pi-mega-compact 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/extensions/dashboard-server/api-contracts/endpoints/registry.js +6 -0
- package/dist/extensions/dashboard-server/routes-cache.js +17 -5
- package/dist/extensions/dashboard-server/routes-game.js +60 -0
- package/dist/extensions/dashboard-server/routes.js +1 -1
- package/dist/extensions/dashboard-server/server.js +3 -1
- package/dist/extensions/mega-runtime/capture-model.js +15 -2
- package/dist/extensions/mega-runtime/runtime-snapshot.js +26 -0
- package/dist/extensions/mega-runtime/runtime.js +1 -0
- package/extensions/dashboard-client/dist/assets/AreaChart-rJdaOUlj.js +2 -0
- package/extensions/dashboard-client/dist/assets/AreaChart-rJdaOUlj.js.map +1 -0
- package/extensions/dashboard-client/dist/assets/BarChart-DOfc8me9.js +2 -0
- package/extensions/dashboard-client/dist/assets/BarChart-DOfc8me9.js.map +1 -0
- package/extensions/dashboard-client/dist/assets/{CacheTab-CDyZqMO-.js → CacheTab-EhqkEglo.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{CacheTab-CDyZqMO-.js.map → CacheTab-EhqkEglo.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{EventsTab-ByPYMJVG.js → EventsTab-BUACwWXf.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{EventsTab-ByPYMJVG.js.map → EventsTab-BUACwWXf.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{HealthTab-CeHQR0py.js → HealthTab-CDEYVRBb.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{HealthTab-CeHQR0py.js.map → HealthTab-CDEYVRBb.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MaintenanceTab-ceTD_c1A.js → MaintenanceTab-DtanIeCQ.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MaintenanceTab-ceTD_c1A.js.map → MaintenanceTab-DtanIeCQ.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{MemoryMapTab-CRUdVR7u.js → MemoryMapTab-BGEhL7OG.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{MemoryMapTab-CRUdVR7u.js.map → MemoryMapTab-BGEhL7OG.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/MetricsTab-Cktozn4s.js +2 -0
- package/extensions/dashboard-client/dist/assets/MetricsTab-Cktozn4s.js.map +1 -0
- package/extensions/dashboard-client/dist/assets/OverviewTab-08v6Ayuf.js +16 -0
- package/extensions/dashboard-client/dist/assets/OverviewTab-08v6Ayuf.js.map +1 -0
- package/extensions/dashboard-client/dist/assets/{ReposTab-DUrP7Efa.js → ReposTab-Bg72Ozdc.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{ReposTab-DUrP7Efa.js.map → ReposTab-Bg72Ozdc.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/SessionsTab-BcTK9Lg6.js +2 -0
- package/extensions/dashboard-client/dist/assets/{SessionsTab-Cg-IsijD.js.map → SessionsTab-BcTK9Lg6.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{SetupTab-ZE1daXjN.js → SetupTab-Bt-Ru1xp.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{SetupTab-ZE1daXjN.js.map → SetupTab-Bt-Ru1xp.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{TimeSavedCard-BkTgi3Af.js → TimeSavedCard-ic_LjJ79.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{TimeSavedCard-BkTgi3Af.js.map → TimeSavedCard-ic_LjJ79.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{TurnsTab-CZvudHQF.js → TurnsTab-D9AZTMgG.js} +4 -4
- package/extensions/dashboard-client/dist/assets/{TurnsTab-CZvudHQF.js.map → TurnsTab-D9AZTMgG.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/WikiTab-hRcJPi_m.js +2 -0
- package/extensions/dashboard-client/dist/assets/{WikiTab-BVAnGp8_.js.map → WikiTab-hRcJPi_m.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{button-CUrzhi2A.js → button-BdAtIbVu.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{button-CUrzhi2A.js.map → button-BdAtIbVu.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{card-BsfojHfp.js → card-BFYc_QrK.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{card-BsfojHfp.js.map → card-BFYc_QrK.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/generateCategoricalChart-BwzyqytT.js +70 -0
- package/extensions/dashboard-client/dist/assets/generateCategoricalChart-BwzyqytT.js.map +1 -0
- package/extensions/dashboard-client/dist/assets/{index-OM3w-l2T.js → index-pmtEr3sb.js} +8 -8
- package/extensions/dashboard-client/dist/assets/index-pmtEr3sb.js.map +1 -0
- package/extensions/dashboard-client/dist/assets/index-za_gmEmQ.css +1 -0
- package/extensions/dashboard-client/dist/assets/{switch-qSz2Un3t.js → switch-DEyGlFwJ.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{switch-qSz2Un3t.js.map → switch-DEyGlFwJ.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{toggle-DyBKcLe-.js → toggle-pDMBQYQj.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{toggle-DyBKcLe-.js.map → toggle-pDMBQYQj.js.map} +1 -1
- package/extensions/dashboard-client/dist/assets/{useSSE-DqVouqww.js → useSSE-BKaC4dao.js} +2 -2
- package/extensions/dashboard-client/dist/assets/{useSSE-DqVouqww.js.map → useSSE-BKaC4dao.js.map} +1 -1
- package/extensions/dashboard-client/dist/index.html +2 -2
- package/extensions/dashboard-client/package-lock.json +56 -0
- package/extensions/dashboard-client/package.json +3 -0
- package/extensions/dashboard-client/src/api/client.ts +11 -0
- package/extensions/dashboard-client/src/components/SessionContextGauges.tsx +14 -8
- package/extensions/dashboard-client/src/components/WidgetDetailModal.tsx +69 -0
- package/extensions/dashboard-client/src/components/charts/PerfBarChart.tsx +89 -0
- package/extensions/dashboard-client/src/components/charts/PerfLineChart.tsx +108 -0
- package/extensions/dashboard-client/src/components/layout/AppShell.tsx +1 -1
- package/extensions/dashboard-client/src/components/ui/SortableCard.tsx +75 -0
- package/extensions/dashboard-client/src/hooks/useCardPositions.ts +74 -0
- package/extensions/dashboard-client/src/styles/base.css +2 -4
- package/extensions/dashboard-client/src/styles/session-gauges.css +28 -15
- package/extensions/dashboard-client/src/tabs/OverviewTab.tsx +310 -79
- package/extensions/dashboard-client/src/types/card.ts +40 -0
- package/extensions/dashboard-client/tailwind.config.js +1 -1
- package/extensions/dashboard-server/api-contracts/endpoints/registry.ts +10 -0
- package/extensions/dashboard-server/api-contracts/endpoints/types.ts +36 -0
- package/extensions/dashboard-server/api-contracts/endpoints.ts +3 -0
- package/extensions/dashboard-server/api-contracts/index.ts +3 -0
- package/extensions/dashboard-server/routes-cache.ts +17 -5
- package/extensions/dashboard-server/routes-game.ts +72 -0
- package/extensions/dashboard-server/routes.ts +1 -0
- package/extensions/dashboard-server/server.ts +2 -0
- package/extensions/mega-runtime/capture-model.ts +14 -2
- package/extensions/mega-runtime/runtime-snapshot.ts +40 -0
- package/extensions/mega-runtime/runtime.ts +1 -0
- package/package.json +1 -1
- package/extensions/dashboard-client/dist/assets/AreaChart-C68tGr2J.js +0 -70
- package/extensions/dashboard-client/dist/assets/AreaChart-C68tGr2J.js.map +0 -1
- package/extensions/dashboard-client/dist/assets/MetricsTab-DP7Kmdu9.js +0 -2
- package/extensions/dashboard-client/dist/assets/MetricsTab-DP7Kmdu9.js.map +0 -1
- package/extensions/dashboard-client/dist/assets/OverviewTab-4CGP0djv.js +0 -2
- package/extensions/dashboard-client/dist/assets/OverviewTab-4CGP0djv.js.map +0 -1
- package/extensions/dashboard-client/dist/assets/SessionsTab-Cg-IsijD.js +0 -2
- package/extensions/dashboard-client/dist/assets/WikiTab-BVAnGp8_.js +0 -2
- package/extensions/dashboard-client/dist/assets/index-CUA6EDRF.css +0 -1
- package/extensions/dashboard-client/dist/assets/index-OM3w-l2T.js.map +0 -1
|
@@ -85,6 +85,12 @@ export const ENDPOINTS = {
|
|
|
85
85
|
path: "/api/perf",
|
|
86
86
|
description: "Rolling-window performance aggregates over perf_samples.",
|
|
87
87
|
},
|
|
88
|
+
/** GET /api/perf/samples — Raw perf samples for a single kind (chart drill-down). */
|
|
89
|
+
perfSamples: {
|
|
90
|
+
method: "GET",
|
|
91
|
+
path: "/api/perf/samples",
|
|
92
|
+
description: "Raw perf_samples for one kind (time-series drill-down across any perf metric).",
|
|
93
|
+
},
|
|
88
94
|
/** GET /api/achievements — Achievement tiles with unlock state. */
|
|
89
95
|
achievements: {
|
|
90
96
|
method: "GET",
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
* PREVENT-002 (parameterized SQL). Loopback-only localhost dashboard endpoint.
|
|
10
10
|
*/
|
|
11
11
|
import { createRequire } from "node:module";
|
|
12
|
-
import { computeCacheSavings } from "../../src/pricing.js";
|
|
12
|
+
import { computeCacheSavings, lookupModelInputRate } from "../../src/pricing.js";
|
|
13
|
+
import { costApiConfig, lookupCostApiPricing } from "../../src/costApi.js";
|
|
13
14
|
// ---------------------------------------------------------------------------
|
|
14
15
|
// handleProviderCache — "/api/provider-cache"
|
|
15
16
|
// ---------------------------------------------------------------------------
|
|
@@ -90,14 +91,25 @@ export function handleProviderCache(req, res, ctx) {
|
|
|
90
91
|
let savings = null;
|
|
91
92
|
try {
|
|
92
93
|
const snap = latestModelSnapshot(stateDir); // guardrails-allow PREVENT-PI-004: local SQLite read (loopback dashboard)
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
let rate = snap?.inputRate ?? 0;
|
|
95
|
+
let modelName = snap?.modelName ?? snap?.modelId ?? "unknown";
|
|
96
|
+
// Fallback chain: SQLite snapshot → local pricing table → cost API
|
|
97
|
+
if (rate <= 0 && modelName !== "unknown") {
|
|
98
|
+
rate = lookupModelInputRate(modelName) ?? 0;
|
|
99
|
+
}
|
|
100
|
+
if (rate <= 0 && costApiConfig().enabled && modelName !== "unknown") {
|
|
101
|
+
// guardrails-allow PREVENT-PI-004: cost API pricing lookup (user-opted-in)
|
|
102
|
+
const apiPricing = lookupCostApiPricing(modelName);
|
|
103
|
+
rate = apiPricing?.inputRate ?? 0;
|
|
104
|
+
}
|
|
105
|
+
if (rate > 0) {
|
|
106
|
+
const s = computeCacheSavings(lifetime.totalCacheRead, lifetime.totalCacheWrite, rate);
|
|
95
107
|
savings = {
|
|
96
108
|
cacheReadSaved: s.cacheReadSaved,
|
|
97
109
|
cacheWriteCost: s.cacheWriteCost,
|
|
98
110
|
netSaved: s.netSaved,
|
|
99
|
-
model:
|
|
100
|
-
inputRate:
|
|
111
|
+
model: modelName,
|
|
112
|
+
inputRate: rate,
|
|
101
113
|
};
|
|
102
114
|
}
|
|
103
115
|
}
|
|
@@ -298,6 +298,66 @@ export function handlePerf(req, res, ctx) {
|
|
|
298
298
|
return true;
|
|
299
299
|
}
|
|
300
300
|
// ---------------------------------------------------------------------------
|
|
301
|
+
// handlePerfSamples — "/api/perf/samples"
|
|
302
|
+
// ---------------------------------------------------------------------------
|
|
303
|
+
export function handlePerfSamples(req, res, ctx) {
|
|
304
|
+
if (!req.url?.startsWith("/api/perf/samples"))
|
|
305
|
+
return false;
|
|
306
|
+
const { stateDir } = ctx;
|
|
307
|
+
// /api/perf/samples — dashboard Perf tab chart drill-down. GET returns raw
|
|
308
|
+
// perf_samples for a single kind (?kind=<k>&minutes=<n>) ascending by ts so
|
|
309
|
+
// the client can render a time-series for any perf metric (turn_latency_ms,
|
|
310
|
+
// tps, disk_write_ms, cache_hit_pct, db_recompute_ms, etc.). `kind` is
|
|
311
|
+
// required and validated against the PERF_KINDS allow-list (400 on unknown);
|
|
312
|
+
// `minutes` defaults to 60 and is capped at 1440 (24h). Reads perf_samples
|
|
313
|
+
// via the same require()'d sqlite helper as /api/perf — no new SQLite code.
|
|
314
|
+
// Non-GET -> 405. PREVENT-PI-004: loopback.
|
|
315
|
+
const psReq = createRequire(import.meta.url);
|
|
316
|
+
const { readPerfSamples, PERF_KINDS } = psReq("../../src/store/sqlite.js");
|
|
317
|
+
if (req.method !== "GET") {
|
|
318
|
+
res.writeHead(405, { "Content-Type": "application/json" }); // guardrails-allow PREVENT-PI-004: loopback dashboard response (local)
|
|
319
|
+
res.end(JSON.stringify({ error: "method_not_allowed" }));
|
|
320
|
+
return true;
|
|
321
|
+
}
|
|
322
|
+
try {
|
|
323
|
+
const url = new URL(req.url, "http://x"); // guardrails-allow PREVENT-PI-004: localhost dashboard URL base (loopback-only)
|
|
324
|
+
const kindParam = url.searchParams.get("kind") ?? "";
|
|
325
|
+
if (!PERF_KINDS.includes(kindParam)) {
|
|
326
|
+
res.writeHead(400, { "Content-Type": "application/json" }); // guardrails-allow PREVENT-PI-004: loopback dashboard response (local)
|
|
327
|
+
res.end(JSON.stringify({ error: "unknown_kind", kind: kindParam }));
|
|
328
|
+
return true;
|
|
329
|
+
}
|
|
330
|
+
let minutes = Number(url.searchParams.get("minutes") ?? "60");
|
|
331
|
+
if (!Number.isFinite(minutes) || minutes <= 0)
|
|
332
|
+
minutes = 60;
|
|
333
|
+
minutes = Math.min(minutes, 1440); // cap at 24h
|
|
334
|
+
const sinceTs = Date.now() - minutes * 60_000;
|
|
335
|
+
const kind = kindParam; // validated against PERF_KINDS above
|
|
336
|
+
const rows = readPerfSamples(stateDir, sinceTs, kind); // guardrails-allow PREVENT-PI-004: local SQLite read (loopback dashboard)
|
|
337
|
+
const samples = rows.map((r) => ({
|
|
338
|
+
ts: r.ts,
|
|
339
|
+
value: r.value,
|
|
340
|
+
...(r.meta != null && typeof r.meta === "object"
|
|
341
|
+
? { meta: JSON.stringify(r.meta) }
|
|
342
|
+
: r.meta != null
|
|
343
|
+
? { meta: String(r.meta) }
|
|
344
|
+
: {}),
|
|
345
|
+
}));
|
|
346
|
+
res.writeHead(200, { "Content-Type": "application/json" });
|
|
347
|
+
res.end(JSON.stringify({
|
|
348
|
+
samples,
|
|
349
|
+
kind: kindParam,
|
|
350
|
+
minutes,
|
|
351
|
+
updatedAt: Date.now(),
|
|
352
|
+
}));
|
|
353
|
+
}
|
|
354
|
+
catch (e) {
|
|
355
|
+
res.writeHead(500, { "Content-Type": "application/json" });
|
|
356
|
+
res.end(JSON.stringify({ error: "perf_samples_unavailable", detail: String(e) }));
|
|
357
|
+
}
|
|
358
|
+
return true;
|
|
359
|
+
}
|
|
360
|
+
// ---------------------------------------------------------------------------
|
|
301
361
|
// handleAchievements — "/api/achievements"
|
|
302
362
|
// ---------------------------------------------------------------------------
|
|
303
363
|
export function handleAchievements(req, res, ctx) {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export { buildRouteContext } from "./routes-core.js";
|
|
8
8
|
export { handleIndex, handleRepoIndex, handleStatic } from "./routes-repo.js";
|
|
9
|
-
export { handleGameState, handleGameScores, handlePerf, handleAchievements, } from "./routes-game.js";
|
|
9
|
+
export { handleGameState, handleGameScores, handlePerf, handlePerfSamples, handleAchievements, } from "./routes-game.js";
|
|
10
10
|
export { handleEvents, handleSessions } from "./routes-sessions.js";
|
|
11
11
|
export { handleTopics } from "./routes-topics.js";
|
|
12
12
|
export { handleTurns } from "./routes-turns.js";
|
|
@@ -13,7 +13,7 @@ import { fileURLToPath } from "node:url";
|
|
|
13
13
|
import { createRequire } from "node:module";
|
|
14
14
|
import { NEW_UI } from "../../src/config.js";
|
|
15
15
|
import { log, setLogPath, setDashboardServerVersion } from "./state.js";
|
|
16
|
-
import { buildRouteContext, handleIndex, handleRepoIndex, handleEvents, handleGameState, handleGameScores, handlePerf, handleAchievements, handleSessions, handleTopics, handleTurns, handleMaintenance, handleProviderCache, handleCacheStripes, handleMemoryStatus, handleSetupStatus, handleSetupDetect, handleSetupConfigure, handleMemoryMap, handleRaptorTree, handleRaptorBuildHistory, handleContextHealth, handleCachePoison, handleHealthSettings, handleEmbedderHealth, handleRagSettings, handleRagMetrics, handleWiki, handleStatic, } from "./routes.js";
|
|
16
|
+
import { buildRouteContext, handleIndex, handleRepoIndex, handleEvents, handleGameState, handleGameScores, handlePerf, handlePerfSamples, handleAchievements, handleSessions, handleTopics, handleTurns, handleMaintenance, handleProviderCache, handleCacheStripes, handleMemoryStatus, handleSetupStatus, handleSetupDetect, handleSetupConfigure, handleMemoryMap, handleRaptorTree, handleRaptorBuildHistory, handleContextHealth, handleCachePoison, handleHealthSettings, handleEmbedderHealth, handleRagSettings, handleRagMetrics, handleWiki, handleStatic, } from "./routes.js";
|
|
17
17
|
export async function launchDashboardServer(stateDir) {
|
|
18
18
|
// Our own package version — exposed at /api/version so the launcher can
|
|
19
19
|
// detect a stale server (started by an older build) and replace it on
|
|
@@ -191,6 +191,8 @@ export async function launchDashboardServer(stateDir) {
|
|
|
191
191
|
return;
|
|
192
192
|
if (handleGameScores(req, res, ctx))
|
|
193
193
|
return;
|
|
194
|
+
if (handlePerfSamples(req, res, ctx))
|
|
195
|
+
return;
|
|
194
196
|
if (handlePerf(req, res, ctx))
|
|
195
197
|
return;
|
|
196
198
|
if (handleAchievements(req, res, ctx))
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { resolveRepoRoot } from "../mega-config.js";
|
|
9
9
|
import { recordModelSnapshot, recordRepoModel } from "../../src/store/sqlite.js";
|
|
10
10
|
import { lookupModelInputRate } from "../../src/pricing.js";
|
|
11
|
+
import { costApiConfig, lookupCostApiPricing } from "../../src/costApi.js";
|
|
11
12
|
// -------------------------------------------------------------- captureModel
|
|
12
13
|
export function captureModelImpl(ctx, ectx) {
|
|
13
14
|
const m = ectx.model;
|
|
@@ -29,13 +30,25 @@ export function captureModelImpl(ctx, ectx) {
|
|
|
29
30
|
}
|
|
30
31
|
const modelId = m.id;
|
|
31
32
|
const fallbackInput = lookupModelInputRate(modelId);
|
|
33
|
+
let inputRate = m.cost?.input || fallbackInput || 0;
|
|
34
|
+
let outputRate = m.cost?.output ?? 0;
|
|
35
|
+
// Cost API last-resort fallback for models not in the local pricing table
|
|
36
|
+
if (inputRate <= 0 && costApiConfig().enabled) {
|
|
37
|
+
// guardrails-allow PREVENT-PI-004: cost API pricing lookup (user-opted-in)
|
|
38
|
+
const apiPricing = lookupCostApiPricing(modelId);
|
|
39
|
+
if (apiPricing) {
|
|
40
|
+
inputRate = apiPricing.inputRate ?? 0;
|
|
41
|
+
if (outputRate <= 0)
|
|
42
|
+
outputRate = apiPricing.outputRate ?? 0;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
32
45
|
const snap = {
|
|
33
46
|
provider: m.provider,
|
|
34
47
|
providerName,
|
|
35
48
|
modelId,
|
|
36
49
|
modelName: m.name ?? null,
|
|
37
|
-
inputRate
|
|
38
|
-
outputRate
|
|
50
|
+
inputRate,
|
|
51
|
+
outputRate,
|
|
39
52
|
contextWindow: m.contextWindow ?? 0,
|
|
40
53
|
maxTokens: m.maxTokens ?? 0,
|
|
41
54
|
reasoning: !!m.reasoning,
|
|
@@ -45,6 +45,12 @@ export function snapshotImpl(self, ctx) {
|
|
|
45
45
|
const sig = materialSigImpl(self);
|
|
46
46
|
if (ctx && self.widgetData && self.lastSnapshotSig === sig) {
|
|
47
47
|
self.renderWidget(ctx);
|
|
48
|
+
// Refresh heartbeat on a time cadence even when material state hasn't
|
|
49
|
+
// changed, so the session doesn't appear stale and get pruned by the
|
|
50
|
+
// dashboard's 30-min cutoff. The full snapshot recompute is still gated
|
|
51
|
+
// (expensive SQLite opens + writeFileSync), but a heartbeat row is
|
|
52
|
+
// cheap (single INSERT OR REPLACE on the index DB).
|
|
53
|
+
refreshHeartbeatIfStale(self, ctx, 10_000);
|
|
48
54
|
return;
|
|
49
55
|
}
|
|
50
56
|
const perfT0 = performance.now();
|
|
@@ -216,4 +222,24 @@ export function snapshotImpl(self, ctx) {
|
|
|
216
222
|
/* non-fatal: perf instrumentation never blocks the agent */
|
|
217
223
|
}
|
|
218
224
|
self.lastSnapshotSig = sig;
|
|
225
|
+
self.lastHeartbeatAt = Date.now();
|
|
226
|
+
}
|
|
227
|
+
// ----------------------------------------------------------- heartbeat refresh
|
|
228
|
+
/** Refresh the session heartbeat if enough time has elapsed since the last
|
|
229
|
+
* write. Called from the material-change gate fast path (where the full
|
|
230
|
+
* snapshot recompute is skipped) so the session stays visible in the
|
|
231
|
+
* dashboard during idle/typing periods. Non-fatal — best-effort like the
|
|
232
|
+
* main heartbeat write. */
|
|
233
|
+
function refreshHeartbeatIfStale(self, ctx, intervalMs) {
|
|
234
|
+
const now = Date.now();
|
|
235
|
+
if (now - self.lastHeartbeatAt < intervalMs)
|
|
236
|
+
return;
|
|
237
|
+
try {
|
|
238
|
+
const repo = resolveRepoRoot(ctx?.cwd ?? self.currentStateDir) ?? self.currentStateDir;
|
|
239
|
+
recordSessionHeartbeat(process.pid, self.rt.sessionId, repo, self.currentStateDir, self.lastCtxWindow || 0);
|
|
240
|
+
self.lastHeartbeatAt = now;
|
|
241
|
+
}
|
|
242
|
+
catch {
|
|
243
|
+
/* non-fatal: heartbeat refresh must never block the snapshot path */
|
|
244
|
+
}
|
|
219
245
|
}
|
|
@@ -163,6 +163,7 @@ export class MegaRuntime {
|
|
|
163
163
|
// (already-registered) widget factory is refreshed. Kills the per-event
|
|
164
164
|
// main-thread block during typing/idle streaming with no material change.
|
|
165
165
|
lastSnapshotSig = null;
|
|
166
|
+
lastHeartbeatAt = 0;
|
|
166
167
|
// v0.8.5: bumped whenever the cached game-state memo is evicted (bumpGameState
|
|
167
168
|
// for in-process /mega-game writes, the fs.watch callback for cross-process
|
|
168
169
|
// dashboard-server writes, and bindRepo on repo switch) so the snapshot gate
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as R,c as W,m as T,i as C,d as F,A as ie,e as B,h as q,j as oe,k as G,l as se,n as le,u as ue,o as K,G as ce,p as J,q as Q,D as fe,g as pe,X as he,Y as de,f as me}from"./generateCategoricalChart-BwzyqytT.js";import{R as p,A as ee,r as ve}from"./index-pmtEr3sb.js";var ye=["layout","type","stroke","connectNulls","isRange","ref"],be=["key"],te;function M(e){"@babel/helpers - typeof";return M=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},M(e)}function ae(e,t){if(e==null)return{};var r=Ae(e,t),a,n;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)a=i[n],!(t.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}function Ae(e,t){if(e==null)return{};var r={};for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){if(t.indexOf(a)>=0)continue;r[a]=e[a]}return r}function D(){return D=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},D.apply(this,arguments)}function U(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,a)}return r}function S(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?U(Object(r),!0).forEach(function(a){E(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):U(Object(r)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a))})}return e}function ge(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Z(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,ne(a.key),a)}}function xe(e,t,r){return t&&Z(e.prototype,t),r&&Z(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Pe(e,t,r){return t=$(t),Oe(e,re()?Reflect.construct(t,r||[],$(e).constructor):t.apply(e,r))}function Oe(e,t){if(t&&(M(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ee(e)}function Ee(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function re(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(re=function(){return!!e})()}function $(e){return $=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},$(e)}function we(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&X(e,t)}function X(e,t){return X=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,n){return a.__proto__=n,a},X(e,t)}function E(e,t,r){return t=ne(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ne(e){var t=_e(e,"string");return M(t)=="symbol"?t:t+""}function _e(e,t){if(M(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var a=r.call(e,t);if(M(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var L=function(e){function t(){var r;ge(this,t);for(var a=arguments.length,n=new Array(a),i=0;i<a;i++)n[i]=arguments[i];return r=Pe(this,t,[].concat(n)),E(r,"state",{isAnimationFinished:!0}),E(r,"id",ue("recharts-area-")),E(r,"handleAnimationEnd",function(){var o=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),K(o)&&o()}),E(r,"handleAnimationStart",function(){var o=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),K(o)&&o()}),r}return we(t,e),xe(t,[{key:"renderDots",value:function(a,n,i){var o=this.props.isAnimationActive,s=this.state.isAnimationFinished;if(o&&!s)return null;var u=this.props,l=u.dot,f=u.points,c=u.dataKey,h=R(this.props,!1),A=R(l,!0),g=f.map(function(v,O){var y=S(S(S({key:"dot-".concat(O),r:3},h),A),{},{index:O,cx:v.x,cy:v.y,dataKey:c,value:v.value,payload:v.payload,points:f});return t.renderDotItem(l,y)}),x={clipPath:a?"url(#clipPath-".concat(n?"":"dots-").concat(i,")"):null};return p.createElement(W,D({className:"recharts-area-dots"},x),g)}},{key:"renderHorizontalRect",value:function(a){var n=this.props,i=n.baseLine,o=n.points,s=n.strokeWidth,u=o[0].x,l=o[o.length-1].x,f=a*Math.abs(u-l),c=T(o.map(function(h){return h.y||0}));return C(i)&&typeof i=="number"?c=Math.max(i,c):i&&Array.isArray(i)&&i.length&&(c=Math.max(T(i.map(function(h){return h.y||0})),c)),C(c)?p.createElement("rect",{x:u<l?u:u-f,y:0,width:f,height:Math.floor(c+(s?parseInt("".concat(s),10):1))}):null}},{key:"renderVerticalRect",value:function(a){var n=this.props,i=n.baseLine,o=n.points,s=n.strokeWidth,u=o[0].y,l=o[o.length-1].y,f=a*Math.abs(u-l),c=T(o.map(function(h){return h.x||0}));return C(i)&&typeof i=="number"?c=Math.max(i,c):i&&Array.isArray(i)&&i.length&&(c=Math.max(T(i.map(function(h){return h.x||0})),c)),C(c)?p.createElement("rect",{x:0,y:u<l?u:u-f,width:c+(s?parseInt("".concat(s),10):1),height:Math.floor(f)}):null}},{key:"renderClipRect",value:function(a){var n=this.props.layout;return n==="vertical"?this.renderVerticalRect(a):this.renderHorizontalRect(a)}},{key:"renderAreaStatically",value:function(a,n,i,o){var s=this.props,u=s.layout,l=s.type,f=s.stroke,c=s.connectNulls,h=s.isRange;s.ref;var A=ae(s,ye);return p.createElement(W,{clipPath:i?"url(#clipPath-".concat(o,")"):null},p.createElement(F,D({},R(A,!0),{points:a,connectNulls:c,type:l,baseLine:n,layout:u,stroke:"none",className:"recharts-area-area"})),f!=="none"&&p.createElement(F,D({},R(this.props,!1),{className:"recharts-area-curve",layout:u,type:l,connectNulls:c,fill:"none",points:a})),f!=="none"&&h&&p.createElement(F,D({},R(this.props,!1),{className:"recharts-area-curve",layout:u,type:l,connectNulls:c,fill:"none",points:n})))}},{key:"renderAreaWithAnimation",value:function(a,n){var i=this,o=this.props,s=o.points,u=o.baseLine,l=o.isAnimationActive,f=o.animationBegin,c=o.animationDuration,h=o.animationEasing,A=o.animationId,g=this.state,x=g.prevPoints,v=g.prevBaseLine;return p.createElement(ie,{begin:f,duration:c,isActive:l,easing:h,from:{t:0},to:{t:1},key:"area-".concat(A),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(O){var y=O.t;if(x){var _=x.length/s.length,d=s.map(function(P,N){var k=Math.floor(N*_);if(x[k]){var j=x[k],I=B(j.x,P.x),V=B(j.y,P.y);return S(S({},P),{},{x:I(y),y:V(y)})}return P}),m;if(C(u)&&typeof u=="number"){var b=B(v,u);m=b(y)}else if(q(u)||oe(u)){var w=B(v,0);m=w(y)}else m=u.map(function(P,N){var k=Math.floor(N*_);if(v[k]){var j=v[k],I=B(j.x,P.x),V=B(j.y,P.y);return S(S({},P),{},{x:I(y),y:V(y)})}return P});return i.renderAreaStatically(d,m,a,n)}return p.createElement(W,null,p.createElement("defs",null,p.createElement("clipPath",{id:"animationClipPath-".concat(n)},i.renderClipRect(y))),p.createElement(W,{clipPath:"url(#animationClipPath-".concat(n,")")},i.renderAreaStatically(s,u,a,n)))})}},{key:"renderArea",value:function(a,n){var i=this.props,o=i.points,s=i.baseLine,u=i.isAnimationActive,l=this.state,f=l.prevPoints,c=l.prevBaseLine,h=l.totalLength;return u&&o&&o.length&&(!f&&h>0||!G(f,o)||!G(c,s))?this.renderAreaWithAnimation(a,n):this.renderAreaStatically(o,s,a,n)}},{key:"render",value:function(){var a,n=this.props,i=n.hide,o=n.dot,s=n.points,u=n.className,l=n.top,f=n.left,c=n.xAxis,h=n.yAxis,A=n.width,g=n.height,x=n.isAnimationActive,v=n.id;if(i||!s||!s.length)return null;var O=this.state.isAnimationFinished,y=s.length===1,_=ee("recharts-area",u),d=c&&c.allowDataOverflow,m=h&&h.allowDataOverflow,b=d||m,w=q(v)?this.id:v,P=(a=R(o,!1))!==null&&a!==void 0?a:{r:3,strokeWidth:2},N=P.r,k=N===void 0?3:N,j=P.strokeWidth,I=j===void 0?2:j,V=se(o)?o:{},Y=V.clipDot,H=Y===void 0?!0:Y,z=k*2+I;return p.createElement(W,{className:_},d||m?p.createElement("defs",null,p.createElement("clipPath",{id:"clipPath-".concat(w)},p.createElement("rect",{x:d?f:f-A/2,y:m?l:l-g/2,width:d?A:A*2,height:m?g:g*2})),!H&&p.createElement("clipPath",{id:"clipPath-dots-".concat(w)},p.createElement("rect",{x:f-z/2,y:l-z/2,width:A+z,height:g+z}))):null,y?null:this.renderArea(b,w),(o||y)&&this.renderDots(b,H,w),(!x||O)&&le.renderCallByParent(this.props,s))}}],[{key:"getDerivedStateFromProps",value:function(a,n){return a.animationId!==n.prevAnimationId?{prevAnimationId:a.animationId,curPoints:a.points,curBaseLine:a.baseLine,prevPoints:n.curPoints,prevBaseLine:n.curBaseLine}:a.points!==n.curPoints||a.baseLine!==n.curBaseLine?{curPoints:a.points,curBaseLine:a.baseLine}:null}}])}(ve.PureComponent);te=L;E(L,"displayName","Area");E(L,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!ce.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});E(L,"getBaseValue",function(e,t,r,a){var n=e.layout,i=e.baseValue,o=t.props.baseValue,s=o??i;if(C(s)&&typeof s=="number")return s;var u=n==="horizontal"?a:r,l=u.scale.domain();if(u.type==="number"){var f=Math.max(l[0],l[1]),c=Math.min(l[0],l[1]);return s==="dataMin"?c:s==="dataMax"||f<0?f:Math.max(Math.min(l[0],l[1]),0)}return s==="dataMin"?l[0]:s==="dataMax"?l[1]:l[0]});E(L,"getComposedData",function(e){var t=e.props,r=e.item,a=e.xAxis,n=e.yAxis,i=e.xAxisTicks,o=e.yAxisTicks,s=e.bandSize,u=e.dataKey,l=e.stackedData,f=e.dataStartIndex,c=e.displayedData,h=e.offset,A=t.layout,g=l&&l.length,x=te.getBaseValue(t,r,a,n),v=A==="horizontal",O=!1,y=c.map(function(d,m){var b;g?b=l[f+m]:(b=J(d,u),Array.isArray(b)?O=!0:b=[x,b]);var w=b[1]==null||g&&J(d,u)==null;return v?{x:Q({axis:a,ticks:i,bandSize:s,entry:d,index:m}),y:w?null:n.scale(b[1]),value:b,payload:d}:{x:w?null:a.scale(b[1]),y:Q({axis:n,ticks:o,bandSize:s,entry:d,index:m}),value:b,payload:d}}),_;return g||O?_=y.map(function(d){var m=Array.isArray(d.value)?d.value[0]:null;return v?{x:d.x,y:m!=null&&d.y!=null?n.scale(m):null}:{x:m!=null?a.scale(m):null,y:d.y}}):_=v?n.scale(x):a.scale(x),S({points:y,baseLine:_,layout:A,isRange:O},h)});E(L,"renderDotItem",function(e,t){var r;if(p.isValidElement(e))r=p.cloneElement(e,t);else if(K(e))r=e(t);else{var a=ee("recharts-area-dot",typeof e!="boolean"?e.className:""),n=t.key,i=ae(t,be);r=p.createElement(fe,D({},i,{key:n,className:a}))}return r});var ke=pe({chartName:"AreaChart",GraphicalChild:L,axisComponents:[{axisType:"xAxis",AxisComp:he},{axisType:"yAxis",AxisComp:de}],formatAxisMap:me});export{ke as A,L as a};
|
|
2
|
+
//# sourceMappingURL=AreaChart-rJdaOUlj.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AreaChart-rJdaOUlj.js","sources":["../../node_modules/recharts/es6/cartesian/Area.js","../../node_modules/recharts/es6/chart/AreaChart.js"],"sourcesContent":["var _excluded = [\"layout\", \"type\", \"stroke\", \"connectNulls\", \"isRange\", \"ref\"],\n _excluded2 = [\"key\"];\nvar _Area;\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n/**\n * @fileOverview Area\n */\nimport React, { PureComponent } from 'react';\nimport clsx from 'clsx';\nimport Animate from 'react-smooth';\nimport isFunction from 'lodash/isFunction';\nimport max from 'lodash/max';\nimport isNil from 'lodash/isNil';\nimport isNan from 'lodash/isNaN';\nimport isEqual from 'lodash/isEqual';\nimport { Curve } from '../shape/Curve';\nimport { Dot } from '../shape/Dot';\nimport { Layer } from '../container/Layer';\nimport { LabelList } from '../component/LabelList';\nimport { Global } from '../util/Global';\nimport { isNumber, uniqueId, interpolateNumber } from '../util/DataUtils';\nimport { getCateCoordinateOfLine, getValueByDataKey } from '../util/ChartUtils';\nimport { filterProps, hasClipDot } from '../util/ReactUtils';\nexport var Area = /*#__PURE__*/function (_PureComponent) {\n function Area() {\n var _this;\n _classCallCheck(this, Area);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _callSuper(this, Area, [].concat(args));\n _defineProperty(_this, \"state\", {\n isAnimationFinished: true\n });\n _defineProperty(_this, \"id\", uniqueId('recharts-area-'));\n _defineProperty(_this, \"handleAnimationEnd\", function () {\n var onAnimationEnd = _this.props.onAnimationEnd;\n _this.setState({\n isAnimationFinished: true\n });\n if (isFunction(onAnimationEnd)) {\n onAnimationEnd();\n }\n });\n _defineProperty(_this, \"handleAnimationStart\", function () {\n var onAnimationStart = _this.props.onAnimationStart;\n _this.setState({\n isAnimationFinished: false\n });\n if (isFunction(onAnimationStart)) {\n onAnimationStart();\n }\n });\n return _this;\n }\n _inherits(Area, _PureComponent);\n return _createClass(Area, [{\n key: \"renderDots\",\n value: function renderDots(needClip, clipDot, clipPathId) {\n var isAnimationActive = this.props.isAnimationActive;\n var isAnimationFinished = this.state.isAnimationFinished;\n if (isAnimationActive && !isAnimationFinished) {\n return null;\n }\n var _this$props = this.props,\n dot = _this$props.dot,\n points = _this$props.points,\n dataKey = _this$props.dataKey;\n var areaProps = filterProps(this.props, false);\n var customDotProps = filterProps(dot, true);\n var dots = points.map(function (entry, i) {\n var dotProps = _objectSpread(_objectSpread(_objectSpread({\n key: \"dot-\".concat(i),\n r: 3\n }, areaProps), customDotProps), {}, {\n index: i,\n cx: entry.x,\n cy: entry.y,\n dataKey: dataKey,\n value: entry.value,\n payload: entry.payload,\n points: points\n });\n return Area.renderDotItem(dot, dotProps);\n });\n var dotsProps = {\n clipPath: needClip ? \"url(#clipPath-\".concat(clipDot ? '' : 'dots-').concat(clipPathId, \")\") : null\n };\n return /*#__PURE__*/React.createElement(Layer, _extends({\n className: \"recharts-area-dots\"\n }, dotsProps), dots);\n }\n }, {\n key: \"renderHorizontalRect\",\n value: function renderHorizontalRect(alpha) {\n var _this$props2 = this.props,\n baseLine = _this$props2.baseLine,\n points = _this$props2.points,\n strokeWidth = _this$props2.strokeWidth;\n var startX = points[0].x;\n var endX = points[points.length - 1].x;\n var width = alpha * Math.abs(startX - endX);\n var maxY = max(points.map(function (entry) {\n return entry.y || 0;\n }));\n if (isNumber(baseLine) && typeof baseLine === 'number') {\n maxY = Math.max(baseLine, maxY);\n } else if (baseLine && Array.isArray(baseLine) && baseLine.length) {\n maxY = Math.max(max(baseLine.map(function (entry) {\n return entry.y || 0;\n })), maxY);\n }\n if (isNumber(maxY)) {\n return /*#__PURE__*/React.createElement(\"rect\", {\n x: startX < endX ? startX : startX - width,\n y: 0,\n width: width,\n height: Math.floor(maxY + (strokeWidth ? parseInt(\"\".concat(strokeWidth), 10) : 1))\n });\n }\n return null;\n }\n }, {\n key: \"renderVerticalRect\",\n value: function renderVerticalRect(alpha) {\n var _this$props3 = this.props,\n baseLine = _this$props3.baseLine,\n points = _this$props3.points,\n strokeWidth = _this$props3.strokeWidth;\n var startY = points[0].y;\n var endY = points[points.length - 1].y;\n var height = alpha * Math.abs(startY - endY);\n var maxX = max(points.map(function (entry) {\n return entry.x || 0;\n }));\n if (isNumber(baseLine) && typeof baseLine === 'number') {\n maxX = Math.max(baseLine, maxX);\n } else if (baseLine && Array.isArray(baseLine) && baseLine.length) {\n maxX = Math.max(max(baseLine.map(function (entry) {\n return entry.x || 0;\n })), maxX);\n }\n if (isNumber(maxX)) {\n return /*#__PURE__*/React.createElement(\"rect\", {\n x: 0,\n y: startY < endY ? startY : startY - height,\n width: maxX + (strokeWidth ? parseInt(\"\".concat(strokeWidth), 10) : 1),\n height: Math.floor(height)\n });\n }\n return null;\n }\n }, {\n key: \"renderClipRect\",\n value: function renderClipRect(alpha) {\n var layout = this.props.layout;\n if (layout === 'vertical') {\n return this.renderVerticalRect(alpha);\n }\n return this.renderHorizontalRect(alpha);\n }\n }, {\n key: \"renderAreaStatically\",\n value: function renderAreaStatically(points, baseLine, needClip, clipPathId) {\n var _this$props4 = this.props,\n layout = _this$props4.layout,\n type = _this$props4.type,\n stroke = _this$props4.stroke,\n connectNulls = _this$props4.connectNulls,\n isRange = _this$props4.isRange,\n ref = _this$props4.ref,\n others = _objectWithoutProperties(_this$props4, _excluded);\n return /*#__PURE__*/React.createElement(Layer, {\n clipPath: needClip ? \"url(#clipPath-\".concat(clipPathId, \")\") : null\n }, /*#__PURE__*/React.createElement(Curve, _extends({}, filterProps(others, true), {\n points: points,\n connectNulls: connectNulls,\n type: type,\n baseLine: baseLine,\n layout: layout,\n stroke: \"none\",\n className: \"recharts-area-area\"\n })), stroke !== 'none' && /*#__PURE__*/React.createElement(Curve, _extends({}, filterProps(this.props, false), {\n className: \"recharts-area-curve\",\n layout: layout,\n type: type,\n connectNulls: connectNulls,\n fill: \"none\",\n points: points\n })), stroke !== 'none' && isRange && /*#__PURE__*/React.createElement(Curve, _extends({}, filterProps(this.props, false), {\n className: \"recharts-area-curve\",\n layout: layout,\n type: type,\n connectNulls: connectNulls,\n fill: \"none\",\n points: baseLine\n })));\n }\n }, {\n key: \"renderAreaWithAnimation\",\n value: function renderAreaWithAnimation(needClip, clipPathId) {\n var _this2 = this;\n var _this$props5 = this.props,\n points = _this$props5.points,\n baseLine = _this$props5.baseLine,\n isAnimationActive = _this$props5.isAnimationActive,\n animationBegin = _this$props5.animationBegin,\n animationDuration = _this$props5.animationDuration,\n animationEasing = _this$props5.animationEasing,\n animationId = _this$props5.animationId;\n var _this$state = this.state,\n prevPoints = _this$state.prevPoints,\n prevBaseLine = _this$state.prevBaseLine;\n // const clipPathId = isNil(id) ? this.id : id;\n\n return /*#__PURE__*/React.createElement(Animate, {\n begin: animationBegin,\n duration: animationDuration,\n isActive: isAnimationActive,\n easing: animationEasing,\n from: {\n t: 0\n },\n to: {\n t: 1\n },\n key: \"area-\".concat(animationId),\n onAnimationEnd: this.handleAnimationEnd,\n onAnimationStart: this.handleAnimationStart\n }, function (_ref) {\n var t = _ref.t;\n if (prevPoints) {\n var prevPointsDiffFactor = prevPoints.length / points.length;\n // update animtaion\n var stepPoints = points.map(function (entry, index) {\n var prevPointIndex = Math.floor(index * prevPointsDiffFactor);\n if (prevPoints[prevPointIndex]) {\n var prev = prevPoints[prevPointIndex];\n var interpolatorX = interpolateNumber(prev.x, entry.x);\n var interpolatorY = interpolateNumber(prev.y, entry.y);\n return _objectSpread(_objectSpread({}, entry), {}, {\n x: interpolatorX(t),\n y: interpolatorY(t)\n });\n }\n return entry;\n });\n var stepBaseLine;\n if (isNumber(baseLine) && typeof baseLine === 'number') {\n var interpolator = interpolateNumber(prevBaseLine, baseLine);\n stepBaseLine = interpolator(t);\n } else if (isNil(baseLine) || isNan(baseLine)) {\n var _interpolator = interpolateNumber(prevBaseLine, 0);\n stepBaseLine = _interpolator(t);\n } else {\n stepBaseLine = baseLine.map(function (entry, index) {\n var prevPointIndex = Math.floor(index * prevPointsDiffFactor);\n if (prevBaseLine[prevPointIndex]) {\n var prev = prevBaseLine[prevPointIndex];\n var interpolatorX = interpolateNumber(prev.x, entry.x);\n var interpolatorY = interpolateNumber(prev.y, entry.y);\n return _objectSpread(_objectSpread({}, entry), {}, {\n x: interpolatorX(t),\n y: interpolatorY(t)\n });\n }\n return entry;\n });\n }\n return _this2.renderAreaStatically(stepPoints, stepBaseLine, needClip, clipPathId);\n }\n return /*#__PURE__*/React.createElement(Layer, null, /*#__PURE__*/React.createElement(\"defs\", null, /*#__PURE__*/React.createElement(\"clipPath\", {\n id: \"animationClipPath-\".concat(clipPathId)\n }, _this2.renderClipRect(t))), /*#__PURE__*/React.createElement(Layer, {\n clipPath: \"url(#animationClipPath-\".concat(clipPathId, \")\")\n }, _this2.renderAreaStatically(points, baseLine, needClip, clipPathId)));\n });\n }\n }, {\n key: \"renderArea\",\n value: function renderArea(needClip, clipPathId) {\n var _this$props6 = this.props,\n points = _this$props6.points,\n baseLine = _this$props6.baseLine,\n isAnimationActive = _this$props6.isAnimationActive;\n var _this$state2 = this.state,\n prevPoints = _this$state2.prevPoints,\n prevBaseLine = _this$state2.prevBaseLine,\n totalLength = _this$state2.totalLength;\n if (isAnimationActive && points && points.length && (!prevPoints && totalLength > 0 || !isEqual(prevPoints, points) || !isEqual(prevBaseLine, baseLine))) {\n return this.renderAreaWithAnimation(needClip, clipPathId);\n }\n return this.renderAreaStatically(points, baseLine, needClip, clipPathId);\n }\n }, {\n key: \"render\",\n value: function render() {\n var _filterProps;\n var _this$props7 = this.props,\n hide = _this$props7.hide,\n dot = _this$props7.dot,\n points = _this$props7.points,\n className = _this$props7.className,\n top = _this$props7.top,\n left = _this$props7.left,\n xAxis = _this$props7.xAxis,\n yAxis = _this$props7.yAxis,\n width = _this$props7.width,\n height = _this$props7.height,\n isAnimationActive = _this$props7.isAnimationActive,\n id = _this$props7.id;\n if (hide || !points || !points.length) {\n return null;\n }\n var isAnimationFinished = this.state.isAnimationFinished;\n var hasSinglePoint = points.length === 1;\n var layerClass = clsx('recharts-area', className);\n var needClipX = xAxis && xAxis.allowDataOverflow;\n var needClipY = yAxis && yAxis.allowDataOverflow;\n var needClip = needClipX || needClipY;\n var clipPathId = isNil(id) ? this.id : id;\n var _ref2 = (_filterProps = filterProps(dot, false)) !== null && _filterProps !== void 0 ? _filterProps : {\n r: 3,\n strokeWidth: 2\n },\n _ref2$r = _ref2.r,\n r = _ref2$r === void 0 ? 3 : _ref2$r,\n _ref2$strokeWidth = _ref2.strokeWidth,\n strokeWidth = _ref2$strokeWidth === void 0 ? 2 : _ref2$strokeWidth;\n var _ref3 = hasClipDot(dot) ? dot : {},\n _ref3$clipDot = _ref3.clipDot,\n clipDot = _ref3$clipDot === void 0 ? true : _ref3$clipDot;\n var dotSize = r * 2 + strokeWidth;\n return /*#__PURE__*/React.createElement(Layer, {\n className: layerClass\n }, needClipX || needClipY ? /*#__PURE__*/React.createElement(\"defs\", null, /*#__PURE__*/React.createElement(\"clipPath\", {\n id: \"clipPath-\".concat(clipPathId)\n }, /*#__PURE__*/React.createElement(\"rect\", {\n x: needClipX ? left : left - width / 2,\n y: needClipY ? top : top - height / 2,\n width: needClipX ? width : width * 2,\n height: needClipY ? height : height * 2\n })), !clipDot && /*#__PURE__*/React.createElement(\"clipPath\", {\n id: \"clipPath-dots-\".concat(clipPathId)\n }, /*#__PURE__*/React.createElement(\"rect\", {\n x: left - dotSize / 2,\n y: top - dotSize / 2,\n width: width + dotSize,\n height: height + dotSize\n }))) : null, !hasSinglePoint ? this.renderArea(needClip, clipPathId) : null, (dot || hasSinglePoint) && this.renderDots(needClip, clipDot, clipPathId), (!isAnimationActive || isAnimationFinished) && LabelList.renderCallByParent(this.props, points));\n }\n }], [{\n key: \"getDerivedStateFromProps\",\n value: function getDerivedStateFromProps(nextProps, prevState) {\n if (nextProps.animationId !== prevState.prevAnimationId) {\n return {\n prevAnimationId: nextProps.animationId,\n curPoints: nextProps.points,\n curBaseLine: nextProps.baseLine,\n prevPoints: prevState.curPoints,\n prevBaseLine: prevState.curBaseLine\n };\n }\n if (nextProps.points !== prevState.curPoints || nextProps.baseLine !== prevState.curBaseLine) {\n return {\n curPoints: nextProps.points,\n curBaseLine: nextProps.baseLine\n };\n }\n return null;\n }\n }]);\n}(PureComponent);\n_Area = Area;\n_defineProperty(Area, \"displayName\", 'Area');\n_defineProperty(Area, \"defaultProps\", {\n stroke: '#3182bd',\n fill: '#3182bd',\n fillOpacity: 0.6,\n xAxisId: 0,\n yAxisId: 0,\n legendType: 'line',\n connectNulls: false,\n // points of area\n points: [],\n dot: false,\n activeDot: true,\n hide: false,\n isAnimationActive: !Global.isSsr,\n animationBegin: 0,\n animationDuration: 1500,\n animationEasing: 'ease'\n});\n_defineProperty(Area, \"getBaseValue\", function (props, item, xAxis, yAxis) {\n var layout = props.layout,\n chartBaseValue = props.baseValue;\n var itemBaseValue = item.props.baseValue;\n\n // The baseValue can be defined both on the AreaChart as well as on the Area.\n // The value for the item takes precedence.\n var baseValue = itemBaseValue !== null && itemBaseValue !== void 0 ? itemBaseValue : chartBaseValue;\n if (isNumber(baseValue) && typeof baseValue === 'number') {\n return baseValue;\n }\n var numericAxis = layout === 'horizontal' ? yAxis : xAxis;\n var domain = numericAxis.scale.domain();\n if (numericAxis.type === 'number') {\n var domainMax = Math.max(domain[0], domain[1]);\n var domainMin = Math.min(domain[0], domain[1]);\n if (baseValue === 'dataMin') {\n return domainMin;\n }\n if (baseValue === 'dataMax') {\n return domainMax;\n }\n return domainMax < 0 ? domainMax : Math.max(Math.min(domain[0], domain[1]), 0);\n }\n if (baseValue === 'dataMin') {\n return domain[0];\n }\n if (baseValue === 'dataMax') {\n return domain[1];\n }\n return domain[0];\n});\n_defineProperty(Area, \"getComposedData\", function (_ref4) {\n var props = _ref4.props,\n item = _ref4.item,\n xAxis = _ref4.xAxis,\n yAxis = _ref4.yAxis,\n xAxisTicks = _ref4.xAxisTicks,\n yAxisTicks = _ref4.yAxisTicks,\n bandSize = _ref4.bandSize,\n dataKey = _ref4.dataKey,\n stackedData = _ref4.stackedData,\n dataStartIndex = _ref4.dataStartIndex,\n displayedData = _ref4.displayedData,\n offset = _ref4.offset;\n var layout = props.layout;\n var hasStack = stackedData && stackedData.length;\n var baseValue = _Area.getBaseValue(props, item, xAxis, yAxis);\n var isHorizontalLayout = layout === 'horizontal';\n var isRange = false;\n var points = displayedData.map(function (entry, index) {\n var value;\n if (hasStack) {\n value = stackedData[dataStartIndex + index];\n } else {\n value = getValueByDataKey(entry, dataKey);\n if (!Array.isArray(value)) {\n value = [baseValue, value];\n } else {\n isRange = true;\n }\n }\n var isBreakPoint = value[1] == null || hasStack && getValueByDataKey(entry, dataKey) == null;\n if (isHorizontalLayout) {\n return {\n x: getCateCoordinateOfLine({\n axis: xAxis,\n ticks: xAxisTicks,\n bandSize: bandSize,\n entry: entry,\n index: index\n }),\n y: isBreakPoint ? null : yAxis.scale(value[1]),\n value: value,\n payload: entry\n };\n }\n return {\n x: isBreakPoint ? null : xAxis.scale(value[1]),\n y: getCateCoordinateOfLine({\n axis: yAxis,\n ticks: yAxisTicks,\n bandSize: bandSize,\n entry: entry,\n index: index\n }),\n value: value,\n payload: entry\n };\n });\n var baseLine;\n if (hasStack || isRange) {\n baseLine = points.map(function (entry) {\n var x = Array.isArray(entry.value) ? entry.value[0] : null;\n if (isHorizontalLayout) {\n return {\n x: entry.x,\n y: x != null && entry.y != null ? yAxis.scale(x) : null\n };\n }\n return {\n x: x != null ? xAxis.scale(x) : null,\n y: entry.y\n };\n });\n } else {\n baseLine = isHorizontalLayout ? yAxis.scale(baseValue) : xAxis.scale(baseValue);\n }\n return _objectSpread({\n points: points,\n baseLine: baseLine,\n layout: layout,\n isRange: isRange\n }, offset);\n});\n_defineProperty(Area, \"renderDotItem\", function (option, props) {\n var dotItem;\n if ( /*#__PURE__*/React.isValidElement(option)) {\n dotItem = /*#__PURE__*/React.cloneElement(option, props);\n } else if (isFunction(option)) {\n dotItem = option(props);\n } else {\n var className = clsx('recharts-area-dot', typeof option !== 'boolean' ? option.className : '');\n var key = props.key,\n rest = _objectWithoutProperties(props, _excluded2);\n dotItem = /*#__PURE__*/React.createElement(Dot, _extends({}, rest, {\n key: key,\n className: className\n }));\n }\n return dotItem;\n});","/**\n * @fileOverview Area Chart\n */\nimport { generateCategoricalChart } from './generateCategoricalChart';\nimport { Area } from '../cartesian/Area';\nimport { XAxis } from '../cartesian/XAxis';\nimport { YAxis } from '../cartesian/YAxis';\nimport { formatAxisMap } from '../util/CartesianUtils';\nexport var AreaChart = generateCategoricalChart({\n chartName: 'AreaChart',\n GraphicalChild: Area,\n axisComponents: [{\n axisType: 'xAxis',\n AxisComp: XAxis\n }, {\n axisType: 'yAxis',\n AxisComp: YAxis\n }],\n formatAxisMap: formatAxisMap\n});"],"names":["_excluded","_excluded2","_Area","_typeof","o","_objectWithoutProperties","source","excluded","target","_objectWithoutPropertiesLoose","key","i","sourceSymbolKeys","_extends","ownKeys","r","t","_objectSpread","_defineProperty","_classCallCheck","instance","Constructor","_defineProperties","props","descriptor","_toPropertyKey","_createClass","protoProps","staticProps","_callSuper","e","_getPrototypeOf","_possibleConstructorReturn","_isNativeReflectConstruct","self","call","_assertThisInitialized","_inherits","subClass","superClass","_setPrototypeOf","p","obj","value","_toPrimitive","Area","_PureComponent","_this","_len","args","_key","uniqueId","onAnimationEnd","isFunction","onAnimationStart","needClip","clipDot","clipPathId","isAnimationActive","isAnimationFinished","_this$props","dot","points","dataKey","areaProps","filterProps","customDotProps","dots","entry","dotProps","dotsProps","React","Layer","alpha","_this$props2","baseLine","strokeWidth","startX","endX","width","maxY","max","isNumber","_this$props3","startY","endY","height","maxX","layout","_this$props4","type","stroke","connectNulls","isRange","others","Curve","_this2","_this$props5","animationBegin","animationDuration","animationEasing","animationId","_this$state","prevPoints","prevBaseLine","Animate","_ref","prevPointsDiffFactor","stepPoints","index","prevPointIndex","prev","interpolatorX","interpolateNumber","interpolatorY","stepBaseLine","interpolator","isNil","isNan","_interpolator","_this$props6","_this$state2","totalLength","isEqual","_filterProps","_this$props7","hide","className","top","left","xAxis","yAxis","id","hasSinglePoint","layerClass","clsx","needClipX","needClipY","_ref2","_ref2$r","_ref2$strokeWidth","_ref3","hasClipDot","_ref3$clipDot","dotSize","LabelList","nextProps","prevState","PureComponent","Global","item","chartBaseValue","itemBaseValue","baseValue","numericAxis","domain","domainMax","domainMin","_ref4","xAxisTicks","yAxisTicks","bandSize","stackedData","dataStartIndex","displayedData","offset","hasStack","isHorizontalLayout","getValueByDataKey","isBreakPoint","getCateCoordinateOfLine","x","option","dotItem","rest","Dot","AreaChart","generateCategoricalChart","XAxis","YAxis","formatAxisMap"],"mappings":"iRAAA,IAAIA,GAAY,CAAC,SAAU,OAAQ,SAAU,eAAgB,UAAW,KAAK,EAC3EC,GAAa,CAAC,KAAK,EACjBC,GACJ,SAASC,EAAQC,EAAG,CAAE,0BAA2B,OAAOD,EAAwB,OAAO,QAArB,YAA2C,OAAO,OAAO,UAA1B,SAAqC,SAAUC,EAAG,CAAE,OAAO,OAAOA,CAAG,EAAI,SAAUA,EAAG,CAAE,OAAOA,GAAmB,OAAO,QAArB,YAA+BA,EAAE,cAAgB,QAAUA,IAAM,OAAO,UAAY,SAAW,OAAOA,CAAG,EAAGD,EAAQC,CAAC,CAAG,CAC7T,SAASC,GAAyBC,EAAQC,EAAU,CAAE,GAAID,GAAU,KAAM,MAAO,CAAA,EAAI,IAAIE,EAASC,GAA8BH,EAAQC,CAAQ,EAAOG,EAAKC,EAAG,GAAI,OAAO,sBAAuB,CAAE,IAAIC,EAAmB,OAAO,sBAAsBN,CAAM,EAAG,IAAKK,EAAI,EAAGA,EAAIC,EAAiB,OAAQD,IAAOD,EAAME,EAAiBD,CAAC,EAAO,EAAAJ,EAAS,QAAQG,CAAG,GAAK,IAAkB,OAAO,UAAU,qBAAqB,KAAKJ,EAAQI,CAAG,IAAaF,EAAOE,CAAG,EAAIJ,EAAOI,CAAG,EAAK,CAAE,OAAOF,C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,CAAS,EAAIvB,EAAM,MAAMuB,CAAS,EAEzExI,EAAc,CACnB,OAAQ6C,EACR,SAAUa,EACV,OAAQa,EACR,QAASK,CACb,EAAKwE,CAAM,CACX,CAAC,EACDnJ,EAAgB2B,EAAM,gBAAiB,SAAU+H,EAAQrJ,EAAO,CAC9D,IAAIsJ,EACJ,GAAkBtG,EAAM,eAAeqG,CAAM,EAC3CC,EAAuBtG,EAAM,aAAaqG,EAAQrJ,CAAK,UAC9C8B,EAAWuH,CAAM,EAC1BC,EAAUD,EAAOrJ,CAAK,MACjB,CACL,IAAIwG,EAAYQ,GAAK,oBAAqB,OAAOqC,GAAW,UAAYA,EAAO,UAAY,EAAE,EACzFlK,EAAMa,EAAM,IACduJ,EAAOzK,GAAyBkB,EAAOtB,EAAU,EACnD4K,EAAuBtG,EAAM,cAAcwG,GAAKlK,EAAS,CAAA,EAAIiK,EAAM,CACjE,IAAKpK,EACL,UAAWqH,CACjB,CAAK,CAAC,CACJ,CACA,OAAO8C,CACT,CAAC,ECthBS,IAACG,GAAYC,GAAyB,CAC9C,UAAW,YACX,eAAgBpI,EAChB,eAAgB,CAAC,CACf,SAAU,QACV,SAAUqI,EACd,EAAK,CACD,SAAU,QACV,SAAUC,EACd,CAAG,EACD,cAAeC,EACjB,CAAC","x_google_ignoreList":[0,1]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{g as a,L as e,X as i,Y as s,f as x,B as t}from"./generateCategoricalChart-BwzyqytT.js";var p=a({chartName:"LineChart",GraphicalChild:e,axisComponents:[{axisType:"xAxis",AxisComp:i},{axisType:"yAxis",AxisComp:s}],formatAxisMap:x}),o=a({chartName:"BarChart",GraphicalChild:t,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:i},{axisType:"yAxis",AxisComp:s}],formatAxisMap:x});export{o as B,p as L};
|
|
2
|
+
//# sourceMappingURL=BarChart-DOfc8me9.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BarChart-DOfc8me9.js","sources":["../../node_modules/recharts/es6/chart/LineChart.js","../../node_modules/recharts/es6/chart/BarChart.js"],"sourcesContent":["/**\n * @fileOverview Line Chart\n */\nimport { generateCategoricalChart } from './generateCategoricalChart';\nimport { Line } from '../cartesian/Line';\nimport { XAxis } from '../cartesian/XAxis';\nimport { YAxis } from '../cartesian/YAxis';\nimport { formatAxisMap } from '../util/CartesianUtils';\nexport var LineChart = generateCategoricalChart({\n chartName: 'LineChart',\n GraphicalChild: Line,\n axisComponents: [{\n axisType: 'xAxis',\n AxisComp: XAxis\n }, {\n axisType: 'yAxis',\n AxisComp: YAxis\n }],\n formatAxisMap: formatAxisMap\n});","/**\n * @fileOverview Bar Chart\n */\nimport { generateCategoricalChart } from './generateCategoricalChart';\nimport { Bar } from '../cartesian/Bar';\nimport { XAxis } from '../cartesian/XAxis';\nimport { YAxis } from '../cartesian/YAxis';\nimport { formatAxisMap } from '../util/CartesianUtils';\nexport var BarChart = generateCategoricalChart({\n chartName: 'BarChart',\n GraphicalChild: Bar,\n defaultTooltipEventType: 'axis',\n validateTooltipEventTypes: ['axis', 'item'],\n axisComponents: [{\n axisType: 'xAxis',\n AxisComp: XAxis\n }, {\n axisType: 'yAxis',\n AxisComp: YAxis\n }],\n formatAxisMap: formatAxisMap\n});"],"names":["LineChart","generateCategoricalChart","Line","XAxis","YAxis","formatAxisMap","BarChart","Bar"],"mappings":"8FAQU,IAACA,EAAYC,EAAyB,CAC9C,UAAW,YACX,eAAgBC,EAChB,eAAgB,CAAC,CACf,SAAU,QACV,SAAUC,CACd,EAAK,CACD,SAAU,QACV,SAAUC,CACd,CAAG,EACD,cAAeC,CACjB,CAAC,ECXUC,EAAWL,EAAyB,CAC7C,UAAW,WACX,eAAgBM,EAChB,wBAAyB,OACzB,0BAA2B,CAAC,OAAQ,MAAM,EAC1C,eAAgB,CAAC,CACf,SAAU,QACV,SAAUJ,CACd,EAAK,CACD,SAAU,QACV,SAAUC,CACd,CAAG,EACD,cAAeC,CACjB,CAAC","x_google_ignoreList":[0,1]}
|
package/extensions/dashboard-client/dist/assets/{CacheTab-CDyZqMO-.js → CacheTab-EhqkEglo.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as e,r as h,u as j,
|
|
2
|
-
//# sourceMappingURL=CacheTab-
|
|
1
|
+
import{j as e,r as h,u as j,x as L,y as $,w as H,l as M}from"./index-pmtEr3sb.js";import{C as I,T as k}from"./TimeSavedCard-ic_LjJ79.js";import{b as m,c as u,d as w,e as W,f as d}from"./format-COjDIVGj.js";import{l as _}from"./pricing-DkYp8-vi.js";import{C as g,a as f,b as C,c as S}from"./card-BFYc_QrK.js";import{B as D}from"./button-BdAtIbVu.js";function R(a){return a>=80?"ov-stat-value-green":a>=50?"ov-stat-value-yellow":"ov-stat-value-red"}function F(a){return a==null?"":a>=0?"ov-stat-value-green":"ov-stat-value-red"}function r({label:a,value:s,className:t,title:l}){return e.jsxs("div",{className:"flex items-baseline justify-between border-b border-border py-1 text-sm",children:[e.jsx("span",{className:"text-xs text-muted-foreground",title:l,children:a}),e.jsx("span",{className:`font-semibold${t?` ${t}`:""}`,children:s})]})}function O(a){return e.jsxs(g,{className:"electric-hover",children:[e.jsx(f,{children:e.jsx(C,{children:"Provider Prompt Cache"})}),e.jsxs(S,{children:[e.jsx(r,{label:"Cache Hit Rate",value:`${a.hitPct.toFixed(1)}%`,className:R(a.hitPct)}),e.jsx(r,{label:"Turns Recorded",value:String(a.turnCount)}),e.jsx(r,{label:"Cache Read Tokens",value:m(a.totalCacheRead)}),e.jsx(r,{label:"Cache Write Tokens",value:m(a.totalCacheWrite)}),e.jsx(r,{label:"Input Tokens",value:m(a.totalInput)}),e.jsx(r,{label:"$ Saved (reads)",value:u(a.cacheReadSaved)}),e.jsx(r,{label:"Write Investment",value:u(a.cacheWriteCost)}),e.jsx(r,{label:"Net Saved",value:u(a.netSaved),className:F(a.netSaved)}),e.jsx(r,{label:"Model",value:a.modelLabel??"—"}),e.jsx(r,{label:"Tracked Since",value:w(a.firstTurnAt)}),e.jsx(r,{label:"Last Updated",value:W(a.latestTurnAt)}),a.byModel.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-2 text-xs font-semibold text-muted-foreground",children:"Per Model"}),a.byModel.map(s=>{const t=_(s.model),l=t!=null?s.totalCacheRead/1e6*t:null,n=t!=null?s.totalCacheWrite/1e6*t:null;return e.jsxs("div",{className:"mt-2",children:[e.jsx(r,{label:"Model",value:s.model}),e.jsx(r,{label:"Hit Rate",value:`${s.hitPct.toFixed(1)}%`,className:R(s.hitPct)}),e.jsx(r,{label:"Cache Read",value:m(s.totalCacheRead)}),e.jsx(r,{label:"Cache Write",value:m(s.totalCacheWrite)}),e.jsx(r,{label:"Samples",value:String(s.sampleCount)}),e.jsx(r,{label:"$ Saved (reads)",value:l!=null?u(l):"—"}),e.jsx(r,{label:"Write Investment",value:n!=null?u(n):"—"})]},s.model)})]})]})]})}const G=["ov-bar-green","ov-bar-blue","ov-bar-teal","ov-bar-yellow","ov-bar-gray"],B=["Permanent","Epoch","Topic","Thread","Volatile"],K={good:"ov-text-green",fair:"ov-text-yellow",degraded:"ov-text-orange",poor:"ov-text-red"};function U({data:a}){const s=Math.max(...a.buckets.map(l=>l.count),1),t=K[a.health.label]??"ov-text-gray";return e.jsxs("div",{className:"ov-card",children:[e.jsx("h3",{className:"ov-card-title",children:"Cache Stripe Distribution"}),e.jsxs("div",{className:"ov-stripe-health-summary",children:[e.jsx("span",{className:`ov-stripe-health-badge ${t}`,children:a.health.label}),e.jsx("span",{className:"ov-stripe-health-score",children:d(a.health.score)}),e.jsxs("span",{className:"ov-stripe-churn",children:["Churn: ",d(a.health.churnRate)]}),e.jsxs("span",{className:"ov-stripe-total",children:[a.totalChunks," total chunks"]})]}),e.jsx("div",{className:"ov-stripe-bars",children:a.buckets.map(l=>{const n=s>0?Math.max(0,Math.min(100,l.count/s*100)):0,o=G[l.stripe]??"ov-bar-gray",c=l.label||(B[l.stripe]??`Stripe ${l.stripe}`);return e.jsxs("div",{className:"ov-stripe-row",children:[e.jsx("span",{className:"ov-stripe-label",title:c,children:c}),e.jsx("div",{className:"ov-bar-track",children:e.jsx("div",{className:`ov-bar-fill ${o}`,style:{width:`${n}%`}})}),e.jsx("span",{className:"ov-stripe-count",children:l.count}),e.jsx("span",{className:"ov-stripe-stability",title:`min ${d(l.minStability)} / max ${d(l.maxStability)}`,children:d(l.avgStability)})]},l.stripe)})}),e.jsxs("div",{className:"ov-stripe-footer",children:["Epoch: ",a.epochId??"—","· Dominant tier: ",d(a.health.dominantTier)]})]})}function x(a){return`${a.toFixed(1)}%`}function V(a){return a>=80?"ov-bar-green":a>=60?"ov-bar-teal":a>=40?"ov-bar-yellow":a>=20?"ov-bar-orange":"ov-bar-red"}const q=({perf:a})=>{const{cache_hit_pct:s}=a,t=s.samples&&s.samples.length>0?s.samples:[];return e.jsxs(g,{className:"electric-hover",children:[e.jsx(f,{children:e.jsx(C,{children:"Cache Hit-Rate Trend"})}),e.jsxs(S,{children:[e.jsxs("div",{className:"mb-3 flex gap-4 text-sm text-muted-foreground",children:[e.jsxs("div",{children:["Avg: ",e.jsx("strong",{className:"text-foreground",children:x(s.avg)})]}),e.jsxs("div",{children:["Latest: ",e.jsx("strong",{className:"text-foreground",children:x(s.latest)})]}),e.jsxs("div",{children:["Samples: ",e.jsx("strong",{className:"text-foreground",children:s.n})]})]}),t.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"ov-sparkline",role:"img","aria-label":`Cache hit rate trend: ${s.n} samples, average ${x(s.avg)}, latest ${x(s.latest)}`,children:t.map((l,n)=>{const o=Math.max(2,Math.round(l.pct*.6)),c=V(l.pct),v=n===t.length-1;return e.jsx("div",{className:`ov-sparkline-bar ${c}${v?" ov-bar-latest":""}`,style:{height:`${o}px`},title:`${x(l.pct)} at ${new Date(l.ts).toLocaleTimeString()}`},n)})}),e.jsxs("div",{className:"mt-1 text-xs text-muted-foreground",children:[t.length," sample",t.length!==1?"s":""," over"," ",t.length>1?`${Math.round((t[t.length-1].ts-t[0].ts)/1e3)}s`:"latest turn"]})]}):e.jsx("div",{className:"text-sm text-muted-foreground",children:"No cache-hit samples yet"})]})]})};function ee(){const[a,s]=h.useState(!1),{data:t,loading:l,error:n}=j(h.useCallback(()=>L(),[]),{pollInterval:5e3}),{data:o,loading:c,error:v}=j(h.useCallback(()=>$(),[]),{pollInterval:15e3}),{data:N,loading:A,error:T}=j(h.useCallback(()=>H({minutes:30}),[]),{pollInterval:15e3}),{data:i,loading:E,error:y}=j(h.useCallback(()=>M(),[]),{pollInterval:5e3});return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{children:[e.jsx(D,{type:"button",variant:"outline",onClick:()=>s(!a),children:a?"Hide Guidance":"Show Cache-Friendly Prompt Ordering Guidance"}),a&&e.jsxs(g,{className:"mt-3",children:[e.jsx(f,{children:e.jsx(C,{children:"Cache-Friendly Prompt Ordering"})}),e.jsxs(S,{children:[e.jsxs("ul",{className:"list-disc space-y-1 pl-5",children:[e.jsx("li",{children:"Keep system prompts and stable context at the top of your conversation — the provider caches the leading prefix."}),e.jsxs("li",{children:["Tool results and volatile content are automatically moved to the tail by message separation (",e.jsx("code",{children:"MEGACOMPACT_MESSAGE_SEPARATION"}),") so they don't invalidate the cache prefix."]}),e.jsxs("li",{children:["Cache striping (",e.jsx("code",{children:"MEGACOMPACT_CACHE_STRIPING"}),") further orders stable context by a stability score so the most durable chunks lead."]}),e.jsx("li",{children:"Avoid inserting new instructions mid-conversation — prepend them instead."})]}),i&&e.jsxs("div",{className:"mt-2 text-sm",children:[e.jsx("strong",{children:"Status:"})," ",i.config.auto?"Auto-compaction Enabled":"Auto-compaction Disabled"," |"," ","fast-gate ",i.config.fastGatePct,"% / threshold"," ",i.config.thresholdTokens.toLocaleString()," tokens"]})]})]})]}),e.jsx("h2",{className:"font-heading text-lg font-semibold",children:"Provider Prompt Cache"}),l?e.jsx("p",{className:"tab-stub",children:"Loading..."}):n?e.jsxs("p",{className:"tab-stub",children:["Provider cache unavailable: ",n.message]}):t?e.jsx(O,{hitPct:t.cache.avgHitPct,turnCount:t.cache.turnCount,totalCacheRead:t.cache.totalCacheRead,totalCacheWrite:t.cache.totalCacheWrite,totalInput:t.cache.totalInput,cacheReadSaved:t.savings?.cacheReadSaved??null,cacheWriteCost:t.savings?.cacheWriteCost??null,netSaved:t.savings?.netSaved??null,modelLabel:t.savings?.model??null,firstTurnAt:t.cache.firstTurnAt,latestTurnAt:t.cache.latestTurnAt,byModel:t.cache.byModel??[]}):null,e.jsx("h2",{className:"font-heading text-lg font-semibold",children:"Cache Stripe Distribution"}),c?e.jsx("p",{className:"tab-stub",children:"Loading..."}):v?e.jsxs("p",{className:"tab-stub",children:["Cache stripe data unavailable: ",v.message]}):o?e.jsx(U,{data:o}):null,e.jsx("h2",{className:"font-heading text-lg font-semibold",children:"Cache Hit-Rate Trend"}),A?e.jsx("p",{className:"tab-stub",children:"Loading..."}):T?e.jsxs("p",{className:"tab-stub",children:["Hit-rate trend unavailable: ",T.message]}):N?e.jsx(q,{perf:N}):null,e.jsx("h2",{className:"font-heading text-lg font-semibold",children:"Mega-Compact Dedup Cache"}),E?e.jsx("p",{className:"tab-stub",children:"Loading..."}):y?e.jsxs("p",{className:"tab-stub",children:["Snapshot unavailable: ",y.message]}):i&&(()=>{const{cacheHits:p,compacts:P,timeSaved:b}=i;return e.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:[e.jsx(I,{cacheHitsSession:p.session,cacheHitsTotal:p.total,tokensSavedSession:p.sessionTokensSaved,tokensSavedTotal:p.totalTokensSaved,compactionsSession:P.session,compactionsTotal:P.total}),e.jsx(k,{compactSessionSec:b.compact.sessionSec,compactTotalSec:b.compact.totalSec,cacheHitSessionSec:b.cacheHit.sessionSec,cacheHitTotalSec:b.cacheHit.totalSec})]})})()]})}export{ee as default};
|
|
2
|
+
//# sourceMappingURL=CacheTab-EhqkEglo.js.map
|