/* global React */
const { useMemo } = React;
// Deterministic cover palette — picked by hashing the hypothesis rnd_id
const COVER_PALETTE = [
{ from: "#3a2a55", to: "#7c5fc4", angle: 135, motif: "merge" },
{ from: "#3a5a4f", to: "#a8c89e", angle: 145, motif: "garden" },
{ from: "#1f3a5c", to: "#5b7bb8", angle: 120, motif: "tower" },
{ from: "#5c2a2a", to: "#c87a4a", angle: 150, motif: "reactor" },
{ from: "#2a3a55", to: "#6b8eb8", angle: 130, motif: "realm" },
{ from: "#2a1f3a", to: "#7b5fa8", angle: 125, motif: "deck" },
{ from: "#1a3a3a", to: "#5ba8a8", angle: 130, motif: "audio" },
{ from: "#3a2a1a", to: "#c89e7b", angle: 140, motif: "fox" },
{ from: "#3a4a2a", to: "#9eb87b", angle: 145, motif: "bonsai" },
{ from: "#1a2a3a", to: "#5ba8c8", angle: 160, motif: "wave" },
{ from: "#3a3a2a", to: "#a8a85b", angle: 135, motif: "runner" },
{ from: "#5a4a3a", to: "#c8a87b", angle: 140, motif: "garden" },
];
function hashId(id) {
let h = 0;
for (let i = 0; i < id.length; i++) h = (h * 31 + id.charCodeAt(i)) >>> 0;
return h;
}
function getCoverConfig(projectId) {
const idx = hashId(projectId || "x") % COVER_PALETTE.length;
return COVER_PALETTE[idx];
}
function CoverMotif({ motif }) {
const c = "rgba(255,255,255,0.09)";
const c2 = "rgba(255,255,255,0.04)";
const s = "rgba(255,255,255,0.18)";
switch (motif) {
case "merge":
return