    <script>
        const display = document.getElementById('display');
        const logo = document.getElementById('logo');
        let currentInput = '';
        let isFrequencyActive = false;
        const radioScreen = document.getElementById('radio-screen');
        const flashingLight = document.getElementById('flashing-light');
        const frequencySound = document.getElementById('frequency-sound');
        const btnConnect = document.getElementById('btn-connect');
        const btnDisconnect = document.getElementById('btn-disconnect');
        const disconnectSound = document.getElementById('disconnect-sound');

        // FONCTION POUR METTRE A JOUR L'ETAT DES BOUTON
        function updateButtonStates() {
            const hasInput = currentInput.trim() !== '';
            btnConnect.disabled = !hasInput;
        }

        // FONCTION POUR BASCULER L'ETAT DE LA RADIO //
        function toggleRadio() {
            const isRadioOpen = radioScreen.style.display === 'block';
            if (isRadioOpen) {
                radioScreen.style.display = 'none';
                flashingLight.style.opacity = '0';
                flashingLight.style.display = 'none';
                document.body.style.cursor = 'default';
                fetch(`https://Slupix_radio/setFocus`, {
                    method: 'POST',
                    body: JSON.stringify({
                        focus: false
                    })
                });

            } else {
                radioScreen.style.display = 'block';
                flashingLight.style.opacity = '1';
                flashingLight.style.display = 'block';
                document.body.style.cursor = 'none';
                fetch(`https://Slupix_radio/setFocus`, {
                    method: 'POST',
                    body: JSON.stringify({
                        focus: true
                    })
                });
            }
        }

        window.addEventListener('message', function(event) {
            if (event.data.action === 'open') toggleRadio();
            if (event.data.action === 'close') toggleRadio();
        });

        // GESTION DE L'INTERACTION AVEC LES BOUTONS //
        document.querySelectorAll('.button').forEach(button => {
            button.addEventListener('click', () => {
                const value = button.getAttribute('data-value');
                if (value) {

                    if (currentInput.length < 5 && !(value === '.' && currentInput.includes('.'))) {
                        currentInput += value;
                    }
                } else if (button.id === 'btn-delete') {
                    currentInput = currentInput.slice(0, -1);
                }

                display.textContent = currentInput || '';

                logo.style.opacity = currentInput !== '' ? '0' : '1';

                updateButtonStates();
            });
        });

        // ACTION DES GESTION TOUCHE CLAVIER //
        document.addEventListener('keydown', function(event) {
            if (event.key === "Enter") {
                connectToFrequency();
            }
            if (event.key === "Escape") toggleRadio();
        });


        // FONCTION DE CONNEXION A LA FREQUENCE VOULU //
        function connectToFrequency() {
            const frequency = display.textContent;

            if (frequency) {
                if (!isFrequencyActive) {

                    frequencySound.play();
                    fetch(`https://Slupix_radio/connectFrequency`, {
                        method: 'POST',
                        body: JSON.stringify({
                            frequency
                        })
                    });

                    frequencySound.volume = 0.1;

                    isFrequencyActive = true;
                }
            }
            updateButtonStates();
        }


        // FONCTION DE DECONNEXION AVEC LE SON JOUER A LA DECONNEXION //
        function handleDisconnect() {

            if (isFrequencyActive) {
                disconnectSound.currentTime = 0;
                disconnectSound.play().catch(e => {
                    console.error("Erreur lors de la lecture du son de déconnexion : ", e);
                });
            }

            disconnectSound.volume = 0.1;

            isFrequencyActive = false;

            currentInput = '';
            display.textContent = '';

            fetch(`https://Slupix_radio/disconnectFrequency`, {
                method: 'POST'
            });

            logo.style.opacity = '1';

            updateButtonStates();
        }

        // ACTION DU BOUTON DE CONNEXION //
        btnConnect.addEventListener('click', () => {
            connectToFrequency();
        });

        // ACTION DU BOUTON DE DECONNEXION //
        btnDisconnect.addEventListener('click', () => {
            handleDisconnect();
        });

        // ACTION DU BOUTON DE FERMETURE //
        const btnClose = document.getElementById('btn-close');
        btnClose.addEventListener('click', () => {
            toggleRadio();
        });

        // DESACTIVE LES BOUTON AU DEMARAGE //
        updateButtonStates();
    </script>
