import { ArrayBufferReader } from './ArrayBufferReader';
export class BimGeometricFeaturesReader {
    constructor() { }
    readEntry(reader) {
        const originalOffset = reader.offsetInBytes;
        // eslint-disable-next-line @typescript-eslint/no-unused-vars
        const [version, headerSize] = reader.uint16(2);
        const [dataSize] = reader.uint32(1);
        const meshHash = reader.uint8(16);
        const [numberOfEdges] = reader.uint32(1);
        reader.offsetInBytes = originalOffset + headerSize;
        const edges = reader.typedArray(numberOfEdges);
        reader.offsetInBytes = originalOffset + headerSize + dataSize;
        return [this.base64EncodedMeshHash(meshHash), { edges: edges.array }];
    }
    decodeGeometricFeatures(data) {
        const reader = new ArrayBufferReader(data);
        const entries = new Map();
        while (reader.offsetInBytes < data.byteLength) {
            entries.set(...this.readEntry(reader));
        }
        return entries;
    }
    base64EncodedMeshHash(meshHash) {
        return btoa(String.fromCharCode(...meshHash));
    }
}
//# sourceMappingURL=bim-geometric-features-reader.js.map