tokentracker-cli 0.35.0 → 0.35.2

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.
Files changed (45) hide show
  1. package/dashboard/dist/assets/ActivityHeatmap-Bb0omCiI.js +42 -0
  2. package/dashboard/dist/assets/{Card-BS2ABbwq.js → Card-CtI3QMH6.js} +1 -1
  3. package/dashboard/dist/assets/DashboardPage-jCAhwrGj.js +19 -0
  4. package/dashboard/dist/assets/{DevicePage-BS_MwVUp.js → DevicePage-CyWx9gIK.js} +1 -1
  5. package/dashboard/dist/assets/DialogTitle-C9pIgpxK.js +12 -0
  6. package/dashboard/dist/assets/{FadeIn-DIxWR6-M.js → FadeIn-D1DCy1c9.js} +1 -1
  7. package/dashboard/dist/assets/{HeaderGithubStar-CLeDseVx.js → HeaderGithubStar-D2qhRbZX.js} +1 -1
  8. package/dashboard/dist/assets/{IpCheckPage-BltMdT8r.js → IpCheckPage-B_L_cKmD.js} +1 -1
  9. package/dashboard/dist/assets/{LandingPage-Ckmf_iGO.js → LandingPage-MT2qg0bE.js} +1 -1
  10. package/dashboard/dist/assets/{LeaderboardAvatar-aZZacexT.js → LeaderboardAvatar-BXi46kQk.js} +1 -1
  11. package/dashboard/dist/assets/{LeaderboardPage-Chm7475Z.js → LeaderboardPage-CrhD0iRk.js} +3 -3
  12. package/dashboard/dist/assets/{LeaderboardProfileModal-B9iPWc5O.js → LeaderboardProfileModal-DRylJ_fc.js} +1 -1
  13. package/dashboard/dist/assets/{LeaderboardProfilePage-B268HOjB.js → LeaderboardProfilePage-DfVriPxC.js} +1 -1
  14. package/dashboard/dist/assets/LimitsPage-Ni3_-kEb.js +2 -0
  15. package/dashboard/dist/assets/{LocalOnlyNotice-DFg7yglW.js → LocalOnlyNotice-CQbMwbCe.js} +1 -1
  16. package/dashboard/dist/assets/{LoginPage-DVCpTEii.js → LoginPage-BuLVMfu2.js} +1 -1
  17. package/dashboard/dist/assets/PopoverPopup-BpAU63FH.js +1 -0
  18. package/dashboard/dist/assets/SettingsPage-DX7f066p.js +1 -0
  19. package/dashboard/dist/assets/SkillsPage-BV3LnVvE.js +1 -0
  20. package/dashboard/dist/assets/{WidgetsPage-DnrCBswn.js → WidgetsPage-C-39lx67.js} +1 -1
  21. package/dashboard/dist/assets/{WrappedPage-BXbapLiE.js → WrappedPage-DTDJesAM.js} +1 -1
  22. package/dashboard/dist/assets/{agent-logos-BT_3vfG7.js → agent-logos-BKtVvn2f.js} +1 -1
  23. package/dashboard/dist/assets/{arrow-up-right-U3GN7ZK8.js → arrow-up-right-BjAWXJOu.js} +1 -1
  24. package/dashboard/dist/assets/check-CRcTlhgH.js +1 -0
  25. package/dashboard/dist/assets/{chevron-down-BdbYSxLt.js → chevron-down-D6_2sGG-.js} +1 -1
  26. package/dashboard/dist/assets/{download-Cgae7DJA.js → download-BVdUICgW.js} +1 -1
  27. package/dashboard/dist/assets/{info-lAuE6Iqy.js → info-BUs_fkaX.js} +1 -1
  28. package/dashboard/dist/assets/{main-BJQZ96HP.js → main-BBMM0Tgo.js} +7 -3
  29. package/dashboard/dist/assets/use-limits-display-prefs-BJRhaKEd.js +1 -0
  30. package/dashboard/dist/assets/{use-native-settings-CDAuv4ZG.js → use-native-settings-lyrRoQkg.js} +1 -1
  31. package/dashboard/dist/assets/{use-usage-limits-CvfL47sK.js → use-usage-limits-COFMsRkg.js} +1 -1
  32. package/dashboard/dist/assets/{useCurrency-B562nxEx.js → useCurrency-C3yqfWiI.js} +1 -1
  33. package/dashboard/dist/index.html +1 -1
  34. package/dashboard/dist/share.html +1 -1
  35. package/package.json +1 -1
  36. package/src/lib/pricing/seed-snapshot.json +1 -1
  37. package/dashboard/dist/assets/ActivityHeatmap-_zJmKtP2.js +0 -42
  38. package/dashboard/dist/assets/DashboardPage-DlkR4Y-l.js +0 -19
  39. package/dashboard/dist/assets/DialogTitle-CSNWjYGj.js +0 -12
  40. package/dashboard/dist/assets/LimitsPage-BsLzNCO6.js +0 -2
  41. package/dashboard/dist/assets/PopoverPopup-DzFBEvzq.js +0 -1
  42. package/dashboard/dist/assets/SettingsPage-D2gehORd.js +0 -1
  43. package/dashboard/dist/assets/SkillsPage-CDIbfAxi.js +0 -1
  44. package/dashboard/dist/assets/check-Bdnp5EHR.js +0 -1
  45. package/dashboard/dist/assets/use-limits-display-prefs-BOMVZxxS.js +0 -1
