tokentracker-cli 0.57.1 → 0.58.0

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 (55) hide show
  1. package/README.ja.md +6 -5
  2. package/README.ko.md +6 -5
  3. package/README.md +7 -6
  4. package/README.zh-CN.md +6 -5
  5. package/dashboard/dist/assets/{ActivityHeatmap-BvbV3_J7.js → ActivityHeatmap--h7iLeSz.js} +1 -1
  6. package/dashboard/dist/assets/{Card-DJZ6ntik.js → Card-KutJI7Kb.js} +1 -1
  7. package/dashboard/dist/assets/DashboardPage-CZS3KR2C.js +19 -0
  8. package/dashboard/dist/assets/{DevicePage-DW6XIKeU.js → DevicePage-Bvf6grjO.js} +1 -1
  9. package/dashboard/dist/assets/{DialogTitle-BsrlMQVP.js → DialogTitle-Cd8SHRAb.js} +1 -1
  10. package/dashboard/dist/assets/{FadeIn-XjqQkcHf.js → FadeIn-D_0IpM7h.js} +1 -1
  11. package/dashboard/dist/assets/{HeaderGithubStar-DcwDZDfU.js → HeaderGithubStar-wllgUDeU.js} +1 -1
  12. package/dashboard/dist/assets/{IpCheckPage-DwWHgam0.js → IpCheckPage-oUeKrhWf.js} +1 -1
  13. package/dashboard/dist/assets/{LandingPage-BqtWjGwE.js → LandingPage-BqzdZPJZ.js} +1 -1
  14. package/dashboard/dist/assets/{LeaderboardAvatar-BeBtwC-_.js → LeaderboardAvatar-Bib0pX-r.js} +1 -1
  15. package/dashboard/dist/assets/{LeaderboardPage-0TwqZOxu.js → LeaderboardPage-BjLZyZb-.js} +3 -3
  16. package/dashboard/dist/assets/{LeaderboardProfileModal-3HwkYdbM.js → LeaderboardProfileModal-GiTmpwyn.js} +1 -1
  17. package/dashboard/dist/assets/{LeaderboardProfilePage-865y5FBU.js → LeaderboardProfilePage-Df_jL82E.js} +1 -1
  18. package/dashboard/dist/assets/LimitsPage-BhPNmv6R.js +2 -0
  19. package/dashboard/dist/assets/{LocalOnlyNotice-CTKip6yZ.js → LocalOnlyNotice-B01hqlKr.js} +1 -1
  20. package/dashboard/dist/assets/{LoginPage-DhfoXUgm.js → LoginPage-BjqX1wZg.js} +1 -1
  21. package/dashboard/dist/assets/{PopoverPopup-3YotW-4M.js → PopoverPopup-CWyN32rM.js} +1 -1
  22. package/dashboard/dist/assets/{ResetPasswordPage-CqEEo2VL.js → ResetPasswordPage-Bw7tWm1t.js} +1 -1
  23. package/dashboard/dist/assets/{Select-BjnA__CB.js → Select-DbBT6mPJ.js} +1 -1
  24. package/dashboard/dist/assets/{SelectItemText-CoQ0e4TL.js → SelectItemText-XGWezP4M.js} +1 -1
  25. package/dashboard/dist/assets/{SettingsPage-ushnnb65.js → SettingsPage-CrA-jBWs.js} +1 -1
  26. package/dashboard/dist/assets/{SkillsPage-CW4mBNzt.js → SkillsPage-CfYTgQMY.js} +1 -1
  27. package/dashboard/dist/assets/{WidgetsPage-BiwEsW3y.js → WidgetsPage-DjE_NMiT.js} +1 -1
  28. package/dashboard/dist/assets/{WrappedPage-vu2gEGcG.js → WrappedPage-MciuOQFt.js} +1 -1
  29. package/dashboard/dist/assets/{agent-logos-CvsRxSzl.js → agent-logos-JyXME_ur.js} +1 -1
  30. package/dashboard/dist/assets/{arrow-up-right-DwYMKA3i.js → arrow-up-right-U8aUNwfl.js} +1 -1
  31. package/dashboard/dist/assets/{download-BpLBXlyg.js → download-CK8DaHH6.js} +1 -1
  32. package/dashboard/dist/assets/{info-D7gs3LAC.js → info-DF9b_Lut.js} +1 -1
  33. package/dashboard/dist/assets/{main-D2iJg7iA.js → main-4M5oNV2-.js} +15 -11
  34. package/dashboard/dist/assets/{main-Bb0Bwbp7.css → main-xFJe2FDa.css} +1 -1
  35. package/dashboard/dist/assets/use-limits-display-prefs--1a77fnk.js +1 -0
  36. package/dashboard/dist/assets/{use-native-settings-C-JvsUqt.js → use-native-settings-PZ_s8TF_.js} +1 -1
  37. package/dashboard/dist/assets/{use-usage-limits-DfKKdPYm.js → use-usage-limits-B11QqFl7.js} +1 -1
  38. package/dashboard/dist/assets/{useCurrency-CAzf_Pmi.js → useCurrency-CzRjastg.js} +1 -1
  39. package/dashboard/dist/assets/{useScrollLock-DNuJyLo9.js → useScrollLock-BXcNDJbM.js} +1 -1
  40. package/dashboard/dist/brand-logos/zcode.svg +1 -0
  41. package/dashboard/dist/index.html +2 -2
  42. package/dashboard/dist/share.html +2 -2
  43. package/package.json +2 -2
  44. package/src/commands/init.js +9 -2
  45. package/src/commands/status.js +11 -0
  46. package/src/commands/sync.js +45 -0
  47. package/src/lib/pricing/curated-overrides.json +2 -0
  48. package/src/lib/pricing/matcher.js +17 -2
  49. package/src/lib/pricing/seed-snapshot.json +1 -1
  50. package/src/lib/rollout.js +31 -0
  51. package/src/lib/usage-limits.js +6 -1
  52. package/src/lib/zcode-limits.js +213 -0
  53. package/dashboard/dist/assets/DashboardPage-Bu3v5Fm2.js +0 -19
  54. package/dashboard/dist/assets/LimitsPage-CfGYwdDz.js +0 -2
  55. package/dashboard/dist/assets/use-limits-display-prefs-BDCL1zsb.js +0 -1
