import { aR as ExponentialEase, aS as ElasticEase, aT as CubicEase, aU as BounceEase, aV as BackEase, aW as CircleEase, aX as BezierCurveEase, R as RegisterClass } from './index-CxR0Yf_7.js';
import { F as FlowGraphBlock } from './KHR_interactivity-BPhVhH5L.js';
import { R as RichTypeAny, b as RichTypeNumber } from './declarationMapper-eK_q7dJF.js';
import './index-BvBk1Iap.js';
import './objectModelMapping-DnUo8NMz.js';

/**
 * The type of the easing function.
 */
var EasingFunctionType;
(function (EasingFunctionType) {
    EasingFunctionType[EasingFunctionType["CircleEase"] = 0] = "CircleEase";
    EasingFunctionType[EasingFunctionType["BackEase"] = 1] = "BackEase";
    EasingFunctionType[EasingFunctionType["BounceEase"] = 2] = "BounceEase";
    EasingFunctionType[EasingFunctionType["CubicEase"] = 3] = "CubicEase";
    EasingFunctionType[EasingFunctionType["ElasticEase"] = 4] = "ElasticEase";
    EasingFunctionType[EasingFunctionType["ExponentialEase"] = 5] = "ExponentialEase";
    EasingFunctionType[EasingFunctionType["PowerEase"] = 6] = "PowerEase";
    EasingFunctionType[EasingFunctionType["QuadraticEase"] = 7] = "QuadraticEase";
    EasingFunctionType[EasingFunctionType["QuarticEase"] = 8] = "QuarticEase";
    EasingFunctionType[EasingFunctionType["QuinticEase"] = 9] = "QuinticEase";
    EasingFunctionType[EasingFunctionType["SineEase"] = 10] = "SineEase";
    EasingFunctionType[EasingFunctionType["BezierCurveEase"] = 11] = "BezierCurveEase";
})(EasingFunctionType || (EasingFunctionType = {}));
/**
 * @internal
 * Creates an easing function object based on the type and parameters provided.
 * This is not tree-shaking friendly, so if you need cubic bezier, use the dedicated bezier block.
 * @param type The type of the easing function.
 * @param controlPoint1 The first control point for the bezier curve.
 * @param controlPoint2 The second control point for the bezier curve.
 * @returns The easing function object.
 */
function CreateEasingFunction(type, ...parameters) {
    switch (type) {
        case 11 /* EasingFunctionType.BezierCurveEase */:
            return new BezierCurveEase(...parameters);
        case 0 /* EasingFunctionType.CircleEase */:
            return new CircleEase();
        case 1 /* EasingFunctionType.BackEase */:
            return new BackEase(...parameters);
        case 2 /* EasingFunctionType.BounceEase */:
            return new BounceEase(...parameters);
        case 3 /* EasingFunctionType.CubicEase */:
            return new CubicEase();
        case 4 /* EasingFunctionType.ElasticEase */:
            return new ElasticEase(...parameters);
        case 5 /* EasingFunctionType.ExponentialEase */:
            return new ExponentialEase(...parameters);
        default:
            throw new Error("Easing type not yet implemented");
    }
}
/**
 * An easing block that generates an easingFunction object based on the data provided.
 */
class FlowGraphEasingBlock extends FlowGraphBlock {
    constructor(
    /**
     * the configuration of the block
     */
    config) {
        super(config);
        this.config = config;
        /**
         * Internal cache of reusable easing functions.
         * key is type-mode-properties
         */
        this._easingFunctions = {};
        this.type = this.registerDataInput("type", RichTypeAny, 11);
        this.mode = this.registerDataInput("mode", RichTypeNumber, 0);
        this.parameters = this.registerDataInput("parameters", RichTypeAny, [1, 0, 0, 1]);
        this.easingFunction = this.registerDataOutput("easingFunction", RichTypeAny);
    }
    _updateOutputs(context) {
        const type = this.type.getValue(context);
        const mode = this.mode.getValue(context);
        const parameters = this.parameters.getValue(context);
        if (type === undefined || mode === undefined) {
            return;
        }
        const key = `${type}-${mode}-${parameters.join("-")}`;
        if (!this._easingFunctions[key]) {
            const easing = CreateEasingFunction(type, ...parameters);
            easing.setEasingMode(mode);
            this._easingFunctions[key] = easing;
        }
        this.easingFunction.setValue(this._easingFunctions[key], context);
    }
    getClassName() {
        return "FlowGraphEasingBlock" /* FlowGraphBlockNames.Easing */;
    }
}
RegisterClass("FlowGraphEasingBlock" /* FlowGraphBlockNames.Easing */, FlowGraphEasingBlock);

export { EasingFunctionType, FlowGraphEasingBlock };
//# sourceMappingURL=flowGraphEasingBlock-DPpBHrfT.js.map
