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xD,OAAI0E,IAAiB,IAASE,WACnBD,EAEAtJ,KAAKyH,cAAc+B,OAAOF,EACzC,CAQA,mBAAAG,CAAoBC,EAAGnI,GACnB,MAAiB,iBAANmI,EACA1J,KAAKoJ,SAAS7H,GAElBvB,KAAKkJ,QAAQQ,EAAGnI,EAC3B,CAIA,UAAAoI,CAAWpI,GACP,OAAOA,EAASvB,KAAK6F,UAAUtE,EACnC,CAIA,QAAAqI,CAASrI,GACL,OAAOA,EAASvB,KAAK6F,UAAUtE,GAAU,IAC7C,CAIA,YAAAsI,CAAatI,GACT,OAAOvB,KAAK6F,UAAUtE,EAASvB,KAAK6F,UAAUtE,GAClD,CACA,gBAAAuI,CAAiBC,GACb,GAAIA,EAAMpF,QAAU,KAChB,MAAM,IAAIf,MAAM,+CACZ,MAER,IAAK,IAAI5B,EAAI,EAAGA,EAAI,KAAwBA,IACxC,GAAI+H,EAAMzE,WAAWtD,IAAMhC,KAAK2H,SAAS3H,KAAKsB,WAAa,KAAaU,GACpE,OAAO,EAGf,OAAO,CACX,CAIA,gBAAAgI,CAAiBC,EAAcC,GAC3B,MAAMlD,EAAM,GACZ,IAAK,IAAIhF,EAAI,EAAGA,EAAIkI,IAAclI,EACN,OAApBiI,EAAajI,IACbgF,EAAIjC,KAAKkF,EAAajI,IAG9B,OAAOgF,CACX,CAOA,aAAAmD,CAAcF,EAAcC,GACxB,MAAMlD,EAAM,GACZ,IAAK,IAAIhF,EAAI,EAAGA,EAAIkI,IAAclI,EAAG,CACjC,MAAMiF,EAAMgD,EAAajI,GACb,OAARiF,GACAD,EAAIjC,KAAKkC,EAAImD,SAErB,CACA,OAAOpD,CACX,E","sources":["webpack://ch.enlightware.gamecreator/./node_modules/flatbuffers/mjs/builder.js","webpack://ch.enlightware.gamecreator/./node_modules/flatbuffers/mjs/byte-buffer.js"],"sourcesContent":["import { ByteBuffer } from \"./byte-buffer.js\";\r\nimport { SIZEOF_SHORT, SIZE_PREFIX_LENGTH, SIZEOF_INT, FILE_IDENTIFIER_LENGTH } from \"./constants.js\";\r\nexport class Builder {\r\n /**\r\n * Create a FlatBufferBuilder.\r\n */\r\n constructor(opt_initial_size) {\r\n /** Minimum alignment encountered so far. */\r\n this.minalign = 1;\r\n /** The vtable for the current table. */\r\n this.vtable = null;\r\n /** The amount of fields we're actually using. */\r\n this.vtable_in_use = 0;\r\n /** Whether we are currently serializing a table. */\r\n this.isNested = false;\r\n /** Starting offset of the current struct/table. */\r\n this.object_start = 0;\r\n /** List of offsets of all vtables. */\r\n this.vtables = [];\r\n /** For the current vector being built. */\r\n this.vector_num_elems = 0;\r\n /** False omits default values from the serialized data */\r\n this.force_defaults = false;\r\n this.string_maps = null;\r\n this.text_encoder = new TextEncoder();\r\n let initial_size;\r\n if (!opt_initial_size) {\r\n initial_size = 1024;\r\n }\r\n else {\r\n initial_size = opt_initial_size;\r\n }\r\n /**\r\n * @type {ByteBuffer}\r\n * @private\r\n */\r\n this.bb = ByteBuffer.allocate(initial_size);\r\n this.space = initial_size;\r\n }\r\n clear() {\r\n this.bb.clear();\r\n this.space = this.bb.capacity();\r\n this.minalign = 1;\r\n this.vtable = null;\r\n this.vtable_in_use = 0;\r\n this.isNested = false;\r\n this.object_start = 0;\r\n this.vtables = [];\r\n this.vector_num_elems = 0;\r\n this.force_defaults = false;\r\n this.string_maps = null;\r\n }\r\n /**\r\n * In order to save space, fields that are set to their default value\r\n * don't get serialized into the buffer. Forcing defaults provides a\r\n * way to manually disable this optimization.\r\n *\r\n * @param forceDefaults true always serializes default values\r\n */\r\n forceDefaults(forceDefaults) {\r\n this.force_defaults = forceDefaults;\r\n }\r\n /**\r\n * Get the ByteBuffer representing the FlatBuffer. Only call this after you've\r\n * called finish(). The actual data starts at the ByteBuffer's current position,\r\n * not necessarily at 0.\r\n */\r\n dataBuffer() {\r\n return this.bb;\r\n }\r\n /**\r\n * Get the bytes representing the FlatBuffer. Only call this after you've\r\n * called finish().\r\n */\r\n asUint8Array() {\r\n return this.bb.bytes().subarray(this.bb.position(), this.bb.position() + this.offset());\r\n }\r\n /**\r\n * Prepare to write an element of `size` after `additional_bytes` have been\r\n * written, e.g. if you write a string, you need to align such the int length\r\n * field is aligned to 4 bytes, and the string data follows it directly. If all\r\n * you need to do is alignment, `additional_bytes` will be 0.\r\n *\r\n * @param size This is the of the new element to write\r\n * @param additional_bytes The padding size\r\n */\r\n prep(size, additional_bytes) {\r\n // Track the biggest thing we've ever aligned to.\r\n if (size > this.minalign) {\r\n this.minalign = size;\r\n }\r\n // Find the amount of alignment needed such that `size` is properly\r\n // aligned after `additional_bytes`\r\n const align_size = ((~(this.bb.capacity() - this.space + additional_bytes)) + 1) & (size - 1);\r\n // Reallocate the buffer if needed.\r\n while (this.space < align_size + size + additional_bytes) {\r\n const old_buf_size = this.bb.capacity();\r\n this.bb = Builder.growByteBuffer(this.bb);\r\n this.space += this.bb.capacity() - old_buf_size;\r\n }\r\n this.pad(align_size);\r\n }\r\n pad(byte_size) {\r\n for (let i = 0; i < byte_size; i++) {\r\n this.bb.writeInt8(--this.space, 0);\r\n }\r\n }\r\n writeInt8(value) {\r\n this.bb.writeInt8(this.space -= 1, value);\r\n }\r\n writeInt16(value) {\r\n this.bb.writeInt16(this.space -= 2, value);\r\n }\r\n writeInt32(value) {\r\n this.bb.writeInt32(this.space -= 4, value);\r\n }\r\n writeInt64(value) {\r\n this.bb.writeInt64(this.space -= 8, value);\r\n }\r\n writeFloat32(value) {\r\n this.bb.writeFloat32(this.space -= 4, value);\r\n }\r\n writeFloat64(value) {\r\n this.bb.writeFloat64(this.space -= 8, value);\r\n }\r\n /**\r\n * Add an `int8` to the buffer, properly aligned, and grows the buffer (if necessary).\r\n * @param value The `int8` to add the buffer.\r\n */\r\n addInt8(value) {\r\n this.prep(1, 0);\r\n this.writeInt8(value);\r\n }\r\n /**\r\n * Add an `int16` to the buffer, properly aligned, and grows the buffer (if necessary).\r\n * @param value The `int16` to add the buffer.\r\n */\r\n addInt16(value) {\r\n this.prep(2, 0);\r\n this.writeInt16(value);\r\n }\r\n /**\r\n * Add an `int32` to the buffer, properly aligned, and grows the buffer (if necessary).\r\n * @param value The `int32` to add the buffer.\r\n */\r\n addInt32(value) {\r\n this.prep(4, 0);\r\n this.writeInt32(value);\r\n }\r\n /**\r\n * Add an `int64` to the buffer, properly aligned, and grows the buffer (if necessary).\r\n * @param value The `int64` to add the buffer.\r\n */\r\n addInt64(value) {\r\n this.prep(8, 0);\r\n this.writeInt64(value);\r\n }\r\n /**\r\n * Add a `float32` to the buffer, properly aligned, and grows the buffer (if necessary).\r\n * @param value The `float32` to add the buffer.\r\n */\r\n addFloat32(value) {\r\n this.prep(4, 0);\r\n this.writeFloat32(value);\r\n }\r\n /**\r\n * Add a `float64` to the buffer, properly aligned, and grows the buffer (if necessary).\r\n * @param value The `float64` to add the buffer.\r\n */\r\n addFloat64(value) {\r\n this.prep(8, 0);\r\n this.writeFloat64(value);\r\n }\r\n addFieldInt8(voffset, value, defaultValue) {\r\n if (this.force_defaults || value != defaultValue) {\r\n this.addInt8(value);\r\n this.slot(voffset);\r\n }\r\n }\r\n addFieldInt16(voffset, value, defaultValue) {\r\n if (this.force_defaults || value != defaultValue) {\r\n this.addInt16(value);\r\n this.slot(voffset);\r\n }\r\n }\r\n addFieldInt32(voffset, value, defaultValue) {\r\n if (this.force_defaults || value != defaultValue) {\r\n this.addInt32(value);\r\n this.slot(voffset);\r\n }\r\n }\r\n addFieldInt64(voffset, value, defaultValue) {\r\n if (this.force_defaults || value !== defaultValue) {\r\n this.addInt64(value);\r\n this.slot(voffset);\r\n }\r\n }\r\n addFieldFloat32(voffset, value, defaultValue) {\r\n if (this.force_defaults || value != defaultValue) {\r\n this.addFloat32(value);\r\n this.slot(voffset);\r\n }\r\n }\r\n addFieldFloat64(voffset, value, defaultValue) {\r\n if (this.force_defaults || value != defaultValue) {\r\n this.addFloat64(value);\r\n this.slot(voffset);\r\n }\r\n }\r\n addFieldOffset(voffset, value, defaultValue) {\r\n if (this.force_defaults || value != defaultValue) {\r\n this.addOffset(value);\r\n this.slot(voffset);\r\n }\r\n }\r\n /**\r\n * Structs are stored inline, so nothing additional is being added. `d` is always 0.\r\n */\r\n addFieldStruct(voffset, value, defaultValue) {\r\n if (value != defaultValue) {\r\n this.nested(value);\r\n this.slot(voffset);\r\n }\r\n }\r\n /**\r\n * Structures are always stored inline, they need to be created right\r\n * where they're used. You'll get this assertion failure if you\r\n * created it elsewhere.\r\n */\r\n nested(obj) {\r\n if (obj != this.offset()) {\r\n throw new Error('FlatBuffers: struct must be serialized inline.');\r\n }\r\n }\r\n /**\r\n * Should not be creating any other object, string or vector\r\n * while an object is being constructed\r\n */\r\n notNested() {\r\n if (this.isNested) {\r\n throw new Error('FlatBuffers: object serialization must not be nested.');\r\n }\r\n }\r\n /**\r\n * Set the current vtable at `voffset` to the current location in the buffer.\r\n */\r\n slot(voffset) {\r\n if (this.vtable !== null)\r\n this.vtable[voffset] = this.offset();\r\n }\r\n /**\r\n * @returns Offset relative to the end of the buffer.\r\n */\r\n offset() {\r\n return this.bb.capacity() - this.space;\r\n }\r\n /**\r\n * Doubles the size of the backing ByteBuffer and copies the old data towards\r\n * the end of the new buffer (since we build the buffer backwards).\r\n *\r\n * @param bb The current buffer with the existing data\r\n * @returns A new byte buffer with the old data copied\r\n * to it. The data is located at the end of the buffer.\r\n *\r\n * uint8Array.set() formally takes {Array|ArrayBufferView}, so to pass\r\n * it a uint8Array we need to suppress the type check:\r\n * @suppress {checkTypes}\r\n */\r\n static growByteBuffer(bb) {\r\n const old_buf_size = bb.capacity();\r\n // Ensure we don't grow beyond what fits in an int.\r\n if (old_buf_size & 0xC0000000) {\r\n throw new Error('FlatBuffers: cannot grow buffer beyond 2 gigabytes.');\r\n }\r\n const new_buf_size = old_buf_size << 1;\r\n const nbb = ByteBuffer.allocate(new_buf_size);\r\n nbb.setPosition(new_buf_size - old_buf_size);\r\n nbb.bytes().set(bb.bytes(), new_buf_size - old_buf_size);\r\n return nbb;\r\n }\r\n /**\r\n * Adds on offset, relative to where it will be written.\r\n *\r\n * @param offset The offset to add.\r\n */\r\n addOffset(offset) {\r\n this.prep(SIZEOF_INT, 0); // Ensure alignment is already done.\r\n this.writeInt32(this.offset() - offset + SIZEOF_INT);\r\n }\r\n /**\r\n * Start encoding a new object in the buffer. Users will not usually need to\r\n * call this directly. The FlatBuffers compiler will generate helper methods\r\n * that call this method internally.\r\n */\r\n startObject(numfields) {\r\n this.notNested();\r\n if (this.vtable == null) {\r\n this.vtable = [];\r\n }\r\n this.vtable_in_use = numfields;\r\n for (let i = 0; i < numfields; i++) {\r\n this.vtable[i] = 0; // This will push additional elements as needed\r\n }\r\n this.isNested = true;\r\n this.object_start = this.offset();\r\n }\r\n /**\r\n * Finish off writing the object that is under construction.\r\n *\r\n * @returns The offset to the object inside `dataBuffer`\r\n */\r\n endObject() {\r\n if (this.vtable == null || !this.isNested) {\r\n throw new Error('FlatBuffers: endObject called without startObject');\r\n }\r\n this.addInt32(0);\r\n const vtableloc = this.offset();\r\n // Trim trailing zeroes.\r\n let i = this.vtable_in_use - 1;\r\n // eslint-disable-next-line no-empty\r\n for (; i >= 0 && this.vtable[i] == 0; i--) { }\r\n const trimmed_size = i + 1;\r\n // Write out the current vtable.\r\n for (; i >= 0; i--) {\r\n // Offset relative to the start of the table.\r\n this.addInt16(this.vtable[i] != 0 ? vtableloc - this.vtable[i] : 0);\r\n }\r\n const standard_fields = 2; // The fields below:\r\n this.addInt16(vtableloc - this.object_start);\r\n const len = (trimmed_size + standard_fields) * SIZEOF_SHORT;\r\n this.addInt16(len);\r\n // Search for an existing vtable that matches the current one.\r\n let existing_vtable = 0;\r\n const vt1 = this.space;\r\n outer_loop: for (i = 0; i < this.vtables.length; i++) {\r\n const vt2 = this.bb.capacity() - this.vtables[i];\r\n if (len == this.bb.readInt16(vt2)) {\r\n for (let j = SIZEOF_SHORT; j < len; j += SIZEOF_SHORT) {\r\n if (this.bb.readInt16(vt1 + j) != this.bb.readInt16(vt2 + j)) {\r\n continue outer_loop;\r\n }\r\n }\r\n existing_vtable = this.vtables[i];\r\n break;\r\n }\r\n }\r\n if (existing_vtable) {\r\n // Found a match:\r\n // Remove the current vtable.\r\n this.space = this.bb.capacity() - vtableloc;\r\n // Point table to existing vtable.\r\n this.bb.writeInt32(this.space, existing_vtable - vtableloc);\r\n }\r\n else {\r\n // No match:\r\n // Add the location of the current vtable to the list of vtables.\r\n this.vtables.push(this.offset());\r\n // Point table to current vtable.\r\n this.bb.writeInt32(this.bb.capacity() - vtableloc, this.offset() - vtableloc);\r\n }\r\n this.isNested = false;\r\n return vtableloc;\r\n }\r\n /**\r\n * Finalize a buffer, poiting to the given `root_table`.\r\n */\r\n finish(root_table, opt_file_identifier, opt_size_prefix) {\r\n const size_prefix = opt_size_prefix ? SIZE_PREFIX_LENGTH : 0;\r\n if (opt_file_identifier) {\r\n const file_identifier = opt_file_identifier;\r\n this.prep(this.minalign, SIZEOF_INT +\r\n FILE_IDENTIFIER_LENGTH + size_prefix);\r\n if (file_identifier.length != FILE_IDENTIFIER_LENGTH) {\r\n throw new Error('FlatBuffers: file identifier must be length ' +\r\n FILE_IDENTIFIER_LENGTH);\r\n }\r\n for (let i = FILE_IDENTIFIER_LENGTH - 1; i >= 0; i--) {\r\n this.writeInt8(file_identifier.charCodeAt(i));\r\n }\r\n }\r\n this.prep(this.minalign, SIZEOF_INT + size_prefix);\r\n this.addOffset(root_table);\r\n if (size_prefix) {\r\n this.addInt32(this.bb.capacity() - this.space);\r\n }\r\n this.bb.setPosition(this.space);\r\n }\r\n /**\r\n * Finalize a size prefixed buffer, pointing to the given `root_table`.\r\n */\r\n finishSizePrefixed(root_table, opt_file_identifier) {\r\n this.finish(root_table, opt_file_identifier, true);\r\n }\r\n /**\r\n * This checks a required field has been set in a given table that has\r\n * just been constructed.\r\n */\r\n requiredField(table, field) {\r\n const table_start = this.bb.capacity() - table;\r\n const vtable_start = table_start - this.bb.readInt32(table_start);\r\n const ok = this.bb.readInt16(vtable_start + field) != 0;\r\n // If this fails, the caller will show what field needs to be set.\r\n if (!ok) {\r\n throw new Error('FlatBuffers: field ' + field + ' must be set');\r\n }\r\n }\r\n /**\r\n * Start a new array/vector of objects. Users usually will not call\r\n * this directly. The FlatBuffers compiler will create a start/end\r\n * method for vector types in generated code.\r\n *\r\n * @param elem_size The size of each element in the array\r\n * @param num_elems The number of elements in the array\r\n * @param alignment The alignment of the array\r\n */\r\n startVector(elem_size, num_elems, alignment) {\r\n this.notNested();\r\n this.vector_num_elems = num_elems;\r\n this.prep(SIZEOF_INT, elem_size * num_elems);\r\n this.prep(alignment, elem_size * num_elems); // Just in case alignment > int.\r\n }\r\n /**\r\n * Finish off the creation of an array and all its elements. The array must be\r\n * created with `startVector`.\r\n *\r\n * @returns The offset at which the newly created array\r\n * starts.\r\n */\r\n endVector() {\r\n this.writeInt32(this.vector_num_elems);\r\n return this.offset();\r\n }\r\n /**\r\n * Encode the string `s` in the buffer using UTF-8. If the string passed has\r\n * already been seen, we return the offset of the already written string\r\n *\r\n * @param s The string to encode\r\n * @return The offset in the buffer where the encoded string starts\r\n */\r\n createSharedString(s) {\r\n if (!s) {\r\n return 0;\r\n }\r\n if (!this.string_maps) {\r\n this.string_maps = new Map();\r\n }\r\n if (this.string_maps.has(s)) {\r\n return this.string_maps.get(s);\r\n }\r\n const offset = this.createString(s);\r\n this.string_maps.set(s, offset);\r\n return offset;\r\n }\r\n /**\r\n * Encode the string `s` in the buffer using UTF-8. If a Uint8Array is passed\r\n * instead of a string, it is assumed to contain valid UTF-8 encoded data.\r\n *\r\n * @param s The string to encode\r\n * @return The offset in the buffer where the encoded string starts\r\n */\r\n createString(s) {\r\n if (s === null || s === undefined) {\r\n return 0;\r\n }\r\n let utf8;\r\n if (s instanceof Uint8Array) {\r\n utf8 = s;\r\n }\r\n else {\r\n utf8 = this.text_encoder.encode(s);\r\n }\r\n this.addInt8(0);\r\n this.startVector(1, utf8.length, 1);\r\n this.bb.setPosition(this.space -= utf8.length);\r\n for (let i = 0, offset = this.space, bytes = this.bb.bytes(); i < utf8.length; i++) {\r\n bytes[offset++] = utf8[i];\r\n }\r\n return this.endVector();\r\n }\r\n /**\r\n * A helper function to pack an object\r\n *\r\n * @returns offset of obj\r\n */\r\n createObjectOffset(obj) {\r\n if (obj === null) {\r\n return 0;\r\n }\r\n if (typeof obj === 'string') {\r\n return this.createString(obj);\r\n }\r\n else {\r\n return obj.pack(this);\r\n }\r\n }\r\n /**\r\n * A helper function to pack a list of object\r\n *\r\n * @returns list of offsets of each non null object\r\n */\r\n createObjectOffsetList(list) {\r\n const ret = [];\r\n for (let i = 0; i < list.length; ++i) {\r\n const val = list[i];\r\n if (val !== null) {\r\n ret.push(this.createObjectOffset(val));\r\n }\r\n else {\r\n throw new Error('FlatBuffers: Argument for createObjectOffsetList cannot contain null.');\r\n }\r\n }\r\n return ret;\r\n }\r\n createStructOffsetList(list, startFunc) {\r\n startFunc(this, list.length);\r\n this.createObjectOffsetList(list.slice().reverse());\r\n return this.endVector();\r\n }\r\n}\r\n","import { FILE_IDENTIFIER_LENGTH, SIZEOF_INT } from \"./constants.js\";\r\nimport { int32, isLittleEndian, float32, float64 } from \"./utils.js\";\r\nimport { Encoding } from \"./encoding.js\";\r\nexport class ByteBuffer {\r\n /**\r\n * Create a new ByteBuffer with a given array of bytes (`Uint8Array`)\r\n */\r\n constructor(bytes_) {\r\n this.bytes_ = bytes_;\r\n this.position_ = 0;\r\n this.text_decoder_ = new TextDecoder();\r\n }\r\n /**\r\n * Create and allocate a new ByteBuffer with a given size.\r\n */\r\n static allocate(byte_size) {\r\n return new ByteBuffer(new Uint8Array(byte_size));\r\n }\r\n clear() {\r\n this.position_ = 0;\r\n }\r\n /**\r\n * Get the underlying `Uint8Array`.\r\n */\r\n bytes() {\r\n return this.bytes_;\r\n }\r\n /**\r\n * Get the buffer's position.\r\n */\r\n position() {\r\n return this.position_;\r\n }\r\n /**\r\n * Set the buffer's position.\r\n */\r\n setPosition(position) {\r\n this.position_ = position;\r\n }\r\n /**\r\n * Get the buffer's capacity.\r\n */\r\n capacity() {\r\n return this.bytes_.length;\r\n }\r\n readInt8(offset) {\r\n return this.readUint8(offset) << 24 >> 24;\r\n }\r\n readUint8(offset) {\r\n return this.bytes_[offset];\r\n }\r\n readInt16(offset) {\r\n return this.readUint16(offset) << 16 >> 16;\r\n }\r\n readUint16(offset) {\r\n return this.bytes_[offset] | this.bytes_[offset + 1] << 8;\r\n }\r\n readInt32(offset) {\r\n return this.bytes_[offset] | this.bytes_[offset + 1] << 8 | this.bytes_[offset + 2] << 16 | this.bytes_[offset + 3] << 24;\r\n }\r\n readUint32(offset) {\r\n return this.readInt32(offset) >>> 0;\r\n }\r\n readInt64(offset) {\r\n return BigInt.asIntN(64, BigInt(this.readUint32(offset)) + (BigInt(this.readUint32(offset + 4)) << BigInt(32)));\r\n }\r\n readUint64(offset) {\r\n return BigInt.asUintN(64, BigInt(this.readUint32(offset)) + (BigInt(this.readUint32(offset + 4)) << BigInt(32)));\r\n }\r\n readFloat32(offset) {\r\n int32[0] = this.readInt32(offset);\r\n return float32[0];\r\n }\r\n readFloat64(offset) {\r\n int32[isLittleEndian ? 0 : 1] = this.readInt32(offset);\r\n int32[isLittleEndian ? 1 : 0] = this.readInt32(offset + 4);\r\n return float64[0];\r\n }\r\n writeInt8(offset, value) {\r\n this.bytes_[offset] = value;\r\n }\r\n writeUint8(offset, value) {\r\n this.bytes_[offset] = value;\r\n }\r\n writeInt16(offset, value) {\r\n this.bytes_[offset] = value;\r\n this.bytes_[offset + 1] = value >> 8;\r\n }\r\n writeUint16(offset, value) {\r\n this.bytes_[offset] = value;\r\n this.bytes_[offset + 1] = value >> 8;\r\n }\r\n writeInt32(offset, value) {\r\n this.bytes_[offset] = value;\r\n this.bytes_[offset + 1] = value >> 8;\r\n this.bytes_[offset + 2] = value >> 16;\r\n this.bytes_[offset + 3] = value >> 24;\r\n }\r\n writeUint32(offset, value) {\r\n this.bytes_[offset] = value;\r\n this.bytes_[offset + 1] = value >> 8;\r\n this.bytes_[offset + 2] = value >> 16;\r\n this.bytes_[offset + 3] = value >> 24;\r\n }\r\n writeInt64(offset, value) {\r\n this.writeInt32(offset, Number(BigInt.asIntN(32, value)));\r\n this.writeInt32(offset + 4, Number(BigInt.asIntN(32, value >> BigInt(32))));\r\n }\r\n writeUint64(offset, value) {\r\n this.writeUint32(offset, Number(BigInt.asUintN(32, value)));\r\n this.writeUint32(offset + 4, Number(BigInt.asUintN(32, value >> BigInt(32))));\r\n }\r\n writeFloat32(offset, value) {\r\n float32[0] = value;\r\n this.writeInt32(offset, int32[0]);\r\n }\r\n writeFloat64(offset, value) {\r\n float64[0] = value;\r\n this.writeInt32(offset, int32[isLittleEndian ? 0 : 1]);\r\n this.writeInt32(offset + 4, int32[isLittleEndian ? 1 : 0]);\r\n }\r\n /**\r\n * Return the file identifier. Behavior is undefined for FlatBuffers whose\r\n * schema does not include a file_identifier (likely points at padding or the\r\n * start of a the root vtable).\r\n */\r\n getBufferIdentifier() {\r\n if (this.bytes_.length < this.position_ + SIZEOF_INT +\r\n FILE_IDENTIFIER_LENGTH) {\r\n throw new Error('FlatBuffers: ByteBuffer is too short to contain an identifier.');\r\n }\r\n let result = \"\";\r\n for (let i = 0; i < FILE_IDENTIFIER_LENGTH; i++) {\r\n result += String.fromCharCode(this.readInt8(this.position_ + SIZEOF_INT + i));\r\n }\r\n return result;\r\n }\r\n /**\r\n * Look up a field in the vtable, return an offset into the object, or 0 if the\r\n * field is not present.\r\n */\r\n __offset(bb_pos, vtable_offset) {\r\n const vtable = bb_pos - this.readInt32(bb_pos);\r\n return vtable_offset < this.readInt16(vtable) ? this.readInt16(vtable + vtable_offset) : 0;\r\n }\r\n /**\r\n * Initialize any Table-derived type to point to the union at the given offset.\r\n */\r\n __union(t, offset) {\r\n t.bb_pos = offset + this.readInt32(offset);\r\n t.bb = this;\r\n return t;\r\n }\r\n /**\r\n * Create a JavaScript string from UTF-8 data stored inside the FlatBuffer.\r\n * This allocates a new string and converts to wide chars upon each access.\r\n *\r\n * To avoid the conversion to string, pass Encoding.UTF8_BYTES as the\r\n * \"optionalEncoding\" argument. This is useful for avoiding conversion when\r\n * the data will just be packaged back up in another FlatBuffer later on.\r\n *\r\n * @param offset\r\n * @param opt_encoding Defaults to UTF16_STRING\r\n */\r\n __string(offset, opt_encoding) {\r\n offset += this.readInt32(offset);\r\n const length = this.readInt32(offset);\r\n offset += SIZEOF_INT;\r\n const utf8bytes = this.bytes_.subarray(offset, offset + length);\r\n if (opt_encoding === Encoding.UTF8_BYTES)\r\n return utf8bytes;\r\n else\r\n return this.text_decoder_.decode(utf8bytes);\r\n }\r\n /**\r\n * Handle unions that can contain string as its member, if a Table-derived type then initialize it,\r\n * if a string then return a new one\r\n *\r\n * WARNING: strings are immutable in JS so we can't change the string that the user gave us, this\r\n * makes the behaviour of __union_with_string different compared to __union\r\n */\r\n __union_with_string(o, offset) {\r\n if (typeof o === 'string') {\r\n return this.__string(offset);\r\n }\r\n return this.__union(o, offset);\r\n }\r\n /**\r\n * Retrieve the relative offset stored at \"offset\"\r\n */\r\n __indirect(offset) {\r\n return offset + this.readInt32(offset);\r\n }\r\n /**\r\n * Get the start of data of a vector whose offset is stored at \"offset\" in this object.\r\n */\r\n __vector(offset) {\r\n return offset + this.readInt32(offset) + SIZEOF_INT; // data starts after the length\r\n }\r\n /**\r\n * Get the length of a vector whose offset is stored at \"offset\" in this object.\r\n */\r\n __vector_len(offset) {\r\n return this.readInt32(offset + this.readInt32(offset));\r\n }\r\n __has_identifier(ident) {\r\n if (ident.length != FILE_IDENTIFIER_LENGTH) {\r\n throw new Error('FlatBuffers: file identifier must be length ' +\r\n FILE_IDENTIFIER_LENGTH);\r\n }\r\n for (let i = 0; i < FILE_IDENTIFIER_LENGTH; i++) {\r\n if (ident.charCodeAt(i) != this.readInt8(this.position() + SIZEOF_INT + i)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n /**\r\n * A helper function for generating list for obj api\r\n */\r\n createScalarList(listAccessor, listLength) {\r\n const ret = [];\r\n for (let i = 0; i < listLength; ++i) {\r\n if (listAccessor(i) !== null) {\r\n ret.push(listAccessor(i));\r\n }\r\n }\r\n return ret;\r\n }\r\n /**\r\n * A helper function for generating list for obj api\r\n * @param listAccessor function that accepts an index and return data at that index\r\n * @param listLength listLength\r\n * @param res result list\r\n */\r\n createObjList(listAccessor, listLength) {\r\n const ret = [];\r\n for (let i = 0; i < listLength; ++i) {\r\n const val = listAccessor(i);\r\n if (val !== null) {\r\n ret.push(val.unpack());\r\n }\r\n }\r\n return ret;\r\n }\r\n}\r\n"],"names":["Builder","constructor","opt_initial_size","initial_size","this","minalign","vtable","vtable_in_use","isNested","object_start","vtables","vector_num_elems","force_defaults","string_maps","text_encoder","TextEncoder","bb","allocate","space","clear","capacity","forceDefaults","dataBuffer","asUint8Array","bytes","subarray","position","offset","prep","size","additional_bytes","align_size","old_buf_size","growByteBuffer","pad","byte_size","i","writeInt8","value","writeInt16","writeInt32","writeInt64","writeFloat32","writeFloat64","addInt8","addInt16","addInt32","addInt64","addFloat32","addFloat64","addFieldInt8","voffset","defaultValue","slot","addFieldInt16","addFieldInt32","addFieldInt64","addFieldFloat32","addFieldFloat64","addFieldOffset","addOffset","addFieldStruct","nested","obj","Error","notNested","new_buf_size","nbb","setPosition","set","startObject","numfields","endObject","vtableloc","trimmed_size","len","existing_vtable","vt1","outer_loop","length","vt2","readInt16","j","push","finish","root_table","opt_file_identifier","opt_size_prefix","size_prefix","file_identifier","charCodeAt","finishSizePrefixed","requiredField","table","field","table_start","vtable_start","readInt32","startVector","elem_size","num_elems","alignment","endVector","createSharedString","s","Map","has","get","createString","utf8","Uint8Array","encode","createObjectOffset","pack","createObjectOffsetList","list","ret","val","createStructOffsetList","startFunc","slice","reverse","ByteBuffer","bytes_","position_","text_decoder_","TextDecoder","readInt8","readUint8","readUint16","readUint32","readInt64","BigInt","asIntN","readUint64","asUintN","readFloat32","readFloat64","writeUint8","writeUint16","writeUint32","Number","writeUint64","getBufferIdentifier","result","String","fromCharCode","__offset","bb_pos","vtable_offset","__union","t","__string","opt_encoding","utf8bytes","UTF8_BYTES","decode","__union_with_string","o","__indirect","__vector","__vector_len","__has_identifier","ident","createScalarList","listAccessor","listLength","createObjList","unpack"],"sourceRoot":""}