import React, {useEffect, useId, useRef, useState} from 'react'; import {ArrowDownRight, ArrowRight, ChevronDown, ChevronUp, Flame, Pause, Play, RotateCcw, Sun, Volume2, VolumeX, Zap} from 'lucide-react'; import './intro.css'; function EnergyField() { const uid=useId().replaceAll(':',''); return ; } export default function EnergyIntro({active=true,onStart}) { const [expanded,setExpanded]=useState(true); const [motionPaused,setMotionPaused]=useState(()=>typeof window!=='undefined'&&window.matchMedia('(prefers-reduced-motion: reduce)').matches); const [visible,setVisible]=useState(true),[pageVisible,setPageVisible]=useState(()=>typeof document==='undefined'||!document.hidden); const [playing,setPlaying]=useState(false),[muted,setMuted]=useState(true),[ended,setEnded]=useState(false),[progress,setProgress]=useState(0),[mediaError,setMediaError]=useState(''); const root=useRef(null), video=useRef(null), resumeVideo=useRef(false), showControl=useRef(null), hideControl=useRef(null); const moving=active&&expanded&&visible&&pageVisible&&!motionPaused; useEffect(()=>{ const preference=window.matchMedia('(prefers-reduced-motion: reduce)'); const reduce=event=>{if(event.matches){setMotionPaused(true);video.current?.pause();resumeVideo.current=false;}}; preference.addEventListener('change',reduce); const visibility=()=>{setPageVisible(!document.hidden);if(document.hidden){video.current?.pause();resumeVideo.current=false;}}; document.addEventListener('visibilitychange',visibility); return()=>{preference.removeEventListener('change',reduce);document.removeEventListener('visibilitychange',visibility);}; },[]); useEffect(()=>{ if(!root.current||!('IntersectionObserver' in window))return; const observer=new IntersectionObserver(([entry])=>{setVisible(entry.isIntersecting);if(!entry.isIntersecting){video.current?.pause();resumeVideo.current=false;}},{threshold:.08}); observer.observe(root.current);return()=>observer.disconnect(); },[expanded]); useEffect(()=>{if(!active||!expanded){video.current?.pause();resumeVideo.current=false;}},[active,expanded]); const playFilm=async()=>{ if(!video.current)return; setMediaError('');setMotionPaused(false); if(video.current.ended)video.current.currentTime=0; try {await video.current.play();} catch {setMediaError('Playback is unavailable. You can still start your analysis.');} }; const toggleFilm=()=>{if(playing)video.current?.pause();else playFilm();}; const toggleMotion=()=>{ if(!motionPaused){resumeVideo.current=!!video.current&&!video.current.paused;video.current?.pause();setMotionPaused(true);} else {setMotionPaused(false);if(resumeVideo.current){resumeVideo.current=false;playFilm();}} }; const collapse=(restoreFocus=true)=>{video.current?.pause();resumeVideo.current=false;setPlaying(false);setEnded(false);setProgress(0);setMediaError('');setExpanded(false);if(restoreFocus)requestAnimationFrame(()=>showControl.current?.focus({preventScroll:true}));}; const expand=()=>{setExpanded(true);requestAnimationFrame(()=>hideControl.current?.focus({preventScroll:true}));}; const start=()=>{collapse(false);onStart?.();}; const replay=()=>{if(video.current)video.current.currentTime=0;setEnded(false);setProgress(0);playFilm();}; if(!expanded)return
Right to Energy.Fair bills. Fair returns.
; return
XENOWATTZ PRESENTS / RIGHT TO ENERGY

FOR HOUSEHOLDS. NGOs. SMALL BUSINESSES.

Right to
Energy.

Fair bills. Fair returns.

What you pay. What your roof earns. Put supplier prices, network costs, policy charges and taxes under scrutiny.

Electricity tools live now. Your data. A fresh forecast.

MEET BHOR BOHRTHE INTRO / 10 SEC
{!playing&&}
“

Even Bhor Bohr has bills to pay.

BHOR BOHR
RESIDENT ENERGY REBEL
{mediaError&&

{mediaError}

}
AFFORDABILITY. ACCOUNTABILITY. BALANCE.
; }