import { b as FlowGraphExecutionBlockWithOutSignal } from './KHR_interactivity-VqtS29i9.esm.js';
import { R as RichTypeAny } from './declarationMapper-CZ6AxirO.esm.js';
import { f as RegisterClass } from './index-Cl9U4nB-.esm.js';
import './objectModelMapping-ghOGfUOh.esm.js';

/**
 * @experimental
 * A block that pauses an Audio V2 sound. If the sound is already paused, resumes it.
 */
class FlowGraphPauseSoundBlock extends FlowGraphExecutionBlockWithOutSignal {
    /**
     * Constructs a new FlowGraphPauseSoundBlock.
     * @param config - optional configuration for the block
     */
    constructor(config) {
        super(config);
        this.sound = this.registerDataInput("sound", RichTypeAny);
    }
    /**
     * @internal
     */
    _execute(context, _callingSignal) {
        const soundValue = this.sound.getValue(context);
        if (!soundValue) {
            this._reportError(context, "No sound provided");
            this.out._activateSignal(context);
            return;
        }
        if (soundValue.state === 5 /* SoundState.Paused */) {
            soundValue.resume();
        }
        else if (soundValue.state === 2 /* SoundState.Starting */ || soundValue.state === 3 /* SoundState.Started */) {
            soundValue.pause();
        }
        this.out._activateSignal(context);
    }
    /**
     * @returns class name of the block.
     */
    getClassName() {
        return "FlowGraphPauseSoundBlock" /* FlowGraphBlockNames.AudioPauseSound */;
    }
}
RegisterClass("FlowGraphPauseSoundBlock" /* FlowGraphBlockNames.AudioPauseSound */, FlowGraphPauseSoundBlock);

export { FlowGraphPauseSoundBlock };
//# sourceMappingURL=flowGraphPauseSoundBlock-CGkOGmmd.esm.js.map
