pi-mega-compact 0.20.39 → 0.20.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/config/vector-cortex-ml5d.js +28 -0
  2. package/dist/config/vector-cortex.js +2 -2
  3. package/dist/config.js +1 -1
  4. package/dist/extensions/dashboard-server/api-contracts/cortex-improve.js +14 -0
  5. package/dist/extensions/dashboard-server/api-contracts/endpoints/registry-ext.js +13 -0
  6. package/dist/extensions/dashboard-server/route-dispatch.js +5 -1
  7. package/dist/extensions/dashboard-server/routes-cortex-improve.js +220 -0
  8. package/dist/extensions/dashboard-server/routes-rag-settings-vector-cortex.js +1 -0
  9. package/dist/extensions/dashboard-server/routes.js +1 -0
  10. package/dist/extensions/mega-runtime/dashboard-snapshot.js +2 -2
  11. package/dist/src/config/vector-cortex-ml5d.js +28 -0
  12. package/dist/src/config/vector-cortex.js +2 -2
  13. package/dist/src/config.js +1 -1
  14. package/dist/src/vector-cortex/improve.js +24 -0
  15. package/dist/vector-cortex/improve.js +24 -0
  16. package/extensions/dashboard-client/dist/assets/{AreaChart-DjXp8u2Y.js → AreaChart-BT7YPcp7.js} +2 -2
  17. package/extensions/dashboard-client/dist/assets/{AreaChart-DjXp8u2Y.js.map → AreaChart-BT7YPcp7.js.map} +1 -1
  18. package/extensions/dashboard-client/dist/assets/{BarChart-BZbus-dR.js → BarChart-DceGcBUh.js} +2 -2
  19. package/extensions/dashboard-client/dist/assets/{BarChart-BZbus-dR.js.map → BarChart-DceGcBUh.js.map} +1 -1
  20. package/extensions/dashboard-client/dist/assets/{CacheTab-DQ2CjxVW.js → CacheTab-B9lCouRl.js} +2 -2
  21. package/extensions/dashboard-client/dist/assets/{CacheTab-DQ2CjxVW.js.map → CacheTab-B9lCouRl.js.map} +1 -1
  22. package/extensions/dashboard-client/dist/assets/{EventsTab-DUpnOV1p.js → EventsTab-oqJ11jY7.js} +2 -2
  23. package/extensions/dashboard-client/dist/assets/{EventsTab-DUpnOV1p.js.map → EventsTab-oqJ11jY7.js.map} +1 -1
  24. package/extensions/dashboard-client/dist/assets/{HealthTab-Bul_xjcn.js → HealthTab-Dbosf2Ik.js} +2 -2
  25. package/extensions/dashboard-client/dist/assets/{HealthTab-Bul_xjcn.js.map → HealthTab-Dbosf2Ik.js.map} +1 -1
  26. package/extensions/dashboard-client/dist/assets/{MaintenanceTab-DLUjdKd3.js → MaintenanceTab-6TiApCVE.js} +2 -2
  27. package/extensions/dashboard-client/dist/assets/{MaintenanceTab-DLUjdKd3.js.map → MaintenanceTab-6TiApCVE.js.map} +1 -1
  28. package/extensions/dashboard-client/dist/assets/MemoryMapTab-cBsE4mTf.js +2 -0
  29. package/extensions/dashboard-client/dist/assets/{MemoryMapTab-BFy0hb6F.js.map → MemoryMapTab-cBsE4mTf.js.map} +1 -1
  30. package/extensions/dashboard-client/dist/assets/{MetricsTab-BpYuUkq3.js → MetricsTab-CX-X9hhy.js} +2 -2
  31. package/extensions/dashboard-client/dist/assets/{MetricsTab-BpYuUkq3.js.map → MetricsTab-CX-X9hhy.js.map} +1 -1
  32. package/extensions/dashboard-client/dist/assets/{OverviewTab-z7yuT-uq.js → OverviewTab-CpPYaTJF.js} +2 -2
  33. package/extensions/dashboard-client/dist/assets/{OverviewTab-z7yuT-uq.js.map → OverviewTab-CpPYaTJF.js.map} +1 -1
  34. package/extensions/dashboard-client/dist/assets/{ReposTab-ClORoDy_.js → ReposTab-D_Ot4QbU.js} +2 -2
  35. package/extensions/dashboard-client/dist/assets/{ReposTab-ClORoDy_.js.map → ReposTab-D_Ot4QbU.js.map} +1 -1
  36. package/extensions/dashboard-client/dist/assets/{SessionsTab-CUpehIt9.js → SessionsTab-BUzO3iGK.js} +2 -2
  37. package/extensions/dashboard-client/dist/assets/{SessionsTab-CUpehIt9.js.map → SessionsTab-BUzO3iGK.js.map} +1 -1
  38. package/extensions/dashboard-client/dist/assets/{SetupTab-Cii80Fdz.js → SetupTab-Be4w9v4j.js} +2 -2
  39. package/extensions/dashboard-client/dist/assets/{SetupTab-Cii80Fdz.js.map → SetupTab-Be4w9v4j.js.map} +1 -1
  40. package/extensions/dashboard-client/dist/assets/{TimeSavedCard-BV2iCSdV.js → TimeSavedCard-Cx-g6CXH.js} +2 -2
  41. package/extensions/dashboard-client/dist/assets/{TimeSavedCard-BV2iCSdV.js.map → TimeSavedCard-Cx-g6CXH.js.map} +1 -1
  42. package/extensions/dashboard-client/dist/assets/{TurnsTab-1T86rHnD.js → TurnsTab-CC_7T7ad.js} +3 -3
  43. package/extensions/dashboard-client/dist/assets/{TurnsTab-1T86rHnD.js.map → TurnsTab-CC_7T7ad.js.map} +1 -1
  44. package/extensions/dashboard-client/dist/assets/{VcStatusBadge-DKPleja8.js → VcStatusBadge-ZTItXSiH.js} +2 -2
  45. package/extensions/dashboard-client/dist/assets/{VcStatusBadge-DKPleja8.js.map → VcStatusBadge-ZTItXSiH.js.map} +1 -1
  46. package/extensions/dashboard-client/dist/assets/VectorCortexTab-DgAUZ4Pg.js +2 -0
  47. package/extensions/dashboard-client/dist/assets/VectorCortexTab-DgAUZ4Pg.js.map +1 -0
  48. package/extensions/dashboard-client/dist/assets/WikiTab-DnKupXTv.js +2 -0
  49. package/extensions/dashboard-client/dist/assets/{WikiTab-DKTILa1M.js.map → WikiTab-DnKupXTv.js.map} +1 -1
  50. package/extensions/dashboard-client/dist/assets/button-CFt3e0yc.js +2 -0
  51. package/extensions/dashboard-client/dist/assets/{button-5fSU8BZj.js.map → button-CFt3e0yc.js.map} +1 -1
  52. package/extensions/dashboard-client/dist/assets/{card-BFUnpXE_.js → card-C6ZjsHrl.js} +2 -2
  53. package/extensions/dashboard-client/dist/assets/{card-BFUnpXE_.js.map → card-C6ZjsHrl.js.map} +1 -1
  54. package/extensions/dashboard-client/dist/assets/client-extra-DdEdGTIe.js +2 -0
  55. package/extensions/dashboard-client/dist/assets/client-extra-DdEdGTIe.js.map +1 -0
  56. package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-xCzi6pWn.js → generateCategoricalChart-C9_fu2hc.js} +2 -2
  57. package/extensions/dashboard-client/dist/assets/{generateCategoricalChart-xCzi6pWn.js.map → generateCategoricalChart-C9_fu2hc.js.map} +1 -1
  58. package/extensions/dashboard-client/dist/assets/{index-DqjmZ88m.js → index-DY81TY4f.js} +11 -11
  59. package/extensions/dashboard-client/dist/assets/index-DY81TY4f.js.map +1 -0
  60. package/extensions/dashboard-client/dist/assets/{switch-CeZUPf_e.js → switch-BOqa1d6x.js} +2 -2
  61. package/extensions/dashboard-client/dist/assets/{switch-CeZUPf_e.js.map → switch-BOqa1d6x.js.map} +1 -1
  62. package/extensions/dashboard-client/dist/assets/{toggle-MQQwdkwD.js → toggle-DToFaIEd.js} +2 -2
  63. package/extensions/dashboard-client/dist/assets/{toggle-MQQwdkwD.js.map → toggle-DToFaIEd.js.map} +1 -1
  64. package/extensions/dashboard-client/dist/assets/{useSSE-BetS7QHN.js → useSSE-CZqkhU18.js} +2 -2
  65. package/extensions/dashboard-client/dist/assets/{useSSE-BetS7QHN.js.map → useSSE-CZqkhU18.js.map} +1 -1
  66. package/extensions/dashboard-client/dist/index.html +1 -1
  67. package/extensions/dashboard-client/src/api/client-extra.ts +19 -1
  68. package/extensions/dashboard-client/src/components/ModelImprovementCard.tsx +141 -0
  69. package/extensions/dashboard-client/src/tabs/VectorCortexTab.tsx +6 -0
  70. package/extensions/dashboard-client/src/types/cortex-improve.ts +42 -0
  71. package/extensions/dashboard-server/api-contracts/cortex-improve.ts +82 -0
  72. package/extensions/dashboard-server/api-contracts/endpoints/registry-ext.ts +31 -0
  73. package/extensions/dashboard-server/api-contracts/index.ts +12 -0
  74. package/extensions/dashboard-server/route-dispatch.ts +4 -0
  75. package/extensions/dashboard-server/routes-cortex-improve.ts +256 -0
  76. package/extensions/dashboard-server/routes-rag-settings-vector-cortex.ts +6 -0
  77. package/extensions/dashboard-server/routes.ts +4 -0
  78. package/extensions/mega-runtime/dashboard-snapshot.ts +2 -2
  79. package/package.json +1 -1
  80. package/src/config/vector-cortex-ml5d.ts +30 -0
  81. package/src/config/vector-cortex.ts +2 -2
  82. package/src/config.ts +1 -0
  83. package/src/vector-cortex/improve.ts +28 -0
  84. package/extensions/dashboard-client/dist/assets/MemoryMapTab-BFy0hb6F.js +0 -2
  85. package/extensions/dashboard-client/dist/assets/VectorCortexTab-BRzvd_pU.js +0 -2
  86. package/extensions/dashboard-client/dist/assets/VectorCortexTab-BRzvd_pU.js.map +0 -1
  87. package/extensions/dashboard-client/dist/assets/WikiTab-DKTILa1M.js +0 -2
  88. package/extensions/dashboard-client/dist/assets/button-5fSU8BZj.js +0 -2
  89. package/extensions/dashboard-client/dist/assets/client-extra-BZbw21wu.js +0 -2
  90. package/extensions/dashboard-client/dist/assets/client-extra-BZbw21wu.js.map +0 -1
  91. package/extensions/dashboard-client/dist/assets/index-DqjmZ88m.js.map +0 -1
