/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { InboundFlow } from "./InboundFlow.js";
class DrivingReceivingFlow extends InboundFlow {
  async transferNextChunk() {
    const { writeController } = this.stream;
    const blockCounter = this.nextMessageCounter;
    await this.messenger.sendBlockQuery({ blockCounter });
    const {
      kind: messageType,
      message: { blockCounter: dataBlockCounter, data }
    } = await this.messenger.readBlock();
    this.validateCounter(dataBlockCounter, blockCounter);
    this.transferredBytes += data.byteLength;
    if (this.writeDataChunk(writeController, data, messageType)) {
      this.finalBlockCounter = dataBlockCounter;
      return true;
    }
    return false;
  }
}
export {
  DrivingReceivingFlow
};
//# sourceMappingURL=DrivingReceivingFlow.js.map
