tokentracker-cli 0.81.3 → 0.82.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 (85) hide show
  1. package/dashboard/dist/assets/{AchievementBadge-DiSoAalB.js → AchievementBadge-D6iPEEbz.js} +1 -1
  2. package/dashboard/dist/assets/{AchievementsPage-DI_cvzqy.js → AchievementsPage-Jry355YE.js} +2 -2
  3. package/dashboard/dist/assets/{AchievementsSection-ClWZZNvc.js → AchievementsSection-ah-kG00E.js} +1 -1
  4. package/dashboard/dist/assets/{BadgeDetailModal-DpQeG_6H.js → BadgeDetailModal-FyvUrVvF.js} +1 -1
  5. package/dashboard/dist/assets/{Card-B0hyofoy.js → Card-C3nLScju.js} +1 -1
  6. package/dashboard/dist/assets/{ClawdAnimated-DZJGQ3-9.js → ClawdAnimated-CLHhE26z.js} +1 -1
  7. package/dashboard/dist/assets/{CommunityStatsModal-Dcikt0kT.js → CommunityStatsModal-DA3PHLV5.js} +1 -1
  8. package/dashboard/dist/assets/{ConfirmModal-DCfRP4oI.js → ConfirmModal-CTDarLrD.js} +1 -1
  9. package/dashboard/dist/assets/DashboardPage-DZIiWc3Y.js +1 -0
  10. package/dashboard/dist/assets/{DevicePage-De6KuFaJ.js → DevicePage-CyXjUO8W.js} +1 -1
  11. package/dashboard/dist/assets/DialogDescription-ahxSNUcB.js +1 -0
  12. package/dashboard/dist/assets/DialogTitle-z86PHHyk.js +1 -0
  13. package/dashboard/dist/assets/{FadeIn-DZoN7vbQ.js → FadeIn-BDWtfIsO.js} +1 -1
  14. package/dashboard/dist/assets/{HeaderGithubStar-C9HQnEsI.js → HeaderGithubStar-DE1USQbb.js} +1 -1
  15. package/dashboard/dist/assets/{IpCheckPage-82zniXwO.js → IpCheckPage-B2SkgT0P.js} +1 -1
  16. package/dashboard/dist/assets/{LandingPage-Df9fdR0n.js → LandingPage-PU5gxsfY.js} +14 -14
  17. package/dashboard/dist/assets/{LeaderboardAvatar-CjfEgoR8.js → LeaderboardAvatar-CaOV_hFE.js} +1 -1
  18. package/dashboard/dist/assets/{LeaderboardPage-BdbE6Nhj.js → LeaderboardPage-B0JtEyRP.js} +2 -2
  19. package/dashboard/dist/assets/{LeaderboardProfileModal-CDTK21dp.js → LeaderboardProfileModal-DtNEbVH8.js} +3 -3
  20. package/dashboard/dist/assets/{LeaderboardProfilePage-B6QWnwB1.js → LeaderboardProfilePage-DRklax3-.js} +3 -3
  21. package/dashboard/dist/assets/LimitsPage-Dg0cJa40.js +4 -0
  22. package/dashboard/dist/assets/{LocalOnlyNotice-DOcSDrOy.js → LocalOnlyNotice-si9PMKya.js} +1 -1
  23. package/dashboard/dist/assets/{LoginPage-WY_sRA7I.js → LoginPage-DgLwhXKo.js} +1 -1
  24. package/dashboard/dist/assets/{PetPage-CNbgNE6f.js → PetPage-DEZbjk99.js} +1 -1
  25. package/dashboard/dist/assets/{PopoverPopup-Cv525-dF.js → PopoverPopup-DX7v1XfE.js} +1 -1
  26. package/dashboard/dist/assets/ResetPasswordPage-C6NvRO-Q.js +1 -0
  27. package/dashboard/dist/assets/{Select-3HkgkO8y.js → Select-CH2xVU8X.js} +1 -1
  28. package/dashboard/dist/assets/{SelectItemText-Bz8FAKEv.js → SelectItemText-CCW6JeeN.js} +1 -1
  29. package/dashboard/dist/assets/SettingsPage-Cm3uT11D.js +1 -0
  30. package/dashboard/dist/assets/{SkillsPage-Dnz3eGcE.js → SkillsPage-CljRL6yF.js} +1 -1
  31. package/dashboard/dist/assets/{TrendMonitor-OopQ06B8.js → TrendMonitor-DM1_WNfw.js} +2 -2
  32. package/dashboard/dist/assets/WidgetsPage-mJ1j6hly.js +1 -0
  33. package/dashboard/dist/assets/{WrappedPage-Dbd-8EKD.js → WrappedPage-Dz71ln4t.js} +1 -1
  34. package/dashboard/dist/assets/__vite-browser-external-C7JwykID.css +1 -0
  35. package/dashboard/dist/assets/{__vite-browser-external-CxN2E6q5.js → __vite-browser-external-Eoyj4eG-.js} +47 -18
  36. package/dashboard/dist/assets/agent-logos-D3K_ZRUj.js +1 -0
  37. package/dashboard/dist/assets/{arrow-up-right-CGnVz9Km.js → arrow-up-right-CT4-gmOS.js} +1 -1
  38. package/dashboard/dist/assets/{check-CkI3WNti.js → check-B87_qvAg.js} +1 -1
  39. package/dashboard/dist/assets/{copy-Bh3g2_O-.js → copy-Dtr68epm.js} +1 -1
  40. package/dashboard/dist/assets/{download-BITw7nKX.js → download-DaWsA_Gj.js} +1 -1
  41. package/dashboard/dist/assets/{flame-ByAsnNar.js → flame-vLBOq0X0.js} +1 -1
  42. package/dashboard/dist/assets/{format-tokens-Cu8JtuN4.js → format-tokens-C6Pidz3s.js} +1 -1
  43. package/dashboard/dist/assets/{icons-D9OB0N43.js → icons-BaaYJxUN.js} +1 -1
  44. package/dashboard/dist/assets/{info-Mu2CLf-A.js → info-B46Qt16h.js} +1 -1
  45. package/dashboard/dist/assets/limits-providers-13af4PEg.js +1 -0
  46. package/dashboard/dist/assets/{link-2-CSlVaUw9.js → link-2-DeN6MJpT.js} +1 -1
  47. package/dashboard/dist/assets/{loader-circle-CYck0YaS.js → loader-circle-ByEuaaSw.js} +1 -1
  48. package/dashboard/dist/assets/{provider-display-BB925tPa.js → provider-display-CKbOKeV4.js} +1 -1
  49. package/dashboard/dist/assets/{terminal-4YysOnTe.js → terminal-DyicX7lG.js} +1 -1
  50. package/dashboard/dist/assets/{trash-2-C8-ZfrZG.js → trash-2-CVCC3DtQ.js} +1 -1
  51. package/dashboard/dist/assets/{use-community-stats-Cxt-otko.js → use-community-stats-CExk3D6G.js} +1 -1
  52. package/dashboard/dist/assets/use-limits-display-prefs-CRl4uU95.js +1 -0
  53. package/dashboard/dist/assets/{use-native-settings-DbdPXxGf.js → use-native-settings-Bi6E9dsE.js} +1 -1
  54. package/dashboard/dist/assets/{use-ordered-list-BZMM-iIj.js → use-ordered-list-Dk0p2otw.js} +1 -1
  55. package/dashboard/dist/assets/use-session-efficiency-pref-YAG-OYIh.js +1 -0
  56. package/dashboard/dist/assets/{use-transform-CuAoUb8H.js → use-transform-lflyghWN.js} +1 -1
  57. package/dashboard/dist/assets/use-usage-limits-DJXvJ25Q.js +1 -0
  58. package/dashboard/dist/assets/{useCurrency-CpDnFC0N.js → useCurrency-BtHtcsO5.js} +1 -1
  59. package/dashboard/dist/assets/{useScrollLock-Vyaif-7C.js → useScrollLock-C2C-Yazq.js} +1 -1
  60. package/dashboard/dist/assets/{useTokenFormat-B8FrUarf.js → useTokenFormat-BdD057ih.js} +1 -1
  61. package/dashboard/dist/assets/{zap-CdeKJ6HL.js → zap-DWWma29E.js} +1 -1
  62. package/dashboard/dist/index.html +2 -2
  63. package/dashboard/dist/share.html +2 -2
  64. package/package.json +1 -1
  65. package/src/cli.js +6 -0
  66. package/src/commands/sessions.js +29 -0
  67. package/src/lib/context-health.js +124 -0
  68. package/src/lib/git-outcomes.js +147 -0
  69. package/src/lib/local-api.js +45 -3
  70. package/src/lib/outcomes-engine.js +23 -0
  71. package/src/lib/pricing/seed-snapshot.json +1 -1
  72. package/src/lib/session-analytics.js +612 -0
  73. package/src/lib/usage-limits.js +21 -0
  74. package/dashboard/dist/assets/DashboardPage-DBajsWEp.js +0 -1
  75. package/dashboard/dist/assets/DialogDescription-uQ4gVIv9.js +0 -1
  76. package/dashboard/dist/assets/DialogTitle-BvElfi0r.js +0 -1
  77. package/dashboard/dist/assets/LimitsPage-f0L0d15j.js +0 -4
  78. package/dashboard/dist/assets/ResetPasswordPage-vrcj6bBP.js +0 -1
  79. package/dashboard/dist/assets/SettingsPage-CVldAt69.js +0 -1
  80. package/dashboard/dist/assets/WidgetsPage-4dWjZkc9.js +0 -1
  81. package/dashboard/dist/assets/__vite-browser-external-CQxW1DuO.css +0 -1
  82. package/dashboard/dist/assets/agent-logos-CT9fumzx.js +0 -1
  83. package/dashboard/dist/assets/use-limits-display-prefs-BUFZh6fe.js +0 -1
  84. package/dashboard/dist/assets/use-quality-per-dollar-pref-DXoW5A0_.js +0 -1
  85. package/dashboard/dist/assets/use-usage-limits-BEc3QMzR.js +0 -1