@@ -0,0 +1,28 @@
1
+ /**
2
+ * config/vector-cortex-ml5d.ts — ML5-D dashboard "Improve Cortex" flag.
3
+ *
4
+ * Sibling extract mirroring vector-cortex-ml5a.ts / vector-cortex-ml5b.ts /
5
+ * vector-cortex-ml5c.ts, so vector-cortex.ts stays under its 300-line soft
6
+ * limit (soft-as-hard gate). This is the dashboard "Improve Cortex" surface +
7
+ * promote workflow sprint flag.
8
+ * vector-cortex.ts re-exports the ENUM below and root src/config.ts re-exports
9
+ * it, so no consumer import path changes.
10
+ *
11
+ * ML5-D adds the dashboard ModelImprovementCard + the POST /api/cortex/improve
12
+ * and GET /api/cortex/improve/status/:jobId endpoints. The flag gates that
13
+ * surface only; when OFF the endpoints return 404/disabled and VectorCortexTab
14
+ * renders exactly as before (byte-identical to the ML5-C-era tab — no
15
+ * ModelImprovementCard, no improve job is ever spawned).
16
+ *
17
+ * Pi-agnostic, dependency-free (PREVENT-PI-004 / PREVENT-011).
18
+ */
19
+ import { sprintFlag } from "./vector-cortex-flag.js";
20
+ /**
21
+ * ML5-D — dashboard "Improve Cortex" surface + promote workflow. Default ON.
22
+ * `MEGACOMPACT_ML5_D=0` disables and is byte-identical to the ML5-C survivor:
23
+ * both `/api/cortex/improve*` endpoints return 404 and VectorCortexTab omits the
24
+ * ModelImprovementCard. The flag gates the dashboard surface only; it does not
25
+ * gate the underlying ML5-A training pipeline or the encoder's mode-A/B/C
26
+ * selection (those are governed by ML5-A and the encoder independently).
27
+ */
28
+ export const ML5D_ENABLED = () => sprintFlag("MEGACOMPACT_ML5_D");
@@ -239,8 +239,7 @@ export const VC8A_ENABLED = () => sprintFlag("MEGACOMPACT_VC8A");
239
239
  * mirroring VC4A..VC8A.
