tokentracker-cli 0.23.0 → 0.23.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dashboard/dist/assets/{Card-BgXt23Ak.js → Card-WqeqJCTJ.js} +1 -1
  2. package/dashboard/dist/assets/DashboardPage-DfXV-T4E.js +42 -0
  3. package/dashboard/dist/assets/{DevicePage-CWTFzGYj.js → DevicePage-CKQwUIFV.js} +1 -1
  4. package/dashboard/dist/assets/{FadeIn-r11-zwBU.js → FadeIn-BvXHu5jo.js} +1 -1
  5. package/dashboard/dist/assets/{HeaderGithubStar-ZDYMF__6.js → HeaderGithubStar-BYgV73_y.js} +1 -1
  6. package/dashboard/dist/assets/{IpCheckPage-cCSBXnv2.js → IpCheckPage-BjuJDGa8.js} +1 -1
  7. package/dashboard/dist/assets/{LandingPage-DDUROVcN.js → LandingPage-Dymt6fsi.js} +1 -1
  8. package/dashboard/dist/assets/LeaderboardPage-BWJX1oGI.js +5 -0
  9. package/dashboard/dist/assets/{LeaderboardProfilePage-BthYFghU.js → LeaderboardProfilePage-DmNl8aoL.js} +1 -1
  10. package/dashboard/dist/assets/{LimitsPage-BQpint0k.js → LimitsPage-D_q9Z5nB.js} +1 -1
  11. package/dashboard/dist/assets/{LoginPage-EUjSrjOv.js → LoginPage-BvwX7KJg.js} +1 -1
  12. package/dashboard/dist/assets/PopoverPopup-CrBQ_8vY.js +12 -0
  13. package/dashboard/dist/assets/{ProviderIcon-D7GhGvvD.js → ProviderIcon-Cb-YMfcK.js} +1 -1
  14. package/dashboard/dist/assets/SettingsPage-u30V0Mqy.js +1 -0
  15. package/dashboard/dist/assets/SkillsPage-ssktZGFE.js +1 -0
  16. package/dashboard/dist/assets/{WidgetsPage-QfPgS0dO.js → WidgetsPage-_geExCIR.js} +1 -1
  17. package/dashboard/dist/assets/{WrappedPage-0iiBrhBo.js → WrappedPage-C5Wcs8L4.js} +1 -1
  18. package/dashboard/dist/assets/check-Cu-lm-wz.js +1 -0
  19. package/dashboard/dist/assets/{chevron-down-Br4ZSPLP.js → chevron-down-BbPjwLP4.js} +1 -1
  20. package/dashboard/dist/assets/{download-CnQNKpma.js → download-iIollDJi.js} +1 -1
  21. package/dashboard/dist/assets/info-DjS23Duh.js +1 -0
  22. package/dashboard/dist/assets/{leaderboard-columns-Bdgb7vS7.js → leaderboard-columns-DTnRH3EZ.js} +1 -1
  23. package/dashboard/dist/assets/main-Cb6vMAZa.js +688 -0
  24. package/dashboard/dist/assets/{use-limits-display-prefs-B5TQdyrf.js → use-limits-display-prefs-DZ9hgvef.js} +1 -1
  25. package/dashboard/dist/assets/{use-native-settings-CSxKG_Na.js → use-native-settings-DS1TfSil.js} +1 -1
  26. package/dashboard/dist/assets/{use-reduced-motion-C9rLBEnX.js → use-reduced-motion-D82galUK.js} +1 -1
  27. package/dashboard/dist/assets/{use-usage-limits-Bmok4oKO.js → use-usage-limits-B-svr8YY.js} +1 -1
  28. package/dashboard/dist/assets/useCurrency-uA9QPua4.js +1 -0
  29. package/dashboard/dist/index.html +1 -1
  30. package/dashboard/dist/share.html +1 -1
  31. package/package.json +1 -1
  32. package/src/cli.js +2 -1
  33. package/src/commands/serve.js +57 -2
  34. package/src/lib/local-api.js +48 -9
  35. package/src/lib/pricing/seed-snapshot.json +1 -1
  36. package/dashboard/dist/assets/DashboardPage-NVAsY99I.js +0 -64
  37. package/dashboard/dist/assets/LeaderboardPage-BaETRtBF.js +0 -5
  38. package/dashboard/dist/assets/PopoverPopup-DyjmUoRY.js +0 -12
  39. package/dashboard/dist/assets/SettingsPage-9lfQ1c28.js +0 -1
  40. package/dashboard/dist/assets/SkillsPage-Bt7d1kd0.js +0 -1
  41. package/dashboard/dist/assets/check-CtXuxG1H.js +0 -1
  42. package/dashboard/dist/assets/main-D7f_DoMp.js +0 -676
