tokentracker-cli 0.81.2 → 0.81.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dashboard/dist/assets/AchievementBadge-DiSoAalB.js +1 -0
- package/dashboard/dist/assets/AchievementsPage-DI_cvzqy.js +2 -0
- package/dashboard/dist/assets/AchievementsSection-ClWZZNvc.js +1 -0
- package/dashboard/dist/assets/BadgeDetailModal-DpQeG_6H.js +1 -0
- package/dashboard/dist/assets/Card-B0hyofoy.js +1 -0
- package/dashboard/dist/assets/ClawdAnimated-DZJGQ3-9.js +1 -0
- package/dashboard/dist/assets/CommunityStatsModal-Dcikt0kT.js +1 -0
- package/dashboard/dist/assets/ConfirmModal-DCfRP4oI.js +1 -0
- package/dashboard/dist/assets/DashboardPage-DBajsWEp.js +1 -0
- package/dashboard/dist/assets/DevicePage-De6KuFaJ.js +1 -0
- package/dashboard/dist/assets/DialogDescription-uQ4gVIv9.js +1 -0
- package/dashboard/dist/assets/DialogTitle-BvElfi0r.js +1 -0
- package/dashboard/dist/assets/FadeIn-DZoN7vbQ.js +1 -0
- package/dashboard/dist/assets/HeaderGithubStar-C9HQnEsI.js +1 -0
- package/dashboard/dist/assets/{IpCheckPage-CMf9CHFr.js → IpCheckPage-82zniXwO.js} +3 -3
- package/dashboard/dist/assets/{LandingPage-BT61_TqT.js → LandingPage-Df9fdR0n.js} +168 -168
- package/dashboard/dist/assets/LeaderboardAvatar-CjfEgoR8.js +1 -0
- package/dashboard/dist/assets/LeaderboardPage-BdbE6Nhj.js +2 -0
- package/dashboard/dist/assets/{LeaderboardProfileModal-C_kxqOMn.js → LeaderboardProfileModal-CDTK21dp.js} +4 -4
- package/dashboard/dist/assets/{LeaderboardProfilePage-zgNsE0EQ.js → LeaderboardProfilePage-B6QWnwB1.js} +3 -3
- package/dashboard/dist/assets/{LimitsPage-BiQpqxj8.js → LimitsPage-f0L0d15j.js} +4 -4
- package/dashboard/dist/assets/LocalOnlyNotice-DOcSDrOy.js +1 -0
- package/dashboard/dist/assets/LoginPage-WY_sRA7I.js +1 -0
- package/dashboard/dist/assets/PetPage-CNbgNE6f.js +1 -0
- package/dashboard/dist/assets/PopoverPopup-Cv525-dF.js +1 -0
- package/dashboard/dist/assets/ResetPasswordPage-vrcj6bBP.js +1 -0
- package/dashboard/dist/assets/Select-3HkgkO8y.js +1 -0
- package/dashboard/dist/assets/SelectItemText-Bz8FAKEv.js +1 -0
- package/dashboard/dist/assets/SettingsPage-CVldAt69.js +1 -0
- package/dashboard/dist/assets/SkillsPage-Dnz3eGcE.js +1 -0
- package/dashboard/dist/assets/TrendMonitor-OopQ06B8.js +19 -0
- package/dashboard/dist/assets/WidgetsPage-4dWjZkc9.js +1 -0
- package/dashboard/dist/assets/WrappedPage-Dbd-8EKD.js +1 -0
- package/dashboard/dist/assets/__vite-browser-external-CQxW1DuO.css +1 -0
- package/dashboard/dist/assets/__vite-browser-external-CxN2E6q5.js +1312 -0
- package/dashboard/dist/assets/agent-logos-CT9fumzx.js +1 -0
- package/dashboard/dist/assets/arrow-up-right-CGnVz9Km.js +1 -0
- package/dashboard/dist/assets/check-CkI3WNti.js +1 -0
- package/dashboard/dist/assets/copy-Bh3g2_O-.js +1 -0
- package/dashboard/dist/assets/download-BITw7nKX.js +1 -0
- package/dashboard/dist/assets/flame-ByAsnNar.js +1 -0
- package/dashboard/dist/assets/format-tokens-Cu8JtuN4.js +1 -0
- package/dashboard/dist/assets/icons-D9OB0N43.js +1 -0
- package/dashboard/dist/assets/index-lKnLA6Pd.js +1 -0
- package/dashboard/dist/assets/info-Mu2CLf-A.js +1 -0
- package/dashboard/dist/assets/link-2-CSlVaUw9.js +1 -0
- package/dashboard/dist/assets/loader-circle-CYck0YaS.js +1 -0
- package/dashboard/dist/assets/provider-display-BB925tPa.js +42 -0
- package/dashboard/dist/assets/terminal-4YysOnTe.js +1 -0
- package/dashboard/dist/assets/trash-2-C8-ZfrZG.js +1 -0
- package/dashboard/dist/assets/use-community-stats-Cxt-otko.js +1 -0
- package/dashboard/dist/assets/use-limits-display-prefs-BUFZh6fe.js +1 -0
- package/dashboard/dist/assets/use-native-settings-DbdPXxGf.js +1 -0
- package/dashboard/dist/assets/{use-ordered-list-DPbiKnPc.js → use-ordered-list-BZMM-iIj.js} +2 -2
- package/dashboard/dist/assets/use-quality-per-dollar-pref-DXoW5A0_.js +1 -0
- package/dashboard/dist/assets/use-transform-CuAoUb8H.js +1 -0
- package/dashboard/dist/assets/use-usage-limits-BEc3QMzR.js +1 -0
- package/dashboard/dist/assets/useCurrency-CpDnFC0N.js +1 -0
- package/dashboard/dist/assets/useScrollLock-Vyaif-7C.js +1 -0
- package/dashboard/dist/assets/useTokenFormat-B8FrUarf.js +1 -0
- package/dashboard/dist/assets/zap-CdeKJ6HL.js +1 -0
- package/dashboard/dist/index.html +2 -2
- package/dashboard/dist/share.html +2 -2
- package/package.json +1 -1
- package/src/commands/serve.js +8 -6
- package/src/commands/status.js +2 -1
- package/src/commands/sync.js +164 -36
- package/src/lib/codex-context-breakdown.js +330 -13
- package/src/lib/codex-rollout-parser.js +323 -42
- package/src/lib/cursor-store.js +1289 -0
- package/src/lib/diagnostics.js +8 -5
- package/src/lib/fs.js +254 -16
- package/src/lib/local-api.js +106 -17
- package/src/lib/pricing/index.js +8 -0
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/src/lib/rollout.js +101 -9
- package/dashboard/dist/assets/AchievementBadge-DXWHZrAL.js +0 -1
- package/dashboard/dist/assets/AchievementsPage-BhrQXniL.js +0 -2
- package/dashboard/dist/assets/AchievementsSection-gzP3m1Ml.js +0 -1
- package/dashboard/dist/assets/BadgeDetailModal-DGKPuvDU.js +0 -1
- package/dashboard/dist/assets/Card-BRtYQ-Ot.js +0 -1
- package/dashboard/dist/assets/ClawdAnimated-UsNG-qDv.js +0 -1
- package/dashboard/dist/assets/CommunityStatsModal-CJQw-P4t.js +0 -1
- package/dashboard/dist/assets/ConfirmModal-ByY4GDsy.js +0 -1
- package/dashboard/dist/assets/DashboardPage-CuLVnW98.js +0 -19
- package/dashboard/dist/assets/DevicePage-D67CxpmR.js +0 -1
- package/dashboard/dist/assets/DialogClose-Ci8hkTw5.js +0 -1
- package/dashboard/dist/assets/DialogDescription-C9vXUZU0.js +0 -1
- package/dashboard/dist/assets/DialogTitle-sLJxKWjv.js +0 -1
- package/dashboard/dist/assets/FadeIn-xVds37w6.js +0 -1
- package/dashboard/dist/assets/HeaderGithubStar-kK3omgmB.js +0 -1
- package/dashboard/dist/assets/LeaderboardAvatar-DyKz6NdT.js +0 -1
- package/dashboard/dist/assets/LeaderboardPage-DJ4zihJJ.js +0 -2
- package/dashboard/dist/assets/LocalOnlyNotice-DTrrUVbZ.js +0 -1
- package/dashboard/dist/assets/LoginPage-BOM9Q2sI.js +0 -1
- package/dashboard/dist/assets/PetPage-BURk7RG-.js +0 -1
- package/dashboard/dist/assets/PopoverPopup-BV_aoNBd.js +0 -1
- package/dashboard/dist/assets/ResetPasswordPage-SBL2LvXC.js +0 -1
- package/dashboard/dist/assets/Select-BsRdHde3.js +0 -1
- package/dashboard/dist/assets/SelectItemText-DgkrZxIq.js +0 -1
- package/dashboard/dist/assets/SettingsPage-DqxVsfnB.js +0 -1
- package/dashboard/dist/assets/SkillsPage-B0VfWkOh.js +0 -1
- package/dashboard/dist/assets/WidgetsPage-4QQ8wI_g.js +0 -1
- package/dashboard/dist/assets/WrappedPage-BK53khVY.js +0 -1
- package/dashboard/dist/assets/agent-logos-DXpW_Wmz.js +0 -1
- package/dashboard/dist/assets/arrow-up-right-DCc--V5G.js +0 -1
- package/dashboard/dist/assets/check-DqxuosV2.js +0 -1
- package/dashboard/dist/assets/copy-qChAT7MY.js +0 -1
- package/dashboard/dist/assets/download-W9R3sBph.js +0 -1
- package/dashboard/dist/assets/flame-0eyhMnfU.js +0 -1
- package/dashboard/dist/assets/format-tokens-CkfBUcoa.js +0 -1
- package/dashboard/dist/assets/info-DY1O85-U.js +0 -1
- package/dashboard/dist/assets/link-2-B_Z66hFT.js +0 -1
- package/dashboard/dist/assets/loader-circle-xH40lon2.js +0 -1
- package/dashboard/dist/assets/main-CeaB5N36.js +0 -1259
- package/dashboard/dist/assets/main-DAc77vwF.css +0 -1
- package/dashboard/dist/assets/provider-display-C_XKZQcF.js +0 -42
- package/dashboard/dist/assets/trash-2-DVhNJ74r.js +0 -1
- package/dashboard/dist/assets/use-community-stats-CO-nr2Vf.js +0 -1
- package/dashboard/dist/assets/use-limits-display-prefs-RRqmyoxt.js +0 -1
- package/dashboard/dist/assets/use-native-settings-79piPeET.js +0 -1
- package/dashboard/dist/assets/use-quality-per-dollar-pref-DyF49QRF.js +0 -1
- package/dashboard/dist/assets/use-transform-BvXyGAtb.js +0 -1
- package/dashboard/dist/assets/use-usage-limits-BiZ_I-KE.js +0 -1
- package/dashboard/dist/assets/useCurrency-D-C1e7eE.js +0 -1
- package/dashboard/dist/assets/useScrollLock-BfU2EMvG.js +0 -1
- package/dashboard/dist/assets/useTokenFormat-Cm4EvrQp.js +0 -1
- package/dashboard/dist/assets/zap-DlAOTwFs.js +0 -1
package/src/lib/rollout.js
CHANGED
|
@@ -167,6 +167,7 @@ async function listOpencodeMessageFiles(storageDir) {
|
|
|
167
167
|
async function parseRolloutIncremental({
|
|
168
168
|
rolloutFiles,
|
|
169
169
|
cursors,
|
|
170
|
+
codexEventStore,
|
|
170
171
|
queuePath,
|
|
171
172
|
projectQueuePath,
|
|
172
173
|
onProgress,
|
|
@@ -200,8 +201,16 @@ async function parseRolloutIncremental({
|
|
|
200
201
|
// the claudeHashes pattern: it makes an inode-changing re-scan idempotent so an
|
|
201
202
|
// external rewrite of a session file (Codex-Manager's atomic provider-patch on
|
|
202
203
|
// account switch, issue #187) cannot re-count already-counted events.
|
|
204
|
+
const externalCodexEventStore =
|
|
205
|
+
codexEventStore &&
|
|
206
|
+
typeof codexEventStore.has === "function" &&
|
|
207
|
+
typeof codexEventStore.add === "function"
|
|
208
|
+
? codexEventStore
|
|
209
|
+
: null;
|
|
203
210
|
const prevCodexHashes = Array.isArray(cursors?.codexHashes) ? cursors.codexHashes : [];
|
|
204
|
-
if (!Array.isArray(cursors.codexHashes))
|
|
211
|
+
if (!externalCodexEventStore && !Array.isArray(cursors.codexHashes)) {
|
|
212
|
+
cursors.codexHashes = prevCodexHashes;
|
|
213
|
+
}
|
|
205
214
|
let seenCodexEvents = null;
|
|
206
215
|
let newCodexEventKeys = null;
|
|
207
216
|
let newCodexEventKeySet = null;
|
|
@@ -229,7 +238,9 @@ async function parseRolloutIncremental({
|
|
|
229
238
|
hash_set_constructions: 0,
|
|
230
239
|
hash_array_materializations: 0,
|
|
231
240
|
hash_array_materialized_items: 0,
|
|
232
|
-
codex_hash_count:
|
|
241
|
+
codex_hash_count: externalCodexEventStore
|
|
242
|
+
? Number(externalCodexEventStore.size || 0)
|
|
243
|
+
: prevCodexHashes.length,
|
|
233
244
|
});
|
|
234
245
|
}
|
|
235
246
|
const ensureNewCodexEventKeys = () => {
|
|
@@ -242,6 +253,7 @@ async function parseRolloutIncremental({
|
|
|
242
253
|
newCodexEventKeySet.add(key);
|
|
243
254
|
newCodexEventKeys.push(key);
|
|
244
255
|
if (seenCodexEvents) seenCodexEvents.add(key);
|
|
256
|
+
externalCodexEventStore?.add(key);
|
|
245
257
|
};
|
|
246
258
|
const getAppendOnlyCodexEvents = () => {
|
|
247
259
|
if (!appendOnlyCodexEvents) {
|
|
@@ -258,6 +270,20 @@ async function parseRolloutIncremental({
|
|
|
258
270
|
return appendOnlyCodexEvents;
|
|
259
271
|
};
|
|
260
272
|
const getHistoricalCodexEvents = () => {
|
|
273
|
+
if (externalCodexEventStore) {
|
|
274
|
+
if (!historicalCodexEvents) {
|
|
275
|
+
historicalCodexEvents = {
|
|
276
|
+
has(key) {
|
|
277
|
+
return Boolean(
|
|
278
|
+
newCodexEventKeySet?.has(key) ||
|
|
279
|
+
externalCodexEventStore.has(key)
|
|
280
|
+
);
|
|
281
|
+
},
|
|
282
|
+
add: recordNewCodexEvent,
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
return historicalCodexEvents;
|
|
286
|
+
}
|
|
261
287
|
if (!seenCodexEvents) {
|
|
262
288
|
seenCodexEvents = new Set(prevCodexHashes);
|
|
263
289
|
for (const key of newCodexEventKeys || []) seenCodexEvents.add(key);
|
|
@@ -470,11 +496,15 @@ async function parseRolloutIncremental({
|
|
|
470
496
|
const projectBucketsQueued = projectEnabled
|
|
471
497
|
? await enqueueTouchedProjectBuckets({ projectQueuePath, projectState, projectTouchedBuckets })
|
|
472
498
|
: 0;
|
|
473
|
-
|
|
499
|
+
if (!externalCodexEventStore) {
|
|
500
|
+
for (const key of newCodexEventKeys || []) prevCodexHashes.push(key);
|
|
501
|
+
}
|
|
474
502
|
if (syncDiagnostics) {
|
|
475
|
-
syncDiagnostics.codex_hash_count =
|
|
476
|
-
?
|
|
477
|
-
:
|
|
503
|
+
syncDiagnostics.codex_hash_count = externalCodexEventStore
|
|
504
|
+
? Number(externalCodexEventStore.size || 0)
|
|
505
|
+
: Array.isArray(cursors.codexHashes)
|
|
506
|
+
? cursors.codexHashes.length
|
|
507
|
+
: prevCodexHashes.length;
|
|
478
508
|
}
|
|
479
509
|
hourlyState.updatedAt = new Date().toISOString();
|
|
480
510
|
cursors.hourly = hourlyState;
|
|
@@ -489,6 +519,7 @@ async function parseRolloutIncremental({
|
|
|
489
519
|
async function filterColdCodexRolloutFiles({
|
|
490
520
|
rolloutFiles,
|
|
491
521
|
cursors,
|
|
522
|
+
codexCursorStore = null,
|
|
492
523
|
projectEnabled = false,
|
|
493
524
|
auditDue = false,
|
|
494
525
|
nowMs = Date.now(),
|
|
@@ -506,18 +537,50 @@ async function filterColdCodexRolloutFiles({
|
|
|
506
537
|
0,
|
|
507
538
|
);
|
|
508
539
|
syncDiagnostics.discovered_rollouts = discoveredRollouts;
|
|
509
|
-
syncDiagnostics.cursor_keys =
|
|
540
|
+
syncDiagnostics.cursor_keys = Number.isFinite(codexCursorStore?.fileCount)
|
|
541
|
+
? codexCursorStore.fileCount
|
|
542
|
+
: Object.keys(cursors?.files || {}).length;
|
|
510
543
|
syncDiagnostics.cold_skipped = 0;
|
|
511
544
|
syncDiagnostics.parse_candidates = discoveredRollouts;
|
|
512
545
|
}
|
|
513
|
-
if (
|
|
546
|
+
if (
|
|
547
|
+
!codexCursorStore &&
|
|
548
|
+
(auditDue || !cursors?.files || typeof cursors.files !== "object")
|
|
549
|
+
) {
|
|
514
550
|
return { rolloutFiles: files, skipped: 0 };
|
|
515
551
|
}
|
|
516
552
|
|
|
517
553
|
const activeDates = activeCodexRolloutDates(files, { nowMs, recentDays });
|
|
518
554
|
const freshnessCache = new Map();
|
|
555
|
+
const cursorLoadDirectories = new Set();
|
|
556
|
+
const coldDaySkipDecisions = new Map();
|
|
519
557
|
const out = [];
|
|
520
558
|
let skipped = 0;
|
|
559
|
+
let cursorStoreRestarted = false;
|
|
560
|
+
|
|
561
|
+
const loadCodexCursorDirectory = async (filePath) => {
|
|
562
|
+
if (!codexCursorStore) return;
|
|
563
|
+
const directory = path.dirname(filePath);
|
|
564
|
+
if (cursorLoadDirectories.has(directory)) return;
|
|
565
|
+
cursorLoadDirectories.add(directory);
|
|
566
|
+
const result = await codexCursorStore.loadCodexFilesForPaths([filePath], cursors);
|
|
567
|
+
if (result?.restarted) cursorStoreRestarted = true;
|
|
568
|
+
};
|
|
569
|
+
|
|
570
|
+
const canSkipCodexDirectory = async (filePath) => {
|
|
571
|
+
if (!codexCursorStore) return false;
|
|
572
|
+
const directory = path.dirname(filePath);
|
|
573
|
+
if (coldDaySkipDecisions.has(directory)) {
|
|
574
|
+
return coldDaySkipDecisions.get(directory);
|
|
575
|
+
}
|
|
576
|
+
const decision = await codexCursorStore.canSkipCodexDay({
|
|
577
|
+
filePath,
|
|
578
|
+
dayInventoryCache: cursors?.codexDayInventoryCache,
|
|
579
|
+
nowMs,
|
|
580
|
+
});
|
|
581
|
+
coldDaySkipDecisions.set(directory, decision);
|
|
582
|
+
return decision;
|
|
583
|
+
};
|
|
521
584
|
|
|
522
585
|
for (const entry of files) {
|
|
523
586
|
const filePath = typeof entry === "string" ? entry : entry?.path;
|
|
@@ -532,10 +595,27 @@ async function filterColdCodexRolloutFiles({
|
|
|
532
595
|
|
|
533
596
|
const rolloutDate = rolloutDateFromPath(filePath);
|
|
534
597
|
if (!rolloutDate || activeDates.has(rolloutDate)) {
|
|
598
|
+
await loadCodexCursorDirectory(filePath);
|
|
599
|
+
if (cursorStoreRestarted) break;
|
|
535
600
|
out.push(entry);
|
|
536
601
|
continue;
|
|
537
602
|
}
|
|
538
603
|
|
|
604
|
+
if (auditDue) {
|
|
605
|
+
await loadCodexCursorDirectory(filePath);
|
|
606
|
+
if (cursorStoreRestarted) break;
|
|
607
|
+
out.push(entry);
|
|
608
|
+
continue;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
if (await canSkipCodexDirectory(filePath)) {
|
|
612
|
+
skipped += 1;
|
|
613
|
+
continue;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
await loadCodexCursorDirectory(filePath);
|
|
617
|
+
if (cursorStoreRestarted) break;
|
|
618
|
+
|
|
539
619
|
const prev = cursors.files[filePath];
|
|
540
620
|
const cachedSize = Number(prev?.offset);
|
|
541
621
|
if (!Number.isFinite(cachedSize) || cachedSize <= 0) {
|
|
@@ -563,6 +643,18 @@ async function filterColdCodexRolloutFiles({
|
|
|
563
643
|
skipped += 1;
|
|
564
644
|
}
|
|
565
645
|
|
|
646
|
+
if (cursorStoreRestarted) {
|
|
647
|
+
await codexCursorStore.loadCodexFilesForPaths(files, cursors);
|
|
648
|
+
if (syncDiagnostics) {
|
|
649
|
+
syncDiagnostics.cold_skipped = 0;
|
|
650
|
+
syncDiagnostics.parse_candidates = files.reduce(
|
|
651
|
+
(count, entry) => count + (isCodexEntry(entry) ? 1 : 0),
|
|
652
|
+
0,
|
|
653
|
+
);
|
|
654
|
+
}
|
|
655
|
+
return { rolloutFiles: files, skipped: 0, restarted: true };
|
|
656
|
+
}
|
|
657
|
+
|
|
566
658
|
if (syncDiagnostics) {
|
|
567
659
|
syncDiagnostics.cold_skipped = skipped;
|
|
568
660
|
syncDiagnostics.parse_candidates = out.reduce(
|
|
@@ -570,7 +662,7 @@ async function filterColdCodexRolloutFiles({
|
|
|
570
662
|
0,
|
|
571
663
|
);
|
|
572
664
|
}
|
|
573
|
-
return { rolloutFiles: out, skipped };
|
|
665
|
+
return { rolloutFiles: out, skipped, restarted: false };
|
|
574
666
|
}
|
|
575
667
|
|
|
576
668
|
function activeCodexRolloutDates(
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as o,R as N,j as r}from"./main-CeaB5N36.js";import{Z as $}from"./zap-DlAOTwFs.js";import{F as A}from"./flame-0eyhMnfU.js";const j=[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]],E=o("blocks",j);const L=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],C=o("brain",L);const T=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]],z=o("calendar-days",T);const B=[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]],R=o("crown",B);const q=[["path",{d:"M12.67 19a2 2 0 0 0 1.416-.588l6.154-6.172a6 6 0 0 0-8.49-8.49L5.586 9.914A2 2 0 0 0 5 11.328V18a1 1 0 0 0 1 1z",key:"18jl4k"}],["path",{d:"M16 8 2 22",key:"vp34q"}],["path",{d:"M17.5 15H9",key:"1oz8nu"}]],H=o("feather",q);const D=[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]],F=o("folder-git-2",D);const I=[["path",{d:"M4 16v-2.38C4 11.5 2.97 10.5 3 8c.03-2.72 1.49-6 4.5-6C9.37 2 10 3.8 10 5.5c0 3.11-2 5.66-2 8.68V16a2 2 0 1 1-4 0Z",key:"1dudjm"}],["path",{d:"M20 20v-2.38c0-2.12 1.03-3.12 1-5.62-.03-2.72-1.49-6-4.5-6C14.63 6 14 7.8 14 9.5c0 3.11 2 5.66 2 8.68V20a2 2 0 1 0 4 0Z",key:"l2t8xc"}],["path",{d:"M16 17h4",key:"1dejxt"}],["path",{d:"M4 13h4",key:"1bwh8b"}]],G=o("footprints",I);const V=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],S=o("heart",V);const Z=[["path",{d:"M7.21 15 2.66 7.14a2 2 0 0 1 .13-2.2L4.4 2.8A2 2 0 0 1 6 2h12a2 2 0 0 1 1.6.8l1.6 2.14a2 2 0 0 1 .14 2.2L16.79 15",key:"143lza"}],["path",{d:"M11 12 5.12 2.2",key:"qhuxz6"}],["path",{d:"m13 12 5.88-9.8",key:"hbye0f"}],["path",{d:"M8 7h8",key:"i86dvs"}],["circle",{cx:"12",cy:"17",r:"5",key:"qbz8iq"}],["path",{d:"M12 18v-2h-.5",key:"fawc4q"}]],O=o("medal",Z);const P=[["path",{d:"M18 5h4",key:"1lhgn2"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],X=o("moon-star",P);const K=[["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}],["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",key:"u4xsad"}],["path",{d:"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",key:"676m9"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",key:"92ym6u"}]],U=o("rocket",K);const W=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Y=o("shield-check",W);const J=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],Q=o("trending-up",J),k=[{id:"token_titan",scope:"cloud",icon:R,format:"tokens",art:"/achievements/token-titan.png"},{id:"big_day",scope:"cloud",icon:$,format:"tokens",art:"/achievements/big-day.png"},{id:"wordsmith",scope:"cloud",icon:H,format:"tokens",art:"/achievements/wordsmith.png"},{id:"marathoner",scope:"cloud",icon:G,format:"days",art:"/achievements/marathoner.png"},{id:"streak",scope:"cloud",icon:A,format:"days",art:"/achievements/streak.png"},{id:"weekend_warrior",scope:"cloud",icon:z,format:"days",art:"/achievements/weekend-warrior.png"},{id:"momentum",scope:"cloud",icon:Q,format:"multiplier",art:"/achievements/momentum.png"},{id:"polyglot",scope:"cloud",icon:C,format:"count",art:"/achievements/polyglot.png"},{id:"trendsetter",scope:"cloud",icon:U,format:"count",art:"/achievements/trendsetter.png"},{id:"multitool",scope:"cloud",icon:E,format:"count",art:"/achievements/multitool.png"},{id:"podium",scope:"cloud",icon:O,format:"rank",art:"/achievements/podium.png"},{id:"veteran",scope:"cloud",icon:Y,format:"days",art:"/achievements/veteran.png"},{id:"project_hopper",scope:"local",icon:F,format:"count",art:"/achievements/project-hopper.png"},{id:"project_devotion",scope:"local",icon:S,format:"tokens",art:"/achievements/project-devotion.png"},{id:"night_owl",scope:"local",icon:X,format:"count",art:"/achievements/night-owl.png"}],u=new Map(k.map(e=>[e.id,e])),m=new Map(k.map((e,a)=>[e.id,a]));function de(e,a){return`achievements.badge.${e}.${a}`}function ee(e){return[...e||[]].sort((a,t)=>{const c=(t?.tier||0)-(a?.tier||0);return c!==0?c:(m.get(a?.id)??99)-(m.get(t?.id)??99)})}function re(e){const a=(e||[]).filter(t=>t&&(t.tier||0)>=1&&u.has(t.id));return a.length===0?null:ee(a)[0]}const v={1:"bronze",2:"silver",3:"gold",4:"diamond"},ie=["bronze","silver","gold","diamond"],ae={bronze:{rim:["#a06a44","#5c3a22"],face:["#d29a6c","#96602f"],glyph:"#3f2817",ring:"#e8c3a0",sheen:"rgba(255, 236, 220, 0.45)",label:"#a06a44"},silver:{rim:["#aab3bb","#67707b"],face:["#dde2e7","#9ba5ae"],glyph:"#39424b",ring:"#f2f5f7",sheen:"rgba(255, 255, 255, 0.55)",label:"#8b959f"},gold:{rim:["#c9971c","#8a6508"],face:["#f2ca52","#cf9c26"],glyph:"#5c430e",ring:"#ffe9a8",sheen:"rgba(255, 248, 214, 0.55)",label:"#b8860b"},diamond:{rim:["#62b1e0","#7c6fd9"],face:["#c8ecf6","#84b4ea"],glyph:"#27496d",ring:"#eafcff",sheen:"rgba(255, 255, 255, 0.65)",label:"#5a9bd8"}},y={rim:["#a8ada9","#7c817d"],face:["#cdd2ce","#a3a8a4"],glyph:"#6a706c",ring:"#dde1de",sheen:"rgba(255, 255, 255, 0.25)",label:"#8b908c"};function te(e,a=!1){return a||!e||e<1?y:ae[v[Math.min(e,4)]]||y}function se(e){return v[e]||null}const g={xs:18,sm:24,md:44,xl:88,lg:108},f={xs:.75,sm:1,md:1.5,xl:2,lg:2};function le({badgeId:e,tier:a=0,size:t="md",locked:c=!1,label:i,className:M=""}){const s=u.get(e),h=c||!a||a<1,n=te(a,h),d=t==="fill",l=d?"100%":g[t]||g.md,b=d?4:f[t]||f.md,[_,x]=N.useState(!1),p=s?.icon||null,w=!!s?.art&&!_;return r.jsx("span",{role:i?"img":void 0,"aria-label":i||void 0,"aria-hidden":i?void 0:!0,className:`inline-flex shrink-0 rounded-full ${M}`,style:{width:l,height:l,padding:b,background:`linear-gradient(135deg, ${n.rim[0]} 0%, ${n.ring} 42%, ${n.rim[1]} 100%)`,boxShadow:d||t==="md"||t==="xl"||t==="lg"?"0 0 0 1px rgba(10, 15, 12, 0.06), 0 1px 2px rgba(10, 15, 12, 0.08)":void 0},children:w?r.jsx("img",{src:s.art,alt:"",draggable:!1,loading:"lazy",onError:()=>x(!0),className:"h-full w-full rounded-full object-cover",style:h?{filter:"grayscale(1)",opacity:.55}:void 0}):r.jsx("span",{className:"flex h-full w-full items-center justify-center rounded-full",style:{background:`linear-gradient(145deg, ${n.face[0]}, ${n.face[1]})`},children:p?r.jsx(p,{size:d?64:Math.round(l*.5),color:n.glyph,strokeWidth:2}):null})})}export{le as A,k as B,S as H,ae as T,u as a,de as b,ie as c,re as h,te as p,ee as s,se as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/BadgeDetailModal-DGKPuvDU.js","assets/main-CeaB5N36.js","assets/main-DAc77vwF.css","assets/AchievementBadge-DXWHZrAL.js","assets/zap-DlAOTwFs.js","assets/flame-0eyhMnfU.js","assets/use-transform-BvXyGAtb.js","assets/AchievementsSection-gzP3m1Ml.js","assets/format-tokens-CkfBUcoa.js","assets/DialogTitle-sLJxKWjv.js","assets/useScrollLock-BfU2EMvG.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as l,V as x,am as f,U as v,j as e,E as c,L as p,R as g,_ as y,a as b,an as k,a4 as j}from"./main-CeaB5N36.js";import{A as w}from"./AchievementsSection-gzP3m1Ml.js";import{B as h}from"./AchievementBadge-DXWHZrAL.js";import"./format-tokens-CkfBUcoa.js";import"./zap-DlAOTwFs.js";import"./flame-0eyhMnfU.js";function N({enabled:a=!0}={}){const[n,t]=l.useState({status:"loading",achievements:[],error:null}),s=l.useMemo(()=>x(),[]);return l.useEffect(()=>{if(!a){t({status:"disabled",achievements:[],error:null});return}let i=!1;return t(r=>({...r,status:"loading"})),f({timeZone:s,tzOffsetMinutes:v()}).then(r=>{i||t({status:"ready",achievements:Array.isArray(r?.achievements)?r.achievements:[],error:null})}).catch(r=>{i||t({status:"error",achievements:[],error:r})}),()=>{i=!0}},[a,s]),n}const A=g.lazy(()=>j(()=>import("./BadgeDetailModal-DGKPuvDU.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])));function I({authLoading:a,authEnabled:n,authUserId:t,mockEnabled:s}){if(s)return{authLoading:!1,signedIn:!0,userId:"mock-user"};const i=!!(n&&t);return{authLoading:!!a,signedIn:i,userId:i?t:null}}function B(){const a=y(),[n,t]=l.useState({status:"loading",achievements:[],userId:null}),s=b(),{authLoading:i,signedIn:r,userId:o}=I({authLoading:a?.loading,authEnabled:a?.enabled,authUserId:a?.user?.id,mockEnabled:s});return l.useEffect(()=>{if(i){t({status:"loading",achievements:[],userId:null});return}if(!r){t({status:"signed-out",achievements:[],userId:null});return}let d=!1;return t({status:"loading",achievements:[],userId:o}),(async()=>{try{const u=s?null:await a.getAccessToken?.(),m=await k({accessToken:u,userId:o});if(d)return;t({status:"ready",achievements:Array.isArray(m?.badges)?m.badges:[],userId:o})}catch{d||t({status:"error",achievements:[],userId:o})}})(),()=>{d=!0}},[i,s,r,o]),{...n,signedIn:r,settled:_({authLoading:i,signedIn:r,userId:o,state:n})}}function _({authLoading:a,signedIn:n,userId:t,state:s}){return a?!1:n?s.userId===t&&(s.status==="ready"||s.status==="error"):s.status==="signed-out"}function E(){return e.jsx("div",{className:"mx-0 grid animate-pulse grid-cols-[repeat(3,max-content)] justify-between gap-y-7 sm:-mx-2 sm:grid-cols-[repeat(4,max-content)] lg:grid-cols-[repeat(5,max-content)]","aria-hidden":!0,children:Array.from({length:h.length}).map((a,n)=>e.jsxs("div",{className:"flex w-[6.75rem] flex-col items-center px-0 pb-3 pt-4 sm:w-[7.75rem]",children:[e.jsx("div",{className:"h-[108px] w-[108px] rounded-full bg-oai-gray-200 dark:bg-oai-gray-800"}),e.jsx("div",{className:"mt-3 h-3 w-16 rounded bg-oai-gray-200 dark:bg-oai-gray-800"}),e.jsx("div",{className:"mt-2 h-2 w-10 rounded bg-oai-gray-100 dark:bg-oai-gray-800/60"})]},n))})}function R(){const a=N(),n=B(),[t,s]=l.useState(null),i=a.status==="loading"||!n.settled,r=l.useMemo(()=>[...n.achievements||[],...a.achievements||[]],[n.achievements,a.achievements]),o=l.useMemo(()=>r.filter(u=>(u?.tier||0)>=1).length,[r]),d=h.length;return e.jsxs("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:[e.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:e.jsxs("div",{className:"mx-auto max-w-4xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-7 flex items-baseline justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:c("achievements.page.title")}),e.jsx("p",{className:"mt-1.5 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:c("achievements.page.local_note")})]}),!i&&e.jsxs("div",{className:"shrink-0 text-right",children:[e.jsxs("div",{className:"font-mono text-2xl font-semibold leading-none tabular-nums text-oai-black dark:text-white",children:[o,e.jsxs("span",{className:"text-oai-gray-400 dark:text-oai-gray-600",children:["/",d]})]}),e.jsx("div",{className:"mt-2 h-1 w-24 overflow-hidden rounded-full bg-oai-gray-200 dark:bg-oai-gray-800",children:e.jsx("div",{className:"h-full rounded-full bg-oai-brand-600 transition-[width] duration-500",style:{width:`${Math.round(o/d*100)}%`}})})]})]}),!n.signedIn&&!i&&e.jsxs("div",{className:"mb-6 flex flex-wrap items-center justify-between gap-x-4 gap-y-2 rounded-xl border border-oai-gray-200 bg-oai-gray-50 px-4 py-3 dark:border-oai-gray-800 dark:bg-oai-gray-900/60",children:[e.jsx("p",{className:"text-sm text-oai-gray-600 dark:text-oai-gray-300",children:c("achievements.signin.prompt")}),e.jsx(p,{to:"/login",className:"shrink-0 rounded-lg bg-oai-brand-600 px-3 py-1.5 text-sm font-medium text-white transition-colors duration-200 hover:bg-oai-brand-700 active:scale-[0.98]",children:c("achievements.signin.action")})]}),i?e.jsx(E,{}):e.jsxs(e.Fragment,{children:[e.jsx(w,{achievements:r,isOwn:!0,columns:"wide",size:"lg",animateIn:!0,onSelect:s}),e.jsxs("p",{className:"mt-10 text-center text-xs text-oai-gray-400 dark:text-oai-gray-500",children:[c("achievements.page.suggest")," ",e.jsx("a",{href:"https://github.com/mm7894215/TokenTracker/issues",target:"_blank",rel:"noopener noreferrer",className:"underline decoration-oai-gray-300 underline-offset-2 transition-colors hover:text-oai-gray-700 hover:decoration-oai-gray-500 dark:decoration-oai-gray-600 dark:hover:text-oai-gray-300",children:c("achievements.page.suggest_link")})]})]})]})}),t&&e.jsx(g.Suspense,{fallback:null,children:e.jsx(A,{badge:t,onClose:()=>s(null)})})]})}export{_ as cloudBadgesSettled,R as default,I as resolveCloudBadgeIdentity};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as _,u as $,j as s,E as l,m as C}from"./main-CeaB5N36.js";import{B as x,s as b,b as T,t as E,A as B,T as L}from"./AchievementBadge-DXWHZrAL.js";import{f as I}from"./format-tokens-CkfBUcoa.js";const D=[["path",{d:"M10 16h.01",key:"1bzywj"}],["path",{d:"M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"18tbho"}],["path",{d:"M21.946 12.013H2.054",key:"zqlbp7"}],["path",{d:"M6 16h.01",key:"1pmjb7"}]],F=_("hard-drive",D);function G(r,i){const t=Number(i)||0;switch(r){case"tokens":return I(t);case"rank":return`#${Math.round(t)}`;case"multiplier":return`${(Math.round(t*10)/10).toString()}×`;default:return Math.round(t).toLocaleString()}}function H(r){if(!r)return 0;const i=Number(r.next_threshold),t=Number(r.metric_value??r.value);if(!Number.isFinite(i)||i<=0)return r.tier>=4?1:0;if(!Number.isFinite(t)||t<=0)return 0;const n=r.lower_is_better?i/t:t/i;return Math.max(0,Math.min(1,n))}function S(r){const i=r?.achieved||{},t=Object.values(i).map(n=>n?Date.parse(n):NaN).filter(n=>Number.isFinite(n));return t.length>0?Math.max(...t):null}function V({achievements:r,isOwn:i=!1,scope:t,onSelect:n,size:m="xl",columns:v="default",animateIn:y=!1,className:N=""}){const k=$(),u=y&&!k,p=new Map;for(const e of Array.isArray(r)?r:[])e&&e.id&&p.set(e.id,e);const g=t?x.filter(e=>e.scope===t):x;let c;if(i){const e=g.map(a=>({entry:a,record:p.get(a.id)||{id:a.id,tier:0}})),o=b(e.filter(a=>(a.record.tier||0)>=1).map(a=>({...a,id:a.entry.id,tier:a.record.tier}))),h=e.filter(a=>(a.record.tier||0)<1);c=[...o,...h]}else c=b(g.map(e=>({entry:e,record:p.get(e.id)})).filter(e=>e.record&&(e.record.tier||0)>=1).map(e=>({...e,id:e.entry.id,tier:e.record.tier}))).map(({entry:e,record:o})=>({entry:e,record:o}));if(c.length===0)return null;const j=v==="wide"?"grid-cols-[repeat(3,max-content)] sm:grid-cols-[repeat(4,max-content)] lg:grid-cols-[repeat(5,max-content)]":"grid-cols-[repeat(3,max-content)] sm:grid-cols-[repeat(4,max-content)]",w=m==="lg"?"mx-0 sm:-mx-2":"-mx-2 sm:-mx-4",M=m==="lg"?"px-0":"px-1";return s.jsx("div",{className:`${w} grid justify-between gap-y-7 ${j} ${N}`,children:c.map(({entry:e,record:o},h)=>{const a=(o.tier||0)>=1,f=l(T(e.id,"name")),d=a?E(o.tier):null,A=H(o);return s.jsxs(C.button,{type:"button",initial:u?{opacity:0,y:16,scale:.9}:!1,animate:u?{opacity:1,y:0,scale:1}:void 0,whileTap:u?{scale:.97}:void 0,transition:{delay:.05+h*.035,duration:.45,ease:[.16,1,.3,1]},onClick:n?()=>n({...o,id:e.id}):void 0,className:`group flex w-[6.75rem] flex-col items-center rounded-xl ${M} pb-3 pt-4 text-center transition-[background-color,transform] duration-200 ease-out hover:bg-oai-gray-50 active:scale-[0.97] dark:hover:bg-oai-gray-900/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand/60 sm:w-[7.75rem]`,"aria-label":l("achievements.badge.aria",{name:f,tier:d?l(`achievements.tier.${d}`):l("achievements.modal.locked")}),children:[s.jsx(B,{badgeId:e.id,tier:o.tier,locked:!a,size:m,className:"transition-transform duration-200 ease-out group-hover:-translate-y-0.5 group-hover:scale-105"}),s.jsxs("span",{className:"mt-2.5 flex w-full items-center justify-center gap-1",children:[s.jsx("span",{title:f,className:"min-w-0 truncate text-xs font-medium leading-tight text-oai-gray-800 dark:text-oai-gray-200",children:f}),e.scope==="local"&&s.jsx("span",{title:l("achievements.page.local_note"),"aria-label":l("achievements.scope.local"),className:"inline-flex shrink-0 text-oai-gray-400 dark:text-oai-gray-500",children:s.jsx(F,{size:11,strokeWidth:2,"aria-hidden":!0})})]}),s.jsx("span",{className:"mt-1 flex h-4 w-full items-center justify-center",children:a?s.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.08em]",style:{color:L[d]?.label},children:l(`achievements.tier.${d}`)}):i?s.jsx("span",{className:"h-[3px] w-14 overflow-hidden rounded-full bg-oai-gray-200 dark:bg-oai-gray-800",children:s.jsx("span",{className:"block h-full rounded-full bg-oai-brand/70",style:{width:`${Math.round(A*100)}%`}})}):null})]},e.id)})})}export{V as A,H as b,G as f,S as l};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c$ as De,d0 as Ie,d1 as _e,d2 as Me,d3 as Te,d4 as ye,i as be,d5 as $e,d6 as Ve,d7 as Oe,d8 as Re,d9 as Pe,da as Be,db as Ke,dc as Le,dd as Xe,de as Ce,df as Fe,dg as G,dh as Ge,di as We,dj as ze,dk as Ue,u as Ye,r as C,j as a,m as L,$ as Ze,E as h,P as ve,X as He}from"./main-CeaB5N36.js";import{a as je,A as qe,p as Je,b as U,t as le,T as $,c as Qe}from"./AchievementBadge-DXWHZrAL.js";import{a as et,u as z}from"./use-transform-BvXyGAtb.js";import{l as ce,f as ue,b as tt}from"./AchievementsSection-gzP3m1Ml.js";import{D as nt,a as rt,b as at,c as st,d as it,e as ot}from"./DialogTitle-sLJxKWjv.js";import"./zap-DlAOTwFs.js";import"./flame-0eyhMnfU.js";import"./format-tokens-CkfBUcoa.js";import"./useScrollLock-BfU2EMvG.js";const lt=(e,t,n)=>{const r=t-e;return((n-e)%r+r)%r+e};function Ne(e,t){return De(e)?e[lt(0,e.length,t)]:e}class ct{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>t.finished))}getAll(t){return this.animations[0][t]}setAll(t,n){for(let r=0;r<this.animations.length;r++)this.animations[r][t]=n}attachTimeline(t){const n=this.animations.map(r=>r.attachTimeline(t));return()=>{n.forEach((r,s)=>{r&&r(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get state(){return this.getAll("state")}get startTime(){return this.getAll("startTime")}get duration(){return de(this.animations,"duration")}get iterationDuration(){return de(this.animations,"iterationDuration")}runAll(t){this.animations.forEach(n=>n[t]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function de(e,t){let n=0;for(let r=0;r<e.length;r++){const s=e[r][t];s!==null&&s>n&&(n=s)}return n}class ut extends ct{then(t,n){return this.finished.finally(t).then(()=>{})}}function dt(e,t){return e in t}class ft extends Ie{constructor(){super(...arguments),this.type="object"}readValueFromInstance(t,n){if(dt(n,t)){const r=t[n];if(typeof r=="string"||typeof r=="number")return r}}getBaseTargetFromProps(){}removeValueFromRenderState(t,n){delete n.output[t]}measureInstanceViewportBox(){return _e()}build(t,n){Object.assign(t.output,n)}renderInstance(t,{output:n}){Object.assign(t,n)}sortInstanceNodePosition(){return 0}}function Y(e){return typeof e=="object"&&!Array.isArray(e)}function ke(e,t,n,r){return e==null?[]:typeof e=="string"&&Y(t)?Me(e,n,r):e instanceof NodeList?Array.from(e):Array.isArray(e)?e.filter(s=>s!=null):[e]}function mt(e,t,n){return e*(t+1)+n*t}function fe(e,t,n,r){return typeof t=="number"?t:t.startsWith("-")||t.startsWith("+")?Math.max(0,e+parseFloat(t)):t==="<"?n:t.startsWith("<")?Math.max(0,n+parseFloat(t.slice(1))):r.get(t)??e}function pt(e,t,n){for(let r=0;r<e.length;r++){const s=e[r];s.at>t&&s.at<n&&(ye(e,s),r--)}}function ht(e,t,n,r,s,c){pt(e,s,c);for(let i=0;i<t.length;i++)e.push({value:t[i],at:Te(s,c,r[i]),easing:Ne(n,i)})}function gt(e,t,n=0){const r=t+1+t*n;for(let s=0;s<e.length;s++)e[s]=e[s]/r}function xt(e,t){return e.at===t.at?e.value===null?1:t.value===null?-1:0:e.at-t.at}const yt="easeInOut",bt=20;function vt(e,{defaultTransition:t={},...n}={},r,s){const c=t.duration||.3,i=new Map,m=new Map,f={},p=new Map;let g=0,u=0,x=0;for(let N=0;N<e.length;N++){const k=e[N];if(typeof k=="string"){p.set(k,u);continue}else if(!Array.isArray(k)){p.set(k.name,fe(u,k.at,g,p));continue}let[E,b,v={}]=k;v.at!==void 0&&(u=fe(u,v.at,g,p));let j=0;const _=(w,M,A,o=0,l=0)=>{const d=jt(w),{delay:D=0,times:y=$e(d),type:R=t.type||"keyframes",repeat:P,repeatType:W,repeatDelay:Z=0,...Se}=M;let{ease:I=t.ease||"easeOut",duration:S}=M;const H=typeof D=="function"?D(o,l):D,q=d.length,J=Pe(R)?R:s?.[R||"keyframes"];if(q<=2&&J){let V=100;if(q===2&&wt(d)){const B=d[1]-d[0];V=Math.abs(B)}const O={...t,...Se};S!==void 0&&(O.duration=Be(S));const F=Ve(O,V,J);I=F.ease,S=F.duration}S??(S=c);const Q=u+H;y.length===1&&y[0]===0&&(y[1]=1);const ee=y.length-d.length;if(ee>0&&Oe(y,ee),d.length===1&&d.unshift(null),P&&P<bt){const V=S>0?Z/S:0;S=mt(S,P,Z);const O=[...d],F=[...y];I=Array.isArray(I)?[...I]:[I];const B=[...I],ne=W==="reverse"||W==="mirror";let re=O,ae=B;ne&&(re=[...O].reverse(),W==="reverse"&&(ae=[...B].reverse().map(T=>typeof T=="function"?Re(T):T)));for(let T=0;T<P;T++){const se=ne&&T%2===0,ie=se?re:O,Ee=se?ae:B,oe=(T+1)*(1+V);V>0&&(d.push(d[d.length-1]),y.push(oe),I.push("linear")),d.push(...ie);for(let K=0;K<ie.length;K++)y.push(F[K]+oe),I.push(K===0?"linear":Ne(Ee,K-1))}gt(y,P,V)}const te=Q+S;ht(A,d,I,y,Q,te),j=Math.max(H+S,j),x=Math.max(te,x)};if(be(E)){const w=me(E,m);_(b,v,pe("default",w))}else{const w=ke(E,b,r,f),M=w.length;for(let A=0;A<M;A++){b=b,v=v;const o=w[A],l=me(o,m);for(const d in b)_(b[d],Nt(v,d),pe(d,l),A,M)}}g=u,u+=j}return m.forEach((N,k)=>{for(const E in N){const b=N[E];b.sort(xt);const v=[],j=[],_=[];for(let o=0;o<b.length;o++){const{at:l,value:d,easing:D}=b[o];v.push(d),j.push(Ke(0,x,l)),_.push(D||"easeOut")}j[0]!==0&&(j.unshift(0),v.unshift(v[0]),_.unshift(yt)),j[j.length-1]!==1&&(j.push(1),v.push(null)),i.has(k)||i.set(k,{keyframes:{},transition:{}});const w=i.get(k);w.keyframes[E]=v;const{type:M,...A}=t;w.transition[E]={...A,duration:x,ease:_,times:j,...n}}}),i}function me(e,t){return!t.has(e)&&t.set(e,{}),t.get(e)}function pe(e,t){return t[e]||(t[e]=[]),t[e]}function jt(e){return Array.isArray(e)?e:[e]}function Nt(e,t){return e&&e[t]?{...e,...e[t]}:{...e}}const kt=e=>typeof e=="number",wt=e=>e.every(kt);function At(e){const t={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},n=Le(e)&&!Xe(e)?new Ce(t):new Fe(t);n.mount(e),G.set(e,n)}function St(e){const t={presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}},n=new ft(t);n.mount(e),G.set(e,n)}function Et(e,t){return be(e)||typeof e=="number"||typeof e=="string"&&!Y(t)}function we(e,t,n,r){const s=[];if(Et(e,t))s.push(Ge(e,Y(t)&&t.default||t,n&&(n.default||n)));else{if(e==null)return s;const c=ke(e,t,r),i=c.length;for(let m=0;m<i;m++){const f=c[m],p=f instanceof Element?At:St;G.has(f)||p(f);const g=G.get(f),u={...n};"delay"in u&&typeof u.delay=="function"&&(u.delay=u.delay(m,i)),s.push(...We(g,{...t,transition:u},{}))}}return s}function Dt(e,t,n){const r=[],s=e.map(i=>{if(Array.isArray(i)&&typeof i[0]=="function"){const m=i[0],f=ze(0);return f.on("change",m),i.length===1?[f,[0,1]]:i.length===2?[f,[0,1],i[1]]:[f,i[1],i[2]]}return i});return vt(s,t,n,{spring:Ue}).forEach(({keyframes:i,transition:m},f)=>{r.push(...we(f,i,m))}),r}function It(e){return Array.isArray(e)&&e.some(Array.isArray)}function _t(e={}){const{scope:t,reduceMotion:n,skipAnimations:r}=e;function s(c,i,m){let f=[],p;const g={};if(n!==void 0&&(g.reduceMotion=n),r!==void 0&&(g.skipAnimations=r),It(c)){const{onComplete:x,...N}=i||{};typeof x=="function"&&(p=x),f=Dt(c,{...g,...N},t)}else{const{onComplete:x,...N}=m||{};typeof x=="function"&&(p=x),f=we(c,i,{...g,...N},t)}const u=new ut(f);return p&&u.finished.then(p),t&&(t.animations.push(u),u.finished.then(()=>{ye(t.animations,u)})),u}return s}const X=_t(),he=8;function Mt({badgeId:e,tier:t,locked:n=!1,size:r=176,backLines:s=[],label:c}){const i=et(0),m=Ye(),f=C.useRef(null),p=C.useRef(null),g=C.useRef(!1),u=Je(t,n),x=je.get(e)?.icon||null,N=z(i,o=>`${(o%360+360)%360/360*160-80}%`),k=z(i,o=>`${80-(o%360+360)%360/360*160}%`),E=z(i,o=>{const l=Math.abs(Math.sin(o*Math.PI/180));return Math.max(0,(l-.35)/.65)*.3}),b=()=>{p.current?.stop?.(),p.current=null};C.useEffect(()=>{if(m||g.current)return;let o=!1;i.set(-360);const l=X(i,0,{duration:.9,ease:[.16,1,.3,1]});return p.current=l,l.then(()=>{o||g.current||(p.current=X(i,[0,-14,14,0],{duration:4.5,repeat:1/0,ease:"easeInOut"}))}),()=>{o=!0,b()}},[m,i]);const v=o=>{const l=i.get();if(m){const y=Math.round(l/180)*180;p.current=X(i,y,{duration:.2,ease:"easeOut"});return}const d=l+o*.35,D=Math.round(d/180)*180;p.current=X(i,D,{type:"spring",velocity:o,stiffness:58,damping:13.5,mass:1})},j=o=>{g.current=!0,b(),o.currentTarget.setPointerCapture?.(o.pointerId),f.current={pointerId:o.pointerId,startX:o.clientX,startRot:i.get(),samples:[{t:o.timeStamp,x:o.clientX}]}},_=o=>{const l=f.current;!l||l.pointerId!==o.pointerId||(i.set(l.startRot+(o.clientX-l.startX)*.55),l.samples.push({t:o.timeStamp,x:o.clientX}),l.samples.length>5&&l.samples.shift())},w=o=>{const l=f.current;if(!l||l.pointerId!==o.pointerId)return;f.current=null;const d=l.samples[0],D=l.samples[l.samples.length-1],y=D.t-d.t,R=y>0?(D.x-d.x)*.55*1e3/y:0;v(R)},M=o=>{if(o.key!=="ArrowLeft"&&o.key!=="ArrowRight")return;o.preventDefault(),g.current=!0,b();const l=o.key==="ArrowRight"?30:-30;p.current=X(i,i.get()+l,{duration:.15,ease:"easeOut"})},A={backfaceVisibility:"hidden",WebkitBackfaceVisibility:"hidden"};return a.jsx("div",{role:"img","aria-label":c,tabIndex:0,onPointerDown:j,onPointerMove:_,onPointerUp:w,onPointerCancel:w,onKeyDown:M,className:"inline-flex cursor-grab select-none items-center justify-center outline-none focus-visible:ring-2 focus-visible:ring-oai-brand/60 rounded-full active:cursor-grabbing",style:{perspective:900,touchAction:"pan-y"},children:a.jsxs("div",{className:"relative",style:{transform:"rotateX(-8deg)",transformStyle:"preserve-3d"},children:[a.jsxs(L.div,{className:"relative",style:{rotateY:i,transformStyle:"preserve-3d",width:r,height:r},children:[[-3,-1.5,0,1.5,3].map(o=>a.jsx("div",{"aria-hidden":!0,className:"absolute inset-0 rounded-full",style:{transform:`translateZ(${o}px)`,background:u.rim[1]}},o)),a.jsxs("div",{className:"absolute inset-0 overflow-hidden rounded-full",style:{...A,transform:`translateZ(${he/2}px)`},children:[a.jsx(qe,{badgeId:e,tier:t,locked:n,size:"fill",className:"brightness-105 saturate-[1.08]"}),a.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 rounded-full",style:{background:"radial-gradient(circle at 30% 20%, rgba(255,255,255,0.45), rgba(255,255,255,0) 42%), linear-gradient(172deg, rgba(255,255,255,0.14) 0%, rgba(255,255,255,0) 38%, rgba(0,0,0,0.08) 100%)",boxShadow:"inset 0 3px 7px rgba(255,255,255,0.5), inset 0 -3px 8px rgba(0,0,0,0.15)"}}),a.jsx(L.div,{"aria-hidden":!0,className:"pointer-events-none absolute inset-0",style:{x:N,background:"linear-gradient(105deg, transparent 34%, rgba(255,255,255,0.5) 50%, transparent 66%)"}}),a.jsx(L.div,{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 rounded-full",style:{opacity:E,background:"rgba(8, 12, 10, 0.9)"}})]}),a.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-1 overflow-hidden rounded-full px-6 text-center",style:{...A,transform:`rotateY(180deg) translateZ(${he/2}px)`,background:`linear-gradient(145deg, ${u.face[0]}, ${u.face[1]})`,boxShadow:`inset 0 0 0 6px ${u.rim[1]}, inset 0 0 0 7.5px rgba(255,255,255,0.22), inset 0 3px 7px rgba(255,255,255,0.4), inset 0 -4px 12px rgba(0,0,0,0.22)`},children:[a.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 rounded-full",style:{background:"repeating-radial-gradient(circle at 50% 50%, rgba(255,255,255,0.06) 0px, rgba(255,255,255,0.06) 1px, transparent 1px, transparent 4px)"}}),x?a.jsx(x,{"aria-hidden":!0,size:Math.round(r*.62),strokeWidth:1.1,color:u.glyph,className:"pointer-events-none absolute opacity-[0.13]",style:{filter:"drop-shadow(0 1px 0 rgba(255,255,255,0.3)) drop-shadow(0 -1px 0 rgba(0,0,0,0.35))"}}):null,a.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 rounded-full",style:{background:"radial-gradient(circle at 70% 20%, rgba(255,255,255,0.4), rgba(255,255,255,0) 44%), linear-gradient(188deg, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0) 38%, rgba(0,0,0,0.10) 100%)"}}),s.map((o,l)=>a.jsx("div",{className:`font-mono tabular-nums ${l===0?"text-[10px] uppercase tracking-[0.18em]":l===1?"text-lg font-bold":"text-[11px]"}`,style:{color:u.glyph,textShadow:"0 1px 0 rgba(255,255,255,0.28), 0 -1px 0 rgba(0,0,0,0.3)"},children:o},`${l}-${o}`)),a.jsx(L.div,{"aria-hidden":!0,className:"pointer-events-none absolute inset-0",style:{x:k,background:"linear-gradient(105deg, transparent 34%, rgba(255,255,255,0.45) 50%, transparent 66%)"}}),a.jsx(L.div,{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 rounded-full",style:{opacity:E,background:"rgba(8, 12, 10, 0.9)"}})]})]}),a.jsx("div",{"aria-hidden":!0,className:"absolute left-1/2 h-3 w-3/5 rounded-[100%] bg-black/20 blur-md dark:bg-black/45",style:{bottom:-20,transform:"translateX(-50%)"}})]})})}function Ae(e){if(!e)return null;const t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleDateString():null}function Tt(e){const t=Number(e);return!Number.isSafeInteger(t)||t<1?null:String(t).padStart(6,"0")}function $t(e,t,n){if(t?.scope!=="cloud"||!n)return null;const r=Number(e?.serials?.[n]);return Number.isSafeInteger(r)&&r>=1?r:null}function Vt({badge:e}){return a.jsx("div",{className:"flex items-center gap-1",children:Qe.map((t,n)=>{const r=(e.tier||0)>=n+1,s=Ae(e.achieved?.[t]),c=$[t];return a.jsx("span",{title:s?`${h(`achievements.tier.${t}`)} · ${s}`:h(`achievements.tier.${t}`),className:"inline-flex h-2 w-8 rounded-full",style:r?{background:`linear-gradient(120deg, ${c.rim[0]} 0%, ${c.ring} 55%, ${c.rim[1]} 100%)`,boxShadow:"inset 0 1px 1px rgba(255,255,255,0.4), 0 0 0 1px rgba(10,15,12,0.05)"}:void 0,children:!r&&a.jsx("span",{className:"h-full w-full rounded-full bg-oai-gray-200 dark:bg-oai-gray-800"})},t)})})}function ge({badge:e,onClose:t}){const n=je.get(e.id),r=h(U(e.id,"name")),s=(e.tier||0)>=1,c=s?le(e.tier):null,i=Ae(s?e.achieved?.[c]||(ce(e)?new Date(ce(e)).toISOString():null):null),m=ue(n?.format,e.metric_value),f=tt(e),p=e.tier<4?le((e.tier||0)+1):null,g=$t(e,n,c),u=Tt(g),x=u?[h("achievements.modal.achieved_label"),h("achievements.modal.issue_number",{number:u}),i||r]:[s?h("achievements.modal.achieved_label"):h("achievements.modal.locked"),s?m:"···",s&&i?i:r];return a.jsxs("div",{className:"flex flex-col items-center px-6 pb-6 pt-5 text-center",children:[a.jsxs("div",{className:"flex w-full items-start justify-between gap-3",children:[a.jsxs("div",{className:"min-w-0 flex-1 text-left",children:[a.jsx("h2",{className:"truncate text-lg font-semibold tracking-tight text-oai-black dark:text-white",children:r}),a.jsx("p",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:h(U(e.id,"desc"))})]}),a.jsx("button",{type:"button",onClick:t,"aria-label":h("achievements.modal.close"),className:"shrink-0 rounded-md p-1.5 text-oai-gray-400 transition-colors hover:bg-oai-gray-100 hover:text-oai-gray-700 dark:hover:bg-oai-gray-900 dark:hover:text-oai-gray-200",children:a.jsx(He,{size:16})})]}),a.jsx("div",{className:"mt-5 mb-7",children:a.jsx(Mt,{badgeId:e.id,tier:e.tier,locked:!s,backLines:x,label:h("achievements.modal.coin_aria",{name:r})})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"rounded-full px-2.5 py-0.5 text-[11px] font-semibold uppercase tracking-wide",style:s?{background:`linear-gradient(120deg, ${$[c].rim[0]} 0%, ${$[c].ring} 55%, ${$[c].rim[1]} 100%)`,color:$[c].glyph,textShadow:"0 1px 0 rgba(255,255,255,0.35)",boxShadow:"inset 0 1px 1px rgba(255,255,255,0.4), 0 0 0 1px rgba(10,15,12,0.06)"}:{background:"rgba(128,134,130,0.75)",color:"rgba(250,250,250,0.95)"},children:s?h(`achievements.tier.${c}`):h("achievements.modal.locked")}),s&&i?a.jsx("span",{className:"text-xs tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:i}):null]}),a.jsxs("dl",{className:"mt-5 w-full space-y-3 border-t border-oai-gray-200/70 pt-4 text-left dark:border-oai-gray-800/60",children:[a.jsxs("div",{className:"flex items-baseline justify-between gap-3 text-sm",children:[a.jsx("dt",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:h("achievements.modal.value_label")}),a.jsx("dd",{className:"font-mono font-semibold tabular-nums text-oai-black dark:text-white",children:m})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-baseline justify-between gap-3 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[a.jsx("span",{children:e.tier>=4?h("achievements.modal.max_tier"):h("achievements.modal.progress_to_next",{tier:h(`achievements.tier.${p}`)})}),e.tier<4&&e.next_threshold!=null?a.jsxs("span",{className:"font-mono tabular-nums",children:[m," ",e.lower_is_better?"→":"/"," ",ue(n?.format,e.next_threshold)]}):null]}),a.jsx("div",{className:"mt-1.5 h-1.5 w-full overflow-hidden rounded-full bg-oai-gray-200 dark:bg-oai-gray-800",children:a.jsx("div",{className:"h-full rounded-full transition-[width] duration-500",style:{width:`${Math.round((e.tier>=4?1:f)*100)}%`,background:s?`linear-gradient(90deg, ${$[c].rim[0]} 0%, ${$[c].ring} 55%, ${$[c].rim[1]} 100%)`:"rgba(128,134,130,0.75)",boxShadow:s?"inset 0 1px 1px rgba(255,255,255,0.35)":void 0}})})]}),a.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[a.jsx("span",{children:h("achievements.modal.tier_history")}),a.jsx(Vt,{badge:e})]})]})]})}const xe=ve("relative w-full max-w-[380px] flex flex-col","rounded-2xl bg-white dark:bg-oai-gray-950","shadow-[0_20px_60px_-20px_rgba(0,0,0,0.25)] dark:shadow-[0_20px_60px_-10px_rgba(0,0,0,0.65)]","ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 overflow-hidden","dark:border-t dark:border-white/[0.08]");function Gt({badge:e,onClose:t}){const n=Ze(),r=!!e;return C.useEffect(()=>{if(!n||!r)return;const s=c=>{c.key==="Escape"&&(c.stopPropagation(),t?.())};return window.addEventListener("keydown",s,!0),()=>window.removeEventListener("keydown",s,!0)},[n,r,t]),r?n?a.jsxs("div",{className:"fixed inset-0 z-[120] flex items-center justify-center p-4",children:[a.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-[2px]",onClick:t,"aria-hidden":!0}),a.jsx("div",{className:xe,children:a.jsx(ge,{badge:e,onClose:t})})]}):a.jsx(nt,{open:!0,onOpenChange:s=>{s||t?.()},children:a.jsxs(rt,{children:[a.jsx(at,{className:"cost-modal-backdrop z-[110]"}),a.jsx(st,{className:"fixed inset-0 z-[120] flex items-center justify-center p-4",children:a.jsxs(it,{className:ve("cost-modal-popup",xe),children:[a.jsx(ot,{render:a.jsx("h2",{className:"sr-only"}),children:h(U(e.id,"name"))}),a.jsx(ge,{badge:e,onClose:t})]})})]})}):null}export{Gt as BadgeDetailModal,$t as currentBadgeIssueNumber,Gt as default,Tt as formatIssueNumber};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r}from"./main-CeaB5N36.js";function t({children:i,title:a,subtitle:o,className:s="",bodyClassName:d=""}){return r.jsxs("div",{className:`rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 transition-colors duration-200 ${s}`,children:[(a||o)&&r.jsxs("div",{className:"px-5 py-4 border-b border-oai-gray-200 dark:border-oai-gray-800 transition-colors duration-200",children:[a&&r.jsx("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide transition-colors duration-200",children:a}),o&&r.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-300 mt-1 transition-colors duration-200",children:o})]}),r.jsx("div",{className:`p-5 ${d}`,children:i})]})}export{t as C};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r,j as f}from"./main-CeaB5N36.js";function p(e){const n=String(e||"").trim().toLowerCase();return/^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$/.test(n)?n:"clawd"}const C=.84;function L(e){return p(e)==="clawd"?C:1}const z={idle:{row:0,durations:[280,110,110,140,140,320]},"running-right":{row:1,durations:[120,120,120,120,120,120,120,220]},"running-left":{row:2,durations:[120,120,120,120,120,120,120,220]},waving:{row:3,durations:[140,140,140,280]},jumping:{row:4,durations:[140,140,140,140,280]},failed:{row:5,durations:[140,140,140,140,140,140,140,240]},waiting:{row:6,durations:[150,150,150,150,150,260]},running:{row:7,durations:[120,120,120,120,120,220]},review:{row:8,durations:[150,150,150,150,150,280]}};function T(e){return["error","disconnected","working-overheated"].includes(e)?"failed":["happy","waking","mini-happy","jumping"].includes(e)?"jumping":["working-typing","working-ultrathink","working-juggling","running"].includes(e)?"running":["working-thinking","working-wizard","review"].includes(e)?"review":["sleeping","idle-doze","mini-sleep","waiting"].includes(e)?"waiting":["mini-peek","waving"].includes(e)?"waving":e==="running-left"||e==="running-right"?e:"idle"}function V(){const[e,n]=r.useState(()=>typeof document>"u"?!0:document.visibilityState!=="hidden");return r.useEffect(()=>{if(typeof document>"u")return;const t=()=>n(document.visibilityState!=="hidden");return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[]),e}function _(){const[e,n]=r.useState(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches);return r.useEffect(()=>{if(typeof window.matchMedia!="function")return;const t=window.matchMedia("(prefers-reduced-motion: reduce)"),i=o=>n(o.matches);return t.addEventListener("change",i),()=>t.removeEventListener("change",i)},[]),e}function I({character:e,pet:n=null,state:t="idle-living",dragState:i=null,size:o=48,className:d="",lookDirectionIndex:u=null}){const l=p(e),g=i==="running-left"||i==="running-right"?i:T(t),a=z[g],s=n?.spriteVersionNumber===2?2:1,w=s===2?11:9,c=s===2&&g==="idle"&&Number.isInteger(u)?(u%16+16)%16:null,h=c==null?a.row:9+Math.floor(c/8),m=c==null?null:c%8,k=_(),y=V(),[b,S]=r.useState(0);r.useEffect(()=>{if(S(0),k||!y||c!=null)return;let M=!1,x=0;const E=$=>{x=window.setTimeout(()=>{if(M)return;const j=($+1)%a.durations.length;S(j),E(j)},a.durations[$])};return E(0),()=>{M=!0,window.clearTimeout(x)}},[c,k,y,a]);const A=r.useMemo(()=>({width:o*(192/208),height:o,backgroundImage:`url(${n?.assetUrl||`/pets/${l}/spritesheet.webp`})`,backgroundRepeat:"no-repeat",backgroundSize:`800% ${w*100}%`,backgroundPosition:`${(m??b)/7*100}% ${h/(w-1)*100}%`,imageRendering:"pixelated"}),[w,m,h,b,l,n?.assetUrl,o]);return f.jsx("div",{"aria-hidden":"true",className:`pet-atlas-animated ${d}`,style:A})}const R={"idle-living":"idle/living.svg","idle-doze":"idle/doze.svg","idle-follow":"idle/follow.svg","idle-look":"idle/look.svg","idle-yawn":"idle/yawn.svg","idle-collapse":"idle/collapse.svg","working-building":"working/building.svg","working-carrying":"working/carrying.svg","working-conducting":"working/conducting.svg","working-confused":"working/confused.svg","working-debugger":"working/debugger.svg","working-juggling":"working/juggling.svg","working-overheated":"working/overheated.svg","working-pushing":"working/pushing.svg","working-sweeping":"working/sweeping.svg","working-thinking":"working/thinking.svg","working-typing":"working/typing.svg","working-ultrathink":"working/ultrathink.svg","working-wizard":"working/wizard.svg","mini-alert":"mini/alert.svg","mini-crabwalk":"mini/crabwalk.svg","mini-enter":"mini/enter.svg","mini-enter-sleep":"mini/enter-sleep.svg","mini-happy":"mini/happy.svg","mini-idle":"mini/idle.svg","mini-peek":"mini/peek.svg","mini-sleep":"mini/sleep.svg","react-double":"react/double.svg","react-drag":"react/drag.svg","react-left":"react/left.svg","react-right":"react/right.svg","collapse-sleep":"sleep/collapse-sleep.svg",sleeping:"sleep/sleeping.svg",wake:"sleep/wake.svg",disconnected:"status/disconnected.svg",error:"status/error.svg",notification:"status/notification.svg",happy:"happy.svg","static-base":"static-base.svg"},v=new Map;async function P(e){if(v.has(e))return v.get(e);if(typeof fetch!="function")return null;let n;try{n=await fetch(`/clawd/${e}`)}catch{return null}if(!n.ok)return null;const i=(await n.text()).replace(/<svg([^>]*)>/,(o,d)=>`<svg${d.replace(/\s+width="[^"]*"/g,"").replace(/\s+height="[^"]*"/g,"")} width="100%" height="100%">`);return v.set(e,i),i}function H({state:e="idle-living",size:n=48,className:t=""}){const[i,o]=r.useState(""),d=r.useRef(null),l=N()?"static-base":e,g=R[l]||R["static-base"];return r.useEffect(()=>{let a=!1;return P(g).then(s=>{!a&&s&&o(s)}),()=>{a=!0}},[g]),r.useEffect(()=>{const a=d.current?.querySelector("svg");if(a)try{const s=a.getBBox();s.width>0&&s.height>0&&a.setAttribute("viewBox",`${s.x-2} ${s.y-2} ${s.width+4} ${s.height+4}`)}catch{}},[i]),f.jsx("div",{ref:d,"aria-hidden":"true",className:`clawd-animated ${t}`,style:{width:n,height:n,display:"inline-flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},dangerouslySetInnerHTML:{__html:i}})}function B({state:e="idle-living",size:n=48,className:t="",character:i="clawd",pet:o=null,lookDirectionIndex:d=null}){const u=p(i);return u!=="clawd"?f.jsx(I,{character:u,pet:o,state:e,size:n,className:t,lookDirectionIndex:d}):f.jsx(H,{state:e,size:n*L(u),className:t})}function N(){const[e,n]=r.useState(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches);return r.useEffect(()=>{if(typeof window.matchMedia!="function")return;const t=window.matchMedia("(prefers-reduced-motion: reduce)"),i=o=>n(o.matches);return t.addEventListener("change",i),()=>t.removeEventListener("change",i)},[]),e}export{B as C,p as n};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as a,X as b,E as e,S as h}from"./main-CeaB5N36.js";import{f}from"./format-tokens-CkfBUcoa.js";import{u as k}from"./useTokenFormat-Cm4EvrQp.js";import{D as v,a as N,b as j,c as D,d as w,e as E}from"./DialogTitle-sLJxKWjv.js";import{D as M}from"./DialogClose-Ci8hkTw5.js";import{D as _}from"./DialogDescription-C9vXUZU0.js";import"./useScrollLock-BfU2EMvG.js";const I=1.75,O=[[/claude|fable|opus|sonnet|haiku/,{provider:"CLAUDE",color:"#d97757"}],[/gpt|codex|o3|o4/,{provider:"CODEX",color:"#3b82f6"}],[/gemini/,{provider:"GEMINI",color:"#2196f3"}],[/composer|cursor/,{provider:"CURSOR",color:"#10b981"}],[/kimi/,{provider:"KIMI",color:"#a78bfa"}],[/mimo/,{provider:"MIMO",color:"#ff6900"}],[/copilot/,{provider:"COPILOT",color:"#6366f1"}],[/kiro/,{provider:"KIRO",color:"#6366f1"}],[/grok/,{provider:"GROK",color:"#f43f5e"}],[/deepseek/,{provider:"DEEPSEEK",color:"#4D6BFE"}],[/glm/,{provider:"ZCODE",color:"#14b8a6"}],[/hy3/,{provider:"WORKBUDDY",color:"#0ea5e9"}],[/minimax/,{provider:"MINIMAX",color:"#f59e0b"}]];function S(i){const s=(i||"").toLowerCase(),t=O.find(([o])=>o.test(s));return t?t[1]:{provider:"",color:"#9ca3af"}}function c({label:i,value:s,title:t,className:o=""}){return a.jsxs("div",{className:`flex min-w-0 flex-col gap-1.5 ${o}`,title:t,children:[a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500",children:i}),a.jsx("span",{className:"truncate text-2xl font-semibold leading-none tracking-tight text-oai-black dark:text-white tabular-nums",children:s})]})}function P({isOpen:i,onClose:s,communityStats:t}){const{formatTokens:o,formatTokensTooltip:m}=k();if(!t||t.status!=="ready")return null;const l=Number(t.tokenFloor)||0,x=Number(t.totalEntries)||0,p=l/1e6*I,n=Array.isArray(t.topModels)?t.topModels.slice(0,10):[],y=n.reduce((r,d)=>Math.max(r,Number(d.share)||0),0)||1;return a.jsx(v,{open:i,onOpenChange:r=>!r&&s(),children:a.jsxs(N,{children:[a.jsx(j,{className:"fixed inset-0 z-[100] bg-black/40 backdrop-blur-[2px] transition-opacity duration-200 ease-out data-[ending-style]:opacity-0 data-[starting-style]:opacity-0"}),a.jsx(D,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:a.jsxs(w,{className:"relative flex w-full max-w-md flex-col gap-5 max-h-[85vh] overflow-y-auto rounded-2xl bg-white p-6 shadow-2xl ring-1 ring-oai-gray-200 transition-[opacity,transform] duration-[220ms] ease-[cubic-bezier(0.16,1,0.3,1)] data-[ending-style]:translate-y-2 data-[ending-style]:scale-[0.96] data-[ending-style]:opacity-0 data-[starting-style]:translate-y-2 data-[starting-style]:scale-[0.96] data-[starting-style]:opacity-0 dark:bg-oai-gray-900 dark:ring-oai-gray-800",children:[a.jsx(M,{className:"absolute top-4 right-4 p-1.5 rounded-lg text-oai-gray-400 dark:text-oai-gray-500 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors cursor-pointer","aria-label":e("shared.dialog.close"),children:a.jsx(b,{className:"size-4"})}),a.jsxs("div",{className:"pr-8",children:[a.jsx(E,{className:"text-lg font-bold tracking-tight text-oai-black dark:text-white",children:e("leaderboard.community.modal.title")}),a.jsx(_,{className:"mt-1 text-xs text-oai-gray-400 dark:text-oai-gray-500",children:e("leaderboard.community.modal.description")})]}),a.jsxs("div",{className:"grid grid-cols-3 divide-x divide-oai-gray-100 border-y border-oai-gray-100 py-4 dark:divide-oai-gray-800/80 dark:border-oai-gray-800/80",children:[a.jsx(c,{className:"pr-4",label:e("leaderboard.community.modal.total_tokens"),value:o(l),title:e("leaderboard.community.modal.tokens_title",{count:m(l)})}),a.jsx(c,{className:"px-4",label:e("leaderboard.community.modal.active_devs"),value:x.toLocaleString("en-US"),title:e("leaderboard.community.modal.active_devs_detail",{count:x.toLocaleString("en-US")})}),a.jsx(c,{className:"pl-4",label:e("leaderboard.community.modal.global_spend"),value:`$${f(p)}`,title:e("leaderboard.community.modal.global_spend_detail",{amount:Math.round(p).toLocaleString("en-US")})})]}),n.length>0&&a.jsxs("div",{className:"flex flex-col gap-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500",children:e("leaderboard.community.modal.top_models")}),a.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:e("leaderboard.community.modal.all_time")})]}),a.jsx("div",{className:"flex flex-col gap-0.5",children:n.map((r,d)=>{const g=S(r.name),u=Number(r.share)||0;return a.jsxs("div",{className:"relative flex h-9 items-center gap-2.5 overflow-hidden px-2.5",children:[a.jsx("div",{className:"absolute inset-y-0 left-0",style:{width:`${Math.max(u/y*100,2)}%`,backgroundColor:`${g.color}24`},"aria-hidden":"true"}),a.jsx("span",{className:"relative w-4 shrink-0 text-right font-mono text-[11px] text-oai-gray-400 dark:text-oai-gray-500 tabular-nums",children:d+1}),a.jsx(h,{provider:g.provider,size:15,className:"relative shrink-0 text-oai-gray-500 dark:text-oai-gray-400"}),a.jsx("span",{className:"relative min-w-0 flex-1 truncate text-[13px] font-medium text-oai-gray-700 dark:text-oai-gray-200",title:r.name,children:r.name}),a.jsx("span",{className:"relative shrink-0 text-xs font-semibold text-oai-black dark:text-white tabular-nums",title:e("leaderboard.community.modal.tokens_title",{count:m(r.tokens)}),children:o(r.tokens)}),a.jsxs("span",{className:"relative w-11 shrink-0 text-right text-[11px] text-oai-gray-400 dark:text-oai-gray-500 tabular-nums",children:[u,"%"]})]},r.name)})})]}),a.jsx("p",{className:"text-[11px] leading-normal text-oai-gray-400 dark:text-oai-gray-500",children:e("leaderboard.community.modal.note")})]})})]})})}export{P as CommunityStatsModal};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as a,N as i,P as x}from"./main-CeaB5N36.js";import{D as p,a as m,b as y,c as b,d as f,e as u}from"./DialogTitle-sLJxKWjv.js";import{D as h}from"./DialogDescription-C9vXUZU0.js";function N({open:r,title:l,description:t,confirmLabel:o,cancelLabel:n,destructive:d=!1,busy:e=!1,onConfirm:c,onCancel:s}){return a.jsx(p,{open:r,onOpenChange:g=>{!g&&!e&&s?.()},children:a.jsxs(m,{children:[a.jsx(y,{className:"fixed inset-0 z-[100] bg-black/40 backdrop-blur-[2px] transition-opacity duration-200 ease-out data-[ending-style]:opacity-0 data-[starting-style]:opacity-0"}),a.jsx(b,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:a.jsxs(f,{className:"relative w-full max-w-md rounded-2xl bg-white p-6 shadow-[0_20px_60px_-20px_rgba(0,0,0,0.25)] ring-1 ring-oai-gray-200 transition-[opacity,transform] duration-[220ms] ease-[cubic-bezier(0.16,1,0.3,1)] data-[ending-style]:translate-y-2 data-[ending-style]:scale-[0.96] data-[ending-style]:opacity-0 data-[starting-style]:translate-y-2 data-[starting-style]:scale-[0.96] data-[starting-style]:opacity-0 dark:bg-oai-gray-950 dark:shadow-[0_20px_60px_-10px_rgba(0,0,0,0.65)] dark:ring-oai-gray-800",children:[a.jsx(u,{className:"text-base font-semibold text-oai-black dark:text-white",children:l}),t?a.jsx(h,{className:"mt-2 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:t}):null,a.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[a.jsx(i,{type:"button",variant:"secondary",size:"sm",disabled:e,onClick:()=>s?.(),children:n}),a.jsx(i,{type:"button",size:"sm",disabled:e,onClick:()=>c?.(),className:x(d&&"!bg-red-600 hover:!bg-red-700 focus-visible:!outline-red-600 dark:!bg-red-600 dark:hover:!bg-red-500"),children:o})]})]})})]})})}export{N as C};
|