tokentracker-cli 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/dashboard/dist/.well-known/submitby-ai/6e2fa70e-9eb2-4c97-a9a9-fed567a3d4a9.txt +1 -0
- package/dashboard/dist/assets/AchievementBadge-mB7HZSGE.js +1 -0
- package/dashboard/dist/assets/{AchievementsPage-9_MxdI7O.js → AchievementsPage-DLzeq_eo.js} +2 -2
- package/dashboard/dist/assets/{AchievementsSection-CKDQGcJh.js → AchievementsSection-DrXQyDns.js} +1 -1
- package/dashboard/dist/assets/{BadgeDetailModal-DdrXPVRL.js → BadgeDetailModal-WrgKRybi.js} +1 -1
- package/dashboard/dist/assets/{BotAnimated-DsJDdDid.js → BotAnimated-DFRaixVK.js} +1 -1
- package/dashboard/dist/assets/{Card-Bz-sWY1C.js → Card-bFq2tlO8.js} +1 -1
- package/dashboard/dist/assets/{CloudCheckoutPage-DRjZcE0W.js → CloudCheckoutPage-gwhGxavy.js} +1 -1
- package/dashboard/dist/assets/{CloudPage-BNDyyX9r.js → CloudPage-BD4iBYeZ.js} +2 -2
- package/dashboard/dist/assets/{CommandPalette-LbE6Icc0.js → CommandPalette-C_KlPl0U.js} +1 -1
- package/dashboard/dist/assets/{CommunityStatsModal-DuEcAOB9.js → CommunityStatsModal-Cl1Bgv8M.js} +1 -1
- package/dashboard/dist/assets/{ConfirmModal-B5V7ONKv.js → ConfirmModal-NWoYevYC.js} +1 -1
- package/dashboard/dist/assets/{Controls-ZfN0QwwD.js → Controls-D2-D2cfA.js} +1 -1
- package/dashboard/dist/assets/{DashboardPage-DqZPFmlv.js → DashboardPage-vITMnPXx.js} +1 -1
- package/dashboard/dist/assets/{DateRangePopover-CbkBeaEI.js → DateRangePopover-8EMVXuH6.js} +1 -1
- package/dashboard/dist/assets/{DevicePage-DrHjmpPH.js → DevicePage-DbP8d6bM.js} +1 -1
- package/dashboard/dist/assets/{DialogClose-DHaAwV1u.js → DialogClose-CEstgLa1.js} +1 -1
- package/dashboard/dist/assets/DialogDescription-0wcygxtH.js +1 -0
- package/dashboard/dist/assets/{DialogTitle-CBhd4oLc.js → DialogTitle-DP5TLLbz.js} +1 -1
- package/dashboard/dist/assets/{ElectricLogo-CSWd3b2H.js → ElectricLogo-Uvi3yMum.js} +1 -1
- package/dashboard/dist/assets/{FadeIn-D5p6nDla.js → FadeIn-Dpzihg6f.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-BKVSzY27.js → HeaderGithubStar-DllqemKr.js} +1 -1
- package/dashboard/dist/assets/{HoverTooltip-CvkAyCDm.js → HoverTooltip-Dc-TAH6l.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-BEMJGKtl.js → IpCheckPage-jd1D5ZKX.js} +1 -1
- package/dashboard/dist/assets/{LandingPage-iRp33enQ.js → LandingPage-CB1ZVw-a.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardPage-DVMPrN4z.js → LeaderboardPage-Bt2cRRmE.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardProBadge-DwnaJoje.js → LeaderboardProBadge-BVlyVOFf.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardProfileModal-DnzVweLM.js → LeaderboardProfileModal-CwQFRJg_.js} +3 -3
- package/dashboard/dist/assets/{LeaderboardProfilePage-BHNuPuW7.js → LeaderboardProfilePage-CeqcTbUG.js} +1 -1
- package/dashboard/dist/assets/{LimitsPage-9LitacBf.js → LimitsPage-Bp4ZORmR.js} +6 -6
- package/dashboard/dist/assets/{LocalOnlyNotice-DStlbPET.js → LocalOnlyNotice-B2_HoCVD.js} +1 -1
- package/dashboard/dist/assets/{LoginCard-I47ukXU5.js → LoginCard-nw9JOc2d.js} +1 -1
- package/dashboard/dist/assets/{LoginModal-C4iotNjY.js → LoginModal-BHNLTK1D.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-46QSEnG0.js → LoginPage-LI2GZKhM.js} +1 -1
- package/dashboard/dist/assets/{PetPage-SvgDUR8o.js → PetPage-CK6sPeI0.js} +2 -2
- package/dashboard/dist/assets/{PopoverPopup-k2ejLK1I.js → PopoverPopup-BsXchEVa.js} +1 -1
- package/dashboard/dist/assets/{ProviderIcon-Bx1XKzin.js → ProviderIcon-vgCEy0dh.js} +1 -1
- package/dashboard/dist/assets/{ResetPasswordPage-CcKIDknp.js → ResetPasswordPage-B4CPj2vX.js} +1 -1
- package/dashboard/dist/assets/{Select-D0hLQyU8.js → Select-BkAy6P2r.js} +1 -1
- package/dashboard/dist/assets/{SelectItemText-DJGBJhDK.js → SelectItemText-C0RNqDrD.js} +1 -1
- package/dashboard/dist/assets/{SelfHostPage-CeIFGRep.js → SelfHostPage-B-_w-Z-a.js} +1 -1
- package/dashboard/dist/assets/{ServiceStatusPage-DMtw0YDh.js → ServiceStatusPage-5YevsGGD.js} +1 -1
- package/dashboard/dist/assets/{SessionsPage-D6h5vSZn.js → SessionsPage-CmWXBqD2.js} +1 -1
- package/dashboard/dist/assets/{SettingsPage-BZgpB5SB.js → SettingsPage-CA70zP-t.js} +3 -3
- package/dashboard/dist/assets/{SkillsPage-CtFuZ1ob.js → SkillsPage-CNamhfzU.js} +1 -1
- package/dashboard/dist/assets/{TokenGalaxy-DC-no047.js → TokenGalaxy-CXrVBSk6.js} +1 -1
- package/dashboard/dist/assets/{TooltipPopup-ZM0Ie2_C.js → TooltipPopup-CR4MqElX.js} +1 -1
- package/dashboard/dist/assets/{TrendMonitor-fpLaqJ-o.js → TrendMonitor-DQfcrEve.js} +1 -1
- package/dashboard/dist/assets/{WidgetsPage-DIoHY6ZJ.js → WidgetsPage-BBXxtZbP.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-D1-7o8Z1.js → WrappedPage-C8i2KlMF.js} +1 -1
- package/dashboard/dist/assets/{__vite-browser-external-DZF5L1pt.js → __vite-browser-external-BEEzY7mq.js} +2 -2
- package/dashboard/dist/assets/{agent-logos-YBC1iAbE.js → agent-logos-CxQb8vir.js} +1 -1
- package/dashboard/dist/assets/{arrow-left-BIe3z7iW.js → arrow-left-D6zkcLVt.js} +1 -1
- package/dashboard/dist/assets/{arrow-right-CJmRcvYZ.js → arrow-right-BGb-XVn_.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-IgkBHoCl.js → arrow-up-right-XTStagDJ.js} +1 -1
- package/dashboard/dist/assets/{calendar-days-DTuIv3ts.js → calendar-days-Cz3NGZiS.js} +1 -1
- package/dashboard/dist/assets/{check-DrXhhj46.js → check-1z_vmHPD.js} +1 -1
- package/dashboard/dist/assets/{chevron-down-DHaFKHMK.js → chevron-down-CkSBY3bE.js} +1 -1
- package/dashboard/dist/assets/{cloud-checkout-BffVMyzI.js → cloud-checkout-pD5C4r_S.js} +1 -1
- package/dashboard/dist/assets/{composite-M_CP_KSx.js → composite-BtDzx3a2.js} +1 -1
- package/dashboard/dist/assets/{copy-D5xoS-Q8.js → copy-Ctv_wxuD.js} +1 -1
- package/dashboard/dist/assets/{download-CqomMv4-.js → download-DKbKMGSR.js} +1 -1
- package/dashboard/dist/assets/{external-link--q3pCw6b.js → external-link-g9cU017t.js} +1 -1
- package/dashboard/dist/assets/{flame-CUGlDV__.js → flame-DZq3kXUt.js} +1 -1
- package/dashboard/dist/assets/{format-tokens-BZ6TX9Km.js → format-tokens-CXQfx0PC.js} +1 -1
- package/dashboard/dist/assets/{gift-BBgOeC20.js → gift-CKlKjGP6.js} +1 -1
- package/dashboard/dist/assets/{icons-BELeB4ms.js → icons-xPGMnBjl.js} +1 -1
- package/dashboard/dist/assets/{index-CsdgnKGf.js → index-BwOjMtB2.js} +1 -1
- package/dashboard/dist/assets/{index-CoRqgJ71.js → index-CDBOKcDh.js} +1 -1
- package/dashboard/dist/assets/{index-DkBvk4Qg.js → index-Dl0oFLNr.js} +33 -33
- package/dashboard/dist/assets/{index-B1B6oAbl.js → index-fVbP5wOv.js} +1 -1
- package/dashboard/dist/assets/{info-BG1vQZ1r.js → info-D9xNIuGh.js} +1 -1
- package/dashboard/dist/assets/{link-2-oi5TrXqi.js → link-2-Bk5wYt2n.js} +1 -1
- package/dashboard/dist/assets/{loader-circle-BQQ_Xbby.js → loader-circle-CcN3pHWb.js} +1 -1
- package/dashboard/dist/assets/{local-usage-transfer-Dwz-clJ-.js → local-usage-transfer-CYcy1ici.js} +1 -1
- package/dashboard/dist/assets/{modifiers.esm-C7a817l7.js → modifiers.esm-DbpEzkJe.js} +1 -1
- package/dashboard/dist/assets/module-ZyVsxBG_.js +3 -0
- package/dashboard/dist/assets/{monitor-smartphone-Bnbo7uRg.js → monitor-smartphone-WkWv1qIS.js} +1 -1
- package/dashboard/dist/assets/{play-C_xI_JM_.js → play-2yZGWMes.js} +1 -1
- package/dashboard/dist/assets/{plus-xF6PK5As.js → plus-mOF8tG1F.js} +1 -1
- package/dashboard/dist/assets/{provider-display-DxquW3js.js → provider-display-7gaOvgMp.js} +1 -1
- package/dashboard/dist/assets/{react-CGK0_x3G.js → react-CdPiPDhk.js} +1 -1
- package/dashboard/dist/assets/{safePolygon-CCoDMR4f.js → safePolygon-C7FJLAlh.js} +1 -1
- package/dashboard/dist/assets/{search-EZAGpmfJ.js → search-C63nCrjo.js} +1 -1
- package/dashboard/dist/assets/{server-2qbrx2G0.js → server-BaG1rnuv.js} +1 -1
- package/dashboard/dist/assets/{shield-check-D8kUejpE.js → shield-check-D_4-Cm6L.js} +1 -1
- package/dashboard/dist/assets/{skills-api-DYPf1Vxh.js → skills-api-DfbzwpDv.js} +1 -1
- package/dashboard/dist/assets/{sortable.esm-D9gC08dQ.js → sortable.esm-D-v8FRX5.js} +1 -1
- package/dashboard/dist/assets/{store-BWUCbK6Y.js → store-Dv_FYrXK.js} +1 -1
- package/dashboard/dist/assets/{terminal-B16b7r6H.js → terminal-FQi6MaYt.js} +1 -1
- package/dashboard/dist/assets/{trash-BIEoE13C.js → trash-TbK96dEz.js} +1 -1
- package/dashboard/dist/assets/use-community-stats-DGoWVZuk.js +1 -0
- package/dashboard/dist/assets/{use-latest-request-guard-CYKu-VOB.js → use-latest-request-guard-Dg6uSaYt.js} +1 -1
- package/dashboard/dist/assets/{use-limits-display-prefs-CEAjVxFr.js → use-limits-display-prefs-Djbdp7fi.js} +1 -1
- package/dashboard/dist/assets/{use-native-settings-vTg4j5Ln.js → use-native-settings-DIk0AF3b.js} +1 -1
- package/dashboard/dist/assets/{use-ordered-list-CtXedlqH.js → use-ordered-list-CUqV3Zgl.js} +1 -1
- package/dashboard/dist/assets/use-reduced-motion-DMCok-vZ.js +1 -0
- package/dashboard/dist/assets/{use-transform-CdeW5xhz.js → use-transform-D_-w22c8.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-DmDa5Py8.js → use-usage-limits-h7aGsIQr.js} +1 -1
- package/dashboard/dist/assets/{useCurrency-bqycM681.js → useCurrency-B_AuLCsL.js} +1 -1
- package/dashboard/dist/assets/{usePositioner-DEXS10fY.js → usePositioner-DfxvIif8.js} +1 -1
- package/dashboard/dist/assets/{useTokenFormat-YF6hY8_m.js → useTokenFormat-bbO13V4s.js} +1 -1
- package/dashboard/dist/assets/{zap-Dg-ij-lq.js → zap-k07-EXTK.js} +1 -1
- package/dashboard/dist/index.html +20 -1
- package/dashboard/dist/indexnow-key.txt +1 -0
- package/dashboard/dist/ip-check.html +1 -1
- package/dashboard/dist/leaderboard.html +1 -1
- package/dashboard/dist/share.html +1 -1
- package/dashboard/dist/tt6a1c9e2f4b8d.txt +1 -0
- package/package.json +3 -3
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/src/lib/qoder-limits.js +178 -38
- package/dashboard/dist/assets/AchievementBadge-Dn39pyx9.js +0 -1
- package/dashboard/dist/assets/DialogDescription-CEY6jbs9.js +0 -1
- package/dashboard/dist/assets/module-C2SOSUuR.js +0 -3
- package/dashboard/dist/assets/use-community-stats-DWS7YKbM.js +0 -1
- package/dashboard/dist/assets/use-reduced-motion-DVLsAhSA.js +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{o as te,j as e,y as $e,c as r,h as B,r as
|
|
2
|
-
`)}const st=Ot,De=[1,.65,.45,.3,.2];function ke(t){return De[Math.min(t,De.length-1)]}function Ee({paceX:t,paceOver:a}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"absolute top-0 h-full bg-oai-gray-100 dark:bg-oai-gray-700/50",style:{left:`calc(${t}% - 3px)`,width:"6px"}}),e.jsx("div",{className:`absolute top-0 h-full ${a?"bg-red-500":"bg-emerald-500"}`,style:{left:`calc(${t}% - 1px)`,width:"2px"}})]})}function xa({label:t,pct:a,reset:i,mode:s=_.USED,pacePercent:n=null,paceOver:o=!1,title:l=null,segments:c=null}){const d=Math.max(0,Math.min(100,Number(a)||0)),m=s===_.REMAINING?100-d:d,u=rt(m,s),p=Math.round(m),v=m>0&&p===0?Math.max(m,.35):m;let h=String(p);m>0&&p===0&&(h=r("limits.bar.sub_one_percent"));const f=n==null?null:Math.max(0,Math.min(100,n)),S=c?.map(w=>Math.max(0,Math.min(100,Number(w.pct)||0))),k=S?.reduce((w,E)=>w+E,0)||0,M=c?Math.max(0,d-k):0,j=Math.max(0,100-k-M);return e.jsxs("div",{className:"group relative flex items-center gap-2",children:[e.jsx(st,{text:l}),e.jsx("span",{"data-limit-label":"",className:"text-xs sm:text-sm text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:t}),c?e.jsxs("div",{"data-limit-segments":"",className:"relative flex min-w-0 flex-1 h-1.5 overflow-hidden",style:{gap:"min(2px, 1%)"},children:[c.map((w,E)=>e.jsx("div",{"data-limit-segment":w.key,className:`${u} min-w-0 rounded-full h-full transition-[flex-grow] duration-500 ease-out`,style:{flex:`${S[E]} 1 0px`,opacity:ke(E)}},w.key)),M?e.jsx("div",{"data-limit-unallocated-used":"",className:`${u} min-w-0 rounded-full h-full`,style:{flex:`${M} 1 0px`,opacity:ke(c.length)}}):null,j?e.jsx("div",{"data-limit-remainder":"",className:"min-w-0 rounded-full h-full bg-oai-gray-100 dark:bg-oai-gray-700/50",style:{flex:`${j} 1 0px`}}):null,f!=null&&e.jsx(Ee,{paceX:f,paceOver:o})]}):e.jsxs("div",{className:"relative min-w-0 flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:[e.jsx("div",{className:`${u} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${v}%`,minWidth:m>0?"3px":0}}),f!=null&&e.jsx(Ee,{paceX:f,paceOver:o})]}),e.jsxs("span",{className:"text-xs sm:text-sm tabular-nums text-oai-gray-600 dark:text-oai-gray-300 w-11 text-right shrink-0 whitespace-nowrap",children:[h,"%"]}),i&&e.jsx("span",{className:"text-xs tabular-nums text-oai-gray-400 dark:text-oai-gray-500 w-8 text-right shrink-0",children:i})]})}function pa({segments:t,fillColor:a}){return e.jsx("div",{"data-limit-legend":"",className:"-mt-0.5 flex flex-wrap gap-x-3 gap-y-0.5 text-[11px] leading-snug",style:{paddingLeft:"calc(var(--tt-limits-label-w, 0px) + 0.5rem)"},children:t.map((i,s)=>e.jsxs("span",{className:"inline-flex items-center gap-1 whitespace-nowrap",children:[e.jsx("span",{"aria-hidden":!0,className:`${a} inline-block h-1.5 w-1.5 shrink-0 rounded-full`,style:{opacity:ke(s)}}),e.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:i.label??r(i.labelKey)}),e.jsxs("span",{className:"tabular-nums text-oai-gray-700 dark:text-oai-gray-200",children:[ie(i.pct),"%"]})]},i.key))})}function ot(t,a,i){const s=t.label??r(t.labelKey),n=i===_.REMAINING,o=d=>n?100-d:d;if(a.expectedPercent==null){const d=Math.max(0,Math.min(100,Number(de(t.window,t.pctField))||0)),m=ie(o(d));return n?r("limits.explain.remaining",{label:s,used:m}):r("limits.explain.used",{label:s,used:m})}if(a.paceOver){if(a.runsOutEta)return r("limits.explain.ahead_eta",{label:s,eta:a.runsOutEta});const d=ie(o(a.projectedEnd??100));return r(n?"limits.explain.ahead_pct_remaining":"limits.explain.ahead_pct",{label:s,pct:d})}const l=Math.max(0,Math.min(100,Number(de(t.window,t.pctField))||0)),c=ie(o(a.projectedEnd??l));return r(n?"limits.explain.on_track_remaining":"limits.explain.on_track",{label:s,pct:c})}function lt({pace:t}){return t.pacePercent!=null}function ga(t,a){return t.some(i=>lt(i)&&(i.mode??a)===_.REMAINING)}function ct({rows:t,mode:a,now:i=Date.now()}){if(t.length===0)return null;const s=ga(t,a),n=t.some(lt);return e.jsxs("div",{className:"mt-1 flex flex-col gap-1",children:[t.map(({spec:o,pace:l,mode:c=a})=>{const d=Q(ue(me(o.window,o.resetField)));return e.jsxs("div",{className:"text-[11px] leading-snug text-oai-gray-600 dark:text-oai-gray-300",children:[ot(o,l,c),d?e.jsxs("span",{className:"text-oai-gray-400 dark:text-oai-gray-500",children:[" · ",r(o.timeKind==="expiry"?"limits.hover.expires_at":"limits.hover.resets_at",{time:d})]}):null,o.showCreditDetail?e.jsx("div",{children:it(o.window,o.creditPrecision)}):null]},o.key)}),n?e.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(s?"limits.explain.body_remaining":"limits.explain.body")}):null]})}function J(t){if(!t)return null;const a=Date.now()-new Date(t).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 s=Math.floor(i/60);if(s<24)return r("shared.time.h_ago",{n:s});const n=Math.floor(s/24);return r("shared.time.d_ago",{n})}const Te={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"}},ha={claude:"claude",codex:"codex",antigravity:"agy"};function K({label:t,age:a=null,tone:i="live",tooltip:s=null}){const n=Te[i]||Te.live,o=i==="live";return e.jsxs("div",{className:"relative inline-flex items-center group cursor-help ml-1",onClick:l=>l.stopPropagation(),children:[e.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:[o?e.jsxs("span",{className:"relative flex h-1.5 w-1.5",children:[e.jsx("span",{className:`animate-ping absolute inline-flex h-full w-full rounded-full ${n.pulse} opacity-75`}),e.jsx("span",{className:`relative inline-flex rounded-full h-1.5 w-1.5 ${n.dot}`})]}):e.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${n.dot}`}),t,a?e.jsxs(e.Fragment,{children:[" · ",a]}):null]}),s?e.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:[s,e.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 dt({name:t,providerId:a,children:i,expandable:s=!1,expanded:n=!1,onToggle:o,badge:l=null,rightAdornment:c=null,toggleOnHeader:d=!1}){const m=Ue(a),u=e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[m?e.jsx(Be,{provider:m,size:22,className:la}):null,e.jsx("span",{className:"text-base font-semibold text-oai-black dark:text-oai-white",children:t}),c?e.jsx("span",{className:"shrink-0",children:c}):null,l]}),p="rounded-xl border border-oai-gray-200 bg-white dark:border-oai-gray-800 dark:bg-oai-gray-900",v="flex w-full items-center justify-between gap-3 border-b border-oai-gray-200 px-4 py-4 text-left dark:border-oai-gray-800 sm:px-5",h=e.jsx("div",{className:"flex flex-col gap-2 px-4 py-4 sm:px-5",children:i});return s?d?e.jsxs("div",{className:p,children:[e.jsxs("button",{type:"button","aria-expanded":n,onClick:o,className:`${v} rounded-t-xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-oai-brand-500`,children:[u,e.jsx(le,{size:16,"aria-hidden":!0,className:`shrink-0 text-oai-gray-400 transition-transform ${n?"rotate-180":""}`})]}),h]}):e.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":n,onClick:o,onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),o?.())},className:`${p} cursor-pointer transition-colors hover:border-oai-gray-300 dark:hover:border-oai-gray-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500`,children:[e.jsxs("div",{className:v,children:[u,e.jsx(le,{size:16,"aria-hidden":!0,className:`shrink-0 text-oai-gray-400 transition-transform ${n?"rotate-180":""}`})]}),h]}):e.jsxs("div",{className:p,children:[e.jsx("div",{className:v,children:u}),h]})}function ut({subscription:t}){const a=t.autoRenew?r("subscriptions.badge.auto_renew"):r("subscriptions.badge.stops"),i=t.autoRenew?Ze:je;return e.jsx("span",{role:"img","aria-label":a,title:a,className:`inline-flex translate-y-px ${t.autoRenew?"text-oai-brand-600 dark:text-oai-brand-400":"text-blue-600 dark:text-blue-400"}`,children:e.jsx(i,{size:14,strokeWidth:2,"aria-hidden":!0})})}function mt({subscription:t,now:a,mode:i=_.USED}){const s=ce(t,a);if(!s)return null;const{endMs:n,expired:o}=s,l=!o&&n-a<=3*864e5,c=o?100:s.progress*100,d=i===_.REMAINING?100-c:c,m=o?100:Math.max(0,Math.min(100,d)),u=Math.round(m),p=m>0&&u===0?r("limits.bar.sub_one_percent"):`${u}%`;return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs sm:text-sm text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:r("subscriptions.inline.label")}),e.jsx("div",{className:"relative min-w-0 flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:e.jsx("div",{className:`${o?"bg-red-500":l?"bg-amber-500":"bg-blue-500"} rounded-full h-full block motion-safe:transition-[width] motion-safe:duration-500 ease-out motion-reduce:transition-none`,style:{width:`${m}%`,minWidth:m>0?"3px":0}})}),e.jsx("span",{className:"text-xs sm:text-sm tabular-nums text-oai-gray-600 dark:text-oai-gray-300 w-11 text-right shrink-0 whitespace-nowrap",children:p}),e.jsx("span",{className:`text-xs tabular-nums shrink-0 whitespace-nowrap w-8 text-right ${o?"text-oai-error":"text-oai-gray-400 dark:text-oai-gray-500"}`,children:Qe(n,a)})]})}function xt({subscription:t,now:a}){const i=ce(t,a);if(!i)return null;const s=new Intl.DateTimeFormat(B(),{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"});return e.jsxs("div",{className:"text-[11px] leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx("span",{children:r("subscriptions.inline.label")}),e.jsx("span",{className:"text-oai-gray-300 dark:text-oai-gray-600",children:":"}),e.jsx("span",{children:t.autoRenew?r("subscriptions.label.renews_at"):r("subscriptions.label.expires_at")}),e.jsx("span",{children:" "}),e.jsx("span",{className:"font-mono tabular-nums",children:s.format(new Date(i.endMs))}),e.jsx("span",{className:"text-oai-gray-300 dark:text-oai-gray-600",children:" · "}),e.jsx("span",{className:i.expired?"text-oai-error":void 0,children:ve(i.endMs,a)}),e.jsx("span",{className:"text-oai-gray-300 dark:text-oai-gray-600",children:" · "}),e.jsx("span",{children:t.autoRenew?r("subscriptions.status.auto_renew"):r("subscriptions.status.manual")})]})}const fa=ze;function A({children:t,tone:a="neutral"}){return a==="error"?e.jsxs("div",{className:"flex items-start gap-2 text-xs leading-relaxed text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx(vt,{size:15,"aria-hidden":!0,className:"mt-0.5 shrink-0 text-red-500 dark:text-red-400"}),e.jsx("span",{className:"min-w-0 break-words",children:t})]}):e.jsx("div",{className:"text-[11px] leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:t})}function pt({rows:t,mode:a,extra:i=null,expanded:s=!1}){const n=t.length===0&&!i;return e.jsxs(e.Fragment,{children:[t.map(({spec:o,pace:l,mode:c=a})=>{const d=de(o.window,o.pctField),u=s&&o.productPool&&Array.isArray(o.segments)&&o.segments.length!==0?o.segments:null,p=u&&c!==_.REMAINING?u:null;return e.jsxs(C.Fragment,{children:[e.jsx(xa,{label:o.label??r(o.labelKey),pct:d,reset:ua(me(o.window,o.resetField)),mode:c,segments:p,pacePercent:l.pacePercent,paceOver:l.paceOver,title:ma(o,l,c)}),u?e.jsxs(e.Fragment,{children:[e.jsx(pa,{segments:u,fillColor:rt(d,_.USED)}),c===_.REMAINING?e.jsx("div",{"data-limit-share-note":"",className:"-mt-0.5 text-[11px] leading-snug text-oai-gray-400 dark:text-oai-gray-500",style:{paddingLeft:"calc(var(--tt-limits-label-w, 0px) + 0.5rem)"},children:r("limits.grok.shares_are_used")}):null]}):null]},o.key)}),n?e.jsx(A,{children:r("limits.status.no_data")}):null,i]})}function ba(t){if(!Number.isFinite(t.expiresMs))return null;const a=Math.floor((t.expiresMs-Date.now())/864e5);return a<0?null:a===0?r("limits.reset_bank.hover_detail_today",{date:t.expiresAt}):r("limits.reset_bank.hover_detail",{date:t.expiresAt,days:a})}function ya({row:t}){const a=Math.max(0,Math.min(100,Number(t.percent)||0));return e.jsxs("div",{className:"group relative flex items-center gap-2","data-reset-bank-row":"",children:[e.jsx(st,{text:ba(t)}),e.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:t.label}),e.jsx("div",{className:"relative min-w-0 flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:e.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}})}),e.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:t.expiresAt})]})}function va({model:t}){const a=t.kind==="count_only"?r("limits.codex_reset_bank.count_only",{count:t.availableCount}):null;return e.jsxs("div",{className:"mt-1 flex flex-col gap-1","data-reset-bank-section":t.kind,children:[e.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?e.jsx("div",{className:"text-[11px] leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:a}):t.rows.map(i=>e.jsx(ya,{row:i},i.key))]})}const ka={five_hour:5*3600*1e3,weekly:168*3600*1e3};function ja({data:t}){const[a,i]=g.useState(!1),s=Date.now(),n=[{key:"five_hour",label:r("limits.label.zcode_5h")},{key:"weekly",label:r("limits.label.zcode_weekly")}].map(l=>{const c=(t[l.key]||[]).filter(h=>Date.parse(h.expires_at)>s).sort((h,f)=>Date.parse(h.expires_at)-Date.parse(f.expires_at)),d=new Map;for(const h of c){const f=Date.parse(h.expires_at);d.set(f,(d.get(f)||0)+1)}const u=[...d.entries()].sort((h,f)=>h[0]-f[0]).map(([h,f])=>f>1?r("limits.zcode.reset_bank.batch",{time:Q(h),count:f}):Q(h)).join(`
|
|
3
|
-
`),
|
|
4
|
-
`),o=async l=>{l.stopPropagation();try{await navigator.clipboard.writeText(n),i(!0),setTimeout(()=>i(!1),1600)}catch{}};return e.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:[e.jsx("div",{className:"font-medium text-oai-gray-700 dark:text-oai-gray-200",children:r("limits.copilot.otelHint.title")}),e.jsx("div",{className:"mt-0.5 leading-snug",children:r("limits.copilot.otelHint.body")}),e.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}),e.jsx("button",{type:"button",onClick:o,className:"mt-1 inline-flex items-center gap-1 rounded border border-oai-gray-300 dark:border-oai-gray-700 px-1.5 py-0.5 text-[10.5px] text-oai-gray-700 dark:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:a?r("limits.copilot.otelHint.copied"):r("limits.copilot.otelHint.copy")})]})}function D({n:t,children:a}){return e.jsxs("li",{className:"flex gap-2.5",children:[e.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:t}),e.jsx("div",{className:"min-w-0 flex-1 leading-snug",children:a})]})}function we(){return e.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:e.jsx("path",{d:"M4.5 2.75h4.75V7.5M9.25 2.75 3 9"})})}function Ne({provider:t,onSaved:a}){const[i,s]=
|
|
5
|
-
`),s=async n=>{n.stopPropagation();try{await navigator.clipboard.writeText(i),a(!0),setTimeout(()=>a(!1),1600)}catch{}};return e.jsxs("div",{className:"mt-3 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("div",{className:"mt-0.5 leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:r("limits.codingPlan.setupHint.subtitle")}),e.jsxs("ol",{className:"mt-2.5 space-y-2.5",children:[e.jsxs(D,{n:"1",children:[e.jsx("div",{children:r("limits.codingPlan.setupHint.step1")}),e.jsxs("a",{href:"https://www.volcengine.com/docs/82379/2536875",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.codingPlan.setupHint.cta"),e.jsx(we,{})]})]}),e.jsxs(D,{n:"2",children:[e.jsx("div",{children:r("limits.codingPlan.setupHint.step2")}),e.jsx("div",{className:"mt-0.5 text-oai-gray-500 dark:text-oai-gray-400",children:r("limits.codingPlan.setupHint.step2_remote")})]}),e.jsxs(D,{n:"3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:r("limits.codingPlan.setupHint.step3")}),e.jsx("button",{type:"button",onClick:s,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:t?r("limits.codingPlan.setupHint.copied"):r("limits.codingPlan.setupHint.copy")})]}),e.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}),e.jsx("div",{className:"mt-1 text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:r("limits.codingPlan.setupHint.note_app")})]})]})]})}function Oe(){const[t,a]=
|
|
6
|
-
`),s=async n=>{n.stopPropagation();try{await navigator.clipboard.writeText(i),a(!0),setTimeout(()=>a(!1),1600)}catch{}};return e.jsxs("div",{className:"mt-3 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("div",{className:"mt-0.5 leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:r("limits.agentPlan.setupHint.subtitle")}),e.jsxs("ol",{className:"mt-2.5 space-y-2.5",children:[e.jsxs(D,{n:"1",children:[e.jsx("div",{children:r("limits.agentPlan.setupHint.step1")}),e.jsxs("a",{href:"https://www.volcengine.com/docs/82379/2536875",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.agentPlan.setupHint.cta"),e.jsx(we,{})]})]}),e.jsxs(D,{n:"2",children:[e.jsx("div",{children:r("limits.agentPlan.setupHint.step2")}),e.jsx("div",{className:"mt-0.5 text-oai-gray-500 dark:text-oai-gray-400",children:r("limits.agentPlan.setupHint.step2_remote")})]}),e.jsxs(D,{n:"3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:r("limits.agentPlan.setupHint.step3")}),e.jsx("button",{type:"button",onClick:s,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:t?r("limits.agentPlan.setupHint.copied"):r("limits.agentPlan.setupHint.copy")})]}),e.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}),e.jsx("div",{className:"mt-1 text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:r("limits.agentPlan.setupHint.note_app")})]})]})]})}function ht(t){const[a,i]=g.useState(0);return g.useLayoutEffect(()=>{const s=t.current;if(!s)return;const n=[...s.querySelectorAll("[data-limit-label]")].filter(d=>d.closest("[data-limit-label-group]")===s);let o=0,l=null;if(n.length>0)try{l=document.createElement("canvas").getContext("2d")}catch{l=null}if(l){const d=window.getComputedStyle(n[0]);l.font=`${d.fontStyle} ${d.fontWeight} ${d.fontSize} ${d.fontFamily}`;for(const m of n)o=Math.max(o,l.measureText(m.textContent).width)}const c=Math.ceil(o);i(d=>d===c?d:c)}),a}function Ca({claude:t,codex:a,cursor:i,gemini:s,kimi:n,kiro:o,grok:l,antigravity:c,copilot:d,zcode:m,opencodeGo:u,commandCode:p,qoder:v,qoderCn:h,codingPlan:f,agentPlan:S,devin:k,workbuddy:M,order:j,visibility:w,displayMode:E,subscriptions:R=[],showSubscriptions:I=!0,onProviderKeySaved:V=null}){const H={claude:t,codex:a,cursor:i,gemini:s,kimi:n,kiro:o,grok:l,antigravity:c,copilot:d,zcode:m,opencodeGo:u,commandCode:p,qoder:v,qoderCn:h,codingPlan:f,agentPlan:S,devin:k,workbuddy:M},ae=g.useRef(null),Y=ht(ae),[$,re]=g.useState(null),[Z,xe]=g.useState(()=>Date.now()),pe=[...new Set((Array.isArray(j)&&j.length>0?j:fa).map(y=>y==="workbuddyAi"?"workbuddy":y))],ge=E===_.REMAINING?_.REMAINING:_.USED;g.useEffect(()=>{const y=setInterval(()=>xe(Date.now()),6e4);return()=>clearInterval(y)},[]);const O=new Map;if(I)for(const y of R||[]){if(!y?.provider)continue;const L=new Date(y.nextBillingAt).getTime();if(!Number.isFinite(L))continue;const z=O.get(y.provider);if(!z){O.set(y.provider,y);continue}const G=new Date(z.nextBillingAt).getTime(),x=L>Z,N=G>Z;(x&&(!N||G>L)||!x&&!N&&L>G)&&O.set(y.provider,y)}const F=pe.filter(y=>!w||w[y]!==!1||O.has(y)).map(y=>_a(y,H[y],ge,$===y,()=>re(L=>L===y?null:y),O.get(y)||null,Z,V)).filter(Boolean);return e.jsx(Ht,{delay:.15,children:e.jsx("div",{ref:ae,"data-limit-label-group":"",className:"flex flex-col gap-3",style:Y>0?{"--tt-limits-label-w":`${Y}px`}:void 0,children:F.length>0?F:e.jsx(A,{children:r("limits.status.all_hidden")})})})}async function ft(t){const a=await t.json().catch(()=>null);if(!t.ok||a?.ok===!1)throw new Error(a?.error||`Subscription request failed with HTTP ${t.status}`);return a}async function Ma(){const t=await fetch("/functions/tokentracker-subscription-manager",{headers:{Accept:"application/json"},cache:"no-store"}),a=await ft(t);return Array.isArray(a.subscriptions)?a.subscriptions:[]}async function _e(t){const a=await jt();return ft(await fetch("/functions/tokentracker-subscription-manager",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",...a},cache:"no-store",body:JSON.stringify(t)}))}function Da(t){return _e({action:"create",subscription:t})}function Ea(t,a){return _e({action:"update",id:t,subscription:a})}function Ta(t){return _e({action:"delete",id:t})}const be={plan:"",provider:"",cycle:"monthly",autoRenew:!0,startedAt:""};function Ra(t){const a=new Date(t);if(Number.isNaN(a.getTime()))return"";const i=s=>String(s).padStart(2,"0");return`${a.getFullYear()}-${i(a.getMonth()+1)}-${i(a.getDate())}T${i(a.getHours())}:${i(a.getMinutes())}`}function Ia({subscriptions:t,onChanged:a}){const[i,s]=g.useState(!1),[n,o]=g.useState(null),[l,c]=g.useState(be),[d,m]=g.useState(!1),[u,p]=g.useState(!1),[v,h]=g.useState(!1),[f,S]=g.useState(!1),[k,M]=g.useState(null),[j,w]=g.useState(!1),[E,R]=g.useState(!1),[I,V]=g.useState(null),[H,ae]=g.useState(()=>Date.now()),Y=g.useRef(null),$=B(),re=g.useMemo(()=>new Intl.DateTimeFormat($,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),[$]);g.useEffect(()=>{const x=setInterval(()=>ae(Date.now()),6e4);return()=>clearInterval(x)},[]),g.useEffect(()=>{if(!i)return;const x=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;Y.current?.scrollIntoView?.({behavior:x?"auto":"smooth",block:"nearest"})},[i,n]);const Z=g.useMemo(()=>ze.map(x=>{const N=(t||[]).some(P=>P.provider===x&&P.id!==n),b=oe(x);return{value:x,label:N?`${b} ${r("subscriptions.form.provider_taken_suffix")}`:b,disabled:N}}),[$,t,n]),xe=g.useMemo(()=>[{value:"weekly",label:r("subscriptions.form.cycle_weekly")},{value:"monthly",label:r("subscriptions.form.cycle_monthly")},{value:"yearly",label:r("subscriptions.form.cycle_yearly")}],[$]),pe=g.useMemo(()=>[{value:"true",label:r("subscriptions.form.auto_renew_on")},{value:"false",label:r("subscriptions.form.auto_renew_off")}],[$]),ge=g.useCallback(()=>{c(be),o(null),p(!1),h(!1),S(!1),s(!0)},[]),O=g.useCallback(x=>{c({plan:x.plan||"",provider:x.provider||"",cycle:x.cycle||"monthly",autoRenew:x.autoRenew,startedAt:Ra(new Date(na(x)).toISOString())}),o(x.id),p(!1),h(!1),S(!1),s(!0)},[]),F=g.useCallback(()=>{s(!1),o(null),c(be),p(!1),h(!1),S(!1)},[]),y=g.useCallback(async x=>{if(x.preventDefault(),p(!1),!l.provider){h(!0);return}if((t||[]).some(W=>W.provider===l.provider&&W.id!==n)){S(!0);return}const b=new Date(l.startedAt).getTime();if(!Number.isFinite(b)){p(!0);return}const P={service:oe(l.provider),plan:l.plan,provider:l.provider||null,autoRenew:l.autoRenew,cycle:l.cycle,startedAt:b,nextBillingAt:Je(b,l.cycle)};m(!0);try{n?await Ea(n,P):await Da(P),F(),await a?.()}catch{p(!0)}finally{m(!1)}},[F,n,l,a,t]),L=g.useCallback(async()=>{if(k){w(!0),R(!1);try{await Ta(k.id),k.id===n&&F(),M(null),await a?.()}catch{R(!0)}finally{w(!1)}}},[F,n,a,k]),z=t||[],G=()=>{const x=n?z.find(b=>b.id===n):null,N=x?ce(x,H):null;return e.jsxs("form",{ref:Y,onSubmit:y,className:"grid grid-cols-1 gap-3 px-3 py-3 text-left sm:grid-cols-2",children:[e.jsx("div",{className:"flex items-center justify-between sm:col-span-2",children:e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400",children:n?r("subscriptions.edit"):r("subscriptions.add")})}),N?e.jsxs("div",{className:"sm:col-span-2 rounded-md bg-oai-gray-50 dark:bg-oai-gray-800/50 px-2.5 py-2 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("span",{className:"text-oai-gray-400 dark:text-oai-gray-500",children:x.autoRenew?r("subscriptions.label.renews_at"):r("subscriptions.label.expires_at")})," ",e.jsx("span",{className:"font-mono tabular-nums",children:re.format(new Date(N.endMs))})," · ",e.jsx("span",{className:N.expired?"text-oai-error":void 0,children:ve(N.endMs,H)})]}):null,e.jsxs("div",{className:"flex flex-col sm:col-span-1",children:[e.jsx("label",{htmlFor:"subscription-provider",className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5",children:r("subscriptions.form.provider")}),e.jsx(he,{id:"subscription-provider",value:l.provider,onValueChange:b=>c({...l,provider:String(b)}),options:Z,matchTriggerWidth:!0,className:"h-10 w-full px-3 text-sm"})]}),e.jsx("div",{className:"sm:col-span-1",children:e.jsx(Ce,{label:r("subscriptions.form.plan"),value:l.plan,maxLength:120,placeholder:r("subscriptions.form.plan_placeholder"),onChange:b=>c({...l,plan:b.target.value})})}),e.jsxs("div",{className:"flex flex-col sm:col-span-1",children:[e.jsx("label",{htmlFor:"subscription-cycle",className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5",children:r("subscriptions.form.cycle")}),e.jsx(he,{id:"subscription-cycle",value:l.cycle,onValueChange:b=>c({...l,cycle:String(b)}),options:xe,matchTriggerWidth:!0,className:"h-10 w-full px-3 text-sm"})]}),e.jsxs("div",{className:"flex flex-col sm:col-span-1",children:[e.jsx("label",{htmlFor:"subscription-auto-renew",className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5",children:r("subscriptions.form.auto_renew")}),e.jsx(he,{id:"subscription-auto-renew",value:String(l.autoRenew),onValueChange:b=>c({...l,autoRenew:b==="true"}),options:pe,matchTriggerWidth:!0,className:"h-10 w-full px-3 text-sm"})]}),e.jsx("div",{className:"sm:col-span-2",children:e.jsx(Ce,{label:r("subscriptions.form.started_at"),type:"datetime-local",value:l.startedAt,required:!0,onChange:b=>c({...l,startedAt:b.target.value})})}),e.jsxs("div",{className:"flex items-center justify-end gap-2 sm:col-span-2",children:[n?e.jsx(X,{type:"button",variant:"secondary",size:"sm",onClick:()=>{const b=z.find(P=>P.id===n);b&&M(b)},className:"!text-red-600 dark:!text-red-400 mr-auto",children:r("subscriptions.delete")}):null,v?e.jsx("p",{className:"mr-auto text-sm text-oai-error",role:"alert",children:r("subscriptions.form.provider_required")}):null,f?e.jsx("p",{className:"mr-auto text-sm text-oai-error",role:"alert",children:r("subscriptions.form.provider_taken")}):null,u?e.jsx("p",{className:"mr-auto text-sm text-oai-error",role:"alert",children:r("subscriptions.form.error")}):null,e.jsx(X,{type:"button",variant:"secondary",size:"sm",onClick:F,children:r("shared.action.cancel")}),e.jsx(X,{type:"submit",size:"sm",disabled:d,children:r("subscriptions.save")})]})]})};return e.jsxs("div",{className:"flex max-h-[min(80vh,42rem)] w-[min(92vw,32rem)] flex-col gap-3 overflow-y-auto rounded-xl border border-oai-gray-200 bg-white p-4 shadow-lg dark:border-oai-gray-700 dark:bg-oai-gray-900",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"min-w-0",children:e.jsx("span",{className:"block truncate text-sm font-semibold text-oai-black dark:text-white",children:r("limits.page.openSubscriptions")})}),e.jsxs(X,{type:"button",size:"sm",onClick:ge,className:"shrink-0 gap-1.5",children:[e.jsx(zt,{size:14,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:r("subscriptions.add")})]})]}),z.length===0&&!(i&&!n)?e.jsxs("div",{className:"flex flex-col items-center justify-center gap-1 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center dark:border-oai-gray-700",children:[e.jsx(qe,{className:"h-6 w-6 text-oai-gray-300 dark:text-oai-gray-600 mb-2","aria-hidden":!0}),e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:r("subscriptions.empty.title")}),e.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:r("subscriptions.empty.body")})]}):e.jsxs("ul",{className:"flex flex-col gap-1.5",children:[z.map(x=>{const N=ce(x,H);if(!N)return null;const{endMs:b,expired:P}=N,W=P?100:N.progress*100,bt=!P&&b-H<=3*864e5,yt=I===x.id;return e.jsxs("li",{className:"rounded-lg border border-oai-gray-100 dark:border-oai-gray-800",children:[e.jsxs("button",{type:"button",onClick:()=>O(x),"aria-label":`${r("subscriptions.edit")} ${x.service}`,"aria-expanded":n===x.id,className:"w-full flex flex-col gap-1.5 px-3 py-2.5 text-left cursor-pointer hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/40 rounded-lg transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:[e.jsxs("span",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(Be,{provider:Ue(x.provider)||"OTHER",size:14}),e.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-white truncate",children:x.service}),e.jsx("span",{role:"img","aria-label":x.autoRenew?r("subscriptions.badge.auto_renew"):r("subscriptions.badge.stops"),title:x.autoRenew?r("subscriptions.badge.auto_renew"):r("subscriptions.badge.stops"),className:`inline-flex shrink-0 translate-y-px ${x.autoRenew?"text-oai-brand-600 dark:text-oai-brand-400":"text-blue-600 dark:text-blue-400"}`,children:x.autoRenew?e.jsx(Ze,{size:14,strokeWidth:2,"aria-hidden":!0}):e.jsx(je,{size:14,strokeWidth:2,"aria-hidden":!0})}),x.plan?e.jsx("span",{className:"text-xs rounded-full border border-oai-gray-200 dark:border-oai-gray-700 px-2 py-0.5 text-oai-gray-500 dark:text-oai-gray-400 shrink-0",children:x.plan}):null]}),e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[10px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0",children:r("subscriptions.inline.label")}),e.jsx("span",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1 overflow-hidden",children:e.jsx("span",{className:`${P?"bg-red-500":bt?"bg-amber-500":"bg-blue-500"} rounded-full h-full block transition-[width] duration-500 ease-out`,style:{width:`${W}%`,minWidth:W>0?"3px":0}})}),e.jsx("span",{className:`text-[10px] tabular-nums shrink-0 ${P?"text-oai-error":"text-oai-gray-400 dark:text-oai-gray-500"}`,children:Qe(b,H)})]})]}),n===x.id?e.jsx("div",{className:"border-t border-oai-gray-100 dark:border-oai-gray-800",children:G()}):null,n!==x.id&&yt?e.jsxs("div",{className:"px-3 pb-3 flex flex-col gap-2 border-t border-oai-gray-100 dark:border-oai-gray-800",children:[e.jsxs("p",{className:"pt-2 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("span",{className:"text-oai-gray-400 dark:text-oai-gray-500",children:x.autoRenew?r("subscriptions.label.renews_at"):r("subscriptions.label.expires_at")})," ",e.jsx("span",{className:"font-mono tabular-nums",children:re.format(new Date(b))})," · ",e.jsx("span",{className:P?"text-oai-error":void 0,children:ve(b,H)})," · ",e.jsx("span",{children:x.autoRenew?r("subscriptions.status.auto_renew"):r("subscriptions.status.manual")})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(X,{type:"button",variant:"secondary",size:"sm",onClick:()=>O(x),children:r("subscriptions.edit")})})]}):null]},x.id)}),i&&!n?e.jsx("li",{className:"rounded-lg border border-oai-gray-100 dark:border-oai-gray-800",children:G()}):null]}),e.jsx(Lt,{open:!!k,title:r("subscriptions.confirm_delete_title"),description:k?.service||"",error:E?r("subscriptions.delete_error"):null,confirmLabel:r("subscriptions.delete"),cancelLabel:r("shared.action.cancel"),destructive:!0,busy:j,onCancel:()=>{M(null),R(!1)},onConfirm:L})]})}const Fe=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),Aa="x-apple.systempreferences:com.apple.preference.notifications";function Le(t){const a=Date.parse(t);return Number.isFinite(a)?new Intl.DateTimeFormat(B(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(a)):String(t)}function Ha(t){const a=Object.entries(t||{}).filter(([o,l])=>o!=="fetched_at"&&l&&typeof l=="object"&&l.configured!==!1),i=a.filter(([,o])=>!!o.error),s=a.some(([,o])=>!!o.start_plan?.error||!!o.reset_credits?.error),n=a.filter(([,o])=>o.provenance?.stale===!0||o.provenance?.source==="disk-cache");return a.length&&i.length===0&&!s&&n.length===a.length?{kind:"stale"}:i.length||n.length||s?{kind:"partial",at:t.fetched_at}:{kind:"updated",at:t.fetched_at}}function Oa(){const t=qt(),a=Ct(),i=r("limits.alert.blocked"),s=a?Pe.button:Pe.div;return e.jsxs(s,{type:a?"button":void 0,onClick:a?()=>Mt({type:"action",name:"openURL",value:Aa}):void 0,initial:t?!1:{opacity:0,x:14,scale:.9},animate:{opacity:1,x:0,scale:1},transition:{type:"spring",stiffness:320,damping:18},title:i,className:`relative hidden sm:inline-flex min-w-0 max-w-[360px] items-center gap-1.5 rounded-full border border-amber-300/70 bg-amber-50 px-3 py-1.5 text-xs text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300 ${a?"cursor-pointer transition-colors hover:bg-amber-100 dark:hover:bg-amber-500/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-500/60":""}`,children:[e.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-amber-500"})]}),e.jsx("span",{className:"truncate",children:i}),e.jsx("span",{"aria-hidden":!0,className:"absolute left-full top-1/2 -translate-y-1/2 border-[5px] border-transparent border-l-amber-300/80 dark:border-l-amber-500/40"})]})}function dr(){const t=wt(),{data:a,error:i,isLoading:s,refresh:n}=Tt(t?{initialRefresh:!0,initialState:t,publishToPreloadCache:!0}:{initialRefresh:!0,publishToPreloadCache:!0}),o=At(),l=Rt(),[c,d]=C.useState([]),[m,u]=C.useState(!1),[p,v]=C.useState(!1),[h]=Nt(),f=C.useRef(0),S=C.useRef(!1),[k,M]=C.useState(!1),[j,w]=C.useState(null),E=C.useCallback(async()=>{if(!S.current){S.current=!0,M(!0),w(null);try{const I=await n();w(I?Ha(I):{kind:"failed"})}finally{S.current=!1,M(!1)}}},[n]),R=C.useCallback(async()=>{if(!Fe&&!Se())return;const I=++f.current;try{const V=await Ma();if(I!==f.current)return;d(V),u(!1)}catch{if(I!==f.current)return;u(!0)}},[]);return C.useEffect(()=>{R()},[R]),C.useEffect(()=>{h.get("openSubscriptions")==="1"&&v(!0)},[h]),C.useEffect(()=>{l.enabled&&a&&It(a)},[l.enabled,a]),!Fe&&!Se()?e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx($t,{})}):e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-6 grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-2 gap-y-2 sm:mb-8 sm:gap-x-4 sm:gap-y-3",children:[e.jsx("h1",{className:"min-w-0 text-2xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white",children:r("nav.limits")}),e.jsxs("div",{className:"flex items-center gap-1 sm:gap-2",children:[l.enabled&&l.permissionBlocked?e.jsx(Oa,{}):null,e.jsx("button",{type:"button",onClick:()=>{E()},disabled:k,"aria-label":r("limits.page.refresh"),title:r("limits.page.refresh"),className:"shrink-0 inline-flex h-10 w-10 sm:h-9 sm: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 disabled:opacity-50",children:e.jsx(_t,{className:`h-4 w-4 ${k?"animate-spin":""}`,"aria-hidden":!0})}),e.jsxs(Ut,{open:p,onOpenChange:v,children:[e.jsx(Bt,{"aria-label":r("limits.page.openSubscriptions"),title:r("limits.page.openSubscriptions"),className:"shrink-0 inline-flex h-10 w-10 sm:h-9 sm: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:e.jsx(qe,{className:"h-4 w-4","aria-hidden":!0})}),e.jsx(Gt,{children:e.jsx(Wt,{side:"bottom",align:"end",sideOffset:8,className:"z-50",children:e.jsx(Kt,{children:e.jsx(Ia,{subscriptions:c,onChanged:R})})})})]}),e.jsx("button",{type:"button",onClick:()=>{l.setEnabled(!l.enabled)},"aria-label":l.enabled?r("limits.alert.disable"):r("limits.alert.enable"),title:l.enabled?r("limits.alert.disable"):r("limits.alert.enable"),className:`inline-flex h-10 w-10 sm:h-9 sm:w-9 items-center justify-center rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 ${l.enabled&&l.permissionBlocked?"text-amber-600 dark:text-amber-400":"text-oai-gray-600 dark:text-oai-gray-400 hover:text-oai-black dark:hover:text-white"}`,children:l.enabled?e.jsx(Yt,{className:"h-4 w-4","aria-hidden":!0}):e.jsx(Vt,{className:"h-4 w-4","aria-hidden":!0})}),e.jsx(St,{to:"/settings?section=limits","aria-label":r("limits.page.openSettings"),title:r("limits.page.openSettings"),className:"shrink-0 inline-flex h-10 w-10 sm:h-9 sm: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:e.jsx(Pt,{className:"h-4 w-4","aria-hidden":!0})})]}),e.jsx("p",{className:"col-span-2 hidden sm:block sm:text-base text-oai-gray-500 dark:text-oai-gray-400",children:r("limits.page.subtitle")})]}),e.jsx("span",{role:"status",className:"sr-only",children:k?r("limits.page.refresh_loading"):""}),j?.kind==="updated"?e.jsx("p",{role:"status",className:"mb-4 text-sm text-emerald-700 dark:text-emerald-300",children:r("limits.page.refreshed_at",{time:Le(j.at)})}):null,j?.kind==="partial"?e.jsx("p",{role:"status",className:"mb-4 text-sm text-amber-600 dark:text-amber-400",children:r("limits.page.refresh_partial",{time:Le(j.at)})}):null,j?.kind==="stale"?e.jsx("p",{role:"status",className:"mb-4 text-sm text-amber-600 dark:text-amber-400",children:r("limits.page.refresh_stale")}):null,j?.kind==="failed"?e.jsx("p",{role:"status",className:"mb-4 text-sm text-amber-600 dark:text-amber-400",children:r("limits.page.refresh_failed")}):null,s?e.jsx(Qt,{}):e.jsxs(e.Fragment,{children:[i?e.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:i}):null,m?e.jsx("p",{className:"mb-4 text-sm text-amber-600 dark:text-amber-400",children:r("subscriptions.load_error")}):null,e.jsx(Ca,{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,commandCode:a?.commandCode,qoder:a?.qoder,qoderCn:a?.qoderCn,codingPlan:a?.codingPlan,agentPlan:a?.agentPlan,devin:a?.devin,workbuddy:a?.workbuddy,order:o.order,visibility:o.visibility,displayMode:o.displayMode,subscriptions:c,showSubscriptions:o.showSubscriptions!==!1,onProviderKeySaved:()=>{n()}})]})]})})})}export{dr as LimitsPage};
|
|
1
|
+
import{o as te,j as e,y as $e,c as r,h as B,r as p,bm as kt,V as P,bn as jt,al as wt,B as X,bo as Nt,e as _t,W as Se,R as St,L as Ct,bp as Pt,t as Mt,w as Dt}from"./__vite-browser-external-BEEzY7mq.js";import{m as Ce}from"./react-CdPiPDhk.js";import{P as se,c as Et,r as ue,a as Tt,u as Rt,b as It,s as At}from"./use-usage-limits-h7aGsIQr.js";import{b as ze,c as S,l as oe,d as Ue,u as Ht}from"./use-limits-display-prefs-Djbdp7fi.js";import{F as Ot}from"./FadeIn-Dpzihg6f.js";import{P as Be}from"./ProviderIcon-vgCEy0dh.js";import{H as Ft}from"./HoverTooltip-Dc-TAH6l.js";import{C as le}from"./chevron-down-CkSBY3bE.js";import{G as Lt}from"./gift-CKlKjGP6.js";import{C as $t}from"./ConfirmModal-NWoYevYC.js";import{I as Pe,L as zt}from"./LocalOnlyNotice-B2_HoCVD.js";import{S as he}from"./Select-BkAy6P2r.js";import{P as Ut}from"./plus-mOF8tG1F.js";import{P as Bt,a as Gt,b as Wt,c as Kt,d as qt}from"./PopoverPopup-BsXchEVa.js";import{u as Vt}from"./use-reduced-motion-DMCok-vZ.js";import"./use-latest-request-guard-Dg6uSaYt.js";import"./DialogTitle-DP5TLLbz.js";import"./composite-BtDzx3a2.js";import"./store-Dv_FYrXK.js";import"./DialogDescription-0wcygxtH.js";import"./arrow-up-right-XTStagDJ.js";import"./download-DKbKMGSR.js";import"./check-1z_vmHPD.js";import"./SelectItemText-C0RNqDrD.js";import"./usePositioner-DfxvIif8.js";import"./safePolygon-C7FJLAlh.js";const Ge={name:"bell-off",size:24,node:[["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"}]]};Ge.node;const Yt=te(Ge);const We={name:"bell",size:24,node:[["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"}]]};We.node;const Zt=te(We);const Ke={name:"calendar-clock",size:24,node:[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v3",key:"otl347"}],["path",{d:"M21 7.338V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h2.338",key:"7hb8p4"}],["path",{d:"M3 9h5.859",key:"numkqi"}],["path",{d:"M8 2v3",key:"1ioesn"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]};Ke.node;const qe=te(Ke);const Ve={name:"clock",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]};Ve.node;const je=te(Ve);const Ye={name:"infinity",size:24,node:[["path",{d:"M6 16c5 0 7-8 12-8a4 4 0 0 1 0 8c-5 0-7-8-12-8a4 4 0 1 0 0 8",key:"18ogeb"}]]};Ye.node;const Ze=te(Ye),Xt=[3,2,3,3,2,2,3];function q({className:t}){return e.jsx("div",{className:$e("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",t)})}function Jt(){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(q,{className:"h-3 w-12 shrink-0"}),e.jsx(q,{className:"flex-1 h-1.5 rounded-full min-w-0"}),e.jsx(q,{className:"h-3 w-[30px] shrink-0"}),e.jsx(q,{className:"h-3 w-6 shrink-0"})]})}function Qt({bars:t,index:a}){const i=a%3===0?"w-24":a%3===1?"w-20":"w-[4.5rem]";return e.jsxs("div",{className:"rounded-xl border border-oai-gray-200 bg-white dark:border-oai-gray-800 dark:bg-oai-gray-900",children:[e.jsxs("div",{className:"flex items-center gap-3 border-b border-oai-gray-200 px-4 py-4 dark:border-oai-gray-800 sm:px-5",children:[e.jsx(q,{className:"h-[22px] w-[22px] shrink-0 rounded"}),e.jsx(q,{className:$e("h-4",i)})]}),e.jsx("div",{className:"flex flex-col gap-2 px-4 py-4 sm:px-5",children:Array.from({length:t},(s,n)=>e.jsx(Jt,{},n))})]})}function ea(){return e.jsx("div",{className:"flex flex-col gap-3","aria-hidden":"true",children:Xt.map((t,a)=>e.jsx(Qt,{bars:t,index:a},a))})}const ye=100;function Me(t){const a=Date.parse(t);return Number.isFinite(a)?a:null}function ta(t){return Math.max(0,Math.min(ye,Math.round(t)))}function aa(t){return new Intl.DateTimeFormat(B(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(t))}function ra(t,a,i){if(t==null||t>=a)return ye;const s=a-t,n=a-i;return ta(n/s*ye)}function ia(t){const a=t.available_count;return a===null?null:Number.isInteger(a)&&a>=0?a:void 0}function na(t,{now:a}={}){if(!t||typeof t!="object")return null;const i=ia(t);if(i===void 0)return null;const s=Array.isArray(t.credits)?t.credits:[],n=a instanceof Date?a.getTime():Number(a??Date.now()),o=[];for(const l of s){const c=Me(l?.expires_at);if(c==null)continue;const d=o.length+1;o.push({key:`reset-${d}`,label:r("limits.codex_reset_bank.row_label",{index:d}),expiresAt:aa(c),expiresMs:c,percent:ra(Me(l?.granted_at),c,n)})}return i===0?null:o.length>0?{kind:"rows",availableCount:i??o.length,rows:o}:i>0?{kind:"count_only",availableCount:i,rows:[]}:null}const ee=864e5;function U(t,a){const i=new Date(t),s=i.getUTCDate(),n=new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth()+a,1,i.getUTCHours(),i.getUTCMinutes())),o=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()+1,0)).getUTCDate();return n.setUTCDate(Math.min(s,o)),n.getTime()}function Xe(t,a){if(a==="weekly")return t-7*ee;if(a==="yearly")return U(t,-12);const i=new Date(t),s=new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),0)).getUTCDate(),n=new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth()-1,1,i.getUTCHours(),i.getUTCMinutes()));return n.setUTCDate(Math.min(i.getUTCDate(),s)),n.getTime()}function Je(t,a){return a==="weekly"?t+7*ee:a==="yearly"?U(t,12):U(t,1)}function sa(t){if(t.startedAt!=null){const a=new Date(t.startedAt).getTime();if(Number.isFinite(a))return a}return Xe(new Date(t.nextBillingAt).getTime(),t.cycle)}function oa(t,a,i){if(t.startedAt!=null){const s=new Date(t.startedAt).getTime();if(Number.isFinite(s))return s}return Xe(i,a)}function la(t,a,i){if(a==="weekly"){const c=7*ee,d=i<=t?0:Math.floor((i-t)/c);return{startMs:t+d*c,endMs:t+(d+1)*c}}const s=a==="yearly"?12:1,n=s*30.436875*ee;let o=i<=t?0:Math.floor((i-t)/n);for(;o>0&&U(t,o*s)>i;)o-=1;let l=0;for(;U(t,(o+1)*s)<=i&&l<12e3;)o+=1,l+=1;return{startMs:U(t,o*s),endMs:U(t,(o+1)*s)}}function ce(t,a){const i=new Date(t.nextBillingAt).getTime();if(!Number.isFinite(i))return null;const s=["weekly","monthly","yearly"].includes(t.cycle)?t.cycle:"monthly",n=oa(t,s,i);if(!Number.isFinite(n))return null;let o,l,c=!1;t.autoRenew?{startMs:o,endMs:l}=la(n,s,a):t.startedAt!=null?(o=n,l=Je(n,s),c=l<=a):(o=n,l=i,c=l<=a);const d=Math.max(1,l-o),m=c?1:Math.max(0,Math.min(1,(a-o)/d));return{endMs:l,startMs:o,progress:m,cycleDays:Math.max(1,Math.round(d/ee)),expired:c}}function Qe(t,a){const i=t-a;if(i<=0)return r("subscriptions.expired");const s=Math.ceil(i/6e4);if(s<60)return`${s}m`;const n=Math.floor(s/60);return n<24?`${n}h`:`${Math.floor(n/24)}d`}function ve(t,a){const i=t-a;if(i<=0)return r("subscriptions.expired");const s=Math.floor(i/6e4),n=Math.floor(s/1440),o=Math.floor(s%1440/60),l=s%60;return r("subscriptions.countdown",{days:n,hours:o,minutes:l})}const ca="shrink-0 text-oai-black dark:text-oai-white",da={opencodeGo:"OPENCODE_GO_API_KEY",commandCode:"COMMAND_CODE_API_KEY"},ua={opencodeGo:"opencode-go",commandCode:"command-code"};function et(){const t=typeof navigator>"u"?"":navigator.userAgent||"";return/Windows/i.test(t)?"windows":/Linux/i.test(t)?"linux":"macos"}function tt(){return et()==="windows"?r("limits.commandCode.setupHint.snippet_login_windows"):r("limits.commandCode.setupHint.snippet_login")}function at(){return r("limits.devin.setupHint.snippet_login")}function ma(t){const a=ue(t);if(!Number.isFinite(a))return null;const i=a-Date.now();if(i<=0)return r("shared.time.now");const s=Math.floor(i/6e4);if(s<60)return`${s}m`;const n=Math.floor(s/60);return n<24?`${n}h`:`${Math.floor(n/24)}d`}function rt(t,a){const i=a===S.REMAINING?100-t:t;return i>=90?"bg-red-500":i>=70?"bg-amber-500":"bg-emerald-500"}function de(t,a="used_percent"){return t?a==="utilization"?t.utilization:t.used_percent:null}function me(t,a="reset_at"){return t?a==="resets_at"?t.resets_at:t.reset_at:null}function ie(t){const a=Math.max(0,Math.min(100,Number(t)||0)),i=Math.round(a);return a>0&&i===0?r("limits.bar.sub_one_percent"):String(i)}function ne(t,{useGrouping:a=!0,maximumFractionDigits:i}={}){const s=Number(t);return Number.isFinite(s)?new Intl.NumberFormat(void 0,{minimumFractionDigits:0,maximumFractionDigits:i??(s>=100?0:2),useGrouping:a}).format(s):null}function it(t,a){if(!t||typeof t!="object"||!(Number(t.limit_credits)>0))return null;const i={useGrouping:t.unit!=="calls",maximumFractionDigits:a},s=ne(t.used_credits,i),n=ne(t.limit_credits,i),o=ne(t.remaining_credits,i);if(!s||!n||!o)return null;const l=t.unit==="calls"?"limits.qoder_calls.detail":"limits.codex_credits.detail";return r(l,{used:s,limit:n,remaining:o})}function nt(t,a,i){return Et({usedPercent:de(t.window,t.pctField),windowSeconds:Tt(t,t.window),resetMs:ue(me(t.window,t.resetField)),mode:a,now:i})}function Q(t){return Number.isFinite(t)?new Intl.DateTimeFormat(B(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(t)):null}function xa(t,a,i){const s=[ot(t,a,i)],n=ue(me(t.window,t.resetField)),o=Q(n);o&&s.push(r(t.timeKind==="expiry"?"limits.hover.expires_at":"limits.hover.resets_at",{time:o}));const l=it(t.window,t.creditPrecision);return l&&s.push(l),s.join(`
|
|
2
|
+
`)}const st=Ft,De=[1,.65,.45,.3,.2];function ke(t){return De[Math.min(t,De.length-1)]}function Ee({paceX:t,paceOver:a}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"absolute top-0 h-full bg-oai-gray-100 dark:bg-oai-gray-700/50",style:{left:`calc(${t}% - 3px)`,width:"6px"}}),e.jsx("div",{className:`absolute top-0 h-full ${a?"bg-red-500":"bg-emerald-500"}`,style:{left:`calc(${t}% - 1px)`,width:"2px"}})]})}function pa({label:t,pct:a,reset:i,mode:s=S.USED,pacePercent:n=null,paceOver:o=!1,title:l=null,segments:c=null}){const d=Math.max(0,Math.min(100,Number(a)||0)),m=s===S.REMAINING?100-d:d,u=rt(m,s),g=Math.round(m),k=m>0&&g===0?Math.max(m,.35):m;let y=String(g);m>0&&g===0&&(y=r("limits.bar.sub_one_percent"));const h=n==null?null:Math.max(0,Math.min(100,n)),v=c?.map(N=>Math.max(0,Math.min(100,Number(N.pct)||0))),j=v?.reduce((N,E)=>N+E,0)||0,M=c?Math.max(0,d-j):0,w=Math.max(0,100-j-M);return e.jsxs("div",{className:"group relative flex items-center gap-2",children:[e.jsx(st,{text:l}),e.jsx("span",{"data-limit-label":"",className:"text-xs sm:text-sm text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:t}),c?e.jsxs("div",{"data-limit-segments":"",className:"relative flex min-w-0 flex-1 h-1.5 overflow-hidden",style:{gap:"min(2px, 1%)"},children:[c.map((N,E)=>e.jsx("div",{"data-limit-segment":N.key,className:`${u} min-w-0 rounded-full h-full transition-[flex-grow] duration-500 ease-out`,style:{flex:`${v[E]} 1 0px`,opacity:ke(E)}},N.key)),M?e.jsx("div",{"data-limit-unallocated-used":"",className:`${u} min-w-0 rounded-full h-full`,style:{flex:`${M} 1 0px`,opacity:ke(c.length)}}):null,w?e.jsx("div",{"data-limit-remainder":"",className:"min-w-0 rounded-full h-full bg-oai-gray-100 dark:bg-oai-gray-700/50",style:{flex:`${w} 1 0px`}}):null,h!=null&&e.jsx(Ee,{paceX:h,paceOver:o})]}):e.jsxs("div",{className:"relative min-w-0 flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:[e.jsx("div",{className:`${u} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${k}%`,minWidth:m>0?"3px":0}}),h!=null&&e.jsx(Ee,{paceX:h,paceOver:o})]}),e.jsxs("span",{className:"text-xs sm:text-sm tabular-nums text-oai-gray-600 dark:text-oai-gray-300 w-11 text-right shrink-0 whitespace-nowrap",children:[y,"%"]}),i&&e.jsx("span",{className:"text-xs tabular-nums text-oai-gray-400 dark:text-oai-gray-500 w-8 text-right shrink-0",children:i})]})}function ga({segments:t,fillColor:a}){return e.jsx("div",{"data-limit-legend":"",className:"-mt-0.5 flex flex-wrap gap-x-3 gap-y-0.5 text-[11px] leading-snug",style:{paddingLeft:"calc(var(--tt-limits-label-w, 0px) + 0.5rem)"},children:t.map((i,s)=>e.jsxs("span",{className:"inline-flex items-center gap-1 whitespace-nowrap",children:[e.jsx("span",{"aria-hidden":!0,className:`${a} inline-block h-1.5 w-1.5 shrink-0 rounded-full`,style:{opacity:ke(s)}}),e.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:i.label??r(i.labelKey)}),e.jsxs("span",{className:"tabular-nums text-oai-gray-700 dark:text-oai-gray-200",children:[ie(i.pct),"%"]})]},i.key))})}function ot(t,a,i){const s=t.label??r(t.labelKey),n=i===S.REMAINING,o=d=>n?100-d:d;if(a.expectedPercent==null){const d=Math.max(0,Math.min(100,Number(de(t.window,t.pctField))||0)),m=ie(o(d));return n?r("limits.explain.remaining",{label:s,used:m}):r("limits.explain.used",{label:s,used:m})}if(a.paceOver){if(a.runsOutEta)return r("limits.explain.ahead_eta",{label:s,eta:a.runsOutEta});const d=ie(o(a.projectedEnd??100));return r(n?"limits.explain.ahead_pct_remaining":"limits.explain.ahead_pct",{label:s,pct:d})}const l=Math.max(0,Math.min(100,Number(de(t.window,t.pctField))||0)),c=ie(o(a.projectedEnd??l));return r(n?"limits.explain.on_track_remaining":"limits.explain.on_track",{label:s,pct:c})}function lt({pace:t}){return t.pacePercent!=null}function ha(t,a){return t.some(i=>lt(i)&&(i.mode??a)===S.REMAINING)}function ct({rows:t,mode:a,now:i=Date.now()}){if(t.length===0)return null;const s=ha(t,a),n=t.some(lt);return e.jsxs("div",{className:"mt-1 flex flex-col gap-1",children:[t.map(({spec:o,pace:l,mode:c=a})=>{const d=Q(ue(me(o.window,o.resetField)));return e.jsxs("div",{className:"text-[11px] leading-snug text-oai-gray-600 dark:text-oai-gray-300",children:[ot(o,l,c),d?e.jsxs("span",{className:"text-oai-gray-400 dark:text-oai-gray-500",children:[" · ",r(o.timeKind==="expiry"?"limits.hover.expires_at":"limits.hover.resets_at",{time:d})]}):null,o.showCreditDetail?e.jsx("div",{children:it(o.window,o.creditPrecision)}):null]},o.key)}),n?e.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(s?"limits.explain.body_remaining":"limits.explain.body")}):null]})}function J(t){if(!t)return null;const a=Date.now()-new Date(t).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 s=Math.floor(i/60);if(s<24)return r("shared.time.h_ago",{n:s});const n=Math.floor(s/24);return r("shared.time.d_ago",{n})}const Te={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"}},fa={claude:"claude",codex:"codex",antigravity:"agy"};function K({label:t,age:a=null,tone:i="live",tooltip:s=null}){const n=Te[i]||Te.live,o=i==="live";return e.jsxs("div",{className:"relative inline-flex items-center group cursor-help ml-1",onClick:l=>l.stopPropagation(),children:[e.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:[o?e.jsxs("span",{className:"relative flex h-1.5 w-1.5",children:[e.jsx("span",{className:`animate-ping absolute inline-flex h-full w-full rounded-full ${n.pulse} opacity-75`}),e.jsx("span",{className:`relative inline-flex rounded-full h-1.5 w-1.5 ${n.dot}`})]}):e.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${n.dot}`}),t,a?e.jsxs(e.Fragment,{children:[" · ",a]}):null]}),s?e.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:[s,e.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 dt({name:t,providerId:a,children:i,expandable:s=!1,expanded:n=!1,onToggle:o,badge:l=null,rightAdornment:c=null,toggleOnHeader:d=!1}){const m=Ue(a),u=e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[m?e.jsx(Be,{provider:m,size:22,className:ca}):null,e.jsx("span",{className:"text-base font-semibold text-oai-black dark:text-oai-white",children:t}),c?e.jsx("span",{className:"shrink-0",children:c}):null,l]}),g="rounded-xl border border-oai-gray-200 bg-white dark:border-oai-gray-800 dark:bg-oai-gray-900",k="flex w-full items-center justify-between gap-3 border-b border-oai-gray-200 px-4 py-4 text-left dark:border-oai-gray-800 sm:px-5",y=e.jsx("div",{className:"flex flex-col gap-2 px-4 py-4 sm:px-5",children:i});return s?d?e.jsxs("div",{className:g,children:[e.jsxs("button",{type:"button","aria-expanded":n,onClick:o,className:`${k} rounded-t-xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-oai-brand-500`,children:[u,e.jsx(le,{size:16,"aria-hidden":!0,className:`shrink-0 text-oai-gray-400 transition-transform ${n?"rotate-180":""}`})]}),y]}):e.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":n,onClick:o,onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),o?.())},className:`${g} cursor-pointer transition-colors hover:border-oai-gray-300 dark:hover:border-oai-gray-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500`,children:[e.jsxs("div",{className:k,children:[u,e.jsx(le,{size:16,"aria-hidden":!0,className:`shrink-0 text-oai-gray-400 transition-transform ${n?"rotate-180":""}`})]}),y]}):e.jsxs("div",{className:g,children:[e.jsx("div",{className:k,children:u}),y]})}function ut({subscription:t}){const a=t.autoRenew?r("subscriptions.badge.auto_renew"):r("subscriptions.badge.stops"),i=t.autoRenew?Ze:je;return e.jsx("span",{role:"img","aria-label":a,title:a,className:`inline-flex translate-y-px ${t.autoRenew?"text-oai-brand-600 dark:text-oai-brand-400":"text-blue-600 dark:text-blue-400"}`,children:e.jsx(i,{size:14,strokeWidth:2,"aria-hidden":!0})})}function mt({subscription:t,now:a,mode:i=S.USED}){const s=ce(t,a);if(!s)return null;const{endMs:n,expired:o}=s,l=!o&&n-a<=3*864e5,c=o?100:s.progress*100,d=i===S.REMAINING?100-c:c,m=o?100:Math.max(0,Math.min(100,d)),u=Math.round(m),g=m>0&&u===0?r("limits.bar.sub_one_percent"):`${u}%`;return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs sm:text-sm text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:r("subscriptions.inline.label")}),e.jsx("div",{className:"relative min-w-0 flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:e.jsx("div",{className:`${o?"bg-red-500":l?"bg-amber-500":"bg-blue-500"} rounded-full h-full block motion-safe:transition-[width] motion-safe:duration-500 ease-out motion-reduce:transition-none`,style:{width:`${m}%`,minWidth:m>0?"3px":0}})}),e.jsx("span",{className:"text-xs sm:text-sm tabular-nums text-oai-gray-600 dark:text-oai-gray-300 w-11 text-right shrink-0 whitespace-nowrap",children:g}),e.jsx("span",{className:`text-xs tabular-nums shrink-0 whitespace-nowrap w-8 text-right ${o?"text-oai-error":"text-oai-gray-400 dark:text-oai-gray-500"}`,children:Qe(n,a)})]})}function xt({subscription:t,now:a}){const i=ce(t,a);if(!i)return null;const s=new Intl.DateTimeFormat(B(),{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"});return e.jsxs("div",{className:"text-[11px] leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx("span",{children:r("subscriptions.inline.label")}),e.jsx("span",{className:"text-oai-gray-300 dark:text-oai-gray-600",children:":"}),e.jsx("span",{children:t.autoRenew?r("subscriptions.label.renews_at"):r("subscriptions.label.expires_at")}),e.jsx("span",{children:" "}),e.jsx("span",{className:"font-mono tabular-nums",children:s.format(new Date(i.endMs))}),e.jsx("span",{className:"text-oai-gray-300 dark:text-oai-gray-600",children:" · "}),e.jsx("span",{className:i.expired?"text-oai-error":void 0,children:ve(i.endMs,a)}),e.jsx("span",{className:"text-oai-gray-300 dark:text-oai-gray-600",children:" · "}),e.jsx("span",{children:t.autoRenew?r("subscriptions.status.auto_renew"):r("subscriptions.status.manual")})]})}const ba=ze;function A({children:t,tone:a="neutral"}){return a==="error"?e.jsxs("div",{className:"flex items-start gap-2 text-xs leading-relaxed text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx(kt,{size:15,"aria-hidden":!0,className:"mt-0.5 shrink-0 text-red-500 dark:text-red-400"}),e.jsx("span",{className:"min-w-0 break-words",children:t})]}):e.jsx("div",{className:"text-[11px] leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:t})}function pt({rows:t,mode:a,extra:i=null,expanded:s=!1}){const n=t.length===0&&!i;return e.jsxs(e.Fragment,{children:[t.map(({spec:o,pace:l,mode:c=a})=>{const d=de(o.window,o.pctField),u=s&&o.productPool&&Array.isArray(o.segments)&&o.segments.length!==0?o.segments:null,g=u&&c!==S.REMAINING?u:null;return e.jsxs(P.Fragment,{children:[e.jsx(pa,{label:o.label??r(o.labelKey),pct:d,reset:ma(me(o.window,o.resetField)),mode:c,segments:g,pacePercent:l.pacePercent,paceOver:l.paceOver,title:xa(o,l,c)}),u?e.jsxs(e.Fragment,{children:[e.jsx(ga,{segments:u,fillColor:rt(d,S.USED)}),c===S.REMAINING?e.jsx("div",{"data-limit-share-note":"",className:"-mt-0.5 text-[11px] leading-snug text-oai-gray-400 dark:text-oai-gray-500",style:{paddingLeft:"calc(var(--tt-limits-label-w, 0px) + 0.5rem)"},children:r("limits.grok.shares_are_used")}):null]}):null]},o.key)}),n?e.jsx(A,{children:r("limits.status.no_data")}):null,i]})}function ya(t){if(!Number.isFinite(t.expiresMs))return null;const a=Math.floor((t.expiresMs-Date.now())/864e5);return a<0?null:a===0?r("limits.reset_bank.hover_detail_today",{date:t.expiresAt}):r("limits.reset_bank.hover_detail",{date:t.expiresAt,days:a})}function va({row:t}){const a=Math.max(0,Math.min(100,Number(t.percent)||0));return e.jsxs("div",{className:"group relative flex items-center gap-2","data-reset-bank-row":"",children:[e.jsx(st,{text:ya(t)}),e.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:t.label}),e.jsx("div",{className:"relative min-w-0 flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:e.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}})}),e.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:t.expiresAt})]})}function ka({model:t}){const a=t.kind==="count_only"?r("limits.codex_reset_bank.count_only",{count:t.availableCount}):null;return e.jsxs("div",{className:"mt-1 flex flex-col gap-1","data-reset-bank-section":t.kind,children:[e.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?e.jsx("div",{className:"text-[11px] leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:a}):t.rows.map(i=>e.jsx(va,{row:i},i.key))]})}const ja={five_hour:5*3600*1e3,weekly:168*3600*1e3};function gt(t,a){if(!t||typeof t!="object")return!1;if(t.error)return!0;for(const i of["five_hour","weekly"])for(const s of t[i]||[])if(Date.parse(s?.expires_at)>a)return!0;return!1}function wa({data:t}){const[a,i]=p.useState(!1),s=Date.now();if(!gt(t,s))return null;const n=[{key:"five_hour",label:r("limits.label.zcode_5h")},{key:"weekly",label:r("limits.label.zcode_weekly")}].map(c=>{const d=(t[c.key]||[]).filter(h=>Date.parse(h.expires_at)>s).sort((h,v)=>Date.parse(h.expires_at)-Date.parse(v.expires_at)),m=new Map;for(const h of d){const v=Date.parse(h.expires_at);m.set(v,(m.get(v)||0)+1)}const g=[...m.entries()].sort((h,v)=>h[0]-v[0]).map(([h,v])=>v>1?r("limits.zcode.reset_bank.batch",{time:Q(h),count:v}):Q(h)).join(`
|
|
3
|
+
`),k=ja[c.key]||0,y=d.length&&k?Math.max(0,Math.min(100,(Date.parse(d[0].expires_at)-s)/k*100)):0;return{...c,cards:d,batchTitle:g,countdownPercent:y}});let o=0;const l=[];for(const c of n)o+=c.cards.length,c.cards.length&&l.push(c);return e.jsxs("div",{className:"mt-2 border-t border-oai-gray-200/60 pt-2 dark:border-oai-gray-800",children:[e.jsxs("button",{type:"button","aria-expanded":a,onClick:c=>{c.stopPropagation(),i(d=>!d)},onKeyDown:c=>c.stopPropagation(),className:"flex w-full items-center gap-1.5 rounded text-xs text-oai-gray-500 transition-colors hover:text-oai-gray-800 dark:text-oai-gray-400 dark:hover:text-oai-gray-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:[e.jsx(je,{size:13,"aria-hidden":!0}),e.jsx("span",{className:"min-w-0 truncate",children:r("limits.zcode.reset_bank.title")}),o?e.jsx("span",{className:"rounded-full bg-oai-gray-100 px-2 py-0.5 text-[10px] tabular-nums text-oai-gray-600 dark:bg-oai-gray-800 dark:text-oai-gray-300",children:r("limits.zcode.reset_bank.count",{count:o})}):null,e.jsx(le,{size:13,"aria-hidden":!0,className:`ml-auto transition-transform ${a?"rotate-180":""}`})]}),t.error?e.jsx(A,{tone:"error",children:t.error}):null,a&&!t.error?e.jsx("div",{className:"mt-2 flex flex-col gap-1.5",children:l.map(c=>e.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[e.jsx("span",{"data-limit-label":"",className:"shrink-0 whitespace-nowrap text-oai-gray-500 dark:text-oai-gray-400",style:{width:"var(--tt-limits-label-w)"},children:c.label}),e.jsx("span",{className:"rounded-full bg-oai-gray-100 px-2 py-0.5 tabular-nums text-oai-gray-600 dark:bg-oai-gray-800 dark:text-oai-gray-300",children:r("limits.zcode.reset_bank.count",{count:c.cards.length})}),e.jsx("div",{className:"relative min-w-0 flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",title:c.batchTitle,children:e.jsx("div",{className:"bg-oai-gray-400 dark:bg-oai-gray-500 rounded-full h-full transition-[width] duration-500 ease-out",style:{width:`${c.countdownPercent}%`,minWidth:c.countdownPercent>0?"3px":0}})}),c.cards.length?e.jsx("span",{className:"ml-auto shrink-0 whitespace-nowrap text-right text-[10px] tabular-nums text-oai-gray-400 dark:text-oai-gray-500",title:c.batchTitle,children:r("limits.zcode.reset_bank.earliest",{time:Q(Date.parse(c.cards[0].expires_at))})}):null]},c.key))}):null]})}function ht(t,a){if(t==="zcode_reset_bank")return gt(a.reset_credits,Date.now())?e.jsx(wa,{data:a.reset_credits}):null;if(t==="codex_meta"){const i=na(a.reset_credits);return i?e.jsx(ka,{model:i}):null}if(t==="kimi_parallel"&&a.parallel_limit)return e.jsx(A,{children:r("limits.label.kimi_parallel",{count:a.parallel_limit})});if(t==="kiro_credits"&&Number.isFinite(Number(a.tracked_credits))&&Number(a.tracked_credit_records)>0){const i=ne(a.tracked_credits,{maximumFractionDigits:2});return e.jsx(A,{children:r("limits.label.kiro_tracked_credits",{credits:i,count:Number(a.tracked_credit_records)})})}return t==="copilot_otel"&&!a.otel_has_files&&!a.otel_enabled?e.jsx(Ca,{defaultDir:a.otel_default_dir}):null}function Na({data:t,mode:a,now:i}){const[s,n]=p.useState(!1),o=p.useRef(null),l=ft(o),c=[...new Set((t.buckets||[]).map(u=>u.plan_name).filter(Boolean))],d=c.length?c.join(" · "):r("limits.zcode.start_grants"),m=se.zcode.windows(t).filter(u=>u.window).map(u=>({spec:u,pace:nt(u,a,i)}));return e.jsxs("div",{className:"mt-2 border-t border-oai-gray-200/60 pt-2 dark:border-oai-gray-800",children:[e.jsxs("button",{type:"button","aria-expanded":s,onClick:u=>{u.stopPropagation(),n(g=>!g)},onKeyDown:u=>u.stopPropagation(),className:"flex w-full items-center gap-1.5 rounded text-xs text-oai-gray-500 transition-colors hover:text-oai-gray-800 dark:text-oai-gray-400 dark:hover:text-oai-gray-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:[e.jsx(Lt,{size:13,"aria-hidden":!0}),e.jsx("span",{className:"min-w-0 truncate",title:d,children:d}),e.jsx(le,{size:13,"aria-hidden":!0,className:`ml-auto transition-transform ${s?"rotate-180":""}`})]}),s?e.jsx("div",{ref:o,"data-limit-label-group":"",className:"mt-2 flex flex-col gap-1.5",style:l>0?{"--tt-limits-label-w":`${l}px`}:void 0,children:t.error?e.jsx(A,{tone:"error",children:t.error}):e.jsxs(e.Fragment,{children:[e.jsx(pt,{rows:m,mode:a}),e.jsx(ct,{rows:m,mode:a,now:i}),(t.buckets||[]).filter(u=>Number.isFinite(u.remaining_units)&&Number.isFinite(u.total_units)).map((u,g)=>e.jsx("div",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:r("limits.zcode.grant_amount",{remaining:u.remaining_units.toLocaleString(B()),total:u.total_units.toLocaleString(B())})},u.entitlement_id||g))]})}):null]})}function _a(t,a,i,s,n,o,l=null,c=null,d=Date.now(),m=null){const u=se[t];if(!u)return null;const g=u.windows(a).filter(y=>y.window).map(y=>({spec:y,mode:s,pace:nt(y,s,d)})),k=ht(u.extra,a);return e.jsxs(dt,{name:i,providerId:t,expandable:g.length>0||!!c,expanded:n,onToggle:o,badge:l,rightAdornment:c?e.jsx(ut,{subscription:c}):null,toggleOnHeader:t==="zcode",children:[e.jsx(pt,{mode:s,rows:g,extra:k,expanded:n}),t==="opencodeGo"||t==="commandCode"?e.jsx(Pa,{providerId:t,data:a,onSaved:m}):null,c?e.jsx(mt,{subscription:c,now:d,mode:s}):null,n?e.jsx(ct,{rows:g,mode:s,now:d}):null,n&&c?e.jsx(xt,{subscription:c,now:d}):null,t==="zcode"&&a.start_plan?.configured?e.jsx(Na,{data:a.start_plan,mode:s,now:d}):null]},t)}function fe(t,a,i,s,n=null,o=Date.now(),l=S.USED){const c=!!n;return e.jsxs(dt,{name:oe(t),providerId:t,expandable:c,expanded:i,onToggle:s,rightAdornment:c?e.jsx(ut,{subscription:n}):null,children:[a,c?e.jsx(mt,{subscription:n,now:o,mode:l}):null,c&&i?e.jsx("div",{className:"mt-1",children:e.jsx(xt,{subscription:n,now:o})}):null]},t)}function Sa(t,a,i,s,n,o=null,l=Date.now(),c=null){if(!se[t])return null;if(!a?.configured)return fe(t,e.jsxs(e.Fragment,{children:[e.jsx(A,{children:r("limits.status.not_connected")}),t==="opencodeGo"?e.jsx(T,{title:r("limits.opencodeGo.setupHint.title"),children:e.jsx(Re,{onSaved:c})}):null,t==="commandCode"?e.jsx(T,{title:r("limits.commandCode.setupHint.title"),children:e.jsx(Ie,{onSaved:c})}):null,t==="codingPlan"?e.jsx(T,{title:r("limits.codingPlan.setupHint.title"),children:e.jsx(He,{})}):null,t==="agentPlan"?e.jsx(T,{title:r("limits.agentPlan.setupHint.title"),children:e.jsx(Oe,{})}):null,t==="devin"?e.jsx(T,{title:r("limits.devin.setupHint.title"),children:e.jsx(Ae,{})}):null]}),s,n,o,l,i);if(t==="opencodeGo"&&a.subscription_status==="inactive")return fe(t,e.jsx(A,{children:r("limits.opencodeGo.status.inactive")}),s,n,o,l,i);if(a.error)return fe(t,e.jsxs(e.Fragment,{children:[e.jsx(A,{tone:"error",children:a.error}),t==="kiro"?ht(se.kiro.extra,a):null,t==="opencodeGo"?e.jsx(T,{title:r("limits.opencodeGo.setupHint.title"),children:e.jsx(Re,{onSaved:c})}):null,t==="commandCode"?e.jsx(T,{title:r("limits.commandCode.setupHint.title"),children:e.jsx(Ie,{onSaved:c})}):null,t==="codingPlan"?e.jsx(T,{title:r("limits.codingPlan.setupHint.title"),children:e.jsx(He,{})}):null,t==="agentPlan"?e.jsx(T,{title:r("limits.agentPlan.setupHint.title"),children:e.jsx(Oe,{})}):null,t==="devin"?e.jsx(T,{title:r("limits.devin.setupHint.title"),children:e.jsx(Ae,{})}):null]}),s,n,o,l,i);const d=oe(t),m=a.plan_label?`${d} ${a.plan_label}`:d;let u=null;if(a.auth_action_required==="reauth"){const k=t==="commandCode"?tt():t==="devin"?at():fa[t];u=e.jsx(K,{label:r("limits.reauth.badge"),age:J(a.cached_at),tone:"stale",tooltip:k?r("limits.reauth.tooltip",{command:k}):null})}if(!u&&t==="antigravity")if(a.cached){const k=J(a.cached_at);u=e.jsx(K,{label:r("limits.label.antigravity_cached"),age:k,tone:"cached",tooltip:r("limits.tooltip.antigravity_cached")})}else u=e.jsx(K,{label:r("limits.label.antigravity_live"),tone:"live",tooltip:r("limits.tooltip.antigravity_live")});!u&&(t==="qoder"||t==="qoderCn")&&a.cached&&(u=e.jsx(K,{label:r("limits.label.antigravity_cached"),age:J(a.cached_at),tone:"cached",tooltip:r("limits.tooltip.qoder_cached")})),!u&&(t==="codingPlan"||t==="agentPlan")&&a.cached&&(u=e.jsx(K,{label:r("limits.label.antigravity_cached"),age:J(a.cached_at),tone:"cached",tooltip:r("limits.tooltip.ark_cached")}));const g=a.provenance;return g?.stale&&!u&&(u=e.jsx(K,{label:r("limits.provenance.stale"),age:J(g.captured_at),tone:"stale",tooltip:r("limits.provenance.tooltip",{source:g.source,confidence:g.confidence})})),_a(t,a,m,i,s,n,u,o,l,c)}function Ca({defaultDir:t}){const[a,i]=p.useState(!1),n=["export COPILOT_OTEL_ENABLED=true","export COPILOT_OTEL_EXPORTER_TYPE=file",`export COPILOT_OTEL_FILE_EXPORTER_PATH="${t||"$HOME/.copilot/otel"}/copilot-otel-$(date +%Y%m%d).jsonl"`].join(`
|
|
4
|
+
`),o=async l=>{l.stopPropagation();try{await navigator.clipboard.writeText(n),i(!0),setTimeout(()=>i(!1),1600)}catch{}};return e.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:[e.jsx("div",{className:"font-medium text-oai-gray-700 dark:text-oai-gray-200",children:r("limits.copilot.otelHint.title")}),e.jsx("div",{className:"mt-0.5 leading-snug",children:r("limits.copilot.otelHint.body")}),e.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}),e.jsx("button",{type:"button",onClick:o,className:"mt-1 inline-flex items-center gap-1 rounded border border-oai-gray-300 dark:border-oai-gray-700 px-1.5 py-0.5 text-[10.5px] text-oai-gray-700 dark:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:a?r("limits.copilot.otelHint.copied"):r("limits.copilot.otelHint.copy")})]})}function D({n:t,children:a}){return e.jsxs("li",{className:"flex gap-2.5",children:[e.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:t}),e.jsx("div",{className:"min-w-0 flex-1 leading-snug",children:a})]})}function we(){return e.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:e.jsx("path",{d:"M4.5 2.75h4.75V7.5M9.25 2.75 3 9"})})}function Ne({provider:t,onSaved:a}){const[i,s]=p.useState(""),[n,o]=p.useState("idle"),[l,c]=p.useState(!1),d=async m=>{m.preventDefault(),m.stopPropagation();const u=i.trim();if(!(!u||n==="saving")){o("saving"),c(!1);try{await jt(t,u),s(""),o("saved"),a?.()}catch{o("idle"),c(!0)}}};return e.jsxs("form",{className:"mt-1.5 space-y-1.5",onSubmit:d,onClick:m=>m.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"password",value:i,onChange:m=>{s(m.target.value),o("idle"),c(!1)},placeholder:r("limits.apiKey.placeholder"),"aria-label":r("limits.apiKey.placeholder"),autoComplete:"new-password",spellCheck:!1,className:"min-w-0 flex-1 rounded-md border border-oai-gray-300 bg-white px-2 py-1 font-mono text-[11px] text-oai-gray-800 outline-none focus:border-oai-brand dark:border-oai-gray-700 dark:bg-oai-gray-900 dark:text-oai-gray-100"}),e.jsx("button",{type:"submit",disabled:!i.trim()||n==="saving",className:"shrink-0 rounded-md bg-oai-brand/10 px-2 py-1 font-medium text-oai-brand hover:bg-oai-brand/15 disabled:opacity-50 transition-colors",children:n==="saving"?r("limits.apiKey.saving"):n==="saved"?r("limits.apiKey.saved"):r("limits.apiKey.save")})]}),e.jsx("div",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:l?r("limits.apiKey.save_failed"):r("limits.apiKey.local_note")})]})}function Pa({providerId:t,data:a,onSaved:i}){if(a?.credential_source!=="env")return null;const s=da[t],n=ua[t];return!s||!n?null:e.jsxs("div",{className:"mt-1.5 rounded-md border border-amber-300/60 bg-amber-50/60 px-2 py-1.5 text-[10.5px] leading-snug text-amber-800 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200",children:[e.jsx("div",{children:r("limits.apiKey.env_note",{env:s})}),e.jsx(Ne,{provider:n,onSaved:i}),et()==="macos"?e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1.5",children:[e.jsx("code",{className:"rounded bg-white/70 px-1 py-0.5 font-mono text-[10px] dark:bg-oai-gray-900/60",children:r("limits.apiKey.env_unset_command",{env:s})}),e.jsx("span",{children:r("limits.apiKey.env_unset_note")})]}):null]})}function T({title:t,children:a}){return e.jsxs("div",{className:"text-xs text-oai-gray-600 dark:text-oai-gray-300",onClick:i=>i.stopPropagation(),onKeyDown:i=>i.stopPropagation(),children:[e.jsx("div",{className:"font-medium text-oai-gray-800 dark:text-oai-gray-100",children:t}),a]})}function Re({onSaved:t}){return e.jsxs("div",{className:"mt-3 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("div",{className:"mt-0.5 leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:r("limits.opencodeGo.setupHint.subtitle")}),e.jsxs("ol",{className:"mt-2.5 space-y-2.5",children:[e.jsxs(D,{n:"1",children:[e.jsx("div",{children:r("limits.opencodeGo.setupHint.step1")}),e.jsxs("a",{href:"https://opencode.ai",target:"_blank",rel:"noreferrer",onClick:a=>a.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"),e.jsx(we,{})]})]}),e.jsx(D,{n:"2",children:e.jsx("div",{children:r("limits.opencodeGo.setupHint.step2")})}),e.jsxs(D,{n:"3",children:[e.jsx("div",{children:r("limits.opencodeGo.setupHint.step3")}),e.jsx(Ne,{provider:"opencode-go",onSaved:t})]})]})]})}function Ie({onSaved:t}){const a=tt();return e.jsxs("div",{className:"mt-3 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("div",{className:"mt-0.5 leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:r("limits.commandCode.setupHint.subtitle")}),e.jsxs("ol",{className:"mt-2.5 space-y-2.5",children:[e.jsxs(D,{n:"1",children:[e.jsx("div",{children:r("limits.commandCode.setupHint.step1")}),e.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:a})]}),e.jsxs(D,{n:"2",children:[e.jsx("div",{children:r("limits.commandCode.setupHint.step2")}),e.jsx(Ne,{provider:"command-code",onSaved:t})]})]})]})}function Ae(){const t=at();return e.jsxs("div",{className:"mt-3 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("div",{className:"mt-0.5 leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:r("limits.devin.setupHint.subtitle")}),e.jsx("ol",{className:"mt-2.5 space-y-2.5",children:e.jsxs(D,{n:"1",children:[e.jsx("div",{children:r("limits.devin.setupHint.step1")}),e.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:t}),e.jsx("div",{className:"mt-1 text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:r("limits.devin.setupHint.note")})]})})]})}function He(){const[t,a]=p.useState(!1),i=["npm install -g @volcengine/ark-cli","arkcli auth login volc-sso # browser SSO (recommended)","arkcli auth status # verify the session"].join(`
|
|
5
|
+
`),s=async n=>{n.stopPropagation();try{await navigator.clipboard.writeText(i),a(!0),setTimeout(()=>a(!1),1600)}catch{}};return e.jsxs("div",{className:"mt-3 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("div",{className:"mt-0.5 leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:r("limits.codingPlan.setupHint.subtitle")}),e.jsxs("ol",{className:"mt-2.5 space-y-2.5",children:[e.jsxs(D,{n:"1",children:[e.jsx("div",{children:r("limits.codingPlan.setupHint.step1")}),e.jsxs("a",{href:"https://www.volcengine.com/docs/82379/2536875",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.codingPlan.setupHint.cta"),e.jsx(we,{})]})]}),e.jsxs(D,{n:"2",children:[e.jsx("div",{children:r("limits.codingPlan.setupHint.step2")}),e.jsx("div",{className:"mt-0.5 text-oai-gray-500 dark:text-oai-gray-400",children:r("limits.codingPlan.setupHint.step2_remote")})]}),e.jsxs(D,{n:"3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:r("limits.codingPlan.setupHint.step3")}),e.jsx("button",{type:"button",onClick:s,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:t?r("limits.codingPlan.setupHint.copied"):r("limits.codingPlan.setupHint.copy")})]}),e.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}),e.jsx("div",{className:"mt-1 text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:r("limits.codingPlan.setupHint.note_app")})]})]})]})}function Oe(){const[t,a]=p.useState(!1),i=[r("limits.agentPlan.setupHint.snippet_install"),r("limits.agentPlan.setupHint.snippet_login"),r("limits.agentPlan.setupHint.snippet_status")].join(`
|
|
6
|
+
`),s=async n=>{n.stopPropagation();try{await navigator.clipboard.writeText(i),a(!0),setTimeout(()=>a(!1),1600)}catch{}};return e.jsxs("div",{className:"mt-3 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("div",{className:"mt-0.5 leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:r("limits.agentPlan.setupHint.subtitle")}),e.jsxs("ol",{className:"mt-2.5 space-y-2.5",children:[e.jsxs(D,{n:"1",children:[e.jsx("div",{children:r("limits.agentPlan.setupHint.step1")}),e.jsxs("a",{href:"https://www.volcengine.com/docs/82379/2536875",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.agentPlan.setupHint.cta"),e.jsx(we,{})]})]}),e.jsxs(D,{n:"2",children:[e.jsx("div",{children:r("limits.agentPlan.setupHint.step2")}),e.jsx("div",{className:"mt-0.5 text-oai-gray-500 dark:text-oai-gray-400",children:r("limits.agentPlan.setupHint.step2_remote")})]}),e.jsxs(D,{n:"3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{children:r("limits.agentPlan.setupHint.step3")}),e.jsx("button",{type:"button",onClick:s,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:t?r("limits.agentPlan.setupHint.copied"):r("limits.agentPlan.setupHint.copy")})]}),e.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}),e.jsx("div",{className:"mt-1 text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:r("limits.agentPlan.setupHint.note_app")})]})]})]})}function ft(t){const[a,i]=p.useState(0);return p.useLayoutEffect(()=>{const s=t.current;if(!s)return;const n=[...s.querySelectorAll("[data-limit-label]")].filter(d=>d.closest("[data-limit-label-group]")===s);let o=0,l=null;if(n.length>0)try{l=document.createElement("canvas").getContext("2d")}catch{l=null}if(l){const d=window.getComputedStyle(n[0]);l.font=`${d.fontStyle} ${d.fontWeight} ${d.fontSize} ${d.fontFamily}`;for(const m of n)o=Math.max(o,l.measureText(m.textContent).width)}const c=Math.ceil(o);i(d=>d===c?d:c)}),a}function Ma({claude:t,codex:a,cursor:i,gemini:s,kimi:n,kiro:o,grok:l,antigravity:c,copilot:d,zcode:m,opencodeGo:u,commandCode:g,qoder:k,qoderCn:y,codingPlan:h,agentPlan:v,devin:j,workbuddy:M,order:w,visibility:N,displayMode:E,subscriptions:R=[],showSubscriptions:I=!0,onProviderKeySaved:V=null}){const H={claude:t,codex:a,cursor:i,gemini:s,kimi:n,kiro:o,grok:l,antigravity:c,copilot:d,zcode:m,opencodeGo:u,commandCode:g,qoder:k,qoderCn:y,codingPlan:h,agentPlan:v,devin:j,workbuddy:M},ae=p.useRef(null),Y=ft(ae),[$,re]=p.useState(null),[Z,xe]=p.useState(()=>Date.now()),pe=[...new Set((Array.isArray(w)&&w.length>0?w:ba).map(b=>b==="workbuddyAi"?"workbuddy":b))],ge=E===S.REMAINING?S.REMAINING:S.USED;p.useEffect(()=>{const b=setInterval(()=>xe(Date.now()),6e4);return()=>clearInterval(b)},[]);const O=new Map;if(I)for(const b of R||[]){if(!b?.provider)continue;const L=new Date(b.nextBillingAt).getTime();if(!Number.isFinite(L))continue;const z=O.get(b.provider);if(!z){O.set(b.provider,b);continue}const G=new Date(z.nextBillingAt).getTime(),x=L>Z,_=G>Z;(x&&(!_||G>L)||!x&&!_&&L>G)&&O.set(b.provider,b)}const F=pe.filter(b=>!N||N[b]!==!1||O.has(b)).map(b=>Sa(b,H[b],ge,$===b,()=>re(L=>L===b?null:b),O.get(b)||null,Z,V)).filter(Boolean);return e.jsx(Ot,{delay:.15,children:e.jsx("div",{ref:ae,"data-limit-label-group":"",className:"flex flex-col gap-3",style:Y>0?{"--tt-limits-label-w":`${Y}px`}:void 0,children:F.length>0?F:e.jsx(A,{children:r("limits.status.all_hidden")})})})}async function bt(t){const a=await t.json().catch(()=>null);if(!t.ok||a?.ok===!1)throw new Error(a?.error||`Subscription request failed with HTTP ${t.status}`);return a}async function Da(){const t=await fetch("/functions/tokentracker-subscription-manager",{headers:{Accept:"application/json"},cache:"no-store"}),a=await bt(t);return Array.isArray(a.subscriptions)?a.subscriptions:[]}async function _e(t){const a=await wt();return bt(await fetch("/functions/tokentracker-subscription-manager",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",...a},cache:"no-store",body:JSON.stringify(t)}))}function Ea(t){return _e({action:"create",subscription:t})}function Ta(t,a){return _e({action:"update",id:t,subscription:a})}function Ra(t){return _e({action:"delete",id:t})}const be={plan:"",provider:"",cycle:"monthly",autoRenew:!0,startedAt:""};function Ia(t){const a=new Date(t);if(Number.isNaN(a.getTime()))return"";const i=s=>String(s).padStart(2,"0");return`${a.getFullYear()}-${i(a.getMonth()+1)}-${i(a.getDate())}T${i(a.getHours())}:${i(a.getMinutes())}`}function Aa({subscriptions:t,onChanged:a}){const[i,s]=p.useState(!1),[n,o]=p.useState(null),[l,c]=p.useState(be),[d,m]=p.useState(!1),[u,g]=p.useState(!1),[k,y]=p.useState(!1),[h,v]=p.useState(!1),[j,M]=p.useState(null),[w,N]=p.useState(!1),[E,R]=p.useState(!1),[I,V]=p.useState(null),[H,ae]=p.useState(()=>Date.now()),Y=p.useRef(null),$=B(),re=p.useMemo(()=>new Intl.DateTimeFormat($,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),[$]);p.useEffect(()=>{const x=setInterval(()=>ae(Date.now()),6e4);return()=>clearInterval(x)},[]),p.useEffect(()=>{if(!i)return;const x=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;Y.current?.scrollIntoView?.({behavior:x?"auto":"smooth",block:"nearest"})},[i,n]);const Z=p.useMemo(()=>ze.map(x=>{const _=(t||[]).some(C=>C.provider===x&&C.id!==n),f=oe(x);return{value:x,label:_?`${f} ${r("subscriptions.form.provider_taken_suffix")}`:f,disabled:_}}),[$,t,n]),xe=p.useMemo(()=>[{value:"weekly",label:r("subscriptions.form.cycle_weekly")},{value:"monthly",label:r("subscriptions.form.cycle_monthly")},{value:"yearly",label:r("subscriptions.form.cycle_yearly")}],[$]),pe=p.useMemo(()=>[{value:"true",label:r("subscriptions.form.auto_renew_on")},{value:"false",label:r("subscriptions.form.auto_renew_off")}],[$]),ge=p.useCallback(()=>{c(be),o(null),g(!1),y(!1),v(!1),s(!0)},[]),O=p.useCallback(x=>{c({plan:x.plan||"",provider:x.provider||"",cycle:x.cycle||"monthly",autoRenew:x.autoRenew,startedAt:Ia(new Date(sa(x)).toISOString())}),o(x.id),g(!1),y(!1),v(!1),s(!0)},[]),F=p.useCallback(()=>{s(!1),o(null),c(be),g(!1),y(!1),v(!1)},[]),b=p.useCallback(async x=>{if(x.preventDefault(),g(!1),!l.provider){y(!0);return}if((t||[]).some(W=>W.provider===l.provider&&W.id!==n)){v(!0);return}const f=new Date(l.startedAt).getTime();if(!Number.isFinite(f)){g(!0);return}const C={service:oe(l.provider),plan:l.plan,provider:l.provider||null,autoRenew:l.autoRenew,cycle:l.cycle,startedAt:f,nextBillingAt:Je(f,l.cycle)};m(!0);try{n?await Ta(n,C):await Ea(C),F(),await a?.()}catch{g(!0)}finally{m(!1)}},[F,n,l,a,t]),L=p.useCallback(async()=>{if(j){N(!0),R(!1);try{await Ra(j.id),j.id===n&&F(),M(null),await a?.()}catch{R(!0)}finally{N(!1)}}},[F,n,a,j]),z=t||[],G=()=>{const x=n?z.find(f=>f.id===n):null,_=x?ce(x,H):null;return e.jsxs("form",{ref:Y,onSubmit:b,className:"grid grid-cols-1 gap-3 px-3 py-3 text-left sm:grid-cols-2",children:[e.jsx("div",{className:"flex items-center justify-between sm:col-span-2",children:e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400",children:n?r("subscriptions.edit"):r("subscriptions.add")})}),_?e.jsxs("div",{className:"sm:col-span-2 rounded-md bg-oai-gray-50 dark:bg-oai-gray-800/50 px-2.5 py-2 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("span",{className:"text-oai-gray-400 dark:text-oai-gray-500",children:x.autoRenew?r("subscriptions.label.renews_at"):r("subscriptions.label.expires_at")})," ",e.jsx("span",{className:"font-mono tabular-nums",children:re.format(new Date(_.endMs))})," · ",e.jsx("span",{className:_.expired?"text-oai-error":void 0,children:ve(_.endMs,H)})]}):null,e.jsxs("div",{className:"flex flex-col sm:col-span-1",children:[e.jsx("label",{htmlFor:"subscription-provider",className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5",children:r("subscriptions.form.provider")}),e.jsx(he,{id:"subscription-provider",value:l.provider,onValueChange:f=>c({...l,provider:String(f)}),options:Z,matchTriggerWidth:!0,className:"h-10 w-full px-3 text-sm"})]}),e.jsx("div",{className:"sm:col-span-1",children:e.jsx(Pe,{label:r("subscriptions.form.plan"),value:l.plan,maxLength:120,placeholder:r("subscriptions.form.plan_placeholder"),onChange:f=>c({...l,plan:f.target.value})})}),e.jsxs("div",{className:"flex flex-col sm:col-span-1",children:[e.jsx("label",{htmlFor:"subscription-cycle",className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5",children:r("subscriptions.form.cycle")}),e.jsx(he,{id:"subscription-cycle",value:l.cycle,onValueChange:f=>c({...l,cycle:String(f)}),options:xe,matchTriggerWidth:!0,className:"h-10 w-full px-3 text-sm"})]}),e.jsxs("div",{className:"flex flex-col sm:col-span-1",children:[e.jsx("label",{htmlFor:"subscription-auto-renew",className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5",children:r("subscriptions.form.auto_renew")}),e.jsx(he,{id:"subscription-auto-renew",value:String(l.autoRenew),onValueChange:f=>c({...l,autoRenew:f==="true"}),options:pe,matchTriggerWidth:!0,className:"h-10 w-full px-3 text-sm"})]}),e.jsx("div",{className:"sm:col-span-2",children:e.jsx(Pe,{label:r("subscriptions.form.started_at"),type:"datetime-local",value:l.startedAt,required:!0,onChange:f=>c({...l,startedAt:f.target.value})})}),e.jsxs("div",{className:"flex items-center justify-end gap-2 sm:col-span-2",children:[n?e.jsx(X,{type:"button",variant:"secondary",size:"sm",onClick:()=>{const f=z.find(C=>C.id===n);f&&M(f)},className:"!text-red-600 dark:!text-red-400 mr-auto",children:r("subscriptions.delete")}):null,k?e.jsx("p",{className:"mr-auto text-sm text-oai-error",role:"alert",children:r("subscriptions.form.provider_required")}):null,h?e.jsx("p",{className:"mr-auto text-sm text-oai-error",role:"alert",children:r("subscriptions.form.provider_taken")}):null,u?e.jsx("p",{className:"mr-auto text-sm text-oai-error",role:"alert",children:r("subscriptions.form.error")}):null,e.jsx(X,{type:"button",variant:"secondary",size:"sm",onClick:F,children:r("shared.action.cancel")}),e.jsx(X,{type:"submit",size:"sm",disabled:d,children:r("subscriptions.save")})]})]})};return e.jsxs("div",{className:"flex max-h-[min(80vh,42rem)] w-[min(92vw,32rem)] flex-col gap-3 overflow-y-auto rounded-xl border border-oai-gray-200 bg-white p-4 shadow-lg dark:border-oai-gray-700 dark:bg-oai-gray-900",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"min-w-0",children:e.jsx("span",{className:"block truncate text-sm font-semibold text-oai-black dark:text-white",children:r("limits.page.openSubscriptions")})}),e.jsxs(X,{type:"button",size:"sm",onClick:ge,className:"shrink-0 gap-1.5",children:[e.jsx(Ut,{size:14,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:r("subscriptions.add")})]})]}),z.length===0&&!(i&&!n)?e.jsxs("div",{className:"flex flex-col items-center justify-center gap-1 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center dark:border-oai-gray-700",children:[e.jsx(qe,{className:"h-6 w-6 text-oai-gray-300 dark:text-oai-gray-600 mb-2","aria-hidden":!0}),e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:r("subscriptions.empty.title")}),e.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:r("subscriptions.empty.body")})]}):e.jsxs("ul",{className:"flex flex-col gap-1.5",children:[z.map(x=>{const _=ce(x,H);if(!_)return null;const{endMs:f,expired:C}=_,W=C?100:_.progress*100,yt=!C&&f-H<=3*864e5,vt=I===x.id;return e.jsxs("li",{className:"rounded-lg border border-oai-gray-100 dark:border-oai-gray-800",children:[e.jsxs("button",{type:"button",onClick:()=>O(x),"aria-label":`${r("subscriptions.edit")} ${x.service}`,"aria-expanded":n===x.id,className:"w-full flex flex-col gap-1.5 px-3 py-2.5 text-left cursor-pointer hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/40 rounded-lg transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:[e.jsxs("span",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(Be,{provider:Ue(x.provider)||"OTHER",size:14}),e.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-white truncate",children:x.service}),e.jsx("span",{role:"img","aria-label":x.autoRenew?r("subscriptions.badge.auto_renew"):r("subscriptions.badge.stops"),title:x.autoRenew?r("subscriptions.badge.auto_renew"):r("subscriptions.badge.stops"),className:`inline-flex shrink-0 translate-y-px ${x.autoRenew?"text-oai-brand-600 dark:text-oai-brand-400":"text-blue-600 dark:text-blue-400"}`,children:x.autoRenew?e.jsx(Ze,{size:14,strokeWidth:2,"aria-hidden":!0}):e.jsx(je,{size:14,strokeWidth:2,"aria-hidden":!0})}),x.plan?e.jsx("span",{className:"text-xs rounded-full border border-oai-gray-200 dark:border-oai-gray-700 px-2 py-0.5 text-oai-gray-500 dark:text-oai-gray-400 shrink-0",children:x.plan}):null]}),e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[10px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0",children:r("subscriptions.inline.label")}),e.jsx("span",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1 overflow-hidden",children:e.jsx("span",{className:`${C?"bg-red-500":yt?"bg-amber-500":"bg-blue-500"} rounded-full h-full block transition-[width] duration-500 ease-out`,style:{width:`${W}%`,minWidth:W>0?"3px":0}})}),e.jsx("span",{className:`text-[10px] tabular-nums shrink-0 ${C?"text-oai-error":"text-oai-gray-400 dark:text-oai-gray-500"}`,children:Qe(f,H)})]})]}),n===x.id?e.jsx("div",{className:"border-t border-oai-gray-100 dark:border-oai-gray-800",children:G()}):null,n!==x.id&&vt?e.jsxs("div",{className:"px-3 pb-3 flex flex-col gap-2 border-t border-oai-gray-100 dark:border-oai-gray-800",children:[e.jsxs("p",{className:"pt-2 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("span",{className:"text-oai-gray-400 dark:text-oai-gray-500",children:x.autoRenew?r("subscriptions.label.renews_at"):r("subscriptions.label.expires_at")})," ",e.jsx("span",{className:"font-mono tabular-nums",children:re.format(new Date(f))})," · ",e.jsx("span",{className:C?"text-oai-error":void 0,children:ve(f,H)})," · ",e.jsx("span",{children:x.autoRenew?r("subscriptions.status.auto_renew"):r("subscriptions.status.manual")})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(X,{type:"button",variant:"secondary",size:"sm",onClick:()=>O(x),children:r("subscriptions.edit")})})]}):null]},x.id)}),i&&!n?e.jsx("li",{className:"rounded-lg border border-oai-gray-100 dark:border-oai-gray-800",children:G()}):null]}),e.jsx($t,{open:!!j,title:r("subscriptions.confirm_delete_title"),description:j?.service||"",error:E?r("subscriptions.delete_error"):null,confirmLabel:r("subscriptions.delete"),cancelLabel:r("shared.action.cancel"),destructive:!0,busy:w,onCancel:()=>{M(null),R(!1)},onConfirm:L})]})}const Fe=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),Ha="x-apple.systempreferences:com.apple.preference.notifications";function Le(t){const a=Date.parse(t);return Number.isFinite(a)?new Intl.DateTimeFormat(B(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(a)):String(t)}function Oa(t){const a=Object.entries(t||{}).filter(([o,l])=>o!=="fetched_at"&&l&&typeof l=="object"&&l.configured!==!1),i=a.filter(([,o])=>!!o.error),s=a.some(([,o])=>!!o.start_plan?.error||!!o.reset_credits?.error),n=a.filter(([,o])=>o.provenance?.stale===!0||o.provenance?.source==="disk-cache");return a.length&&i.length===0&&!s&&n.length===a.length?{kind:"stale"}:i.length||n.length||s?{kind:"partial",at:t.fetched_at}:{kind:"updated",at:t.fetched_at}}function Fa(){const t=Vt(),a=Mt(),i=r("limits.alert.blocked"),s=a?Ce.button:Ce.div;return e.jsxs(s,{type:a?"button":void 0,onClick:a?()=>Dt({type:"action",name:"openURL",value:Ha}):void 0,initial:t?!1:{opacity:0,x:14,scale:.9},animate:{opacity:1,x:0,scale:1},transition:{type:"spring",stiffness:320,damping:18},title:i,className:`relative hidden sm:inline-flex min-w-0 max-w-[360px] items-center gap-1.5 rounded-full border border-amber-300/70 bg-amber-50 px-3 py-1.5 text-xs text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300 ${a?"cursor-pointer transition-colors hover:bg-amber-100 dark:hover:bg-amber-500/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-500/60":""}`,children:[e.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-amber-500"})]}),e.jsx("span",{className:"truncate",children:i}),e.jsx("span",{"aria-hidden":!0,className:"absolute left-full top-1/2 -translate-y-1/2 border-[5px] border-transparent border-l-amber-300/80 dark:border-l-amber-500/40"})]})}function ur(){const t=Nt(),{data:a,error:i,isLoading:s,refresh:n}=Rt(t?{initialRefresh:!0,initialState:t,publishToPreloadCache:!0}:{initialRefresh:!0,publishToPreloadCache:!0}),o=Ht(),l=It(),[c,d]=P.useState([]),[m,u]=P.useState(!1),[g,k]=P.useState(!1),[y]=_t(),h=P.useRef(0),v=P.useRef(!1),[j,M]=P.useState(!1),[w,N]=P.useState(null),E=P.useCallback(async()=>{if(!v.current){v.current=!0,M(!0),N(null);try{const I=await n();N(I?Oa(I):{kind:"failed"})}finally{v.current=!1,M(!1)}}},[n]),R=P.useCallback(async()=>{if(!Fe&&!Se())return;const I=++h.current;try{const V=await Da();if(I!==h.current)return;d(V),u(!1)}catch{if(I!==h.current)return;u(!0)}},[]);return P.useEffect(()=>{R()},[R]),P.useEffect(()=>{y.get("openSubscriptions")==="1"&&k(!0)},[y]),P.useEffect(()=>{l.enabled&&a&&At(a)},[l.enabled,a]),!Fe&&!Se()?e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx(zt,{})}):e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-6 grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-2 gap-y-2 sm:mb-8 sm:gap-x-4 sm:gap-y-3",children:[e.jsx("h1",{className:"min-w-0 text-2xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white",children:r("nav.limits")}),e.jsxs("div",{className:"flex items-center gap-1 sm:gap-2",children:[l.enabled&&l.permissionBlocked?e.jsx(Fa,{}):null,e.jsx("button",{type:"button",onClick:()=>{E()},disabled:j,"aria-label":r("limits.page.refresh"),title:r("limits.page.refresh"),className:"shrink-0 inline-flex h-10 w-10 sm:h-9 sm: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 disabled:opacity-50",children:e.jsx(St,{className:`h-4 w-4 ${j?"animate-spin":""}`,"aria-hidden":!0})}),e.jsxs(Bt,{open:g,onOpenChange:k,children:[e.jsx(Gt,{"aria-label":r("limits.page.openSubscriptions"),title:r("limits.page.openSubscriptions"),className:"shrink-0 inline-flex h-10 w-10 sm:h-9 sm: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:e.jsx(qe,{className:"h-4 w-4","aria-hidden":!0})}),e.jsx(Wt,{children:e.jsx(Kt,{side:"bottom",align:"end",sideOffset:8,className:"z-50",children:e.jsx(qt,{children:e.jsx(Aa,{subscriptions:c,onChanged:R})})})})]}),e.jsx("button",{type:"button",onClick:()=>{l.setEnabled(!l.enabled)},"aria-label":l.enabled?r("limits.alert.disable"):r("limits.alert.enable"),title:l.enabled?r("limits.alert.disable"):r("limits.alert.enable"),className:`inline-flex h-10 w-10 sm:h-9 sm:w-9 items-center justify-center rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 ${l.enabled&&l.permissionBlocked?"text-amber-600 dark:text-amber-400":"text-oai-gray-600 dark:text-oai-gray-400 hover:text-oai-black dark:hover:text-white"}`,children:l.enabled?e.jsx(Zt,{className:"h-4 w-4","aria-hidden":!0}):e.jsx(Yt,{className:"h-4 w-4","aria-hidden":!0})}),e.jsx(Ct,{to:"/settings?section=limits","aria-label":r("limits.page.openSettings"),title:r("limits.page.openSettings"),className:"shrink-0 inline-flex h-10 w-10 sm:h-9 sm: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:e.jsx(Pt,{className:"h-4 w-4","aria-hidden":!0})})]}),e.jsx("p",{className:"col-span-2 hidden sm:block sm:text-base text-oai-gray-500 dark:text-oai-gray-400",children:r("limits.page.subtitle")})]}),e.jsx("span",{role:"status",className:"sr-only",children:j?r("limits.page.refresh_loading"):""}),w?.kind==="updated"?e.jsx("p",{role:"status",className:"mb-4 text-sm text-emerald-700 dark:text-emerald-300",children:r("limits.page.refreshed_at",{time:Le(w.at)})}):null,w?.kind==="partial"?e.jsx("p",{role:"status",className:"mb-4 text-sm text-amber-600 dark:text-amber-400",children:r("limits.page.refresh_partial",{time:Le(w.at)})}):null,w?.kind==="stale"?e.jsx("p",{role:"status",className:"mb-4 text-sm text-amber-600 dark:text-amber-400",children:r("limits.page.refresh_stale")}):null,w?.kind==="failed"?e.jsx("p",{role:"status",className:"mb-4 text-sm text-amber-600 dark:text-amber-400",children:r("limits.page.refresh_failed")}):null,s?e.jsx(ea,{}):e.jsxs(e.Fragment,{children:[i?e.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:i}):null,m?e.jsx("p",{className:"mb-4 text-sm text-amber-600 dark:text-amber-400",children:r("subscriptions.load_error")}):null,e.jsx(Ma,{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,commandCode:a?.commandCode,qoder:a?.qoder,qoderCn:a?.qoderCn,codingPlan:a?.codingPlan,agentPlan:a?.agentPlan,devin:a?.devin,workbuddy:a?.workbuddy,order:o.order,visibility:o.visibility,displayMode:o.displayMode,subscriptions:c,showSubscriptions:o.showSubscriptions!==!1,onProviderKeySaved:()=>{n()}})]})]})})})}export{ur as LimitsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as h,j as e,c as r}from"./__vite-browser-external-
|
|
1
|
+
import{r as h,j as e,c as r}from"./__vite-browser-external-BEEzY7mq.js";import{A as p}from"./arrow-up-right-XTStagDJ.js";import{D as b}from"./download-DKbKMGSR.js";function I({id:t,value:l,onChange:d,placeholder:c,disabled:i=!1,type:x="text",label:s,error:a,className:g="",...m}){const y=h.useId(),o=t||y,n=a?`${o}-error`:void 0,u=`w-full bg-oai-white dark:bg-oai-gray-900 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md text-oai-black dark:text-oai-white placeholder-oai-gray-400 dark:placeholder-oai-gray-500 transition-all duration-200 focus:outline-none focus:border-oai-brand dark:focus:border-oai-brand focus:ring-1 focus:ring-oai-brand/30 ${i?"bg-oai-gray-50 dark:bg-oai-gray-800 text-oai-gray-400 dark:text-oai-gray-400 cursor-not-allowed":""} ${a?"border-oai-error focus:border-oai-error focus:ring-oai-error/30":""} h-10 px-3 text-sm ${g}`;return e.jsxs("div",{className:"w-full",children:[s&&e.jsx("label",{htmlFor:o,className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5 transition-colors duration-200",children:s}),e.jsx("input",{id:o,type:x,value:l,onChange:d,placeholder:c,disabled:i,"aria-invalid":a?!0:void 0,"aria-describedby":n,className:u,...m}),a&&e.jsx("p",{id:n,className:"mt-1.5 text-sm text-oai-error",children:a})]})}const f="https://github.com/xiufengsun/TokenTracker/releases/latest";function _(){const t=()=>{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:r("local_only.title")}),e.jsx("p",{className:"mt-2 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:r("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:t,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:r("local_only.open_app")}),e.jsx(p,{size:14,strokeWidth:2,"aria-hidden":!0})]}),e.jsxs("a",{href:f,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(b,{size:14,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:r("local_only.download")})]})]})]})})}export{I,_ as L};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as be,Z as ye,a as fe,r as o,q as pe,$ as we,c as a,j as e,y as b}from"./__vite-browser-external-DZF5L1pt.js";import{A as ke}from"./arrow-left-BIe3z7iW.js";const oe={name:"mail",size:24,node:[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]]};oe.node;const ve=be(oe),je=e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1Z",fill:"#4285F4"}),e.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23Z",fill:"#34A853"}),e.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18A10.96 10.96 0 0 0 1 12c0 1.77.42 3.44 1.18 4.93l3.66-2.84Z",fill:"#FBBC05"}),e.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53Z",fill:"#EA4335"})]}),Ne=e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12Z"})}),_e={google:je,github:Ne},Ce={google:"Google",github:"GitHub",microsoft:"Microsoft",discord:"Discord",apple:"Apple"};function Ae(n){return Ce[n]||String(n||"").replace(/-/g," ")}function Pe(n){if(typeof n=="string"&&n.trim())return n.trim();if(n&&typeof n=="object"){if(typeof n.token=="string"&&n.token.trim())return n.token.trim();if(typeof n.otp=="string"&&n.otp.trim())return n.otp.trim()}return""}function Le({title:n,subtitle:H,className:se="",onSuccess:S,oauthReturnPath:Z,hideTitle:ie=!1,hideLogo:G=!1,initialMode:f="signin",tokenFromUrl:E="",initialEmail:p="",initialCode:v=""}){ye();const{enabled:w,configurationError:ne,connectionHost:T,signedIn:j,refreshUser:L,signInWithPassword:V,signUp:U,signInWithOAuth:W,getPublicAuthConfig:$,sendResetPasswordEmail:z,exchangeResetPasswordToken:J,resetPassword:K}=fe(),[l,m]=o.useState(f),[g,k]=o.useState(p),[x,N]=o.useState(""),[O,q]=o.useState(""),[F,le]=o.useState(""),[I,Q]=o.useState(v),[_,h]=o.useState(!1),[X,s]=o.useState(null),[C,y]=o.useState(null),[M,R]=o.useState(!1),[de,ce]=o.useState(!!(f!=="signin"||p)),[A,Y]=o.useState(!0),[P,ee]=o.useState([]),[re,ge]=o.useState(8);o.useEffect(()=>{f&&m(f)},[f]),o.useEffect(()=>{p&&k(p)},[p]),o.useEffect(()=>{v&&Q(v)},[v]),o.useEffect(()=>{if(!w)return;let r=!0;return Y(!0),(async()=>{const{data:t,error:i}=await $();if(!r)return;const c=t&&typeof t=="object"&&!Array.isArray(t)&&Array.isArray(t.oAuthProviders)&&t.oAuthProviders.every(d=>typeof d=="string"&&d.length>0)&&(t.customOAuthProviders===void 0||Array.isArray(t.customOAuthProviders)&&t.customOAuthProviders.every(d=>typeof d=="string"&&d.length>0));if(i||!c)ee(["google","github"]);else{const d=t.oAuthProviders,he=Array.isArray(t.customOAuthProviders)?t.customOAuthProviders:[];ee([...d,...he]),typeof t.passwordMinLength=="number"&&t.passwordMinLength>0&&ge(t.passwordMinLength)}Y(!1)})(),()=>{r=!1}},[w,$]),o.useEffect(()=>{j&&S&&S()},[j,S]);const ae=o.useCallback(()=>typeof window>"u"?"":pe()?"tokentracker://auth/callback":`${window.location.origin}/`,[]),te=o.useMemo(()=>typeof window>"u"?"/reset-password":`${window.location.origin}/reset-password`,[]),B=o.useCallback(async r=>{s(null),h(!0);try{const t=we(Z);if(t)try{window.sessionStorage.setItem("tt.cloud.return",t)}catch{}const{error:i}=await W(r,ae());i&&s(i.message||String(i))}finally{h(!1)}},[W,ae,Z]);o.useEffect(()=>{if(!w||A||j||typeof window>"u")return;const r=window.location.search;if(!r)return;const t=new URLSearchParams(r),i=t.get("native")==="1",c=t.get("provider");i&&c&&[...P].includes(c)&&B(c)},[w,A,j,P,B]);const ue=o.useCallback(async r=>{r.preventDefault(),s(null),h(!0);try{if(l==="signup"){const{data:i,error:c}=await U({email:g.trim(),password:x,name:F.trim()||void 0});if(c){s(c.message||String(c));return}if(i?.requireEmailVerification){y(a("login.verify_email_pending")),m("signin");return}await L();return}const{error:t}=await V({email:g.trim(),password:x});if(t){s(t.message||String(t));return}await L()}finally{h(!1)}},[l,g,x,F,U,V,L]),me=o.useCallback(async r=>{r.preventDefault(),s(null),h(!0);try{const t=g.trim(),{error:i}=await z({email:t,redirectTo:te});if(i){s(i.message||String(i));return}k(t),y(a("reset_password.request.sent")),m("reset_confirm")}finally{h(!1)}},[g,te,z]),xe=o.useCallback(async r=>{if(r.preventDefault(),s(null),x!==O){s(a("reset_password.error.password_mismatch"));return}h(!0);try{let t=E;if(!t){const{data:c,error:d}=await J({email:g.trim(),code:I.trim()});if(d){s(d.message||String(d));return}if(t=Pe(c),!t){s(a("reset_password.error.missing_token"));return}}const{error:i}=await K({newPassword:x,otp:t});if(i){s(i.message||String(i));return}R(!0),y(a("reset_password.success"))}finally{h(!1)}},[I,O,g,J,x,K,E]);if(!w)return ne?e.jsx("p",{role:"alert",className:"p-4 text-sm leading-6 text-oai-gray-700 dark:text-oai-gray-300",children:a("instance.configuration.invalid")}):null;const u=l==="reset_email"||l==="reset_confirm",D=A||!!P.length;return e.jsxs("div",{className:b("w-full bg-white dark:bg-oai-gray-950 p-6 transition-colors duration-200",se),children:[u&&e.jsxs("button",{type:"button",onClick:()=>{m("signin"),y(null),s(null),R(!1),N(""),q("")},className:"flex items-center gap-1.5 text-xs font-medium text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors mb-4 focus:outline-none",children:[e.jsx(ke,{className:"h-3.5 w-3.5"}),a("reset_password.back_to_sign_in")]}),e.jsxs("div",{className:b("mb-6",u?"text-left":"text-center"),children:[!G&&!u&&e.jsxs("div",{className:"flex items-center justify-center gap-2 mb-2",children:[e.jsx("img",{src:"/app-icon.png",alt:"",width:28,height:28,className:"rounded-md"}),e.jsx("span",{className:"text-lg font-semibold text-oai-black dark:text-white font-oai tracking-tight",children:a("shared.app_name")})]}),!ie||u?e.jsx("h2",{className:b("text-sm font-semibold text-oai-black dark:text-white tracking-tight mb-1",(G||u)&&"text-base font-bold md:text-lg"),children:u?a("reset_password.title"):n||a("login_modal.subtitle")}):null,!u&&H&&e.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mt-1.5 leading-relaxed max-w-[320px] mx-auto",children:H}),u&&e.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mt-1.5 leading-relaxed max-w-[320px]",children:C&&l==="reset_confirm"&&!M?C:a("reset_password.subtitle")})]}),T?e.jsx("p",{className:"mb-4 text-center text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:a("instance.connection.destination",{host:T})}):null,C&&(!u||M)&&e.jsx("div",{className:"mb-4 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900/50 px-3 py-2 text-xs text-oai-gray-700 dark:text-oai-gray-300",children:C}),X&&e.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400 text-center",role:"alert",children:X}),l==="reset_email"&&e.jsxs("form",{onSubmit:me,className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-email",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.email")}),e.jsx("input",{id:"card-reset-email",type:"email",autoComplete:"email",required:!0,value:g,onChange:r=>k(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsx("button",{type:"submit",disabled:_,className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:a("reset_password.request.submit")})]}),l==="reset_confirm"&&(M?e.jsx("button",{type:"button",onClick:()=>{m("signin"),R(!1),y(null),s(null),N(""),q("")},className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors text-center shadow-sm",children:a("reset_password.success_cta")}):e.jsxs("form",{onSubmit:xe,className:"space-y-3",children:[!E&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-email-confirm",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.email")}),e.jsx("input",{id:"card-reset-email-confirm",type:"email",autoComplete:"email",required:!0,value:g,onChange:r=>k(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-code",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("reset_password.field.code")}),e.jsx("input",{id:"card-reset-code",type:"text",inputMode:"numeric",autoComplete:"one-time-code",required:!0,value:I,onChange:r=>Q(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-password",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("reset_password.field.new_password")}),e.jsx("input",{id:"card-reset-password",type:"password",autoComplete:"new-password",required:!0,minLength:8,value:x,onChange:r=>N(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-password-confirm",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("reset_password.field.confirm_password")}),e.jsx("input",{id:"card-reset-password-confirm",type:"password",autoComplete:"new-password",required:!0,minLength:8,value:O,onChange:r=>q(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsx("button",{type:"submit",disabled:_,className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:a("reset_password.reset.submit")})]})),!u&&e.jsxs(e.Fragment,{children:[D?e.jsx("div",{className:"space-y-2.5 mb-5",children:A?e.jsxs("div",{className:"space-y-2.5",children:[e.jsx("div",{className:"h-10 rounded-lg bg-oai-gray-100 dark:bg-oai-gray-900/50 animate-pulse"}),e.jsx("div",{className:"h-10 rounded-lg bg-oai-gray-100 dark:bg-oai-gray-900/50 animate-pulse"})]}):P.map(r=>e.jsxs("button",{type:"button",disabled:_,onClick:()=>B(r),className:b("w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-900 text-sm font-medium text-oai-black dark:text-white","hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:border-oai-gray-300 dark:hover:border-oai-gray-600 transition-colors disabled:opacity-50","flex items-center justify-center gap-2.5"),children:[_e[r]||null,a("login.oauth.continue",{provider:Ae(r)})]},r))}):null,de?e.jsxs(e.Fragment,{children:[D?e.jsxs("div",{className:"relative mb-5",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t border-oai-gray-200 dark:border-oai-gray-800"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase tracking-wider",children:e.jsx("span",{className:"bg-white dark:bg-oai-gray-950 px-3 text-oai-gray-400 dark:text-oai-gray-600",children:a("login_modal.divider_email")})})]}):null,e.jsxs("div",{className:"flex rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 p-0.5 bg-oai-gray-50 dark:bg-oai-gray-900/50 mb-4",children:[e.jsx("button",{type:"button",className:b("flex-1 py-1.5 text-xs font-medium rounded-md transition-colors",l==="signin"?"bg-white dark:bg-oai-gray-800 text-oai-black dark:text-white shadow-sm":"text-oai-gray-500 hover:text-oai-gray-700 dark:hover:text-oai-gray-300"),onClick:()=>{m("signin"),s(null)},children:a("login.tab.sign_in")}),e.jsx("button",{type:"button",className:b("flex-1 py-1.5 text-xs font-medium rounded-md transition-colors",l==="signup"?"bg-white dark:bg-oai-gray-800 text-oai-black dark:text-white shadow-sm":"text-oai-gray-500 hover:text-oai-gray-700 dark:hover:text-oai-gray-300"),onClick:()=>{m("signup"),s(null)},children:a("login.tab.sign_up")})]}),e.jsxs("form",{onSubmit:ue,className:"space-y-3",children:[l==="signup"&&e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-name",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.name")}),e.jsx("input",{id:"card-name",type:"text",autoComplete:"name",value:F,onChange:r=>le(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500",placeholder:a("login.field.name_placeholder")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-email",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.email")}),e.jsx("input",{id:"card-email",type:"email",autoComplete:"email",required:!0,value:g,onChange:r=>k(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-password",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.password")}),e.jsx("input",{id:"card-password",type:"password",autoComplete:l==="signup"?"new-password":"current-password",required:!0,minLength:l==="signup"?re:void 0,value:x,onChange:r=>N(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"}),l==="signup"&&e.jsx("p",{className:"mt-1 text-xs text-oai-gray-400 dark:text-oai-gray-600",children:a("login.password_hint",{min:String(re)})}),l==="signin"&&e.jsx("div",{className:"mt-1 text-right",children:e.jsx("button",{type:"button",onClick:()=>{m("reset_email"),s(null),y(null)},className:"text-xs font-medium text-oai-gray-500 hover:text-oai-black dark:hover:text-white no-underline bg-transparent border-0 p-0 cursor-pointer focus:outline-none",children:a("login.forgot_password")})})]}),e.jsx("button",{type:"submit",disabled:_,className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:l==="signup"?a("login.submit.sign_up"):a("login.submit.sign_in")})]})]}):e.jsxs(e.Fragment,{children:[D?e.jsxs("div",{className:"relative mb-5",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t border-oai-gray-200 dark:border-oai-gray-800"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase tracking-wider",children:e.jsx("span",{className:"bg-white dark:bg-oai-gray-950 px-3 text-oai-gray-400 dark:text-oai-gray-600",children:a("login.divider")})})]}):null,e.jsxs("button",{type:"button",onClick:()=>ce(!0),className:b("w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-900 text-sm font-medium text-oai-black dark:text-white","hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:border-oai-gray-300 dark:hover:border-oai-gray-600 transition-colors","flex items-center justify-center gap-2.5"),children:[e.jsx(ve,{className:"h-[18px] w-[18px] text-oai-gray-500 dark:text-oai-gray-400",strokeWidth:1.75}),a("login_modal.continue_email")]})]})]})]})}export{Le as L};
|
|
1
|
+
import{o as be,Z as ye,a as fe,r as o,q as pe,$ as we,c as a,j as e,y as b}from"./__vite-browser-external-BEEzY7mq.js";import{A as ke}from"./arrow-left-D6zkcLVt.js";const oe={name:"mail",size:24,node:[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]]};oe.node;const ve=be(oe),je=e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1Z",fill:"#4285F4"}),e.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23Z",fill:"#34A853"}),e.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18A10.96 10.96 0 0 0 1 12c0 1.77.42 3.44 1.18 4.93l3.66-2.84Z",fill:"#FBBC05"}),e.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53Z",fill:"#EA4335"})]}),Ne=e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12Z"})}),_e={google:je,github:Ne},Ce={google:"Google",github:"GitHub",microsoft:"Microsoft",discord:"Discord",apple:"Apple"};function Ae(n){return Ce[n]||String(n||"").replace(/-/g," ")}function Pe(n){if(typeof n=="string"&&n.trim())return n.trim();if(n&&typeof n=="object"){if(typeof n.token=="string"&&n.token.trim())return n.token.trim();if(typeof n.otp=="string"&&n.otp.trim())return n.otp.trim()}return""}function Le({title:n,subtitle:H,className:se="",onSuccess:S,oauthReturnPath:Z,hideTitle:ie=!1,hideLogo:G=!1,initialMode:f="signin",tokenFromUrl:E="",initialEmail:p="",initialCode:v=""}){ye();const{enabled:w,configurationError:ne,connectionHost:T,signedIn:j,refreshUser:L,signInWithPassword:V,signUp:U,signInWithOAuth:W,getPublicAuthConfig:$,sendResetPasswordEmail:z,exchangeResetPasswordToken:J,resetPassword:K}=fe(),[l,m]=o.useState(f),[g,k]=o.useState(p),[x,N]=o.useState(""),[O,q]=o.useState(""),[F,le]=o.useState(""),[I,Q]=o.useState(v),[_,h]=o.useState(!1),[X,s]=o.useState(null),[C,y]=o.useState(null),[M,R]=o.useState(!1),[de,ce]=o.useState(!!(f!=="signin"||p)),[A,Y]=o.useState(!0),[P,ee]=o.useState([]),[re,ge]=o.useState(8);o.useEffect(()=>{f&&m(f)},[f]),o.useEffect(()=>{p&&k(p)},[p]),o.useEffect(()=>{v&&Q(v)},[v]),o.useEffect(()=>{if(!w)return;let r=!0;return Y(!0),(async()=>{const{data:t,error:i}=await $();if(!r)return;const c=t&&typeof t=="object"&&!Array.isArray(t)&&Array.isArray(t.oAuthProviders)&&t.oAuthProviders.every(d=>typeof d=="string"&&d.length>0)&&(t.customOAuthProviders===void 0||Array.isArray(t.customOAuthProviders)&&t.customOAuthProviders.every(d=>typeof d=="string"&&d.length>0));if(i||!c)ee(["google","github"]);else{const d=t.oAuthProviders,he=Array.isArray(t.customOAuthProviders)?t.customOAuthProviders:[];ee([...d,...he]),typeof t.passwordMinLength=="number"&&t.passwordMinLength>0&&ge(t.passwordMinLength)}Y(!1)})(),()=>{r=!1}},[w,$]),o.useEffect(()=>{j&&S&&S()},[j,S]);const ae=o.useCallback(()=>typeof window>"u"?"":pe()?"tokentracker://auth/callback":`${window.location.origin}/`,[]),te=o.useMemo(()=>typeof window>"u"?"/reset-password":`${window.location.origin}/reset-password`,[]),B=o.useCallback(async r=>{s(null),h(!0);try{const t=we(Z);if(t)try{window.sessionStorage.setItem("tt.cloud.return",t)}catch{}const{error:i}=await W(r,ae());i&&s(i.message||String(i))}finally{h(!1)}},[W,ae,Z]);o.useEffect(()=>{if(!w||A||j||typeof window>"u")return;const r=window.location.search;if(!r)return;const t=new URLSearchParams(r),i=t.get("native")==="1",c=t.get("provider");i&&c&&[...P].includes(c)&&B(c)},[w,A,j,P,B]);const ue=o.useCallback(async r=>{r.preventDefault(),s(null),h(!0);try{if(l==="signup"){const{data:i,error:c}=await U({email:g.trim(),password:x,name:F.trim()||void 0});if(c){s(c.message||String(c));return}if(i?.requireEmailVerification){y(a("login.verify_email_pending")),m("signin");return}await L();return}const{error:t}=await V({email:g.trim(),password:x});if(t){s(t.message||String(t));return}await L()}finally{h(!1)}},[l,g,x,F,U,V,L]),me=o.useCallback(async r=>{r.preventDefault(),s(null),h(!0);try{const t=g.trim(),{error:i}=await z({email:t,redirectTo:te});if(i){s(i.message||String(i));return}k(t),y(a("reset_password.request.sent")),m("reset_confirm")}finally{h(!1)}},[g,te,z]),xe=o.useCallback(async r=>{if(r.preventDefault(),s(null),x!==O){s(a("reset_password.error.password_mismatch"));return}h(!0);try{let t=E;if(!t){const{data:c,error:d}=await J({email:g.trim(),code:I.trim()});if(d){s(d.message||String(d));return}if(t=Pe(c),!t){s(a("reset_password.error.missing_token"));return}}const{error:i}=await K({newPassword:x,otp:t});if(i){s(i.message||String(i));return}R(!0),y(a("reset_password.success"))}finally{h(!1)}},[I,O,g,J,x,K,E]);if(!w)return ne?e.jsx("p",{role:"alert",className:"p-4 text-sm leading-6 text-oai-gray-700 dark:text-oai-gray-300",children:a("instance.configuration.invalid")}):null;const u=l==="reset_email"||l==="reset_confirm",D=A||!!P.length;return e.jsxs("div",{className:b("w-full bg-white dark:bg-oai-gray-950 p-6 transition-colors duration-200",se),children:[u&&e.jsxs("button",{type:"button",onClick:()=>{m("signin"),y(null),s(null),R(!1),N(""),q("")},className:"flex items-center gap-1.5 text-xs font-medium text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors mb-4 focus:outline-none",children:[e.jsx(ke,{className:"h-3.5 w-3.5"}),a("reset_password.back_to_sign_in")]}),e.jsxs("div",{className:b("mb-6",u?"text-left":"text-center"),children:[!G&&!u&&e.jsxs("div",{className:"flex items-center justify-center gap-2 mb-2",children:[e.jsx("img",{src:"/app-icon.png",alt:"",width:28,height:28,className:"rounded-md"}),e.jsx("span",{className:"text-lg font-semibold text-oai-black dark:text-white font-oai tracking-tight",children:a("shared.app_name")})]}),!ie||u?e.jsx("h2",{className:b("text-sm font-semibold text-oai-black dark:text-white tracking-tight mb-1",(G||u)&&"text-base font-bold md:text-lg"),children:u?a("reset_password.title"):n||a("login_modal.subtitle")}):null,!u&&H&&e.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mt-1.5 leading-relaxed max-w-[320px] mx-auto",children:H}),u&&e.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mt-1.5 leading-relaxed max-w-[320px]",children:C&&l==="reset_confirm"&&!M?C:a("reset_password.subtitle")})]}),T?e.jsx("p",{className:"mb-4 text-center text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:a("instance.connection.destination",{host:T})}):null,C&&(!u||M)&&e.jsx("div",{className:"mb-4 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900/50 px-3 py-2 text-xs text-oai-gray-700 dark:text-oai-gray-300",children:C}),X&&e.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400 text-center",role:"alert",children:X}),l==="reset_email"&&e.jsxs("form",{onSubmit:me,className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-email",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.email")}),e.jsx("input",{id:"card-reset-email",type:"email",autoComplete:"email",required:!0,value:g,onChange:r=>k(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsx("button",{type:"submit",disabled:_,className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:a("reset_password.request.submit")})]}),l==="reset_confirm"&&(M?e.jsx("button",{type:"button",onClick:()=>{m("signin"),R(!1),y(null),s(null),N(""),q("")},className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors text-center shadow-sm",children:a("reset_password.success_cta")}):e.jsxs("form",{onSubmit:xe,className:"space-y-3",children:[!E&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-email-confirm",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.email")}),e.jsx("input",{id:"card-reset-email-confirm",type:"email",autoComplete:"email",required:!0,value:g,onChange:r=>k(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-code",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("reset_password.field.code")}),e.jsx("input",{id:"card-reset-code",type:"text",inputMode:"numeric",autoComplete:"one-time-code",required:!0,value:I,onChange:r=>Q(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-password",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("reset_password.field.new_password")}),e.jsx("input",{id:"card-reset-password",type:"password",autoComplete:"new-password",required:!0,minLength:8,value:x,onChange:r=>N(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-password-confirm",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("reset_password.field.confirm_password")}),e.jsx("input",{id:"card-reset-password-confirm",type:"password",autoComplete:"new-password",required:!0,minLength:8,value:O,onChange:r=>q(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsx("button",{type:"submit",disabled:_,className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:a("reset_password.reset.submit")})]})),!u&&e.jsxs(e.Fragment,{children:[D?e.jsx("div",{className:"space-y-2.5 mb-5",children:A?e.jsxs("div",{className:"space-y-2.5",children:[e.jsx("div",{className:"h-10 rounded-lg bg-oai-gray-100 dark:bg-oai-gray-900/50 animate-pulse"}),e.jsx("div",{className:"h-10 rounded-lg bg-oai-gray-100 dark:bg-oai-gray-900/50 animate-pulse"})]}):P.map(r=>e.jsxs("button",{type:"button",disabled:_,onClick:()=>B(r),className:b("w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-900 text-sm font-medium text-oai-black dark:text-white","hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:border-oai-gray-300 dark:hover:border-oai-gray-600 transition-colors disabled:opacity-50","flex items-center justify-center gap-2.5"),children:[_e[r]||null,a("login.oauth.continue",{provider:Ae(r)})]},r))}):null,de?e.jsxs(e.Fragment,{children:[D?e.jsxs("div",{className:"relative mb-5",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t border-oai-gray-200 dark:border-oai-gray-800"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase tracking-wider",children:e.jsx("span",{className:"bg-white dark:bg-oai-gray-950 px-3 text-oai-gray-400 dark:text-oai-gray-600",children:a("login_modal.divider_email")})})]}):null,e.jsxs("div",{className:"flex rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 p-0.5 bg-oai-gray-50 dark:bg-oai-gray-900/50 mb-4",children:[e.jsx("button",{type:"button",className:b("flex-1 py-1.5 text-xs font-medium rounded-md transition-colors",l==="signin"?"bg-white dark:bg-oai-gray-800 text-oai-black dark:text-white shadow-sm":"text-oai-gray-500 hover:text-oai-gray-700 dark:hover:text-oai-gray-300"),onClick:()=>{m("signin"),s(null)},children:a("login.tab.sign_in")}),e.jsx("button",{type:"button",className:b("flex-1 py-1.5 text-xs font-medium rounded-md transition-colors",l==="signup"?"bg-white dark:bg-oai-gray-800 text-oai-black dark:text-white shadow-sm":"text-oai-gray-500 hover:text-oai-gray-700 dark:hover:text-oai-gray-300"),onClick:()=>{m("signup"),s(null)},children:a("login.tab.sign_up")})]}),e.jsxs("form",{onSubmit:ue,className:"space-y-3",children:[l==="signup"&&e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-name",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.name")}),e.jsx("input",{id:"card-name",type:"text",autoComplete:"name",value:F,onChange:r=>le(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500",placeholder:a("login.field.name_placeholder")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-email",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.email")}),e.jsx("input",{id:"card-email",type:"email",autoComplete:"email",required:!0,value:g,onChange:r=>k(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-password",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.password")}),e.jsx("input",{id:"card-password",type:"password",autoComplete:l==="signup"?"new-password":"current-password",required:!0,minLength:l==="signup"?re:void 0,value:x,onChange:r=>N(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"}),l==="signup"&&e.jsx("p",{className:"mt-1 text-xs text-oai-gray-400 dark:text-oai-gray-600",children:a("login.password_hint",{min:String(re)})}),l==="signin"&&e.jsx("div",{className:"mt-1 text-right",children:e.jsx("button",{type:"button",onClick:()=>{m("reset_email"),s(null),y(null)},className:"text-xs font-medium text-oai-gray-500 hover:text-oai-black dark:hover:text-white no-underline bg-transparent border-0 p-0 cursor-pointer focus:outline-none",children:a("login.forgot_password")})})]}),e.jsx("button",{type:"submit",disabled:_,className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:l==="signup"?a("login.submit.sign_up"):a("login.submit.sign_in")})]})]}):e.jsxs(e.Fragment,{children:[D?e.jsxs("div",{className:"relative mb-5",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t border-oai-gray-200 dark:border-oai-gray-800"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase tracking-wider",children:e.jsx("span",{className:"bg-white dark:bg-oai-gray-950 px-3 text-oai-gray-400 dark:text-oai-gray-600",children:a("login.divider")})})]}):null,e.jsxs("button",{type:"button",onClick:()=>ce(!0),className:b("w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-900 text-sm font-medium text-oai-black dark:text-white","hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:border-oai-gray-300 dark:hover:border-oai-gray-600 transition-colors","flex items-center justify-center gap-2.5"),children:[e.jsx(ve,{className:"h-[18px] w-[18px] text-oai-gray-500 dark:text-oai-gray-400",strokeWidth:1.75}),a("login_modal.continue_email")]})]})]})]})}export{Le as L};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as p,a as x,r as l,j as a,c as o,X as y}from"./__vite-browser-external-
|
|
1
|
+
import{u as p,a as x,r as l,j as a,c as o,X as y}from"./__vite-browser-external-BEEzY7mq.js";import{L as m}from"./LoginCard-nw9JOc2d.js";import{D as h,a as b,b as f,c as j,d as k,e as v}from"./DialogTitle-DP5TLLbz.js";import{D as w}from"./DialogDescription-0wcygxtH.js";import"./arrow-left-D6zkcLVt.js";import"./composite-BtDzx3a2.js";import"./store-Dv_FYrXK.js";function E(){const{isOpen:c,request:t,closeLoginModal:i,completeLoginModal:s}=p(),{enabled:d,configurationError:r}=x(),e=t?.id,n=l.useCallback(()=>i(e),[i,e]),g=l.useCallback(()=>{s(e)},[s,e]);return a.jsx(h,{open:c,onOpenChange:u=>{u||n()},children:a.jsxs(b,{children:[a.jsx(f,{className:"fixed inset-0 z-[100] bg-black/40 transition-opacity duration-200 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 dark:bg-black/60"}),a.jsx(j,{className:"fixed inset-0 z-[101] flex items-center justify-center overflow-y-auto overscroll-contain p-4",children:a.jsxs(k,{className:"relative max-h-[calc(100dvh-2rem)] w-full max-w-[420px] overflow-y-auto overscroll-contain rounded-2xl border border-oai-gray-200 bg-white shadow-2xl transition-[opacity,transform] duration-200 data-[ending-style]:translate-y-2 data-[ending-style]:scale-[0.95] data-[ending-style]:opacity-0 data-[starting-style]:translate-y-2 data-[starting-style]:scale-[0.95] data-[starting-style]:opacity-0 motion-reduce:transition-none dark:border-oai-gray-800 dark:bg-oai-gray-950",children:[a.jsx(v,{className:"sr-only",children:o("login.title")}),t?.subtitle?a.jsx(w,{className:"sr-only",children:t.subtitle}):null,a.jsx("button",{type:"button",onClick:n,"aria-label":o("shared.dialog.close"),className:"absolute right-2 top-2 z-10 flex h-11 w-11 items-center justify-center rounded-md text-oai-gray-400 transition-colors hover:text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:text-oai-gray-500 dark:hover:text-white",children:a.jsx(y,{className:"h-5 w-5","aria-hidden":!0})}),d?a.jsx(m,{title:t?.nextPath?o("login.title"):void 0,hideTitle:!0,subtitle:t?.subtitle,oauthReturnPath:t?.nextPath,onSuccess:g,className:"p-6 bg-transparent"},e):a.jsx("p",{role:r?"alert":"status",className:"p-6 pt-14 text-sm leading-6 text-oai-gray-700 dark:text-oai-gray-300",children:o(r?"instance.configuration.invalid":"login.cloud_only")})]})})]})})}export{E as LoginModal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as j,e as N,a as _,r,c as s,j as e,L as p}from"./__vite-browser-external-
|
|
1
|
+
import{d as j,e as N,a as _,r,c as s,j as e,L as p}from"./__vite-browser-external-BEEzY7mq.js";import{L as k}from"./LoginCard-nw9JOc2d.js";import"./arrow-left-D6zkcLVt.js";function L(n){const t=new URLSearchParams(n).get("next");return typeof t!="string"||t.length===0||!t.startsWith("/")||t.startsWith("//")?"/dashboard":t}function I(){const n=j(),[t,f]=N(),{enabled:o,configurationError:g,loading:x,signedIn:h,refreshUser:m}=_(),a=r.useMemo(()=>L(t.toString()),[t]),l=/^\/(cloud|billing\/checkout)(\?|$)/.test(a),w=l&&new URLSearchParams(a.split("?")[1]).get("intent")==="trial",[y,u]=r.useState(null);r.useEffect(()=>{if(/^\/(cloud|billing\/checkout)(\?|$)/.test(a))try{window.sessionStorage.setItem("tt.cloud.return",a)}catch{}},[a]),r.useEffect(()=>{const d=t.get("insforge_status"),i=t.get("insforge_type"),b=t.get("insforge_error");d==="success"&&i==="verify_email"?u(s("login.verify_email_success")):d==="error"&&i==="verify_email"&&b&&u(s("shared.error.prefix",{error:b}))},[t]);const c=r.useMemo(()=>t.get("native")==="1",[t]);r.useEffect(()=>{if(!(!o||x)&&h){if(c){window.location.href="/auth/native-callback";return}try{window.sessionStorage.removeItem("tt.cloud.return")}catch{}n(a,{replace:!0})}},[o,x,h,n,a,c]),r.useEffect(()=>{o&&m()},[o,m]),r.useEffect(()=>{if(c&&typeof window<"u")try{window.sessionStorage.setItem("tokentracker_native_login","1")}catch{}},[c]);const v=r.useCallback(()=>{f(d=>{const i=new URLSearchParams(d);return i.delete("insforge_status"),i.delete("insforge_type"),i.delete("insforge_error"),i},{replace:!0}),u(null)},[f]);return o?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(p,{to:l?"/cloud":"/",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(l?"cloud.checkout.back":"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:[y?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:y}),e.jsx("button",{type:"button",onClick:v,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(k,{hideLogo:!0,title:s("login.title"),subtitle:s(l?w?"cloud.login.trial_context":"cloud.login.purchase_context":"login.subtitle"),className:"p-8 bg-transparent",onSuccess:()=>{if(c)window.location.href="/auth/native-callback";else{try{window.sessionStorage.removeItem("tt.cloud.return")}catch{}n(a,{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(p,{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",role:g?"alert":void 0,children:g?s("instance.configuration.invalid"):s("login.cloud_only")})})]})}export{I as LoginPage};
|