import { ComponentTypeEnum } from "../../interface/type";

import { cartesianCoordinateLayout, getMarkPointProcessInfo, positionLayout, xyLayout } from "../utils";

import { registerMarkPointAnimate } from "@visactor/vrender-components";

import { isValid } from "@visactor/vutils";

import { Factory } from "../../../core/factory";

import { BaseMarkPoint } from "./base-mark-point";

import { markPoint } from "../../../theme/builtin/common/component/mark-point";

export class CartesianMarkPoint extends BaseMarkPoint {
    constructor() {
        super(...arguments), this.type = ComponentTypeEnum.markPoint, this.name = ComponentTypeEnum.markPoint, 
        this.coordinateType = "cartesian";
    }
    _computePointsAttr() {
        var _a;
        const spec = this._spec, data = this._markerData, relativeSeries = this._relativeSeries, isXYLayout = isValid(spec.x) && isValid(spec.y), isCoordinateLayout = isValid(spec.coordinate), isPositionLayout = isValid(spec.position), autoRange = null !== (_a = null == spec ? void 0 : spec.autoRange) && void 0 !== _a && _a;
        let point;
        return isXYLayout ? point = xyLayout(data, relativeSeries, relativeSeries, relativeSeries, autoRange)[0][0] : isCoordinateLayout ? point = cartesianCoordinateLayout(data, relativeSeries, autoRange, spec.coordinatesOffset)[0] : isPositionLayout && (point = positionLayout(spec.position, relativeSeries, spec.regionRelative)[0]), 
        {
            point: point
        };
    }
    _computeOptions() {
        const spec = this._spec, {doXYProcess: doXYProcess} = getMarkPointProcessInfo(spec), isCoordinateProcess = isValid(spec.coordinate);
        let options;
        return doXYProcess ? options = [ this._processSpecByDims([ {
            dim: "x",
            specValue: spec.x
        }, {
            dim: "y",
            specValue: spec.y
        } ]) ] : isCoordinateProcess && (options = this._processSpecCoo(spec)), {
            options: options
        };
    }
}

CartesianMarkPoint.type = ComponentTypeEnum.markPoint, CartesianMarkPoint.coordinateType = "cartesian", 
CartesianMarkPoint.builtInTheme = {
    markPoint: markPoint
};

export const registerMarkPoint = () => {
    Factory.registerComponent(CartesianMarkPoint.type, CartesianMarkPoint), registerMarkPointAnimate();
};
//# sourceMappingURL=cartesian-mark-point.js.map
