import Instruction from '../instruction.js';
export default class Symbol extends Instruction {
    constructor(x, y) {
        super();
        Object.defineProperty(this, "x", {
            enumerable: true,
            configurable: true,
            writable: true,
            value: x
        });
        Object.defineProperty(this, "y", {
            enumerable: true,
            configurable: true,
            writable: true,
            value: y
        });
        this.x = x;
        this.y = y;
    }
    onGridResize(_grid, mode, direction, index) {
        if (mode === 'insert') {
            return this.copyWith({
                x: direction === 'column' && this.x >= index ? this.x + 1 : this.x,
                y: direction === 'row' && this.y >= index ? this.y + 1 : this.y,
            });
        }
        else {
            if (direction === 'column' && this.x === index)
                return null;
            if (direction === 'row' && this.y === index)
                return null;
            return this.copyWith({
                x: direction === 'column' && this.x > index ? this.x - 1 : this.x,
                y: direction === 'row' && this.y > index ? this.y - 1 : this.y,
            });
        }
    }
    get placementStep() {
        return 0.5;
    }
    withX(x) {
        return this.copyWith({ x });
    }
    withY(y) {
        return this.copyWith({ y });
    }
    withPosition(x, y) {
        return this.copyWith({ x, y });
    }
}
export const instance = undefined;