240
240
  */
241
241
  export const VC8B_ENABLED = () => sprintFlag("MEGACOMPACT_VC8B");
242
- // VC8C (canary selection + Rust parity) extracted to vector-cortex-vc8c.ts;
243
- // re-exported so existing `./config/vector-cortex.js` imports keep resolving.
242
+ // VC8C (canary selection + Rust parity) extracted to vector-cortex-vc8c.ts; re-exported so existing imports keep resolving.
244
243
  export { VC8C_ENABLED } from "./vector-cortex-vc8c.js";
245
244
  // Sibling extracts to stay under the 300-line soft limit.
246
245
  export { VC9A_ENABLED } from "./vector-cortex-vc9a.js";
@@ -251,5 +250,6 @@ export { PCC_ENABLED } from "./vector-cortex-pcc.js";
251
250
  export { ML5A_ENABLED } from "./vector-cortex-ml5a.js";
252
251
  export { ML5B_ENABLED } from "./vector-cortex-ml5b.js";
253
252
  export { ML5C_ENABLED } from "./vector-cortex-ml5c.js";
253
+ export { ML5D_ENABLED } from "./vector-cortex-ml5d.js";
254
254
  // Breaker constants (TRIAD_RESILIENCE.md §breaker) extracted to vector-cortex-breakers.ts.
255
255
  export { BREAKER_WINDOW_MS, BREAKER_MIN_ATTEMPTS, BREAKER_PERF_FAILURES, BREAKER_PERF_FAILURE_RATE, BREAKER_CORRECTNESS_FAILURES, BREAKER_COOLDOWN_MS, BREAKER_PROBE_COUNT, BREAKER_RETRY_BASE_MS, BREAKER_RETRY_CAP_MS, BREAKER_RETRY_JITTER, BREAKER_HYSTERESIS_FAILURE_RATE, BREAKER_HYSTERESIS_BUDGET_P95_MS, BREAKER_MIN_HEALTHY_RESIDENCE_MS, } from "./vector-cortex-breakers.js";
package/dist/config.js CHANGED
@@ -114,4 +114,4 @@ export const NEW_UI = () => ragEnabled("MEGACOMPACT_NEW_UI");
114
114
  // default ON, `=0`/`_DISABLED` off. Re-exported from src/config/vector-cortex.ts
115
115
  // so root consumers share one source of truth.
116
116
  // ---------------------------------------------------------------------------
117
- export { VC0A_ENABLED, VC0B_ENABLED, VC1A_ENABLED, VC0C_ENABLED, VC1B_ENABLED, VC1C_ENABLED, VC2A_ENABLED, VC2B_ENABLED, VC2C_ENABLED, VC3A_ENABLED, VC3B_ENABLED, VC3C_ENABLED, VC4A_ENABLED, VC4B_ENABLED, VC4C_ENABLED, VC5A_ENABLED, VC5B_ENABLED, VC5C_ENABLED, VC6A_ENABLED, VC6B_ENABLED, VC6C_ENABLED, VC7A_ENABLED, VC7B_ENABLED, VC7C_ENABLED, VC8A_ENABLED, VC8B_ENABLED, VC8C_ENABLED, VC9A_ENABLED, VC9B_ENABLED, VC9C_ENABLED, VC9D_ENABLED, PCC_ENABLED, ML5A_ENABLED, ML5B_ENABLED, ML5C_ENABLED, BREAKER_WINDOW_MS, BREAKER_MIN_ATTEMPTS, BREAKER_PERF_FAILURES, BREAKER_PERF_FAILURE_RATE, BREAKER_CORRECTNESS_FAILURES, BREAKER_COOLDOWN_MS, BREAKER_PROBE_COUNT, BREAKER_RETRY_BASE_MS, BREAKER_RETRY_CAP_MS, BREAKER_RETRY_JITTER, BREAKER_HYSTERESIS_FAILURE_RATE, BREAKER_HYSTERESIS_BUDGET_P95_MS, BREAKER_MIN_HEALTHY_RESIDENCE_MS, } from "./config/vector-cortex.js";
117
+ export { VC0A_ENABLED, VC0B_ENABLED, VC1A_ENABLED, VC0C_ENABLED, VC1B_ENABLED, VC1C_ENABLED, VC2A_ENABLED, VC2B_ENABLED, VC2C_ENABLED, VC3A_ENABLED, VC3B_ENABLED, VC3C_ENABLED, VC4A_ENABLED, VC4B_ENABLED, VC4C_ENABLED, VC5A_ENABLED, VC5B_ENABLED, VC5C_ENABLED, VC6A_ENABLED, VC6B_ENABLED, VC6C_ENABLED, VC7A_ENABLED, VC7B_ENABLED, VC7C_ENABLED, VC8A_ENABLED, VC8B_ENABLED, VC8C_ENABLED, VC9A_ENABLED, VC9B_ENABLED, VC9C_ENABLED, VC9D_ENABLED, PCC_ENABLED, ML5A_ENABLED, ML5B_ENABLED, ML5C_ENABLED, ML5D_ENABLED, BREAKER_WINDOW_MS, BREAKER_MIN_ATTEMPTS, BREAKER_PERF_FAILURES, BREAKER_PERF_FAILURE_RATE, BREAKER_CORRECTNESS_FAILURES, BREAKER_COOLDOWN_MS, BREAKER_PROBE_COUNT, BREAKER_RETRY_BASE_MS, BREAKER_RETRY_CAP_MS, BREAKER_RETRY_JITTER, BREAKER_HYSTERESIS_FAILURE_RATE, BREAKER_HYSTERESIS_BUDGET_P95_MS, BREAKER_MIN_HEALTHY_RESIDENCE_MS, } from "./config/vector-cortex.js";
@@ -0,0 +1,14 @@
1
+ /**
2
+ * api-contracts/cortex-improve.ts — ML5-D "Improve Cortex" job API types.
3
+ *
4
+ * Types for POST /api/cortex/improve (launch a local ML5-A training job that
5
+ * re-qualifies the five heads against the latest local corpus) and GET
6
+ * /api/cortex/improve/status/:jobId (poll the in-process job state to a
7
+ * terminal qualified / demoted_to_B verdict). Local-only, aggregate surfaces:
8
+ * mode / verdict / digest / reason / progress — never message content or corpus
9
+ * rows (EVAL-REDACT-002).
10
+ *
11
+ * PREVENT-PI-004: type definitions only, no network code.
12
+ * PREVENT-011: no `any` type — all types are explicit.
13
+ */
14
+ export {};
@@ -54,4 +54,17 @@ export const EXTRA_ENDPOINTS = {
54
54
  path: "/api/prefix-stability",
55
55
  description: "Per-turn prompt-cache stable-prefix ratio trend (GET /api/prefix-stability?limit=N) read from prefix_stability rows in the local events log. Flag-off (MEGACOMPACT_PC_C=0) returns 404.",
56
56
  },
