tokentracker-cli 0.58.0 → 0.60.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/README.ja.md +1 -1
  2. package/README.ko.md +1 -1
  3. package/README.md +1 -1
  4. package/README.zh-CN.md +1 -1
  5. package/dashboard/dist/assets/{ActivityHeatmap--h7iLeSz.js → ActivityHeatmap-DxRcGqb0.js} +1 -1
  6. package/dashboard/dist/assets/{Card-KutJI7Kb.js → Card-CSvrNnBU.js} +1 -1
  7. package/dashboard/dist/assets/DashboardPage-Cj-7LbVz.js +19 -0
  8. package/dashboard/dist/assets/{DevicePage-Bvf6grjO.js → DevicePage-MIwh75pN.js} +1 -1
  9. package/dashboard/dist/assets/DialogTitle-5Pz9G5vx.js +1 -0
  10. package/dashboard/dist/assets/{FadeIn-D_0IpM7h.js → FadeIn-BswCXVn8.js} +1 -1
  11. package/dashboard/dist/assets/{HeaderGithubStar-wllgUDeU.js → HeaderGithubStar-DcEFKMNV.js} +1 -1
  12. package/dashboard/dist/assets/{IpCheckPage-oUeKrhWf.js → IpCheckPage-DNiWD9VI.js} +1 -1
  13. package/dashboard/dist/assets/{LandingPage-BqzdZPJZ.js → LandingPage-mipacgyL.js} +1 -1
  14. package/dashboard/dist/assets/{LeaderboardAvatar-Bib0pX-r.js → LeaderboardAvatar-Cha0prSv.js} +1 -1
  15. package/dashboard/dist/assets/{LeaderboardPage-BjLZyZb-.js → LeaderboardPage-DB4L0VDC.js} +3 -3
  16. package/dashboard/dist/assets/LeaderboardProfileModal-CXBulhhd.js +72 -0
  17. package/dashboard/dist/assets/{LeaderboardProfilePage-Df_jL82E.js → LeaderboardProfilePage-BHYi-9Nl.js} +1 -1
  18. package/dashboard/dist/assets/LimitsPage-BjD-_Cbj.js +2 -0
  19. package/dashboard/dist/assets/{LocalOnlyNotice-B01hqlKr.js → LocalOnlyNotice-C4z5PX1u.js} +1 -1
  20. package/dashboard/dist/assets/{LoginPage-BjqX1wZg.js → LoginPage-awg65x0b.js} +1 -1
  21. package/dashboard/dist/assets/PopoverPopup-D-wymWwQ.js +1 -0
  22. package/dashboard/dist/assets/{ResetPasswordPage-Bw7tWm1t.js → ResetPasswordPage-DBCOMvii.js} +1 -1
  23. package/dashboard/dist/assets/{Select-DbBT6mPJ.js → Select-CkunmlOy.js} +1 -1
  24. package/dashboard/dist/assets/SelectItemText-D7T3VeBt.js +1 -0
  25. package/dashboard/dist/assets/{SettingsPage-CrA-jBWs.js → SettingsPage-DIsoKZO8.js} +1 -1
  26. package/dashboard/dist/assets/SkillsPage-DIGp5OHK.js +1 -0
  27. package/dashboard/dist/assets/{WidgetsPage-DjE_NMiT.js → WidgetsPage-N_zvVc5J.js} +1 -1
  28. package/dashboard/dist/assets/{WrappedPage-MciuOQFt.js → WrappedPage-DKH7yGKN.js} +1 -1
  29. package/dashboard/dist/assets/{agent-logos-JyXME_ur.js → agent-logos-CcHm05Tf.js} +1 -1
  30. package/dashboard/dist/assets/{arrow-up-right-U8aUNwfl.js → arrow-up-right-Srji5q6H.js} +1 -1
  31. package/dashboard/dist/assets/{download-CK8DaHH6.js → download-D3OfnpNz.js} +1 -1
  32. package/dashboard/dist/assets/{info-DF9b_Lut.js → info-lMniNm1U.js} +1 -1
  33. package/dashboard/dist/assets/main-BGYbJv-h.js +1034 -0
  34. package/dashboard/dist/assets/use-limits-display-prefs-D9l2vQL-.js +1 -0
  35. package/dashboard/dist/assets/{use-native-settings-PZ_s8TF_.js → use-native-settings-CtMHe825.js} +1 -1
  36. package/dashboard/dist/assets/{use-usage-limits-B11QqFl7.js → use-usage-limits-CsWdVm7H.js} +1 -1
  37. package/dashboard/dist/assets/{useCurrency-CzRjastg.js → useCurrency-8LyGElzm.js} +1 -1
  38. package/dashboard/dist/assets/useScrollLock-CuXeF5Ev.js +1 -0
  39. package/dashboard/dist/index.html +1 -1
  40. package/dashboard/dist/share.html +1 -1
  41. package/package.json +1 -1
  42. package/src/cli.js +2 -2
  43. package/src/commands/status.js +4 -0
  44. package/src/commands/sync.js +2 -2
  45. package/src/lib/diagnostics.js +3 -0
  46. package/src/lib/openclaw-session-plugin.js +54 -2
  47. package/src/lib/opencode-go-limits.js +261 -0
  48. package/src/lib/pricing/curated-overrides.json +4 -2
  49. package/src/lib/pricing/seed-snapshot.json +1 -1
  50. package/src/lib/rollout.js +22 -13
  51. package/src/lib/usage-limits.js +9 -1
  52. package/dashboard/dist/assets/DashboardPage-CZS3KR2C.js +0 -19
  53. package/dashboard/dist/assets/DialogTitle-Cd8SHRAb.js +0 -1
  54. package/dashboard/dist/assets/LeaderboardProfileModal-GiTmpwyn.js +0 -72
  55. package/dashboard/dist/assets/LimitsPage-BhPNmv6R.js +0 -2
  56. package/dashboard/dist/assets/PopoverPopup-CWyN32rM.js +0 -1
  57. package/dashboard/dist/assets/SelectItemText-XGWezP4M.js +0 -1
  58. package/dashboard/dist/assets/SkillsPage-CfYTgQMY.js +0 -1
  59. package/dashboard/dist/assets/main-4M5oNV2-.js +0 -1030
  60. package/dashboard/dist/assets/use-limits-display-prefs--1a77fnk.js +0 -1
  61. package/dashboard/dist/assets/useScrollLock-BXcNDJbM.js +0 -1
