tokentracker-cli 0.30.0 → 0.31.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +3 -1
- package/README.ko.md +3 -1
- package/README.md +3 -1
- package/README.zh-CN.md +3 -1
- package/dashboard/dist/assets/{ActivityHeatmap-BzW0rtoR.js → ActivityHeatmap-BjiEMIl2.js} +1 -1
- package/dashboard/dist/assets/{Card-wgEcKm5u.js → Card-Nlgzr57Q.js} +1 -1
- package/dashboard/dist/assets/DashboardPage-z7rLj1gX.js +19 -0
- package/dashboard/dist/assets/{DevicePage-D82cqG-v.js → DevicePage-B1NhBt9Q.js} +1 -1
- package/dashboard/dist/assets/DialogTitle-CEBn-oBo.js +12 -0
- package/dashboard/dist/assets/FadeIn-Dbk47nhk.js +1 -0
- package/dashboard/dist/assets/{HeaderGithubStar-CSBGOKw2.js → HeaderGithubStar-B0OAKXVw.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-WXEmhuVW.js → IpCheckPage-C0wQLtdK.js} +1 -1
- package/dashboard/dist/assets/{LandingPage-ap4xIJva.js → LandingPage-DWSbmVip.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardAvatar-CjaHOh8E.js → LeaderboardAvatar-CLMnffKE.js} +1 -1
- package/dashboard/dist/assets/LeaderboardPage-CZvefN8H.js +6 -0
- package/dashboard/dist/assets/{LeaderboardProfileModal-BX4b5Uqc.js → LeaderboardProfileModal-DasxA8Lo.js} +3 -3
- package/dashboard/dist/assets/LeaderboardProfilePage-DJJ7l3Ix.js +1 -0
- package/dashboard/dist/assets/LimitsPage-xUmhxOqT.js +2 -0
- package/dashboard/dist/assets/{LocalOnlyNotice-D43ZmQJl.js → LocalOnlyNotice-B3uM29rj.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-gqSOnPUr.js → LoginPage-BejL6eIO.js} +1 -1
- package/dashboard/dist/assets/PopoverPopup-V6vxWbIV.js +1 -0
- package/dashboard/dist/assets/SettingsPage-DossFM4s.js +1 -0
- package/dashboard/dist/assets/SkillsPage-COwiRUo1.js +1 -0
- package/dashboard/dist/assets/WidgetsPage-CtkM_RQn.js +1 -0
- package/dashboard/dist/assets/WrappedPage-BpXrsSoG.js +1 -0
- package/dashboard/dist/assets/agent-logos-D6Jmq7E1.js +1 -0
- package/dashboard/dist/assets/{arrow-up-right-BXWeIpuU.js → arrow-up-right-BS0sCPTz.js} +1 -1
- package/dashboard/dist/assets/check-DKwh5hl-.js +1 -0
- package/dashboard/dist/assets/{chevron-down-u-JNpncG.js → chevron-down-DyiXbuAL.js} +1 -1
- package/dashboard/dist/assets/{download-DvfHniid.js → download-CqDWRO99.js} +1 -1
- package/dashboard/dist/assets/{info-BdrJIus6.js → info-DMW1GFmI.js} +1 -1
- package/dashboard/dist/assets/main-CjFrTufR.css +1 -0
- package/dashboard/dist/assets/main-uqC1VAKB.js +959 -0
- package/dashboard/dist/assets/{use-limits-display-prefs-DU4WDeXF.js → use-limits-display-prefs-C04zvO7N.js} +1 -1
- package/dashboard/dist/assets/{use-native-settings-CefuRE0t.js → use-native-settings-BvFr6zgZ.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-BvZsTD3e.js → use-usage-limits-5fwy0xeB.js} +1 -1
- package/dashboard/dist/assets/useCurrency-vRzRfd7L.js +1 -0
- package/dashboard/dist/index.html +2 -2
- package/dashboard/dist/share.html +2 -2
- package/package.json +1 -1
- package/src/lib/local-api.js +67 -0
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/src/lib/skill-usage.js +267 -0
- package/src/lib/skills-manager.js +371 -13
- package/dashboard/dist/assets/DashboardPage-BH_InuuJ.js +0 -19
- package/dashboard/dist/assets/DialogTitle-QumMNQjm.js +0 -12
- package/dashboard/dist/assets/FadeIn-B2rj5E5l.js +0 -1
- package/dashboard/dist/assets/LeaderboardPage-DN4Sd56j.js +0 -6
- package/dashboard/dist/assets/LeaderboardProfilePage-hkIYzooc.js +0 -1
- package/dashboard/dist/assets/LimitsPage-BgoAXuwU.js +0 -2
- package/dashboard/dist/assets/PopoverPopup-BkMR2-Ij.js +0 -1
- package/dashboard/dist/assets/ProviderIcon-No-nxvR1.js +0 -1
- package/dashboard/dist/assets/SettingsPage-BVpnWPq9.js +0 -1
- package/dashboard/dist/assets/SkillsPage-DnIxIt1d.js +0 -1
- package/dashboard/dist/assets/WidgetsPage-DY7qT8jg.js +0 -1
- package/dashboard/dist/assets/WrappedPage-BTkoEQPM.js +0 -1
- package/dashboard/dist/assets/agent-logos-Dp5LiRgu.js +0 -1
- package/dashboard/dist/assets/check-B_JRaxbD.js +0 -1
- package/dashboard/dist/assets/main-BojOq9Ae.css +0 -1
- package/dashboard/dist/assets/main-DhcQGvkP.js +0 -917
- package/dashboard/dist/assets/use-reduced-motion-nzFM1j1r.js +0 -1
- package/dashboard/dist/assets/useCurrency-C62kk8HZ.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as tn,r as x,G as Me,u as X}from"./main-DhcQGvkP.js";import{ai as Ce,aa as Hn,G as nt,aj as $n,c as G,ak as be,al as Vn,J as nn,am as ot,L as U,an as de,ab as pe,ao as $t,ap as fe,z as ge,aq as on,ar as at,as as Ie,at as We,au as Wn,av as sn,aw as _n,ax as lt,ay as ft,az as Ue,aA as Nn,n as ut,Q as rn,aB as jn,aC as cn,p as ce,o as dt,aD as Yn,aE as zn,r as q,aF as ee,w as _e,B as an,m as we,x as le,aG as ln,aH as Un,I as ke,V as Xn,aI as Vt,a1 as fn,aJ as Kn,aK as Gn,aL as qn,aM as Jn,aN as Qn,C as st,aO as Zn,aP as eo,M as se,aQ as to,P as no,aR as oo,aS as so,a6 as ro,aT as io,aU as co,T as ao,aV as lo,U as un,K as fo,aW as uo,a0 as go,a3 as po,a as gt,aX as mo,aY as Wt,aZ as ho,a_ as xo,a$ as yo,b0 as Ro,a4 as vo,b1 as bo,b2 as wo,b3 as Eo,a7 as Co,a8 as Oo,b4 as To,a9 as dn,S as So,ad as Po,af as Ao,ag as Mo}from"./DialogTitle-QumMNQjm.js";const Io=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],lr=tn("chevron-right",Io);const ko=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],fr=tn("loader-circle",ko),Do=["top","right","bottom","left"],Oe=Math.min,Q=Math.max,Ne=Math.round,He=Math.floor,ae=e=>({x:e,y:e}),Lo={left:"right",right:"left",bottom:"top",top:"bottom"};function rt(e,t,n){return Q(e,Oe(t,n))}function ue(e,t){return typeof e=="function"?e(t):e}function J(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),s=ht(e),r=mt(s);let i=s==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[r]>t.floating[r]&&(i=je(i)),[i,je(i)]}function Bo(e){const t=je(e);return[it(e),t,it(t)]}function it(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const _t=["left","right"],Nt=["right","left"],Ho=["top","bottom"],$o=["bottom","top"];function Vo(e,t,n){switch(e){case"top":case"bottom":return n?t?Nt:_t:t?_t:Nt;case"left":case"right":return t?Ho:$o;default:return[]}}function Wo(e,t,n,o){const s=me(e);let r=Vo(J(e),n==="start",o);return s&&(r=r.map(i=>i+"-"+s),t&&(r=r.concat(r.map(it)))),r}function je(e){const t=J(e);return Lo[t]+e.slice(t.length)}function _o(e){return{top:0,right:0,bottom:0,left:0,...e}}function gn(e){return typeof e!="number"?_o(e):{top:e,right:e,bottom:e,left:e}}function Ye(e){const{x:t,y:n,width:o,height:s}=e;return{width:o,height:s,top:n,left:t,right:t+o,bottom:n+s,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 No(e,t={}){const n="rootStore"in e?e.rootStore:e,o=n.context.dataRef,{enabled:s=!0,event:r="click",toggle:i=!0,ignoreMouse:l=!1,stickIfOpen:a=!0,touchOpenDelay:u=0}=t,c=x.useRef(void 0),f=Hn(),d=nt(),p=x.useMemo(()=>({onPointerDown(g){c.current=g.pointerType},onMouseDown(g){const m=c.current,b=g.nativeEvent,E=n.select("open");if(g.button!==0||r==="click"||Ce(m,!0)&&l)return;const R=o.current.openEvent,C=R?.type,h=n.select("domReferenceElement")!==g.currentTarget,O=E&&h||!(E&&i&&(!(R&&a)||C==="click"||C==="mousedown"));if(Vn(b.target)){const w=G(be,b,b.target);O&&m==="touch"&&u>0?d.start(u,()=>{n.setOpen(!0,w)}):n.setOpen(O,w);return}const T=g.currentTarget;f.request(()=>{const w=G(be,b,T);O&&m==="touch"&&u>0?d.start(u,()=>{n.setOpen(!0,w)}):n.setOpen(O,w)})},onClick(g){if(r==="mousedown-only")return;const m=c.current;if(r==="mousedown"&&m){c.current=void 0;return}if(Ce(m,!0)&&l)return;const b=n.select("open"),E=o.current.openEvent,R=n.select("domReferenceElement")!==g.currentTarget,C=b&&R||!(b&&i&&(!(E&&a)||$n(E))),h=G(be,g.nativeEvent,g.currentTarget);C&&m==="touch"&&u>0?d.start(u,()=>{n.setOpen(!0,h)}):n.setOpen(C,h)},onKeyDown(){c.current=void 0}}),[o,r,l,n,a,i,f,d,u]);return x.useMemo(()=>s?{reference:p}:nn,[s,p])}function jt(e,t,n){let{reference:o,floating:s}=e;const r=te(t),i=ht(t),l=mt(i),a=J(t),u=r==="y",c=o.x+o.width/2-s.width/2,f=o.y+o.height/2-s.height/2,d=o[l]/2-s[l]/2;let p;switch(a){case"top":p={x:c,y:o.y-s.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-s.width,y:f};break;default:p={x:o.x,y:o.y}}switch(me(t)){case"start":p[i]-=d*(n&&u?-1:1);break;case"end":p[i]+=d*(n&&u?-1:1);break}return p}async function jo(e,t){var n;t===void 0&&(t={});const{x:o,y:s,platform:r,rects:i,elements:l,strategy:a}=e,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:f="floating",altBoundary:d=!1,padding:p=0}=ue(t,e),g=gn(p),b=l[d?f==="floating"?"reference":"floating":f],E=Ye(await r.getClippingRect({element:(n=await(r.isElement==null?void 0:r.isElement(b)))==null||n?b:b.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(l.floating)),boundary:u,rootBoundary:c,strategy:a})),R=f==="floating"?{x:o,y:s,width:i.floating.width,height:i.floating.height}:i.reference,C=await(r.getOffsetParent==null?void 0:r.getOffsetParent(l.floating)),h=await(r.isElement==null?void 0:r.isElement(C))?await(r.getScale==null?void 0:r.getScale(C))||{x:1,y:1}:{x:1,y:1},O=Ye(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:R,offsetParent:C,strategy:a}):R);return{top:(E.top-O.top+g.top)/h.y,bottom:(O.bottom-E.bottom+g.bottom)/h.y,left:(E.left-O.left+g.left)/h.x,right:(O.right-E.right+g.right)/h.x}}const Yo=50,zo=async(e,t,n)=>{const{placement:o="bottom",strategy:s="absolute",middleware:r=[],platform:i}=n,l=i.detectOverflow?i:{...i,detectOverflow:jo},a=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:s}),{x:c,y:f}=jt(u,o,a),d=o,p=0;const g={};for(let m=0;m<r.length;m++){const b=r[m];if(!b)continue;const{name:E,fn:R}=b,{x:C,y:h,data:O,reset:T}=await R({x:c,y:f,initialPlacement:o,placement:d,strategy:s,middlewareData:g,rects:u,platform:l,elements:{reference:e,floating:t}});c=C??c,f=h??f,g[E]={...g[E],...O},T&&p<Yo&&(p++,typeof T=="object"&&(T.placement&&(d=T.placement),T.rects&&(u=T.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:s}):T.rects),{x:c,y:f}=jt(u,d,a)),m=-1)}return{x:c,y:f,placement:d,strategy:s,middlewareData:g}},Uo=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:s,middlewareData:r,rects:i,initialPlacement:l,platform:a,elements:u}=t,{mainAxis:c=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:m=!0,...b}=ue(e,t);if((n=r.arrow)!=null&&n.alignmentOffset)return{};const E=J(s),R=te(l),C=J(l)===l,h=await(a.isRTL==null?void 0:a.isRTL(u.floating)),O=d||(C||!m?[je(l)]:Bo(l)),T=g!=="none";!d&&T&&O.push(...Wo(l,m,g,h));const w=[l,...O],k=await a.detectOverflow(t,b),$=[];let A=((o=r.flip)==null?void 0:o.overflows)||[];if(c&&$.push(k[E]),f){const D=Fo(s,i,h);$.push(k[D[0]],k[D[1]])}if(A=[...A,{placement:s,overflows:$}],!$.every(D=>D<=0)){var L,S;const D=(((L=r.flip)==null?void 0:L.index)||0)+1,I=w[D];if(I&&(!(f==="alignment"?R!==te(I):!1)||A.every(v=>te(v.placement)===R?v.overflows[0]>0:!0)))return{data:{index:D,overflows:A},reset:{placement:I}};let F=(S=A.filter(M=>M.overflows[0]<=0).sort((M,v)=>M.overflows[1]-v.overflows[1])[0])==null?void 0:S.placement;if(!F)switch(p){case"bestFit":{var y;const M=(y=A.filter(v=>{if(T){const P=te(v.placement);return P===R||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:y[0];M&&(F=M);break}case"initialPlacement":F=l;break}if(s!==F)return{reset:{placement:F}}}return{}}}};function Yt(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function zt(e){return Do.some(t=>e[t]>=0)}const Xo=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:o}=t,{strategy:s="referenceHidden",...r}=ue(e,t);switch(s){case"referenceHidden":{const i=await o.detectOverflow(t,{...r,elementContext:"reference"}),l=Yt(i,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:zt(l)}}}case"escaped":{const i=await o.detectOverflow(t,{...r,altBoundary:!0}),l=Yt(i,n.floating);return{data:{escapedOffsets:l,escaped:zt(l)}}}default:return{}}}}},pn=new Set(["left","top"]);async function Ko(e,t){const{placement:n,platform:o,elements:s}=e,r=await(o.isRTL==null?void 0:o.isRTL(s.floating)),i=J(n),l=me(n),a=te(n)==="y",u=pn.has(i)?-1:1,c=r&&a?-1:1,f=ue(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof g=="number"&&(p=l==="end"?g*-1:g),a?{x:p*c,y:d*u}:{x:d*u,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:s,y:r,placement:i,middlewareData:l}=t,a=await Ko(t,e);return i===((n=l.offset)==null?void 0:n.placement)&&(o=l.arrow)!=null&&o.alignmentOffset?{}:{x:s+a.x,y:r+a.y,data:{...a,placement:i}}}}},qo=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:s,platform:r}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:a={fn:E=>{let{x:R,y:C}=E;return{x:R,y:C}}},...u}=ue(e,t),c={x:n,y:o},f=await r.detectOverflow(t,u),d=te(J(s)),p=pt(d);let g=c[p],m=c[d];if(i){const E=p==="y"?"top":"left",R=p==="y"?"bottom":"right",C=g+f[E],h=g-f[R];g=rt(C,g,h)}if(l){const E=d==="y"?"top":"left",R=d==="y"?"bottom":"right",C=m+f[E],h=m-f[R];m=rt(C,m,h)}const b=a.fn({...t,[p]:g,[d]:m});return{...b,data:{x:b.x-n,y:b.y-o,enabled:{[p]:i,[d]:l}}}}}},Jo=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:s,rects:r,middlewareData:i}=t,{offset:l=0,mainAxis:a=!0,crossAxis:u=!0}=ue(e,t),c={x:n,y:o},f=te(s),d=pt(f);let p=c[d],g=c[f];const m=ue(l,t),b=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(a){const C=d==="y"?"height":"width",h=r.reference[d]-r.floating[C]+b.mainAxis,O=r.reference[d]+r.reference[C]-b.mainAxis;p<h?p=h:p>O&&(p=O)}if(u){var E,R;const C=d==="y"?"width":"height",h=pn.has(J(s)),O=r.reference[f]-r.floating[C]+(h&&((E=i.offset)==null?void 0:E[f])||0)+(h?0:b.crossAxis),T=r.reference[f]+r.reference[C]+(h?0:((R=i.offset)==null?void 0:R[f])||0)-(h?b.crossAxis:0);g<O?g=O:g>T&&(g=T)}return{[d]:p,[f]:g}}}},Qo=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:s,rects:r,platform:i,elements:l}=t,{apply:a=()=>{},...u}=ue(e,t),c=await i.detectOverflow(t,u),f=J(s),d=me(s),p=te(s)==="y",{width:g,height:m}=r.floating;let b,E;f==="top"||f==="bottom"?(b=f,E=d===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(E=f,b=d==="end"?"top":"bottom");const R=m-c.top-c.bottom,C=g-c.left-c.right,h=Oe(m-c[b],R),O=Oe(g-c[E],C),T=!t.middlewareData.shift;let w=h,k=O;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(k=C),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(w=R),T&&!d){const A=Q(c.left,0),L=Q(c.right,0),S=Q(c.top,0),y=Q(c.bottom,0);p?k=g-2*(A!==0||L!==0?A+L:Q(c.left,c.right)):w=m-2*(S!==0||y!==0?S+y:Q(c.top,c.bottom))}await a({...t,availableWidth:k,availableHeight:w});const $=await i.getDimensions(l.floating);return g!==$.width||m!==$.height?{reset:{rects:!0}}:{}}}};function mn(e){const t=fe(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const s=ge(e),r=s?e.offsetWidth:n,i=s?e.offsetHeight:o,l=Ne(n)!==r||Ne(o)!==i;return l&&(n=r,o=i),{width:n,height:o,$:l}}function xt(e){return U(e)?e:e.contextElement}function Ee(e){const t=xt(e);if(!ge(t))return ae(1);const n=t.getBoundingClientRect(),{width:o,height:s,$:r}=mn(t);let i=(r?Ne(n.width):n.width)/o,l=(r?Ne(n.height):n.height)/s;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const Zo=ae(0);function hn(e){const t=pe(e);return!on()||!t.visualViewport?Zo:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function es(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==pe(e)?!1:t}function he(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),r=xt(e);let i=ae(1);t&&(o?U(o)&&(i=Ee(o)):i=Ee(e));const l=es(r,n,o)?hn(r):ae(0);let a=(s.left+l.x)/i.x,u=(s.top+l.y)/i.y,c=s.width/i.x,f=s.height/i.y;if(r){const d=pe(r),p=o&&U(o)?pe(o):o;let g=d,m=$t(g);for(;m&&o&&p!==g;){const b=Ee(m),E=m.getBoundingClientRect(),R=fe(m),C=E.left+(m.clientLeft+parseFloat(R.paddingLeft))*b.x,h=E.top+(m.clientTop+parseFloat(R.paddingTop))*b.y;a*=b.x,u*=b.y,c*=b.x,f*=b.y,a+=C,u+=h,g=pe(m),m=$t(g)}}return Ye({width:c,height:f,x:a,y:u})}function Xe(e,t){const n=Ue(e).scrollLeft;return t?t.left+n:he(de(e)).left+n}function xn(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-Xe(e,n),s=n.top+t.scrollTop;return{x:o,y:s}}function ts(e){let{elements:t,rect:n,offsetParent:o,strategy:s}=e;const r=s==="fixed",i=de(o),l=t?at(t.floating):!1;if(o===i||l&&r)return n;let a={scrollLeft:0,scrollTop:0},u=ae(1);const c=ae(0),f=ge(o);if((f||!f&&!r)&&((lt(o)!=="body"||ft(i))&&(a=Ue(o)),f)){const p=he(o);u=Ee(o),c.x=p.x+o.clientLeft,c.y=p.y+o.clientTop}const d=i&&!f&&!r?xn(i,a):ae(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-a.scrollLeft*u.x+c.x+d.x,y:n.y*u.y-a.scrollTop*u.y+c.y+d.y}}function ns(e){return Array.from(e.getClientRects())}function os(e){const t=de(e),n=Ue(e),o=e.ownerDocument.body,s=Q(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),r=Q(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let i=-n.scrollLeft+Xe(e);const l=-n.scrollTop;return fe(o).direction==="rtl"&&(i+=Q(t.clientWidth,o.clientWidth)-s),{width:s,height:r,x:i,y:l}}const Ut=25;function ss(e,t){const n=pe(e),o=de(e),s=n.visualViewport;let r=o.clientWidth,i=o.clientHeight,l=0,a=0;if(s){r=s.width,i=s.height;const c=on();(!c||c&&t==="fixed")&&(l=s.offsetLeft,a=s.offsetTop)}const u=Xe(o);if(u<=0){const c=o.ownerDocument,f=c.body,d=getComputedStyle(f),p=c.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,g=Math.abs(o.clientWidth-f.clientWidth-p);g<=Ut&&(r-=g)}else u<=Ut&&(r+=u);return{width:r,height:i,x:l,y:a}}function rs(e,t){const n=he(e,!0,t==="fixed"),o=n.top+e.clientTop,s=n.left+e.clientLeft,r=ge(e)?Ee(e):ae(1),i=e.clientWidth*r.x,l=e.clientHeight*r.y,a=s*r.x,u=o*r.y;return{width:i,height:l,x:a,y:u}}function Xt(e,t,n){let o;if(t==="viewport")o=ss(e,n);else if(t==="document")o=os(de(e));else if(U(t))o=rs(t,n);else{const s=hn(e);o={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Ye(o)}function yn(e,t){const n=Ie(e);return n===t||!U(n)||We(n)?!1:fe(n).position==="fixed"||yn(n,t)}function is(e,t){const n=t.get(e);if(n)return n;let o=ot(e,[],!1).filter(l=>U(l)&<(l)!=="body"),s=null;const r=fe(e).position==="fixed";let i=r?Ie(e):e;for(;U(i)&&!We(i);){const l=fe(i),a=sn(i);!a&&l.position==="fixed"&&(s=null),(r?!a&&!s:!a&&l.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||ft(i)&&!a&&yn(e,i))?o=o.filter(c=>c!==i):s=l,i=Ie(i)}return t.set(e,o),o}function cs(e){let{element:t,boundary:n,rootBoundary:o,strategy:s}=e;const i=[...n==="clippingAncestors"?at(t)?[]:is(t,this._c):[].concat(n),o],l=Xt(t,i[0],s);let a=l.top,u=l.right,c=l.bottom,f=l.left;for(let d=1;d<i.length;d++){const p=Xt(t,i[d],s);a=Q(p.top,a),u=Oe(p.right,u),c=Oe(p.bottom,c),f=Q(p.left,f)}return{width:u-f,height:c-a,x:f,y:a}}function as(e){const{width:t,height:n}=mn(e);return{width:t,height:n}}function ls(e,t,n){const o=ge(t),s=de(t),r=n==="fixed",i=he(e,!0,r,t);let l={scrollLeft:0,scrollTop:0};const a=ae(0);function u(){a.x=Xe(s)}if(o||!o&&!r)if((lt(t)!=="body"||ft(s))&&(l=Ue(t)),o){const p=he(t,!0,r,t);a.x=p.x+t.clientLeft,a.y=p.y+t.clientTop}else s&&u();r&&!o&&s&&u();const c=s&&!o&&!r?xn(s,l):ae(0),f=i.left+l.scrollLeft-a.x-c.x,d=i.top+l.scrollTop-a.y-c.y;return{x:f,y:d,width:i.width,height:i.height}}function Ze(e){return fe(e).position==="static"}function Kt(e,t){if(!ge(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 Rn(e,t){const n=pe(e);if(at(e))return n;if(!ge(e)){let s=Ie(e);for(;s&&!We(s);){if(U(s)&&!Ze(s))return s;s=Ie(s)}return n}let o=Kt(e,t);for(;o&&Wn(o)&&Ze(o);)o=Kt(o,t);return o&&We(o)&&Ze(o)&&!sn(o)?n:o||_n(e)||n}const fs=async function(e){const t=this.getOffsetParent||Rn,n=this.getDimensions,o=await n(e.floating);return{reference:ls(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function us(e){return fe(e).direction==="rtl"}const ds={convertOffsetParentRelativeRectToViewportRelativeRect:ts,getDocumentElement:de,getClippingRect:cs,getOffsetParent:Rn,getElementRects:fs,getClientRects:ns,getDimensions:as,getScale:Ee,isElement:U,isRTL:us};function vn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function gs(e,t){let n=null,o;const s=de(e);function r(){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),r();const u=e.getBoundingClientRect(),{left:c,top:f,width:d,height:p}=u;if(l||t(),!d||!p)return;const g=He(f),m=He(s.clientWidth-(c+d)),b=He(s.clientHeight-(f+p)),E=He(c),C={rootMargin:-g+"px "+-m+"px "+-b+"px "+-E+"px",threshold:Q(0,Oe(1,a))||1};let h=!0;function O(T){const w=T[0].intersectionRatio;if(w!==a){if(!h)return i();w?i(!1,w):o=setTimeout(()=>{i(!1,1e-7)},1e3)}w===1&&!vn(u,e.getBoundingClientRect())&&i(),h=!1}try{n=new IntersectionObserver(O,{...C,root:s.ownerDocument})}catch{n=new IntersectionObserver(O,C)}n.observe(e)}return i(!0),r}function Gt(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:s=!0,ancestorResize:r=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=o,u=xt(e),c=s||r?[...u?ot(u):[],...t?ot(t):[]]:[];c.forEach(E=>{s&&E.addEventListener("scroll",n,{passive:!0}),r&&E.addEventListener("resize",n)});const f=u&&l?gs(u,n):null;let d=-1,p=null;i&&(p=new ResizeObserver(E=>{let[R]=E;R&&R.target===u&&p&&t&&(p.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var C;(C=p)==null||C.observe(t)})),n()}),u&&!a&&p.observe(u),t&&p.observe(t));let g,m=a?he(e):null;a&&b();function b(){const E=he(e);m&&!vn(m,E)&&n(),m=E,g=requestAnimationFrame(b)}return n(),()=>{var E;c.forEach(R=>{s&&R.removeEventListener("scroll",n),r&&R.removeEventListener("resize",n)}),f?.(),(E=p)==null||E.disconnect(),p=null,a&&cancelAnimationFrame(g)}}const ps=Go,ms=qo,hs=Uo,xs=Qo,ys=Xo,Rs=Jo,vs=(e,t,n)=>{const o=new Map,s={platform:ds,...n},r={...s.platform,_c:o};return zo(e,t,{...s,platform:r})};var bs=typeof document<"u",ws=function(){},$e=bs?x.useLayoutEffect:ws;function ze(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,s;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(!ze(e[o],t[o]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,s[o]))return!1;for(o=n;o--!==0;){const r=s[o];if(!(r==="_owner"&&e.$$typeof)&&!ze(e[r],t[r]))return!1}return!0}return e!==e&&t!==t}function bn(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function qt(e,t){const n=bn(e);return Math.round(t*n)/n}function et(e){const t=x.useRef(e);return $e(()=>{t.current=e}),t}function Es(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:s,elements:{reference:r,floating:i}={},transform:l=!0,whileElementsMounted:a,open:u}=e,[c,f]=x.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[d,p]=x.useState(o);ze(d,o)||p(o);const[g,m]=x.useState(null),[b,E]=x.useState(null),R=x.useCallback(v=>{v!==T.current&&(T.current=v,m(v))},[]),C=x.useCallback(v=>{v!==w.current&&(w.current=v,E(v))},[]),h=r||g,O=i||b,T=x.useRef(null),w=x.useRef(null),k=x.useRef(c),$=a!=null,A=et(a),L=et(s),S=et(u),y=x.useCallback(()=>{if(!T.current||!w.current)return;const v={placement:t,strategy:n,middleware:d};L.current&&(v.platform=L.current),vs(T.current,w.current,v).then(P=>{const N={...P,isPositioned:S.current!==!1};D.current&&!ze(k.current,N)&&(k.current=N,Me.flushSync(()=>{f(N)}))})},[d,t,n,L,S]);$e(()=>{u===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,f(v=>({...v,isPositioned:!1})))},[u]);const D=x.useRef(!1);$e(()=>(D.current=!0,()=>{D.current=!1}),[]),$e(()=>{if(h&&(T.current=h),O&&(w.current=O),h&&O){if(A.current)return A.current(h,O,y);y()}},[h,O,y,A,$]);const I=x.useMemo(()=>({reference:T,floating:w,setReference:R,setFloating:C}),[R,C]),F=x.useMemo(()=>({reference:h,floating:O}),[h,O]),M=x.useMemo(()=>{const v={position:n,left:0,top:0};if(!F.floating)return v;const P=qt(F.floating,c.x),N=qt(F.floating,c.y);return l?{...v,transform:"translate("+P+"px, "+N+"px)",...bn(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:P,top:N}},[n,l,F.floating,c.x,c.y]);return x.useMemo(()=>({...c,update:y,refs:I,elements:F,floatingStyles:M}),[c,y,I,F,M])}const Cs=(e,t)=>{const n=ps(e);return{name:n.name,fn:n.fn,options:[e,t]}},Os=(e,t)=>{const n=ms(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ts=(e,t)=>({fn:Rs(e).fn,options:[e,t]}),Ss=(e,t)=>{const n=hs(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ps=(e,t)=>{const n=xs(e);return{name:n.name,fn:n.fn,options:[e,t]}},As=(e,t)=>{const n=ys(e);return{name:n.name,fn:n.fn,options:[e,t]}};function Ms(e){const{open:t=!1,onOpenChange:n,elements:o={}}=e,s=Nn(),r=ut()!=null,i=rn(()=>new jn({open:t,onOpenChange:n,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:o.triggers??new cn,floatingId:s,nested:r,noEmit:e.noEmit||!1})).current;return ce(()=>{const l={open:t,floatingId:s};o.reference!==void 0&&(l.referenceElement=o.reference,l.domReferenceElement=U(o.reference)?o.reference:null),o.floating!==void 0&&(l.floatingElement=o.floating),i.update(l)},[t,s,o.reference,o.floating,i]),i.context.onOpenChange=n,i.context.nested=r,i.context.noEmit=e.noEmit||!1,i}function Is(e={}){const{nodeId:t,externalTree:n}=e,o=Ms(e),s=e.rootContext||o,r={reference:s.useState("referenceElement"),floating:s.useState("floatingElement"),domReference:s.useState("domReferenceElement")},[i,l]=x.useState(null),a=x.useRef(null),u=dt(n);ce(()=>{r.domReference&&(a.current=r.domReference)},[r.domReference]);const c=Es({...e,elements:{...r,...i&&{reference:i}}}),f=x.useCallback(w=>{const k=U(w)?{getBoundingClientRect:()=>w.getBoundingClientRect(),getClientRects:()=>w.getClientRects(),contextElement:w}:w;l(k),c.refs.setReference(k)},[c.refs]),[d,p]=x.useState(null),[g,m]=x.useState(null);s.useSyncedValue("referenceElement",d),s.useSyncedValue("domReferenceElement",U(d)?d:null),s.useSyncedValue("floatingElement",g);const b=x.useCallback(w=>{(U(w)||w===null)&&(a.current=w,p(w)),(U(c.refs.reference.current)||c.refs.reference.current===null||w!==null&&!U(w))&&c.refs.setReference(w)},[c.refs,p]),E=x.useCallback(w=>{m(w),c.refs.setFloating(w)},[c.refs]),R=x.useMemo(()=>({...c.refs,setReference:b,setFloating:E,setPositionReference:f,domReference:a}),[c.refs,b,E,f]),C=x.useMemo(()=>({...c.elements,domReference:r.domReference}),[c.elements,r.domReference]),h=s.useState("open"),O=s.useState("floatingId"),T=x.useMemo(()=>({...c,dataRef:s.context.dataRef,open:h,onOpenChange:s.setOpen,events:s.context.events,floatingId:O,refs:R,elements:C,nodeId:t,rootStore:s}),[c,R,C,t,s,h,O]);return ce(()=>{s.context.dataRef.current.floatingContext=T;const w=u?.nodesRef.current.find(k=>k.id===t);w&&(w.context=T)}),x.useMemo(()=>({...c,context:T,refs:R,elements:C,rootStore:s}),[c,R,C,T,s])}const ct=Yn("safe-polygon"),ks=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${zn}`;function Ds(e){return e?!!e.closest(ks):!1}function wn(e){const t=x.useRef(void 0),n=x.useRef(!1),o=x.useRef(void 0),s=x.useRef(!0),r=x.useRef(!1),i=x.useRef(()=>{}),l=x.useRef(!1),a=nt(),u=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:s,performedPointerEventsMutationRef:r,unbindMouseMoveRef:i,restTimeoutPendingRef:l,openChangeTimeout:a,restTimeout:u,handleCloseOptionsRef:c}),f.hoverInteractionState},[e,t,n,o,s,r,i,l,a,u,c])}const Ls=new Set(["click","mousedown"]);function Fs(e,t={}){const n="rootStore"in e?e.rootStore:e,o=n.useState("open"),s=n.useState("floatingElement"),r=n.useState("domReferenceElement"),{dataRef:i}=n.context,{enabled:l=!0,closeDelay:a=0,externalTree:u}=t,{pointerTypeRef:c,interactedInsideRef:f,handlerRef:d,performedPointerEventsMutationRef:p,unbindMouseMoveRef:g,restTimeoutPendingRef:m,openChangeTimeout:b,handleCloseOptionsRef:E}=wn(n),R=dt(u),C=ut(),h=q(()=>f.current?!0:i.current.openEvent?Ls.has(i.current.openEvent.type):!1),O=q(()=>{const A=i.current.openEvent?.type;return A?.includes("mouse")&&A!=="mousedown"}),T=x.useCallback((A,L=!0)=>{const S=Bs(a,c.current);S&&!d.current?b.start(S,()=>n.setOpen(!1,G(ee,A))):L&&(b.clear(),n.setOpen(!1,G(ee,A)))},[a,d,n,c,b]),w=q(()=>{g.current(),d.current=void 0}),k=q(()=>{if(p.current){const A=_e(s).body;A.style.pointerEvents="",A.removeAttribute(ct),p.current=!1}}),$=q(A=>{const L=an(A);if(!Ds(L)){f.current=!1;return}f.current=!0});ce(()=>{o||(c.current=void 0,m.current=!1,f.current=!1,w(),k())},[o,c,m,f,w,k]),x.useEffect(()=>()=>{w()},[w]),x.useEffect(()=>k,[k]),ce(()=>{if(l&&o&&E.current?.blockPointerEvents&&O()&&U(r)&&s){p.current=!0;const A=_e(s).body;A.setAttribute(ct,"");const L=r,S=s,y=R?.nodesRef.current.find(D=>D.id===C)?.context?.elements.floating;return y&&(y.style.pointerEvents=""),A.style.pointerEvents="none",L.style.pointerEvents="auto",S.style.pointerEvents="auto",()=>{A.style.pointerEvents="",L.style.pointerEvents="",S.style.pointerEvents=""}}},[l,o,r,s,E,O,R,C,p]),x.useEffect(()=>{if(!l)return;function A(D){if(h()||!i.current.floatingContext||!n.select("open"))return;const I=n.context.triggerElements;D.relatedTarget&&I.hasElement(D.relatedTarget)||(k(),w(),h()||T(D))}function L(D){b.clear(),k(),d.current?.(D),w()}function S(D){h()||T(D,!1)}const y=s;return y&&(y.addEventListener("mouseleave",A),y.addEventListener("mouseenter",L),y.addEventListener("mouseleave",S),y.addEventListener("pointerdown",$,!0)),()=>{y&&(y.removeEventListener("mouseleave",A),y.removeEventListener("mouseenter",L),y.removeEventListener("mouseleave",S),y.removeEventListener("pointerdown",$,!0))}})}function Bs(e,t){return t&&!Ce(t)?0:typeof e=="function"?e():e}function tt(e){return typeof e=="function"?e():e}const Hs={current:null};function $s(e,t={}){const n="rootStore"in e?e.rootStore:e,{dataRef:o,events:s}=n.context,{enabled:r=!0,delay:i=0,handleClose:l=null,mouseOnly:a=!1,restMs:u=0,move:c=!0,triggerElementRef:f=Hs,externalTree:d,isActiveTrigger:p=!0}=t,g=dt(d),{pointerTypeRef:m,interactedInsideRef:b,handlerRef:E,blockMouseMoveRef:R,performedPointerEventsMutationRef:C,unbindMouseMoveRef:h,restTimeoutPendingRef:O,openChangeTimeout:T,restTimeout:w,handleCloseOptionsRef:k}=wn(n),$=we(l),A=we(i),L=we(u);p&&(k.current=$.current?.__options);const S=q(()=>b.current?!0:o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1),y=x.useCallback((M,v=!0)=>{const P=Qe(A.current,"close",m.current);P&&!E.current?T.start(P,()=>n.setOpen(!1,G(ee,M))):v&&(T.clear(),n.setOpen(!1,G(ee,M)))},[A,E,n,m,T]),D=q(()=>{h.current(),E.current=void 0}),I=q(()=>{if(C.current){const M=_e(n.select("domReferenceElement")).body;M.style.pointerEvents="",M.removeAttribute(ct),C.current=!1}});x.useEffect(()=>{if(!r)return;function M(v){v.open||(T.clear(),w.clear(),R.current=!0,O.current=!1)}return s.on("openchange",M),()=>{s.off("openchange",M)}},[r,s,T,w,R,O]);const F=q(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:g,x:M.clientX,y:M.clientY,onClose(){I(),D(),!S()&&P===n.select("domReferenceElement")&&y(M)}})(M)});return x.useEffect(()=>{if(!r)return;const M=f.current??(p?n.select("domReferenceElement"):null);if(!U(M))return;function v(V){if(T.clear(),R.current=!1,a&&!Ce(m.current)||tt(L.current)>0&&!Qe(A.current,"open"))return;const W=Qe(A.current,"open",m.current),j=n.select("domReferenceElement"),B=n.context.triggerElements,Y=(B.hasElement(V.target)||B.hasMatchingElement(re=>le(re,V.target)))&&(!j||!le(j,V.target)),H=V.currentTarget??null,_=n.select("open"),ne=!_||Y;Y&&_?n.setOpen(!0,G(ee,V,H)):W?T.start(W,()=>{ne&&n.setOpen(!0,G(ee,V,H))}):ne&&n.setOpen(!0,G(ee,V,H))}function P(V){if(S()){I();return}h.current();const W=n.select("domReferenceElement"),j=_e(W);w.clear(),O.current=!1;const B=n.context.triggerElements;if(V.relatedTarget&&B.hasElement(V.relatedTarget))return;if($.current&&o.current.floatingContext){n.select("open")||T.clear();const H=f.current;E.current=$.current({...o.current.floatingContext,tree:g,x:V.clientX,y:V.clientY,onClose(){I(),D(),!S()&&H===n.select("domReferenceElement")&&y(V,!0)}});const _=E.current;_(V),j.addEventListener("mousemove",_),h.current=()=>{j.removeEventListener("mousemove",_)};return}(m.current!=="touch"||!le(n.select("floatingElement"),V.relatedTarget))&&y(V)}function N(V){F(V)}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)}},[D,I,R,o,A,y,n,r,$,F,p,S,a,c,m,L,w,O,T,f,g,h,E]),x.useMemo(()=>{function M(v){m.current=v.pointerType}return{onPointerDown:M,onPointerEnter:M,onMouseMove(v){const{nativeEvent:P}=v,N=v.currentTarget,V=n.select("domReferenceElement"),W=n.context.triggerElements,j=n.select("open"),B=(W.hasElement(v.target)||W.hasMatchingElement(H=>le(H,v.target)))&&(!V||!le(V,v.target));if(a&&!Ce(m.current)||j&&!B||tt(L.current)===0||!B&&O.current&&v.movementX**2+v.movementY**2<2)return;w.clear();function Y(){if(O.current=!1,S())return;const H=n.select("open");!R.current&&(!H||B)&&n.setOpen(!0,G(ee,P,N))}m.current==="touch"?Me.flushSync(()=>{Y()}):B&&j?Y():(O.current=!0,w.start(tt(L.current),Y))}}},[R,S,a,n,m,L,w,O])}function Jt(e,t){const[n,o]=e;let s=!1;const r=t.length;for(let i=0,l=r-1;i<r;l=i++){const[a,u]=t[i]||[0,0],[c,f]=t[l]||[0,0];u>=o!=f>=o&&n<=(c-a)*(o-u)/(f-u)+a&&(s=!s)}return s}function Vs(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function Ws(e={}){const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:o=!0}=e,s=new ln;let r=!1,i=null,l=null,a=typeof performance<"u"?performance.now():0;function u(f,d){const p=performance.now(),g=p-a;if(i===null||l===null||g===0)return i=f,l=d,a=p,null;const m=f-i,b=d-l,R=Math.sqrt(m*m+b*b)/g;return i=f,l=d,a=p,R}const c=({x:f,y:d,placement:p,elements:g,onClose:m,nodeId:b,tree:E})=>function(C){function h(){s.clear(),m()}if(s.clear(),!g.domReference||!g.floating||p==null||f==null||d==null)return;const{clientX:O,clientY:T}=C,w=[O,T],k=an(C),$=C.type==="mouseleave",A=le(g.floating,k),L=le(g.domReference,k),S=g.domReference.getBoundingClientRect(),y=g.floating.getBoundingClientRect(),D=p.split("-")[0],I=f>y.right-y.width/2,F=d>y.bottom-y.height/2,M=Vs(w,S),v=y.width>S.width,P=y.height>S.height,N=(v?S:y).left,V=(v?S:y).right,W=(P?S:y).top,j=(P?S:y).bottom;if(A&&(r=!0,!$))return;if(L&&(r=!1),L&&!$){r=!0;return}if($&&U(C.relatedTarget)&&le(g.floating,C.relatedTarget)||E&&Un(E.nodesRef.current,b).some(({context:H})=>H?.open))return;if(D==="top"&&d>=S.bottom-1||D==="bottom"&&d<=S.top+1||D==="left"&&f>=S.right-1||D==="right"&&f<=S.left+1)return h();let B=[];switch(D){case"top":B=[[N,S.top+1],[N,y.bottom-1],[V,y.bottom-1],[V,S.top+1]];break;case"bottom":B=[[N,y.top+1],[N,S.bottom-1],[V,S.bottom-1],[V,y.top+1]];break;case"left":B=[[y.right-1,j],[y.right-1,W],[S.left+1,W],[S.left+1,j]];break;case"right":B=[[S.right-1,j],[S.right-1,W],[y.left+1,W],[y.left+1,j]];break}function Y([H,_]){switch(D){case"top":{const ne=[v?H+t/2:I?H+t*4:H-t*4,_+t+1],re=[v?H-t/2:I?H+t*4:H-t*4,_+t+1],oe=[[y.left,I||v?y.bottom-t:y.top],[y.right,I?v?y.bottom-t:y.top:y.bottom-t]];return[ne,re,...oe]}case"bottom":{const ne=[v?H+t/2:I?H+t*4:H-t*4,_-t],re=[v?H-t/2:I?H+t*4:H-t*4,_-t],oe=[[y.left,I||v?y.top+t:y.bottom],[y.right,I?v?y.top+t:y.bottom:y.top+t]];return[ne,re,...oe]}case"left":{const ne=[H+t+1,P?_+t/2:F?_+t*4:_-t*4],re=[H+t+1,P?_-t/2:F?_+t*4:_-t*4];return[...[[F||P?y.right-t:y.left,y.top],[F?P?y.right-t:y.left:y.right-t,y.bottom]],ne,re]}case"right":{const ne=[H-t,P?_+t/2:F?_+t*4:_-t*4],re=[H-t,P?_-t/2:F?_+t*4:_-t*4],oe=[[F||P?y.left+t:y.right,y.top],[F?P?y.left+t:y.right:y.left+t,y.bottom]];return[ne,re,...oe]}default:return[]}}if(!Jt([O,T],B)){if(r&&!M)return h();if(!$&&o){const H=u(C.clientX,C.clientY);if(H!==null&&H<.1)return h()}Jt([O,T],Y([f,d]))?!r&&o&&s.start(40,h):h()}};return c.__options={blockPointerEvents:n},c}const _s=x.createContext(void 0);function Ns(e=!1){const t=x.useContext(_s);if(t===void 0&&!e)throw new Error(ke(16));return t}function js(e){const{focusableWhenDisabled:t,disabled:n,composite:o=!1,tabIndex:s=0,isNativeButton:r}=e,i=o&&t!==!1,l=o&&t===!1;return{props:x.useMemo(()=>{const u={onKeyDown(c){n&&t&&c.key!=="Tab"&&c.preventDefault()}};return o||(u.tabIndex=s,!r&&n&&(u.tabIndex=t?s:-1)),(r&&(t||i)||!r&&n)&&(u["aria-disabled"]=n),r&&(!t||l)&&(u.disabled=n),u},[o,n,t,i,l,r,s])}}function Ys(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:o=0,native:s=!0}=e,r=x.useRef(null),i=Ns(!0)!==void 0,l=q(()=>{const d=r.current;return!!(d?.tagName==="A"&&d?.href)}),{props:a}=js({focusableWhenDisabled:n,disabled:t,composite:i,tabIndex:o,isNativeButton:s}),u=x.useCallback(()=>{const d=r.current;zs(d)&&i&&t&&a.disabled===void 0&&d.disabled&&(d.disabled=!1)},[t,a.disabled,i]);ce(u,[u]);const c=x.useCallback((d={})=>{const{onClick:p,onMouseDown:g,onKeyUp:m,onKeyDown:b,onPointerDown:E,...R}=d;return Xn({type:s?"button":void 0,onClick(h){if(t){h.preventDefault();return}p?.(h)},onMouseDown(h){t||g?.(h)},onKeyDown(h){if(t||(Vt(h),b?.(h)),h.baseUIHandlerPrevented)return;const O=h.target===h.currentTarget&&!s&&!l()&&!t,T=h.key==="Enter",w=h.key===" ";O&&((w||T)&&h.preventDefault(),T&&p?.(h))},onKeyUp(h){t||(Vt(h),m?.(h)),!h.baseUIHandlerPrevented&&h.target===h.currentTarget&&!s&&!t&&h.key===" "&&p?.(h)},onPointerDown(h){if(t){h.preventDefault();return}E?.(h)}},s?void 0:{role:"button"},a,R)},[t,a,s,l]),f=q(d=>{r.current=d,u()});return{getButtonProps:c,buttonRef:f}}function zs(e){return ge(e)&&e.tagName==="BUTTON"}const Us=x.createContext(void 0);function Xs(){return x.useContext(Us)?.direction??"ltr"}const Ks=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:s,rects:r,platform:i,elements:l,middlewareData:a}=t,{element:u,padding:c=0,offsetParent:f="real"}=ue(e,t)||{};if(u==null)return{};const d=gn(c),p={x:n,y:o},g=ht(s),m=mt(g),b=await i.getDimensions(u),E=g==="y",R=E?"top":"left",C=E?"bottom":"right",h=E?"clientHeight":"clientWidth",O=r.reference[m]+r.reference[g]-p[g]-r.floating[m],T=p[g]-r.reference[g],w=f==="real"?await i.getOffsetParent?.(u):l.floating;let k=l.floating[h]||r.floating[m];(!k||!await i.isElement?.(w))&&(k=l.floating[h]||r.floating[m]);const $=O/2-T/2,A=k/2-b[m]/2-1,L=Math.min(d[R],A),S=Math.min(d[C],A),y=L,D=k-b[m]-S,I=k/2-b[m]/2+$,F=rt(y,I,D),M=!a.arrow&&me(s)!=null&&I!==F&&r.reference[m]/2-(I<y?L:S)-b[m]/2<0,v=M?I<y?I-y:I-D:0;return{[g]:p[g]+v,data:{[g]:F,centerOffset:I-F-v,...M&&{alignmentOffset:v}},reset:M}}}),Gs=(e,t)=>({...Ks(e),options:[e,t]}),qs={name:"hide",async fn(e){const{width:t,height:n,x:o,y:s}=e.rects.reference,r=t===0&&n===0&&o===0&&s===0;return{data:{referenceHidden:(await As().fn(e)).data?.referenceHidden||r}}}},Ve={sideX:"left",sideY:"top"},Js={name:"adaptiveOrigin",async fn(e){const{x:t,y:n,rects:{floating:o},elements:{floating:s},platform:r,strategy:i,placement:l}=e,a=pe(s),u=a.getComputedStyle(s);if(!(u.transitionDuration!=="0s"&&u.transitionDuration!==""))return{x:t,y:n,data:Ve};const f=await r.getOffsetParent?.(s);let d={width:0,height:0};if(i==="fixed"&&a?.visualViewport)d={width:a.visualViewport.width,height:a.visualViewport.height};else if(f===a){const R=fn(s);d={width:R.documentElement.clientWidth,height:R.documentElement.clientHeight}}else await r.isElement?.(f)&&(d=await r.getDimensions(f));const p=J(l);let g=t,m=n;p==="left"&&(g=d.width-(t+o.width)),p==="top"&&(m=d.height-(n+o.height));const b=p==="left"?"right":Ve.sideX,E=p==="top"?"bottom":Ve.sideY;return{x:g,y:m,data:{sideX:b,sideY:E}}}};function En(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 Qt(e,t,n){const{rects:o,placement:s}=e;return{side:En(t,J(s),n),align:me(s)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function Qs(e){const{anchor:t,positionMethod:n="absolute",side:o="bottom",sideOffset:s=0,align:r="center",alignOffset:i=0,collisionBoundary:l,collisionPadding:a=5,sticky:u=!1,arrowPadding:c=5,disableAnchorTracking:f=!1,keepMounted:d=!1,floatingRootContext:p,mounted:g,collisionAvoidance:m,shiftCrossAxis:b=!1,nodeId:E,adaptiveOrigin:R,lazyFlip:C=!1,externalTree:h}=e,[O,T]=x.useState(null);!g&&O!==null&&T(null);const w=m.side||"flip",k=m.align||"flip",$=m.fallbackAxisSide||"end",A=typeof t=="function"?t:void 0,L=q(A),S=A?L:t,y=we(t),I=Xs()==="rtl",F=O||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":I?"left":"right","inline-start":I?"right":"left"}[o],M=r==="center"?F:`${F}-${r}`;let v=a;const P=1,N=o==="bottom"?P:0,V=o==="top"?P:0,W=o==="right"?P:0,j=o==="left"?P:0;typeof v=="number"?v={top:v+N,right:v+j,bottom:v+V,left:v+W}:v&&(v={top:(v.top||0)+N,right:(v.right||0)+j,bottom:(v.bottom||0)+V,left:(v.left||0)+W});const B={boundary:l==="clipping-ancestors"?"clippingAncestors":l,padding:v},Y=x.useRef(null),H=we(s),_=we(i),oe=[Cs(z=>{const K=Qt(z,o,I),ie=typeof H.current=="function"?H.current(K):H.current,Z=typeof _.current=="function"?_.current(K):_.current;return{mainAxis:ie,crossAxis:Z,alignmentAxis:Z}},[typeof s!="function"?s:0,typeof i!="function"?i:0,I,o])],Rt=k==="none"&&w!=="shift",vt=!Rt&&(u||b||w==="shift"),bt=w==="none"?null:Ss({...B,padding:{top:v.top+P,right:v.right+P,bottom:v.bottom+P,left:v.left+P},mainAxis:!b&&w==="flip",crossAxis:k==="flip"?"alignment":!1,fallbackAxisSideDirection:$}),wt=Rt?null:Os(z=>{const K=fn(z.elements.floating).documentElement;return{...B,rootBoundary:b?{x:0,y:0,width:K.clientWidth,height:K.clientHeight}:void 0,mainAxis:k!=="none",crossAxis:vt,limiter:u||b?void 0:Ts(ie=>{if(!Y.current)return{};const{width:Z,height:Re}=Y.current.getBoundingClientRect(),ve=te(J(ie.placement)),Be=ve==="y"?Z:Re,qe=ve==="y"?v.left+v.right:v.top+v.bottom;return{offset:Be/2+qe/2}})}},[B,u,b,v,k]);w==="shift"||k==="shift"||r==="center"?oe.push(wt,bt):oe.push(bt,wt),oe.push(Ps({...B,apply({elements:{floating:z},rects:{reference:K},availableWidth:ie,availableHeight:Z}){Object.entries({"--available-width":`${ie}px`,"--available-height":`${Z}px`,"--anchor-width":`${K.width}px`,"--anchor-height":`${K.height}px`}).forEach(([Re,ve])=>{z.style.setProperty(Re,ve)})}}),Gs(()=>({element:Y.current||document.createElement("div"),padding:c,offsetParent:"floating"}),[c]),{name:"transformOrigin",fn(z){const{elements:K,middlewareData:ie,placement:Z,rects:Re,y:ve}=z,Be=J(Z),qe=te(Be),Bt=Y.current,Pn=ie.arrow?.x||0,An=ie.arrow?.y||0,Mn=Bt?.clientWidth||0,In=Bt?.clientHeight||0,Je=Pn+Mn/2,Ht=An+In/2,kn=Math.abs(ie.shift?.y||0),Dn=Re.reference.height/2,Ae=typeof s=="function"?s(Qt(z,o,I)):s,Ln=kn>Ae,Fn={top:`${Je}px calc(100% + ${Ae}px)`,bottom:`${Je}px ${-Ae}px`,left:`calc(100% + ${Ae}px) ${Ht}px`,right:`${-Ae}px ${Ht}px`}[Be],Bn=`${Je}px ${Re.reference.y+Dn-ve}px`;return K.floating.style.setProperty("--transform-origin",vt&&qe==="y"&&Ln?Bn:Fn),{}}},qs,R),ce(()=>{!g&&p&&p.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[g,p]);const Ke=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}=Is({rootContext:p,placement:M,middleware:oe,strategy:n,whileElementsMounted:d?void 0:(...z)=>Gt(...z,Ke),nodeId:E,externalTree:h}),{sideX:Pt,sideY:At}=ye.adaptiveOrigin||Ve,Ge=Se?n:"fixed",Mt=x.useMemo(()=>R?{position:Ge,[Pt]:Et,[At]:Ct}:{position:Ge,...St},[R,Ge,Pt,Et,At,Ct,St]),Fe=x.useRef(null);ce(()=>{if(!g)return;const z=y.current,K=typeof z=="function"?z():z,Z=(Zt(K)?K.current:K)||null||null;Z!==Fe.current&&(xe.setPositionReference(Z),Fe.current=Z)},[g,xe,S,y]),x.useEffect(()=>{if(!g)return;const z=y.current;typeof z!="function"&&Zt(z)&&z.current!==Fe.current&&(xe.setPositionReference(z.current),Fe.current=z.current)},[g,xe,S,y]),x.useEffect(()=>{if(d&&g&&Te.domReference&&Te.floating)return Gt(Te.domReference,Te.floating,Le,Ke)},[d,g,Te,Le,Ke]);const Pe=J(Ot),It=En(o,Pe,I),kt=me(Ot)||"center",Dt=!!ye.hide?.referenceHidden;ce(()=>{C&&g&&Se&&T(Pe)},[C,g,Se,Pe]);const Lt=x.useMemo(()=>({position:"absolute",top:ye.arrow?.y,left:ye.arrow?.x}),[ye.arrow]),Ft=ye.arrow?.centerOffset!==0;return x.useMemo(()=>({positionerStyles:Mt,arrowStyles:Lt,arrowRef:Y,arrowUncentered:Ft,side:It,align:kt,physicalSide:Pe,anchorHidden:Dt,refs:xe,context:Tt,isPositioned:Se,update:Le}),[Mt,Lt,Y,Ft,It,kt,Pe,Dt,xe,Tt,Se,Le])}function Zt(e){return e!=null&&"current"in e}const Zs=x.createContext(void 0);function er(e){return x.useContext(Zs)}function Cn(e){return e==="starting"?Kn:nn}const On=x.createContext(void 0);function De(e){const t=x.useContext(On);if(t===void 0&&!e)throw new Error(ke(47));return t}function tr(){return{...eo(),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 nr={...qn,disabled:se(e=>e.disabled),instantType:se(e=>e.instantType),openMethod:se(e=>e.openMethod),openChangeReason:se(e=>e.openChangeReason),modal:se(e=>e.modal),stickIfOpen:se(e=>e.stickIfOpen),titleElementId:se(e=>e.titleElementId),descriptionElementId:se(e=>e.descriptionElementId),openOnHover:se(e=>e.openOnHover),closeDelay:se(e=>e.closeDelay),hasViewport:se(e=>e.hasViewport)};class yt extends Gn{constructor(t){const n={...tr(),...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 ln,triggerElements:new cn},nr)}setOpen=(t,n)=>{const o=n.reason===ee,s=n.reason===be&&n.event.detail===0,r=!t&&(n.reason===Jn||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 u={open:t,openChangeReason:n.reason},c=n.trigger?.id??null;(c||t)&&(u.activeTriggerId=c,u.activeTriggerElement=n.trigger??null),this.update(u)};o?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(Qn,()=>{this.set("stickIfOpen",!1)}),Me.flushSync(a)):a(),s||r?this.set("instantType",s?"click":"dismiss"):n.reason===st?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(t,n){const o=rn(()=>new yt(n)).current,s=t??o;return Zn(o.disposeEffect),s}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function en({props:e}){const{children:t,open:n,defaultOpen:o=!1,onOpenChange:s,onOpenChangeComplete:r,modal:i=!1,handle:l,triggerId:a,defaultTriggerId:u=null}=e,c=yt.useStore(l?.store,{open:n??o,modal:i,activeTriggerId:a!==void 0?a:u});c.useControlledProp("open",n,o),c.useControlledProp("activeTriggerId",a,u);const f=c.useState("open"),d=c.useState("positionerElement"),p=c.useState("payload"),g=c.useState("openChangeReason");c.useContextCallback("onOpenChange",s),c.useContextCallback("onOpenChangeComplete",r);const{openMethod:m,triggerProps:b,reset:E}=no(f);oo(c);const{forceUnmount:R}=so(f,c,()=>{c.update({stickIfOpen:!0,openChangeReason:null}),E()});ro(f&&i===!0&&g!==ee&&m!=="touch",d),x.useEffect(()=>{f||c.context.stickIfOpenTimeout.clear()},[c,f]);const C=x.useCallback(I=>{const F=G(I);return F.preventUnmountOnClose=()=>{c.set("preventUnmountingOnClose",!0)},F},[c]),h=x.useCallback(()=>{c.setOpen(!1,C(io))},[c,C]);x.useImperativeHandle(e.actionsRef,()=>({unmount:R,close:h}),[R,h]);const O=co({popupStore:c,onOpenChange:c.setOpen}),T=ao(O,{outsidePressEvent:{mouse:i==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),w=lo(O),{getReferenceProps:k,getFloatingProps:$,getTriggerProps:A}=un([T,w]),L=x.useMemo(()=>k(b),[k,b]),S=x.useMemo(()=>A(b),[A,b]),y=x.useMemo(()=>$(),[$]);c.useSyncedValues({modal:i,openMethod:m,activeTriggerProps:L,inactiveTriggerProps:S,popupProps:y,floatingRootContext:O,nested:ut()!=null});const D=x.useMemo(()=>({store:c}),[c]);return X.jsx(On.Provider,{value:D,children:typeof t=="function"?t({payload:p}):t})}function ur(e){return De(!0)?X.jsx(en,{props:e}):X.jsx(to,{children:X.jsx(en,{props:e})})}const or=300,dr=x.forwardRef(function(t,n){const{render:o,className:s,disabled:r=!1,nativeButton:i=!0,handle:l,payload:a,openOnHover:u=!1,delay:c=or,closeDelay:f=0,id:d,...p}=t,g=De(!0),m=l?.store??g?.store;if(!m)throw new Error(ke(74));const b=fo(d),E=m.useState("isTriggerActive",b),R=m.useState("floatingRootContext"),C=m.useState("isOpenedByTrigger",b),h=x.useRef(null),{registerTrigger:O,isMountedByThisTrigger:T}=uo(b,h,m,{payload:a,disabled:r,openOnHover:u,closeDelay:f}),w=m.useState("openChangeReason"),k=m.useState("stickIfOpen"),$=m.useState("openMethod"),A=$s(R,{enabled:R!=null&&u&&($!=="touch"||w!==be),mouseOnly:!0,move:!1,handleClose:Ws(),restMs:c,delay:{close:f},triggerElementRef:h,isActiveTrigger:E}),L=No(R,{enabled:R!=null,stickIfOpen:k}),S=un([L]),y=m.useState("triggerProps",T),D=x.useMemo(()=>({disabled:r,open:C}),[r,C]),{getButtonProps:I,buttonRef:F}=Ys({disabled:r,native:i}),M=x.useMemo(()=>({open(W){return W&&w===be?go.open(W):po.open(W)}}),[w]),v=gt("button",t,{state:D,ref:[F,n,O,h],props:[S.getReferenceProps(),A,y,{[mo]:"",id:b},p,I],stateAttributesMapping:M}),P=x.useRef(null),N=q(W=>{Me.flushSync(()=>{m.setOpen(!1,G(st,W.nativeEvent,W.currentTarget))}),ho(P.current)?.focus()}),V=q(W=>{const j=m.select("positionerElement");if(j&&xo(W,j))m.context.beforeContentFocusGuardRef.current?.focus();else{Me.flushSync(()=>{m.setOpen(!1,G(st,W.nativeEvent,W.currentTarget))});let B=yo(m.context.triggerFocusTargetRef.current||h.current);for(;B!==null&&le(j,B);){const Y=B;if(B=Ro(B),B===Y)break}B?.focus()}});return E?X.jsxs(x.Fragment,{children:[X.jsx(Wt,{ref:P,onFocus:N}),X.jsx(x.Fragment,{children:v},b),X.jsx(Wt,{ref:m.context.triggerFocusTargetRef,onFocus:V})]}):X.jsx(x.Fragment,{children:v},b)}),Tn=x.createContext(void 0);function sr(){const e=x.useContext(Tn);if(e===void 0)throw new Error(ke(45));return e}const gr=x.forwardRef(function(t,n){const{keepMounted:o=!1,...s}=t,{store:r}=De();return r.useState("mounted")||o?X.jsx(Tn.Provider,{value:o,children:X.jsx(vo,{ref:n,...s,renderGuards:!1})}):null}),Sn=x.createContext(void 0);function rr(){const e=x.useContext(Sn);if(!e)throw new Error(ke(46));return e}const pr=x.forwardRef(function(t,n){const{render:o,className:s,anchor:r,positionMethod:i="absolute",side:l="bottom",align:a="center",sideOffset:u=0,alignOffset:c=0,collisionBoundary:f="clipping-ancestors",collisionPadding:d=5,arrowPadding:p=5,sticky:g=!1,disableAnchorTracking:m=!1,collisionAvoidance:b=bo,...E}=t,{store:R}=De(),C=sr(),h=wo(),O=R.useState("floatingRootContext"),T=R.useState("mounted"),w=R.useState("open"),k=R.useState("openChangeReason"),$=R.useState("activeTriggerElement"),A=R.useState("modal"),L=R.useState("positionerElement"),S=R.useState("instantType"),y=R.useState("transitionStatus"),D=R.useState("hasViewport"),I=x.useRef(null),F=Eo(L,!1,!1),M=Qs({anchor:r,floatingRootContext:O,positionMethod:i,mounted:T,side:l,sideOffset:u,align:a,alignOffset:c,arrowPadding:p,collisionBoundary:f,collisionPadding:d,sticky:g,disableAnchorTracking:m,keepMounted:C,nodeId:h,collisionAvoidance:b,adaptiveOrigin:D?Js:void 0}),v=x.useMemo(()=>{const B={};return w||(B.pointerEvents="none"),{role:"presentation",hidden:!T,style:{...M.positionerStyles,...B}}},[w,T,M.positionerStyles]),P=x.useMemo(()=>({props:v,...M}),[v,M]),N=O?.select("domReferenceElement");ce(()=>{const B=N,Y=I.current;if(B&&(I.current=B),Y&&B&&B!==Y){R.set("instantType",void 0);const H=new AbortController;return F(()=>{R.set("instantType","trigger-change")},H.signal),()=>{H.abort()}}},[N,F,R]);const V=x.useMemo(()=>({open:w,side:P.side,align:P.align,anchorHidden:P.anchorHidden,instant:S}),[w,P.side,P.align,P.anchorHidden,S]),W=x.useCallback(B=>{R.set("positionerElement",B)},[R]),j=gt("div",t,{state:V,props:[P.props,Cn(y),E],ref:[n,W],stateAttributesMapping:dn});return X.jsxs(Sn.Provider,{value:P,children:[T&&A===!0&&k!==ee&&X.jsx(Co,{ref:R.context.internalBackdropRef,inert:Oo(!w),cutout:$}),X.jsx(To,{id:h,children:j})]})}),ir={...dn,...Ao},mr=x.forwardRef(function(t,n){const{className:o,render:s,initialFocus:r,finalFocus:i,...l}=t,{store:a}=De(),u=rr(),c=er()!=null,f=a.useState("open"),d=a.useState("openMethod"),p=a.useState("instantType"),g=a.useState("transitionStatus"),m=a.useState("popupProps"),b=a.useState("titleElementId"),E=a.useState("descriptionElementId"),R=a.useState("modal"),C=a.useState("mounted"),h=a.useState("openChangeReason"),O=a.useState("activeTriggerElement"),T=a.useState("floatingRootContext");So({open:f,ref:a.context.popupRef,onComplete(){f&&a.context.onOpenChangeComplete?.(!0)}});const w=a.useState("disabled"),k=a.useState("openOnHover"),$=a.useState("closeDelay");Fs(T,{enabled:k&&!w,closeDelay:$});function A(I){return I==="touch"?a.context.popupRef.current:!0}const L=r===void 0?A:r,S=x.useMemo(()=>({open:f,side:u.side,align:u.align,instant:p,transitionStatus:g}),[f,u.side,u.align,p,g]),y=x.useCallback(I=>{a.set("popupElement",I)},[a]),D=gt("div",t,{state:S,ref:[n,a.context.popupRef,y],props:[m,{"aria-labelledby":b,"aria-describedby":E,onKeyDown(I){c&&Mo.has(I.key)&&I.stopPropagation()}},Cn(g),l],stateAttributesMapping:ir});return X.jsx(Po,{context:T,openInteractionType:d,modal:R==="trap-focus",disabled:!C||h===ee,initialFocus:L,returnFocus:i,restoreFocus:"popup",previousFocusableElement:ge(O)?O:void 0,nextFocusableElement:a.context.triggerFocusTargetRef,beforeContentFocusGuardRef:a.context.beforeContentFocusGuardRef,children:D})});export{lr as C,fr as L,ur as P,dr as a,gr as b,pr as c,mr as d,Ms as e,He as f,No as g,Qs as h,er as i,Cn as j,Ys as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as r}from"./main-DhcQGvkP.js";function i({size:t=16,className:e=""}){return r.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:r.jsx("path",{d:"M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z"})})}function h({size:t=16,className:e=""}){return r.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",className:e,children:r.jsx("path",{d:"M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z"})})}function d({size:t=16,className:e=""}){return r.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:r.jsx("path",{d:"M22.106 5.68L12.5.135a.998.998 0 00-.998 0L1.893 5.68a.84.84 0 00-.419.726v11.186c0 .3.16.577.42.727l9.607 5.547a.999.999 0 00.998 0l9.608-5.547a.84.84 0 00.42-.727V6.407a.84.84 0 00-.42-.726zm-.603 1.176L12.228 22.92c-.063.108-.228.064-.228-.061V12.34a.59.59 0 00-.295-.51l-9.11-5.26c-.107-.062-.063-.228.062-.228h18.55c.264 0 .428.286.296.514z"})})}function x({size:t=16,className:e=""}){return r.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:r.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z"})})}function s({size:t=16,className:e=""}){return r.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:r.jsx("path",{d:"M9.27 15.29l7.978-5.897c.391-.29.95-.177 1.137.272.98 2.369.542 5.215-1.41 7.169-1.951 1.954-4.667 2.382-7.149 1.406l-2.711 1.257c3.889 2.661 8.611 2.003 11.562-.953 2.341-2.344 3.066-5.539 2.388-8.42l.006.007c-.983-4.232.242-5.924 2.75-9.383.06-.082.12-.164.179-.248l-3.301 3.305v-.01L9.267 15.292M7.623 16.723c-2.792-2.67-2.31-6.801.071-9.184 1.761-1.763 4.647-2.483 7.166-1.425l2.705-1.25a7.808 7.808 0 00-1.829-1A8.975 8.975 0 005.984 5.83c-2.533 2.536-3.33 6.436-1.962 9.764 1.022 2.487-.653 4.246-2.34 6.022-.599.63-1.199 1.259-1.682 1.925l7.62-6.815"})})}function a({size:t=16,className:e=""}){return r.jsx("svg",{width:t,height:t,viewBox:"0 -1 22 28",fill:"currentColor",fillRule:"evenodd",className:e,children:r.jsx("path",{d:"M4.125 20.149c-2.69 5.959 3.036 7.453 7.26 3.966 1.24 3.91 5.898.993 7.569-2.036 3.682-6.678 2.195-13.49 1.813-14.895-2.617-9.582-15.699-9.592-17.95.049-.526 1.687-.535 3.606-.833 5.598-.15 1.005-.256 1.646-.645 2.703-.223.607-.53 1.147-1.014 2.056-.75 1.412-.434 4.138 3.434 2.724v.001ZM11.895 11.332c-1.073 0-1.234-1.283-1.234-2.048 0-.69.124-1.239.358-1.586a1 1 0 0 1 .876-.462c.375 0 .697.158.924.47.259.354.395.9.395 1.578 0 1.283-.493 2.048-1.319 2.048Zm4.416 0c-1.073 0-1.234-1.283-1.234-2.048 0-.69.124-1.239.358-1.586a1 1 0 0 1 .876-.462c.375 0 .697.158.924.47.259.354.396.9.396 1.578 0 1.283-.494 2.048-1.32 2.048Z"})})}function C({size:t=16,className:e=""}){return r.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:r.jsx("path",{d:"M16 6H8v12h8V6zm4 16H4V2h16v20z"})})}function u({size:t=16,className:e=""}){return r.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:[r.jsx("path",{d:"M21.846 0a1.923 1.923 0 110 3.846H20.15a.226.226 0 01-.227-.226V1.923C19.923.861 20.784 0 21.846 0z"}),r.jsx("path",{d:"M11.065 11.199l7.257-7.2c.137-.136.06-.41-.116-.41H14.3a.164.164 0 00-.117.051l-7.82 7.756c-.122.12-.302.013-.302-.179V3.82c0-.127-.083-.23-.185-.23H3.186c-.103 0-.186.103-.186.23V19.77c0 .128.083.23.186.23h2.69c.103 0 .186-.102.186-.23v-3.25c0-.069.025-.135.069-.178l2.424-2.406a.158.158 0 01.205-.023l6.484 4.772a7.677 7.677 0 003.453 1.283c.108.012.2-.095.2-.23v-3.06c0-.117-.07-.212-.164-.227a5.028 5.028 0 01-2.027-.807l-5.613-4.064c-.117-.078-.132-.279-.028-.381z"})]})}function v({size:t=16,className:e=""}){return r.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:r.jsx("path",{d:"M19.245 5.364c1.322 1.36 1.877 3.216 2.11 5.817.622 0 1.2.135 1.592.654l.73.964c.21.278.323.61.323.955v2.62c0 .339-.173.669-.453.868C20.239 19.602 16.157 21.5 12 21.5c-4.6 0-9.205-2.583-11.547-4.258-.28-.2-.452-.53-.453-.868v-2.62c0-.345.113-.679.321-.956l.73-.963c.392-.517.974-.654 1.593-.654l.029-.297c.25-2.446.81-4.213 2.082-5.52 2.461-2.54 5.71-2.851 7.146-2.864h.198c1.436.013 4.685.323 7.146 2.864zm-7.244 4.328c-.284 0-.613.016-.962.05-.123.447-.305.85-.57 1.108-1.05 1.023-2.316 1.18-2.994 1.18-.638 0-1.306-.13-1.851-.464-.516.165-1.012.403-1.044.996a65.882 65.882 0 00-.063 2.884l-.002.48c-.002.563-.005 1.126-.013 1.69.002.326.204.63.51.765 2.482 1.102 4.83 1.657 6.99 1.657 2.156 0 4.504-.555 6.985-1.657a.854.854 0 00.51-.766c.03-1.682.006-3.372-.076-5.053-.031-.596-.528-.83-1.046-.996-.546.333-1.212.464-1.85.464-.677 0-1.942-.157-2.993-1.18-.266-.258-.447-.661-.57-1.108-.32-.032-.64-.049-.96-.05zm-2.525 4.013c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zm5 0c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zM7.635 5.087c-1.05.102-1.935.438-2.385.906-.975 1.037-.765 3.668-.21 4.224.405.394 1.17.657 1.995.657h.09c.649-.013 1.785-.176 2.73-1.11.435-.41.705-1.433.675-2.47-.03-.834-.27-1.52-.63-1.813-.39-.336-1.275-.482-2.265-.394zm6.465.394c-.36.292-.6.98-.63 1.813-.03 1.037.24 2.06.675 2.47.968.957 2.136 1.104 2.776 1.11h.044c.825 0 1.59-.263 1.995-.657.555-.556.765-3.187-.21-4.224-.45-.468-1.335-.804-2.385-.906-.99-.088-1.875.058-2.265.394zM12 7.615c-.24 0-.525.015-.84.044.03.16.045.336.06.526l-.001.159a2.94 2.94 0 01-.014.25c.225-.022.425-.027.612-.028h.366c.187 0 .387.006.612.028-.015-.146-.015-.277-.015-.409.015-.19.03-.365.06-.526a9.29 9.29 0 00-.84-.044z"})})}function g({size:t=16,className:e=""}){return r.jsxs("svg",{width:t,height:t,viewBox:"0 0 64 60",fill:"none",className:e,"aria-hidden":"true",children:[r.jsx("path",{fill:"currentColor",d:"M37.2114 3.75318C37.6821 3.33106 37.7106 3.31457 38.0558 3.29385C38.6149 3.2531 39.1272 3.52199 39.9989 4.31564C42.0356 6.16652 44.8714 9.97183 46.6346 13.2212L47.3163 14.4819L48.2782 14.9605C49.2072 15.4299 50.7308 16.3923 51.3672 16.9085C51.655 17.1464 51.6956 17.1508 51.9947 17.0344C53.3454 16.5084 55.2803 17.206 56.9869 18.8432C58.5231 20.3155 59.9943 22.8312 60.558 24.9308C60.6403 25.2687 60.7493 25.9952 60.7891 26.5362C60.9177 28.4358 60.3092 29.9532 59.1362 30.64C58.8965 30.7784 58.8801 30.8158 58.8868 31.4132C58.9409 34.2583 58.1741 37.0985 56.6335 39.8679C54.8946 42.9773 51.7981 46.1938 47.6074 49.2243C45.357 50.8619 40.0323 53.964 37.6248 55.0532C31.8578 57.6496 27.2346 58.646 23.2188 58.154C20.8236 57.8638 18.1124 56.9287 16.5082 55.8433C16.086 55.5515 16.0191 55.5329 15.6966 55.6251C13.9793 56.1185 11.73 55.1053 9.81931 52.9844C9.05725 52.1366 7.82714 50.0548 7.42839 48.9409C6.50606 46.3339 6.68976 43.9816 7.91836 42.5767C8.23573 42.2149 8.2453 42.1995 8.17598 41.5912C8.06148 40.5951 8.00971 39.1206 8.06202 38.1692L8.10361 37.2803L6.76977 34.9212C4.70378 31.2451 3.3912 28.1582 2.88489 25.7998C2.61762 24.5066 2.63385 23.9324 2.96214 23.5078C3.16198 23.2515 3.81796 22.9866 4.60785 22.8407C6.59665 22.4917 10.9334 22.8076 15.7581 23.6595L16.259 23.7458L17.3608 22.7713C19.1891 21.1519 20.4038 20.244 22.6429 18.8478C24.9768 17.3876 27.6108 16.1858 30.577 15.2346L31.5295 14.9294L32.0526 13.5561C33.9257 8.61146 35.8437 4.96584 37.2114 3.75318ZM21.5208 29.0919C19.404 30.314 18.3453 30.9251 17.5676 31.6099C14.4179 34.3835 13.2414 38.777 14.5823 42.7537C14.9135 43.7357 15.5247 44.7942 16.7469 46.9111C17.9691 49.0279 18.5801 50.0865 19.2649 50.8643C22.0385 54.014 26.4316 55.1918 30.4084 53.8509C31.3904 53.5198 32.4489 52.9085 34.5657 51.6863L46.7442 44.6551C48.8613 43.4328 49.9205 42.8214 50.6983 42.1365C53.8479 39.363 55.0245 34.9695 53.6835 30.9927C53.3524 30.0107 52.7412 28.9522 51.519 26.8354C50.2968 24.7185 49.6858 23.66 49.0009 22.8822C46.2274 19.7325 41.8342 18.5547 37.8575 19.8956C36.8754 20.2267 35.8163 20.8383 33.6993 22.0606L21.5208 29.0919Z"}),r.jsx("g",{transform:"rotate(-30 22.6953 37.6011)",children:r.jsx("rect",{x:"22.6953",y:"37.6011",width:"4.81084",height:"9.99175",rx:"2.40542",fill:"currentColor"})}),r.jsx("g",{transform:"rotate(-30 35.6748 30.1074)",children:r.jsx("rect",{x:"35.6748",y:"30.1074",width:"4.81084",height:"9.99175",rx:"2.40542",fill:"currentColor"})})]})}function f({size:t=16,className:e=""}){return r.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",className:e,children:r.jsx("path",{d:"M7 2h10a5 5 0 015 5v10a5 5 0 01-5 5H7a5 5 0 01-5-5V7a5 5 0 015-5zm0 4.5v11h2.35v-4.55h5.3V17.5H17v-11h-2.35v4.1h-5.3V6.5H7z"})})}function j({size:t=16,className:e=""}){return r.jsx("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"currentColor",className:e,children:r.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z"})})}function w({size:t=16,className:e=""}){return r.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,"aria-hidden":"true",children:r.jsx("g",{transform:"translate(3.4502, 3)",fill:"#9570BE",children:r.jsx("path",{d:"M3.17890888,3.6 L3.17890888,0 L16,0 L16,3.6 L3.17890888,3.6 Z M9.642,7.2 L9.64218223,10.8 L0,10.8 L0,3.6 L16,3.6 L16,7.2 L9.642,7.2 Z M3.17890888,18 L3.178,14.4 L0,14.4 L0,10.8 L16,10.8 L16,18 L3.17890888,18 Z",fillRule:"nonzero"})})})}function L({size:t=16,className:e=""}){return r.jsxs("svg",{width:t,height:t,viewBox:"0 0 120 90",fill:"currentColor",className:e,children:[r.jsx("rect",{x:"10",y:"8",width:"100",height:"12",rx:"2"}),r.jsx("rect",{x:"25",y:"20",width:"12",height:"62",rx:"2"}),r.jsx("rect",{x:"75",y:"20",width:"12",height:"45",rx:"2"}),r.jsx("rect",{x:"71",y:"55",width:"20",height:"16",rx:"3"}),r.jsx("rect",{x:"76",y:"71",width:"3",height:"8",rx:"1"}),r.jsx("rect",{x:"82",y:"71",width:"3",height:"8",rx:"1"})]})}function I({size:t=16,className:e=""}){return r.jsxs("svg",{width:t,height:t,viewBox:"0 0 120 90",fill:"currentColor",className:e,children:[r.jsx("rect",{x:"10",y:"8",width:"100",height:"12",rx:"2"}),r.jsx("rect",{x:"25",y:"20",width:"12",height:"62",rx:"2"}),r.jsx("rect",{x:"83",y:"20",width:"12",height:"62",rx:"2"})]})}function p({size:t=16,className:e=""}){return r.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:[r.jsx("path",{d:"M9 3v2"}),r.jsx("path",{d:"M15 3v2"}),r.jsx("rect",{x:"4",y:"6",width:"16",height:"13",rx:"3"}),r.jsx("circle",{cx:"9",cy:"13",r:"1.4",fill:"currentColor",stroke:"none"}),r.jsx("circle",{cx:"15",cy:"13",r:"1.4",fill:"currentColor",stroke:"none"}),r.jsx("path",{d:"M9 16h6"})]})}const M={CLAUDE:i,CODEBUDDY:g,CODEX:h,COPILOT:v,CRAFT:w,CURSOR:d,DROID:p,GEMINI:x,GITHUB:j,GROK:s,HERMES:f,KIMI:u,KIRO:a,OPENCODE:C,OMP:L,PI:I},R={ANTIGRAVITY:"/brand-logos/antigravity.svg",CLAUDE:"/brand-logos/claude-code.svg",CODEX:"/brand-logos/codex.svg",GEMINI:"/brand-logos/gemini.svg",HERMES:"/brand-logos/hermes.svg","KILO-CLI":"/brand-logos/kilo.svg","KILO-CODE":"/brand-logos/kilo.svg",OPENCLAW:"/brand-logos/openclaw.svg",OPENCODE:"/brand-logos/opencode.svg"};function m({size:t=16,className:e=""}){return r.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:e,children:r.jsx("circle",{cx:"12",cy:"12",r:"7.5",strokeDasharray:"3 3"})})}function B({provider:t,size:e=16,color:O,className:o=""}){const n=t?.toUpperCase?.()||"",l=R[n];if(l)return r.jsx("img",{src:l,alt:"",width:e,height:e,className:o,style:{width:e,height:e,objectFit:"contain"},"aria-hidden":!0});const c=M[n];return c?r.jsx(c,{size:e,className:o}):r.jsx(m,{size:e,className:`text-oai-gray-400 dark:text-oai-gray-500 shrink-0 ${o}`})}export{B as P};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as v,r as l,a9 as J,a3 as Y,aq as L,u as t,v as A,H as x,s,J as q,af as Q,ar as X,ag as ee,ah as te,ai as O,as as ne,at as ae,I as ie,R as se,E as oe,F as re,O as le,au as ce,av as ue,aw as de,ax as ge,C as he,ay as pe,az as be,aA as me,aB as fe,aC as xe,aD as ye,aE as ve,a1 as ke}from"./main-DhcQGvkP.js";import{L as je,a as E,u as Ne}from"./use-limits-display-prefs-DU4WDeXF.js";import{S as k,T as j,a as m,b as Se,u as I}from"./use-native-settings-CefuRE0t.js";import{C as we}from"./check-B_JRaxbD.js";import{u as Ce}from"./useCurrency-C62kk8HZ.js";import{C as P}from"./chevron-down-u-JNpncG.js";import{I as Le}from"./info-BdrJIus6.js";import{D as Ee}from"./download-DvfHniid.js";import"./Card-wgEcKm5u.js";const Ge=[["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"}]],Ae=v("activity",Ge);const Oe=[["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",Oe);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 G(){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(()=>Y.postRender(a),[a]),n]}const _=e=>e===!0,Ve=e=>_(e===!0)||e==="id",Ze=({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||G()});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 Ke({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(Ze,{children:t.jsx("div",{className:"flex flex-col",children:n.map(d=>{const p=i[d]!==!1,N=r===d;return t.jsxs(A.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:E[d]}),t.jsx("div",{onMouseDown:S=>S.stopPropagation(),draggable:!1,children:t.jsx(Ke,{checked:p,onChange:()=>a(d),ariaLabel:`${s("limits.settings.toggle_visible")}: ${E[d]}`})})]},d)})})})}function Ye(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 qe(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(()=>Ye(e),[e]),Z=l.useMemo(()=>qe(e),[e]),W=l.useMemo(()=>typeof e?.id=="string"?e.id.trim():"",[e]),K=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:Z,githubError:B,githubInput:R,githubUrl:U,loadSetters:K,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 O({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 O({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=q(),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(A.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 Et({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 Gt(){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(Et,{currency:o,rate:r,rateSource:c,rateFetchedAt:u}),control:t.jsx(Lt,{currency:o,setCurrency:g})})]})}function At(){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(Ee,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.menubar.checkUpdates")]})})]})}function Ot(){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(Ae,{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(Gt,{}),t.jsx(At,{}),t.jsx(mt,{}),t.jsx(k,{title:s("settings.section.limits"),children:t.jsx(Je,{prefs:e})})]}),t.jsx(Ot,{})]})})})}export{Ht as SettingsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as St,r as n,u as r,G as yr,B as Ve,H as Ue,X as Nt,s as S,E as Qr,v as rr,aH as Zr,i as en,aE as tn,R as rn}from"./main-DhcQGvkP.js";import{L as nn}from"./LocalOnlyNotice-D43ZmQJl.js";import{C as an}from"./Card-wgEcKm5u.js";import{A as Wt,s as Me,i as lt,j as Be,k as ze,l as br,m as $e,n as sn,o as on,p as ee,q as ln,r as Ne,t as cn,v as nr,w as dn,x as st,c as Ee,y as At,z as ar,B as un,C as wr,E as fn,F as gn,G as Ge,H as Ft,I as Xe,N as Le,J as yt,K as bt,L as mn,M as fe,O as qt,P as hn,Q as $t,R as B,S as Rt,T as pn,U as xn,V as Gt,W as Yt,X as kr,Y as vr,Z as Ct,_ as yn,$ as bn,a as De,a0 as wn,a1 as Ht,a2 as kn,a3 as vn,a4 as jn,a5 as Sn,a6 as Nn,a7 as Rn,a8 as Cn,a9 as jr,aa as In,ab as sr,ac as Mn,ad as En,ae as Tn,af as Xt,ag as Pn,ah as _t,u as On,D as An,d as _n,e as Ln,f as Vn,g as Dn,h as Fn}from"./DialogTitle-QumMNQjm.js";import{I as $n}from"./info-BdrJIus6.js";import{P as tt}from"./ProviderIcon-No-nxvR1.js";import{C as Ye}from"./check-B_JRaxbD.js";import{f as or,e as Hn,g as Un,u as Jt,h as Bn,i as zn,j as Kn,L as Ke,P as Wn,a as qn,b as Gn,c as Yn,d as Xn,C as Jn}from"./PopoverPopup-BkMR2-Ij.js";import{u as Qn}from"./use-reduced-motion-nzFM1j1r.js";import{C as Sr}from"./chevron-down-u-JNpncG.js";import{D as Zn}from"./download-DvfHniid.js";import"./arrow-up-right-BXWeIpuU.js";const ea=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Ut=St("external-link",ea);const ta=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Nr=St("plus",ta);const ra=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ir=St("search",ra);const na=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Rr=St("trash-2",na);function aa(e){const t=n.useRef(!0);t.current&&(t.current=!1,e())}function Bt({controlled:e,default:t,name:a,state:s="value"}){const{current:u}=n.useRef(e!==void 0),[o,c]=n.useState(t),l=u?e:o,p=n.useCallback(y=>{u||c(y)},[]);return[l,p]}function gt(e,t,a){return Math.floor(e/t)!==a}function ot(e,t){return t<0||t>=e.current.length}function Lt(e,t){return Ie(e,{disabledIndices:t})}function lr(e,t){return Ie(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Ie(e,{startingIndex:t=-1,decrement:a=!1,disabledIndices:s,amount:u=1}={}){let o=t;do o+=a?-u:u;while(o>=0&&o<=e.current.length-1&&it(e,o,s));return o}function sa(e,{event:t,orientation:a,loopFocus:s,rtl:u,cols:o,disabledIndices:c,minIndex:l,maxIndex:p,prevIndex:y,stopEvent:f=!1}){let m=y;const h=[],T={};let x=!1;{let d=null,E=-1;e.current.forEach((b,j)=>{if(b==null)return;const A=b.closest('[role="row"]');A&&(x=!0),(A!==d||E===-1)&&(d=A,E+=1,h[E]=[]),h[E].push(j),T[j]=E})}const k=x&&h.length>0&&h.some(d=>d.length!==o);function M(d){if(!k||y===-1)return;const E=T[y];if(E==null)return;const b=h[E].indexOf(y);let j=d==="up"?E-1:E+1;s&&(j<0?j=h.length-1:j>=h.length&&(j=0));const A=new Set;for(;j>=0&&j<h.length&&!A.has(j);){A.add(j);const L=h[j];if(L.length===0){j=d==="up"?j-1:j+1;continue}const Q=Math.min(b,L.length-1);for(let _=Q;_>=0;_-=1){const te=L[_];if(!it(e,te,c))return te}j=d==="up"?j-1:j+1,s&&(j<0?j=h.length-1:j>=h.length&&(j=0))}}if(t.key===Wt){const d=M("up");if(d!==void 0)f&&Me(t),m=d;else{if(f&&Me(t),y===-1)m=p;else if(m=Ie(e,{startingIndex:m,amount:o,decrement:!0,disabledIndices:c}),s&&(y-o<l||m<0)){const E=y%o,b=p%o,j=p-(b-E);b===E?m=p:m=b>E?j:j-o}ot(e,m)&&(m=y)}}if(t.key===lt){const d=M("down");d!==void 0?(f&&Me(t),m=d):(f&&Me(t),y===-1?m=l:(m=Ie(e,{startingIndex:y,amount:o,disabledIndices:c}),s&&y+o>p&&(m=Ie(e,{startingIndex:y%o-o,amount:o,disabledIndices:c}))),ot(e,m)&&(m=y))}if(a==="both"){const d=or(y/o);t.key===(u?Be:ze)&&(f&&Me(t),y%o!==o-1?(m=Ie(e,{startingIndex:y,disabledIndices:c}),s&>(m,o,d)&&(m=Ie(e,{startingIndex:y-y%o-1,disabledIndices:c}))):s&&(m=Ie(e,{startingIndex:y-y%o-1,disabledIndices:c})),gt(m,o,d)&&(m=y)),t.key===(u?ze:Be)&&(f&&Me(t),y%o!==0?(m=Ie(e,{startingIndex:y,decrement:!0,disabledIndices:c}),s&>(m,o,d)&&(m=Ie(e,{startingIndex:y+(o-y%o),decrement:!0,disabledIndices:c}))):s&&(m=Ie(e,{startingIndex:y+(o-y%o),decrement:!0,disabledIndices:c})),gt(m,o,d)&&(m=y));const E=or(p/o)===d;ot(e,m)&&(s&&E?m=t.key===(u?ze:Be)?p:Ie(e,{startingIndex:y-y%o-1,disabledIndices:c}):m=y)}return m}function oa(e,t,a){const s=[];let u=0;return e.forEach(({width:o,height:c},l)=>{let p=!1;for(a&&(u=0);!p;){const y=[];for(let f=0;f<o;f+=1)for(let m=0;m<c;m+=1)y.push(u+f+m*t);u%t+o<=t&&y.every(f=>s[f]==null)?(y.forEach(f=>{s[f]=l}),p=!0):u+=1}}),[...s]}function ia(e,t,a,s,u){if(e===-1)return-1;const o=a.indexOf(e),c=t[e];switch(u){case"tl":return o;case"tr":return c?o+c.width-1:o;case"bl":return c?o+(c.height-1)*s:o;case"br":return a.lastIndexOf(e);default:return-1}}function la(e,t){return t.flatMap((a,s)=>e.includes(a)?[s]:[])}function it(e,t,a){if(typeof a=="function")return a(t);if(a)return a.includes(t);const s=e.current[t];return s?s.hasAttribute("disabled")||s.getAttribute("aria-disabled")==="true":!1}const ca="Escape";function It(e,t,a){switch(e){case"vertical":return t;case"horizontal":return a;default:return t||a}}function mt(e,t){return It(t,e===Wt||e===lt,e===Be||e===ze)}function Vt(e,t,a){return It(t,e===lt,a?e===Be:e===ze)||e==="Enter"||e===" "||e===""}function da(e,t,a){return It(t,a?e===Be:e===ze,e===lt)}function ua(e,t,a,s){const u=a?e===ze:e===Be,o=e===Wt;return t==="both"||t==="horizontal"&&s&&s>1?e===ca:It(t,u,o)}function fa(e,t){const a="rootStore"in e?e.rootStore:e,s=a.useState("open"),u=a.useState("floatingElement"),o=a.useState("domReferenceElement"),c=a.context.dataRef,{listRef:l,activeIndex:p,onNavigate:y=()=>{},enabled:f=!0,selectedIndex:m=null,allowEscape:h=!1,loopFocus:T=!1,nested:x=!1,rtl:k=!1,virtual:M=!1,focusItemOnOpen:d="auto",focusItemOnHover:E=!0,openOnArrowKeyDown:b=!0,disabledIndices:j=void 0,orientation:A="vertical",parentOrientation:L,cols:Q=1,scrollItemIntoView:_=!0,itemSizes:te,dense:ye=!1,id:X,resetOnPointerLeave:Z=!0,externalTree:K}=t,ge=br(u),W=$e(ge),D=sn(),ae=on(K);ee(()=>{c.current.orientation=A},[c,A]);const R=ln(o),H=n.useRef(d),C=n.useRef(m??-1),v=n.useRef(null),de=n.useRef(!0),P=Ne(g=>{y(C.current===-1?null:C.current,g)}),oe=n.useRef(P),J=n.useRef(!!u),I=n.useRef(s),U=n.useRef(!1),be=n.useRef(!1),ke=$e(j),F=$e(s),xe=$e(_),re=$e(m),we=$e(Z),me=Ne(()=>{function g(i){M?ae?.events.emit("virtualfocus",i):cn(i,{sync:U.current,preventScroll:!0})}const V=l.current[C.current],N=be.current;V&&g(V),(U.current?i=>i():requestAnimationFrame)(()=>{const i=l.current[C.current]||V;if(!i)return;V||g(i);const w=xe.current;w&&q&&(N||!de.current)&&i.scrollIntoView?.(typeof w=="boolean"?{block:"nearest",inline:"nearest"}:w)})});ee(()=>{f&&(s&&u?(C.current=m??-1,H.current&&m!=null&&(be.current=!0,P())):J.current&&(C.current=-1,oe.current()))},[f,s,u,m,P]),ee(()=>{if(f){if(!s){U.current=!1;return}if(u)if(p==null){if(U.current=!1,re.current!=null)return;if(J.current&&(C.current=-1,me()),(!I.current||!J.current)&&H.current&&(v.current!=null||H.current===!0&&v.current==null)){let g=0;const V=()=>{l.current[0]==null?(g<2&&(g?requestAnimationFrame:queueMicrotask)(V),g+=1):(C.current=v.current==null||Vt(v.current,A,k)||x?Lt(l):lr(l),v.current=null,P())};V()}}else ot(l,p)||(C.current=p,me(),be.current=!1)}},[f,s,u,p,re,x,l,A,k,P,me,ke]),ee(()=>{if(!f||u||!ae||M||!J.current)return;const g=ae.nodesRef.current,V=g.find(i=>i.id===D)?.context?.elements.floating,N=nr(dn(u)),G=g.some(i=>i.context&&st(i.context.elements.floating,N));V&&!G&&de.current&&V.focus({preventScroll:!0})},[f,u,ae,D,M]),ee(()=>{oe.current=P,I.current=s,J.current=!!u}),ee(()=>{s||(v.current=null,H.current=d)},[s,d]);const ue=p!=null,q=n.useMemo(()=>{function g(N){if(!F.current)return;const G=l.current.indexOf(N.currentTarget);G!==-1&&C.current!==G&&(C.current=G,P(N))}return{onFocus(N){U.current=!0,g(N)},onClick:({currentTarget:N})=>N.focus({preventScroll:!0}),onMouseMove(N){U.current=!0,be.current=!1,E&&g(N)},onPointerLeave(N){if(!F.current||!de.current||N.pointerType==="touch")return;U.current=!0;const G=N.relatedTarget;!E||l.current.includes(G)||we.current&&(C.current=-1,P(N),M||W.current?.focus({preventScroll:!0}))}}},[F,W,E,l,P,we,M]),ne=n.useCallback(()=>L??ae?.nodesRef.current.find(g=>g.id===D)?.context?.dataRef?.current.orientation,[D,ae,L]),ve=Ne(g=>{if(de.current=!1,U.current=!0,g.which===229||!F.current&&g.currentTarget===W.current)return;if(x&&ua(g.key,A,k,Q)){mt(g.key,ne())||Me(g),a.setOpen(!1,Ee(At,g.nativeEvent)),ar(o)&&(M?ae?.events.emit("virtualfocus",o):o.focus());return}const V=C.current,N=Lt(l,j),G=lr(l,j);if(R||(g.key==="Home"&&(Me(g),C.current=N,P(g)),g.key==="End"&&(Me(g),C.current=G,P(g))),Q>1){const i=te||Array.from({length:l.current.length},()=>({width:1,height:1})),w=oa(i,Q,ye),O=w.findIndex(ce=>ce!=null&&!it(l,ce,j)),Y=w.reduce((ce,pe,Re)=>pe!=null&&!it(l,pe,j)?Re:ce,-1),le=w[sa({current:w.map(ce=>ce!=null?l.current[ce]:null)},{event:g,orientation:A,loopFocus:T,rtl:k,cols:Q,disabledIndices:la([...(typeof j!="function"?j:null)||l.current.map((ce,pe)=>it(l,pe,j)?pe:void 0),void 0],w),minIndex:O,maxIndex:Y,prevIndex:ia(C.current>G?N:C.current,i,w,Q,g.key===lt?"bl":g.key===(k?Be:ze)?"tr":"tl"),stopEvent:!0})];if(le!=null&&(C.current=le,P(g)),A==="both")return}if(mt(g.key,A)){if(Me(g),s&&!M&&nr(g.currentTarget.ownerDocument)===g.currentTarget){C.current=Vt(g.key,A,k)?N:G,P(g);return}Vt(g.key,A,k)?T?V>=G?h&&V!==l.current.length?C.current=-1:(U.current=!1,C.current=N):C.current=Ie(l,{startingIndex:V,disabledIndices:j}):C.current=Math.min(G,Ie(l,{startingIndex:V,disabledIndices:j})):T?V<=N?h&&V!==-1?C.current=l.current.length:(U.current=!1,C.current=G):C.current=Ie(l,{startingIndex:V,decrement:!0,disabledIndices:j}):C.current=Math.max(N,Ie(l,{startingIndex:V,decrement:!0,disabledIndices:j})),ot(l,C.current)&&(C.current=-1),P(g)}}),se=n.useMemo(()=>M&&s&&ue&&{"aria-activedescendant":`${X}-${p}`},[M,s,ue,X,p]),ie=n.useMemo(()=>({"aria-orientation":A==="both"?void 0:A,...R?{}:se,onKeyDown(g){if(g.key==="Tab"&&g.shiftKey&&s&&!M){const V=un(g.nativeEvent);if(V&&!st(W.current,V))return;Me(g),a.setOpen(!1,Ee(wr,g.nativeEvent)),ar(o)&&o.focus();return}ve(g)},onPointerMove(){de.current=!0}}),[se,ve,W,A,R,a,s,M,o]),Ce=n.useMemo(()=>{function g(N){d==="auto"&&fn(N.nativeEvent)&&(H.current=!M)}function V(N){H.current=d,d==="auto"&&gn(N.nativeEvent)&&(H.current=!0)}return{onKeyDown(N){const G=a.select("open");de.current=!1;const i=N.key.startsWith("Arrow"),w=da(N.key,ne(),k),O=mt(N.key,A),Y=(x?w:O)||N.key==="Enter"||N.key.trim()==="";if(M&&G)return ve(N);if(!(!G&&!b&&i)){if(Y){const le=mt(N.key,ne());v.current=x&&le?null:N.key}if(x){w&&(Me(N),G?(C.current=Lt(l,ke.current),P(N)):a.setOpen(!0,Ee(At,N.nativeEvent,N.currentTarget)));return}O&&(re.current!=null&&(C.current=re.current),Me(N),!G&&b?a.setOpen(!0,Ee(At,N.nativeEvent,N.currentTarget)):ve(N),G&&P(N))}},onFocus(N){a.select("open")&&!M&&(C.current=-1,P(N))},onPointerDown:V,onPointerEnter:V,onMouseDown:g,onClick:g}},[ve,ke,d,l,x,P,a,b,A,ne,k,re,M]),he=n.useMemo(()=>({...se,...Ce}),[se,Ce]);return n.useMemo(()=>f?{reference:he,floating:ie,item:q,trigger:Ce}:{},[f,he,ie,Ce,q])}function ga(e,t){const a="rootStore"in e?e.rootStore:e,s=a.useState("open"),u=a.context.dataRef,{listRef:o,activeIndex:c,onMatch:l,onTypingChange:p,enabled:y=!0,findMatch:f=null,resetMs:m=750,ignoreKeys:h=Ft,selectedIndex:T=null}=t,x=Ge(),k=n.useRef(""),M=n.useRef(T??c??-1),d=n.useRef(null);ee(()=>{s&&(x.clear(),d.current=null,k.current="")},[s,x]),ee(()=>{s&&k.current===""&&(M.current=T??c??-1)},[s,T,c]);const E=Ne(L=>{L?u.current.typing||(u.current.typing=L,p?.(L)):u.current.typing&&(u.current.typing=L,p?.(L))}),b=Ne(L=>{function Q(Z,K,ge){const W=f?f(K,ge):K.find(D=>D?.toLocaleLowerCase().indexOf(ge.toLocaleLowerCase())===0);return W?Z.indexOf(W):-1}const _=o.current;if(k.current.length>0&&k.current[0]!==" "&&(Q(_,_,k.current)===-1?E(!1):L.key===" "&&Me(L)),_==null||h.includes(L.key)||L.key.length!==1||L.ctrlKey||L.metaKey||L.altKey)return;s&&L.key!==" "&&(Me(L),E(!0)),_.every(Z=>Z?Z[0]?.toLocaleLowerCase()!==Z[1]?.toLocaleLowerCase():!0)&&k.current===L.key&&(k.current="",M.current=d.current),k.current+=L.key,x.start(m,()=>{k.current="",M.current=d.current,E(!1)});const ye=M.current,X=Q(_,[..._.slice((ye||0)+1),..._.slice(0,(ye||0)+1)],k.current);X!==-1?(l?.(X),d.current=X):L.key!==" "&&(k.current="",E(!1))}),j=n.useMemo(()=>({onKeyDown:b}),[b]),A=n.useMemo(()=>({onKeyDown:b,onKeyUp(L){L.key===" "&&E(!1)}}),[b,E]);return n.useMemo(()=>y?{reference:j,floating:A}:{},[y,j,A])}const Cr=n.createContext(null),Ir=n.createContext(null);function We(){const e=n.useContext(Cr);if(e===null)throw new Error(Xe(60));return e}function Mr(){const e=n.useContext(Ir);if(e===null)throw new Error(Xe(61));return e}let cr=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const ma={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Qt={valid(e){return e===null?null:e?{[cr.valid]:""}:{[cr.invalid]:""}}},ha=n.createContext({invalid:void 0,name:void 0,validityData:{state:ma,errors:[],error:"",value:"",initialValue:null},setValidityData:Le,disabled:void 0,touched:!1,setTouched:Le,dirty:!1,setDirty:Le,filled:!1,setFilled:Le,focused:!1,setFocused:Le,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=yt)=>e,getInputValidationProps:(e=yt)=>e,inputRef:{current:null},commit:async()=>{}}});function Mt(e=!0){const t=n.useContext(ha);if(t.setValidityData===Le&&!e)throw new Error(Xe(28));return t}const pa=n.createContext({controlId:void 0,setControlId:Le,labelId:void 0,setLabelId:Le,messageIds:[],setMessageIds:Le,getDescriptionProps:e=>e});function Zt(){return n.useContext(pa)}function Er(e={}){const{id:t,implicit:a=!1,controlRef:s}=e,{controlId:u,setControlId:o}=Zt(),c=bt(t);return ee(()=>{if(!(!a&&!t||o===Le)){if(a){const l=s?.current;mn(l)&&l.closest("label")!=null?o(t??null):o(u??c)}else t&&o(t);return()=>{t&&o(void 0)}}},[t,s,u,o,a,c]),u??c}const xa=(e,t)=>Object.is(e,t);function rt(e,t,a){return e==null||t==null?Object.is(e,t):a(e,t)}function Dt(e,t,a){return!e||e.length===0?!1:e.some(s=>s===void 0?!1:rt(s,t,a))}function zt(e,t,a){return!e||e.length===0?-1:e.findIndex(s=>s===void 0?!1:rt(s,t,a))}function ya(e,t,a){return e.filter(s=>!rt(s,t,a))}function Kt(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Tr(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function ba(e){if(!Array.isArray(e))return e!=null&&!("null"in e);if(Tr(e)){for(const t of e)for(const a of t.items)if(a&&a.value==null&&a.label!=null)return!0;return!1}for(const t of e)if(t&&t.value==null&&t.label!=null)return!0;return!1}function wa(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return Kt(e)}function et(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Kt(e.value):Kt(e)}function Pr(e,t,a){function s(){return wa(e,a)}if(a&&e!=null)return a(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??s();if(Array.isArray(t)){const u=Tr(t)?t.flatMap(o=>o.items):t;if(e==null||typeof e!="object"){const o=u.find(c=>c.value===e);return o&&o.label!=null?o.label:s()}if("value"in e){const o=u.find(c=>c&&c.value===e.value);if(o&&o.label!=null)return o.label}}return s()}function ka(e,t,a){return e.reduce((s,u,o)=>(o>0&&s.push(", "),s.push(r.jsx(n.Fragment,{children:Pr(u,t,a)},o)),s),[])}const $={id:fe(e=>e.id),modal:fe(e=>e.modal),multiple:fe(e=>e.multiple),items:fe(e=>e.items),itemToStringLabel:fe(e=>e.itemToStringLabel),itemToStringValue:fe(e=>e.itemToStringValue),isItemEqualToValue:fe(e=>e.isItemEqualToValue),value:fe(e=>e.value),hasSelectedValue:fe(e=>{const{value:t,multiple:a,itemToStringValue:s}=e;return t==null?!1:a&&Array.isArray(t)?t.length>0:et(t,s)!==""}),hasNullItemLabel:fe((e,t)=>t?ba(e.items):!1),open:fe(e=>e.open),mounted:fe(e=>e.mounted),forceMount:fe(e=>e.forceMount),transitionStatus:fe(e=>e.transitionStatus),openMethod:fe(e=>e.openMethod),activeIndex:fe(e=>e.activeIndex),selectedIndex:fe(e=>e.selectedIndex),isActive:fe((e,t)=>e.activeIndex===t),isSelected:fe((e,t,a)=>{const s=e.isItemEqualToValue,u=e.value;return e.multiple?Array.isArray(u)&&u.some(o=>rt(o,a,s)):e.selectedIndex===t&&e.selectedIndex!==null?!0:rt(u,a,s)}),isSelectedByFocus:fe((e,t)=>e.selectedIndex===t),popupProps:fe(e=>e.popupProps),triggerProps:fe(e=>e.triggerProps),triggerElement:fe(e=>e.triggerElement),positionerElement:fe(e=>e.positionerElement),listElement:fe(e=>e.listElement),scrollUpArrowVisible:fe(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:fe(e=>e.scrollDownArrowVisible),hasScrollArrows:fe(e=>e.hasScrollArrows)},va=n.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Le,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function er(){return n.useContext(va)}function ja(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}function Or(e){const{enabled:t=!0,value:a,id:s,name:u,controlRef:o,commit:c}=e,{formRef:l}=er(),{invalid:p,markedDirtyRef:y,validityData:f,setValidityData:m}=Mt(),h=Ne(e.getValue);ee(()=>{if(!t)return;let T=a;T===void 0&&(T=h()),f.initialValue===null&&T!==null&&m(x=>({...x,initialValue:T}))},[t,m,a,f.initialValue,h]),ee(()=>{!t||!s||l.current.fields.set(s,{getValue:h,name:u,controlRef:o,validityData:ja(f,p),validate(T=!0){let x=a;x===void 0&&(x=h()),y.current=!0,T?yr.flushSync(()=>c(x)):c(x)}})},[c,o,t,l,h,s,p,y,u,f,a]),ee(()=>{const T=l.current.fields;return()=>{s&&T.delete(s)}},[l,s])}function Ar(e,t){const a=n.useRef(e),s=Ne(t);ee(()=>{a.current!==e&&s(a.current)},[e,s]),ee(()=>{a.current=e},[e])}function _r(e){const{id:t,value:a,defaultValue:s=null,onValueChange:u,open:o,defaultOpen:c=!1,onOpenChange:l,name:p,disabled:y=!1,readOnly:f=!1,required:m=!1,modal:h=!0,actionsRef:T,inputRef:x,onOpenChangeComplete:k,items:M,multiple:d=!1,itemToStringLabel:E,itemToStringValue:b,isItemEqualToValue:j=xa,highlightItemOnHover:A=!0,children:L}=e,{clearErrors:Q}=er(),{setDirty:_,setTouched:te,setFocused:ye,shouldValidateOnChange:X,validityData:Z,setFilled:K,name:ge,disabled:W,validation:D,validationMode:ae}=Mt(),R=Er({id:t}),H=W||y,C=ge??p,[v,de]=Bt({controlled:a,default:d?s??Ft:s,name:"Select",state:"value"}),[P,oe]=Bt({controlled:o,default:c,name:"Select",state:"open"}),J=n.useRef([]),I=n.useRef([]),U=n.useRef(null),be=n.useRef(null),ke=n.useRef(0),F=n.useRef(null),xe=n.useRef([]),re=n.useRef(!1),we=n.useRef(!1),me=n.useRef(null),ue=n.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),q=n.useRef(!1),{mounted:ne,setMounted:ve,transitionStatus:se}=qt(P),{openMethod:ie,triggerProps:Ce,reset:he}=hn(P),g=$t(()=>new yn({id:R,modal:h,multiple:d,itemToStringLabel:E,itemToStringValue:b,isItemEqualToValue:j,value:v,open:P,mounted:ne,transitionStatus:se,items:M,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,V=B(g,$.activeIndex),N=B(g,$.selectedIndex),G=B(g,$.triggerElement),i=B(g,$.positionerElement),w=n.useMemo(()=>d&&Array.isArray(v)&&v.length===0?"":et(v,b),[d,v,b]),O=n.useMemo(()=>d&&Array.isArray(v)?v.map(z=>et(z,b)):et(v,b),[d,v,b]),Y=$e(g.state.triggerElement);Or({id:R,commit:D.commit,value:v,controlRef:Y,name:C,getValue:()=>O});const le=n.useRef(v);ee(()=>{v!==le.current&&g.set("forceMount",!0)},[g,v]),ee(()=>{K(d?Array.isArray(v)&&v.length>0:v!=null)},[d,v,K]),ee(function(){if(P)return;const je=xe.current;if(d){const _e=Array.isArray(v)?v:[];if(_e.length===0){g.set("selectedIndex",null);return}const Te=_e[_e.length-1],ft=zt(je,Te,j);g.set("selectedIndex",ft===-1?null:ft);return}const Ae=zt(je,v,j);g.set("selectedIndex",Ae===-1?null:Ae)},[d,P,v,xe,j,g]),Ar(v,()=>{Q(C),_(v!==Z.initialValue),X()?D.commit(v):D.commit(v,!0)});const ce=Ne((z,je)=>{if(l?.(z,je),!je.isCanceled&&(oe(z),!z&&(je.reason===wr||je.reason===bn)&&(te(!0),ye(!1),ae==="onBlur"&&D.commit(v)),!z&&g.state.activeIndex!==null)){const Ae=J.current[g.state.activeIndex];queueMicrotask(()=>{Ae?.setAttribute("tabindex","-1")})}}),pe=Ne(()=>{ve(!1),g.set("activeIndex",null),he(),k?.(!1)});Rt({enabled:!T,open:P,ref:U,onComplete(){P||pe()}}),n.useImperativeHandle(T,()=>({unmount:pe}),[pe]);const Re=Ne((z,je)=>{u?.(z,je),!je.isCanceled&&de(z)}),Se=Ne(()=>{const z=g.state.listElement||U.current;if(!z)return;const je=z.scrollTop,Ae=z.scrollTop+z.clientHeight,_e=je>1,Te=Ae<z.scrollHeight-1;g.state.scrollUpArrowVisible!==_e&&g.set("scrollUpArrowVisible",_e),g.state.scrollDownArrowVisible!==Te&&g.set("scrollDownArrowVisible",Te)}),Oe=Hn({open:P,onOpenChange:ce,elements:{reference:G,floating:i}}),Je=Un(Oe,{enabled:!f&&!H,event:"mousedown"}),nt=pn(Oe,{bubbles:!1}),Fe=fa(Oe,{enabled:!f&&!H,listRef:J,activeIndex:V,selectedIndex:N,disabledIndices:Ft,onNavigate(z){z===null&&!P||g.set("activeIndex",z)},focusItemOnHover:!1}),Tt=ga(Oe,{enabled:!f&&!H&&(P||!d),listRef:I,activeIndex:V,selectedIndex:N,onMatch(z){P?g.set("activeIndex",z):Re(xe.current[z],Ee("none"))},onTypingChange(z){re.current=z}}),{getReferenceProps:Qe,getFloatingProps:Ze,getItemProps:ct}=xn([Je,nt,Fe,Tt]),at=n.useMemo(()=>Gt(Qe(),Ce,R?{id:R}:yt),[Qe,Ce,R]);aa(()=>{g.update({popupProps:Ze(),triggerProps:at})}),ee(()=>{g.update({id:R,modal:h,multiple:d,value:v,open:P,mounted:ne,transitionStatus:se,popupProps:Ze(),triggerProps:at,items:M,itemToStringLabel:E,itemToStringValue:b,isItemEqualToValue:j,openMethod:ie})},[g,R,h,d,v,P,ne,se,Ze,at,M,E,b,j,ie]);const dt=n.useMemo(()=>({store:g,name:C,required:m,disabled:H,readOnly:f,multiple:d,itemToStringLabel:E,itemToStringValue:b,highlightItemOnHover:A,setValue:Re,setOpen:ce,listRef:J,popupRef:U,scrollHandlerRef:be,handleScrollArrowVisibility:Se,scrollArrowsMountedCountRef:ke,getItemProps:ct,events:Oe.context.events,valueRef:F,valuesRef:xe,labelsRef:I,typingRef:re,selectionRef:ue,selectedItemTextRef:me,validation:D,onOpenChangeComplete:k,keyboardActiveRef:we,alignItemWithTriggerActiveRef:q,initialValueRef:le}),[g,C,m,H,f,d,E,b,A,Re,ce,ct,Oe.context.events,D,k,Se]),ut=Yt(x,D.inputRef),Pt=d&&Array.isArray(v)&&v.length>0,Ot=n.useMemo(()=>!d||!Array.isArray(v)||!C?null:v.map(z=>{const je=et(z,b);return r.jsx("input",{type:"hidden",name:C,value:je},je)}),[d,v,C,b]);return r.jsx(Cr.Provider,{value:dt,children:r.jsxs(Ir.Provider,{value:Oe,children:[L,r.jsx("input",{...D.getInputValidationProps({onFocus(){g.state.triggerElement?.focus({focusVisible:!0})},onChange(z){if(z.nativeEvent.defaultPrevented)return;const je=z.target.value,Ae=Ee(Ct,z.nativeEvent);function _e(){if(d)return;const Te=xe.current.find(ft=>et(ft,b).toLowerCase()===je.toLowerCase());Te!=null&&(_(Te!==Z.initialValue),Re(Te,Ae),X()&&D.commit(Te))}g.set("forceMount",!0),queueMicrotask(_e)}}),name:d?void 0:C,value:w,disabled:H,required:m&&!Pt,readOnly:f,ref:ut,style:C?kr:vr,tabIndex:-1,"aria-hidden":!0}),Ot]})})}function Sa(e){const t=e.getBoundingClientRect(),a=window.getComputedStyle(e,"::before"),s=window.getComputedStyle(e,"::after");if(!(a.content!=="none"||s.content!=="none"))return t;const o=parseFloat(a.width)||0,c=parseFloat(a.height)||0,l=parseFloat(s.width)||0,p=parseFloat(s.height)||0,y=Math.max(t.width,o,l),f=Math.max(t.height,c,p),m=y-t.width,h=f-t.height;return{left:t.left-m/2,right:t.right+m/2,top:t.top-h/2,bottom:t.bottom+h/2}}const ht=2,Na=400,dr=200,Ra={...wn,...Qt,value:()=>null},Lr=n.forwardRef(function(t,a){const{render:s,className:u,id:o,disabled:c=!1,nativeButton:l=!0,...p}=t,{setTouched:y,setFocused:f,validationMode:m,state:h,disabled:T}=Mt(),{labelId:x}=Zt(),{store:k,setOpen:M,selectionRef:d,validation:E,readOnly:b,required:j,alignItemWithTriggerActiveRef:A,disabled:L,keyboardActiveRef:Q}=We(),_=T||L||c,te=B(k,$.open),ye=B(k,$.value),X=B(k,$.triggerProps),Z=B(k,$.positionerElement),K=B(k,$.listElement),ge=B(k,$.id),W=B(k,$.hasSelectedValue),D=!W&&te,ae=B(k,$.hasNullItemLabel,D),R=o??ge;Er({id:R});const H=$e(Z),C=n.useRef(null),{getButtonProps:v,buttonRef:de}=Jt({disabled:_,native:l}),P=Ne(re=>{k.set("triggerElement",re)}),oe=Yt(a,C,de,P),J=Ge(),I=Ge(),U=Ge(),be=Ge();n.useEffect(()=>{if(te)return!(W||ae)?U.start(Na,()=>{d.current.allowUnselectedMouseUp=!0,d.current.allowSelectedMouseUp=!0}):be.start(dr,()=>{d.current.allowUnselectedMouseUp=!0,U.start(dr,()=>{d.current.allowSelectedMouseUp=!0})}),()=>{U.clear(),be.clear()};d.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},I.clear()},[te,W,ae,d,I,U,be]);const ke=n.useMemo(()=>K?.id??br(Z)?.id,[K,Z]),F=Gt(X,{id:R,role:"combobox","aria-expanded":te?"true":"false","aria-haspopup":"listbox","aria-controls":te?ke:void 0,"aria-labelledby":x,"aria-readonly":b||void 0,"aria-required":j||void 0,tabIndex:_?-1:0,ref:oe,onFocus(re){f(!0),te&&A.current&&M(!1,Ee(Ct,re.nativeEvent)),J.start(0,()=>{k.set("forceMount",!0)})},onBlur(re){st(Z,re.relatedTarget)||(y(!0),f(!1),m==="onBlur"&&E.commit(ye))},onPointerMove(){Q.current=!1},onKeyDown(){Q.current=!0},onMouseDown(re){if(te)return;const we=Ht(re.currentTarget);function me(ue){if(!C.current)return;const q=ue.target;if(st(C.current,q)||st(H.current,q)||q===C.current)return;const ne=Sa(C.current);ue.clientX>=ne.left-ht&&ue.clientX<=ne.right+ht&&ue.clientY>=ne.top-ht&&ue.clientY<=ne.bottom+ht||M(!1,Ee(kn,ue))}I.start(0,()=>{we.addEventListener("mouseup",me,{once:!0})})}},E.getValidationProps,p,v);F.role="combobox";const xe=n.useMemo(()=>({...h,open:te,disabled:_,value:ye,readOnly:b,placeholder:!W}),[h,te,_,ye,b,W]);return De("button",t,{ref:[a,C],state:xe,stateAttributesMapping:Ra,props:F})}),Ca={value:()=>null},Vr=n.forwardRef(function(t,a){const{className:s,render:u,children:o,placeholder:c,...l}=t,{store:p,valueRef:y}=We(),f=B(p,$.value),m=B(p,$.items),h=B(p,$.itemToStringLabel),T=B(p,$.hasSelectedValue),x=!T&&c!=null&&o==null,k=B(p,$.hasNullItemLabel,x),M=n.useMemo(()=>({value:f,placeholder:!T}),[f,T]);let d=null;return typeof o=="function"?d=o(f):o!=null?d=o:!T&&c!=null&&!k?d=c:Array.isArray(f)?d=ka(f,m,h):d=Pr(f,m,h),De("span",t,{state:M,ref:[a,y],props:[{children:d},l],stateAttributesMapping:Ca})}),Dr=n.forwardRef(function(t,a){const{className:s,render:u,...o}=t,{store:c}=We(),l=B(c,$.open),p=n.useMemo(()=>({open:l}),[l]);return De("span",t,{state:p,ref:a,props:[{"aria-hidden":!0,children:"▼"},o],stateAttributesMapping:vn})}),Ia=n.createContext(void 0),Fr=n.forwardRef(function(t,a){const{store:s}=We(),u=B(s,$.mounted),o=B(s,$.forceMount);return u||o?r.jsx(Ia.Provider,{value:!0,children:r.jsx(jn,{ref:a,...t})}):null}),$r=n.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function Ma(){return n.useContext($r)}function Ea(e){const{children:t,elementsRef:a,labelsRef:s,onMapChange:u}=e,o=Ne(u),c=n.useRef(0),l=$t(Pa).current,p=$t(Ta).current,[y,f]=n.useState(0),m=n.useRef(y),h=Ne((d,E)=>{p.set(d,E??null),m.current+=1,f(m.current)}),T=Ne(d=>{p.delete(d),m.current+=1,f(m.current)}),x=n.useMemo(()=>{const d=new Map;return Array.from(p.keys()).filter(b=>b.isConnected).sort(Oa).forEach((b,j)=>{const A=p.get(b)??{};d.set(b,{...A,index:j})}),d},[p,y]);ee(()=>{if(typeof MutationObserver!="function"||x.size===0)return;const d=new MutationObserver(E=>{const b=new Set,j=A=>b.has(A)?b.delete(A):b.add(A);E.forEach(A=>{A.removedNodes.forEach(j),A.addedNodes.forEach(j)}),b.size===0&&(m.current+=1,f(m.current))});return x.forEach((E,b)=>{b.parentElement&&d.observe(b.parentElement,{childList:!0})}),()=>{d.disconnect()}},[x]),ee(()=>{m.current===y&&(a.current.length!==x.size&&(a.current.length=x.size),s&&s.current.length!==x.size&&(s.current.length=x.size),c.current=x.size),o(x)},[o,x,a,s,y]),ee(()=>()=>{a.current=[]},[a]),ee(()=>()=>{s&&(s.current=[])},[s]);const k=Ne(d=>(l.add(d),()=>{l.delete(d)}));ee(()=>{l.forEach(d=>d(x))},[l,x]);const M=n.useMemo(()=>({register:h,unregister:T,subscribeMapChange:k,elementsRef:a,labelsRef:s,nextIndexRef:c}),[h,T,k,a,s,c]);return r.jsx($r.Provider,{value:M,children:t})}function Ta(){return new Map}function Pa(){return new Set}function Oa(e,t){const a=e.compareDocumentPosition(t);return a&Node.DOCUMENT_POSITION_FOLLOWING||a&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:a&Node.DOCUMENT_POSITION_PRECEDING||a&Node.DOCUMENT_POSITION_CONTAINS?1:0}const Hr=n.createContext(void 0);function Aa(){const e=n.useContext(Hr);if(!e)throw new Error(Xe(59));return e}function wt(e,t){e&&Object.assign(e.style,t)}const _a={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},La={position:"fixed"},Ur=n.forwardRef(function(t,a){const{anchor:s,positionMethod:u="absolute",className:o,render:c,side:l="bottom",align:p="center",sideOffset:y=0,alignOffset:f=0,collisionBoundary:m="clipping-ancestors",collisionPadding:h,arrowPadding:T=5,sticky:x=!1,disableAnchorTracking:k,alignItemWithTrigger:M=!0,collisionAvoidance:d=Sn,...E}=t,{store:b,listRef:j,labelsRef:A,alignItemWithTriggerActiveRef:L,selectedItemTextRef:Q,valuesRef:_,initialValueRef:te,popupRef:ye,setValue:X}=We(),Z=Mr(),K=B(b,$.open),ge=B(b,$.mounted),W=B(b,$.modal),D=B(b,$.value),ae=B(b,$.openMethod),R=B(b,$.positionerElement),H=B(b,$.triggerElement),C=B(b,$.isItemEqualToValue),v=n.useRef(null),de=n.useRef(null),[P,oe]=n.useState(M),J=ge&&P&&ae!=="touch";!ge&&P!==M&&oe(M),ee(()=>{ge||($.scrollUpArrowVisible(b.state)&&b.set("scrollUpArrowVisible",!1),$.scrollDownArrowVisible(b.state)&&b.set("scrollDownArrowVisible",!1))},[b,ge]),n.useImperativeHandle(L,()=>J),Nn((J||W)&&K&&ae!=="touch",H);const I=Bn({anchor:s,floatingRootContext:Z,positionMethod:u,mounted:ge,side:l,sideOffset:y,align:p,alignOffset:f,arrowPadding:T,collisionBoundary:m,collisionPadding:h,sticky:x,disableAnchorTracking:k??J,collisionAvoidance:d,keepMounted:!0}),U=J?"none":I.side,be=J?La:I.positionerStyles,ke=n.useMemo(()=>{const q={};return K||(q.pointerEvents="none"),{role:"presentation",hidden:!ge,style:{...be,...q}}},[K,ge,be]),F=n.useMemo(()=>({open:K,side:U,align:I.align,anchorHidden:I.anchorHidden}),[K,U,I.align,I.anchorHidden]),xe=Ne(q=>{b.set("positionerElement",q)}),re=De("div",t,{ref:[a,xe],state:F,stateAttributesMapping:jr,props:[ke,E]}),we=n.useRef(0),me=Ne(q=>{if(q.size===0&&we.current===0||_.current.length===0)return;const ne=we.current;if(we.current=q.size,q.size===ne)return;const ve=Ee(Ct);if(ne!==0&&!b.state.multiple&&D!==null&&zt(_.current,D,C)===-1){const ie=te.current,he=ie!=null&&Dt(_.current,ie,C)?ie:null;X(he,ve),he===null&&(b.set("selectedIndex",null),Q.current=null)}if(ne!==0&&b.state.multiple&&Array.isArray(D)){const se=D.filter(ie=>Dt(_.current,ie,C));(se.length!==D.length||se.some(ie=>!Dt(D,ie,C)))&&(X(se,ve),se.length===0&&(b.set("selectedIndex",null),Q.current=null))}if(K&&J){b.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const se={height:""};wt(R,se),wt(ye.current,se)}}),ue=n.useMemo(()=>({...I,side:U,alignItemWithTriggerActive:J,setControlledAlignItemWithTrigger:oe,scrollUpArrowRef:v,scrollDownArrowRef:de}),[I,U,J,oe]);return r.jsx(Ea,{elementsRef:j,labelsRef:A,onMapChange:me,children:r.jsxs(Hr.Provider,{value:ue,children:[ge&&W&&r.jsx(Rn,{inert:Cn(!K),cutout:H}),re]})})});function Br(e){const t=e.currentTarget.getBoundingClientRect();return t.top+1<=e.clientY&&e.clientY<=t.bottom-1&&t.left+1<=e.clientX&&e.clientX<=t.right-1}const pt="base-ui-disable-scrollbar",ur={className:pt,getElement(e){return r.jsx("style",{nonce:e,href:pt,precedence:"base-ui:low",children:`.${pt}{scrollbar-width:none}.${pt}::-webkit-scrollbar{display:none}`})}};function Va(e,t=Number.MIN_SAFE_INTEGER,a=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,a))}const Da=n.createContext(void 0),Fa={disableStyleElements:!1};function $a(){return n.useContext(Da)??Fa}const Ha={...jr,...Xt},zr=n.forwardRef(function(t,a){const{render:s,className:u,...o}=t,{store:c,popupRef:l,onOpenChangeComplete:p,setOpen:y,valueRef:f,selectedItemTextRef:m,keyboardActiveRef:h,multiple:T,handleScrollArrowVisibility:x,scrollHandlerRef:k,highlightItemOnHover:M}=We(),{side:d,align:E,alignItemWithTriggerActive:b,setControlledAlignItemWithTrigger:j,scrollDownArrowRef:A,scrollUpArrowRef:L}=Aa(),Q=zn()!=null,_=Mr(),{nonce:te,disableStyleElements:ye}=$a(),X=Ge(),Z=B(c,$.id),K=B(c,$.open),ge=B(c,$.mounted),W=B(c,$.popupProps),D=B(c,$.transitionStatus),ae=B(c,$.triggerElement),R=B(c,$.positionerElement),H=B(c,$.listElement),C=n.useRef(0),v=n.useRef(!1),de=n.useRef(0),P=n.useRef(!1),oe=n.useRef({}),J=In(),I=Ne(F=>{if(!R||!l.current||!P.current)return;if(v.current||!b){x();return}const xe=R.style.top==="0px",re=R.style.bottom==="0px",we=R.getBoundingClientRect().height,me=Ht(R),ue=getComputedStyle(R),q=parseFloat(ue.marginTop),ne=parseFloat(ue.marginBottom),ve=fr(getComputedStyle(l.current)),se=me.documentElement.clientHeight-q-ne,ie=F.scrollTop,Ce=F.scrollHeight,he=F.clientHeight,g=Ce-he;let V=0,N=null,G=!1;if(xe){const i=g-ie,w=we+i,O=Math.min(w,se);V=O,O!==se?N=g:G=!0}else if(re){const i=ie-0,w=we+i,O=Math.min(w,se),Y=w-se;V=O,O!==se?N=0:(G=!0,ie<g&&(N=ie-(i-Y)))}V!==0&&(R.style.height=`${V}px`),N!=null&&(F.scrollTop=N),(G||V>=ve)&&(v.current=!0),x()});n.useImperativeHandle(k,()=>I,[I]),Rt({open:K,ref:l,onComplete(){K&&p?.(!0)}});const U=n.useMemo(()=>({open:K,transitionStatus:D,side:d,align:E}),[K,D,d,E]);ee(()=>{!R||!l.current||Object.keys(oe.current).length||(oe.current={top:R.style.top||"0",left:R.style.left||"0",right:R.style.right,height:R.style.height,bottom:R.style.bottom,minHeight:R.style.minHeight,maxHeight:R.style.maxHeight,marginTop:R.style.marginTop,marginBottom:R.style.marginBottom})},[l,R]),ee(()=>{K||b||(P.current=!1,v.current=!1,C.current=0,de.current=0,wt(R,oe.current))},[K,b,R,l]),ee(()=>{const F=l.current;if(!(!K||!ae||!R||!F||c.state.transitionStatus==="ending")){if(!b){P.current=!0,J.request(x),F.style.removeProperty("--transform-origin");return}queueMicrotask(()=>{const xe=Ba(F);F.style.removeProperty("--transform-origin");try{const re=getComputedStyle(R),we=getComputedStyle(F),me=Ht(ae),ue=sr(R),q=ae.getBoundingClientRect(),ne=R.getBoundingClientRect(),ve=q.left,se=q.height,ie=H||F,Ce=ie.scrollHeight,he=parseFloat(we.borderBottomWidth),g=parseFloat(re.marginTop)||10,V=parseFloat(re.marginBottom)||10,N=parseFloat(re.minHeight)||100,G=fr(we),i=5,w=5,O=20,Y=me.documentElement.clientHeight-g-V,le=me.documentElement.clientWidth,ce=Y-q.bottom+se,pe=m.current,Re=f.current;let Se,Oe=0,Je=0;if(pe&&Re){const z=Re.getBoundingClientRect();Se=pe.getBoundingClientRect();const je=z.left-ve,Ae=Se.left-ne.left,_e=z.top-q.top+z.height/2,Te=Se.top-ne.top+Se.height/2;Oe=je-Ae,Je=Te-_e}const nt=ce+Je+V+he;let Fe=Math.min(Y,nt);const Tt=Y-g-V,Qe=nt-Fe,Ze=Math.max(i,ve+Oe),ct=le-w,at=Math.max(0,Ze+ne.width-ct);R.style.left=`${Ze-at}px`,R.style.height=`${Fe}px`,R.style.maxHeight="auto",R.style.marginTop=`${g}px`,R.style.marginBottom=`${V}px`,F.style.height="100%";const dt=ie.scrollHeight-ie.clientHeight,ut=Qe>=dt;ut&&(Fe=Math.min(Y,ne.height)-(Qe-dt));const Pt=q.top<O||q.bottom>Y-O||Fe<Math.min(Ce,N),Ot=(ue.visualViewport?.scale??1)!==1&&Mn;if(Pt||Ot){P.current=!0,wt(R,oe.current),yr.flushSync(()=>j(!1));return}if(ut){const z=Math.max(0,Y-nt);R.style.top=ne.height>=Tt?"0":`${z}px`,R.style.height=`${Fe}px`,ie.scrollTop=ie.scrollHeight-ie.clientHeight,C.current=Math.max(N,Fe)}else R.style.bottom="0",C.current=Math.max(N,Fe),ie.scrollTop=Qe;if(Se){const z=ne.top,je=ne.height,Ae=Se.top+Se.height/2,_e=je>0?(Ae-z)/je*100:50,Te=Va(_e,0,100);F.style.setProperty("--transform-origin",`50% ${Te}%`)}(C.current===Y||Fe>=G)&&(v.current=!0),x(),setTimeout(()=>{P.current=!0})}finally{xe()}})}},[c,K,R,ae,f,m,l,x,b,j,J,A,L,H]),n.useEffect(()=>{if(!b||!R||!K)return;const F=sr(R);function xe(re){y(!1,Ee(Tn,re))}return F.addEventListener("resize",xe),()=>{F.removeEventListener("resize",xe)}},[y,b,R,K]);const be={...H?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":T||void 0,id:`${Z}-list`},onKeyDown(F){h.current=!0,Q&&Pn.has(F.key)&&F.stopPropagation()},onMouseMove(){h.current=!1},onPointerLeave(F){if(!M||Br(F)||F.pointerType==="touch")return;const xe=F.currentTarget;X.start(0,()=>{c.set("activeIndex",null),xe.focus({preventScroll:!0})})},onScroll(F){H||k.current?.(F.currentTarget)},...b&&{style:H?{height:"100%"}:_a}},ke=De("div",t,{ref:[a,l],state:U,stateAttributesMapping:Ha,props:[W,be,Kn(D),{className:!H&&b?ur.className:void 0},o]});return r.jsxs(n.Fragment,{children:[!ye&&ur.getElement(te),r.jsx(En,{context:_,modal:!1,disabled:!ge,restoreFocus:!0,children:ke})]})});function fr(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}const gr={transform:"none",scale:"1",translate:"0 0"};function Ua(e,t,a){a?e.setProperty(t,a):e.removeProperty(t)}function Ba(e){const{style:t}=e,a={},s=Object.keys(gr);for(const u of s)a[u]=t.getPropertyValue(u),t.setProperty(u,gr[u]);return()=>{for(const u of s)Ua(t,u,a[u])}}let Kr=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function za(e={}){const{label:t,metadata:a,textRef:s,indexGuessBehavior:u,index:o}=e,{register:c,unregister:l,subscribeMapChange:p,elementsRef:y,labelsRef:f,nextIndexRef:m}=Ma(),h=n.useRef(-1),[T,x]=n.useState(o??(u===Kr.GuessFromOrder?()=>{if(h.current===-1){const d=m.current;m.current+=1,h.current=d}return h.current}:-1)),k=n.useRef(null),M=n.useCallback(d=>{if(k.current=d,T!==-1&&d!==null&&(y.current[T]=d,f)){const E=t!==void 0;f.current[T]=E?t:s?.current?.textContent??d.textContent}},[T,y,f,t,s]);return ee(()=>{if(o!=null)return;const d=k.current;if(d)return c(d,a),()=>{l(d)}},[o,c,l,a]),ee(()=>{if(o==null)return p(d=>{const E=k.current?d.get(k.current)?.index:null;E!=null&&x(E)})},[o,p,x]),n.useMemo(()=>({ref:M,index:T}),[T,M])}const Wr=n.createContext(void 0);function tr(){const e=n.useContext(Wr);if(!e)throw new Error(Xe(57));return e}const kt=n.memo(n.forwardRef(function(t,a){const{render:s,className:u,value:o=null,label:c,disabled:l=!1,nativeButton:p=!1,...y}=t,f=n.useRef(null),m=za({label:c,textRef:f,indexGuessBehavior:Kr.GuessFromOrder}),{store:h,getItemProps:T,setOpen:x,setValue:k,selectionRef:M,typingRef:d,valuesRef:E,keyboardActiveRef:b,multiple:j,highlightItemOnHover:A}=We(),L=Ge(),Q=B(h,$.isActive,m.index),_=B(h,$.isSelected,m.index,o),te=B(h,$.isSelectedByFocus,m.index),ye=B(h,$.isItemEqualToValue),X=m.index,Z=X!==-1,K=n.useRef(null),ge=$e(X);ee(()=>{if(!Z)return;const I=E.current;return I[X]=o,()=>{delete I[X]}},[Z,X,o,E]),ee(()=>{if(!Z)return;const I=h.state.value;let U=I;j&&Array.isArray(I)&&I.length>0&&(U=I[I.length-1]),U!==void 0&&rt(U,o,ye)&&h.set("selectedIndex",X)},[Z,X,j,ye,h,o]);const W=n.useMemo(()=>({disabled:l,selected:_,highlighted:Q}),[l,_,Q]),D=T({active:Q,selected:_});D.onFocus=void 0,D.id=void 0;const ae=n.useRef(null),R=n.useRef("mouse"),H=n.useRef(!1),{getButtonProps:C,buttonRef:v}=Jt({disabled:l,focusableWhenDisabled:!0,native:p});function de(I){const U=h.state.value;if(j){const be=Array.isArray(U)?U:[],ke=_?ya(be,o,ye):[...be,o];k(ke,Ee(_t,I))}else k(o,Ee(_t,I)),x(!1,Ee(_t,I))}const P={role:"option","aria-selected":_,tabIndex:Q?0:-1,onFocus(){h.set("activeIndex",X)},onMouseEnter(){!b.current&&h.state.selectedIndex===null&&h.set("activeIndex",X)},onMouseMove(){A&&h.set("activeIndex",X)},onMouseLeave(I){!A||b.current||Br(I)||L.start(0,()=>{h.state.activeIndex===X&&h.set("activeIndex",null)})},onTouchStart(){M.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(I){ae.current=I.key,h.set("activeIndex",X)},onClick(I){H.current=!1,!(I.type==="keydown"&&ae.current===null)&&(l||ae.current===" "&&d.current||R.current!=="touch"&&!Q||(ae.current=null,de(I.nativeEvent)))},onPointerEnter(I){R.current=I.pointerType},onPointerDown(I){R.current=I.pointerType,H.current=!0},onMouseUp(I){if(l)return;if(H.current){H.current=!1;return}const U=!M.current.allowSelectedMouseUp&&_,be=!M.current.allowUnselectedMouseUp&&!_;U||be||R.current!=="touch"&&!Q||de(I.nativeEvent)}},oe=De("div",t,{ref:[v,a,m.ref,K],state:W,props:[D,P,y,C]}),J=n.useMemo(()=>({selected:_,indexRef:ge,textRef:f,selectedByFocus:te,hasRegistered:Z}),[_,ge,f,te,Z]);return r.jsx(Wr.Provider,{value:J,children:oe})})),vt=n.forwardRef(function(t,a){const s=t.keepMounted??!1,{selected:u}=tr();return s||u?r.jsx(Ka,{...t,ref:a}):null}),Ka=n.memo(n.forwardRef((e,t)=>{const{render:a,className:s,keepMounted:u,...o}=e,{selected:c}=tr(),l=n.useRef(null),{transitionStatus:p,setMounted:y}=qt(c),f=n.useMemo(()=>({selected:c,transitionStatus:p}),[c,p]),m=De("span",e,{ref:[t,l],state:f,props:[{"aria-hidden":!0,children:"✔️"},o],stateAttributesMapping:Xt});return Rt({open:c,ref:l,onComplete(){c||y(!1)}}),m})),jt=n.memo(n.forwardRef(function(t,a){const{indexRef:s,textRef:u,selectedByFocus:o,hasRegistered:c}=tr(),{selectedItemTextRef:l}=We(),{className:p,render:y,...f}=t,m=n.useCallback(T=>{if(!T||!c)return;const x=l.current===null||!l.current.isConnected;(o||x&&s.current===0)&&(l.current=T)},[l,s,o,c]);return De("div",t,{ref:[m,a,u],props:f})})),Wa=n.forwardRef(function(t,a){const{render:s,className:u,id:o,...c}=t,{store:l}=On(),p=bt(o);return l.useSyncedValueWithCleanup("descriptionElementId",p),De("p",t,{ref:a,props:[{id:p},c]})});function qa({open:e,title:t,description:a,confirmLabel:s,cancelLabel:u,destructive:o=!1,busy:c=!1,onConfirm:l,onCancel:p}){return r.jsx(An,{open:e,onOpenChange:y=>{!y&&!c&&p?.()},children:r.jsxs(_n,{children:[r.jsx(Ln,{className:"fixed inset-0 z-[100] bg-black/40 backdrop-blur-[2px] transition-opacity duration-200 ease-out data-[ending-style]:opacity-0 data-[starting-style]:opacity-0"}),r.jsx(Vn,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:r.jsxs(Dn,{className:"relative w-full max-w-md rounded-2xl bg-white p-6 shadow-[0_20px_60px_-20px_rgba(0,0,0,0.25)] ring-1 ring-oai-gray-200 transition-[opacity,transform] duration-[220ms] ease-[cubic-bezier(0.16,1,0.3,1)] data-[ending-style]:translate-y-2 data-[ending-style]:scale-[0.96] data-[ending-style]:opacity-0 data-[starting-style]:translate-y-2 data-[starting-style]:scale-[0.96] data-[starting-style]:opacity-0 dark:bg-oai-gray-950 dark:shadow-[0_20px_60px_-10px_rgba(0,0,0,0.65)] dark:ring-oai-gray-800",children:[r.jsx(Fn,{className:"text-base font-semibold text-oai-black dark:text-white",children:t}),a?r.jsx(Wa,{className:"mt-2 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:a}):null,r.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[r.jsx(Ve,{type:"button",variant:"secondary",size:"sm",disabled:c,onClick:()=>p?.(),children:u}),r.jsx(Ve,{type:"button",size:"sm",disabled:c,onClick:()=>l?.(),className:Ue(o&&"!bg-red-600 hover:!bg-red-700 focus-visible:!outline-red-600 dark:!bg-red-600 dark:hover:!bg-red-500"),children:s})]})]})})]})})}function qr({id:e,value:t,onChange:a,placeholder:s,disabled:u=!1,type:o="text",label:c,error:l,className:p="",...y}){const f=n.useId(),m=e||f,h=l?`${m}-error`:void 0,M=`w-full bg-oai-white dark:bg-oai-gray-900 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md text-oai-black dark:text-oai-white placeholder-oai-gray-400 dark:placeholder-oai-gray-500 transition-all duration-200 focus:outline-none focus:border-oai-brand dark:focus:border-oai-brand focus:ring-1 focus:ring-oai-brand/30 ${u?"bg-oai-gray-50 dark:bg-oai-gray-800 text-oai-gray-400 dark:text-oai-gray-400 cursor-not-allowed":""} ${l?"border-oai-error focus:border-oai-error focus:ring-oai-error/30":""} h-10 px-3 text-sm ${p}`;return r.jsxs("div",{className:"w-full",children:[c&&r.jsx("label",{htmlFor:m,className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5 transition-colors duration-200",children:c}),r.jsx("input",{id:m,type:o,value:t,onChange:a,placeholder:s,disabled:u,"aria-invalid":l?!0:void 0,"aria-describedby":h,className:M,...y}),l&&r.jsx("p",{id:h,className:"mt-1.5 text-sm text-oai-error",children:l})]})}const Ga="tt:hint:dismissed:";function Gr(e){return Ga+e}function Ya(e){if(typeof window>"u")return!1;try{return window.localStorage.getItem(Gr(e))==="1"}catch{return!1}}function Xa({id:e,children:t,className:a,ariaLabel:s}){const[u,o]=n.useState(()=>Ya(e)),c=n.useCallback(()=>{if(typeof window<"u")try{window.localStorage.setItem(Gr(e),"1")}catch{}o(!0)},[e]);return u?null:r.jsxs("div",{role:"note","aria-label":s||S("hint.dismissible_aria"),className:Ue("relative rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-4 py-3 text-sm text-oai-gray-700","dark:border-oai-gray-800 dark:bg-oai-gray-900/40 dark:text-oai-gray-300",a),children:[r.jsx("button",{type:"button",onClick:c,"aria-label":S("hint.dismiss"),className:"absolute top-2 right-2 inline-flex h-7 w-7 items-center justify-center rounded-md text-oai-gray-500 transition-colors hover:bg-oai-gray-200/70 hover:text-oai-gray-700 focus:outline-none focus:ring-2 focus:ring-oai-blue/30 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800/70 dark:hover:text-oai-gray-200",children:r.jsx(Nt,{className:"h-4 w-4","aria-hidden":"true"})}),r.jsxs("div",{className:"flex items-start gap-2 pr-8",children:[r.jsx($n,{className:"mt-0.5 h-4 w-4 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":"true"}),r.jsx("div",{className:"min-w-0 flex-1",children:t})]})]})}let mr=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.indeterminate="data-indeterminate",e.disabled="data-disabled",e.readonly="data-readonly",e.required="data-required",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});function Yr(e){return n.useMemo(()=>({checked(t){return e.indeterminate?{}:t?{[mr.checked]:""}:{[mr.unchecked]:""}},...Qt}),[e.indeterminate])}const Ja=n.createContext({disabled:!1});function Qa(){return n.useContext(Ja)}const Za=n.createContext(void 0);function es(e=!0){const t=n.useContext(Za);if(t===void 0&&!e)throw new Error(Xe(3));return t}const Xr=n.createContext(void 0);function ts(){const e=n.useContext(Xr);if(e===void 0)throw new Error(Xe(14));return e}const rs="data-parent",ns=n.forwardRef(function(t,a){const{checked:s,className:u,defaultChecked:o=!1,disabled:c=!1,id:l,indeterminate:p=!1,inputRef:y,name:f,onCheckedChange:m,parent:h=!1,readOnly:T=!1,render:x,required:k=!1,uncheckedValue:M,value:d,nativeButton:E=!1,...b}=t,{clearErrors:j}=er(),{disabled:A,name:L,setDirty:Q,setFilled:_,setFocused:te,setTouched:ye,state:X,validationMode:Z,validityData:K,shouldValidateOnChange:ge,validation:W}=Mt(),D=Qa(),{labelId:ae,controlId:R,setControlId:H,getDescriptionProps:C}=Zt(),v=es(),de=v?.parent,P=de&&v.allValues,oe=A||D.disabled||v?.disabled||c,J=L??f,I=d??J,U=bt(),be=bt();let ke=R;P?ke=h?be:`${de.id}-${I}`:l&&(ke=l);let F={};P&&(h?F=v.parent.getParentProps():I&&(F=v.parent.getChildProps(I)));const xe=Ne(m),{checked:re=s,indeterminate:we=p,onCheckedChange:me,...ue}=F,q=v?.value,ne=v?.setValue,ve=v?.defaultValue,se=n.useRef(null),{getButtonProps:ie,buttonRef:Ce}=Jt({disabled:oe,native:E}),he=v?.validation??W,[g,V]=Bt({controlled:I&&q&&!h?q.includes(I):re,default:I&&ve&&!h?ve.includes(I):o,name:"Checkbox",state:"checked"});ee(()=>{if(H!==Le)return H(ke),()=>{H(void 0)}},[ke,v,H,h]),Or({enabled:!v,id:U,commit:he.commit,value:g,controlRef:se,name:J,getValue:()=>g});const N=n.useRef(null),G=Yt(y,N,he.inputRef);ee(()=>{N.current&&(N.current.indeterminate=we,g&&_(!0))},[g,we,_]),Ar(g,()=>{v&&!h||(j(J),_(g),Q(g!==K.initialValue),ge()?he.commit(g):he.commit(g,!0))});const i=Gt({checked:g,disabled:oe,name:h?void 0:J,id:E?void 0:ke??void 0,required:k,ref:G,style:J?kr:vr,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(pe){if(pe.nativeEvent.defaultPrevented)return;const Re=pe.target.checked,Se=Ee(Ct,pe.nativeEvent);if(me?.(Re,Se),xe(Re,Se),!Se.isCanceled&&(V(Re),I&&q&&ne&&!h)){const Oe=Re?[...q,I]:q.filter(Je=>Je!==I);ne(Oe,Se)}},onFocus(){se.current?.focus()}},d!==void 0?{value:(v?g&&d:d)||""}:yt,C,v?he.getValidationProps:he.getInputValidationProps),w=P?!!re:g,O=P&&we||p;n.useEffect(()=>{de&&I&&de.disabledStatesRef.current.set(I,oe)},[de,oe,I]);const Y=n.useMemo(()=>({...X,checked:w,disabled:oe,readOnly:T,required:k,indeterminate:O}),[X,w,oe,T,k,O]),le=Yr(Y),ce=De("span",t,{state:Y,ref:[Ce,se,a,v?.registerControlRef],props:[{id:E?ke??void 0:U,role:"checkbox","aria-checked":we?"mixed":g,"aria-readonly":T||void 0,"aria-required":k||void 0,"aria-labelledby":ae,[rs]:h?"":void 0,onFocus(){te(!0)},onBlur(){const pe=N.current;pe&&(ye(!0),te(!1),Z==="onBlur"&&he.commit(v?q:pe.checked))},onClick(pe){T||oe||(pe.preventDefault(),N.current?.click())}},C,he.getValidationProps,b,ue,ie],stateAttributesMapping:le});return r.jsxs(Xr.Provider,{value:Y,children:[ce,!g&&!v&&J&&!h&&M!==void 0&&r.jsx("input",{type:"hidden",name:J,value:M}),r.jsx("input",{...i})]})}),as=n.forwardRef(function(t,a){const{render:s,className:u,keepMounted:o=!1,...c}=t,l=ts(),p=l.checked||l.indeterminate,{transitionStatus:y,setMounted:f}=qt(p),m=n.useRef(null),h=n.useMemo(()=>({...l,transitionStatus:y}),[l,y]);Rt({open:p,ref:m,onComplete(){p||f(!1)}});const T=Yr(l),x=n.useMemo(()=>({...T,...Xt,...Qt}),[T]),k=o||p,M=De("span",t,{enabled:k,ref:[a,m],state:h,stateAttributesMapping:x,props:c});return k?M:null});function ss(e,t){return`target:${e}:${t}`}function os(e){return`remove:${e.id||e.directory}`}function is({skill:e,targets:t,busyKey:a,onClose:s,onToggleTarget:u,onRemove:o}){return r.jsx(Qr,{children:e?r.jsx(ls,{skill:e,targets:t,busyKey:a,onClose:s,onToggleTarget:u,onRemove:o},e.id||e.directory):null})}function ls({skill:e,targets:t,busyKey:a,onClose:s,onToggleTarget:u,onRemove:o}){const c=Qn(),l=n.useRef(null);n.useEffect(()=>{const x=M=>{M.key==="Escape"&&(M.stopPropagation(),s?.())},k=M=>{const d=M.target;d instanceof Element&&(l.current?.contains(d)||d.closest('[data-skill-row="1"]')||s?.())};return document.addEventListener("keydown",x),document.addEventListener("mousedown",k),()=>{document.removeEventListener("keydown",x),document.removeEventListener("mousedown",k)}},[s]);const p=e.name||e.directory,y=!!(e.repoOwner&&e.repoName),f=y?`https://github.com/${e.repoOwner}/${e.repoName}`:null,m=new Set(e.targets||[]),h=a===os(e),T=c?{duration:0}:{type:"spring",stiffness:320,damping:30,mass:.7};return r.jsxs(r.Fragment,{children:[r.jsx(rr.div,{className:"fixed inset-0 z-20 bg-oai-black/30 backdrop-blur-[2px] lg:hidden",initial:c?!1:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:c?0:.15},onClick:s,"aria-hidden":!0}),r.jsxs(rr.aside,{ref:l,role:"complementary","aria-label":p,initial:c?!1:{opacity:0,x:24,scale:.98},animate:{opacity:1,x:0,scale:1},exit:c?{opacity:0}:{opacity:0,x:24,scale:.98},transition:T,className:"fixed inset-x-3 bottom-3 top-20 z-30 flex flex-col overflow-hidden rounded-2xl border border-white/40 bg-white/75 shadow-[0_24px_60px_-20px_rgba(15,23,42,0.25)] backdrop-blur-xl backdrop-saturate-150 supports-[backdrop-filter]:bg-white/65 dark:border-white/10 dark:bg-oai-gray-950/70 dark:shadow-[0_24px_60px_-20px_rgba(0,0,0,0.7)] dark:supports-[backdrop-filter]:bg-oai-gray-950/55 lg:inset-auto lg:right-6 lg:top-24 lg:bottom-6 lg:w-[22rem] lg:max-h-[calc(100vh-7.5rem)]",children:[r.jsxs("header",{className:"flex items-start gap-3 border-b border-white/40 bg-gradient-to-b from-white/30 to-transparent px-5 pb-4 pt-5 dark:border-white/10 dark:from-white/[0.04]",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",title:p,children:p}),y?r.jsxs("a",{href:f,target:"_blank",rel:"noreferrer noopener",className:"mt-1 inline-flex max-w-full items-center gap-1 truncate text-xs text-oai-gray-500 transition-colors hover:text-oai-black hover:underline dark:text-oai-gray-400 dark:hover:text-white",title:f,children:[r.jsxs("span",{className:"truncate",children:[e.repoOwner,"/",e.repoName]}),r.jsx(Ut,{className:"h-3 w-3 shrink-0","aria-hidden":!0})]}):r.jsx("div",{className:"mt-1 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",title:e.directory,children:e.directory})]}),r.jsx("button",{type:"button",onClick:s,"aria-label":S("skills.detail.close"),className:"-mr-1 inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-oai-gray-500 transition hover:bg-oai-gray-100 hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:r.jsx(Nt,{className:"h-4 w-4","aria-hidden":!0})})]}),r.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 py-5",children:[e.description?r.jsx("p",{className:"text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:e.description}):null,r.jsxs("section",{className:e.description?"mt-6":"",children:[r.jsx("h3",{className:"mb-2 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-500 dark:text-oai-gray-400",children:S("skills.detail.sync_section_title")}),r.jsx("div",{className:"overflow-hidden rounded-xl bg-white/40 ring-1 ring-white/50 dark:bg-white/[0.02] dark:ring-white/10",children:(t||[]).map((x,k)=>{const M=m.has(x.id),d=a===ss(e.id,x.id),E=k===(t||[]).length-1,b=`skill-detail-sync-${e.id||e.directory}-${x.id}`;return r.jsxs("label",{htmlFor:b,className:"flex cursor-pointer items-center gap-3 px-3 py-2.5 text-sm text-oai-black transition-colors hover:bg-white/40 dark:text-white dark:hover:bg-white/[0.04]"+(E?"":" border-b border-white/40 dark:border-white/[0.06]"),children:[r.jsx(ns,{id:b,checked:M,disabled:d,onCheckedChange:j=>u?.(e,x.id,!!j),className:"peer flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] border border-oai-gray-300/80 bg-white/80 shadow-sm transition-colors hover:border-oai-gray-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-400/40 focus-visible:ring-offset-1 focus-visible:ring-offset-transparent disabled:cursor-not-allowed disabled:opacity-50 data-[checked]:border-oai-black data-[checked]:bg-oai-black dark:border-oai-gray-500/60 dark:bg-oai-gray-900/60 dark:hover:border-oai-gray-400 dark:data-[checked]:border-white dark:data-[checked]:bg-white",children:r.jsx(as,{className:"flex items-center justify-center text-white dark:text-oai-black",children:r.jsx(Ye,{className:"h-3 w-3",strokeWidth:3.5,"aria-hidden":!0})})}),r.jsx(tt,{provider:x.id,size:16}),r.jsx("span",{className:"flex-1",children:x.label}),d?r.jsx(Ke,{className:"h-3.5 w-3.5 animate-spin text-oai-gray-400","aria-hidden":!0}):null]},x.id)})})]})]}),r.jsxs("footer",{className:"border-t border-white/40 bg-white/30 px-5 py-4 dark:border-white/10 dark:bg-white/[0.02]",children:[r.jsxs("button",{type:"button",onClick:()=>o?.(e),disabled:h,className:"inline-flex w-full items-center justify-center gap-2 rounded-lg border border-red-200/70 bg-white px-3 py-2 text-sm font-medium text-red-600 transition hover:border-red-300 hover:bg-red-50 focus:outline-none focus:ring-2 focus:ring-red-400/30 disabled:cursor-not-allowed disabled:opacity-60 dark:border-red-900/60 dark:bg-oai-gray-950 dark:text-red-300 dark:hover:border-red-800 dark:hover:bg-red-950/30",children:[h?r.jsx(Ke,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):r.jsx(Rr,{className:"h-3.5 w-3.5","aria-hidden":!0}),S("skills.detail.remove_button")]}),r.jsx("p",{className:"mt-2 text-center text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:S("skills.detail.remove_confirm_hint")})]})]})]})}const Jr="tokentracker-skills";async function Et(e){const t=new URL(`/functions/${Jr}`,window.location.origin);if(e)for(const[u,o]of Object.entries(e))o!=null&&o!==""&&t.searchParams.set(u,String(o));const a=await fetch(t.toString(),{headers:{Accept:"application/json"},cache:"no-store"}),s=await a.json().catch(()=>null);if(!a.ok)throw new Error(s?.error||`Request failed with HTTP ${a.status}`);return s}async function qe(e){const t=await Zr(),a=await fetch(`/functions/${Jr}`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",...t},cache:"no-store",body:JSON.stringify(e)}),s=await a.json().catch(()=>null);if(!a.ok||s?.ok===!1)throw new Error(s?.error||`Request failed with HTTP ${a.status}`);return s}function cs(){return Et({mode:"installed"})}function ds(e={}){return Et({mode:"discover",...e.force?{force:1}:{}})}function us(e,t=0,a=20){return Et({mode:"search",q:e,offset:t,limit:a})}function fs(){return Et({mode:"repos"})}function gs(e,t){return qe({action:"install",skill:e,targets:t})}function ms(e){return qe({action:"uninstall",id:e})}function hs(e){return qe({action:"restore",id:e})}function ps(e,t){return qe({action:"set_targets",id:e,targets:t})}function xs(e,t){return qe({action:"import_local",directory:e,targets:t})}function ys(e,t){return qe({action:"delete_local",directory:e,targets:t||[]})}function bs(e){return qe({action:"add_repo",repo:e})}function ws(e,t){return qe({action:"remove_repo",owner:e,name:t})}const ks=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),hr=["claude","codex"],vs={claude:"text-orange-500 dark:text-orange-300",codex:"text-emerald-600 dark:text-emerald-300",grok:"text-zinc-700 dark:text-zinc-200",antigravity:"text-violet-600 dark:text-violet-300",gemini:"text-sky-600 dark:text-sky-300",opencode:"text-amber-600 dark:text-amber-300",hermes:"text-indigo-500 dark:text-indigo-300"},He="all",Pe="skillssh";function xt(e){return`${e.repoOwner||"local"}/${e.repoName||"local"}:${e.directory}`}function pr(e){return`install:${xt(e)}`}function xr(e){return`remove:${e.id||e.directory}`}function js(e,t){return`target:${e}:${t}`}function Ss({target:e}){return r.jsxs("span",{className:"inline-flex h-6 items-center gap-1.5 rounded-full bg-oai-gray-100 px-2 text-[11px] font-medium text-oai-gray-700 ring-1 ring-oai-gray-200/70 dark:bg-oai-gray-800/70 dark:text-oai-gray-200 dark:ring-oai-gray-700/70",children:[r.jsx("span",{className:Ue("flex h-3.5 w-3.5 items-center justify-center",vs[e.id]),"aria-hidden":!0,children:r.jsx(tt,{provider:e.id,size:14})}),e.label]})}function Ns({skill:e,targets:t}){const a=new Set(e.targets||[]),s=t.filter(o=>a.has(o.id));if(!s.length)return r.jsx("span",{className:"text-xs italic text-oai-gray-500 dark:text-oai-gray-400",children:S("skills.target.synced_none")});const u=s.map(o=>o.label).join(", ");return r.jsx("div",{className:"flex flex-wrap gap-1","aria-label":S("skills.target.synced_summary",{targets:u}),children:s.map(o=>r.jsx(Ss,{target:o},o.id))})}function Rs({skill:e,targets:t,selected:a,onSelect:s}){const u=e.repoOwner&&e.repoName?`${e.repoOwner}/${e.repoName}`:null,o=u?`${e.directory} · ${u}`:e.directory,c=l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),s?.(e))};return r.jsxs("div",{"data-skill-row":"1",role:"button",tabIndex:0,"aria-pressed":a,"aria-label":S("skills.row.open_details",{name:e.name||e.directory}),onClick:()=>s?.(e),onKeyDown:c,className:Ue("flex cursor-pointer flex-col gap-3 rounded-md px-3 py-3 transition focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 lg:flex-row lg:items-center lg:gap-4",a?"bg-oai-gray-100 ring-1 ring-oai-gray-200 dark:bg-oai-gray-800/60 dark:ring-oai-gray-800":"hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/40"),children:[r.jsxs("div",{className:"min-w-0 flex-1",title:o,children:[r.jsx("h2",{className:"truncate text-sm font-semibold text-oai-black dark:text-white",children:e.name||e.directory}),e.description?r.jsx("p",{className:"mt-0.5 line-clamp-2 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:e.description}):null]}),r.jsx("div",{className:"flex items-center gap-2 lg:gap-3",children:r.jsx(Ns,{skill:e,targets:t})}),r.jsx(Jn,{className:Ue("hidden h-4 w-4 shrink-0 text-oai-gray-300 transition-colors dark:text-oai-gray-600 lg:block",a&&"text-oai-gray-500 dark:text-oai-gray-300"),"aria-hidden":!0})]})}function Cs({agentFilter:e,agentOptions:t,onAgentFilter:a,filteredCount:s,totalCount:u,anyFilter:o,onClearFilters:c}){return r.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 px-1 pt-1 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[r.jsxs(_r,{value:e,onValueChange:a,children:[r.jsxs(Lr,{"aria-label":S("skills.filter.agent_label"),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs font-medium text-oai-gray-700 transition hover:border-oai-gray-300 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-200 dark:hover:border-oai-gray-700",children:[r.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:[S("skills.filter.agent_label"),":"]}),r.jsx(Vr,{children:l=>l==="all"?S("skills.filter.agent_all"):t.find(p=>p.id===l)?.label||l}),r.jsx(Dr,{className:"text-oai-gray-400",children:r.jsx(Sr,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),r.jsx(Fr,{children:r.jsx(Ur,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:r.jsxs(zr,{className:"min-w-[var(--anchor-width)] overflow-hidden rounded-md border border-oai-gray-200 bg-white p-1 shadow-[0_12px_32px_-12px_rgba(0,0,0,0.18)] outline-none dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:shadow-[0_12px_32px_-12px_rgba(0,0,0,0.6)]",children:[r.jsxs(kt,{value:"all",className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[r.jsx(jt,{children:S("skills.filter.agent_all")}),r.jsx(vt,{children:r.jsx(Ye,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),t.map(l=>r.jsxs(kt,{value:l.id,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(tt,{provider:l.id,size:14}),r.jsx(jt,{children:l.label})]}),r.jsx(vt,{children:r.jsx(Ye,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},l.id))]})})})]}),r.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:S("skills.filter.result_count",{filtered:s,total:u})}),o?r.jsxs("button",{type:"button",onClick:c,className:"ml-auto inline-flex h-7 items-center gap-1 rounded-full bg-oai-gray-100 px-2.5 text-[11px] font-medium text-oai-gray-700 transition hover:bg-oai-gray-200 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:bg-oai-gray-800/70 dark:text-oai-gray-200 dark:hover:bg-oai-gray-700",children:[r.jsx(Nt,{className:"h-3 w-3","aria-hidden":!0}),S("skills.filter.clear")]}):null]})}function Is({items:e,totalCount:t,targets:a,agentOptions:s,agentFilter:u,onAgentFilter:o,anyFilter:c,onClearFilters:l,selectedId:p,onSelect:y}){return r.jsxs("div",{children:[r.jsx(Cs,{agentFilter:u,agentOptions:s,onAgentFilter:o,filteredCount:e.length,totalCount:t,anyFilter:c,onClearFilters:l}),e.length===0?r.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:[r.jsx("p",{children:S("skills.empty.no_match")}),r.jsx(Ve,{type:"button",variant:"secondary",size:"sm",onClick:l,children:S("skills.filter.clear")})]}):r.jsx("div",{className:"divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:e.map(f=>r.jsx(Rs,{skill:f,targets:a,selected:p===(f.id||f.directory),onSelect:y},f.id||f.key))})]})}const Ms={contentVisibility:"auto",containIntrinsicSize:"0 240px"},Es=rn.memo(function({skill:t,installed:a,installing:s,allTargets:u,defaultTargets:o,onInstall:c}){const[l,p]=n.useState(()=>(o||[]).filter(x=>u.some(k=>k.id===x))),y=x=>{p(k=>k.includes(x)?k.filter(M=>M!==x):[...k,x])},f=t.repoOwner&&t.repoName?`${t.repoOwner}/${t.repoName}`:null,m=f?`https://github.com/${t.repoOwner}/${t.repoName}`:null,h=t.installs!=null?S("skills.card.installs",{count:Number(t.installs||0).toLocaleString()}):null,T=l.length?l.map(x=>u.find(k=>k.id===x)?.label||x).join(", "):S("skills.action.choose_targets");return r.jsxs(an,{className:"h-full rounded-lg",bodyClassName:"flex h-full flex-col",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[t.readmeUrl?r.jsxs("a",{href:t.readmeUrl,target:"_blank",rel:"noopener noreferrer",className:"group inline-flex max-w-full items-center gap-1 truncate text-base font-semibold text-oai-black hover:underline dark:text-white",title:t.readmeUrl,children:[r.jsx("span",{className:"truncate",children:t.name||t.directory}),r.jsx(Ut,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400 opacity-0 transition-opacity group-hover:opacity-100","aria-hidden":!0})]}):r.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",children:t.name||t.directory}),f||h?r.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-1.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[m?r.jsxs("a",{href:m,target:"_blank",rel:"noopener noreferrer",onClick:x=>x.stopPropagation(),className:"inline-flex items-center gap-1 truncate rounded text-oai-gray-500 hover:text-oai-black hover:underline focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-400 dark:hover:text-white",title:m,children:[r.jsx("span",{className:"truncate",children:f}),r.jsx(Ut,{className:"h-2.5 w-2.5 shrink-0","aria-hidden":!0})]}):null,f&&h?r.jsx("span",{"aria-hidden":!0,children:"·"}):null,h?r.jsx("span",{className:"truncate",children:h}):null]}):null]}),a?r.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-md bg-oai-black/[0.06] px-2 py-1 text-xs font-medium text-oai-gray-700 ring-1 ring-oai-black/10 dark:bg-white/[0.08] dark:text-oai-gray-200 dark:ring-white/10",children:[r.jsx(Ye,{className:"h-3 w-3","aria-hidden":!0}),S("skills.card.installed")]}):null]}),t.description?r.jsx("p",{className:"mt-3 line-clamp-3 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:t.description}):null,r.jsx("div",{className:"mt-auto pt-5",children:a?r.jsxs("div",{className:"inline-flex h-9 w-full items-center justify-center gap-1.5 rounded-md bg-oai-black/[0.04] text-sm font-medium text-oai-gray-700 ring-1 ring-inset ring-oai-black/[0.08] dark:bg-white/[0.05] dark:text-oai-gray-200 dark:ring-white/[0.08]",children:[r.jsx(Ye,{className:"h-3.5 w-3.5","aria-hidden":!0}),S("skills.card.installed")]}):r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[r.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:S("skills.card.targets_prefix")}),r.jsx("span",{className:"min-w-0 truncate font-medium text-oai-black dark:text-white",children:l.length?T:S("skills.target.none")}),r.jsxs(Wn,{children:[r.jsx(qn,{disabled:s,"aria-label":S("skills.action.choose_targets"),className:"rounded text-xs font-medium text-oai-gray-500 underline decoration-oai-gray-300 decoration-dotted underline-offset-2 transition hover:text-oai-black hover:decoration-oai-gray-500 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 disabled:cursor-not-allowed disabled:opacity-60 dark:text-oai-gray-400 dark:decoration-oai-gray-600 dark:hover:text-white dark:hover:decoration-oai-gray-400",children:S("skills.card.targets_change")}),r.jsx(Gn,{children:r.jsx(Yn,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:r.jsxs(Xn,{className:"min-w-[220px] rounded-lg bg-white p-1.5 shadow-lg ring-1 ring-oai-gray-200 dark:bg-oai-gray-950 dark:ring-oai-gray-800",children:[r.jsx("div",{className:"px-2 pb-1 pt-0.5 text-[11px] font-medium uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400",children:S("skills.target.menu_label")}),u.map(x=>{const k=l.includes(x.id);return r.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm text-oai-black hover:bg-oai-gray-100 dark:text-white dark:hover:bg-oai-gray-800",children:[r.jsx("input",{type:"checkbox",className:"h-4 w-4 shrink-0 rounded border-oai-gray-300 text-oai-black focus:ring-oai-gray-400 dark:border-oai-gray-600 dark:bg-oai-gray-900 dark:text-white",checked:k,onChange:()=>y(x.id)}),r.jsx(tt,{provider:x.id,size:16}),r.jsx("span",{className:"flex-1 text-left",children:x.label})]},x.id)})]})})})]})]}),r.jsxs(Ve,{type:"button",size:"sm",onClick:()=>c(t,l),disabled:s||l.length===0,className:"w-full",children:[s?r.jsx(Ke,{className:"mr-1.5 h-3.5 w-3.5 animate-spin","aria-hidden":!0}):r.jsx(Zn,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),S("skills.action.install")]})]})})]})});function Ts({repos:e,repoInput:t,onRepoInput:a,busyKey:s,onAdd:u,onRemove:o}){return r.jsxs("div",{className:"rounded-lg border border-oai-gray-200 bg-white p-4 dark:border-oai-gray-800 dark:bg-oai-gray-950",children:[r.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[r.jsx(qr,{value:t,onChange:c=>a(c.target.value),placeholder:S("skills.repo.placeholder"),className:"min-w-0 flex-1"}),r.jsxs(Ve,{type:"button",variant:"secondary",size:"md",onClick:u,disabled:s==="repo:add",className:"shrink-0 whitespace-nowrap",children:[s==="repo:add"?r.jsx(Ke,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):r.jsx(Nr,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),S("skills.repo.add")]})]}),e.length?r.jsx("div",{className:"mt-3 divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:e.map(c=>{const l=s===`repo:${c.owner}/${c.name}`;return r.jsxs("div",{className:"flex items-center justify-between gap-3 py-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"truncate text-sm font-medium text-oai-black dark:text-white",children:[c.owner,"/",c.name]}),r.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:c.branch})]}),r.jsxs(Ve,{type:"button",variant:"ghost",size:"sm",disabled:l,onClick:()=>o(c),className:"shrink-0",children:[l?r.jsx(Ke,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):r.jsx(Rr,{className:"h-3.5 w-3.5","aria-hidden":!0}),r.jsx("span",{className:"sr-only",children:S("skills.repo.remove")})]})]},`${c.owner}/${c.name}`)})}):null]})}function Ps(){return typeof window>"u"?"my":new URLSearchParams(window.location.search).get("tab")==="browse"?"browse":"my"}function Ws(){const[e,t]=n.useState(Ps),[a,s]=n.useState({skills:[],targets:[]}),[u,o]=n.useState([]),[c,l]=n.useState([]),[p,y]=n.useState([]),[f,m]=n.useState(He),[h,T]=n.useState(""),[x,k]=n.useState(""),[M,d]=n.useState(""),[E,b]=n.useState(!1),[j,A]=n.useState("all"),[L,Q]=n.useState(null),[_,te]=n.useState(""),[ye,X]=n.useState(!0),[Z,K]=n.useState(!1),[ge,W]=n.useState(""),[D,ae]=n.useState(null),[R,H]=n.useState(null),C=n.useMemo(()=>{const i=new Set;for(const w of a.skills||[]){i.add(xt(w).toLowerCase()),w.repoOwner&&w.repoName&&i.add(`${w.repoOwner}/${w.repoName}:${w.sourceDirectory||w.directory}`.toLowerCase());const O=String(w.directory||"").split(/[\\/]/).pop().toLowerCase();O&&i.add(`dir:${O}`)}return i},[a.skills]),v=n.useCallback(async()=>{const i=await cs();s({skills:i.skills||[],targets:i.targets||[]})},[]),de=n.useCallback(async()=>{const i=await fs();y(i.repos||[])},[]),P=n.useCallback(async({force:i=!1}={})=>{K(!0);try{const w=await ds({force:i});o(w.skills||[])}finally{K(!1)}},[]),oe=n.useCallback(async()=>{X(!0),W("");try{await Promise.all([v(),de()])}catch(i){W(i?.message||S("skills.error.generic"))}finally{X(!1)}},[v,de]),J=n.useCallback(async()=>{await oe(),e==="browse"&&f!==Pe&&P({force:!0}).catch(i=>W(i?.message||S("skills.error.generic")))},[P,oe,f,e]);if(n.useEffect(()=>{oe()},[oe]),n.useEffect(()=>{e==="browse"&&f!==Pe&&u.length===0&&P().catch(i=>W(i?.message||S("skills.error.generic")))},[u.length,P,f,e]),n.useEffect(()=>{if(!R)return;const i=setTimeout(()=>H(w=>w?.key===R.key?null:w),R.ttlMs||5e3);return()=>clearTimeout(i)},[R]),n.useEffect(()=>{const i=setTimeout(()=>k(h),200);return()=>clearTimeout(i)},[h]),n.useEffect(()=>{if(typeof window>"u")return;const i=new URLSearchParams(window.location.search),w=i.get("tab");if(e==="my"){if(!w)return;i.delete("tab")}else{if(w===e)return;i.set("tab",e)}const O=i.toString(),Y=`${window.location.pathname}${O?`?${O}`:""}${window.location.hash}`;window.history.replaceState({},"",Y)},[e]),!ks&&!en())return r.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:r.jsx(nn,{})});const I=async(i,w)=>{te(i),W("");try{await w(),await v()}catch(O){W(O?.message||S("skills.error.generic"))}finally{te("")}},U=(i,w)=>{const O=(w&&w.length?w:hr).filter(Y=>(a.targets||[]).some(le=>le.id===Y));I(pr(i),async()=>{await gs(i,O);const Y=O.map(le=>(a.targets||[]).find(ce=>ce.id===le)?.label||le).join(", ");H({key:`${Date.now()}:install:${xt(i)}`,message:S("skills.toast.installed",{name:i.name||i.directory,targets:Y||S("skills.target.none")}),ttlMs:4e3})})},be=i=>{ae(i)},ke=()=>{const i=D;i&&(ae(null),I(xr(i),async()=>{let w=null;i.managed?w=await ms(i.id):await ys(i.directory,i.targets||[]);const O=!!(w?.trashed&&i.managed&&i.id);H({key:`${Date.now()}:${i.id||i.directory}`,message:S("skills.toast.removed",{name:i.name||i.directory}),undo:O?async()=>{try{await hs(i.id),await v(),H(null)}catch(Y){W(Y?.message||S("skills.error.generic"))}}:null,ttlMs:5e3})}))},F=(i,w,O)=>I(js(i.id,w),async()=>{const Y=new Set(i.targets||[]);O?Y.add(w):Y.delete(w),i.managed?await ps(i.id,Array.from(Y)):await xs(i.directory,Array.from(Y))}),xe=async()=>{const i=h.trim();if(!(i.length<2)){te("search"),W("");try{const w=await us(i);l(w.skills||[])}catch(w){W(w?.message||S("skills.error.generic"))}finally{te("")}}},re=async()=>{const i=M.trim().replace(/^https:\/\/github\.com\//,"").replace(/\.git$/,""),[w,O]=i.split("/");if(!w||!O){W(S("skills.repo.invalid"));return}await I("repo:add",async()=>{await bs({owner:w,name:O,branch:"main",enabled:!0}),d(""),await de(),await P()})},we=async i=>{await I(`repo:${i.owner}/${i.name}`,async()=>{await ws(i.owner,i.name),await de(),await P()})},me=a.targets||[],ue=a.skills||[],q=n.useMemo(()=>j==="all"?ue:ue.filter(i=>(i.targets||[]).includes(j)),[ue,j]),ne=j!=="all",ve=n.useMemo(()=>L&&ue.find(i=>(i.id||i.directory)===L)||null,[ue,L]),se=n.useCallback(()=>{A("all")},[]),ie=n.useCallback(i=>{Q(w=>{const O=i?.id||i?.directory||null;return w===O?null:O})},[]),Ce=n.useCallback(()=>Q(null),[]);n.useEffect(()=>{e!=="my"&&L&&Q(null)},[e,L]),n.useEffect(()=>{L&&!ve&&Q(null)},[ve,L]);const he=n.useMemo(()=>{const i=f===Pe?c:u,w=f===Pe||f===He?i:i.filter(le=>`${le.repoOwner}/${le.repoName}`===f),O=x.trim().toLowerCase();return(f===Pe||!O?w:w.filter(le=>(le.name||"").toLowerCase().includes(O)||(le.directory||"").toLowerCase().includes(O)||(le.description||"").toLowerCase().includes(O))).map(le=>{const ce=xt(le).toLowerCase(),pe=String(le.directory||"").split(/[\\/]/).pop().toLowerCase(),Re=pe?`dir:${pe}`:"";return{...le,installed:C.has(ce)||Re&&C.has(Re)}})},[x,u,C,c,f]),g=r.jsx("div",{className:"flex h-64 items-center justify-center",children:r.jsx(Ke,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0})}),V=r.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-3 px-6 text-center",children:[r.jsx(Ke,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0}),r.jsx("p",{className:"max-w-md text-xs text-oai-gray-500 dark:text-oai-gray-400",children:S("skills.browse.loading_hint")})]}),N=(i,w=null)=>r.jsxs("div",{className:"flex flex-col items-center gap-4 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:[r.jsx("p",{children:S(i)}),w]});let G;if(ye)G=g;else if(e==="my")G=ue.length?r.jsx(Is,{items:q,totalCount:ue.length,targets:me,agentOptions:me,agentFilter:j,onAgentFilter:A,anyFilter:ne,onClearFilters:se,selectedId:L,onSelect:ie}):r.jsxs("div",{className:"flex flex-col items-center gap-4 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center dark:border-oai-gray-800",children:[me.length>0?r.jsxs("div",{className:"relative h-11 w-80 overflow-hidden","aria-hidden":!0,children:[r.jsx("div",{className:"pointer-events-none absolute inset-0",style:{maskImage:"linear-gradient(to right, transparent 8%, black 20%, black 32%, transparent 44%, transparent 56%, black 68%, black 80%, transparent 92%)",WebkitMaskImage:"linear-gradient(to right, transparent 8%, black 20%, black 32%, transparent 44%, transparent 56%, black 68%, black 80%, transparent 92%)"},children:r.jsx("div",{className:"absolute inset-y-0 left-0 flex w-max items-center animate-marquee-x",style:{filter:"blur(2.5px)"},children:[...me,...me].map((i,w)=>r.jsx("span",{className:"shrink-0 px-3",children:r.jsx(tt,{provider:i.id,size:30})},`b-${w}`))})}),r.jsx("div",{className:"pointer-events-none absolute inset-0",style:{maskImage:"linear-gradient(to right, transparent 28%, black 42%, black 58%, transparent 72%)",WebkitMaskImage:"linear-gradient(to right, transparent 28%, black 42%, black 58%, transparent 72%)"},children:r.jsx("div",{className:"absolute inset-y-0 left-0 flex w-max items-center animate-marquee-x",children:[...me,...me].map((i,w)=>r.jsx("span",{className:"shrink-0 px-3",children:r.jsx(tt,{provider:i.id,size:30})},`c-${w}`))})}),r.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 w-20 bg-gradient-to-r from-oai-white to-transparent dark:from-oai-gray-900"}),r.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 w-20 bg-gradient-to-l from-oai-white to-transparent dark:from-oai-gray-900"})]}):null,r.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:S("skills.empty.my")}),r.jsx(Ve,{type:"button",size:"sm",onClick:()=>t("browse"),children:S("skills.empty.my_cta")})]});else{const i=f===Pe,w=p.length===0&&!i,O=!i&&(x.trim()!==""||f!==He),Y=()=>{T(""),m(He)},le=!w&&!Z&&(he.length>0||O)?r.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 px-1 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[r.jsx("span",{children:S("skills.filter.result_count_browse",{count:he.length})}),O?r.jsxs("button",{type:"button",onClick:Y,className:"ml-auto inline-flex h-7 items-center gap-1 rounded-full bg-oai-gray-100 px-2.5 text-[11px] font-medium text-oai-gray-700 transition hover:bg-oai-gray-200 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:bg-oai-gray-800/70 dark:text-oai-gray-200 dark:hover:bg-oai-gray-700",children:[r.jsx(Nt,{className:"h-3 w-3","aria-hidden":!0}),S("skills.filter.clear")]}):null]}):null;let ce;w?ce=r.jsx("div",{className:"rounded-lg border border-dashed border-oai-gray-200 p-6 text-center dark:border-oai-gray-800",children:r.jsx("p",{className:"text-sm text-oai-gray-600 dark:text-oai-gray-300",children:S("skills.browse.empty_sources")})}):Z&&!i?ce=V:i&&h.trim().length<2?ce=r.jsx("div",{className:"rounded-lg border border-dashed border-oai-gray-200 px-4 py-6 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:S("skills.browse.hint_skillssh")}):he.length?ce=r.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:he.map(Se=>r.jsx("div",{style:Ms,children:r.jsx(Es,{skill:Se,installed:!!Se.installed,installing:_===pr(Se),allTargets:me,defaultTargets:hr,onInstall:U})},Se.id||Se.key))}):O?ce=N("skills.empty.no_match",r.jsx(Ve,{type:"button",variant:"secondary",size:"sm",onClick:Y,children:S("skills.filter.clear")})):i?ce=N("skills.empty.search"):ce=N("skills.empty.browse");const pe=w||E?r.jsx("div",{className:"mb-5",children:r.jsx(Ts,{repos:p,repoInput:M,onRepoInput:d,busyKey:_,onAdd:re,onRemove:we})}):null,Re=!E&&!i&&p.length<=1&&he.length>0?r.jsx(Xa,{id:"skills-browse-intro",className:"mt-6",children:r.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[r.jsx("span",{children:S("skills.browse.add_repo_hint")}),r.jsx("button",{type:"button",onClick:()=>b(!0),className:"rounded font-medium text-oai-gray-700 underline decoration-dotted underline-offset-2 transition hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-200 dark:hover:text-white",children:S("skills.browse.manage_sources")})]})}):null;G=r.jsxs(r.Fragment,{children:[pe,le,ce,Re]})}return r.jsxs("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:[r.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:r.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[r.jsxs("div",{className:"mb-6 flex items-end justify-between gap-4",children:[r.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:S("skills.page.title")}),r.jsxs(Ve,{type:"button",variant:"secondary",size:"sm",onClick:J,disabled:ye||Z,children:[r.jsx(tn,{className:Ue("mr-1.5 h-3.5 w-3.5",(ye||Z)&&"animate-spin"),"aria-hidden":!0}),S("skills.action.refresh")]})]}),r.jsx("div",{className:"mb-5 flex gap-6 border-b border-oai-gray-200 dark:border-oai-gray-800",children:[["my",S("skills.tab.my")],["browse",S("skills.tab.browse")]].map(([i,w])=>r.jsx("button",{type:"button","aria-pressed":e===i,onClick:()=>t(i),className:Ue("-mb-px border-b-2 pb-2 text-sm font-medium transition-colors",e===i?"border-oai-black text-oai-black dark:border-white dark:text-white":"border-transparent text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:w},i))}),ge?r.jsx("div",{className:"mb-4 rounded-lg border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-200",children:ge}):null,e==="browse"?r.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-center",children:[r.jsx("div",{role:"tablist","aria-label":S("skills.source.label"),className:"inline-flex h-10 shrink-0 items-center rounded-md border border-oai-gray-200 bg-oai-white p-1 dark:border-oai-gray-800 dark:bg-oai-gray-900",children:[["repo",S("skills.mode.repo")],["skillssh",S("skills.mode.skillssh")]].map(([i,w])=>{const O=i==="skillssh"==(f===Pe);return r.jsx("button",{type:"button",role:"tab","aria-selected":O,onClick:()=>{i==="skillssh"?m(Pe):f===Pe&&m(He)},className:Ue("rounded px-3 py-1 text-sm font-medium transition-colors",O?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-700 dark:text-white":"text-oai-gray-500 hover:text-oai-gray-800 dark:text-oai-gray-400 dark:hover:text-oai-gray-200"),children:w},i)})}),f!==Pe?r.jsxs(_r,{value:f,onValueChange:m,children:[r.jsxs(Lr,{"aria-label":S("skills.source.label"),className:"inline-flex h-10 w-44 shrink-0 items-center justify-between gap-2 rounded-md border border-oai-gray-200 bg-oai-white px-3 text-sm text-oai-black focus:outline-none data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:data-[popup-open]:border-oai-gray-700",children:[r.jsx(Vr,{children:i=>i===He?S("skills.source.all"):i}),r.jsx(Dr,{className:"text-oai-gray-400",children:r.jsx(Sr,{className:"h-4 w-4","aria-hidden":!0})})]}),r.jsx(Fr,{children:r.jsx(Ur,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:r.jsxs(zr,{className:"min-w-[var(--anchor-width)] overflow-hidden rounded-md border border-oai-gray-200 bg-white p-1 shadow-[0_12px_32px_-12px_rgba(0,0,0,0.18)] outline-none transition-[opacity,transform] duration-150 ease-out data-[ending-style]:scale-[0.97] data-[ending-style]:opacity-0 data-[starting-style]:scale-[0.97] data-[starting-style]:opacity-0 dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:shadow-[0_12px_32px_-12px_rgba(0,0,0,0.6)]",children:[r.jsxs(kt,{value:He,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[r.jsx(jt,{children:S("skills.source.all")}),r.jsx(vt,{children:r.jsx(Ye,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),p.map(i=>{const w=`${i.owner}/${i.name}`;return r.jsxs(kt,{value:w,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[r.jsx(jt,{children:w}),r.jsx(vt,{children:r.jsx(Ye,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},w)})]})})})]}):null,r.jsxs("div",{className:"relative flex-1",children:[r.jsx(ir,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-oai-gray-400","aria-hidden":!0}),r.jsx(qr,{type:"search",value:h,onChange:i=>T(i.target.value),onKeyDown:i=>{i.key==="Enter"&&f===Pe&&xe()},"aria-label":S("skills.action.search_aria"),placeholder:f===Pe?S("skills.browse.placeholder_skillssh"):f===He?S("skills.browse.placeholder_all"):S("skills.browse.placeholder_repo",{repo:f}),className:"pl-9 !border-oai-gray-200 dark:!border-oai-gray-800 focus:!border-oai-gray-400 focus:!ring-oai-gray-400/20 dark:focus:!border-oai-gray-500 dark:focus:!ring-oai-gray-500/20"})]}),f===Pe?r.jsxs(Ve,{type:"button",onClick:xe,disabled:h.trim().length<2||_==="search",className:"focus:!ring-oai-gray-400/30",children:[_==="search"?r.jsx(Ke,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):r.jsx(ir,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),S("skills.action.search")]}):r.jsxs(Ve,{type:"button",variant:"secondary",size:"sm",onClick:()=>b(i=>!i),"aria-expanded":E,className:"!h-10 shrink-0 whitespace-nowrap !border-oai-gray-200 dark:!border-oai-gray-800 hover:!border-oai-gray-300 dark:hover:!border-oai-gray-700 hover:!text-oai-black dark:hover:!text-white focus:!ring-oai-gray-400/30",children:[r.jsx(Nr,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),S("skills.browse.manage_sources"),r.jsx("span",{className:"ml-1.5 rounded bg-oai-gray-100 px-1.5 py-0.5 text-xs font-medium text-oai-gray-600 dark:bg-oai-gray-800 dark:text-oai-gray-300",children:p.length})]})]}):null,G,r.jsx(is,{skill:ve,targets:me,busyKey:_,onClose:Ce,onToggleTarget:F,onRemove:be})]})}),r.jsx(qa,{open:!!D,title:S("skills.confirm.remove_title",{name:D?.name||D?.directory||""}),description:D?D.managed?S("skills.confirm.remove_managed"):S("skills.confirm.remove_local"):"",confirmLabel:S("skills.action.remove"),cancelLabel:S("shared.action.cancel"),destructive:!0,busy:_===xr(D||{}),onCancel:()=>ae(null),onConfirm:ke}),r.jsx("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"pointer-events-none fixed inset-x-0 bottom-6 z-[90] flex justify-center px-4",children:R?r.jsxs("div",{className:"pointer-events-auto flex max-w-md items-center gap-3 rounded-full bg-oai-black px-4 py-2 text-sm text-white shadow-lg dark:bg-white dark:text-oai-black",children:[r.jsx("span",{children:R.message}),R.undo?r.jsx("button",{type:"button",onClick:R.undo,className:"rounded-full px-2 py-0.5 text-xs font-semibold uppercase tracking-wide hover:bg-white/10 dark:hover:bg-oai-black/10",children:S("shared.action.undo")}):null]}):null})]})}export{Ws as SkillsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as e,s as o,aI as _,aw as P,r as u,aJ as I,R as B,H as p}from"./main-DhcQGvkP.js";import{u as D,T as E}from"./use-native-settings-CefuRE0t.js";import{F as v,S as K,a as $}from"./FadeIn-B2rj5E5l.js";import{A as G}from"./arrow-up-right-BXWeIpuU.js";import{D as z}from"./download-DvfHniid.js";import{C as R}from"./chevron-down-u-JNpncG.js";import"./Card-wgEcKm5u.js";import"./use-reduced-motion-nzFM1j1r.js";const H=["todayTokens","todayCost"],F=[{id:"todayTokens",label:"Today Tokens",shortLabel:"Tokens",category:"tokens"},{id:"todayCost",label:"Today Cost",shortLabel:"Cost",category:"cost"},{id:"last7dTokens",label:"Last 7 Days",shortLabel:"7d",category:"tokens"},{id:"totalTokens",label:"Total Tokens",shortLabel:"Total",category:"tokens"},{id:"totalCost",label:"Total Cost",shortLabel:"All $",category:"cost"},{id:"claude5h",label:"Claude 5h Limit",shortLabel:"Cl 5h",category:"limits"},{id:"claude7d",label:"Claude 7d Limit",shortLabel:"Cl 7d",category:"limits"},{id:"codex5h",label:"Codex 5h Limit",shortLabel:"Cx 5h",category:"limits"},{id:"codex7d",label:"Codex 7d Limit",shortLabel:"Cx 7d",category:"limits"},{id:"cursorPlan",label:"Cursor Plan Limit",shortLabel:"Cu Plan",category:"limits"},{id:"cursorAuto",label:"Cursor Auto Limit",shortLabel:"Cu Auto",category:"limits"},{id:"cursorAPI",label:"Cursor API Limit",shortLabel:"Cu API",category:"limits"},{id:"geminiPro",label:"Gemini Pro Limit",shortLabel:"Gm Pro",category:"limits"},{id:"geminiFlash",label:"Gemini Flash Limit",shortLabel:"Gm Flash",category:"limits"},{id:"geminiLite",label:"Gemini Lite Limit",shortLabel:"Gm Lite",category:"limits"},{id:"kimiWeekly",label:"Kimi Weekly Limit",shortLabel:"Km Wk",category:"limits"},{id:"kimi5h",label:"Kimi 5h Limit",shortLabel:"Km 5h",category:"limits"},{id:"kimiTotal",label:"Kimi Total Limit",shortLabel:"Km Tot",category:"limits"},{id:"kiroMonth",label:"Kiro Monthly Limit",shortLabel:"Kr Mo",category:"limits"},{id:"kiroBonus",label:"Kiro Bonus Limit",shortLabel:"Kr Bn",category:"limits"},{id:"copilotPremium",label:"Copilot Premium Limit",shortLabel:"Co Prem",category:"limits"},{id:"copilotChat",label:"Copilot Chat Limit",shortLabel:"Co Chat",category:"limits"},{id:"antigravityClaude",label:"Antigravity Claude Limit",shortLabel:"Ag Cl",category:"limits"},{id:"antigravityGPro",label:"Antigravity Gemini Pro Limit",shortLabel:"Ag GPro",category:"limits"},{id:"antigravityFlash",label:"Antigravity Flash Limit",shortLabel:"Ag Fl",category:"limits"}];function N(t,i=F,s=2){const a=new Set(i.map(n=>n.id)),l=new Set,r=Array.isArray(t)?t.filter(n=>!a.has(n)||l.has(n)?!1:(l.add(n),!0)):[];return(r.length>0?r:H).slice(0,Math.max(1,Number(s)||2))}const O=264,U=124,g="ui-rounded, -apple-system, system-ui",L=["#5A8CF2","#9973E6","#4DB8A6","#E68C59"],X={claude:"#C77DFF",codex:"#34C759",cursor:"#FFCC00",gemini:"#0A84FF"};function Y(t){return t>=.9?"#E64D4D":t>=.7?"#D9A633":"#33B866"}function b({size:t="sm",children:i}){const s=t==="lg",a=s?560:264,l=s?32:22;return e.jsx("div",{className:p("flex w-full items-center justify-center rounded-xl bg-oai-gray-100 dark:bg-oai-gray-950/60",s?"py-10 sm:py-14 px-6":"py-6 px-4"),children:e.jsx("div",{className:"overflow-hidden bg-white dark:bg-oai-gray-800 shadow-oai-md dark:shadow-[0_2px_4px_rgba(0,0,0,0.4),0_8px_24px_rgba(0,0,0,0.5)]",style:{width:"100%",maxWidth:a,aspectRatio:`${O} / ${U}`,borderRadius:l},children:i})})}function V({size:t="sm"}){const i="M0,104 L14,104 C26,98 34,100 44,96 S58,88 68,92 80,100 90,94 102,80 112,82 126,92 136,88 150,74 162,76 178,88 188,86 204,72 216,74 236,84 250,80 L264,80",s=`${i} L264,124 L0,124 Z`,a=`sparkArea-${t}`;return e.jsx(b,{size:t,children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:a,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#0A84FF",stopOpacity:"0.18"}),e.jsx("stop",{offset:"100%",stopColor:"#0A84FF",stopOpacity:"0"})]})}),e.jsx("text",{x:"14",y:"20",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"700",letterSpacing:"0.6",children:"TODAY"}),e.jsx("text",{x:"14",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:g,children:"203.2M"}),e.jsx("text",{x:"14",y:"60",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:g,children:"$129.56 ±0%"}),e.jsx("text",{x:"134",y:"20",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"700",letterSpacing:"0.6",children:"7 DAYS"}),e.jsx("text",{x:"134",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:g,children:"880.9M"}),e.jsx("text",{x:"134",y:"60",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:g,children:"$673.61"}),e.jsx("path",{d:s,fill:`url(#${a})`,stroke:"none"}),e.jsx("path",{d:i,fill:"none",stroke:"#0A84FF",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})})}const C=(()=>{const s=[];for(let a=0;a<26;a++)for(let l=0;l<7;l++){const r=Math.sin((a+1)*12.9898+(l+1)*78.233+17)*43758.5453,c=Math.floor(Math.abs(r-Math.floor(r))*100);s.push({w:a,d:l,v:c})}return s})();function S(t,i){return t<18?i?"#262626":"#e5e5e5":t<38?"rgba(10, 132, 255, 0.28)":t<58?"rgba(10, 132, 255, 0.50)":t<80?"rgba(10, 132, 255, 0.75)":"#0A84FF"}function J(){return e.jsx(b,{children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"hidden dark:inline",children:C.map(r=>e.jsx("rect",{x:r.w*(7.5+1.2),y:r.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:S(r.v,!0)},`d-${r.w}-${r.d}`))}),e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"dark:hidden",children:C.map(r=>e.jsx("rect",{x:r.w*(7.5+1.2),y:r.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:S(r.v,!1)},`l-${r.w}-${r.d}`))}),e.jsx("text",{x:19.5,y:"102",className:"fill-oai-black dark:fill-white",fontSize:"10",fontWeight:"700",fontFamily:g,children:"10.3B"}),e.jsx("text",{x:19.5+30,y:"102",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"500",children:"tokens · 202 active days"})]})})}function Z(){const t=[{name:"claude-opus-4-6",value:"586.4M",pct:59},{name:"claude-sonnet-4-5-20250929",value:"218.7M",pct:22},{name:"gpt-5.4",value:"80.6M",pct:8},{name:"composer-2-fast",value:"52.1M",pct:5}],i=22,s=28,a=14,l=236;return e.jsx(b,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:t.map((r,c)=>{const n=s+c*i,h=L[c%L.length];return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:n-3,r:"2.5",fill:h}),e.jsx("text",{x:"26",y:n,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:r.name}),e.jsx("text",{x:"218",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"600",fontFamily:g,children:r.value}),e.jsxs("text",{x:"250",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"600",fontFamily:g,children:[r.pct,"%"]}),e.jsx("rect",{x:a,y:n+4,width:l,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:a,y:n+4,width:Math.max(l*(r.pct/100),4),height:"2.8",rx:"1.4",fill:h})]},r.name)})})})}function q(){const t=[{label:"Claude · 7d",source:"claude",reset:"in 1d",pct:61},{label:"Claude · 5h",source:"claude",reset:"in 4h 28m",pct:4},{label:"Cursor",source:"cursor",reset:"in 25d",pct:51},{label:"Codex · weekly",source:"codex",reset:"in 1d",pct:32}],i=22,s=28,a=14,l=236;return e.jsx(b,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:t.map((r,c)=>{const n=s+c*i,h=X[r.source],y=Y(r.pct/100);return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:n-3,r:"2.5",fill:h}),e.jsx("text",{x:"26",y:n,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:r.label}),e.jsx("text",{x:"218",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:g,children:r.reset}),e.jsxs("text",{x:"250",y:n,textAnchor:"end",className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"700",fontFamily:g,children:[r.pct,"%"]}),e.jsx("rect",{x:a,y:n+4,width:l,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:a,y:n+4,width:Math.max(l*(r.pct/100),4),height:"2.8",rx:"1.4",fill:y})]},r.label)})})})}function Q(t){switch(t.category){case"cost":return"$8.42";case"limits":return"62%";default:return t.id==="last7dTokens"?"1.8B":"203M"}}function ee(t,i){switch(t){case"todayTokens":return o("menubar.metric.today_tokens");case"todayCost":return o("menubar.metric.today_cost");case"last7dTokens":return o("menubar.metric.last_7d_tokens");case"totalTokens":return o("menubar.metric.total_tokens");case"totalCost":return o("menubar.metric.total_cost");case"claude5h":return o("menubar.metric.claude_5h");case"claude7d":return o("menubar.metric.claude_7d");case"codex5h":return o("menubar.metric.codex_5h");case"codex7d":return o("menubar.metric.codex_7d");default:return i}}function te(t,i){const s=new Set(i.map(l=>l.id)),a=t.filter(l=>s.has(l));for(const l of i){if(a.length>=2)break;a.includes(l.id)||a.push(l.id)}return a.slice(0,2)}function ae({slotConfigs:t,showStats:i}){return e.jsx("div",{className:"flex justify-center rounded-xl bg-gradient-to-b from-oai-gray-100 to-oai-gray-200 px-6 py-8 dark:from-oai-gray-950/80 dark:to-oai-gray-900/80",children:e.jsxs("div",{className:"inline-flex items-stretch rounded-md shadow-[0_1px_3px_rgba(0,0,0,0.18)] ring-1 ring-black/10 dark:ring-white/10 px-3",style:{background:"linear-gradient(180deg, #2c2c2e 0%, #1c1c1e 100%)"},children:[e.jsx("div",{className:"flex items-center pl-2 pr-1 py-2.5",children:e.jsx("img",{src:"/clawd/mini/idle-tight.svg",alt:"","aria-hidden":"true",className:"block shrink-0",style:{height:22,width:"auto"},draggable:"false"})}),i?t.map(({slot:s,item:a},l)=>e.jsxs(B.Fragment,{children:[l>0?e.jsx("span",{className:"my-1 w-px bg-white/20","aria-hidden":"true"}):null,e.jsxs("div",{className:p("flex min-w-[52px] flex-col items-center justify-center py-1.5",l===0?"pl-1 pr-2":"px-2"),children:[e.jsx("span",{className:"text-[13px] font-semibold leading-none tabular-nums text-white",children:a?.previewValue||"--"}),e.jsx("span",{className:"mt-[2px] text-[6px] font-semibold uppercase leading-none text-white/75",children:a?.shortLabel||"Metric"})]})]},s)):null]})})}function ie({slot:t,value:i,options:s,disabled:a,onChange:l}){const r=t===0?o("menubar.slot.primary"):o("menubar.slot.secondary");return e.jsxs("label",{className:"flex min-w-0 flex-col gap-1.5",children:[e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.08em] text-oai-gray-500 dark:text-oai-gray-400",children:r}),e.jsxs("div",{className:"relative",children:[e.jsx("select",{value:i,disabled:a,"aria-label":r,onChange:c=>l(t,c.target.value),className:p("w-full appearance-none rounded-lg border border-oai-gray-200 bg-white px-3 py-2 pr-9 text-sm font-medium text-oai-black transition-colors hover:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:hover:border-oai-gray-700",a&&"cursor-not-allowed opacity-50 hover:border-oai-gray-200 dark:hover:border-oai-gray-800"),children:s.map(c=>e.jsx("option",{value:c.id,children:c.displayLabel},c.id))}),e.jsx(R,{className:"pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-oai-gray-400","aria-hidden":"true"})]})]})}function A({label:t,hint:i,checked:s,disabled:a,onChange:l}){return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:t}),i?e.jsx("p",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i}):null]}),e.jsx(E,{checked:s,disabled:a,onChange:l,ariaLabel:t})]})}function re(){const{available:t,settings:i,setSetting:s}=D(),a=u.useMemo(()=>(Array.isArray(i?.menuBarAvailableItems)?i.menuBarAvailableItems:F).map(m=>({...m,displayLabel:ee(m.id,m.label),previewValue:Q(m)})),[i?.menuBarAvailableItems]),l=Number(i?.menuBarMaxItems)||2,r=u.useMemo(()=>N(i?.menuBarItems,a,l),[a,l,i?.menuBarItems]),c=u.useMemo(()=>te(r,a),[a,r]),n=i?.showStats!==!1,h=d=>{s("menuBarItems",N(d,a,l))},y=(d,m)=>{const x=[...c];x[d===0?1:0]!==m&&(x[d]=m,h(x))},w=[0,1].map(d=>{const m=c[d]||a[d]?.id||"",j=c[d===0?1:0],W=a.filter(f=>f.id===m||f.id!==j),T=a.find(f=>f.id===m);return{slot:d,currentValue:m,options:W,item:T}}),k=i?.animatedIcon!==!1;return e.jsxs("article",{className:"rounded-xl border border-oai-gray-200 bg-white p-5 transition-colors duration-200 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:p-6",children:[e.jsx(ae,{slotConfigs:w,showStats:n}),e.jsx("div",{className:"mt-5 grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4",children:w.map(({slot:d,currentValue:m,options:x})=>e.jsx(ie,{slot:d,value:m,options:x,disabled:!t||!n,onChange:y},d))}),e.jsxs("div",{className:"mt-5 divide-y divide-oai-gray-100 border-t border-oai-gray-100 dark:divide-oai-gray-800 dark:border-oai-gray-800",children:[e.jsx(A,{label:o("settings.menubar.showStats"),hint:t?o("settings.menubar.showStatsHint"):o("menubar.native_only"),checked:n,disabled:!t,onChange:()=>s("showStats",!n)}),e.jsx(A,{label:o("settings.menubar.animatedIcon"),hint:o("settings.menubar.animatedIconHint"),checked:k,disabled:!t,onChange:()=>s("animatedIcon",!k)})]})]})}function se(){const[t,i]=u.useState("loading");return u.useEffect(()=>{if(typeof window>"u")return;if(I()){i("native");return}const s=(navigator.userAgent||"").toLowerCase(),a=/mac/.test(s)&&!/iphone|ipad/.test(s);i(a?"mac-web":"other")},[]),t}function le(){const t=se();return t==="loading"?e.jsx("div",{className:"h-10 w-40","aria-hidden":"true"}):t==="native"?e.jsxs("button",{type:"button",onClick:()=>_("openWidgetGallery"),className:"inline-flex h-10 items-center gap-2 rounded-lg bg-oai-black px-4 text-sm font-medium text-white transition-colors hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:[o("widgets.cta.open_gallery"),e.jsx(G,{className:"h-4 w-4","aria-hidden":"true"})]}):t==="mac-web"?e.jsxs("a",{href:"https://github.com/mm7894215/TokenTracker/releases/latest",target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-10 items-center gap-2 rounded-lg bg-oai-black px-4 text-sm font-medium text-white no-underline transition-colors hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:[e.jsx(z,{className:"h-4 w-4","aria-hidden":"true"}),o("widgets.cta.download")]}):e.jsxs("span",{className:"inline-flex h-10 items-center gap-2 rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-4 text-sm font-medium text-oai-gray-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-400",children:[e.jsx(P,{className:"h-4 w-4","aria-hidden":"true"}),o("widgets.cta.macos_only")]})}const oe=[{id:"summary",Preview:V,nameKey:"widgets.summary.name",descKey:"widgets.summary.description"},{id:"heatmap",Preview:J,nameKey:"widgets.heatmap.name",descKey:"widgets.heatmap.description"},{id:"topModels",Preview:Z,nameKey:"widgets.topModels.name",descKey:"widgets.topModels.description"},{id:"limits",Preview:q,nameKey:"widgets.limits.name",descKey:"widgets.limits.description"}];function ne({Preview:t,nameKey:i,descKey:s}){return e.jsxs("article",{className:"flex h-full flex-col rounded-xl border border-oai-gray-200 bg-white p-4 transition-colors duration-200 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:p-5",children:[e.jsx(t,{}),e.jsxs("div",{className:"mt-4",children:[e.jsx("h3",{className:"text-[15px] font-semibold text-oai-black dark:text-white",children:o(i)}),e.jsx("p",{className:"mt-1.5 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:o(s)})]})]})}function M({titleKey:t}){return e.jsx("h2",{className:"mb-4 text-xl font-semibold tracking-tight text-oai-black dark:text-white sm:mb-5 sm:text-2xl",children:o(t)})}function be(){return e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-5xl px-4 sm:px-6",children:[e.jsx(v,{y:12,children:e.jsxs("header",{className:"mb-10 flex items-start justify-between gap-4 sm:mb-12",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:o("widgets.page.title")}),e.jsx("div",{className:"shrink-0",children:e.jsx(le,{})})]})}),e.jsx(v,{y:12,delay:.06,children:e.jsxs("section",{"aria-label":o("widgets.menubar.section.title"),className:"mb-12 sm:mb-14",children:[e.jsx(M,{titleKey:"widgets.menubar.section.title"}),e.jsx(re,{})]})}),e.jsxs("section",{"aria-label":o("widgets.gallery.section.title"),children:[e.jsx(M,{titleKey:"widgets.gallery.section.title"}),e.jsx(K,{staggerDelay:.08,initialDelay:.04,children:e.jsx("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2 lg:gap-5",children:oe.map(({id:t,Preview:i,nameKey:s,descKey:a})=>e.jsx($,{children:e.jsx(ne,{Preview:i,nameKey:s,descKey:a})},t))})})]})]})})})}export{be as WidgetsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as l,u as e,y}from"./main-DhcQGvkP.js";function o(a){return Number.isFinite(a)?Math.abs(a)>=1e12?(a/1e12).toFixed(2).replace(/\.?0+$/,"")+"T":y(a,{decimals:2}):"0"}function r({children:a,accent:n=!1,className:i=""}){const c="rounded-2xl border border-oai-gray-200 dark:border-oai-gray-800 p-6 bg-white dark:bg-oai-gray-900",d=n?"bg-gradient-to-br from-emerald-50 to-cyan-50 dark:from-emerald-900/30 dark:to-cyan-900/30 border-transparent":"";return e.jsx("div",{className:`${c} ${d} ${i}`,children:a})}function k(){const[a,n]=l.useState(null),[i,c]=l.useState("loading"),[d,g]=l.useState("");if(l.useEffect(()=>{let t=!1;const h=new URLSearchParams(window.location.search).get("year"),p=h?`/functions/tokentracker-wrapped?year=${encodeURIComponent(h)}`:"/functions/tokentracker-wrapped";return fetch(p).then(async s=>{if(!s.ok)throw new Error(`HTTP ${s.status}`);return s.json()}).then(s=>{t||(n(s),c(s.totals&&s.totals.tokens>0?"ready":"empty"))}).catch(s=>{t||(g(String(s?.message||s)),c("error"))}),()=>{t=!0}},[]),i==="loading")return e.jsx("div",{className:"min-h-screen bg-white dark:bg-oai-gray-950 flex items-center justify-center",children:e.jsx("p",{className:"text-oai-gray-500",children:"Loading…"})});if(i==="error")return e.jsx("div",{className:"min-h-screen bg-white dark:bg-oai-gray-950 flex items-center justify-center px-6",children:e.jsx(r,{children:e.jsxs("p",{className:"text-red-600 dark:text-red-300",children:["Couldn't load Wrapped: ",d]})})});if(i==="empty"||!a)return e.jsx("div",{className:"min-h-screen bg-white dark:bg-oai-gray-950 flex items-center justify-center px-6",children:e.jsx(r,{children:e.jsxs("p",{className:"text-oai-gray-500",children:["No data for that year yet. Run ",e.jsx("code",{children:"tracker sync"})," first."]})})});const x=t=>`${(t*100).toFixed(0)}%`;return e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-white to-oai-gray-50 dark:from-oai-gray-950 dark:to-oai-gray-900 px-6 py-12",children:e.jsxs("div",{className:"max-w-3xl mx-auto space-y-6",children:[e.jsxs("header",{className:"text-center pb-6",children:[e.jsx("p",{className:"text-sm uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400",children:"TokenTracker Wrapped"}),e.jsx("h1",{className:"text-6xl font-bold text-oai-gray-900 dark:text-white mt-2",children:a.year})]}),e.jsxs(r,{accent:!0,className:"text-center",children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-oai-gray-600 dark:text-oai-gray-300",children:"Total tokens"}),e.jsx("p",{className:"text-7xl font-bold text-emerald-700 dark:text-emerald-300 mt-2",children:o(a.totals.tokens)}),e.jsxs("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mt-4",children:["across ",e.jsx("strong",{children:a.totals.conversations.toLocaleString("en-US")})," conversations,"," ",e.jsx("strong",{children:a.totals.active_days})," active days, and"," ",e.jsx("strong",{children:a.totals.sources})," tools"]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs(r,{children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400 mb-4",children:"Top tools"}),e.jsx("ul",{className:"space-y-3",children:a.top.sources.slice(0,5).map(t=>e.jsxs("li",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-oai-gray-900 dark:text-white",children:t.source}),e.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400 font-mono text-sm",children:[o(t.tokens)," · ",x(t.share)]})]},t.source))})]}),e.jsxs(r,{children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400 mb-4",children:"Top models"}),e.jsx("ul",{className:"space-y-3",children:a.top.models.slice(0,5).map(t=>e.jsxs("li",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-oai-gray-900 dark:text-white truncate pr-3",children:t.model}),e.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400 font-mono text-sm whitespace-nowrap",children:[o(t.tokens)," · ",x(t.share)]})]},t.model))})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.peak_hour&&e.jsxs(r,{children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400",children:"Peak hour"}),e.jsxs("p",{className:"text-4xl font-semibold text-oai-gray-900 dark:text-white mt-2",children:[String(a.peak_hour.hour).padStart(2,"0"),":00 UTC"]}),e.jsxs("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mt-1",children:[o(a.peak_hour.tokens)," tokens"]})]}),a.longest_streak&&a.longest_streak.days>0&&e.jsxs(r,{children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400",children:"Longest streak"}),e.jsxs("p",{className:"text-4xl font-semibold text-oai-gray-900 dark:text-white mt-2",children:[a.longest_streak.days," days"]}),e.jsxs("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mt-1",children:[a.longest_streak.from," → ",a.longest_streak.to]})]})]}),a.top.days.length>0&&e.jsxs(r,{children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400 mb-4",children:"Top days"}),e.jsx("ul",{className:"space-y-2",children:a.top.days.slice(0,5).map(t=>e.jsxs("li",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-oai-gray-900 dark:text-white font-mono text-sm",children:t.day}),e.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-400 font-mono text-sm",children:o(t.tokens)})]},t.day))})]}),a.highlights.length>0&&e.jsxs(r,{accent:!0,children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-600 dark:text-oai-gray-300 mb-3",children:"Highlights"}),e.jsx("ul",{className:"space-y-2 text-oai-gray-800 dark:text-oai-gray-200",children:a.highlights.map((t,m)=>e.jsxs("li",{className:"text-base",children:["· ",t]},m))})]}),e.jsxs("footer",{className:"text-center text-xs text-oai-gray-400 dark:text-oai-gray-500 pt-6",children:["Generated from local queue.jsonl · share with"," ",e.jsx("code",{className:"font-mono",children:"tracker wrapped --json"})]})]})})}export{k as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a2 as I,a3 as j,a4 as w,a5 as M,a6 as h,a7 as N,r as u,a8 as V,a9 as G,aa as H,ab as g,u as p,R as F,v,E as C}from"./main-DhcQGvkP.js";import{P}from"./ProviderIcon-No-nxvR1.js";function D(...e){const t=!Array.isArray(e[0]),n=t?0:-1,o=e[0+n],r=e[1+n],i=e[2+n],a=e[3+n],s=I(r,i,a);return t?s(o):s}function K(e,t,n={}){const o=e.get();let r=null,i=o,a;const s=typeof o=="string"?o.replace(/[\d.-]/g,""):void 0,c=()=>{r&&(r.stop(),r=null),e.animation=void 0},d=()=>{const l=b(e.get()),f=b(i);if(l===f){c();return}const y=r?r.getGeneratorVelocity():e.getVelocity();c(),r=new M({keyframes:[l,f],velocity:y,type:"spring",restDelta:.001,restSpeed:.01,...n,onUpdate:a})},m=()=>{d(),e.animation=r??void 0,e.events.animationStart?.notify(),r?.then(()=>{e.animation=void 0,e.events.animationComplete?.notify()})};if(e.attach((l,f)=>{i=l,a=y=>f(x(y,s)),j.postRender(m)},c),w(t)){let l=n.skipInitialAnimation===!0;const f=t.on("change",A=>{l?(l=!1,e.jump(x(A,s),!1)):e.set(x(A,s))}),y=e.on("destroy",f);return()=>{f(),y()}}return c}function x(e,t){return t?e+t:e}function b(e){return typeof e=="number"?e:parseFloat(e)}function k(e){const t=h(()=>N(e)),{isStatic:n}=u.useContext(V);if(n){const[,o]=u.useState(e);u.useEffect(()=>t.on("change",o),[])}return t}function E(e,t){const n=k(t()),o=()=>n.set(t());return o(),G(()=>{const r=()=>j.preRender(o,!1,!0),i=e.map(a=>a.on("change",r));return()=>{i.forEach(a=>a()),H(o)}}),n}function T(e){g.current=[],e();const t=E(g.current,e);return g.current=void 0,t}function L(e,t,n,o){if(typeof e=="function")return T(e);if(n!==void 0&&!Array.isArray(n)&&typeof t!="function")return z(e,t,n,o);const a=typeof t=="function"?t:D(t,n,o),s=Array.isArray(e)?S(e,a):S([e],([d])=>a(d)),c=Array.isArray(e)?void 0:e.accelerate;return c&&!c.isTransformed&&typeof t!="function"&&Array.isArray(n)&&o?.clamp!==!1&&(s.accelerate={...c,times:t,keyframes:n,isTransformed:!0}),s}function S(e,t){const n=h(()=>[]);return E(e,()=>{n.length=0;const o=e.length;for(let r=0;r<o;r++)n[r]=e[r].get();return t(n)})}function z(e,t,n,o){const r=h(()=>Object.keys(n)),i=h(()=>({}));for(const a of r)i[a]=L(e,t,n[a],o);return i}function J(e,t={}){const{isStatic:n}=u.useContext(V),o=()=>w(e)?e.get():e;if(n)return L(o);const r=k(o());return u.useInsertionEffect(()=>K(r,e,t),[r,JSON.stringify(t)]),r}function q(e,t={}){return J(e,{type:"spring",...t})}function U(e){const t=[...e];for(let n=t.length-1;n>0;n--){const o=Math.floor(Math.random()*(n+1));[t[n],t[o]]=[t[o],t[n]]}return t}function $(e,t){const n=U(e),o=Array.from({length:t},()=>[]);n.forEach((i,a)=>{o[a%t].push(i)});const r=Math.max(...o.map(i=>i.length));return o.forEach(i=>{for(;i.length<r;)i.push(n[Math.floor(Math.random()*n.length)])}),o}const B=F.memo(function({logos:t,index:n,currentTime:o,onHoverChange:r}){const[i,a]=u.useState(!1),s=4e3,c=n*400,d=(o+c)%(s*t.length),m=Math.floor(d/s),l=t[m],f=y=>{a(y),r(y)};return p.jsxs("div",{className:"relative flex flex-col items-center",onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),children:[p.jsx(v.div,{className:"relative h-8 w-8 sm:h-10 sm:w-10 md:h-12 md:w-12 overflow-hidden",initial:{opacity:0,y:50},animate:{opacity:1,y:0},transition:{delay:n*.1,duration:.5,ease:"easeOut"},children:p.jsx(C,{mode:"wait",children:p.jsx(v.div,{className:"absolute inset-0 flex items-center justify-center",initial:{y:"18%",opacity:0,filter:"blur(4px)"},animate:{y:"0%",opacity:1,filter:"blur(0px)",transition:{type:"tween",ease:[.22,1,.36,1],duration:.9}},exit:{y:"-18%",opacity:0,filter:"blur(4px)",transition:{type:"tween",ease:[.4,0,1,1],duration:.55}},children:p.jsx(P,{provider:l.provider,size:24,className:"object-contain"})},`${l.id}-${m}`)})}),p.jsx(C,{children:i&&p.jsx(v.span,{className:"pointer-events-none absolute -bottom-7 z-10 whitespace-nowrap rounded bg-oai-gray-800 px-2 py-0.5 text-xs font-medium text-oai-gray-100 shadow-lg ring-1 ring-oai-gray-700",initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},children:l.name})})]})});function Q({logos:e,columnCount:t=2}){const[n,o]=u.useState([]),[r,i]=u.useState(0),[a,s]=u.useState(!1);u.useEffect(()=>{o($(e,t))},[e,t]),u.useEffect(()=>{if(a)return;const d=setInterval(()=>i(m=>m+100),100);return()=>clearInterval(d)},[a]);const c=u.useCallback(d=>{s(d)},[]);return p.jsx("div",{className:"flex gap-2.5 sm:gap-4 text-oai-gray-200",children:n.map((d,m)=>p.jsx(B,{logos:d,index:m,currentTime:r,onHoverChange:c},m))})}const W=[{id:1,name:"Claude Code",provider:"claude"},{id:2,name:"Codex",provider:"codex"},{id:3,name:"Cursor",provider:"cursor"},{id:4,name:"Gemini",provider:"gemini"},{id:5,name:"OpenCode",provider:"opencode"},{id:6,name:"OpenClaw",provider:"openclaw"},{id:7,name:"Antigravity",provider:"antigravity"},{id:8,name:"Kiro",provider:"kiro"},{id:9,name:"Hermes",provider:"hermes"},{id:10,name:"GitHub Copilot",provider:"copilot"},{id:11,name:"Kimi",provider:"kimi"},{id:12,name:"oh-my-pi",provider:"omp"},{id:13,name:"Pi",provider:"pi"},{id:14,name:"CodeBuddy",provider:"codebuddy"},{id:15,name:"Grok",provider:"grok"},{id:16,name:"Kilo",provider:"kilo-cli"},{id:17,name:"Craft",provider:"craft"},{id:18,name:"Droid",provider:"droid"},{id:19,name:"GitHub",provider:"github"}];export{W as A,Q as L,q as a,L as b,k as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c}from"./main-DhcQGvkP.js";const e=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],t=c("check",e);export{t as C};
|