import { c as FlowGraphExecutionBlockWithOutSignal } from './KHR_interactivity-BGk_Crki.esm.js';
import { R as RichTypeAny, d as RichTypeNumber, b as RichTypeBoolean } from './declarationMapper-CyxdrUFP.esm.js';
import { R as RegisterClass } from './index-BvJBnIUK.esm.js';
import './objectModelMapping-BtiDAwYm.esm.js';

/** This file must only contain pure code and pure imports */
/**
 * @experimental
 * A block that plays an Audio V2 sound.
 */
class FlowGraphPlaySoundBlock extends FlowGraphExecutionBlockWithOutSignal {
    /**
     * Constructs a new FlowGraphPlaySoundBlock.
     * @param config - optional configuration for the block
     */
    constructor(config) {
        super(config);
        this.sound = this.registerDataInput("sound", RichTypeAny);
        this.volume = this.registerDataInput("volume", RichTypeNumber, 1);
        this.startOffset = this.registerDataInput("startOffset", RichTypeNumber, 0);
        this.loop = this.registerDataInput("loop", RichTypeBoolean, false);
    }
    /**
     * @internal
     */
    _execute(context, _callingSignal) {
        const soundValue = this.sound.getValue(context);
        if (!soundValue) {
            this._reportError(context, "No sound provided");
            this.out._activateSignal(context);
            return;
        }
        const vol = this.volume.getValue(context);
        const offset = this.startOffset.getValue(context);
        const loopVal = this.loop.getValue(context);
        soundValue.play({ volume: vol, startOffset: offset, loop: loopVal });
        this.out._activateSignal(context);
    }
    /**
     * @returns class name of the block.
     */
    getClassName() {
        return "FlowGraphPlaySoundBlock" /* FlowGraphBlockNames.AudioPlaySound */;
    }
}
let _Registered = false;
/**
 * Register side effects for flowGraphPlaySoundBlock.
 * Safe to call multiple times; only the first call has an effect.
 */
function RegisterFlowGraphPlaySoundBlock() {
    if (_Registered) {
        return;
    }
    _Registered = true;
    RegisterClass("FlowGraphPlaySoundBlock" /* FlowGraphBlockNames.AudioPlaySound */, FlowGraphPlaySoundBlock);
}

/**
 * Re-exports pure implementation and applies runtime side effects.
 * Import flowGraphPlaySoundBlock.pure for tree-shakeable, side-effect-free usage.
 */
RegisterFlowGraphPlaySoundBlock();

export { FlowGraphPlaySoundBlock, RegisterFlowGraphPlaySoundBlock };
//# sourceMappingURL=flowGraphPlaySoundBlock-BOx1crIC.esm.js.map