@@ -1 +0,0 @@
1
- import{c as St,r as n,C as r,a7 as yr,H as Le,a5 as Ue,X as Nt,B as S,O as Qr,F as rr,ax as Zr,aw as en,R as tn}from"./main-D7f_DoMp.js";import{C as rn}from"./Card-BgXt23Ak.js";import{A as Wt,s as Me,n as lt,o as Be,p as ze,q as nr,r as br,t as $e,v as nn,w as an,x as ee,y as sn,z as Ne,B as on,E as ar,F as ln,G as st,c as Ee,H as At,J as sr,K as cn,M as wr,N as dn,O as un,Q as Ge,R as Ft,S as Xe,T as Ve,U as yt,V as bt,W as fn,X as fe,Y as qt,Z as gn,_ as $t,$ as B,a0 as Rt,a1 as mn,a2 as hn,a3 as pn,a4 as xn,a5 as Gt,a6 as Yt,a7 as kr,a8 as vr,a9 as Ct,aa as yn,ab as bn,a as Xt,b as De,ac as wn,ad as Ht,ae as kn,af as vn,ag as jn,ah as Sn,ai as Nn,aj as Rn,ak as Cn,al as In,am as jr,an as Mn,ao as En,ap as or,aq as Tn,ar as Pn,as as On,at as Jt,au as An,av as _n,aw as _t,u as Vn,D as Ln,e as Dn,f as Fn,g as $n,h as Hn,i as Un,I as Bn,L as Ke,P as zn,j as Kn,k as Wn,l as qn,m as Gn,C as Yn}from"./PopoverPopup-DyjmUoRY.js";import{P as tt}from"./ProviderIcon-D7GhGvvD.js";import{C as Ye}from"./check-CtXuxG1H.js";import{u as Xn}from"./use-reduced-motion-C9rLBEnX.js";import{C as Sr}from"./chevron-down-Br4ZSPLP.js";import{D as Jn}from"./download-CnQNKpma.js";const Qn=[["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",Qn);const Zn=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Nr=St("plus",Zn);const ea=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],ir=St("search",ea);const ta=[["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",ta);function ra(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 Vt(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 na(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 V=h[j];if(V.length===0){j=d==="up"?j-1:j+1;continue}const Q=Math.min(b,V.length-1);for(let _=Q;_>=0;_-=1){const te=V[_];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=nr(y/o);t.key===(u?Be:ze)&&(f&&Me(t),y%o!==o-1?(m=Ie(e,{startingIndex:y,disabledIndices:c}),s&&gt(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&&gt(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=nr(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 aa(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 sa(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 oa(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 ia="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 Lt(e,t,a){return It(t,e===lt,a?e===Be:e===ze)||e==="Enter"||e===" "||e===""}function la(e,t,a){return It(t,a?e===Be:e===ze,e===lt)}function ca(e,t,a,s){const u=a?e===ze:e===Be,o=e===Wt;return t==="both"||t==="horizontal"&&s&&s>1?e===ia:It(t,u,o)}function da(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:V,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=nn(),ae=an(K);ee(()=>{c.current.orientation=A},[c,A]);const R=sn(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):on(i,{sync:U.current,preventScroll:!0})}const L=l.current[C.current],N=be.current;L&&g(L),(U.current?i=>i():requestAnimationFrame)(()=>{const i=l.current[C.current]||L;if(!i)return;L||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 L=()=>{l.current[0]==null?(g<2&&(g?requestAnimationFrame:queueMicrotask)(L),g+=1):(C.current=v.current==null||Lt(v.current,A,k)||x?Vt(l):lr(l),v.current=null,P())};L()}}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,L=g.find(i=>i.id===D)?.context?.elements.floating,N=ar(ln(u)),G=g.some(i=>i.context&&st(i.context.elements.floating,N));L&&!G&&de.current&&L.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(()=>V??ae?.nodesRef.current.find(g=>g.id===D)?.context?.dataRef?.current.orientation,[D,ae,V]),ve=Ne(g=>{if(de.current=!1,U.current=!0,g.which===229||!F.current&&g.currentTarget===W.current)return;if(x&&ca(g.key,A,k,Q)){mt(g.key,ne())||Me(g),a.setOpen(!1,Ee(At,g.nativeEvent)),sr(o)&&(M?ae?.events.emit("virtualfocus",o):o.focus());return}const L=C.current,N=Vt(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=aa(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[na({current:w.map(ce=>ce!=null?l.current[ce]:null)},{event:g,orientation:A,loopFocus:T,rtl:k,cols:Q,disabledIndices:oa([...(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:sa(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&&ar(g.currentTarget.ownerDocument)===g.currentTarget){C.current=Lt(g.key,A,k)?N:G,P(g);return}Lt(g.key,A,k)?T?L>=G?h&&L!==l.current.length?C.current=-1:(U.current=!1,C.current=N):C.current=Ie(l,{startingIndex:L,disabledIndices:j}):C.current=Math.min(G,Ie(l,{startingIndex:L,disabledIndices:j})):T?L<=N?h&&L!==-1?C.current=l.current.length:(U.current=!1,C.current=G):C.current=Ie(l,{startingIndex:L,decrement:!0,disabledIndices:j}):C.current=Math.max(N,Ie(l,{startingIndex:L,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 L=cn(g.nativeEvent);if(L&&!st(W.current,L))return;Me(g),a.setOpen(!1,Ee(wr,g.nativeEvent)),sr(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"&&dn(N.nativeEvent)&&(H.current=!M)}function L(N){H.current=d,d==="auto"&&un(N.nativeEvent)&&(H.current=!0)}return{onKeyDown(N){const G=a.select("open");de.current=!1;const i=N.key.startsWith("Arrow"),w=la(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=Vt(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:L,onPointerEnter:L,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 ua(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(V=>{V?u.current.typing||(u.current.typing=V,p?.(V)):u.current.typing&&(u.current.typing=V,p?.(V))}),b=Ne(V=>{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):V.key===" "&&Me(V)),_==null||h.includes(V.key)||V.key.length!==1||V.ctrlKey||V.metaKey||V.altKey)return;s&&V.key!==" "&&(Me(V),E(!0)),_.every(Z=>Z?Z[0]?.toLocaleLowerCase()!==Z[1]?.toLocaleLowerCase():!0)&&k.current===V.key&&(k.current="",M.current=d.current),k.current+=V.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):V.key!==" "&&(k.current="",E(!1))}),j=n.useMemo(()=>({onKeyDown:b}),[b]),A=n.useMemo(()=>({onKeyDown:b,onKeyUp(V){V.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 fa={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]:""}}},ga=n.createContext({invalid:void 0,name:void 0,validityData:{state:fa,errors:[],error:"",value:"",initialValue:null},setValidityData:Ve,disabled:void 0,touched:!1,setTouched:Ve,dirty:!1,setDirty:Ve,filled:!1,setFilled:Ve,focused:!1,setFocused:Ve,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(ga);if(t.setValidityData===Ve&&!e)throw new Error(Xe(28));return t}const ma=n.createContext({controlId:void 0,setControlId:Ve,labelId:void 0,setLabelId:Ve,messageIds:[],setMessageIds:Ve,getDescriptionProps:e=>e});function Zt(){return n.useContext(ma)}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===Ve)){if(a){const l=s?.current;fn(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 ha=(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 pa(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 xa(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 ya(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 ya(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 ba(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?xa(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)},wa=n.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Ve,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function er(){return n.useContext(wa)}function ka(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:ka(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=ha,highlightItemOnHover:A=!0,children:V}=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}=gn(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,L=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=mn({open:P,onOpenChange:ce,elements:{reference:G,floating:i}}),Je=hn(Oe,{enabled:!f&&!H,event:"mousedown"}),nt=pn(Oe,{bubbles:!1}),Fe=da(Oe,{enabled:!f&&!H,listRef:J,activeIndex:L,selectedIndex:N,disabledIndices:Ft,onNavigate(z){z===null&&!P||g.set("activeIndex",z)},focusItemOnHover:!1}),Tt=ua(Oe,{enabled:!f&&!H&&(P||!d),listRef:I,activeIndex:L,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]);ra(()=>{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:[V,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 va(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,ja=400,dr=200,Sa={...wn,...Qt,value:()=>null},Vr=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:V,keyboardActiveRef:Q}=We(),_=T||V||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}=Xt({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(ja,()=>{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=va(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:Sa,props:F})}),Na={value:()=>null},Lr=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=ba(f,m,h):d=Pr(f,m,h),De("span",t,{state:M,ref:[a,y],props:[{children:d},l],stateAttributesMapping:Na})}),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})}),Ra=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(Ra.Provider,{value:!0,children:r.jsx(jn,{ref:a,...t})}):null}),$r=n.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function Ca(){return n.useContext($r)}function Ia(e){const{children:t,elementsRef:a,labelsRef:s,onMapChange:u}=e,o=Ne(u),c=n.useRef(0),l=$t(Ea).current,p=$t(Ma).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(Ta).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 Ma(){return new Map}function Ea(){return new Set}function Ta(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 Pa(){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 Oa={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},Aa={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:V,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(V,()=>J),Nn((J||W)&&K&&ae!=="touch",H);const I=Rn({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?Aa: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(Ia,{elementsRef:j,labelsRef:A,onMapChange:me,children:r.jsxs(Hr.Provider,{value:ue,children:[ge&&W&&r.jsx(Cn,{inert:In(!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 _a(e,t=Number.MIN_SAFE_INTEGER,a=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,a))}const Va=n.createContext(void 0),La={disableStyleElements:!1};function Da(){return n.useContext(Va)??La}const Fa={...jr,...Jt},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:V}=Pa(),Q=Mn()!=null,_=Mr(),{nonce:te,disableStyleElements:ye}=Da(),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=En(),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 L=0,N=null,G=!1;if(xe){const i=g-ie,w=we+i,O=Math.min(w,se);L=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;L=O,O!==se?N=0:(G=!0,ie<g&&(N=ie-(i-Y)))}L!==0&&(R.style.height=`${L}px`),N!=null&&(F.scrollTop=N),(G||L>=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=Ha(F);F.style.removeProperty("--transform-origin");try{const re=getComputedStyle(R),we=getComputedStyle(F),me=Ht(ae),ue=or(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,L=parseFloat(re.marginBottom)||10,N=parseFloat(re.minHeight)||100,G=fr(we),i=5,w=5,O=20,Y=me.documentElement.clientHeight-g-L,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+L+he;let Fe=Math.min(Y,nt);const Tt=Y-g-L,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=`${L}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&&Tn;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=_a(_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,V,H]),n.useEffect(()=>{if(!b||!R||!K)return;const F=or(R);function xe(re){y(!1,Ee(On,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&&_n.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%"}:Oa}},ke=De("div",t,{ref:[a,l],state:U,stateAttributesMapping:Fa,props:[W,be,An(D),{className:!H&&b?ur.className:void 0},o]});return r.jsxs(n.Fragment,{children:[!ye&&ur.getElement(te),r.jsx(Pn,{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 $a(e,t,a){a?e.setProperty(t,a):e.removeProperty(t)}function Ha(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)$a(t,u,a[u])}}let Kr=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function Ua(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}=Ca(),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=Ua({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(),V=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}=Xt({disabled:l,focusableWhenDisabled:!0,native:p});function de(I){const U=h.state.value;if(j){const be=Array.isArray(U)?U:[],ke=_?pa(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)||V.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(Ba,{...t,ref:a}):null}),Ba=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:Jt});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})})),za=n.forwardRef(function(t,a){const{render:s,className:u,id:o,...c}=t,{store:l}=Vn(),p=bt(o);return l.useSyncedValueWithCleanup("descriptionElementId",p),De("p",t,{ref:a,props:[{id:p},c]})});function Ka({open:e,title:t,description:a,confirmLabel:s,cancelLabel:u,destructive:o=!1,busy:c=!1,onConfirm:l,onCancel:p}){return r.jsx(Ln,{open:e,onOpenChange:y=>{!y&&!c&&p?.()},children:r.jsxs(Dn,{children:[r.jsx(Fn,{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($n,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:r.jsxs(Hn,{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(Un,{className:"text-base font-semibold text-oai-black dark:text-white",children:t}),a?r.jsx(za,{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(Le,{type:"button",variant:"secondary",size:"sm",disabled:c,onClick:()=>p?.(),children:u}),r.jsx(Le,{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 Wa="tt:hint:dismissed:";function Gr(e){return Wa+e}function qa(e){if(typeof window>"u")return!1;try{return window.localStorage.getItem(Gr(e))==="1"}catch{return!1}}function Ga({id:e,children:t,className:a,ariaLabel:s}){const[u,o]=n.useState(()=>qa(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(Bn,{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 Ya=n.createContext({disabled:!1});function Xa(){return n.useContext(Ya)}const Ja=n.createContext(void 0);function Qa(e=!0){const t=n.useContext(Ja);if(t===void 0&&!e)throw new Error(Xe(3));return t}const Xr=n.createContext(void 0);function Za(){const e=n.useContext(Xr);if(e===void 0)throw new Error(Xe(14));return e}const es="data-parent",ts=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:V,setDirty:Q,setFilled:_,setFocused:te,setTouched:ye,state:X,validationMode:Z,validityData:K,shouldValidateOnChange:ge,validation:W}=Mt(),D=Xa(),{labelId:ae,controlId:R,setControlId:H,getDescriptionProps:C}=Zt(),v=Qa(),de=v?.parent,P=de&&v.allValues,oe=A||D.disabled||v?.disabled||c,J=V??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}=Xt({disabled:oe,native:E}),he=v?.validation??W,[g,L]=Bt({controlled:I&&q&&!h?q.includes(I):re,default:I&&ve&&!h?ve.includes(I):o,name:"Checkbox",state:"checked"});ee(()=>{if(H!==Ve)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&&(L(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,[es]: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})]})}),rs=n.forwardRef(function(t,a){const{render:s,className:u,keepMounted:o=!1,...c}=t,l=Za(),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,...Jt,...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 ns(e,t){return`target:${e}:${t}`}function as(e){return`remove:${e.id||e.directory}`}function ss({skill:e,targets:t,busyKey:a,onClose:s,onToggleTarget:u,onRemove:o}){return r.jsx(Qr,{children:e?r.jsx(os,{skill:e,targets:t,busyKey:a,onClose:s,onToggleTarget:u,onRemove:o},e.id||e.directory):null})}function os({skill:e,targets:t,busyKey:a,onClose:s,onToggleTarget:u,onRemove:o}){const c=Xn(),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===as(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===ns(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(ts,{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(rs,{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 is(){return Et({mode:"installed"})}function ls(e={}){return Et({mode:"discover",...e.force?{force:1}:{}})}function cs(e,t=0,a=20){return Et({mode:"search",q:e,offset:t,limit:a})}function ds(){return Et({mode:"repos"})}function us(e,t){return qe({action:"install",skill:e,targets:t})}function fs(e){return qe({action:"uninstall",id:e})}function gs(e){return qe({action:"restore",id:e})}function ms(e,t){return qe({action:"set_targets",id:e,targets:t})}function hs(e,t){return qe({action:"import_local",directory:e,targets:t})}function ps(e,t){return qe({action:"delete_local",directory:e,targets:t||[]})}function xs(e){return qe({action:"add_repo",repo:e})}function ys(e,t){return qe({action:"remove_repo",owner:e,name:t})}const hr=["claude","codex"],bs={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 ws(e,t){return`target:${e}:${t}`}function ks({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",bs[e.id]),"aria-hidden":!0,children:r.jsx(tt,{provider:e.id,size:14})}),e.label]})}function vs({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(ks,{target:o},o.id))})}function js({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(vs,{skill:e,targets:t})}),r.jsx(Yn,{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 Ss({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(Vr,{"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(Lr,{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 Ns({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(Ss,{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(Le,{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(js,{skill:f,targets:a,selected:p===(f.id||f.directory),onSelect:y},f.id||f.key))})]})}const Rs={contentVisibility:"auto",containIntrinsicSize:"0 240px"},Cs=tn.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(rn,{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(zn,{children:[r.jsx(Kn,{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(Wn,{children:r.jsx(qn,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:r.jsxs(Gn,{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(Le,{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(Jn,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),S("skills.action.install")]})]})})]})});function Is({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(Le,{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(Le,{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 Ms(){return typeof window>"u"?"my":new URLSearchParams(window.location.search).get("tab")==="browse"?"browse":"my"}function Fs(){const[e,t]=n.useState(Ms),[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"),[V,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 is();s({skills:i.skills||[],targets:i.targets||[]})},[]),de=n.useCallback(async()=>{const i=await ds();y(i.repos||[])},[]),P=n.useCallback(async({force:i=!1}={})=>{K(!0);try{const w=await ls({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]);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]);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 us(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 fs(i.id):await ps(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 gs(i.id),await v(),H(null)}catch(Y){W(Y?.message||S("skills.error.generic"))}}:null,ttlMs:5e3})}))},F=(i,w,O)=>I(ws(i.id,w),async()=>{const Y=new Set(i.targets||[]);O?Y.add(w):Y.delete(w),i.managed?await ms(i.id,Array.from(Y)):await hs(i.directory,Array.from(Y))}),xe=async()=>{const i=h.trim();if(!(i.length<2)){te("search"),W("");try{const w=await cs(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 xs({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 ys(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(()=>V&&ue.find(i=>(i.id||i.directory)===V)||null,[ue,V]),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"&&V&&Q(null)},[e,V]),n.useEffect(()=>{V&&!ve&&Q(null)},[ve,V]);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})}),L=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(Ns,{items:q,totalCount:ue.length,targets:me,agentOptions:me,agentFilter:j,onAgentFilter:A,anyFilter:ne,onClearFilters:se,selectedId:V,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(Le,{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=L: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:Rs,children:r.jsx(Cs,{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(Le,{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(Is,{repos:p,repoInput:M,onRepoInput:d,busyKey:_,onAdd:re,onRemove:we})}):null,Re=!E&&!i&&p.length<=1&&he.length>0?r.jsx(Ga,{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(Le,{type:"button",variant:"secondary",size:"sm",onClick:J,disabled:ye||Z,children:[r.jsx(en,{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(Vr,{"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(Lr,{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(Le,{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(Le,{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(ss,{skill:ve,targets:me,busyKey:_,onClose:Ce,onToggleTarget:F,onRemove:be})]})}),r.jsx(Ka,{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{Fs as SkillsPage};
@@ -1 +0,0 @@
1
- import{c}from"./main-D7f_DoMp.js";const e=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],t=c("check",e);export{t as C};