57
+ // ─── ML5-D Improve Cortex (dashboard Vector Cortex tab) ───────────
58
+ /** POST /api/cortex/improve — launch a local ML5-A training job. */
59
+ improveCortex: {
60
+ method: "POST",
61
+ path: "/api/cortex/improve",
62
+ description: "Launch a local ML5-A training job that re-qualifies the five heads against the latest local corpus and returns an opaque jobId. Requires confirm:true; flag-off returns 404. Local-only — never fetches anything.",
63
+ },
64
+ /** GET /api/cortex/improve/status/:jobId — poll an improve job. */
65
+ improveCortexStatus: {
66
+ method: "GET",
67
+ path: "/api/cortex/improve/status/:jobId",
68
+ description: "Poll an in-process Cortex improve job to terminal qualified / demoted_to_B. Unknown jobId or flag-off returns 404. Read-only, in-memory job state.",
69
+ },
57
70
  };
@@ -8,7 +8,7 @@
8
8
  * PREVENT-PI-004: local filesystem read only, no network.
9
9
  * PREVENT-011: no `any` type.
10
10
  */
11
- import { handleIndex, handleRepoIndex, handleEvents, handleGameState, handleGameScores, handlePerfSamples, handlePerf, handleAchievements, handleSessions, handleTopics, handleTurns, handleMaintenance, handleProviderCache, handleMemoryStatus, handleCacheStripes, handlePrefixStability, handleSetupStatus, handleSetupDetect, handleSetupConfigure, handleMemoryMap, handleRaptorTree, handleRaptorBuildHistory, handleContextHealth, handleCachePoison, handleHealthSettings, handleEmbedderHealth, handleRagSettings, handleRagMetrics, handleModelThresholds, handleWiki, handleVectorCortexEvaluation, handleVectorCortexHealth, handleVectorCortexBreakersReset, handleVectorCortexLedger, handleVectorCortexTopology, handleVectorCortexQuery, handleVectorCortexShards, handleVectorCortexResidual, handleVectorCortexReconstruct, handleVectorCortexPlans, handleVectorCortexRender, handleVectorCortexRollout, handleVectorCortexClosureProof, handleVectorCortexRestore, handleSetupCortexStatus, handleSetupCortexAction, handleSetupCortexActionLog, } from "./routes.js";
11
+ import { handleIndex, handleRepoIndex, handleEvents, handleGameState, handleGameScores, handlePerfSamples, handlePerf, handleAchievements, handleSessions, handleTopics, handleTurns, handleMaintenance, handleProviderCache, handleMemoryStatus, handleCacheStripes, handlePrefixStability, handleSetupStatus, handleSetupDetect, handleSetupConfigure, handleMemoryMap, handleRaptorTree, handleRaptorBuildHistory, handleContextHealth, handleCachePoison, handleHealthSettings, handleEmbedderHealth, handleRagSettings, handleRagMetrics, handleModelThresholds, handleWiki, handleVectorCortexEvaluation, handleVectorCortexHealth, handleVectorCortexBreakersReset, handleVectorCortexLedger, handleVectorCortexTopology, handleVectorCortexQuery, handleVectorCortexShards, handleVectorCortexResidual, handleVectorCortexReconstruct, handleVectorCortexPlans, handleVectorCortexRender, handleVectorCortexRollout, handleVectorCortexClosureProof, handleVectorCortexRestore, handleSetupCortexStatus, handleSetupCortexAction, handleSetupCortexActionLog, handleImproveCortex, handleImproveCortexStatus, } from "./routes.js";
12
12
  // VC6C repair lives in its own module (routes-vector-cortex-repair.ts) so the
13
13
  // heal route file stays well under the 400-line extension soft limit.
14
14
  import { handleVectorCortexRepair } from "./routes-vector-cortex-repair.js";
@@ -149,5 +149,9 @@ export function dispatchRoutes(req, res, ctx) {
149
149
  return true;
150
150
  if (handleSetupCortexActionLog(req, res, ctx))
151
151
  return true;
152
+ if (handleImproveCortex(req, res, ctx))
153
+ return true;
154
+ if (handleImproveCortexStatus(req, res, ctx))
155
+ return true;
152
156
  return false;
153
157
  }
