{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "pixel-openspace-dashboard",
  "title": "Pixel Openspace Dashboard",
  "description": "The open space inside a dashboard: per-source cards, the room in isometric view with one zone per source, a planning board, what needs you, an agent's last runs and the team.",
  "registryDependencies": [
    "https://pixel-openspace.vercel.app/r/pixel-openspace.json"
  ],
  "files": [
    {
      "path": "registry/pixel-openspace/dashboard.tsx",
      "content": "'use client'\n\n/*\n * Le tableau de bord autour de la salle : les chiffres de chaque source en\n * haut, la salle au milieu, le planning dessous ; à droite, ce qui a besoin de\n * toi, le détail d'un agent et l'équipe. Il prend les mêmes props que la salle,\n * plus les sources qui groupent les agents ; tout se recalcule depuis elles.\n */\n\nimport { useState, useSyncExternalStore, type CSSProperties, type ReactNode } from 'react'\nimport { THEMES } from './contexte'\nimport { Portrait, habitsDe } from './iso'\nimport { PixelOpenspace } from './pixel-openspace'\nimport type { Agent, AgentStatus, Language, OpenSpaceProps } from './types'\n\n/** Where a group of agents runs: a machine, a repository, a queue. */\nexport type DashboardSource = {\n  id: string\n  name: string\n  /** Written next to the name: \"launchd\", \"owner/repo\". */\n  detail?: string\n  /** What its agents are called: \"jobs\", \"workflows\". */\n  unit?: string\n  color?: string\n  /** The ids of its agents. */\n  agents: Array<string>\n}\n\nexport type DashboardProps = Omit<OpenSpaceProps, 'zones'> & {\n  /** Groups of agents: one card, one zone of the room and one filter each. Without it, every agent is in one source. */\n  sources?: Array<DashboardSource>\n}\n\nconst ACCENT = '#e8b923'\n/* Les titres ronds : Fredoka si la page la charge dans --font-fredoka, sinon la police des titres de la salle. */\nconst TITRE = 'font-[family-name:var(--font-fredoka,var(--font-pixel))]'\nconst COULEURS = ['#9aa3ff', '#f6a26a', '#5eead4', '#f472b6', '#a3e635']\n\nconst ETATS: Record<AgentStatus, { couleur: string; texte: string; fond: string }> = {\n  working: { couleur: ACCENT, texte: '#f5d25e', fond: '#2a2410' },\n  ok: { couleur: '#4ade80', texte: '#86efac', fond: '#10241a' },\n  late: { couleur: '#fb923c', texte: '#fdba74', fond: '#2a1a10' },\n  asleep: { couleur: '#818cf8', texte: '#a5b4fc', fond: '#181a33' },\n  failed: { couleur: '#ef4444', texte: '#fca5a5', fond: '#2a1219' },\n  off: { couleur: '#71717a', texte: '#a1a6bd', fond: '#1c1d24' },\n  never: { couleur: '#a1a1aa', texte: '#c3c8e0', fond: '#1c1d24' },\n  'on-demand': { couleur: '#38bdf8', texte: '#7dd3fc', fond: '#0f2230' },\n}\nconst LEGENDE: Array<AgentStatus> = ['working', 'ok', 'late', 'failed', 'asleep', 'on-demand', 'off']\n\nconst MOTS = {\n  en: {\n    statuts: {\n      working: 'Running',\n      ok: 'Up to date',\n      late: 'Late',\n      asleep: 'Asleep',\n      failed: 'Failed',\n      off: 'Off',\n      never: 'Never ran',\n      'on-demand': 'On demand',\n    } satisfies Record<AgentStatus, string>,\n    toutes: 'All agents',\n    agents: 'agents',\n    occupes: 'running',\n    passages: 'runs today',\n    enEchec: 'failed',\n    enRetard: 'late',\n    souci: 'issues',\n    prochain: 'Next',\n    rien: 'Nothing planned',\n    direct: 'Live',\n    besoin: 'Needs you',\n    alertes: (n: number) => `${n} alert${n > 1 ? 's' : ''}`,\n    toutVaBien: 'all good',\n    personne: 'Nobody is failing or late.',\n    relancer: 'Run again',\n    voir: 'View',\n    dernier: 'last run',\n    jamais: 'never',\n    maintenant: 'NOW',\n    auTravail: (role: string) => `${role}, screen on.`,\n    aucunPassage: 'No run today.',\n    echec: 'FAILED',\n    equipe: 'Team',\n    sources: 'sources',\n    planning: 'Planning',\n    planningSous: 'the day of your jobs, every source',\n    tous: 'All',\n    aVenir: 'Upcoming',\n    enCours: 'Running',\n    aSurveiller: 'To watch',\n    termine: 'Done',\n    vide: 'Nothing',\n    vue: 'Room view',\n    iso: 'Iso',\n    face: 'Front',\n    aLaDemande: 'on demand',\n    demarre: (nom: string) => `${nom} started`,\n    fini: (nom: string, message: string) => `${nom} is done: ${message}`,\n    plante: (nom: string) => `${nom} failed`,\n    dans: (d: string) => `in ${d}`,\n    ilYa: (d: string) => `${d} ago`,\n    instant: 'just now',\n    jours: 'd',\n    a: (h: string) => `at ${h}`,\n  },\n  fr: {\n    statuts: {\n      working: 'Au travail',\n      ok: 'À jour',\n      late: 'En retard',\n      asleep: 'Endormi',\n      failed: 'En échec',\n      off: 'Absent',\n      never: 'Jamais lancé',\n      'on-demand': 'À la demande',\n    } satisfies Record<AgentStatus, string>,\n    toutes: 'Tous les agents',\n    agents: 'agents',\n    occupes: 'au travail',\n    passages: 'passages aujourd’hui',\n    enEchec: 'en échec',\n    enRetard: 'en retard',\n    souci: 'souci',\n    prochain: 'Prochain',\n    rien: 'Rien de prévu',\n    direct: 'En direct',\n    besoin: 'Besoin de toi',\n    alertes: (n: number) => `${n} alerte${n > 1 ? 's' : ''}`,\n    toutVaBien: 'tout va bien',\n    personne: 'Personne n’est en échec ni en retard.',\n    relancer: 'Relancer',\n    voir: 'Voir',\n    dernier: 'dernier passage',\n    jamais: 'jamais',\n    maintenant: 'MAINTENANT',\n    auTravail: (role: string) => `${role}, écran allumé.`,\n    aucunPassage: 'Aucun passage aujourd’hui.',\n    echec: 'ÉCHEC',\n    equipe: 'Équipe',\n    sources: 'sources',\n    planning: 'Planning',\n    planningSous: 'la journée de tes tâches, toutes sources',\n    tous: 'Tous',\n    aVenir: 'À venir',\n    enCours: 'Au travail',\n    aSurveiller: 'À surveiller',\n    termine: 'Terminé',\n    vide: 'Rien',\n    vue: 'Vue de la salle',\n    iso: 'Iso',\n    face: 'De face',\n    aLaDemande: 'à la demande',\n    demarre: (nom: string) => `${nom} a démarré`,\n    fini: (nom: string, message: string) => `${nom} a fini : ${message}`,\n    plante: (nom: string) => `${nom} a planté`,\n    dans: (d: string) => `dans ${d}`,\n    ilYa: (d: string) => `il y a ${d}`,\n    instant: 'à l’instant',\n    jours: 'j',\n    a: (h: string) => `à ${h}`,\n  },\n} satisfies Record<Language, unknown>\ntype Mots = (typeof MOTS)[Language]\n\n/* L'heure, relue toutes les 30 secondes ; le rendu serveur n'en a pas, pour ne pas désaccorder l'hydratation. */\nlet instant = Date.now()\nfunction abonnerHorloge(prevenir: () => void) {\n  instant = Date.now()\n  const t = setInterval(() => {\n    instant = Date.now()\n    prevenir()\n  }, 30_000)\n  return () => clearInterval(t)\n}\nconst lireHorloge = () => instant\n\n/** Une durée en minutes, heures ou jours ; seule l'unité des jours change d'une langue à l'autre. */\nconst duree = (min: number, m: Mots) =>\n  min < 60 ? `${min} min` : min < 60 * 24 ? `${Math.round(min / 60)} h` : `${Math.round(min / 60 / 24)} ${m.jours}`\nconst minutesJusqua = (iso: string, maintenant: number) => Math.round((new Date(iso).getTime() - maintenant) / 60_000)\n\nfunction ecart(iso: string | null | undefined, maintenant: number, m: Mots): string | null {\n  if (!iso) return null\n  const minutes = minutesJusqua(iso, maintenant)\n  if (minutes === 0) return m.instant\n  return minutes > 0 ? m.dans(duree(minutes, m)) : m.ilYa(duree(-minutes, m))\n}\n\nfunction aujourdhui(iso: string | null | undefined, maintenant: number) {\n  if (!iso) return false\n  const minuit = new Date(maintenant)\n  minuit.setHours(0, 0, 0, 0)\n  return new Date(iso).getTime() >= minuit.getTime()\n}\n\ntype Source = DashboardSource & { couleur: string }\n\nfunction Pastille({ statut, m }: { statut: AgentStatus; m: Mots }) {\n  const e = ETATS[statut]\n  return (\n    <span\n      className=\"shrink-0 rounded-full px-2.5 py-[3px] text-[11px] font-semibold whitespace-nowrap\"\n      style={{ background: e.fond, color: e.texte }}\n    >\n      ● {m.statuts[statut]}\n    </span>\n  )\n}\n\nfunction Puce({ source }: { source: Source }) {\n  return (\n    <span\n      className=\"self-start rounded-[5px] border px-[7px] py-px text-[10px] font-semibold uppercase\"\n      style={{ borderColor: `color-mix(in oklab, ${source.couleur} 45%, transparent)`, color: source.couleur }}\n    >\n      {source.name}\n    </span>\n  )\n}\n\nfunction Panneau({\n  titre,\n  aside,\n  className,\n  style,\n  children,\n}: {\n  titre: ReactNode\n  aside?: ReactNode\n  className?: string\n  style?: CSSProperties\n  children: ReactNode\n}) {\n  return (\n    <section\n      className={['flex flex-col gap-3 rounded-[18px] border border-[#232a45] bg-[#0e1222] p-[18px]', className].filter(Boolean).join(' ')}\n      style={style}\n    >\n      <div className=\"flex flex-wrap items-center justify-between gap-3\">\n        <h2 className={`${TITRE} m-0 flex items-center gap-2 text-[19px] font-semibold text-[#f3f4fa]`}>{titre}</h2>\n        {aside ? <span className=\"text-xs text-[#9aa2c4]\">{aside}</span> : null}\n      </div>\n      {children}\n    </section>\n  )\n}\n\nfunction Chiffre({ n, label, couleur }: { n: string | number; label: string; couleur?: string }) {\n  return (\n    <span className=\"whitespace-nowrap\" style={couleur ? { color: couleur } : undefined}>\n      <b className={`${TITRE} text-[22px]`} style={{ color: couleur ?? '#f3f4fa' }}>\n        {n}\n      </b>{' '}\n      {label}\n    </span>\n  )\n}\n\n/** Une source : ce qui tourne, les passages du jour, ce qui coince, et le prochain départ. */\nfunction CarteSource({ source, agents, maintenant, m }: { source: Source; agents: Array<Agent>; maintenant: number; m: Mots }) {\n  const siens = agents.filter((a) => source.agents.includes(a.id))\n  const passages = siens.reduce((n, a) => n + (a.runs ?? []).filter((r) => aujourdhui(r.at, maintenant)).length, 0)\n  const echecs = siens.filter((a) => a.status === 'failed').length\n  const retards = siens.filter((a) => a.status === 'late').length\n  const prochain = siens\n    .filter((a) => a.nextRun && new Date(a.nextRun).getTime() > maintenant)\n    .sort((a, b) => new Date(a.nextRun!).getTime() - new Date(b.nextRun!).getTime())[0]\n  return (\n    <div\n      className=\"flex flex-col gap-1.5 rounded-[14px] border border-[#262e52] bg-[#10142a] px-[18px] py-3.5\"\n      style={{ borderTop: `2px solid ${source.couleur}` }}\n    >\n      <div className=\"flex items-baseline gap-2.5\">\n        <span className={`${TITRE} text-[17px] font-bold tracking-wide uppercase`} style={{ color: source.couleur }}>\n          {source.name}\n        </span>\n        <span className=\"text-[13px] text-[#9aa2c4]\">\n          {source.detail ? `${source.detail} · ` : ''}\n          {siens.length} {source.unit ?? m.agents}\n        </span>\n      </div>\n      <div className=\"flex flex-wrap items-baseline gap-x-4 text-[13px] text-[#9aa2c4]\">\n        <Chiffre n={`${siens.filter((a) => a.status === 'working').length}/${siens.length}`} label={m.occupes} />\n        <Chiffre n={passages} label={m.passages} />\n        {echecs ? <Chiffre n={echecs} label={m.enEchec} couleur=\"#fca5a5\" /> : null}\n        {retards ? <Chiffre n={retards} label={m.enRetard} couleur=\"#fdba74\" /> : null}\n        {!echecs && !retards ? <Chiffre n={0} label={m.souci} couleur=\"#86efac\" /> : null}\n      </div>\n      <div className=\"text-xs text-[#9aa2c4]\">\n        {prochain ? (\n          <>\n            {m.prochain} : <b className=\"text-[#e7e9f3]\">{prochain.name}</b> {ecart(prochain.nextRun, maintenant, m)}\n          </>\n        ) : (\n          m.rien\n        )}\n      </div>\n    </div>\n  )\n}\n\ntype Colonne = {\n  titre: string\n  couleur: string\n  fond: string\n  liste: Array<Agent>\n  info: (a: Agent) => string | null\n  texte: (a: Agent) => string\n}\n\n/**\n * The open space inside a dashboard: per-source cards on top, the room, a\n * planning board below; on the right, what needs you, the selected agent's\n * last runs and the team. Takes the same props as `PixelOpenspace`, plus\n * `sources`; the room is in isometric view unless `view` says otherwise.\n */\nexport function PixelOpenspaceDashboard({\n  sources: sourcesProp,\n  view: vueProp = 'iso',\n  theme = 'modern',\n  // Pas de nuit par défaut : un tableau de bord se regarde le soir aussi, et tout le monde y reste en mouvement.\n  nightHours = [0, 0],\n  ...salle\n}: DashboardProps) {\n  const { agents, onRun, language = 'en', now } = salle\n  const m = MOTS[language] ?? MOTS.en\n  const horloge = useSyncExternalStore(abonnerHorloge, lireHorloge, () => null)\n  const maintenant = now ?? horloge\n  const [choisi, setChoisi] = useState<string | null>(null)\n  const [vue, setVue] = useState(vueProp)\n  const [filtre, setFiltre] = useState<string>('tous')\n  // La dernière nouvelle, numérotée : chaque nouvelle rejoue l'animation qui l'affiche puis l'efface.\n  const [annonce, setAnnonce] = useState<{ texte: string; n: number } | null>(null)\n\n  /* Une notification quand un agent démarre, finit ou plante : on compare aux états du rendu d'avant. */\n  const [avant, setAvant] = useState(agents)\n  if (avant !== agents) {\n    setAvant(agents)\n    const precedents = new Map(avant.map((a) => [a.id, a]))\n    const change = agents.find((a) => precedents.get(a.id)?.status !== a.status && precedents.has(a.id))\n    if (change) {\n      const texte =\n        change.status === 'working'\n          ? m.demarre(change.name)\n          : change.status === 'failed'\n            ? m.plante(change.name)\n            : m.fini(change.name, change.lastMessage ?? '')\n      setAnnonce({ texte, n: (annonce?.n ?? 0) + 1 })\n    }\n  }\n\n  const sources: Array<Source> = (\n    sourcesProp?.length ? sourcesProp : [{ id: 'tous', name: m.toutes, agents: agents.map((a) => a.id) }]\n  ).map((s, k) => ({ ...s, couleur: s.color ?? COULEURS[k % COULEURS.length] }))\n  const sourceDe = (id: string) => sources.find((s) => s.agents.includes(id)) ?? sources[0]\n  const habille = THEMES[theme] ?? THEMES.modern\n  const portrait = (a: Pick<Agent, 'id'>, taille = 28) => (\n    <Portrait id={a.id} habits={habitsDe(a.id, habille.tenue(a.id), habille.casque(a.id))} taille={taille} />\n  )\n\n  if (maintenant === null) return <div className=\"min-h-[600px] rounded-[18px] bg-[#080b16]\" />\n\n  const aVenir = agents\n    .filter((a) => a.nextRun && new Date(a.nextRun).getTime() > maintenant && a.status !== 'working')\n    .sort((a, b) => new Date(a.nextRun!).getTime() - new Date(b.nextRun!).getTime())\n  const prochain = aVenir[0]\n  const alertes = agents.filter((a) => a.status === 'failed' || a.status === 'late')\n  const detail = agents.find((a) => a.id === choisi) ?? alertes[0] ?? agents[0]\n  const etapes = [...(detail?.runs ?? [])].reverse().slice(0, 5)\n  const heure = (iso: string) =>\n    new Date(iso).toLocaleTimeString(language === 'fr' ? 'fr-FR' : 'en-GB', { hour: '2-digit', minute: '2-digit' })\n  const depart = (iso: string) => (aujourdhui(iso, maintenant) ? m.a(heure(iso)) : ecart(iso, maintenant, m))\n  const filtres = (liste: Array<Agent>) => (filtre === 'tous' ? liste : liste.filter((a) => sourceDe(a.id).id === filtre))\n\n  const colonnes: Array<Colonne> = [\n    {\n      titre: m.aVenir,\n      couleur: '#9aa2c4',\n      fond: '#0b0f1d',\n      liste: filtres(aVenir).slice(0, 4),\n      info: (a) => (a.nextRun ? depart(a.nextRun) : null),\n      texte: (a) => a.schedule ?? a.role ?? '',\n    },\n    {\n      titre: m.enCours,\n      couleur: '#e9d48a',\n      fond: '#12131f',\n      liste: filtres(agents.filter((a) => a.status === 'working')),\n      info: (a) => ecart(a.lastRun, maintenant, m),\n      texte: (a) => a.role ?? '',\n    },\n    {\n      titre: m.aSurveiller,\n      couleur: '#fca5a5',\n      fond: '#170f17',\n      liste: filtres(alertes),\n      info: (a) => m.statuts[a.status].toLowerCase(),\n      texte: (a) => a.lastMessage ?? a.role ?? '',\n    },\n    {\n      titre: m.termine,\n      couleur: '#86efac',\n      fond: '#0d1611',\n      liste: filtres(agents.filter((a) => a.status === 'ok' && aujourdhui(a.lastRun, maintenant)))\n        .sort((a, b) => (b.lastRun ?? '').localeCompare(a.lastRun ?? ''))\n        .slice(0, 4),\n      info: (a) => (a.lastRun ? heure(a.lastRun) : null),\n      texte: (a) => a.lastMessage ?? '',\n    },\n  ]\n\n  return (\n    <div className=\"relative flex flex-col gap-[18px] rounded-[22px] bg-[#080b16] p-4 text-[#e7e9f3] sm:p-6\">\n      <div className=\"grid gap-5 xl:grid-cols-[minmax(0,1fr)_380px]\">\n        {/* Colonne de gauche */}\n        <div className=\"flex min-w-0 flex-col gap-4\">\n          <div className=\"grid gap-3 md:grid-cols-[repeat(auto-fit,minmax(240px,1fr))]\">\n            {sources.map((s) => (\n              <CarteSource key={s.id} source={s} agents={agents} maintenant={maintenant} m={m} />\n            ))}\n            <div className=\"flex flex-col items-center justify-center gap-0.5 rounded-[14px] border border-[#262e52] bg-[#10142a] px-3 py-3.5 text-center\">\n              <span className=\"text-[11px] font-semibold tracking-wider text-[#9aa2c4] uppercase\">{m.prochain}</span>\n              <span className={`${TITRE} text-[26px] font-bold text-[#f3f4fa]`}>\n                {prochain ? duree(Math.max(0, minutesJusqua(prochain.nextRun!, maintenant)), m) : '—'}\n              </span>\n              <span className=\"text-xs text-[#9aa2c4]\">{prochain ? `${prochain.name}, ${sourceDe(prochain.id).name}` : m.rien}</span>\n            </div>\n          </div>\n\n          {/* La salle : une zone par source. */}\n          <section aria-label={m.vue} className=\"overflow-hidden rounded-[18px]\">\n            <PixelOpenspace\n              {...salle}\n              theme={theme}\n              nightHours={nightHours}\n              view={vue}\n              zones={sources.length > 1 ? sources.map((s) => ({ name: s.name, agents: s.agents, detail: s.detail, color: s.couleur })) : []}\n            />\n          </section>\n\n          <div className=\"flex flex-wrap items-center justify-between gap-4\">\n            <div className=\"flex flex-wrap items-center gap-4 text-[13px] text-[#c3c8e0]\">\n              {LEGENDE.map((s) => (\n                <span key={s} className=\"flex items-center gap-1.5\">\n                  <span className=\"size-2 rounded-full\" style={{ background: ETATS[s].couleur }} />\n                  {m.statuts[s]}\n                </span>\n              ))}\n            </div>\n            <div role=\"group\" aria-label={m.vue} className=\"flex gap-0.5 rounded-[10px] border border-[#232a45] bg-[#121729] p-1\">\n              {(\n                [\n                  ['iso', m.iso],\n                  ['front', m.face],\n                ] as const\n              ).map(([v, label]) => (\n                <button\n                  key={v}\n                  type=\"button\"\n                  aria-pressed={vue === v}\n                  onClick={() => setVue(v)}\n                  className={`min-h-[34px] cursor-pointer rounded-[7px] px-3.5 text-[13px] ${vue === v ? 'bg-[#f3f4fa] font-semibold text-[#0d1124]' : 'text-[#9aa2c4]'}`}\n                >\n                  {label}\n                </button>\n              ))}\n            </div>\n          </div>\n\n          {/* Le planning de la journée */}\n          <Panneau\n            titre={\n              <>\n                {m.planning} <span className=\"font-sans text-[13px] font-normal text-[#9aa2c4]\">{m.planningSous}</span>\n              </>\n            }\n            aside={\n              sources.length > 1 ? (\n                <span className=\"flex flex-wrap gap-2\">\n                  {[{ id: 'tous', name: m.tous, couleur: '#f3f4fa' }, ...sources].map((s) => (\n                    <button\n                      key={s.id}\n                      type=\"button\"\n                      aria-pressed={filtre === s.id}\n                      onClick={() => setFiltre(s.id)}\n                      className=\"min-h-[34px] cursor-pointer rounded-full border border-[#3a4266] px-3.5 text-[13px] font-semibold\"\n                      style={{ color: s.couleur, background: filtre === s.id ? '#1b2140' : 'transparent' }}\n                    >\n                      {s.name}\n                    </button>\n                  ))}\n                </span>\n              ) : undefined\n            }\n          >\n            <div className=\"grid gap-3 sm:grid-cols-2 lg:grid-cols-4\">\n              {colonnes.map((col) => (\n                <div key={col.titre} className=\"flex flex-col gap-2 rounded-xl p-2.5\" style={{ background: col.fond }}>\n                  <div className=\"flex justify-between text-[11px] font-bold tracking-wider uppercase\" style={{ color: col.couleur }}>\n                    <span>● {col.titre}</span>\n                    <span>{col.liste.length}</span>\n                  </div>\n                  {col.liste.length === 0 ? <span className=\"py-2 text-sm text-[#9aa2c4]\">{m.vide}</span> : null}\n                  {col.liste.map((a) => (\n                    <button\n                      key={a.id}\n                      type=\"button\"\n                      onClick={() => setChoisi(a.id)}\n                      className=\"flex cursor-pointer flex-col gap-1.5 rounded-[10px] border bg-[#141a30] px-3 py-2.5 text-left\"\n                      style={{ borderColor: a.status === 'failed' || a.status === 'late' ? ETATS[a.status].couleur : '#232a45' }}\n                    >\n                      <span className=\"flex items-baseline justify-between gap-2\">\n                        <span className=\"truncate text-sm font-semibold text-[#f3f4fa]\">{a.name}</span>\n                        <span className=\"shrink-0 text-[11px] text-[#9aa2c4]\">{col.info(a)}</span>\n                      </span>\n                      <span className=\"line-clamp-2 text-xs text-[#9aa2c4]\">{col.texte(a)}</span>\n                      {sources.length > 1 ? <Puce source={sourceDe(a.id)} /> : null}\n                      {a.status === 'working' ? (\n                        <span className=\"h-1 overflow-hidden rounded-sm bg-[#232a45]\">\n                          <span className=\"block h-full w-2/5 animate-pulse rounded-sm\" style={{ background: ACCENT }} />\n                        </span>\n                      ) : null}\n                    </button>\n                  ))}\n                </div>\n              ))}\n            </div>\n          </Panneau>\n        </div>\n\n        {/* Colonne de droite */}\n        <div className=\"flex min-w-0 flex-col gap-4\">\n          <Panneau\n            titre={\n              <>\n                <span className=\"size-2.5 rounded-full\" style={{ background: ACCENT }} />\n                {m.besoin}\n              </>\n            }\n            aside={alertes.length ? m.alertes(alertes.length) : m.toutVaBien}\n            className=\"border-2 bg-[#15131a]\"\n            style={{ borderColor: ACCENT, boxShadow: '0 0 24px rgba(232, 185, 35, 0.15)' }}\n          >\n            {alertes.length === 0 ? <p className=\"m-0 text-sm text-[#9aa2c4]\">{m.personne}</p> : null}\n            {alertes.map((a) => (\n              <div\n                key={a.id}\n                className=\"flex flex-col gap-2.5 rounded-[10px] border-l-[3px] bg-[#1c1a24] p-3\"\n                style={{ borderLeftColor: ETATS[a.status].couleur }}\n              >\n                <div className=\"flex items-center gap-2.5\">\n                  {portrait(a, 30)}\n                  <div className=\"flex flex-col gap-px\">\n                    <span className=\"flex items-center gap-2 text-sm font-semibold text-[#f3f4fa]\">\n                      {a.name} {sources.length > 1 ? <Puce source={sourceDe(a.id)} /> : null}\n                    </span>\n                    <span className=\"text-xs text-[#9aa2c4]\">\n                      {m.statuts[a.status].toLowerCase()} · {m.dernier} {ecart(a.lastRun, maintenant, m) ?? m.jamais}\n                    </span>\n                  </div>\n                </div>\n                <p className=\"m-0 text-sm font-semibold text-[#f3f4fa]\">{a.lastMessage ?? a.role}</p>\n                <div className=\"flex gap-2\">\n                  {onRun ? (\n                    <button\n                      type=\"button\"\n                      onClick={() => void onRun(a)}\n                      className=\"min-h-[38px] cursor-pointer rounded-full bg-[#f0883e] px-[18px] text-sm font-semibold text-[#1c0f05]\"\n                    >\n                      {m.relancer}\n                    </button>\n                  ) : null}\n                  <button\n                    type=\"button\"\n                    onClick={() => setChoisi(a.id)}\n                    className=\"min-h-[38px] cursor-pointer rounded-full border border-[#3a4266] px-[18px] text-sm font-medium text-[#e7e9f3]\"\n                  >\n                    {m.voir}\n                  </button>\n                </div>\n              </div>\n            ))}\n          </Panneau>\n\n          {/* L'agent choisi et ses derniers passages */}\n          {detail ? (\n            <section\n              aria-label={detail.name}\n              className=\"flex flex-col gap-3.5 rounded-[18px] border border-[#232a45] bg-[#0e1222] p-[18px]\"\n            >\n              <div className=\"flex items-start gap-3\">\n                <div\n                  className=\"flex size-[46px] shrink-0 items-center justify-center rounded-xl\"\n                  style={{ background: ETATS[detail.status].fond }}\n                >\n                  {portrait(detail, 36)}\n                </div>\n                <div className=\"flex min-w-0 grow flex-col gap-0.5\">\n                  <div className=\"flex items-center justify-between gap-2\">\n                    <h2 className={`${TITRE} m-0 text-[21px] font-bold text-[#f3f4fa]`}>{detail.name}</h2>\n                    <Pastille statut={detail.status} m={m} />\n                  </div>\n                  <span className=\"text-xs text-[#9aa2c4]\">\n                    {sources.length > 1 ? `${sourceDe(detail.id).name} · ` : ''}\n                    {detail.schedule ?? m.aLaDemande} · {m.dernier} {ecart(detail.lastRun, maintenant, m) ?? m.jamais}\n                  </span>\n                </div>\n              </div>\n              <div className=\"flex flex-col gap-1\">\n                <span className=\"text-[11px] font-bold tracking-wider text-[#9aa2c4]\">{m.maintenant}</span>\n                <p className=\"m-0 text-[15px] leading-snug font-medium text-[#f3f4fa]\">\n                  {detail.status === 'working' ? m.auTravail(detail.role ?? detail.name) : (detail.lastMessage ?? detail.role)}\n                </p>\n              </div>\n              {etapes.length ? (\n                <ol className=\"m-0 flex list-none flex-col p-0\">\n                  {etapes.map((r, i) => {\n                    const rate = r.ok === false\n                    return (\n                      <li key={r.at + i} className=\"flex gap-3\">\n                        <div className=\"flex flex-col items-center\">\n                          <span\n                            className=\"flex size-[22px] shrink-0 items-center justify-center rounded-full text-[11px] font-bold\"\n                            style={{ background: rate ? '#ef4444' : '#1f6b43', color: rate ? '#ffffff' : '#dcfce7' }}\n                          >\n                            {i + 1}\n                          </span>\n                          {i < etapes.length - 1 ? <span className=\"w-0.5 grow bg-[#2a3150]\" /> : null}\n                        </div>\n                        <div className=\"flex flex-col gap-1 pb-3\">\n                          <div className=\"text-sm font-semibold text-[#f3f4fa]\">\n                            {heure(r.at)}{' '}\n                            {rate ? (\n                              <span className=\"text-[10px] font-bold text-[#fca5a5]\">{m.echec}</span>\n                            ) : (\n                              <span className=\"text-[#4ade80]\">✓</span>\n                            )}\n                          </div>\n                          {rate ? (\n                            <span className=\"self-start rounded-md bg-[#2a1219] px-2 py-[3px] text-xs font-semibold text-[#fca5a5]\">\n                              → {r.message}\n                            </span>\n                          ) : (\n                            <div className=\"text-xs text-[#9aa2c4]\">{r.message}</div>\n                          )}\n                        </div>\n                      </li>\n                    )\n                  })}\n                </ol>\n              ) : (\n                <p className=\"m-0 text-sm text-[#9aa2c4]\">{m.aucunPassage}</p>\n              )}\n            </section>\n          ) : null}\n\n          {/* L'équipe, source par source */}\n          <Panneau titre={m.equipe} aside={`${agents.length} ${m.agents}${sources.length > 1 ? ` · ${sources.length} ${m.sources}` : ''}`}>\n            {sources.map((source) => (\n              <div key={source.id} className=\"flex flex-col\">\n                {sources.length > 1 ? (\n                  <div className=\"py-1 text-xs font-semibold uppercase\" style={{ color: source.couleur }}>\n                    {source.name} <span className=\"font-normal text-[#9aa2c4] normal-case\">{source.detail}</span>\n                  </div>\n                ) : null}\n                {agents\n                  .filter((a) => source.agents.includes(a.id))\n                  .map((a) => (\n                    <button\n                      key={a.id}\n                      type=\"button\"\n                      onClick={() => setChoisi(a.id)}\n                      aria-current={a.id === detail?.id}\n                      className=\"flex cursor-pointer items-center gap-2.5 rounded-lg px-1 py-[5px] text-left aria-[current=true]:bg-[#161c33]\"\n                    >\n                      {portrait(a)}\n                      <span className=\"min-w-0 grow\">\n                        <span className=\"block truncate text-sm font-semibold text-[#f3f4fa]\">\n                          {a.name} <span className=\"text-xs font-normal text-[#9aa2c4]\">{a.schedule}</span>\n                        </span>\n                        <span className=\"block truncate text-xs text-[#9aa2c4]\">{a.lastMessage ?? a.role}</span>\n                      </span>\n                      <Pastille statut={a.status} m={m} />\n                    </button>\n                  ))}\n              </div>\n            ))}\n          </Panneau>\n        </div>\n      </div>\n\n      <style>{`@keyframes po-annonce { 0% { opacity: 0; transform: translate(-50%, 12px) } 8%, 85% { opacity: 1; transform: translate(-50%, 0) } 100% { opacity: 0; transform: translate(-50%, 12px) } }`}</style>\n      <div role=\"status\" aria-live=\"polite\">\n        {annonce ? (\n          <div\n            key={annonce.n}\n            className=\"pointer-events-none fixed bottom-6 left-1/2 rounded-xl bg-[#f8f9fc] px-5 py-3 text-sm font-medium text-[#141428] opacity-0 shadow-[0_10px_30px_rgba(0,0,0,0.45)]\"\n            style={{ animation: 'po-annonce 3.5s ease forwards' }}\n          >\n            {annonce.texte}\n          </div>\n        ) : null}\n      </div>\n    </div>\n  )\n}\n",
      "type": "registry:component",
      "target": "components/pixel-openspace/dashboard.tsx"
    }
  ],
  "type": "registry:block"
}