@@ -1,12 +0,0 @@
1
- import{ct as rt,cu as mn,ba as Be,aW as $,j as ne,b_ as _e,r as d,a_ as Z,bX as Wt,aY as A,aX as mt,cv as hn,bd as ht,b4 as je,bn,aV as st,cw as jt,cx as at,b1 as Ee,b$ as it,cy as se,aZ as we,a$ as K,bf as En,c1 as yn,bh as Vt,c9 as bt,cb as Et,cd as vn,cz as Sn,b2 as ee,b as de,b3 as Rn,cA as Bt,bo as Ke,c8 as Tn,cB as Cn,bP as _t,b9 as ae,bT as ze,bS as xn,cC as wn,cD as Q,bM as Xe,c2 as ct,bK as yt,c4 as On,bQ as In,bg as kn,b6 as lt,cE as Kt,cF as Mn,b7 as Yt,cG as le,bb as $t,b8 as We,cH as Pn,cI as Ht,cJ as Gt,cK as vt,a as Ye,br as dt,bk as Fn,bm as Ln,bi as Ie,cL as Ut,bY as qt,bp as Dn,c7 as Nn}from"./main-BJQZ96HP.js";function ye(e,t,n=!0){return e.filter(r=>r.parentId===t&&(!n||r.context?.open)).flatMap(r=>[r,...ye(e,r.id,n)])}function St(e,t){let n=[],o=e.find(r=>r.id===t)?.parentId;for(;o;){const r=e.find(s=>s.id===o);o=r?.parentId,r&&(n=n.concat(r))}return n}function An(e){e.preventDefault(),e.stopPropagation()}function Wn(e){return"nativeEvent"in e}function jn(e){return e.mozInputSource===0&&e.isTrusted?!0:rt&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Vn(e){return mn?!1:!rt&&e.width===0&&e.height===0||rt&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function gr(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function Bn(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function Fe(e){const t=Be(_n,e).current;return t.next=e,$(t.effect),t}function _n(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function zt(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(o=>o(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}class Kn{nodesRef={current:[]};events=zt();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(o=>o===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const Xt=d.createContext(null),Jt=d.createContext(null),$e=()=>d.useContext(Xt)?.id||null,ft=e=>{const t=d.useContext(Jt);return e??t};function mr(e){const t=_e(),n=ft(e),o=$e();return $(()=>{if(!t)return;const r={id:t,parentId:o};return n?.addNode(r),()=>{n?.removeNode(r)}},[n,t,o]),t}function hr(e){const{children:t,id:n}=e,o=$e();return ne.jsx(Xt.Provider,{value:d.useMemo(()=>({id:n,parentId:o}),[n,o]),children:t})}function br(e){const{children:t,externalTree:n}=e,o=Be(()=>n??new Kn).current;return ne.jsx(Jt.Provider,{value:o,children:t})}let Rt=0;function Je(e,t={}){const{preventScroll:n=!1,cancelPrevious:o=!0,sync:r=!1}=t;o&&cancelAnimationFrame(Rt);const s=()=>e?.focus({preventScroll:n});r?s():Rt=requestAnimationFrame(s)}const ve={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function Tt(e){return e==="inert"?ve.inert:e==="aria-hidden"?ve["aria-hidden"]:ve.none}let Le=new WeakSet,De={},Qe=0;const Qt=e=>e&&(e.host||Qt(e.parentNode)),Yn=(e,t)=>t.map(n=>{if(e.contains(n))return n;const o=Qt(n);return e.contains(o)?o:null}).filter(n=>n!=null);function $n(e,t,n,o){const r="data-base-ui-inert",s=o?"inert":n?"aria-hidden":null,u=Yn(t,e),a=new Set,i=new Set(u),l=[];De[r]||(De[r]=new WeakMap);const b=De[r];u.forEach(f),p(t),a.clear();function f(g){!g||a.has(g)||(a.add(g),g.parentNode&&f(g.parentNode))}function p(g){!g||i.has(g)||[].forEach.call(g.children,h=>{if(Wt(h)!=="script")if(a.has(h))p(h);else{const y=s?h.getAttribute(s):null,C=y!==null&&y!=="false",O=Tt(s),v=(O.get(h)||0)+1,R=(b.get(h)||0)+1;O.set(h,v),b.set(h,R),l.push(h),v===1&&C&&Le.add(h),R===1&&h.setAttribute(r,""),!C&&s&&h.setAttribute(s,s==="inert"?"":"true")}})}return Qe+=1,()=>{l.forEach(g=>{const h=Tt(s),C=(h.get(g)||0)-1,O=(b.get(g)||0)-1;h.set(g,C),b.set(g,O),C||(!Le.has(g)&&s&&g.removeAttribute(s),Le.delete(g)),O||g.removeAttribute(r)}),Qe-=1,Qe||(ve.inert=new WeakMap,ve["aria-hidden"]=new WeakMap,ve.none=new WeakMap,Le=new WeakSet,De={})}}function Hn(e,t=!1,n=!1){const o=Z(e[0]).body;return $n(e.concat(Array.from(o.querySelectorAll("[aria-live]"))),o,t,n)}function Gn(e,t){const n=Ke(e.target);return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const Ct=20;let ie=[];function pt(){ie=ie.filter(e=>e.isConnected)}function Un(e){pt(),e&&Wt(e)!=="body"&&(ie.push(e),ie.length>Ct&&(ie=ie.slice(-Ct)))}function Ze(){return pt(),ie[ie.length-1]}function qn(e){if(!e)return null;const t=at();return Bt(e,t)?e:jt(e,t)[0]||e}function zn(e){return!e||!e.isConnected?!1:typeof e.checkVisibility=="function"?e.checkVisibility():_t(e).display!=="none"}function xt(e,t){if(!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const n=at(),r=Cn(e,n).filter(u=>{const a=u.getAttribute("data-tabindex")||"";return Bt(u,n)||u.hasAttribute("data-tabindex")&&!a.startsWith("-")}),s=e.getAttribute("tabindex");t.current.includes("floating")||r.length===0?s!=="0"&&e.setAttribute("tabindex","0"):(s!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Xn(e){const{context:t,children:n,disabled:o=!1,order:r=["content"],initialFocus:s=!0,returnFocus:u=!0,restoreFocus:a=!1,modal:i=!0,closeOnFocusOut:l=!0,openInteractionType:b="",getInsideElements:f=()=>[],nextFocusableElement:p,previousFocusableElement:g,beforeContentFocusGuardRef:h,externalTree:y}=e,C="rootStore"in t?t.rootStore:t,O=C.useState("open"),v=C.useState("domReferenceElement"),R=C.useState("floatingElement"),{events:N,dataRef:F}=C.context,M=A(()=>F.current.floatingContext?.nodeId),B=A(f),L=s===!1,V=mt(v)&&L,W=Fe(r),_=Fe(s),q=Fe(u),Re=Fe(b),G=ft(y),k=hn(),re=d.useRef(null),He=d.useRef(null),Y=d.useRef(!1),oe=d.useRef(!1),fe=d.useRef(!1),ke=d.useRef(-1),pe=d.useRef(""),J=d.useRef(""),Te=d.useRef(null),ce=d.useRef(null),Ge=ht(Te,h,k?.beforeInsideRef),Ce=ht(ce,k?.afterInsideRef),ge=je(),ue=je(),me=bn(),he=k!=null,c=st(R),w=A((m=c)=>m?jt(m,at()):[]),E=A(m=>{const T=w(m);return W.current.map(()=>T).filter(Boolean).flat()});d.useEffect(()=>{if(o||!i)return;function m(I){I.key==="Tab"&&K(c,we(Z(c)))&&w().length===0&&!V&&An(I)}const T=Z(c);return T.addEventListener("keydown",m),()=>{T.removeEventListener("keydown",m)}},[o,v,c,i,W,V,w,E]),d.useEffect(()=>{if(o||!R)return;function m(T){const I=ee(T),j=w().indexOf(I);j!==-1&&(ke.current=j)}return R.addEventListener("focusin",m),()=>{R.removeEventListener("focusin",m)}},[o,R,w]),d.useEffect(()=>{if(o||!O)return;const m=Z(c);function T(){fe.current=!1}function I(j){const x=ee(j),S=K(R,x)||K(v,x)||K(k?.portalNode,x);fe.current=!S,J.current=j.pointerType||"keyboard"}function D(){J.current="keyboard"}return m.addEventListener("pointerdown",I,!0),m.addEventListener("pointerup",T,!0),m.addEventListener("pointercancel",T,!0),m.addEventListener("keydown",D,!0),()=>{m.removeEventListener("pointerdown",I,!0),m.removeEventListener("pointerup",T,!0),m.removeEventListener("pointercancel",T,!0),m.removeEventListener("keydown",D,!0)}},[o,R,v,c,O,k]),d.useEffect(()=>{if(o||!l)return;function m(){oe.current=!0,ue.start(0,()=>{oe.current=!1})}function T(x){const S=x.relatedTarget,z=x.currentTarget,U=ee(x);queueMicrotask(()=>{const be=M(),Me=C.context.triggerElements,Ue=S?.hasAttribute(it("focus-guard"))&&[Te.current,ce.current,k?.beforeInsideRef.current,k?.afterInsideRef.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,se(g),se(p)].includes(S),qe=!(K(v,S)||K(R,S)||K(S,R)||K(k?.portalNode,S)||S!=null&&Me.hasElement(S)||Me.hasMatchingElement(X=>K(X,S))||Ue||G&&(ye(G.nodesRef.current,be).find(X=>K(X.context?.elements.floating,S)||K(X.context?.elements.domReference,S))||St(G.nodesRef.current,be).find(X=>[X.context?.elements.floating,st(X.context?.elements.floating)].includes(S)||X.context?.elements.domReference===S)));if(z===v&&c&&xt(c,W),a&&z!==v&&!zn(U)&&we(Z(c))===Z(c).body){if(Ee(c)&&(c.focus(),a==="popup")){me.request(()=>{c.focus()});return}const X=ke.current,xe=w(),Pe=xe[X]||xe[xe.length-1]||c;Ee(Pe)&&Pe.focus()}if(F.current.insideReactTree){F.current.insideReactTree=!1;return}(V||!i)&&S&&qe&&!oe.current&&(V||S!==Ze())&&(Y.current=!0,C.setOpen(!1,de(Rn,x)))})}function I(){fe.current||(F.current.insideReactTree=!0,ge.start(0,()=>{F.current.insideReactTree=!1}))}const D=Ee(v)?v:null,j=[];if(!(!R&&!D))return D&&(D.addEventListener("focusout",T),D.addEventListener("pointerdown",m),j.push(()=>{D.removeEventListener("focusout",T),D.removeEventListener("pointerdown",m)})),R&&(R.addEventListener("focusout",T),k&&(R.addEventListener("focusout",I,!0),j.push(()=>{R.removeEventListener("focusout",I,!0)})),j.push(()=>{R.removeEventListener("focusout",T)})),()=>{j.forEach(x=>{x()})}},[o,v,R,c,i,G,k,C,l,a,w,V,M,W,F,ge,ue,me,p,g]),d.useEffect(()=>{if(o||!R||!O)return;const m=Array.from(k?.portalNode?.querySelectorAll(`[${it("portal")}]`)||[]),I=(G?St(G.nodesRef.current,M()):[]).find(x=>mt(x.context?.elements.domReference||null))?.context?.elements.domReference,D=[R,I,...m,...B(),re.current,He.current,Te.current,ce.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,se(g),se(p),V?v:null].filter(x=>x!=null),j=Hn(D,i||V);return()=>{j()}},[O,o,v,R,i,W,k,V,G,M,B,p,g]),$(()=>{if(!O||o||!Ee(c))return;const m=Z(c),T=we(m);queueMicrotask(()=>{const I=E(c),D=_.current,j=typeof D=="function"?D(Re.current||""):D;if(j===void 0||j===!1)return;let x;j===!0||j===null?x=I[0]||c:x=se(j),x=x||I[0]||c,!K(c,T)&&Je(x,{preventScroll:x===c})})},[o,O,c,L,E,_,Re]),$(()=>{if(o||!c)return;const m=Z(c),T=we(m);Un(T);function I(x){if(x.open||(pe.current=Gn(x.nativeEvent,J.current)),x.reason===yn&&x.nativeEvent.type==="mouseleave"&&(Y.current=!0),x.reason===Vt)if(x.nested)Y.current=!1;else if(jn(x.nativeEvent)||Vn(x.nativeEvent))Y.current=!1;else{let S=!1;document.createElement("div").focus({get preventScroll(){return S=!0,!1}}),S?Y.current=!1:Y.current=!0}}N.on("openchange",I);const D=m.createElement("span");D.setAttribute("tabindex","-1"),D.setAttribute("aria-hidden","true"),Object.assign(D.style,En),he&&v&&v.insertAdjacentElement("afterend",D);function j(){const x=q.current;let S=typeof x=="function"?x(pe.current):x;if(S===void 0||S===!1)return null;if(S===null&&(S=!0),typeof S=="boolean"){const U=v||Ze();return U&&U.isConnected?U:D}const z=v||Ze()||D;return se(S)||z}return()=>{N.off("openchange",I);const x=we(m),S=K(R,x)||G&&ye(G.nodesRef.current,M(),!1).some(U=>K(U.context?.elements.floating,x)),z=j();queueMicrotask(()=>{const U=qn(z),be=typeof q.current!="boolean";q.current&&!Y.current&&Ee(U)&&(!(!be&&U!==x&&x!==m.body)||S)&&U.focus({preventScroll:!0}),D.remove()})}},[o,R,c,q,F,N,G,he,v,M]),d.useEffect(()=>{queueMicrotask(()=>{Y.current=!1})},[o]),d.useEffect(()=>{if(o||!O)return;function m(I){ee(I)?.closest(`[${Tn}]`)&&(oe.current=!0)}const T=Z(c);return T.addEventListener("pointerdown",m,!0),()=>{T.removeEventListener("pointerdown",m,!0)}},[o,O,c]),$(()=>{if(!o&&k)return k.setFocusManagerState({modal:i,closeOnFocusOut:l,open:O,onOpenChange:C.setOpen,domReference:v}),()=>{k.setFocusManagerState(null)}},[o,k,i,O,C,l,v]),$(()=>{if(!(o||!c))return xt(c,W),()=>{queueMicrotask(pt)}},[o,c,W]);const H=!o&&(i?!V:!0)&&(he||i);return ne.jsxs(d.Fragment,{children:[H&&ne.jsx(bt,{"data-type":"inside",ref:Ge,onFocus:m=>{if(i){const T=E();Je(T[T.length-1])}else k?.portalNode&&(Y.current=!1,Et(m,k.portalNode)?vn(v)?.focus():se(g??k.beforeOutsideRef)?.focus())}}),n,H&&ne.jsx(bt,{"data-type":"inside",ref:Ce,onFocus:m=>{i?Je(E()[0]):k?.portalNode&&(l&&(Y.current=!0),Et(m,k.portalNode)?Sn(v)?.focus():se(p??k.afterOutsideRef)?.focus())}})]})}const Jn={intentional:"onClick",sloppy:"onPointerDown"};function Qn(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function Zn(e,t={}){const n="rootStore"in e?e.rootStore:e,o=n.useState("open"),r=n.useState("floatingElement"),s=n.useState("referenceElement"),u=n.useState("domReferenceElement"),{onOpenChange:a,dataRef:i}=n.context,{enabled:l=!0,escapeKey:b=!0,outsidePress:f=!0,outsidePressEvent:p="sloppy",referencePress:g=!1,referencePressEvent:h="sloppy",ancestorScroll:y=!1,bubbles:C,externalTree:O}=t,v=ft(O),R=A(typeof f=="function"?f:()=>!1),N=typeof f=="function"?R:f,F=d.useRef(!1),{escapeKey:M,outsidePress:B}=Qn(C),L=d.useRef(null),V=je(),W=je(),_=A(()=>{W.clear(),i.current.insideReactTree=!1}),q=d.useRef(!1),Re=d.useRef(""),G=A(c=>{Re.current=c.pointerType}),k=A(()=>{const c=Re.current,w=c==="pen"||!c?"mouse":c,E=typeof p=="function"?p():p;return typeof E=="string"?E:E[w]}),re=A(c=>{if(!o||!l||!b||c.key!=="Escape"||q.current)return;const w=i.current.floatingContext?.nodeId,E=v?ye(v.nodesRef.current,w):[];if(!M&&E.length>0){let T=!0;if(E.forEach(I=>{I.context?.open&&!I.context.dataRef.current.__escapeKeyBubbles&&(T=!1)}),!T)return}const H=Wn(c)?c.nativeEvent:c,m=de(On,H);n.setOpen(!1,m),!M&&!m.isPropagationAllowed&&c.stopPropagation()}),He=A(c=>{const w=k();return w==="intentional"&&c.type!=="click"||w==="sloppy"&&c.type==="click"}),Y=A(()=>{i.current.insideReactTree=!0,W.start(0,_)}),oe=A((c,w=!1)=>{if(He(c)){_();return}if(i.current.insideReactTree){_();return}if(k()==="intentional"&&w||typeof N=="function"&&!N(c))return;const E=ee(c),H=`[${it("inert")}]`,m=Z(n.select("floatingElement")).querySelectorAll(H),T=n.context.triggerElements;if(E&&(T.hasElement(E)||T.hasMatchingElement(S=>K(S,E))))return;let I=ae(E)?E:null;for(;I&&!ze(I);){const S=xn(I);if(ze(S)||!ae(S))break;I=S}if(m.length&&ae(E)&&!wn(E)&&!K(E,n.select("floatingElement"))&&Array.from(m).every(S=>!K(I,S)))return;if(Ee(E)&&!("touches"in c)){const S=ze(E),z=_t(E),U=/auto|scroll/,be=S||U.test(z.overflowX),Me=S||U.test(z.overflowY),Ue=be&&E.clientWidth>0&&E.scrollWidth>E.clientWidth,qe=Me&&E.clientHeight>0&&E.scrollHeight>E.clientHeight,X=z.direction==="rtl",xe=qe&&(X?c.offsetX<=E.offsetWidth-E.clientWidth:c.offsetX>E.clientWidth),Pe=Ue&&c.offsetY>E.clientHeight;if(xe||Pe)return}const D=i.current.floatingContext?.nodeId,j=v&&ye(v.nodesRef.current,D).some(S=>Q(c,S.context?.elements.floating));if(Q(c,n.select("floatingElement"))||Q(c,n.select("domReferenceElement"))||j)return;const x=v?ye(v.nodesRef.current,D):[];if(x.length>0){let S=!0;if(x.forEach(z=>{z.context?.open&&!z.context.dataRef.current.__outsidePressBubbles&&(S=!1)}),!S)return}n.setOpen(!1,de(Vt,c)),_()}),fe=A(c=>{k()!=="sloppy"||c.pointerType==="touch"||!n.select("open")||!l||Q(c,n.select("floatingElement"))||Q(c,n.select("domReferenceElement"))||oe(c)}),ke=A(c=>{if(k()!=="sloppy"||!n.select("open")||!l||Q(c,n.select("floatingElement"))||Q(c,n.select("domReferenceElement")))return;const w=c.touches[0];w&&(L.current={startTime:Date.now(),startX:w.clientX,startY:w.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},V.start(1e3,()=>{L.current&&(L.current.dismissOnTouchEnd=!1,L.current.dismissOnMouseDown=!1)}))}),pe=A(c=>{const w=ee(c);function E(){ke(c),w?.removeEventListener(c.type,E)}w?.addEventListener(c.type,E)}),J=A(c=>{const w=F.current;if(F.current=!1,V.clear(),c.type==="mousedown"&&L.current&&!L.current.dismissOnMouseDown)return;const E=ee(c);function H(){c.type==="pointerdown"?fe(c):oe(c,w),E?.removeEventListener(c.type,H)}E?.addEventListener(c.type,H)}),Te=A(c=>{if(k()!=="sloppy"||!L.current||Q(c,n.select("floatingElement"))||Q(c,n.select("domReferenceElement")))return;const w=c.touches[0];if(!w)return;const E=Math.abs(w.clientX-L.current.startX),H=Math.abs(w.clientY-L.current.startY),m=Math.sqrt(E*E+H*H);m>5&&(L.current.dismissOnTouchEnd=!0),m>10&&(oe(c),V.clear(),L.current=null)}),ce=A(c=>{const w=ee(c);function E(){Te(c),w?.removeEventListener(c.type,E)}w?.addEventListener(c.type,E)}),Ge=A(c=>{k()!=="sloppy"||!L.current||Q(c,n.select("floatingElement"))||Q(c,n.select("domReferenceElement"))||(L.current.dismissOnTouchEnd&&oe(c),V.clear(),L.current=null)}),Ce=A(c=>{const w=ee(c);function E(){Ge(c),w?.removeEventListener(c.type,E)}w?.addEventListener(c.type,E)});d.useEffect(()=>{if(!o||!l)return;i.current.__escapeKeyBubbles=M,i.current.__outsidePressBubbles=B;const c=new ct;function w(I){n.setOpen(!1,de(kn,I))}function E(){c.clear(),q.current=!0}function H(){c.start(In()?5:0,()=>{q.current=!1})}const m=Z(r);m.addEventListener("pointerdown",G,!0),b&&(m.addEventListener("keydown",re),m.addEventListener("compositionstart",E),m.addEventListener("compositionend",H)),N&&(m.addEventListener("click",J,!0),m.addEventListener("pointerdown",J,!0),m.addEventListener("touchstart",pe,!0),m.addEventListener("touchmove",ce,!0),m.addEventListener("touchend",Ce,!0),m.addEventListener("mousedown",J,!0));let T=[];return y&&(ae(u)&&(T=Xe(u)),ae(r)&&(T=T.concat(Xe(r))),!ae(s)&&s&&s.contextElement&&(T=T.concat(Xe(s.contextElement)))),T=T.filter(I=>I!==m.defaultView?.visualViewport),T.forEach(I=>{I.addEventListener("scroll",w,{passive:!0})}),()=>{m.removeEventListener("pointerdown",G,!0),b&&(m.removeEventListener("keydown",re),m.removeEventListener("compositionstart",E),m.removeEventListener("compositionend",H)),N&&(m.removeEventListener("click",J,!0),m.removeEventListener("pointerdown",J,!0),m.removeEventListener("touchstart",pe,!0),m.removeEventListener("touchmove",ce,!0),m.removeEventListener("touchend",Ce,!0),m.removeEventListener("mousedown",J,!0)),T.forEach(I=>{I.removeEventListener("scroll",w)}),c.clear(),F.current=!1}},[i,r,s,u,b,N,o,a,y,l,M,B,re,oe,J,fe,pe,ce,Ce,G,n]),d.useEffect(_,[N,_]);const ge=d.useMemo(()=>({onKeyDown:re,...g&&{[Jn[h]]:c=>{n.setOpen(!1,de(yt,c.nativeEvent))},...h!=="intentional"&&{onClick(c){n.setOpen(!1,de(yt,c.nativeEvent))}}}}),[re,n,g,h]),ue=A(c=>{const w=ee(c.nativeEvent);!K(n.select("floatingElement"),w)||c.button!==0||(F.current=!0)}),me=A(c=>{!o||!l||c.button!==0||(F.current=!0)}),he=d.useMemo(()=>({onKeyDown:re,onPointerDown:ue,onMouseDown:ue,onMouseUp:ue,onClickCapture:Y,onMouseDownCapture(c){Y(),me(c)},onPointerDownCapture(c){Y(),me(c)},onMouseUpCapture:Y,onTouchEndCapture:Y,onTouchMoveCapture:Y}),[re,ue,Y,me]);return d.useMemo(()=>l?{reference:ge,floating:he,trigger:ge}:{},[l,ge,he])}var Ve=Symbol("NOT_FOUND");function eo(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function to(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function no(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(o=>typeof o=="function"?`function ${o.name||"unnamed"}()`:typeof o).join(", ");throw new TypeError(`${t}[${n}]`)}}var wt=e=>Array.isArray(e)?e:[e];function oo(e){const t=Array.isArray(e[0])?e[0]:e;return no(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function ro(e,t){const n=[],{length:o}=e;for(let r=0;r<o;r++)n.push(e[r].apply(null,t));return n}function so(e){let t;return{get(n){return t&&e(t.key,n)?t.value:Ve},put(n,o){t={key:n,value:o}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function io(e,t){let n=[];function o(a){const i=n.findIndex(l=>t(a,l.key));if(i>-1){const l=n[i];return i>0&&(n.splice(i,1),n.unshift(l)),l.value}return Ve}function r(a,i){o(a)===Ve&&(n.unshift({key:a,value:i}),n.length>e&&n.pop())}function s(){return n}function u(){n=[]}return{get:o,put:r,getEntries:s,clear:u}}var co=(e,t)=>e===t;function uo(e){return function(n,o){if(n===null||o===null||n.length!==o.length)return!1;const{length:r}=n;for(let s=0;s<r;s++)if(!e(n[s],o[s]))return!1;return!0}}function ao(e,t){const n=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:o=co,maxSize:r=1,resultEqualityCheck:s}=n,u=uo(o);let a=0;const i=r<=1?so(u):io(r,u);function l(){let b=i.get(arguments);if(b===Ve){if(b=e.apply(null,arguments),a++,s){const p=i.getEntries().find(g=>s(g.value,b));p&&(b=p.value,a!==0&&a--)}i.put(arguments,b)}return b}return l.clearCache=()=>{i.clear(),l.resetResultsCount()},l.resultsCount=()=>a,l.resetResultsCount=()=>{a=0},l}var lo=class{constructor(e){this.value=e}deref(){return this.value}},fo=typeof WeakRef<"u"?WeakRef:lo,po=0,Ot=1;function Ne(){return{s:po,v:void 0,o:null,p:null}}function Zt(e,t={}){let n=Ne();const{resultEqualityCheck:o}=t;let r,s=0;function u(){let a=n;const{length:i}=arguments;for(let f=0,p=i;f<p;f++){const g=arguments[f];if(typeof g=="function"||typeof g=="object"&&g!==null){let h=a.o;h===null&&(a.o=h=new WeakMap);const y=h.get(g);y===void 0?(a=Ne(),h.set(g,a)):a=y}else{let h=a.p;h===null&&(a.p=h=new Map);const y=h.get(g);y===void 0?(a=Ne(),h.set(g,a)):a=y}}const l=a;let b;if(a.s===Ot)b=a.v;else if(b=e.apply(null,arguments),s++,o){const f=r?.deref?.()??r;f!=null&&o(f,b)&&(b=f,s!==0&&s--),r=typeof b=="object"&&b!==null||typeof b=="function"?new fo(b):b}return l.s=Ot,l.v=b,b}return u.clearCache=()=>{n=Ne(),u.resetResultsCount()},u.resultsCount=()=>s,u.resetResultsCount=()=>{s=0},u}function en(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,o=(...r)=>{let s=0,u=0,a,i={},l=r.pop();typeof l=="object"&&(i=l,l=r.pop()),eo(l,`createSelector expects an output function after the inputs, but received: [${typeof l}]`);const b={...n,...i},{memoize:f,memoizeOptions:p=[],argsMemoize:g=Zt,argsMemoizeOptions:h=[]}=b,y=wt(p),C=wt(h),O=oo(r),v=f(function(){return s++,l.apply(null,arguments)},...y),R=g(function(){u++;const F=ro(O,arguments);return a=v.apply(null,F),a},...C);return Object.assign(R,{resultFunc:l,memoizedResultFunc:v,dependencies:O,dependencyRecomputations:()=>u,resetDependencyRecomputations:()=>{u=0},lastResult:()=>a,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:f,argsMemoize:g})};return Object.assign(o,{withTypes:()=>o}),o}var go=en(Zt),mo=Object.assign((e,t=go)=>{to(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),o=n.map(s=>e[s]);return t(o,(...s)=>s.reduce((u,a,i)=>(u[n[i]]=a,u),{}))},{withTypes:()=>mo});en({memoize:ao,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});const P=(e,t,n,o,r,s,...u)=>{if(u.length>0)throw new Error(lt(1));let a;if(e)a=e;else throw new Error("Missing arguments");return a};var et={exports:{}},tt={};var It;function ho(){if(It)return tt;It=1;var e=Kt();function t(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var n=typeof Object.is=="function"?Object.is:t,o=e.useState,r=e.useEffect,s=e.useLayoutEffect,u=e.useDebugValue;function a(f,p){var g=p(),h=o({inst:{value:g,getSnapshot:p}}),y=h[0].inst,C=h[1];return s(function(){y.value=g,y.getSnapshot=p,i(y)&&C({inst:y})},[f,g,p]),r(function(){return i(y)&&C({inst:y}),f(function(){i(y)&&C({inst:y})})},[f]),u(g),g}function i(f){var p=f.getSnapshot;f=f.value;try{var g=p();return!n(f,g)}catch{return!0}}function l(f,p){return p()}var b=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:a;return tt.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:b,tt}var kt;function tn(){return kt||(kt=1,et.exports=ho()),et.exports}var bo=tn(),nt={exports:{}},ot={};var Mt;function Eo(){if(Mt)return ot;Mt=1;var e=Kt(),t=tn();function n(l,b){return l===b&&(l!==0||1/l===1/b)||l!==l&&b!==b}var o=typeof Object.is=="function"?Object.is:n,r=t.useSyncExternalStore,s=e.useRef,u=e.useEffect,a=e.useMemo,i=e.useDebugValue;return ot.useSyncExternalStoreWithSelector=function(l,b,f,p,g){var h=s(null);if(h.current===null){var y={hasValue:!1,value:null};h.current=y}else y=h.current;h=a(function(){function O(M){if(!v){if(v=!0,R=M,M=p(M),g!==void 0&&y.hasValue){var B=y.value;if(g(B,M))return N=B}return N=M}if(B=N,o(R,M))return B;var L=p(M);return g!==void 0&&g(B,L)?(R=M,B):(R=M,N=L)}var v=!1,R,N,F=f===void 0?null:f;return[function(){return O(b())},F===null?void 0:function(){return O(F())}]},[b,f,p,g]);var C=r(l,h[0],h[1]);return u(function(){y.hasValue=!0,y.value=C},[C]),i(C),C},ot}var Pt;function yo(){return Pt||(Pt=1,nt.exports=Eo()),nt.exports}var vo=yo();const So=Mn(19),Ro=So?Co:xo;function To(e,t,n,o,r){return Ro(e,t,n,o,r)}function Co(e,t,n,o,r){const s=d.useCallback(()=>t(e.getSnapshot(),n,o,r),[e,t,n,o,r]);return bo.useSyncExternalStore(e.subscribe,s,s)}function xo(e,t,n,o,r){return vo.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,s=>t(s,n,o,r))}class Oe{constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const o of this.listeners){if(n!==this.updateTick)return;o(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){Oe.prototype.setState.call(this,{...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||Oe.prototype.setState.call(this,{...this.state,[t]:n})}notifyAll(){const t={...this.state};Oe.prototype.setState.call(this,t)}}class nn extends Oe{constructor(t,n={},o){super(t),this.context=n,this.selectors=o}controlledValues=new Map;useSyncedValue(t,n){d.useDebugValue(t),$(()=>{this.state[t]!==n&&this.set(t,n)},[t,n])}useSyncedValueWithCleanup(t,n){const o=this;$(()=>(o.state[t]!==n&&o.set(t,n),()=>{o.set(t,void 0)}),[o,t,n])}useSyncedValues(t){const n=this,o=Object.values(t);$(()=>{n.update(t)},[n,...o])}useControlledProp(t,n,o){d.useDebugValue(t);const r=this,s=n!==void 0;this.controlledValues.has(t)||(this.controlledValues.set(t,s),!s&&!Object.is(this.state[t],o)&&super.setState({...this.state,[t]:o})),$(()=>{s&&!Object.is(r.state[t],n)&&super.setState({...r.state,[t]:n})},[r,t,n,o,s])}set(t,n){this.controlledValues.get(t)!==!0&&super.set(t,n)}update(t){const n={...t};for(const o in n)if(Object.hasOwn(n,o)&&this.controlledValues.get(o)===!0){delete n[o];continue}super.update(n)}setState(t){const n={...t};for(const o in n)if(Object.hasOwn(n,o)&&this.controlledValues.get(o)===!0){delete n[o];continue}super.setState({...this.state,...n})}select=(t,n,o,r)=>{const s=this.selectors[t];return s(this.state,n,o,r)};useState=(t,n,o,r)=>{d.useDebugValue(t);const s=this.selectors[t];return To(this,s,n,o,r)};useContextCallback(t,n){d.useDebugValue(t);const o=A(n??Yt);this.context[t]=o}useStateSetter(t){const n=d.useRef(void 0);return n.current===void 0&&(n.current=o=>{this.set(t,o)}),n.current}observe(t,n){let o;typeof t=="function"?o=t:o=this.selectors[t];let r=o(this.state);return n(r,r,this),this.subscribe(s=>{const u=o(s);if(!Object.is(r,u)){const a=r;r=u,n(u,a,this)}})}}const wo={open:P(e=>e.open),domReferenceElement:P(e=>e.domReferenceElement),referenceElement:P(e=>e.positionReference??e.referenceElement),floatingElement:P(e=>e.floatingElement),floatingId:P(e=>e.floatingId)};class on extends nn{constructor(t){const{nested:n,noEmit:o,onOpenChange:r,triggerElements:s,...u}=t;super({...u,positionReference:u.referenceElement,domReferenceElement:u.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:zt(),nested:n,noEmit:o,triggerElements:s},wo)}setOpen=(t,n)=>{if((!t||!this.state.open||Bn(n.event))&&(this.context.dataRef.current.openEvent=t?n.event:void 0),!this.context.noEmit){const o={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",o)}this.context.onOpenChange?.(t,n)}}function Oo(e,t=!1,n=!1){const[o,r]=d.useState(e&&t?"idle":void 0),[s,u]=d.useState(e);return e&&!s&&(u(!0),r("starting")),!e&&s&&o!=="ending"&&!n&&r("ending"),!e&&!s&&o==="ending"&&r(void 0),$(()=>{if(!e&&s&&o!=="ending"&&n){const a=le.request(()=>{r("ending")});return()=>{le.cancel(a)}}},[e,s,o,n]),$(()=>{if(!e||t)return;const a=le.request(()=>{r(void 0)});return()=>{le.cancel(a)}},[t,e]),$(()=>{if(!e||!t)return;e&&s&&o!=="idle"&&r("starting");const a=le.request(()=>{r("idle")});return()=>{le.cancel(a)}},[t,e,s,r,o]),d.useMemo(()=>({mounted:s,setMounted:u,transitionStatus:o}),[s,o])}function Io(e,t){const n=d.useRef(null),o=d.useRef(null);return d.useCallback(r=>{if(e!==void 0){if(n.current!==null){const s=n.current,u=o.current,a=t.context.triggerElements.getById(s);u&&a===u&&t.context.triggerElements.delete(s),n.current=null,o.current=null}r!==null&&(n.current=e,o.current=r,t.context.triggerElements.add(e,r))}},[t,e])}function Er(e,t,n,o){const r=n.useState("isMountedByTrigger",e),s=Io(e,n),u=A(a=>{if(s(a),!a||!n.select("open"))return;const i=n.select("activeTriggerId");if(i===e){n.update({activeTriggerElement:a,...o});return}i==null&&n.update({activeTriggerId:e,activeTriggerElement:a,...o})});return $(()=>{r&&n.update({activeTriggerElement:t.current,...o})},[r,n,t,...Object.values(o)]),{registerTrigger:u,isMountedByThisTrigger:r}}function ko(e){const t=e.useState("open");$(()=>{if(t&&!e.select("activeTriggerId")&&e.context.triggerElements.size===1){const n=e.context.triggerElements.entries().next();if(!n.done){const[o,r]=n.value;e.update({activeTriggerId:o,activeTriggerElement:r})}}},[t,e])}function Mo(e,t,n){const{mounted:o,setMounted:r,transitionStatus:s}=Oo(e);t.useSyncedValues({mounted:o,transitionStatus:s});const u=A(()=>{r(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}),a=t.useState("preventUnmountingOnClose");return $t({enabled:!a,open:e,ref:t.context.popupRef,onComplete(){e||u()}}),{forceUnmount:u,transitionStatus:s}}class rn{constructor(){this.elements=new Set,this.idMap=new Map}add(t,n){const o=this.idMap.get(t);o!==n&&(o!==void 0&&this.elements.delete(o),this.elements.add(n),this.idMap.set(t,n))}delete(t){const n=this.idMap.get(t);n&&(this.elements.delete(n),this.idMap.delete(t))}hasElement(t){return this.elements.has(t)}hasMatchingElement(t){for(const n of this.elements)if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}get size(){return this.idMap.size}}function Po(){return new on({open:!1,floatingElement:null,referenceElement:null,triggerElements:new rn,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function Fo(){return{open:!1,mounted:!1,transitionStatus:"idle",floatingRootContext:Po(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,popupElement:null,positionerElement:null,activeTriggerProps:We,inactiveTriggerProps:We,popupProps:We}}const Lo={open:P(e=>e.open),mounted:P(e=>e.mounted),transitionStatus:P(e=>e.transitionStatus),floatingRootContext:P(e=>e.floatingRootContext),preventUnmountingOnClose:P(e=>e.preventUnmountingOnClose),payload:P(e=>e.payload),activeTriggerId:P(e=>e.activeTriggerId),activeTriggerElement:P(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:P((e,t)=>t!==void 0&&e.activeTriggerId===t),isOpenedByTrigger:P((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.open),isMountedByTrigger:P((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.mounted),triggerProps:P((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:P(e=>e.popupProps),popupElement:P(e=>e.popupElement),positionerElement:P(e=>e.positionerElement)};function Do(e){const{popupStore:t,noEmit:n=!1,treatPopupAsFloatingElement:o=!1,onOpenChange:r}=e,s=_e(),u=$e()!=null,a=t.useState("open"),i=t.useState("activeTriggerElement"),l=t.useState(o?"popupElement":"positionerElement"),b=t.context.triggerElements,f=Be(()=>new on({open:a,referenceElement:i,floatingElement:l,triggerElements:b,onOpenChange:r,floatingId:s,nested:u,noEmit:n})).current;return $(()=>{const p={open:a,floatingId:s,referenceElement:i,floatingElement:l};ae(i)&&(p.domReferenceElement=i),f.state.positionReference===f.state.referenceElement&&(p.positionReference=i),f.update(p)},[a,s,i,l,f]),f.context.onOpenChange=r,f.context.nested=u,f.context.noEmit=n,f}function No(e=[]){const t=e.map(l=>l?.reference),n=e.map(l=>l?.floating),o=e.map(l=>l?.item),r=e.map(l=>l?.trigger),s=d.useCallback(l=>Ae(l,e,"reference"),t),u=d.useCallback(l=>Ae(l,e,"floating"),n),a=d.useCallback(l=>Ae(l,e,"item"),o),i=d.useCallback(l=>Ae(l,e,"trigger"),r);return d.useMemo(()=>({getReferenceProps:s,getFloatingProps:u,getItemProps:a,getTriggerProps:i}),[s,u,a,i])}function Ae(e,t,n){const o=new Map,r=n==="item",s={};n==="floating"&&(s.tabIndex=-1,s[Pn]="");for(const u in e)r&&e&&(u===Ht||u===Gt)||(s[u]=e[u]);for(let u=0;u<t.length;u+=1){let a;const i=t[u]?.[n];typeof i=="function"?a=e?i(e):null:a=i,a&&Ft(s,a,r,o)}return Ft(s,e,r,o),s}function Ft(e,t,n,o){for(const r in t){const s=t[r];n&&(r===Ht||r===Gt)||(r.startsWith("on")?(o.has(r)||o.set(r,[]),typeof s=="function"&&(o.get(r)?.push(s),e[r]=(...u)=>o.get(r)?.map(a=>a(...u)).find(a=>a!==void 0))):e[r]=s)}}const Ao=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Wo(e,t={}){const n="rootStore"in e?e.rootStore:e,o=n.useState("open"),r=n.useState("floatingId"),s=n.useState("domReferenceElement"),u=n.useState("floatingElement"),{enabled:a=!0,role:i="dialog"}=t,l=_e(),b=s?.id||l,f=d.useMemo(()=>st(u)?.id||r,[u,r]),p=Ao.get(i)??i,h=$e()!=null,y=d.useMemo(()=>p==="tooltip"||i==="label"?We:{"aria-haspopup":p==="alertdialog"?"dialog":p,"aria-expanded":"false",...p==="listbox"&&{role:"combobox"},...p==="menu"&&h&&{role:"menuitem"},...i==="select"&&{"aria-autocomplete":"none"},...i==="combobox"&&{"aria-autocomplete":"list"}},[p,h,i]),C=d.useMemo(()=>p==="tooltip"||i==="label"?{[`aria-${i==="label"?"labelledby":"describedby"}`]:o?f:void 0}:{...y,"aria-expanded":o?"true":"false","aria-controls":o?f:void 0,...p==="menu"&&{id:b}},[p,f,o,b,i,y]),O=d.useMemo(()=>{const R={id:f,...p&&{role:p}};return p==="tooltip"||i==="label"?R:{...R,...p==="menu"&&{"aria-labelledby":b}}},[p,f,b,i]),v=d.useCallback(({active:R,selected:N})=>{const F={role:"option",...R&&{id:`${f}-fui-option`}};switch(i){case"select":case"combobox":return{...F,"aria-selected":N}}return{}},[f,i]);return d.useMemo(()=>a?{reference:C,floating:O,item:v,trigger:y}:{},[a,C,O,y,v])}let te=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=vt.startingStyle]="startingStyle",e[e.endingStyle=vt.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e})({}),ut=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const jo={[ut.popupOpen]:""},Vo={[ut.popupOpen]:"",[ut.pressed]:""},Bo={[te.open]:""},_o={[te.closed]:""},Ko={[te.anchorHidden]:""},yr={open(e){return e?jo:null}},vr={open(e){return e?Vo:null}},gt={open(e){return e?Bo:_o},anchorHidden(e){return e?Ko:null}},sn=d.createContext(void 0);function Se(e){const t=d.useContext(sn);if(e===!1&&t===void 0)throw new Error(lt(27));return t}const Yo={...gt,...dt},Sr=d.forwardRef(function(t,n){const{render:o,className:r,forceRender:s=!1,...u}=t,{store:a}=Se(),i=a.useState("open"),l=a.useState("nested"),b=a.useState("mounted"),f=a.useState("transitionStatus"),p=d.useMemo(()=>({open:i,transitionStatus:f}),[i,f]);return Ye("div",t,{state:p,ref:[a.context.backdropRef,n],stateAttributesMapping:Yo,props:[{role:"presentation",hidden:!b,style:{userSelect:"none",WebkitUserSelect:"none"}},u],enabled:s||!l})});function $o(e){return _e(e,"base-ui")}let Ho=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),Go=(function(e){return e[e.open=te.open]="open",e[e.closed=te.closed]="closed",e[e.startingStyle=te.startingStyle]="startingStyle",e[e.endingStyle=te.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const cn=d.createContext(void 0);function un(){const e=d.useContext(cn);if(e===void 0)throw new Error(lt(26));return e}const an="ArrowUp",ln="ArrowDown",dn="ArrowLeft",fn="ArrowRight",pn="Home",gn="End",Uo=new Set([dn,fn]),qo=new Set([an,ln]),zo=new Set([...Uo,...qo]);[...zo];const Xo=new Set([an,ln,dn,fn,pn,gn]),Jo={...gt,...dt,nestedDialogOpen(e){return e?{[Go.nestedDialogOpen]:""}:null}},Rr=d.forwardRef(function(t,n){const{className:o,finalFocus:r,initialFocus:s,render:u,...a}=t,{store:i}=Se(),l=i.useState("descriptionElementId"),b=i.useState("disablePointerDismissal"),f=i.useState("floatingRootContext"),p=i.useState("popupProps"),g=i.useState("modal"),h=i.useState("mounted"),y=i.useState("nested"),C=i.useState("nestedOpenDialogCount"),O=i.useState("open"),v=i.useState("openMethod"),R=i.useState("titleElementId"),N=i.useState("transitionStatus"),F=i.useState("role");un(),$t({open:O,ref:i.context.popupRef,onComplete(){O&&i.context.onOpenChangeComplete?.(!0)}});function M(_){return _==="touch"?i.context.popupRef.current:!0}const B=s===void 0?M:s,L=C>0,V=d.useMemo(()=>({open:O,nested:y,transitionStatus:N,nestedDialogOpen:L}),[O,y,N,L]),W=Ye("div",t,{state:V,props:[p,{"aria-labelledby":R??void 0,"aria-describedby":l??void 0,role:F,tabIndex:-1,hidden:!h,onKeyDown(_){Xo.has(_.key)&&_.stopPropagation()},style:{[Ho.nestedDialogs]:C}},a],ref:[n,i.context.popupRef,i.useStateSetter("popupElement")],stateAttributesMapping:Jo});return ne.jsx(Xn,{context:f,openInteractionType:v,disabled:!h,closeOnFocusOut:!b,initialFocus:B,returnFocus:r,modal:g!==!1,restoreFocus:"popup",children:W})}),Qo=d.forwardRef(function(t,n){const{cutout:o,...r}=t;let s;if(o){const u=o?.getBoundingClientRect();s=`polygon(
2
- 0% 0%,
3
- 100% 0%,
4
- 100% 100%,
5
- 0% 100%,
6
- 0% 0%,
7
- ${u.left}px ${u.top}px,
8
- ${u.left}px ${u.bottom}px,
9
- ${u.right}px ${u.bottom}px,
10
- ${u.right}px ${u.top}px,
11
- ${u.left}px ${u.top}px
12
- )`}return ne.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...r,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})}),Tr=d.forwardRef(function(t,n){const{keepMounted:o=!1,...r}=t,{store:s}=Se(),u=s.useState("mounted"),a=s.useState("modal"),i=s.useState("open");return u||o?ne.jsx(cn.Provider,{value:o,children:ne.jsxs(Fn,{ref:n,...r,children:[u&&a===!0&&ne.jsx(Qo,{ref:s.context.internalBackdropRef,inert:Ln(!i)}),t.children]})}):null});let Lt={},Dt={},Nt="";function Zo(e){if(typeof document>"u")return!1;const t=Ie(e);return Ke(t).innerWidth-t.documentElement.clientWidth>0}function er(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const o=Ie(e).documentElement,r={scrollbarGutter:o.style.scrollbarGutter,overflowY:o.style.overflowY};o.style.scrollbarGutter="stable",o.style.overflowY="scroll";const s=o.offsetWidth;o.style.overflowY="hidden";const u=o.offsetWidth;return Object.assign(o.style,r),s===u}function tr(e){const t=Ie(e),n=t.documentElement,o=t.body,r=qt(n)?n:o,s=r.style.overflow;return r.style.overflow="hidden",()=>{r.style.overflow=s}}function nr(e){const t=Ie(e),n=t.documentElement,o=t.body,r=Ke(n);let s=0,u=0,a=!1;const i=le.create();if(Dn&&(r.visualViewport?.scale??1)!==1)return()=>{};function l(){const p=r.getComputedStyle(n),g=r.getComputedStyle(o),C=(p.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";s=n.scrollTop,u=n.scrollLeft,Lt={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Nt=n.style.scrollBehavior,Dt={position:o.style.position,height:o.style.height,width:o.style.width,boxSizing:o.style.boxSizing,overflowY:o.style.overflowY,overflowX:o.style.overflowX,scrollBehavior:o.style.scrollBehavior};const O=n.scrollHeight>n.clientHeight,v=n.scrollWidth>n.clientWidth,R=p.overflowY==="scroll"||g.overflowY==="scroll",N=p.overflowX==="scroll"||g.overflowX==="scroll",F=Math.max(0,r.innerWidth-o.clientWidth),M=Math.max(0,r.innerHeight-o.clientHeight),B=parseFloat(g.marginTop)+parseFloat(g.marginBottom),L=parseFloat(g.marginLeft)+parseFloat(g.marginRight),V=qt(n)?n:o;if(a=er(e),a){n.style.scrollbarGutter=C,V.style.overflowY="hidden",V.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:C,overflowY:"hidden",overflowX:"hidden"}),(O||R)&&(n.style.overflowY="scroll"),(v||N)&&(n.style.overflowX="scroll"),Object.assign(o.style,{position:"relative",height:B||M?`calc(100dvh - ${B+M}px)`:"100dvh",width:L||F?`calc(100vw - ${L+F}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),o.scrollTop=s,o.scrollLeft=u,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function b(){Object.assign(n.style,Lt),Object.assign(o.style,Dt),a||(n.scrollTop=s,n.scrollLeft=u,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=Nt)}function f(){b(),i.request(l)}return l(),r.addEventListener("resize",f),()=>{i.cancel(),b(),typeof r.removeEventListener=="function"&&r.removeEventListener("resize",f)}}class or{lockCount=0;restore=null;timeoutLock=ct.create();timeoutUnlock=ct.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const o=Ie(t).documentElement,r=Ke(o).getComputedStyle(o).overflowY;if(r==="hidden"||r==="clip"){this.restore=Yt;return}const s=Ut||!Zo(t);this.restore=s?tr(t):nr(t)}}const rr=new or;function sr(e=!0,t=null){$(()=>{if(e)return rr.acquire(t)},[e,t])}function ir(e){const t=d.useRef(""),n=d.useCallback(r=>{r.defaultPrevented||(t.current=r.pointerType,e(r,r.pointerType))},[e]);return{onClick:d.useCallback(r=>{if(r.detail===0){e(r,"keyboard");return}"pointerType"in r&&e(r,r.pointerType),e(r,t.current),t.current=""},[e]),onPointerDown:n}}function cr(e){const[t,n]=d.useState(null),o=A((a,i)=>{e||n(i||(Ut?"touch":""))}),r=d.useCallback(()=>{n(null)},[]),{onClick:s,onPointerDown:u}=ir(o);return d.useMemo(()=>({openMethod:t,reset:r,triggerProps:{onClick:s,onPointerDown:u}}),[t,r,s,u])}function ur(e){const{store:t,parentContext:n,actionsRef:o}=e,r=t.useState("open"),s=t.useState("disablePointerDismissal"),u=t.useState("modal"),a=t.useState("popupElement"),{openMethod:i,triggerProps:l,reset:b}=cr(r);ko(t);const{forceUnmount:f}=Mo(r,t,()=>{b()}),p=A(W=>{const _=de(W);return _.preventUnmountOnClose=()=>{t.set("preventUnmountingOnClose",!0)},_}),g=d.useCallback(()=>{t.setOpen(!1,p(Nn))},[t,p]);d.useImperativeHandle(o,()=>({unmount:f,close:g}),[f,g]);const h=Do({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[y,C]=d.useState(0),O=y===0,v=Wo(h),R=Zn(h,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?"intentional":{mouse:u==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(W){if("button"in W&&W.button!==0||"touches"in W&&W.touches.length!==1)return!1;const _=ee(W);if(O&&!s){const q=_;return u&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===q||t.context.backdropRef.current===q||K(q,a)&&!q?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:O});sr(r&&u===!0,a);const{getReferenceProps:N,getFloatingProps:F,getTriggerProps:M}=No([v,R]);t.useContextCallback("onNestedDialogOpen",W=>{C(W+1)}),t.useContextCallback("onNestedDialogClose",()=>{C(0)}),d.useEffect(()=>(n?.onNestedDialogOpen&&r&&n.onNestedDialogOpen(y),n?.onNestedDialogClose&&!r&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&r&&n.onNestedDialogClose()}),[r,n,y]);const B=d.useMemo(()=>N(l),[N,l]),L=d.useMemo(()=>M(l),[M,l]),V=d.useMemo(()=>F(),[F]);t.useSyncedValues({openMethod:i,activeTriggerProps:B,inactiveTriggerProps:L,popupProps:V,floatingRootContext:h,nestedOpenDialogCount:y})}const ar={...Lo,modal:P(e=>e.modal),nested:P(e=>e.nested),nestedOpenDialogCount:P(e=>e.nestedOpenDialogCount),disablePointerDismissal:P(e=>e.disablePointerDismissal),openMethod:P(e=>e.openMethod),descriptionElementId:P(e=>e.descriptionElementId),titleElementId:P(e=>e.titleElementId),viewportElement:P(e=>e.viewportElement),role:P(e=>e.role)};class lr extends nn{constructor(t){super(dr(t),{popupRef:d.createRef(),backdropRef:d.createRef(),internalBackdropRef:d.createRef(),triggerElements:new rn,onOpenChange:void 0,onOpenChangeComplete:void 0},ar)}setOpen=(t,n)=>{if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&n.trigger==null&&this.state.activeTriggerId!=null&&(n.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,n),n.isCanceled)return;const o={open:t,nativeEvent:n.event,reason:n.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",o);const r={open:t},s=n.trigger?.id??null;(s||t)&&(r.activeTriggerId=s,r.activeTriggerElement=n.trigger??null),this.update(r)}}function dr(e={}){return{...Fo(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...e}}function Cr(e){const{children:t,open:n,defaultOpen:o=!1,onOpenChange:r,onOpenChangeComplete:s,disablePointerDismissal:u=!1,modal:a=!0,actionsRef:i,handle:l,triggerId:b,defaultTriggerId:f=null}=e,p=Se(!0),g=!!p,h=Be(()=>l?.store??new lr({open:n??o,activeTriggerId:b!==void 0?b:f,modal:a,disablePointerDismissal:u,nested:g})).current;h.useControlledProp("open",n,o),h.useControlledProp("activeTriggerId",b,f),h.useSyncedValues({disablePointerDismissal:u,nested:g,modal:a}),h.useContextCallback("onOpenChange",r),h.useContextCallback("onOpenChangeComplete",s);const y=h.useState("payload");ur({store:h,actionsRef:i,parentContext:p?.store.context});const C=d.useMemo(()=>({store:h}),[h]);return ne.jsx(sn.Provider,{value:C,children:typeof t=="function"?t({payload:y}):t})}let At=(function(e){return e[e.open=te.open]="open",e[e.closed=te.closed]="closed",e[e.startingStyle=te.startingStyle]="startingStyle",e[e.endingStyle=te.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const fr={...gt,...dt,nested(e){return e?{[At.nested]:""}:null},nestedDialogOpen(e){return e?{[At.nestedDialogOpen]:""}:null}},xr=d.forwardRef(function(t,n){const{className:o,render:r,children:s,...u}=t,a=un(),{store:i}=Se(),l=i.useState("open"),b=i.useState("nested"),f=i.useState("transitionStatus"),p=i.useState("nestedOpenDialogCount"),g=i.useState("mounted"),h=p>0,y=d.useMemo(()=>({open:l,nested:b,transitionStatus:f,nestedDialogOpen:h}),[l,b,f,h]);return Ye("div",t,{enabled:a||g,state:y,ref:[n,i.useStateSetter("viewportElement")],stateAttributesMapping:fr,props:[{role:"presentation",hidden:!g,children:s},u]})}),wr=d.forwardRef(function(t,n){const{render:o,className:r,id:s,...u}=t,{store:a}=Se(),i=$o(s);return a.useSyncedValueWithCleanup("titleElementId",i),Ye("h2",t,{ref:n,props:[{id:i},u]})});export{on as A,ye as B,Xo as C,Cr as D,Lo as E,Xn as F,Fo as G,br as H,Qo as I,ko as J,Mo as K,Do as L,Wo as M,Er as N,mr as O,rn as P,hr as Q,nn as R,Oe as S,Tr as a,Sr as b,xr as c,Rr as d,wr as e,Fe as f,$e as g,ft as h,Je as i,jn as j,Vn as k,$o as l,P as m,Oo as n,cr as o,To as p,Zn as q,No as r,An as s,vr as t,Se as u,yr as v,sr as w,gt as x,gr as y,Bn as z};
@@ -1,2 +0,0 @@
1
- import{j as i,N as h,A as s,r as j,ax as v,i as k,L as N,ay as L}from"./main-BJQZ96HP.js";import{u as P}from"./use-usage-limits-CvfL47sK.js";import{u as C}from"./use-limits-display-prefs-BOMVZxxS.js";import{C as g}from"./Card-BS2ABbwq.js";import{F as E}from"./FadeIn-DIxWR6-M.js";import{L as O}from"./LocalOnlyNotice-DFg7yglW.js";import"./arrow-up-right-U3GN7ZK8.js";import"./download-Cgae7DJA.js";const T=[3,2,3,3,2,2,3];function m({className:n}){return i.jsx("div",{className:h("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",n)})}function R(){return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(m,{className:"h-3 w-12 shrink-0"}),i.jsx(m,{className:"flex-1 h-1.5 rounded-full min-w-0"}),i.jsx(m,{className:"h-3 w-[30px] shrink-0"}),i.jsx(m,{className:"h-3 w-6 shrink-0"})]})}function S({bars:n,index:e}){const r=e%3===0?"w-24":e%3===1?"w-20":"w-[4.5rem]";return i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(m,{className:"h-[14px] w-[14px] rounded shrink-0"}),i.jsx(m,{className:h("h-4",r)})]}),Array.from({length:n},(a,l)=>i.jsx(R,{},l))]})}function A(){return i.jsx(g,{children:i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsx(m,{className:"h-3.5 w-28"}),T.map((n,e)=>i.jsx(S,{bars:n,index:e},e))]})})}function t(n){if(!n)return null;const e=typeof n=="number"?n*1e3:Date.parse(n);if(!Number.isFinite(e))return null;const r=e-Date.now();if(r<=0)return s("shared.time.now");const a=Math.floor(r/6e4);if(a<60)return`${a}m`;const l=Math.floor(a/60);return l<24?`${l}h`:`${Math.floor(l/24)}d`}function I(n){return n>=90?"bg-red-500":n>=70?"bg-amber-500":"bg-emerald-500"}function o({label:n,pct:e,reset:r}){const a=Math.max(0,Math.min(100,Number(e)||0)),l=Math.round(a),u=a>0&&l===0?Math.max(a,.35):a,x=a>0&&l===0?"<1":String(l);return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 w-12 shrink-0",children:n}),i.jsx("div",{className:"flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:i.jsx("div",{className:`${I(l)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${u}%`,minWidth:a>0?"3px":0}})}),i.jsxs("span",{className:"text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400 w-[30px] text-right shrink-0",children:[x,"%"]}),r?i.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500 w-6 text-right shrink-0",children:r}):null]})}function d({name:n,icon:e,children:r}){const l=e==="/brand-logos/cursor.svg"||e==="/brand-logos/kiro.svg"||e==="/brand-logos/copilot.svg"||e==="/brand-logos/kimi.svg"?"w-[14px] h-[14px] dark:invert":"w-[14px] h-[14px]";return i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[e?i.jsx("img",{src:e,alt:"",className:l}):null,i.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:n})]}),r]})}const M=["claude","codex","cursor","gemini","kimi","kiro","copilot","antigravity"],D={claude:{name:"Claude",icon:"/brand-logos/claude-code.svg"},codex:{name:"Codex",icon:"/brand-logos/codex.svg"},cursor:{name:"Cursor",icon:"/brand-logos/cursor.svg"},gemini:{name:"Gemini",icon:"/brand-logos/gemini.svg"},kimi:{name:"Kimi",icon:"/brand-logos/kimi.svg"},kiro:{name:"Kiro",icon:"/brand-logos/kiro.svg"},copilot:{name:"GitHub Copilot",icon:"/brand-logos/copilot.svg"},antigravity:{name:"Antigravity",icon:"/brand-logos/antigravity.svg"}};function c({children:n,tone:e="neutral"}){const r=e==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400";return i.jsx("div",{className:`text-[11px] leading-snug ${r}`,children:n})}function H(n,e){const r=D[n];if(!r)return null;if(!e?.configured)return i.jsx(d,{name:r.name,icon:r.icon,children:i.jsx(c,{children:s("limits.status.not_connected")})},n);if(e.error)return i.jsx(d,{name:r.name,icon:r.icon,children:i.jsx(c,{tone:"error",children:s("shared.error.prefix",{error:e.error})})},n);switch(n){case"claude":return i.jsxs(d,{name:r.name,icon:r.icon,children:[e.five_hour?i.jsx(o,{label:"5h",pct:e.five_hour.utilization,reset:t(e.five_hour.resets_at)}):null,e.seven_day?i.jsx(o,{label:"7d",pct:e.seven_day.utilization,reset:t(e.seven_day.resets_at)}):null,e.seven_day_opus?i.jsx(o,{label:"Opus",pct:e.seven_day_opus.utilization,reset:t(e.seven_day_opus.resets_at)}):null,!e.five_hour&&!e.seven_day&&!e.seven_day_opus?i.jsx(c,{children:s("limits.status.no_data")}):null]},"claude");case"codex":return i.jsxs(d,{name:r.name,icon:r.icon,children:[e.primary_window?i.jsx(o,{label:"5h",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?i.jsx(o,{label:"7d",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"codex");case"cursor":return i.jsxs(d,{name:r.name,icon:r.icon,children:[e.primary_window?i.jsx(o,{label:s("limits.label.cursor_plan"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?i.jsx(o,{label:s("limits.label.cursor_auto"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?i.jsx(o,{label:s("limits.label.cursor_api"),pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"cursor");case"gemini":return i.jsxs(d,{name:r.name,icon:r.icon,children:[e.primary_window?i.jsx(o,{label:"Pro",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?i.jsx(o,{label:"Flash",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?i.jsx(o,{label:"Lite",pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"gemini");case"kimi":return i.jsxs(d,{name:r.name,icon:r.icon,children:[e.primary_window?i.jsx(o,{label:s("limits.label.kimi_weekly"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?i.jsx(o,{label:s("limits.label.kimi_5h"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?i.jsx(o,{label:s("limits.label.kimi_total"),pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null,e.parallel_limit?i.jsx(c,{children:s("limits.label.kimi_parallel",{count:e.parallel_limit})}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"kimi");case"kiro":return i.jsxs(d,{name:r.name,icon:r.icon,children:[e.primary_window?i.jsx(o,{label:s("limits.label.kiro_month"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?i.jsx(o,{label:s("limits.label.kiro_bonus"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"kiro");case"antigravity":return i.jsxs(d,{name:r.name,icon:r.icon,children:[e.primary_window?i.jsx(o,{label:"Claude",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?i.jsx(o,{label:"G Pro",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?i.jsx(o,{label:"Flash",pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?i.jsx(c,{children:s("limits.status.no_data")}):null]},"antigravity");case"copilot":return i.jsxs(d,{name:r.name,icon:r.icon,children:[e.primary_window?i.jsx(o,{label:s("limits.label.copilot_premium"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?i.jsx(o,{label:s("limits.label.copilot_chat"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window?i.jsx(c,{children:s("limits.status.no_data")}):null,e.otel_has_files||e.otel_enabled?null:i.jsx($,{defaultDir:e.otel_default_dir})]},"copilot");default:return null}}function $({defaultDir:n}){const[e,r]=j.useState(!1),l=["export COPILOT_OTEL_ENABLED=true","export COPILOT_OTEL_EXPORTER_TYPE=file",`export COPILOT_OTEL_FILE_EXPORTER_PATH="${n||"$HOME/.copilot/otel"}/copilot-otel-$(date +%Y%m%d).jsonl"`].join(`
2
- `),u=async()=>{try{await navigator.clipboard.writeText(l),r(!0),setTimeout(()=>r(!1),1600)}catch{}};return i.jsxs("div",{className:"mt-1 rounded-md border border-amber-300/60 dark:border-amber-700/40 bg-amber-50/50 dark:bg-amber-900/10 px-2.5 py-2 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[i.jsx("div",{className:"font-medium text-oai-gray-700 dark:text-oai-gray-200",children:s("limits.copilot.otelHint.title")}),i.jsx("div",{className:"mt-0.5 leading-snug",children:s("limits.copilot.otelHint.body")}),i.jsx("pre",{className:"mt-1.5 overflow-x-auto rounded bg-oai-gray-100 dark:bg-oai-gray-900/60 px-2 py-1.5 font-mono text-[10.5px] leading-tight whitespace-pre",children:l}),i.jsx("button",{type:"button",onClick:u,className:"mt-1 inline-flex items-center gap-1 rounded border border-oai-gray-300 dark:border-oai-gray-700 px-1.5 py-0.5 text-[10.5px] text-oai-gray-700 dark:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:e?s("limits.copilot.otelHint.copied"):s("limits.copilot.otelHint.copy")})]})}function F({claude:n,codex:e,cursor:r,gemini:a,kimi:l,kiro:u,antigravity:x,copilot:b,order:w,visibility:_}){const f={claude:n,codex:e,cursor:r,gemini:a,kimi:l,kiro:u,antigravity:x,copilot:b},y=(Array.isArray(w)&&w.length>0?w:M).filter(p=>!_||_[p]!==!1).map(p=>H(p,f[p])).filter(Boolean);return i.jsx(E,{delay:.15,children:i.jsx(g,{children:i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsx("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:s("limits.panel.title")}),y.length>0?y:i.jsx(c,{children:s("limits.status.all_hidden")})]})})})}const B=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function J(){const n=v(),{data:e,error:r,isLoading:a}=P(n?{initialRefresh:!0,initialState:n,publishToPreloadCache:!0}:{initialRefresh:!0,publishToPreloadCache:!0}),l=C();return!B&&!k()?i.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:i.jsx(O,{})}):i.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:i.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:i.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[i.jsxs("div",{className:"flex flex-row items-start justify-between gap-4 mb-8",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:s("nav.limits")}),i.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:s("limits.page.subtitle")})]}),i.jsx(N,{to:"/settings","aria-label":s("limits.page.openSettings"),title:s("limits.page.openSettings"),className:"shrink-0 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 no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:i.jsx(L,{className:"h-4 w-4","aria-hidden":!0})})]}),a?i.jsx(A,{}):i.jsxs(i.Fragment,{children:[r?i.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:s("shared.error.prefix",{error:r})}):null,i.jsx(F,{claude:e?.claude,codex:e?.codex,cursor:e?.cursor,gemini:e?.gemini,kimi:e?.kimi,kiro:e?.kiro,antigravity:e?.antigravity,copilot:e?.copilot,order:l.order,visibility:l.visibility})]})]})})})}export{J as LimitsPage};
@@ -1 +0,0 @@
1
- import{c as en,r as x,bn as Hn,b4 as nt,b as K,bK as be,bL as Bn,b8 as tn,bM as ot,b9 as z,bN as de,bo as ge,bO as $t,bP as fe,b1 as pe,bQ as nn,bR as at,bS as Me,bT as _e,bU as $n,bV as on,bW as _n,bX as lt,bY as ft,bZ as Xe,M as Ie,b_ as Vn,ba as rn,aW as le,b$ as Wn,c0 as Nn,aY as ee,c1 as Z,a_ as Ve,b2 as sn,a$ as ae,c2 as cn,bi as an,c3 as jn,b6 as ze,c4 as Yn,c5 as Xn,b3 as rt,c6 as zn,j as U,c7 as Un,u as Gn,a as ut,c8 as Kn,c9 as _t,ca as qn,cb as Jn,cc as Qn,cd as Zn,bk as eo,ce as to,cf as no,bm as oo,bb as ro,br as so}from"./main-BJQZ96HP.js";import{y as Ce,z as io,g as dt,A as co,P as ln,h as gt,f as we,B as ao,R as lo,E as fo,G as uo,m as re,H as go,o as po,J as mo,K as ho,w as xo,L as yo,q as vo,M as Ro,r as fn,l as bo,N as wo,t as Eo,v as Co,O as Oo,I as To,Q as So,x as un,F as Po,C as Ao}from"./DialogTitle-CSNWjYGj.js";const Mo=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],os=en("chevron-right",Mo);const Io=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],rs=en("loader-circle",Io),ko=["top","right","bottom","left"],Oe=Math.min,J=Math.max,We=Math.round,He=Math.floor,ce=e=>({x:e,y:e}),Lo={left:"right",right:"left",bottom:"top",top:"bottom"};function st(e,t,n){return J(e,Oe(t,n))}function ue(e,t){return typeof e=="function"?e(t):e}function q(e){return e.split("-")[0]}function me(e){return e.split("-")[1]}function pt(e){return e==="x"?"y":"x"}function mt(e){return e==="y"?"height":"width"}function te(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function ht(e){return pt(te(e))}function Fo(e,t,n){n===void 0&&(n=!1);const o=me(e),r=ht(e),s=mt(r);let i=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Ne(i)),[i,Ne(i)]}function Do(e){const t=Ne(e);return[it(e),t,it(t)]}function it(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Vt=["left","right"],Wt=["right","left"],Ho=["top","bottom"],Bo=["bottom","top"];function $o(e,t,n){switch(e){case"top":case"bottom":return n?t?Wt:Vt:t?Vt:Wt;case"left":case"right":return t?Ho:Bo;default:return[]}}function _o(e,t,n,o){const r=me(e);let s=$o(q(e),n==="start",o);return r&&(s=s.map(i=>i+"-"+r),t&&(s=s.concat(s.map(it)))),s}function Ne(e){const t=q(e);return Lo[t]+e.slice(t.length)}function Vo(e){return{top:0,right:0,bottom:0,left:0,...e}}function dn(e){return typeof e!="number"?Vo(e):{top:e,right:e,bottom:e,left:e}}function je(e){const{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}function Qe(e,t,n){if(n&&!Ce(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const o=e();return typeof o=="number"?o:o?.[t]}return e?.[t]}function Wo(e,t={}){const n="rootStore"in e?e.rootStore:e,o=n.context.dataRef,{enabled:r=!0,event:s="click",toggle:i=!0,ignoreMouse:l=!1,stickIfOpen:a=!0,touchOpenDelay:d=0}=t,c=x.useRef(void 0),f=Hn(),m=nt(),p=x.useMemo(()=>({onPointerDown(u){c.current=u.pointerType},onMouseDown(u){const g=c.current,R=u.nativeEvent,w=n.select("open");if(u.button!==0||s==="click"||Ce(g,!0)&&l)return;const y=o.current.openEvent,C=y?.type,E=n.select("domReferenceElement")!==u.currentTarget,O=w&&E||!(w&&i&&(!(y&&a)||C==="click"||C==="mousedown"));if(Bn(R.target)){const b=K(be,R,R.target);O&&g==="touch"&&d>0?m.start(d,()=>{n.setOpen(!0,b)}):n.setOpen(O,b);return}const T=u.currentTarget;f.request(()=>{const b=K(be,R,T);O&&g==="touch"&&d>0?m.start(d,()=>{n.setOpen(!0,b)}):n.setOpen(O,b)})},onClick(u){if(s==="mousedown-only")return;const g=c.current;if(s==="mousedown"&&g){c.current=void 0;return}if(Ce(g,!0)&&l)return;const R=n.select("open"),w=o.current.openEvent,y=n.select("domReferenceElement")!==u.currentTarget,C=R&&y||!(R&&i&&(!(w&&a)||io(w))),E=K(be,u.nativeEvent,u.currentTarget);C&&g==="touch"&&d>0?m.start(d,()=>{n.setOpen(!0,E)}):n.setOpen(C,E)},onKeyDown(){c.current=void 0}}),[o,s,l,n,a,i,f,m,d]);return x.useMemo(()=>r?{reference:p}:tn,[r,p])}function Nt(e,t,n){let{reference:o,floating:r}=e;const s=te(t),i=ht(t),l=mt(i),a=q(t),d=s==="y",c=o.x+o.width/2-r.width/2,f=o.y+o.height/2-r.height/2,m=o[l]/2-r[l]/2;let p;switch(a){case"top":p={x:c,y:o.y-r.height};break;case"bottom":p={x:c,y:o.y+o.height};break;case"right":p={x:o.x+o.width,y:f};break;case"left":p={x:o.x-r.width,y:f};break;default:p={x:o.x,y:o.y}}switch(me(t)){case"start":p[i]-=m*(n&&d?-1:1);break;case"end":p[i]+=m*(n&&d?-1:1);break}return p}async function No(e,t){var n;t===void 0&&(t={});const{x:o,y:r,platform:s,rects:i,elements:l,strategy:a}=e,{boundary:d="clippingAncestors",rootBoundary:c="viewport",elementContext:f="floating",altBoundary:m=!1,padding:p=0}=ue(t,e),u=dn(p),R=l[m?f==="floating"?"reference":"floating":f],w=je(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(R)))==null||n?R:R.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:d,rootBoundary:c,strategy:a})),y=f==="floating"?{x:o,y:r,width:i.floating.width,height:i.floating.height}:i.reference,C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),E=await(s.isElement==null?void 0:s.isElement(C))?await(s.getScale==null?void 0:s.getScale(C))||{x:1,y:1}:{x:1,y:1},O=je(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:y,offsetParent:C,strategy:a}):y);return{top:(w.top-O.top+u.top)/E.y,bottom:(O.bottom-w.bottom+u.bottom)/E.y,left:(w.left-O.left+u.left)/E.x,right:(O.right-w.right+u.right)/E.x}}const jo=50,Yo=async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:s=[],platform:i}=n,l=i.detectOverflow?i:{...i,detectOverflow:No},a=await(i.isRTL==null?void 0:i.isRTL(t));let d=await i.getElementRects({reference:e,floating:t,strategy:r}),{x:c,y:f}=Nt(d,o,a),m=o,p=0;const u={};for(let g=0;g<s.length;g++){const R=s[g];if(!R)continue;const{name:w,fn:y}=R,{x:C,y:E,data:O,reset:T}=await y({x:c,y:f,initialPlacement:o,placement:m,strategy:r,middlewareData:u,rects:d,platform:l,elements:{reference:e,floating:t}});c=C??c,f=E??f,u[w]={...u[w],...O},T&&p<jo&&(p++,typeof T=="object"&&(T.placement&&(m=T.placement),T.rects&&(d=T.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:r}):T.rects),{x:c,y:f}=Nt(d,m,a)),g=-1)}return{x:c,y:f,placement:m,strategy:r,middlewareData:u}},Xo=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:s,rects:i,initialPlacement:l,platform:a,elements:d}=t,{mainAxis:c=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:u="none",flipAlignment:g=!0,...R}=ue(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const w=q(r),y=te(l),C=q(l)===l,E=await(a.isRTL==null?void 0:a.isRTL(d.floating)),O=m||(C||!g?[Ne(l)]:Do(l)),T=u!=="none";!m&&T&&O.push(..._o(l,g,u,E));const b=[l,...O],k=await a.detectOverflow(t,R),$=[];let A=((o=s.flip)==null?void 0:o.overflows)||[];if(c&&$.push(k[w]),f){const L=Fo(r,i,E);$.push(k[L[0]],k[L[1]])}if(A=[...A,{placement:r,overflows:$}],!$.every(L=>L<=0)){var F,S;const L=(((F=s.flip)==null?void 0:F.index)||0)+1,I=b[L];if(I&&(!(f==="alignment"?y!==te(I):!1)||A.every(v=>te(v.placement)===y?v.overflows[0]>0:!0)))return{data:{index:L,overflows:A},reset:{placement:I}};let D=(S=A.filter(M=>M.overflows[0]<=0).sort((M,v)=>M.overflows[1]-v.overflows[1])[0])==null?void 0:S.placement;if(!D)switch(p){case"bestFit":{var h;const M=(h=A.filter(v=>{if(T){const P=te(v.placement);return P===y||P==="y"}return!0}).map(v=>[v.placement,v.overflows.filter(P=>P>0).reduce((P,N)=>P+N,0)]).sort((v,P)=>v[1]-P[1])[0])==null?void 0:h[0];M&&(D=M);break}case"initialPlacement":D=l;break}if(r!==D)return{reset:{placement:D}}}return{}}}};function jt(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Yt(e){return ko.some(t=>e[t]>=0)}const zo=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:o}=t,{strategy:r="referenceHidden",...s}=ue(e,t);switch(r){case"referenceHidden":{const i=await o.detectOverflow(t,{...s,elementContext:"reference"}),l=jt(i,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Yt(l)}}}case"escaped":{const i=await o.detectOverflow(t,{...s,altBoundary:!0}),l=jt(i,n.floating);return{data:{escapedOffsets:l,escaped:Yt(l)}}}default:return{}}}}},gn=new Set(["left","top"]);async function Uo(e,t){const{placement:n,platform:o,elements:r}=e,s=await(o.isRTL==null?void 0:o.isRTL(r.floating)),i=q(n),l=me(n),a=te(n)==="y",d=gn.has(i)?-1:1,c=s&&a?-1:1,f=ue(t,e);let{mainAxis:m,crossAxis:p,alignmentAxis:u}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof u=="number"&&(p=l==="end"?u*-1:u),a?{x:p*c,y:m*d}:{x:m*d,y:p*c}}const Go=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:s,placement:i,middlewareData:l}=t,a=await Uo(t,e);return i===((n=l.offset)==null?void 0:n.placement)&&(o=l.arrow)!=null&&o.alignmentOffset?{}:{x:r+a.x,y:s+a.y,data:{...a,placement:i}}}}},Ko=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r,platform:s}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:a={fn:w=>{let{x:y,y:C}=w;return{x:y,y:C}}},...d}=ue(e,t),c={x:n,y:o},f=await s.detectOverflow(t,d),m=te(q(r)),p=pt(m);let u=c[p],g=c[m];if(i){const w=p==="y"?"top":"left",y=p==="y"?"bottom":"right",C=u+f[w],E=u-f[y];u=st(C,u,E)}if(l){const w=m==="y"?"top":"left",y=m==="y"?"bottom":"right",C=g+f[w],E=g-f[y];g=st(C,g,E)}const R=a.fn({...t,[p]:u,[m]:g});return{...R,data:{x:R.x-n,y:R.y-o,enabled:{[p]:i,[m]:l}}}}}},qo=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:r,rects:s,middlewareData:i}=t,{offset:l=0,mainAxis:a=!0,crossAxis:d=!0}=ue(e,t),c={x:n,y:o},f=te(r),m=pt(f);let p=c[m],u=c[f];const g=ue(l,t),R=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(a){const C=m==="y"?"height":"width",E=s.reference[m]-s.floating[C]+R.mainAxis,O=s.reference[m]+s.reference[C]-R.mainAxis;p<E?p=E:p>O&&(p=O)}if(d){var w,y;const C=m==="y"?"width":"height",E=gn.has(q(r)),O=s.reference[f]-s.floating[C]+(E&&((w=i.offset)==null?void 0:w[f])||0)+(E?0:R.crossAxis),T=s.reference[f]+s.reference[C]+(E?0:((y=i.offset)==null?void 0:y[f])||0)-(E?R.crossAxis:0);u<O?u=O:u>T&&(u=T)}return{[m]:p,[f]:u}}}},Jo=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:r,rects:s,platform:i,elements:l}=t,{apply:a=()=>{},...d}=ue(e,t),c=await i.detectOverflow(t,d),f=q(r),m=me(r),p=te(r)==="y",{width:u,height:g}=s.floating;let R,w;f==="top"||f==="bottom"?(R=f,w=m===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(w=f,R=m==="end"?"top":"bottom");const y=g-c.top-c.bottom,C=u-c.left-c.right,E=Oe(g-c[R],y),O=Oe(u-c[w],C),T=!t.middlewareData.shift;let b=E,k=O;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(k=C),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(b=y),T&&!m){const A=J(c.left,0),F=J(c.right,0),S=J(c.top,0),h=J(c.bottom,0);p?k=u-2*(A!==0||F!==0?A+F:J(c.left,c.right)):b=g-2*(S!==0||h!==0?S+h:J(c.top,c.bottom))}await a({...t,availableWidth:k,availableHeight:b});const $=await i.getDimensions(l.floating);return u!==$.width||g!==$.height?{reset:{rects:!0}}:{}}}};function pn(e){const t=fe(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=pe(e),s=r?e.offsetWidth:n,i=r?e.offsetHeight:o,l=We(n)!==s||We(o)!==i;return l&&(n=s,o=i),{width:n,height:o,$:l}}function xt(e){return z(e)?e:e.contextElement}function Ee(e){const t=xt(e);if(!pe(t))return ce(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:s}=pn(t);let i=(s?We(n.width):n.width)/o,l=(s?We(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const Qo=ce(0);function mn(e){const t=ge(e);return!nn()||!t.visualViewport?Qo:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Zo(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ge(e)?!1:t}function he(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=xt(e);let i=ce(1);t&&(o?z(o)&&(i=Ee(o)):i=Ee(e));const l=Zo(s,n,o)?mn(s):ce(0);let a=(r.left+l.x)/i.x,d=(r.top+l.y)/i.y,c=r.width/i.x,f=r.height/i.y;if(s){const m=ge(s),p=o&&z(o)?ge(o):o;let u=m,g=$t(u);for(;g&&o&&p!==u;){const R=Ee(g),w=g.getBoundingClientRect(),y=fe(g),C=w.left+(g.clientLeft+parseFloat(y.paddingLeft))*R.x,E=w.top+(g.clientTop+parseFloat(y.paddingTop))*R.y;a*=R.x,d*=R.y,c*=R.x,f*=R.y,a+=C,d+=E,u=ge(g),g=$t(u)}}return je({width:c,height:f,x:a,y:d})}function Ue(e,t){const n=Xe(e).scrollLeft;return t?t.left+n:he(de(e)).left+n}function hn(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-Ue(e,n),r=n.top+t.scrollTop;return{x:o,y:r}}function er(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const s=r==="fixed",i=de(o),l=t?at(t.floating):!1;if(o===i||l&&s)return n;let a={scrollLeft:0,scrollTop:0},d=ce(1);const c=ce(0),f=pe(o);if((f||!f&&!s)&&((lt(o)!=="body"||ft(i))&&(a=Xe(o)),f)){const p=he(o);d=Ee(o),c.x=p.x+o.clientLeft,c.y=p.y+o.clientTop}const m=i&&!f&&!s?hn(i,a):ce(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-a.scrollLeft*d.x+c.x+m.x,y:n.y*d.y-a.scrollTop*d.y+c.y+m.y}}function tr(e){return Array.from(e.getClientRects())}function nr(e){const t=de(e),n=Xe(e),o=e.ownerDocument.body,r=J(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),s=J(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let i=-n.scrollLeft+Ue(e);const l=-n.scrollTop;return fe(o).direction==="rtl"&&(i+=J(t.clientWidth,o.clientWidth)-r),{width:r,height:s,x:i,y:l}}const Xt=25;function or(e,t){const n=ge(e),o=de(e),r=n.visualViewport;let s=o.clientWidth,i=o.clientHeight,l=0,a=0;if(r){s=r.width,i=r.height;const c=nn();(!c||c&&t==="fixed")&&(l=r.offsetLeft,a=r.offsetTop)}const d=Ue(o);if(d<=0){const c=o.ownerDocument,f=c.body,m=getComputedStyle(f),p=c.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,u=Math.abs(o.clientWidth-f.clientWidth-p);u<=Xt&&(s-=u)}else d<=Xt&&(s+=d);return{width:s,height:i,x:l,y:a}}function rr(e,t){const n=he(e,!0,t==="fixed"),o=n.top+e.clientTop,r=n.left+e.clientLeft,s=pe(e)?Ee(e):ce(1),i=e.clientWidth*s.x,l=e.clientHeight*s.y,a=r*s.x,d=o*s.y;return{width:i,height:l,x:a,y:d}}function zt(e,t,n){let o;if(t==="viewport")o=or(e,n);else if(t==="document")o=nr(de(e));else if(z(t))o=rr(t,n);else{const r=mn(e);o={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return je(o)}function xn(e,t){const n=Me(e);return n===t||!z(n)||_e(n)?!1:fe(n).position==="fixed"||xn(n,t)}function sr(e,t){const n=t.get(e);if(n)return n;let o=ot(e,[],!1).filter(l=>z(l)&&lt(l)!=="body"),r=null;const s=fe(e).position==="fixed";let i=s?Me(e):e;for(;z(i)&&!_e(i);){const l=fe(i),a=on(i);!a&&l.position==="fixed"&&(r=null),(s?!a&&!r:!a&&l.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||ft(i)&&!a&&xn(e,i))?o=o.filter(c=>c!==i):r=l,i=Me(i)}return t.set(e,o),o}function ir(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const i=[...n==="clippingAncestors"?at(t)?[]:sr(t,this._c):[].concat(n),o],l=zt(t,i[0],r);let a=l.top,d=l.right,c=l.bottom,f=l.left;for(let m=1;m<i.length;m++){const p=zt(t,i[m],r);a=J(p.top,a),d=Oe(p.right,d),c=Oe(p.bottom,c),f=J(p.left,f)}return{width:d-f,height:c-a,x:f,y:a}}function cr(e){const{width:t,height:n}=pn(e);return{width:t,height:n}}function ar(e,t,n){const o=pe(t),r=de(t),s=n==="fixed",i=he(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const a=ce(0);function d(){a.x=Ue(r)}if(o||!o&&!s)if((lt(t)!=="body"||ft(r))&&(l=Xe(t)),o){const p=he(t,!0,s,t);a.x=p.x+t.clientLeft,a.y=p.y+t.clientTop}else r&&d();s&&!o&&r&&d();const c=r&&!o&&!s?hn(r,l):ce(0),f=i.left+l.scrollLeft-a.x-c.x,m=i.top+l.scrollTop-a.y-c.y;return{x:f,y:m,width:i.width,height:i.height}}function Ze(e){return fe(e).position==="static"}function Ut(e,t){if(!pe(e)||fe(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return de(e)===n&&(n=n.ownerDocument.body),n}function yn(e,t){const n=ge(e);if(at(e))return n;if(!pe(e)){let r=Me(e);for(;r&&!_e(r);){if(z(r)&&!Ze(r))return r;r=Me(r)}return n}let o=Ut(e,t);for(;o&&$n(o)&&Ze(o);)o=Ut(o,t);return o&&_e(o)&&Ze(o)&&!on(o)?n:o||_n(e)||n}const lr=async function(e){const t=this.getOffsetParent||yn,n=this.getDimensions,o=await n(e.floating);return{reference:ar(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function fr(e){return fe(e).direction==="rtl"}const ur={convertOffsetParentRelativeRectToViewportRelativeRect:er,getDocumentElement:de,getClippingRect:ir,getOffsetParent:yn,getElementRects:lr,getClientRects:tr,getDimensions:cr,getScale:Ee,isElement:z,isRTL:fr};function vn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function dr(e,t){let n=null,o;const r=de(e);function s(){var l;clearTimeout(o),(l=n)==null||l.disconnect(),n=null}function i(l,a){l===void 0&&(l=!1),a===void 0&&(a=1),s();const d=e.getBoundingClientRect(),{left:c,top:f,width:m,height:p}=d;if(l||t(),!m||!p)return;const u=He(f),g=He(r.clientWidth-(c+m)),R=He(r.clientHeight-(f+p)),w=He(c),C={rootMargin:-u+"px "+-g+"px "+-R+"px "+-w+"px",threshold:J(0,Oe(1,a))||1};let E=!0;function O(T){const b=T[0].intersectionRatio;if(b!==a){if(!E)return i();b?i(!1,b):o=setTimeout(()=>{i(!1,1e-7)},1e3)}b===1&&!vn(d,e.getBoundingClientRect())&&i(),E=!1}try{n=new IntersectionObserver(O,{...C,root:r.ownerDocument})}catch{n=new IntersectionObserver(O,C)}n.observe(e)}return i(!0),s}function Gt(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=o,d=xt(e),c=r||s?[...d?ot(d):[],...t?ot(t):[]]:[];c.forEach(w=>{r&&w.addEventListener("scroll",n,{passive:!0}),s&&w.addEventListener("resize",n)});const f=d&&l?dr(d,n):null;let m=-1,p=null;i&&(p=new ResizeObserver(w=>{let[y]=w;y&&y.target===d&&p&&t&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var C;(C=p)==null||C.observe(t)})),n()}),d&&!a&&p.observe(d),t&&p.observe(t));let u,g=a?he(e):null;a&&R();function R(){const w=he(e);g&&!vn(g,w)&&n(),g=w,u=requestAnimationFrame(R)}return n(),()=>{var w;c.forEach(y=>{r&&y.removeEventListener("scroll",n),s&&y.removeEventListener("resize",n)}),f?.(),(w=p)==null||w.disconnect(),p=null,a&&cancelAnimationFrame(u)}}const gr=Go,pr=Ko,mr=Xo,hr=Jo,xr=zo,yr=qo,vr=(e,t,n)=>{const o=new Map,r={platform:ur,...n},s={...r.platform,_c:o};return Yo(e,t,{...r,platform:s})};var Rr=typeof document<"u",br=function(){},Be=Rr?x.useLayoutEffect:br;function Ye(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,o,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!Ye(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;o--!==0;){const s=r[o];if(!(s==="_owner"&&e.$$typeof)&&!Ye(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Rn(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Kt(e,t){const n=Rn(e);return Math.round(t*n)/n}function et(e){const t=x.useRef(e);return Be(()=>{t.current=e}),t}function wr(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:s,floating:i}={},transform:l=!0,whileElementsMounted:a,open:d}=e,[c,f]=x.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,p]=x.useState(o);Ye(m,o)||p(o);const[u,g]=x.useState(null),[R,w]=x.useState(null),y=x.useCallback(v=>{v!==T.current&&(T.current=v,g(v))},[]),C=x.useCallback(v=>{v!==b.current&&(b.current=v,w(v))},[]),E=s||u,O=i||R,T=x.useRef(null),b=x.useRef(null),k=x.useRef(c),$=a!=null,A=et(a),F=et(r),S=et(d),h=x.useCallback(()=>{if(!T.current||!b.current)return;const v={placement:t,strategy:n,middleware:m};F.current&&(v.platform=F.current),vr(T.current,b.current,v).then(P=>{const N={...P,isPositioned:S.current!==!1};L.current&&!Ye(k.current,N)&&(k.current=N,Ie.flushSync(()=>{f(N)}))})},[m,t,n,F,S]);Be(()=>{d===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,f(v=>({...v,isPositioned:!1})))},[d]);const L=x.useRef(!1);Be(()=>(L.current=!0,()=>{L.current=!1}),[]),Be(()=>{if(E&&(T.current=E),O&&(b.current=O),E&&O){if(A.current)return A.current(E,O,h);h()}},[E,O,h,A,$]);const I=x.useMemo(()=>({reference:T,floating:b,setReference:y,setFloating:C}),[y,C]),D=x.useMemo(()=>({reference:E,floating:O}),[E,O]),M=x.useMemo(()=>{const v={position:n,left:0,top:0};if(!D.floating)return v;const P=Kt(D.floating,c.x),N=Kt(D.floating,c.y);return l?{...v,transform:"translate("+P+"px, "+N+"px)",...Rn(D.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:P,top:N}},[n,l,D.floating,c.x,c.y]);return x.useMemo(()=>({...c,update:h,refs:I,elements:D,floatingStyles:M}),[c,h,I,D,M])}const Er=(e,t)=>{const n=gr(e);return{name:n.name,fn:n.fn,options:[e,t]}},Cr=(e,t)=>{const n=pr(e);return{name:n.name,fn:n.fn,options:[e,t]}},Or=(e,t)=>({fn:yr(e).fn,options:[e,t]}),Tr=(e,t)=>{const n=mr(e);return{name:n.name,fn:n.fn,options:[e,t]}},Sr=(e,t)=>{const n=hr(e);return{name:n.name,fn:n.fn,options:[e,t]}},Pr=(e,t)=>{const n=xr(e);return{name:n.name,fn:n.fn,options:[e,t]}};function Ar(e){const{open:t=!1,onOpenChange:n,elements:o={}}=e,r=Vn(),s=dt()!=null,i=rn(()=>new co({open:t,onOpenChange:n,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:o.triggers??new ln,floatingId:r,nested:s,noEmit:e.noEmit||!1})).current;return le(()=>{const l={open:t,floatingId:r};o.reference!==void 0&&(l.referenceElement=o.reference,l.domReferenceElement=z(o.reference)?o.reference:null),o.floating!==void 0&&(l.floatingElement=o.floating),i.update(l)},[t,r,o.reference,o.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i.context.noEmit=e.noEmit||!1,i}function Mr(e={}){const{nodeId:t,externalTree:n}=e,o=Ar(e),r=e.rootContext||o,s={reference:r.useState("referenceElement"),floating:r.useState("floatingElement"),domReference:r.useState("domReferenceElement")},[i,l]=x.useState(null),a=x.useRef(null),d=gt(n);le(()=>{s.domReference&&(a.current=s.domReference)},[s.domReference]);const c=wr({...e,elements:{...s,...i&&{reference:i}}}),f=x.useCallback(b=>{const k=z(b)?{getBoundingClientRect:()=>b.getBoundingClientRect(),getClientRects:()=>b.getClientRects(),contextElement:b}:b;l(k),c.refs.setReference(k)},[c.refs]),[m,p]=x.useState(null),[u,g]=x.useState(null);r.useSyncedValue("referenceElement",m),r.useSyncedValue("domReferenceElement",z(m)?m:null),r.useSyncedValue("floatingElement",u);const R=x.useCallback(b=>{(z(b)||b===null)&&(a.current=b,p(b)),(z(c.refs.reference.current)||c.refs.reference.current===null||b!==null&&!z(b))&&c.refs.setReference(b)},[c.refs,p]),w=x.useCallback(b=>{g(b),c.refs.setFloating(b)},[c.refs]),y=x.useMemo(()=>({...c.refs,setReference:R,setFloating:w,setPositionReference:f,domReference:a}),[c.refs,R,w,f]),C=x.useMemo(()=>({...c.elements,domReference:s.domReference}),[c.elements,s.domReference]),E=r.useState("open"),O=r.useState("floatingId"),T=x.useMemo(()=>({...c,dataRef:r.context.dataRef,open:E,onOpenChange:r.setOpen,events:r.context.events,floatingId:O,refs:y,elements:C,nodeId:t,rootStore:r}),[c,y,C,t,r,E,O]);return le(()=>{r.context.dataRef.current.floatingContext=T;const b=d?.nodesRef.current.find(k=>k.id===t);b&&(b.context=T)}),x.useMemo(()=>({...c,context:T,refs:y,elements:C,rootStore:r}),[c,y,C,T,r])}const ct=Wn("safe-polygon"),Ir=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${Nn}`;function kr(e){return e?!!e.closest(Ir):!1}function bn(e){const t=x.useRef(void 0),n=x.useRef(!1),o=x.useRef(void 0),r=x.useRef(!0),s=x.useRef(!1),i=x.useRef(()=>{}),l=x.useRef(!1),a=nt(),d=nt(),c=x.useRef(void 0);return x.useMemo(()=>{const f=e.context.dataRef.current;return f.hoverInteractionState||(f.hoverInteractionState={pointerTypeRef:t,interactedInsideRef:n,handlerRef:o,blockMouseMoveRef:r,performedPointerEventsMutationRef:s,unbindMouseMoveRef:i,restTimeoutPendingRef:l,openChangeTimeout:a,restTimeout:d,handleCloseOptionsRef:c}),f.hoverInteractionState},[e,t,n,o,r,s,i,l,a,d,c])}const Lr=new Set(["click","mousedown"]);function Fr(e,t={}){const n="rootStore"in e?e.rootStore:e,o=n.useState("open"),r=n.useState("floatingElement"),s=n.useState("domReferenceElement"),{dataRef:i}=n.context,{enabled:l=!0,closeDelay:a=0,externalTree:d}=t,{pointerTypeRef:c,interactedInsideRef:f,handlerRef:m,performedPointerEventsMutationRef:p,unbindMouseMoveRef:u,restTimeoutPendingRef:g,openChangeTimeout:R,handleCloseOptionsRef:w}=bn(n),y=gt(d),C=dt(),E=ee(()=>f.current?!0:i.current.openEvent?Lr.has(i.current.openEvent.type):!1),O=ee(()=>{const A=i.current.openEvent?.type;return A?.includes("mouse")&&A!=="mousedown"}),T=x.useCallback((A,F=!0)=>{const S=Dr(a,c.current);S&&!m.current?R.start(S,()=>n.setOpen(!1,K(Z,A))):F&&(R.clear(),n.setOpen(!1,K(Z,A)))},[a,m,n,c,R]),b=ee(()=>{u.current(),m.current=void 0}),k=ee(()=>{if(p.current){const A=Ve(r).body;A.style.pointerEvents="",A.removeAttribute(ct),p.current=!1}}),$=ee(A=>{const F=sn(A);if(!kr(F)){f.current=!1;return}f.current=!0});le(()=>{o||(c.current=void 0,g.current=!1,f.current=!1,b(),k())},[o,c,g,f,b,k]),x.useEffect(()=>()=>{b()},[b]),x.useEffect(()=>k,[k]),le(()=>{if(l&&o&&w.current?.blockPointerEvents&&O()&&z(s)&&r){p.current=!0;const A=Ve(r).body;A.setAttribute(ct,"");const F=s,S=r,h=y?.nodesRef.current.find(L=>L.id===C)?.context?.elements.floating;return h&&(h.style.pointerEvents=""),A.style.pointerEvents="none",F.style.pointerEvents="auto",S.style.pointerEvents="auto",()=>{A.style.pointerEvents="",F.style.pointerEvents="",S.style.pointerEvents=""}}},[l,o,s,r,w,O,y,C,p]),x.useEffect(()=>{if(!l)return;function A(L){if(E()||!i.current.floatingContext||!n.select("open"))return;const I=n.context.triggerElements;L.relatedTarget&&I.hasElement(L.relatedTarget)||(k(),b(),E()||T(L))}function F(L){R.clear(),k(),m.current?.(L),b()}function S(L){E()||T(L,!1)}const h=r;return h&&(h.addEventListener("mouseleave",A),h.addEventListener("mouseenter",F),h.addEventListener("mouseleave",S),h.addEventListener("pointerdown",$,!0)),()=>{h&&(h.removeEventListener("mouseleave",A),h.removeEventListener("mouseenter",F),h.removeEventListener("mouseleave",S),h.removeEventListener("pointerdown",$,!0))}})}function Dr(e,t){return t&&!Ce(t)?0:typeof e=="function"?e():e}function tt(e){return typeof e=="function"?e():e}const Hr={current:null};function Br(e,t={}){const n="rootStore"in e?e.rootStore:e,{dataRef:o,events:r}=n.context,{enabled:s=!0,delay:i=0,handleClose:l=null,mouseOnly:a=!1,restMs:d=0,move:c=!0,triggerElementRef:f=Hr,externalTree:m,isActiveTrigger:p=!0}=t,u=gt(m),{pointerTypeRef:g,interactedInsideRef:R,handlerRef:w,blockMouseMoveRef:y,performedPointerEventsMutationRef:C,unbindMouseMoveRef:E,restTimeoutPendingRef:O,openChangeTimeout:T,restTimeout:b,handleCloseOptionsRef:k}=bn(n),$=we(l),A=we(i),F=we(d);p&&(k.current=$.current?.__options);const S=ee(()=>R.current?!0:o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1),h=x.useCallback((M,v=!0)=>{const P=Qe(A.current,"close",g.current);P&&!w.current?T.start(P,()=>n.setOpen(!1,K(Z,M))):v&&(T.clear(),n.setOpen(!1,K(Z,M)))},[A,w,n,g,T]),L=ee(()=>{E.current(),w.current=void 0}),I=ee(()=>{if(C.current){const M=Ve(n.select("domReferenceElement")).body;M.style.pointerEvents="",M.removeAttribute(ct),C.current=!1}});x.useEffect(()=>{if(!s)return;function M(v){v.open||(T.clear(),b.clear(),y.current=!0,O.current=!1)}return r.on("openchange",M),()=>{r.off("openchange",M)}},[s,r,T,b,y,O]);const D=ee(M=>{if(S()||!o.current.floatingContext)return;const v=n.context.triggerElements;if(M.relatedTarget&&v.hasElement(M.relatedTarget))return;const P=f.current;$.current?.({...o.current.floatingContext,tree:u,x:M.clientX,y:M.clientY,onClose(){I(),L(),!S()&&P===n.select("domReferenceElement")&&h(M)}})(M)});return x.useEffect(()=>{if(!s)return;const M=f.current??(p?n.select("domReferenceElement"):null);if(!z(M))return;function v(_){if(T.clear(),y.current=!1,a&&!Ce(g.current)||tt(F.current)>0&&!Qe(A.current,"open"))return;const V=Qe(A.current,"open",g.current),j=n.select("domReferenceElement"),H=n.context.triggerElements,Y=(H.hasElement(_.target)||H.hasMatchingElement(se=>ae(se,_.target)))&&(!j||!ae(j,_.target)),B=_.currentTarget??null,W=n.select("open"),ne=!W||Y;Y&&W?n.setOpen(!0,K(Z,_,B)):V?T.start(V,()=>{ne&&n.setOpen(!0,K(Z,_,B))}):ne&&n.setOpen(!0,K(Z,_,B))}function P(_){if(S()){I();return}E.current();const V=n.select("domReferenceElement"),j=Ve(V);b.clear(),O.current=!1;const H=n.context.triggerElements;if(_.relatedTarget&&H.hasElement(_.relatedTarget))return;if($.current&&o.current.floatingContext){n.select("open")||T.clear();const B=f.current;w.current=$.current({...o.current.floatingContext,tree:u,x:_.clientX,y:_.clientY,onClose(){I(),L(),!S()&&B===n.select("domReferenceElement")&&h(_,!0)}});const W=w.current;W(_),j.addEventListener("mousemove",W),E.current=()=>{j.removeEventListener("mousemove",W)};return}(g.current!=="touch"||!ae(n.select("floatingElement"),_.relatedTarget))&&h(_)}function N(_){D(_)}return n.select("open")&&M.addEventListener("mouseleave",N),c&&M.addEventListener("mousemove",v,{once:!0}),M.addEventListener("mouseenter",v),M.addEventListener("mouseleave",P),()=>{M.removeEventListener("mouseleave",N),c&&M.removeEventListener("mousemove",v),M.removeEventListener("mouseenter",v),M.removeEventListener("mouseleave",P)}},[L,I,y,o,A,h,n,s,$,D,p,S,a,c,g,F,b,O,T,f,u,E,w]),x.useMemo(()=>{function M(v){g.current=v.pointerType}return{onPointerDown:M,onPointerEnter:M,onMouseMove(v){const{nativeEvent:P}=v,N=v.currentTarget,_=n.select("domReferenceElement"),V=n.context.triggerElements,j=n.select("open"),H=(V.hasElement(v.target)||V.hasMatchingElement(B=>ae(B,v.target)))&&(!_||!ae(_,v.target));if(a&&!Ce(g.current)||j&&!H||tt(F.current)===0||!H&&O.current&&v.movementX**2+v.movementY**2<2)return;b.clear();function Y(){if(O.current=!1,S())return;const B=n.select("open");!y.current&&(!B||H)&&n.setOpen(!0,K(Z,P,N))}g.current==="touch"?Ie.flushSync(()=>{Y()}):H&&j?Y():(O.current=!0,b.start(tt(F.current),Y))}}},[y,S,a,n,g,F,b,O])}function qt(e,t){const[n,o]=e;let r=!1;const s=t.length;for(let i=0,l=s-1;i<s;l=i++){const[a,d]=t[i]||[0,0],[c,f]=t[l]||[0,0];d>=o!=f>=o&&n<=(c-a)*(o-d)/(f-d)+a&&(r=!r)}return r}function $r(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function _r(e={}){const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:o=!0}=e,r=new cn;let s=!1,i=null,l=null,a=typeof performance<"u"?performance.now():0;function d(f,m){const p=performance.now(),u=p-a;if(i===null||l===null||u===0)return i=f,l=m,a=p,null;const g=f-i,R=m-l,y=Math.sqrt(g*g+R*R)/u;return i=f,l=m,a=p,y}const c=({x:f,y:m,placement:p,elements:u,onClose:g,nodeId:R,tree:w})=>function(C){function E(){r.clear(),g()}if(r.clear(),!u.domReference||!u.floating||p==null||f==null||m==null)return;const{clientX:O,clientY:T}=C,b=[O,T],k=sn(C),$=C.type==="mouseleave",A=ae(u.floating,k),F=ae(u.domReference,k),S=u.domReference.getBoundingClientRect(),h=u.floating.getBoundingClientRect(),L=p.split("-")[0],I=f>h.right-h.width/2,D=m>h.bottom-h.height/2,M=$r(b,S),v=h.width>S.width,P=h.height>S.height,N=(v?S:h).left,_=(v?S:h).right,V=(P?S:h).top,j=(P?S:h).bottom;if(A&&(s=!0,!$))return;if(F&&(s=!1),F&&!$){s=!0;return}if($&&z(C.relatedTarget)&&ae(u.floating,C.relatedTarget)||w&&ao(w.nodesRef.current,R).some(({context:B})=>B?.open))return;if(L==="top"&&m>=S.bottom-1||L==="bottom"&&m<=S.top+1||L==="left"&&f>=S.right-1||L==="right"&&f<=S.left+1)return E();let H=[];switch(L){case"top":H=[[N,S.top+1],[N,h.bottom-1],[_,h.bottom-1],[_,S.top+1]];break;case"bottom":H=[[N,h.top+1],[N,S.bottom-1],[_,S.bottom-1],[_,h.top+1]];break;case"left":H=[[h.right-1,j],[h.right-1,V],[S.left+1,V],[S.left+1,j]];break;case"right":H=[[S.right-1,j],[S.right-1,V],[h.left+1,V],[h.left+1,j]];break}function Y([B,W]){switch(L){case"top":{const ne=[v?B+t/2:I?B+t*4:B-t*4,W+t+1],se=[v?B-t/2:I?B+t*4:B-t*4,W+t+1],oe=[[h.left,I||v?h.bottom-t:h.top],[h.right,I?v?h.bottom-t:h.top:h.bottom-t]];return[ne,se,...oe]}case"bottom":{const ne=[v?B+t/2:I?B+t*4:B-t*4,W-t],se=[v?B-t/2:I?B+t*4:B-t*4,W-t],oe=[[h.left,I||v?h.top+t:h.bottom],[h.right,I?v?h.top+t:h.bottom:h.top+t]];return[ne,se,...oe]}case"left":{const ne=[B+t+1,P?W+t/2:D?W+t*4:W-t*4],se=[B+t+1,P?W-t/2:D?W+t*4:W-t*4];return[...[[D||P?h.right-t:h.left,h.top],[D?P?h.right-t:h.left:h.right-t,h.bottom]],ne,se]}case"right":{const ne=[B-t,P?W+t/2:D?W+t*4:W-t*4],se=[B-t,P?W-t/2:D?W+t*4:W-t*4],oe=[[D||P?h.left+t:h.right,h.top],[D?P?h.left+t:h.right:h.left+t,h.bottom]];return[ne,se,...oe]}default:return[]}}if(!qt([O,T],H)){if(s&&!M)return E();if(!$&&o){const B=d(C.clientX,C.clientY);if(B!==null&&B<.1)return E()}qt([O,T],Y([f,m]))?!s&&o&&r.start(40,E):E()}};return c.__options={blockPointerEvents:n},c}const Vr=x.createContext(void 0);function Wr(){return x.useContext(Vr)?.direction??"ltr"}const Nr=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:r,rects:s,platform:i,elements:l,middlewareData:a}=t,{element:d,padding:c=0,offsetParent:f="real"}=ue(e,t)||{};if(d==null)return{};const m=dn(c),p={x:n,y:o},u=ht(r),g=mt(u),R=await i.getDimensions(d),w=u==="y",y=w?"top":"left",C=w?"bottom":"right",E=w?"clientHeight":"clientWidth",O=s.reference[g]+s.reference[u]-p[u]-s.floating[g],T=p[u]-s.reference[u],b=f==="real"?await i.getOffsetParent?.(d):l.floating;let k=l.floating[E]||s.floating[g];(!k||!await i.isElement?.(b))&&(k=l.floating[E]||s.floating[g]);const $=O/2-T/2,A=k/2-R[g]/2-1,F=Math.min(m[y],A),S=Math.min(m[C],A),h=F,L=k-R[g]-S,I=k/2-R[g]/2+$,D=st(h,I,L),M=!a.arrow&&me(r)!=null&&I!==D&&s.reference[g]/2-(I<h?F:S)-R[g]/2<0,v=M?I<h?I-h:I-L:0;return{[u]:p[u]+v,data:{[u]:D,centerOffset:I-D-v,...M&&{alignmentOffset:v}},reset:M}}}),jr=(e,t)=>({...Nr(e),options:[e,t]}),Yr={name:"hide",async fn(e){const{width:t,height:n,x:o,y:r}=e.rects.reference,s=t===0&&n===0&&o===0&&r===0;return{data:{referenceHidden:(await Pr().fn(e)).data?.referenceHidden||s}}}},$e={sideX:"left",sideY:"top"},Xr={name:"adaptiveOrigin",async fn(e){const{x:t,y:n,rects:{floating:o},elements:{floating:r},platform:s,strategy:i,placement:l}=e,a=ge(r),d=a.getComputedStyle(r);if(!(d.transitionDuration!=="0s"&&d.transitionDuration!==""))return{x:t,y:n,data:$e};const f=await s.getOffsetParent?.(r);let m={width:0,height:0};if(i==="fixed"&&a?.visualViewport)m={width:a.visualViewport.width,height:a.visualViewport.height};else if(f===a){const y=an(r);m={width:y.documentElement.clientWidth,height:y.documentElement.clientHeight}}else await s.isElement?.(f)&&(m=await s.getDimensions(f));const p=q(l);let u=t,g=n;p==="left"&&(u=m.width-(t+o.width)),p==="top"&&(g=m.height-(n+o.height));const R=p==="left"?"right":$e.sideX,w=p==="top"?"bottom":$e.sideY;return{x:u,y:g,data:{sideX:R,sideY:w}}}};function wn(e,t,n){const o=e==="inline-start"||e==="inline-end";return{top:"top",right:o?n?"inline-start":"inline-end":"right",bottom:"bottom",left:o?n?"inline-end":"inline-start":"left"}[t]}function Jt(e,t,n){const{rects:o,placement:r}=e;return{side:wn(t,q(r),n),align:me(r)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function zr(e){const{anchor:t,positionMethod:n="absolute",side:o="bottom",sideOffset:r=0,align:s="center",alignOffset:i=0,collisionBoundary:l,collisionPadding:a=5,sticky:d=!1,arrowPadding:c=5,disableAnchorTracking:f=!1,keepMounted:m=!1,floatingRootContext:p,mounted:u,collisionAvoidance:g,shiftCrossAxis:R=!1,nodeId:w,adaptiveOrigin:y,lazyFlip:C=!1,externalTree:E}=e,[O,T]=x.useState(null);!u&&O!==null&&T(null);const b=g.side||"flip",k=g.align||"flip",$=g.fallbackAxisSide||"end",A=typeof t=="function"?t:void 0,F=ee(A),S=A?F:t,h=we(t),I=Wr()==="rtl",D=O||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":I?"left":"right","inline-start":I?"right":"left"}[o],M=s==="center"?D:`${D}-${s}`;let v=a;const P=1,N=o==="bottom"?P:0,_=o==="top"?P:0,V=o==="right"?P:0,j=o==="left"?P:0;typeof v=="number"?v={top:v+N,right:v+j,bottom:v+_,left:v+V}:v&&(v={top:(v.top||0)+N,right:(v.right||0)+j,bottom:(v.bottom||0)+_,left:(v.left||0)+V});const H={boundary:l==="clipping-ancestors"?"clippingAncestors":l,padding:v},Y=x.useRef(null),B=we(r),W=we(i),oe=[Er(X=>{const G=Jt(X,o,I),ie=typeof B.current=="function"?B.current(G):B.current,Q=typeof W.current=="function"?W.current(G):W.current;return{mainAxis:ie,crossAxis:Q,alignmentAxis:Q}},[typeof r!="function"?r:0,typeof i!="function"?i:0,I,o])],vt=k==="none"&&b!=="shift",Rt=!vt&&(d||R||b==="shift"),bt=b==="none"?null:Tr({...H,padding:{top:v.top+P,right:v.right+P,bottom:v.bottom+P,left:v.left+P},mainAxis:!R&&b==="flip",crossAxis:k==="flip"?"alignment":!1,fallbackAxisSideDirection:$}),wt=vt?null:Cr(X=>{const G=an(X.elements.floating).documentElement;return{...H,rootBoundary:R?{x:0,y:0,width:G.clientWidth,height:G.clientHeight}:void 0,mainAxis:k!=="none",crossAxis:Rt,limiter:d||R?void 0:Or(ie=>{if(!Y.current)return{};const{width:Q,height:ve}=Y.current.getBoundingClientRect(),Re=te(q(ie.placement)),De=Re==="y"?Q:ve,qe=Re==="y"?v.left+v.right:v.top+v.bottom;return{offset:De/2+qe/2}})}},[H,d,R,v,k]);b==="shift"||k==="shift"||s==="center"?oe.push(wt,bt):oe.push(bt,wt),oe.push(Sr({...H,apply({elements:{floating:X},rects:{reference:G},availableWidth:ie,availableHeight:Q}){Object.entries({"--available-width":`${ie}px`,"--available-height":`${Q}px`,"--anchor-width":`${G.width}px`,"--anchor-height":`${G.height}px`}).forEach(([ve,Re])=>{X.style.setProperty(ve,Re)})}}),jr(()=>({element:Y.current||document.createElement("div"),padding:c,offsetParent:"floating"}),[c]),{name:"transformOrigin",fn(X){const{elements:G,middlewareData:ie,placement:Q,rects:ve,y:Re}=X,De=q(Q),qe=te(De),Ht=Y.current,Sn=ie.arrow?.x||0,Pn=ie.arrow?.y||0,An=Ht?.clientWidth||0,Mn=Ht?.clientHeight||0,Je=Sn+An/2,Bt=Pn+Mn/2,In=Math.abs(ie.shift?.y||0),kn=ve.reference.height/2,Ae=typeof r=="function"?r(Jt(X,o,I)):r,Ln=In>Ae,Fn={top:`${Je}px calc(100% + ${Ae}px)`,bottom:`${Je}px ${-Ae}px`,left:`calc(100% + ${Ae}px) ${Bt}px`,right:`${-Ae}px ${Bt}px`}[De],Dn=`${Je}px ${ve.reference.y+kn-Re}px`;return G.floating.style.setProperty("--transform-origin",Rt&&qe==="y"&&Ln?Dn:Fn),{}}},Yr,y),le(()=>{!u&&p&&p.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[u,p]);const Ge=x.useMemo(()=>({elementResize:!f&&typeof ResizeObserver<"u",layoutShift:!f&&typeof IntersectionObserver<"u"}),[f]),{refs:xe,elements:Te,x:Et,y:Ct,middlewareData:ye,update:Le,placement:Ot,context:Tt,isPositioned:Se,floatingStyles:St}=Mr({rootContext:p,placement:M,middleware:oe,strategy:n,whileElementsMounted:m?void 0:(...X)=>Gt(...X,Ge),nodeId:w,externalTree:E}),{sideX:Pt,sideY:At}=ye.adaptiveOrigin||$e,Ke=Se?n:"fixed",Mt=x.useMemo(()=>y?{position:Ke,[Pt]:Et,[At]:Ct}:{position:Ke,...St},[y,Ke,Pt,Et,At,Ct,St]),Fe=x.useRef(null);le(()=>{if(!u)return;const X=h.current,G=typeof X=="function"?X():X,Q=(Qt(G)?G.current:G)||null||null;Q!==Fe.current&&(xe.setPositionReference(Q),Fe.current=Q)},[u,xe,S,h]),x.useEffect(()=>{if(!u)return;const X=h.current;typeof X!="function"&&Qt(X)&&X.current!==Fe.current&&(xe.setPositionReference(X.current),Fe.current=X.current)},[u,xe,S,h]),x.useEffect(()=>{if(m&&u&&Te.domReference&&Te.floating)return Gt(Te.domReference,Te.floating,Le,Ge)},[m,u,Te,Le,Ge]);const Pe=q(Ot),It=wn(o,Pe,I),kt=me(Ot)||"center",Lt=!!ye.hide?.referenceHidden;le(()=>{C&&u&&Se&&T(Pe)},[C,u,Se,Pe]);const Ft=x.useMemo(()=>({position:"absolute",top:ye.arrow?.y,left:ye.arrow?.x}),[ye.arrow]),Dt=ye.arrow?.centerOffset!==0;return x.useMemo(()=>({positionerStyles:Mt,arrowStyles:Ft,arrowRef:Y,arrowUncentered:Dt,side:It,align:kt,physicalSide:Pe,anchorHidden:Lt,refs:xe,context:Tt,isPositioned:Se,update:Le}),[Mt,Ft,Y,Dt,It,kt,Pe,Lt,xe,Tt,Se,Le])}function Qt(e){return e!=null&&"current"in e}const Ur=x.createContext(void 0);function Gr(e){return x.useContext(Ur)}function En(e){return e==="starting"?jn:tn}const Cn=x.createContext(void 0);function ke(e){const t=x.useContext(Cn);if(t===void 0&&!e)throw new Error(ze(47));return t}function Kr(){return{...uo(),disabled:!1,modal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}const qr={...fo,disabled:re(e=>e.disabled),instantType:re(e=>e.instantType),openMethod:re(e=>e.openMethod),openChangeReason:re(e=>e.openChangeReason),modal:re(e=>e.modal),stickIfOpen:re(e=>e.stickIfOpen),titleElementId:re(e=>e.titleElementId),descriptionElementId:re(e=>e.descriptionElementId),openOnHover:re(e=>e.openOnHover),closeDelay:re(e=>e.closeDelay),hasViewport:re(e=>e.hasViewport)};class yt extends lo{constructor(t){const n={...Kr(),...t};n.open&&t?.mounted===void 0&&(n.mounted=!0),super(n,{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:x.createRef(),beforeContentFocusGuardRef:x.createRef(),stickIfOpenTimeout:new cn,triggerElements:new ln},qr)}setOpen=(t,n)=>{const o=n.reason===Z,r=n.reason===be&&n.event.detail===0,s=!t&&(n.reason===Yn||n.reason==null);if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(t,n),n.isCanceled)return;const i={open:t,nativeEvent:n.event,reason:n.reason,nested:this.state.nested,triggerElement:n.trigger};this.state.floatingRootContext.context.events?.emit("openchange",i);const a=()=>{const d={open:t,openChangeReason:n.reason},c=n.trigger?.id??null;(c||t)&&(d.activeTriggerId=c,d.activeTriggerElement=n.trigger??null),this.update(d)};o?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(Xn,()=>{this.set("stickIfOpen",!1)}),Ie.flushSync(a)):a(),r||s?this.set("instantType",r?"click":"dismiss"):n.reason===rt?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(t,n){const o=rn(()=>new yt(n)).current,r=t??o;return zn(o.disposeEffect),r}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function Zt({props:e}){const{children:t,open:n,defaultOpen:o=!1,onOpenChange:r,onOpenChangeComplete:s,modal:i=!1,handle:l,triggerId:a,defaultTriggerId:d=null}=e,c=yt.useStore(l?.store,{open:n??o,modal:i,activeTriggerId:a!==void 0?a:d});c.useControlledProp("open",n,o),c.useControlledProp("activeTriggerId",a,d);const f=c.useState("open"),m=c.useState("positionerElement"),p=c.useState("payload"),u=c.useState("openChangeReason");c.useContextCallback("onOpenChange",r),c.useContextCallback("onOpenChangeComplete",s);const{openMethod:g,triggerProps:R,reset:w}=po(f);mo(c);const{forceUnmount:y}=ho(f,c,()=>{c.update({stickIfOpen:!0,openChangeReason:null}),w()});xo(f&&i===!0&&u!==Z&&g!=="touch",m),x.useEffect(()=>{f||c.context.stickIfOpenTimeout.clear()},[c,f]);const C=x.useCallback(I=>{const D=K(I);return D.preventUnmountOnClose=()=>{c.set("preventUnmountingOnClose",!0)},D},[c]),E=x.useCallback(()=>{c.setOpen(!1,C(Un))},[c,C]);x.useImperativeHandle(e.actionsRef,()=>({unmount:y,close:E}),[y,E]);const O=yo({popupStore:c,onOpenChange:c.setOpen}),T=vo(O,{outsidePressEvent:{mouse:i==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),b=Ro(O),{getReferenceProps:k,getFloatingProps:$,getTriggerProps:A}=fn([T,b]),F=x.useMemo(()=>k(R),[k,R]),S=x.useMemo(()=>A(R),[A,R]),h=x.useMemo(()=>$(),[$]);c.useSyncedValues({modal:i,openMethod:g,activeTriggerProps:F,inactiveTriggerProps:S,popupProps:h,floatingRootContext:O,nested:dt()!=null});const L=x.useMemo(()=>({store:c}),[c]);return U.jsx(Cn.Provider,{value:L,children:typeof t=="function"?t({payload:p}):t})}function ss(e){return ke(!0)?U.jsx(Zt,{props:e}):U.jsx(go,{children:U.jsx(Zt,{props:e})})}const Jr=300,is=x.forwardRef(function(t,n){const{render:o,className:r,disabled:s=!1,nativeButton:i=!0,handle:l,payload:a,openOnHover:d=!1,delay:c=Jr,closeDelay:f=0,id:m,...p}=t,u=ke(!0),g=l?.store??u?.store;if(!g)throw new Error(ze(74));const R=bo(m),w=g.useState("isTriggerActive",R),y=g.useState("floatingRootContext"),C=g.useState("isOpenedByTrigger",R),E=x.useRef(null),{registerTrigger:O,isMountedByThisTrigger:T}=wo(R,E,g,{payload:a,disabled:s,openOnHover:d,closeDelay:f}),b=g.useState("openChangeReason"),k=g.useState("stickIfOpen"),$=g.useState("openMethod"),A=Br(y,{enabled:y!=null&&d&&($!=="touch"||b!==be),mouseOnly:!0,move:!1,handleClose:_r(),restMs:c,delay:{close:f},triggerElementRef:E,isActiveTrigger:w}),F=Wo(y,{enabled:y!=null,stickIfOpen:k}),S=fn([F]),h=g.useState("triggerProps",T),L=x.useMemo(()=>({disabled:s,open:C}),[s,C]),{getButtonProps:I,buttonRef:D}=Gn({disabled:s,native:i}),M=x.useMemo(()=>({open(V){return V&&b===be?Eo.open(V):Co.open(V)}}),[b]),v=ut("button",t,{state:L,ref:[D,n,O,E],props:[S.getReferenceProps(),A,h,{[Kn]:"",id:R},p,I],stateAttributesMapping:M}),P=x.useRef(null),N=ee(V=>{Ie.flushSync(()=>{g.setOpen(!1,K(rt,V.nativeEvent,V.currentTarget))}),qn(P.current)?.focus()}),_=ee(V=>{const j=g.select("positionerElement");if(j&&Jn(V,j))g.context.beforeContentFocusGuardRef.current?.focus();else{Ie.flushSync(()=>{g.setOpen(!1,K(rt,V.nativeEvent,V.currentTarget))});let H=Qn(g.context.triggerFocusTargetRef.current||E.current);for(;H!==null&&ae(j,H);){const Y=H;if(H=Zn(H),H===Y)break}H?.focus()}});return w?U.jsxs(x.Fragment,{children:[U.jsx(_t,{ref:P,onFocus:N}),U.jsx(x.Fragment,{children:v},R),U.jsx(_t,{ref:g.context.triggerFocusTargetRef,onFocus:_})]}):U.jsx(x.Fragment,{children:v},R)}),On=x.createContext(void 0);function Qr(){const e=x.useContext(On);if(e===void 0)throw new Error(ze(45));return e}const cs=x.forwardRef(function(t,n){const{keepMounted:o=!1,...r}=t,{store:s}=ke();return s.useState("mounted")||o?U.jsx(On.Provider,{value:o,children:U.jsx(eo,{ref:n,...r,renderGuards:!1})}):null}),Tn=x.createContext(void 0);function Zr(){const e=x.useContext(Tn);if(!e)throw new Error(ze(46));return e}const as=x.forwardRef(function(t,n){const{render:o,className:r,anchor:s,positionMethod:i="absolute",side:l="bottom",align:a="center",sideOffset:d=0,alignOffset:c=0,collisionBoundary:f="clipping-ancestors",collisionPadding:m=5,arrowPadding:p=5,sticky:u=!1,disableAnchorTracking:g=!1,collisionAvoidance:R=to,...w}=t,{store:y}=ke(),C=Qr(),E=Oo(),O=y.useState("floatingRootContext"),T=y.useState("mounted"),b=y.useState("open"),k=y.useState("openChangeReason"),$=y.useState("activeTriggerElement"),A=y.useState("modal"),F=y.useState("positionerElement"),S=y.useState("instantType"),h=y.useState("transitionStatus"),L=y.useState("hasViewport"),I=x.useRef(null),D=no(F,!1,!1),M=zr({anchor:s,floatingRootContext:O,positionMethod:i,mounted:T,side:l,sideOffset:d,align:a,alignOffset:c,arrowPadding:p,collisionBoundary:f,collisionPadding:m,sticky:u,disableAnchorTracking:g,keepMounted:C,nodeId:E,collisionAvoidance:R,adaptiveOrigin:L?Xr:void 0}),v=x.useMemo(()=>{const H={};return b||(H.pointerEvents="none"),{role:"presentation",hidden:!T,style:{...M.positionerStyles,...H}}},[b,T,M.positionerStyles]),P=x.useMemo(()=>({props:v,...M}),[v,M]),N=O?.select("domReferenceElement");le(()=>{const H=N,Y=I.current;if(H&&(I.current=H),Y&&H&&H!==Y){y.set("instantType",void 0);const B=new AbortController;return D(()=>{y.set("instantType","trigger-change")},B.signal),()=>{B.abort()}}},[N,D,y]);const _=x.useMemo(()=>({open:b,side:P.side,align:P.align,anchorHidden:P.anchorHidden,instant:S}),[b,P.side,P.align,P.anchorHidden,S]),V=x.useCallback(H=>{y.set("positionerElement",H)},[y]),j=ut("div",t,{state:_,props:[P.props,En(h),w],ref:[n,V],stateAttributesMapping:un});return U.jsxs(Tn.Provider,{value:P,children:[T&&A===!0&&k!==Z&&U.jsx(To,{ref:y.context.internalBackdropRef,inert:oo(!b),cutout:$}),U.jsx(So,{id:E,children:j})]})}),es={...un,...so},ls=x.forwardRef(function(t,n){const{className:o,render:r,initialFocus:s,finalFocus:i,...l}=t,{store:a}=ke(),d=Zr(),c=Gr()!=null,f=a.useState("open"),m=a.useState("openMethod"),p=a.useState("instantType"),u=a.useState("transitionStatus"),g=a.useState("popupProps"),R=a.useState("titleElementId"),w=a.useState("descriptionElementId"),y=a.useState("modal"),C=a.useState("mounted"),E=a.useState("openChangeReason"),O=a.useState("activeTriggerElement"),T=a.useState("floatingRootContext");ro({open:f,ref:a.context.popupRef,onComplete(){f&&a.context.onOpenChangeComplete?.(!0)}});const b=a.useState("disabled"),k=a.useState("openOnHover"),$=a.useState("closeDelay");Fr(T,{enabled:k&&!b,closeDelay:$});function A(I){return I==="touch"?a.context.popupRef.current:!0}const F=s===void 0?A:s,S=x.useMemo(()=>({open:f,side:d.side,align:d.align,instant:p,transitionStatus:u}),[f,d.side,d.align,p,u]),h=x.useCallback(I=>{a.set("popupElement",I)},[a]),L=ut("div",t,{state:S,ref:[n,a.context.popupRef,h],props:[g,{"aria-labelledby":R,"aria-describedby":w,onKeyDown(I){c&&Ao.has(I.key)&&I.stopPropagation()}},En(u),l],stateAttributesMapping:es});return U.jsx(Po,{context:T,openInteractionType:m,modal:y==="trap-focus",disabled:!C||E===Z,initialFocus:F,returnFocus:i,restoreFocus:"popup",previousFocusableElement:pe(O)?O:void 0,nextFocusableElement:a.context.triggerFocusTargetRef,beforeContentFocusGuardRef:a.context.beforeContentFocusGuardRef,children:L})});export{os as C,rs as L,ss as P,is as a,cs as b,as as c,ls as d,Wo as e,He as f,zr as g,Gr as h,En as i,Ar as u};
@@ -1 +0,0 @@
1
- import{c as v,r as l,ah as J,ab as Q,aC as L,j as t,m as O,N as x,A as s,Q as Y,an as q,aD as X,ar as ee,as as te,at as A,aE as ne,aF as ae,O as ie,R as se,J as oe,K as re,W as le,aG as ce,aH as ue,aI as de,aJ as ge,E as he,aK as pe,aL as be,aM as me,aN as fe,aO as xe,aP as ye,aQ as ve,a9 as ke}from"./main-BJQZ96HP.js";import{L as je,a as G,u as Ne}from"./use-limits-display-prefs-BOMVZxxS.js";import{S as k,T as j,a as m,b as Se,u as I}from"./use-native-settings-CDAuv4ZG.js";import{C as we}from"./check-Bdnp5EHR.js";import{u as Ce}from"./useCurrency-B562nxEx.js";import{C as P}from"./chevron-down-BdbYSxLt.js";import{I as Le}from"./info-lAuE6Iqy.js";import{D as Ge}from"./download-Cgae7DJA.js";import"./Card-BS2ABbwq.js";const Ee=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Oe=v("activity",Ee);const Ae=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Ie=v("copy",Ae);const Pe=[["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"}]],_e=v("grip-vertical",Pe);const De=[["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"}]],Te=v("languages",De);const Me=[["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"}]],Ue=v("log-out",Me);const Re=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Fe=v("pencil",Re),He=e=>!e.isLayoutDirty&&e.willUpdate(!1);function E(){const e=new Set,n=new WeakMap,i=()=>e.forEach(He);return{add:a=>{e.add(a),n.set(a,a.addEventListener("willUpdate",i))},remove:a=>{e.delete(a);const o=n.get(a);o&&(o(),n.delete(a)),i()},dirty:i}}const $e=l.createContext(null);function Be(){const e=l.useRef(!1);return J(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function ze(){const e=Be(),[n,i]=l.useState(0),a=l.useCallback(()=>{e.current&&i(n+1)},[n]);return[l.useCallback(()=>Q.postRender(a),[a]),n]}const _=e=>e===!0,Ve=e=>_(e===!0)||e==="id",Ke=({children:e,id:n,inherit:i=!0})=>{const a=l.useContext(L),o=l.useContext($e),[r,c]=ze(),u=l.useRef(null),g=a.id||o;u.current===null&&(Ve(i)&&g&&(n=n?g+"-"+n:g),u.current={id:n,group:_(i)&&a.group||E()});const h=l.useMemo(()=>({...u.current,forceRender:r}),[c]);return t.jsx(L.Provider,{value:h,children:e})},We=new Set(["cursor","kiro","copilot","kimi"]);function Ze({checked:e,onChange:n,ariaLabel:i}){return t.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":i,onClick:n,className:x("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:x("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})}function Je({prefs:e}){const{order:n,visibility:i,toggle:a,moveToward:o}=e,[r,c]=l.useState(null),[u,g]=l.useState(null),h=d=>p=>{c(d),p.dataTransfer.effectAllowed="move",p.dataTransfer.setData("text/plain",d)},b=d=>p=>{p.preventDefault(),p.dataTransfer.dropEffect="move",r&&r!==d&&u!==d&&(g(d),o(r,d))},f=()=>{c(null),g(null)},y=d=>{d.preventDefault(),c(null),g(null)};return t.jsx(Ke,{children:t.jsx("div",{className:"flex flex-col",children:n.map(d=>{const p=i[d]!==!1,N=r===d;return t.jsxs(O.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:h(d),onDragOver:b(d),onDragEnd:f,onDrop:y,className:x("flex items-center gap-3 py-2 rounded-md","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60",N&&"opacity-40"),style:{cursor:N?"grabbing":"grab"},children:[t.jsx(_e,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),t.jsx("img",{src:je[d],alt:"",width:18,height:18,className:x("h-[18px] w-[18px] shrink-0 pointer-events-none",We.has(d)&&"dark:invert"),draggable:!1}),t.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:G[d]}),t.jsx("div",{onMouseDown:S=>S.stopPropagation(),draggable:!1,children:t.jsx(Ze,{checked:p,onChange:()=>a(d),ariaLabel:`${s("limits.settings.toggle_visible")}: ${G[d]}`})})]},d)})})})}function Qe(e){if(!e||typeof e!="object")return"";const n=e.user_metadata&&typeof e.user_metadata=="object"?e.user_metadata:{},i=e.profile&&typeof e.profile=="object"?e.profile:{},a=n.full_name||n.name||i.name||n.user_name||n.preferred_username;return typeof a=="string"&&a.trim()?a.trim():typeof e.email=="string"&&e.email.includes("@")?e.email.split("@")[0].trim()||e.email.trim():typeof e.email=="string"?e.email.trim():""}function Ye(e){return!e||typeof e!="object"?"":typeof e.email=="string"?e.email.trim():""}function qe(e){const n=typeof e=="string"?e.trim():"";if(!n)return null;const i=n.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),a=n.match(/^https:\/\/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/?$/i),o=i?.[1]||a?.[1];return o?`https://github.com/${o}`:null}function w(e,n){console.warn(`[tokentracker] settings ${e}:`,n)}function Xe(e,n,i){const[a,o]=l.useState(()=>q()),r=n&&i&&X(),c=l.useCallback(async()=>{const u=!a;if(ee(u),o(u),!!u)try{await te(()=>e())}catch(g){w("cloud sync",g)}},[a,e]);return{cloudSyncOn:a,handleCloudSyncToggle:c,showLocalCloudSync:r}}function et(e){const[n,i]=l.useState(!1),[a,o]=l.useState(!1),[r,c]=l.useState(!1),[u,g]=l.useState(!1),[h,b]=l.useState(null),[f,y]=l.useState(!1),[d,p]=l.useState(""),[N,S]=l.useState(!1),[U,C]=l.useState(""),[R,F]=l.useState(""),[H,$]=l.useState(!1),[B,z]=l.useState(null),V=l.useMemo(()=>Qe(e),[e]),K=l.useMemo(()=>Ye(e),[e]),W=l.useMemo(()=>typeof e?.id=="string"?e.id.trim():"",[e]),Z=l.useMemo(()=>({setAnonymousOn:o,setCustomDisplayName:b,setGithubUrl:C,setProfileLoading:c,setPublicProfileOn:i,setShowGithubOn:S}),[]);return{anonymousOn:a,customDisplayName:h,displayName:V,editingGithub:H,editingName:f,email:K,githubError:B,githubInput:R,githubUrl:U,loadSetters:Z,nameInput:d,profileLoading:r,profileSaving:u,publicProfileOn:n,setAnonymousOn:o,setCustomDisplayName:b,setEditingGithub:$,setEditingName:y,setGithubError:z,setGithubInput:F,setGithubUrl:C,setNameInput:p,setProfileLoading:c,setProfileSaving:g,setPublicProfileOn:i,setShowGithubOn:S,showGithubOn:N,userId:W}}function tt(e,n,i){l.useEffect(()=>{if(!n)return;let a=!0;return i.setProfileLoading(!0),(async()=>{try{const o=await A({getAccessToken:e});if(!a||!o)return;const r=await ne({accessToken:o});if(!a)return;i.setPublicProfileOn(!!r?.enabled),i.setAnonymousOn(!!r?.anonymous),r?.display_name&&i.setCustomDisplayName(r.display_name),i.setShowGithubOn(!!r?.show_github_url),i.setGithubUrl(r?.github_url||"")}catch(o){w("load public profile",o)}finally{a&&i.setProfileLoading(!1)}})(),()=>{a=!1}},[e,n,i])}function nt(e,n){return l.useCallback(async(i,{label:a,onError:o,onSuccess:r}={})=>{if(n.profileSaving)return!1;n.setProfileSaving(!0);try{const c=await A({getAccessToken:e});if(!c)return!1;const u=await ae({accessToken:c,...i});return r?.(u),!0}catch(c){return o?o(c):w(a||"mutate profile",c),!1}finally{n.setProfileSaving(!1)}},[e,n])}function at(e,n){return{anonymousOn:e.anonymousOn,customDisplayName:e.customDisplayName,displayName:e.displayName,editingName:e.editingName,handleAnonymousToggle:n.handleAnonymousToggle,handleSaveName:n.handleSaveName,nameInput:e.nameInput,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingName:e.setEditingName,setNameInput:e.setNameInput,startEditingName:n.startEditingName}}function it(e,n){return{editingGithub:e.editingGithub,githubError:e.githubError,githubInput:e.githubInput,githubUrl:e.githubUrl,handleSaveGithub:n.handleSaveGithub,handleShowGithubToggle:n.handleShowGithubToggle,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingGithub:e.setEditingGithub,setGithubError:e.setGithubError,setGithubInput:e.setGithubInput,showGithubOn:e.showGithubOn,startEditingGithub:n.startEditingGithub}}function st(e,n){const i=l.useCallback(async()=>{const o=!e.publicProfileOn;await n({enabled:o},{label:"toggle public profile",onSuccess:()=>e.setPublicProfileOn(o)})},[n,e]);return{handleAnonymousToggle:l.useCallback(async()=>{const o=!e.anonymousOn;await n({anonymous:o},{label:"toggle anonymous",onSuccess:()=>e.setAnonymousOn(o)})},[n,e]),handlePublicProfileToggle:i}}function ot(e,n){const i=l.useCallback(async()=>{const o=e.nameInput.trim().slice(0,50);o&&await n({display_name:o},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(o),e.setEditingName(!1)}})},[n,e]),a=l.useCallback(()=>{e.setNameInput(e.customDisplayName||e.displayName),e.setEditingName(!0)},[e]);return{handleSaveName:i,startEditingName:a}}function rt(e,n){const i=l.useCallback(async()=>{if(!e.showGithubOn&&!e.githubUrl){e.setEditingGithub(!0),e.setGithubInput(""),e.setGithubError(null);return}const r=!e.showGithubOn;await n({show_github_url:r},{label:"toggle GitHub profile",onSuccess:()=>e.setShowGithubOn(r)})},[n,e]),a=l.useCallback(async()=>{const r=qe(e.githubInput);if(e.githubInput.trim()&&!r){e.setGithubError(s("settings.account.githubUrlInvalid"));return}e.setGithubError(null),await n({github_url:r,show_github_url:!!r},{label:"save GitHub profile",onError:c=>e.setGithubError(c?.message||s("settings.account.githubUrlInvalid")),onSuccess:c=>{e.setGithubUrl(c?.github_url||r||""),e.setShowGithubOn(!!r),e.setEditingGithub(!1)}})},[n,e]),o=l.useCallback(()=>{e.setGithubInput(e.githubUrl),e.setGithubError(null),e.setEditingGithub(!0)},[e]);return{handleSaveGithub:a,handleShowGithubToggle:i,startEditingGithub:o}}function lt(){const e=Y(),n=et(e.user),i=Xe(e.getAccessToken,e.enabled,e.signedIn);tt(e.getAccessToken,e.signedIn,n.loadSetters);const a=nt(e.getAccessToken,n),o=st(n,a),r=ot(n,a),c=rt(n,a);return{...e,...i,email:n.email,handlePublicProfileToggle:o.handlePublicProfileToggle,userId:n.userId,name:at(n,{...o,...r}),github:it(n,c),profileLoading:n.profileLoading,profileSaving:n.profileSaving,publicProfileOn:n.publicProfileOn}}function D({disabled:e,onCancel:n,onSave:i,saveLabel:a=s("settings.account.save")}){return t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:i,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:a}),t.jsx("button",{type:"button",onClick:n,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:s("settings.account.cancel")})]})}function ct({nameInput:e,setEditingName:n,setNameInput:i,profileSaving:a,handleSaveName:o}){return t.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[t.jsx("input",{type:"text",value:e,onChange:r=>i(r.target.value),onKeyDown:r=>{r.key==="Enter"&&o(),r.key==="Escape"&&n(!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:s("settings.account.displayName")}),t.jsx(D,{disabled:a||!e.trim(),onCancel:()=>n(!1),onSave:o,saveLabel:a?s("settings.account.saving"):void 0})]})}function ut({githubError:e,githubInput:n,handleSaveGithub:i,profileSaving:a,setEditingGithub:o,setGithubError:r,setGithubInput:c}){return t.jsxs("div",{className:"mt-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"text",value:n,onChange:u=>{c(u.target.value),e&&r(null)},onKeyDown:u=>{u.key==="Enter"&&i(),u.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:s("settings.account.githubUrlPlaceholder")}),t.jsx(D,{disabled:a,onCancel:()=>{o(!1),r(null)},onSave:i,saveLabel:a?s("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 T({disabled:e=!1,label:n,onClick:i,title:a}){return t.jsxs("button",{type:"button",onClick:i,disabled:e,title:a,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(Fe,{className:"h-3.5 w-3.5","aria-hidden":!0}),n]})}function M({actions:e,editing:n,editor:i,hint:a,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}),n?i:t.jsx("div",{className:"mt-0.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:a})]}),n?null:e]})})}function dt({name:e}){const n=e.anonymousOn?s("settings.account.displayNameDisabledWhileAnon"):void 0;return t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(T,{disabled:e.anonymousOn,label:s("settings.account.edit"),onClick:e.startEditingName,title:n}),t.jsx(j,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:s("settings.account.displayName")})]})}function gt({name:e}){const{anonymousOn:n,customDisplayName:i,displayName:a,editingName:o,handleAnonymousToggle:r,handleSaveName:c,nameInput:u,profileLoading:g,profileSaving:h,setEditingName:b,setNameInput:f,startEditingName:y}=e,d=n?s("settings.account.displayNameAnonymousHint"):i||a;return t.jsx(M,{label:s("settings.account.displayName"),editing:o,hint:d,editor:t.jsx(ct,{nameInput:u,setEditingName:b,setNameInput:f,profileSaving:h,handleSaveName:c}),actions:t.jsx(dt,{name:e})})}function ht({github:e}){const{editingGithub:n,githubError:i,githubInput:a,githubUrl:o,handleSaveGithub:r,handleShowGithubToggle:c,profileLoading:u,profileSaving:g,setEditingGithub:h,setGithubError:b,setGithubInput:f,showGithubOn:y,startEditingGithub:d}=e;return t.jsx(M,{label:s("settings.account.githubUrl"),editing:n,hint:o||s("settings.account.githubUrlHint"),editor:t.jsx(ut,{githubError:i,githubInput:a,handleSaveGithub:r,profileSaving:g,setEditingGithub:h,setGithubError:b,setGithubInput:f}),actions:t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(T,{label:s("settings.account.edit"),onClick:d}),t.jsx(j,{checked:y,onChange:c,disabled:u||g,ariaLabel:s("settings.account.githubUrl")})]})})}function pt(){const{openLoginModal:e}=ie();return t.jsx(k,{title:s("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:s("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:s("settings.account.signIn")})]})})}function bt({name:e,github:n}){return t.jsxs(t.Fragment,{children:[t.jsx(gt,{name:e}),t.jsx(ht,{github:n})]})}function mt(){const e=lt();return e.enabled?e.signedIn?t.jsxs(k,{title:s("settings.section.account"),subtitle:e.email||e.name.customDisplayName||e.name.displayName,action:t.jsx(xt,{onSignOut:e.signOut}),children:[t.jsx(ft,{userId:e.userId}),t.jsx(yt,{settings:e}),t.jsx(vt,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),t.jsx(kt,{visible:e.publicProfileOn,name:e.name,github:e.github})]}):t.jsx(pt,{}):null}function ft({userId:e}){const[n,i]=se.useState(!1);if(!e)return null;const a=async()=>{try{if(typeof navigator>"u"||!navigator.clipboard?.writeText)return;await navigator.clipboard.writeText(e),i(!0),globalThis.setTimeout(()=>i(!1),1200)}catch{i(!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:s("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:a,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":s("settings.account.copyUserId"),children:[n?t.jsx(we,{className:"h-3.5 w-3.5","aria-hidden":!0}):t.jsx(Ie,{className:"h-3.5 w-3.5","aria-hidden":!0}),n?s("settings.account.copied"):s("settings.account.copy")]})]})}function xt({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(Ue,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.account.signOut")]})}function yt({settings:e}){return e.showLocalCloudSync?t.jsx(m,{label:s("settings.account.cloudSync"),hint:s("settings.account.cloudSyncHint"),control:t.jsx(j,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:s("settings.account.cloudSync")})}):null}function vt({checked:e,disabled:n,onChange:i}){return t.jsx(m,{label:s("settings.account.publicProfile"),hint:s("settings.account.publicProfileHint"),control:t.jsx(j,{checked:e,onChange:i,disabled:n,ariaLabel:s("settings.account.publicProfile")})})}function kt({visible:e,name:n,github:i}){return t.jsx(oe,{initial:!1,children:e?t.jsx(O.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(bt,{name:n,github:i})},"public-profile-fields"):null})}function jt(){return[{value:"light",label:s("settings.appearance.theme.light"),Icon:ce},{value:"dark",label:s("settings.appearance.theme.dark"),Icon:ue},{value:"system",label:s("settings.appearance.theme.system"),Icon:de}]}function Nt(){return[{value:pe,label:s("settings.appearance.language.system")},{value:be,label:s("settings.appearance.language.english")},{value:me,label:s("settings.appearance.language.chinese")},{value:fe,label:s("settings.appearance.language.traditional_chinese")},{value:xe,label:s("settings.appearance.language.japanese")},{value:ye,label:s("settings.appearance.language.korean")}]}function St(e){if(!e)return null;try{const n=new Date(e);return Number.isNaN(n.getTime())?null:n.toLocaleString()}catch{return null}}function wt(e,n){const i=s(`settings.appearance.currency.rate_source.${e}`),a=St(n),o=a?s("settings.appearance.currency.rate_updated",{when:a}):s("settings.appearance.currency.rate_never");return`${i} · ${o}`}function Ct({locale:e,setLocale:n}){const i=Nt();return t.jsxs("div",{className:"relative inline-flex",children:[t.jsx(Te,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0}),t.jsx("select",{value:e,onChange:a=>n(a.target.value),"aria-label":s("settings.appearance.language.label"),className:x("appearance-none rounded-lg border border-oai-gray-200 bg-white py-1.5 pl-8 pr-8 text-xs font-medium text-oai-black","transition-colors hover:bg-oai-gray-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500","dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:hover:bg-oai-gray-800"),children:i.map(a=>t.jsx("option",{value:a.value,children:a.label},a.value))}),t.jsx(P,{className:"pointer-events-none absolute right-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]})}function Lt({currency:e,setCurrency:n}){const i=ge();return t.jsxs("div",{className:"relative inline-flex",children:[t.jsx("select",{value:e,onChange:a=>n(a.target.value),"aria-label":s("settings.appearance.currency.label"),className:x("appearance-none rounded-lg border border-oai-gray-200 bg-white py-1.5 pl-3 pr-8 text-xs font-medium text-oai-black","transition-colors hover:bg-oai-gray-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500","dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:hover:bg-oai-gray-800"),children:i.map(a=>t.jsx("option",{value:a.code,children:s(a.labelKey)},a.code))}),t.jsx(P,{className:"pointer-events-none absolute right-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]})}function Gt({currency:e,rate:n,rateSource:i,rateFetchedAt:a}){if(e===he)return t.jsx(t.Fragment,{children:s("settings.appearance.currency.hint")});const o=wt(i,a);return t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx("span",{children:`1 USD = ${n.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(Le,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}function Et(){const{theme:e,setTheme:n}=re(),{locale:i,setLocale:a}=le(),{currency:o,rate:r,rateSource:c,rateFetchedAt:u,setCurrency:g}=Ce();return t.jsxs(k,{title:s("settings.section.appearance"),children:[t.jsx(m,{label:s("settings.appearance.theme.label"),hint:s("settings.appearance.theme.hint"),control:t.jsx(Se,{options:jt(),value:e,onChange:n})}),t.jsx(m,{label:s("settings.appearance.language.label"),hint:s("settings.appearance.language.hint"),control:t.jsx(Ct,{locale:i,setLocale:a})}),t.jsx(m,{label:s("settings.appearance.currency.label"),hint:t.jsx(Gt,{currency:o,rate:r,rateSource:c,rateFetchedAt:u}),control:t.jsx(Lt,{currency:o,setCurrency:g})})]})}function Ot(){const{available:e,settings:n,setSetting:i,runAction:a}=I();if(!e)return null;const o=!!n?.launchAtLogin,r=n?.launchAtLoginSupported!==!1,c=n?.updateStatus||null,u=!!n?.updateBusy,g=!!n?.isSyncing;return t.jsxs(k,{title:s("settings.section.menubar"),children:[r?t.jsx(m,{label:s("settings.menubar.launchAtLogin"),hint:s("settings.menubar.launchAtLoginHint"),control:t.jsx(j,{checked:o,onChange:()=>i("launchAtLogin",!o),ariaLabel:s("settings.menubar.launchAtLogin")})}):null,t.jsx(m,{label:s("settings.menubar.syncNow"),hint:s("settings.menubar.syncNowHint"),control:t.jsxs("button",{type:"button",onClick:()=>a("syncNow"),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(ve,{className:x("h-3.5 w-3.5",g&&"animate-spin"),"aria-hidden":!0}),g?s("settings.menubar.syncing"):s("settings.menubar.syncNow")]})}),t.jsx(m,{label:s("settings.menubar.updates"),hint:c||void 0,control:t.jsxs("button",{type:"button",onClick:()=>a("checkForUpdates"),disabled:u,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(Ge,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.menubar.checkUpdates")]})})]})}function At(){const{available:e,settings:n,runAction:i}=I(),a=e&&n?.version;return t.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-2 text-xs text-oai-gray-500 dark:text-oai-gray-500",children:[a?t.jsxs(t.Fragment,{children:[t.jsxs("span",{children:["TokenTrackerBar v",n.version]}),t.jsx("span",{"aria-hidden":!0,children:"·"}),t.jsx("button",{type:"button",onClick:()=>i("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:"·"})]}):null,t.jsxs("a",{href:ke,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(Oe,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.footer.statusPage")]})]})}function Ht(){const e=Ne();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 max-w-3xl px-4 sm:px-6",children:[t.jsxs("div",{className:"mb-8",children:[t.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:s("settings.page.title")}),t.jsx("p",{className:"mt-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.page.subtitle")})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsx(Et,{}),t.jsx(Ot,{}),t.jsx(mt,{}),t.jsx(k,{title:s("settings.section.limits"),children:t.jsx(Je,{prefs:e})})]}),t.jsx(At,{})]})})})}export{Ht as SettingsPage};