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AAI,CAAC,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC;QACxD,IAAI,KAAK,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE,KAA6B,CAAC;QACrE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,OAAO,EAAE;YAC5B,IAAI,KAAK,KAAK,SAAS,EAAE;gBACrB,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;aACzB;iBAAM;gBACH,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;gBACtB,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;gBACxB,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;gBAC3B,MAAM,IAAI,MAAM,CAAC;aACpB;SACJ;IACL,CAAC;CACJ;AA9BD,sCA8BC","file":"binary.js","sourcesContent":["// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n\nimport { Binary } from '../type';\nimport { toUint8Array } from '../util/buffer';\nimport { BufferBuilder } from './buffer';\nimport { VariableWidthBuilder, BuilderOptions } from '../builder';\n\n/** @ignore */\nexport class BinaryBuilder<TNull = any> extends VariableWidthBuilder<Binary, TNull> {\n constructor(opts: BuilderOptions<Binary, TNull>) {\n super(opts);\n this._values = new BufferBuilder(new Uint8Array(0));\n }\n public get byteLength(): number {\n let size = this._pendingLength + (this.length * 4);\n this._offsets && (size += this._offsets.byteLength);\n this._values && (size += this._values.byteLength);\n this._nulls && (size += this._nulls.byteLength);\n return size;\n }\n public setValue(index: number, value: Uint8Array) {\n return super.setValue(index, toUint8Array(value));\n }\n protected _flushPending(pending: Map<number, Uint8Array | undefined>, pendingLength: number) {\n const offsets = this._offsets;\n const data = this._values.reserve(pendingLength).buffer;\n let index = 0, length = 0, offset = 0, value: Uint8Array | undefined;\n for ([index, value] of pending) {\n if (value === undefined) {\n offsets.set(index, 0);\n } else {\n length = value.length;\n data.set(value, offset);\n offsets.set(index, length);\n offset += length;\n }\n }\n }\n}\n"]}