/**
 * DevExtreme (esm/__internal/ui/drawer/m_drawer.animation.js)
 * Version: 23.2.9 (build 24294-0112)
 * Build date: Sun Oct 20 2024
 *
 * Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED
 * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
 */
import fx from "../../../animation/fx";
import {
    camelize
} from "../../../core/utils/inflector";
export var animation = {
    moveTo(config) {
        var {
            $element: $element
        } = config;
        var {
            position: position
        } = config;
        var direction = config.direction || "left";
        var toConfig = {};
        var animationType;
        switch (direction) {
            case "right":
                toConfig.transform = "translate(".concat(position, "px, 0px)");
                animationType = "custom";
                break;
            case "left":
                toConfig.left = position;
                animationType = "slide";
                break;
            case "top":
            case "bottom":
                toConfig.top = position;
                animationType = "slide"
        }
        fx.animate($element, {
            type: animationType,
            to: toConfig,
            duration: config.duration,
            complete: config.complete
        })
    },
    margin(config) {
        var {
            $element: $element
        } = config;
        var {
            margin: margin
        } = config;
        var direction = config.direction || "left";
        var toConfig = {};
        toConfig["margin".concat(camelize(direction, true))] = margin;
        fx.animate($element, {
            to: toConfig,
            duration: config.duration,
            complete: config.complete
        })
    },
    fade($element, config, duration, completeAction) {
        fx.animate($element, {
            type: "fade",
            to: config.to,
            from: config.from,
            duration: duration,
            complete: completeAction
        })
    },
    size(config) {
        var {
            $element: $element
        } = config;
        var {
            size: size
        } = config;
        var direction = config.direction || "left";
        var marginTop = config.marginTop || 0;
        var {
            duration: duration
        } = config;
        var toConfig = {};
        if ("right" === direction || "left" === direction) {
            toConfig.width = size
        } else {
            toConfig.height = size
        }
        if ("bottom" === direction) {
            toConfig.marginTop = marginTop
        }
        fx.animate($element, {
            to: toConfig,
            duration: duration,
            complete: config.complete
        })
    },
    complete($element) {
        fx.stop($element, true)
    }
};