@@ -0,0 +1,220 @@
1
+ /**
2
+ * dashboard-server/routes-cortex-improve.ts — ML5-D "Improve Cortex" job routes.
3
+ *
4
+ * POST /api/cortex/improve — confirmation-gated local ML5-A training
5
+ * GET /api/cortex/improve/status/:jobId — poll an in-process job to terminal
6
+ *
7
+ * The Improve action launches the committed ML5-A training pipeline
8
+ * (training/vector-cortex/train.py) as a background child_process against the
9
+ * latest local corpus, then re-qualifies the five heads. Job state is kept
10
+ * in-process in a Map<jobId, JobState> on this module; nothing is persisted
11
+ * across restarts (the status endpoint is read-only, in-memory).
12
+ *
13
+ * LOCAL ONLY (PREVENT-PI-004): the job spawns a local python process and reads
14
+ * local files — never a fetch. The `onnxruntime-node` native path is attempted
15
+ * only when MEGACOMPACT_ENCODER_NATIVE=1 (default OFF); otherwise the harness
16
+ * uses the WASM/trigram fallback. The status payload surfaces mode/verdict/
17
+ * digest/reason/progress only — never message or corpus content (EVAL-REDACT-002).
18
+ *
19
+ * Guardrails: PREVENT-011 (no `any`), PREVENT-001 (guarded JSON.parse via
20
+ * readJsonBody), flag-off byte-identical (no card + endpoints 404).
21
+ */
22
+ import { spawn } from "node:child_process";
23
+ import { createHash, randomBytes } from "node:crypto";
24
+ import { readFileSync, existsSync } from "node:fs";
25
+ import { join, dirname } from "node:path";
26
+ import { fileURLToPath } from "node:url";
27
+ import { sendJson, readJsonBody } from "./routes-vector-cortex-shared.js";
28
+ import { ML5D_ENABLED } from "../../src/config.js";
29
+ import { qualifyDecision } from "../../src/vector-cortex/improve.js";
30
+ /** Resolve the committed training entry by walking up to the repo root. */
31
+ function trainingScript() {
32
+ let dir = dirname(fileURLToPath(import.meta.url));
33
+ const rel = join("training", "vector-cortex", "train.py");
34
+ for (let i = 0; i < 8; i++) {
35
+ // guardrails-allow PREVENT-PI-004: local script read (loopback)
36
+ const candidate = join(dir, rel);
37
+ if (existsSync(candidate))
38
+ return candidate;
39
+ const next = dirname(dir);
40
+ if (next === dir)
41
+ break;
42
+ dir = next;
43
+ }
44
+ return null;
45
+ }
46
+ /** In-process job registry; nothing survives a server restart. */
47
+ const JOBS = new Map();
48
+ /** Opaque job token: sha256(ts+random) hex-sliced. */
49
+ function newJobId() {
50
+ return createHash("sha256")
51
+ .update(`${Date.now()}:${randomBytes(16).toString("hex")}`)
52
+ .digest("hex")
53
+ .slice(0, 24);
54
+ }
55
+ /**
56
+ * Spawn the ML5-A training pipeline in the background and drive the job state
57
+ * to a terminal qualified / demoted_to_B verdict. Honest: an empty corpus (the
58
+ * host state) makes train.py no-op and the job ends demoted_to_B.
59
+ */
60
+ function startJob(jobId) {
61
+ const script = trainingScript();
62
+ const boot = Date.now();
63
+ JOBS.set(jobId, { status: "improving", progress: 0, updatedAt: new Date().toISOString() });
64
+ if (script === null) {
65
+ settle(jobId, { status: "demoted_to_B", reason: "ENC_TRAIN_PIPELINE_ABSENT", progress: 1 });
66
+ return;
67
+ }
68
+ const env = { ...process.env };
69
+ const proc = spawn("python3", [script], {
70
+ env,
71
+ cwd: join(dirname(script), "..", ".."),
72
+ stdio: ["ignore", "pipe", "pipe"],
73
+ });
74
+ let output = "";
75
+ const step = () => {
76
+ const pct = Math.min(0.9, 0.1 + ((Date.now() - boot) / 60000) * 0.6);
77
+ const cur = JOBS.get(jobId);
78
+ if (cur && cur.status === "improving" && pct > cur.progress) {
79
+ JOBS.set(jobId, { ...cur, progress: pct, updatedAt: new Date().toISOString() });
80
+ }
81
+ };
82
+ const timer = setInterval(step, 2000);
83
+ const stop = () => clearInterval(timer);
84
+ proc.stdout?.on("data", (d) => {
85
+ output += d.toString();
86
+ });
87
+ proc.stderr?.on("data", (d) => {
88
+ output += d.toString();
89
+ });
90
+ proc.on("error", (err) => {
91
+ stop();
92
+ settle(jobId, {
93
+ status: "demoted_to_B",
94
+ reason: `ENC_TRAIN_SPAWN_FAILED:${err.message}`,
95
+ progress: 1,
96
+ });
97
+ });
98
+ proc.on("close", (code) => {
99
+ stop();
100
+ // Read the produced trained-heads artifact digest. The report line includes
101
+ // `trainedHeadsPath`; verify the file exists after a successful run.
102
+ const match = /trainedHeadsPath":\s*"([^"]+)"/.exec(output);
103
+ const assetPath = match?.[1];
104
+ let digest = null;
105
+ if (assetPath) {
106
+ // guardrails-allow PREVENT-PI-004: local artifact read (loopback)
107
+ try {
108
+ digest = createHash("sha256")
109
+ .update(readFileSync(assetPath))
110
+ .digest("hex")
111
+ .slice(0, 12);
112
+ }
113
+ catch {
114
+ digest = null;
115
+ }
116
+ }
117
+ const decision = qualifyDecision(code ?? -1, digest);
118
+ if (decision === "qualified") {
119
+ settle(jobId, {
120
+ status: "qualified",
121
+ progress: 1,
122
+ assetDigest: digest ?? undefined,
123
+ verdict: { mode: "A", assetDigestPrefix: digest ?? null, verdict: "qualified" },
124
+ });
125
+ }
126
+ else {
127
+ settle(jobId, {
128
+ status: "demoted_to_B",
129
+ reason: assetPath
130
+ ? "trained asset did not verify — demoted to mode B"
131
+ : "empty corpus (no groups) — no qualified asset emitted",
132
+ progress: 1,
133
+ });
134
+ }
135
+ });
136
+ }
137
+ /** Write a terminal job state (idempotent — only advances from improving). */
138
+ function settle(jobId, terminal) {
139
+ const cur = JOBS.get(jobId);
140
+ if (cur && cur.status !== "improving")
141
+ return;
142
+ JOBS.set(jobId, { ...terminal, updatedAt: new Date().toISOString() });
143
+ }
144
+ /** Flag-off response, byte-identical regardless of request (ML5-D absent). */
145
+ function sendDisabled(res) {
146
+ sendJson(res, 404, { error: "disabled" });
147
+ }
148
+ /**
149
+ * POST /api/cortex/improve (ML5-D). Returns true when it claims the request.
150
+ * Requires `confirm:true` server-side (mirrors the client window.confirm).
151
+ */
152
+ export function handleImproveCortex(req, res, _ctx) {
153
+ const url = req.url ?? "";
154
+ if (url !== "/api/cortex/improve")
155
+ return false;
156
+ if (req.method !== "POST") {
157
+ sendJson(res, 405, { error: "method_not_allowed" });
158
+ return true;
159
+ }
160
+ if (!ML5D_ENABLED()) {
161
+ sendDisabled(res);
162
+ return true;
163
+ }
164
+ readJsonBody(req, (parsed) => {
165
+ if (!parsed.ok) {
166
+ sendJson(res, 400, { error: "invalid_body" });
167
+ return;
168
+ }
169
+ if (parsed.value.confirm !== true) {
170
+ sendJson(res, 400, { error: "confirmation_required" });
171
+ return;
172
+ }
173
+ const jobId = newJobId();
174
+ startJob(jobId);
175
+ const body = { status: "improving", jobId };
176
+ sendJson(res, 200, body);
177
+ });
178
+ return true;
179
+ }
180
+ /**
181
+ * GET /api/cortex/improve/status/:jobId (ML5-D). Returns true when it claims the
182
+ * request. Flag-off or unknown jobId → 404. Read-only in-memory.
183
+ */
184
+ export function handleImproveCortexStatus(req, res, _ctx) {
185
+ const url = req.url ?? "";
186
+ const match = /^\/api\/cortex\/improve\/status\/([A-Za-z0-9]+)$/.exec(url);
187
+ if (!match)
188
+ return false;
189
+ if (req.method !== "GET") {
190
+ sendJson(res, 405, { error: "method_not_allowed" });
191
+ return true;
192
+ }
193
+ if (!ML5D_ENABLED()) {
194
+ sendDisabled(res);
195
+ return true;
196
+ }
197
+ const job = JOBS.get(match[1]);
198
+ if (!job) {
199
+ sendJson(res, 404, { error: "job_not_found" });
200
+ return true;
201
+ }
202
+ // Narrow job.status into the discriminated CortexImproveStatus variant. The
203
+ // terminal shapes require their payload fields, so construct per-state.
204
+ const body = job.status === "improving"
205
+ ? { status: "improving", progress: job.progress }
206
+ : job.status === "qualified"
207
+ ? {
208
+ status: "qualified",
209
+ progress: job.progress,
210
+ verdict: job.verdict ?? { mode: "A", assetDigestPrefix: null, verdict: "qualified" },
211
+ assetDigest: job.assetDigest ?? "",
212
+ }
213
+ : {
214
+ status: "demoted_to_B",
215
+ progress: job.progress,
216
+ reason: job.reason ?? "UNKNOWN_TERMINAL",
217
+ };
218
+ sendJson(res, 200, body);
219
+ return true;
220
+ }
@@ -55,5 +55,6 @@ export const VECTOR_CORTEX_SETTINGS = {
55
55
  boolDirect("MEGACOMPACT_PC_C", "PC-C Dashboard Cache Visibility", "Dashboard per-turn prompt-cache visibility: surfaces the per-turn stable-prefix ratio trend (GET /api/prefix-stability) in the CacheTab PrefixStabilityCard. Reads aggregate ratios/counts from the local monitoring events log only — no payload bytes. OFF = byte-identical predecessor (PC-B-era): /api/prefix-stability returns 404 and the CacheTab omits the PrefixStabilityCard.", true),
56
56
  boolDirect("MEGACOMPACT_ML5_A", "ML5-A Five-Head Training Load", "ML5-A real trained-head loading: loadHeadProjections (trained-heads-v1) feeds selectQualifiedEncoder (trainedHeadsPath atomic demotion) + loadCalibrationV1. ON (default) = a pinned trained-heads path must load for mode A. OFF = loaders return null and selection ignores trainedHeadsPath — byte-identical to the placeholder-weighted VC2C path.", true),
57
57
  boolDirect("MEGACOMPACT_ML5_C", "ML5-C Runtime Decision + Packaging", "ML5-C runtime backend selection (WASM vs native): selects the ONNX runtime backend based on the ML5-B bench record and platform support. ON (default) = the runtime-selection dispatch runs and emits vector_cortex_runtime_selected. OFF = no selection runs — encoder serves mode B trigram, byte-identical to ML5-B.", true),
58
+ boolDirect("MEGACOMPACT_ML5_D", "ML5-D Dashboard Improve Cortex", "ML5-D dashboard 'Improve Cortex' surface: the ModelImprovementCard + POST /api/cortex/improve + GET /api/cortex/improve/status/:jobId. ON (default) = the card renders and Improve launches a local ML5-A training job. OFF = both improve endpoints return 404 and VectorCortexTab omits the card, byte-identical to ML5-C.", true),
58
59
  ],
59
60
  };
@@ -27,3 +27,4 @@ export { handleWiki } from "./routes-wiki.js";
27
27
  export { handleVectorCortexEvaluation, handleVectorCortexHealth, handleVectorCortexBreakersReset, handleVectorCortexLedger, handleVectorCortexTopology, handleVectorCortexQuery, handleVectorCortexShards, handleVectorCortexResidual, handleVectorCortexReconstruct, handleVectorCortexPlans, handleVectorCortexRender, handleVectorCortexRollout, handleVectorCortexClosureProof, handleVectorCortexRestore, } from "./routes-vector-cortex.js";
28
28
  export { handleSetupCortexStatus } from "./routes-setup-cortex.js";
29
29
  export { handleSetupCortexAction, handleSetupCortexActionLog, } from "./routes-setup-cortex-actions.js";
30
+ export { handleImproveCortex, handleImproveCortexStatus, } from "./routes-cortex-improve.js";
@@ -97,8 +97,8 @@ export function buildDashboardSnapshot(ctx) {
97
97
  // per-session in rt and there's no cumulative counter yet.
98
98
  total: ctx.repo.dedupCollapsed,
99
99
  sessionTokensSaved: ctx.rt.cacheHitTokens,
100
- // Cumulative tokens saved across all sessions in this repo
101
- // was a placeholder (dedupCollapsed * 100).
100
+ // Cumulative tokens saved across all sessions in this repo = the
101
+ // real repo counter (audit Table 1 stub 8 closed — no rolled-up math).
102
102
  totalTokensSaved: ctx.repo.tokensSaved,
103
103
  },
104
104
  compacts: {
@@ -0,0 +1,28 @@
1
+ /**
2
+ * config/vector-cortex-ml5d.ts — ML5-D dashboard "Improve Cortex" flag.
3
+ *
4
+ * Sibling extract mirroring vector-cortex-ml5a.ts / vector-cortex-ml5b.ts /
5
+ * vector-cortex-ml5c.ts, so vector-cortex.ts stays under its 300-line soft
6
+ * limit (soft-as-hard gate). This is the dashboard "Improve Cortex" surface +
7
+ * promote workflow sprint flag.
8
+ * vector-cortex.ts re-exports the ENUM below and root src/config.ts re-exports
9
+ * it, so no consumer import path changes.
10
+ *
11
+ * ML5-D adds the dashboard ModelImprovementCard + the POST /api/cortex/improve
12
+ * and GET /api/cortex/improve/status/:jobId endpoints. The flag gates that
13
+ * surface only; when OFF the endpoints return 404/disabled and VectorCortexTab
14
+ * renders exactly as before (byte-identical to the ML5-C-era tab — no
15
+ * ModelImprovementCard, no improve job is ever spawned).
16
+ *
17
+ * Pi-agnostic, dependency-free (PREVENT-PI-004 / PREVENT-011).
18
+ */
19
+ import { sprintFlag } from "./vector-cortex-flag.js";
20
+ /**
21
+ * ML5-D — dashboard "Improve Cortex" surface + promote workflow. Default ON.
22
+ * `MEGACOMPACT_ML5_D=0` disables and is byte-identical to the ML5-C survivor:
23
+ * both `/api/cortex/improve*` endpoints return 404 and VectorCortexTab omits the
24
+ * ModelImprovementCard. The flag gates the dashboard surface only; it does not
25
+ * gate the underlying ML5-A training pipeline or the encoder's mode-A/B/C
26
+ * selection (those are governed by ML5-A and the encoder independently).
27
+ */
28
+ export const ML5D_ENABLED = () => sprintFlag("MEGACOMPACT_ML5_D");
@@ -239,8 +239,7 @@ export const VC8A_ENABLED = () => sprintFlag("MEGACOMPACT_VC8A");
239
239
  * mirroring VC4A..VC8A.
240
240
  */
241
241
  export const VC8B_ENABLED = () => sprintFlag("MEGACOMPACT_VC8B");
242
- // VC8C (canary selection + Rust parity) extracted to vector-cortex-vc8c.ts;
243
- // re-exported so existing `./config/vector-cortex.js` imports keep resolving.
242
+ // VC8C (canary selection + Rust parity) extracted to vector-cortex-vc8c.ts; re-exported so existing imports keep resolving.
244
243
  export { VC8C_ENABLED } from "./vector-cortex-vc8c.js";
245
244
  // Sibling extracts to stay under the 300-line soft limit.
246
245
  export { VC9A_ENABLED } from "./vector-cortex-vc9a.js";
@@ -251,5 +250,6 @@ export { PCC_ENABLED } from "./vector-cortex-pcc.js";
251
250
  export { ML5A_ENABLED } from "./vector-cortex-ml5a.js";
252
251
  export { ML5B_ENABLED } from "./vector-cortex-ml5b.js";
253
252
  export { ML5C_ENABLED } from "./vector-cortex-ml5c.js";
253
+ export { ML5D_ENABLED } from "./vector-cortex-ml5d.js";
254
254
  // Breaker constants (TRIAD_RESILIENCE.md §breaker) extracted to vector-cortex-breakers.ts.
255
255
  export { BREAKER_WINDOW_MS, BREAKER_MIN_ATTEMPTS, BREAKER_PERF_FAILURES, BREAKER_PERF_FAILURE_RATE, BREAKER_CORRECTNESS_FAILURES, BREAKER_COOLDOWN_MS, BREAKER_PROBE_COUNT, BREAKER_RETRY_BASE_MS, BREAKER_RETRY_CAP_MS, BREAKER_RETRY_JITTER, BREAKER_HYSTERESIS_FAILURE_RATE, BREAKER_HYSTERESIS_BUDGET_P95_MS, BREAKER_MIN_HEALTHY_RESIDENCE_MS, } from "./vector-cortex-breakers.js";
@@ -114,4 +114,4 @@ export const NEW_UI = () => ragEnabled("MEGACOMPACT_NEW_UI");
114
114
  // default ON, `=0`/`_DISABLED` off. Re-exported from src/config/vector-cortex.ts
115
115
  // so root consumers share one source of truth.
116
116
  // ---------------------------------------------------------------------------
117
- export { VC0A_ENABLED, VC0B_ENABLED, VC1A_ENABLED, VC0C_ENABLED, VC1B_ENABLED, VC1C_ENABLED, VC2A_ENABLED, VC2B_ENABLED, VC2C_ENABLED, VC3A_ENABLED, VC3B_ENABLED, VC3C_ENABLED, VC4A_ENABLED, VC4B_ENABLED, VC4C_ENABLED, VC5A_ENABLED, VC5B_ENABLED, VC5C_ENABLED, VC6A_ENABLED, VC6B_ENABLED, VC6C_ENABLED, VC7A_ENABLED, VC7B_ENABLED, VC7C_ENABLED, VC8A_ENABLED, VC8B_ENABLED, VC8C_ENABLED, VC9A_ENABLED, VC9B_ENABLED, VC9C_ENABLED, VC9D_ENABLED, PCC_ENABLED, ML5A_ENABLED, ML5B_ENABLED, ML5C_ENABLED, BREAKER_WINDOW_MS, BREAKER_MIN_ATTEMPTS, BREAKER_PERF_FAILURES, BREAKER_PERF_FAILURE_RATE, BREAKER_CORRECTNESS_FAILURES, BREAKER_COOLDOWN_MS, BREAKER_PROBE_COUNT, BREAKER_RETRY_BASE_MS, BREAKER_RETRY_CAP_MS, BREAKER_RETRY_JITTER, BREAKER_HYSTERESIS_FAILURE_RATE, BREAKER_HYSTERESIS_BUDGET_P95_MS, BREAKER_MIN_HEALTHY_RESIDENCE_MS, } from "./config/vector-cortex.js";
117
+ export { VC0A_ENABLED, VC0B_ENABLED, VC1A_ENABLED, VC0C_ENABLED, VC1B_ENABLED, VC1C_ENABLED, VC2A_ENABLED, VC2B_ENABLED, VC2C_ENABLED, VC3A_ENABLED, VC3B_ENABLED, VC3C_ENABLED, VC4A_ENABLED, VC4B_ENABLED, VC4C_ENABLED, VC5A_ENABLED, VC5B_ENABLED, VC5C_ENABLED, VC6A_ENABLED, VC6B_ENABLED, VC6C_ENABLED, VC7A_ENABLED, VC7B_ENABLED, VC7C_ENABLED, VC8A_ENABLED, VC8B_ENABLED, VC8C_ENABLED, VC9A_ENABLED, VC9B_ENABLED, VC9C_ENABLED, VC9D_ENABLED, PCC_ENABLED, ML5A_ENABLED, ML5B_ENABLED, ML5C_ENABLED, ML5D_ENABLED, BREAKER_WINDOW_MS, BREAKER_MIN_ATTEMPTS, BREAKER_PERF_FAILURES, BREAKER_PERF_FAILURE_RATE, BREAKER_CORRECTNESS_FAILURES, BREAKER_COOLDOWN_MS, BREAKER_PROBE_COUNT, BREAKER_RETRY_BASE_MS, BREAKER_RETRY_CAP_MS, BREAKER_RETRY_JITTER, BREAKER_HYSTERESIS_FAILURE_RATE, BREAKER_HYSTERESIS_BUDGET_P95_MS, BREAKER_MIN_HEALTHY_RESIDENCE_MS, } from "./config/vector-cortex.js";
@@ -0,0 +1,24 @@
1
+ /**
2
+ * vector-cortex/improve.ts — ML5-D "Improve Cortex" pure decision rule.
3
+ *
4
+ * The single pure decision of the improve job harness: given the training
5
+ * process exit code and whether a readable produced-asset digest exists,
6
+ * decide whether the five heads qualify (promote) or are demoted to mode B.
7
+ *
8
+ * Lives under src/ so both the dashboard-server route (routes-cortex-improve.ts)
9
+ * and the ML5-D acceptance aggregator (dist/vector-cortex/ml5d-acceptance.test.js)
10
+ * can import it — the mirrored dist/vector-cortex/ subtree carries this file via
11
+ * the publish-acceptance copyTree, so the acceptance suite needs no real
12
+ * training run.
13
+ *
14
+ * Pure, total over its inputs, zero I/O (PREVENT-PI-004 / PREVENT-011).
15
+ */
16
+ /**
17
+ * Terminal decision for an improve job: qualified only when the training
18
+ * process exited 0 AND a readable produced-asset digest exists; otherwise the
19
+ * job is demoted to mode B (honest degradation — an empty corpus or a failed
20
+ * train never fabricates a promotion).
21
+ */
22
+ export function qualifyDecision(exitCode, assetDigest) {
23
+ return exitCode === 0 && assetDigest !== null ? "qualified" : "demoted_to_B";
24
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * vector-cortex/improve.ts — ML5-D "Improve Cortex" pure decision rule.
3
+ *
4
+ * The single pure decision of the improve job harness: given the training
5
+ * process exit code and whether a readable produced-asset digest exists,
6
+ * decide whether the five heads qualify (promote) or are demoted to mode B.
7
+ *
8
+ * Lives under src/ so both the dashboard-server route (routes-cortex-improve.ts)
9
+ * and the ML5-D acceptance aggregator (dist/vector-cortex/ml5d-acceptance.test.js)
10
+ * can import it — the mirrored dist/vector-cortex/ subtree carries this file via
11
+ * the publish-acceptance copyTree, so the acceptance suite needs no real
12
+ * training run.
13
+ *
14
+ * Pure, total over its inputs, zero I/O (PREVENT-PI-004 / PREVENT-011).
15
+ */
16
+ /**
17
+ * Terminal decision for an improve job: qualified only when the training
18
+ * process exited 0 AND a readable produced-asset digest exists; otherwise the
19
+ * job is demoted to mode B (honest degradation — an empty corpus or a failed
20
+ * train never fabricates a promotion).
21
+ */
22
+ export function qualifyDecision(exitCode, assetDigest) {
23
+ return exitCode === 0 && assetDigest !== null ? "qualified" : "demoted_to_B";
24
+ }
@@ -1,2 +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-xCzi6pWn.js";import{R as p,F as ee,r as ve}from"./index-DqjmZ88m.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-DjXp8u2Y.js.map
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-C9_fu2hc.js";import{R as p,A as ee,r as ve}from"./index-DY81TY4f.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-BT7YPcp7.js.map