@@ -0,0 +1,4 @@
1
+ import{k as F,j as t,b as G,c as r,ah as $,r as b,P as Z,ai as ee,R as te,F as ae,L as ie,aj as re}from"./__vite-browser-external-Eoyj4eG-.js";import{P as H,c as ne,r as v,a as oe,u as se,b as le,s as de}from"./use-usage-limits-DJXvJ25Q.js";import{L as x,u as ce}from"./use-limits-display-prefs-CRl4uU95.js";import{C as B}from"./Card-C3nLScju.js";import{F as ue}from"./FadeIn-BDWtfIsO.js";import{L as xe,l as w,a as me}from"./limits-providers-13af4PEg.js";import{L as pe}from"./LocalOnlyNotice-si9PMKya.js";import"./arrow-up-right-CT4-gmOS.js";import"./download-DaWsA_Gj.js";const ge=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]],fe=F("bell-off",ge);const he=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],be=F("bell",he),ye=[3,2,3,3,2,2,3];function g({className:e}){return t.jsx("div",{className:G("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",e)})}function ke(){return t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(g,{className:"h-3 w-12 shrink-0"}),t.jsx(g,{className:"flex-1 h-1.5 rounded-full min-w-0"}),t.jsx(g,{className:"h-3 w-[30px] shrink-0"}),t.jsx(g,{className:"h-3 w-6 shrink-0"})]})}function ve({bars:e,index:a}){const i=a%3===0?"w-24":a%3===1?"w-20":"w-[4.5rem]";return t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(g,{className:"h-[14px] w-[14px] rounded shrink-0"}),t.jsx(g,{className:G("h-4",i)})]}),Array.from({length:e},(o,n)=>t.jsx(ke,{},n))]})}function je(){return t.jsx(B,{children:t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx(g,{className:"h-3.5 w-28"}),ye.map((e,a)=>t.jsx(ve,{bars:e,index:a},a))]})})}const I=100;function C(e){const a=Date.parse(e);return Number.isFinite(a)?a:null}function we(e){return Math.max(0,Math.min(I,Math.round(e)))}function Ne(e){return new Intl.DateTimeFormat($(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(e))}function _e(e,a,i){if(e==null||e>=a)return I;const o=a-e,n=a-i;return we(n/o*I)}function Me(e){const a=e.available_count;return a===null?null:Number.isInteger(a)&&a>=0?a:void 0}function Ee(e,{now:a}={}){if(!e||typeof e!="object")return null;const i=Me(e);if(i===void 0)return null;const o=Array.isArray(e.credits)?e.credits:[],n=a instanceof Date?a.getTime():Number(a??Date.now()),s=[];for(const c of o){const d=C(c?.expires_at);if(d==null)continue;const l=s.length+1;s.push({key:`reset-${l}`,label:r("limits.codex_reset_bank.row_label",{index:l}),expiresAt:Ne(d),expiresMs:d,percent:_e(C(c?.granted_at),d,n)})}return i===0?null:s.length>0?{kind:"rows",availableCount:i??s.length,rows:s}:i>0?{kind:"count_only",availableCount:i,rows:[]}:null}const Ie="shrink-0 text-oai-black dark:text-oai-white";function Le(e){const a=v(e);if(!Number.isFinite(a))return null;const i=a-Date.now();if(i<=0)return r("shared.time.now");const o=Math.floor(i/6e4);if(o<60)return`${o}m`;const n=Math.floor(o/60);return n<24?`${n}h`:`${Math.floor(n/24)}d`}function Pe(e,a){const i=a===x.REMAINING?100-e:e;return i>=90?"bg-red-500":i>=70?"bg-amber-500":"bg-emerald-500"}function k(e,a="used_percent"){return e?a==="utilization"?e.utilization:e.used_percent:null}function j(e,a="reset_at"){return e?a==="resets_at"?e.resets_at:e.reset_at:null}function N(e){const a=Math.max(0,Math.min(100,Number(e)||0)),i=Math.round(a);return a>0&&i===0?r("limits.bar.sub_one_percent"):String(i)}function _(e){const a=Number(e);return Number.isFinite(a)?new Intl.NumberFormat(void 0,{minimumFractionDigits:0,maximumFractionDigits:a>=100?0:2}).format(a):null}function Oe(e){if(!e||typeof e!="object")return null;const a=_(e.used_credits),i=_(e.limit_credits),o=_(e.remaining_credits);return!a||!i||!o?null:r("limits.codex_credits.detail",{used:a,limit:i,remaining:o})}function Se(e,a){return ne({usedPercent:k(e.window,e.pctField),windowSeconds:oe(e,e.window),resetMs:v(j(e.window,e.resetField)),mode:a})}function W(e){return Number.isFinite(e)?new Intl.DateTimeFormat($(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(e)):null}function Re(e,a,i){const o=[z(e,a,i)],n=v(j(e.window,e.resetField)),s=W(n);if(s&&o.push(r("limits.hover.resets_at",{time:s})),e.key==="credits"){const c=Oe(e.window);c&&o.push(c)}return o.join(`
2
+ `)}function U({text:e}){return e?t.jsx("div",{role:"tooltip",className:"pointer-events-none absolute bottom-full left-1/2 z-10 mb-2 w-max max-w-[260px] -translate-x-1/2 whitespace-pre-line rounded-xl border border-oai-gray-200/50 dark:border-oai-gray-800/50 bg-white/90 dark:bg-oai-gray-900/90 backdrop-blur-md px-2.5 py-1.5 text-[10.5px] leading-snug text-oai-gray-700 dark:text-oai-gray-200 shadow-xl opacity-0 transition-opacity duration-150 group-hover:opacity-100",children:e}):null}function Ce({label:e,pct:a,reset:i,mode:o=x.USED,pacePercent:n=null,paceOver:s=!1,title:c=null}){const d=Math.max(0,Math.min(100,Number(a)||0)),l=o===x.REMAINING?100-d:d,u=Math.round(l),m=l>0&&u===0?Math.max(l,.35):l;let f=String(u);l>0&&u===0&&(f=r("limits.bar.sub_one_percent"));const h=n==null?null:Math.max(0,Math.min(100,n));return t.jsxs("div",{className:"group relative flex items-center gap-2",children:[t.jsx(U,{text:c}),t.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}),t.jsxs("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:[t.jsx("div",{className:`${Pe(l,o)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${m}%`,minWidth:l>0?"3px":0}}),h!=null&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"absolute top-0 h-full bg-oai-gray-100 dark:bg-oai-gray-700/50",style:{left:`calc(${h}% - 3px)`,width:"6px"}}),t.jsx("div",{className:`absolute top-0 h-full ${s?"bg-red-500":"bg-emerald-500"}`,style:{left:`calc(${h}% - 1px)`,width:"2px"}})]})]}),t.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:[f,"%"]}),i&&t.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500 w-6 text-right shrink-0",children:i})]})}function z(e,a,i){const o=e.label??r(e.labelKey),n=i===x.REMAINING,s=l=>n?100-l:l;if(a.expectedPercent==null){const l=Math.max(0,Math.min(100,Number(k(e.window,e.pctField))||0)),u=N(s(l));return n?r("limits.explain.remaining",{label:o,used:u}):r("limits.explain.used",{label:o,used:u})}if(a.paceOver){if(a.runsOutEta)return r("limits.explain.ahead_eta",{label:o,eta:a.runsOutEta});const l=N(s(a.projectedEnd??100));return r(n?"limits.explain.ahead_pct_remaining":"limits.explain.ahead_pct",{label:o,pct:l})}const c=Math.max(0,Math.min(100,Number(k(e.window,e.pctField))||0)),d=N(s(a.projectedEnd??c));return r(n?"limits.explain.on_track_remaining":"limits.explain.on_track",{label:o,pct:d})}function De({rows:e,mode:a}){if(e.length===0)return null;const i=a===x.REMAINING;return t.jsxs("div",{className:"mt-1 flex flex-col gap-1",children:[e.map(({spec:o,pace:n})=>{const s=W(v(j(o.window,o.resetField)));return t.jsxs("div",{className:"text-[11px] leading-snug text-oai-gray-600 dark:text-oai-gray-300",children:[z(o,n,a),s?t.jsxs("span",{className:"text-oai-gray-400 dark:text-oai-gray-500",children:[" · ",r("limits.hover.resets_at",{time:s})]}):null]},o.key)}),t.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:r(i?"limits.explain.body_remaining":"limits.explain.body")})]})}function D(e){if(!e)return null;const a=Date.now()-new Date(e).getTime();if(a<0)return null;const i=Math.floor(a/6e4);if(i<1)return r("shared.time.now");if(i<60)return r("shared.time.m_ago",{n:i});const o=Math.floor(i/60);if(o<24)return r("shared.time.h_ago",{n:o});const n=Math.floor(o/24);return r("shared.time.d_ago",{n})}const A={live:{surface:"bg-oai-gray-50 dark:bg-oai-gray-800 border-oai-gray-200/60 dark:border-oai-gray-700/60 text-oai-gray-500 dark:text-oai-gray-400",dot:"bg-emerald-500",pulse:"bg-emerald-400"},stale:{surface:"bg-oai-gray-50 dark:bg-oai-gray-800 border-oai-gray-200/60 dark:border-oai-gray-700/60 text-oai-gray-500 dark:text-oai-gray-400",dot:"bg-amber-500",pulse:"bg-amber-400"},cached:{surface:"bg-oai-gray-50 dark:bg-oai-gray-800 border-oai-gray-200/60 dark:border-oai-gray-700/60 text-oai-gray-500 dark:text-oai-gray-400",dot:"bg-amber-500",pulse:"bg-amber-400"}};function M({label:e,age:a=null,tone:i="live",tooltip:o=null}){const n=A[i]||A.live,s=i==="live";return t.jsxs("div",{className:"relative inline-flex items-center group cursor-help ml-1",onClick:c=>c.stopPropagation(),children:[t.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[9px] font-semibold uppercase tracking-wider border leading-normal ${n.surface}`,children:[s?t.jsxs("span",{className:"relative flex h-1.5 w-1.5",children:[t.jsx("span",{className:`animate-ping absolute inline-flex h-full w-full rounded-full ${n.pulse} opacity-75`}),t.jsx("span",{className:`relative inline-flex rounded-full h-1.5 w-1.5 ${n.dot}`})]}):t.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${n.dot}`}),e,a?t.jsxs(t.Fragment,{children:[" · ",a]}):null]}),o?t.jsxs("span",{className:"pointer-events-none absolute left-1/2 bottom-full z-20 mb-2 -translate-x-1/2 w-48 rounded-md bg-oai-gray-900 dark:bg-oai-gray-800 px-2.5 py-1.5 text-[10px] font-normal text-white text-center opacity-0 scale-95 translate-y-1 group-hover:opacity-100 group-hover:scale-100 group-hover:translate-y-0 transition-all duration-200 cubic-bezier(0.16, 1, 0.3, 1) leading-normal shadow-lg origin-bottom border border-oai-gray-800 dark:border-oai-gray-700",children:[o,t.jsx("span",{className:"absolute left-1/2 top-full -translate-x-1/2 border-4 border-transparent border-t-oai-gray-900 dark:border-t-oai-gray-800"})]}):null]})}function L({name:e,providerId:a,children:i,expandable:o=!1,expanded:n=!1,onToggle:s,badge:c=null}){const d=me(a),l=t.jsxs("div",{className:"flex items-center gap-1.5",children:[d?t.jsx(Z,{provider:d,size:14,className:Ie}):null,t.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:e}),c]});return o?t.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":n,onClick:s,onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),s?.())},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:[l,i]}):t.jsxs("div",{className:"flex flex-col gap-1.5",children:[l,i]})}const Ae=xe;function y({children:e,tone:a="neutral"}){const i=a==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400";return t.jsx("div",{className:`text-[11px] leading-snug ${i}`,children:e})}function Te({rows:e,mode:a,extra:i=null}){const o=e.length===0&&!i;return t.jsxs(t.Fragment,{children:[e.map(({spec:n,pace:s})=>t.jsx(Ce,{label:n.label??r(n.labelKey),pct:k(n.window,n.pctField),reset:Le(j(n.window,n.resetField)),mode:a,pacePercent:s.pacePercent,paceOver:s.paceOver,title:Re(n,s,a)},n.key)),o?t.jsx(y,{children:r("limits.status.no_data")}):null,i]})}function Fe(e){if(!Number.isFinite(e.expiresMs))return null;const a=Math.floor((e.expiresMs-Date.now())/864e5);return a<0?null:a===0?r("limits.reset_bank.hover_detail_today",{date:e.expiresAt}):r("limits.reset_bank.hover_detail",{date:e.expiresAt,days:a})}function Ge({row:e}){const a=Math.max(0,Math.min(100,Number(e.percent)||0));return t.jsxs("div",{className:"group relative flex items-center gap-2","data-reset-bank-row":"",children:[t.jsx(U,{text:Fe(e)}),t.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}),t.jsx("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:t.jsx("div",{className:"bg-oai-gray-400 dark:bg-oai-gray-500 rounded-full h-full transition-[width] duration-500 ease-out",style:{width:`${a}%`,minWidth:a>0?"3px":0}})}),t.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 $e({model:e}){const a=e.kind==="count_only"?r("limits.codex_reset_bank.count_only",{count:e.availableCount}):null;return t.jsxs("div",{className:"mt-1 flex flex-col gap-1","data-reset-bank-section":e.kind,children:[t.jsx("div",{className:"text-[10.5px] font-medium uppercase tracking-wide text-oai-gray-400 dark:text-oai-gray-500",children:r("limits.codex_reset_bank.title")}),a?t.jsx("div",{className:"text-[11px] leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:a}):e.rows.map(i=>t.jsx(Ge,{row:i},i.key))]})}function He(e,a){if(e==="codex_meta"){const i=Ee(a.reset_credits);return i?t.jsx($e,{model:i}):null}return e==="kimi_parallel"&&a.parallel_limit?t.jsx(y,{children:r("limits.label.kimi_parallel",{count:a.parallel_limit})}):e==="copilot_otel"&&!a.otel_has_files&&!a.otel_enabled?t.jsx(Ue,{defaultDir:a.otel_default_dir}):null}function Be(e,a,i,o,n,s,c=null){const d=H[e];if(!d)return null;const l=d.windows(a).filter(m=>m.window).map(m=>({spec:m,pace:Se(m,o)})),u=He(d.extra,a);return t.jsxs(L,{name:i,providerId:e,expandable:l.length>0,expanded:n,onToggle:s,badge:c,children:[t.jsx(Te,{mode:o,rows:l,extra:u}),n?t.jsx(De,{rows:l,mode:o}):null]},e)}function We(e,a,i,o,n){if(!H[e])return null;if(!a?.configured)return t.jsxs(L,{name:w(e),providerId:e,children:[t.jsx(y,{children:r("limits.status.not_connected")}),e==="opencodeGo"?t.jsx(T,{}):null]},e);if(a.error)return t.jsxs(L,{name:w(e),providerId:e,children:[t.jsx(y,{tone:"error",children:r("shared.error.prefix",{error:a.error})}),e==="opencodeGo"?t.jsx(T,{}):null]},e);const s=w(e),c=a.plan_label?`${s} ${a.plan_label}`:s;let d=null;if(e==="antigravity")if(a.cached){const u=D(a.cached_at);d=t.jsx(M,{label:r("limits.label.antigravity_cached"),age:u,tone:"cached",tooltip:r("limits.tooltip.antigravity_cached")})}else d=t.jsx(M,{label:r("limits.label.antigravity_live"),tone:"live",tooltip:r("limits.tooltip.antigravity_live")});const l=a.provenance;return l?.stale&&!d&&(d=t.jsx(M,{label:r("limits.provenance.stale"),age:D(l.captured_at),tone:"stale",tooltip:r("limits.provenance.tooltip",{source:l.source,confidence:l.confidence})})),Be(e,a,c,i,o,n,d)}function Ue({defaultDir:e}){const[a,i]=b.useState(!1),n=["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(`
3
+ `),s=async c=>{c.stopPropagation();try{await navigator.clipboard.writeText(n),i(!0),setTimeout(()=>i(!1),1600)}catch{}};return t.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:[t.jsx("div",{className:"font-medium text-oai-gray-700 dark:text-oai-gray-200",children:r("limits.copilot.otelHint.title")}),t.jsx("div",{className:"mt-0.5 leading-snug",children:r("limits.copilot.otelHint.body")}),t.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:n}),t.jsx("button",{type:"button",onClick:s,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:a?r("limits.copilot.otelHint.copied"):r("limits.copilot.otelHint.copy")})]})}function E({n:e,children:a}){return t.jsxs("li",{className:"flex gap-2.5",children:[t.jsx("span",{className:"mt-[1px] flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-oai-brand/15 text-[9px] font-semibold text-oai-brand",children:e}),t.jsx("div",{className:"min-w-0 flex-1 leading-snug",children:a})]})}function ze(){return t.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":"true",className:"h-2.5 w-2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("path",{d:"M4.5 2.75h4.75V7.5M9.25 2.75 3 9"})})}function T(){const[e,a]=b.useState(!1),i=['export OPENCODE_GO_AUTH_COOKIE="..."','# Optional: export OPENCODE_GO_WORKSPACE_ID="wrk_..." (Only if auto-discovery fails)'].join(`
4
+ `),o=async n=>{n.stopPropagation();try{await navigator.clipboard.writeText(i),a(!0),setTimeout(()=>a(!1),1600)}catch{}};return t.jsxs("div",{className:"mt-1.5 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700/60 bg-oai-gray-50/50 dark:bg-oai-gray-900/20 p-3 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[t.jsx("div",{className:"text-[12px] font-semibold text-oai-gray-800 dark:text-oai-gray-100",children:r("limits.opencodeGo.setupHint.title")}),t.jsx("div",{className:"mt-0.5 leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:r("limits.opencodeGo.setupHint.subtitle")}),t.jsxs("ol",{className:"mt-2.5 space-y-2.5",children:[t.jsxs(E,{n:"1",children:[t.jsx("div",{children:r("limits.opencodeGo.setupHint.step1")}),t.jsxs("a",{href:"https://opencode.ai",target:"_blank",rel:"noreferrer",onClick:n=>n.stopPropagation(),className:"mt-1 inline-flex items-center gap-1 rounded-md bg-oai-brand/10 px-2 py-1 font-medium text-oai-brand hover:bg-oai-brand/15 transition-colors",children:[r("limits.opencodeGo.setupHint.cta"),t.jsx(ze,{})]})]}),t.jsxs(E,{n:"2",children:[t.jsx("div",{children:r("limits.opencodeGo.setupHint.step2")}),t.jsxs("ul",{className:"mt-1 space-y-0.5 text-oai-gray-500 dark:text-oai-gray-400",children:[t.jsx("li",{children:r("limits.opencodeGo.setupHint.step2_workspace")}),t.jsx("li",{children:r("limits.opencodeGo.setupHint.step2_cookie")})]})]}),t.jsxs(E,{n:"3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{children:r("limits.opencodeGo.setupHint.step3")}),t.jsx("button",{type:"button",onClick:o,className:"shrink-0 rounded-md border border-oai-gray-300 dark:border-oai-gray-700 px-2 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:e?r("limits.opencodeGo.setupHint.copied"):r("limits.opencodeGo.setupHint.copy")})]}),t.jsx("pre",{className:"mt-1.5 overflow-x-auto rounded-md bg-oai-gray-100 dark:bg-oai-gray-900/60 px-2 py-1.5 font-mono text-[10.5px] leading-relaxed whitespace-pre",children:i}),t.jsx("div",{className:"mt-1 text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:r("limits.opencodeGo.setupHint.note_app")})]})]})]})}function Ke(e){const[a,i]=b.useState(0);return b.useLayoutEffect(()=>{const o=e.current;if(!o)return;const n=o.querySelectorAll("[data-limit-label]");let s=0,c=null;if(n.length>0)try{c=document.createElement("canvas").getContext("2d")}catch{c=null}if(c){const l=window.getComputedStyle(n[0]);c.font=`${l.fontStyle} ${l.fontWeight} ${l.fontSize} ${l.fontFamily}`;for(const u of n)s=Math.max(s,c.measureText(u.textContent).width)}const d=Math.ceil(s);i(l=>l===d?l:d)}),a}function Ve({claude:e,codex:a,cursor:i,gemini:o,kimi:n,kiro:s,grok:c,antigravity:d,copilot:l,zcode:u,opencodeGo:m,order:f,visibility:h,displayMode:K}){const V={claude:e,codex:a,cursor:i,gemini:o,kimi:n,kiro:s,grok:c,antigravity:d,copilot:l,zcode:u,opencodeGo:m},P=b.useRef(null),O=Ke(P),[X,Y]=b.useState(null),q=Array.isArray(f)&&f.length>0?f:Ae,S=K===x.REMAINING?x.REMAINING:x.USED,J=S===x.REMAINING?r("limits.settings.display_mode_remaining"):r("limits.settings.display_mode_used"),R=q.filter(p=>!h||h[p]!==!1).map(p=>We(p,V[p],S,X===p,()=>Y(Q=>Q===p?null:p))).filter(Boolean);return t.jsx(ue,{delay:.15,children:t.jsx(B,{children:t.jsxs("div",{ref:P,className:"flex flex-col gap-3",style:O>0?{"--tt-limits-label-w":`${O}px`}:void 0,children:[t.jsxs("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:[r("limits.panel.title"),r("limits.panel.mode_separator"),J]}),R.length>0?R:t.jsx(y,{children:r("limits.status.all_hidden")})]})})})}const Xe=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function rt(){const e=ee(),{data:a,error:i,isLoading:o}=se(e?{initialRefresh:!0,initialState:e,publishToPreloadCache:!0}:{initialRefresh:!0,publishToPreloadCache:!0}),n=ce(),s=le();return te.useEffect(()=>{s.enabled&&a&&de(a)},[s.enabled,a]),!Xe&&!ae()?t.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:t.jsx(pe,{})}):t.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:t.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:t.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[t.jsxs("div",{className:"flex flex-row items-start justify-between gap-4 mb-8",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:r("nav.limits")}),t.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:r("limits.page.subtitle")})]}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[t.jsx("button",{type:"button",onClick:()=>{s.setEnabled(!s.enabled)},"aria-label":s.enabled?r("limits.alert.disable"):r("limits.alert.enable"),title:s.enabled?r("limits.alert.disable"):r("limits.alert.enable"),className:"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 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:s.enabled?t.jsx(be,{className:"h-4 w-4","aria-hidden":!0}):t.jsx(fe,{className:"h-4 w-4","aria-hidden":!0})}),t.jsx(ie,{to:"/settings","aria-label":r("limits.page.openSettings"),title:r("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:t.jsx(re,{className:"h-4 w-4","aria-hidden":!0})})]})]}),o?t.jsx(je,{}):t.jsxs(t.Fragment,{children:[i?t.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:r("shared.error.prefix",{error:i})}):null,t.jsx(Ve,{claude:a?.claude,codex:a?.codex,cursor:a?.cursor,gemini:a?.gemini,kimi:a?.kimi,kiro:a?.kiro,grok:a?.grok,antigravity:a?.antigravity,copilot:a?.copilot,zcode:a?.zcode,opencodeGo:a?.opencodeGo,order:n.order,visibility:n.visibility,displayMode:n.displayMode})]})]})})})}export{rt as LimitsPage};
@@ -1 +1 @@
1
- import{j as e,c as t}from"./__vite-browser-external-CxN2E6q5.js";import{A as r}from"./arrow-up-right-CGnVz9Km.js";import{D as o}from"./download-BITw7nKX.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,c as t}from"./__vite-browser-external-Eoyj4eG-.js";import{A as r}from"./arrow-up-right-CT4-gmOS.js";import{D as o}from"./download-DaWsA_Gj.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{u as p,e as w,f as v,r,c as s,j as e,L as y,h as j}from"./__vite-browser-external-CxN2E6q5.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{u as p,d as w,e as v,r,c as s,j as e,L as y,f as j}from"./__vite-browser-external-Eoyj4eG-.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 +1 @@
1
- import{l as P,Q as H,aj as O,r as n,ak as q,al as $,am as W,an as K,c as i,j as e,b,ao as Z}from"./__vite-browser-external-CxN2E6q5.js";import{u as J,T as E,S as Q}from"./use-native-settings-DbdPXxGf.js";import{n as X,C as _}from"./ClawdAnimated-DZJGQ3-9.js";import{F as L}from"./FadeIn-DZoN7vbQ.js";import{L as Y}from"./link-2-CSlVaUw9.js";import{L as G}from"./loader-circle-CYck0YaS.js";import{Z as ee}from"./zap-CdeKJ6HL.js";import{T as te}from"./trash-2-C8-ZfrZG.js";import"./Card-B0hyofoy.js";const ae=[["path",{d:"M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5",key:"4pqfef"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 12v-1",key:"1ej8lb"}],["path",{d:"M8 18v-2",key:"qcmpov"}],["path",{d:"M8 7V6",key:"1nbb54"}],["circle",{cx:"8",cy:"20",r:"2",key:"ckkr5m"}]],re=P("file-archive",ae);const ie=[["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}],["path",{d:"M12 13V7",key:"h0r20n"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]],se=P("monitor-up",ie);const oe=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],ne=P("upload",oe),le={visible:!1,character:"clawd",size:"medium"};function de(){const t=H()&&O(),[a,s]=n.useState(le);n.useEffect(()=>{if(!t)return;const d=q(o=>{s({visible:!!o.visible,character:X(o.character),size:["small","medium","large"].includes(o.size)?o.size:"medium"})});return $(),d},[t]);const l=n.useCallback((d,o)=>{s(x=>({...x,[d]:o})),t&&W(d,o)},[t]);return{available:t,settings:a,setSetting:l}}const y=[{id:"clawd",displayName:"Clawd",nameKey:"pet.character.clawd",spriteVersionNumber:1,custom:!1},{id:"sprout",displayName:"Sprout",nameKey:"pet.character.sprout",spriteVersionNumber:1,custom:!1,assetUrl:"/pets/sprout/spritesheet.webp"},{id:"byte",displayName:"Byte",nameKey:"pet.character.byte",spriteVersionNumber:1,custom:!1,assetUrl:"/pets/byte/spritesheet.webp"},{id:"ember",displayName:"Ember",nameKey:"pet.character.ember",spriteVersionNumber:1,custom:!1,assetUrl:"/pets/ember/spritesheet.webp"}];async function z(t){const a=await t.json().catch(()=>null);if(!t.ok||a?.ok===!1)throw new Error(a?.error||`Pet request failed with HTTP ${t.status}`);return a}async function ce(){const t=await fetch("/functions/tokentracker-pets",{headers:{Accept:"application/json"},cache:"no-store"}),a=await z(t);return[...y,...Array.isArray(a.pets)?a.pets:[]]}async function B(t){const a=await K();return z(await fetch("/functions/tokentracker-pets",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",...a},cache:"no-store",body:JSON.stringify(t)}))}function me(t){return B({action:"install_url",url:t})}async function M(t){const a=await K();return z(await fetch("/api/pets/import",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/zip",...a},cache:"no-store",body:t}))}function pe(t){return B({action:"remove",id:t})}let C=y;function xe(){const[t,a]=n.useState(C),[s,l]=n.useState(!0),[d,o]=n.useState(!1),x=n.useCallback(async()=>{l(!0);try{const m=await ce();return C=m,a(m),o(!0),m}catch{return C=y,a(y),o(!1),y}finally{l(!1)}},[]);return n.useEffect(()=>{x()},[x]),{pets:t,loading:s,available:d,refresh:x}}const ue={clawd:"from-oai-amber-50 dark:from-orange-950/70",sprout:"from-oai-brand-100 dark:from-emerald-950/70",byte:"from-oai-gray-200 dark:from-slate-800/70",ember:"from-orange-100 dark:from-orange-950/80"};function ge(){const t=i("pet.import.subtitle"),a="codex-pets.net",s=t.indexOf(a);return s<0?t:e.jsxs(e.Fragment,{children:[t.slice(0,s),e.jsx("a",{href:"https://codex-pets.net",target:"_blank",rel:"noreferrer",className:"underline decoration-oai-gray-400 underline-offset-2 transition-colors hover:text-oai-black dark:decoration-oai-gray-500 dark:hover:text-white",children:a}),t.slice(s+a.length)]})}const k=[{id:"idle-living",labelKey:"pet.state.calm"},{id:"working-thinking",labelKey:"pet.state.focus"},{id:"working-juggling",labelKey:"pet.state.multitask"},{id:"working-wizard",labelKey:"pet.state.streak"},{id:"happy",labelKey:"pet.state.celebrate"},{id:"sleeping",labelKey:"pet.state.rest"}];function be({character:t,selected:a,onSelect:s,onRemove:l,removeDisabled:d}){const o=t.nameKey?i(t.nameKey):t.displayName;return e.jsxs("div",{className:"group relative",children:[e.jsxs("button",{type:"button",onClick:s,"aria-pressed":a,className:b("relative w-full overflow-hidden rounded-xl border p-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",a?"border-oai-brand-500/40 bg-white dark:border-oai-brand-500/25 dark:bg-oai-gray-900/80":"border-oai-gray-200/80 bg-white/55 hover:border-oai-gray-400 dark:border-oai-gray-800 dark:bg-oai-gray-950/55 dark:hover:border-oai-gray-600"),children:[e.jsx("div",{className:b("absolute inset-0 bg-gradient-to-br to-transparent opacity-80 dark:opacity-55",ue[t.id]||"from-oai-gray-200/80 dark:from-oai-gray-800/70")}),e.jsxs("div",{className:"relative flex items-center gap-2.5",children:[e.jsx("div",{className:"flex h-12 w-12 shrink-0 items-center justify-center",children:e.jsx(_,{state:"idle-living",character:t.id,pet:t,size:44})}),e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-semibold text-oai-black dark:text-white",children:o}),t.spriteVersionNumber===2?e.jsx("span",{className:"shrink-0 rounded border border-oai-gray-300/80 px-1 text-[9px] font-semibold text-oai-gray-500 dark:border-oai-gray-600 dark:text-oai-gray-400",children:i("pet.format.v2")}):null,a?e.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-oai-brand-500","aria-hidden":!0}):null]})]})]}),l?e.jsx("button",{type:"button",disabled:d,onClick:l,"aria-label":`${i("pet.import.remove")} · ${o}`,className:b("absolute right-1.5 top-1.5 flex h-6 w-6 items-center justify-center rounded-md border border-oai-gray-200/90 bg-white/95 text-oai-gray-500 transition-opacity hover:text-red-600 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 disabled:opacity-40 dark:border-oai-gray-700 dark:bg-oai-gray-900/95 dark:text-oai-gray-400 dark:hover:text-red-400",a?"opacity-100":"opacity-0 group-hover:opacity-100"),children:e.jsx(te,{className:"h-3 w-3","aria-hidden":!0})}):null]})}function he({pet:t,state:a,onStateChange:s}){const[l,d]=n.useState(null),o=n.useRef(null),x=k.find(function(u){return u.id===a}),m=i(x?.labelKey||"pet.state.calm");return e.jsxs("section",{className:"relative flex min-h-[400px] flex-col overflow-hidden bg-oai-gray-50 dark:bg-oai-gray-950 sm:min-h-[440px] lg:min-h-[480px]",onPointerMove:c=>{if(t?.spriteVersionNumber!==2||!o.current)return;const u=o.current.getBoundingClientRect(),v=c.clientX-(u.left+u.width/2),p=c.clientY-(u.top+u.height/2),j=(Math.atan2(v,-p)*180/Math.PI+360)%360;d(Math.round(j/22.5)%16)},onPointerLeave:()=>d(null),children:[e.jsx("div",{className:"absolute inset-0 opacity-[0.16] dark:opacity-[0.12]",style:{backgroundImage:"radial-gradient(currentColor 0.7px, transparent 0.7px)",backgroundSize:"14px 14px"},"aria-hidden":!0}),e.jsxs("div",{className:"relative flex items-center justify-between gap-3 px-5 pt-5",children:[e.jsx("span",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-oai-gray-500 dark:text-oai-gray-400",children:i("pet.preview.states")}),e.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-black/5 bg-white/65 px-3 py-1.5 text-[11px] font-medium text-oai-gray-600 backdrop-blur-md dark:border-white/10 dark:bg-black/20 dark:text-oai-gray-300",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500","aria-hidden":!0}),m]})]}),e.jsx("div",{className:"relative flex flex-1 items-center justify-center px-6 py-5",children:e.jsx("div",{ref:o,className:"relative flex h-52 w-52 items-center justify-center sm:h-56 sm:w-56 lg:h-64 lg:w-64",children:e.jsx("div",{className:"origin-bottom lg:scale-[1.18]",children:e.jsx(_,{state:a,character:t?.id||"clawd",pet:t,size:190,lookDirectionIndex:l})})})}),e.jsx("div",{className:"relative border-t border-oai-gray-200/70 bg-white/85 px-3 py-2 dark:border-oai-gray-800 dark:bg-oai-gray-950/85",children:e.jsx("div",{className:"grid grid-cols-3 gap-1","aria-label":i("pet.preview.states"),children:k.map(c=>e.jsxs("button",{type:"button",onClick:()=>s(c.id),"aria-pressed":a===c.id,className:b("flex min-h-10 flex-col items-center justify-center gap-1 rounded-lg px-1.5 text-xs transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-oai-brand-500",a===c.id?"font-semibold text-oai-black dark:text-white":"font-medium text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:[e.jsx("span",{children:i(c.labelKey)}),e.jsx("span",{className:b("h-1 w-1 rounded-full transition-colors duration-200",a===c.id?"bg-oai-black dark:bg-white":"bg-transparent"),"aria-hidden":!0})]},c.id))})})]})}function Pe(){const{available:t,settings:a,setSetting:s}=de(),{pets:l,loading:d,available:o,refresh:x}=xe(),[m,c]=n.useState(""),[u,v]=n.useState(""),[p,j]=n.useState(!1),[U,A]=n.useState("idle-living"),[I,V]=n.useState(!0),f=a.character||"clawd",S=J(),T=S.settings?.menuBarIconStyle==="pet",D=l.find(r=>r.id===f)||l[0],w=p?{kind:"busy",text:i("pet.import.busy")}:u?{kind:"error",text:u}:null;n.useEffect(()=>{!d&&l.length>0&&!l.some(r=>r.id===f)&&s("character","clawd")},[d,l,f,s]);async function N(r,g=i("pet.import.success")){j(!0),v("");try{const h=await r();await x(),h?.pet?.id&&s("character",h.pet.id),Z({title:g,timeout:4e3}),c("")}catch(h){v(h?.message||i("pet.import.failed"))}finally{j(!1)}}n.useEffect(()=>{if(!I)return;const r=window.setInterval(()=>{A(g=>{const h=k.findIndex(F=>F.id===g);return k[(h+1)%k.length].id})},5e3);return()=>window.clearInterval(r)},[I]);const R=[{value:"small",label:i("pet.size.small")},{value:"medium",label:i("pet.size.medium")},{value:"large",label:i("pet.size.large")}];return e.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:e.jsx("main",{className:"flex-1 pb-14 pt-8 sm:pt-10",children:e.jsxs("div",{className:"mx-auto max-w-5xl px-4 sm:px-6",children:[e.jsx(L,{y:12,children:e.jsxs("header",{className:"mb-8",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight sm:text-4xl",children:i("pet.page.title")}),e.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:i("pet.page.subtitle")})]})}),e.jsx(L,{y:12,delay:.04,children:e.jsxs("div",{className:"overflow-hidden rounded-[28px] border border-oai-gray-200 bg-white/75 dark:border-oai-gray-800 dark:bg-oai-gray-900/60 lg:grid lg:grid-cols-[1.12fr_0.88fr]",children:[e.jsx(he,{pet:D,state:U,onStateChange:r=>{V(!1),A(r)}}),e.jsxs("aside",{className:"flex flex-col border-t border-oai-gray-200 p-5 dark:border-oai-gray-800 lg:min-h-[480px] lg:border-l lg:border-t-0",children:[e.jsxs("section",{"aria-labelledby":"pet-character-title",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"pet-character-title",className:"text-sm font-semibold",children:i("pet.characters.title")}),e.jsx("p",{className:"mt-1 text-xs leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:i("pet.characters.subtitle")})]}),e.jsx("div",{className:"mt-4 grid grid-cols-2 gap-2",children:l.map(r=>e.jsx(be,{character:r,selected:f===r.id,onSelect:()=>s("character",r.id),removeDisabled:p,onRemove:o&&r.custom?()=>N(async()=>(await pe(r.id),f===r.id&&s("character","clawd"),null),i("pet.import.removed")):void 0},r.id))}),S.available?e.jsxs("div",{className:"mt-4 flex items-center justify-between gap-3 rounded-xl border border-oai-gray-200/70 bg-oai-gray-50/60 px-3 py-2.5 dark:border-oai-gray-800 dark:bg-oai-gray-900/40",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-xs font-semibold",children:i("pet.menubar.title")}),e.jsx("p",{className:"mt-0.5 text-[11px] leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:i("pet.menubar.hint")})]}),e.jsx(E,{checked:T,onChange:()=>S.setSetting("menuBarIconStyle",T?"clawd":"pet"),ariaLabel:i("pet.menubar.title")})]}):null]}),o?e.jsxs("section",{className:"mt-6 border-t border-oai-gray-200/70 pt-5 dark:border-oai-gray-800","aria-labelledby":"pet-import-title",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{className:"h-4 w-4 text-oai-gray-500","aria-hidden":!0}),e.jsx("h2",{id:"pet-import-title",className:"text-sm font-semibold",children:i("pet.import.title")})]}),e.jsx("p",{className:"mt-1 text-xs leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:e.jsx(ge,{})}),e.jsxs("form",{className:"mt-3 flex gap-2",onSubmit:r=>{r.preventDefault(),!p&&m.trim()&&N(()=>me(m))},children:[e.jsxs("label",{className:"relative flex min-w-0 flex-1 items-center",children:[e.jsx(Y,{className:"pointer-events-none absolute left-3 h-3.5 w-3.5 text-oai-gray-400","aria-hidden":!0}),e.jsx("input",{value:m,onChange:r=>c(r.target.value),"aria-label":i("pet.import.url_label"),placeholder:"codex-pets.net/#/pets/…",className:"h-9 w-full rounded-lg border border-oai-gray-200 bg-white pl-9 pr-3 text-xs outline-none focus:border-oai-brand-500 dark:border-oai-gray-700 dark:bg-oai-gray-950"})]}),e.jsxs("button",{type:"submit",disabled:p||!m.trim(),className:"flex h-9 shrink-0 items-center gap-1.5 rounded-lg bg-oai-black px-3.5 text-xs font-semibold text-white transition-colors disabled:bg-oai-gray-200 disabled:text-oai-gray-400 dark:bg-white dark:text-black dark:disabled:bg-oai-gray-800 dark:disabled:text-oai-gray-500",children:[p?e.jsx(G,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):null,i("pet.import.add")]})]}),e.jsxs("label",{onDragOver:r=>r.preventDefault(),onDrop:r=>{if(r.preventDefault(),p)return;const g=r.dataTransfer?.files?.[0];g&&N(()=>M(g))},className:b("mt-2 flex h-9 w-full cursor-pointer items-center justify-center gap-1.5 rounded-lg border border-dashed border-oai-gray-300 text-xs font-medium text-oai-gray-500 transition-colors hover:border-oai-gray-500 hover:text-oai-black dark:border-oai-gray-600 dark:text-oai-gray-400 dark:hover:border-oai-gray-400 dark:hover:text-white",p&&"pointer-events-none opacity-40"),children:[e.jsx(re,{className:"h-3.5 w-3.5","aria-hidden":!0}),i("pet.import.zip"),e.jsx("input",{type:"file",accept:".zip,.codex-pet.zip,application/zip",className:"sr-only",disabled:p,onChange:r=>{const g=r.target.files?.[0];g&&N(()=>M(g)),r.target.value=""}})]}),w?e.jsx("p",{role:w.kind==="error"?"alert":"status",className:b("mt-2 text-xs",w.kind==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400"),children:w.text}):null]}):null,e.jsxs("section",{className:"mt-6 border-t border-oai-gray-200/70 pt-5 dark:border-oai-gray-800",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(se,{className:"h-4 w-4 text-oai-gray-500 dark:text-oai-gray-400",strokeWidth:1.75,"aria-hidden":!0}),e.jsx("h2",{className:"text-sm font-semibold",children:i("pet.controls.title")})]}),e.jsxs("div",{className:"mt-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"text-sm font-medium",children:i("pet.controls.show")}),e.jsx(E,{checked:a.visible,onChange:()=>s("visible",!a.visible),disabled:!t,ariaLabel:i("pet.controls.show")})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"text-sm font-medium",children:i("pet.controls.size")}),e.jsx("div",{className:"shrink-0",children:e.jsx(Q,{options:R,value:a.size,onChange:r=>s("size",r),disabled:!t})})]})]})]}),t?null:e.jsxs("div",{className:"mt-6 flex gap-2 rounded-xl bg-oai-gray-100 p-3 text-xs leading-relaxed text-oai-gray-500 dark:bg-oai-gray-800/70 dark:text-oai-gray-400",children:[e.jsx(ee,{className:"mt-0.5 h-3.5 w-3.5 shrink-0","aria-hidden":!0}),i("pet.controls.native_only")]})]})]})})]})})})}export{Pe as PetPage};
1
+ import{k as P,N as H,ak as O,r as n,al as q,am as $,an as W,ao as K,c as i,j as e,b,ap as Z}from"./__vite-browser-external-Eoyj4eG-.js";import{u as J,T as E,S as X}from"./use-native-settings-Bi6E9dsE.js";import{n as Y,C as _}from"./ClawdAnimated-CLHhE26z.js";import{F as L}from"./FadeIn-BDWtfIsO.js";import{L as G}from"./link-2-DeN6MJpT.js";import{L as Q}from"./loader-circle-ByEuaaSw.js";import{Z as ee}from"./zap-DWWma29E.js";import{T as te}from"./trash-2-CVCC3DtQ.js";import"./Card-C3nLScju.js";const ae=[["path",{d:"M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5",key:"4pqfef"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 12v-1",key:"1ej8lb"}],["path",{d:"M8 18v-2",key:"qcmpov"}],["path",{d:"M8 7V6",key:"1nbb54"}],["circle",{cx:"8",cy:"20",r:"2",key:"ckkr5m"}]],re=P("file-archive",ae);const ie=[["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}],["path",{d:"M12 13V7",key:"h0r20n"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]],se=P("monitor-up",ie);const oe=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],ne=P("upload",oe),le={visible:!1,character:"clawd",size:"medium"};function de(){const t=H()&&O(),[a,s]=n.useState(le);n.useEffect(()=>{if(!t)return;const d=q(o=>{s({visible:!!o.visible,character:Y(o.character),size:["small","medium","large"].includes(o.size)?o.size:"medium"})});return $(),d},[t]);const l=n.useCallback((d,o)=>{s(x=>({...x,[d]:o})),t&&W(d,o)},[t]);return{available:t,settings:a,setSetting:l}}const y=[{id:"clawd",displayName:"Clawd",nameKey:"pet.character.clawd",spriteVersionNumber:1,custom:!1},{id:"sprout",displayName:"Sprout",nameKey:"pet.character.sprout",spriteVersionNumber:1,custom:!1,assetUrl:"/pets/sprout/spritesheet.webp"},{id:"byte",displayName:"Byte",nameKey:"pet.character.byte",spriteVersionNumber:1,custom:!1,assetUrl:"/pets/byte/spritesheet.webp"},{id:"ember",displayName:"Ember",nameKey:"pet.character.ember",spriteVersionNumber:1,custom:!1,assetUrl:"/pets/ember/spritesheet.webp"}];async function z(t){const a=await t.json().catch(()=>null);if(!t.ok||a?.ok===!1)throw new Error(a?.error||`Pet request failed with HTTP ${t.status}`);return a}async function ce(){const t=await fetch("/functions/tokentracker-pets",{headers:{Accept:"application/json"},cache:"no-store"}),a=await z(t);return[...y,...Array.isArray(a.pets)?a.pets:[]]}async function B(t){const a=await K();return z(await fetch("/functions/tokentracker-pets",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",...a},cache:"no-store",body:JSON.stringify(t)}))}function me(t){return B({action:"install_url",url:t})}async function M(t){const a=await K();return z(await fetch("/api/pets/import",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/zip",...a},cache:"no-store",body:t}))}function pe(t){return B({action:"remove",id:t})}let C=y;function xe(){const[t,a]=n.useState(C),[s,l]=n.useState(!0),[d,o]=n.useState(!1),x=n.useCallback(async()=>{l(!0);try{const m=await ce();return C=m,a(m),o(!0),m}catch{return C=y,a(y),o(!1),y}finally{l(!1)}},[]);return n.useEffect(()=>{x()},[x]),{pets:t,loading:s,available:d,refresh:x}}const ue={clawd:"from-oai-amber-50 dark:from-orange-950/70",sprout:"from-oai-brand-100 dark:from-emerald-950/70",byte:"from-oai-gray-200 dark:from-slate-800/70",ember:"from-orange-100 dark:from-orange-950/80"};function ge(){const t=i("pet.import.subtitle"),a="codex-pets.net",s=t.indexOf(a);return s<0?t:e.jsxs(e.Fragment,{children:[t.slice(0,s),e.jsx("a",{href:"https://codex-pets.net",target:"_blank",rel:"noreferrer",className:"underline decoration-oai-gray-400 underline-offset-2 transition-colors hover:text-oai-black dark:decoration-oai-gray-500 dark:hover:text-white",children:a}),t.slice(s+a.length)]})}const k=[{id:"idle-living",labelKey:"pet.state.calm"},{id:"working-thinking",labelKey:"pet.state.focus"},{id:"working-juggling",labelKey:"pet.state.multitask"},{id:"working-wizard",labelKey:"pet.state.streak"},{id:"happy",labelKey:"pet.state.celebrate"},{id:"sleeping",labelKey:"pet.state.rest"}];function be({character:t,selected:a,onSelect:s,onRemove:l,removeDisabled:d}){const o=t.nameKey?i(t.nameKey):t.displayName;return e.jsxs("div",{className:"group relative",children:[e.jsxs("button",{type:"button",onClick:s,"aria-pressed":a,className:b("relative w-full overflow-hidden rounded-xl border p-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",a?"border-oai-brand-500/40 bg-white dark:border-oai-brand-500/25 dark:bg-oai-gray-900/80":"border-oai-gray-200/80 bg-white/55 hover:border-oai-gray-400 dark:border-oai-gray-800 dark:bg-oai-gray-950/55 dark:hover:border-oai-gray-600"),children:[e.jsx("div",{className:b("absolute inset-0 bg-gradient-to-br to-transparent opacity-80 dark:opacity-55",ue[t.id]||"from-oai-gray-200/80 dark:from-oai-gray-800/70")}),e.jsxs("div",{className:"relative flex items-center gap-2.5",children:[e.jsx("div",{className:"flex h-12 w-12 shrink-0 items-center justify-center",children:e.jsx(_,{state:"idle-living",character:t.id,pet:t,size:44})}),e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-semibold text-oai-black dark:text-white",children:o}),t.spriteVersionNumber===2?e.jsx("span",{className:"shrink-0 rounded border border-oai-gray-300/80 px-1 text-[9px] font-semibold text-oai-gray-500 dark:border-oai-gray-600 dark:text-oai-gray-400",children:i("pet.format.v2")}):null,a?e.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-oai-brand-500","aria-hidden":!0}):null]})]})]}),l?e.jsx("button",{type:"button",disabled:d,onClick:l,"aria-label":`${i("pet.import.remove")} · ${o}`,className:b("absolute right-1.5 top-1.5 flex h-6 w-6 items-center justify-center rounded-md border border-oai-gray-200/90 bg-white/95 text-oai-gray-500 transition-opacity hover:text-red-600 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 disabled:opacity-40 dark:border-oai-gray-700 dark:bg-oai-gray-900/95 dark:text-oai-gray-400 dark:hover:text-red-400",a?"opacity-100":"opacity-0 group-hover:opacity-100"),children:e.jsx(te,{className:"h-3 w-3","aria-hidden":!0})}):null]})}function he({pet:t,state:a,onStateChange:s}){const[l,d]=n.useState(null),o=n.useRef(null),x=k.find(function(u){return u.id===a}),m=i(x?.labelKey||"pet.state.calm");return e.jsxs("section",{className:"relative flex min-h-[400px] flex-col overflow-hidden bg-oai-gray-50 dark:bg-oai-gray-950 sm:min-h-[440px] lg:min-h-[480px]",onPointerMove:c=>{if(t?.spriteVersionNumber!==2||!o.current)return;const u=o.current.getBoundingClientRect(),v=c.clientX-(u.left+u.width/2),p=c.clientY-(u.top+u.height/2),j=(Math.atan2(v,-p)*180/Math.PI+360)%360;d(Math.round(j/22.5)%16)},onPointerLeave:()=>d(null),children:[e.jsx("div",{className:"absolute inset-0 opacity-[0.16] dark:opacity-[0.12]",style:{backgroundImage:"radial-gradient(currentColor 0.7px, transparent 0.7px)",backgroundSize:"14px 14px"},"aria-hidden":!0}),e.jsxs("div",{className:"relative flex items-center justify-between gap-3 px-5 pt-5",children:[e.jsx("span",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-oai-gray-500 dark:text-oai-gray-400",children:i("pet.preview.states")}),e.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-black/5 bg-white/65 px-3 py-1.5 text-[11px] font-medium text-oai-gray-600 backdrop-blur-md dark:border-white/10 dark:bg-black/20 dark:text-oai-gray-300",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500","aria-hidden":!0}),m]})]}),e.jsx("div",{className:"relative flex flex-1 items-center justify-center px-6 py-5",children:e.jsx("div",{ref:o,className:"relative flex h-52 w-52 items-center justify-center sm:h-56 sm:w-56 lg:h-64 lg:w-64",children:e.jsx("div",{className:"origin-bottom lg:scale-[1.18]",children:e.jsx(_,{state:a,character:t?.id||"clawd",pet:t,size:190,lookDirectionIndex:l})})})}),e.jsx("div",{className:"relative border-t border-oai-gray-200/70 bg-white/85 px-3 py-2 dark:border-oai-gray-800 dark:bg-oai-gray-950/85",children:e.jsx("div",{className:"grid grid-cols-3 gap-1","aria-label":i("pet.preview.states"),children:k.map(c=>e.jsxs("button",{type:"button",onClick:()=>s(c.id),"aria-pressed":a===c.id,className:b("flex min-h-10 flex-col items-center justify-center gap-1 rounded-lg px-1.5 text-xs transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-oai-brand-500",a===c.id?"font-semibold text-oai-black dark:text-white":"font-medium text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:[e.jsx("span",{children:i(c.labelKey)}),e.jsx("span",{className:b("h-1 w-1 rounded-full transition-colors duration-200",a===c.id?"bg-oai-black dark:bg-white":"bg-transparent"),"aria-hidden":!0})]},c.id))})})]})}function Pe(){const{available:t,settings:a,setSetting:s}=de(),{pets:l,loading:d,available:o,refresh:x}=xe(),[m,c]=n.useState(""),[u,v]=n.useState(""),[p,j]=n.useState(!1),[U,A]=n.useState("idle-living"),[I,V]=n.useState(!0),f=a.character||"clawd",S=J(),T=S.settings?.menuBarIconStyle==="pet",D=l.find(r=>r.id===f)||l[0],w=p?{kind:"busy",text:i("pet.import.busy")}:u?{kind:"error",text:u}:null;n.useEffect(()=>{!d&&l.length>0&&!l.some(r=>r.id===f)&&s("character","clawd")},[d,l,f,s]);async function N(r,g=i("pet.import.success")){j(!0),v("");try{const h=await r();await x(),h?.pet?.id&&s("character",h.pet.id),Z({title:g,timeout:4e3}),c("")}catch(h){v(h?.message||i("pet.import.failed"))}finally{j(!1)}}n.useEffect(()=>{if(!I)return;const r=window.setInterval(()=>{A(g=>{const h=k.findIndex(F=>F.id===g);return k[(h+1)%k.length].id})},5e3);return()=>window.clearInterval(r)},[I]);const R=[{value:"small",label:i("pet.size.small")},{value:"medium",label:i("pet.size.medium")},{value:"large",label:i("pet.size.large")}];return e.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:e.jsx("main",{className:"flex-1 pb-14 pt-8 sm:pt-10",children:e.jsxs("div",{className:"mx-auto max-w-5xl px-4 sm:px-6",children:[e.jsx(L,{y:12,children:e.jsxs("header",{className:"mb-8",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight sm:text-4xl",children:i("pet.page.title")}),e.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:i("pet.page.subtitle")})]})}),e.jsx(L,{y:12,delay:.04,children:e.jsxs("div",{className:"overflow-hidden rounded-[28px] border border-oai-gray-200 bg-white/75 dark:border-oai-gray-800 dark:bg-oai-gray-900/60 lg:grid lg:grid-cols-[1.12fr_0.88fr]",children:[e.jsx(he,{pet:D,state:U,onStateChange:r=>{V(!1),A(r)}}),e.jsxs("aside",{className:"flex flex-col border-t border-oai-gray-200 p-5 dark:border-oai-gray-800 lg:min-h-[480px] lg:border-l lg:border-t-0",children:[e.jsxs("section",{"aria-labelledby":"pet-character-title",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"pet-character-title",className:"text-sm font-semibold",children:i("pet.characters.title")}),e.jsx("p",{className:"mt-1 text-xs leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:i("pet.characters.subtitle")})]}),e.jsx("div",{className:"mt-4 grid grid-cols-2 gap-2",children:l.map(r=>e.jsx(be,{character:r,selected:f===r.id,onSelect:()=>s("character",r.id),removeDisabled:p,onRemove:o&&r.custom?()=>N(async()=>(await pe(r.id),f===r.id&&s("character","clawd"),null),i("pet.import.removed")):void 0},r.id))}),S.available?e.jsxs("div",{className:"mt-4 flex items-center justify-between gap-3 rounded-xl border border-oai-gray-200/70 bg-oai-gray-50/60 px-3 py-2.5 dark:border-oai-gray-800 dark:bg-oai-gray-900/40",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-xs font-semibold",children:i("pet.menubar.title")}),e.jsx("p",{className:"mt-0.5 text-[11px] leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:i("pet.menubar.hint")})]}),e.jsx(E,{checked:T,onChange:()=>S.setSetting("menuBarIconStyle",T?"clawd":"pet"),ariaLabel:i("pet.menubar.title")})]}):null]}),o?e.jsxs("section",{className:"mt-6 border-t border-oai-gray-200/70 pt-5 dark:border-oai-gray-800","aria-labelledby":"pet-import-title",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{className:"h-4 w-4 text-oai-gray-500","aria-hidden":!0}),e.jsx("h2",{id:"pet-import-title",className:"text-sm font-semibold",children:i("pet.import.title")})]}),e.jsx("p",{className:"mt-1 text-xs leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:e.jsx(ge,{})}),e.jsxs("form",{className:"mt-3 flex gap-2",onSubmit:r=>{r.preventDefault(),!p&&m.trim()&&N(()=>me(m))},children:[e.jsxs("label",{className:"relative flex min-w-0 flex-1 items-center",children:[e.jsx(G,{className:"pointer-events-none absolute left-3 h-3.5 w-3.5 text-oai-gray-400","aria-hidden":!0}),e.jsx("input",{value:m,onChange:r=>c(r.target.value),"aria-label":i("pet.import.url_label"),placeholder:"codex-pets.net/#/pets/…",className:"h-9 w-full rounded-lg border border-oai-gray-200 bg-white pl-9 pr-3 text-xs outline-none focus:border-oai-brand-500 dark:border-oai-gray-700 dark:bg-oai-gray-950"})]}),e.jsxs("button",{type:"submit",disabled:p||!m.trim(),className:"flex h-9 shrink-0 items-center gap-1.5 rounded-lg bg-oai-black px-3.5 text-xs font-semibold text-white transition-colors disabled:bg-oai-gray-200 disabled:text-oai-gray-400 dark:bg-white dark:text-black dark:disabled:bg-oai-gray-800 dark:disabled:text-oai-gray-500",children:[p?e.jsx(Q,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):null,i("pet.import.add")]})]}),e.jsxs("label",{onDragOver:r=>r.preventDefault(),onDrop:r=>{if(r.preventDefault(),p)return;const g=r.dataTransfer?.files?.[0];g&&N(()=>M(g))},className:b("mt-2 flex h-9 w-full cursor-pointer items-center justify-center gap-1.5 rounded-lg border border-dashed border-oai-gray-300 text-xs font-medium text-oai-gray-500 transition-colors hover:border-oai-gray-500 hover:text-oai-black dark:border-oai-gray-600 dark:text-oai-gray-400 dark:hover:border-oai-gray-400 dark:hover:text-white",p&&"pointer-events-none opacity-40"),children:[e.jsx(re,{className:"h-3.5 w-3.5","aria-hidden":!0}),i("pet.import.zip"),e.jsx("input",{type:"file",accept:".zip,.codex-pet.zip,application/zip",className:"sr-only",disabled:p,onChange:r=>{const g=r.target.files?.[0];g&&N(()=>M(g)),r.target.value=""}})]}),w?e.jsx("p",{role:w.kind==="error"?"alert":"status",className:b("mt-2 text-xs",w.kind==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400"),children:w.text}):null]}):null,e.jsxs("section",{className:"mt-6 border-t border-oai-gray-200/70 pt-5 dark:border-oai-gray-800",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(se,{className:"h-4 w-4 text-oai-gray-500 dark:text-oai-gray-400",strokeWidth:1.75,"aria-hidden":!0}),e.jsx("h2",{className:"text-sm font-semibold",children:i("pet.controls.title")})]}),e.jsxs("div",{className:"mt-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"text-sm font-medium",children:i("pet.controls.show")}),e.jsx(E,{checked:a.visible,onChange:()=>s("visible",!a.visible),disabled:!t,ariaLabel:i("pet.controls.show")})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"text-sm font-medium",children:i("pet.controls.size")}),e.jsx("div",{className:"shrink-0",children:e.jsx(X,{options:R,value:a.size,onChange:r=>s("size",r),disabled:!t})})]})]})]}),t?null:e.jsxs("div",{className:"mt-6 flex gap-2 rounded-xl bg-oai-gray-100 p-3 text-xs leading-relaxed text-oai-gray-500 dark:bg-oai-gray-800/70 dark:text-oai-gray-400",children:[e.jsx(ee,{className:"mt-0.5 h-3.5 w-3.5 shrink-0","aria-hidden":!0}),i("pet.controls.native_only")]})]})]})})]})})})}export{Pe as PetPage};
@@ -1 +1 @@
1
- import{l as Xe,b2 as Ue,bs as Ke,bt as le,bu as We,O as ne,b1 as ge,r as m,bv as Q,bw as me,bx as he,by as oe,aJ as be,bz as qe,bA as we,aK as z,aH as $,bB as W,$ as ue,aC as pe,aL as ze,bC as Ee,bD as Je,bE as $e,bF as Qe,bG as Te,aA as q,j as G,aI as Ze,aB as Me,b6 as et,bH as tt,bI as nt,bJ as ot,bK as st,b3 as rt,w as Le,bL as it,bM as ye,aF as at,bN as ct,bO as lt,aG as ut,aE as ft,bP as dt,aD as pt}from"./__vite-browser-external-CxN2E6q5.js";import{n as ve,o as Ae,q as He,r as Ce,v as se,P as gt,w as mt,k as ht,s as Et,x as Tt,y as vt,e as Ct,f as Pt,g as bt,h as Rt,a as Be,j as St,u as Ot,z as It,A as Mt,t as yt,B as xt,I as Ft,D as kt,c as wt,d as Lt,b as At,p as Ht}from"./useScrollLock-Vyaif-7C.js";import{f as Bt,p as Dt,g as _t}from"./DialogTitle-BvElfi0r.js";import{r as Nt,t as jt,v as Gt,w as Yt,x as Vt,y as Xt,z as Ut,A as Kt}from"./SelectItemText-Bz8FAKEv.js";const Wt=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Tn=Xe("chevron-right",Wt);function qt(e,n){return n!=null&&!ve(n)?0:typeof e=="function"?e():e}function Pe(e,n,t){const l=qt(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 _e(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 Ne(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 Jt(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=He(),h=Ne(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()&&Q(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 H=h.pointerEventsScopeElement!==a?h.pointerEventsScopeElement:null,v=F!==a?F:null,P=h.handleCloseOptions?.getScope?.()??H??v??x.closest("[data-rootownerid]")??d.body;return _e(h,{scopeElement:P,referenceElement:x,floatingElement:a}),()=>{g()}}},[t,p,S,E,h,B,r,O,g]),m.useEffect(()=>{if(!t)return;function x(){return!!(r&&O&&Ce(r.nodesRef.current,O).length>0)}function a(b){const M=Pe(l,"close",h.pointerType),_=()=>{o.setOpen(!1,$(W,b)),r?.events.emit("floating.closed",b)};M?h.openChangeTimeout.start(M,_):(h.openChangeTimeout.clear(),_())}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",v),g()}function H(b){if(x()&&r){r.events.on("floating.closed",v);return}if(we(b.relatedTarget,o.context.triggerElements))return;const M=c.current.floatingContext?.nodeId??i,_=b.relatedTarget;if(!(r&&M&&Q(_)&&Ce(r.nodesRef.current,M,!1).some(X=>z(X.context?.elements.floating,_)))){if(h.handler){h.handler(b);return}g(),B()&&!u()&&a(b)}}function v(b){!r||!O||x()||j.start(0,()=>{r.events.off("floating.closed",v),o.setOpen(!1,$(W,b)),r.events.emit("floating.closed",b)})}const P=E;return he(P&&oe(P,"mouseenter",F),P&&oe(P,"mouseleave",H),P&&oe(P,"pointerdown",d,!0),()=>{r?.events.off("floating.closed",v)})},[t,E,o,c,l,i,B,u,g,h,r,O,j])}const $t={current:null};function Qt(e,n={}){const{enabled:t=!0,delay:l=0,handleClose:i=null,mouseOnly:o=!1,restMs:p=0,move:E=!0,triggerElementRef:S=$t,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=Ne(u),d=m.useRef(!1),F=se(i),H=se(l),v=se(p),P=se(t),b=se(j),M=se(h),_=ne(()=>De(B.current.openEvent?.type,a.interactedInside)),V=ne(()=>b.current?.()!==!1),X=ne((s,T,L)=>{const R=u.context.triggerElements;if(R.hasElement(T))return!s||!z(s,T);if(!Q(L))return!1;const f=L;return R.hasMatchingElement(A=>z(A,f))&&(!s||!z(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,A=!0){const D=Pe(H.current,"close",a.pointerType);D?a.openChangeTimeout.start(D,()=>{u.setOpen(!1,$(W,f)),x?.events.emit("floating.closed",f)}):A&&(a.openChangeTimeout.clear(),u.setOpen(!1,$(W,f)),x?.events.emit("floating.closed",f))}const T=S.current??(r?u.select("domReferenceElement"):null);if(!Q(T))return;function L(f){if(a.openChangeTimeout.clear(),a.blockMouseMove=!1,o&&!ve(a.pointerType))return;const A=xe(v.current),D=Pe(H.current,"open",a.pointerType),Y=be(f),U=f.currentTarget??null,I=u.select("domReferenceElement");let k=U;if(Q(Y)&&!u.context.triggerElements.hasElement(Y)){for(const Ie of u.context.triggerElements.elements())if(z(Ie,Y)){k=Ie;break}}Q(U)&&Q(I)&&!u.context.triggerElements.hasElement(U)&&z(U,I)&&(k=I);const C=k==null?!1:X(I,k,Y),J=u.select("open"),Z=M.current?.()??u.select("transitionStatus")==="ending",K=!J&&Z&&d.current,ee=!C&&Q(k)&&Q(I)&&z(I,k)&&K,te=A>0&&!D,Ve=C&&(J||K)||ee,Oe=!J||C;if(Ve){V()&&u.setOpen(!0,$(W,f,k));return}te||(D?a.openChangeTimeout.start(D,()=>{Oe&&V()&&u.setOpen(!0,$(W,f,k))}):Oe&&V()&&u.setOpen(!0,$(W,f,k)))}function R(f){if(_()){w();return}N();const A=u.select("domReferenceElement"),D=me(A);a.restTimeout.clear(),a.restTimeoutPending=!1;const Y=B.current.floatingContext??O?.();if(we(f.relatedTarget,u.context.triggerElements))return;if(F.current&&Y){u.select("open")||a.openChangeTimeout.clear();const I=S.current;a.handler=F.current({...Y,tree:x,x:f.clientX,y:f.clientY,onClose(){w(),N(),P.current&&!_()&&I===u.select("domReferenceElement")&&s(f,!0)}}),D.addEventListener("mousemove",a.handler),a.handler(f);return}(a.pointerType!=="touch"||!z(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,H,u,t,F,a,r,X,_,o,E,v,S,x,P,O,M,V]),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"),A=u.select("open"),D=X(f,R,T.target);if(o&&!ve(a.pointerType))return;if(A&&D&&a.handleCloseOptions?.blockPointerEvents){const I=u.select("floatingElement");if(I){const k=a.handleCloseOptions?.getScope?.()??R.ownerDocument.body;_e(a,{scopeElement:k,referenceElement:R,floatingElement:I})}}const Y=xe(v.current);if(A&&!D||Y===0||!D&&a.restTimeoutPending&&T.movementX**2+T.movementY**2<2)return;a.restTimeout.clear();function U(){if(a.restTimeoutPending=!1,_())return;const I=u.select("open");!a.blockMouseMove&&(!I||D)&&V()&&u.setOpen(!0,$(W,L,R))}a.pointerType==="touch"?ue.flushSync(()=>{U()}):D&&A?U():(a.restTimeoutPending=!0,a.restTimeout.start(Y,U))}}},[t,a,_,X,o,u,v,V])}const Fe=.1,Zt=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 en(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 tn(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(),H=F-B;if(j===null||u===null||H===0)return j=a,u=d,B=F,!1;const v=a-j,P=d-u,b=v*v+P*P,M=H*H*Zt;return j=a,u=d,B=F,b<M}function x(){t.clear(),S()}return function(d){t.clear();const F=E.domReference,H=E.floating;if(!F||!H||O==null||i==null||o==null)return;const{clientX:v,clientY:P}=d,b=be(d),M=d.type==="mouseleave",_=z(H,b),V=z(F,b);if(_&&(h=!0,!M))return;if(V&&(h=!1,!M)){h=!0;return}if(M&&Q(d.relatedTarget)&&z(H,d.relatedTarget))return;function X(){return!!(r&&Ce(r.nodesRef.current,c).length>0)}function N(){X()||x()}if(X())return;const w=F.getBoundingClientRect(),s=H.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,A=(R?w:s).left,D=(R?w:s).right,Y=(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(v,P,A,w.top+1,D,s.bottom-1);break;case"bottom":I=ce(v,P,A,s.top+1,D,w.bottom-1);break;case"left":I=ce(v,P,s.right-1,U,w.left+1,Y);break;case"right":I=ce(v,P,w.right-1,U,s.left+1,Y);break}if(I)return;if(h&&!en(v,P,w)){N();return}if(!M&&g(v,P)){N();return}let k=!1;switch(O){case"top":{const C=R?y/2:y*4,J=R||T?i+C:i-C,Z=R?i-C:T?i+C:i-C,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(v,P,J,K,Z,K,s.left,ee,s.right,te);break}case"bottom":{const C=R?y/2:y*4,J=R||T?i+C:i-C,Z=R?i-C:T?i+C:i-C,K=o-y,ee=T||R?s.top+y:s.bottom,te=T?R?s.top+y:s.bottom:s.top+y;k=ae(v,P,J,K,Z,K,s.left,ee,s.right,te);break}case"left":{const C=f?y/2:y*4,J=f||L?o+C:o-C,Z=f?o-C:L?o+C:o-C,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(v,P,ee,s.top,te,s.bottom,K,J,K,Z);break}case"right":{const C=f?y/2:y*4,J=f||L?o+C:o-C,Z=f?o-C:L?o+C:o-C,K=i-y,ee=L||f?s.left+y:s.right,te=L?f?s.left+y:s.right:s.left+y;k=ae(v,P,K,J,K,Z,ee,s.top,te,s.bottom);break}}k?h||t.start(40,N):N()}};return l.__options={...e,blockPointerEvents:n},l}const je=m.createContext(void 0);function re(e){const n=m.useContext(je);if(n===void 0&&!e)throw new Error(pe(47));return n}function nn(){return{..._t(),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 on={...Dt,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 ze{constructor(n,t,l=!1){const i={...nn(),...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},on)}setOpen=(n,t)=>{const l=t.reason===W,i=t.reason===Ee&&t.event.detail===0,o=!n&&(t.reason===Je||t.reason==null),p=mt(t),E=this.select("activeTriggerId");if(!n&&t.reason===$e&&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(Qe,()=>{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});vt(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=He()!=null;r.useContextCallback("onOpenChange",i),r.useContextCallback("onOpenChangeComplete",o),Ct(r,O),Pt(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,$(Ze))},[r]);m.useImperativeHandle(e.actionsRef,()=>({unmount:B,close:g}),[B,g]);const x=O||h,a=m.useMemo(()=>({store:r}),[r]);return G.jsxs(je.Provider,{value:a,children:[x&&G.jsx(sn,{store:r,modal:p}),typeof n=="function"?n({payload:j}):n]})}function vn(e){return re(!0)?G.jsx(ke,{props:e}):G.jsx(Tt,{children:G.jsx(ke,{props:e})})}function sn({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(Be,l.floating),[l.floating]);return St(e,{activeTriggerProps:i,inactiveTriggerProps:o,popupProps:p}),null}const rn=300;function an(e,n){const t=m.useRef(null);function l(o){ue.flushSync(()=>{e.setOpen(!1,$(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,$(Te,o.nativeEvent,o.currentTarget))});let E=nt(e.context.triggerFocusTargetRef.current||n.current);for(;E!==null&&z(p,E);){const S=E;if(E=ot(E),E===S)break}E?.focus()}}return{preFocusGuardRef:t,handlePreFocusGuardFocus:l,handleFocusTargetFocus:i}}const Cn=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=rn,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),H=g.useState("triggerPopupId",x),v=m.useRef(null),{registerTrigger:P,isMountedByThisTrigger:b}=It(x,v,g,{payload:c,disabled:p,openOnHover:r,closeDelay:h}),M=g.useState("openChangeReason"),_=g.useState("stickIfOpen"),V=g.useState("openMethod"),X=g.useState("focusManagerModal"),N=Qt(d,{enabled:!p&&d!=null&&r&&(V!=="touch"||M!==Ee),mouseOnly:!0,move:!1,handleClose:tn(),restMs:O,delay:{close:h},triggerElementRef:v,isActiveTrigger:a,isClosing:()=>g.select("transitionStatus")==="ending"}),w=Nt(d,{enabled:d!=null,stickIfOpen:_}),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:A,handlePreFocusGuardFocus:D,handleFocusTargetFocus:Y}=an(g,v),I=Le("button",n,{state:{disabled:p,open:F},ref:[R,t,P,v],props:[w.reference,N,T,s,{[it]:"",id:x,"aria-haspopup":"dialog","aria-expanded":F,"aria-controls":H},u,L],stateAttributesMapping:f});return b&&!X?G.jsxs(m.Fragment,{children:[G.jsx(ye,{ref:A,onFocus:D}),G.jsx(m.Fragment,{children:I},x),G.jsx(ye,{ref:g.context.triggerFocusTargetRef,onFocus:Y})]}):G.jsx(m.Fragment,{children:I},x)}),Ge=m.createContext(void 0);function cn(){const e=m.useContext(Ge);if(e===void 0)throw new Error(pe(45));return e}const Pn=m.forwardRef(function(n,t){const{keepMounted:l=!1,...i}=n,{store:o}=re();return o.useState("mounted")||l?G.jsx(Ge.Provider,{value:l,children:G.jsx(at,{ref:t,...i})}):null}),Ye=m.createContext(void 0);function ln(){const e=m.useContext(Ye);if(!e)throw new Error(pe(46));return e}const bn=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=cn(),H=xt(),v=d.useState("floatingRootContext"),P=d.useState("mounted"),b=d.useState("open"),M=d.useState("openChangeReason"),_=d.useState("activeTriggerElement"),V=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=Gt({anchor:p,floatingRootContext:v,positionMethod:E,mounted:P,side:S,sideOffset:r,align:c,alignOffset:O,arrowPadding:u,collisionBoundary:h,collisionPadding:j,sticky:B,disableAnchorTracking:g,keepMounted:F,nodeId:H,collisionAvoidance:x,adaptiveOrigin:T?Xt:void 0}),A=v.useState("domReferenceElement");ge(()=>{const I=A,k=L.current;if(I&&(L.current=I),k&&I&&I!==k){d.set("instantType",void 0);const C=new AbortController;return R(()=>{d.set("instantType","trigger-change")},C.signal),()=>{C.abort()}}},[A,R,d]),Yt(b&&V===!0&&M!==W,X==="touch",N,_);const D=m.useCallback(I=>{d.set("positionerElement",I)},[d]),Y={open:b,side:f.side,align:f.align,anchorHidden:f.anchorHidden,instant:w},U=Vt(n,Y,{styles:f.positionerStyles,transitionStatus:s,props:a,refs:[t,D],hidden:!P,inert:!b});return G.jsxs(Ye.Provider,{value:f,children:[P&&V===!0&&M!==W&&G.jsx(Ft,{ref:d.context.internalBackdropRef,inert:ut(!b),cutout:_}),G.jsx(kt,{id:H,children:U})]})}),un=m.createContext(void 0);function fn(){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 dn(e){const{value:n,children:t}=e;return G.jsx(un.Provider,{value:n,children:t})}const pn={...Ht,...pt},Rn=m.forwardRef(function(n,t){const{render:l,className:i,style:o,initialFocus:p,finalFocus:E,...S}=n,{store:c}=re(),r=ln(),O=Ut()!=null,{context:h,hasClosePart:j}=fn(),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"),H=c.useState("modal"),v=c.useState("mounted"),P=c.useState("openChangeReason"),b=c.useState("activeTriggerElement"),M=c.useState("floatingRootContext"),_=M.useState("floatingId"),V=c.useState("disabled"),X=c.useState("openOnHover"),N=c.useState("closeDelay"),w=S.id??_;ft({open:u,ref:c.context.popupRef,onComplete(){u&&c.context.onOpenChangeComplete?.(!0)}}),Jt(M,{enabled:X&&!V,closeDelay:N});const s=p===void 0?wt(c.context.popupRef):p,T=H!==!1&&j;c.useSyncedValue("focusManagerModal",T);const L=m.useCallback(A=>{c.set("popupElement",A)},[c]),R={open:u,side:r.side,align:r.align,instant:g,transitionStatus:x},f=Le("div",n,{state:R,ref:[t,c.context.popupRef,L],props:[a,{id:w,role:"dialog",...Be,"aria-labelledby":d,"aria-describedby":F,onKeyDown(A){O&&At.has(A.key)&&A.stopPropagation()}},Kt(x),S],stateAttributesMapping:pn});return G.jsx(Lt,{context:M,openInteractionType:B,modal:T,disabled:!v||P===W,initialFocus:s,returnFocus:E,restoreFocus:"popup",previousFocusableElement:dt(b)?b:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:G.jsx(dn,{value:h,children:f})})});export{Tn as C,vn as P,Cn as a,Pn as b,bn as c,Rn as d};
1
+ import{k as Xe,aO as Ue,bt as Ke,bu as le,bv as We,K as ne,aN as ge,r as m,bw as $,bx as me,by as he,bz as oe,aK as be,bA as qe,bB as we,aL as z,aI as Q,bC as W,Y as ue,aD as pe,aM as ze,bD as Ee,bE as Je,bF as Qe,bG as $e,bH as Te,aB as q,j as Y,aJ as Ze,aC as Me,aS as et,bI as tt,bJ as nt,bK as ot,bL as st,aP as rt,y as Le,bM as it,bN as ye,aG as at,bO as ct,bP as lt,aH as ut,aF as ft,bQ as dt,aE as pt}from"./__vite-browser-external-Eoyj4eG-.js";import{n as Pe,o as Ae,q as He,r as ve,v as se,P as gt,w as mt,k as ht,s as Et,x as Tt,y as Pt,e as vt,f as Ct,g as bt,h as Rt,a as Be,j as St,u as Ot,z as It,A as Mt,t as yt,B as xt,I as Ft,D as kt,c as wt,d as Lt,b as At,p as Ht}from"./useScrollLock-C2C-Yazq.js";import{f as Bt,p as Dt,g as Nt}from"./DialogTitle-z86PHHyk.js";import{r as _t,t as jt,v as Yt,w as Gt,x as Vt,y as Xt,z as Ut,A as Kt}from"./SelectItemText-CCW6JeeN.js";const Wt=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Tn=Xe("chevron-right",Wt);function qt(e,n){return n!=null&&!Pe(n)?0:typeof e=="function"?e():e}function Ce(e,n,t){const l=qt(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 _e(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 Jt(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=He(),h=_e(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()&&$(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 H=h.pointerEventsScopeElement!==a?h.pointerEventsScopeElement:null,P=F!==a?F:null,C=h.handleCloseOptions?.getScope?.()??H??P??x.closest("[data-rootownerid]")??d.body;return Ne(h,{scopeElement:C,referenceElement:x,floatingElement:a}),()=>{g()}}},[t,p,S,E,h,B,r,O,g]),m.useEffect(()=>{if(!t)return;function x(){return!!(r&&O&&ve(r.nodesRef.current,O).length>0)}function a(b){const M=Ce(l,"close",h.pointerType),N=()=>{o.setOpen(!1,Q(W,b)),r?.events.emit("floating.closed",b)};M?h.openChangeTimeout.start(M,N):(h.openChangeTimeout.clear(),N())}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",P),g()}function H(b){if(x()&&r){r.events.on("floating.closed",P);return}if(we(b.relatedTarget,o.context.triggerElements))return;const M=c.current.floatingContext?.nodeId??i,N=b.relatedTarget;if(!(r&&M&&$(N)&&ve(r.nodesRef.current,M,!1).some(X=>z(X.context?.elements.floating,N)))){if(h.handler){h.handler(b);return}g(),B()&&!u()&&a(b)}}function P(b){!r||!O||x()||j.start(0,()=>{r.events.off("floating.closed",P),o.setOpen(!1,Q(W,b)),r.events.emit("floating.closed",b)})}const C=E;return he(C&&oe(C,"mouseenter",F),C&&oe(C,"mouseleave",H),C&&oe(C,"pointerdown",d,!0),()=>{r?.events.off("floating.closed",P)})},[t,E,o,c,l,i,B,u,g,h,r,O,j])}const Qt={current:null};function $t(e,n={}){const{enabled:t=!0,delay:l=0,handleClose:i=null,mouseOnly:o=!1,restMs:p=0,move:E=!0,triggerElementRef:S=Qt,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=_e(u),d=m.useRef(!1),F=se(i),H=se(l),P=se(p),C=se(t),b=se(j),M=se(h),N=ne(()=>De(B.current.openEvent?.type,a.interactedInside)),V=ne(()=>b.current?.()!==!1),X=ne((s,T,L)=>{const R=u.context.triggerElements;if(R.hasElement(T))return!s||!z(s,T);if(!$(L))return!1;const f=L;return R.hasMatchingElement(A=>z(A,f))&&(!s||!z(s,f))}),_=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(()=>_,[_]),m.useEffect(()=>{if(!t)return;function s(T){T.open?d.current=!1:(d.current=T.reason===W,_(),a.openChangeTimeout.clear(),a.restTimeout.clear(),a.blockMouseMove=!0,a.restTimeoutPending=!1)}return g.on("openchange",s),()=>{g.off("openchange",s)}},[t,g,a,_]),m.useEffect(()=>{if(!t)return;function s(f,A=!0){const D=Ce(H.current,"close",a.pointerType);D?a.openChangeTimeout.start(D,()=>{u.setOpen(!1,Q(W,f)),x?.events.emit("floating.closed",f)}):A&&(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(!$(T))return;function L(f){if(a.openChangeTimeout.clear(),a.blockMouseMove=!1,o&&!Pe(a.pointerType))return;const A=xe(P.current),D=Ce(H.current,"open",a.pointerType),G=be(f),U=f.currentTarget??null,I=u.select("domReferenceElement");let k=U;if($(G)&&!u.context.triggerElements.hasElement(G)){for(const Ie of u.context.triggerElements.elements())if(z(Ie,G)){k=Ie;break}}$(U)&&$(I)&&!u.context.triggerElements.hasElement(U)&&z(U,I)&&(k=I);const v=k==null?!1:X(I,k,G),J=u.select("open"),Z=M.current?.()??u.select("transitionStatus")==="ending",K=!J&&Z&&d.current,ee=!v&&$(k)&&$(I)&&z(I,k)&&K,te=A>0&&!D,Ve=v&&(J||K)||ee,Oe=!J||v;if(Ve){V()&&u.setOpen(!0,Q(W,f,k));return}te||(D?a.openChangeTimeout.start(D,()=>{Oe&&V()&&u.setOpen(!0,Q(W,f,k))}):Oe&&V()&&u.setOpen(!0,Q(W,f,k)))}function R(f){if(N()){w();return}_();const A=u.select("domReferenceElement"),D=me(A);a.restTimeout.clear(),a.restTimeoutPending=!1;const G=B.current.floatingContext??O?.();if(we(f.relatedTarget,u.context.triggerElements))return;if(F.current&&G){u.select("open")||a.openChangeTimeout.clear();const I=S.current;a.handler=F.current({...G,tree:x,x:f.clientX,y:f.clientY,onClose(){w(),_(),C.current&&!N()&&I===u.select("domReferenceElement")&&s(f,!0)}}),D.addEventListener("mousemove",a.handler),a.handler(f);return}(a.pointerType!=="touch"||!z(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))},[_,w,B,H,u,t,F,a,r,X,N,o,E,P,S,x,C,O,M,V]),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"),A=u.select("open"),D=X(f,R,T.target);if(o&&!Pe(a.pointerType))return;if(A&&D&&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 G=xe(P.current);if(A&&!D||G===0||!D&&a.restTimeoutPending&&T.movementX**2+T.movementY**2<2)return;a.restTimeout.clear();function U(){if(a.restTimeoutPending=!1,N())return;const I=u.select("open");!a.blockMouseMove&&(!I||D)&&V()&&u.setOpen(!0,Q(W,L,R))}a.pointerType==="touch"?ue.flushSync(()=>{U()}):D&&A?U():(a.restTimeoutPending=!0,a.restTimeout.start(G,U))}}},[t,a,N,X,o,u,P,V])}const Fe=.1,Zt=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 en(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 tn(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(),H=F-B;if(j===null||u===null||H===0)return j=a,u=d,B=F,!1;const P=a-j,C=d-u,b=P*P+C*C,M=H*H*Zt;return j=a,u=d,B=F,b<M}function x(){t.clear(),S()}return function(d){t.clear();const F=E.domReference,H=E.floating;if(!F||!H||O==null||i==null||o==null)return;const{clientX:P,clientY:C}=d,b=be(d),M=d.type==="mouseleave",N=z(H,b),V=z(F,b);if(N&&(h=!0,!M))return;if(V&&(h=!1,!M)){h=!0;return}if(M&&$(d.relatedTarget)&&z(H,d.relatedTarget))return;function X(){return!!(r&&ve(r.nodesRef.current,c).length>0)}function _(){X()||x()}if(X())return;const w=F.getBoundingClientRect(),s=H.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,A=(R?w:s).left,D=(R?w:s).right,G=(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){_();return}let I=!1;switch(O){case"top":I=ce(P,C,A,w.top+1,D,s.bottom-1);break;case"bottom":I=ce(P,C,A,s.top+1,D,w.bottom-1);break;case"left":I=ce(P,C,s.right-1,U,w.left+1,G);break;case"right":I=ce(P,C,w.right-1,U,s.left+1,G);break}if(I)return;if(h&&!en(P,C,w)){_();return}if(!M&&g(P,C)){_();return}let k=!1;switch(O){case"top":{const v=R?y/2:y*4,J=R||T?i+v:i-v,Z=R?i-v:T?i+v:i-v,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(P,C,J,K,Z,K,s.left,ee,s.right,te);break}case"bottom":{const v=R?y/2:y*4,J=R||T?i+v:i-v,Z=R?i-v:T?i+v:i-v,K=o-y,ee=T||R?s.top+y:s.bottom,te=T?R?s.top+y:s.bottom:s.top+y;k=ae(P,C,J,K,Z,K,s.left,ee,s.right,te);break}case"left":{const v=f?y/2:y*4,J=f||L?o+v:o-v,Z=f?o-v:L?o+v:o-v,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(P,C,ee,s.top,te,s.bottom,K,J,K,Z);break}case"right":{const v=f?y/2:y*4,J=f||L?o+v:o-v,Z=f?o-v:L?o+v:o-v,K=i-y,ee=L||f?s.left+y:s.right,te=L?f?s.left+y:s.right:s.left+y;k=ae(P,C,K,J,K,Z,ee,s.top,te,s.bottom);break}}k?h||t.start(40,_):_()}};return l.__options={...e,blockPointerEvents:n},l}const je=m.createContext(void 0);function re(e){const n=m.useContext(je);if(n===void 0&&!e)throw new Error(pe(47));return n}function nn(){return{...Nt(),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 on={...Dt,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 ze{constructor(n,t,l=!1){const i={...nn(),...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},on)}setOpen=(n,t)=>{const l=t.reason===W,i=t.reason===Ee&&t.event.detail===0,o=!n&&(t.reason===Je||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($e,()=>{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});Pt(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=He()!=null;r.useContextCallback("onOpenChange",i),r.useContextCallback("onOpenChangeComplete",o),vt(r,O),Ct(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(je.Provider,{value:a,children:[x&&Y.jsx(sn,{store:r,modal:p}),typeof n=="function"?n({payload:j}):n]})}function Pn(e){return re(!0)?Y.jsx(ke,{props:e}):Y.jsx(Tt,{children:Y.jsx(ke,{props:e})})}function sn({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(Be,l.floating),[l.floating]);return St(e,{activeTriggerProps:i,inactiveTriggerProps:o,popupProps:p}),null}const rn=300;function an(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&&z(p,E);){const S=E;if(E=ot(E),E===S)break}E?.focus()}}return{preFocusGuardRef:t,handlePreFocusGuardFocus:l,handleFocusTargetFocus:i}}const vn=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=rn,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),H=g.useState("triggerPopupId",x),P=m.useRef(null),{registerTrigger:C,isMountedByThisTrigger:b}=It(x,P,g,{payload:c,disabled:p,openOnHover:r,closeDelay:h}),M=g.useState("openChangeReason"),N=g.useState("stickIfOpen"),V=g.useState("openMethod"),X=g.useState("focusManagerModal"),_=$t(d,{enabled:!p&&d!=null&&r&&(V!=="touch"||M!==Ee),mouseOnly:!0,move:!1,handleClose:tn(),restMs:O,delay:{close:h},triggerElementRef:P,isActiveTrigger:a,isClosing:()=>g.select("transitionStatus")==="ending"}),w=_t(d,{enabled:d!=null,stickIfOpen:N}),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:A,handlePreFocusGuardFocus:D,handleFocusTargetFocus:G}=an(g,P),I=Le("button",n,{state:{disabled:p,open:F},ref:[R,t,C,P],props:[w.reference,_,T,s,{[it]:"",id:x,"aria-haspopup":"dialog","aria-expanded":F,"aria-controls":H},u,L],stateAttributesMapping:f});return b&&!X?Y.jsxs(m.Fragment,{children:[Y.jsx(ye,{ref:A,onFocus:D}),Y.jsx(m.Fragment,{children:I},x),Y.jsx(ye,{ref:g.context.triggerFocusTargetRef,onFocus:G})]}):Y.jsx(m.Fragment,{children:I},x)}),Ye=m.createContext(void 0);function cn(){const e=m.useContext(Ye);if(e===void 0)throw new Error(pe(45));return e}const Cn=m.forwardRef(function(n,t){const{keepMounted:l=!1,...i}=n,{store:o}=re();return o.useState("mounted")||l?Y.jsx(Ye.Provider,{value:l,children:Y.jsx(at,{ref:t,...i})}):null}),Ge=m.createContext(void 0);function ln(){const e=m.useContext(Ge);if(!e)throw new Error(pe(46));return e}const bn=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=cn(),H=xt(),P=d.useState("floatingRootContext"),C=d.useState("mounted"),b=d.useState("open"),M=d.useState("openChangeReason"),N=d.useState("activeTriggerElement"),V=d.useState("modal"),X=d.useState("openMethod"),_=d.useState("positionerElement"),w=d.useState("instantType"),s=d.useState("transitionStatus"),T=d.useState("hasViewport"),L=m.useRef(null),R=lt(_,!1,!1),f=Yt({anchor:p,floatingRootContext:P,positionMethod:E,mounted:C,side:S,sideOffset:r,align:c,alignOffset:O,arrowPadding:u,collisionBoundary:h,collisionPadding:j,sticky:B,disableAnchorTracking:g,keepMounted:F,nodeId:H,collisionAvoidance:x,adaptiveOrigin:T?Xt:void 0}),A=P.useState("domReferenceElement");ge(()=>{const I=A,k=L.current;if(I&&(L.current=I),k&&I&&I!==k){d.set("instantType",void 0);const v=new AbortController;return R(()=>{d.set("instantType","trigger-change")},v.signal),()=>{v.abort()}}},[A,R,d]),Gt(b&&V===!0&&M!==W,X==="touch",_,N);const D=m.useCallback(I=>{d.set("positionerElement",I)},[d]),G={open:b,side:f.side,align:f.align,anchorHidden:f.anchorHidden,instant:w},U=Vt(n,G,{styles:f.positionerStyles,transitionStatus:s,props:a,refs:[t,D],hidden:!C,inert:!b});return Y.jsxs(Ge.Provider,{value:f,children:[C&&V===!0&&M!==W&&Y.jsx(Ft,{ref:d.context.internalBackdropRef,inert:ut(!b),cutout:N}),Y.jsx(kt,{id:H,children:U})]})}),un=m.createContext(void 0);function fn(){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 dn(e){const{value:n,children:t}=e;return Y.jsx(un.Provider,{value:n,children:t})}const pn={...Ht,...pt},Rn=m.forwardRef(function(n,t){const{render:l,className:i,style:o,initialFocus:p,finalFocus:E,...S}=n,{store:c}=re(),r=ln(),O=Ut()!=null,{context:h,hasClosePart:j}=fn(),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"),H=c.useState("modal"),P=c.useState("mounted"),C=c.useState("openChangeReason"),b=c.useState("activeTriggerElement"),M=c.useState("floatingRootContext"),N=M.useState("floatingId"),V=c.useState("disabled"),X=c.useState("openOnHover"),_=c.useState("closeDelay"),w=S.id??N;ft({open:u,ref:c.context.popupRef,onComplete(){u&&c.context.onOpenChangeComplete?.(!0)}}),Jt(M,{enabled:X&&!V,closeDelay:_});const s=p===void 0?wt(c.context.popupRef):p,T=H!==!1&&j;c.useSyncedValue("focusManagerModal",T);const L=m.useCallback(A=>{c.set("popupElement",A)},[c]),R={open:u,side:r.side,align:r.align,instant:g,transitionStatus:x},f=Le("div",n,{state:R,ref:[t,c.context.popupRef,L],props:[a,{id:w,role:"dialog",...Be,"aria-labelledby":d,"aria-describedby":F,onKeyDown(A){O&&At.has(A.key)&&A.stopPropagation()}},Kt(x),S],stateAttributesMapping:pn});return Y.jsx(Lt,{context:M,openInteractionType:B,modal:T,disabled:!P||C===W,initialFocus:s,returnFocus:E,restoreFocus:"popup",previousFocusableElement:dt(b)?b:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:Y.jsx(dn,{value:h,children:f})})});export{Tn as C,Pn as P,vn as a,Cn as b,bn as c,Rn as d};
@@ -0,0 +1 @@
1
+ import{d,e as m,r as t,j as e,L as l,c as o,f as x}from"./__vite-browser-external-Eoyj4eG-.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,N as l,O as w,w as k,j as e,b as x}from"./__vite-browser-external-CxN2E6q5.js";import{u as j,a as N,s as i,L as C,b as E,S as I,c as R,d as T,C as L,e as A,f as P,g as O,h as _,i as D,j as G}from"./SelectItemText-Bz8FAKEv.js";import{C as M}from"./check-CkI3WNti.js";const V=v.forwardRef(function(t,s){const{render:n,className:f,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]})}),z="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:f,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:f,"aria-label":n,className:x(z,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(L,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]}),e.jsx(A,{children:e.jsx(P,{align:g,side:"bottom",sideOffset:4,className:"z-50",children:e.jsx(O,{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(V,{role:"listbox","aria-label":n,children:s.map(a=>e.jsxs(_,{value:a.value,disabled:a.disabled,className:({selected:p,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",p?"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(D,{children:e.jsx(M,{className:"h-3 w-3","aria-hidden":!0})})}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.jsx(G,{children:a.label})})]},String(a.value)))})})})})]})}export{U as S};
1
+ import{r as v,J as l,K as w,y as k,j as e,b as x}from"./__vite-browser-external-Eoyj4eG-.js";import{u as j,a as N,s as i,L as C,b as E,S as I,c as R,d as T,C as L,e as A,f as P,g as _,h as D,i as G,j as M}from"./SelectItemText-CCW6JeeN.js";import{C as O}from"./check-B87_qvAg.js";const V=v.forwardRef(function(t,s){const{render:n,className:f,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]})}),z="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 J({value:y,onValueChange:t,options:s=[],ariaLabel:n,id:f,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:f,"aria-label":n,className:x(z,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(L,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]}),e.jsx(A,{children:e.jsx(P,{align:g,side:"bottom",sideOffset:4,className:"z-50",children:e.jsx(_,{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(V,{role:"listbox","aria-label":n,children:s.map(a=>e.jsxs(D,{value:a.value,disabled:a.disabled,className:({selected:p,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",p?"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(G,{children:e.jsx(O,{className:"h-3 w-3","aria-hidden":!0})})}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.jsx(M,{children:a.label})})]},String(a.value)))})})})})]})}export{J as S};