@@ -0,0 +1,2 @@
1
+ import{j as i,V as I,G as d,N as G,r as h,U as W,aG as z,i as B,L as U,aH as H}from"./main-BGYbJv-h.js";import{u as V}from"./use-usage-limits-CsWdVm7H.js";import{L as x,a as X,l as g,b as Y,u as q}from"./use-limits-display-prefs-D9l2vQL-.js";import{C as P}from"./Card-CSvrNnBU.js";import{F as J}from"./FadeIn-BswCXVn8.js";import{L as Q}from"./LocalOnlyNotice-C4z5PX1u.js";import"./arrow-up-right-Srji5q6H.js";import"./download-D3OfnpNz.js";const Z=[3,2,3,3,2,2,3];function y({className:e}){return i.jsx("div",{className:I("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",e)})}function ee(){return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(y,{className:"h-3 w-12 shrink-0"}),i.jsx(y,{className:"flex-1 h-1.5 rounded-full min-w-0"}),i.jsx(y,{className:"h-3 w-[30px] shrink-0"}),i.jsx(y,{className:"h-3 w-6 shrink-0"})]})}function te({bars:e,index:t}){const n=t%3===0?"w-24":t%3===1?"w-20":"w-[4.5rem]";return i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(y,{className:"h-[14px] w-[14px] rounded shrink-0"}),i.jsx(y,{className:I("h-4",n)})]}),Array.from({length:e},(a,r)=>i.jsx(ee,{},r))]})}function ie(){return i.jsx(P,{children:i.jsxs("div",{className:"flex flex-col gap-3",children:[i.jsx(y,{className:"h-3.5 w-28"}),Z.map((e,t)=>i.jsx(te,{bars:e,index:t},t))]})})}function ne(e,t){if(!(e>0))return null;const n=(e-t)/e;return Number.isFinite(n)?Math.min(Math.max(n,0),1):null}function re(e,t,n=.03){return e>t+n}function ae(e){const t=Math.max(0,Math.floor(e)),n=Math.floor(t/3600);return n>24?`${Math.floor(n/24)}d`:n>0?`${n}h`:`${Math.floor(t/60)}m`}function le(e,t){if(typeof e.windowSeconds=="number")return e.windowSeconds;if(e.windowSecondsField&&t){const n=t[e.windowSecondsField];return typeof n=="number"&&n>0?n:null}return null}function L(e){return e==null?NaN:typeof e=="number"?e*1e3:Date.parse(e)}function oe({usedPercent:e,windowSeconds:t,resetMs:n,mode:a,now:r=Date.now()}){const o=Math.min(Math.max(Number(e)||0,0),100)/100,s={pacePercent:null,paceOver:!1,expectedPercent:null,runsOutEta:null,projectedEnd:null};if(!(t>0)||!Number.isFinite(n))return s;const c=Math.max(0,(n-r)/1e3),l=ne(t,c);if(l==null)return s;if(s.expectedPercent=Math.round(l*100),s.paceOver=re(o,l),o>=.05){const u=a==="remaining"?1-l:l;s.pacePercent=u*100}if(l>.02&&o>0){const u=t*l,w=o/u,m=o/l;m>=1&&w>0?s.runsOutEta=ae((1-o)/w):s.projectedEnd=Math.round(Math.min(m,1)*100)}return s}const _=100;function S(e){const t=Date.parse(e);return Number.isFinite(t)?t:null}function se(e){return Math.max(0,Math.min(_,Math.round(e)))}function de(e){return new Intl.DateTimeFormat(G(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(e))}function ce(e,t,n){if(e==null||e>=t)return _;const a=t-e,r=t-n;return se(r/a*_)}function ue(e){const t=e.available_count;return t===null?null:Number.isInteger(t)&&t>=0?t:void 0}function me(e,{now:t}={}){if(!e||typeof e!="object")return null;const n=ue(e);if(n===void 0)return null;const a=Array.isArray(e.credits)?e.credits:[],r=t instanceof Date?t.getTime():Number(t??Date.now()),o=[];for(const s of a){const c=S(s?.expires_at);if(c==null)continue;const l=o.length+1;o.push({key:`reset-${l}`,label:d("limits.codex_reset_bank.row_label",{index:l}),expiresAt:de(c),percent:ce(S(s?.granted_at),c,r)})}return n===0?null:o.length>0?{kind:"rows",availableCount:n??o.length,rows:o}:n>0?{kind:"count_only",availableCount:n,rows:[]}:null}const R={claude:{windows(e){return[{key:"5h",labelKey:"limits.label.claude_5h",window:e.five_hour,pctField:"utilization",resetField:"resets_at",windowSeconds:5*3600},{key:"7d",labelKey:"limits.label.claude_7d",window:e.seven_day,pctField:"utilization",resetField:"resets_at",windowSeconds:7*86400},{key:"opus",labelKey:"limits.label.claude_opus",window:e.seven_day_opus,pctField:"utilization",resetField:"resets_at",windowSeconds:7*86400}]}},codex:{extra:"codex_reset_bank",windows(e){return[{key:"5h",labelKey:"limits.label.codex_5h",window:e.primary_window,windowSecondsField:"limit_window_seconds"},{key:"7d",labelKey:"limits.label.codex_7d",window:e.secondary_window,windowSecondsField:"limit_window_seconds"},{key:"spark-5h",labelKey:"limits.label.codex_spark_5h",window:e.spark_primary_window,windowSecondsField:"limit_window_seconds"},{key:"spark-7d",labelKey:"limits.label.codex_spark_7d",window:e.spark_secondary_window,windowSecondsField:"limit_window_seconds"}]}},cursor:{windows(e){return[{key:"plan",labelKey:"limits.label.cursor_plan",window:e.primary_window},{key:"auto",labelKey:"limits.label.cursor_auto",window:e.secondary_window},{key:"api",labelKey:"limits.label.cursor_api",window:e.tertiary_window}]}},gemini:{windows(e){return[{key:"pro",labelKey:"limits.label.gemini_pro",window:e.primary_window},{key:"flash",labelKey:"limits.label.gemini_flash",window:e.secondary_window},{key:"lite",labelKey:"limits.label.gemini_lite",window:e.tertiary_window}]}},kimi:{extra:"kimi_parallel",windows(e){return[{key:"weekly",labelKey:"limits.label.kimi_weekly",window:e.primary_window,windowSeconds:7*86400},{key:"5h",labelKey:"limits.label.kimi_5h",window:e.secondary_window,windowSeconds:5*3600},{key:"total",labelKey:"limits.label.kimi_total",window:e.tertiary_window}]}},kiro:{windows(e){return[{key:"month",labelKey:"limits.label.kiro_month",window:e.primary_window},{key:"bonus",labelKey:"limits.label.kiro_bonus",window:e.secondary_window}]}},grok:{windows(e){return[{key:"month",labelKey:"limits.label.grok_month",window:e.primary_window},{key:"ondemand",labelKey:"limits.label.grok_ondemand",window:e.secondary_window}]}},antigravity:{windows(e){return[{key:"claude",labelKey:"limits.label.antigravity_claude",window:e.primary_window},{key:"gpro",labelKey:"limits.label.antigravity_gpro",window:e.secondary_window},{key:"flash",labelKey:"limits.label.antigravity_flash",window:e.tertiary_window}]}},copilot:{extra:"copilot_otel",windows(e){return[{key:"premium",labelKey:"limits.label.copilot_premium",window:e.primary_window},{key:"chat",labelKey:"limits.label.copilot_chat",window:e.secondary_window}]}},zcode:{windows(e){return[{key:"glm52",labelKey:"limits.label.zcode_glm52",window:e.primary_window},{key:"glm5t",labelKey:"limits.label.zcode_glm5t",window:e.secondary_window}]}},opencodeGo:{windows(e){return[{key:"5h",labelKey:"limits.label.opencode_go_5h",window:e.primary_window},{key:"weekly",labelKey:"limits.label.opencode_go_weekly",window:e.secondary_window},{key:"monthly",labelKey:"limits.label.opencode_go_monthly",window:e.tertiary_window}]}}},xe="shrink-0 text-oai-black dark:text-oai-white";function we(e){const t=L(e);if(!Number.isFinite(t))return null;const n=t-Date.now();if(n<=0)return d("shared.time.now");const a=Math.floor(n/6e4);if(a<60)return`${a}m`;const r=Math.floor(a/60);return r<24?`${r}h`:`${Math.floor(r/24)}d`}function pe(e,t){const n=t===x.REMAINING?100-e:e;return n>=90?"bg-red-500":n>=70?"bg-amber-500":"bg-emerald-500"}function b(e,t="used_percent"){return e?t==="utilization"?e.utilization:e.used_percent:null}function F(e,t="reset_at"){return e?t==="resets_at"?e.resets_at:e.reset_at:null}function ye(e,t){return oe({usedPercent:b(e.window,e.pctField),windowSeconds:le(e,e.window),resetMs:L(F(e.window,e.resetField)),mode:t})}function he({label:e,pct:t,reset:n,mode:a=x.USED,pacePercent:r=null,paceOver:o=!1}){const s=Math.max(0,Math.min(100,Number(t)||0)),c=a===x.REMAINING?100-s:s,l=Math.round(c),u=c>0&&l===0?Math.max(c,.35):c;let w=String(l);c>0&&l===0&&(w=d("limits.bar.sub_one_percent"));const m=r==null?null:Math.max(0,Math.min(100,r));return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{"data-limit-label":"",className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:e}),i.jsxs("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:[i.jsx("div",{className:`${pe(c,a)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${u}%`,minWidth:c>0?"3px":0}}),m!=null&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"absolute top-0 h-full bg-oai-gray-100 dark:bg-oai-gray-700/50",style:{left:`calc(${m}% - 3px)`,width:"6px"}}),i.jsx("div",{className:`absolute top-0 h-full ${o?"bg-red-500":"bg-emerald-500"}`,style:{left:`calc(${m}% - 1px)`,width:"2px"}})]})]}),i.jsxs("span",{className:"text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400 w-9 text-right shrink-0 whitespace-nowrap",children:[w,"%"]}),n&&i.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500 w-6 text-right shrink-0",children:n})]})}function fe(e,t,n){const a=d(e.labelKey),r=n===x.REMAINING,o=l=>r?100-l:l;if(t.expectedPercent==null){const l=Math.round(Math.max(0,Math.min(100,Number(b(e.window,e.pctField))||0)));return r?d("limits.explain.remaining",{label:a,used:o(l)}):d("limits.explain.used",{label:a,used:l})}if(t.paceOver){if(t.runsOutEta)return d("limits.explain.ahead_eta",{label:a,eta:t.runsOutEta});const l=o(t.projectedEnd??100);return d(r?"limits.explain.ahead_pct_remaining":"limits.explain.ahead_pct",{label:a,pct:l})}const s=Math.round(Math.max(0,Math.min(100,Number(b(e.window,e.pctField))||0))),c=o(t.projectedEnd??s);return d(r?"limits.explain.on_track_remaining":"limits.explain.on_track",{label:a,pct:c})}function be({rows:e,mode:t}){if(e.length===0)return null;const n=t===x.REMAINING;return i.jsxs("div",{className:"mt-1 flex flex-col gap-1",children:[e.map(({spec:a,pace:r})=>i.jsx("div",{className:"text-[11px] leading-snug text-oai-gray-600 dark:text-oai-gray-300",children:fe(a,r,t)},a.key)),i.jsx("div",{className:"mt-1 pt-1.5 border-t border-oai-gray-200/70 dark:border-oai-gray-700/50 text-[10.5px] leading-snug text-oai-gray-400 dark:text-oai-gray-500",children:d(n?"limits.explain.body_remaining":"limits.explain.body")})]})}function k({name:e,providerId:t,children:n,expandable:a=!1,expanded:r=!1,onToggle:o}){const s=Y(t),c=i.jsxs("div",{className:"flex items-center gap-1.5",children:[s?i.jsx(W,{provider:s,size:14,className:xe}):null,i.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:e})]});return a?i.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":r,onClick:o,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),o?.())},className:"flex flex-col gap-1.5 -mx-1.5 px-1.5 py-1 rounded-lg cursor-pointer transition-colors hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/40 aria-expanded:bg-oai-gray-50 dark:aria-expanded:bg-oai-gray-800/40",children:[c,n]}):i.jsxs("div",{className:"flex flex-col gap-1.5",children:[c,n]})}const ge=X;function f({children:e,tone:t="neutral"}){const n=t==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400";return i.jsx("div",{className:`text-[11px] leading-snug ${n}`,children:e})}function _e({rows:e,mode:t,extra:n=null}){const a=e.length===0&&!n;return i.jsxs(i.Fragment,{children:[e.map(({spec:r,pace:o})=>i.jsx(he,{label:d(r.labelKey),pct:b(r.window,r.pctField),reset:we(F(r.window,r.resetField)),mode:t,pacePercent:o.pacePercent,paceOver:o.paceOver},r.key)),a?i.jsx(f,{children:d("limits.status.no_data")}):null,n]})}function ke({row:e}){const t=Math.max(0,Math.min(100,Number(e.percent)||0));return i.jsxs("div",{className:"flex items-center gap-2","data-reset-bank-row":"",children:[i.jsx("span",{"data-limit-label":"",className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:e.label}),i.jsx("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:i.jsx("div",{className:"bg-oai-gray-400 dark:bg-oai-gray-500 rounded-full h-full transition-[width] duration-500 ease-out",style:{width:`${t}%`,minWidth:t>0?"3px":0}})}),i.jsx("span",{className:"text-[10px] tabular-nums text-oai-gray-400 dark:text-oai-gray-500 w-[4.25rem] text-right shrink-0 whitespace-nowrap",children:e.expiresAt})]})}function je({model:e}){const t=e.kind==="count_only"?d("limits.codex_reset_bank.count_only",{count:e.availableCount}):null;return i.jsxs("div",{className:"mt-1 flex flex-col gap-1","data-reset-bank-section":e.kind,children:[i.jsx("div",{className:"text-[10.5px] font-medium uppercase tracking-wide text-oai-gray-400 dark:text-oai-gray-500",children:d("limits.codex_reset_bank.title")}),t?i.jsx("div",{className:"text-[11px] leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:t}):e.rows.map(n=>i.jsx(ke,{row:n},n.key))]})}function ve(e,t){if(e==="codex_reset_bank"){const n=me(t.reset_credits);return n?i.jsx(je,{model:n}):null}return e==="kimi_parallel"&&t.parallel_limit?i.jsx(f,{children:d("limits.label.kimi_parallel",{count:t.parallel_limit})}):e==="copilot_otel"&&!t.otel_has_files&&!t.otel_enabled?i.jsx(Ee,{defaultDir:t.otel_default_dir}):null}function Ne(e,t,n,a,r,o){const s=R[e];if(!s)return null;const c=s.windows(t).filter(u=>u.window).map(u=>({spec:u,pace:ye(u,a)})),l=ve(s.extra,t);return i.jsxs(k,{name:n,providerId:e,expandable:c.length>0,expanded:r,onToggle:o,children:[i.jsx(_e,{mode:a,rows:c,extra:l}),r?i.jsx(be,{rows:c,mode:a}):null]},e)}function Me(e,t,n,a,r){if(!R[e])return null;if(!t?.configured)return i.jsx(k,{name:g(e),providerId:e,children:i.jsx(f,{children:d("limits.status.not_connected")})},e);if(t.error)return i.jsx(k,{name:g(e),providerId:e,children:i.jsx(f,{tone:"error",children:d("shared.error.prefix",{error:t.error})})},e);const o=g(e),s=t.plan_label?`${o} ${t.plan_label}`:o;return Ne(e,t,s,n,a,r)}function Ee({defaultDir:e}){const[t,n]=h.useState(!1),r=["export COPILOT_OTEL_ENABLED=true","export COPILOT_OTEL_EXPORTER_TYPE=file",`export COPILOT_OTEL_FILE_EXPORTER_PATH="${e||"$HOME/.copilot/otel"}/copilot-otel-$(date +%Y%m%d).jsonl"`].join(`
2
+ `),o=async s=>{s.stopPropagation();try{await navigator.clipboard.writeText(r),n(!0),setTimeout(()=>n(!1),1600)}catch{}};return i.jsxs("div",{className:"mt-1 rounded-md border border-amber-300/60 dark:border-amber-700/40 bg-amber-50/50 dark:bg-amber-900/10 px-2.5 py-2 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[i.jsx("div",{className:"font-medium text-oai-gray-700 dark:text-oai-gray-200",children:d("limits.copilot.otelHint.title")}),i.jsx("div",{className:"mt-0.5 leading-snug",children:d("limits.copilot.otelHint.body")}),i.jsx("pre",{className:"mt-1.5 overflow-x-auto rounded bg-oai-gray-100 dark:bg-oai-gray-900/60 px-2 py-1.5 font-mono text-[10.5px] leading-tight whitespace-pre",children:r}),i.jsx("button",{type:"button",onClick:o,className:"mt-1 inline-flex items-center gap-1 rounded border border-oai-gray-300 dark:border-oai-gray-700 px-1.5 py-0.5 text-[10.5px] text-oai-gray-700 dark:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:t?d("limits.copilot.otelHint.copied"):d("limits.copilot.otelHint.copy")})]})}function Se(e){const[t,n]=h.useState(0);return h.useLayoutEffect(()=>{const a=e.current;if(!a)return;const r=a.querySelectorAll("[data-limit-label]");let o=0,s=null;if(r.length>0)try{s=document.createElement("canvas").getContext("2d")}catch{s=null}if(s){const l=window.getComputedStyle(r[0]);s.font=`${l.fontStyle} ${l.fontWeight} ${l.fontSize} ${l.fontFamily}`;for(const u of r)o=Math.max(o,s.measureText(u.textContent).width)}const c=Math.ceil(o);n(l=>l===c?l:c)}),t}function Ie({claude:e,codex:t,cursor:n,gemini:a,kimi:r,kiro:o,grok:s,antigravity:c,copilot:l,zcode:u,opencodeGo:w,order:m,visibility:j,displayMode:K}){const O={claude:e,codex:t,cursor:n,gemini:a,kimi:r,kiro:o,grok:s,antigravity:c,copilot:l,zcode:u,opencodeGo:w},v=h.useRef(null),N=Se(v),[T,D]=h.useState(null),A=Array.isArray(m)&&m.length>0?m:ge,M=K===x.REMAINING?x.REMAINING:x.USED,C=M===x.REMAINING?d("limits.settings.display_mode_remaining"):d("limits.settings.display_mode_used"),E=A.filter(p=>!j||j[p]!==!1).map(p=>Me(p,O[p],M,T===p,()=>D($=>$===p?null:p))).filter(Boolean);return i.jsx(J,{delay:.15,children:i.jsx(P,{children:i.jsxs("div",{ref:v,className:"flex flex-col gap-3",style:N>0?{"--tt-limits-label-w":`${N}px`}:void 0,children:[i.jsxs("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:[d("limits.panel.title"),d("limits.panel.mode_separator"),C]}),E.length>0?E:i.jsx(f,{children:d("limits.status.all_hidden")})]})})})}const Pe=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function Ce(){const e=z(),{data:t,error:n,isLoading:a}=V(e?{initialRefresh:!0,initialState:e,publishToPreloadCache:!0}:{initialRefresh:!0,publishToPreloadCache:!0}),r=q();return!Pe&&!B()?i.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:i.jsx(Q,{})}):i.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:i.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:i.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[i.jsxs("div",{className:"flex flex-row items-start justify-between gap-4 mb-8",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:d("nav.limits")}),i.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:d("limits.page.subtitle")})]}),i.jsx(U,{to:"/settings","aria-label":d("limits.page.openSettings"),title:d("limits.page.openSettings"),className:"shrink-0 inline-flex h-9 w-9 items-center justify-center rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:i.jsx(H,{className:"h-4 w-4","aria-hidden":!0})})]}),a?i.jsx(ie,{}):i.jsxs(i.Fragment,{children:[n?i.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:d("shared.error.prefix",{error:n})}):null,i.jsx(Ie,{claude:t?.claude,codex:t?.codex,cursor:t?.cursor,gemini:t?.gemini,kimi:t?.kimi,kiro:t?.kiro,grok:t?.grok,antigravity:t?.antigravity,copilot:t?.copilot,zcode:t?.zcode,opencodeGo:t?.opencodeGo,order:r.order,visibility:r.visibility,displayMode:r.displayMode})]})]})})})}export{Ce as LimitsPage};
@@ -1 +1 @@
1
- import{j as e,G as t}from"./main-4M5oNV2-.js";import{A as r}from"./arrow-up-right-U8aUNwfl.js";import{D as o}from"./download-CK8DaHH6.js";const i="https://github.com/mm7894215/TokenTracker/releases/latest";function c(){const a=()=>{try{window.location.href="tokentracker://open"}catch{}};return e.jsx("div",{className:"flex flex-1 flex-col items-center justify-center px-6 py-20 text-center",children:e.jsxs("div",{className:"max-w-md",children:[e.jsx("h2",{className:"text-lg font-semibold text-oai-black dark:text-white",children:t("local_only.title")}),e.jsx("p",{className:"mt-2 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:t("local_only.body")}),e.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-3",children:[e.jsxs("button",{type:"button",onClick:a,className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium bg-oai-gray-900 text-white hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100 transition-colors",children:[e.jsx("span",{children:t("local_only.open_app")}),e.jsx(r,{size:14,strokeWidth:2,"aria-hidden":!0})]}),e.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-900 transition-colors",children:[e.jsx(o,{size:14,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:t("local_only.download")})]})]})]})})}export{c as L};
1
+ import{j as e,G as t}from"./main-BGYbJv-h.js";import{A as r}from"./arrow-up-right-Srji5q6H.js";import{D as o}from"./download-D3OfnpNz.js";const i="https://github.com/mm7894215/TokenTracker/releases/latest";function c(){const a=()=>{try{window.location.href="tokentracker://open"}catch{}};return e.jsx("div",{className:"flex flex-1 flex-col items-center justify-center px-6 py-20 text-center",children:e.jsxs("div",{className:"max-w-md",children:[e.jsx("h2",{className:"text-lg font-semibold text-oai-black dark:text-white",children:t("local_only.title")}),e.jsx("p",{className:"mt-2 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:t("local_only.body")}),e.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-3",children:[e.jsxs("button",{type:"button",onClick:a,className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium bg-oai-gray-900 text-white hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100 transition-colors",children:[e.jsx("span",{children:t("local_only.open_app")}),e.jsx(r,{size:14,strokeWidth:2,"aria-hidden":!0})]}),e.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-900 transition-colors",children:[e.jsx(o,{size:14,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:t("local_only.download")})]})]})]})})}export{c as L};
@@ -1 +1 @@
1
- import{at as p,aJ as w,Y as v,r,G as s,j as e,L as y,_ as j}from"./main-4M5oNV2-.js";function N(i){const t=new URLSearchParams(i).get("next");return typeof t!="string"||t.length===0||!t.startsWith("/")||t.startsWith("//")?"/dashboard":t}function k(){const i=p(),[t,u]=w(),{enabled:n,loading:f,signedIn:x,refreshUser:g}=v(),c=r.useMemo(()=>N(t.toString()),[t]),[h,d]=r.useState(null);r.useEffect(()=>{const l=t.get("insforge_status"),a=t.get("insforge_type"),m=t.get("insforge_error");l==="success"&&a==="verify_email"?d(s("login.verify_email_success")):l==="error"&&a==="verify_email"&&m&&d(s("shared.error.prefix",{error:m}))},[t]);const o=r.useMemo(()=>t.get("native")==="1",[t]);r.useEffect(()=>{if(!(!n||f)&&x){if(o){window.location.href="/auth/native-callback";return}i(c,{replace:!0})}},[n,f,x,i,c,o]),r.useEffect(()=>{n&&g()},[n,g]),r.useEffect(()=>{if(o&&typeof window<"u")try{window.sessionStorage.setItem("tokentracker_native_login","1")}catch{}},[o]);const b=r.useCallback(()=>{u(l=>{const a=new URLSearchParams(l);return a.delete("insforge_status"),a.delete("insforge_type"),a.delete("insforge_error"),a},{replace:!0}),d(null)},[u]);return n?e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 h-16 flex items-center justify-between",children:e.jsx(y,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 rounded",children:s("login.back_home")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4 py-12",children:e.jsxs("div",{className:"w-full max-w-md space-y-6",children:[h?e.jsxs("div",{className:"rounded-lg border border-oai-gray-800 bg-oai-gray-900/50 px-4 py-3 text-sm text-oai-gray-300 flex justify-between gap-3 items-start",role:"status",children:[e.jsx("span",{children:h}),e.jsx("button",{type:"button",onClick:b,className:"shrink-0 text-oai-gray-500 hover:text-white text-xs",children:s("login.dismiss")})]}):null,e.jsx("div",{className:"border border-oai-gray-900 bg-oai-gray-950 rounded-2xl overflow-hidden shadow-2xl",children:e.jsx(j,{hideLogo:!0,title:s("login.title"),subtitle:s("login.subtitle"),className:"p-8 bg-transparent",onSuccess:()=>{o?window.location.href="/auth/native-callback":i(c,{replace:!0})}})})]})})]}):e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 py-4",children:e.jsx(y,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline",children:s("login.back_home")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4",children:e.jsx("p",{className:"text-oai-gray-400 text-center max-w-md",children:s("login.cloud_only")})})]})}export{k as LoginPage};
1
+ import{at as p,aJ as w,Y as v,r,G as s,j as e,L as y,_ as j}from"./main-BGYbJv-h.js";function N(i){const t=new URLSearchParams(i).get("next");return typeof t!="string"||t.length===0||!t.startsWith("/")||t.startsWith("//")?"/dashboard":t}function k(){const i=p(),[t,u]=w(),{enabled:n,loading:f,signedIn:x,refreshUser:g}=v(),c=r.useMemo(()=>N(t.toString()),[t]),[h,d]=r.useState(null);r.useEffect(()=>{const l=t.get("insforge_status"),a=t.get("insforge_type"),m=t.get("insforge_error");l==="success"&&a==="verify_email"?d(s("login.verify_email_success")):l==="error"&&a==="verify_email"&&m&&d(s("shared.error.prefix",{error:m}))},[t]);const o=r.useMemo(()=>t.get("native")==="1",[t]);r.useEffect(()=>{if(!(!n||f)&&x){if(o){window.location.href="/auth/native-callback";return}i(c,{replace:!0})}},[n,f,x,i,c,o]),r.useEffect(()=>{n&&g()},[n,g]),r.useEffect(()=>{if(o&&typeof window<"u")try{window.sessionStorage.setItem("tokentracker_native_login","1")}catch{}},[o]);const b=r.useCallback(()=>{u(l=>{const a=new URLSearchParams(l);return a.delete("insforge_status"),a.delete("insforge_type"),a.delete("insforge_error"),a},{replace:!0}),d(null)},[u]);return n?e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 h-16 flex items-center justify-between",children:e.jsx(y,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 rounded",children:s("login.back_home")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4 py-12",children:e.jsxs("div",{className:"w-full max-w-md space-y-6",children:[h?e.jsxs("div",{className:"rounded-lg border border-oai-gray-800 bg-oai-gray-900/50 px-4 py-3 text-sm text-oai-gray-300 flex justify-between gap-3 items-start",role:"status",children:[e.jsx("span",{children:h}),e.jsx("button",{type:"button",onClick:b,className:"shrink-0 text-oai-gray-500 hover:text-white text-xs",children:s("login.dismiss")})]}):null,e.jsx("div",{className:"border border-oai-gray-900 bg-oai-gray-950 rounded-2xl overflow-hidden shadow-2xl",children:e.jsx(j,{hideLogo:!0,title:s("login.title"),subtitle:s("login.subtitle"),className:"p-8 bg-transparent",onSuccess:()=>{o?window.location.href="/auth/native-callback":i(c,{replace:!0})}})})]})})]}):e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 py-4",children:e.jsx(y,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline",children:s("login.back_home")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4",children:e.jsx("p",{className:"text-oai-gray-400 text-center max-w-md",children:s("login.cloud_only")})})]})}export{k as LoginPage};
@@ -0,0 +1 @@
1
+ import{c as we,b5 as Ue,bx as Ke,by as le,bz as We,bA as ne,b3 as ge,r as m,bB as J,bC as me,bD as he,bE as oe,bF as be,bG as qe,bH as Le,bI as $,b as Q,bJ as W,ar as ue,b4 as pe,bK as $e,bL as Ee,bM as ze,d as Qe,bN as Je,bO as Te,bP as q,j as Y,bQ as Ze,b9 as Me,b8 as et,bR as tt,bS as nt,bT as ot,bU as st,u as rt,a as He,bV as it,bW as ye,bX as at,bY as ct,bZ as lt,b_ as ut,be as ft,b$ as dt,bf as pt}from"./main-BGYbJv-h.js";import{i as Ce,b as Ae,c as Be,g as Pe,d as se,P as gt,e as mt,f as ht,s as Et,F as Tt,h as Ct,j as Pt,k as vt,l as bt,m as Rt,n as _e,o as St,u as Ot,p as It,q as Mt,t as yt,r as xt,I as Ft,v as kt,w as wt,x as Lt,y as Ht,z as At}from"./useScrollLock-CuXeF5Ev.js";import{f as Bt,p as _t,g as Dt}from"./DialogTitle-5Pz9G5vx.js";import{p as Nt,q as jt,r as Yt,t as Vt,v as Gt,w as Xt,x as Ut,y as Kt}from"./SelectItemText-D7T3VeBt.js";const Wt=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Cn=we("chevron-right",Wt);const qt=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Pn=we("loader-circle",qt);function $t(e,n){return n!=null&&!Ce(n)?0:typeof e=="function"?e():e}function ve(e,n,t){const l=$t(e,t);return typeof l=="number"?l:l?.[n]}function xe(e){return typeof e=="function"?e():e}function De(e,n){return n||e==="click"||e==="mousedown"}function zt(e){return e?.includes("mouse")&&e!=="mousedown"}class Re{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new le,this.restTimeout=new le,this.handleCloseOptions=void 0}static create(){return new Re}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const fe=new WeakMap;function de(e){if(!e.performedPointerEventsMutation)return;const n=e.pointerEventsScopeElement;n&&fe.get(n)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),fe.delete(n)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function Ne(e,n){const{scopeElement:t,referenceElement:l,floatingElement:i}=n,o=fe.get(t);o&&o!==e&&de(o),de(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=t,e.pointerEventsReferenceElement=l,e.pointerEventsFloatingElement=i,fe.set(t,e),t.style.pointerEvents="none",l.style.pointerEvents="auto",i.style.pointerEvents="auto"}function je(e){const n=e.context.dataRef.current,t=Ue(()=>n.hoverInteractionState??Re.create()).current;return n.hoverInteractionState||(n.hoverInteractionState=t),Ke(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function Qt(e,n={}){const{enabled:t=!0,closeDelay:l=0,nodeId:i}=n,o="rootStore"in e?e.rootStore:e,p=o.useState("open"),E=o.useState("floatingElement"),S=o.useState("domReferenceElement"),{dataRef:c}=o.context,r=Ae(),O=Be(),h=je(o),j=We(),u=ne(()=>De(c.current.openEvent?.type,h.interactedInside)),B=ne(()=>zt(c.current.openEvent?.type)),g=ne(()=>{de(h)});ge(()=>{p||(h.pointerType=void 0,h.restTimeoutPending=!1,h.interactedInside=!1,g())},[p,h,g]),m.useEffect(()=>g,[g]),ge(()=>{if(t&&p&&h.handleCloseOptions?.blockPointerEvents&&B()&&J(S)&&E){const x=S,a=E,d=me(E),F=r?.nodesRef.current.find(b=>b.id===O)?.context?.elements.floating;F&&(F.style.pointerEvents="");const A=h.pointerEventsScopeElement!==a?h.pointerEventsScopeElement:null,C=F!==a?F:null,v=h.handleCloseOptions?.getScope?.()??A??C??x.closest("[data-rootownerid]")??d.body;return Ne(h,{scopeElement:v,referenceElement:x,floatingElement:a}),()=>{g()}}},[t,p,S,E,h,B,r,O,g]),m.useEffect(()=>{if(!t)return;function x(){return!!(r&&O&&Pe(r.nodesRef.current,O).length>0)}function a(b){const M=ve(l,"close",h.pointerType),D=()=>{o.setOpen(!1,Q(W,b)),r?.events.emit("floating.closed",b)};M?h.openChangeTimeout.start(M,D):(h.openChangeTimeout.clear(),D())}function d(b){const M=be(b);if(!qe(M)){h.interactedInside=!1;return}h.interactedInside=M?.closest("[aria-haspopup]")!=null}function F(){h.openChangeTimeout.clear(),j.clear(),r?.events.off("floating.closed",C),g()}function A(b){if(x()&&r){r.events.on("floating.closed",C);return}if(Le(b.relatedTarget,o.context.triggerElements))return;const M=c.current.floatingContext?.nodeId??i,D=b.relatedTarget;if(!(r&&M&&J(D)&&Pe(r.nodesRef.current,M,!1).some(X=>$(X.context?.elements.floating,D)))){if(h.handler){h.handler(b);return}g(),B()&&!u()&&a(b)}}function C(b){!r||!O||x()||j.start(0,()=>{r.events.off("floating.closed",C),o.setOpen(!1,Q(W,b)),r.events.emit("floating.closed",b)})}const v=E;return he(v&&oe(v,"mouseenter",F),v&&oe(v,"mouseleave",A),v&&oe(v,"pointerdown",d,!0),()=>{r?.events.off("floating.closed",C)})},[t,E,o,c,l,i,B,u,g,h,r,O,j])}const Jt={current:null};function Zt(e,n={}){const{enabled:t=!0,delay:l=0,handleClose:i=null,mouseOnly:o=!1,restMs:p=0,move:E=!0,triggerElementRef:S=Jt,externalTree:c,isActiveTrigger:r=!0,getHandleCloseContext:O,isClosing:h,shouldOpen:j}=n,u="rootStore"in e?e.rootStore:e,{dataRef:B,events:g}=u.context,x=Ae(c),a=je(u),d=m.useRef(!1),F=se(i),A=se(l),C=se(p),v=se(t),b=se(j),M=se(h),D=ne(()=>De(B.current.openEvent?.type,a.interactedInside)),G=ne(()=>b.current?.()!==!1),X=ne((s,T,L)=>{const R=u.context.triggerElements;if(R.hasElement(T))return!s||!$(s,T);if(!J(L))return!1;const f=L;return R.hasMatchingElement(H=>$(H,f))&&(!s||!$(s,f))}),N=ne(()=>{if(!a.handler)return;me(u.select("domReferenceElement")).removeEventListener("mousemove",a.handler),a.handler=void 0}),w=ne(()=>{de(a)});return r&&(a.handleCloseOptions=F.current?.__options),m.useEffect(()=>N,[N]),m.useEffect(()=>{if(!t)return;function s(T){T.open?d.current=!1:(d.current=T.reason===W,N(),a.openChangeTimeout.clear(),a.restTimeout.clear(),a.blockMouseMove=!0,a.restTimeoutPending=!1)}return g.on("openchange",s),()=>{g.off("openchange",s)}},[t,g,a,N]),m.useEffect(()=>{if(!t)return;function s(f,H=!0){const _=ve(A.current,"close",a.pointerType);_?a.openChangeTimeout.start(_,()=>{u.setOpen(!1,Q(W,f)),x?.events.emit("floating.closed",f)}):H&&(a.openChangeTimeout.clear(),u.setOpen(!1,Q(W,f)),x?.events.emit("floating.closed",f))}const T=S.current??(r?u.select("domReferenceElement"):null);if(!J(T))return;function L(f){if(a.openChangeTimeout.clear(),a.blockMouseMove=!1,o&&!Ce(a.pointerType))return;const H=xe(C.current),_=ve(A.current,"open",a.pointerType),V=be(f),U=f.currentTarget??null,I=u.select("domReferenceElement");let k=U;if(J(V)&&!u.context.triggerElements.hasElement(V)){for(const Ie of u.context.triggerElements.elements())if($(Ie,V)){k=Ie;break}}J(U)&&J(I)&&!u.context.triggerElements.hasElement(U)&&$(U,I)&&(k=I);const P=k==null?!1:X(I,k,V),z=u.select("open"),Z=M.current?.()??u.select("transitionStatus")==="ending",K=!z&&Z&&d.current,ee=!P&&J(k)&&J(I)&&$(I,k)&&K,te=H>0&&!_,Xe=P&&(z||K)||ee,Oe=!z||P;if(Xe){G()&&u.setOpen(!0,Q(W,f,k));return}te||(_?a.openChangeTimeout.start(_,()=>{Oe&&G()&&u.setOpen(!0,Q(W,f,k))}):Oe&&G()&&u.setOpen(!0,Q(W,f,k)))}function R(f){if(D()){w();return}N();const H=u.select("domReferenceElement"),_=me(H);a.restTimeout.clear(),a.restTimeoutPending=!1;const V=B.current.floatingContext??O?.();if(Le(f.relatedTarget,u.context.triggerElements))return;if(F.current&&V){u.select("open")||a.openChangeTimeout.clear();const I=S.current;a.handler=F.current({...V,tree:x,x:f.clientX,y:f.clientY,onClose(){w(),N(),v.current&&!D()&&I===u.select("domReferenceElement")&&s(f,!0)}}),_.addEventListener("mousemove",a.handler),a.handler(f);return}(a.pointerType!=="touch"||!$(u.select("floatingElement"),f.relatedTarget))&&s(f)}return E?he(oe(T,"mousemove",L,{once:!0}),oe(T,"mouseenter",L),oe(T,"mouseleave",R)):he(oe(T,"mouseenter",L),oe(T,"mouseleave",R))},[N,w,B,A,u,t,F,a,r,X,D,o,E,C,S,x,v,O,M,G]),m.useMemo(()=>{if(!t)return;function s(T){a.pointerType=T.pointerType}return{onPointerDown:s,onPointerEnter:s,onMouseMove(T){const{nativeEvent:L}=T,R=T.currentTarget,f=u.select("domReferenceElement"),H=u.select("open"),_=X(f,R,T.target);if(o&&!Ce(a.pointerType))return;if(H&&_&&a.handleCloseOptions?.blockPointerEvents){const I=u.select("floatingElement");if(I){const k=a.handleCloseOptions?.getScope?.()??R.ownerDocument.body;Ne(a,{scopeElement:k,referenceElement:R,floatingElement:I})}}const V=xe(C.current);if(H&&!_||V===0||!_&&a.restTimeoutPending&&T.movementX**2+T.movementY**2<2)return;a.restTimeout.clear();function U(){if(a.restTimeoutPending=!1,D())return;const I=u.select("open");!a.blockMouseMove&&(!I||_)&&G()&&u.setOpen(!0,Q(W,L,R))}a.pointerType==="touch"?ue.flushSync(()=>{U()}):_&&H?U():(a.restTimeoutPending=!0,a.restTimeout.start(V,U))}}},[t,a,D,X,o,u,C,G])}const Fe=.1,en=Fe*Fe,y=.5;function ie(e,n,t,l,i,o){return l>=n!=o>=n&&e<=(i-t)*(n-l)/(o-l)+t}function ae(e,n,t,l,i,o,p,E,S,c){let r=!1;return ie(e,n,t,l,i,o)&&(r=!r),ie(e,n,i,o,p,E)&&(r=!r),ie(e,n,p,E,S,c)&&(r=!r),ie(e,n,S,c,t,l)&&(r=!r),r}function tn(e,n,t){return e>=t.x&&e<=t.x+t.width&&n>=t.y&&n<=t.y+t.height}function ce(e,n,t,l,i,o){const p=Math.min(t,i),E=Math.max(t,i),S=Math.min(l,o),c=Math.max(l,o);return e>=p&&e<=E&&n>=S&&n<=c}function nn(e={}){const{blockPointerEvents:n=!1}=e,t=new le,l=({x:i,y:o,placement:p,elements:E,onClose:S,nodeId:c,tree:r})=>{const O=p?.split("-")[0];let h=!1,j=null,u=null,B=typeof performance<"u"?performance.now():0;function g(a,d){const F=performance.now(),A=F-B;if(j===null||u===null||A===0)return j=a,u=d,B=F,!1;const C=a-j,v=d-u,b=C*C+v*v,M=A*A*en;return j=a,u=d,B=F,b<M}function x(){t.clear(),S()}return function(d){t.clear();const F=E.domReference,A=E.floating;if(!F||!A||O==null||i==null||o==null)return;const{clientX:C,clientY:v}=d,b=be(d),M=d.type==="mouseleave",D=$(A,b),G=$(F,b);if(D&&(h=!0,!M))return;if(G&&(h=!1,!M)){h=!0;return}if(M&&J(d.relatedTarget)&&$(A,d.relatedTarget))return;function X(){return!!(r&&Pe(r.nodesRef.current,c).length>0)}function N(){X()||x()}if(X())return;const w=F.getBoundingClientRect(),s=A.getBoundingClientRect(),T=i>s.right-s.width/2,L=o>s.bottom-s.height/2,R=s.width>w.width,f=s.height>w.height,H=(R?w:s).left,_=(R?w:s).right,V=(f?w:s).top,U=(f?w:s).bottom;if(O==="top"&&o>=w.bottom-1||O==="bottom"&&o<=w.top+1||O==="left"&&i>=w.right-1||O==="right"&&i<=w.left+1){N();return}let I=!1;switch(O){case"top":I=ce(C,v,H,w.top+1,_,s.bottom-1);break;case"bottom":I=ce(C,v,H,s.top+1,_,w.bottom-1);break;case"left":I=ce(C,v,s.right-1,U,w.left+1,V);break;case"right":I=ce(C,v,w.right-1,U,s.left+1,V);break}if(I)return;if(h&&!tn(C,v,w)){N();return}if(!M&&g(C,v)){N();return}let k=!1;switch(O){case"top":{const P=R?y/2:y*4,z=R||T?i+P:i-P,Z=R?i-P:T?i+P:i-P,K=o+y+1,ee=T||R?s.bottom-y:s.top,te=T?R?s.bottom-y:s.top:s.bottom-y;k=ae(C,v,z,K,Z,K,s.left,ee,s.right,te);break}case"bottom":{const P=R?y/2:y*4,z=R||T?i+P:i-P,Z=R?i-P:T?i+P:i-P,K=o-y,ee=T||R?s.top+y:s.bottom,te=T?R?s.top+y:s.bottom:s.top+y;k=ae(C,v,z,K,Z,K,s.left,ee,s.right,te);break}case"left":{const P=f?y/2:y*4,z=f||L?o+P:o-P,Z=f?o-P:L?o+P:o-P,K=i+y+1,ee=L||f?s.right-y:s.left,te=L?f?s.right-y:s.left:s.right-y;k=ae(C,v,ee,s.top,te,s.bottom,K,z,K,Z);break}case"right":{const P=f?y/2:y*4,z=f||L?o+P:o-P,Z=f?o-P:L?o+P:o-P,K=i-y,ee=L||f?s.left+y:s.right,te=L?f?s.left+y:s.right:s.left+y;k=ae(C,v,K,z,K,Z,ee,s.top,te,s.bottom);break}}k?h||t.start(40,N):N()}};return l.__options={...e,blockPointerEvents:n},l}const Ye=m.createContext(void 0);function re(e){const n=m.useContext(Ye);if(n===void 0&&!e)throw new Error(pe(47));return n}function on(){return{...Dt(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}const sn={..._t,disabled:q(e=>e.disabled),instantType:q(e=>e.instantType),openMethod:q(e=>e.openMethod),openChangeReason:q(e=>e.openChangeReason),modal:q(e=>e.modal),focusManagerModal:q(e=>e.focusManagerModal),stickIfOpen:q(e=>e.stickIfOpen),titleElementId:q(e=>e.titleElementId),descriptionElementId:q(e=>e.descriptionElementId),openOnHover:q(e=>e.openOnHover),closeDelay:q(e=>e.closeDelay),hasViewport:q(e=>e.hasViewport)};class Se extends $e{constructor(n,t,l=!1){const i={...on(),...n},o=new gt;i.open&&n?.mounted===void 0&&(i.mounted=!0),i.floatingRootContext=Bt(o,t,l),super(i,{popupRef:m.createRef(),backdropRef:m.createRef(),internalBackdropRef:m.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:m.createRef(),beforeContentFocusGuardRef:m.createRef(),stickIfOpenTimeout:new le,triggerElements:o},sn)}setOpen=(n,t)=>{const l=t.reason===W,i=t.reason===Ee&&t.event.detail===0,o=!n&&(t.reason===ze||t.reason==null),p=mt(t),E=this.select("activeTriggerId");if(!n&&t.reason===Qe&&t.trigger==null&&E!=null&&(t.trigger=this.context.triggerElements.getById(E)??this.select("activeTriggerElement")??void 0),this.context.onOpenChange?.(n,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,t);const S=()=>{const c={open:n,openChangeReason:t.reason};Et(c,n,t.trigger,p()),this.update(c)};l?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(Je,()=>{this.set("stickIfOpen",!1)}),ue.flushSync(S)):S(),i||o?this.set("instantType",i?"click":"dismiss"):t.reason===Te?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(n,t){const{store:l,internalStore:i}=ht(n,(o,p)=>new Se(t,o,p));return m.useEffect(()=>i?.disposeEffect(),[i]),l}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function ke({props:e}){const{children:n,open:t,defaultOpen:l=!1,onOpenChange:i,onOpenChangeComplete:o,modal:p=!1,handle:E,triggerId:S,defaultTriggerId:c=null}=e,r=Se.useStore(E?.store,{modal:p,open:l,openProp:t,activeTriggerId:c,triggerIdProp:S});Ct(r,t,l,c),r.useControlledProp("openProp",t),r.useControlledProp("triggerIdProp",S);const O=r.useState("open"),h=r.useState("mounted"),j=r.useState("payload"),u=Be()!=null;r.useContextCallback("onOpenChange",i),r.useContextCallback("onOpenChangeComplete",o),Pt(r,O),vt(r);const{forceUnmount:B}=bt(O,r,()=>{r.update({stickIfOpen:!0,openChangeReason:null})});r.useSyncedValues({modal:p,nested:u}),m.useEffect(()=>{O||r.context.stickIfOpenTimeout.clear()},[r,O]);const g=m.useCallback(()=>{r.setOpen(!1,Q(Ze))},[r]);m.useImperativeHandle(e.actionsRef,()=>({unmount:B,close:g}),[B,g]);const x=O||h,a=m.useMemo(()=>({store:r}),[r]);return Y.jsxs(Ye.Provider,{value:a,children:[x&&Y.jsx(rn,{store:r,modal:p}),typeof n=="function"?n({payload:j}):n]})}function vn(e){return re(!0)?Y.jsx(ke,{props:e}):Y.jsx(Tt,{children:Y.jsx(ke,{props:e})})}function rn({store:e,modal:n}){const t=e.useState("floatingRootContext"),l=Rt(t,{outsidePressEvent:{mouse:n==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),i=l.reference??Me,o=l.trigger??Me,p=m.useMemo(()=>et(_e,l.floating),[l.floating]);return St(e,{activeTriggerProps:i,inactiveTriggerProps:o,popupProps:p}),null}const an=300;function cn(e,n){const t=m.useRef(null);function l(o){ue.flushSync(()=>{e.setOpen(!1,Q(Te,o.nativeEvent,o.currentTarget))}),st(t.current)?.focus()}function i(o){const p=e.select("positionerElement");if(p&&tt(o,p))e.context.beforeContentFocusGuardRef.current?.focus();else{ue.flushSync(()=>{e.setOpen(!1,Q(Te,o.nativeEvent,o.currentTarget))});let E=nt(e.context.triggerFocusTargetRef.current||n.current);for(;E!==null&&$(p,E);){const S=E;if(E=ot(E),E===S)break}E?.focus()}}return{preFocusGuardRef:t,handlePreFocusGuardFocus:l,handleFocusTargetFocus:i}}const bn=m.forwardRef(function(n,t){const{render:l,className:i,style:o,disabled:p=!1,nativeButton:E=!0,handle:S,payload:c,openOnHover:r=!1,delay:O=an,closeDelay:h=0,id:j,...u}=n,B=re(!0),g=S?.store??B?.store;if(!g)throw new Error(pe(74));const x=Ot(j),a=g.useState("isTriggerActive",x),d=g.useState("floatingRootContext"),F=g.useState("isOpenedByTrigger",x),A=g.useState("triggerPopupId",x),C=m.useRef(null),{registerTrigger:v,isMountedByThisTrigger:b}=It(x,C,g,{payload:c,disabled:p,openOnHover:r,closeDelay:h}),M=g.useState("openChangeReason"),D=g.useState("stickIfOpen"),G=g.useState("openMethod"),X=g.useState("focusManagerModal"),N=Zt(d,{enabled:!p&&d!=null&&r&&(G!=="touch"||M!==Ee),mouseOnly:!0,move:!1,handleClose:nn(),restMs:O,delay:{close:h},triggerElementRef:C,isActiveTrigger:a,isClosing:()=>g.select("transitionStatus")==="ending"}),w=Nt(d,{enabled:d!=null,stickIfOpen:D}),s=jt(()=>g.select("open"),k=>{g.set("openMethod",k)}),T=g.useState("triggerProps",b),{getButtonProps:L,buttonRef:R}=rt({disabled:p,native:E}),f={open(k){return k&&M===Ee?Mt.open(k):yt.open(k)}},{preFocusGuardRef:H,handlePreFocusGuardFocus:_,handleFocusTargetFocus:V}=cn(g,C),I=He("button",n,{state:{disabled:p,open:F},ref:[R,t,v,C],props:[w.reference,N,T,s,{[it]:"",id:x,"aria-haspopup":"dialog","aria-expanded":F,"aria-controls":A},u,L],stateAttributesMapping:f});return b&&!X?Y.jsxs(m.Fragment,{children:[Y.jsx(ye,{ref:H,onFocus:_}),Y.jsx(m.Fragment,{children:I},x),Y.jsx(ye,{ref:g.context.triggerFocusTargetRef,onFocus:V})]}):Y.jsx(m.Fragment,{children:I},x)}),Ve=m.createContext(void 0);function ln(){const e=m.useContext(Ve);if(e===void 0)throw new Error(pe(45));return e}const Rn=m.forwardRef(function(n,t){const{keepMounted:l=!1,...i}=n,{store:o}=re();return o.useState("mounted")||l?Y.jsx(Ve.Provider,{value:l,children:Y.jsx(at,{ref:t,...i})}):null}),Ge=m.createContext(void 0);function un(){const e=m.useContext(Ge);if(!e)throw new Error(pe(46));return e}const Sn=m.forwardRef(function(n,t){const{render:l,className:i,style:o,anchor:p,positionMethod:E="absolute",side:S="bottom",align:c="center",sideOffset:r=0,alignOffset:O=0,collisionBoundary:h="clipping-ancestors",collisionPadding:j=5,arrowPadding:u=5,sticky:B=!1,disableAnchorTracking:g=!1,collisionAvoidance:x=ct,...a}=n,{store:d}=re(),F=ln(),A=xt(),C=d.useState("floatingRootContext"),v=d.useState("mounted"),b=d.useState("open"),M=d.useState("openChangeReason"),D=d.useState("activeTriggerElement"),G=d.useState("modal"),X=d.useState("openMethod"),N=d.useState("positionerElement"),w=d.useState("instantType"),s=d.useState("transitionStatus"),T=d.useState("hasViewport"),L=m.useRef(null),R=lt(N,!1,!1),f=Yt({anchor:p,floatingRootContext:C,positionMethod:E,mounted:v,side:S,sideOffset:r,align:c,alignOffset:O,arrowPadding:u,collisionBoundary:h,collisionPadding:j,sticky:B,disableAnchorTracking:g,keepMounted:F,nodeId:A,collisionAvoidance:x,adaptiveOrigin:T?Xt:void 0}),H=C.useState("domReferenceElement");ge(()=>{const I=H,k=L.current;if(I&&(L.current=I),k&&I&&I!==k){d.set("instantType",void 0);const P=new AbortController;return R(()=>{d.set("instantType","trigger-change")},P.signal),()=>{P.abort()}}},[H,R,d]),Vt(b&&G===!0&&M!==W,X==="touch",N,D);const _=m.useCallback(I=>{d.set("positionerElement",I)},[d]),V={open:b,side:f.side,align:f.align,anchorHidden:f.anchorHidden,instant:w},U=Gt(n,V,{styles:f.positionerStyles,transitionStatus:s,props:a,refs:[t,_],hidden:!v,inert:!b});return Y.jsxs(Ge.Provider,{value:f,children:[v&&G===!0&&M!==W&&Y.jsx(Ft,{ref:d.context.internalBackdropRef,inert:ut(!b),cutout:D}),Y.jsx(kt,{id:A,children:U})]})}),fn=m.createContext(void 0);function dn(){const[e,n]=m.useState(0),t=ne(()=>(n(i=>i+1),()=>{n(i=>Math.max(0,i-1))}));return{context:m.useMemo(()=>({register:t}),[t]),hasClosePart:e>0}}function pn(e){const{value:n,children:t}=e;return Y.jsx(fn.Provider,{value:n,children:t})}const gn={...At,...pt},On=m.forwardRef(function(n,t){const{render:l,className:i,style:o,initialFocus:p,finalFocus:E,...S}=n,{store:c}=re(),r=un(),O=Ut()!=null,{context:h,hasClosePart:j}=dn(),u=c.useState("open"),B=c.useState("openMethod"),g=c.useState("instantType"),x=c.useState("transitionStatus"),a=c.useState("popupProps"),d=c.useState("titleElementId"),F=c.useState("descriptionElementId"),A=c.useState("modal"),C=c.useState("mounted"),v=c.useState("openChangeReason"),b=c.useState("activeTriggerElement"),M=c.useState("floatingRootContext"),D=M.useState("floatingId"),G=c.useState("disabled"),X=c.useState("openOnHover"),N=c.useState("closeDelay"),w=S.id??D;ft({open:u,ref:c.context.popupRef,onComplete(){u&&c.context.onOpenChangeComplete?.(!0)}}),Qt(M,{enabled:X&&!G,closeDelay:N});const s=p===void 0?wt(c.context.popupRef):p,T=A!==!1&&j;c.useSyncedValue("focusManagerModal",T);const L=m.useCallback(H=>{c.set("popupElement",H)},[c]),R={open:u,side:r.side,align:r.align,instant:g,transitionStatus:x},f=He("div",n,{state:R,ref:[t,c.context.popupRef,L],props:[a,{id:w,role:"dialog",..._e,"aria-labelledby":d,"aria-describedby":F,onKeyDown(H){O&&Ht.has(H.key)&&H.stopPropagation()}},Kt(x),S],stateAttributesMapping:gn});return Y.jsx(Lt,{context:M,openInteractionType:B,modal:T,disabled:!C||v===W,initialFocus:s,returnFocus:E,restoreFocus:"popup",previousFocusableElement:dt(b)?b:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:Y.jsx(pn,{value:h,children:f})})});export{Cn as C,Pn as L,vn as P,bn as a,Rn as b,Sn as c,On as d};
@@ -1 +1 @@
1
- import{aJ as d,Y as m,r as t,j as e,L as l,G as o,_ as x}from"./main-4M5oNV2-.js";function n(s,a){for(const r of a){const i=s.get(r);if(typeof i=="string"&&i.trim())return i.trim()}return""}function u(){const[s]=d(),{enabled:a}=m(),r=t.useMemo(()=>n(s,["otp","token","reset_token","insforge_token"]),[s]),i=t.useMemo(()=>n(s,["email"]),[s]),c=t.useMemo(()=>n(s,["code"]),[s]);return a?e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 h-16 flex items-center justify-between",children:e.jsx(l,{to:"/login",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 rounded",children:o("reset_password.back_to_sign_in")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4 py-12",children:e.jsx("div",{className:"w-full max-w-md border border-oai-gray-900 bg-oai-gray-950 rounded-2xl overflow-hidden shadow-2xl",children:e.jsx(x,{hideLogo:!0,initialMode:r?"reset_confirm":"reset_email",tokenFromUrl:r,initialEmail:i,initialCode:c})})})]}):e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 py-4",children:e.jsx(l,{to:"/login",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline",children:o("reset_password.back_to_sign_in")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4",children:e.jsx("p",{className:"text-oai-gray-400 text-center max-w-md",children:o("login.cloud_only")})})]})}export{u as ResetPasswordPage};
1
+ import{aJ as d,Y as m,r as t,j as e,L as l,G as o,_ as x}from"./main-BGYbJv-h.js";function n(s,a){for(const r of a){const i=s.get(r);if(typeof i=="string"&&i.trim())return i.trim()}return""}function u(){const[s]=d(),{enabled:a}=m(),r=t.useMemo(()=>n(s,["otp","token","reset_token","insforge_token"]),[s]),i=t.useMemo(()=>n(s,["email"]),[s]),c=t.useMemo(()=>n(s,["code"]),[s]);return a?e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 h-16 flex items-center justify-between",children:e.jsx(l,{to:"/login",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 rounded",children:o("reset_password.back_to_sign_in")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4 py-12",children:e.jsx("div",{className:"w-full max-w-md border border-oai-gray-900 bg-oai-gray-950 rounded-2xl overflow-hidden shadow-2xl",children:e.jsx(x,{hideLogo:!0,initialMode:r?"reset_confirm":"reset_email",tokenFromUrl:r,initialEmail:i,initialCode:c})})})]}):e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 py-4",children:e.jsx(l,{to:"/login",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline",children:o("reset_password.back_to_sign_in")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4",children:e.jsx("p",{className:"text-oai-gray-400 text-center max-w-md",children:o("login.cloud_only")})})]})}export{u as ResetPasswordPage};
@@ -1 +1 @@
1
- import{r as v,b2 as l,bB as w,a as k,j as e,V as x}from"./main-4M5oNV2-.js";import{u as j,z as N,s as i,L as C,A as E,S as I,h as R,i as T,C as A,j as L,k as P,l as V,m as _,o as z,n as B}from"./SelectItemText-XGWezP4M.js";import{C as D}from"./useScrollLock-BXcNDJbM.js";const G=v.forwardRef(function(t,s){const{render:n,className:p,style:o,...c}=t,{store:r,scrollHandlerRef:d}=j(),{alignItemWithTriggerActive:g}=N(),u=l(r,i.hasScrollArrows),h=l(r,i.openMethod),a=l(r,i.multiple),m={id:`${l(r,i.id)}-list`,role:"listbox","aria-multiselectable":a||void 0,onScroll(b){d.current?.(b.currentTarget)},...g&&{style:C},className:u&&h!=="touch"?E.className:void 0},S=w(b=>{r.set("listElement",b)});return k("div",t,{ref:[s,S],props:[m,c]})}),M="relative inline-flex items-center justify-between gap-2 rounded-lg border border-oai-gray-200 bg-white text-oai-black transition-colors hover:border-oai-gray-300 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:hover:border-oai-gray-700";function U({value:y,onValueChange:t,options:s=[],ariaLabel:n,id:p,disabled:o=!1,leadingIcon:c=null,className:r="",popupClassName:d="",align:g="start",matchTriggerWidth:u=!1}){const h=s.map(a=>({value:a.value,label:a.label}));return e.jsxs(I,{value:y,items:h,disabled:o,onValueChange:a=>{!o&&a!=null&&t?.(a)},children:[e.jsxs(R,{id:p,"aria-label":n,className:x(M,o&&"cursor-not-allowed opacity-50 hover:border-oai-gray-200 dark:hover:border-oai-gray-800",r),children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[c,e.jsx(T,{className:"truncate"})]}),e.jsx(A,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]}),e.jsx(L,{children:e.jsx(P,{align:g,side:"bottom",sideOffset:4,className:"z-50",children:e.jsx(V,{className:x("max-h-[min(18rem,var(--available-height))] origin-[var(--transform-origin)] overflow-y-auto","rounded-xl border border-oai-gray-200 bg-white p-1 shadow-lg ring-1 ring-black/[0.04]","dark:border-oai-gray-700 dark:bg-oai-gray-900 dark:ring-white/[0.05]","transition-[opacity,transform] duration-150 ease-out","data-[starting-style]:scale-95 data-[starting-style]:opacity-0","data-[ending-style]:scale-95 data-[ending-style]:opacity-0",u&&"min-w-[var(--anchor-width)]",d),children:e.jsx(G,{role:"listbox","aria-label":n,children:s.map(a=>e.jsxs(_,{value:a.value,disabled:a.disabled,className:({selected:f,disabled:m})=>x("flex w-full cursor-pointer items-center gap-1.5 whitespace-nowrap rounded-lg py-1.5 pl-1.5 pr-6","text-left text-xs outline-none transition-colors",f?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800/70 dark:text-white":"text-oai-gray-600 hover:bg-oai-gray-50 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800/60",m&&"cursor-not-allowed opacity-50 hover:bg-transparent dark:hover:bg-transparent"),children:[e.jsx("span",{className:"flex w-3.5 shrink-0 items-center justify-center text-oai-gray-500 dark:text-oai-gray-300",children:e.jsx(z,{children:e.jsx(D,{className:"h-3 w-3","aria-hidden":!0})})}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.jsx(B,{children:a.label})})]},String(a.value)))})})})})]})}export{U as S};
1
+ import{r as v,b2 as l,bA as w,a as k,j as e,V as x}from"./main-BGYbJv-h.js";import{u as j,z as N,s as i,L as C,A as E,S as I,h as R,i as T,C as A,j as L,k as P,l as V,m as _,o as z,n as D}from"./SelectItemText-D7T3VeBt.js";import{C as G}from"./useScrollLock-CuXeF5Ev.js";const M=v.forwardRef(function(t,s){const{render:n,className:p,style:o,...c}=t,{store:r,scrollHandlerRef:d}=j(),{alignItemWithTriggerActive:g}=N(),u=l(r,i.hasScrollArrows),h=l(r,i.openMethod),a=l(r,i.multiple),m={id:`${l(r,i.id)}-list`,role:"listbox","aria-multiselectable":a||void 0,onScroll(b){d.current?.(b.currentTarget)},...g&&{style:C},className:u&&h!=="touch"?E.className:void 0},S=w(b=>{r.set("listElement",b)});return k("div",t,{ref:[s,S],props:[m,c]})}),O="relative inline-flex items-center justify-between gap-2 rounded-lg border border-oai-gray-200 bg-white text-oai-black transition-colors hover:border-oai-gray-300 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:hover:border-oai-gray-700";function U({value:y,onValueChange:t,options:s=[],ariaLabel:n,id:p,disabled:o=!1,leadingIcon:c=null,className:r="",popupClassName:d="",align:g="start",matchTriggerWidth:u=!1}){const h=s.map(a=>({value:a.value,label:a.label}));return e.jsxs(I,{value:y,items:h,disabled:o,onValueChange:a=>{!o&&a!=null&&t?.(a)},children:[e.jsxs(R,{id:p,"aria-label":n,className:x(O,o&&"cursor-not-allowed opacity-50 hover:border-oai-gray-200 dark:hover:border-oai-gray-800",r),children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[c,e.jsx(T,{className:"truncate"})]}),e.jsx(A,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]}),e.jsx(L,{children:e.jsx(P,{align:g,side:"bottom",sideOffset:4,className:"z-50",children:e.jsx(V,{className:x("max-h-[min(18rem,var(--available-height))] origin-[var(--transform-origin)] overflow-y-auto","rounded-xl border border-oai-gray-200 bg-white p-1 shadow-lg ring-1 ring-black/[0.04]","dark:border-oai-gray-700 dark:bg-oai-gray-900 dark:ring-white/[0.05]","transition-[opacity,transform] duration-150 ease-out","data-[starting-style]:scale-95 data-[starting-style]:opacity-0","data-[ending-style]:scale-95 data-[ending-style]:opacity-0",u&&"min-w-[var(--anchor-width)]",d),children:e.jsx(M,{role:"listbox","aria-label":n,children:s.map(a=>e.jsxs(_,{value:a.value,disabled:a.disabled,className:({selected:f,disabled:m})=>x("flex w-full cursor-pointer items-center gap-1.5 whitespace-nowrap rounded-lg py-1.5 pl-1.5 pr-6","text-left text-xs outline-none transition-colors",f?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800/70 dark:text-white":"text-oai-gray-600 hover:bg-oai-gray-50 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800/60",m&&"cursor-not-allowed opacity-50 hover:bg-transparent dark:hover:bg-transparent"),children:[e.jsx("span",{className:"flex w-3.5 shrink-0 items-center justify-center text-oai-gray-500 dark:text-oai-gray-300",children:e.jsx(z,{children:e.jsx(G,{className:"h-3 w-3","aria-hidden":!0})})}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.jsx(D,{children:a.label})})]},String(a.value)))})})})})]})}export{U as S};
@@ -0,0 +1 @@
1
+ import{c as Vr,bL as kr,r as l,c4 as Nt,bz as vt,bF as qn,c5 as Hr,b9 as zt,b as _e,bB as Ae,c6 as it,c7 as rn,b$ as nt,c8 as rt,ba as Be,c9 as un,ca as Ct,cb as _t,cc as Nr,cd as Kn,ce as _r,cf as fn,cg as dn,ch as jt,ci as En,cj as Xn,ar as Br,ck as Wr,b5 as Tt,b3 as J,cl as Gn,cm as Ur,bA as ue,cn as Cn,co as Jt,cp as Tn,cq as Qt,bC as ot,bI as at,cr as An,cs as Mt,bO as Jn,ct as Yt,cu as qt,cv as Qn,cw as pn,cx as $r,cy as zr,cz as on,cA as jr,a as gt,cB as Yr,b4 as It,b6 as Le,j as Ie,bP as oe,b2 as z,be as gn,b8 as sn,b7 as qr,bb as Kr,bc as Xr,bd as mn,cC as Gr,cD as Jr,cE as Qr,u as Zn,cF as Zr,bX as eo,cG as to,b_ as no,cH as ro,bE as oo,cI as so,bf as er,cJ as Zt}from"./main-BGYbJv-h.js";import{i as In,c as tr,A as io,P as co,b as nr,d as Ye,B as lo,D as et,E as rr,G as ao,z as or,u as uo,a as sr,m as fo,n as po,H as go,q as mo,J as ho,I as xo,x as yo,y as wo}from"./useScrollLock-CuXeF5Ev.js";const bo=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ei=Vr("chevron-down",bo),Ro=["top","right","bottom","left"],wt=Math.min,Ne=Math.max,Bt=Math.round,Ot=Math.floor,Ge=e=>({x:e,y:e}),So={left:"right",right:"left",bottom:"top",top:"bottom"};function cn(e,t,n){return Ne(e,wt(t,n))}function st(e,t){return typeof e=="function"?e(t):e}function Ve(e){return e.split("-")[0]}function ut(e){return e.split("-")[1]}function hn(e){return e==="x"?"y":"x"}function xn(e){return e==="y"?"height":"width"}function je(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function yn(e){return hn(je(e))}function vo(e,t,n){n===void 0&&(n=!1);const r=ut(e),o=yn(e),s=xn(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Wt(i)),[i,Wt(i)]}function Eo(e){const t=Wt(e);return[ln(e),t,ln(t)]}function ln(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Mn=["left","right"],On=["right","left"],Co=["top","bottom"],To=["bottom","top"];function Ao(e,t,n){switch(e){case"top":case"bottom":return n?t?On:Mn:t?Mn:On;case"left":case"right":return t?Co:To;default:return[]}}function Io(e,t,n,r){const o=ut(e);let s=Ao(Ve(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(ln)))),s}function Wt(e){const t=Ve(e);return So[t]+e.slice(t.length)}function Mo(e){return{top:0,right:0,bottom:0,left:0,...e}}function ir(e){return typeof e!="number"?Mo(e):{top:e,right:e,bottom:e,left:e}}function At(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function bt(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}function Oo(e,t={}){const{enabled:n=!0,event:r="click",toggle:o=!0,ignoreMouse:s=!1,stickIfOpen:i=!0,touchOpenDelay:c=0,reason:a=kr}=t,f="rootStore"in e?e.rootStore:e,g=f.context.dataRef,u=l.useRef(void 0),d=Nt(),p=vt(),m=l.useMemo(()=>{function y(h,R,x,w){const S=_e(a,R,x);h&&w==="touch"&&c>0?p.start(c,()=>{f.setOpen(!0,S)}):f.setOpen(h,S)}function b(h,R,x){const w=g.current.openEvent,S=f.select("domReferenceElement")!==R;return h&&S||!h||!o?!0:w&&i?!x(w.type):!1}return{onPointerDown(h){u.current=h.pointerType},onMouseDown(h){const R=u.current,x=h.nativeEvent,w=f.select("open");if(h.button!==0||r==="click"||In(R,!0)&&s)return;const S=b(w,h.currentTarget,T=>T==="click"||T==="mousedown"),C=qn(x);if(Hr(C)){y(S,x,C,R);return}const P=h.currentTarget;d.request(()=>{y(S,x,P,R)})},onClick(h){if(r==="mousedown-only")return;const R=u.current;if(r==="mousedown"&&R){u.current=void 0;return}if(In(R,!0)&&s)return;const x=f.select("open"),w=b(x,h.currentTarget,S=>S==="click"||S==="mousedown"||S==="keydown"||S==="keyup");y(w,h.nativeEvent,h.currentTarget,R)},onKeyDown(){u.current=void 0}}},[g,r,s,a,f,i,o,d,p,c]);return l.useMemo(()=>n?{reference:m}:zt,[n,m])}function Pn(e,t,n){let{reference:r,floating:o}=e;const s=je(t),i=yn(t),c=xn(i),a=Ve(t),f=s==="y",g=r.x+r.width/2-o.width/2,u=r.y+r.height/2-o.height/2,d=r[c]/2-o[c]/2;let p;switch(a){case"top":p={x:g,y:r.y-o.height};break;case"bottom":p={x:g,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:u};break;case"left":p={x:r.x-o.width,y:u};break;default:p={x:r.x,y:r.y}}switch(ut(t)){case"start":p[i]-=d*(n&&f?-1:1);break;case"end":p[i]+=d*(n&&f?-1:1);break}return p}async function Po(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:c,strategy:a}=e,{boundary:f="clippingAncestors",rootBoundary:g="viewport",elementContext:u="floating",altBoundary:d=!1,padding:p=0}=st(t,e),m=ir(p),b=c[d?u==="floating"?"reference":"floating":u],h=At(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(b)))==null||n?b:b.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:f,rootBoundary:g,strategy:a})),R=u==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),w=await(s.isElement==null?void 0:s.isElement(x))?await(s.getScale==null?void 0:s.getScale(x))||{x:1,y:1}:{x:1,y:1},S=At(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:R,offsetParent:x,strategy:a}):R);return{top:(h.top-S.top+m.top)/w.y,bottom:(S.bottom-h.bottom+m.bottom)/w.y,left:(h.left-S.left+m.left)/w.x,right:(S.right-h.right+m.right)/w.x}}const Do=50,Lo=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=i.detectOverflow?i:{...i,detectOverflow:Po},a=await(i.isRTL==null?void 0:i.isRTL(t));let f=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:g,y:u}=Pn(f,r,a),d=r,p=0;const m={};for(let y=0;y<s.length;y++){const b=s[y];if(!b)continue;const{name:h,fn:R}=b,{x,y:w,data:S,reset:C}=await R({x:g,y:u,initialPlacement:r,placement:d,strategy:o,middlewareData:m,rects:f,platform:c,elements:{reference:e,floating:t}});g=x??g,u=w??u,m[h]={...m[h],...S},C&&p<Do&&(p++,typeof C=="object"&&(C.placement&&(d=C.placement),C.rects&&(f=C.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:g,y:u}=Pn(f,d,a)),y=-1)}return{x:g,y:u,placement:d,strategy:o,middlewareData:m}},Fo=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:c,platform:a,elements:f}=t,{mainAxis:g=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:y=!0,...b}=st(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const h=Ve(o),R=je(c),x=Ve(c)===c,w=await(a.isRTL==null?void 0:a.isRTL(f.floating)),S=d||(x||!y?[Wt(c)]:Eo(c)),C=m!=="none";!d&&C&&S.push(...Io(c,y,m,w));const P=[c,...S],T=await a.detectOverflow(t,b),L=[];let _=((r=s.flip)==null?void 0:r.overflows)||[];if(g&&L.push(T[h]),u){const I=vo(o,i,w);L.push(T[I[0]],T[I[1]])}if(_=[..._,{placement:o,overflows:L}],!L.every(I=>I<=0)){var X,B;const I=(((X=s.flip)==null?void 0:X.index)||0)+1,H=P[I];if(H&&(!(u==="alignment"?R!==je(H):!1)||_.every(E=>je(E.placement)===R?E.overflows[0]>0:!0)))return{data:{index:I,overflows:_},reset:{placement:H}};let Y=(B=_.filter(F=>F.overflows[0]<=0).sort((F,E)=>F.overflows[1]-E.overflows[1])[0])==null?void 0:B.placement;if(!Y)switch(p){case"bestFit":{var k;const F=(k=_.filter(E=>{if(C){const W=je(E.placement);return W===R||W==="y"}return!0}).map(E=>[E.placement,E.overflows.filter(W=>W>0).reduce((W,A)=>W+A,0)]).sort((E,W)=>E[1]-W[1])[0])==null?void 0:k[0];F&&(Y=F);break}case"initialPlacement":Y=c;break}if(o!==Y)return{reset:{placement:Y}}}return{}}}};function Dn(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ln(e){return Ro.some(t=>e[t]>=0)}const Vo=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=st(e,t);switch(o){case"referenceHidden":{const i=await r.detectOverflow(t,{...s,elementContext:"reference"}),c=Dn(i,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Ln(c)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),c=Dn(i,n.floating);return{data:{escapedOffsets:c,escaped:Ln(c)}}}default:return{}}}}},cr=new Set(["left","top"]);async function ko(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Ve(n),c=ut(n),a=je(n)==="y",f=cr.has(i)?-1:1,g=s&&a?-1:1,u=st(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:m}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return c&&typeof m=="number"&&(p=c==="end"?m*-1:m),a?{x:p*g,y:d*f}:{x:d*f,y:p*g}}const Ho=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:c}=t,a=await ko(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:s+a.y,data:{...a,placement:i}}}}},No=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:c=!1,limiter:a={fn:h=>{let{x:R,y:x}=h;return{x:R,y:x}}},...f}=st(e,t),g={x:n,y:r},u=await s.detectOverflow(t,f),d=je(Ve(o)),p=hn(d);let m=g[p],y=g[d];if(i){const h=p==="y"?"top":"left",R=p==="y"?"bottom":"right",x=m+u[h],w=m-u[R];m=cn(x,m,w)}if(c){const h=d==="y"?"top":"left",R=d==="y"?"bottom":"right",x=y+u[h],w=y-u[R];y=cn(x,y,w)}const b=a.fn({...t,[p]:m,[d]:y});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[p]:i,[d]:c}}}}}},_o=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:c=0,mainAxis:a=!0,crossAxis:f=!0}=st(e,t),g={x:n,y:r},u=je(o),d=hn(u);let p=g[d],m=g[u];const y=st(c,t),b=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(a){const x=d==="y"?"height":"width",w=s.reference[d]-s.floating[x]+b.mainAxis,S=s.reference[d]+s.reference[x]-b.mainAxis;p<w?p=w:p>S&&(p=S)}if(f){var h,R;const x=d==="y"?"width":"height",w=cr.has(Ve(o)),S=s.reference[u]-s.floating[x]+(w&&((h=i.offset)==null?void 0:h[u])||0)+(w?0:b.crossAxis),C=s.reference[u]+s.reference[x]+(w?0:((R=i.offset)==null?void 0:R[u])||0)-(w?b.crossAxis:0);m<S?m=S:m>C&&(m=C)}return{[d]:p,[u]:m}}}},Bo=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:c}=t,{apply:a=()=>{},...f}=st(e,t),g=await i.detectOverflow(t,f),u=Ve(o),d=ut(o),p=je(o)==="y",{width:m,height:y}=s.floating;let b,h;u==="top"||u==="bottom"?(b=u,h=d===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(h=u,b=d==="end"?"top":"bottom");const R=y-g.top-g.bottom,x=m-g.left-g.right,w=wt(y-g[b],R),S=wt(m-g[h],x),C=!t.middlewareData.shift;let P=w,T=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=x),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(P=R),C&&!d){const _=Ne(g.left,0),X=Ne(g.right,0),B=Ne(g.top,0),k=Ne(g.bottom,0);p?T=m-2*(_!==0||X!==0?_+X:Ne(g.left,g.right)):P=y-2*(B!==0||k!==0?B+k:Ne(g.top,g.bottom))}await a({...t,availableWidth:T,availableHeight:P});const L=await i.getDimensions(c.floating);return m!==L.width||y!==L.height?{reset:{rects:!0}}:{}}}};function lr(e){const t=rt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=nt(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=Bt(n)!==s||Bt(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function wn(e){return Ae(e)?e:e.contextElement}function yt(e){const t=wn(e);if(!nt(t))return Ge(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=lr(t);let i=(s?Bt(n.width):n.width)/r,c=(s?Bt(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const Wo=Ge(0);function ar(e){const t=Be(e);return!Xn()||!t.visualViewport?Wo:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Uo(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Be(e)?!1:t}function dt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=wn(e);let i=Ge(1);t&&(r?Ae(r)&&(i=yt(r)):i=yt(e));const c=Uo(s,n,r)?ar(s):Ge(0);let a=(o.left+c.x)/i.x,f=(o.top+c.y)/i.y,g=o.width/i.x,u=o.height/i.y;if(s){const d=Be(s),p=r&&Ae(r)?Be(r):r;let m=d,y=En(m);for(;y&&r&&p!==m;){const b=yt(y),h=y.getBoundingClientRect(),R=rt(y),x=h.left+(y.clientLeft+parseFloat(R.paddingLeft))*b.x,w=h.top+(y.clientTop+parseFloat(R.paddingTop))*b.y;a*=b.x,f*=b.y,g*=b.x,u*=b.y,a+=x,f+=w,m=Be(y),y=En(m)}}return At({width:g,height:u,x:a,y:f})}function Kt(e,t){const n=jt(e).scrollLeft;return t?t.left+n:dt(it(e)).left+n}function ur(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Kt(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function $o(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=it(r),c=t?un(t.floating):!1;if(r===i||c&&s)return n;let a={scrollLeft:0,scrollTop:0},f=Ge(1);const g=Ge(0),u=nt(r);if((u||!u&&!s)&&((fn(r)!=="body"||dn(i))&&(a=jt(r)),u)){const p=dt(r);f=yt(r),g.x=p.x+r.clientLeft,g.y=p.y+r.clientTop}const d=i&&!u&&!s?ur(i,a):Ge(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-a.scrollLeft*f.x+g.x+d.x,y:n.y*f.y-a.scrollTop*f.y+g.y+d.y}}function zo(e){return Array.from(e.getClientRects())}function jo(e){const t=it(e),n=jt(e),r=e.ownerDocument.body,o=Ne(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Ne(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Kt(e);const c=-n.scrollTop;return rt(r).direction==="rtl"&&(i+=Ne(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:c}}const Fn=25;function Yo(e,t){const n=Be(e),r=it(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,c=0,a=0;if(o){s=o.width,i=o.height;const g=Xn();(!g||g&&t==="fixed")&&(c=o.offsetLeft,a=o.offsetTop)}const f=Kt(r);if(f<=0){const g=r.ownerDocument,u=g.body,d=getComputedStyle(u),p=g.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,m=Math.abs(r.clientWidth-u.clientWidth-p);m<=Fn&&(s-=m)}else f<=Fn&&(s+=f);return{width:s,height:i,x:c,y:a}}function qo(e,t){const n=dt(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=nt(e)?yt(e):Ge(1),i=e.clientWidth*s.x,c=e.clientHeight*s.y,a=o*s.x,f=r*s.y;return{width:i,height:c,x:a,y:f}}function Vn(e,t,n){let r;if(t==="viewport")r=Yo(e,n);else if(t==="document")r=jo(it(e));else if(Ae(t))r=qo(t,n);else{const o=ar(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return At(r)}function fr(e,t){const n=Ct(e);return n===t||!Ae(n)||_t(n)?!1:rt(n).position==="fixed"||fr(n,t)}function Ko(e,t){const n=t.get(e);if(n)return n;let r=rn(e,[],!1).filter(c=>Ae(c)&&fn(c)!=="body"),o=null;const s=rt(e).position==="fixed";let i=s?Ct(e):e;for(;Ae(i)&&!_t(i);){const c=rt(i),a=Kn(i);!a&&c.position==="fixed"&&(o=null),(s?!a&&!o:!a&&c.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||dn(i)&&!a&&fr(e,i))?r=r.filter(g=>g!==i):o=c,i=Ct(i)}return t.set(e,r),r}function Xo(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?un(t)?[]:Ko(t,this._c):[].concat(n),r],c=Vn(t,i[0],o);let a=c.top,f=c.right,g=c.bottom,u=c.left;for(let d=1;d<i.length;d++){const p=Vn(t,i[d],o);a=Ne(p.top,a),f=wt(p.right,f),g=wt(p.bottom,g),u=Ne(p.left,u)}return{width:f-u,height:g-a,x:u,y:a}}function Go(e){const{width:t,height:n}=lr(e);return{width:t,height:n}}function Jo(e,t,n){const r=nt(t),o=it(t),s=n==="fixed",i=dt(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=Ge(0);function f(){a.x=Kt(o)}if(r||!r&&!s)if((fn(t)!=="body"||dn(o))&&(c=jt(t)),r){const p=dt(t,!0,s,t);a.x=p.x+t.clientLeft,a.y=p.y+t.clientTop}else o&&f();s&&!r&&o&&f();const g=o&&!r&&!s?ur(o,c):Ge(0),u=i.left+c.scrollLeft-a.x-g.x,d=i.top+c.scrollTop-a.y-g.y;return{x:u,y:d,width:i.width,height:i.height}}function en(e){return rt(e).position==="static"}function kn(e,t){if(!nt(e)||rt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return it(e)===n&&(n=n.ownerDocument.body),n}function dr(e,t){const n=Be(e);if(un(e))return n;if(!nt(e)){let o=Ct(e);for(;o&&!_t(o);){if(Ae(o)&&!en(o))return o;o=Ct(o)}return n}let r=kn(e,t);for(;r&&Nr(r)&&en(r);)r=kn(r,t);return r&&_t(r)&&en(r)&&!Kn(r)?n:r||_r(e)||n}const Qo=async function(e){const t=this.getOffsetParent||dr,n=this.getDimensions,r=await n(e.floating);return{reference:Jo(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Zo(e){return rt(e).direction==="rtl"}const pr={convertOffsetParentRelativeRectToViewportRelativeRect:$o,getDocumentElement:it,getClippingRect:Xo,getOffsetParent:dr,getElementRects:Qo,getClientRects:zo,getDimensions:Go,getScale:yt,isElement:Ae,isRTL:Zo};function gr(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function es(e,t){let n=null,r;const o=it(e);function s(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function i(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),s();const f=e.getBoundingClientRect(),{left:g,top:u,width:d,height:p}=f;if(c||t(),!d||!p)return;const m=Ot(u),y=Ot(o.clientWidth-(g+d)),b=Ot(o.clientHeight-(u+p)),h=Ot(g),x={rootMargin:-m+"px "+-y+"px "+-b+"px "+-h+"px",threshold:Ne(0,wt(1,a))||1};let w=!0;function S(C){const P=C[0].intersectionRatio;if(P!==a){if(!w)return i();P?i(!1,P):r=setTimeout(()=>{i(!1,1e-7)},1e3)}P===1&&!gr(f,e.getBoundingClientRect())&&i(),w=!1}try{n=new IntersectionObserver(S,{...x,root:o.ownerDocument})}catch{n=new IntersectionObserver(S,x)}n.observe(e)}return i(!0),s}function Hn(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,f=wn(e),g=o||s?[...f?rn(f):[],...t?rn(t):[]]:[];g.forEach(h=>{o&&h.addEventListener("scroll",n,{passive:!0}),s&&h.addEventListener("resize",n)});const u=f&&c?es(f,n):null;let d=-1,p=null;i&&(p=new ResizeObserver(h=>{let[R]=h;R&&R.target===f&&p&&t&&(p.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var x;(x=p)==null||x.observe(t)})),n()}),f&&!a&&p.observe(f),t&&p.observe(t));let m,y=a?dt(e):null;a&&b();function b(){const h=dt(e);y&&!gr(y,h)&&n(),y=h,m=requestAnimationFrame(b)}return n(),()=>{var h;g.forEach(R=>{o&&R.removeEventListener("scroll",n),s&&R.removeEventListener("resize",n)}),u?.(),(h=p)==null||h.disconnect(),p=null,a&&cancelAnimationFrame(m)}}const ts=Ho,ns=No,rs=Fo,os=Bo,ss=Vo,is=_o,cs=(e,t,n)=>{const r=new Map,o={platform:pr,...n},s={...o.platform,_c:r};return Lo(e,t,{...o,platform:s})};var ls=typeof document<"u",as=function(){},kt=ls?l.useLayoutEffect:as;function Ut(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ut(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Ut(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function mr(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Nn(e,t){const n=mr(e);return Math.round(t*n)/n}function tn(e){const t=l.useRef(e);return kt(()=>{t.current=e}),t}function us(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:c=!0,whileElementsMounted:a,open:f}=e,[g,u]=l.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[d,p]=l.useState(r);Ut(d,r)||p(r);const[m,y]=l.useState(null),[b,h]=l.useState(null),R=l.useCallback(E=>{E!==C.current&&(C.current=E,y(E))},[]),x=l.useCallback(E=>{E!==P.current&&(P.current=E,h(E))},[]),w=s||m,S=i||b,C=l.useRef(null),P=l.useRef(null),T=l.useRef(g),L=a!=null,_=tn(a),X=tn(o),B=tn(f),k=l.useCallback(()=>{if(!C.current||!P.current)return;const E={placement:t,strategy:n,middleware:d};X.current&&(E.platform=X.current),cs(C.current,P.current,E).then(W=>{const A={...W,isPositioned:B.current!==!1};I.current&&!Ut(T.current,A)&&(T.current=A,Br.flushSync(()=>{u(A)}))})},[d,t,n,X,B]);kt(()=>{f===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,u(E=>({...E,isPositioned:!1})))},[f]);const I=l.useRef(!1);kt(()=>(I.current=!0,()=>{I.current=!1}),[]),kt(()=>{if(w&&(C.current=w),S&&(P.current=S),w&&S){if(_.current)return _.current(w,S,k);k()}},[w,S,k,_,L]);const H=l.useMemo(()=>({reference:C,floating:P,setReference:R,setFloating:x}),[R,x]),Y=l.useMemo(()=>({reference:w,floating:S}),[w,S]),F=l.useMemo(()=>{const E={position:n,left:0,top:0};if(!Y.floating)return E;const W=Nn(Y.floating,g.x),A=Nn(Y.floating,g.y);return c?{...E,transform:"translate("+W+"px, "+A+"px)",...mr(Y.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:A}},[n,c,Y.floating,g.x,g.y]);return l.useMemo(()=>({...g,update:k,refs:H,elements:Y,floatingStyles:F}),[g,k,H,Y,F])}const fs=(e,t)=>{const n=ts(e);return{name:n.name,fn:n.fn,options:[e,t]}},ds=(e,t)=>{const n=ns(e);return{name:n.name,fn:n.fn,options:[e,t]}},ps=(e,t)=>({fn:is(e).fn,options:[e,t]}),gs=(e,t)=>{const n=rs(e);return{name:n.name,fn:n.fn,options:[e,t]}},ms=(e,t)=>{const n=os(e);return{name:n.name,fn:n.fn,options:[e,t]}},hs=(e,t)=>{const n=ss(e);return{name:n.name,fn:n.fn,options:[e,t]}};function hr(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,o=Wr(),s=tr()!=null,i=Tt(()=>new io({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new co,floatingId:o,syncOnly:!1,nested:s})).current;return J(()=>{const c={open:t,floatingId:o};r.reference!==void 0&&(c.referenceElement=r.reference,c.domReferenceElement=Ae(r.reference)?r.reference:null),r.floating!==void 0&&(c.floatingElement=r.floating),i.update(c)},[t,o,r.reference,r.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i}function xs(e={}){const{nodeId:t,externalTree:n}=e,r=hr(e),o=e.rootContext||r,s=o.useState("referenceElement"),i=o.useState("floatingElement"),c=o.useState("domReferenceElement"),a=o.useState("open"),f=o.useState("floatingId"),[g,u]=l.useState(null),[d,p]=l.useState(void 0),[m,y]=l.useState(void 0),b=l.useRef(null),h=nr(n),R=l.useMemo(()=>({reference:s,floating:i,domReference:c}),[s,i,c]),x=us({...e,elements:{...R,...g&&{reference:g}}}),w=Ae(d)?d:null,S=m===void 0?o.state.floatingElement:m;o.useSyncedValue("referenceElement",d??null),o.useSyncedValue("domReferenceElement",d===void 0?c:w),o.useSyncedValue("floatingElement",S);const C=l.useCallback(B=>{const k=Ae(B)?{getBoundingClientRect:()=>B.getBoundingClientRect(),getClientRects:()=>B.getClientRects(),contextElement:B}:B;u(k),x.refs.setReference(k)},[x.refs]),P=l.useCallback(B=>{(Ae(B)||B===null)&&(b.current=B,p(B)),(Ae(x.refs.reference.current)||x.refs.reference.current===null||B!==null&&!Ae(B))&&x.refs.setReference(B)},[x.refs,p]),T=l.useCallback(B=>{y(B),x.refs.setFloating(B)},[x.refs]),L=l.useMemo(()=>({...x.refs,setReference:P,setFloating:T,setPositionReference:C,domReference:b}),[x.refs,P,T,C]),_=l.useMemo(()=>({...x.elements,domReference:c}),[x.elements,c]),X=l.useMemo(()=>({...x,dataRef:o.context.dataRef,open:a,onOpenChange:o.setOpen,events:o.context.events,floatingId:f,refs:L,elements:_,nodeId:t,rootStore:o}),[x,L,_,t,o,a,f]);return J(()=>{c&&(b.current=c)},[c]),J(()=>{o.context.dataRef.current.floatingContext=X;const B=h?.nodesRef.current.find(k=>k.id===t);B&&(B.context=X)}),l.useMemo(()=>({...x,context:X,refs:L,elements:_,rootStore:o}),[x,L,_,X,o])}const ys="Escape";function Xt(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Pt(e,t){return Xt(t,e===Qn||e===pn,e===Yt||e===qt)}function nn(e,t,n){return Xt(t,e===pn,n?e===Yt:e===qt)||e==="Enter"||e===" "||e===""}function ws(e,t,n){return Xt(t,n?e===Yt:e===qt,e===pn)}function bs(e,t,n,r){const o=n?e===qt:e===Yt,s=e===Qn;return t==="both"||t==="horizontal"&&r?e===ys:Xt(t,o,s)}function Rs(e,t){const{listRef:n,activeIndex:r,onNavigate:o=()=>{},enabled:s=!0,selectedIndex:i=null,allowEscape:c=!1,loopFocus:a=!1,nested:f=!1,rtl:g=!1,virtual:u=!1,focusItemOnOpen:d="auto",focusItemOnHover:p=!0,openOnArrowKeyDown:m=!0,disabledIndices:y=void 0,orientation:b="vertical",parentOrientation:h,id:R,resetOnPointerLeave:x=!0,externalTree:w,grid:S}=t,C=S!=null,P="rootStore"in e?e.rootStore:e,T=P.useState("open"),L=P.useState("floatingElement"),_=P.useState("domReferenceElement"),X=P.context.dataRef,B=Gn(L),k=Ur(_),I=Ye(B),H=tr(),Y=nr(w),F=l.useRef(d),E=l.useRef(i??-1),W=l.useRef(null),A=l.useRef(!0),v=ue(M=>{o(E.current===-1?null:E.current,M)}),N=l.useRef(!!L),me=l.useRef(T),q=l.useRef(!1),ye=l.useRef(!1),he=l.useRef(null),O=Ye(y),j=Ye(T),le=Ye(i),Ce=Ye(x),Q=Nt(),ne=Nt(),se=ue(()=>{function M(G){u?Y?.events.emit("virtualfocus",G):he.current=lo(G,{sync:q.current,preventScroll:!0})}const D=n.current[E.current],Z=ye.current;D&&M(D),(q.current?G=>G():G=>Q.request(G))(()=>{const G=n.current[E.current]||D;if(!G)return;D||M(G),we&&(Z||!A.current)&&G.scrollIntoView?.({block:"nearest",inline:"nearest"})})});J(()=>{X.current.orientation=b},[X,b]),J(()=>{s&&(T&&L?(E.current=i??-1,F.current&&i!=null&&(ye.current=!0,v())):N.current&&(E.current=-1,v()))},[s,T,L,i,v]),J(()=>{if(s){if(!T){q.current=!1;return}if(L)if(r==null){if(q.current=!1,le.current!=null)return;if(N.current&&(E.current=-1,se()),(!me.current||!N.current)&&F.current&&(W.current!=null||F.current===!0&&W.current==null)){let M=0;const D=()=>{n.current[0]==null?(M<2&&(M?V=>ne.request(V):queueMicrotask)(D),M+=1):(E.current=W.current==null||nn(W.current,b,g)||f?Jt(n):Tn(n),W.current=null,v())};D()}}else Cn(n.current,r)||(E.current=r,se(),ye.current=!1)}},[s,T,L,r,le,f,n,b,g,v,se,ne]),J(()=>{if(!s||L||!Y||u||!N.current)return;const M=Y.nodesRef.current,D=M.find(G=>G.id===H)?.context?.elements.floating,Z=Qt(ot(_??D??null)),V=M.some(G=>G.context&&at(G.context.elements.floating,Z));D&&!V&&A.current&&D.focus({preventScroll:!0})},[s,L,_,Y,H,u]),J(()=>{me.current=T,N.current=!!L}),J(()=>{T||(W.current=null,F.current=d)},[T,d]);const Se=r!=null,fe=ue(M=>{if(!j.current)return;const D=n.current.indexOf(M.currentTarget);D!==-1&&(E.current!==D||r!==D)&&(E.current=D,v(M))}),de=ue(()=>h??Y?.nodesRef.current.find(M=>M.id===H)?.context?.dataRef?.current.orientation),xe=ue(()=>Jt(n,O.current)),te=ue(M=>{if(A.current=!1,q.current=!0,M.which===229||!j.current&&M.currentTarget===I.current)return;if(f&&bs(M.key,b,g,C)){Pt(M.key,de())||et(M),P.setOpen(!1,_e(An,M.nativeEvent)),nt(_)&&(u?Y?.events.emit("virtualfocus",_):_.focus());return}const D=E.current,Z=Jt(n,y),V=Tn(n,y);if(k||(M.key==="Home"&&(et(M),E.current=Z,v(M)),M.key==="End"&&(et(M),E.current=V,v(M))),S!=null){const G=S(M,E.current,n,b,a,g,y,Z,V);if(G!=null&&(E.current=G,v(M)),b==="both")return}if(Pt(M.key,b)){if(et(M),T&&!u&&Qt(M.currentTarget.ownerDocument)===M.currentTarget){E.current=nn(M.key,b,g)?Z:V,v(M);return}nn(M.key,b,g)?a?D>=V?c&&D!==n.current.length?E.current=-1:(q.current=!1,E.current=Z):E.current=Mt(n.current,{startingIndex:D,disabledIndices:y}):E.current=Math.min(V,Mt(n.current,{startingIndex:D,disabledIndices:y})):a?D<=Z?c&&D!==-1?E.current=n.current.length:(q.current=!1,E.current=V):E.current=Mt(n.current,{startingIndex:D,decrement:!0,disabledIndices:y}):E.current=Math.max(Z,Mt(n.current,{startingIndex:D,decrement:!0,disabledIndices:y})),Cn(n.current,E.current)&&(E.current=-1),v(M)}}),we=l.useMemo(()=>({onFocus(D){q.current=!0,fe(D)},onClick:({currentTarget:D})=>D.focus({preventScroll:!0}),onMouseMove(D){q.current=!0,ye.current=!1,p&&fe(D)},onPointerLeave(D){if(!j.current||!A.current||D.pointerType==="touch")return;q.current=!0;const Z=D.relatedTarget;if(!(!p||n.current.includes(Z))&&Ce.current&&(he.current?.(),he.current=null,E.current=-1,v(D),!u)){const V=I.current,G=Qt(ot(V));V&&at(V,G)&&V.focus({preventScroll:!0})}}}),[fe,j,I,p,n,v,Ce,u]),ce=l.useMemo(()=>u&&T&&Se&&{"aria-activedescendant":`${R}-${r}`},[u,T,Se,R,r]),ie=l.useMemo(()=>({"aria-orientation":b==="both"?void 0:b,...k?{}:ce,onKeyDown(M){if(M.key==="Tab"&&M.shiftKey&&T&&!u){const D=qn(M.nativeEvent);if(D&&!at(I.current,D))return;et(M),P.setOpen(!1,_e(Jn,M.nativeEvent)),nt(_)&&_.focus();return}te(M)},onPointerMove(){A.current=!0}}),[ce,te,I,b,k,P,T,u,_]),re=l.useMemo(()=>{function M(V){P.setOpen(!0,_e(An,V.nativeEvent,V.currentTarget))}function D(V){d==="auto"&&rr(V.nativeEvent)&&(F.current=!u)}function Z(V){F.current=d,d==="auto"&&ao(V.nativeEvent)&&(F.current=!0)}return{onKeyDown(V){const G=P.select("open");A.current=!1;const ke=V.key.startsWith("Arrow"),We=ws(V.key,de(),g),Me=Pt(V.key,b),Fe=(f?We:Me)||V.key==="Enter"||V.key.trim()==="";if(u&&G)return te(V);if(!(!G&&!m&&ke)){if(Fe){const ae=Pt(V.key,de());W.current=f&&ae?null:V.key}if(f){We&&(et(V),G?(E.current=xe(),v(V)):M(V));return}Me&&(le.current!=null&&(E.current=le.current),et(V),!G&&m?M(V):te(V),G&&v(V))}},onFocus(V){P.select("open")&&!u&&(E.current=-1,v(V))},onPointerDown:Z,onPointerEnter:Z,onMouseDown:D,onClick:D}},[te,d,xe,f,v,P,m,b,de,g,le,u]),$=l.useMemo(()=>({...ce,...re}),[ce,re]);return l.useMemo(()=>s?{reference:$,floating:ie,item:we,trigger:re}:{},[s,$,ie,re,we])}function Ss(e,t){const{listRef:n,elementsRef:r,activeIndex:o,onMatch:s,disabledIndices:i,onTyping:c,enabled:a=!0,resetMs:f=750,selectedIndex:g=null}=t,u="rootStore"in e?e.rootStore:e,d=u.useState("open"),p=vt(),m=l.useRef(""),y=l.useRef(g??o??-1),b=l.useRef(null),h=ue(w=>{function S(I){const H=r?.current[I];return!H||zr(H)}function C(I){return S(I)?i==null||!$r(on,I,i):!1}function P(I,H,Y=0){if(I.length===0)return-1;const F=(Y%I.length+I.length)%I.length,E=H.toLowerCase();for(let W=0;W<I.length;W+=1){const A=(F+W)%I.length;if(!(!I[A]?.toLowerCase().startsWith(E)||!C(A)))return A}return-1}const T=n.current;if(m.current.length>0&&w.key===" "&&(et(w),c?.(!0)),m.current.length>0&&m.current[0]!==" "&&P(T,m.current)===-1&&w.key!==" "&&c?.(!1),T==null||w.key.length!==1||w.ctrlKey||w.metaKey||w.altKey)return;d&&w.key!==" "&&(et(w),c?.(!0));const L=m.current==="";L&&(y.current=g??o??-1),T.every((I,H)=>I&&C(H)?I[0]?.toLowerCase()!==I[1]?.toLowerCase():!0)&&m.current===w.key&&(m.current="",y.current=b.current),m.current+=w.key,p.start(f,()=>{m.current="",y.current=b.current,c?.(!1)});const B=((L?g??o??-1:y.current)??0)+1,k=P(T,m.current,B);k!==-1?(s?.(k),b.current=k):w.key!==" "&&(m.current="",c?.(!1))}),R=ue(w=>{const S=w.relatedTarget,C=u.select("domReferenceElement"),P=u.select("floatingElement");at(C,S)||at(P,S)||(p.clear(),m.current="",y.current=b.current,c?.(!1))});J(()=>{!d&&g!==null||(p.clear(),b.current=null,m.current!==""&&(m.current=""))},[d,g,p]),J(()=>{d&&m.current===""&&(y.current=g??o??-1)},[d,g,o]);const x=l.useMemo(()=>({onKeyDown:h,onBlur:R}),[h,R]);return l.useMemo(()=>a?{reference:x,floating:x}:{},[a,x])}const vs=l.createContext(void 0);function xr(){return l.useContext(vs)?.direction??"ltr"}const Es=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:c,middlewareData:a}=t,{element:f,padding:g=0,offsetParent:u="real"}=st(e,t)||{};if(f==null)return{};const d=ir(g),p={x:n,y:r},m=yn(o),y=xn(m),b=await i.getDimensions(f),h=m==="y",R=h?"top":"left",x=h?"bottom":"right",w=h?"clientHeight":"clientWidth",S=s.reference[y]+s.reference[m]-p[m]-s.floating[y],C=p[m]-s.reference[m],P=u==="real"?await i.getOffsetParent?.(f):c.floating;let T=c.floating[w]||s.floating[y];(!T||!await i.isElement?.(P))&&(T=c.floating[w]||s.floating[y]);const L=S/2-C/2,_=T/2-b[y]/2-1,X=Math.min(d[R],_),B=Math.min(d[x],_),k=X,I=T-b[y]-B,H=T/2-b[y]/2+L,Y=cn(k,H,I),F=!a.arrow&&ut(o)!=null&&H!==Y&&s.reference[y]/2-(H<k?X:B)-b[y]/2<0,E=F?H<k?H-k:H-I:0;return{[m]:p[m]+E,data:{[m]:Y,centerOffset:H-Y-E,...F&&{alignmentOffset:E}},reset:F}}}),Cs=(e,t)=>({...Es(e),options:[e,t]}),Ts=hs().fn,As={name:"hide",async fn(e){const{width:t,height:n,x:r,y:o}=e.rects.reference,s=t===0&&n===0&&r===0&&o===0;return{data:{referenceHidden:(await Ts(e)).data?.referenceHidden||s}}}},Ht={sideX:"left",sideY:"top"},Ci={name:"adaptiveOrigin",async fn(e){const{x:t,y:n,rects:{floating:r},elements:{floating:o},platform:s,strategy:i,placement:c}=e,a=Be(o),f=a.getComputedStyle(o);if(!(f.transitionDuration!=="0s"&&f.transitionDuration!==""))return{x:t,y:n,data:Ht};const u=await s.getOffsetParent?.(o);let d={width:0,height:0};if(i==="fixed"&&a?.visualViewport)d={width:a.visualViewport.width,height:a.visualViewport.height};else if(u===a){const R=ot(o);d={width:R.documentElement.clientWidth,height:R.documentElement.clientHeight}}else await s.isElement?.(u)&&(d=await s.getDimensions(u));const p=Ve(c);let m=t,y=n;p==="left"&&(m=d.width-(t+r.width)),p==="top"&&(y=d.height-(n+r.height));const b=p==="left"?"right":Ht.sideX,h=p==="top"?"bottom":Ht.sideY;return{x:m,y,data:{sideX:b,sideY:h}}}};function yr(e,t,n){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?n?"inline-start":"inline-end":"right",bottom:"bottom",left:r?n?"inline-end":"inline-start":"left"}[t]}function _n(e,t,n){const{rects:r,placement:o}=e;return{side:yr(t,Ve(o),n),align:ut(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Is(e){const{anchor:t,positionMethod:n="absolute",side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,collisionBoundary:c,collisionPadding:a=5,sticky:f=!1,arrowPadding:g=5,disableAnchorTracking:u=!1,inline:d,keepMounted:p=!1,floatingRootContext:m,mounted:y,collisionAvoidance:b,shiftCrossAxis:h=!1,nodeId:R,adaptiveOrigin:x,lazyFlip:w=!1,externalTree:S}=e,[C,P]=l.useState(null);!y&&C!==null&&P(null);const T=b.side||"flip",L=b.align||"flip",_=b.fallbackAxisSide||"end",X=typeof t=="function"?t:void 0,B=ue(X),k=X?B:t,I=Ye(t),H=Ye(y),F=xr()==="rtl",E=C||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":F?"left":"right","inline-start":F?"right":"left"}[r],W=s==="center"?E:`${E}-${s}`;let A=a;const v=1,N=r==="bottom"?v:0,me=r==="top"?v:0,q=r==="right"?v:0,ye=r==="left"?v:0;typeof A=="number"?A={top:A+N,right:A+ye,bottom:A+me,left:A+q}:A&&(A={top:(A.top||0)+N,right:(A.right||0)+ye,bottom:(A.bottom||0)+me,left:(A.left||0)+q});const he={boundary:c==="clipping-ancestors"?"clippingAncestors":c,padding:A},O=l.useRef(null),j=Ye(o),le=Ye(i),Ce=typeof o!="function"?o:0,Q=typeof i!="function"?i:0,ne=[];d&&ne.push(d),ne.push(fs(ee=>{const pe=_n(ee,r,F),ve=typeof j.current=="function"?j.current(pe):j.current,Re=typeof le.current=="function"?le.current(pe):le.current;return{mainAxis:ve,crossAxis:Re,alignmentAxis:Re}},[Ce,Q,F,r]));const se=L==="none"&&T!=="shift",Se=!se&&(f||h||T==="shift"),fe=T==="none"?null:gs({...he,padding:{top:A.top+v,right:A.right+v,bottom:A.bottom+v,left:A.left+v},mainAxis:!h&&T==="flip",crossAxis:L==="flip"?"alignment":!1,fallbackAxisSideDirection:_}),de=se?null:ds(ee=>{const pe=ot(ee.elements.floating).documentElement;return{...he,rootBoundary:h?{x:0,y:0,width:pe.clientWidth,height:pe.clientHeight}:void 0,mainAxis:L!=="none",crossAxis:Se,limiter:f||h?void 0:ps(ve=>{if(!O.current)return{};const{width:Re,height:Te}=O.current.getBoundingClientRect(),be=je(Ve(ve.placement)),Oe=be==="y"?Re:Te,ze=be==="y"?A.left+A.right:A.top+A.bottom;return{offset:Oe/2+ze/2}})}},[he,f,h,A,L]);T==="shift"||L==="shift"||s==="center"?ne.push(de,fe):ne.push(fe,de),ne.push(ms({...he,apply({elements:{floating:ee},availableWidth:pe,availableHeight:ve,rects:Re}){if(!H.current)return;const Te=ee.style;Te.setProperty("--available-width",`${pe}px`),Te.setProperty("--available-height",`${ve}px`);const be=Be(ee).devicePixelRatio||1,{x:Oe,y:ze,width:qe,height:ct}=Re.reference,Pe=(Math.round((Oe+qe)*be)-Math.round(Oe*be))/be,Ke=(Math.round((ze+ct)*be)-Math.round(ze*be))/be;Te.setProperty("--anchor-width",`${Pe}px`),Te.setProperty("--anchor-height",`${Ke}px`)}}),Cs(ee=>({element:O.current||ot(ee.elements.floating).createElement("div"),padding:g,offsetParent:"floating"}),[g]),{name:"transformOrigin",fn(ee){const{elements:pe,middlewareData:ve,placement:Re,rects:Te,y:be}=ee,Oe=Ve(Re),ze=je(Oe),qe=O.current,ct=ve.arrow?.x||0,Pe=ve.arrow?.y||0,Ke=qe?.clientWidth||0,ht=qe?.clientHeight||0,lt=ct+Ke/2,xt=Pe+ht/2,K=Math.abs(ve.shift?.y||0),ge=Te.reference.height/2,Ee=typeof o=="function"?o(_n(ee,r,F)):o,De=K>Ee,Xe={top:`${lt}px calc(100% + ${Ee}px)`,bottom:`${lt}px ${-Ee}px`,left:`calc(100% + ${Ee}px) ${xt}px`,right:`${-Ee}px ${xt}px`}[Oe],Ze=`${lt}px ${Te.reference.y+ge-be}px`;return pe.floating.style.setProperty("--transform-origin",Se&&ze==="y"&&De?Ze:Xe),{}}},As,x),J(()=>{!y&&m&&m.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[y,m]);const xe=l.useMemo(()=>({elementResize:!u&&typeof ResizeObserver<"u",layoutShift:!u&&typeof IntersectionObserver<"u"}),[u]),{refs:te,elements:we,x:ce,y:ie,middlewareData:re,update:$,placement:M,context:D,isPositioned:Z,floatingStyles:V}=xs({rootContext:m,open:p?y:void 0,placement:W,middleware:ne,strategy:n,whileElementsMounted:p?void 0:(...ee)=>Hn(...ee,xe),nodeId:R,externalTree:S}),{sideX:G,sideY:ke}=re.adaptiveOrigin||Ht,We=Z?n:"fixed",Me=l.useMemo(()=>{const ee=x?{position:We,[G]:ce,[ke]:ie}:{position:We,...V};return Z||(ee.opacity=0),ee},[x,We,G,ce,ke,ie,V,Z]),Fe=l.useRef(null);J(()=>{if(!y)return;const ee=I.current,pe=typeof ee=="function"?ee():ee,Re=(Bn(pe)?pe.current:pe)||null||null;Re!==Fe.current&&(te.setPositionReference(Re),Fe.current=Re)},[y,te,k,I]),l.useEffect(()=>{if(!y)return;const ee=I.current;typeof ee!="function"&&Bn(ee)&&ee.current!==Fe.current&&(te.setPositionReference(ee.current),Fe.current=ee.current)},[y,te,k,I]),l.useEffect(()=>{if(p&&y&&we.reference&&we.floating)return Hn(we.reference,we.floating,$,xe)},[p,y,we,$,xe]);const ae=Ve(M),Ue=yr(r,ae,F),$e=ut(M)||"center",He=!!re.hide?.referenceHidden;J(()=>{w&&y&&Z&&P(ae)},[w,y,Z,ae]);const Je=l.useMemo(()=>({position:"absolute",top:re.arrow?.y,left:re.arrow?.x}),[re.arrow]),Qe=re.arrow?.centerOffset!==0;return l.useMemo(()=>({positionerStyles:Me,arrowStyles:Je,arrowRef:O,arrowUncentered:Qe,side:Ue,align:$e,physicalSide:ae,anchorHidden:He,refs:te,context:D,isPositioned:Z,update:$}),[Me,Je,O,Qe,Ue,$e,ae,He,te,D,Z,$])}function Bn(e){return e!=null&&"current"in e}function wr(e){return e==="starting"?jr:zt}function Ms(e,t,{styles:n,transitionStatus:r,props:o,refs:s,hidden:i,inert:c=!1}){const a={...n};return c&&(a.pointerEvents="none"),gt("div",e,{state:t,ref:s,props:[{role:"presentation",hidden:i,style:a},wr(r),o],stateAttributesMapping:or})}function Os(e){const t=l.useRef(""),n=l.useCallback(o=>{o.defaultPrevented||(t.current=o.pointerType,e(o,o.pointerType))},[e]);return{onClick:l.useCallback(o=>{if(o.detail===0){e(o,"keyboard");return}"pointerType"in o?e(o,o.pointerType):e(o,t.current),t.current=""},[e]),onPointerDown:n}}function br(e,t){const n=l.useRef(e),r=ue(t);J(()=>{n.current!==e&&r(n.current)},[e,r]),J(()=>{n.current=e},[e])}function Ps(e,t){const n=ue((s,i)=>{(typeof e=="function"?e():e)||t(i||(Yr?"touch":""))}),{onClick:r,onPointerDown:o}=Os(n);return l.useMemo(()=>({onClick:r,onPointerDown:o}),[r,o])}function Ds(e){const[t,n]=l.useState(null),r=Ps(e,n);return br(e,o=>{o&&!e&&n(null)}),l.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}function Ls(e){const[t,n]=l.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}function Fs(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function Wn({controlled:e,default:t,name:n,state:r="value"}){const{current:o}=l.useRef(e!==void 0),[s,i]=l.useState(t),c=o?e:s,a=l.useCallback(f=>{o||i(f)},[]);return[c,a]}const Rr=l.createContext(null),Sr=l.createContext(null);function mt(){const e=l.useContext(Rr);if(e===null)throw new Error(It(60));return e}function vr(){const e=l.useContext(Sr);if(e===null)throw new Error(It(61));return e}let Un=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const Vs={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Rt={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},ks={disabled:!1,...Rt},Hs={valid(e){return e===null?null:e?{[Un.valid]:""}:{[Un.invalid]:""}}},Ns={invalid:void 0,name:void 0,validityData:{state:Vs,errors:[],error:"",value:"",initialValue:null},setValidityData:Le,disabled:void 0,touched:Rt.touched,setTouched:Le,dirty:Rt.dirty,setDirty:Le,filled:Rt.filled,setFilled:Le,focused:Rt.focused,setFocused:Le,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:ks,markedDirtyRef:{current:!1},registerFieldControl:Le,validation:{getValidationProps:(e,t=zt)=>t,inputRef:{current:null},registerInput:Le,commit:async()=>{},change:Le}},_s=l.createContext(Ns);function bn(e=!0){const t=l.useContext(_s);if(t.setValidityData===Le&&!e)throw new Error(It(28));return t}function Bs(e,t,n,r,o=!0,s){const{registerFieldControl:i}=bn(),c=l.useRef(null);c.current||(c.current=Symbol()),J(()=>{const a=c.current;return!a||!o?void 0:(i(a,{controlRef:e,getValue:r,id:t,name:s,value:n}),()=>{i(a,void 0)})},[e,o,r,t,s,i,n])}const Ws=l.createContext({controlId:void 0,registerControlId:Le,labelId:void 0,setLabelId:Le,messageIds:[],setMessageIds:Le,getDescriptionProps:e=>e});function Er(){return l.useContext(Ws)}function Cr(e={}){const{id:t,implicit:n=!1,controlRef:r}=e,{controlId:o,registerControlId:s}=Er(),i=uo(t),c=n?o:void 0,a=Tt(()=>Symbol("labelable-control")),f=l.useRef(!1),g=l.useRef(t!=null),u=ue(()=>{!f.current||s===Le||(f.current=!1,s(a.current,void 0))});return J(()=>{if(s===Le)return;let d;if(n){const p=r?.current;Ae(p)&&p.closest("label")!=null?d=t??null:d=c??i}else if(t!=null)g.current=!0,d=t;else if(g.current)d=i;else{u();return}if(d===void 0){u();return}f.current=!0,s(a.current,d)},[t,r,c,s,n,i,a,u]),l.useEffect(()=>u,[u]),o??i}const Us=(e,t)=>Object.is(e,t);function pt(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function $s(e,t,n){return!e||e.length===0?!1:e.some(r=>r===void 0?!1:pt(t,r,n))}function Et(e,t,n){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:pt(r,t,n))}function zs(e,t,n){return e.filter(r=>!pt(t,r,n))}function an(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Tr(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function js(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(Tr(t)){for(const n of t)for(const r of n.items)if(r&&r.value==null&&r.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function Ar(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return an(e)}function ft(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?an(e.value):an(e)}function Ir(e,t,n){function r(){return Ar(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){const o=t,s=Tr(o)?o.flatMap(i=>i.items):o;if(e==null||typeof e!="object"){const i=s.find(c=>c.value===e);return i&&i.label!=null?i.label:r()}if("value"in e){const i=s.find(c=>c&&c.value===e.value);if(i&&i.label!=null)return i.label}}return r()}function Ys(e,t,n){return e.reduce((r,o,s)=>(s>0&&r.push(", "),r.push(Ie.jsx(l.Fragment,{children:Ir(o,t,n)},s)),r),[])}const U={id:oe(e=>e.id),labelId:oe(e=>e.labelId),modal:oe(e=>e.modal),multiple:oe(e=>e.multiple),items:oe(e=>e.items),itemToStringLabel:oe(e=>e.itemToStringLabel),itemToStringValue:oe(e=>e.itemToStringValue),isItemEqualToValue:oe(e=>e.isItemEqualToValue),value:oe(e=>e.value),hasSelectedValue:oe(e=>{const{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:ft(t,r)!==""}),hasNullItemLabel:oe((e,t)=>t?js(e.items):!1),open:oe(e=>e.open),mounted:oe(e=>e.mounted),forceMount:oe(e=>e.forceMount),transitionStatus:oe(e=>e.transitionStatus),openMethod:oe(e=>e.openMethod),activeIndex:oe(e=>e.activeIndex),selectedIndex:oe(e=>e.selectedIndex),isActive:oe((e,t)=>e.activeIndex===t),isSelected:oe((e,t)=>{const n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(o=>pt(t,o,n)):pt(t,r,n)}),isSelectedByFocus:oe((e,t)=>e.selectedIndex===t),popupProps:oe(e=>e.popupProps),triggerProps:oe(e=>e.triggerProps),triggerElement:oe(e=>e.triggerElement),positionerElement:oe(e=>e.positionerElement),listElement:oe(e=>e.listElement),popupSide:oe(e=>e.popupSide),scrollUpArrowVisible:oe(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:oe(e=>e.scrollDownArrowVisible),hasScrollArrows:oe(e=>e.hasScrollArrows)},qs=l.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Le,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function Ks(){return l.useContext(qs)}function Xs(e,t,n=(r,o)=>r===o){return e.length===t.length&&e.every((r,o)=>n(r,t[o]))}const tt=1;function Mr(e,t){return Math.max(0,e-t)}function Gs(e,t){if(t<=0)return 0;const n=bt(e,0,t),r=n,o=t-n,s=r<=tt,i=o<=tt;return s&&i?r<=o?0:t:s?0:i?t:n}function Ti(e){const{id:t,value:n,defaultValue:r=null,onValueChange:o,open:s,defaultOpen:i=!1,onOpenChange:c,name:a,form:f,autoComplete:g,disabled:u=!1,readOnly:d=!1,required:p=!1,modal:m=!0,actionsRef:y,inputRef:b,onOpenChangeComplete:h,items:R,multiple:x=!1,itemToStringLabel:w,itemToStringValue:S,isItemEqualToValue:C=Us,highlightItemOnHover:P=!0,children:T}=e,{clearErrors:L}=Ks(),{setDirty:_,setTouched:X,setFocused:B,validityData:k,setFilled:I,name:H,disabled:Y,validation:F,validationMode:E}=bn(),W=Cr({id:t}),A=Y||u,v=H??a,[N,me]=Wn({controlled:n,default:x?r??on:r,name:"Select",state:"value"}),[q,ye]=Wn({controlled:s,default:i,name:"Select",state:"open"}),he=l.useRef([]),O=l.useRef([]),j=l.useRef(null),le=l.useRef(null),Ce=l.useRef(0),Q=l.useRef(null),ne=l.useRef([]),se=l.useRef(!1),Se=l.useRef(null),fe=l.useRef(null),de=l.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),xe=l.useRef(!1),{mounted:te,setMounted:we,transitionStatus:ce}=sr(q),{openMethod:ie,triggerProps:re}=Ds(q),$=Tt(()=>new Gr({id:W,labelId:void 0,modal:m,multiple:x,itemToStringLabel:w,itemToStringValue:S,isItemEqualToValue:C,value:N,open:q,mounted:te,transitionStatus:ce,items:R,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,M=z($,U.activeIndex),D=z($,U.selectedIndex),Z=z($,U.triggerElement),V=z($,U.positionerElement),G=Ls(ie),ke=ie??G??null,We=l.useMemo(()=>x?"":ft(N,S),[x,N,S]),Me=l.useMemo(()=>x&&Array.isArray(N)?N.map(K=>ft(K,S)):ft(N,S),[x,N,S]),Fe=Ye($.state.triggerElement),ae=ue(()=>Me);Bs(Fe,W,N,ae,!A,a);const Ue=l.useRef(N),$e=x?Array.isArray(N)&&N.length>0:N!=null&&ft(N,S)!=="";J(()=>{N!==Ue.current&&$.set("forceMount",!0)},[$,N]),J(()=>{I($e)},[$e,I]),J(function(){const ge=ne.current;let Ee;if(x){const De=Array.isArray(N)?N:[];if(De.length===0)Ee=null;else{const Xe=De[De.length-1],Ze=Et(ge,Xe,C);Ee=Ze===-1?null:Ze}}else{const De=Et(ge,N,C);Ee=De===-1?null:De}Ee===null&&(fe.current=null),!q&&$.set("selectedIndex",Ee)},[$e,x,q,N,ne,C,$,fe]);function He(K){const ge=k.initialValue;return Array.isArray(K)&&Array.isArray(ge)?!Xs(K,ge,(Ee,De)=>pt(Ee,De,C)):K!==ge}br(N,()=>{L(v),_(He(N)),F.change(N)});const Je=ue((K,ge)=>{c?.(K,ge),!ge.isCanceled&&(ye(K),!K&&(ge.reason===Jn||ge.reason===Jr)&&(X(!0),B(!1),E==="onBlur"&&F.commit(N)))}),Qe=ue(()=>{we(!1),$.update({activeIndex:null,openMethod:null}),h?.(!1)});gn({enabled:!y,open:q,ref:j,onComplete(){q||Qe()}}),l.useImperativeHandle(y,()=>({unmount:Qe}),[Qe]);const ee=ue((K,ge)=>{o?.(K,ge),!ge.isCanceled&&me(K)}),pe=ue(()=>{const K=$.state.listElement||j.current;if(!K)return;const ge=Mr(K.scrollHeight,K.clientHeight),Ee=Gs(K.scrollTop,ge),De=Ee>0,Xe=Ee<ge;$.state.scrollUpArrowVisible!==De&&$.set("scrollUpArrowVisible",De),$.state.scrollDownArrowVisible!==Xe&&$.set("scrollDownArrowVisible",Xe)}),ve=hr({open:q,onOpenChange:Je,elements:{reference:Z,floating:V}}),Re=Oo(ve,{enabled:!d&&!A,event:"mousedown"}),Te=fo(ve),be=Rs(ve,{enabled:!d&&!A,listRef:he,activeIndex:M,selectedIndex:D,disabledIndices:on,onNavigate(K){K===null&&!q||$.set("activeIndex",K)},focusItemOnHover:P}),Oe=Ss(ve,{enabled:!d&&!A&&(q||!x),listRef:O,activeIndex:M,selectedIndex:D,disabledIndices:K=>Fs(he.current[K]),onMatch(K){q?$.set("activeIndex",K):ee(ne.current[K],_e("none"))},onTyping(K){se.current=K}}),ze=l.useMemo(()=>{const K=sn(Oe.reference,be.reference,Te.reference,Re.reference,re);return W&&(K.id=W),K},[Re.reference,Oe.reference,be.reference,Te.reference,re,W]),qe=l.useMemo(()=>sn(po,Oe.floating,be.floating,Te.floating),[Oe.floating,be.floating,Te.floating]),ct=be.item??zt;go(()=>{$.update({popupProps:qe,triggerProps:ze})}),J(()=>{$.update({id:W,modal:m,multiple:x,value:N,open:q,mounted:te,transitionStatus:ce,popupProps:qe,triggerProps:ze,items:R,itemToStringLabel:w,itemToStringValue:S,isItemEqualToValue:C,openMethod:ke})},[$,W,m,x,N,q,te,ce,qe,ze,R,w,S,C,ke]);const Pe=l.useMemo(()=>({store:$,name:v,required:p,disabled:A,readOnly:d,multiple:x,highlightItemOnHover:P,setValue:ee,setOpen:Je,listRef:he,popupRef:j,scrollHandlerRef:le,handleScrollArrowVisibility:pe,scrollArrowsMountedCountRef:Ce,itemProps:ct,valueRef:Q,valuesRef:ne,labelsRef:O,typingRef:se,selectionRef:de,firstItemTextRef:Se,selectedItemTextRef:fe,validation:F,onOpenChangeComplete:h,alignItemWithTriggerActiveRef:xe,initialValueRef:Ue}),[$,v,p,A,d,x,P,ee,Je,ct,F,h,pe]),Ke=qr(b,F.inputRef),ht=x&&Array.isArray(N)&&N.length>0,lt=x?void 0:v,xt=l.useMemo(()=>!x||!Array.isArray(N)||!v?null:N.map(K=>{const ge=ft(K,S);return Ie.jsx("input",{type:"hidden",form:f,name:v,value:ge,disabled:A},ge)}),[x,N,f,v,S,A]);return Ie.jsx(Rr.Provider,{value:Pe,children:Ie.jsxs(Sr.Provider,{value:ve,children:[T,Ie.jsx("input",{...F.getValidationProps(A,{onFocus(){$.state.triggerElement?.focus({focusVisible:!0})},onChange(K){if(K.nativeEvent.defaultPrevented||A||d)return;const ge=K.currentTarget.value,Ee=_e(mn,K.nativeEvent);function De(){if(x)return;const Xe=ge.toLowerCase();let Ze=ne.current.findIndex(Gt=>ft(Gt,S).toLowerCase()===Xe||Ar(Gt,w).toLowerCase()===Xe);Ze===-1&&(Ze=ne.current.findIndex((Gt,Fr)=>{const vn=O.current[Fr];return vn!=null&&vn.toLowerCase()===Xe}));const Sn=Ze===-1?void 0:ne.current[Ze];Sn!=null&&ee(Sn,Ee)}$.set("forceMount",!0),queueMicrotask(De)}}),id:W&&lt==null?`${W}-hidden-input`:void 0,form:f,name:lt,autoComplete:g,value:We,disabled:A,required:p&&!ht,readOnly:d,ref:Ke,style:v?Kr:Xr,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),xt]})})}function Js(e,t){return e??t}function Qs(e){const t=e.getBoundingClientRect(),n=Be(e);if(Qr)return t;const r=n.getComputedStyle(e,"::before"),o=n.getComputedStyle(e,"::after");if(!(r.content!=="none"||o.content!=="none"))return t;const i=parseFloat(r.width)||0,c=parseFloat(r.height)||0,a=parseFloat(o.width)||0,f=parseFloat(o.height)||0,g=Math.max(t.width,i,a),u=Math.max(t.height,c,f),d=g-t.width,p=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-p/2,bottom:t.bottom+p/2}}const Dt=2,Zs=400,ei={...mo,...Hs,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},Ai=l.forwardRef(function(t,n){const{render:r,className:o,id:s,disabled:i=!1,nativeButton:c=!0,style:a,...f}=t,{setTouched:g,setFocused:u,validationMode:d,state:p,disabled:m}=bn(),{labelId:y}=Er(),{store:b,setOpen:h,selectionRef:R,validation:x,readOnly:w,required:S,alignItemWithTriggerActiveRef:C,disabled:P}=mt(),T=m||P||i,L=z(b,U.open),_=z(b,U.mounted),X=z(b,U.value),B=z(b,U.triggerProps),k=z(b,U.positionerElement),I=z(b,U.listElement),H=z(b,U.popupSide),Y=z(b,U.id),F=z(b,U.labelId),E=z(b,U.hasSelectedValue),W=_&&k?H:null,A=s??Y,v=Js(y,F);Cr({id:A});const N=Ye(k),me=l.useRef(null),{getButtonProps:q,buttonRef:ye}=Zn({disabled:T,native:c}),he=ue(se=>{b.set("triggerElement",se)}),O=vt(),j=vt(),le=vt();l.useEffect(()=>{if(L)return le.start(Zs,()=>{R.current.allowUnselectedMouseUp=!0,R.current.allowSelectedMouseUp=!0}),()=>{le.clear()};R.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},j.clear()},[L,R,j,le]);const Ce=sn(B,{id:A,role:"combobox","aria-expanded":L?"true":"false","aria-haspopup":"listbox","aria-controls":L?I?.id??Gn(k)?.id:void 0,"aria-labelledby":v,"aria-readonly":w||void 0,"aria-required":S||void 0,tabIndex:T?-1:0,onFocus(se){u(!0),L&&C.current&&h(!1,_e(mn,se.nativeEvent)),O.start(0,()=>{b.set("forceMount",!0)})},onBlur(se){at(k,se.relatedTarget)||(g(!0),u(!1),d==="onBlur"&&x.commit(X))},onMouseDown(se){if(L)return;const Se=ot(se.currentTarget);function fe(de){if(!me.current)return;const xe=de.target;if(at(me.current,xe)||at(N.current,xe))return;const te=Qs(me.current);de.clientX>=te.left-Dt&&de.clientX<=te.right+Dt&&de.clientY>=te.top-Dt&&de.clientY<=te.bottom+Dt||h(!1,_e(Zr,de))}j.start(0,()=>{Se.addEventListener("mouseup",fe,{once:!0})})}},f,q),Q=x.getValidationProps(T,Ce);Q.role="combobox";const ne={...p,open:L,disabled:T,value:X,readOnly:w,popupSide:W,placeholder:!E};return gt("button",t,{ref:[n,me,ye,he],state:ne,stateAttributesMapping:ei,props:Q})}),ti={value:()=>null},Ii=l.forwardRef(function(t,n){const{className:r,render:o,children:s,placeholder:i,style:c,...a}=t,{store:f,valueRef:g}=mt(),u=z(f,U.value),d=z(f,U.items),p=z(f,U.itemToStringLabel),m=z(f,U.hasSelectedValue),y=!m&&i!=null&&s==null,b=z(f,U.hasNullItemLabel,y),h={value:u,placeholder:!m};let R=null;return typeof s=="function"?R=s(u):s!=null?R=s:!m&&i!=null&&!b?R=i:Array.isArray(u)?R=Ys(u,d,p):R=Ir(u,d,p),gt("span",t,{state:h,ref:[n,g],props:[{children:R},a],stateAttributesMapping:ti})}),ni=l.createContext(void 0),Mi=l.forwardRef(function(t,n){const{store:r}=mt(),o=z(r,U.mounted),s=z(r,U.forceMount);return o||s?Ie.jsx(ni.Provider,{value:!0,children:Ie.jsx(eo,{ref:n,...t})}):null}),Or=l.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function ri(){return l.useContext(Or)}function oi(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:o}=e,s=ue(o),i=l.useRef(0),c=Tt(ii).current,a=Tt(si).current,[f,g]=l.useState(0),u=l.useRef(f),d=ue((h,R)=>{a.set(h,R??null),u.current+=1,g(u.current)}),p=ue(h=>{a.delete(h),u.current+=1,g(u.current)}),m=l.useMemo(()=>{const h=new Map;return Array.from(a.keys()).filter(x=>x.isConnected).sort(ci).forEach((x,w)=>{const S=a.get(x)??{};h.set(x,{...S,index:w})}),h},[a,f]);J(()=>{if(typeof MutationObserver!="function"||m.size===0)return;const h=new MutationObserver(R=>{const x=new Set,w=S=>x.has(S)?x.delete(S):x.add(S);R.forEach(S=>{S.removedNodes.forEach(w),S.addedNodes.forEach(w)}),x.size===0&&(u.current+=1,g(u.current))});return m.forEach((R,x)=>{x.parentElement&&h.observe(x.parentElement,{childList:!0})}),()=>{h.disconnect()}},[m]),J(()=>{u.current===f&&(n.current.length!==m.size&&(n.current.length=m.size),r&&r.current.length!==m.size&&(r.current.length=m.size),i.current=m.size),s(m)},[s,m,n,r,f]),J(()=>()=>{n.current=[]},[n]),J(()=>()=>{r&&(r.current=[])},[r]);const y=ue(h=>(c.add(h),()=>{c.delete(h)}));J(()=>{c.forEach(h=>h(m))},[c,m]);const b=l.useMemo(()=>({register:d,unregister:p,subscribeMapChange:y,elementsRef:n,labelsRef:r,nextIndexRef:i}),[d,p,y,n,r,i]);return Ie.jsx(Or.Provider,{value:b,children:t})}function si(){return new Map}function ii(){return new Set}function ci(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const Pr=l.createContext(void 0);function li(){const e=l.useContext(Pr);if(!e)throw new Error(It(59));return e}function $t(e,t){e&&Object.assign(e.style,t)}const ai={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},ui=20;function fi(e,t,n,r){const[o,s]=l.useState(!1);J(()=>{if(!e||!t||n==null){s(!1);return}const i=ot(n).documentElement.clientWidth,c=n.offsetWidth;s(i>0&&c>0&&c>=i-ui)},[e,t,n]),ho(e&&(!t||o),r)}const di={position:"fixed"},Oi=l.forwardRef(function(t,n){const{anchor:r,positionMethod:o="absolute",className:s,render:i,side:c="bottom",align:a="center",sideOffset:f=0,alignOffset:g=0,collisionBoundary:u="clipping-ancestors",collisionPadding:d,arrowPadding:p=5,sticky:m=!1,disableAnchorTracking:y,alignItemWithTrigger:b=!0,collisionAvoidance:h=to,style:R,...x}=t,{store:w,listRef:S,labelsRef:C,alignItemWithTriggerActiveRef:P,selectedItemTextRef:T,valuesRef:L,initialValueRef:_,popupRef:X,setValue:B}=mt(),k=vr(),I=z(w,U.open),H=z(w,U.mounted),Y=z(w,U.modal),F=z(w,U.value),E=z(w,U.openMethod),W=z(w,U.positionerElement),A=z(w,U.triggerElement),v=z(w,U.isItemEqualToValue),N=z(w,U.transitionStatus),me=l.useRef(null),q=l.useRef(null),[ye,he]=l.useState(b),O=H&&ye&&E!=="touch";!H&&ye!==b&&he(b),J(()=>{H||(U.scrollUpArrowVisible(w.state)&&w.set("scrollUpArrowVisible",!1),U.scrollDownArrowVisible(w.state)&&w.set("scrollDownArrowVisible",!1))},[w,H]),l.useImperativeHandle(P,()=>O),fi((O||Y)&&I,E==="touch",W,A);const j=Is({anchor:r,floatingRootContext:k,positionMethod:o,mounted:H,side:c,sideOffset:f,align:a,alignOffset:g,arrowPadding:p,collisionBoundary:u,collisionPadding:d,sticky:m,disableAnchorTracking:y??O,collisionAvoidance:h,keepMounted:!0}),le=O?"none":j.side,Ce=O?di:j.positionerStyles,Q={open:I,side:le,align:j.align,anchorHidden:j.anchorHidden};J(()=>{w.set("popupSide",j.side)},[w,j.side]);const ne=ue(xe=>{w.set("positionerElement",xe)}),se=Ms(t,Q,{styles:Ce,transitionStatus:N,props:x,refs:[n,ne],hidden:!H,inert:!I}),Se=l.useRef(0),fe=ue(xe=>{if(xe.size===0&&Se.current===0||L.current.length===0)return;const te=Se.current;if(Se.current=xe.size,xe.size===te)return;const we=_e(mn);if(te!==0&&!w.state.multiple&&F!==null&&Et(L.current,F,v)===-1){const ie=_.current,$=ie!=null&&Et(L.current,ie,v)!==-1?ie:null;B($,we),$===null&&(w.set("selectedIndex",null),T.current=null)}if(te!==0&&w.state.multiple&&Array.isArray(F)){const ce=re=>Et(L.current,re,v)!==-1,ie=F.filter(re=>ce(re));(ie.length!==F.length||ie.some(re=>!$s(F,re,v)))&&(B(ie,we),ie.length===0&&(w.set("selectedIndex",null),T.current=null))}if(I&&O){w.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const ce={height:""};$t(W,ce),$t(X.current,ce)}}),de=l.useMemo(()=>({...j,side:le,alignItemWithTriggerActive:O,setControlledAlignItemWithTrigger:he,scrollUpArrowRef:me,scrollDownArrowRef:q}),[j,le,O,he]);return Ie.jsx(oi,{elementsRef:S,labelsRef:C,onMapChange:fe,children:Ie.jsxs(Pr.Provider,{value:de,children:[H&&Y&&Ie.jsx(xo,{inert:no(!I),cutout:A}),se]})})}),Lt="base-ui-disable-scrollbar",$n={className:Lt,getElement(e){return Ie.jsx("style",{nonce:e,href:Lt,precedence:"base-ui:low",children:`.${Lt}{scrollbar-width:none}.${Lt}::-webkit-scrollbar{display:none}`})}},pi=l.createContext(void 0);function gi(e){return l.useContext(pi)}const mi=l.createContext(void 0),hi={disableStyleElements:!1};function xi(){return l.useContext(mi)??hi}const yi={...or,...er},Pi=l.forwardRef(function(t,n){const{render:r,className:o,style:s,finalFocus:i,...c}=t,{store:a,popupRef:f,onOpenChangeComplete:g,setOpen:u,valueRef:d,firstItemTextRef:p,selectedItemTextRef:m,multiple:y,handleScrollArrowVisibility:b,scrollHandlerRef:h,listRef:R,highlightItemOnHover:x}=mt(),{side:w,align:S,alignItemWithTriggerActive:C,isPositioned:P,setControlledAlignItemWithTrigger:T}=li(),L=gi()!=null,_=vr(),X=xr(),{nonce:B,disableStyleElements:k}=xi(),I=z(a,U.id),H=z(a,U.open),Y=z(a,U.openMethod),F=z(a,U.mounted),E=z(a,U.popupProps),W=z(a,U.transitionStatus),A=z(a,U.triggerElement),v=z(a,U.positionerElement),N=z(a,U.listElement),me=l.useRef(!1),q=l.useRef(!1),ye=l.useRef({}),he=Nt(),O=ue(Q=>{if(!v||!f.current||!q.current)return;if(me.current||!C){b();return}const ne=v.style.top==="0px",se=v.style.bottom==="0px";if(!ne&&!se){b();return}const Se=jn(v),fe=St(v.getBoundingClientRect().height,"y",Se),de=ot(v),xe=Be(v),te=xe.getComputedStyle(v),we=parseFloat(te.marginTop),ce=parseFloat(te.marginBottom),ie=zn(xe.getComputedStyle(f.current)),re=Math.min(de.documentElement.clientHeight-we-ce,ie),$=Q.scrollTop,M=Ft(Q);let D=0,Z=null,V=!1,G=!1;const ke=ae=>{v.style.height=`${ae}px`},We=(ae,Ue)=>{const $e=bt(ae,0,re-fe);$e>0&&ke(fe+$e),Q.scrollTop=Ue,re-(fe+$e)<=tt&&(me.current=!0),b()},Me=ne?M-$:$,Fe=Math.min(fe+Me,re);if(D=Fe,Me<=tt){We(Me,ne?M:0);return}if(re-Fe>tt)ne?G=!0:Z=0;else if(V=!0,se&&$<M){const ae=fe+Me-re;Z=$-(Me-ae)}if(D=Math.ceil(D),D!==0&&ke(D),G||Z!=null){const ae=Ft(Q),Ue=G?ae:bt(Z,0,ae);Math.abs(Q.scrollTop-Ue)>tt&&(Q.scrollTop=Ue)}(V||D>=re-tt)&&(me.current=!0),b()});l.useImperativeHandle(h,()=>O,[O]),gn({open:H,ref:f,onComplete(){H&&g?.(!0)}});const j={open:H,transitionStatus:W,side:w,align:S};J(()=>{!v||!f.current||Object.keys(ye.current).length||(ye.current={top:v.style.top||"0",left:v.style.left||"0",right:v.style.right,height:v.style.height,bottom:v.style.bottom,minHeight:v.style.minHeight,maxHeight:v.style.maxHeight,marginTop:v.style.marginTop,marginBottom:v.style.marginBottom})},[f,v]),J(()=>{H||C||(q.current=!1,me.current=!1,$t(v,ye.current))},[H,C,v,f]),J(()=>{const Q=f.current;if(!H||!A||!v||!Q||C&&!P||a.state.transitionStatus==="ending")return;if(!C){q.current=!0,he.request(b),Q.style.removeProperty("--transform-origin");return}const ne=wi(Q);Q.style.removeProperty("--transform-origin");try{let se=m.current;se?.isConnected||(se=!U.hasSelectedValue(a.state)&&p.current?.isConnected?p.current:null);const Se=d.current,fe=Be(v),de=fe.getComputedStyle(v),xe=fe.getComputedStyle(Q),te=ot(A),we=jn(A),ce=Vt(A.getBoundingClientRect(),we),ie=Vt(v.getBoundingClientRect(),we),re=ce.height,$=N||Q,M=$.scrollHeight,D=parseFloat(xe.borderBottomWidth),Z=parseFloat(de.marginTop)||10,V=parseFloat(de.marginBottom)||10,G=parseFloat(de.minHeight)||100,ke=zn(xe),We=5,Me=5,Fe=20,ae=te.documentElement.clientHeight-Z-V,Ue=te.documentElement.clientWidth,$e=ae-ce.bottom+re;let He,Je=X==="rtl"?ce.right-ie.width:ce.left,Qe=0;if(se&&Se){const Pe=Vt(Se.getBoundingClientRect(),we);He=Vt(se.getBoundingClientRect(),we),Je=ie.left+(X==="rtl"?Pe.right-He.right:Pe.left-He.left);const Ke=Pe.top-ce.top+Pe.height/2;Qe=He.top-ie.top+He.height/2-Ke}const ee=$e+Qe+V+D;let pe=Math.min(ae,ee);const ve=ae-Z-V,Re=ee-pe,Te=Ue-Me;v.style.left=`${bt(Je,We,Te-ie.width)}px`,v.style.height=`${pe}px`,v.style.maxHeight="none",v.style.marginTop=`${Z}px`,v.style.marginBottom=`${V}px`,Q.style.height="100%";const be=Ft($),Oe=Re>=be-tt;Oe&&(pe=Math.min(ae,ie.height)-(Re-be));const ze=ce.top<Fe||ce.bottom>ae-Fe||Math.ceil(pe)+tt<Math.min(M,G),qe=(fe.visualViewport?.scale??1)!==1&&ro;if(ze||qe){q.current=!0,$t(v,ye.current),T(!1);return}const ct=Math.max(G,pe);if(Oe){const Pe=Math.max(0,ae-ee);v.style.top=ie.height>=ve?"0":`${Pe}px`,v.style.height=`${pe}px`,$.scrollTop=Ft($)}else v.style.bottom="0",$.scrollTop=Re;if(He){const Pe=ie.top,Ke=ie.height,ht=He.top+He.height/2,lt=Ke>0?(ht-Pe)/Ke*100:50,xt=bt(lt,0,100);Q.style.setProperty("--transform-origin",`50% ${xt}%`)}(ct===ae||pe>=ke)&&(me.current=!0),b(),x&&a.state.selectedIndex===null&&a.state.activeIndex===null&&R.current[0]!=null&&a.set("activeIndex",0),q.current=!0}finally{ne()}},[a,H,v,A,d,p,m,f,b,C,T,he,N,R,x,X,P]),l.useEffect(()=>{if(!C||!v||!H)return;const Q=Be(v);function ne(se){u(!1,_e(so,se))}return oo(Q,"resize",ne)},[u,C,v,H]);const le={...N?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":y||void 0,id:`${I}-list`},onKeyDown(Q){L&&wo.has(Q.key)&&Q.stopPropagation()},onScroll(Q){N||O(Q.currentTarget)},...C&&{style:N?{height:"100%"}:ai}},Ce=gt("div",t,{ref:[n,f],state:j,stateAttributesMapping:yi,props:[E,le,wr(W),{className:!N&&C?$n.className:void 0},c]});return Ie.jsxs(l.Fragment,{children:[!k&&$n.getElement(B),Ie.jsx(yo,{context:_,modal:!1,disabled:!F,openInteractionType:Y,returnFocus:i,restoreFocus:!0,children:Ce})]})});function zn(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}function Ft(e){return Mr(e.scrollHeight,e.clientHeight)}function jn(e){return pr.getScale(e)}function St(e,t,n){return e/n[t]}function Vt(e,t){return At({x:St(e.x,"x",t),y:St(e.y,"y",t),width:St(e.width,"x",t),height:St(e.height,"y",t)})}const Yn=[["transform","none"],["scale","1"],["translate","0 0"]];function wi(e){const{style:t}=e,n={};for(const[r,o]of Yn)n[r]=t.getPropertyValue(r),t.setProperty(r,o,"important");return()=>{for(const[r]of Yn){const o=n[r];o?t.setProperty(r,o):t.removeProperty(r)}}}let Dr=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function bi(e={}){const{label:t,metadata:n,textRef:r,indexGuessBehavior:o,index:s}=e,{register:i,unregister:c,subscribeMapChange:a,elementsRef:f,labelsRef:g,nextIndexRef:u}=ri(),d=l.useRef(-1),[p,m]=l.useState(s??(o===Dr.GuessFromOrder?()=>{if(d.current===-1){const h=u.current;u.current+=1,d.current=h}return d.current}:-1)),y=l.useRef(null),b=l.useCallback(h=>{if(y.current=h,p!==-1&&h!==null&&(f.current[p]=h,g)){const R=t!==void 0;g.current[p]=R?t:r?.current?.textContent??h.textContent}},[p,f,g,t,r]);return J(()=>{if(s!=null)return;const h=y.current;if(h)return i(h,n),()=>{c(h)}},[s,i,c,n]),J(()=>{if(s==null)return a(h=>{const R=y.current?h.get(y.current)?.index:null;R!=null&&m(R)})},[s,a,m]),{ref:b,index:p}}const Lr=l.createContext(void 0);function Rn(){const e=l.useContext(Lr);if(!e)throw new Error(It(57));return e}const Di=l.memo(l.forwardRef(function(t,n){const{render:r,className:o,style:s,value:i=null,label:c,disabled:a=!1,nativeButton:f=!1,...g}=t,u=l.useRef(null),d=bi({label:c,textRef:u,indexGuessBehavior:Dr.GuessFromOrder}),{store:p,itemProps:m,setOpen:y,setValue:b,selectionRef:h,typingRef:R,valuesRef:x,multiple:w,selectedItemTextRef:S,disabled:C,readOnly:P}=mt(),T=z(p,U.isActive,d.index),L=z(p,U.open),_=z(p,U.isSelected,i),X=z(p,U.isSelectedByFocus,d.index),B=z(p,U.isItemEqualToValue),k=d.index,I=k!==-1,H=l.useRef(null);J(()=>{if(!I)return;const O=x.current;return O[k]=i,()=>{delete O[k]}},[I,k,i,x]),J(()=>{if(!I)return;const O=p.state.value;let j=O;w&&Array.isArray(O)&&(j=O.length>0?O[O.length-1]:void 0),j!==void 0&&pt(i,j,B)&&(p.set("selectedIndex",k),u.current&&(S.current=u.current))},[I,k,w,B,p,i,S]);const Y=l.useRef(null),F=l.useRef("mouse"),E=l.useRef(!1),{getButtonProps:W,buttonRef:A}=Zn({disabled:a,focusableWhenDisabled:!0,native:f,composite:!0}),v={disabled:a,selected:_,highlighted:T};function N(O){if(C||P)return;const j=p.state.value;if(w){const le=Array.isArray(j)?j:[],Ce=_?zs(le,i,B):[...le,i];b(Ce,_e(Zt,O))}else b(i,_e(Zt,O)),y(!1,_e(Zt,O))}function me(){h.current.dragY=0}const q={role:"option","aria-selected":_,tabIndex:L&&T?0:-1,onKeyDown(O){Y.current=O.key,p.set("activeIndex",k),O.key===" "&&R.current&&O.preventDefault()},onClick(O){const j=O.type==="click"&&F.current!=="touch",le=O.nativeEvent.pointerType,Ce=j&&rr(O.nativeEvent)&&(le!==void 0||T),Q=j&&!Ce&&!E.current;E.current=!1,!(O.type==="keydown"&&Y.current===null)&&(a||O.type==="keydown"&&Y.current===" "&&R.current||Q||(Y.current=null,N(O.nativeEvent)))},onPointerEnter(O){F.current=O.pointerType},onPointerMove(O){if(O.pointerType==="mouse"&&O.buttons===1){const j=h.current;j.dragY+=O.movementY,j.dragY**2>=64&&(j.allowUnselectedMouseUp=!0)}},onPointerDown(O){F.current=O.pointerType,E.current=!0,me()},onMouseUp(){if(me(),a||F.current==="touch"||E.current)return;const O=!h.current.allowSelectedMouseUp&&_,j=!h.current.allowUnselectedMouseUp&&!_;O||j||(E.current=!0,H.current?.click(),E.current=!1)}},ye=gt("div",t,{ref:[A,n,d.ref,H],state:v,props:[m,q,g,W]}),he=l.useMemo(()=>({selected:_,index:k,textRef:u,selectedByFocus:X,hasRegistered:I}),[_,k,u,X,I]);return Ie.jsx(Lr.Provider,{value:he,children:ye})})),Li=l.forwardRef(function(t,n){const r=t.keepMounted??!1,{selected:o}=Rn();return r||o?Ie.jsx(Ri,{...t,ref:n}):null}),Ri=l.memo(l.forwardRef((e,t)=>{const{render:n,className:r,style:o,keepMounted:s,...i}=e,{selected:c}=Rn(),a=l.useRef(null),{transitionStatus:f,setMounted:g}=sr(c),d=gt("span",e,{ref:[t,a],state:{selected:c,transitionStatus:f},props:[{"aria-hidden":!0,children:"✔️"},i],stateAttributesMapping:er});return gn({open:c,ref:a,onComplete(){c||g(!1)}}),d})),Fi=l.memo(l.forwardRef(function(t,n){const{index:r,textRef:o,selectedByFocus:s,hasRegistered:i}=Rn(),{firstItemTextRef:c,selectedItemTextRef:a}=mt(),{render:f,className:g,style:u,...d}=t,p=l.useCallback(y=>{y&&(i&&r===0&&(c.current=y),i&&s&&(a.current=y))},[c,a,r,s,i]);return gt("div",t,{ref:[p,n,o],props:d})}));export{$n as A,Ei as C,ai as L,Ti as S,Ks as a,bn as b,Er as c,Wn as d,Bs as e,Hs as f,br as g,Ai as h,Ii as i,Mi as j,Oi as k,Pi as l,Di as m,Fi as n,Li as o,Oo as p,Ps as q,Is as r,U as s,fi as t,mt as u,Ms as v,Ci as w,gi as x,wr as y,li as z};
@@ -1 +1 @@
1
- import{c as y,r as l,ao as X,ai as q,aL as L,j as n,m as O,U as ee,V as v,G as s,Y as te,av as ne,aM as ae,az as ie,aA as se,aB as P,aN as oe,aO as re,W as le,R as ce,S as ue,T as de,a2 as ge,aP as he,aQ as pe,aR as me,aS as be,K as fe,aT as xe,aU as ye,aV as ve,aW as je,aX as ke,aY as Ne,aZ as Se,ag as we}from"./main-4M5oNV2-.js";import{b as G,l as A,u as Ce,L as E}from"./use-limits-display-prefs--1a77fnk.js";import{S as j,T as k,a as b,b as _,u as T}from"./use-native-settings-PZ_s8TF_.js";import{C as Le}from"./useScrollLock-BXcNDJbM.js";import{u as Ge}from"./useCurrency-CzRjastg.js";import{S as D}from"./Select-DbBT6mPJ.js";import{I as Ae}from"./info-DF9b_Lut.js";import{D as Ee}from"./download-CK8DaHH6.js";import"./Card-KutJI7Kb.js";import"./SelectItemText-XGWezP4M.js";const Ie=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Oe=y("activity",Ie);const Pe=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],_e=y("copy",Pe);const Te=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],De=y("grip-vertical",Te);const Me=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],Ue=y("languages",Me);const Re=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Fe=y("log-out",Re);const He=[["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"}]],$e=y("pencil",He),Be=e=>!e.isLayoutDirty&&e.willUpdate(!1);function I(){const e=new Set,t=new WeakMap,a=()=>e.forEach(Be);return{add:i=>{e.add(i),t.set(i,i.addEventListener("willUpdate",a))},remove:i=>{e.delete(i);const o=t.get(i);o&&(o(),t.delete(i)),a()},dirty:a}}const ze=l.createContext(null);function Ve(){const e=l.useRef(!1);return X(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function We(){const e=Ve(),[t,a]=l.useState(0),i=l.useCallback(()=>{e.current&&a(t+1)},[t]);return[l.useCallback(()=>q.postRender(i),[i]),t]}const M=e=>e===!0,Ze=e=>M(e===!0)||e==="id",Ke=({children:e,id:t,inherit:a=!0})=>{const i=l.useContext(L),o=l.useContext(ze),[r,c]=We(),u=l.useRef(null),g=i.id||o;u.current===null&&(Ze(a)&&g&&(t=t?g+"-"+t:g),u.current={id:t,group:M(a)&&i.group||I()});const h=l.useMemo(()=>({...u.current,forceRender:r}),[c]);return n.jsx(L.Provider,{value:h,children:e})},Ye="shrink-0 text-oai-gray-900 dark:text-oai-gray-200";function Je({checked:e,onChange:t,ariaLabel:a}){return n.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":a,onClick:t,className:v("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",e?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:n.jsx("span",{className:v("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})}function Qe({prefs:e}){const{order:t,visibility:a,toggle:i,moveToward:o}=e,[r,c]=l.useState(null),[u,g]=l.useState(null),h=d=>p=>{c(d),p.dataTransfer.effectAllowed="move",p.dataTransfer.setData("text/plain",d)},m=d=>p=>{p.preventDefault(),p.dataTransfer.dropEffect="move",r&&r!==d&&u!==d&&(g(d),o(r,d))},f=()=>{c(null),g(null)},x=d=>{d.preventDefault(),c(null),g(null)};return n.jsx(Ke,{children:n.jsx("div",{className:"flex flex-col",children:t.map(d=>{const p=a[d]!==!1,N=r===d;return n.jsxs(O.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:h(d),onDragOver:m(d),onDragEnd:f,onDrop:x,className:v("flex items-center gap-3 py-2 rounded-md","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60",N&&"opacity-40"),style:{cursor:N?"grabbing":"grab"},children:[n.jsx(De,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),G(d)?n.jsx(ee,{provider:G(d),size:18,className:v("pointer-events-none",Ye)}):null,n.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:A(d)}),n.jsx("div",{onMouseDown:S=>S.stopPropagation(),draggable:!1,children:n.jsx(Je,{checked:p,onChange:()=>i(d),ariaLabel:`${s("limits.settings.toggle_visible")}: ${A(d)}`})})]},d)})})})}function Xe(e){if(!e||typeof e!="object")return"";const t=e.user_metadata&&typeof e.user_metadata=="object"?e.user_metadata:{},a=e.profile&&typeof e.profile=="object"?e.profile:{},i=t.full_name||t.name||a.name||t.user_name||t.preferred_username;return typeof i=="string"&&i.trim()?i.trim():typeof e.email=="string"&&e.email.includes("@")?e.email.split("@")[0].trim()||e.email.trim():typeof e.email=="string"?e.email.trim():""}function qe(e){return!e||typeof e!="object"?"":typeof e.email=="string"?e.email.trim():""}function et(e){const t=typeof e=="string"?e.trim():"";if(!t)return null;const a=t.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),i=t.match(/^https:\/\/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/?$/i),o=a?.[1]||i?.[1];return o?`https://github.com/${o}`:null}function w(e,t){console.warn(`[tokentracker] settings ${e}:`,t)}function tt(e,t,a){const[i,o]=l.useState(()=>ne()),r=t&&a&&ae(),c=l.useCallback(async()=>{const u=!i;if(ie(u),o(u),!!u)try{await se(()=>e())}catch(g){w("cloud sync",g)}},[i,e]);return{cloudSyncOn:i,handleCloudSyncToggle:c,showLocalCloudSync:r}}function nt(e){const[t,a]=l.useState(!1),[i,o]=l.useState(!1),[r,c]=l.useState(!1),[u,g]=l.useState(!1),[h,m]=l.useState(null),[f,x]=l.useState(!1),[d,p]=l.useState(""),[N,S]=l.useState(!1),[H,C]=l.useState(""),[$,B]=l.useState(""),[z,V]=l.useState(!1),[W,Z]=l.useState(null),K=l.useMemo(()=>Xe(e),[e]),Y=l.useMemo(()=>qe(e),[e]),J=l.useMemo(()=>typeof e?.id=="string"?e.id.trim():"",[e]),Q=l.useMemo(()=>({setAnonymousOn:o,setCustomDisplayName:m,setGithubUrl:C,setProfileLoading:c,setPublicProfileOn:a,setShowGithubOn:S}),[]);return{anonymousOn:i,customDisplayName:h,displayName:K,editingGithub:z,editingName:f,email:Y,githubError:W,githubInput:$,githubUrl:H,loadSetters:Q,nameInput:d,profileLoading:r,profileSaving:u,publicProfileOn:t,setAnonymousOn:o,setCustomDisplayName:m,setEditingGithub:V,setEditingName:x,setGithubError:Z,setGithubInput:B,setGithubUrl:C,setNameInput:p,setProfileLoading:c,setProfileSaving:g,setPublicProfileOn:a,setShowGithubOn:S,showGithubOn:N,userId:J}}function at(e,t,a){l.useEffect(()=>{if(!t)return;let i=!0;return a.setProfileLoading(!0),(async()=>{try{const o=await P({getAccessToken:e});if(!i||!o)return;const r=await oe({accessToken:o});if(!i)return;a.setPublicProfileOn(!!r?.enabled),a.setAnonymousOn(!!r?.anonymous),r?.display_name&&a.setCustomDisplayName(r.display_name),a.setShowGithubOn(!!r?.show_github_url),a.setGithubUrl(r?.github_url||"")}catch(o){w("load public profile",o)}finally{i&&a.setProfileLoading(!1)}})(),()=>{i=!1}},[e,t,a])}function it(e,t){return l.useCallback(async(a,{label:i,onError:o,onSuccess:r}={})=>{if(t.profileSaving)return!1;t.setProfileSaving(!0);try{const c=await P({getAccessToken:e});if(!c)return!1;const u=await re({accessToken:c,...a});return r?.(u),!0}catch(c){return o?o(c):w(i||"mutate profile",c),!1}finally{t.setProfileSaving(!1)}},[e,t])}function st(e,t){return{anonymousOn:e.anonymousOn,customDisplayName:e.customDisplayName,displayName:e.displayName,editingName:e.editingName,handleAnonymousToggle:t.handleAnonymousToggle,handleSaveName:t.handleSaveName,nameInput:e.nameInput,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingName:e.setEditingName,setNameInput:e.setNameInput,startEditingName:t.startEditingName}}function ot(e,t){return{editingGithub:e.editingGithub,githubError:e.githubError,githubInput:e.githubInput,githubUrl:e.githubUrl,handleSaveGithub:t.handleSaveGithub,handleShowGithubToggle:t.handleShowGithubToggle,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingGithub:e.setEditingGithub,setGithubError:e.setGithubError,setGithubInput:e.setGithubInput,showGithubOn:e.showGithubOn,startEditingGithub:t.startEditingGithub}}function rt(e,t){const a=l.useCallback(async()=>{const o=!e.publicProfileOn;await t({enabled:o},{label:"toggle public profile",onSuccess:()=>e.setPublicProfileOn(o)})},[t,e]);return{handleAnonymousToggle:l.useCallback(async()=>{const o=!e.anonymousOn;await t({anonymous:o},{label:"toggle anonymous",onSuccess:()=>e.setAnonymousOn(o)})},[t,e]),handlePublicProfileToggle:a}}function lt(e,t,a){const i=l.useCallback(async()=>{const r=e.nameInput.trim().slice(0,50);r&&await t({display_name:r},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(r),e.setEditingName(!1),a?.()}})},[t,e,a]),o=l.useCallback(()=>{e.setNameInput(e.customDisplayName||e.displayName),e.setEditingName(!0)},[e]);return{handleSaveName:i,startEditingName:o}}function ct(e,t){const a=l.useCallback(async()=>{if(!e.showGithubOn&&!e.githubUrl){e.setEditingGithub(!0),e.setGithubInput(""),e.setGithubError(null);return}const r=!e.showGithubOn;await t({show_github_url:r},{label:"toggle GitHub profile",onSuccess:()=>e.setShowGithubOn(r)})},[t,e]),i=l.useCallback(async()=>{const r=et(e.githubInput);if(e.githubInput.trim()&&!r){e.setGithubError(s("settings.account.githubUrlInvalid"));return}e.setGithubError(null),await t({github_url:r,show_github_url:!!r},{label:"save GitHub profile",onError:c=>e.setGithubError(c?.message||s("settings.account.githubUrlInvalid")),onSuccess:c=>{e.setGithubUrl(c?.github_url||r||""),e.setShowGithubOn(!!r),e.setEditingGithub(!1)}})},[t,e]),o=l.useCallback(()=>{e.setGithubInput(e.githubUrl),e.setGithubError(null),e.setEditingGithub(!0)},[e]);return{handleSaveGithub:i,handleShowGithubToggle:a,startEditingGithub:o}}function ut(){const e=te(),t=nt(e.user),a=tt(e.getAccessToken,e.enabled,e.signedIn);at(e.getAccessToken,e.signedIn,t.loadSetters);const i=it(e.getAccessToken,t),o=rt(t,i),r=lt(t,i,e.refreshDisplayName),c=ct(t,i);return{...e,...a,email:t.email,handlePublicProfileToggle:o.handlePublicProfileToggle,userId:t.userId,name:st(t,{...o,...r}),github:ot(t,c),profileLoading:t.profileLoading,profileSaving:t.profileSaving,publicProfileOn:t.publicProfileOn}}function U({disabled:e,onCancel:t,onSave:a,saveLabel:i=s("settings.account.save")}){return n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",onClick:a,disabled:e,className:"rounded-md bg-oai-brand-500 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-oai-brand-600 disabled:opacity-50",children:i}),n.jsx("button",{type:"button",onClick:t,className:"rounded-md px-2 py-1.5 text-xs text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:s("settings.account.cancel")})]})}function dt({nameInput:e,setEditingName:t,setNameInput:a,profileSaving:i,handleSaveName:o}){return n.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[n.jsx("input",{type:"text",value:e,onChange:r=>a(r.target.value),onKeyDown:r=>{r.key==="Enter"&&o(),r.key==="Escape"&&t(!1)},maxLength:50,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:s("settings.account.displayName")}),n.jsx(U,{disabled:i||!e.trim(),onCancel:()=>t(!1),onSave:o,saveLabel:i?s("settings.account.saving"):void 0})]})}function gt({githubError:e,githubInput:t,handleSaveGithub:a,profileSaving:i,setEditingGithub:o,setGithubError:r,setGithubInput:c}){return n.jsxs("div",{className:"mt-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("input",{type:"text",value:t,onChange:u=>{c(u.target.value),e&&r(null)},onKeyDown:u=>{u.key==="Enter"&&a(),u.key==="Escape"&&(o(!1),r(null))},maxLength:100,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:s("settings.account.githubUrlPlaceholder")}),n.jsx(U,{disabled:i,onCancel:()=>{o(!1),r(null)},onSave:a,saveLabel:i?s("settings.account.saving"):void 0})]}),e?n.jsx("div",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:e}):null]})}function R({disabled:e=!1,label:t,onClick:a,title:i}){return n.jsxs("button",{type:"button",onClick:a,disabled:e,title:i,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-40 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[n.jsx($e,{className:"h-3.5 w-3.5","aria-hidden":!0}),t]})}function F({actions:e,editing:t,editor:a,hint:i,label:o}){return n.jsx("div",{className:"py-3",children:n.jsxs("div",{className:"flex items-start justify-between gap-4",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:o}),t?a:n.jsx("div",{className:"mt-0.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i})]}),t?null:e]})})}function ht({name:e}){const t=e.anonymousOn?s("settings.account.displayNameDisabledWhileAnon"):void 0;return n.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[n.jsx(R,{disabled:e.anonymousOn,label:s("settings.account.edit"),onClick:e.startEditingName,title:t}),n.jsx(k,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:s("settings.account.displayName")})]})}function pt({name:e}){const{anonymousOn:t,customDisplayName:a,displayName:i,editingName:o,handleAnonymousToggle:r,handleSaveName:c,nameInput:u,profileLoading:g,profileSaving:h,setEditingName:m,setNameInput:f,startEditingName:x}=e,d=t?s("settings.account.displayNameAnonymousHint"):a||i;return n.jsx(F,{label:s("settings.account.displayName"),editing:o,hint:d,editor:n.jsx(dt,{nameInput:u,setEditingName:m,setNameInput:f,profileSaving:h,handleSaveName:c}),actions:n.jsx(ht,{name:e})})}function mt({github:e}){const{editingGithub:t,githubError:a,githubInput:i,githubUrl:o,handleSaveGithub:r,handleShowGithubToggle:c,profileLoading:u,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:f,showGithubOn:x,startEditingGithub:d}=e;return n.jsx(F,{label:s("settings.account.githubUrl"),editing:t,hint:o||s("settings.account.githubUrlHint"),editor:n.jsx(gt,{githubError:a,githubInput:i,handleSaveGithub:r,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:f}),actions:n.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[n.jsx(R,{label:s("settings.account.edit"),onClick:d}),n.jsx(k,{checked:x,onChange:c,disabled:u||g,ariaLabel:s("settings.account.githubUrl")})]})})}function bt(){const{openLoginModal:e}=le();return n.jsx(j,{title:s("settings.section.account"),children:n.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[n.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.account.signedOutHint")}),n.jsx("button",{type:"button",onClick:e,className:"inline-flex h-8 shrink-0 items-center justify-center rounded-md bg-oai-gray-900 px-4 text-xs font-medium text-white transition-colors hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100",children:s("settings.account.signIn")})]})})}function ft({name:e,github:t}){return n.jsxs(n.Fragment,{children:[n.jsx(pt,{name:e}),n.jsx(mt,{github:t})]})}function xt(){const e=ut();return e.enabled?e.signedIn?n.jsxs(j,{title:s("settings.section.account"),subtitle:e.email||e.name.customDisplayName||e.name.displayName,action:n.jsx(vt,{onSignOut:e.signOut}),children:[n.jsx(yt,{userId:e.userId}),n.jsx(jt,{settings:e}),n.jsx(kt,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),n.jsx(Nt,{visible:e.publicProfileOn,name:e.name,github:e.github})]}):n.jsx(bt,{}):null}function yt({userId:e}){const[t,a]=ce.useState(!1);if(!e)return null;const i=async()=>{try{if(typeof navigator>"u"||!navigator.clipboard?.writeText)return;await navigator.clipboard.writeText(e),a(!0),globalThis.setTimeout(()=>a(!1),1200)}catch{a(!1)}};return n.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:s("settings.account.userId")}),n.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-oai-gray-500 dark:text-oai-gray-400",children:e})]}),n.jsxs("button",{type:"button",onClick:i,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800","aria-label":s("settings.account.copyUserId"),children:[t?n.jsx(Le,{className:"h-3.5 w-3.5","aria-hidden":!0}):n.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0}),t?s("settings.account.copied"):s("settings.account.copy")]})]})}function vt({onSignOut:e}){return n.jsxs("button",{type:"button",onClick:()=>e(),className:"inline-flex h-7 items-center gap-1.5 text-xs font-medium text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:[n.jsx(Fe,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.account.signOut")]})}function jt({settings:e}){return e.showLocalCloudSync?n.jsx(b,{label:s("settings.account.cloudSync"),hint:s("settings.account.cloudSyncHint"),control:n.jsx(k,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:s("settings.account.cloudSync")})}):null}function kt({checked:e,disabled:t,onChange:a}){return n.jsx(b,{label:s("settings.account.publicProfile"),hint:s("settings.account.publicProfileHint"),control:n.jsx(k,{checked:e,onChange:a,disabled:t,ariaLabel:s("settings.account.publicProfile")})})}function Nt({visible:e,name:t,github:a}){return n.jsx(ue,{initial:!1,children:e?n.jsx(O.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{height:{duration:.28,ease:[.22,1,.36,1]},opacity:{duration:.2,ease:[.22,1,.36,1]}},style:{overflow:"hidden"},className:"divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:n.jsx(ft,{name:t,github:a})},"public-profile-fields"):null})}function St(){return[{value:"light",label:s("settings.appearance.theme.light"),Icon:he},{value:"dark",label:s("settings.appearance.theme.dark"),Icon:pe},{value:"system",label:s("settings.appearance.theme.system"),Icon:me}]}function wt(){return[{value:xe,label:s("settings.appearance.language.system")},{value:ye,label:s("settings.appearance.language.english")},{value:ve,label:s("settings.appearance.language.chinese")},{value:je,label:s("settings.appearance.language.traditional_chinese")},{value:ke,label:s("settings.appearance.language.japanese")},{value:Ne,label:s("settings.appearance.language.korean")}]}function Ct(e){if(!e)return null;try{const t=new Date(e);return Number.isNaN(t.getTime())?null:t.toLocaleString()}catch{return null}}function Lt(e,t){const a=s(`settings.appearance.currency.rate_source.${e}`),i=Ct(t),o=i?s("settings.appearance.currency.rate_updated",{when:i}):s("settings.appearance.currency.rate_never");return`${a} · ${o}`}function Gt({locale:e,setLocale:t}){const a=wt();return n.jsx(D,{value:e,onValueChange:t,options:a,ariaLabel:s("settings.appearance.language.label"),className:"px-2.5 py-1.5 text-xs font-medium",leadingIcon:n.jsx(Ue,{className:"h-3.5 w-3.5 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})})}function At({currency:e,setCurrency:t}){const a=be().map(i=>({value:i.code,label:s(i.labelKey)}));return n.jsx(D,{value:e,onValueChange:t,options:a,ariaLabel:s("settings.appearance.currency.label"),className:"px-3 py-1.5 text-xs font-medium"})}function Et({currency:e,rate:t,rateSource:a,rateFetchedAt:i}){if(e===fe)return n.jsx(n.Fragment,{children:s("settings.appearance.currency.hint")});const o=Lt(a,i);return n.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[n.jsx("span",{children:`1 USD = ${t.toFixed(4)} ${e}`}),n.jsx("span",{role:"img","aria-label":o,title:o,className:"inline-flex h-4 w-4 cursor-help items-center justify-center text-oai-gray-400 hover:text-oai-gray-600 dark:text-oai-gray-500 dark:hover:text-oai-gray-300",children:n.jsx(Ae,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}function It(){const{theme:e,setTheme:t}=de(),{locale:a,setLocale:i}=ge(),{currency:o,rate:r,rateSource:c,rateFetchedAt:u,setCurrency:g}=Ge();return n.jsxs(j,{title:s("settings.section.appearance"),children:[n.jsx(b,{label:s("settings.appearance.theme.label"),hint:s("settings.appearance.theme.hint"),control:n.jsx(_,{options:St(),value:e,onChange:t})}),n.jsx(b,{label:s("settings.appearance.language.label"),hint:s("settings.appearance.language.hint"),control:n.jsx(Gt,{locale:a,setLocale:i})}),n.jsx(b,{label:s("settings.appearance.currency.label"),hint:n.jsx(Et,{currency:o,rate:r,rateSource:c,rateFetchedAt:u}),control:n.jsx(At,{currency:o,setCurrency:g})})]})}function Ot(){const{available:e,settings:t,setSetting:a,runAction:i}=T();if(!e)return null;const o=!!t?.launchAtLogin,r=t?.launchAtLoginSupported!==!1,c=t?.updateStatus||null,u=!!t?.updateBusy,g=!!t?.isSyncing;return n.jsxs(j,{title:s("settings.section.menubar"),children:[r?n.jsx(b,{label:s("settings.menubar.launchAtLogin"),hint:s("settings.menubar.launchAtLoginHint"),control:n.jsx(k,{checked:o,onChange:()=>a("launchAtLogin",!o),ariaLabel:s("settings.menubar.launchAtLogin")})}):null,n.jsx(b,{label:s("settings.menubar.syncNow"),hint:s("settings.menubar.syncNowHint"),control:n.jsxs("button",{type:"button",onClick:()=>i("syncNow"),disabled:g,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[n.jsx(Se,{className:v("h-3.5 w-3.5",g&&"animate-spin"),"aria-hidden":!0}),g?s("settings.menubar.syncing"):s("settings.menubar.syncNow")]})}),n.jsx(b,{label:s("settings.menubar.updates"),hint:c||void 0,control:n.jsxs("button",{type:"button",onClick:()=>i("checkForUpdates"),disabled:u,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[n.jsx(Ee,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.menubar.checkUpdates")]})})]})}function Pt(){const{available:e,settings:t,runAction:a}=T(),i=e&&t?.version;return n.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-2 text-xs text-oai-gray-500 dark:text-oai-gray-500",children:[i?n.jsxs(n.Fragment,{children:[n.jsxs("span",{children:["TokenTrackerBar v",t.version]}),n.jsx("span",{"aria-hidden":!0,children:"·"}),n.jsx("button",{type:"button",onClick:()=>a("openAbout"),className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:"GitHub"}),n.jsx("span",{"aria-hidden":!0,children:"·"})]}):null,n.jsxs("a",{href:we,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:[n.jsx(Oe,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.footer.statusPage")]})]})}function _t({prefs:e}){return n.jsx(_,{options:[{value:E.USED,label:s("limits.settings.display_mode_used")},{value:E.REMAINING,label:s("limits.settings.display_mode_remaining")}],value:e.displayMode,onChange:e.setDisplayMode})}function Vt(){const e=Ce();return n.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:n.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:n.jsxs("div",{className:"mx-auto max-w-3xl px-4 sm:px-6",children:[n.jsxs("div",{className:"mb-8",children:[n.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:s("settings.page.title")}),n.jsx("p",{className:"mt-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.page.subtitle")})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsx(It,{}),n.jsx(Ot,{}),n.jsx(xt,{}),n.jsx(j,{title:s("settings.section.limits"),action:n.jsx(_t,{prefs:e}),children:n.jsx(Qe,{prefs:e})})]}),n.jsx(Pt,{})]})})})}export{Vt as SettingsPage};
1
+ import{c as y,r as l,ao as X,ai as q,aL as L,j as n,m as O,U as ee,V as v,G as s,Y as te,av as ne,aM as ae,az as ie,aA as se,aB as P,aN as oe,aO as re,W as le,R as ce,S as ue,T as de,a2 as ge,aP as he,aQ as pe,aR as me,aS as be,K as fe,aT as xe,aU as ye,aV as ve,aW as je,aX as ke,aY as Ne,aZ as Se,ag as we}from"./main-BGYbJv-h.js";import{b as G,l as A,u as Ce,L as E}from"./use-limits-display-prefs-D9l2vQL-.js";import{S as j,T as k,a as b,b as _,u as T}from"./use-native-settings-CtMHe825.js";import{C as Le}from"./useScrollLock-CuXeF5Ev.js";import{u as Ge}from"./useCurrency-8LyGElzm.js";import{S as D}from"./Select-CkunmlOy.js";import{I as Ae}from"./info-lMniNm1U.js";import{D as Ee}from"./download-D3OfnpNz.js";import"./Card-CSvrNnBU.js";import"./SelectItemText-D7T3VeBt.js";const Ie=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Oe=y("activity",Ie);const Pe=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],_e=y("copy",Pe);const Te=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],De=y("grip-vertical",Te);const Me=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],Ue=y("languages",Me);const Re=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Fe=y("log-out",Re);const He=[["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"}]],$e=y("pencil",He),Be=e=>!e.isLayoutDirty&&e.willUpdate(!1);function I(){const e=new Set,t=new WeakMap,a=()=>e.forEach(Be);return{add:i=>{e.add(i),t.set(i,i.addEventListener("willUpdate",a))},remove:i=>{e.delete(i);const o=t.get(i);o&&(o(),t.delete(i)),a()},dirty:a}}const ze=l.createContext(null);function Ve(){const e=l.useRef(!1);return X(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function We(){const e=Ve(),[t,a]=l.useState(0),i=l.useCallback(()=>{e.current&&a(t+1)},[t]);return[l.useCallback(()=>q.postRender(i),[i]),t]}const M=e=>e===!0,Ze=e=>M(e===!0)||e==="id",Ke=({children:e,id:t,inherit:a=!0})=>{const i=l.useContext(L),o=l.useContext(ze),[r,c]=We(),u=l.useRef(null),g=i.id||o;u.current===null&&(Ze(a)&&g&&(t=t?g+"-"+t:g),u.current={id:t,group:M(a)&&i.group||I()});const h=l.useMemo(()=>({...u.current,forceRender:r}),[c]);return n.jsx(L.Provider,{value:h,children:e})},Ye="shrink-0 text-oai-gray-900 dark:text-oai-gray-200";function Je({checked:e,onChange:t,ariaLabel:a}){return n.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":a,onClick:t,className:v("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",e?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:n.jsx("span",{className:v("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})}function Qe({prefs:e}){const{order:t,visibility:a,toggle:i,moveToward:o}=e,[r,c]=l.useState(null),[u,g]=l.useState(null),h=d=>p=>{c(d),p.dataTransfer.effectAllowed="move",p.dataTransfer.setData("text/plain",d)},m=d=>p=>{p.preventDefault(),p.dataTransfer.dropEffect="move",r&&r!==d&&u!==d&&(g(d),o(r,d))},f=()=>{c(null),g(null)},x=d=>{d.preventDefault(),c(null),g(null)};return n.jsx(Ke,{children:n.jsx("div",{className:"flex flex-col",children:t.map(d=>{const p=a[d]!==!1,N=r===d;return n.jsxs(O.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:h(d),onDragOver:m(d),onDragEnd:f,onDrop:x,className:v("flex items-center gap-3 py-2 rounded-md","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60",N&&"opacity-40"),style:{cursor:N?"grabbing":"grab"},children:[n.jsx(De,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),G(d)?n.jsx(ee,{provider:G(d),size:18,className:v("pointer-events-none",Ye)}):null,n.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:A(d)}),n.jsx("div",{onMouseDown:S=>S.stopPropagation(),draggable:!1,children:n.jsx(Je,{checked:p,onChange:()=>i(d),ariaLabel:`${s("limits.settings.toggle_visible")}: ${A(d)}`})})]},d)})})})}function Xe(e){if(!e||typeof e!="object")return"";const t=e.user_metadata&&typeof e.user_metadata=="object"?e.user_metadata:{},a=e.profile&&typeof e.profile=="object"?e.profile:{},i=t.full_name||t.name||a.name||t.user_name||t.preferred_username;return typeof i=="string"&&i.trim()?i.trim():typeof e.email=="string"&&e.email.includes("@")?e.email.split("@")[0].trim()||e.email.trim():typeof e.email=="string"?e.email.trim():""}function qe(e){return!e||typeof e!="object"?"":typeof e.email=="string"?e.email.trim():""}function et(e){const t=typeof e=="string"?e.trim():"";if(!t)return null;const a=t.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),i=t.match(/^https:\/\/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/?$/i),o=a?.[1]||i?.[1];return o?`https://github.com/${o}`:null}function w(e,t){console.warn(`[tokentracker] settings ${e}:`,t)}function tt(e,t,a){const[i,o]=l.useState(()=>ne()),r=t&&a&&ae(),c=l.useCallback(async()=>{const u=!i;if(ie(u),o(u),!!u)try{await se(()=>e())}catch(g){w("cloud sync",g)}},[i,e]);return{cloudSyncOn:i,handleCloudSyncToggle:c,showLocalCloudSync:r}}function nt(e){const[t,a]=l.useState(!1),[i,o]=l.useState(!1),[r,c]=l.useState(!1),[u,g]=l.useState(!1),[h,m]=l.useState(null),[f,x]=l.useState(!1),[d,p]=l.useState(""),[N,S]=l.useState(!1),[H,C]=l.useState(""),[$,B]=l.useState(""),[z,V]=l.useState(!1),[W,Z]=l.useState(null),K=l.useMemo(()=>Xe(e),[e]),Y=l.useMemo(()=>qe(e),[e]),J=l.useMemo(()=>typeof e?.id=="string"?e.id.trim():"",[e]),Q=l.useMemo(()=>({setAnonymousOn:o,setCustomDisplayName:m,setGithubUrl:C,setProfileLoading:c,setPublicProfileOn:a,setShowGithubOn:S}),[]);return{anonymousOn:i,customDisplayName:h,displayName:K,editingGithub:z,editingName:f,email:Y,githubError:W,githubInput:$,githubUrl:H,loadSetters:Q,nameInput:d,profileLoading:r,profileSaving:u,publicProfileOn:t,setAnonymousOn:o,setCustomDisplayName:m,setEditingGithub:V,setEditingName:x,setGithubError:Z,setGithubInput:B,setGithubUrl:C,setNameInput:p,setProfileLoading:c,setProfileSaving:g,setPublicProfileOn:a,setShowGithubOn:S,showGithubOn:N,userId:J}}function at(e,t,a){l.useEffect(()=>{if(!t)return;let i=!0;return a.setProfileLoading(!0),(async()=>{try{const o=await P({getAccessToken:e});if(!i||!o)return;const r=await oe({accessToken:o});if(!i)return;a.setPublicProfileOn(!!r?.enabled),a.setAnonymousOn(!!r?.anonymous),r?.display_name&&a.setCustomDisplayName(r.display_name),a.setShowGithubOn(!!r?.show_github_url),a.setGithubUrl(r?.github_url||"")}catch(o){w("load public profile",o)}finally{i&&a.setProfileLoading(!1)}})(),()=>{i=!1}},[e,t,a])}function it(e,t){return l.useCallback(async(a,{label:i,onError:o,onSuccess:r}={})=>{if(t.profileSaving)return!1;t.setProfileSaving(!0);try{const c=await P({getAccessToken:e});if(!c)return!1;const u=await re({accessToken:c,...a});return r?.(u),!0}catch(c){return o?o(c):w(i||"mutate profile",c),!1}finally{t.setProfileSaving(!1)}},[e,t])}function st(e,t){return{anonymousOn:e.anonymousOn,customDisplayName:e.customDisplayName,displayName:e.displayName,editingName:e.editingName,handleAnonymousToggle:t.handleAnonymousToggle,handleSaveName:t.handleSaveName,nameInput:e.nameInput,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingName:e.setEditingName,setNameInput:e.setNameInput,startEditingName:t.startEditingName}}function ot(e,t){return{editingGithub:e.editingGithub,githubError:e.githubError,githubInput:e.githubInput,githubUrl:e.githubUrl,handleSaveGithub:t.handleSaveGithub,handleShowGithubToggle:t.handleShowGithubToggle,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingGithub:e.setEditingGithub,setGithubError:e.setGithubError,setGithubInput:e.setGithubInput,showGithubOn:e.showGithubOn,startEditingGithub:t.startEditingGithub}}function rt(e,t){const a=l.useCallback(async()=>{const o=!e.publicProfileOn;await t({enabled:o},{label:"toggle public profile",onSuccess:()=>e.setPublicProfileOn(o)})},[t,e]);return{handleAnonymousToggle:l.useCallback(async()=>{const o=!e.anonymousOn;await t({anonymous:o},{label:"toggle anonymous",onSuccess:()=>e.setAnonymousOn(o)})},[t,e]),handlePublicProfileToggle:a}}function lt(e,t,a){const i=l.useCallback(async()=>{const r=e.nameInput.trim().slice(0,50);r&&await t({display_name:r},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(r),e.setEditingName(!1),a?.()}})},[t,e,a]),o=l.useCallback(()=>{e.setNameInput(e.customDisplayName||e.displayName),e.setEditingName(!0)},[e]);return{handleSaveName:i,startEditingName:o}}function ct(e,t){const a=l.useCallback(async()=>{if(!e.showGithubOn&&!e.githubUrl){e.setEditingGithub(!0),e.setGithubInput(""),e.setGithubError(null);return}const r=!e.showGithubOn;await t({show_github_url:r},{label:"toggle GitHub profile",onSuccess:()=>e.setShowGithubOn(r)})},[t,e]),i=l.useCallback(async()=>{const r=et(e.githubInput);if(e.githubInput.trim()&&!r){e.setGithubError(s("settings.account.githubUrlInvalid"));return}e.setGithubError(null),await t({github_url:r,show_github_url:!!r},{label:"save GitHub profile",onError:c=>e.setGithubError(c?.message||s("settings.account.githubUrlInvalid")),onSuccess:c=>{e.setGithubUrl(c?.github_url||r||""),e.setShowGithubOn(!!r),e.setEditingGithub(!1)}})},[t,e]),o=l.useCallback(()=>{e.setGithubInput(e.githubUrl),e.setGithubError(null),e.setEditingGithub(!0)},[e]);return{handleSaveGithub:i,handleShowGithubToggle:a,startEditingGithub:o}}function ut(){const e=te(),t=nt(e.user),a=tt(e.getAccessToken,e.enabled,e.signedIn);at(e.getAccessToken,e.signedIn,t.loadSetters);const i=it(e.getAccessToken,t),o=rt(t,i),r=lt(t,i,e.refreshDisplayName),c=ct(t,i);return{...e,...a,email:t.email,handlePublicProfileToggle:o.handlePublicProfileToggle,userId:t.userId,name:st(t,{...o,...r}),github:ot(t,c),profileLoading:t.profileLoading,profileSaving:t.profileSaving,publicProfileOn:t.publicProfileOn}}function U({disabled:e,onCancel:t,onSave:a,saveLabel:i=s("settings.account.save")}){return n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",onClick:a,disabled:e,className:"rounded-md bg-oai-brand-500 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-oai-brand-600 disabled:opacity-50",children:i}),n.jsx("button",{type:"button",onClick:t,className:"rounded-md px-2 py-1.5 text-xs text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:s("settings.account.cancel")})]})}function dt({nameInput:e,setEditingName:t,setNameInput:a,profileSaving:i,handleSaveName:o}){return n.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[n.jsx("input",{type:"text",value:e,onChange:r=>a(r.target.value),onKeyDown:r=>{r.key==="Enter"&&o(),r.key==="Escape"&&t(!1)},maxLength:50,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:s("settings.account.displayName")}),n.jsx(U,{disabled:i||!e.trim(),onCancel:()=>t(!1),onSave:o,saveLabel:i?s("settings.account.saving"):void 0})]})}function gt({githubError:e,githubInput:t,handleSaveGithub:a,profileSaving:i,setEditingGithub:o,setGithubError:r,setGithubInput:c}){return n.jsxs("div",{className:"mt-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("input",{type:"text",value:t,onChange:u=>{c(u.target.value),e&&r(null)},onKeyDown:u=>{u.key==="Enter"&&a(),u.key==="Escape"&&(o(!1),r(null))},maxLength:100,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:s("settings.account.githubUrlPlaceholder")}),n.jsx(U,{disabled:i,onCancel:()=>{o(!1),r(null)},onSave:a,saveLabel:i?s("settings.account.saving"):void 0})]}),e?n.jsx("div",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:e}):null]})}function R({disabled:e=!1,label:t,onClick:a,title:i}){return n.jsxs("button",{type:"button",onClick:a,disabled:e,title:i,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-40 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[n.jsx($e,{className:"h-3.5 w-3.5","aria-hidden":!0}),t]})}function F({actions:e,editing:t,editor:a,hint:i,label:o}){return n.jsx("div",{className:"py-3",children:n.jsxs("div",{className:"flex items-start justify-between gap-4",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:o}),t?a:n.jsx("div",{className:"mt-0.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i})]}),t?null:e]})})}function ht({name:e}){const t=e.anonymousOn?s("settings.account.displayNameDisabledWhileAnon"):void 0;return n.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[n.jsx(R,{disabled:e.anonymousOn,label:s("settings.account.edit"),onClick:e.startEditingName,title:t}),n.jsx(k,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:s("settings.account.displayName")})]})}function pt({name:e}){const{anonymousOn:t,customDisplayName:a,displayName:i,editingName:o,handleAnonymousToggle:r,handleSaveName:c,nameInput:u,profileLoading:g,profileSaving:h,setEditingName:m,setNameInput:f,startEditingName:x}=e,d=t?s("settings.account.displayNameAnonymousHint"):a||i;return n.jsx(F,{label:s("settings.account.displayName"),editing:o,hint:d,editor:n.jsx(dt,{nameInput:u,setEditingName:m,setNameInput:f,profileSaving:h,handleSaveName:c}),actions:n.jsx(ht,{name:e})})}function mt({github:e}){const{editingGithub:t,githubError:a,githubInput:i,githubUrl:o,handleSaveGithub:r,handleShowGithubToggle:c,profileLoading:u,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:f,showGithubOn:x,startEditingGithub:d}=e;return n.jsx(F,{label:s("settings.account.githubUrl"),editing:t,hint:o||s("settings.account.githubUrlHint"),editor:n.jsx(gt,{githubError:a,githubInput:i,handleSaveGithub:r,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:f}),actions:n.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[n.jsx(R,{label:s("settings.account.edit"),onClick:d}),n.jsx(k,{checked:x,onChange:c,disabled:u||g,ariaLabel:s("settings.account.githubUrl")})]})})}function bt(){const{openLoginModal:e}=le();return n.jsx(j,{title:s("settings.section.account"),children:n.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[n.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.account.signedOutHint")}),n.jsx("button",{type:"button",onClick:e,className:"inline-flex h-8 shrink-0 items-center justify-center rounded-md bg-oai-gray-900 px-4 text-xs font-medium text-white transition-colors hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100",children:s("settings.account.signIn")})]})})}function ft({name:e,github:t}){return n.jsxs(n.Fragment,{children:[n.jsx(pt,{name:e}),n.jsx(mt,{github:t})]})}function xt(){const e=ut();return e.enabled?e.signedIn?n.jsxs(j,{title:s("settings.section.account"),subtitle:e.email||e.name.customDisplayName||e.name.displayName,action:n.jsx(vt,{onSignOut:e.signOut}),children:[n.jsx(yt,{userId:e.userId}),n.jsx(jt,{settings:e}),n.jsx(kt,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),n.jsx(Nt,{visible:e.publicProfileOn,name:e.name,github:e.github})]}):n.jsx(bt,{}):null}function yt({userId:e}){const[t,a]=ce.useState(!1);if(!e)return null;const i=async()=>{try{if(typeof navigator>"u"||!navigator.clipboard?.writeText)return;await navigator.clipboard.writeText(e),a(!0),globalThis.setTimeout(()=>a(!1),1200)}catch{a(!1)}};return n.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:s("settings.account.userId")}),n.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-oai-gray-500 dark:text-oai-gray-400",children:e})]}),n.jsxs("button",{type:"button",onClick:i,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800","aria-label":s("settings.account.copyUserId"),children:[t?n.jsx(Le,{className:"h-3.5 w-3.5","aria-hidden":!0}):n.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0}),t?s("settings.account.copied"):s("settings.account.copy")]})]})}function vt({onSignOut:e}){return n.jsxs("button",{type:"button",onClick:()=>e(),className:"inline-flex h-7 items-center gap-1.5 text-xs font-medium text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:[n.jsx(Fe,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.account.signOut")]})}function jt({settings:e}){return e.showLocalCloudSync?n.jsx(b,{label:s("settings.account.cloudSync"),hint:s("settings.account.cloudSyncHint"),control:n.jsx(k,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:s("settings.account.cloudSync")})}):null}function kt({checked:e,disabled:t,onChange:a}){return n.jsx(b,{label:s("settings.account.publicProfile"),hint:s("settings.account.publicProfileHint"),control:n.jsx(k,{checked:e,onChange:a,disabled:t,ariaLabel:s("settings.account.publicProfile")})})}function Nt({visible:e,name:t,github:a}){return n.jsx(ue,{initial:!1,children:e?n.jsx(O.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{height:{duration:.28,ease:[.22,1,.36,1]},opacity:{duration:.2,ease:[.22,1,.36,1]}},style:{overflow:"hidden"},className:"divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:n.jsx(ft,{name:t,github:a})},"public-profile-fields"):null})}function St(){return[{value:"light",label:s("settings.appearance.theme.light"),Icon:he},{value:"dark",label:s("settings.appearance.theme.dark"),Icon:pe},{value:"system",label:s("settings.appearance.theme.system"),Icon:me}]}function wt(){return[{value:xe,label:s("settings.appearance.language.system")},{value:ye,label:s("settings.appearance.language.english")},{value:ve,label:s("settings.appearance.language.chinese")},{value:je,label:s("settings.appearance.language.traditional_chinese")},{value:ke,label:s("settings.appearance.language.japanese")},{value:Ne,label:s("settings.appearance.language.korean")}]}function Ct(e){if(!e)return null;try{const t=new Date(e);return Number.isNaN(t.getTime())?null:t.toLocaleString()}catch{return null}}function Lt(e,t){const a=s(`settings.appearance.currency.rate_source.${e}`),i=Ct(t),o=i?s("settings.appearance.currency.rate_updated",{when:i}):s("settings.appearance.currency.rate_never");return`${a} · ${o}`}function Gt({locale:e,setLocale:t}){const a=wt();return n.jsx(D,{value:e,onValueChange:t,options:a,ariaLabel:s("settings.appearance.language.label"),className:"px-2.5 py-1.5 text-xs font-medium",leadingIcon:n.jsx(Ue,{className:"h-3.5 w-3.5 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})})}function At({currency:e,setCurrency:t}){const a=be().map(i=>({value:i.code,label:s(i.labelKey)}));return n.jsx(D,{value:e,onValueChange:t,options:a,ariaLabel:s("settings.appearance.currency.label"),className:"px-3 py-1.5 text-xs font-medium"})}function Et({currency:e,rate:t,rateSource:a,rateFetchedAt:i}){if(e===fe)return n.jsx(n.Fragment,{children:s("settings.appearance.currency.hint")});const o=Lt(a,i);return n.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[n.jsx("span",{children:`1 USD = ${t.toFixed(4)} ${e}`}),n.jsx("span",{role:"img","aria-label":o,title:o,className:"inline-flex h-4 w-4 cursor-help items-center justify-center text-oai-gray-400 hover:text-oai-gray-600 dark:text-oai-gray-500 dark:hover:text-oai-gray-300",children:n.jsx(Ae,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}function It(){const{theme:e,setTheme:t}=de(),{locale:a,setLocale:i}=ge(),{currency:o,rate:r,rateSource:c,rateFetchedAt:u,setCurrency:g}=Ge();return n.jsxs(j,{title:s("settings.section.appearance"),children:[n.jsx(b,{label:s("settings.appearance.theme.label"),hint:s("settings.appearance.theme.hint"),control:n.jsx(_,{options:St(),value:e,onChange:t})}),n.jsx(b,{label:s("settings.appearance.language.label"),hint:s("settings.appearance.language.hint"),control:n.jsx(Gt,{locale:a,setLocale:i})}),n.jsx(b,{label:s("settings.appearance.currency.label"),hint:n.jsx(Et,{currency:o,rate:r,rateSource:c,rateFetchedAt:u}),control:n.jsx(At,{currency:o,setCurrency:g})})]})}function Ot(){const{available:e,settings:t,setSetting:a,runAction:i}=T();if(!e)return null;const o=!!t?.launchAtLogin,r=t?.launchAtLoginSupported!==!1,c=t?.updateStatus||null,u=!!t?.updateBusy,g=!!t?.isSyncing;return n.jsxs(j,{title:s("settings.section.menubar"),children:[r?n.jsx(b,{label:s("settings.menubar.launchAtLogin"),hint:s("settings.menubar.launchAtLoginHint"),control:n.jsx(k,{checked:o,onChange:()=>a("launchAtLogin",!o),ariaLabel:s("settings.menubar.launchAtLogin")})}):null,n.jsx(b,{label:s("settings.menubar.syncNow"),hint:s("settings.menubar.syncNowHint"),control:n.jsxs("button",{type:"button",onClick:()=>i("syncNow"),disabled:g,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[n.jsx(Se,{className:v("h-3.5 w-3.5",g&&"animate-spin"),"aria-hidden":!0}),g?s("settings.menubar.syncing"):s("settings.menubar.syncNow")]})}),n.jsx(b,{label:s("settings.menubar.updates"),hint:c||void 0,control:n.jsxs("button",{type:"button",onClick:()=>i("checkForUpdates"),disabled:u,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[n.jsx(Ee,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.menubar.checkUpdates")]})})]})}function Pt(){const{available:e,settings:t,runAction:a}=T(),i=e&&t?.version;return n.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-2 text-xs text-oai-gray-500 dark:text-oai-gray-500",children:[i?n.jsxs(n.Fragment,{children:[n.jsxs("span",{children:["TokenTrackerBar v",t.version]}),n.jsx("span",{"aria-hidden":!0,children:"·"}),n.jsx("button",{type:"button",onClick:()=>a("openAbout"),className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:"GitHub"}),n.jsx("span",{"aria-hidden":!0,children:"·"})]}):null,n.jsxs("a",{href:we,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:[n.jsx(Oe,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.footer.statusPage")]})]})}function _t({prefs:e}){return n.jsx(_,{options:[{value:E.USED,label:s("limits.settings.display_mode_used")},{value:E.REMAINING,label:s("limits.settings.display_mode_remaining")}],value:e.displayMode,onChange:e.setDisplayMode})}function Vt(){const e=Ce();return n.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:n.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:n.jsxs("div",{className:"mx-auto max-w-3xl px-4 sm:px-6",children:[n.jsxs("div",{className:"mb-8",children:[n.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:s("settings.page.title")}),n.jsx("p",{className:"mt-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.page.subtitle")})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsx(It,{}),n.jsx(Ot,{}),n.jsx(xt,{}),n.jsx(j,{title:s("settings.section.limits"),action:n.jsx(_t,{prefs:e}),children:n.jsx(Qe,{prefs:e})})]}),n.jsx(Pt,{})]})})})}export{Vt as SettingsPage};