import { f as FlowGraphExecutionBlock } from './KHR_interactivity-BGk_Crki.esm.js';
import { 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 */
/**
 * This block flip flops between two outputs.
 */
class FlowGraphFlipFlopBlock extends FlowGraphExecutionBlock {
    constructor(config) {
        super(config);
        this.onOn = this._registerSignalOutput("onOn");
        this.onOff = this._registerSignalOutput("onOff");
        this.value = this.registerDataOutput("value", RichTypeBoolean);
    }
    _execute(context, _callingSignal) {
        let value = context._getExecutionVariable(this, "value", typeof this.config?.startValue === "boolean" ? !this.config.startValue : false);
        value = !value;
        context._setExecutionVariable(this, "value", value);
        this.value.setValue(value, context);
        if (value) {
            this.onOn._activateSignal(context);
        }
        else {
            this.onOff._activateSignal(context);
        }
    }
    /**
     * @returns class name of the block.
     */
    getClassName() {
        return "FlowGraphFlipFlopBlock" /* FlowGraphBlockNames.FlipFlop */;
    }
}
let _Registered = false;
/**
 * Register side effects for flowGraphFlipFlopBlock.
 * Safe to call multiple times; only the first call has an effect.
 */
function RegisterFlowGraphFlipFlopBlock() {
    if (_Registered) {
        return;
    }
    _Registered = true;
    RegisterClass("FlowGraphFlipFlopBlock" /* FlowGraphBlockNames.FlipFlop */, FlowGraphFlipFlopBlock);
}

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

export { FlowGraphFlipFlopBlock, RegisterFlowGraphFlipFlopBlock };
//# sourceMappingURL=flowGraphFlipFlopBlock-4PtOrqJo.esm.js.map