@@ -0,0 +1 @@
1
+ import{G as u,r as a,a_ as M,a$ as j,b0 as G,b1 as J}from"./main-4M5oNV2-.js";const B=["claude","codex","cursor","gemini","kimi","kiro","grok","copilot","antigravity","zcode"],q={claude:"CLAUDE",codex:"CODEX",cursor:"CURSOR",gemini:"GEMINI",kimi:"KIMI",kiro:"KIRO",grok:"GROK",copilot:"COPILOT",antigravity:"ANTIGRAVITY",zcode:"ZCODE"};function se(e){return q[e]||null}function ae(e){switch(e){case"claude":return u("limits.provider.claude");case"codex":return u("limits.provider.codex");case"cursor":return u("limits.provider.cursor");case"gemini":return u("limits.provider.gemini");case"kimi":return u("limits.provider.kimi");case"kiro":return u("limits.provider.kiro");case"grok":return u("limits.provider.grok");case"copilot":return u("limits.provider.copilot");case"antigravity":return u("limits.provider.antigravity");case"zcode":return u("limits.provider.zcode");default:return String(e||"")}}const y=B,A="tt.limits.providerOrder",E="tt.limits.providerVisibility",h="tt.limits.displayMode",S="tt.limits.updatedAt",V="limitsPreferences",F="limitsDisplayMode",v=Object.freeze({USED:"used",REMAINING:"remaining"}),g=new Set(Object.values(v)),L=new Set([A,E,h,S]);function I(){return[...y]}function b(){return Object.fromEntries(y.map(e=>[e,!0]))}function _(e){const r=[];if(Array.isArray(e))for(const n of e)y.includes(n)&&!r.includes(n)&&r.push(n);for(const n of y)r.includes(n)||r.push(n);return r}function N(e){const r=b();if(!e||typeof e!="object"||Array.isArray(e))return r;for(const n of y)typeof e[n]=="boolean"&&(r[n]=e[n]);return r}function X(e){return g.has(e)?e:v.USED}function m(e){if(e!=null){if(typeof e=="number")return Number.isSafeInteger(e)?e:void 0;if(typeof e=="string"){const r=e.trim();if(r==="")return;const n=Number(r);return Number.isSafeInteger(n)?n:void 0}}}function w(e={}){const r=e&&typeof e=="object"?e:{};return{displayMode:X(r.displayMode),providerOrder:_(r.providerOrder),providerVisibility:N(r.providerVisibility),updatedAt:m(r.updatedAt)}}function Z(){if(typeof window>"u")return I();try{const e=window.localStorage.getItem(A);return _(e?JSON.parse(e):void 0)}catch{return I()}}function $(){if(typeof window>"u")return b();try{const e=window.localStorage.getItem(E);return N(e?JSON.parse(e):void 0)}catch{return b()}}function H(){if(typeof window>"u")return v.USED;try{const e=window.localStorage.getItem(h);return g.has(e)?e:v.USED}catch{return v.USED}}function Q(){if(!(typeof window>"u"))try{return m(window.localStorage.getItem(S))}catch{return}}function W(){if(typeof window>"u")return!1;try{for(const e of L)if(window.localStorage.getItem(e)!==null)return!0}catch{return!1}return!1}function O(){return w({displayMode:H(),providerOrder:Z(),providerVisibility:$(),updatedAt:Q()})}function ee(e){if(typeof window>"u")return;const r=w(e);try{window.localStorage.setItem(A,JSON.stringify(r.providerOrder)),window.localStorage.setItem(E,JSON.stringify(r.providerVisibility)),window.localStorage.setItem(h,r.displayMode),r.updatedAt===void 0?window.localStorage.removeItem(S):window.localStorage.setItem(S,String(r.updatedAt))}catch(n){console.warn("[tokentracker] limits preferences localStorage write failed:",n)}}function re(e){const r=w(e);return{displayMode:r.displayMode,providerOrder:[...r.providerOrder],providerVisibility:{...r.providerVisibility},updatedAt:r.updatedAt??null}}function te(...e){let r;for(const s of e){const l=m(s);l!==void 0&&(r=r===void 0?l:Math.max(r,l))}const n=Date.now();return r!==void 0&&n<=r?r+1:n}function ie(e,r){return e.length===r.length&&e.every((n,s)=>n===r[s])}function ne(e,r){return y.every(n=>e[n]===r[n])}function R(e,r){return e.displayMode===r.displayMode&&ie(e.providerOrder,r.providerOrder)&&ne(e.providerVisibility,r.providerVisibility)}function oe(e,r){return R(e,r)&&m(e.updatedAt)===m(r.updatedAt)}function k(e,r){const n=m(e.updatedAt),s=m(r.updatedAt);return n!==void 0&&(s===void 0||n>s)}function ce(){const[e,r]=a.useState(O),n=a.useRef(e),s=a.useCallback((o,t={})=>{const i=w(o);return n.current=i,r(i),t.writeLocal&&ee(i),i},[]),l=a.useCallback(o=>{M()&&j(V,re(o))},[]),c=a.useCallback(o=>{const t=O(),i=k(t,n.current)?s(t):n.current,d=w(o(i));if(R(i,d))return;const f=te(t.updatedAt,i.updatedAt),p=s({...d,updatedAt:f},{writeLocal:!0});l(p)},[s,l]),C=a.useCallback(o=>{g.has(o)&&c(t=>({...t,displayMode:o}))},[c]),D=a.useCallback(o=>{if(!g.has(o))return;const t=O();if(t.updatedAt!==void 0){s(t);return}s({...t,displayMode:o,updatedAt:void 0},{writeLocal:!0})},[s]);a.useEffect(()=>{if(!M())return;const o=G(t=>{const i=t?.[V];if(i&&typeof i=="object"){const d=w(i);if(!W()){s(d,{writeLocal:!0});return}const f=O();if(k(d,f))s(d,{writeLocal:!0});else{const p=s(f);oe(d,f)||l(p)}return}D(t?.[F])});return J(),o},[D,s,l]),a.useEffect(()=>{if(typeof window>"u")return;const o=t=>{(t.key===null||L.has(t.key))&&s(O())};return window.addEventListener("storage",o),()=>window.removeEventListener("storage",o)},[s]);const P=a.useCallback(o=>{y.includes(o)&&c(t=>({...t,providerVisibility:{...t.providerVisibility,[o]:!t.providerVisibility[o]}}))},[c]),x=a.useCallback(o=>{c(t=>{const i=t.providerOrder.indexOf(o);if(i<=0)return t;const d=[...t.providerOrder];return[d[i-1],d[i]]=[d[i],d[i-1]],{...t,providerOrder:d}})},[c]),U=a.useCallback(o=>{c(t=>{const i=t.providerOrder.indexOf(o);if(i<0||i>=t.providerOrder.length-1)return t;const d=[...t.providerOrder];return[d[i],d[i+1]]=[d[i+1],d[i]],{...t,providerOrder:d}})},[c]),T=a.useCallback((o,t)=>{o!==t&&c(i=>{const d=i.providerOrder.indexOf(o),f=i.providerOrder.indexOf(t);if(d<0||f<0)return i;const p=[...i.providerOrder],[z]=p.splice(d,1);return p.splice(f,0,z),{...i,providerOrder:p}})},[c]),Y=a.useCallback(()=>{c(()=>({displayMode:v.USED,providerOrder:I(),providerVisibility:b()}))},[c]),K=a.useMemo(()=>e.providerOrder.filter(o=>e.providerVisibility[o]!==!1),[e.providerOrder,e.providerVisibility]);return{order:e.providerOrder,visibility:e.providerVisibility,displayMode:e.displayMode,setDisplayMode:C,visibleOrdered:K,toggle:P,moveUp:x,moveDown:U,moveToward:T,reset:Y}}export{v as L,B as a,se as b,ae as l,ce as u};
@@ -1 +1 @@
1
- import{j as a,V as x,r as n,aD as g,c4 as m,b0 as b,b1 as u,a$ as f,c3 as h}from"./main-D2iJg7iA.js";import{C as y}from"./Card-DJZ6ntik.js";function k({checked:s,onChange:t,disabled:e,ariaLabel:i}){return a.jsx("button",{type:"button",role:"switch","aria-checked":s,"aria-label":i,onClick:t,disabled:e,className:x("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 disabled:opacity-50 disabled:cursor-not-allowed",s?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:a.jsx("span",{className:x("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",s?"translate-x-[18px]":"translate-x-[3px]")})})}function p({label:s,hint:t,control:e}){return a.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:s}),t?a.jsx("div",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:t}):null]}),a.jsx("div",{className:"shrink-0",children:e})]})}function N({title:s,subtitle:t,action:e,children:i}){return a.jsxs(y,{children:[a.jsxs("div",{className:"mb-3 flex items-start justify-between gap-4",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h2",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:s}),t?a.jsx("p",{className:"mt-1 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:t}):null]}),e?a.jsx("div",{className:"shrink-0",children:e}):null]}),a.jsx("div",{className:"-mb-3 divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:i})]})}function w({options:s,value:t,onChange:e}){return a.jsx("div",{className:"inline-flex items-center rounded-lg border border-oai-gray-200 bg-oai-gray-50 p-0.5 dark:border-oai-gray-800 dark:bg-oai-gray-900",children:s.map(({value:i,label:d,Icon:l})=>{const r=t===i;return a.jsxs("button",{type:"button",onClick:()=>e(i),"aria-pressed":r,className:x("inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors",r?"bg-white text-oai-black shadow-sm dark:bg-oai-gray-800 dark:text-white":"text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:[l?a.jsx(l,{className:"h-3.5 w-3.5","aria-hidden":!0}):null,a.jsx("span",{children:d})]},i)})})}function S(){const[s,t]=n.useState(null),e=g()&&m();n.useEffect(()=>{if(!e)return;const r=b(o=>t(o));return u(),r},[e]);const i=n.useCallback((r,o)=>{e&&(t(c=>c&&{...c,[r]:o}),f(r,o))},[e]),d=n.useCallback(r=>{e&&h(r)},[e]),l=n.useCallback(()=>{e&&u()},[e]);return{available:e,settings:s,setSetting:i,runAction:d,refresh:l}}export{N as S,k as T,p as a,w as b,S as u};
1
+ import{j as a,V as x,r as n,aD as g,c4 as m,b0 as b,b1 as u,a$ as f,c3 as h}from"./main-4M5oNV2-.js";import{C as y}from"./Card-KutJI7Kb.js";function k({checked:s,onChange:t,disabled:e,ariaLabel:i}){return a.jsx("button",{type:"button",role:"switch","aria-checked":s,"aria-label":i,onClick:t,disabled:e,className:x("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 disabled:opacity-50 disabled:cursor-not-allowed",s?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:a.jsx("span",{className:x("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",s?"translate-x-[18px]":"translate-x-[3px]")})})}function p({label:s,hint:t,control:e}){return a.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:s}),t?a.jsx("div",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:t}):null]}),a.jsx("div",{className:"shrink-0",children:e})]})}function N({title:s,subtitle:t,action:e,children:i}){return a.jsxs(y,{children:[a.jsxs("div",{className:"mb-3 flex items-start justify-between gap-4",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h2",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:s}),t?a.jsx("p",{className:"mt-1 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:t}):null]}),e?a.jsx("div",{className:"shrink-0",children:e}):null]}),a.jsx("div",{className:"-mb-3 divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:i})]})}function w({options:s,value:t,onChange:e}){return a.jsx("div",{className:"inline-flex items-center rounded-lg border border-oai-gray-200 bg-oai-gray-50 p-0.5 dark:border-oai-gray-800 dark:bg-oai-gray-900",children:s.map(({value:i,label:d,Icon:l})=>{const r=t===i;return a.jsxs("button",{type:"button",onClick:()=>e(i),"aria-pressed":r,className:x("inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors",r?"bg-white text-oai-black shadow-sm dark:bg-oai-gray-800 dark:text-white":"text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:[l?a.jsx(l,{className:"h-3.5 w-3.5","aria-hidden":!0}):null,a.jsx("span",{children:d})]},i)})})}function S(){const[s,t]=n.useState(null),e=g()&&m();n.useEffect(()=>{if(!e)return;const r=b(o=>t(o));return u(),r},[e]);const i=n.useCallback((r,o)=>{e&&(t(c=>c&&{...c,[r]:o}),f(r,o))},[e]),d=n.useCallback(r=>{e&&h(r)},[e]),l=n.useCallback(()=>{e&&u()},[e]);return{available:e,settings:s,setSetting:i,runAction:d,refresh:l}}export{N as S,k as T,p as a,w as b,S as u};
@@ -1 +1 @@
1
- import{r as a,ab as w,aI as c}from"./main-D2iJg7iA.js";function v(i){const o=!!i?.initialState,[b,l]=a.useState(()=>o?i?.initialState?.data??null:null),[m,s]=a.useState(()=>o?i?.initialState?.error??null:null),[y,g]=a.useState(!o),u=!!i?.initialRefresh,f=!!i?.publishToPreloadCache,r=a.useCallback((e,t)=>{!f||!e||typeof e!="object"||w(e,{source:t})},[f]),S=a.useCallback(async()=>{try{const e=await c({refresh:!0}),t=e&&typeof e=="object"?e:null;l(t),s(null),r(t,"manual-refresh")}catch(e){s(e?.message||String(e))}},[r]),d=a.useCallback(async()=>{try{const e=await c(),t=e&&typeof e=="object"?e:null;l(t),s(null),r(t,"page-load")}catch(e){s(e?.message||String(e))}},[r]);return a.useEffect(()=>{if(typeof window>"u"||typeof document>"u")return;const e=15e3;let t=Date.now();const n=()=>{if(document.visibilityState!=="visible")return;const h=Date.now();h-t<e||(t=h,d())};return window.addEventListener("focus",n),document.addEventListener("visibilitychange",n),()=>{window.removeEventListener("focus",n),document.removeEventListener("visibilitychange",n)}},[d]),a.useEffect(()=>{if(o&&!u)return;let e=!1;return(async()=>{try{const t=await c();if(e)return;const n=t&&typeof t=="object"?t:null;l(n),s(null),r(n,"page-load")}catch(t){if(e)return;s(t?.message||String(t))}finally{e||g(!1)}})(),()=>{e=!0}},[o,u,r]),{data:b,error:m,isLoading:y,refresh:S}}export{v as u};
1
+ import{r as a,ab as w,aI as c}from"./main-4M5oNV2-.js";function v(i){const o=!!i?.initialState,[b,l]=a.useState(()=>o?i?.initialState?.data??null:null),[m,s]=a.useState(()=>o?i?.initialState?.error??null:null),[y,g]=a.useState(!o),u=!!i?.initialRefresh,f=!!i?.publishToPreloadCache,r=a.useCallback((e,t)=>{!f||!e||typeof e!="object"||w(e,{source:t})},[f]),S=a.useCallback(async()=>{try{const e=await c({refresh:!0}),t=e&&typeof e=="object"?e:null;l(t),s(null),r(t,"manual-refresh")}catch(e){s(e?.message||String(e))}},[r]),d=a.useCallback(async()=>{try{const e=await c(),t=e&&typeof e=="object"?e:null;l(t),s(null),r(t,"page-load")}catch(e){s(e?.message||String(e))}},[r]);return a.useEffect(()=>{if(typeof window>"u"||typeof document>"u")return;const e=15e3;let t=Date.now();const n=()=>{if(document.visibilityState!=="visible")return;const h=Date.now();h-t<e||(t=h,d())};return window.addEventListener("focus",n),document.addEventListener("visibilitychange",n),()=>{window.removeEventListener("focus",n),document.removeEventListener("visibilitychange",n)}},[d]),a.useEffect(()=>{if(o&&!u)return;let e=!1;return(async()=>{try{const t=await c();if(e)return;const n=t&&typeof t=="object"?t:null;l(n),s(null),r(n,"page-load")}catch(t){if(e)return;s(t?.message||String(t))}finally{e||g(!1)}})(),()=>{e=!0}},[o,u,r]),{data:b,error:m,isLoading:y,refresh:S}}export{v as u};
@@ -1 +1 @@
1
- import{r as e,c1 as t,c2 as r,K as c}from"./main-D2iJg7iA.js";const s=Object.freeze({currency:c,rate:1,symbol:"$",rates:{...r},rateSource:"default",rateFetchedAt:null,setCurrency:()=>{}});function a(){return e.useContext(t)??s}export{a as u};
1
+ import{r as e,c1 as t,c2 as r,K as c}from"./main-4M5oNV2-.js";const s=Object.freeze({currency:c,rate:1,symbol:"$",rates:{...r},rateSource:"default",rateFetchedAt:null,setCurrency:()=>{}});function a(){return e.useContext(t)??s}export{a as u};
@@ -1 +1 @@
1
- import{c as _t,b5 as St,b3 as G,b6 as Tt,bD as D,d9 as vt,cz as Ot,j as Te,cF as ze,r as f,bB as U,cH as ot,da as Bt,b7 as ct,bA as Ae,c5 as Gt,cG as it,db as wt,bF as x,bE as xe,c0 as Ee,dc as $e,dd as le,cL as ae,bJ as C,bK as Kt,d3 as Ct,cX as Dt,cY as Xt,d6 as xt,c6 as Vt,bX as ut,bS as lt,bU as Ut,de as $t,cM as qt,bG as Re,bW as jt,c_ as zt,b as Me,bP as Jt,df as Je,ba as We,dg as Qt,dh as He,bM as Zt,di as en,bz as Ne,bN as tn,cE as nn,bC as Ce,cv as _e,cu as rn,dj as sn,cs as on,bL as cn,dk as un,bQ as Se,dl as ye,be as ln,b9 as Be,dm as an,dn as at,d0 as fn,cA as Qe}from"./main-D2iJg7iA.js";const dn=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],jn=_t("check",dn);function Ie(e,t,n=!0){return e.filter(s=>s.parentId===t).flatMap(s=>[...!n||s.context?.open?[s]:[],...Ie(e,s.id,n)])}function ft(e,t){let n=[],r=e.find(s=>s.id===t)?.parentId;for(;r;){const s=e.find(c=>c.id===r);r=s?.parentId,s&&(n=n.concat(s))}return n}function Ge(e){const t=St(pn,e).current;return t.next=e,G(t.effect),t}function pn(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}let Fe=0;function Ke(e,t={}){const{preventScroll:n=!1,sync:r=!1,shouldFocus:s}=t;cancelAnimationFrame(Fe);function c(){s&&!s()||e?.focus({preventScroll:n})}if(r)return c(),Tt;const o=requestAnimationFrame(c);return Fe=o,()=>{Fe===o&&(cancelAnimationFrame(o),Fe=0)}}const De={inert:new WeakMap,"aria-hidden":new WeakMap},dt="data-base-ui-inert",qe={inert:new WeakSet,"aria-hidden":new WeakSet};let we=new WeakMap,Xe=0;function gn(e){return qe[e]}function It(e){return e?vt(e)?e.host:It(e.parentNode):null}const Ve=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=It(n);return e.contains(r)?r:null}).filter(n=>n!=null),pt=e=>{const t=new Set;return e.forEach(n=>{let r=n;for(;r&&!t.has(r);)t.add(r),r=r.parentNode}),t},gt=(e,t,n)=>{const r=[],s=c=>{!c||n.has(c)||Array.from(c.children).forEach(o=>{Ot(o)!=="script"&&(t.has(o)?s(o):r.push(o))})};return s(e),r};function hn(e,t,n,r,{mark:s=!0,markerIgnoreElements:c=[]}){const o=r?"inert":n?"aria-hidden":null;let u=null,v=null;const M=Ve(t,e),O=s?Ve(t,c):[],A=new Set(O),z=s?gt(t,pt(M),new Set(M)).filter(m=>!A.has(m)):[],w=[],k=[];if(o){const m=De[o],y=gn(o);v=y,u=m;const b=Ve(t,Array.from(t.querySelectorAll("[aria-live]"))),E=M.concat(b);gt(t,pt(E),new Set(E)).forEach(N=>{const Y=N.getAttribute(o),J=Y!==null&&Y!=="false",I=(m.get(N)||0)+1;m.set(N,I),w.push(N),I===1&&J&&y.add(N),J||N.setAttribute(o,o==="inert"?"":"true")})}return s&&z.forEach(m=>{const y=(we.get(m)||0)+1;we.set(m,y),k.push(m),y===1&&m.setAttribute(dt,"")}),Xe+=1,()=>{u&&w.forEach(m=>{const b=(u.get(m)||0)-1;u.set(m,b),b||(!v?.has(m)&&o&&m.removeAttribute(o),v?.delete(m))}),s&&k.forEach(m=>{const y=(we.get(m)||0)-1;we.set(m,y),y||m.removeAttribute(dt)}),Xe-=1,Xe||(De.inert=new WeakMap,De["aria-hidden"]=new WeakMap,qe.inert=new WeakSet,qe["aria-hidden"]=new WeakSet,we=new WeakMap)}}function ht(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:s=!0,markerIgnoreElements:c=[]}=t,o=D(e[0]).body;return hn(e,o,n,r,{mark:s,markerIgnoreElements:c})}function kt(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(r=>r(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}class mn{nodesRef={current:[]};events=kt();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(r=>r===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const Pt=f.createContext(null),Ft=f.createContext(null),Ze=()=>f.useContext(Pt)?.id||null,et=e=>{const t=f.useContext(Ft);return e??t};function zn(e){const t=ze(),n=et(e),r=Ze();return G(()=>{if(!t)return;const s={id:t,parentId:r};return n?.addNode(s),()=>{n?.removeNode(s)}},[n,t,r]),t}function Jn(e){const{children:t,id:n}=e,r=Ze();return Te.jsx(Pt.Provider,{value:f.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Qn(e){const{children:t,externalTree:n}=e,r=St(()=>n??new mn).current;return Te.jsx(Ft.Provider,{value:r,children:t})}function bn(e,t){const n=We(Re(e));return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const mt=20;let fe=[];function tt(){fe=fe.filter(e=>e.deref()?.isConnected)}function En(e){tt(),e&&Ot(e)!=="body"&&(fe.push(new WeakRef(e)),fe.length>mt&&(fe=fe.slice(-mt)))}function Ue(){return tt(),fe[fe.length-1]?.deref()}function yn(e){return e?Je(e)?e:wt(e)[0]||e:null}function bt(e,t){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const r=Qt(e).filter(c=>{const o=c.getAttribute("data-tabindex")||"";return Je(c)||c.hasAttribute("data-tabindex")&&!o.startsWith("-")}),s=e.getAttribute("tabindex");t.current.includes("floating")||r.length===0?s!=="0"&&e.setAttribute("tabindex","0"):(s!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Zn(e){const{context:t,children:n,disabled:r=!1,initialFocus:s=!0,returnFocus:c=!0,restoreFocus:o=!1,modal:u=!0,closeOnFocusOut:v=!0,openInteractionType:M="",nextFocusableElement:O,previousFocusableElement:A,beforeContentFocusGuardRef:z,externalTree:w,getInsideElements:k}=e,m="rootStore"in t?t.rootStore:t,y=m.useState("open"),b=m.useState("domReferenceElement"),E=m.useState("floatingElement"),{events:Z,dataRef:N}=m.context,Y=U(()=>N.current.floatingContext?.nodeId),J=s===!1,I=ot(b)&&J,ee=f.useRef(["content"]),se=Ge(s),P=Ge(c),ie=Ge(M),j=et(w),p=Bt(),$=f.useRef(!1),Q=f.useRef(!1),de=f.useRef(!1),oe=f.useRef(null),te=f.useRef(""),pe=f.useRef(""),ge=f.useRef(null),he=f.useRef(null),ke=ct(ge,z,p?.beforeInsideRef),R=ct(he,p?.afterInsideRef),q=Ae(),ce=Ae(),me=Gt(),Pe=p!=null,g=it(E),K=U((a=g)=>a?wt(a):[]),ne=U(()=>k?.().filter(a=>a!=null)??[]);f.useEffect(()=>{if(r||!u)return;function a(H){H.key==="Tab"&&C(g,ae(D(g)))&&K().length===0&&!I&&qt(H)}const W=D(g);return x(W,"keydown",a)},[r,g,u,I,K]),f.useEffect(()=>{if(r||!y)return;const a=D(g);function W(){de.current=!1}function H(S){const h=Re(S),F=ne(),d=C(E,h)||C(b,h)||C(p?.portalNode,h)||F.some(_=>_===h||C(_,h));de.current=!d,pe.current=S.pointerType||"keyboard",h?.closest(`[${jt}]`)&&(Q.current=!0)}function L(){pe.current="keyboard"}return xe(x(a,"pointerdown",H,!0),x(a,"pointerup",W,!0),x(a,"pointercancel",W,!0),x(a,"keydown",L,!0))},[r,E,b,g,y,p,ne]),f.useEffect(()=>{if(r||!v)return;const a=D(g);function W(){Q.current=!0,ce.start(0,()=>{Q.current=!1})}function H(F){const d=Re(F);Je(d)&&(oe.current=d)}function L(F){const d=F.relatedTarget,_=F.currentTarget,X=Re(F);queueMicrotask(()=>{const be=Y(),V=m.context.triggerElements,Le=ne(),i=d?.hasAttribute($e("focus-guard"))&&[ge.current,he.current,p?.beforeInsideRef.current,p?.afterInsideRef.current,p?.beforeOutsideRef.current,p?.afterOutsideRef.current,le(A),le(O)].includes(d),l=!(C(b,d)||C(E,d)||C(d,E)||C(p?.portalNode,d)||Le.some(T=>T===d||C(T,d))||d!=null&&V.hasElement(d)||V.hasMatchingElement(T=>C(T,d))||i||j&&(Ie(j.nodesRef.current,be).find(T=>C(T.context?.elements.floating,d)||C(T.context?.elements.domReference,d))||ft(j.nodesRef.current,be).find(T=>[T.context?.elements.floating,it(T.context?.elements.floating)].includes(d)||T.context?.elements.domReference===d)));if(_===b&&g&&bt(g,ee),o&&_!==b&&!zt(X)&&ae(a)===a.body){if(Ee(g)&&(g.focus(),o==="popup")){me.request(()=>{g.focus()});return}const T=K(),B=oe.current,ue=(B&&T.includes(B)?B:null)||T[T.length-1]||g;Ee(ue)&&ue.focus()}if(N.current.insideReactTree){N.current.insideReactTree=!1;return}(I||!u)&&d&&l&&!Q.current&&(I||d!==Ue())&&($.current=!0,m.setOpen(!1,Me(Jt,F)))})}function S(){de.current||(N.current.insideReactTree=!0,q.start(0,()=>{N.current.insideReactTree=!1}))}const h=Ee(b)?b:null;if(!(!E&&!h))return xe(h&&x(h,"focusout",L),h&&x(h,"pointerdown",W),E&&x(E,"focusin",H),E&&x(E,"focusout",L),E&&p&&x(E,"focusout",S,!0))},[r,b,E,g,u,j,p,m,v,o,K,I,Y,ee,N,q,ce,me,O,A,ne]),f.useEffect(()=>{if(r||!E||!y)return;const a=Array.from(p?.portalNode?.querySelectorAll(`[${$e("portal")}]`)||[]),H=(j?ft(j.nodesRef.current,Y()):[]).find(_=>ot(_.context?.elements.domReference||null))?.context?.elements.domReference,S=[...[E,...a,ge.current,he.current,p?.beforeOutsideRef.current,p?.afterOutsideRef.current,...ne()],H,le(A),le(O),I?b:null].filter(_=>_!=null),h=ht(S,{ariaHidden:u||I,mark:!1}),F=[E,...a].filter(_=>_!=null),d=ht(F);return()=>{d(),h()}},[y,r,b,E,u,p,I,j,Y,O,A,ne]),G(()=>{if(!y||r||!Ee(g))return;const a=D(g),W=ae(a);queueMicrotask(()=>{const H=se.current,L=typeof H=="function"?H(ie.current||""):H;if(L===void 0||L===!1||C(g,W))return;let h=null;const F=()=>(h==null&&(h=K(g)),h[0]||g);let d;L===!0||L===null?d=F():d=le(L),d=d||F();const _=C(g,ae(a));Ke(d,{preventScroll:d===g,shouldFocus(){if(_)return!0;const X=ae(a);return!(X!==d&&C(g,X))}})})},[r,y,g,K,se,ie]),G(()=>{if(r||!g)return;const a=D(g),W=ae(a);En(W);function H(S){if(S.open||(te.current=bn(S.nativeEvent,pe.current)),S.reason===Kt&&S.nativeEvent.type==="mouseleave"&&($.current=!0),S.reason===Ct)if(S.nested)$.current=!1;else if(Dt(S.nativeEvent)||Xt(S.nativeEvent))$.current=!1;else{let h=!1;D(g).createElement("div").focus({get preventScroll(){return h=!0,!1}}),h?$.current=!1:$.current=!0}}Z.on("openchange",H);function L(){const S=P.current;let h=typeof S=="function"?S(te.current):S;if(h===void 0||h===!1)return null;if(h===null&&(h=!0),typeof h=="boolean")return b?.isConnected?b:Ue()||null;const F=b?.isConnected?b:Ue();return le(h)||F||null}return()=>{Z.off("openchange",H);const S=ae(a),h=ne(),F=C(E,S)||h.some(X=>X===S||C(X,S))||j&&Ie(j.nodesRef.current,Y(),!1).some(X=>C(X.context?.elements.floating,S)),d=P.current,_=L();queueMicrotask(()=>{const X=yn(_),be=typeof d!="boolean";d&&!$.current&&Ee(X)&&(!(!be&&X!==S&&S!==a.body)||F)&&X.focus({preventScroll:!0}),$.current=!1})}},[r,E,g,P,Z,j,b,Y,ne]),G(()=>{if(!xt||y||!E)return;const a=ae(D(E));!Ee(a)||!Vt(a)||C(E,a)&&a.blur()},[y,E]),G(()=>{if(!(r||!p))return p.setFocusManagerState({modal:u,closeOnFocusOut:v,open:y,onOpenChange:m.setOpen,domReference:b}),()=>{p.setFocusManagerState(null)}},[r,p,u,y,m,v,b]),G(()=>{if(!(r||!g))return bt(g,ee),()=>{queueMicrotask(tt)}},[r,g,ee]);const ve=!r&&(u?!I:!0)&&(Pe||u);return Te.jsxs(f.Fragment,{children:[ve&&Te.jsx(ut,{"data-type":"inside",ref:ke,onFocus:a=>{if(u){const W=K();Ke(W[W.length-1])}else p?.portalNode&&($.current=!1,lt(a,p.portalNode)?Ut(b)?.focus():le(A??p.beforeOutsideRef)?.focus())}}),n,ve&&Te.jsx(ut,{"data-type":"inside",ref:R,onFocus:a=>{u?Ke(K()[0]):p?.portalNode&&(v&&($.current=!0),lt(a,p.portalNode)?$t(b)?.focus():le(O??p.afterOutsideRef)?.focus())}})]})}const Rn={intentional:"onClick",sloppy:"onPointerDown"};function Sn(){return!1}function Tn(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function er(e,t={}){const{enabled:n=!0,escapeKey:r=!0,outsidePress:s=!0,outsidePressEvent:c="sloppy",referencePress:o=Sn,referencePressEvent:u="sloppy",bubbles:v,externalTree:M}=t,O="rootStore"in e?e.rootStore:e,A=O.useState("open"),z=O.useState("floatingElement"),{dataRef:w}=O.context,k=et(M),m=U(typeof s=="function"?s:()=>!1),y=typeof s=="function"?m:s,b=y!==!1,E=U(()=>c),{escapeKey:Z,outsidePress:N}=Tn(v),Y=f.useRef(!1),J=f.useRef(!1),I=f.useRef(!1),ee=f.useRef(!1),se=f.useRef(""),P=f.useRef(null),ie=Ae(),j=Ae(),p=U(()=>{j.clear(),w.current.insideReactTree=!1}),$=U(R=>{const q=w.current.floatingContext?.nodeId;return(k?Ie(k.nodesRef.current,q):[]).some(me=>me.context?.open&&!me.context.dataRef.current[R])}),Q=U(R=>He(R,O.select("floatingElement"))||He(R,O.select("domReferenceElement"))),de=U(R=>{o()&&O.setOpen(!1,Me(Zt,R.nativeEvent))}),oe=U(R=>{if(!A||!n||!r||R.key!=="Escape"||ee.current||!Z&&$("__escapeKeyBubbles"))return;const q=en(R)?R.nativeEvent:R,ce=Me(tn,q);O.setOpen(!1,ce),ce.isCanceled||R.preventDefault(),!Z&&!ce.isPropagationAllowed&&R.stopPropagation()}),te=U(()=>{w.current.insideReactTree=!0,j.start(0,p)}),pe=U(R=>{if(!A||!n||R.button!==0)return;const q=Re(R.nativeEvent);C(O.select("floatingElement"),q)&&(Y.current||(Y.current=!0,J.current=!1))}),ge=U(R=>{!A||!n||(R.defaultPrevented||R.nativeEvent.defaultPrevented)&&Y.current&&(J.current=!0)});f.useEffect(()=>{if(!A||!n)return;w.current.__escapeKeyBubbles=Z,w.current.__outsidePressBubbles=N;const R=new Ne,q=new Ne;function ce(){R.clear(),ee.current=!0}function me(){R.start(nn()?5:0,()=>{ee.current=!1})}function Pe(){I.current=!0,q.start(0,()=>{I.current=!1})}function g(){Y.current=!1,J.current=!1}function K(){const i=se.current,l=i==="pen"||!i?"mouse":i,T=E(),B=typeof T=="function"?T():T;return typeof B=="string"?B:B[l]}function ne(i){const l=K();return l==="intentional"&&i.type!=="click"||l==="sloppy"&&i.type==="click"}function ve(i){const l=w.current.floatingContext?.nodeId,T=k&&Ie(k.nodesRef.current,l).some(B=>He(i,B.context?.elements.floating));return Q(i)||T}function a(i){if(ne(i)){i.type!=="click"&&!Q(i)&&(q.clear(),I.current=!1),p();return}if(w.current.insideReactTree){p();return}const l=Re(i),T=`[${$e("inert")}]`,B=Ce(l)?l.getRootNode():null,ue=Array.from((vt(B)?B:D(O.select("floatingElement"))).querySelectorAll(T)),rt=O.context.triggerElements;if(l&&(rt.hasElement(l)||rt.hasMatchingElement(re=>C(re,l))))return;let Oe=Ce(l)?l:null;for(;Oe&&!_e(Oe);){const re=rn(Oe);if(_e(re)||!Ce(re))break;Oe=re}if(!(ue.length&&Ce(l)&&!sn(l)&&!C(l,O.select("floatingElement"))&&ue.every(re=>!C(Oe,re)))){if(Ee(l)&&!("touches"in i)){const re=_e(l),Ye=on(l),st=/auto|scroll/,Mt=re||st.test(Ye.overflowX),At=re||st.test(Ye.overflowY),Nt=Mt&&l.clientWidth>0&&l.scrollWidth>l.clientWidth,Wt=At&&l.clientHeight>0&&l.scrollHeight>l.clientHeight,Lt=Ye.direction==="rtl",Yt=Wt&&(Lt?i.offsetX<=l.offsetWidth-l.clientWidth:i.offsetX>l.clientWidth),Ht=Nt&&i.offsetY>l.clientHeight;if(Yt||Ht)return}if(!ve(i)){if(K()==="intentional"&&I.current){q.clear(),I.current=!1;return}typeof y=="function"&&!y(i)||$("__outsidePressBubbles")||(O.setOpen(!1,Me(Ct,i)),p())}}}function W(i){K()!=="sloppy"||i.pointerType==="touch"||!O.select("open")||!n||Q(i)||a(i)}function H(i){if(K()!=="sloppy"||!O.select("open")||!n||Q(i))return;const l=i.touches[0];l&&(P.current={startTime:Date.now(),startX:l.clientX,startY:l.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},ie.start(1e3,()=>{P.current&&(P.current.dismissOnTouchEnd=!1,P.current.dismissOnMouseDown=!1)}))}function L(i,l){const T=Re(i);if(!T)return;const B=x(T,i.type,()=>{l(i),B()})}function S(i){se.current="touch",L(i,H)}function h(i){ie.clear(),i.type==="pointerdown"&&(se.current=i.pointerType),!(i.type==="mousedown"&&P.current&&!P.current.dismissOnMouseDown)&&L(i,l=>{l.type==="pointerdown"?W(l):a(l)})}function F(i){if(!Y.current)return;const l=J.current;if(g(),K()==="intentional"){if(i.type==="pointercancel"){l&&Pe();return}if(!ve(i)){if(l){Pe();return}typeof y=="function"&&!y(i)||(q.clear(),I.current=!0,p())}}}function d(i){if(K()!=="sloppy"||!P.current||Q(i))return;const l=i.touches[0];if(!l)return;const T=Math.abs(l.clientX-P.current.startX),B=Math.abs(l.clientY-P.current.startY),ue=Math.sqrt(T*T+B*B);ue>5&&(P.current.dismissOnTouchEnd=!0),ue>10&&(a(i),ie.clear(),P.current=null)}function _(i){L(i,d)}function X(i){K()!=="sloppy"||!P.current||Q(i)||(P.current.dismissOnTouchEnd&&a(i),ie.clear(),P.current=null)}function be(i){L(i,X)}const V=D(z),Le=xe(r&&xe(x(V,"keydown",oe),x(V,"compositionstart",ce),x(V,"compositionend",me)),b&&xe(x(V,"click",h,!0),x(V,"pointerdown",h,!0),x(V,"pointerup",F,!0),x(V,"pointercancel",F,!0),x(V,"mousedown",h,!0),x(V,"mouseup",F,!0),x(V,"touchstart",S,!0),x(V,"touchmove",_,!0),x(V,"touchend",be,!0)));return()=>{Le(),R.clear(),q.clear(),g(),I.current=!1}},[w,z,r,b,y,A,n,Z,N,oe,p,E,$,Q,k,O,ie]),f.useEffect(p,[y,p]);const he=f.useMemo(()=>({onKeyDown:oe,[Rn[u]]:de,...u!=="intentional"&&{onClick:de}}),[oe,de,u]),ke=f.useMemo(()=>({onKeyDown:oe,onPointerDown:ge,onMouseDown:ge,onClickCapture:te,onMouseDownCapture(R){te(),pe(R)},onPointerDownCapture(R){te(),pe(R)},onMouseUpCapture:te,onTouchEndCapture:te,onTouchMoveCapture:te}),[oe,te,pe,ge]);return f.useMemo(()=>n?{reference:he,floating:ke,trigger:he}:{},[n,he,ke])}const vn={open:Se(e=>e.open),transitionStatus:Se(e=>e.transitionStatus),domReferenceElement:Se(e=>e.domReferenceElement),referenceElement:Se(e=>e.positionReference??e.referenceElement),floatingElement:Se(e=>e.floatingElement),floatingId:Se(e=>e.floatingId)};class On extends cn{constructor(t){const{syncOnly:n,nested:r,onOpenChange:s,triggerElements:c,...o}=t;super({...o,positionReference:o.referenceElement,domReferenceElement:o.referenceElement},{onOpenChange:s,dataRef:{current:{}},events:kt(),nested:r,triggerElements:c},vn),this.syncOnly=n}syncOpenEvent=(t,n)=>{(!t||!this.state.open||n!=null&&un(n))&&(this.context.dataRef.current.openEvent=t?n:void 0)};dispatchOpenChange=(t,n)=>{this.syncOpenEvent(t,n.event);const r={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",r)};setOpen=(t,n)=>{if(this.syncOnly){this.context.onOpenChange?.(t,n);return}this.dispatchOpenChange(t,n),this.context.onOpenChange?.(t,n)}}function wn(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:s,nested:c,onOpenChange:o}=e,u=t.useState("open"),v=t.useState("activeTriggerElement"),M=t.useState(n?"popupElement":"positionerElement"),O=t.context.triggerElements,A=o,z=f.useRef(null);r===void 0&&z.current===null&&(z.current=new On({open:u,transitionStatus:void 0,referenceElement:v,floatingElement:M,triggerElements:O,onOpenChange:A,floatingId:s,syncOnly:!0,nested:c}));const w=r??z.current;return t.useSyncedValue("floatingId",s),G(()=>{const k={open:u,floatingId:s,referenceElement:v,floatingElement:M};Ce(v)&&(k.domReferenceElement=v),w.state.positionReference===w.state.referenceElement&&(k.positionReference=v),w.update(k)},[u,s,v,M,w]),w.context.onOpenChange=A,w.context.nested=c,w}function Cn(e,t=!1,n=!1){const[r,s]=f.useState(e&&t?"idle":void 0),[c,o]=f.useState(e);return e&&!c&&(o(!0),s("starting")),!e&&c&&r!=="ending"&&!n&&s("ending"),!e&&!c&&r==="ending"&&s(void 0),G(()=>{if(!e&&c&&r!=="ending"&&n){const u=ye.request(()=>{s("ending")});return()=>{ye.cancel(u)}}},[e,c,r,n]),G(()=>{if(!e||t)return;const u=ye.request(()=>{s(void 0)});return()=>{ye.cancel(u)}},[t,e]),G(()=>{if(!e||!t)return;e&&c&&r!=="idle"&&s("starting");const u=ye.request(()=>{s("idle")});return()=>{ye.cancel(u)}},[t,e,c,r]),{mounted:c,setMounted:o,transitionStatus:r}}const tr={tabIndex:-1,[an]:""};function nr(e,t,n=!1){const r=ze(),s=Ze()!=null,c=f.useRef(null);e===void 0&&c.current===null&&(c.current=t(r,s));const o=e??c.current;return wn({popupStore:o,treatPopupAsFloatingElement:n,floatingRootContext:o.state.floatingRootContext,floatingId:r,nested:s,onOpenChange:o.setOpen}),{store:o,internalStore:c.current}}function xn(e,t){const n=f.useRef(null),r=f.useRef(null);return f.useCallback(s=>{if(e===void 0)return;let c=!1;if(n.current!==null){const o=n.current,u=r.current,v=t.context.triggerElements.getById(o);u&&v===u&&(t.context.triggerElements.delete(o),c=!0),n.current=null,r.current=null}if(s!==null&&(n.current=e,r.current=s,t.context.triggerElements.add(e,s),c=!0),c){const o=t.context.triggerElements.size;t.select("open")&&t.state.triggerCount!==o&&t.set("triggerCount",o)}},[t,e])}function rr(e,t,n){const r=n?.id??null;(r||t)&&(e.activeTriggerId=r,e.activeTriggerElement=n??null)}function sr(e,t,n,r){const s=n.useState("isMountedByTrigger",e),c=xn(e,n),o=U(u=>{if(c(u),!u)return;const v=n.select("open"),M=n.select("activeTriggerId");if(M===e){n.update({activeTriggerElement:u,...v?r:null});return}M==null&&v&&n.update({activeTriggerId:e,activeTriggerElement:u,...r})});return G(()=>{s&&n.update({activeTriggerElement:t.current,...r})},[s,n,t,...Object.values(r)]),{registerTrigger:o,isMountedByThisTrigger:s}}function or(e){const t=e.useState("open"),n=e.useState("triggerCount");G(()=>{if(!t){e.state.triggerCount!==0&&e.set("triggerCount",0);return}const r=e.context.triggerElements.size,s={};if(e.state.triggerCount!==r&&(s.triggerCount=r),!e.select("activeTriggerId")&&r===1){const c=e.context.triggerElements.entries().next();if(!c.done){const[o,u]=c.value;s.activeTriggerId=o,s.activeTriggerElement=u}}(s.triggerCount!==void 0||s.activeTriggerId!==void 0)&&e.update(s)},[t,e,n])}function cr(e,t,n){const{mounted:r,setMounted:s,transitionStatus:c}=Cn(e);t.useSyncedValues({mounted:r,transitionStatus:c});const o=U(()=>{s(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}),u=t.useState("preventUnmountingOnClose");return ln({enabled:r&&!e&&!u,open:e,ref:t.context.popupRef,onComplete(){e||o()}}),{forceUnmount:o,transitionStatus:c}}function ir(e,t){e.useSyncedValues(t),G(()=>()=>{e.update({activeTriggerProps:Be,inactiveTriggerProps:Be,popupProps:Be})},[e])}function ur(e,t){G(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),G(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class lr{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(t,n){const r=this.idMap.get(t);r!==n&&(r!==void 0&&this.elementsSet.delete(r),this.elementsSet.add(n),this.idMap.set(t,n))}delete(t){const n=this.idMap.get(t);n&&(this.elementsSet.delete(n),this.idMap.delete(t))}hasElement(t){return this.elementsSet.has(t)}hasMatchingElement(t){for(const n of this.elementsSet)if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}let nt=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=at.startingStyle]="startingStyle",e[e.endingStyle=at.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({}),je=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const In={[je.popupOpen]:""},kn={[je.popupOpen]:"",[je.pressed]:""},Pn={[nt.open]:""},Fn={[nt.closed]:""},Mn={[nt.anchorHidden]:""},ar={open(e){return e?In:null}},fr={open(e){return e?kn:null}},dr={open(e){return e?Pn:Fn},anchorHidden(e){return e?Mn:null}};function pr(e){return ze(e,"base-ui")}const An="ArrowUp",Nn="ArrowDown",Wn="ArrowLeft",Ln="ArrowRight",Yn="Home",Hn="End",_n=new Set([Wn,Ln]),Bn=new Set([An,Nn]),Gn=new Set([..._n,...Bn]),gr=new Set([...Gn,Yn,Hn]),hr=f.forwardRef(function(t,n){const{cutout:r,...s}=t;let c;if(r){const o=r.getBoundingClientRect();c=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${o.left}px ${o.top}px,${o.left}px ${o.bottom}px,${o.right}px ${o.bottom}px,${o.right}px ${o.top}px,${o.left}px ${o.top}px)`}return Te.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...s,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:c}})});function mr(e){const t=f.useRef(!0);t.current&&(t.current=!1,e())}let Et={},yt={},Rt="";function Kn(e){if(typeof document>"u")return!1;const t=D(e);return We(t).innerWidth-t.documentElement.clientWidth>0}function Dn(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=D(e),r=n.documentElement,s=n.body,c=Qe(r)?r:s,o=c.style.overflowY,u=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",c.style.overflowY="scroll";const v=c.offsetWidth;c.style.overflowY="hidden";const M=c.offsetWidth;return c.style.overflowY=o,r.style.scrollbarGutter=u,v===M}function Xn(e){const t=D(e),n=t.documentElement,r=t.body,s=Qe(n)?n:r,c={overflowY:s.style.overflowY,overflowX:s.style.overflowX};return Object.assign(s.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(s.style,c)}}function Vn(e){const t=D(e),n=t.documentElement,r=t.body,s=We(n);let c=0,o=0,u=!1;const v=ye.create();if(xt&&(s.visualViewport?.scale??1)!==1)return()=>{};function M(){const w=s.getComputedStyle(n),k=s.getComputedStyle(r),b=(w.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";c=n.scrollTop,o=n.scrollLeft,Et={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Rt=n.style.scrollBehavior,yt={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const E=n.scrollHeight>n.clientHeight,Z=n.scrollWidth>n.clientWidth,N=w.overflowY==="scroll"||k.overflowY==="scroll",Y=w.overflowX==="scroll"||k.overflowX==="scroll",J=Math.max(0,s.innerWidth-r.clientWidth),I=Math.max(0,s.innerHeight-r.clientHeight),ee=parseFloat(k.marginTop)+parseFloat(k.marginBottom),se=parseFloat(k.marginLeft)+parseFloat(k.marginRight),P=Qe(n)?n:r;if(u=Dn(e),u){n.style.scrollbarGutter=b,P.style.overflowY="hidden",P.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:b,overflowY:"hidden",overflowX:"hidden"}),(E||N)&&(n.style.overflowY="scroll"),(Z||Y)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:ee||I?`calc(100dvh - ${ee+I}px)`:"100dvh",width:se||J?`calc(100vw - ${se+J}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=c,r.scrollLeft=o,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function O(){Object.assign(n.style,Et),Object.assign(r.style,yt),u||(n.scrollTop=c,n.scrollLeft=o,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=Rt)}function A(){O(),v.request(M)}M();const z=x(s,"resize",A);return()=>{v.cancel(),O(),typeof s.removeEventListener=="function"&&z()}}class Un{lockCount=0;restore=null;timeoutLock=Ne.create();timeoutUnlock=Ne.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const r=D(t).documentElement,s=We(r).getComputedStyle(r).overflowY;if(s==="hidden"||s==="clip"){this.restore=Tt;return}const c=fn||!Kn(t);this.restore=c?Xn(t):Vn(t)}}const $n=new Un;function br(e=!0,t=null){G(()=>{if(e)return $n.acquire(t)},[e,t])}export{nt as A,jn as C,Qn as F,hr as I,lr as P,Cn as a,et as b,Ze as c,Ge as d,nr as e,mr as f,Ie as g,ur as h,or as i,cr as j,er as k,tr as l,ir as m,sr as n,zn as o,fr as p,Jn as q,Zn as r,rr as s,ar as t,pr as u,gr as v,dr as w,On as x,Ke as y,br as z};
1
+ import{c as _t,b5 as St,b3 as G,b6 as Tt,bD as D,d9 as vt,cz as Ot,j as Te,cF as ze,r as f,bB as U,cH as ot,da as Bt,b7 as ct,bA as Ae,c5 as Gt,cG as it,db as wt,bF as x,bE as xe,c0 as Ee,dc as $e,dd as le,cL as ae,bJ as C,bK as Kt,d3 as Ct,cX as Dt,cY as Xt,d6 as xt,c6 as Vt,bX as ut,bS as lt,bU as Ut,de as $t,cM as qt,bG as Re,bW as jt,c_ as zt,b as Me,bP as Jt,df as Je,ba as We,dg as Qt,dh as He,bM as Zt,di as en,bz as Ne,bN as tn,cE as nn,bC as Ce,cv as _e,cu as rn,dj as sn,cs as on,bL as cn,dk as un,bQ as Se,dl as ye,be as ln,b9 as Be,dm as an,dn as at,d0 as fn,cA as Qe}from"./main-4M5oNV2-.js";const dn=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],jn=_t("check",dn);function Ie(e,t,n=!0){return e.filter(s=>s.parentId===t).flatMap(s=>[...!n||s.context?.open?[s]:[],...Ie(e,s.id,n)])}function ft(e,t){let n=[],r=e.find(s=>s.id===t)?.parentId;for(;r;){const s=e.find(c=>c.id===r);r=s?.parentId,s&&(n=n.concat(s))}return n}function Ge(e){const t=St(pn,e).current;return t.next=e,G(t.effect),t}function pn(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}let Fe=0;function Ke(e,t={}){const{preventScroll:n=!1,sync:r=!1,shouldFocus:s}=t;cancelAnimationFrame(Fe);function c(){s&&!s()||e?.focus({preventScroll:n})}if(r)return c(),Tt;const o=requestAnimationFrame(c);return Fe=o,()=>{Fe===o&&(cancelAnimationFrame(o),Fe=0)}}const De={inert:new WeakMap,"aria-hidden":new WeakMap},dt="data-base-ui-inert",qe={inert:new WeakSet,"aria-hidden":new WeakSet};let we=new WeakMap,Xe=0;function gn(e){return qe[e]}function It(e){return e?vt(e)?e.host:It(e.parentNode):null}const Ve=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=It(n);return e.contains(r)?r:null}).filter(n=>n!=null),pt=e=>{const t=new Set;return e.forEach(n=>{let r=n;for(;r&&!t.has(r);)t.add(r),r=r.parentNode}),t},gt=(e,t,n)=>{const r=[],s=c=>{!c||n.has(c)||Array.from(c.children).forEach(o=>{Ot(o)!=="script"&&(t.has(o)?s(o):r.push(o))})};return s(e),r};function hn(e,t,n,r,{mark:s=!0,markerIgnoreElements:c=[]}){const o=r?"inert":n?"aria-hidden":null;let u=null,v=null;const M=Ve(t,e),O=s?Ve(t,c):[],A=new Set(O),z=s?gt(t,pt(M),new Set(M)).filter(m=>!A.has(m)):[],w=[],k=[];if(o){const m=De[o],y=gn(o);v=y,u=m;const b=Ve(t,Array.from(t.querySelectorAll("[aria-live]"))),E=M.concat(b);gt(t,pt(E),new Set(E)).forEach(N=>{const Y=N.getAttribute(o),J=Y!==null&&Y!=="false",I=(m.get(N)||0)+1;m.set(N,I),w.push(N),I===1&&J&&y.add(N),J||N.setAttribute(o,o==="inert"?"":"true")})}return s&&z.forEach(m=>{const y=(we.get(m)||0)+1;we.set(m,y),k.push(m),y===1&&m.setAttribute(dt,"")}),Xe+=1,()=>{u&&w.forEach(m=>{const b=(u.get(m)||0)-1;u.set(m,b),b||(!v?.has(m)&&o&&m.removeAttribute(o),v?.delete(m))}),s&&k.forEach(m=>{const y=(we.get(m)||0)-1;we.set(m,y),y||m.removeAttribute(dt)}),Xe-=1,Xe||(De.inert=new WeakMap,De["aria-hidden"]=new WeakMap,qe.inert=new WeakSet,qe["aria-hidden"]=new WeakSet,we=new WeakMap)}}function ht(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:s=!0,markerIgnoreElements:c=[]}=t,o=D(e[0]).body;return hn(e,o,n,r,{mark:s,markerIgnoreElements:c})}function kt(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(r=>r(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}class mn{nodesRef={current:[]};events=kt();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(r=>r===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const Pt=f.createContext(null),Ft=f.createContext(null),Ze=()=>f.useContext(Pt)?.id||null,et=e=>{const t=f.useContext(Ft);return e??t};function zn(e){const t=ze(),n=et(e),r=Ze();return G(()=>{if(!t)return;const s={id:t,parentId:r};return n?.addNode(s),()=>{n?.removeNode(s)}},[n,t,r]),t}function Jn(e){const{children:t,id:n}=e,r=Ze();return Te.jsx(Pt.Provider,{value:f.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Qn(e){const{children:t,externalTree:n}=e,r=St(()=>n??new mn).current;return Te.jsx(Ft.Provider,{value:r,children:t})}function bn(e,t){const n=We(Re(e));return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const mt=20;let fe=[];function tt(){fe=fe.filter(e=>e.deref()?.isConnected)}function En(e){tt(),e&&Ot(e)!=="body"&&(fe.push(new WeakRef(e)),fe.length>mt&&(fe=fe.slice(-mt)))}function Ue(){return tt(),fe[fe.length-1]?.deref()}function yn(e){return e?Je(e)?e:wt(e)[0]||e:null}function bt(e,t){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const r=Qt(e).filter(c=>{const o=c.getAttribute("data-tabindex")||"";return Je(c)||c.hasAttribute("data-tabindex")&&!o.startsWith("-")}),s=e.getAttribute("tabindex");t.current.includes("floating")||r.length===0?s!=="0"&&e.setAttribute("tabindex","0"):(s!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Zn(e){const{context:t,children:n,disabled:r=!1,initialFocus:s=!0,returnFocus:c=!0,restoreFocus:o=!1,modal:u=!0,closeOnFocusOut:v=!0,openInteractionType:M="",nextFocusableElement:O,previousFocusableElement:A,beforeContentFocusGuardRef:z,externalTree:w,getInsideElements:k}=e,m="rootStore"in t?t.rootStore:t,y=m.useState("open"),b=m.useState("domReferenceElement"),E=m.useState("floatingElement"),{events:Z,dataRef:N}=m.context,Y=U(()=>N.current.floatingContext?.nodeId),J=s===!1,I=ot(b)&&J,ee=f.useRef(["content"]),se=Ge(s),P=Ge(c),ie=Ge(M),j=et(w),p=Bt(),$=f.useRef(!1),Q=f.useRef(!1),de=f.useRef(!1),oe=f.useRef(null),te=f.useRef(""),pe=f.useRef(""),ge=f.useRef(null),he=f.useRef(null),ke=ct(ge,z,p?.beforeInsideRef),R=ct(he,p?.afterInsideRef),q=Ae(),ce=Ae(),me=Gt(),Pe=p!=null,g=it(E),K=U((a=g)=>a?wt(a):[]),ne=U(()=>k?.().filter(a=>a!=null)??[]);f.useEffect(()=>{if(r||!u)return;function a(H){H.key==="Tab"&&C(g,ae(D(g)))&&K().length===0&&!I&&qt(H)}const W=D(g);return x(W,"keydown",a)},[r,g,u,I,K]),f.useEffect(()=>{if(r||!y)return;const a=D(g);function W(){de.current=!1}function H(S){const h=Re(S),F=ne(),d=C(E,h)||C(b,h)||C(p?.portalNode,h)||F.some(_=>_===h||C(_,h));de.current=!d,pe.current=S.pointerType||"keyboard",h?.closest(`[${jt}]`)&&(Q.current=!0)}function L(){pe.current="keyboard"}return xe(x(a,"pointerdown",H,!0),x(a,"pointerup",W,!0),x(a,"pointercancel",W,!0),x(a,"keydown",L,!0))},[r,E,b,g,y,p,ne]),f.useEffect(()=>{if(r||!v)return;const a=D(g);function W(){Q.current=!0,ce.start(0,()=>{Q.current=!1})}function H(F){const d=Re(F);Je(d)&&(oe.current=d)}function L(F){const d=F.relatedTarget,_=F.currentTarget,X=Re(F);queueMicrotask(()=>{const be=Y(),V=m.context.triggerElements,Le=ne(),i=d?.hasAttribute($e("focus-guard"))&&[ge.current,he.current,p?.beforeInsideRef.current,p?.afterInsideRef.current,p?.beforeOutsideRef.current,p?.afterOutsideRef.current,le(A),le(O)].includes(d),l=!(C(b,d)||C(E,d)||C(d,E)||C(p?.portalNode,d)||Le.some(T=>T===d||C(T,d))||d!=null&&V.hasElement(d)||V.hasMatchingElement(T=>C(T,d))||i||j&&(Ie(j.nodesRef.current,be).find(T=>C(T.context?.elements.floating,d)||C(T.context?.elements.domReference,d))||ft(j.nodesRef.current,be).find(T=>[T.context?.elements.floating,it(T.context?.elements.floating)].includes(d)||T.context?.elements.domReference===d)));if(_===b&&g&&bt(g,ee),o&&_!==b&&!zt(X)&&ae(a)===a.body){if(Ee(g)&&(g.focus(),o==="popup")){me.request(()=>{g.focus()});return}const T=K(),B=oe.current,ue=(B&&T.includes(B)?B:null)||T[T.length-1]||g;Ee(ue)&&ue.focus()}if(N.current.insideReactTree){N.current.insideReactTree=!1;return}(I||!u)&&d&&l&&!Q.current&&(I||d!==Ue())&&($.current=!0,m.setOpen(!1,Me(Jt,F)))})}function S(){de.current||(N.current.insideReactTree=!0,q.start(0,()=>{N.current.insideReactTree=!1}))}const h=Ee(b)?b:null;if(!(!E&&!h))return xe(h&&x(h,"focusout",L),h&&x(h,"pointerdown",W),E&&x(E,"focusin",H),E&&x(E,"focusout",L),E&&p&&x(E,"focusout",S,!0))},[r,b,E,g,u,j,p,m,v,o,K,I,Y,ee,N,q,ce,me,O,A,ne]),f.useEffect(()=>{if(r||!E||!y)return;const a=Array.from(p?.portalNode?.querySelectorAll(`[${$e("portal")}]`)||[]),H=(j?ft(j.nodesRef.current,Y()):[]).find(_=>ot(_.context?.elements.domReference||null))?.context?.elements.domReference,S=[...[E,...a,ge.current,he.current,p?.beforeOutsideRef.current,p?.afterOutsideRef.current,...ne()],H,le(A),le(O),I?b:null].filter(_=>_!=null),h=ht(S,{ariaHidden:u||I,mark:!1}),F=[E,...a].filter(_=>_!=null),d=ht(F);return()=>{d(),h()}},[y,r,b,E,u,p,I,j,Y,O,A,ne]),G(()=>{if(!y||r||!Ee(g))return;const a=D(g),W=ae(a);queueMicrotask(()=>{const H=se.current,L=typeof H=="function"?H(ie.current||""):H;if(L===void 0||L===!1||C(g,W))return;let h=null;const F=()=>(h==null&&(h=K(g)),h[0]||g);let d;L===!0||L===null?d=F():d=le(L),d=d||F();const _=C(g,ae(a));Ke(d,{preventScroll:d===g,shouldFocus(){if(_)return!0;const X=ae(a);return!(X!==d&&C(g,X))}})})},[r,y,g,K,se,ie]),G(()=>{if(r||!g)return;const a=D(g),W=ae(a);En(W);function H(S){if(S.open||(te.current=bn(S.nativeEvent,pe.current)),S.reason===Kt&&S.nativeEvent.type==="mouseleave"&&($.current=!0),S.reason===Ct)if(S.nested)$.current=!1;else if(Dt(S.nativeEvent)||Xt(S.nativeEvent))$.current=!1;else{let h=!1;D(g).createElement("div").focus({get preventScroll(){return h=!0,!1}}),h?$.current=!1:$.current=!0}}Z.on("openchange",H);function L(){const S=P.current;let h=typeof S=="function"?S(te.current):S;if(h===void 0||h===!1)return null;if(h===null&&(h=!0),typeof h=="boolean")return b?.isConnected?b:Ue()||null;const F=b?.isConnected?b:Ue();return le(h)||F||null}return()=>{Z.off("openchange",H);const S=ae(a),h=ne(),F=C(E,S)||h.some(X=>X===S||C(X,S))||j&&Ie(j.nodesRef.current,Y(),!1).some(X=>C(X.context?.elements.floating,S)),d=P.current,_=L();queueMicrotask(()=>{const X=yn(_),be=typeof d!="boolean";d&&!$.current&&Ee(X)&&(!(!be&&X!==S&&S!==a.body)||F)&&X.focus({preventScroll:!0}),$.current=!1})}},[r,E,g,P,Z,j,b,Y,ne]),G(()=>{if(!xt||y||!E)return;const a=ae(D(E));!Ee(a)||!Vt(a)||C(E,a)&&a.blur()},[y,E]),G(()=>{if(!(r||!p))return p.setFocusManagerState({modal:u,closeOnFocusOut:v,open:y,onOpenChange:m.setOpen,domReference:b}),()=>{p.setFocusManagerState(null)}},[r,p,u,y,m,v,b]),G(()=>{if(!(r||!g))return bt(g,ee),()=>{queueMicrotask(tt)}},[r,g,ee]);const ve=!r&&(u?!I:!0)&&(Pe||u);return Te.jsxs(f.Fragment,{children:[ve&&Te.jsx(ut,{"data-type":"inside",ref:ke,onFocus:a=>{if(u){const W=K();Ke(W[W.length-1])}else p?.portalNode&&($.current=!1,lt(a,p.portalNode)?Ut(b)?.focus():le(A??p.beforeOutsideRef)?.focus())}}),n,ve&&Te.jsx(ut,{"data-type":"inside",ref:R,onFocus:a=>{u?Ke(K()[0]):p?.portalNode&&(v&&($.current=!0),lt(a,p.portalNode)?$t(b)?.focus():le(O??p.afterOutsideRef)?.focus())}})]})}const Rn={intentional:"onClick",sloppy:"onPointerDown"};function Sn(){return!1}function Tn(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function er(e,t={}){const{enabled:n=!0,escapeKey:r=!0,outsidePress:s=!0,outsidePressEvent:c="sloppy",referencePress:o=Sn,referencePressEvent:u="sloppy",bubbles:v,externalTree:M}=t,O="rootStore"in e?e.rootStore:e,A=O.useState("open"),z=O.useState("floatingElement"),{dataRef:w}=O.context,k=et(M),m=U(typeof s=="function"?s:()=>!1),y=typeof s=="function"?m:s,b=y!==!1,E=U(()=>c),{escapeKey:Z,outsidePress:N}=Tn(v),Y=f.useRef(!1),J=f.useRef(!1),I=f.useRef(!1),ee=f.useRef(!1),se=f.useRef(""),P=f.useRef(null),ie=Ae(),j=Ae(),p=U(()=>{j.clear(),w.current.insideReactTree=!1}),$=U(R=>{const q=w.current.floatingContext?.nodeId;return(k?Ie(k.nodesRef.current,q):[]).some(me=>me.context?.open&&!me.context.dataRef.current[R])}),Q=U(R=>He(R,O.select("floatingElement"))||He(R,O.select("domReferenceElement"))),de=U(R=>{o()&&O.setOpen(!1,Me(Zt,R.nativeEvent))}),oe=U(R=>{if(!A||!n||!r||R.key!=="Escape"||ee.current||!Z&&$("__escapeKeyBubbles"))return;const q=en(R)?R.nativeEvent:R,ce=Me(tn,q);O.setOpen(!1,ce),ce.isCanceled||R.preventDefault(),!Z&&!ce.isPropagationAllowed&&R.stopPropagation()}),te=U(()=>{w.current.insideReactTree=!0,j.start(0,p)}),pe=U(R=>{if(!A||!n||R.button!==0)return;const q=Re(R.nativeEvent);C(O.select("floatingElement"),q)&&(Y.current||(Y.current=!0,J.current=!1))}),ge=U(R=>{!A||!n||(R.defaultPrevented||R.nativeEvent.defaultPrevented)&&Y.current&&(J.current=!0)});f.useEffect(()=>{if(!A||!n)return;w.current.__escapeKeyBubbles=Z,w.current.__outsidePressBubbles=N;const R=new Ne,q=new Ne;function ce(){R.clear(),ee.current=!0}function me(){R.start(nn()?5:0,()=>{ee.current=!1})}function Pe(){I.current=!0,q.start(0,()=>{I.current=!1})}function g(){Y.current=!1,J.current=!1}function K(){const i=se.current,l=i==="pen"||!i?"mouse":i,T=E(),B=typeof T=="function"?T():T;return typeof B=="string"?B:B[l]}function ne(i){const l=K();return l==="intentional"&&i.type!=="click"||l==="sloppy"&&i.type==="click"}function ve(i){const l=w.current.floatingContext?.nodeId,T=k&&Ie(k.nodesRef.current,l).some(B=>He(i,B.context?.elements.floating));return Q(i)||T}function a(i){if(ne(i)){i.type!=="click"&&!Q(i)&&(q.clear(),I.current=!1),p();return}if(w.current.insideReactTree){p();return}const l=Re(i),T=`[${$e("inert")}]`,B=Ce(l)?l.getRootNode():null,ue=Array.from((vt(B)?B:D(O.select("floatingElement"))).querySelectorAll(T)),rt=O.context.triggerElements;if(l&&(rt.hasElement(l)||rt.hasMatchingElement(re=>C(re,l))))return;let Oe=Ce(l)?l:null;for(;Oe&&!_e(Oe);){const re=rn(Oe);if(_e(re)||!Ce(re))break;Oe=re}if(!(ue.length&&Ce(l)&&!sn(l)&&!C(l,O.select("floatingElement"))&&ue.every(re=>!C(Oe,re)))){if(Ee(l)&&!("touches"in i)){const re=_e(l),Ye=on(l),st=/auto|scroll/,Mt=re||st.test(Ye.overflowX),At=re||st.test(Ye.overflowY),Nt=Mt&&l.clientWidth>0&&l.scrollWidth>l.clientWidth,Wt=At&&l.clientHeight>0&&l.scrollHeight>l.clientHeight,Lt=Ye.direction==="rtl",Yt=Wt&&(Lt?i.offsetX<=l.offsetWidth-l.clientWidth:i.offsetX>l.clientWidth),Ht=Nt&&i.offsetY>l.clientHeight;if(Yt||Ht)return}if(!ve(i)){if(K()==="intentional"&&I.current){q.clear(),I.current=!1;return}typeof y=="function"&&!y(i)||$("__outsidePressBubbles")||(O.setOpen(!1,Me(Ct,i)),p())}}}function W(i){K()!=="sloppy"||i.pointerType==="touch"||!O.select("open")||!n||Q(i)||a(i)}function H(i){if(K()!=="sloppy"||!O.select("open")||!n||Q(i))return;const l=i.touches[0];l&&(P.current={startTime:Date.now(),startX:l.clientX,startY:l.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},ie.start(1e3,()=>{P.current&&(P.current.dismissOnTouchEnd=!1,P.current.dismissOnMouseDown=!1)}))}function L(i,l){const T=Re(i);if(!T)return;const B=x(T,i.type,()=>{l(i),B()})}function S(i){se.current="touch",L(i,H)}function h(i){ie.clear(),i.type==="pointerdown"&&(se.current=i.pointerType),!(i.type==="mousedown"&&P.current&&!P.current.dismissOnMouseDown)&&L(i,l=>{l.type==="pointerdown"?W(l):a(l)})}function F(i){if(!Y.current)return;const l=J.current;if(g(),K()==="intentional"){if(i.type==="pointercancel"){l&&Pe();return}if(!ve(i)){if(l){Pe();return}typeof y=="function"&&!y(i)||(q.clear(),I.current=!0,p())}}}function d(i){if(K()!=="sloppy"||!P.current||Q(i))return;const l=i.touches[0];if(!l)return;const T=Math.abs(l.clientX-P.current.startX),B=Math.abs(l.clientY-P.current.startY),ue=Math.sqrt(T*T+B*B);ue>5&&(P.current.dismissOnTouchEnd=!0),ue>10&&(a(i),ie.clear(),P.current=null)}function _(i){L(i,d)}function X(i){K()!=="sloppy"||!P.current||Q(i)||(P.current.dismissOnTouchEnd&&a(i),ie.clear(),P.current=null)}function be(i){L(i,X)}const V=D(z),Le=xe(r&&xe(x(V,"keydown",oe),x(V,"compositionstart",ce),x(V,"compositionend",me)),b&&xe(x(V,"click",h,!0),x(V,"pointerdown",h,!0),x(V,"pointerup",F,!0),x(V,"pointercancel",F,!0),x(V,"mousedown",h,!0),x(V,"mouseup",F,!0),x(V,"touchstart",S,!0),x(V,"touchmove",_,!0),x(V,"touchend",be,!0)));return()=>{Le(),R.clear(),q.clear(),g(),I.current=!1}},[w,z,r,b,y,A,n,Z,N,oe,p,E,$,Q,k,O,ie]),f.useEffect(p,[y,p]);const he=f.useMemo(()=>({onKeyDown:oe,[Rn[u]]:de,...u!=="intentional"&&{onClick:de}}),[oe,de,u]),ke=f.useMemo(()=>({onKeyDown:oe,onPointerDown:ge,onMouseDown:ge,onClickCapture:te,onMouseDownCapture(R){te(),pe(R)},onPointerDownCapture(R){te(),pe(R)},onMouseUpCapture:te,onTouchEndCapture:te,onTouchMoveCapture:te}),[oe,te,pe,ge]);return f.useMemo(()=>n?{reference:he,floating:ke,trigger:he}:{},[n,he,ke])}const vn={open:Se(e=>e.open),transitionStatus:Se(e=>e.transitionStatus),domReferenceElement:Se(e=>e.domReferenceElement),referenceElement:Se(e=>e.positionReference??e.referenceElement),floatingElement:Se(e=>e.floatingElement),floatingId:Se(e=>e.floatingId)};class On extends cn{constructor(t){const{syncOnly:n,nested:r,onOpenChange:s,triggerElements:c,...o}=t;super({...o,positionReference:o.referenceElement,domReferenceElement:o.referenceElement},{onOpenChange:s,dataRef:{current:{}},events:kt(),nested:r,triggerElements:c},vn),this.syncOnly=n}syncOpenEvent=(t,n)=>{(!t||!this.state.open||n!=null&&un(n))&&(this.context.dataRef.current.openEvent=t?n:void 0)};dispatchOpenChange=(t,n)=>{this.syncOpenEvent(t,n.event);const r={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",r)};setOpen=(t,n)=>{if(this.syncOnly){this.context.onOpenChange?.(t,n);return}this.dispatchOpenChange(t,n),this.context.onOpenChange?.(t,n)}}function wn(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:s,nested:c,onOpenChange:o}=e,u=t.useState("open"),v=t.useState("activeTriggerElement"),M=t.useState(n?"popupElement":"positionerElement"),O=t.context.triggerElements,A=o,z=f.useRef(null);r===void 0&&z.current===null&&(z.current=new On({open:u,transitionStatus:void 0,referenceElement:v,floatingElement:M,triggerElements:O,onOpenChange:A,floatingId:s,syncOnly:!0,nested:c}));const w=r??z.current;return t.useSyncedValue("floatingId",s),G(()=>{const k={open:u,floatingId:s,referenceElement:v,floatingElement:M};Ce(v)&&(k.domReferenceElement=v),w.state.positionReference===w.state.referenceElement&&(k.positionReference=v),w.update(k)},[u,s,v,M,w]),w.context.onOpenChange=A,w.context.nested=c,w}function Cn(e,t=!1,n=!1){const[r,s]=f.useState(e&&t?"idle":void 0),[c,o]=f.useState(e);return e&&!c&&(o(!0),s("starting")),!e&&c&&r!=="ending"&&!n&&s("ending"),!e&&!c&&r==="ending"&&s(void 0),G(()=>{if(!e&&c&&r!=="ending"&&n){const u=ye.request(()=>{s("ending")});return()=>{ye.cancel(u)}}},[e,c,r,n]),G(()=>{if(!e||t)return;const u=ye.request(()=>{s(void 0)});return()=>{ye.cancel(u)}},[t,e]),G(()=>{if(!e||!t)return;e&&c&&r!=="idle"&&s("starting");const u=ye.request(()=>{s("idle")});return()=>{ye.cancel(u)}},[t,e,c,r]),{mounted:c,setMounted:o,transitionStatus:r}}const tr={tabIndex:-1,[an]:""};function nr(e,t,n=!1){const r=ze(),s=Ze()!=null,c=f.useRef(null);e===void 0&&c.current===null&&(c.current=t(r,s));const o=e??c.current;return wn({popupStore:o,treatPopupAsFloatingElement:n,floatingRootContext:o.state.floatingRootContext,floatingId:r,nested:s,onOpenChange:o.setOpen}),{store:o,internalStore:c.current}}function xn(e,t){const n=f.useRef(null),r=f.useRef(null);return f.useCallback(s=>{if(e===void 0)return;let c=!1;if(n.current!==null){const o=n.current,u=r.current,v=t.context.triggerElements.getById(o);u&&v===u&&(t.context.triggerElements.delete(o),c=!0),n.current=null,r.current=null}if(s!==null&&(n.current=e,r.current=s,t.context.triggerElements.add(e,s),c=!0),c){const o=t.context.triggerElements.size;t.select("open")&&t.state.triggerCount!==o&&t.set("triggerCount",o)}},[t,e])}function rr(e,t,n){const r=n?.id??null;(r||t)&&(e.activeTriggerId=r,e.activeTriggerElement=n??null)}function sr(e,t,n,r){const s=n.useState("isMountedByTrigger",e),c=xn(e,n),o=U(u=>{if(c(u),!u)return;const v=n.select("open"),M=n.select("activeTriggerId");if(M===e){n.update({activeTriggerElement:u,...v?r:null});return}M==null&&v&&n.update({activeTriggerId:e,activeTriggerElement:u,...r})});return G(()=>{s&&n.update({activeTriggerElement:t.current,...r})},[s,n,t,...Object.values(r)]),{registerTrigger:o,isMountedByThisTrigger:s}}function or(e){const t=e.useState("open"),n=e.useState("triggerCount");G(()=>{if(!t){e.state.triggerCount!==0&&e.set("triggerCount",0);return}const r=e.context.triggerElements.size,s={};if(e.state.triggerCount!==r&&(s.triggerCount=r),!e.select("activeTriggerId")&&r===1){const c=e.context.triggerElements.entries().next();if(!c.done){const[o,u]=c.value;s.activeTriggerId=o,s.activeTriggerElement=u}}(s.triggerCount!==void 0||s.activeTriggerId!==void 0)&&e.update(s)},[t,e,n])}function cr(e,t,n){const{mounted:r,setMounted:s,transitionStatus:c}=Cn(e);t.useSyncedValues({mounted:r,transitionStatus:c});const o=U(()=>{s(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}),u=t.useState("preventUnmountingOnClose");return ln({enabled:r&&!e&&!u,open:e,ref:t.context.popupRef,onComplete(){e||o()}}),{forceUnmount:o,transitionStatus:c}}function ir(e,t){e.useSyncedValues(t),G(()=>()=>{e.update({activeTriggerProps:Be,inactiveTriggerProps:Be,popupProps:Be})},[e])}function ur(e,t){G(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),G(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class lr{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(t,n){const r=this.idMap.get(t);r!==n&&(r!==void 0&&this.elementsSet.delete(r),this.elementsSet.add(n),this.idMap.set(t,n))}delete(t){const n=this.idMap.get(t);n&&(this.elementsSet.delete(n),this.idMap.delete(t))}hasElement(t){return this.elementsSet.has(t)}hasMatchingElement(t){for(const n of this.elementsSet)if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}let nt=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=at.startingStyle]="startingStyle",e[e.endingStyle=at.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({}),je=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const In={[je.popupOpen]:""},kn={[je.popupOpen]:"",[je.pressed]:""},Pn={[nt.open]:""},Fn={[nt.closed]:""},Mn={[nt.anchorHidden]:""},ar={open(e){return e?In:null}},fr={open(e){return e?kn:null}},dr={open(e){return e?Pn:Fn},anchorHidden(e){return e?Mn:null}};function pr(e){return ze(e,"base-ui")}const An="ArrowUp",Nn="ArrowDown",Wn="ArrowLeft",Ln="ArrowRight",Yn="Home",Hn="End",_n=new Set([Wn,Ln]),Bn=new Set([An,Nn]),Gn=new Set([..._n,...Bn]),gr=new Set([...Gn,Yn,Hn]),hr=f.forwardRef(function(t,n){const{cutout:r,...s}=t;let c;if(r){const o=r.getBoundingClientRect();c=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${o.left}px ${o.top}px,${o.left}px ${o.bottom}px,${o.right}px ${o.bottom}px,${o.right}px ${o.top}px,${o.left}px ${o.top}px)`}return Te.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...s,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:c}})});function mr(e){const t=f.useRef(!0);t.current&&(t.current=!1,e())}let Et={},yt={},Rt="";function Kn(e){if(typeof document>"u")return!1;const t=D(e);return We(t).innerWidth-t.documentElement.clientWidth>0}function Dn(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=D(e),r=n.documentElement,s=n.body,c=Qe(r)?r:s,o=c.style.overflowY,u=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",c.style.overflowY="scroll";const v=c.offsetWidth;c.style.overflowY="hidden";const M=c.offsetWidth;return c.style.overflowY=o,r.style.scrollbarGutter=u,v===M}function Xn(e){const t=D(e),n=t.documentElement,r=t.body,s=Qe(n)?n:r,c={overflowY:s.style.overflowY,overflowX:s.style.overflowX};return Object.assign(s.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(s.style,c)}}function Vn(e){const t=D(e),n=t.documentElement,r=t.body,s=We(n);let c=0,o=0,u=!1;const v=ye.create();if(xt&&(s.visualViewport?.scale??1)!==1)return()=>{};function M(){const w=s.getComputedStyle(n),k=s.getComputedStyle(r),b=(w.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";c=n.scrollTop,o=n.scrollLeft,Et={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Rt=n.style.scrollBehavior,yt={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const E=n.scrollHeight>n.clientHeight,Z=n.scrollWidth>n.clientWidth,N=w.overflowY==="scroll"||k.overflowY==="scroll",Y=w.overflowX==="scroll"||k.overflowX==="scroll",J=Math.max(0,s.innerWidth-r.clientWidth),I=Math.max(0,s.innerHeight-r.clientHeight),ee=parseFloat(k.marginTop)+parseFloat(k.marginBottom),se=parseFloat(k.marginLeft)+parseFloat(k.marginRight),P=Qe(n)?n:r;if(u=Dn(e),u){n.style.scrollbarGutter=b,P.style.overflowY="hidden",P.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:b,overflowY:"hidden",overflowX:"hidden"}),(E||N)&&(n.style.overflowY="scroll"),(Z||Y)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:ee||I?`calc(100dvh - ${ee+I}px)`:"100dvh",width:se||J?`calc(100vw - ${se+J}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=c,r.scrollLeft=o,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function O(){Object.assign(n.style,Et),Object.assign(r.style,yt),u||(n.scrollTop=c,n.scrollLeft=o,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=Rt)}function A(){O(),v.request(M)}M();const z=x(s,"resize",A);return()=>{v.cancel(),O(),typeof s.removeEventListener=="function"&&z()}}class Un{lockCount=0;restore=null;timeoutLock=Ne.create();timeoutUnlock=Ne.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const r=D(t).documentElement,s=We(r).getComputedStyle(r).overflowY;if(s==="hidden"||s==="clip"){this.restore=Tt;return}const c=fn||!Kn(t);this.restore=c?Xn(t):Vn(t)}}const $n=new Un;function br(e=!0,t=null){G(()=>{if(e)return $n.acquire(t)},[e,t])}export{nt as A,jn as C,Qn as F,hr as I,lr as P,Cn as a,et as b,Ze as c,Ge as d,nr as e,mr as f,Ie as g,ur as h,or as i,cr as j,er as k,tr as l,ir as m,sr as n,zn as o,fr as p,Jn as q,Zn as r,rr as s,ar as t,pr as u,gr as v,dr as w,On as x,Ke as y,br as z};
@@ -0,0 +1 @@
1
+ <svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>ZCode</title><path d="M12.105 2L9.927 4.953H.653L2.83 2h9.276zM23.254 19.048L21.078 22h-9.242l2.174-2.952h9.244zM24 2L9.264 22H0L14.736 2H24z"></path></svg>
@@ -235,8 +235,8 @@
235
235
  ]
236
236
  }
237
237
  </script>
238
- <script type="module" crossorigin src="/assets/main-D2iJg7iA.js"></script>
239
- <link rel="stylesheet" crossorigin href="/assets/main-Bb0Bwbp7.css">
238
+ <script type="module" crossorigin src="/assets/main-4M5oNV2-.js"></script>
239
+ <link rel="stylesheet" crossorigin href="/assets/main-xFJe2FDa.css">
240
240
  </head>
241
241
  <body>
242
242
  <main class="aeo-seed-content" aria-label="Token Tracker AI-readable summary">
@@ -75,8 +75,8 @@
75
75
  "description": "Shareable Token Tracker dashboard snapshot."
76
76
  }
77
77
  </script>
78
- <script type="module" crossorigin src="/assets/main-D2iJg7iA.js"></script>
79
- <link rel="stylesheet" crossorigin href="/assets/main-Bb0Bwbp7.css">
78
+ <script type="module" crossorigin src="/assets/main-4M5oNV2-.js"></script>
79
+ <link rel="stylesheet" crossorigin href="/assets/main-xFJe2FDa.css">
80
80
  </head>
81
81
  <body>
82
82
  <main class="aeo-seed-content" aria-label="Token Tracker share page summary">
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tokentracker-cli",
3
- "version": "0.57.1",
4
- "description": "Token usage tracker for AI agent CLIs (Claude Code, Codex, Cursor, Gemini, Kiro, OpenCode, OpenClaw, Every Code, Hermes, GitHub Copilot, Kimi Code, CodeBuddy, WorkBuddy, Grok Build, oh-my-pi, pi, Craft Agents, Kilo CLI, Kilo Code, Roo Code, Zed Agent, Goose, Mimo)",
3
+ "version": "0.58.0",
4
+ "description": "Token usage tracker for AI agent CLIs (Claude Code, Codex, Cursor, Gemini, Antigravity, Kiro, OpenCode, OpenClaw, Every Code, Hermes, GitHub Copilot, Kimi Code, CodeBuddy, WorkBuddy, Grok Build, oh-my-pi, pi, Craft Agents, Kilo CLI, Kilo Code, Roo Code, Zed Agent, Goose, Mimo, ZCode)",
5
5
  "main": "src/cli.js",
6
6
  "bin": {
7
7
  "tokentracker-cli": "bin/tracker.js",
@@ -95,20 +95,27 @@ const SUPPORTED_PROVIDERS = [
95
95
  "Codex CLI",
96
96
  "Cursor",
97
97
  "Gemini CLI",
98
+ "Antigravity",
99
+ "Kiro",
98
100
  "OpenCode",
99
101
  "OpenClaw",
100
102
  "Every Code",
101
- "Kiro",
102
103
  "Hermes Agent",
103
104
  "GitHub Copilot",
104
105
  "Kimi Code",
105
- "oh-my-pi",
106
106
  "CodeBuddy",
107
107
  "WorkBuddy",
108
108
  "Grok Build",
109
+ "oh-my-pi",
110
+ "pi",
111
+ "Craft Agents",
109
112
  "Kilo CLI",
110
113
  "Kilo Code",
114
+ "Roo Code",
115
+ "Zed Agent",
116
+ "Goose",
111
117
  "Mimo",
118
+ "ZCode",
112
119
  ];
113
120
 
114
121
  async function cmdInit(argv) {
@@ -244,6 +244,11 @@ async function cmdStatus(argv = []) {
244
244
  const mimoDbPath = path.join(mimoHome, "mimocode.db");
245
245
  const mimoInstalled = fssync.existsSync(mimoDbPath);
246
246
 
247
+ // ZCode (Z.ai's coding agent — OpenCode-fork SQLite) — passive scan of db.sqlite.
248
+ const zcodeHome = process.env.ZCODE_HOME || path.join(home, ".zcode");
249
+ const zcodeDbPath = path.join(zcodeHome, "cli", "db", "db.sqlite");
250
+ const zcodeInstalled = fssync.existsSync(zcodeDbPath);
251
+
247
252
  // Kilo Code VS Code extension — passive scan of all VS Code-family
248
253
  // globalStorage/kilocode.kilo-code/tasks/ ui_messages.json files.
249
254
  const kilocodeTaskFiles = resolveKilocodeTaskFiles(process.env);
@@ -365,6 +370,9 @@ async function cmdStatus(argv = []) {
365
370
  mimo: mimoInstalled
366
371
  ? { installed: true, detail: mimoDbPath }
367
372
  : { installed: false },
373
+ zcode: zcodeInstalled
374
+ ? { installed: true, detail: zcodeDbPath }
375
+ : { installed: false },
368
376
  kilocode: kilocodeInstalled
369
377
  ? { installed: true, files: kilocodeTaskFiles.length }
370
378
  : { installed: false },
@@ -456,6 +464,9 @@ async function cmdStatus(argv = []) {
456
464
  mimoInstalled
457
465
  ? `- Mimo: passive reader (${mimoDbPath})`
458
466
  : null,
467
+ zcodeInstalled
468
+ ? `- ZCode: passive reader (${zcodeDbPath})`
469
+ : null,
459
470
  kilocodeInstalled
460
471
  ? `- Kilo Code (VS Code extension): passive reader (${kilocodeTaskFiles.length} task${kilocodeTaskFiles.length !== 1 ? "s" : ""} across ${new Set(kilocodeTaskFiles.map((t) => t.ide)).size} IDE${new Set(kilocodeTaskFiles.map((t) => t.ide)).size !== 1 ? "s" : ""})`
461
472
  : null,
@@ -15,6 +15,7 @@ const {
15
15
  listOpencodeMessageFiles,
16
16
  readOpencodeDbMessages,
17
17
  readMimoDbMessages,
18
+ readZcodeDbMessages,
18
19
  resolveKiroDbPath,
19
20
  resolveKiroJsonlPath,
20
21
  resolveHermesPath,
@@ -215,6 +216,7 @@ async function cmdSync(argv) {
215
216
  const opencodeStorageDir = path.join(opencodeHome, "storage");
216
217
  const kiloHome = process.env.KILO_HOME || path.join(xdgDataHome, "kilo");
217
218
  const mimoHome = process.env.MIMO_HOME || path.join(xdgDataHome, "mimocode");
219
+ const zcodeHome = process.env.ZCODE_HOME || path.join(home, ".zcode");
218
220
 
219
221
  // OpenClaw hook integration: allow a hook to request incremental parsing for a single session jsonl.
220
222
  // We still parse all regular sources so model/source attribution stays complete (e.g. Kimi sessions).
@@ -561,6 +563,47 @@ async function cmdSync(argv) {
561
563
  }
562
564
  }
563
565
 
566
+ // ── ZCode (Z.ai's coding agent — OpenCode-fork SQLite) ──
567
+ // Z.ai's ZCode CLI is an OpenCode fork that stores assistant messages in the
568
+ // exact same `message` table schema (~/.zcode/cli/db/db.sqlite). Reuse the
569
+ // OpenCode parser with a dedicated cursor namespace so the message indexes
570
+ // don't collide. readZcodeDbMessages returns ONLY ZCode's own GLM rows
571
+ // (providerID zai/bigmodel/zhipu) — ZCode can orchestrate bundled
572
+ // claude-code/codex/gemini-cli sub-agents whose turns (anthropic/openai/
573
+ // google) are already counted by the standalone parsers, so anything else
574
+ // would double-count.
575
+ const zcodeDbPath = path.join(zcodeHome, "cli", "db", "db.sqlite");
576
+ let zcodeResult = { messagesProcessed: 0, eventsAggregated: 0, bucketsQueued: 0 };
577
+ const zcodeDbMessages = readZcodeDbMessages(zcodeDbPath);
578
+ if (zcodeDbMessages.length > 0) {
579
+ if (progress?.enabled) {
580
+ progress.start(
581
+ `Parsing ZCode ${renderBar(0)} 0/${formatNumber(zcodeDbMessages.length)} msgs | buckets 0`,
582
+ );
583
+ }
584
+ try {
585
+ zcodeResult = await parseOpencodeDbIncremental({
586
+ dbMessages: zcodeDbMessages,
587
+ cursors,
588
+ queuePath,
589
+ projectQueuePath,
590
+ onProgress: (p) => {
591
+ if (!progress?.enabled) return;
592
+ const pct = p.total > 0 ? p.index / p.total : 1;
593
+ progress.update(
594
+ `Parsing ZCode ${renderBar(pct)} ${formatNumber(p.index)}/${formatNumber(
595
+ p.total,
596
+ )} msgs | buckets ${formatNumber(p.bucketsQueued)}`,
597
+ );
598
+ },
599
+ source: "zcode",
600
+ cursorKey: "zcode",
601
+ });
602
+ } catch (err) {
603
+ warnProviderParseFailure("ZCode", err, opts);
604
+ }
605
+ }
606
+
564
607
  // ── Kilo Code VS Code extension (Cline-style ui_messages.json) ──
565
608
  const kilocodeTaskFiles = resolveKilocodeTaskFiles(process.env);
566
609
  let kilocodeResult = { recordsProcessed: 0, eventsAggregated: 0, bucketsQueued: 0 };
@@ -1254,6 +1297,7 @@ async function cmdSync(argv) {
1254
1297
  copilotResult.recordsProcessed +
1255
1298
  kiloResult.messagesProcessed +
1256
1299
  mimoResult.messagesProcessed +
1300
+ zcodeResult.messagesProcessed +
1257
1301
  kilocodeResult.recordsProcessed +
1258
1302
  roocodeResult.recordsProcessed +
1259
1303
  zedResult.recordsProcessed +
@@ -1281,6 +1325,7 @@ async function cmdSync(argv) {
1281
1325
  copilotResult.bucketsQueued +
1282
1326
  kiloResult.bucketsQueued +
1283
1327
  mimoResult.bucketsQueued +
1328
+ zcodeResult.bucketsQueued +
1284
1329
  kilocodeResult.bucketsQueued +
1285
1330
  roocodeResult.bucketsQueued +
1286
1331
  zedResult.bucketsQueued +
@@ -33,6 +33,7 @@
33
33
  "kimi-k2.5": { "input": 0.6, "output": 2, "cache_read": 0.15 },
34
34
  "kimi-k2.5-free": { "input": 0, "output": 0, "cache_read": 0 },
35
35
  "kimi-k2.6": { "input": 0.95, "output": 4, "cache_read": 0.16 },
36
+ "glm-5.2": { "input": 1.4, "output": 4.4, "cache_read": 0.26 },
36
37
  "glm-5.1": { "input": 1.4, "output": 4.4, "cache_read": 0.26 },
37
38
  "glm-5": { "input": 1.0, "output": 3.2, "cache_read": 0.2 },
38
39
  "glm-5-turbo": { "input": 1.2, "output": 4.0, "cache_read": 0.24 },
@@ -76,6 +77,7 @@
76
77
  { "match": "glm-4.7", "ref": "glm-4.7" },
77
78
  { "match": "glm-4.6", "ref": "glm-4.6" },
78
79
  { "match": "glm-5-turbo", "ref": "glm-5-turbo" },
80
+ { "match": "glm-5.2", "ref": "glm-5.2" },
79
81
  { "match": "glm-5.1", "ref": "glm-5.1" },
80
82
  { "match": "glm-5", "ref": "glm-5" }
81
83
  ]
@@ -81,10 +81,18 @@ function normalizeZedModel(model) {
81
81
 
82
82
  // Claude desktop/CLI sometimes reports display-style names such as
83
83
  // `claude-opus-4.8` or `Claude Opus 4.8`, while curated keys use Anthropic's
84
- // historical dash style (`claude-opus-4-8`).
84
+ // historical dash style (`claude-opus-4-8`). Relay/gateway backends (OpenRouter
85
+ // and API proxies) add a provider path prefix and may invert tier/version order
86
+ // — e.g. `anthropic/claude-4.6-opus-20260205` — which previously rendered $0
87
+ // because the prefix slash got flattened to a dash and the order never matched.
85
88
  function normalizeClaudeModel(model) {
86
89
  if (!model || typeof model !== "string") return model;
87
- let m = model
90
+ // Drop the provider path prefix relays prepend ("anthropic/...",
91
+ // "openrouter/anthropic/...") so only the bare Claude id reaches the cleanup
92
+ // and lookups below. Without this the "/" is flattened to "-" by the regex
93
+ // step, breaking both the exact and provider-prefix-strip matches.
94
+ const base = model.includes("/") ? model.slice(model.lastIndexOf("/") + 1) : model;
95
+ let m = base
88
96
  .trim()
89
97
  .replace(/\([^)]*\)/g, " ")
90
98
  .toLowerCase()
@@ -100,6 +108,13 @@ function normalizeClaudeModel(model) {
100
108
  .replace(/^(sonnet|opus|haiku)-/, "claude-$1-")
101
109
  .replace(/^(claude-(?:sonnet|opus|haiku)-\d+)\.(\d+)/, "$1-$2");
102
110
  }
111
+ // Some relays invert tier/version order (`claude-4.6-opus` instead of the
112
+ // canonical `claude-opus-4-6`). Restore it ONLY for major>=4 — Claude 3.x is
113
+ // genuinely version-first (`claude-3-5-sonnet`, `claude-3-opus`) and must stay
114
+ // untouched.
115
+ if (/^claude-(?:[4-9]|\d{2,})[.-]\d+-(?:sonnet|opus|haiku)/.test(m)) {
116
+ return m.replace(/^claude-(\d+)[.-](\d+)-(sonnet|opus|haiku)/, "claude-$3-$1-$2");
117
+ }
103
118
 
104
119
  return m;
105
120
  }