<script setup lang="ts">
import {onMounted, onBeforeUnmount} from "vue";
import SoundWorkbench from "./Sound/SoundWorkbench.vue";
import {GlobalEvent} from "../lib/event";

// 🔧 关键修复：页面挂载时先清理所有可能残留的监听器
// 然后在卸载时再次清理，双重保险
onMounted(() => {
    const beforeCount = GlobalEvent.getListenerCount('soundPromptUpdated');
    GlobalEvent.removeAllListeners('soundPromptUpdated');
});

onBeforeUnmount(() => {
    setTimeout(() => {
        GlobalEvent.removeAllListeners('soundPromptUpdated');
    }, 0);
});
</script>

<template>
    <div class="w-full h-full">
        <SoundWorkbench />
    </div>
</template>

<style>
/* Remove global styles if they were specific to old layout */
@import "../assets/styles/elegant-theme.css";
</style>
