// Tweaks panel: aligned to new config shape (lots array, titleFont). function TweaksPanel({ config, setConfig, tweakDefaults }) { const [active, setActive] = React.useState(false); const [open, setOpen] = React.useState(true); React.useEffect(() => { const onMsg = (e) => { const d = e.data || {}; if (d.type === '__activate_edit_mode') setActive(true); if (d.type === '__deactivate_edit_mode') setActive(false); }; window.addEventListener('message', onMsg); window.parent.postMessage({ type: '__edit_mode_available' }, '*'); return () => window.removeEventListener('message', onMsg); }, []); if (!active) return null; const update = (patch) => { const next = { ...config, ...patch }; setConfig(next); const keys = {}; for (const k of Object.keys(patch)) keys[k] = next[k]; window.parent.postMessage({ type: '__edit_mode_set_keys', edits: keys }, '*'); }; const updateLot = (idx, field, value) => { const lots = config.lots.map((l, i) => i === idx ? { ...l, [field]: field === 'preco' ? (Number(value) || 0) : value } : l ); update({ lots }); }; const addLot = () => { const last = config.lots[config.lots.length - 1]; const newStart = last ? last.fim : '2026-04-20T00:00:00'; update({ lots: [...config.lots, { ini: newStart, fim: newStart, preco: last ? last.preco + 10 : 19, }] }); }; const removeLot = () => { if (config.lots.length > 1) update({ lots: config.lots.slice(0, -1) }); }; return (