"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDefaultState = void 0;
var util_1 = require("@antv/util");
var constants_1 = require("./constants");
var getDefaultState = function (state) {
    if ((0, util_1.isUndefined)(state)) {
        return constants_1.DEFAULT_STATE;
    }
    if (state.active === false) {
        constants_1.DEFAULT_STATE.active = Object.assign(constants_1.DEFAULT_STATE.active, { fillColor: false, strokeColor: false });
    }
    else if (typeof state.active === 'object') {
        if (state.active.fillColor === false) {
            constants_1.DEFAULT_STATE.active.fillColor = false;
        }
        else if (typeof state.active.fillColor === 'string') {
            constants_1.DEFAULT_STATE.active.fillColor = state.active.fillColor;
        }
        if (state.active.strokeColor === false) {
            constants_1.DEFAULT_STATE.active.strokeColor = false;
        }
        else if (typeof state.active.strokeColor === 'string') {
            constants_1.DEFAULT_STATE.active.strokeColor = state.active.strokeColor;
        }
        if (typeof state.active.lineWidth === 'number') {
            constants_1.DEFAULT_STATE.active.lineWidth = state.active.lineWidth;
        }
        if (typeof state.active.lineOpacity === 'number') {
            constants_1.DEFAULT_STATE.active.lineOpacity = state.active.lineOpacity;
        }
    }
    if (state.select === false) {
        constants_1.DEFAULT_STATE.select = Object.assign(constants_1.DEFAULT_STATE.select, { fillColor: false, strokeColor: false });
    }
    else if (typeof state.select === 'object') {
        if (state.select.fillColor === false) {
            constants_1.DEFAULT_STATE.select.fillColor = false;
        }
        else if (typeof state.select.fillColor === 'string') {
            constants_1.DEFAULT_STATE.select.fillColor = state.select.fillColor;
        }
        if (state.select.strokeColor === false) {
            constants_1.DEFAULT_STATE.select.strokeColor = false;
        }
        else if (typeof state.select.strokeColor === 'string') {
            constants_1.DEFAULT_STATE.select.strokeColor = state.select.strokeColor;
        }
        if (typeof state.select.lineWidth === 'number') {
            constants_1.DEFAULT_STATE.select.lineWidth = state.select.lineWidth;
        }
        if (typeof state.select.lineOpacity === 'number') {
            constants_1.DEFAULT_STATE.select.lineOpacity = state.select.lineOpacity;
        }
    }
    return constants_1.DEFAULT_STATE;
};
exports.getDefaultState = getDefaultState;
//# sourceMappingURL=adaptor.js.map