tokentracker-cli 0.74.2 → 0.74.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dashboard/dist/assets/{ActivityHeatmap-DGqoFvkZ.js → ActivityHeatmap-C7oqary_.js} +1 -1
- package/dashboard/dist/assets/{Card-CKxmfosU.js → Card-BCePOeL5.js} +1 -1
- package/dashboard/dist/assets/{CommunityStatsModal-C6h6BKVI.js → CommunityStatsModal-CODikgAM.js} +1 -1
- package/dashboard/dist/assets/{ConfirmModal-wqW-7Vs_.js → ConfirmModal-D4P6QXYR.js} +1 -1
- package/dashboard/dist/assets/{DashboardPage-10hyXbuM.js → DashboardPage-BXNH-zoX.js} +1 -1
- package/dashboard/dist/assets/{DevicePage-DosHEknI.js → DevicePage-BoZhWNng.js} +1 -1
- package/dashboard/dist/assets/{DialogClose-CRzzOKwV.js → DialogClose-tHsQT_Vp.js} +1 -1
- package/dashboard/dist/assets/DialogDescription-D356qUn1.js +1 -0
- package/dashboard/dist/assets/{DialogTitle-CgVdc49w.js → DialogTitle-DU9z49D2.js} +1 -1
- package/dashboard/dist/assets/{FadeIn-CVkirQtu.js → FadeIn-bLe0eaGz.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-DHW75YEC.js → HeaderGithubStar-Bas7sLdk.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-CMOjeIuH.js → IpCheckPage-qeSoM4w3.js} +1 -1
- package/dashboard/dist/assets/{LandingPage-Cca1heHL.js → LandingPage-PnozFLwt.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardAvatar-CVMcytB1.js → LeaderboardAvatar-D-WIXZAr.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardPage-BEfsEAZY.js → LeaderboardPage-RHRwgsVh.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardProfileModal-5LuPOMoM.js → LeaderboardProfileModal-B7yOwluv.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardProfilePage-DUQOF16T.js → LeaderboardProfilePage-C8v53iFy.js} +1 -1
- package/dashboard/dist/assets/{LimitsPage-C6cPHrnU.js → LimitsPage-DKBH_uFv.js} +1 -1
- package/dashboard/dist/assets/{LocalOnlyNotice-B2SjP1L6.js → LocalOnlyNotice-BEeFbIYU.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-D0vP9cX4.js → LoginPage-Q4xGLSh4.js} +1 -1
- package/dashboard/dist/assets/{PopoverPopup-AtVz9OM2.js → PopoverPopup-CdXmxime.js} +1 -1
- package/dashboard/dist/assets/{ResetPasswordPage-6eUhDnAl.js → ResetPasswordPage-DCq6m3Sx.js} +1 -1
- package/dashboard/dist/assets/{Select-Dt-nyHat.js → Select-BFzOQ_Qh.js} +1 -1
- package/dashboard/dist/assets/{SelectItemText-CFxs6Ipf.js → SelectItemText-BtYYJp_d.js} +1 -1
- package/dashboard/dist/assets/{SettingsPage-Ccv_PRTi.js → SettingsPage-DSKKIFxe.js} +1 -1
- package/dashboard/dist/assets/{SkillsPage-Ckmq2qWZ.js → SkillsPage-D0FLWYC3.js} +1 -1
- package/dashboard/dist/assets/{WidgetsPage-CuMpK7JS.js → WidgetsPage-D0vf85Gc.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-C3sjJiS5.js → WrappedPage-Dls_m5Ba.js} +1 -1
- package/dashboard/dist/assets/{agent-logos-CORiXh7-.js → agent-logos-CZPomuU8.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-D-CX3rHC.js → arrow-up-right-BsX4uuXC.js} +1 -1
- package/dashboard/dist/assets/check-CFNHutnk.js +1 -0
- package/dashboard/dist/assets/{copy-BbbIDe0D.js → copy-Irxyg8vw.js} +1 -1
- package/dashboard/dist/assets/{download-CnLKP9Xi.js → download-BO6E5SiF.js} +1 -1
- package/dashboard/dist/assets/{format-tokens-Q8buFewN.js → format-tokens-BmI1AkBm.js} +1 -1
- package/dashboard/dist/assets/{info-Bg3JHknV.js → info-BZoIZTYL.js} +1 -1
- package/dashboard/dist/assets/{main-BZBZhXIl.js → main-C6oRShLQ.js} +2 -2
- package/dashboard/dist/assets/{use-community-stats-BBUKlTpE.js → use-community-stats-B-yz2TUw.js} +1 -1
- package/dashboard/dist/assets/{use-limits-display-prefs-Dnl2W8Rt.js → use-limits-display-prefs-DA9uTJQz.js} +1 -1
- package/dashboard/dist/assets/{use-native-settings-DlQEd871.js → use-native-settings-DpsyM_fO.js} +1 -1
- package/dashboard/dist/assets/{use-ordered-list-4WtaZhJf.js → use-ordered-list-DAaD_oBC.js} +1 -1
- package/dashboard/dist/assets/{use-quality-per-dollar-pref-CS0EFKxa.js → use-quality-per-dollar-pref-akRSCZ4W.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-CJ25xM-V.js → use-usage-limits-B9TQcAWp.js} +1 -1
- package/dashboard/dist/assets/{useCurrency-CaevR9XR.js → useCurrency-DTQa3vND.js} +1 -1
- package/dashboard/dist/assets/{useScrollLock-BLGPKPXr.js → useScrollLock-YAMmPQRR.js} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/dashboard/dist/share.html +1 -1
- package/package.json +1 -1
- package/src/commands/init.js +128 -12
- package/src/commands/serve.js +6 -2
- package/src/commands/status.js +9 -1
- package/src/commands/uninstall.js +4 -0
- package/src/lib/codex-config.js +58 -9
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/dashboard/dist/assets/DialogDescription-DuiVFMP6.js +0 -1
- package/dashboard/dist/assets/check-frbadzCO.js +0 -1
package/dashboard/dist/assets/{use-community-stats-BBUKlTpE.js → use-community-stats-B-yz2TUw.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as w,aa as _,aH as k}from"./main-
|
|
1
|
+
import{r as w,aa as _,aH as k}from"./main-C6oRShLQ.js";const C=6e3,I=100;function h(t,u){let e;const n=new Promise((a,r)=>{e=setTimeout(()=>r(new Error("landing stats timeout")),u)});return Promise.race([t,n]).finally(()=>{e!=null&&clearTimeout(e)})}const E=6e4;let o=null;function b(){if(o&&Date.now()-o.at<E)return o.promise;const t=Promise.all([_({period:"total",limit:I,offset:0}),k().catch(()=>null)]);return o={at:Date.now(),promise:t},t.catch(()=>{o?.promise===t&&(o=null)}),t}function g({enabled:t=!0}={}){const[u,e]=w.useState({status:"loading",tokenFloor:null,totalEntries:null,top:[]});return w.useEffect(()=>{if(!t)return;let n=!1,a=null,r=null;const m=async()=>{try{const[s,l]=await h(b(),C);if(n)return;const i=Array.isArray(s?.entries)?s.entries:[],p=i.reduce((c,T)=>c+(Number(T?.total_tokens)||0),0),d=Number(l?.total_tokens)||0,f=d>0?d:p;if(!i.length||!(f>0)){e(c=>({...c,status:"error"}));return}const y=Array.isArray(l?.top_models)?l.top_models:[];e({status:"ready",tokenFloor:f,totalEntries:Number(s?.total_entries)||i.length,top:i.slice(0,3),topModels:y})}catch{n||e(l=>({...l,status:"error"}))}};return typeof window<"u"&&"requestIdleCallback"in window?a=window.requestIdleCallback(m,{timeout:1500}):r=setTimeout(m,400),()=>{n=!0,a!=null&&typeof window.cancelIdleCallback=="function"&&window.cancelIdleCallback(a),r!=null&&clearTimeout(r)}},[t]),u}export{g as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{N as u,r as a,b4 as M,b5 as G,b6 as j,b7 as J}from"./main-
|
|
1
|
+
import{N as u,r as a,b4 as M,b5 as G,b6 as j,b7 as J}from"./main-C6oRShLQ.js";const B=["claude","codex","cursor","gemini","kimi","kiro","grok","copilot","antigravity","zcode","opencodeGo"],q={claude:"CLAUDE",codex:"CODEX",cursor:"CURSOR",gemini:"GEMINI",kimi:"KIMI",kiro:"KIRO",grok:"GROK",copilot:"COPILOT",antigravity:"ANTIGRAVITY",zcode:"ZCODE",opencodeGo:"OPENCODE"};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");case"opencodeGo":return u("limits.provider.opencode_go");default:return String(e||"")}}const y=B,E="tt.limits.providerOrder",A="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([E,A,h,S]);function I(){return[...y]}function b(){return Object.fromEntries(y.map(e=>[e,!0]))}function N(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 _(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 O(e={}){const r=e&&typeof e=="object"?e:{};return{displayMode:X(r.displayMode),providerOrder:N(r.providerOrder),providerVisibility:_(r.providerVisibility),updatedAt:m(r.updatedAt)}}function Z(){if(typeof window>"u")return I();try{const e=window.localStorage.getItem(E);return N(e?JSON.parse(e):void 0)}catch{return I()}}function H(){if(typeof window>"u")return b();try{const e=window.localStorage.getItem(A);return _(e?JSON.parse(e):void 0)}catch{return b()}}function Q(){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 W(){if(!(typeof window>"u"))try{return m(window.localStorage.getItem(S))}catch{return}}function $(){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 w(){return O({displayMode:Q(),providerOrder:Z(),providerVisibility:H(),updatedAt:W()})}function ee(e){if(typeof window>"u")return;const r=O(e);try{window.localStorage.setItem(E,JSON.stringify(r.providerOrder)),window.localStorage.setItem(A,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=O(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 C(e,r){return e.displayMode===r.displayMode&&ie(e.providerOrder,r.providerOrder)&&ne(e.providerVisibility,r.providerVisibility)}function oe(e,r){return C(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(w),n=a.useRef(e),s=a.useCallback((o,t={})=>{const i=O(o);return n.current=i,r(i),t.writeLocal&&ee(i),i},[]),l=a.useCallback(o=>{M()&&G(V,re(o))},[]),c=a.useCallback(o=>{const t=w(),i=k(t,n.current)?s(t):n.current,d=O(o(i));if(C(i,d))return;const p=te(t.updatedAt,i.updatedAt),f=s({...d,updatedAt:p},{writeLocal:!0});l(f)},[s,l]),P=a.useCallback(o=>{g.has(o)&&c(t=>({...t,displayMode:o}))},[c]),D=a.useCallback(o=>{if(!g.has(o))return;const t=w();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=j(t=>{const i=t?.[V];if(i&&typeof i=="object"){const d=O(i);if(!$()){s(d,{writeLocal:!0});return}const p=w();if(k(d,p))s(d,{writeLocal:!0});else{const f=s(p);oe(d,p)||l(f)}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(w())};return window.addEventListener("storage",o),()=>window.removeEventListener("storage",o)},[s]);const R=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),p=i.providerOrder.indexOf(t);if(d<0||p<0)return i;const f=[...i.providerOrder],[z]=f.splice(d,1);return f.splice(p,0,z),{...i,providerOrder:f}})},[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:P,visibleOrdered:K,toggle:R,moveUp:x,moveDown:U,moveToward:T,reset:Y}}export{v as L,B as a,se as b,ae as l,ce as u};
|
package/dashboard/dist/assets/{use-native-settings-DlQEd871.js → use-native-settings-DpsyM_fO.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as a,a0 as x,r as n,aI as g,cc as m,b6 as b,b7 as u,b5 as f,cb as h}from"./main-
|
|
1
|
+
import{j as a,a0 as x,r as n,aI as g,cc as m,b6 as b,b7 as u,b5 as f,cb as h}from"./main-C6oRShLQ.js";import{C as y}from"./Card-BCePOeL5.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:c,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:c})]},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(d=>d&&{...d,[r]:o}),f(r,o))},[e]),c=n.useCallback(r=>{e&&h(r)},[e]),l=n.useCallback(()=>{e&&u()},[e]);return{available:e,settings:s,setSetting:i,runAction:c,refresh:l}}export{N as S,k as T,p as a,w as b,S as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as c,R as P,aG as Oe}from"./main-
|
|
1
|
+
import{r as c,R as P,aG as Oe}from"./main-C6oRShLQ.js";function In(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return c.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const tt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function me(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function wt(e){return"nodeType"in e}function B(e){var t,n;return e?me(e)?e:wt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function mt(e){const{Document:t}=B(e);return e instanceof t}function Be(e){return me(e)?!1:e instanceof B(e).HTMLElement}function Vt(e){return e instanceof B(e).SVGElement}function ye(e){return e?me(e)?e.document:wt(e)?mt(e)?e:Be(e)||Vt(e)?e.ownerDocument:document:document:document}const Q=tt?c.useLayoutEffect:c.useEffect;function yt(e){const t=c.useRef(e);return Q(()=>{t.current=e}),c.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function Mn(){const e=c.useRef(null),t=c.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=c.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function ke(e,t){t===void 0&&(t=[e]);const n=c.useRef(e);return Q(()=>{n.current!==e&&(n.current=e)},t),n}function Fe(e,t){const n=c.useRef();return c.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Ke(e){const t=yt(e),n=c.useRef(null),r=c.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function ht(e){const t=c.useRef();return c.useEffect(()=>{t.current=e},[e]),t.current}let ct={};function $e(e,t){return c.useMemo(()=>{if(t)return t;const n=ct[e]==null?0:ct[e]+1;return ct[e]=n,e+"-"+n},[e,t])}function Gt(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,a)=>{const s=Object.entries(a);for(const[l,u]of s){const f=i[l];f!=null&&(i[l]=f+e*u)}return i},{...t})}}const we=Gt(1),ze=Gt(-1);function An(e){return"clientX"in e&&"clientY"in e}function xt(e){if(!e)return!1;const{KeyboardEvent:t}=B(e.target);return t&&e instanceof t}function On(e){if(!e)return!1;const{TouchEvent:t}=B(e.target);return t&&e instanceof t}function gt(e){if(On(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return An(e)?{x:e.clientX,y:e.clientY}:null}const _e=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[_e.Translate.toString(e),_e.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Nt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Tn(e){return e.matches(Nt)?e:e.querySelector(Nt)}const Nn={display:"none"};function Ln(e){let{id:t,value:n}=e;return P.createElement("div",{id:t,style:Nn},n)}function kn(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return P.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function zn(){const[e,t]=c.useState("");return{announce:c.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const qt=c.createContext(null);function Pn(e){const t=c.useContext(qt);c.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Bn(){const[e]=c.useState(()=>new Set),t=c.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[c.useCallback(r=>{let{type:o,event:i}=r;e.forEach(a=>{var s;return(s=a[o])==null?void 0:s.call(a,i)})},[e]),t]}const Fn={draggable:`
|
|
2
2
|
To pick up a draggable item, press the space bar.
|
|
3
3
|
While dragging, use the arrow keys to move the item.
|
|
4
4
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as d,r as n}from"./main-
|
|
1
|
+
import{c as d,r as n}from"./main-C6oRShLQ.js";const u=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],f=d("pencil",u),r="tt.qualityPerDollar.enabled";function o(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(r)==="1"}catch{return!1}}function w(){const[s,l]=n.useState(o);n.useEffect(()=>{if(typeof window>"u")return;const t=e=>{(e.key===null||e.key===r)&&l(o())};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)},[]);const a=n.useCallback(t=>{const e=!!t;l(e);try{window.localStorage.setItem(r,e?"1":"0")}catch{}},[]),c=n.useCallback(()=>a(!o()),[a]);return{enabled:s,setEnabled:a,toggle:c}}export{f as P,w as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,ak as w,aN as c}from"./main-
|
|
1
|
+
import{r as a,ak as w,aN as c}from"./main-C6oRShLQ.js";function v(i){const o=!!i?.initialState,[m,l]=a.useState(()=>o?i?.initialState?.data??null:null),[y,s]=a.useState(()=>o?i?.initialState?.error??null:null),[b,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:m,error:y,isLoading:b,refresh:S}}export{v as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,c9 as t,ca as r,S as c}from"./main-
|
|
1
|
+
import{r as e,c9 as t,ca as r,S as c}from"./main-C6oRShLQ.js";const s=Object.freeze({currency:c,rate:1,symbol:"$",rates:{...r},rateSource:"default",rateFetchedAt:null,setCurrency:()=>{}});function u(){return e.useContext(t)??s}export{u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cT as Xe,cN as _t,bc as Ot,ba as B,be as wt,bK as K,cU as Ct,co as je,j as Se,ct as ze,r as g,bI as V,cv as ot,cV as Gt,bf as it,bH as We,cd as Dt,cu as ct,cW as xt,bM as x,bL as ke,c8 as he,cX as Ve,cY as le,cz as ae,bQ as C,bR as Ut,cM as It,cQ as Je,ce as Kt,c3 as ut,b_ as lt,c0 as Xt,cZ as Vt,bN as be,c2 as qt,cH as $t,bl as Pe,bX as jt,c_ as Qe,bi as Ye,c$ as zt,d0 as Be,bT as Jt,bG as Le,bU as Qt,bJ as Ie,ck as _e,cj as Zt,d1 as en,ch as tn,bS as nn,bY as Te,d2 as me,bm as rn,bn as sn,bh as Ge,d3 as on,d4 as at,cK as cn,cp as Ze}from"./main-BZBZhXIl.js";function Fe(e,t,n=!0){return e.filter(s=>s.parentId===t).flatMap(s=>[...!n||s.context?.open?[s]:[],...Fe(e,s.id,n)])}function ft(e,t){let n=[],r=e.find(s=>s.id===t)?.parentId;for(;r;){const s=e.find(o=>o.id===r);r=s?.parentId,s&&(n=n.concat(s))}return n}function un(e){e.preventDefault(),e.stopPropagation()}function ln(e){return"nativeEvent"in e}function an(e){return e.pointerType===""&&e.isTrusted?!0:Xe&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function fn(e){return _t?!1:!Xe&&e.width===0&&e.height===0||Xe&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function $n(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function dn(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function Ae(e){const t=Ot(pn,e).current;return t.next=e,B(t.effect),t}function pn(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}let Ne=0;function De(e,t={}){const{preventScroll:n=!1,sync:r=!1,shouldFocus:s}=t;cancelAnimationFrame(Ne);function o(){s&&!s()||e?.focus({preventScroll:n})}if(r)return o(),wt;const i=requestAnimationFrame(o);return Ne=i,()=>{Ne===i&&(cancelAnimationFrame(i),Ne=0)}}const Ue={inert:new WeakMap,"aria-hidden":new WeakMap},dt="data-base-ui-inert",qe={inert:new WeakSet,"aria-hidden":new WeakSet};let xe=new WeakMap,Ke=0;function gn(e){return qe[e]}function kt(e){return e?Ct(e)?e.host:kt(e.parentNode):null}const pt=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=kt(n);return e.contains(r)?r:null}).filter(n=>n!=null),gt=e=>{const t=new Set;return e.forEach(n=>{let r=n;for(;r&&!t.has(r);)t.add(r),r=r.parentNode}),t},ht=(e,t,n)=>{const r=[],s=o=>{!o||n.has(o)||Array.from(o.children).forEach(i=>{je(i)!=="script"&&(t.has(i)?s(i):r.push(i))})};return s(e),r};function hn(e,t,n,r,{mark:s=!0}){let o=null;r?o="inert":n&&(o="aria-hidden");let i=null,u=null;const h=pt(t,e),f=s?ht(t,gt(h),new Set(h)):[],k=[],L=[];if(o){const b=Ue[o],T=gn(o);u=T,i=b;const A=pt(t,Array.from(t.querySelectorAll("[aria-live]"))),P=h.concat(A);ht(t,gt(P),new Set(P)).forEach(y=>{const E=y.getAttribute(o),Q=E!==null&&E!=="false",H=(b.get(y)||0)+1;b.set(y,H),k.push(y),H===1&&Q&&T.add(y),Q||y.setAttribute(o,o==="inert"?"":"true")})}return s&&f.forEach(b=>{const T=(xe.get(b)||0)+1;xe.set(b,T),L.push(b),T===1&&b.setAttribute(dt,"")}),Ke+=1,()=>{i&&k.forEach(b=>{const A=(i.get(b)||0)-1;i.set(b,A),A||(!u?.has(b)&&o&&b.removeAttribute(o),u?.delete(b))}),s&&L.forEach(b=>{const T=(xe.get(b)||0)-1;xe.set(b,T),T||b.removeAttribute(dt)}),Ke-=1,Ke||(Ue.inert=new WeakMap,Ue["aria-hidden"]=new WeakMap,qe.inert=new WeakSet,qe["aria-hidden"]=new WeakSet,xe=new WeakMap)}}function mt(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:s=!0}=t,o=K(e[0]).body;return hn(e,o,n,r,{mark:s})}function Pt(){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=Pt();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 Ft=g.createContext(null),Mt=g.createContext(null),et=()=>g.useContext(Ft)?.id||null,tt=e=>{const t=g.useContext(Mt);return e??t};function jn(e){const t=ze(),n=tt(e),r=et();return B(()=>{if(!t)return;const s={id:t,parentId:r};return n?.addNode(s),()=>{n?.removeNode(s)}},[n,t,r]),t}function zn(e){const{children:t,id:n}=e,r=et();return Se.jsx(Ft.Provider,{value:g.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Jn(e){const{children:t,externalTree:n}=e,r=Ot(()=>n??new mn).current;return Se.jsx(Mt.Provider,{value:r,children:t})}function bn(e,t){const n=Ye(be(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 bt=20;let fe=[];function nt(){fe=fe.filter(e=>e.deref()?.isConnected)}function Et(e){nt(),e&&je(e)!=="body"&&(fe.push(new WeakRef(e)),fe.length>bt&&(fe=fe.slice(-bt)))}function yt(){return nt(),fe[fe.length-1]?.deref()}function En(e){return e?Qe(e)?e:xt(e)[0]||e:null}function Rt(e){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!e.getAttribute("role")?.includes("dialog"))return;const n=zt(e).filter(s=>{const o=s.getAttribute("data-tabindex")||"";return Qe(s)||s.hasAttribute("data-tabindex")&&!o.startsWith("-")}),r=e.getAttribute("tabindex");n.length===0?r!=="0"&&(e.setAttribute("tabindex","0"),e.setAttribute("data-tabindex","0")):(r!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Qn(e){const{context:t,children:n,disabled:r=!1,initialFocus:s=!0,returnFocus:o=!0,restoreFocus:i=!1,modal:u=!0,closeOnFocusOut:h=!0,openInteractionType:f="",nextFocusableElement:k,previousFocusableElement:L,beforeContentFocusGuardRef:b,externalTree:T,getInsideElements:A}=e,P="rootStore"in t?t.rootStore:t,_=P.useState("open"),y=P.useState("domReferenceElement"),E=P.useState("floatingElement"),{events:Q,dataRef:H}=P.context,q=V(()=>H.current.floatingContext?.nodeId),J=s===!1,G=ot(y)&&J,se=Ae(s),F=Ae(o),$=Ae(f),ve=Ae(_),N=tt(T),R=Gt(),Y=g.useRef(!1),oe=g.useRef(!1),ee=g.useRef(!1),te=g.useRef(null),Ee=g.useRef(""),de=g.useRef(""),pe=g.useRef(null),ye=g.useRef(null),S=it(pe,b,R?.beforeInsideRef),j=it(ye,R?.afterInsideRef),ie=We(),ce=We(),Oe=Dt(),Me=R!=null,p=ct(E),ne=V((m=p)=>m?xt(m):[]),Z=V(()=>A?.().filter(m=>m!=null)??[]);g.useEffect(()=>{if(r||!u)return;function m(W){W.key==="Tab"&&C(p,ae(K(p)))&&ne().length===0&&!G&&un(W)}const I=K(p);return x(I,"keydown",m)},[r,p,u,G,ne]),g.useEffect(()=>{if(r||!_)return;const m=K(p);function I(){ee.current=!1}function W(z){const a=be(z),O=Z(),d=C(E,a)||C(y,a)||C(R?.portalNode,a)||O.some(M=>M===a||C(M,a));ee.current=!d,de.current=z.pointerType||"keyboard",a?.closest(`[${qt}]`)&&(oe.current=!0,ce.start(0,()=>{oe.current=!1}))}function D(){de.current="keyboard"}return ke(x(m,"pointerdown",W,!0),x(m,"pointerup",I,!0),x(m,"pointercancel",I,!0),x(m,"keydown",D,!0),I)},[r,E,y,p,_,R,ce,Z]),g.useEffect(()=>{if(r||!h)return;const m=K(p);function I(){oe.current=!0,ce.start(0,()=>{oe.current=!1})}function W(O){const d=be(O);Qe(d)&&(te.current=d)}function D(O){const d=O.relatedTarget,M=O.currentTarget,U=be(O);u&&d==null&&U!=null&&C(E,U)&&Et(U),queueMicrotask(()=>{const w=q(),Re=P.context.triggerElements,c=Z(),l=d?.hasAttribute(Ve("focus-guard"))&&[pe.current,ye.current,R?.beforeInsideRef.current,R?.afterInsideRef.current,R?.beforeOutsideRef.current,R?.afterOutsideRef.current,le(L),le(k)].includes(d),X=!(C(y,d)||C(E,d)||C(d,E)||C(R?.portalNode,d)||c.some(v=>v===d||C(v,d))||d!=null&&Re.hasElement(d)||Re.hasMatchingElement(v=>C(v,d))||l||N&&(Fe(N.nodesRef.current,w).find(v=>C(v.context?.elements.floating,d)||C(v.context?.elements.domReference,d))||ft(N.nodesRef.current,w).find(v=>[v.context?.elements.floating,ct(v.context?.elements.floating)].includes(d)||v.context?.elements.domReference===d)));if(M===y&&p&&Rt(p),i&&M!==y&&!$t(U)&&ae(m)===m.body){if(he(p)&&(p.focus(),i==="popup")){Oe.request(()=>{p.focus()});return}const v=ne(),ue=te.current,we=(ue&&v.includes(ue)?ue:null)||v[v.length-1]||p;he(we)&&we.focus()}if(H.current.insideReactTree){H.current.insideReactTree=!1;return}(G||!u)&&d&&X&&!oe.current&&(G||d!==yt())&&(Y.current=!0,P.setOpen(!1,Pe(jt,O)))})}function z(){ee.current||(H.current.insideReactTree=!0,ie.start(0,()=>{H.current.insideReactTree=!1}))}const a=he(y)?y:null;if(!(!E&&!a))return ke(a&&x(a,"focusout",D),a&&x(a,"pointerdown",I),E&&x(E,"focusin",W),E&&x(E,"focusout",D),E&&R&&x(E,"focusout",z,!0))},[r,y,E,p,u,N,R,P,h,i,ne,G,q,H,ie,ce,Oe,k,L,Z]),g.useEffect(()=>{if(r||!E||!_)return;const m=Array.from(R?.portalNode?.querySelectorAll(`[${Ve("portal")}]`)||[]),W=(N?ft(N.nodesRef.current,q()):[]).find(M=>ot(M.context?.elements.domReference||null))?.context?.elements.domReference,z=[...[E,...m,pe.current,ye.current,R?.beforeOutsideRef.current,R?.afterOutsideRef.current,...Z()],W,le(L),le(k),G?y:null].filter(M=>M!=null),a=mt(z,{ariaHidden:u||G,mark:!1}),O=[E,...m].filter(M=>M!=null),d=mt(O);return()=>{d(),a()}},[_,r,y,E,u,R,G,N,q,k,L,Z]),B(()=>{if(!_||r||!he(p))return;const m=K(p),I=ae(m);queueMicrotask(()=>{const W=se.current,D=typeof W=="function"?W($.current||""):W;if(D===void 0||D===!1||C(p,I))return;let a=null;const O=()=>(a==null&&(a=ne(p)),a[0]||p);let d;D===!0||D===null?d=O():d=le(D),d=d||O();const M=C(p,ae(m));De(d,{preventScroll:d===p,shouldFocus(){if(!ve.current)return!1;if(M)return!0;const U=ae(m);return!(U!==d&&C(p,U))}})})},[r,_,p,ne,se,$,ve]),B(()=>{if(r||!p)return;const m=K(p),I=ae(m),W=$.current==null;Et(I);function D(a){if(a.open||(Ee.current=bn(a.nativeEvent,de.current)),a.reason===Ut&&a.nativeEvent.type==="mouseleave"&&(Y.current=!0),a.reason===It)if(a.nested)Y.current=!1;else if(an(a.nativeEvent)||fn(a.nativeEvent))Y.current=!1;else{let O=!1;K(p).createElement("div").focus({get preventScroll(){return O=!0,!1}}),O?Y.current=!1:Y.current=!0}}Q.on("openchange",D);function z(){const a=F.current;let O=typeof a=="function"?a(Ee.current):a;if(O===void 0||O===!1)return null;O===null&&(O=!0);const d=y?.isConnected?y:null,M=I?.isConnected&&je(I)!=="body"?I:null;let U=W?M||d:d||M;return U||(U=yt()||null),typeof O=="boolean"?U:le(O)||U||null}return()=>{Q.off("openchange",D);const a=ae(m),O=Z(),d=C(E,a)||O.some(w=>w===a||C(w,a))||N&&Fe(N.nodesRef.current,q(),!1).some(w=>C(w.context?.elements.floating,a)),M=F.current,U=z();queueMicrotask(()=>{const w=En(U),Re=typeof M!="boolean";M&&!Y.current&&he(w)&&(!(!Re&&w!==a&&a!==m.body)||d)&&w.focus({preventScroll:!0}),Y.current=!1})}},[r,E,p,F,$,Q,N,y,q,Z]),B(()=>{if(!Je||_||!E)return;const m=ae(K(E));!he(m)||!Kt(m)||C(E,m)&&m.blur()},[_,E]),B(()=>{if(!(r||!R))return R.setFocusManagerState({modal:u,closeOnFocusOut:h,open:_,onOpenChange:P.setOpen,domReference:y}),()=>{R.setFocusManagerState(null)}},[r,R,u,_,P,h,y]),B(()=>{if(!(r||!p))return Rt(p),()=>{queueMicrotask(nt)}},[r,p]);const ge=!r&&(u?!G:!0)&&(Me||u);return Se.jsxs(g.Fragment,{children:[ge&&Se.jsx(ut,{"data-type":"inside",ref:S,onFocus:m=>{if(u){const I=ne();De(I[I.length-1])}else R?.portalNode&&(Y.current=!1,lt(m,R.portalNode)?Xt(y)?.focus():le(L??R.beforeOutsideRef)?.focus())}}),n,ge&&Se.jsx(ut,{"data-type":"inside",ref:j,onFocus:m=>{u?De(ne()[0]):R?.portalNode&&(h&&(Y.current=!0),lt(m,R.portalNode)?Vt(y)?.focus():le(k??R.afterOutsideRef)?.focus())}})]})}function yn(){return!1}function Rn(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function Zn(e,t={}){const{enabled:n=!0,escapeKey:r=!0,outsidePress:s=!0,outsidePressEvent:o="sloppy",referencePress:i=yn,bubbles:u,externalTree:h}=t,f="rootStore"in e?e.rootStore:e,k=f.useState("open"),L=f.useState("floatingElement"),{dataRef:b}=f.context,T=tt(h),A=V(typeof s=="function"?s:()=>!1),P=typeof s=="function"?A:s,_=P!==!1,y=V(()=>o),{escapeKey:E,outsidePress:Q}=Rn(u),H=g.useRef(!1),q=g.useRef(!1),J=g.useRef(!1),G=g.useRef(!1),se=g.useRef(""),F=g.useRef(null),$=We(),ve=We(),N=V(()=>{ve.clear(),b.current.insideReactTree=!1}),R=V(S=>{const j=b.current.floatingContext?.nodeId;return(T?Fe(T.nodesRef.current,j):[]).some(ce=>ce.context?.open&&!ce.context.dataRef.current[S])}),Y=V(S=>Be(S,f.select("floatingElement"))||Be(S,f.select("domReferenceElement"))),oe=V(S=>{i()&&f.setOpen(!1,Pe(Jt,S.nativeEvent))}),ee=V(S=>{if(!k||!n||!r||S.key!=="Escape"||G.current||!E&&R("__escapeKeyBubbles"))return;const j=ln(S)?S.nativeEvent:S,ie=Pe(Qt,j);f.setOpen(!1,ie),ie.isCanceled||S.preventDefault(),!E&&!ie.isPropagationAllowed&&S.stopPropagation()}),te=V(()=>{b.current.insideReactTree=!0,ve.start(0,N)}),Ee=V(S=>{if(!k||!n||S.button!==0)return;const j=be(S.nativeEvent);C(f.select("floatingElement"),j)&&(H.current||(H.current=!0,q.current=!1))}),de=V(S=>{!k||!n||(S.defaultPrevented||S.nativeEvent.defaultPrevented)&&H.current&&(q.current=!0)});g.useEffect(()=>{if(!k||!n)return;b.current.__escapeKeyBubbles=E,b.current.__outsidePressBubbles=Q;const S=new Le,j=new Le;function ie(){S.clear(),G.current=!0}function ce(){S.start(Je?5:0,()=>{G.current=!1})}function Oe(){J.current=!0,j.start(0,()=>{J.current=!1})}function Me(){H.current=!1,q.current=!1}function p(){const c=se.current,l=c==="pen"||!c?"mouse":c,X=y(),v=typeof X=="function"?X():X;return typeof v=="string"?v:v[l]}function ne(c){const l=p();return l==="intentional"&&c.type!=="click"||l==="sloppy"&&c.type==="click"}function Z(c){const l=b.current.floatingContext?.nodeId,X=T&&Fe(T.nodesRef.current,l).some(v=>Be(c,v.context?.elements.floating));return Y(c)||X}function ge(c){if(ne(c)){c.type!=="click"&&!Y(c)&&(j.clear(),J.current=!1),N();return}if(b.current.insideReactTree){N();return}const l=be(c),X=`[${Ve("inert")}]`,v=Ie(l)?l.getRootNode():null,ue=Array.from((Ct(v)?v:K(f.select("floatingElement"))).querySelectorAll(X)),we=f.context.triggerElements;if(l&&(we.hasElement(l)||we.hasMatchingElement(re=>C(re,l))))return;let Ce=Ie(l)?l:null;for(;Ce&&!_e(Ce);){const re=Zt(Ce);if(_e(re)||!Ie(re))break;Ce=re}if(!(ue.length&&Ie(l)&&!en(l)&&!C(l,f.select("floatingElement"))&&ue.every(re=>!C(Ce,re)))){if(he(l)&&!("touches"in c)){const re=_e(l),He=tn(l),st=/auto|scroll/,At=re||st.test(He.overflowX),Nt=re||st.test(He.overflowY),Wt=At&&l.clientWidth>0&&l.scrollWidth>l.clientWidth,Lt=Nt&&l.clientHeight>0&&l.scrollHeight>l.clientHeight,Yt=He.direction==="rtl",Ht=Lt&&(Yt?c.offsetX<=l.offsetWidth-l.clientWidth:c.offsetX>l.clientWidth),Bt=Wt&&c.offsetY>l.clientHeight;if(Ht||Bt)return}if(!Z(c)){if(p()==="intentional"&&J.current){j.clear(),J.current=!1;return}typeof P=="function"&&!P(c)||R("__outsidePressBubbles")||(f.setOpen(!1,Pe(It,c)),N())}}}function m(c){p()!=="sloppy"||c.pointerType==="touch"||!f.select("open")||!n||Y(c)||ge(c)}function I(c){if(p()!=="sloppy"||!f.select("open")||!n||Y(c))return;const l=c.touches[0];l&&(F.current={startTime:Date.now(),startX:l.clientX,startY:l.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},$.start(1e3,()=>{F.current&&(F.current.dismissOnTouchEnd=!1,F.current.dismissOnMouseDown=!1)}))}function W(c,l){const X=be(c);if(!X)return;const v=x(X,c.type,()=>{l(c),v()})}function D(c){se.current="touch",W(c,I)}function z(c){$.clear(),c.type==="pointerdown"&&(se.current=c.pointerType),!(c.type==="mousedown"&&F.current&&!F.current.dismissOnMouseDown)&&W(c,l=>{l.type==="pointerdown"?m(l):ge(l)})}function a(c){if(!H.current)return;const l=q.current;if(Me(),p()==="intentional"){if(c.type==="pointercancel"){l&&Oe();return}if(!Z(c)){if(l){Oe();return}typeof P=="function"&&!P(c)||(j.clear(),J.current=!0,N())}}}function O(c){if(p()!=="sloppy"||!F.current||Y(c))return;const l=c.touches[0];if(!l)return;const X=Math.abs(l.clientX-F.current.startX),v=Math.abs(l.clientY-F.current.startY),ue=Math.sqrt(X*X+v*v);ue>5&&(F.current.dismissOnTouchEnd=!0),ue>10&&(ge(c),$.clear(),F.current=null)}function d(c){W(c,O)}function M(c){p()!=="sloppy"||!F.current||Y(c)||(F.current.dismissOnTouchEnd&&ge(c),$.clear(),F.current=null)}function U(c){W(c,M)}const w=K(L),Re=ke(r&&ke(x(w,"keydown",ee),x(w,"compositionstart",ie),x(w,"compositionend",ce)),_&&ke(x(w,"click",z,!0),x(w,"pointerdown",z,!0),x(w,"pointerup",a,!0),x(w,"pointercancel",a,!0),x(w,"mousedown",z,!0),x(w,"mouseup",a,!0),x(w,"touchstart",D,!0),x(w,"touchmove",d,!0),x(w,"touchend",U,!0)));return()=>{Re(),S.clear(),j.clear(),Me(),J.current=!1}},[b,L,r,_,P,k,n,E,Q,ee,N,y,R,Y,T,f,$]),g.useEffect(N,[P,N]);const pe=g.useMemo(()=>({onKeyDown:ee,onPointerDown:oe,onClick:oe}),[ee,oe]),ye=g.useMemo(()=>({onKeyDown:ee,onPointerDown:de,onMouseDown:de,onClickCapture:te,onMouseDownCapture(S){te(),Ee(S)},onPointerDownCapture(S){te(),Ee(S)},onMouseUpCapture:te,onTouchEndCapture:te,onTouchMoveCapture:te}),[ee,te,Ee,de]);return g.useMemo(()=>n?{reference:pe,floating:ye,trigger:pe}:{},[n,pe,ye])}function Tn(e){const t=g.useRef(!0);t.current&&(t.current=!1,e())}const Sn={open:Te(e=>e.open),transitionStatus:Te(e=>e.transitionStatus),domReferenceElement:Te(e=>e.domReferenceElement),referenceElement:Te(e=>e.positionReference??e.referenceElement),floatingElement:Te(e=>e.floatingElement),floatingId:Te(e=>e.floatingId)};class vn extends nn{constructor(t){const{syncOnly:n,nested:r,onOpenChange:s,triggerElements:o,...i}=t;super({...i,positionReference:i.referenceElement,domReferenceElement:i.referenceElement},{onOpenChange:s,dataRef:{current:{}},events:Pt(),nested:r,triggerElements:o},Sn),this.syncOnly=n}syncOpenEvent=(t,n)=>{(!t||!this.state.open||n!=null&&dn(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 On(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:s,nested:o,onOpenChange:i}=e,u=t.useState("open"),h=t.useState("activeTriggerElement"),f=t.useState(n?"popupElement":"positionerElement"),k=t.context.triggerElements,L=i,b=g.useRef(null);r===void 0&&b.current===null&&(b.current=new vn({open:u,transitionStatus:void 0,referenceElement:h,floatingElement:f,triggerElements:k,onOpenChange:L,floatingId:s,syncOnly:!0,nested:o}));const T=r??b.current;return t.useSyncedValue("floatingId",s),B(()=>{const A={open:u,floatingId:s,referenceElement:h,floatingElement:f};Ie(h)&&(A.domReferenceElement=h),T.state.positionReference===T.state.referenceElement&&(A.positionReference=h),T.update(A)},[u,s,h,f,T]),T.context.onOpenChange=L,T.context.nested=o,T}function wn(e,t=!1,n=!1){const[r,s]=g.useState(e&&t?"idle":void 0),[o,i]=g.useState(e);return e&&!o&&(i(!0),s("starting")),!e&&o&&r!=="ending"&&!n&&s("ending"),!e&&!o&&r==="ending"&&s(void 0),B(()=>{if(!e&&o&&r!=="ending"&&n){const u=me.request(()=>{s("ending")});return()=>{me.cancel(u)}}},[e,o,r,n]),B(()=>{if(!e||t)return;const u=me.request(()=>{s(void 0)});return()=>{me.cancel(u)}},[t,e]),B(()=>{if(!e||!t)return;e&&o&&r!=="idle"&&s("starting");const u=me.request(()=>{s("idle")});return()=>{me.cancel(u)}},[t,e,o,r]),{mounted:o,setMounted:i,transitionStatus:r}}const er={tabIndex:-1,[on]:""};function tr(e){return t=>t==="touch"?e.current:!0}function nr(e,t,n=!1){const r=ze(),s=et()!=null,o=g.useRef(null);e===void 0&&o.current===null&&(o.current=t(r,s));const i=e??o.current;return On({popupStore:i,treatPopupAsFloatingElement:n,floatingRootContext:i.state.floatingRootContext,floatingId:r,nested:s,onOpenChange:i.setOpen}),{store:i,internalStore:o.current}}function Cn(e,t){const n=g.useRef(null),r=g.useRef(null);return g.useCallback(s=>{if(e===void 0)return;let o=!1;if(n.current!==null){const i=n.current,u=r.current,h=t.context.triggerElements.getById(i);u&&h===u&&(t.context.triggerElements.delete(i),o=!0),n.current=null,r.current=null}if(s!==null&&(n.current=e,r.current=s,t.context.triggerElements.add(e,s),o=!0),o){const i=t.context.triggerElements.size;t.select("open")&&t.state.triggerCount!==i&&t.set("triggerCount",i)}},[t,e])}function rr(e,t,n,r=!1){t?e.preventUnmountingOnClose=!1:r&&(e.preventUnmountingOnClose=!0);const s=n?.id??null;(s||t)&&(e.activeTriggerId=s,e.activeTriggerElement=n??null)}function sr(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function or(e,t,n,r){Tn(()=>{t===void 0&&e.state.open===!1&&n&&(e.state={...e.state,open:!0,activeTriggerId:r,preventUnmountingOnClose:!1})})}function ir(e,t,n,r){const s=n.useState("isMountedByTrigger",e),o=Cn(e,n),i=V(u=>{if(o(u),!u)return;const h=n.select("open"),f=n.select("activeTriggerId");if(f===e){n.update({activeTriggerElement:u,...h?r:null});return}f==null&&h&&n.update({activeTriggerId:e,activeTriggerElement:u,...r})});return B(()=>{s&&n.update({activeTriggerElement:t.current,...r})},[s,n,t,...Object.values(r)]),{registerTrigger:i,isMountedByThisTrigger:s}}function cr(e,t={}){const{closeOnActiveTriggerUnmount:n=!1}=t,r=e.useState("open"),s=e.useState("triggerCount");B(()=>{if(!r){e.state.triggerCount!==0&&e.set("triggerCount",0);return}const o=e.context.triggerElements.size,i={};e.state.triggerCount!==o&&(i.triggerCount=o);const u=e.select("activeTriggerId");let h=null;if(u){const f=e.context.triggerElements.getById(u);f?f!==e.state.activeTriggerElement&&(i.activeTriggerElement=f):h=u}if(!h&&!u&&o===1){const f=e.context.triggerElements.entries().next();if(!f.done){const[k,L]=f.value;i.activeTriggerId=k,i.activeTriggerElement=L}}(i.triggerCount!==void 0||i.activeTriggerId!==void 0||i.activeTriggerElement!==void 0)&&e.update(i),h&&n&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===h&&!e.context.triggerElements.getById(h)){const f=Pe(rn);e.setOpen(!1,f),f.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[r,e,s,n])}function ur(e,t,n){const{mounted:r,setMounted:s,transitionStatus:o}=wn(e),i=t.useState("preventUnmountingOnClose"),u=e?!1:i;t.useSyncedValues({mounted:r,transitionStatus:o,preventUnmountingOnClose:u});const h=V(()=>{s(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return sn({enabled:r&&!e&&!u,open:e,ref:t.context.popupRef,onComplete(){e||h()}}),{forceUnmount:h,transitionStatus:o}}function lr(e,t){e.useSyncedValues(t),B(()=>()=>{e.update({activeTriggerProps:Ge,inactiveTriggerProps:Ge,popupProps:Ge})},[e])}function ar(e,t){B(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),B(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class fr{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 rt=(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})({}),$e=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const xn={[$e.popupOpen]:""},In={[$e.popupOpen]:"",[$e.pressed]:""},kn={[rt.open]:""},Pn={[rt.closed]:""},Fn={[rt.anchorHidden]:""},dr={open(e){return e?xn:null}},pr={open(e){return e?In:null}},gr={open(e){return e?kn:Pn},anchorHidden(e){return e?Fn:null}};function hr(e){return ze(e,"base-ui")}const Mn="ArrowUp",An="ArrowDown",Nn="ArrowLeft",Wn="ArrowRight",Ln="Home",Yn="End",Hn=new Set([Nn,Wn]),Bn=new Set([Mn,An]),_n=new Set([...Hn,...Bn]),mr=new Set([..._n,Ln,Yn]),br=g.forwardRef(function(t,n){const{cutout:r,...s}=t;let o;if(r){const i=r.getBoundingClientRect();o=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${i.left}px ${i.top}px,${i.left}px ${i.bottom}px,${i.right}px ${i.bottom}px,${i.right}px ${i.top}px,${i.left}px ${i.top}px)`}return Se.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...s,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:o}})});let Tt={},St={},vt="";function Gn(e){if(typeof document>"u")return!1;const t=K(e);return Ye(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=K(e),r=n.documentElement,s=n.body,o=Ze(r)?r:s,i=o.style.overflowY,u=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",o.style.overflowY="scroll";const h=o.offsetWidth;o.style.overflowY="hidden";const f=o.offsetWidth;return o.style.overflowY=i,r.style.scrollbarGutter=u,h===f}function Un(e){const t=K(e),n=t.documentElement,r=t.body,s=Ze(n)?n:r,o={overflowY:s.style.overflowY,overflowX:s.style.overflowX};return Object.assign(s.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(s.style,o)}}function Kn(e){const t=K(e),n=t.documentElement,r=t.body,s=Ye(n);let o=0,i=0,u=!1;const h=me.create();if(Je&&(s.visualViewport?.scale??1)!==1)return()=>{};function f(){const T=s.getComputedStyle(n),A=s.getComputedStyle(r),y=(T.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";o=n.scrollTop,i=n.scrollLeft,Tt={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},vt=n.style.scrollBehavior,St={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,Q=n.scrollWidth>n.clientWidth,H=T.overflowY==="scroll"||A.overflowY==="scroll",q=T.overflowX==="scroll"||A.overflowX==="scroll",J=Math.max(0,s.innerWidth-r.clientWidth),G=Math.max(0,s.innerHeight-r.clientHeight),se=parseFloat(A.marginTop)+parseFloat(A.marginBottom),F=parseFloat(A.marginLeft)+parseFloat(A.marginRight),$=Ze(n)?n:r;if(u=Dn(e),u){n.style.scrollbarGutter=y,$.style.overflowY="hidden",$.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:y,overflowY:"hidden",overflowX:"hidden"}),(E||H)&&(n.style.overflowY="scroll"),(Q||q)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:se||G?`calc(100dvh - ${se+G}px)`:"100dvh",width:F||J?`calc(100vw - ${F+J}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=o,r.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function k(){Object.assign(n.style,Tt),Object.assign(r.style,St),u||(n.scrollTop=o,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=vt)}function L(){k(),h.request(f)}f();const b=x(s,"resize",L);return()=>{h.cancel(),k(),typeof s.removeEventListener=="function"&&b()}}class Xn{lockCount=0;restore=null;timeoutLock=Le.create();timeoutUnlock=Le.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=K(t).documentElement,s=Ye(r).getComputedStyle(r).overflowY;if(s==="hidden"||s==="clip"){this.restore=wt;return}const o=cn||!Gn(t);this.restore=o?Un(t):Kn(t)}}const Vn=new Xn;function Er(e=!0,t=null){B(()=>{if(e)return Vn.acquire(t)},[e,t])}export{De as A,un as B,mr as C,an as D,fn as E,Jn as F,Tn as G,Er as H,br as I,rt as J,fr as P,wn as a,tt as b,et as c,Ae as d,sr as e,nr as f,Fe as g,or as h,$n as i,ar as j,cr as k,ur as l,Zn as m,er as n,lr as o,ir as p,pr as q,jn as r,rr as s,dr as t,hr as u,zn as v,tr as w,Qn as x,gr as y,vn as z};
|
|
1
|
+
import{cT as Xe,cN as _t,bc as Ot,ba as B,be as wt,bK as K,cU as Ct,co as je,j as Se,ct as ze,r as g,bI as V,cv as ot,cV as Gt,bf as it,bH as We,cd as Dt,cu as ct,cW as xt,bM as x,bL as ke,c8 as he,cX as Ve,cY as le,cz as ae,bQ as C,bR as Ut,cM as It,cQ as Je,ce as Kt,c3 as ut,b_ as lt,c0 as Xt,cZ as Vt,bN as be,c2 as qt,cH as $t,bl as Pe,bX as jt,c_ as Qe,bi as Ye,c$ as zt,d0 as Be,bT as Jt,bG as Le,bU as Qt,bJ as Ie,ck as _e,cj as Zt,d1 as en,ch as tn,bS as nn,bY as Te,d2 as me,bm as rn,bn as sn,bh as Ge,d3 as on,d4 as at,cK as cn,cp as Ze}from"./main-C6oRShLQ.js";function Fe(e,t,n=!0){return e.filter(s=>s.parentId===t).flatMap(s=>[...!n||s.context?.open?[s]:[],...Fe(e,s.id,n)])}function ft(e,t){let n=[],r=e.find(s=>s.id===t)?.parentId;for(;r;){const s=e.find(o=>o.id===r);r=s?.parentId,s&&(n=n.concat(s))}return n}function un(e){e.preventDefault(),e.stopPropagation()}function ln(e){return"nativeEvent"in e}function an(e){return e.pointerType===""&&e.isTrusted?!0:Xe&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function fn(e){return _t?!1:!Xe&&e.width===0&&e.height===0||Xe&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function $n(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function dn(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function Ae(e){const t=Ot(pn,e).current;return t.next=e,B(t.effect),t}function pn(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}let Ne=0;function De(e,t={}){const{preventScroll:n=!1,sync:r=!1,shouldFocus:s}=t;cancelAnimationFrame(Ne);function o(){s&&!s()||e?.focus({preventScroll:n})}if(r)return o(),wt;const i=requestAnimationFrame(o);return Ne=i,()=>{Ne===i&&(cancelAnimationFrame(i),Ne=0)}}const Ue={inert:new WeakMap,"aria-hidden":new WeakMap},dt="data-base-ui-inert",qe={inert:new WeakSet,"aria-hidden":new WeakSet};let xe=new WeakMap,Ke=0;function gn(e){return qe[e]}function kt(e){return e?Ct(e)?e.host:kt(e.parentNode):null}const pt=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=kt(n);return e.contains(r)?r:null}).filter(n=>n!=null),gt=e=>{const t=new Set;return e.forEach(n=>{let r=n;for(;r&&!t.has(r);)t.add(r),r=r.parentNode}),t},ht=(e,t,n)=>{const r=[],s=o=>{!o||n.has(o)||Array.from(o.children).forEach(i=>{je(i)!=="script"&&(t.has(i)?s(i):r.push(i))})};return s(e),r};function hn(e,t,n,r,{mark:s=!0}){let o=null;r?o="inert":n&&(o="aria-hidden");let i=null,u=null;const h=pt(t,e),f=s?ht(t,gt(h),new Set(h)):[],k=[],L=[];if(o){const b=Ue[o],T=gn(o);u=T,i=b;const A=pt(t,Array.from(t.querySelectorAll("[aria-live]"))),P=h.concat(A);ht(t,gt(P),new Set(P)).forEach(y=>{const E=y.getAttribute(o),Q=E!==null&&E!=="false",H=(b.get(y)||0)+1;b.set(y,H),k.push(y),H===1&&Q&&T.add(y),Q||y.setAttribute(o,o==="inert"?"":"true")})}return s&&f.forEach(b=>{const T=(xe.get(b)||0)+1;xe.set(b,T),L.push(b),T===1&&b.setAttribute(dt,"")}),Ke+=1,()=>{i&&k.forEach(b=>{const A=(i.get(b)||0)-1;i.set(b,A),A||(!u?.has(b)&&o&&b.removeAttribute(o),u?.delete(b))}),s&&L.forEach(b=>{const T=(xe.get(b)||0)-1;xe.set(b,T),T||b.removeAttribute(dt)}),Ke-=1,Ke||(Ue.inert=new WeakMap,Ue["aria-hidden"]=new WeakMap,qe.inert=new WeakSet,qe["aria-hidden"]=new WeakSet,xe=new WeakMap)}}function mt(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:s=!0}=t,o=K(e[0]).body;return hn(e,o,n,r,{mark:s})}function Pt(){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=Pt();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 Ft=g.createContext(null),Mt=g.createContext(null),et=()=>g.useContext(Ft)?.id||null,tt=e=>{const t=g.useContext(Mt);return e??t};function jn(e){const t=ze(),n=tt(e),r=et();return B(()=>{if(!t)return;const s={id:t,parentId:r};return n?.addNode(s),()=>{n?.removeNode(s)}},[n,t,r]),t}function zn(e){const{children:t,id:n}=e,r=et();return Se.jsx(Ft.Provider,{value:g.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Jn(e){const{children:t,externalTree:n}=e,r=Ot(()=>n??new mn).current;return Se.jsx(Mt.Provider,{value:r,children:t})}function bn(e,t){const n=Ye(be(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 bt=20;let fe=[];function nt(){fe=fe.filter(e=>e.deref()?.isConnected)}function Et(e){nt(),e&&je(e)!=="body"&&(fe.push(new WeakRef(e)),fe.length>bt&&(fe=fe.slice(-bt)))}function yt(){return nt(),fe[fe.length-1]?.deref()}function En(e){return e?Qe(e)?e:xt(e)[0]||e:null}function Rt(e){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!e.getAttribute("role")?.includes("dialog"))return;const n=zt(e).filter(s=>{const o=s.getAttribute("data-tabindex")||"";return Qe(s)||s.hasAttribute("data-tabindex")&&!o.startsWith("-")}),r=e.getAttribute("tabindex");n.length===0?r!=="0"&&(e.setAttribute("tabindex","0"),e.setAttribute("data-tabindex","0")):(r!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Qn(e){const{context:t,children:n,disabled:r=!1,initialFocus:s=!0,returnFocus:o=!0,restoreFocus:i=!1,modal:u=!0,closeOnFocusOut:h=!0,openInteractionType:f="",nextFocusableElement:k,previousFocusableElement:L,beforeContentFocusGuardRef:b,externalTree:T,getInsideElements:A}=e,P="rootStore"in t?t.rootStore:t,_=P.useState("open"),y=P.useState("domReferenceElement"),E=P.useState("floatingElement"),{events:Q,dataRef:H}=P.context,q=V(()=>H.current.floatingContext?.nodeId),J=s===!1,G=ot(y)&&J,se=Ae(s),F=Ae(o),$=Ae(f),ve=Ae(_),N=tt(T),R=Gt(),Y=g.useRef(!1),oe=g.useRef(!1),ee=g.useRef(!1),te=g.useRef(null),Ee=g.useRef(""),de=g.useRef(""),pe=g.useRef(null),ye=g.useRef(null),S=it(pe,b,R?.beforeInsideRef),j=it(ye,R?.afterInsideRef),ie=We(),ce=We(),Oe=Dt(),Me=R!=null,p=ct(E),ne=V((m=p)=>m?xt(m):[]),Z=V(()=>A?.().filter(m=>m!=null)??[]);g.useEffect(()=>{if(r||!u)return;function m(W){W.key==="Tab"&&C(p,ae(K(p)))&&ne().length===0&&!G&&un(W)}const I=K(p);return x(I,"keydown",m)},[r,p,u,G,ne]),g.useEffect(()=>{if(r||!_)return;const m=K(p);function I(){ee.current=!1}function W(z){const a=be(z),O=Z(),d=C(E,a)||C(y,a)||C(R?.portalNode,a)||O.some(M=>M===a||C(M,a));ee.current=!d,de.current=z.pointerType||"keyboard",a?.closest(`[${qt}]`)&&(oe.current=!0,ce.start(0,()=>{oe.current=!1}))}function D(){de.current="keyboard"}return ke(x(m,"pointerdown",W,!0),x(m,"pointerup",I,!0),x(m,"pointercancel",I,!0),x(m,"keydown",D,!0),I)},[r,E,y,p,_,R,ce,Z]),g.useEffect(()=>{if(r||!h)return;const m=K(p);function I(){oe.current=!0,ce.start(0,()=>{oe.current=!1})}function W(O){const d=be(O);Qe(d)&&(te.current=d)}function D(O){const d=O.relatedTarget,M=O.currentTarget,U=be(O);u&&d==null&&U!=null&&C(E,U)&&Et(U),queueMicrotask(()=>{const w=q(),Re=P.context.triggerElements,c=Z(),l=d?.hasAttribute(Ve("focus-guard"))&&[pe.current,ye.current,R?.beforeInsideRef.current,R?.afterInsideRef.current,R?.beforeOutsideRef.current,R?.afterOutsideRef.current,le(L),le(k)].includes(d),X=!(C(y,d)||C(E,d)||C(d,E)||C(R?.portalNode,d)||c.some(v=>v===d||C(v,d))||d!=null&&Re.hasElement(d)||Re.hasMatchingElement(v=>C(v,d))||l||N&&(Fe(N.nodesRef.current,w).find(v=>C(v.context?.elements.floating,d)||C(v.context?.elements.domReference,d))||ft(N.nodesRef.current,w).find(v=>[v.context?.elements.floating,ct(v.context?.elements.floating)].includes(d)||v.context?.elements.domReference===d)));if(M===y&&p&&Rt(p),i&&M!==y&&!$t(U)&&ae(m)===m.body){if(he(p)&&(p.focus(),i==="popup")){Oe.request(()=>{p.focus()});return}const v=ne(),ue=te.current,we=(ue&&v.includes(ue)?ue:null)||v[v.length-1]||p;he(we)&&we.focus()}if(H.current.insideReactTree){H.current.insideReactTree=!1;return}(G||!u)&&d&&X&&!oe.current&&(G||d!==yt())&&(Y.current=!0,P.setOpen(!1,Pe(jt,O)))})}function z(){ee.current||(H.current.insideReactTree=!0,ie.start(0,()=>{H.current.insideReactTree=!1}))}const a=he(y)?y:null;if(!(!E&&!a))return ke(a&&x(a,"focusout",D),a&&x(a,"pointerdown",I),E&&x(E,"focusin",W),E&&x(E,"focusout",D),E&&R&&x(E,"focusout",z,!0))},[r,y,E,p,u,N,R,P,h,i,ne,G,q,H,ie,ce,Oe,k,L,Z]),g.useEffect(()=>{if(r||!E||!_)return;const m=Array.from(R?.portalNode?.querySelectorAll(`[${Ve("portal")}]`)||[]),W=(N?ft(N.nodesRef.current,q()):[]).find(M=>ot(M.context?.elements.domReference||null))?.context?.elements.domReference,z=[...[E,...m,pe.current,ye.current,R?.beforeOutsideRef.current,R?.afterOutsideRef.current,...Z()],W,le(L),le(k),G?y:null].filter(M=>M!=null),a=mt(z,{ariaHidden:u||G,mark:!1}),O=[E,...m].filter(M=>M!=null),d=mt(O);return()=>{d(),a()}},[_,r,y,E,u,R,G,N,q,k,L,Z]),B(()=>{if(!_||r||!he(p))return;const m=K(p),I=ae(m);queueMicrotask(()=>{const W=se.current,D=typeof W=="function"?W($.current||""):W;if(D===void 0||D===!1||C(p,I))return;let a=null;const O=()=>(a==null&&(a=ne(p)),a[0]||p);let d;D===!0||D===null?d=O():d=le(D),d=d||O();const M=C(p,ae(m));De(d,{preventScroll:d===p,shouldFocus(){if(!ve.current)return!1;if(M)return!0;const U=ae(m);return!(U!==d&&C(p,U))}})})},[r,_,p,ne,se,$,ve]),B(()=>{if(r||!p)return;const m=K(p),I=ae(m),W=$.current==null;Et(I);function D(a){if(a.open||(Ee.current=bn(a.nativeEvent,de.current)),a.reason===Ut&&a.nativeEvent.type==="mouseleave"&&(Y.current=!0),a.reason===It)if(a.nested)Y.current=!1;else if(an(a.nativeEvent)||fn(a.nativeEvent))Y.current=!1;else{let O=!1;K(p).createElement("div").focus({get preventScroll(){return O=!0,!1}}),O?Y.current=!1:Y.current=!0}}Q.on("openchange",D);function z(){const a=F.current;let O=typeof a=="function"?a(Ee.current):a;if(O===void 0||O===!1)return null;O===null&&(O=!0);const d=y?.isConnected?y:null,M=I?.isConnected&&je(I)!=="body"?I:null;let U=W?M||d:d||M;return U||(U=yt()||null),typeof O=="boolean"?U:le(O)||U||null}return()=>{Q.off("openchange",D);const a=ae(m),O=Z(),d=C(E,a)||O.some(w=>w===a||C(w,a))||N&&Fe(N.nodesRef.current,q(),!1).some(w=>C(w.context?.elements.floating,a)),M=F.current,U=z();queueMicrotask(()=>{const w=En(U),Re=typeof M!="boolean";M&&!Y.current&&he(w)&&(!(!Re&&w!==a&&a!==m.body)||d)&&w.focus({preventScroll:!0}),Y.current=!1})}},[r,E,p,F,$,Q,N,y,q,Z]),B(()=>{if(!Je||_||!E)return;const m=ae(K(E));!he(m)||!Kt(m)||C(E,m)&&m.blur()},[_,E]),B(()=>{if(!(r||!R))return R.setFocusManagerState({modal:u,closeOnFocusOut:h,open:_,onOpenChange:P.setOpen,domReference:y}),()=>{R.setFocusManagerState(null)}},[r,R,u,_,P,h,y]),B(()=>{if(!(r||!p))return Rt(p),()=>{queueMicrotask(nt)}},[r,p]);const ge=!r&&(u?!G:!0)&&(Me||u);return Se.jsxs(g.Fragment,{children:[ge&&Se.jsx(ut,{"data-type":"inside",ref:S,onFocus:m=>{if(u){const I=ne();De(I[I.length-1])}else R?.portalNode&&(Y.current=!1,lt(m,R.portalNode)?Xt(y)?.focus():le(L??R.beforeOutsideRef)?.focus())}}),n,ge&&Se.jsx(ut,{"data-type":"inside",ref:j,onFocus:m=>{u?De(ne()[0]):R?.portalNode&&(h&&(Y.current=!0),lt(m,R.portalNode)?Vt(y)?.focus():le(k??R.afterOutsideRef)?.focus())}})]})}function yn(){return!1}function Rn(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function Zn(e,t={}){const{enabled:n=!0,escapeKey:r=!0,outsidePress:s=!0,outsidePressEvent:o="sloppy",referencePress:i=yn,bubbles:u,externalTree:h}=t,f="rootStore"in e?e.rootStore:e,k=f.useState("open"),L=f.useState("floatingElement"),{dataRef:b}=f.context,T=tt(h),A=V(typeof s=="function"?s:()=>!1),P=typeof s=="function"?A:s,_=P!==!1,y=V(()=>o),{escapeKey:E,outsidePress:Q}=Rn(u),H=g.useRef(!1),q=g.useRef(!1),J=g.useRef(!1),G=g.useRef(!1),se=g.useRef(""),F=g.useRef(null),$=We(),ve=We(),N=V(()=>{ve.clear(),b.current.insideReactTree=!1}),R=V(S=>{const j=b.current.floatingContext?.nodeId;return(T?Fe(T.nodesRef.current,j):[]).some(ce=>ce.context?.open&&!ce.context.dataRef.current[S])}),Y=V(S=>Be(S,f.select("floatingElement"))||Be(S,f.select("domReferenceElement"))),oe=V(S=>{i()&&f.setOpen(!1,Pe(Jt,S.nativeEvent))}),ee=V(S=>{if(!k||!n||!r||S.key!=="Escape"||G.current||!E&&R("__escapeKeyBubbles"))return;const j=ln(S)?S.nativeEvent:S,ie=Pe(Qt,j);f.setOpen(!1,ie),ie.isCanceled||S.preventDefault(),!E&&!ie.isPropagationAllowed&&S.stopPropagation()}),te=V(()=>{b.current.insideReactTree=!0,ve.start(0,N)}),Ee=V(S=>{if(!k||!n||S.button!==0)return;const j=be(S.nativeEvent);C(f.select("floatingElement"),j)&&(H.current||(H.current=!0,q.current=!1))}),de=V(S=>{!k||!n||(S.defaultPrevented||S.nativeEvent.defaultPrevented)&&H.current&&(q.current=!0)});g.useEffect(()=>{if(!k||!n)return;b.current.__escapeKeyBubbles=E,b.current.__outsidePressBubbles=Q;const S=new Le,j=new Le;function ie(){S.clear(),G.current=!0}function ce(){S.start(Je?5:0,()=>{G.current=!1})}function Oe(){J.current=!0,j.start(0,()=>{J.current=!1})}function Me(){H.current=!1,q.current=!1}function p(){const c=se.current,l=c==="pen"||!c?"mouse":c,X=y(),v=typeof X=="function"?X():X;return typeof v=="string"?v:v[l]}function ne(c){const l=p();return l==="intentional"&&c.type!=="click"||l==="sloppy"&&c.type==="click"}function Z(c){const l=b.current.floatingContext?.nodeId,X=T&&Fe(T.nodesRef.current,l).some(v=>Be(c,v.context?.elements.floating));return Y(c)||X}function ge(c){if(ne(c)){c.type!=="click"&&!Y(c)&&(j.clear(),J.current=!1),N();return}if(b.current.insideReactTree){N();return}const l=be(c),X=`[${Ve("inert")}]`,v=Ie(l)?l.getRootNode():null,ue=Array.from((Ct(v)?v:K(f.select("floatingElement"))).querySelectorAll(X)),we=f.context.triggerElements;if(l&&(we.hasElement(l)||we.hasMatchingElement(re=>C(re,l))))return;let Ce=Ie(l)?l:null;for(;Ce&&!_e(Ce);){const re=Zt(Ce);if(_e(re)||!Ie(re))break;Ce=re}if(!(ue.length&&Ie(l)&&!en(l)&&!C(l,f.select("floatingElement"))&&ue.every(re=>!C(Ce,re)))){if(he(l)&&!("touches"in c)){const re=_e(l),He=tn(l),st=/auto|scroll/,At=re||st.test(He.overflowX),Nt=re||st.test(He.overflowY),Wt=At&&l.clientWidth>0&&l.scrollWidth>l.clientWidth,Lt=Nt&&l.clientHeight>0&&l.scrollHeight>l.clientHeight,Yt=He.direction==="rtl",Ht=Lt&&(Yt?c.offsetX<=l.offsetWidth-l.clientWidth:c.offsetX>l.clientWidth),Bt=Wt&&c.offsetY>l.clientHeight;if(Ht||Bt)return}if(!Z(c)){if(p()==="intentional"&&J.current){j.clear(),J.current=!1;return}typeof P=="function"&&!P(c)||R("__outsidePressBubbles")||(f.setOpen(!1,Pe(It,c)),N())}}}function m(c){p()!=="sloppy"||c.pointerType==="touch"||!f.select("open")||!n||Y(c)||ge(c)}function I(c){if(p()!=="sloppy"||!f.select("open")||!n||Y(c))return;const l=c.touches[0];l&&(F.current={startTime:Date.now(),startX:l.clientX,startY:l.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},$.start(1e3,()=>{F.current&&(F.current.dismissOnTouchEnd=!1,F.current.dismissOnMouseDown=!1)}))}function W(c,l){const X=be(c);if(!X)return;const v=x(X,c.type,()=>{l(c),v()})}function D(c){se.current="touch",W(c,I)}function z(c){$.clear(),c.type==="pointerdown"&&(se.current=c.pointerType),!(c.type==="mousedown"&&F.current&&!F.current.dismissOnMouseDown)&&W(c,l=>{l.type==="pointerdown"?m(l):ge(l)})}function a(c){if(!H.current)return;const l=q.current;if(Me(),p()==="intentional"){if(c.type==="pointercancel"){l&&Oe();return}if(!Z(c)){if(l){Oe();return}typeof P=="function"&&!P(c)||(j.clear(),J.current=!0,N())}}}function O(c){if(p()!=="sloppy"||!F.current||Y(c))return;const l=c.touches[0];if(!l)return;const X=Math.abs(l.clientX-F.current.startX),v=Math.abs(l.clientY-F.current.startY),ue=Math.sqrt(X*X+v*v);ue>5&&(F.current.dismissOnTouchEnd=!0),ue>10&&(ge(c),$.clear(),F.current=null)}function d(c){W(c,O)}function M(c){p()!=="sloppy"||!F.current||Y(c)||(F.current.dismissOnTouchEnd&&ge(c),$.clear(),F.current=null)}function U(c){W(c,M)}const w=K(L),Re=ke(r&&ke(x(w,"keydown",ee),x(w,"compositionstart",ie),x(w,"compositionend",ce)),_&&ke(x(w,"click",z,!0),x(w,"pointerdown",z,!0),x(w,"pointerup",a,!0),x(w,"pointercancel",a,!0),x(w,"mousedown",z,!0),x(w,"mouseup",a,!0),x(w,"touchstart",D,!0),x(w,"touchmove",d,!0),x(w,"touchend",U,!0)));return()=>{Re(),S.clear(),j.clear(),Me(),J.current=!1}},[b,L,r,_,P,k,n,E,Q,ee,N,y,R,Y,T,f,$]),g.useEffect(N,[P,N]);const pe=g.useMemo(()=>({onKeyDown:ee,onPointerDown:oe,onClick:oe}),[ee,oe]),ye=g.useMemo(()=>({onKeyDown:ee,onPointerDown:de,onMouseDown:de,onClickCapture:te,onMouseDownCapture(S){te(),Ee(S)},onPointerDownCapture(S){te(),Ee(S)},onMouseUpCapture:te,onTouchEndCapture:te,onTouchMoveCapture:te}),[ee,te,Ee,de]);return g.useMemo(()=>n?{reference:pe,floating:ye,trigger:pe}:{},[n,pe,ye])}function Tn(e){const t=g.useRef(!0);t.current&&(t.current=!1,e())}const Sn={open:Te(e=>e.open),transitionStatus:Te(e=>e.transitionStatus),domReferenceElement:Te(e=>e.domReferenceElement),referenceElement:Te(e=>e.positionReference??e.referenceElement),floatingElement:Te(e=>e.floatingElement),floatingId:Te(e=>e.floatingId)};class vn extends nn{constructor(t){const{syncOnly:n,nested:r,onOpenChange:s,triggerElements:o,...i}=t;super({...i,positionReference:i.referenceElement,domReferenceElement:i.referenceElement},{onOpenChange:s,dataRef:{current:{}},events:Pt(),nested:r,triggerElements:o},Sn),this.syncOnly=n}syncOpenEvent=(t,n)=>{(!t||!this.state.open||n!=null&&dn(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 On(e){const{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:s,nested:o,onOpenChange:i}=e,u=t.useState("open"),h=t.useState("activeTriggerElement"),f=t.useState(n?"popupElement":"positionerElement"),k=t.context.triggerElements,L=i,b=g.useRef(null);r===void 0&&b.current===null&&(b.current=new vn({open:u,transitionStatus:void 0,referenceElement:h,floatingElement:f,triggerElements:k,onOpenChange:L,floatingId:s,syncOnly:!0,nested:o}));const T=r??b.current;return t.useSyncedValue("floatingId",s),B(()=>{const A={open:u,floatingId:s,referenceElement:h,floatingElement:f};Ie(h)&&(A.domReferenceElement=h),T.state.positionReference===T.state.referenceElement&&(A.positionReference=h),T.update(A)},[u,s,h,f,T]),T.context.onOpenChange=L,T.context.nested=o,T}function wn(e,t=!1,n=!1){const[r,s]=g.useState(e&&t?"idle":void 0),[o,i]=g.useState(e);return e&&!o&&(i(!0),s("starting")),!e&&o&&r!=="ending"&&!n&&s("ending"),!e&&!o&&r==="ending"&&s(void 0),B(()=>{if(!e&&o&&r!=="ending"&&n){const u=me.request(()=>{s("ending")});return()=>{me.cancel(u)}}},[e,o,r,n]),B(()=>{if(!e||t)return;const u=me.request(()=>{s(void 0)});return()=>{me.cancel(u)}},[t,e]),B(()=>{if(!e||!t)return;e&&o&&r!=="idle"&&s("starting");const u=me.request(()=>{s("idle")});return()=>{me.cancel(u)}},[t,e,o,r]),{mounted:o,setMounted:i,transitionStatus:r}}const er={tabIndex:-1,[on]:""};function tr(e){return t=>t==="touch"?e.current:!0}function nr(e,t,n=!1){const r=ze(),s=et()!=null,o=g.useRef(null);e===void 0&&o.current===null&&(o.current=t(r,s));const i=e??o.current;return On({popupStore:i,treatPopupAsFloatingElement:n,floatingRootContext:i.state.floatingRootContext,floatingId:r,nested:s,onOpenChange:i.setOpen}),{store:i,internalStore:o.current}}function Cn(e,t){const n=g.useRef(null),r=g.useRef(null);return g.useCallback(s=>{if(e===void 0)return;let o=!1;if(n.current!==null){const i=n.current,u=r.current,h=t.context.triggerElements.getById(i);u&&h===u&&(t.context.triggerElements.delete(i),o=!0),n.current=null,r.current=null}if(s!==null&&(n.current=e,r.current=s,t.context.triggerElements.add(e,s),o=!0),o){const i=t.context.triggerElements.size;t.select("open")&&t.state.triggerCount!==i&&t.set("triggerCount",i)}},[t,e])}function rr(e,t,n,r=!1){t?e.preventUnmountingOnClose=!1:r&&(e.preventUnmountingOnClose=!0);const s=n?.id??null;(s||t)&&(e.activeTriggerId=s,e.activeTriggerElement=n??null)}function sr(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function or(e,t,n,r){Tn(()=>{t===void 0&&e.state.open===!1&&n&&(e.state={...e.state,open:!0,activeTriggerId:r,preventUnmountingOnClose:!1})})}function ir(e,t,n,r){const s=n.useState("isMountedByTrigger",e),o=Cn(e,n),i=V(u=>{if(o(u),!u)return;const h=n.select("open"),f=n.select("activeTriggerId");if(f===e){n.update({activeTriggerElement:u,...h?r:null});return}f==null&&h&&n.update({activeTriggerId:e,activeTriggerElement:u,...r})});return B(()=>{s&&n.update({activeTriggerElement:t.current,...r})},[s,n,t,...Object.values(r)]),{registerTrigger:i,isMountedByThisTrigger:s}}function cr(e,t={}){const{closeOnActiveTriggerUnmount:n=!1}=t,r=e.useState("open"),s=e.useState("triggerCount");B(()=>{if(!r){e.state.triggerCount!==0&&e.set("triggerCount",0);return}const o=e.context.triggerElements.size,i={};e.state.triggerCount!==o&&(i.triggerCount=o);const u=e.select("activeTriggerId");let h=null;if(u){const f=e.context.triggerElements.getById(u);f?f!==e.state.activeTriggerElement&&(i.activeTriggerElement=f):h=u}if(!h&&!u&&o===1){const f=e.context.triggerElements.entries().next();if(!f.done){const[k,L]=f.value;i.activeTriggerId=k,i.activeTriggerElement=L}}(i.triggerCount!==void 0||i.activeTriggerId!==void 0||i.activeTriggerElement!==void 0)&&e.update(i),h&&n&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===h&&!e.context.triggerElements.getById(h)){const f=Pe(rn);e.setOpen(!1,f),f.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[r,e,s,n])}function ur(e,t,n){const{mounted:r,setMounted:s,transitionStatus:o}=wn(e),i=t.useState("preventUnmountingOnClose"),u=e?!1:i;t.useSyncedValues({mounted:r,transitionStatus:o,preventUnmountingOnClose:u});const h=V(()=>{s(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return sn({enabled:r&&!e&&!u,open:e,ref:t.context.popupRef,onComplete(){e||h()}}),{forceUnmount:h,transitionStatus:o}}function lr(e,t){e.useSyncedValues(t),B(()=>()=>{e.update({activeTriggerProps:Ge,inactiveTriggerProps:Ge,popupProps:Ge})},[e])}function ar(e,t){B(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),B(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class fr{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 rt=(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})({}),$e=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const xn={[$e.popupOpen]:""},In={[$e.popupOpen]:"",[$e.pressed]:""},kn={[rt.open]:""},Pn={[rt.closed]:""},Fn={[rt.anchorHidden]:""},dr={open(e){return e?xn:null}},pr={open(e){return e?In:null}},gr={open(e){return e?kn:Pn},anchorHidden(e){return e?Fn:null}};function hr(e){return ze(e,"base-ui")}const Mn="ArrowUp",An="ArrowDown",Nn="ArrowLeft",Wn="ArrowRight",Ln="Home",Yn="End",Hn=new Set([Nn,Wn]),Bn=new Set([Mn,An]),_n=new Set([...Hn,...Bn]),mr=new Set([..._n,Ln,Yn]),br=g.forwardRef(function(t,n){const{cutout:r,...s}=t;let o;if(r){const i=r.getBoundingClientRect();o=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${i.left}px ${i.top}px,${i.left}px ${i.bottom}px,${i.right}px ${i.bottom}px,${i.right}px ${i.top}px,${i.left}px ${i.top}px)`}return Se.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...s,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:o}})});let Tt={},St={},vt="";function Gn(e){if(typeof document>"u")return!1;const t=K(e);return Ye(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=K(e),r=n.documentElement,s=n.body,o=Ze(r)?r:s,i=o.style.overflowY,u=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",o.style.overflowY="scroll";const h=o.offsetWidth;o.style.overflowY="hidden";const f=o.offsetWidth;return o.style.overflowY=i,r.style.scrollbarGutter=u,h===f}function Un(e){const t=K(e),n=t.documentElement,r=t.body,s=Ze(n)?n:r,o={overflowY:s.style.overflowY,overflowX:s.style.overflowX};return Object.assign(s.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(s.style,o)}}function Kn(e){const t=K(e),n=t.documentElement,r=t.body,s=Ye(n);let o=0,i=0,u=!1;const h=me.create();if(Je&&(s.visualViewport?.scale??1)!==1)return()=>{};function f(){const T=s.getComputedStyle(n),A=s.getComputedStyle(r),y=(T.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";o=n.scrollTop,i=n.scrollLeft,Tt={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},vt=n.style.scrollBehavior,St={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,Q=n.scrollWidth>n.clientWidth,H=T.overflowY==="scroll"||A.overflowY==="scroll",q=T.overflowX==="scroll"||A.overflowX==="scroll",J=Math.max(0,s.innerWidth-r.clientWidth),G=Math.max(0,s.innerHeight-r.clientHeight),se=parseFloat(A.marginTop)+parseFloat(A.marginBottom),F=parseFloat(A.marginLeft)+parseFloat(A.marginRight),$=Ze(n)?n:r;if(u=Dn(e),u){n.style.scrollbarGutter=y,$.style.overflowY="hidden",$.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:y,overflowY:"hidden",overflowX:"hidden"}),(E||H)&&(n.style.overflowY="scroll"),(Q||q)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:se||G?`calc(100dvh - ${se+G}px)`:"100dvh",width:F||J?`calc(100vw - ${F+J}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=o,r.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function k(){Object.assign(n.style,Tt),Object.assign(r.style,St),u||(n.scrollTop=o,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=vt)}function L(){k(),h.request(f)}f();const b=x(s,"resize",L);return()=>{h.cancel(),k(),typeof s.removeEventListener=="function"&&b()}}class Xn{lockCount=0;restore=null;timeoutLock=Le.create();timeoutUnlock=Le.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=K(t).documentElement,s=Ye(r).getComputedStyle(r).overflowY;if(s==="hidden"||s==="clip"){this.restore=wt;return}const o=cn||!Gn(t);this.restore=o?Un(t):Kn(t)}}const Vn=new Xn;function Er(e=!0,t=null){B(()=>{if(e)return Vn.acquire(t)},[e,t])}export{De as A,un as B,mr as C,an as D,fn as E,Jn as F,Tn as G,Er as H,br as I,rt as J,fr as P,wn as a,tt as b,et as c,Ae as d,sr as e,nr as f,Fe as g,or as h,$n as i,ar as j,cr as k,ur as l,Zn as m,er as n,lr as o,ir as p,pr as q,jn as r,rr as s,dr as t,hr as u,zn as v,tr as w,Qn as x,gr as y,vn as z};
|
|
@@ -235,7 +235,7 @@
|
|
|
235
235
|
]
|
|
236
236
|
}
|
|
237
237
|
</script>
|
|
238
|
-
<script type="module" crossorigin src="/assets/main-
|
|
238
|
+
<script type="module" crossorigin src="/assets/main-C6oRShLQ.js"></script>
|
|
239
239
|
<link rel="stylesheet" crossorigin href="/assets/main--nUrKVF3.css">
|
|
240
240
|
</head>
|
|
241
241
|
<body>
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"description": "Shareable Token Tracker dashboard snapshot."
|
|
76
76
|
}
|
|
77
77
|
</script>
|
|
78
|
-
<script type="module" crossorigin src="/assets/main-
|
|
78
|
+
<script type="module" crossorigin src="/assets/main-C6oRShLQ.js"></script>
|
|
79
79
|
<link rel="stylesheet" crossorigin href="/assets/main--nUrKVF3.css">
|
|
80
80
|
</head>
|
|
81
81
|
<body>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tokentracker-cli",
|
|
3
|
-
"version": "0.74.
|
|
3
|
+
"version": "0.74.4",
|
|
4
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": {
|
package/src/commands/init.js
CHANGED
|
@@ -344,11 +344,7 @@ async function runSetup({
|
|
|
344
344
|
await writeJson(configPath, config);
|
|
345
345
|
await chmod600IfPossible(configPath);
|
|
346
346
|
|
|
347
|
-
await
|
|
348
|
-
notifyPath,
|
|
349
|
-
buildNotifyHandler({ trackerDir, trackerBinPath, packageName: "tokentracker-cli" }),
|
|
350
|
-
);
|
|
351
|
-
await fs.chmod(notifyPath, 0o755).catch(() => {});
|
|
347
|
+
await writeNotifyHandler({ trackerDir, notifyPath });
|
|
352
348
|
|
|
353
349
|
const summary = await applyIntegrationSetup({
|
|
354
350
|
home,
|
|
@@ -366,6 +362,62 @@ async function runSetup({
|
|
|
366
362
|
};
|
|
367
363
|
}
|
|
368
364
|
|
|
365
|
+
async function writeNotifyHandler({ trackerDir, binDir, notifyPath, packageName = "tokentracker-cli" }) {
|
|
366
|
+
const resolvedNotifyPath =
|
|
367
|
+
notifyPath || path.join(binDir || path.join(path.dirname(trackerDir), "bin"), "notify.cjs");
|
|
368
|
+
await ensureDir(path.dirname(resolvedNotifyPath));
|
|
369
|
+
await writeFileAtomic(
|
|
370
|
+
resolvedNotifyPath,
|
|
371
|
+
buildNotifyHandler({ trackerDir, packageName }),
|
|
372
|
+
);
|
|
373
|
+
await fs.chmod(resolvedNotifyPath, 0o755).catch(() => {});
|
|
374
|
+
return resolvedNotifyPath;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
async function repairCodexNotifyIntegration({ home = os.homedir(), trackerDir, binDir, safeMode = true } = {}) {
|
|
378
|
+
const paths = trackerDir && binDir ? { trackerDir, binDir } : await resolveTrackerPaths({ home });
|
|
379
|
+
const resolvedTrackerDir = trackerDir || paths.trackerDir;
|
|
380
|
+
const resolvedBinDir = binDir || paths.binDir;
|
|
381
|
+
const notifyPath = await writeNotifyHandler({
|
|
382
|
+
trackerDir: resolvedTrackerDir,
|
|
383
|
+
binDir: resolvedBinDir,
|
|
384
|
+
});
|
|
385
|
+
const context = buildIntegrationTargets({
|
|
386
|
+
home,
|
|
387
|
+
trackerDir: resolvedTrackerDir,
|
|
388
|
+
notifyPath,
|
|
389
|
+
});
|
|
390
|
+
const codexProbe = await probeFile(context.codexConfigPath);
|
|
391
|
+
if (!codexProbe.exists) {
|
|
392
|
+
return { changed: false, skippedReason: "config-missing", notifyPath };
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
const currentNotify = await readCodexNotify(context.codexConfigPath);
|
|
396
|
+
if (arraysEqual(currentNotify, context.notifyCmd)) {
|
|
397
|
+
return { changed: false, skippedReason: null, notifyPath };
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
const repairDecision = safeMode
|
|
401
|
+
? await shouldRepairCodexNotify({
|
|
402
|
+
currentNotify,
|
|
403
|
+
expectedNotify: context.notifyCmd,
|
|
404
|
+
notifyOriginalPath: context.notifyOriginalPath,
|
|
405
|
+
})
|
|
406
|
+
: { repair: true, captureOriginal: true, replaceOriginal: false };
|
|
407
|
+
if (!repairDecision.repair) {
|
|
408
|
+
return { changed: false, skippedReason: repairDecision.reason || "external-notify", notifyPath };
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
const result = await upsertCodexNotify({
|
|
412
|
+
codexConfigPath: context.codexConfigPath,
|
|
413
|
+
notifyCmd: context.notifyCmd,
|
|
414
|
+
notifyOriginalPath: context.notifyOriginalPath,
|
|
415
|
+
captureOriginal: repairDecision.captureOriginal,
|
|
416
|
+
replaceOriginal: repairDecision.replaceOriginal,
|
|
417
|
+
});
|
|
418
|
+
return { ...result, skippedReason: null, notifyPath };
|
|
419
|
+
}
|
|
420
|
+
|
|
369
421
|
function buildIntegrationTargets({ home, trackerDir, notifyPath }) {
|
|
370
422
|
const codexHome = process.env.CODEX_HOME || path.join(home, ".codex");
|
|
371
423
|
const codexConfigPath = path.join(codexHome, "config.toml");
|
|
@@ -425,10 +477,12 @@ async function applyIntegrationSetup({ home, trackerDir, notifyPath, notifyOrigi
|
|
|
425
477
|
|
|
426
478
|
const codexProbe = await probeFile(context.codexConfigPath);
|
|
427
479
|
if (codexProbe.exists) {
|
|
480
|
+
const currentNotify = await readCodexNotify(context.codexConfigPath);
|
|
428
481
|
const result = await upsertCodexNotify({
|
|
429
482
|
codexConfigPath: context.codexConfigPath,
|
|
430
483
|
notifyCmd: context.notifyCmd,
|
|
431
484
|
notifyOriginalPath: context.notifyOriginalPath,
|
|
485
|
+
replaceOriginal: shouldReplaceStoredOriginalNotify(currentNotify, context.notifyCmd),
|
|
432
486
|
});
|
|
433
487
|
summary.push({
|
|
434
488
|
label: "Codex CLI",
|
|
@@ -678,10 +732,12 @@ async function applyIntegrationSetup({ home, trackerDir, notifyPath, notifyOrigi
|
|
|
678
732
|
|
|
679
733
|
const codeProbe = await probeFile(context.codeConfigPath);
|
|
680
734
|
if (codeProbe.exists) {
|
|
735
|
+
const currentNotify = await readEveryCodeNotify(context.codeConfigPath);
|
|
681
736
|
const result = await upsertEveryCodeNotify({
|
|
682
737
|
codeConfigPath: context.codeConfigPath,
|
|
683
738
|
notifyCmd: context.codeNotifyCmd,
|
|
684
739
|
notifyOriginalPath: context.codeNotifyOriginalPath,
|
|
740
|
+
replaceOriginal: shouldReplaceStoredOriginalNotify(currentNotify, context.codeNotifyCmd),
|
|
685
741
|
});
|
|
686
742
|
summary.push({
|
|
687
743
|
label: "Every Code",
|
|
@@ -857,6 +913,48 @@ function arraysEqual(a, b) {
|
|
|
857
913
|
return true;
|
|
858
914
|
}
|
|
859
915
|
|
|
916
|
+
async function shouldRepairCodexNotify({ currentNotify, expectedNotify, notifyOriginalPath }) {
|
|
917
|
+
if (!Array.isArray(currentNotify) || currentNotify.length === 0) {
|
|
918
|
+
return { repair: true, captureOriginal: true, replaceOriginal: true };
|
|
919
|
+
}
|
|
920
|
+
if (arraysEqual(currentNotify, expectedNotify)) {
|
|
921
|
+
return { repair: false, reason: "already-set" };
|
|
922
|
+
}
|
|
923
|
+
if (isTokenTrackerNotify(currentNotify, expectedNotify)) {
|
|
924
|
+
return { repair: true, captureOriginal: false };
|
|
925
|
+
}
|
|
926
|
+
if (isSkyComputerUseNotify(currentNotify)) {
|
|
927
|
+
return { repair: true, captureOriginal: true, replaceOriginal: true };
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
const original = await readJson(notifyOriginalPath);
|
|
931
|
+
const originalNotify = Array.isArray(original?.notify) ? original.notify : null;
|
|
932
|
+
if (arraysEqual(currentNotify, originalNotify)) {
|
|
933
|
+
return { repair: true, captureOriginal: true, replaceOriginal: false };
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
return { repair: false, reason: "external-notify" };
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
function shouldReplaceStoredOriginalNotify(currentNotify, expectedNotify) {
|
|
940
|
+
if (isTokenTrackerNotify(currentNotify, expectedNotify)) return false;
|
|
941
|
+
return currentNotify === null || Array.isArray(currentNotify);
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
function isTokenTrackerNotify(cmd, expectedNotify) {
|
|
945
|
+
if (!Array.isArray(cmd)) return false;
|
|
946
|
+
if (arraysEqual(cmd, expectedNotify)) return true;
|
|
947
|
+
const notifyPath = cmd.find((part) => typeof part === "string" && part.endsWith("notify.cjs"));
|
|
948
|
+
if (!notifyPath) return false;
|
|
949
|
+
const normalized = notifyPath.replace(/\\/g, "/");
|
|
950
|
+
return normalized.includes("/.tokentracker/");
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
function isSkyComputerUseNotify(cmd) {
|
|
954
|
+
if (!Array.isArray(cmd)) return false;
|
|
955
|
+
return cmd.some((part) => typeof part === "string" && part.includes("SkyComputerUseClient"));
|
|
956
|
+
}
|
|
957
|
+
|
|
860
958
|
function parseArgs(argv) {
|
|
861
959
|
const out = {
|
|
862
960
|
baseUrl: null,
|
|
@@ -1014,7 +1112,9 @@ try {
|
|
|
1014
1112
|
const cmd = Array.isArray(original?.notify) ? original.notify : null;
|
|
1015
1113
|
if (cmd && cmd.length > 0 && !isSelfNotify(cmd) && shouldChainNotify(cmd)) {
|
|
1016
1114
|
const args = cmd.slice(1);
|
|
1017
|
-
if (payloadArgs.length > 0
|
|
1115
|
+
if (payloadArgs.length > 0 && !containsSequence(args, payloadArgs)) {
|
|
1116
|
+
args.push(...payloadArgs);
|
|
1117
|
+
}
|
|
1018
1118
|
spawnDetached([cmd[0], ...args]);
|
|
1019
1119
|
}
|
|
1020
1120
|
}
|
|
@@ -1051,14 +1151,9 @@ function isSelfNotify(cmd) {
|
|
|
1051
1151
|
|
|
1052
1152
|
function shouldChainNotify(cmd) {
|
|
1053
1153
|
if (!Array.isArray(cmd) || cmd.length === 0) return false;
|
|
1054
|
-
if (containsSkyComputerUseClient(cmd)) return false;
|
|
1055
1154
|
return isRunnableCommand(cmd[0]);
|
|
1056
1155
|
}
|
|
1057
1156
|
|
|
1058
|
-
function containsSkyComputerUseClient(cmd) {
|
|
1059
|
-
return cmd.some((part) => typeof part === 'string' && part.includes('SkyComputerUseClient'));
|
|
1060
|
-
}
|
|
1061
|
-
|
|
1062
1157
|
function isRunnableCommand(command) {
|
|
1063
1158
|
if (typeof command !== 'string' || command.length === 0) return false;
|
|
1064
1159
|
const explicitPath = command.startsWith('~/') || command.includes('/');
|
|
@@ -1072,10 +1167,31 @@ function isRunnableCommand(command) {
|
|
|
1072
1167
|
return false;
|
|
1073
1168
|
}
|
|
1074
1169
|
}
|
|
1170
|
+
|
|
1171
|
+
function containsSequence(haystack, needle) {
|
|
1172
|
+
if (!Array.isArray(haystack) || !Array.isArray(needle) || needle.length === 0) return false;
|
|
1173
|
+
if (needle.length > haystack.length) return false;
|
|
1174
|
+
for (let i = 0; i <= haystack.length - needle.length; i++) {
|
|
1175
|
+
let matched = true;
|
|
1176
|
+
for (let j = 0; j < needle.length; j++) {
|
|
1177
|
+
if (haystack[i + j] !== needle[j]) {
|
|
1178
|
+
matched = false;
|
|
1179
|
+
break;
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
if (matched) return true;
|
|
1183
|
+
}
|
|
1184
|
+
return false;
|
|
1185
|
+
}
|
|
1075
1186
|
`;
|
|
1076
1187
|
}
|
|
1077
1188
|
|
|
1078
|
-
module.exports = {
|
|
1189
|
+
module.exports = {
|
|
1190
|
+
cmdInit,
|
|
1191
|
+
buildNotifyHandler,
|
|
1192
|
+
installLocalTrackerApp,
|
|
1193
|
+
repairCodexNotifyIntegration,
|
|
1194
|
+
};
|
|
1079
1195
|
|
|
1080
1196
|
async function probeFile(p) {
|
|
1081
1197
|
try {
|
package/src/commands/serve.js
CHANGED
|
@@ -58,7 +58,7 @@ async function cmdServe(argv) {
|
|
|
58
58
|
const opts = parseArgs(argv);
|
|
59
59
|
|
|
60
60
|
// 0. First-time setup: if tracker dir doesn't exist, run init first
|
|
61
|
-
const { trackerDir } = await resolveTrackerPaths();
|
|
61
|
+
const { trackerDir, binDir } = await resolveTrackerPaths();
|
|
62
62
|
if (!fssync.existsSync(path.join(trackerDir, "cursors.json"))) {
|
|
63
63
|
process.stdout.write("First time? Setting up Token Tracker...\n\n");
|
|
64
64
|
try {
|
|
@@ -70,8 +70,12 @@ async function cmdServe(argv) {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
try {
|
|
73
|
-
const { installLocalTrackerApp } = require("./init");
|
|
73
|
+
const { installLocalTrackerApp, repairCodexNotifyIntegration } = require("./init");
|
|
74
74
|
await installLocalTrackerApp({ appDir: path.join(trackerDir, "app") });
|
|
75
|
+
const repairResult = await repairCodexNotifyIntegration({ trackerDir, binDir, safeMode: true });
|
|
76
|
+
if (repairResult?.skippedReason && repairResult.skippedReason !== "config-missing") {
|
|
77
|
+
process.stdout.write(`Codex notify repair skipped: ${repairResult.skippedReason}\n`);
|
|
78
|
+
}
|
|
75
79
|
} catch (e) {
|
|
76
80
|
process.stdout.write(`Runtime refresh warning: ${e?.message || e}\n`);
|
|
77
81
|
}
|
package/src/commands/status.js
CHANGED
|
@@ -108,6 +108,7 @@ async function cmdStatus(argv = []) {
|
|
|
108
108
|
env: process.env,
|
|
109
109
|
});
|
|
110
110
|
const notifyPath = path.join(binDir, "notify.cjs");
|
|
111
|
+
const codexNotifyCmd = ["/usr/bin/env", "node", notifyPath];
|
|
111
112
|
const claudeHookCommand = buildClaudeHookCommand(notifyPath);
|
|
112
113
|
const codebuddyHookCommand = buildHookCommand(notifyPath, "codebuddy");
|
|
113
114
|
const workbuddyHookCommand = buildHookCommand(notifyPath, "workbuddy");
|
|
@@ -132,7 +133,7 @@ async function cmdStatus(argv = []) {
|
|
|
132
133
|
);
|
|
133
134
|
|
|
134
135
|
const codexNotify = await readCodexNotify(codexConfigPath);
|
|
135
|
-
const notifyConfigured =
|
|
136
|
+
const notifyConfigured = arraysEqual(codexNotify, codexNotifyCmd);
|
|
136
137
|
const everyCodeNotify = await readEveryCodeNotify(codeConfigPath);
|
|
137
138
|
const everyCodeConfigured =
|
|
138
139
|
Array.isArray(everyCodeNotify) && everyCodeNotify.length > 0;
|
|
@@ -658,6 +659,13 @@ function parseArgs(argv) {
|
|
|
658
659
|
return out;
|
|
659
660
|
}
|
|
660
661
|
|
|
662
|
+
function arraysEqual(a, b) {
|
|
663
|
+
if (!Array.isArray(a) || !Array.isArray(b)) return false;
|
|
664
|
+
if (a.length !== b.length) return false;
|
|
665
|
+
for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;
|
|
666
|
+
return true;
|
|
667
|
+
}
|
|
668
|
+
|
|
661
669
|
// Pure renderer: turn the structured summary into a fixed-width ASCII table.
|
|
662
670
|
// "light" output is for AI agents and CI: deterministic columns, no emoji or
|
|
663
671
|
// spinner side effects, easy to grep. Returns a string (caller adds trailing
|
|
@@ -119,6 +119,8 @@ async function cmdUninstall(argv) {
|
|
|
119
119
|
? `- Codex notify restored: ${codexConfigPath}`
|
|
120
120
|
: codexRestore?.skippedReason === "no-backup-not-installed"
|
|
121
121
|
? "- Codex notify: skipped (no backup; not installed)"
|
|
122
|
+
: codexRestore?.skippedReason === "current-not-managed"
|
|
123
|
+
? "- Codex notify: skipped (current notify is not managed by TokenTracker)"
|
|
122
124
|
: "- Codex notify: no change"
|
|
123
125
|
: "- Codex notify: skipped (config.toml not found)",
|
|
124
126
|
codeConfigExists
|
|
@@ -126,6 +128,8 @@ async function cmdUninstall(argv) {
|
|
|
126
128
|
? `- Every Code notify restored: ${codeConfigPath}`
|
|
127
129
|
: codeRestore?.skippedReason === "no-backup-not-installed"
|
|
128
130
|
? "- Every Code notify: skipped (no backup; not installed)"
|
|
131
|
+
: codeRestore?.skippedReason === "current-not-managed"
|
|
132
|
+
? "- Every Code notify: skipped (current notify is not managed by TokenTracker)"
|
|
129
133
|
: "- Every Code notify: no change"
|
|
130
134
|
: "- Every Code notify: skipped (config.toml not found)",
|
|
131
135
|
claudeConfigExists
|