// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
//   protoc-gen-ts_proto  v2.10.1
//   protoc               v3.21.12
// source: common.proto
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
export const protobufPackage = "dai.proto.common";
export var CameraModel;
(function (CameraModel) {
    CameraModel[CameraModel["PERSPECTIVE"] = 0] = "PERSPECTIVE";
    CameraModel[CameraModel["FISHEYE"] = 1] = "FISHEYE";
    CameraModel[CameraModel["EQUIRECTANGULAR"] = 2] = "EQUIRECTANGULAR";
    CameraModel[CameraModel["RADIALDIVISION"] = 3] = "RADIALDIVISION";
    CameraModel[CameraModel["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(CameraModel || (CameraModel = {}));
export function cameraModelFromJSON(object) {
    switch (object) {
        case 0:
        case "PERSPECTIVE":
            return CameraModel.PERSPECTIVE;
        case 1:
        case "FISHEYE":
            return CameraModel.FISHEYE;
        case 2:
        case "EQUIRECTANGULAR":
            return CameraModel.EQUIRECTANGULAR;
        case 3:
        case "RADIALDIVISION":
            return CameraModel.RADIALDIVISION;
        case -1:
        case "UNRECOGNIZED":
        default:
            return CameraModel.UNRECOGNIZED;
    }
}
export function cameraModelToJSON(object) {
    switch (object) {
        case CameraModel.PERSPECTIVE:
            return "PERSPECTIVE";
        case CameraModel.FISHEYE:
            return "FISHEYE";
        case CameraModel.EQUIRECTANGULAR:
            return "EQUIRECTANGULAR";
        case CameraModel.RADIALDIVISION:
            return "RADIALDIVISION";
        case CameraModel.UNRECOGNIZED:
        default:
            return "UNRECOGNIZED";
    }
}
function createBaseTimestamp() {
    return { sec: 0, nsec: 0 };
}
export const Timestamp = {
    encode(message, writer = new BinaryWriter()) {
        if (message.sec !== 0) {
            writer.uint32(8).int64(message.sec);
        }
        if (message.nsec !== 0) {
            writer.uint32(16).int64(message.nsec);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseTimestamp();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 8) {
                        break;
                    }
                    message.sec = longToNumber(reader.int64());
                    continue;
                }
                case 2: {
                    if (tag !== 16) {
                        break;
                    }
                    message.nsec = longToNumber(reader.int64());
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            sec: isSet(object.sec) ? globalThis.Number(object.sec) : 0,
            nsec: isSet(object.nsec) ? globalThis.Number(object.nsec) : 0,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.sec !== 0) {
            obj.sec = Math.round(message.sec);
        }
        if (message.nsec !== 0) {
            obj.nsec = Math.round(message.nsec);
        }
        return obj;
    },
    create(base) {
        return Timestamp.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseTimestamp();
        message.sec = object.sec ?? 0;
        message.nsec = object.nsec ?? 0;
        return message;
    },
};
function createBaseCameraSettings() {
    return { exposureTimeUs: 0, sensitivityIso: 0, lensPosition: 0, wbColorTemp: 0, lensPositionRaw: 0 };
}
export const CameraSettings = {
    encode(message, writer = new BinaryWriter()) {
        if (message.exposureTimeUs !== 0) {
            writer.uint32(8).int32(message.exposureTimeUs);
        }
        if (message.sensitivityIso !== 0) {
            writer.uint32(16).int32(message.sensitivityIso);
        }
        if (message.lensPosition !== 0) {
            writer.uint32(24).int32(message.lensPosition);
        }
        if (message.wbColorTemp !== 0) {
            writer.uint32(32).int32(message.wbColorTemp);
        }
        if (message.lensPositionRaw !== 0) {
            writer.uint32(45).float(message.lensPositionRaw);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseCameraSettings();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 8) {
                        break;
                    }
                    message.exposureTimeUs = reader.int32();
                    continue;
                }
                case 2: {
                    if (tag !== 16) {
                        break;
                    }
                    message.sensitivityIso = reader.int32();
                    continue;
                }
                case 3: {
                    if (tag !== 24) {
                        break;
                    }
                    message.lensPosition = reader.int32();
                    continue;
                }
                case 4: {
                    if (tag !== 32) {
                        break;
                    }
                    message.wbColorTemp = reader.int32();
                    continue;
                }
                case 5: {
                    if (tag !== 45) {
                        break;
                    }
                    message.lensPositionRaw = reader.float();
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            exposureTimeUs: isSet(object.exposureTimeUs) ? globalThis.Number(object.exposureTimeUs) : 0,
            sensitivityIso: isSet(object.sensitivityIso) ? globalThis.Number(object.sensitivityIso) : 0,
            lensPosition: isSet(object.lensPosition) ? globalThis.Number(object.lensPosition) : 0,
            wbColorTemp: isSet(object.wbColorTemp) ? globalThis.Number(object.wbColorTemp) : 0,
            lensPositionRaw: isSet(object.lensPositionRaw) ? globalThis.Number(object.lensPositionRaw) : 0,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.exposureTimeUs !== 0) {
            obj.exposureTimeUs = Math.round(message.exposureTimeUs);
        }
        if (message.sensitivityIso !== 0) {
            obj.sensitivityIso = Math.round(message.sensitivityIso);
        }
        if (message.lensPosition !== 0) {
            obj.lensPosition = Math.round(message.lensPosition);
        }
        if (message.wbColorTemp !== 0) {
            obj.wbColorTemp = Math.round(message.wbColorTemp);
        }
        if (message.lensPositionRaw !== 0) {
            obj.lensPositionRaw = message.lensPositionRaw;
        }
        return obj;
    },
    create(base) {
        return CameraSettings.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseCameraSettings();
        message.exposureTimeUs = object.exposureTimeUs ?? 0;
        message.sensitivityIso = object.sensitivityIso ?? 0;
        message.lensPosition = object.lensPosition ?? 0;
        message.wbColorTemp = object.wbColorTemp ?? 0;
        message.lensPositionRaw = object.lensPositionRaw ?? 0;
        return message;
    },
};
function createBaseImgTransformation() {
    return {
        transformationMatrix: undefined,
        sourceIntrinsicMatrix: undefined,
        distortionModel: 0,
        distortionCoefficients: undefined,
        srcWidth: 0,
        srcHeight: 0,
        width: 0,
        height: 0,
    };
}
export const ImgTransformation = {
    encode(message, writer = new BinaryWriter()) {
        if (message.transformationMatrix !== undefined) {
            TransformationMatrix.encode(message.transformationMatrix, writer.uint32(10).fork()).join();
        }
        if (message.sourceIntrinsicMatrix !== undefined) {
            TransformationMatrix.encode(message.sourceIntrinsicMatrix, writer.uint32(18).fork()).join();
        }
        if (message.distortionModel !== 0) {
            writer.uint32(24).int32(message.distortionModel);
        }
        if (message.distortionCoefficients !== undefined) {
            FloatArray.encode(message.distortionCoefficients, writer.uint32(34).fork()).join();
        }
        if (message.srcWidth !== 0) {
            writer.uint32(40).uint32(message.srcWidth);
        }
        if (message.srcHeight !== 0) {
            writer.uint32(48).uint32(message.srcHeight);
        }
        if (message.width !== 0) {
            writer.uint32(56).uint32(message.width);
        }
        if (message.height !== 0) {
            writer.uint32(64).uint32(message.height);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseImgTransformation();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.transformationMatrix = TransformationMatrix.decode(reader, reader.uint32());
                    continue;
                }
                case 2: {
                    if (tag !== 18) {
                        break;
                    }
                    message.sourceIntrinsicMatrix = TransformationMatrix.decode(reader, reader.uint32());
                    continue;
                }
                case 3: {
                    if (tag !== 24) {
                        break;
                    }
                    message.distortionModel = reader.int32();
                    continue;
                }
                case 4: {
                    if (tag !== 34) {
                        break;
                    }
                    message.distortionCoefficients = FloatArray.decode(reader, reader.uint32());
                    continue;
                }
                case 5: {
                    if (tag !== 40) {
                        break;
                    }
                    message.srcWidth = reader.uint32();
                    continue;
                }
                case 6: {
                    if (tag !== 48) {
                        break;
                    }
                    message.srcHeight = reader.uint32();
                    continue;
                }
                case 7: {
                    if (tag !== 56) {
                        break;
                    }
                    message.width = reader.uint32();
                    continue;
                }
                case 8: {
                    if (tag !== 64) {
                        break;
                    }
                    message.height = reader.uint32();
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            transformationMatrix: isSet(object.transformationMatrix)
                ? TransformationMatrix.fromJSON(object.transformationMatrix)
                : undefined,
            sourceIntrinsicMatrix: isSet(object.sourceIntrinsicMatrix)
                ? TransformationMatrix.fromJSON(object.sourceIntrinsicMatrix)
                : undefined,
            distortionModel: isSet(object.distortionModel) ? cameraModelFromJSON(object.distortionModel) : 0,
            distortionCoefficients: isSet(object.distortionCoefficients)
                ? FloatArray.fromJSON(object.distortionCoefficients)
                : undefined,
            srcWidth: isSet(object.srcWidth) ? globalThis.Number(object.srcWidth) : 0,
            srcHeight: isSet(object.srcHeight) ? globalThis.Number(object.srcHeight) : 0,
            width: isSet(object.width) ? globalThis.Number(object.width) : 0,
            height: isSet(object.height) ? globalThis.Number(object.height) : 0,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.transformationMatrix !== undefined) {
            obj.transformationMatrix = TransformationMatrix.toJSON(message.transformationMatrix);
        }
        if (message.sourceIntrinsicMatrix !== undefined) {
            obj.sourceIntrinsicMatrix = TransformationMatrix.toJSON(message.sourceIntrinsicMatrix);
        }
        if (message.distortionModel !== 0) {
            obj.distortionModel = cameraModelToJSON(message.distortionModel);
        }
        if (message.distortionCoefficients !== undefined) {
            obj.distortionCoefficients = FloatArray.toJSON(message.distortionCoefficients);
        }
        if (message.srcWidth !== 0) {
            obj.srcWidth = Math.round(message.srcWidth);
        }
        if (message.srcHeight !== 0) {
            obj.srcHeight = Math.round(message.srcHeight);
        }
        if (message.width !== 0) {
            obj.width = Math.round(message.width);
        }
        if (message.height !== 0) {
            obj.height = Math.round(message.height);
        }
        return obj;
    },
    create(base) {
        return ImgTransformation.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseImgTransformation();
        message.transformationMatrix = (object.transformationMatrix !== undefined && object.transformationMatrix !== null)
            ? TransformationMatrix.fromPartial(object.transformationMatrix)
            : undefined;
        message.sourceIntrinsicMatrix =
            (object.sourceIntrinsicMatrix !== undefined && object.sourceIntrinsicMatrix !== null)
                ? TransformationMatrix.fromPartial(object.sourceIntrinsicMatrix)
                : undefined;
        message.distortionModel = object.distortionModel ?? 0;
        message.distortionCoefficients =
            (object.distortionCoefficients !== undefined && object.distortionCoefficients !== null)
                ? FloatArray.fromPartial(object.distortionCoefficients)
                : undefined;
        message.srcWidth = object.srcWidth ?? 0;
        message.srcHeight = object.srcHeight ?? 0;
        message.width = object.width ?? 0;
        message.height = object.height ?? 0;
        return message;
    },
};
function createBaseTransformationMatrix() {
    return { arrays: [] };
}
export const TransformationMatrix = {
    encode(message, writer = new BinaryWriter()) {
        for (const v of message.arrays) {
            FloatArray.encode(v, writer.uint32(10).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseTransformationMatrix();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.arrays.push(FloatArray.decode(reader, reader.uint32()));
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            arrays: globalThis.Array.isArray(object?.arrays) ? object.arrays.map((e) => FloatArray.fromJSON(e)) : [],
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.arrays?.length) {
            obj.arrays = message.arrays.map((e) => FloatArray.toJSON(e));
        }
        return obj;
    },
    create(base) {
        return TransformationMatrix.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseTransformationMatrix();
        message.arrays = object.arrays?.map((e) => FloatArray.fromPartial(e)) || [];
        return message;
    },
};
function createBaseFloatArray() {
    return { values: [] };
}
export const FloatArray = {
    encode(message, writer = new BinaryWriter()) {
        writer.uint32(10).fork();
        for (const v of message.values) {
            writer.float(v);
        }
        writer.join();
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseFloatArray();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag === 13) {
                        message.values.push(reader.float());
                        continue;
                    }
                    if (tag === 10) {
                        const end2 = reader.uint32() + reader.pos;
                        while (reader.pos < end2) {
                            message.values.push(reader.float());
                        }
                        continue;
                    }
                    break;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            values: globalThis.Array.isArray(object?.values) ? object.values.map((e) => globalThis.Number(e)) : [],
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.values?.length) {
            obj.values = message.values;
        }
        return obj;
    },
    create(base) {
        return FloatArray.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseFloatArray();
        message.values = object.values?.map((e) => e) || [];
        return message;
    },
};
function createBaseColor() {
    return { r: 0, g: 0, b: 0, a: 0 };
}
export const Color = {
    encode(message, writer = new BinaryWriter()) {
        if (message.r !== 0) {
            writer.uint32(13).float(message.r);
        }
        if (message.g !== 0) {
            writer.uint32(21).float(message.g);
        }
        if (message.b !== 0) {
            writer.uint32(29).float(message.b);
        }
        if (message.a !== 0) {
            writer.uint32(37).float(message.a);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseColor();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 13) {
                        break;
                    }
                    message.r = reader.float();
                    continue;
                }
                case 2: {
                    if (tag !== 21) {
                        break;
                    }
                    message.g = reader.float();
                    continue;
                }
                case 3: {
                    if (tag !== 29) {
                        break;
                    }
                    message.b = reader.float();
                    continue;
                }
                case 4: {
                    if (tag !== 37) {
                        break;
                    }
                    message.a = reader.float();
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            r: isSet(object.r) ? globalThis.Number(object.r) : 0,
            g: isSet(object.g) ? globalThis.Number(object.g) : 0,
            b: isSet(object.b) ? globalThis.Number(object.b) : 0,
            a: isSet(object.a) ? globalThis.Number(object.a) : 0,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.r !== 0) {
            obj.r = message.r;
        }
        if (message.g !== 0) {
            obj.g = message.g;
        }
        if (message.b !== 0) {
            obj.b = message.b;
        }
        if (message.a !== 0) {
            obj.a = message.a;
        }
        return obj;
    },
    create(base) {
        return Color.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseColor();
        message.r = object.r ?? 0;
        message.g = object.g ?? 0;
        message.b = object.b ?? 0;
        message.a = object.a ?? 0;
        return message;
    },
};
function createBasePoint2f() {
    return { x: 0, y: 0 };
}
export const Point2f = {
    encode(message, writer = new BinaryWriter()) {
        if (message.x !== 0) {
            writer.uint32(13).float(message.x);
        }
        if (message.y !== 0) {
            writer.uint32(21).float(message.y);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBasePoint2f();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 13) {
                        break;
                    }
                    message.x = reader.float();
                    continue;
                }
                case 2: {
                    if (tag !== 21) {
                        break;
                    }
                    message.y = reader.float();
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            x: isSet(object.x) ? globalThis.Number(object.x) : 0,
            y: isSet(object.y) ? globalThis.Number(object.y) : 0,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.x !== 0) {
            obj.x = message.x;
        }
        if (message.y !== 0) {
            obj.y = message.y;
        }
        return obj;
    },
    create(base) {
        return Point2f.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBasePoint2f();
        message.x = object.x ?? 0;
        message.y = object.y ?? 0;
        return message;
    },
};
function createBasePoint3f() {
    return { x: 0, y: 0, z: 0 };
}
export const Point3f = {
    encode(message, writer = new BinaryWriter()) {
        if (message.x !== 0) {
            writer.uint32(13).float(message.x);
        }
        if (message.y !== 0) {
            writer.uint32(21).float(message.y);
        }
        if (message.z !== 0) {
            writer.uint32(29).float(message.z);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBasePoint3f();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 13) {
                        break;
                    }
                    message.x = reader.float();
                    continue;
                }
                case 2: {
                    if (tag !== 21) {
                        break;
                    }
                    message.y = reader.float();
                    continue;
                }
                case 3: {
                    if (tag !== 29) {
                        break;
                    }
                    message.z = reader.float();
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            x: isSet(object.x) ? globalThis.Number(object.x) : 0,
            y: isSet(object.y) ? globalThis.Number(object.y) : 0,
            z: isSet(object.z) ? globalThis.Number(object.z) : 0,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.x !== 0) {
            obj.x = message.x;
        }
        if (message.y !== 0) {
            obj.y = message.y;
        }
        if (message.z !== 0) {
            obj.z = message.z;
        }
        return obj;
    },
    create(base) {
        return Point3f.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBasePoint3f();
        message.x = object.x ?? 0;
        message.y = object.y ?? 0;
        message.z = object.z ?? 0;
        return message;
    },
};
function createBaseSize2f() {
    return { width: 0, height: 0 };
}
export const Size2f = {
    encode(message, writer = new BinaryWriter()) {
        if (message.width !== 0) {
            writer.uint32(13).float(message.width);
        }
        if (message.height !== 0) {
            writer.uint32(21).float(message.height);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseSize2f();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 13) {
                        break;
                    }
                    message.width = reader.float();
                    continue;
                }
                case 2: {
                    if (tag !== 21) {
                        break;
                    }
                    message.height = reader.float();
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            width: isSet(object.width) ? globalThis.Number(object.width) : 0,
            height: isSet(object.height) ? globalThis.Number(object.height) : 0,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.width !== 0) {
            obj.width = message.width;
        }
        if (message.height !== 0) {
            obj.height = message.height;
        }
        return obj;
    },
    create(base) {
        return Size2f.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseSize2f();
        message.width = object.width ?? 0;
        message.height = object.height ?? 0;
        return message;
    },
};
function createBaseRotatedRect() {
    return { center: undefined, size: undefined, angle: 0 };
}
export const RotatedRect = {
    encode(message, writer = new BinaryWriter()) {
        if (message.center !== undefined) {
            Point2f.encode(message.center, writer.uint32(10).fork()).join();
        }
        if (message.size !== undefined) {
            Size2f.encode(message.size, writer.uint32(18).fork()).join();
        }
        if (message.angle !== 0) {
            writer.uint32(29).float(message.angle);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseRotatedRect();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.center = Point2f.decode(reader, reader.uint32());
                    continue;
                }
                case 2: {
                    if (tag !== 18) {
                        break;
                    }
                    message.size = Size2f.decode(reader, reader.uint32());
                    continue;
                }
                case 3: {
                    if (tag !== 29) {
                        break;
                    }
                    message.angle = reader.float();
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            center: isSet(object.center) ? Point2f.fromJSON(object.center) : undefined,
            size: isSet(object.size) ? Size2f.fromJSON(object.size) : undefined,
            angle: isSet(object.angle) ? globalThis.Number(object.angle) : 0,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.center !== undefined) {
            obj.center = Point2f.toJSON(message.center);
        }
        if (message.size !== undefined) {
            obj.size = Size2f.toJSON(message.size);
        }
        if (message.angle !== 0) {
            obj.angle = message.angle;
        }
        return obj;
    },
    create(base) {
        return RotatedRect.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseRotatedRect();
        message.center = (object.center !== undefined && object.center !== null)
            ? Point2f.fromPartial(object.center)
            : undefined;
        message.size = (object.size !== undefined && object.size !== null) ? Size2f.fromPartial(object.size) : undefined;
        message.angle = object.angle ?? 0;
        return message;
    },
};
function createBaseKeypointsList() {
    return { keypoints: [], edges: [] };
}
export const KeypointsList = {
    encode(message, writer = new BinaryWriter()) {
        for (const v of message.keypoints) {
            Keypoint.encode(v, writer.uint32(10).fork()).join();
        }
        for (const v of message.edges) {
            Edge.encode(v, writer.uint32(18).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseKeypointsList();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.keypoints.push(Keypoint.decode(reader, reader.uint32()));
                    continue;
                }
                case 2: {
                    if (tag !== 18) {
                        break;
                    }
                    message.edges.push(Edge.decode(reader, reader.uint32()));
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            keypoints: globalThis.Array.isArray(object?.keypoints)
                ? object.keypoints.map((e) => Keypoint.fromJSON(e))
                : [],
            edges: globalThis.Array.isArray(object?.edges) ? object.edges.map((e) => Edge.fromJSON(e)) : [],
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.keypoints?.length) {
            obj.keypoints = message.keypoints.map((e) => Keypoint.toJSON(e));
        }
        if (message.edges?.length) {
            obj.edges = message.edges.map((e) => Edge.toJSON(e));
        }
        return obj;
    },
    create(base) {
        return KeypointsList.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseKeypointsList();
        message.keypoints = object.keypoints?.map((e) => Keypoint.fromPartial(e)) || [];
        message.edges = object.edges?.map((e) => Edge.fromPartial(e)) || [];
        return message;
    },
};
function createBaseKeypoint() {
    return { imageCoordinates: undefined, confidence: 0, label: 0, labelName: "" };
}
export const Keypoint = {
    encode(message, writer = new BinaryWriter()) {
        if (message.imageCoordinates !== undefined) {
            Point3f.encode(message.imageCoordinates, writer.uint32(10).fork()).join();
        }
        if (message.confidence !== 0) {
            writer.uint32(21).float(message.confidence);
        }
        if (message.label !== 0) {
            writer.uint32(24).uint32(message.label);
        }
        if (message.labelName !== "") {
            writer.uint32(34).string(message.labelName);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseKeypoint();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.imageCoordinates = Point3f.decode(reader, reader.uint32());
                    continue;
                }
                case 2: {
                    if (tag !== 21) {
                        break;
                    }
                    message.confidence = reader.float();
                    continue;
                }
                case 3: {
                    if (tag !== 24) {
                        break;
                    }
                    message.label = reader.uint32();
                    continue;
                }
                case 4: {
                    if (tag !== 34) {
                        break;
                    }
                    message.labelName = reader.string();
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            imageCoordinates: isSet(object.imageCoordinates) ? Point3f.fromJSON(object.imageCoordinates) : undefined,
            confidence: isSet(object.confidence) ? globalThis.Number(object.confidence) : 0,
            label: isSet(object.label) ? globalThis.Number(object.label) : 0,
            labelName: isSet(object.labelName) ? globalThis.String(object.labelName) : "",
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.imageCoordinates !== undefined) {
            obj.imageCoordinates = Point3f.toJSON(message.imageCoordinates);
        }
        if (message.confidence !== 0) {
            obj.confidence = message.confidence;
        }
        if (message.label !== 0) {
            obj.label = Math.round(message.label);
        }
        if (message.labelName !== "") {
            obj.labelName = message.labelName;
        }
        return obj;
    },
    create(base) {
        return Keypoint.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseKeypoint();
        message.imageCoordinates = (object.imageCoordinates !== undefined && object.imageCoordinates !== null)
            ? Point3f.fromPartial(object.imageCoordinates)
            : undefined;
        message.confidence = object.confidence ?? 0;
        message.label = object.label ?? 0;
        message.labelName = object.labelName ?? "";
        return message;
    },
};
function createBaseEdge() {
    return { src: 0, dst: 0 };
}
export const Edge = {
    encode(message, writer = new BinaryWriter()) {
        if (message.src !== 0) {
            writer.uint32(8).uint32(message.src);
        }
        if (message.dst !== 0) {
            writer.uint32(16).uint32(message.dst);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseEdge();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 8) {
                        break;
                    }
                    message.src = reader.uint32();
                    continue;
                }
                case 2: {
                    if (tag !== 16) {
                        break;
                    }
                    message.dst = reader.uint32();
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            src: isSet(object.src) ? globalThis.Number(object.src) : 0,
            dst: isSet(object.dst) ? globalThis.Number(object.dst) : 0,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.src !== 0) {
            obj.src = Math.round(message.src);
        }
        if (message.dst !== 0) {
            obj.dst = Math.round(message.dst);
        }
        return obj;
    },
    create(base) {
        return Edge.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseEdge();
        message.src = object.src ?? 0;
        message.dst = object.dst ?? 0;
        return message;
    },
};
function createBaseSpatialKeypointsList() {
    return { keypoints: [], edges: [] };
}
export const SpatialKeypointsList = {
    encode(message, writer = new BinaryWriter()) {
        for (const v of message.keypoints) {
            SpatialKeypoint.encode(v, writer.uint32(10).fork()).join();
        }
        for (const v of message.edges) {
            Edge.encode(v, writer.uint32(18).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseSpatialKeypointsList();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.keypoints.push(SpatialKeypoint.decode(reader, reader.uint32()));
                    continue;
                }
                case 2: {
                    if (tag !== 18) {
                        break;
                    }
                    message.edges.push(Edge.decode(reader, reader.uint32()));
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            keypoints: globalThis.Array.isArray(object?.keypoints)
                ? object.keypoints.map((e) => SpatialKeypoint.fromJSON(e))
                : [],
            edges: globalThis.Array.isArray(object?.edges) ? object.edges.map((e) => Edge.fromJSON(e)) : [],
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.keypoints?.length) {
            obj.keypoints = message.keypoints.map((e) => SpatialKeypoint.toJSON(e));
        }
        if (message.edges?.length) {
            obj.edges = message.edges.map((e) => Edge.toJSON(e));
        }
        return obj;
    },
    create(base) {
        return SpatialKeypointsList.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseSpatialKeypointsList();
        message.keypoints = object.keypoints?.map((e) => SpatialKeypoint.fromPartial(e)) || [];
        message.edges = object.edges?.map((e) => Edge.fromPartial(e)) || [];
        return message;
    },
};
function createBaseSpatialKeypoint() {
    return { imageCoordinates: undefined, confidence: 0, label: 0, labelName: "", spatialCoordinates: undefined };
}
export const SpatialKeypoint = {
    encode(message, writer = new BinaryWriter()) {
        if (message.imageCoordinates !== undefined) {
            Point3f.encode(message.imageCoordinates, writer.uint32(10).fork()).join();
        }
        if (message.confidence !== 0) {
            writer.uint32(21).float(message.confidence);
        }
        if (message.label !== 0) {
            writer.uint32(24).uint32(message.label);
        }
        if (message.labelName !== "") {
            writer.uint32(34).string(message.labelName);
        }
        if (message.spatialCoordinates !== undefined) {
            Point3f.encode(message.spatialCoordinates, writer.uint32(42).fork()).join();
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
        const end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseSpatialKeypoint();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1: {
                    if (tag !== 10) {
                        break;
                    }
                    message.imageCoordinates = Point3f.decode(reader, reader.uint32());
                    continue;
                }
                case 2: {
                    if (tag !== 21) {
                        break;
                    }
                    message.confidence = reader.float();
                    continue;
                }
                case 3: {
                    if (tag !== 24) {
                        break;
                    }
                    message.label = reader.uint32();
                    continue;
                }
                case 4: {
                    if (tag !== 34) {
                        break;
                    }
                    message.labelName = reader.string();
                    continue;
                }
                case 5: {
                    if (tag !== 42) {
                        break;
                    }
                    message.spatialCoordinates = Point3f.decode(reader, reader.uint32());
                    continue;
                }
            }
            if ((tag & 7) === 4 || tag === 0) {
                break;
            }
            reader.skip(tag & 7);
        }
        return message;
    },
    fromJSON(object) {
        return {
            imageCoordinates: isSet(object.imageCoordinates) ? Point3f.fromJSON(object.imageCoordinates) : undefined,
            confidence: isSet(object.confidence) ? globalThis.Number(object.confidence) : 0,
            label: isSet(object.label) ? globalThis.Number(object.label) : 0,
            labelName: isSet(object.labelName) ? globalThis.String(object.labelName) : "",
            spatialCoordinates: isSet(object.spatialCoordinates) ? Point3f.fromJSON(object.spatialCoordinates) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        if (message.imageCoordinates !== undefined) {
            obj.imageCoordinates = Point3f.toJSON(message.imageCoordinates);
        }
        if (message.confidence !== 0) {
            obj.confidence = message.confidence;
        }
        if (message.label !== 0) {
            obj.label = Math.round(message.label);
        }
        if (message.labelName !== "") {
            obj.labelName = message.labelName;
        }
        if (message.spatialCoordinates !== undefined) {
            obj.spatialCoordinates = Point3f.toJSON(message.spatialCoordinates);
        }
        return obj;
    },
    create(base) {
        return SpatialKeypoint.fromPartial(base ?? {});
    },
    fromPartial(object) {
        const message = createBaseSpatialKeypoint();
        message.imageCoordinates = (object.imageCoordinates !== undefined && object.imageCoordinates !== null)
            ? Point3f.fromPartial(object.imageCoordinates)
            : undefined;
        message.confidence = object.confidence ?? 0;
        message.label = object.label ?? 0;
        message.labelName = object.labelName ?? "";
        message.spatialCoordinates = (object.spatialCoordinates !== undefined && object.spatialCoordinates !== null)
            ? Point3f.fromPartial(object.spatialCoordinates)
            : undefined;
        return message;
    },
};
function longToNumber(int64) {
    const num = globalThis.Number(int64.toString());
    if (num > globalThis.Number.MAX_SAFE_INTEGER) {
        throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
    }
    if (num < globalThis.Number.MIN_SAFE_INTEGER) {
        throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
    }
    return num;
}
function isSet(value) {
    return value !== null && value !== undefined;
}
export const protobufName = "common";
//# sourceMappingURL=common.js.map