import React from 'react';
import {AbsoluteFill, Audio, Easing, Img, Sequence, interpolate, staticFile, useCurrentFrame} from 'remotion';
import {loadFont} from '@remotion/google-fonts/Inter';
import {C, Icon, IconBlock, MindUI, Rule, Words, clamp, useSpr} from './NouveauteMind';
import {PHRASES_ECO, Phrase} from './voixEcosysteme';
const {fontFamily} = loadFont('normal', {weights: ['400', '500', '600', '700', '800'], subsets: ['latin']});
// « L'écosystème Gastinel » (20/10/2026), versions complète et courte.
// Script : SCRIPT-ecosysteme-20261020.md ; sources de chaque phrase : RAPPORT-ecosysteme-20261020.md.
// Voix PROVISOIRE (dots.tts-soar, voix par défaut) ; captures réelles dans public/ecosysteme/.
export const FPS_ECO = 30;
const f = (sec: number) => Math.round(sec * FPS_ECO);
const DATE = '20.10.2026';
// ---------- Petits éléments ----------
const Col: React.FC<{children: React.ReactNode; gap?: number}> = ({children, gap = 44}) => (
{children}
);
const Small: React.FC<{children: React.ReactNode; delay?: number}> = ({children, delay = 0}) => {
const p = useSpr(delay, 22);
return {children}
;
};
const Tag: React.FC<{text: string; note?: string}> = ({text, note}) => (
);
/** Capture réelle encadrée (filet noir, ombre pleine de couleur, aucun arrondi), qui se dévoile de gauche à droite. */
const Capture: React.FC<{src: string; w: number; h: number; accent: string; pos?: string; delay?: number}> = ({src, w, h, accent, pos = 'center', delay = 0}) => {
const p = useSpr(delay, 20);
const fr = useCurrentFrame();
const zoom = interpolate(fr, [delay, delay + 90], [1.06, 1], {...clamp, easing: Easing.out(Easing.cubic)});
return (
);
};
const Pill: React.FC<{text: string; delay?: number; bg?: string; color?: string; size?: number; icon?: string}> = ({text, delay = 0, bg = C.ink, color = '#fff', size = 64, icon}) => {
const p = useSpr(delay, 20);
return (
{icon && }
{text}
);
};
const Stamp: React.FC<{text: string; color?: string; delay?: number; size?: number}> = ({text, color = C.orange, delay = 2, size = 96}) => {
const p = useSpr(delay, 12);
return (
{text}
);
};
const Counter: React.FC<{to: number; color: string; dur?: number; delay?: number}> = ({to, color, dur = 24, delay = 2}) => {
const fr = useCurrentFrame();
const v = Math.round(interpolate(fr, [delay, delay + dur], [0, to], {...clamp, easing: Easing.out(Easing.cubic)}));
return {v}
;
};
const Tile: React.FC<{icon: string; label?: string; delay: number; on?: boolean; accent?: string; size?: number}> = ({icon, label, delay, on, accent = C.bleu, size = 200}) => {
const p = useSpr(delay, 16);
return (
);
};
const Ligne: React.FC<{icon: string; text: string; note?: string; delay: number; accent: string}> = ({icon, text, note, delay, accent}) => {
const p = useSpr(delay, 18);
return (
);
};
// ---------- Plans spéciaux ----------
const MindDemo: React.FC = () => {
const fr = useCurrentFrame();
const k = 1.4;
const hi = interpolate(fr, [56, 64], [0, 1], clamp);
return (
);
};
const Infra: React.FC = () => {
const box = (titre: string, note: string, icon: string, delay: number, fill: boolean) => {
const p = useSpr(delay, 18);
return (
);
};
const trait = (delay: number) => {
const p = useSpr(delay, 22);
return
;
};
return (
{box('Serveur à la maison', 'dans le Vercors · carte graphique 16 Go', 'serveur', 0, true)}
{trait(8)}
{box('Relais HTTPS', 'la porte d’entrée publique', 'cadenas', 12, false)}
{trait(20)}
{box('Toi', 'sur ton navigateur', 'utilisateur', 24, false)}
+ sauvegardes chaque nuit
);
};
const HubCapture: React.FC<{texte?: boolean}> = ({texte = true}) => (
{texte && (
hub.gastinel.me
)}
);
const Services: React.FC<{stamp?: boolean}> = ({stamp}) => (
);
const EnCours: React.FC<{n: number}> = ({n}) => {
const lignes = [
{icon: 'ia', text: 'Réentraîner Mind', note: 'réentraînement en cours'},
{icon: 'meteo', text: 'Un site météo public', note: 'en préparation'},
{icon: 'bloc', text: 'Saison 1 du serveur', note: 'en préparation'},
];
return (
{lignes.slice(0, n).map((l, i) => (
))}
);
};
const Fin: React.FC = () => {
const p = useSpr(6);
return (
gastinel.me
);
};
// ---------- Scènes : un ou plusieurs plans par phrase ; `w` = indice du mot (dans le script) où le plan commence ----------
type Sub = {w: number; chap: string; accent: string; node: React.ReactNode};
const scenes = (id: string, court: boolean): Sub[] => {
switch (id) {
case 'p01': return [
{w: 0, chap: 'ÉCOSYSTÈME GASTINEL', accent: C.jaune, node: },
{w: 7, chap: 'ÉCOSYSTÈME GASTINEL', accent: C.bleu, node: },
];
case 'p02': return [
{w: 0, chap: 'ÉCOSYSTÈME GASTINEL', accent: C.ink, node: },
{w: 5, chap: 'ÉCOSYSTÈME GASTINEL', accent: C.orange, node: (
{['ia', 'meteo', 'bloc', 'utilisateur', 'code', 'serveur', 'montagne', 'lien'].map((n, i) => )}
)},
];
case 'p03': return [
{w: 0, chap: 'MIND', accent: C.bleu, node: mind.gastinel.me },
{w: 2, chap: 'MIND', accent: C.jaune, node: },
];
case 'p04': return [
{w: 0, chap: 'WEATHER STUDIO', accent: C.bleu, node: },
{w: 3, chap: 'WEATHER STUDIO', accent: C.jaune, node: },
{w: 13, chap: 'WEATHER STUDIO', accent: C.vert, node: },
];
case 'p05': return [
{w: 0, chap: 'MÉTÉO', accent: C.orange, node: },
{w: 6, chap: 'MÉTÉO', accent: C.orange, node: Vercors · Chartreuse · Belledonne },
{w: 9, chap: 'MÉTÉO', accent: C.ink, node: },
];
case 'p06': return [
{w: 0, chap: 'MINECRAFT', accent: C.vert, node: },
{w: 6, chap: 'MINECRAFT', accent: C.vert, node: (
MES PROPRES MODS
Accès sur liste blanche pour l’instant.
)},
];
case 'p07': return [{w: 0, chap: 'HUB', accent: C.bleu, node: }];
case 'p08': return [
{w: 0, chap: 'CODE LIBRE', accent: C.vert, node: sur GitHub },
{w: 6, chap: 'CODE LIBRE', accent: C.vert, node: (
)},
];
case 'p09': return [
{w: 0, chap: 'INFRASTRUCTURE', accent: C.ink, node: },
{w: 4, chap: 'INFRASTRUCTURE', accent: C.orange, node: },
];
case 'p10': return [
{w: 0, chap: 'CE QUE JE VISE', accent: C.jaune, node:
},
{w: 4, chap: 'CE QUE JE VISE', accent: C.orange, node: },
];
case 'p11': return court
? [
{w: 0, chap: 'CE QUE JE VISE', accent: C.bleu, node: },
{w: 6, chap: 'CE QUE JE VISE', accent: C.bleu, node: },
{w: 9, chap: 'CE QUE JE VISE', accent: C.orange, node: },
]
: [
{w: 0, chap: 'CE QUE JE VISE', accent: C.bleu, node: },
{w: 6, chap: 'CE QUE JE VISE', accent: C.bleu, node: },
{w: 9, chap: 'CE QUE JE VISE', accent: C.orange, node: },
];
case 'p12': return [
{w: 0, chap: 'CE QUE JE VISE', accent: C.orange, node: },
{w: 3, chap: 'CE QUE JE VISE', accent: C.orange, node: },
{w: 9, chap: 'CE QUE JE VISE', accent: C.orange, node: },
];
case 'p13': return [
{w: 0, chap: 'UNE RÈGLE', accent: C.vert, node: },
{w: 5, chap: 'UNE RÈGLE', accent: C.vert, node: },
{w: 11, chap: 'UNE RÈGLE', accent: C.ink, node: (
Les données servent au service. Point.
)},
];
case 'p14': return [
{w: 0, chap: 'À SUIVRE', accent: C.ink, node: },
{w: 3, chap: 'À SUIVRE', accent: C.bleu, node: },
];
default: return [];
}
};
// ---------- Chronologie (calée sur la durée réelle de chaque prise) ----------
type Plan = {from: number; dur: number; sub: Sub};
type Bloc = {ph: Phrase; audioFrom: number; plans: Plan[]};
const construire = (ids: string[], court: boolean, lead: number, gap: number, tail: number) => {
const blocs: Bloc[] = [];
let cursor = 0;
ids.forEach((id, i) => {
const ph = PHRASES_ECO.find((p) => p.id === id)!;
const start = cursor;
const audioFrom = start + f(i === 0 ? lead : 0);
const blocEnd = start + f((i === 0 ? lead : 0) + ph.dur + (i === ids.length - 1 ? tail : gap));
const subs = scenes(id, court);
const at = (s: Sub) => ph.mots[Math.min(s.w, ph.mots.length - 1)][1];
const plans = subs.map((s, j) => {
const from = j === 0 ? start : audioFrom + f(at(s));
const to = j === subs.length - 1 ? blocEnd : audioFrom + f(at(subs[j + 1]));
return {from, dur: to - from, sub: s};
});
blocs.push({ph, audioFrom, plans});
cursor = blocEnd;
});
return {blocs, total: cursor};
};
const COMPLET = construire(['p01', 'p02', 'p03', 'p04', 'p05', 'p06', 'p07', 'p08', 'p09', 'p10', 'p11', 'p12', 'p13', 'p14'], false, 0.15, 0.35, 1.2);
const COURT = construire(['p01', 'p02', 'p03', 'p04', 'p06', 'p10', 'p11', 'p14'], true, 0.15, 0.3, 1.2);
export const TOTAL_ECO_COMPLET = COMPLET.total;
export const TOTAL_ECO_COURT = COURT.total;
// ---------- Habillage ----------
const Shot: React.FC<{dur: number; accent: string; chap: string; children: React.ReactNode; flash?: boolean}> = ({dur, accent, chap, children, flash}) => {
const fr = useCurrentFrame();
const wipe = interpolate(fr, [0, 9], [0, 1], {extrapolateRight: 'clamp', easing: Easing.bezier(0.7, 0, 0.2, 1)});
const zoom = interpolate(fr, [0, dur], [1, 1.03]);
return (
{children}
{chap}
{DATE}
{flash && }
);
};
/** Sous-titres mot à mot (repris d'ExempleVoix2) : groupes de 3 mots, mot prononcé surligné en jaune. */
const SousTitres: React.FC<{blocs: Bloc[]}> = ({blocs}) => {
const fr = useCurrentFrame();
for (const b of blocs) {
const ph = b.ph;
const t = (fr - b.audioFrom) / FPS_ECO;
if (t < 0 || t > ph.dur + 0.15) continue;
let cur = ph.mots.findIndex(([, s, e]) => t >= s && t < e);
if (cur < 0) cur = ph.mots.reduce((a, [, s], k) => (t >= s ? k : a), 0);
const g0 = Math.floor(cur / 3) * 3;
const groupe = ph.mots.slice(g0, g0 + 3);
return (
{groupe.map(([w, s], k) => (
= s ? C.ink : '#b5b5b5'}}>{w}
))}
);
}
return null;
};
const Montage: React.FC<{data: {blocs: Bloc[]; total: number}; musique: boolean}> = ({data, musique}) => {
const fr = useCurrentFrame();
const fade = f(1.5);
return (
{data.blocs.map((b, i) => (
{b.plans.map((p, j) => (
{p.sub.node}
))}
))}
{musique && (
0.09 * interpolate(x, [0, 6, data.total - fade, data.total], [0.6, 1, 1, 0], clamp)}
/>
)}
);
};
export const EcosystemeComplet: React.FC<{musique?: boolean}> = ({musique = true}) => ;
export const EcosystemeCourt: React.FC<{musique?: boolean}> = ({musique = true}) => ;