1"use strict";
2var __create = Object.create;
3var __defProp = Object.defineProperty;
4var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5var __getOwnPropNames = Object.getOwnPropertyNames;
6var __getProtoOf = Object.getPrototypeOf;
7var __hasOwnProp = Object.prototype.hasOwnProperty;
8var __export = (target, all) => {
9 for (var name in all)
10 __defProp(target, name, { get: all[name], enumerable: true });
11};
12var __copyProps = (to, from, except, desc) => {
13 if (from && typeof from === "object" || typeof from === "function") {
14 for (let key of __getOwnPropNames(from))
15 if (!__hasOwnProp.call(to, key) && key !== except)
16 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17 }
18 return to;
19};
20var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21 // If the importer is in node compatibility mode or this is not an ESM
22 // file that has been converted to a CommonJS file using a Babel-
23 // compatible transform (i.e. "__esModule" has not been set), then set
24 // "default" to the CommonJS "module.exports" for node compatibility.
25 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26 mod
27));
28var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
30// monster_test.ts
31var monster_test_exports = {};
32__export(monster_test_exports, {
33 MyGame: () => my_game_exports,
34 TableA: () => TableA,
35 TableAT: () => TableAT
36});
37module.exports = __toCommonJS(monster_test_exports);
38
39// table-a.js
40var flatbuffers2 = __toESM(require("flatbuffers"), 1);
41
42// my-game/other-name-space/table-b.js
43var flatbuffers = __toESM(require("flatbuffers"), 1);
44var TableB = class {
45 constructor() {
46 this.bb = null;
47 this.bb_pos = 0;
48 }
49 __init(i, bb) {
50 this.bb_pos = i;
51 this.bb = bb;
52 return this;
53 }
54 static getRootAsTableB(bb, obj) {
55 return (obj || new TableB()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
56 }
57 static getSizePrefixedRootAsTableB(bb, obj) {
58 bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
59 return (obj || new TableB()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
60 }
61 a(obj) {
62 const offset = this.bb.__offset(this.bb_pos, 4);
63 return offset ? (obj || new TableA()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
64 }
65 static getFullyQualifiedName() {
66 return "MyGame.OtherNameSpace.TableB";
67 }
68 static startTableB(builder) {
69 builder.startObject(1);
70 }
71 static addA(builder, aOffset) {
72 builder.addFieldOffset(0, aOffset, 0);
73 }
74 static endTableB(builder) {
75 const offset = builder.endObject();
76 return offset;
77 }
78 static createTableB(builder, aOffset) {
79 TableB.startTableB(builder);
80 TableB.addA(builder, aOffset);
81 return TableB.endTableB(builder);
82 }
83 serialize() {
84 return this.bb.bytes();
85 }
86 static deserialize(buffer) {
87 return TableB.getRootAsTableB(new flatbuffers.ByteBuffer(buffer));
88 }
89 unpack() {
90 return new TableBT(this.a() !== null ? this.a().unpack() : null);
91 }
92 unpackTo(_o) {
93 _o.a = this.a() !== null ? this.a().unpack() : null;
94 }
95};
96var TableBT = class {
97 constructor(a = null) {
98 this.a = a;
99 }
100 pack(builder) {
101 const a = this.a !== null ? this.a.pack(builder) : 0;
102 return TableB.createTableB(builder, a);
103 }
104};
105
106// table-a.js
107var TableA = class {
108 constructor() {
109 this.bb = null;
110 this.bb_pos = 0;
111 }
112 __init(i, bb) {
113 this.bb_pos = i;
114 this.bb = bb;
115 return this;
116 }
117 static getRootAsTableA(bb, obj) {
118 return (obj || new TableA()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
119 }
120 static getSizePrefixedRootAsTableA(bb, obj) {
121 bb.setPosition(bb.position() + flatbuffers2.SIZE_PREFIX_LENGTH);
122 return (obj || new TableA()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
123 }
124 b(obj) {
125 const offset = this.bb.__offset(this.bb_pos, 4);
126 return offset ? (obj || new TableB()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
127 }
128 static getFullyQualifiedName() {
129 return "TableA";
130 }
131 static startTableA(builder) {
132 builder.startObject(1);
133 }
134 static addB(builder, bOffset) {
135 builder.addFieldOffset(0, bOffset, 0);
136 }
137 static endTableA(builder) {
138 const offset = builder.endObject();
139 return offset;
140 }
141 static createTableA(builder, bOffset) {
142 TableA.startTableA(builder);
143 TableA.addB(builder, bOffset);
144 return TableA.endTableA(builder);
145 }
146 serialize() {
147 return this.bb.bytes();
148 }
149 static deserialize(buffer) {
150 return TableA.getRootAsTableA(new flatbuffers2.ByteBuffer(buffer));
151 }
152 unpack() {
153 return new TableAT(this.b() !== null ? this.b().unpack() : null);
154 }
155 unpackTo(_o) {
156 _o.b = this.b() !== null ? this.b().unpack() : null;
157 }
158};
159var TableAT = class {
160 constructor(b = null) {
161 this.b = b;
162 }
163 pack(builder) {
164 const b = this.b !== null ? this.b.pack(builder) : 0;
165 return TableA.createTableA(builder, b);
166 }
167};
168
169// my-game.js
170var my_game_exports = {};
171__export(my_game_exports, {
172 Example: () => example_exports,
173 Example2: () => example2_exports,
174 InParentNamespace: () => InParentNamespace,
175 InParentNamespaceT: () => InParentNamespaceT,
176 OtherNameSpace: () => other_name_space_exports
177});
178
179// my-game/in-parent-namespace.js
180var flatbuffers3 = __toESM(require("flatbuffers"), 1);
181var InParentNamespace = class {
182 constructor() {
183 this.bb = null;
184 this.bb_pos = 0;
185 }
186 __init(i, bb) {
187 this.bb_pos = i;
188 this.bb = bb;
189 return this;
190 }
191 static getRootAsInParentNamespace(bb, obj) {
192 return (obj || new InParentNamespace()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
193 }
194 static getSizePrefixedRootAsInParentNamespace(bb, obj) {
195 bb.setPosition(bb.position() + flatbuffers3.SIZE_PREFIX_LENGTH);
196 return (obj || new InParentNamespace()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
197 }
198 static getFullyQualifiedName() {
199 return "MyGame.InParentNamespace";
200 }
201 static startInParentNamespace(builder) {
202 builder.startObject(0);
203 }
204 static endInParentNamespace(builder) {
205 const offset = builder.endObject();
206 return offset;
207 }
208 static createInParentNamespace(builder) {
209 InParentNamespace.startInParentNamespace(builder);
210 return InParentNamespace.endInParentNamespace(builder);
211 }
212 serialize() {
213 return this.bb.bytes();
214 }
215 static deserialize(buffer) {
216 return InParentNamespace.getRootAsInParentNamespace(new flatbuffers3.ByteBuffer(buffer));
217 }
218 unpack() {
219 return new InParentNamespaceT();
220 }
221 unpackTo(_o) {
222 }
223};
224var InParentNamespaceT = class {
225 constructor() {
226 }
227 pack(builder) {
228 return InParentNamespace.createInParentNamespace(builder);
229 }
230};
231
232// my-game/example.js
233var example_exports = {};
234__export(example_exports, {
235 Ability: () => Ability,
236 AbilityT: () => AbilityT,
237 Any: () => Any,
238 AnyAmbiguousAliases: () => AnyAmbiguousAliases,
239 AnyUniqueAliases: () => AnyUniqueAliases,
240 Color: () => Color,
241 LongEnum: () => LongEnum,
242 Monster: () => Monster2,
243 MonsterT: () => MonsterT2,
244 Race: () => Race,
245 Referrable: () => Referrable,
246 ReferrableT: () => ReferrableT,
247 Stat: () => Stat,
248 StatT: () => StatT,
249 StructOfStructs: () => StructOfStructs,
250 StructOfStructsOfStructs: () => StructOfStructsOfStructs,
251 StructOfStructsOfStructsT: () => StructOfStructsOfStructsT,
252 StructOfStructsT: () => StructOfStructsT,
253 Test: () => Test,
254 TestSimpleTableWithEnum: () => TestSimpleTableWithEnum,
255 TestSimpleTableWithEnumT: () => TestSimpleTableWithEnumT,
256 TestT: () => TestT,
257 TypeAliases: () => TypeAliases,
258 TypeAliasesT: () => TypeAliasesT,
259 Vec3: () => Vec3,
260 Vec3T: () => Vec3T
261});
262
263// my-game/example/ability.js
264var Ability = class {
265 constructor() {
266 this.bb = null;
267 this.bb_pos = 0;
268 }
269 __init(i, bb) {
270 this.bb_pos = i;
271 this.bb = bb;
272 return this;
273 }
274 id() {
275 return this.bb.readUint32(this.bb_pos);
276 }
277 mutate_id(value) {
278 this.bb.writeUint32(this.bb_pos + 0, value);
279 return true;
280 }
281 distance() {
282 return this.bb.readUint32(this.bb_pos + 4);
283 }
284 mutate_distance(value) {
285 this.bb.writeUint32(this.bb_pos + 4, value);
286 return true;
287 }
288 static getFullyQualifiedName() {
289 return "MyGame.Example.Ability";
290 }
291 static sizeOf() {
292 return 8;
293 }
294 static createAbility(builder, id, distance) {
295 builder.prep(4, 8);
296 builder.writeInt32(distance);
297 builder.writeInt32(id);
298 return builder.offset();
299 }
300 unpack() {
301 return new AbilityT(this.id(), this.distance());
302 }
303 unpackTo(_o) {
304 _o.id = this.id();
305 _o.distance = this.distance();
306 }
307};
308var AbilityT = class {
309 constructor(id = 0, distance = 0) {
310 this.id = id;
311 this.distance = distance;
312 }
313 pack(builder) {
314 return Ability.createAbility(builder, this.id, this.distance);
315 }
316};
317
318// my-game/example2/monster.js
319var flatbuffers4 = __toESM(require("flatbuffers"), 1);
320var Monster = class {
321 constructor() {
322 this.bb = null;
323 this.bb_pos = 0;
324 }
325 __init(i, bb) {
326 this.bb_pos = i;
327 this.bb = bb;
328 return this;
329 }
330 static getRootAsMonster(bb, obj) {
331 return (obj || new Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
332 }
333 static getSizePrefixedRootAsMonster(bb, obj) {
334 bb.setPosition(bb.position() + flatbuffers4.SIZE_PREFIX_LENGTH);
335 return (obj || new Monster()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
336 }
337 static getFullyQualifiedName() {
338 return "MyGame.Example2.Monster";
339 }
340 static startMonster(builder) {
341 builder.startObject(0);
342 }
343 static endMonster(builder) {
344 const offset = builder.endObject();
345 return offset;
346 }
347 static createMonster(builder) {
348 Monster.startMonster(builder);
349 return Monster.endMonster(builder);
350 }
351 serialize() {
352 return this.bb.bytes();
353 }
354 static deserialize(buffer) {
355 return Monster.getRootAsMonster(new flatbuffers4.ByteBuffer(buffer));
356 }
357 unpack() {
358 return new MonsterT();
359 }
360 unpackTo(_o) {
361 }
362};
363var MonsterT = class {
364 constructor() {
365 }
366 pack(builder) {
367 return Monster.createMonster(builder);
368 }
369};
370
371// my-game/example/monster.js
372var flatbuffers8 = __toESM(require("flatbuffers"), 1);
373
374// my-game/example/any-ambiguous-aliases.js
375var AnyAmbiguousAliases;
376(function(AnyAmbiguousAliases2) {
377 AnyAmbiguousAliases2[AnyAmbiguousAliases2["NONE"] = 0] = "NONE";
378 AnyAmbiguousAliases2[AnyAmbiguousAliases2["M1"] = 1] = "M1";
379 AnyAmbiguousAliases2[AnyAmbiguousAliases2["M2"] = 2] = "M2";
380 AnyAmbiguousAliases2[AnyAmbiguousAliases2["M3"] = 3] = "M3";
381})(AnyAmbiguousAliases = AnyAmbiguousAliases || (AnyAmbiguousAliases = {}));
382function unionToAnyAmbiguousAliases(type, accessor) {
383 switch (AnyAmbiguousAliases[type]) {
384 case "NONE":
385 return null;
386 case "M1":
387 return accessor(new Monster2());
388 case "M2":
389 return accessor(new Monster2());
390 case "M3":
391 return accessor(new Monster2());
392 default:
393 return null;
394 }
395}
396
397// my-game/example/test-simple-table-with-enum.js
398var flatbuffers5 = __toESM(require("flatbuffers"), 1);
399
400// my-game/example/color.js
401var Color;
402(function(Color2) {
403 Color2[Color2["Red"] = 1] = "Red";
404 Color2[Color2["Green"] = 2] = "Green";
405 Color2[Color2["Blue"] = 8] = "Blue";
406})(Color = Color || (Color = {}));
407
408// my-game/example/test-simple-table-with-enum.js
409var TestSimpleTableWithEnum = class {
410 constructor() {
411 this.bb = null;
412 this.bb_pos = 0;
413 }
414 __init(i, bb) {
415 this.bb_pos = i;
416 this.bb = bb;
417 return this;
418 }
419 static getRootAsTestSimpleTableWithEnum(bb, obj) {
420 return (obj || new TestSimpleTableWithEnum()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
421 }
422 static getSizePrefixedRootAsTestSimpleTableWithEnum(bb, obj) {
423 bb.setPosition(bb.position() + flatbuffers5.SIZE_PREFIX_LENGTH);
424 return (obj || new TestSimpleTableWithEnum()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
425 }
426 color() {
427 const offset = this.bb.__offset(this.bb_pos, 4);
428 return offset ? this.bb.readUint8(this.bb_pos + offset) : Color.Green;
429 }
430 mutate_color(value) {
431 const offset = this.bb.__offset(this.bb_pos, 4);
432 if (offset === 0) {
433 return false;
434 }
435 this.bb.writeUint8(this.bb_pos + offset, value);
436 return true;
437 }
438 static getFullyQualifiedName() {
439 return "MyGame.Example.TestSimpleTableWithEnum";
440 }
441 static startTestSimpleTableWithEnum(builder) {
442 builder.startObject(1);
443 }
444 static addColor(builder, color) {
445 builder.addFieldInt8(0, color, Color.Green);
446 }
447 static endTestSimpleTableWithEnum(builder) {
448 const offset = builder.endObject();
449 return offset;
450 }
451 static createTestSimpleTableWithEnum(builder, color) {
452 TestSimpleTableWithEnum.startTestSimpleTableWithEnum(builder);
453 TestSimpleTableWithEnum.addColor(builder, color);
454 return TestSimpleTableWithEnum.endTestSimpleTableWithEnum(builder);
455 }
456 serialize() {
457 return this.bb.bytes();
458 }
459 static deserialize(buffer) {
460 return TestSimpleTableWithEnum.getRootAsTestSimpleTableWithEnum(new flatbuffers5.ByteBuffer(buffer));
461 }
462 unpack() {
463 return new TestSimpleTableWithEnumT(this.color());
464 }
465 unpackTo(_o) {
466 _o.color = this.color();
467 }
468};
469var TestSimpleTableWithEnumT = class {
470 constructor(color = Color.Green) {
471 this.color = color;
472 }
473 pack(builder) {
474 return TestSimpleTableWithEnum.createTestSimpleTableWithEnum(builder, this.color);
475 }
476};
477
478// my-game/example/any-unique-aliases.js
479var AnyUniqueAliases;
480(function(AnyUniqueAliases2) {
481 AnyUniqueAliases2[AnyUniqueAliases2["NONE"] = 0] = "NONE";
482 AnyUniqueAliases2[AnyUniqueAliases2["M"] = 1] = "M";
483 AnyUniqueAliases2[AnyUniqueAliases2["TS"] = 2] = "TS";
484 AnyUniqueAliases2[AnyUniqueAliases2["M2"] = 3] = "M2";
485})(AnyUniqueAliases = AnyUniqueAliases || (AnyUniqueAliases = {}));
486function unionToAnyUniqueAliases(type, accessor) {
487 switch (AnyUniqueAliases[type]) {
488 case "NONE":
489 return null;
490 case "M":
491 return accessor(new Monster2());
492 case "TS":
493 return accessor(new TestSimpleTableWithEnum());
494 case "M2":
495 return accessor(new Monster());
496 default:
497 return null;
498 }
499}
500
501// my-game/example/race.js
502var Race;
503(function(Race2) {
504 Race2[Race2["None"] = -1] = "None";
505 Race2[Race2["Human"] = 0] = "Human";
506 Race2[Race2["Dwarf"] = 1] = "Dwarf";
507 Race2[Race2["Elf"] = 2] = "Elf";
508})(Race = Race || (Race = {}));
509
510// my-game/example/referrable.js
511var flatbuffers6 = __toESM(require("flatbuffers"), 1);
512var Referrable = class {
513 constructor() {
514 this.bb = null;
515 this.bb_pos = 0;
516 }
517 __init(i, bb) {
518 this.bb_pos = i;
519 this.bb = bb;
520 return this;
521 }
522 static getRootAsReferrable(bb, obj) {
523 return (obj || new Referrable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
524 }
525 static getSizePrefixedRootAsReferrable(bb, obj) {
526 bb.setPosition(bb.position() + flatbuffers6.SIZE_PREFIX_LENGTH);
527 return (obj || new Referrable()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
528 }
529 id() {
530 const offset = this.bb.__offset(this.bb_pos, 4);
531 return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt("0");
532 }
533 mutate_id(value) {
534 const offset = this.bb.__offset(this.bb_pos, 4);
535 if (offset === 0) {
536 return false;
537 }
538 this.bb.writeUint64(this.bb_pos + offset, value);
539 return true;
540 }
541 static getFullyQualifiedName() {
542 return "MyGame.Example.Referrable";
543 }
544 static startReferrable(builder) {
545 builder.startObject(1);
546 }
547 static addId(builder, id) {
548 builder.addFieldInt64(0, id, BigInt("0"));
549 }
550 static endReferrable(builder) {
551 const offset = builder.endObject();
552 return offset;
553 }
554 static createReferrable(builder, id) {
555 Referrable.startReferrable(builder);
556 Referrable.addId(builder, id);
557 return Referrable.endReferrable(builder);
558 }
559 serialize() {
560 return this.bb.bytes();
561 }
562 static deserialize(buffer) {
563 return Referrable.getRootAsReferrable(new flatbuffers6.ByteBuffer(buffer));
564 }
565 unpack() {
566 return new ReferrableT(this.id());
567 }
568 unpackTo(_o) {
569 _o.id = this.id();
570 }
571};
572var ReferrableT = class {
573 constructor(id = BigInt("0")) {
574 this.id = id;
575 }
576 pack(builder) {
577 return Referrable.createReferrable(builder, this.id);
578 }
579};
580
581// my-game/example/stat.js
582var flatbuffers7 = __toESM(require("flatbuffers"), 1);
583var Stat = class {
584 constructor() {
585 this.bb = null;
586 this.bb_pos = 0;
587 }
588 __init(i, bb) {
589 this.bb_pos = i;
590 this.bb = bb;
591 return this;
592 }
593 static getRootAsStat(bb, obj) {
594 return (obj || new Stat()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
595 }
596 static getSizePrefixedRootAsStat(bb, obj) {
597 bb.setPosition(bb.position() + flatbuffers7.SIZE_PREFIX_LENGTH);
598 return (obj || new Stat()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
599 }
600 id(optionalEncoding) {
601 const offset = this.bb.__offset(this.bb_pos, 4);
602 return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
603 }
604 val() {
605 const offset = this.bb.__offset(this.bb_pos, 6);
606 return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt("0");
607 }
608 mutate_val(value) {
609 const offset = this.bb.__offset(this.bb_pos, 6);
610 if (offset === 0) {
611 return false;
612 }
613 this.bb.writeInt64(this.bb_pos + offset, value);
614 return true;
615 }
616 count() {
617 const offset = this.bb.__offset(this.bb_pos, 8);
618 return offset ? this.bb.readUint16(this.bb_pos + offset) : 0;
619 }
620 mutate_count(value) {
621 const offset = this.bb.__offset(this.bb_pos, 8);
622 if (offset === 0) {
623 return false;
624 }
625 this.bb.writeUint16(this.bb_pos + offset, value);
626 return true;
627 }
628 static getFullyQualifiedName() {
629 return "MyGame.Example.Stat";
630 }
631 static startStat(builder) {
632 builder.startObject(3);
633 }
634 static addId(builder, idOffset) {
635 builder.addFieldOffset(0, idOffset, 0);
636 }
637 static addVal(builder, val) {
638 builder.addFieldInt64(1, val, BigInt("0"));
639 }
640 static addCount(builder, count) {
641 builder.addFieldInt16(2, count, 0);
642 }
643 static endStat(builder) {
644 const offset = builder.endObject();
645 return offset;
646 }
647 static createStat(builder, idOffset, val, count) {
648 Stat.startStat(builder);
649 Stat.addId(builder, idOffset);
650 Stat.addVal(builder, val);
651 Stat.addCount(builder, count);
652 return Stat.endStat(builder);
653 }
654 serialize() {
655 return this.bb.bytes();
656 }
657 static deserialize(buffer) {
658 return Stat.getRootAsStat(new flatbuffers7.ByteBuffer(buffer));
659 }
660 unpack() {
661 return new StatT(this.id(), this.val(), this.count());
662 }
663 unpackTo(_o) {
664 _o.id = this.id();
665 _o.val = this.val();
666 _o.count = this.count();
667 }
668};
669var StatT = class {
670 constructor(id = null, val = BigInt("0"), count = 0) {
671 this.id = id;
672 this.val = val;
673 this.count = count;
674 }
675 pack(builder) {
676 const id = this.id !== null ? builder.createString(this.id) : 0;
677 return Stat.createStat(builder, id, this.val, this.count);
678 }
679};
680
681// my-game/example/test.js
682var Test = class {
683 constructor() {
684 this.bb = null;
685 this.bb_pos = 0;
686 }
687 __init(i, bb) {
688 this.bb_pos = i;
689 this.bb = bb;
690 return this;
691 }
692 a() {
693 return this.bb.readInt16(this.bb_pos);
694 }
695 mutate_a(value) {
696 this.bb.writeInt16(this.bb_pos + 0, value);
697 return true;
698 }
699 b() {
700 return this.bb.readInt8(this.bb_pos + 2);
701 }
702 mutate_b(value) {
703 this.bb.writeInt8(this.bb_pos + 2, value);
704 return true;
705 }
706 static getFullyQualifiedName() {
707 return "MyGame.Example.Test";
708 }
709 static sizeOf() {
710 return 4;
711 }
712 static createTest(builder, a, b) {
713 builder.prep(2, 4);
714 builder.pad(1);
715 builder.writeInt8(b);
716 builder.writeInt16(a);
717 return builder.offset();
718 }
719 unpack() {
720 return new TestT(this.a(), this.b());
721 }
722 unpackTo(_o) {
723 _o.a = this.a();
724 _o.b = this.b();
725 }
726};
727var TestT = class {
728 constructor(a = 0, b = 0) {
729 this.a = a;
730 this.b = b;
731 }
732 pack(builder) {
733 return Test.createTest(builder, this.a, this.b);
734 }
735};
736
737// my-game/example/vec3.js
738var Vec3 = class {
739 constructor() {
740 this.bb = null;
741 this.bb_pos = 0;
742 }
743 __init(i, bb) {
744 this.bb_pos = i;
745 this.bb = bb;
746 return this;
747 }
748 x() {
749 return this.bb.readFloat32(this.bb_pos);
750 }
751 mutate_x(value) {
752 this.bb.writeFloat32(this.bb_pos + 0, value);
753 return true;
754 }
755 y() {
756 return this.bb.readFloat32(this.bb_pos + 4);
757 }
758 mutate_y(value) {
759 this.bb.writeFloat32(this.bb_pos + 4, value);
760 return true;
761 }
762 z() {
763 return this.bb.readFloat32(this.bb_pos + 8);
764 }
765 mutate_z(value) {
766 this.bb.writeFloat32(this.bb_pos + 8, value);
767 return true;
768 }
769 test1() {
770 return this.bb.readFloat64(this.bb_pos + 16);
771 }
772 mutate_test1(value) {
773 this.bb.writeFloat64(this.bb_pos + 16, value);
774 return true;
775 }
776 test2() {
777 return this.bb.readUint8(this.bb_pos + 24);
778 }
779 mutate_test2(value) {
780 this.bb.writeUint8(this.bb_pos + 24, value);
781 return true;
782 }
783 test3(obj) {
784 return (obj || new Test()).__init(this.bb_pos + 26, this.bb);
785 }
786 static getFullyQualifiedName() {
787 return "MyGame.Example.Vec3";
788 }
789 static sizeOf() {
790 return 32;
791 }
792 static createVec3(builder, x, y, z, test1, test2, test3_a, test3_b) {
793 builder.prep(8, 32);
794 builder.pad(2);
795 builder.prep(2, 4);
796 builder.pad(1);
797 builder.writeInt8(test3_b);
798 builder.writeInt16(test3_a);
799 builder.pad(1);
800 builder.writeInt8(test2);
801 builder.writeFloat64(test1);
802 builder.pad(4);
803 builder.writeFloat32(z);
804 builder.writeFloat32(y);
805 builder.writeFloat32(x);
806 return builder.offset();
807 }
808 unpack() {
809 return new Vec3T(this.x(), this.y(), this.z(), this.test1(), this.test2(), this.test3() !== null ? this.test3().unpack() : null);
810 }
811 unpackTo(_o) {
812 _o.x = this.x();
813 _o.y = this.y();
814 _o.z = this.z();
815 _o.test1 = this.test1();
816 _o.test2 = this.test2();
817 _o.test3 = this.test3() !== null ? this.test3().unpack() : null;
818 }
819};
820var Vec3T = class {
821 constructor(x = 0, y = 0, z = 0, test1 = 0, test2 = Color.Red, test3 = null) {
822 this.x = x;
823 this.y = y;
824 this.z = z;
825 this.test1 = test1;
826 this.test2 = test2;
827 this.test3 = test3;
828 }
829 pack(builder) {
830 return Vec3.createVec3(builder, this.x, this.y, this.z, this.test1, this.test2, this.test3?.a ?? 0, this.test3?.b ?? 0);
831 }
832};
833
834// my-game/example/monster.js
835var Monster2 = class {
836 constructor() {
837 this.bb = null;
838 this.bb_pos = 0;
839 }
840 __init(i, bb) {
841 this.bb_pos = i;
842 this.bb = bb;
843 return this;
844 }
845 static getRootAsMonster(bb, obj) {
846 return (obj || new Monster2()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
847 }
848 static getSizePrefixedRootAsMonster(bb, obj) {
849 bb.setPosition(bb.position() + flatbuffers8.SIZE_PREFIX_LENGTH);
850 return (obj || new Monster2()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
851 }
852 static bufferHasIdentifier(bb) {
853 return bb.__has_identifier("MONS");
854 }
855 pos(obj) {
856 const offset = this.bb.__offset(this.bb_pos, 4);
857 return offset ? (obj || new Vec3()).__init(this.bb_pos + offset, this.bb) : null;
858 }
859 mana() {
860 const offset = this.bb.__offset(this.bb_pos, 6);
861 return offset ? this.bb.readInt16(this.bb_pos + offset) : 150;
862 }
863 mutate_mana(value) {
864 const offset = this.bb.__offset(this.bb_pos, 6);
865 if (offset === 0) {
866 return false;
867 }
868 this.bb.writeInt16(this.bb_pos + offset, value);
869 return true;
870 }
871 hp() {
872 const offset = this.bb.__offset(this.bb_pos, 8);
873 return offset ? this.bb.readInt16(this.bb_pos + offset) : 100;
874 }
875 mutate_hp(value) {
876 const offset = this.bb.__offset(this.bb_pos, 8);
877 if (offset === 0) {
878 return false;
879 }
880 this.bb.writeInt16(this.bb_pos + offset, value);
881 return true;
882 }
883 name(optionalEncoding) {
884 const offset = this.bb.__offset(this.bb_pos, 10);
885 return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
886 }
887 inventory(index) {
888 const offset = this.bb.__offset(this.bb_pos, 14);
889 return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
890 }
891 inventoryLength() {
892 const offset = this.bb.__offset(this.bb_pos, 14);
893 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
894 }
895 inventoryArray() {
896 const offset = this.bb.__offset(this.bb_pos, 14);
897 return offset ? new Uint8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
898 }
899 color() {
900 const offset = this.bb.__offset(this.bb_pos, 16);
901 return offset ? this.bb.readUint8(this.bb_pos + offset) : Color.Blue;
902 }
903 mutate_color(value) {
904 const offset = this.bb.__offset(this.bb_pos, 16);
905 if (offset === 0) {
906 return false;
907 }
908 this.bb.writeUint8(this.bb_pos + offset, value);
909 return true;
910 }
911 testType() {
912 const offset = this.bb.__offset(this.bb_pos, 18);
913 return offset ? this.bb.readUint8(this.bb_pos + offset) : Any.NONE;
914 }
915 test(obj) {
916 const offset = this.bb.__offset(this.bb_pos, 20);
917 return offset ? this.bb.__union(obj, this.bb_pos + offset) : null;
918 }
919 test4(index, obj) {
920 const offset = this.bb.__offset(this.bb_pos, 22);
921 return offset ? (obj || new Test()).__init(this.bb.__vector(this.bb_pos + offset) + index * 4, this.bb) : null;
922 }
923 test4Length() {
924 const offset = this.bb.__offset(this.bb_pos, 22);
925 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
926 }
927 testarrayofstring(index, optionalEncoding) {
928 const offset = this.bb.__offset(this.bb_pos, 24);
929 return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
930 }
931 testarrayofstringLength() {
932 const offset = this.bb.__offset(this.bb_pos, 24);
933 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
934 }
935 /**
936 * an example documentation comment: this will end up in the generated code
937 * multiline too
938 */
939 testarrayoftables(index, obj) {
940 const offset = this.bb.__offset(this.bb_pos, 26);
941 return offset ? (obj || new Monster2()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
942 }
943 testarrayoftablesLength() {
944 const offset = this.bb.__offset(this.bb_pos, 26);
945 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
946 }
947 enemy(obj) {
948 const offset = this.bb.__offset(this.bb_pos, 28);
949 return offset ? (obj || new Monster2()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
950 }
951 testnestedflatbuffer(index) {
952 const offset = this.bb.__offset(this.bb_pos, 30);
953 return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
954 }
955 testnestedflatbufferLength() {
956 const offset = this.bb.__offset(this.bb_pos, 30);
957 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
958 }
959 testnestedflatbufferArray() {
960 const offset = this.bb.__offset(this.bb_pos, 30);
961 return offset ? new Uint8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
962 }
963 testempty(obj) {
964 const offset = this.bb.__offset(this.bb_pos, 32);
965 return offset ? (obj || new Stat()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
966 }
967 testbool() {
968 const offset = this.bb.__offset(this.bb_pos, 34);
969 return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
970 }
971 mutate_testbool(value) {
972 const offset = this.bb.__offset(this.bb_pos, 34);
973 if (offset === 0) {
974 return false;
975 }
976 this.bb.writeInt8(this.bb_pos + offset, +value);
977 return true;
978 }
979 testhashs32Fnv1() {
980 const offset = this.bb.__offset(this.bb_pos, 36);
981 return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
982 }
983 mutate_testhashs32_fnv1(value) {
984 const offset = this.bb.__offset(this.bb_pos, 36);
985 if (offset === 0) {
986 return false;
987 }
988 this.bb.writeInt32(this.bb_pos + offset, value);
989 return true;
990 }
991 testhashu32Fnv1() {
992 const offset = this.bb.__offset(this.bb_pos, 38);
993 return offset ? this.bb.readUint32(this.bb_pos + offset) : 0;
994 }
995 mutate_testhashu32_fnv1(value) {
996 const offset = this.bb.__offset(this.bb_pos, 38);
997 if (offset === 0) {
998 return false;
999 }
1000 this.bb.writeUint32(this.bb_pos + offset, value);
1001 return true;
1002 }
1003 testhashs64Fnv1() {
1004 const offset = this.bb.__offset(this.bb_pos, 40);
1005 return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt("0");
1006 }
1007 mutate_testhashs64_fnv1(value) {
1008 const offset = this.bb.__offset(this.bb_pos, 40);
1009 if (offset === 0) {
1010 return false;
1011 }
1012 this.bb.writeInt64(this.bb_pos + offset, value);
1013 return true;
1014 }
1015 testhashu64Fnv1() {
1016 const offset = this.bb.__offset(this.bb_pos, 42);
1017 return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt("0");
1018 }
1019 mutate_testhashu64_fnv1(value) {
1020 const offset = this.bb.__offset(this.bb_pos, 42);
1021 if (offset === 0) {
1022 return false;
1023 }
1024 this.bb.writeUint64(this.bb_pos + offset, value);
1025 return true;
1026 }
1027 testhashs32Fnv1a() {
1028 const offset = this.bb.__offset(this.bb_pos, 44);
1029 return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
1030 }
1031 mutate_testhashs32_fnv1a(value) {
1032 const offset = this.bb.__offset(this.bb_pos, 44);
1033 if (offset === 0) {
1034 return false;
1035 }
1036 this.bb.writeInt32(this.bb_pos + offset, value);
1037 return true;
1038 }
1039 testhashu32Fnv1a() {
1040 const offset = this.bb.__offset(this.bb_pos, 46);
1041 return offset ? this.bb.readUint32(this.bb_pos + offset) : 0;
1042 }
1043 mutate_testhashu32_fnv1a(value) {
1044 const offset = this.bb.__offset(this.bb_pos, 46);
1045 if (offset === 0) {
1046 return false;
1047 }
1048 this.bb.writeUint32(this.bb_pos + offset, value);
1049 return true;
1050 }
1051 testhashs64Fnv1a() {
1052 const offset = this.bb.__offset(this.bb_pos, 48);
1053 return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt("0");
1054 }
1055 mutate_testhashs64_fnv1a(value) {
1056 const offset = this.bb.__offset(this.bb_pos, 48);
1057 if (offset === 0) {
1058 return false;
1059 }
1060 this.bb.writeInt64(this.bb_pos + offset, value);
1061 return true;
1062 }
1063 testhashu64Fnv1a() {
1064 const offset = this.bb.__offset(this.bb_pos, 50);
1065 return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt("0");
1066 }
1067 mutate_testhashu64_fnv1a(value) {
1068 const offset = this.bb.__offset(this.bb_pos, 50);
1069 if (offset === 0) {
1070 return false;
1071 }
1072 this.bb.writeUint64(this.bb_pos + offset, value);
1073 return true;
1074 }
1075 testarrayofbools(index) {
1076 const offset = this.bb.__offset(this.bb_pos, 52);
1077 return offset ? !!this.bb.readInt8(this.bb.__vector(this.bb_pos + offset) + index) : false;
1078 }
1079 testarrayofboolsLength() {
1080 const offset = this.bb.__offset(this.bb_pos, 52);
1081 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
1082 }
1083 testarrayofboolsArray() {
1084 const offset = this.bb.__offset(this.bb_pos, 52);
1085 return offset ? new Int8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
1086 }
1087 testf() {
1088 const offset = this.bb.__offset(this.bb_pos, 54);
1089 return offset ? this.bb.readFloat32(this.bb_pos + offset) : 3.14159;
1090 }
1091 mutate_testf(value) {
1092 const offset = this.bb.__offset(this.bb_pos, 54);
1093 if (offset === 0) {
1094 return false;
1095 }
1096 this.bb.writeFloat32(this.bb_pos + offset, value);
1097 return true;
1098 }
1099 testf2() {
1100 const offset = this.bb.__offset(this.bb_pos, 56);
1101 return offset ? this.bb.readFloat32(this.bb_pos + offset) : 3;
1102 }
1103 mutate_testf2(value) {
1104 const offset = this.bb.__offset(this.bb_pos, 56);
1105 if (offset === 0) {
1106 return false;
1107 }
1108 this.bb.writeFloat32(this.bb_pos + offset, value);
1109 return true;
1110 }
1111 testf3() {
1112 const offset = this.bb.__offset(this.bb_pos, 58);
1113 return offset ? this.bb.readFloat32(this.bb_pos + offset) : 0;
1114 }
1115 mutate_testf3(value) {
1116 const offset = this.bb.__offset(this.bb_pos, 58);
1117 if (offset === 0) {
1118 return false;
1119 }
1120 this.bb.writeFloat32(this.bb_pos + offset, value);
1121 return true;
1122 }
1123 testarrayofstring2(index, optionalEncoding) {
1124 const offset = this.bb.__offset(this.bb_pos, 60);
1125 return offset ? this.bb.__string(this.bb.__vector(this.bb_pos + offset) + index * 4, optionalEncoding) : null;
1126 }
1127 testarrayofstring2Length() {
1128 const offset = this.bb.__offset(this.bb_pos, 60);
1129 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
1130 }
1131 testarrayofsortedstruct(index, obj) {
1132 const offset = this.bb.__offset(this.bb_pos, 62);
1133 return offset ? (obj || new Ability()).__init(this.bb.__vector(this.bb_pos + offset) + index * 8, this.bb) : null;
1134 }
1135 testarrayofsortedstructLength() {
1136 const offset = this.bb.__offset(this.bb_pos, 62);
1137 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
1138 }
1139 flex(index) {
1140 const offset = this.bb.__offset(this.bb_pos, 64);
1141 return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
1142 }
1143 flexLength() {
1144 const offset = this.bb.__offset(this.bb_pos, 64);
1145 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
1146 }
1147 flexArray() {
1148 const offset = this.bb.__offset(this.bb_pos, 64);
1149 return offset ? new Uint8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
1150 }
1151 test5(index, obj) {
1152 const offset = this.bb.__offset(this.bb_pos, 66);
1153 return offset ? (obj || new Test()).__init(this.bb.__vector(this.bb_pos + offset) + index * 4, this.bb) : null;
1154 }
1155 test5Length() {
1156 const offset = this.bb.__offset(this.bb_pos, 66);
1157 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
1158 }
1159 vectorOfLongs(index) {
1160 const offset = this.bb.__offset(this.bb_pos, 68);
1161 return offset ? this.bb.readInt64(this.bb.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
1162 }
1163 vectorOfLongsLength() {
1164 const offset = this.bb.__offset(this.bb_pos, 68);
1165 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
1166 }
1167 vectorOfDoubles(index) {
1168 const offset = this.bb.__offset(this.bb_pos, 70);
1169 return offset ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + offset) + index * 8) : 0;
1170 }
1171 vectorOfDoublesLength() {
1172 const offset = this.bb.__offset(this.bb_pos, 70);
1173 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
1174 }
1175 vectorOfDoublesArray() {
1176 const offset = this.bb.__offset(this.bb_pos, 70);
1177 return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
1178 }
1179 parentNamespaceTest(obj) {
1180 const offset = this.bb.__offset(this.bb_pos, 72);
1181 return offset ? (obj || new InParentNamespace()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
1182 }
1183 vectorOfReferrables(index, obj) {
1184 const offset = this.bb.__offset(this.bb_pos, 74);
1185 return offset ? (obj || new Referrable()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
1186 }
1187 vectorOfReferrablesLength() {
1188 const offset = this.bb.__offset(this.bb_pos, 74);
1189 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
1190 }
1191 singleWeakReference() {
1192 const offset = this.bb.__offset(this.bb_pos, 76);
1193 return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt("0");
1194 }
1195 mutate_single_weak_reference(value) {
1196 const offset = this.bb.__offset(this.bb_pos, 76);
1197 if (offset === 0) {
1198 return false;
1199 }
1200 this.bb.writeUint64(this.bb_pos + offset, value);
1201 return true;
1202 }
1203 vectorOfWeakReferences(index) {
1204 const offset = this.bb.__offset(this.bb_pos, 78);
1205 return offset ? this.bb.readUint64(this.bb.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
1206 }
1207 vectorOfWeakReferencesLength() {
1208 const offset = this.bb.__offset(this.bb_pos, 78);
1209 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
1210 }
1211 vectorOfStrongReferrables(index, obj) {
1212 const offset = this.bb.__offset(this.bb_pos, 80);
1213 return offset ? (obj || new Referrable()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
1214 }
1215 vectorOfStrongReferrablesLength() {
1216 const offset = this.bb.__offset(this.bb_pos, 80);
1217 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
1218 }
1219 coOwningReference() {
1220 const offset = this.bb.__offset(this.bb_pos, 82);
1221 return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt("0");
1222 }
1223 mutate_co_owning_reference(value) {
1224 const offset = this.bb.__offset(this.bb_pos, 82);
1225 if (offset === 0) {
1226 return false;
1227 }
1228 this.bb.writeUint64(this.bb_pos + offset, value);
1229 return true;
1230 }
1231 vectorOfCoOwningReferences(index) {
1232 const offset = this.bb.__offset(this.bb_pos, 84);
1233 return offset ? this.bb.readUint64(this.bb.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
1234 }
1235 vectorOfCoOwningReferencesLength() {
1236 const offset = this.bb.__offset(this.bb_pos, 84);
1237 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
1238 }
1239 nonOwningReference() {
1240 const offset = this.bb.__offset(this.bb_pos, 86);
1241 return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt("0");
1242 }
1243 mutate_non_owning_reference(value) {
1244 const offset = this.bb.__offset(this.bb_pos, 86);
1245 if (offset === 0) {
1246 return false;
1247 }
1248 this.bb.writeUint64(this.bb_pos + offset, value);
1249 return true;
1250 }
1251 vectorOfNonOwningReferences(index) {
1252 const offset = this.bb.__offset(this.bb_pos, 88);
1253 return offset ? this.bb.readUint64(this.bb.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
1254 }
1255 vectorOfNonOwningReferencesLength() {
1256 const offset = this.bb.__offset(this.bb_pos, 88);
1257 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
1258 }
1259 anyUniqueType() {
1260 const offset = this.bb.__offset(this.bb_pos, 90);
1261 return offset ? this.bb.readUint8(this.bb_pos + offset) : AnyUniqueAliases.NONE;
1262 }
1263 anyUnique(obj) {
1264 const offset = this.bb.__offset(this.bb_pos, 92);
1265 return offset ? this.bb.__union(obj, this.bb_pos + offset) : null;
1266 }
1267 anyAmbiguousType() {
1268 const offset = this.bb.__offset(this.bb_pos, 94);
1269 return offset ? this.bb.readUint8(this.bb_pos + offset) : AnyAmbiguousAliases.NONE;
1270 }
1271 anyAmbiguous(obj) {
1272 const offset = this.bb.__offset(this.bb_pos, 96);
1273 return offset ? this.bb.__union(obj, this.bb_pos + offset) : null;
1274 }
1275 vectorOfEnums(index) {
1276 const offset = this.bb.__offset(this.bb_pos, 98);
1277 return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
1278 }
1279 vectorOfEnumsLength() {
1280 const offset = this.bb.__offset(this.bb_pos, 98);
1281 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
1282 }
1283 vectorOfEnumsArray() {
1284 const offset = this.bb.__offset(this.bb_pos, 98);
1285 return offset ? new Uint8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
1286 }
1287 signedEnum() {
1288 const offset = this.bb.__offset(this.bb_pos, 100);
1289 return offset ? this.bb.readInt8(this.bb_pos + offset) : Race.None;
1290 }
1291 mutate_signed_enum(value) {
1292 const offset = this.bb.__offset(this.bb_pos, 100);
1293 if (offset === 0) {
1294 return false;
1295 }
1296 this.bb.writeInt8(this.bb_pos + offset, value);
1297 return true;
1298 }
1299 testrequirednestedflatbuffer(index) {
1300 const offset = this.bb.__offset(this.bb_pos, 102);
1301 return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
1302 }
1303 testrequirednestedflatbufferLength() {
1304 const offset = this.bb.__offset(this.bb_pos, 102);
1305 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
1306 }
1307 testrequirednestedflatbufferArray() {
1308 const offset = this.bb.__offset(this.bb_pos, 102);
1309 return offset ? new Uint8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
1310 }
1311 scalarKeySortedTables(index, obj) {
1312 const offset = this.bb.__offset(this.bb_pos, 104);
1313 return offset ? (obj || new Stat()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
1314 }
1315 scalarKeySortedTablesLength() {
1316 const offset = this.bb.__offset(this.bb_pos, 104);
1317 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
1318 }
1319 nativeInline(obj) {
1320 const offset = this.bb.__offset(this.bb_pos, 106);
1321 return offset ? (obj || new Test()).__init(this.bb_pos + offset, this.bb) : null;
1322 }
1323 longEnumNonEnumDefault() {
1324 const offset = this.bb.__offset(this.bb_pos, 108);
1325 return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt("0");
1326 }
1327 mutate_long_enum_non_enum_default(value) {
1328 const offset = this.bb.__offset(this.bb_pos, 108);
1329 if (offset === 0) {
1330 return false;
1331 }
1332 this.bb.writeUint64(this.bb_pos + offset, value);
1333 return true;
1334 }
1335 longEnumNormalDefault() {
1336 const offset = this.bb.__offset(this.bb_pos, 110);
1337 return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt("2");
1338 }
1339 mutate_long_enum_normal_default(value) {
1340 const offset = this.bb.__offset(this.bb_pos, 110);
1341 if (offset === 0) {
1342 return false;
1343 }
1344 this.bb.writeUint64(this.bb_pos + offset, value);
1345 return true;
1346 }
1347 nanDefault() {
1348 const offset = this.bb.__offset(this.bb_pos, 112);
1349 return offset ? this.bb.readFloat32(this.bb_pos + offset) : NaN;
1350 }
1351 mutate_nan_default(value) {
1352 const offset = this.bb.__offset(this.bb_pos, 112);
1353 if (offset === 0) {
1354 return false;
1355 }
1356 this.bb.writeFloat32(this.bb_pos + offset, value);
1357 return true;
1358 }
1359 infDefault() {
1360 const offset = this.bb.__offset(this.bb_pos, 114);
1361 return offset ? this.bb.readFloat32(this.bb_pos + offset) : Infinity;
1362 }
1363 mutate_inf_default(value) {
1364 const offset = this.bb.__offset(this.bb_pos, 114);
1365 if (offset === 0) {
1366 return false;
1367 }
1368 this.bb.writeFloat32(this.bb_pos + offset, value);
1369 return true;
1370 }
1371 positiveInfDefault() {
1372 const offset = this.bb.__offset(this.bb_pos, 116);
1373 return offset ? this.bb.readFloat32(this.bb_pos + offset) : Infinity;
1374 }
1375 mutate_positive_inf_default(value) {
1376 const offset = this.bb.__offset(this.bb_pos, 116);
1377 if (offset === 0) {
1378 return false;
1379 }
1380 this.bb.writeFloat32(this.bb_pos + offset, value);
1381 return true;
1382 }
1383 infinityDefault() {
1384 const offset = this.bb.__offset(this.bb_pos, 118);
1385 return offset ? this.bb.readFloat32(this.bb_pos + offset) : Infinity;
1386 }
1387 mutate_infinity_default(value) {
1388 const offset = this.bb.__offset(this.bb_pos, 118);
1389 if (offset === 0) {
1390 return false;
1391 }
1392 this.bb.writeFloat32(this.bb_pos + offset, value);
1393 return true;
1394 }
1395 positiveInfinityDefault() {
1396 const offset = this.bb.__offset(this.bb_pos, 120);
1397 return offset ? this.bb.readFloat32(this.bb_pos + offset) : Infinity;
1398 }
1399 mutate_positive_infinity_default(value) {
1400 const offset = this.bb.__offset(this.bb_pos, 120);
1401 if (offset === 0) {
1402 return false;
1403 }
1404 this.bb.writeFloat32(this.bb_pos + offset, value);
1405 return true;
1406 }
1407 negativeInfDefault() {
1408 const offset = this.bb.__offset(this.bb_pos, 122);
1409 return offset ? this.bb.readFloat32(this.bb_pos + offset) : -Infinity;
1410 }
1411 mutate_negative_inf_default(value) {
1412 const offset = this.bb.__offset(this.bb_pos, 122);
1413 if (offset === 0) {
1414 return false;
1415 }
1416 this.bb.writeFloat32(this.bb_pos + offset, value);
1417 return true;
1418 }
1419 negativeInfinityDefault() {
1420 const offset = this.bb.__offset(this.bb_pos, 124);
1421 return offset ? this.bb.readFloat32(this.bb_pos + offset) : -Infinity;
1422 }
1423 mutate_negative_infinity_default(value) {
1424 const offset = this.bb.__offset(this.bb_pos, 124);
1425 if (offset === 0) {
1426 return false;
1427 }
1428 this.bb.writeFloat32(this.bb_pos + offset, value);
1429 return true;
1430 }
1431 doubleInfDefault() {
1432 const offset = this.bb.__offset(this.bb_pos, 126);
1433 return offset ? this.bb.readFloat64(this.bb_pos + offset) : Infinity;
1434 }
1435 mutate_double_inf_default(value) {
1436 const offset = this.bb.__offset(this.bb_pos, 126);
1437 if (offset === 0) {
1438 return false;
1439 }
1440 this.bb.writeFloat64(this.bb_pos + offset, value);
1441 return true;
1442 }
1443 static getFullyQualifiedName() {
1444 return "MyGame.Example.Monster";
1445 }
1446 static startMonster(builder) {
1447 builder.startObject(62);
1448 }
1449 static addPos(builder, posOffset) {
1450 builder.addFieldStruct(0, posOffset, 0);
1451 }
1452 static addMana(builder, mana) {
1453 builder.addFieldInt16(1, mana, 150);
1454 }
1455 static addHp(builder, hp) {
1456 builder.addFieldInt16(2, hp, 100);
1457 }
1458 static addName(builder, nameOffset) {
1459 builder.addFieldOffset(3, nameOffset, 0);
1460 }
1461 static addInventory(builder, inventoryOffset) {
1462 builder.addFieldOffset(5, inventoryOffset, 0);
1463 }
1464 static createInventoryVector(builder, data) {
1465 builder.startVector(1, data.length, 1);
1466 for (let i = data.length - 1; i >= 0; i--) {
1467 builder.addInt8(data[i]);
1468 }
1469 return builder.endVector();
1470 }
1471 static startInventoryVector(builder, numElems) {
1472 builder.startVector(1, numElems, 1);
1473 }
1474 static addColor(builder, color) {
1475 builder.addFieldInt8(6, color, Color.Blue);
1476 }
1477 static addTestType(builder, testType) {
1478 builder.addFieldInt8(7, testType, Any.NONE);
1479 }
1480 static addTest(builder, testOffset) {
1481 builder.addFieldOffset(8, testOffset, 0);
1482 }
1483 static addTest4(builder, test4Offset) {
1484 builder.addFieldOffset(9, test4Offset, 0);
1485 }
1486 static startTest4Vector(builder, numElems) {
1487 builder.startVector(4, numElems, 2);
1488 }
1489 static addTestarrayofstring(builder, testarrayofstringOffset) {
1490 builder.addFieldOffset(10, testarrayofstringOffset, 0);
1491 }
1492 static createTestarrayofstringVector(builder, data) {
1493 builder.startVector(4, data.length, 4);
1494 for (let i = data.length - 1; i >= 0; i--) {
1495 builder.addOffset(data[i]);
1496 }
1497 return builder.endVector();
1498 }
1499 static startTestarrayofstringVector(builder, numElems) {
1500 builder.startVector(4, numElems, 4);
1501 }
1502 static addTestarrayoftables(builder, testarrayoftablesOffset) {
1503 builder.addFieldOffset(11, testarrayoftablesOffset, 0);
1504 }
1505 static createTestarrayoftablesVector(builder, data) {
1506 builder.startVector(4, data.length, 4);
1507 for (let i = data.length - 1; i >= 0; i--) {
1508 builder.addOffset(data[i]);
1509 }
1510 return builder.endVector();
1511 }
1512 static startTestarrayoftablesVector(builder, numElems) {
1513 builder.startVector(4, numElems, 4);
1514 }
1515 static addEnemy(builder, enemyOffset) {
1516 builder.addFieldOffset(12, enemyOffset, 0);
1517 }
1518 static addTestnestedflatbuffer(builder, testnestedflatbufferOffset) {
1519 builder.addFieldOffset(13, testnestedflatbufferOffset, 0);
1520 }
1521 static createTestnestedflatbufferVector(builder, data) {
1522 builder.startVector(1, data.length, 1);
1523 for (let i = data.length - 1; i >= 0; i--) {
1524 builder.addInt8(data[i]);
1525 }
1526 return builder.endVector();
1527 }
1528 static startTestnestedflatbufferVector(builder, numElems) {
1529 builder.startVector(1, numElems, 1);
1530 }
1531 static addTestempty(builder, testemptyOffset) {
1532 builder.addFieldOffset(14, testemptyOffset, 0);
1533 }
1534 static addTestbool(builder, testbool) {
1535 builder.addFieldInt8(15, +testbool, 0);
1536 }
1537 static addTesthashs32Fnv1(builder, testhashs32Fnv1) {
1538 builder.addFieldInt32(16, testhashs32Fnv1, 0);
1539 }
1540 static addTesthashu32Fnv1(builder, testhashu32Fnv1) {
1541 builder.addFieldInt32(17, testhashu32Fnv1, 0);
1542 }
1543 static addTesthashs64Fnv1(builder, testhashs64Fnv1) {
1544 builder.addFieldInt64(18, testhashs64Fnv1, BigInt("0"));
1545 }
1546 static addTesthashu64Fnv1(builder, testhashu64Fnv1) {
1547 builder.addFieldInt64(19, testhashu64Fnv1, BigInt("0"));
1548 }
1549 static addTesthashs32Fnv1a(builder, testhashs32Fnv1a) {
1550 builder.addFieldInt32(20, testhashs32Fnv1a, 0);
1551 }
1552 static addTesthashu32Fnv1a(builder, testhashu32Fnv1a) {
1553 builder.addFieldInt32(21, testhashu32Fnv1a, 0);
1554 }
1555 static addTesthashs64Fnv1a(builder, testhashs64Fnv1a) {
1556 builder.addFieldInt64(22, testhashs64Fnv1a, BigInt("0"));
1557 }
1558 static addTesthashu64Fnv1a(builder, testhashu64Fnv1a) {
1559 builder.addFieldInt64(23, testhashu64Fnv1a, BigInt("0"));
1560 }
1561 static addTestarrayofbools(builder, testarrayofboolsOffset) {
1562 builder.addFieldOffset(24, testarrayofboolsOffset, 0);
1563 }
1564 static createTestarrayofboolsVector(builder, data) {
1565 builder.startVector(1, data.length, 1);
1566 for (let i = data.length - 1; i >= 0; i--) {
1567 builder.addInt8(+data[i]);
1568 }
1569 return builder.endVector();
1570 }
1571 static startTestarrayofboolsVector(builder, numElems) {
1572 builder.startVector(1, numElems, 1);
1573 }
1574 static addTestf(builder, testf) {
1575 builder.addFieldFloat32(25, testf, 3.14159);
1576 }
1577 static addTestf2(builder, testf2) {
1578 builder.addFieldFloat32(26, testf2, 3);
1579 }
1580 static addTestf3(builder, testf3) {
1581 builder.addFieldFloat32(27, testf3, 0);
1582 }
1583 static addTestarrayofstring2(builder, testarrayofstring2Offset) {
1584 builder.addFieldOffset(28, testarrayofstring2Offset, 0);
1585 }
1586 static createTestarrayofstring2Vector(builder, data) {
1587 builder.startVector(4, data.length, 4);
1588 for (let i = data.length - 1; i >= 0; i--) {
1589 builder.addOffset(data[i]);
1590 }
1591 return builder.endVector();
1592 }
1593 static startTestarrayofstring2Vector(builder, numElems) {
1594 builder.startVector(4, numElems, 4);
1595 }
1596 static addTestarrayofsortedstruct(builder, testarrayofsortedstructOffset) {
1597 builder.addFieldOffset(29, testarrayofsortedstructOffset, 0);
1598 }
1599 static startTestarrayofsortedstructVector(builder, numElems) {
1600 builder.startVector(8, numElems, 4);
1601 }
1602 static addFlex(builder, flexOffset) {
1603 builder.addFieldOffset(30, flexOffset, 0);
1604 }
1605 static createFlexVector(builder, data) {
1606 builder.startVector(1, data.length, 1);
1607 for (let i = data.length - 1; i >= 0; i--) {
1608 builder.addInt8(data[i]);
1609 }
1610 return builder.endVector();
1611 }
1612 static startFlexVector(builder, numElems) {
1613 builder.startVector(1, numElems, 1);
1614 }
1615 static addTest5(builder, test5Offset) {
1616 builder.addFieldOffset(31, test5Offset, 0);
1617 }
1618 static startTest5Vector(builder, numElems) {
1619 builder.startVector(4, numElems, 2);
1620 }
1621 static addVectorOfLongs(builder, vectorOfLongsOffset) {
1622 builder.addFieldOffset(32, vectorOfLongsOffset, 0);
1623 }
1624 static createVectorOfLongsVector(builder, data) {
1625 builder.startVector(8, data.length, 8);
1626 for (let i = data.length - 1; i >= 0; i--) {
1627 builder.addInt64(data[i]);
1628 }
1629 return builder.endVector();
1630 }
1631 static startVectorOfLongsVector(builder, numElems) {
1632 builder.startVector(8, numElems, 8);
1633 }
1634 static addVectorOfDoubles(builder, vectorOfDoublesOffset) {
1635 builder.addFieldOffset(33, vectorOfDoublesOffset, 0);
1636 }
1637 static createVectorOfDoublesVector(builder, data) {
1638 builder.startVector(8, data.length, 8);
1639 for (let i = data.length - 1; i >= 0; i--) {
1640 builder.addFloat64(data[i]);
1641 }
1642 return builder.endVector();
1643 }
1644 static startVectorOfDoublesVector(builder, numElems) {
1645 builder.startVector(8, numElems, 8);
1646 }
1647 static addParentNamespaceTest(builder, parentNamespaceTestOffset) {
1648 builder.addFieldOffset(34, parentNamespaceTestOffset, 0);
1649 }
1650 static addVectorOfReferrables(builder, vectorOfReferrablesOffset) {
1651 builder.addFieldOffset(35, vectorOfReferrablesOffset, 0);
1652 }
1653 static createVectorOfReferrablesVector(builder, data) {
1654 builder.startVector(4, data.length, 4);
1655 for (let i = data.length - 1; i >= 0; i--) {
1656 builder.addOffset(data[i]);
1657 }
1658 return builder.endVector();
1659 }
1660 static startVectorOfReferrablesVector(builder, numElems) {
1661 builder.startVector(4, numElems, 4);
1662 }
1663 static addSingleWeakReference(builder, singleWeakReference) {
1664 builder.addFieldInt64(36, singleWeakReference, BigInt("0"));
1665 }
1666 static addVectorOfWeakReferences(builder, vectorOfWeakReferencesOffset) {
1667 builder.addFieldOffset(37, vectorOfWeakReferencesOffset, 0);
1668 }
1669 static createVectorOfWeakReferencesVector(builder, data) {
1670 builder.startVector(8, data.length, 8);
1671 for (let i = data.length - 1; i >= 0; i--) {
1672 builder.addInt64(data[i]);
1673 }
1674 return builder.endVector();
1675 }
1676 static startVectorOfWeakReferencesVector(builder, numElems) {
1677 builder.startVector(8, numElems, 8);
1678 }
1679 static addVectorOfStrongReferrables(builder, vectorOfStrongReferrablesOffset) {
1680 builder.addFieldOffset(38, vectorOfStrongReferrablesOffset, 0);
1681 }
1682 static createVectorOfStrongReferrablesVector(builder, data) {
1683 builder.startVector(4, data.length, 4);
1684 for (let i = data.length - 1; i >= 0; i--) {
1685 builder.addOffset(data[i]);
1686 }
1687 return builder.endVector();
1688 }
1689 static startVectorOfStrongReferrablesVector(builder, numElems) {
1690 builder.startVector(4, numElems, 4);
1691 }
1692 static addCoOwningReference(builder, coOwningReference) {
1693 builder.addFieldInt64(39, coOwningReference, BigInt("0"));
1694 }
1695 static addVectorOfCoOwningReferences(builder, vectorOfCoOwningReferencesOffset) {
1696 builder.addFieldOffset(40, vectorOfCoOwningReferencesOffset, 0);
1697 }
1698 static createVectorOfCoOwningReferencesVector(builder, data) {
1699 builder.startVector(8, data.length, 8);
1700 for (let i = data.length - 1; i >= 0; i--) {
1701 builder.addInt64(data[i]);
1702 }
1703 return builder.endVector();
1704 }
1705 static startVectorOfCoOwningReferencesVector(builder, numElems) {
1706 builder.startVector(8, numElems, 8);
1707 }
1708 static addNonOwningReference(builder, nonOwningReference) {
1709 builder.addFieldInt64(41, nonOwningReference, BigInt("0"));
1710 }
1711 static addVectorOfNonOwningReferences(builder, vectorOfNonOwningReferencesOffset) {
1712 builder.addFieldOffset(42, vectorOfNonOwningReferencesOffset, 0);
1713 }
1714 static createVectorOfNonOwningReferencesVector(builder, data) {
1715 builder.startVector(8, data.length, 8);
1716 for (let i = data.length - 1; i >= 0; i--) {
1717 builder.addInt64(data[i]);
1718 }
1719 return builder.endVector();
1720 }
1721 static startVectorOfNonOwningReferencesVector(builder, numElems) {
1722 builder.startVector(8, numElems, 8);
1723 }
1724 static addAnyUniqueType(builder, anyUniqueType) {
1725 builder.addFieldInt8(43, anyUniqueType, AnyUniqueAliases.NONE);
1726 }
1727 static addAnyUnique(builder, anyUniqueOffset) {
1728 builder.addFieldOffset(44, anyUniqueOffset, 0);
1729 }
1730 static addAnyAmbiguousType(builder, anyAmbiguousType) {
1731 builder.addFieldInt8(45, anyAmbiguousType, AnyAmbiguousAliases.NONE);
1732 }
1733 static addAnyAmbiguous(builder, anyAmbiguousOffset) {
1734 builder.addFieldOffset(46, anyAmbiguousOffset, 0);
1735 }
1736 static addVectorOfEnums(builder, vectorOfEnumsOffset) {
1737 builder.addFieldOffset(47, vectorOfEnumsOffset, 0);
1738 }
1739 static createVectorOfEnumsVector(builder, data) {
1740 builder.startVector(1, data.length, 1);
1741 for (let i = data.length - 1; i >= 0; i--) {
1742 builder.addInt8(data[i]);
1743 }
1744 return builder.endVector();
1745 }
1746 static startVectorOfEnumsVector(builder, numElems) {
1747 builder.startVector(1, numElems, 1);
1748 }
1749 static addSignedEnum(builder, signedEnum) {
1750 builder.addFieldInt8(48, signedEnum, Race.None);
1751 }
1752 static addTestrequirednestedflatbuffer(builder, testrequirednestedflatbufferOffset) {
1753 builder.addFieldOffset(49, testrequirednestedflatbufferOffset, 0);
1754 }
1755 static createTestrequirednestedflatbufferVector(builder, data) {
1756 builder.startVector(1, data.length, 1);
1757 for (let i = data.length - 1; i >= 0; i--) {
1758 builder.addInt8(data[i]);
1759 }
1760 return builder.endVector();
1761 }
1762 static startTestrequirednestedflatbufferVector(builder, numElems) {
1763 builder.startVector(1, numElems, 1);
1764 }
1765 static addScalarKeySortedTables(builder, scalarKeySortedTablesOffset) {
1766 builder.addFieldOffset(50, scalarKeySortedTablesOffset, 0);
1767 }
1768 static createScalarKeySortedTablesVector(builder, data) {
1769 builder.startVector(4, data.length, 4);
1770 for (let i = data.length - 1; i >= 0; i--) {
1771 builder.addOffset(data[i]);
1772 }
1773 return builder.endVector();
1774 }
1775 static startScalarKeySortedTablesVector(builder, numElems) {
1776 builder.startVector(4, numElems, 4);
1777 }
1778 static addNativeInline(builder, nativeInlineOffset) {
1779 builder.addFieldStruct(51, nativeInlineOffset, 0);
1780 }
1781 static addLongEnumNonEnumDefault(builder, longEnumNonEnumDefault) {
1782 builder.addFieldInt64(52, longEnumNonEnumDefault, BigInt("0"));
1783 }
1784 static addLongEnumNormalDefault(builder, longEnumNormalDefault) {
1785 builder.addFieldInt64(53, longEnumNormalDefault, BigInt("2"));
1786 }
1787 static addNanDefault(builder, nanDefault) {
1788 builder.addFieldFloat32(54, nanDefault, NaN);
1789 }
1790 static addInfDefault(builder, infDefault) {
1791 builder.addFieldFloat32(55, infDefault, Infinity);
1792 }
1793 static addPositiveInfDefault(builder, positiveInfDefault) {
1794 builder.addFieldFloat32(56, positiveInfDefault, Infinity);
1795 }
1796 static addInfinityDefault(builder, infinityDefault) {
1797 builder.addFieldFloat32(57, infinityDefault, Infinity);
1798 }
1799 static addPositiveInfinityDefault(builder, positiveInfinityDefault) {
1800 builder.addFieldFloat32(58, positiveInfinityDefault, Infinity);
1801 }
1802 static addNegativeInfDefault(builder, negativeInfDefault) {
1803 builder.addFieldFloat32(59, negativeInfDefault, -Infinity);
1804 }
1805 static addNegativeInfinityDefault(builder, negativeInfinityDefault) {
1806 builder.addFieldFloat32(60, negativeInfinityDefault, -Infinity);
1807 }
1808 static addDoubleInfDefault(builder, doubleInfDefault) {
1809 builder.addFieldFloat64(61, doubleInfDefault, Infinity);
1810 }
1811 static endMonster(builder) {
1812 const offset = builder.endObject();
1813 builder.requiredField(offset, 10);
1814 return offset;
1815 }
1816 static finishMonsterBuffer(builder, offset) {
1817 builder.finish(offset, "MONS");
1818 }
1819 static finishSizePrefixedMonsterBuffer(builder, offset) {
1820 builder.finish(offset, "MONS", true);
1821 }
1822 serialize() {
1823 return this.bb.bytes();
1824 }
1825 static deserialize(buffer) {
1826 return Monster2.getRootAsMonster(new flatbuffers8.ByteBuffer(buffer));
1827 }
1828 unpack() {
1829 return new MonsterT2(this.pos() !== null ? this.pos().unpack() : null, this.mana(), this.hp(), this.name(), this.bb.createScalarList(this.inventory.bind(this), this.inventoryLength()), this.color(), this.testType(), (() => {
1830 const temp = unionToAny(this.testType(), this.test.bind(this));
1831 if (temp === null) {
1832 return null;
1833 }
1834 return temp.unpack();
1835 })(), this.bb.createObjList(this.test4.bind(this), this.test4Length()), this.bb.createScalarList(this.testarrayofstring.bind(this), this.testarrayofstringLength()), this.bb.createObjList(this.testarrayoftables.bind(this), this.testarrayoftablesLength()), this.enemy() !== null ? this.enemy().unpack() : null, this.bb.createScalarList(this.testnestedflatbuffer.bind(this), this.testnestedflatbufferLength()), this.testempty() !== null ? this.testempty().unpack() : null, this.testbool(), this.testhashs32Fnv1(), this.testhashu32Fnv1(), this.testhashs64Fnv1(), this.testhashu64Fnv1(), this.testhashs32Fnv1a(), this.testhashu32Fnv1a(), this.testhashs64Fnv1a(), this.testhashu64Fnv1a(), this.bb.createScalarList(this.testarrayofbools.bind(this), this.testarrayofboolsLength()), this.testf(), this.testf2(), this.testf3(), this.bb.createScalarList(this.testarrayofstring2.bind(this), this.testarrayofstring2Length()), this.bb.createObjList(this.testarrayofsortedstruct.bind(this), this.testarrayofsortedstructLength()), this.bb.createScalarList(this.flex.bind(this), this.flexLength()), this.bb.createObjList(this.test5.bind(this), this.test5Length()), this.bb.createScalarList(this.vectorOfLongs.bind(this), this.vectorOfLongsLength()), this.bb.createScalarList(this.vectorOfDoubles.bind(this), this.vectorOfDoublesLength()), this.parentNamespaceTest() !== null ? this.parentNamespaceTest().unpack() : null, this.bb.createObjList(this.vectorOfReferrables.bind(this), this.vectorOfReferrablesLength()), this.singleWeakReference(), this.bb.createScalarList(this.vectorOfWeakReferences.bind(this), this.vectorOfWeakReferencesLength()), this.bb.createObjList(this.vectorOfStrongReferrables.bind(this), this.vectorOfStrongReferrablesLength()), this.coOwningReference(), this.bb.createScalarList(this.vectorOfCoOwningReferences.bind(this), this.vectorOfCoOwningReferencesLength()), this.nonOwningReference(), this.bb.createScalarList(this.vectorOfNonOwningReferences.bind(this), this.vectorOfNonOwningReferencesLength()), this.anyUniqueType(), (() => {
1836 const temp = unionToAnyUniqueAliases(this.anyUniqueType(), this.anyUnique.bind(this));
1837 if (temp === null) {
1838 return null;
1839 }
1840 return temp.unpack();
1841 })(), this.anyAmbiguousType(), (() => {
1842 const temp = unionToAnyAmbiguousAliases(this.anyAmbiguousType(), this.anyAmbiguous.bind(this));
1843 if (temp === null) {
1844 return null;
1845 }
1846 return temp.unpack();
1847 })(), this.bb.createScalarList(this.vectorOfEnums.bind(this), this.vectorOfEnumsLength()), this.signedEnum(), this.bb.createScalarList(this.testrequirednestedflatbuffer.bind(this), this.testrequirednestedflatbufferLength()), this.bb.createObjList(this.scalarKeySortedTables.bind(this), this.scalarKeySortedTablesLength()), this.nativeInline() !== null ? this.nativeInline().unpack() : null, this.longEnumNonEnumDefault(), this.longEnumNormalDefault(), this.nanDefault(), this.infDefault(), this.positiveInfDefault(), this.infinityDefault(), this.positiveInfinityDefault(), this.negativeInfDefault(), this.negativeInfinityDefault(), this.doubleInfDefault());
1848 }
1849 unpackTo(_o) {
1850 _o.pos = this.pos() !== null ? this.pos().unpack() : null;
1851 _o.mana = this.mana();
1852 _o.hp = this.hp();
1853 _o.name = this.name();
1854 _o.inventory = this.bb.createScalarList(this.inventory.bind(this), this.inventoryLength());
1855 _o.color = this.color();
1856 _o.testType = this.testType();
1857 _o.test = (() => {
1858 const temp = unionToAny(this.testType(), this.test.bind(this));
1859 if (temp === null) {
1860 return null;
1861 }
1862 return temp.unpack();
1863 })();
1864 _o.test4 = this.bb.createObjList(this.test4.bind(this), this.test4Length());
1865 _o.testarrayofstring = this.bb.createScalarList(this.testarrayofstring.bind(this), this.testarrayofstringLength());
1866 _o.testarrayoftables = this.bb.createObjList(this.testarrayoftables.bind(this), this.testarrayoftablesLength());
1867 _o.enemy = this.enemy() !== null ? this.enemy().unpack() : null;
1868 _o.testnestedflatbuffer = this.bb.createScalarList(this.testnestedflatbuffer.bind(this), this.testnestedflatbufferLength());
1869 _o.testempty = this.testempty() !== null ? this.testempty().unpack() : null;
1870 _o.testbool = this.testbool();
1871 _o.testhashs32Fnv1 = this.testhashs32Fnv1();
1872 _o.testhashu32Fnv1 = this.testhashu32Fnv1();
1873 _o.testhashs64Fnv1 = this.testhashs64Fnv1();
1874 _o.testhashu64Fnv1 = this.testhashu64Fnv1();
1875 _o.testhashs32Fnv1a = this.testhashs32Fnv1a();
1876 _o.testhashu32Fnv1a = this.testhashu32Fnv1a();
1877 _o.testhashs64Fnv1a = this.testhashs64Fnv1a();
1878 _o.testhashu64Fnv1a = this.testhashu64Fnv1a();
1879 _o.testarrayofbools = this.bb.createScalarList(this.testarrayofbools.bind(this), this.testarrayofboolsLength());
1880 _o.testf = this.testf();
1881 _o.testf2 = this.testf2();
1882 _o.testf3 = this.testf3();
1883 _o.testarrayofstring2 = this.bb.createScalarList(this.testarrayofstring2.bind(this), this.testarrayofstring2Length());
1884 _o.testarrayofsortedstruct = this.bb.createObjList(this.testarrayofsortedstruct.bind(this), this.testarrayofsortedstructLength());
1885 _o.flex = this.bb.createScalarList(this.flex.bind(this), this.flexLength());
1886 _o.test5 = this.bb.createObjList(this.test5.bind(this), this.test5Length());
1887 _o.vectorOfLongs = this.bb.createScalarList(this.vectorOfLongs.bind(this), this.vectorOfLongsLength());
1888 _o.vectorOfDoubles = this.bb.createScalarList(this.vectorOfDoubles.bind(this), this.vectorOfDoublesLength());
1889 _o.parentNamespaceTest = this.parentNamespaceTest() !== null ? this.parentNamespaceTest().unpack() : null;
1890 _o.vectorOfReferrables = this.bb.createObjList(this.vectorOfReferrables.bind(this), this.vectorOfReferrablesLength());
1891 _o.singleWeakReference = this.singleWeakReference();
1892 _o.vectorOfWeakReferences = this.bb.createScalarList(this.vectorOfWeakReferences.bind(this), this.vectorOfWeakReferencesLength());
1893 _o.vectorOfStrongReferrables = this.bb.createObjList(this.vectorOfStrongReferrables.bind(this), this.vectorOfStrongReferrablesLength());
1894 _o.coOwningReference = this.coOwningReference();
1895 _o.vectorOfCoOwningReferences = this.bb.createScalarList(this.vectorOfCoOwningReferences.bind(this), this.vectorOfCoOwningReferencesLength());
1896 _o.nonOwningReference = this.nonOwningReference();
1897 _o.vectorOfNonOwningReferences = this.bb.createScalarList(this.vectorOfNonOwningReferences.bind(this), this.vectorOfNonOwningReferencesLength());
1898 _o.anyUniqueType = this.anyUniqueType();
1899 _o.anyUnique = (() => {
1900 const temp = unionToAnyUniqueAliases(this.anyUniqueType(), this.anyUnique.bind(this));
1901 if (temp === null) {
1902 return null;
1903 }
1904 return temp.unpack();
1905 })();
1906 _o.anyAmbiguousType = this.anyAmbiguousType();
1907 _o.anyAmbiguous = (() => {
1908 const temp = unionToAnyAmbiguousAliases(this.anyAmbiguousType(), this.anyAmbiguous.bind(this));
1909 if (temp === null) {
1910 return null;
1911 }
1912 return temp.unpack();
1913 })();
1914 _o.vectorOfEnums = this.bb.createScalarList(this.vectorOfEnums.bind(this), this.vectorOfEnumsLength());
1915 _o.signedEnum = this.signedEnum();
1916 _o.testrequirednestedflatbuffer = this.bb.createScalarList(this.testrequirednestedflatbuffer.bind(this), this.testrequirednestedflatbufferLength());
1917 _o.scalarKeySortedTables = this.bb.createObjList(this.scalarKeySortedTables.bind(this), this.scalarKeySortedTablesLength());
1918 _o.nativeInline = this.nativeInline() !== null ? this.nativeInline().unpack() : null;
1919 _o.longEnumNonEnumDefault = this.longEnumNonEnumDefault();
1920 _o.longEnumNormalDefault = this.longEnumNormalDefault();
1921 _o.nanDefault = this.nanDefault();
1922 _o.infDefault = this.infDefault();
1923 _o.positiveInfDefault = this.positiveInfDefault();
1924 _o.infinityDefault = this.infinityDefault();
1925 _o.positiveInfinityDefault = this.positiveInfinityDefault();
1926 _o.negativeInfDefault = this.negativeInfDefault();
1927 _o.negativeInfinityDefault = this.negativeInfinityDefault();
1928 _o.doubleInfDefault = this.doubleInfDefault();
1929 }
1930};
1931var MonsterT2 = class {
1932 constructor(pos = null, mana = 150, hp = 100, name = null, inventory = [], color = Color.Blue, testType = Any.NONE, test = null, test4 = [], testarrayofstring = [], testarrayoftables = [], enemy = null, testnestedflatbuffer = [], testempty = null, testbool = false, testhashs32Fnv1 = 0, testhashu32Fnv1 = 0, testhashs64Fnv1 = BigInt("0"), testhashu64Fnv1 = BigInt("0"), testhashs32Fnv1a = 0, testhashu32Fnv1a = 0, testhashs64Fnv1a = BigInt("0"), testhashu64Fnv1a = BigInt("0"), testarrayofbools = [], testf = 3.14159, testf2 = 3, testf3 = 0, testarrayofstring2 = [], testarrayofsortedstruct = [], flex = [], test5 = [], vectorOfLongs = [], vectorOfDoubles = [], parentNamespaceTest = null, vectorOfReferrables = [], singleWeakReference = BigInt("0"), vectorOfWeakReferences = [], vectorOfStrongReferrables = [], coOwningReference = BigInt("0"), vectorOfCoOwningReferences = [], nonOwningReference = BigInt("0"), vectorOfNonOwningReferences = [], anyUniqueType = AnyUniqueAliases.NONE, anyUnique = null, anyAmbiguousType = AnyAmbiguousAliases.NONE, anyAmbiguous = null, vectorOfEnums = [], signedEnum = Race.None, testrequirednestedflatbuffer = [], scalarKeySortedTables = [], nativeInline = null, longEnumNonEnumDefault = BigInt("0"), longEnumNormalDefault = BigInt("2"), nanDefault = NaN, infDefault = Infinity, positiveInfDefault = Infinity, infinityDefault = Infinity, positiveInfinityDefault = Infinity, negativeInfDefault = -Infinity, negativeInfinityDefault = -Infinity, doubleInfDefault = Infinity) {
1933 this.pos = pos;
1934 this.mana = mana;
1935 this.hp = hp;
1936 this.name = name;
1937 this.inventory = inventory;
1938 this.color = color;
1939 this.testType = testType;
1940 this.test = test;
1941 this.test4 = test4;
1942 this.testarrayofstring = testarrayofstring;
1943 this.testarrayoftables = testarrayoftables;
1944 this.enemy = enemy;
1945 this.testnestedflatbuffer = testnestedflatbuffer;
1946 this.testempty = testempty;
1947 this.testbool = testbool;
1948 this.testhashs32Fnv1 = testhashs32Fnv1;
1949 this.testhashu32Fnv1 = testhashu32Fnv1;
1950 this.testhashs64Fnv1 = testhashs64Fnv1;
1951 this.testhashu64Fnv1 = testhashu64Fnv1;
1952 this.testhashs32Fnv1a = testhashs32Fnv1a;
1953 this.testhashu32Fnv1a = testhashu32Fnv1a;
1954 this.testhashs64Fnv1a = testhashs64Fnv1a;
1955 this.testhashu64Fnv1a = testhashu64Fnv1a;
1956 this.testarrayofbools = testarrayofbools;
1957 this.testf = testf;
1958 this.testf2 = testf2;
1959 this.testf3 = testf3;
1960 this.testarrayofstring2 = testarrayofstring2;
1961 this.testarrayofsortedstruct = testarrayofsortedstruct;
1962 this.flex = flex;
1963 this.test5 = test5;
1964 this.vectorOfLongs = vectorOfLongs;
1965 this.vectorOfDoubles = vectorOfDoubles;
1966 this.parentNamespaceTest = parentNamespaceTest;
1967 this.vectorOfReferrables = vectorOfReferrables;
1968 this.singleWeakReference = singleWeakReference;
1969 this.vectorOfWeakReferences = vectorOfWeakReferences;
1970 this.vectorOfStrongReferrables = vectorOfStrongReferrables;
1971 this.coOwningReference = coOwningReference;
1972 this.vectorOfCoOwningReferences = vectorOfCoOwningReferences;
1973 this.nonOwningReference = nonOwningReference;
1974 this.vectorOfNonOwningReferences = vectorOfNonOwningReferences;
1975 this.anyUniqueType = anyUniqueType;
1976 this.anyUnique = anyUnique;
1977 this.anyAmbiguousType = anyAmbiguousType;
1978 this.anyAmbiguous = anyAmbiguous;
1979 this.vectorOfEnums = vectorOfEnums;
1980 this.signedEnum = signedEnum;
1981 this.testrequirednestedflatbuffer = testrequirednestedflatbuffer;
1982 this.scalarKeySortedTables = scalarKeySortedTables;
1983 this.nativeInline = nativeInline;
1984 this.longEnumNonEnumDefault = longEnumNonEnumDefault;
1985 this.longEnumNormalDefault = longEnumNormalDefault;
1986 this.nanDefault = nanDefault;
1987 this.infDefault = infDefault;
1988 this.positiveInfDefault = positiveInfDefault;
1989 this.infinityDefault = infinityDefault;
1990 this.positiveInfinityDefault = positiveInfinityDefault;
1991 this.negativeInfDefault = negativeInfDefault;
1992 this.negativeInfinityDefault = negativeInfinityDefault;
1993 this.doubleInfDefault = doubleInfDefault;
1994 }
1995 pack(builder) {
1996 const name = this.name !== null ? builder.createString(this.name) : 0;
1997 const inventory = Monster2.createInventoryVector(builder, this.inventory);
1998 const test = builder.createObjectOffset(this.test);
1999 const test4 = builder.createStructOffsetList(this.test4, Monster2.startTest4Vector);
2000 const testarrayofstring = Monster2.createTestarrayofstringVector(builder, builder.createObjectOffsetList(this.testarrayofstring));
2001 const testarrayoftables = Monster2.createTestarrayoftablesVector(builder, builder.createObjectOffsetList(this.testarrayoftables));
2002 const enemy = this.enemy !== null ? this.enemy.pack(builder) : 0;
2003 const testnestedflatbuffer = Monster2.createTestnestedflatbufferVector(builder, this.testnestedflatbuffer);
2004 const testempty = this.testempty !== null ? this.testempty.pack(builder) : 0;
2005 const testarrayofbools = Monster2.createTestarrayofboolsVector(builder, this.testarrayofbools);
2006 const testarrayofstring2 = Monster2.createTestarrayofstring2Vector(builder, builder.createObjectOffsetList(this.testarrayofstring2));
2007 const testarrayofsortedstruct = builder.createStructOffsetList(this.testarrayofsortedstruct, Monster2.startTestarrayofsortedstructVector);
2008 const flex = Monster2.createFlexVector(builder, this.flex);
2009 const test5 = builder.createStructOffsetList(this.test5, Monster2.startTest5Vector);
2010 const vectorOfLongs = Monster2.createVectorOfLongsVector(builder, this.vectorOfLongs);
2011 const vectorOfDoubles = Monster2.createVectorOfDoublesVector(builder, this.vectorOfDoubles);
2012 const parentNamespaceTest = this.parentNamespaceTest !== null ? this.parentNamespaceTest.pack(builder) : 0;
2013 const vectorOfReferrables = Monster2.createVectorOfReferrablesVector(builder, builder.createObjectOffsetList(this.vectorOfReferrables));
2014 const vectorOfWeakReferences = Monster2.createVectorOfWeakReferencesVector(builder, this.vectorOfWeakReferences);
2015 const vectorOfStrongReferrables = Monster2.createVectorOfStrongReferrablesVector(builder, builder.createObjectOffsetList(this.vectorOfStrongReferrables));
2016 const vectorOfCoOwningReferences = Monster2.createVectorOfCoOwningReferencesVector(builder, this.vectorOfCoOwningReferences);
2017 const vectorOfNonOwningReferences = Monster2.createVectorOfNonOwningReferencesVector(builder, this.vectorOfNonOwningReferences);
2018 const anyUnique = builder.createObjectOffset(this.anyUnique);
2019 const anyAmbiguous = builder.createObjectOffset(this.anyAmbiguous);
2020 const vectorOfEnums = Monster2.createVectorOfEnumsVector(builder, this.vectorOfEnums);
2021 const testrequirednestedflatbuffer = Monster2.createTestrequirednestedflatbufferVector(builder, this.testrequirednestedflatbuffer);
2022 const scalarKeySortedTables = Monster2.createScalarKeySortedTablesVector(builder, builder.createObjectOffsetList(this.scalarKeySortedTables));
2023 Monster2.startMonster(builder);
2024 Monster2.addPos(builder, this.pos !== null ? this.pos.pack(builder) : 0);
2025 Monster2.addMana(builder, this.mana);
2026 Monster2.addHp(builder, this.hp);
2027 Monster2.addName(builder, name);
2028 Monster2.addInventory(builder, inventory);
2029 Monster2.addColor(builder, this.color);
2030 Monster2.addTestType(builder, this.testType);
2031 Monster2.addTest(builder, test);
2032 Monster2.addTest4(builder, test4);
2033 Monster2.addTestarrayofstring(builder, testarrayofstring);
2034 Monster2.addTestarrayoftables(builder, testarrayoftables);
2035 Monster2.addEnemy(builder, enemy);
2036 Monster2.addTestnestedflatbuffer(builder, testnestedflatbuffer);
2037 Monster2.addTestempty(builder, testempty);
2038 Monster2.addTestbool(builder, this.testbool);
2039 Monster2.addTesthashs32Fnv1(builder, this.testhashs32Fnv1);
2040 Monster2.addTesthashu32Fnv1(builder, this.testhashu32Fnv1);
2041 Monster2.addTesthashs64Fnv1(builder, this.testhashs64Fnv1);
2042 Monster2.addTesthashu64Fnv1(builder, this.testhashu64Fnv1);
2043 Monster2.addTesthashs32Fnv1a(builder, this.testhashs32Fnv1a);
2044 Monster2.addTesthashu32Fnv1a(builder, this.testhashu32Fnv1a);
2045 Monster2.addTesthashs64Fnv1a(builder, this.testhashs64Fnv1a);
2046 Monster2.addTesthashu64Fnv1a(builder, this.testhashu64Fnv1a);
2047 Monster2.addTestarrayofbools(builder, testarrayofbools);
2048 Monster2.addTestf(builder, this.testf);
2049 Monster2.addTestf2(builder, this.testf2);
2050 Monster2.addTestf3(builder, this.testf3);
2051 Monster2.addTestarrayofstring2(builder, testarrayofstring2);
2052 Monster2.addTestarrayofsortedstruct(builder, testarrayofsortedstruct);
2053 Monster2.addFlex(builder, flex);
2054 Monster2.addTest5(builder, test5);
2055 Monster2.addVectorOfLongs(builder, vectorOfLongs);
2056 Monster2.addVectorOfDoubles(builder, vectorOfDoubles);
2057 Monster2.addParentNamespaceTest(builder, parentNamespaceTest);
2058 Monster2.addVectorOfReferrables(builder, vectorOfReferrables);
2059 Monster2.addSingleWeakReference(builder, this.singleWeakReference);
2060 Monster2.addVectorOfWeakReferences(builder, vectorOfWeakReferences);
2061 Monster2.addVectorOfStrongReferrables(builder, vectorOfStrongReferrables);
2062 Monster2.addCoOwningReference(builder, this.coOwningReference);
2063 Monster2.addVectorOfCoOwningReferences(builder, vectorOfCoOwningReferences);
2064 Monster2.addNonOwningReference(builder, this.nonOwningReference);
2065 Monster2.addVectorOfNonOwningReferences(builder, vectorOfNonOwningReferences);
2066 Monster2.addAnyUniqueType(builder, this.anyUniqueType);
2067 Monster2.addAnyUnique(builder, anyUnique);
2068 Monster2.addAnyAmbiguousType(builder, this.anyAmbiguousType);
2069 Monster2.addAnyAmbiguous(builder, anyAmbiguous);
2070 Monster2.addVectorOfEnums(builder, vectorOfEnums);
2071 Monster2.addSignedEnum(builder, this.signedEnum);
2072 Monster2.addTestrequirednestedflatbuffer(builder, testrequirednestedflatbuffer);
2073 Monster2.addScalarKeySortedTables(builder, scalarKeySortedTables);
2074 Monster2.addNativeInline(builder, this.nativeInline !== null ? this.nativeInline.pack(builder) : 0);
2075 Monster2.addLongEnumNonEnumDefault(builder, this.longEnumNonEnumDefault);
2076 Monster2.addLongEnumNormalDefault(builder, this.longEnumNormalDefault);
2077 Monster2.addNanDefault(builder, this.nanDefault);
2078 Monster2.addInfDefault(builder, this.infDefault);
2079 Monster2.addPositiveInfDefault(builder, this.positiveInfDefault);
2080 Monster2.addInfinityDefault(builder, this.infinityDefault);
2081 Monster2.addPositiveInfinityDefault(builder, this.positiveInfinityDefault);
2082 Monster2.addNegativeInfDefault(builder, this.negativeInfDefault);
2083 Monster2.addNegativeInfinityDefault(builder, this.negativeInfinityDefault);
2084 Monster2.addDoubleInfDefault(builder, this.doubleInfDefault);
2085 return Monster2.endMonster(builder);
2086 }
2087};
2088
2089// my-game/example/any.js
2090var Any;
2091(function(Any2) {
2092 Any2[Any2["NONE"] = 0] = "NONE";
2093 Any2[Any2["Monster"] = 1] = "Monster";
2094 Any2[Any2["TestSimpleTableWithEnum"] = 2] = "TestSimpleTableWithEnum";
2095 Any2[Any2["MyGame_Example2_Monster"] = 3] = "MyGame_Example2_Monster";
2096})(Any = Any || (Any = {}));
2097function unionToAny(type, accessor) {
2098 switch (Any[type]) {
2099 case "NONE":
2100 return null;
2101 case "Monster":
2102 return accessor(new Monster2());
2103 case "TestSimpleTableWithEnum":
2104 return accessor(new TestSimpleTableWithEnum());
2105 case "MyGame_Example2_Monster":
2106 return accessor(new Monster());
2107 default:
2108 return null;
2109 }
2110}
2111
2112// my-game/example/long-enum.js
2113var LongEnum;
2114(function(LongEnum2) {
2115 LongEnum2["LongOne"] = "2";
2116 LongEnum2["LongTwo"] = "4";
2117 LongEnum2["LongBig"] = "1099511627776";
2118})(LongEnum = LongEnum || (LongEnum = {}));
2119
2120// my-game/example/struct-of-structs.js
2121var StructOfStructs = class {
2122 constructor() {
2123 this.bb = null;
2124 this.bb_pos = 0;
2125 }
2126 __init(i, bb) {
2127 this.bb_pos = i;
2128 this.bb = bb;
2129 return this;
2130 }
2131 a(obj) {
2132 return (obj || new Ability()).__init(this.bb_pos, this.bb);
2133 }
2134 b(obj) {
2135 return (obj || new Test()).__init(this.bb_pos + 8, this.bb);
2136 }
2137 c(obj) {
2138 return (obj || new Ability()).__init(this.bb_pos + 12, this.bb);
2139 }
2140 static getFullyQualifiedName() {
2141 return "MyGame.Example.StructOfStructs";
2142 }
2143 static sizeOf() {
2144 return 20;
2145 }
2146 static createStructOfStructs(builder, a_id, a_distance, b_a, b_b, c_id, c_distance) {
2147 builder.prep(4, 20);
2148 builder.prep(4, 8);
2149 builder.writeInt32(c_distance);
2150 builder.writeInt32(c_id);
2151 builder.prep(2, 4);
2152 builder.pad(1);
2153 builder.writeInt8(b_b);
2154 builder.writeInt16(b_a);
2155 builder.prep(4, 8);
2156 builder.writeInt32(a_distance);
2157 builder.writeInt32(a_id);
2158 return builder.offset();
2159 }
2160 unpack() {
2161 return new StructOfStructsT(this.a() !== null ? this.a().unpack() : null, this.b() !== null ? this.b().unpack() : null, this.c() !== null ? this.c().unpack() : null);
2162 }
2163 unpackTo(_o) {
2164 _o.a = this.a() !== null ? this.a().unpack() : null;
2165 _o.b = this.b() !== null ? this.b().unpack() : null;
2166 _o.c = this.c() !== null ? this.c().unpack() : null;
2167 }
2168};
2169var StructOfStructsT = class {
2170 constructor(a = null, b = null, c = null) {
2171 this.a = a;
2172 this.b = b;
2173 this.c = c;
2174 }
2175 pack(builder) {
2176 return StructOfStructs.createStructOfStructs(builder, this.a?.id ?? 0, this.a?.distance ?? 0, this.b?.a ?? 0, this.b?.b ?? 0, this.c?.id ?? 0, this.c?.distance ?? 0);
2177 }
2178};
2179
2180// my-game/example/struct-of-structs-of-structs.js
2181var StructOfStructsOfStructs = class {
2182 constructor() {
2183 this.bb = null;
2184 this.bb_pos = 0;
2185 }
2186 __init(i, bb) {
2187 this.bb_pos = i;
2188 this.bb = bb;
2189 return this;
2190 }
2191 a(obj) {
2192 return (obj || new StructOfStructs()).__init(this.bb_pos, this.bb);
2193 }
2194 static getFullyQualifiedName() {
2195 return "MyGame.Example.StructOfStructsOfStructs";
2196 }
2197 static sizeOf() {
2198 return 20;
2199 }
2200 static createStructOfStructsOfStructs(builder, a_a_id, a_a_distance, a_b_a, a_b_b, a_c_id, a_c_distance) {
2201 builder.prep(4, 20);
2202 builder.prep(4, 20);
2203 builder.prep(4, 8);
2204 builder.writeInt32(a_c_distance);
2205 builder.writeInt32(a_c_id);
2206 builder.prep(2, 4);
2207 builder.pad(1);
2208 builder.writeInt8(a_b_b);
2209 builder.writeInt16(a_b_a);
2210 builder.prep(4, 8);
2211 builder.writeInt32(a_a_distance);
2212 builder.writeInt32(a_a_id);
2213 return builder.offset();
2214 }
2215 unpack() {
2216 return new StructOfStructsOfStructsT(this.a() !== null ? this.a().unpack() : null);
2217 }
2218 unpackTo(_o) {
2219 _o.a = this.a() !== null ? this.a().unpack() : null;
2220 }
2221};
2222var StructOfStructsOfStructsT = class {
2223 constructor(a = null) {
2224 this.a = a;
2225 }
2226 pack(builder) {
2227 return StructOfStructsOfStructs.createStructOfStructsOfStructs(builder, this.a?.a?.id ?? 0, this.a?.a?.distance ?? 0, this.a?.b?.a ?? 0, this.a?.b?.b ?? 0, this.a?.c?.id ?? 0, this.a?.c?.distance ?? 0);
2228 }
2229};
2230
2231// my-game/example/type-aliases.js
2232var flatbuffers9 = __toESM(require("flatbuffers"), 1);
2233var TypeAliases = class {
2234 constructor() {
2235 this.bb = null;
2236 this.bb_pos = 0;
2237 }
2238 __init(i, bb) {
2239 this.bb_pos = i;
2240 this.bb = bb;
2241 return this;
2242 }
2243 static getRootAsTypeAliases(bb, obj) {
2244 return (obj || new TypeAliases()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
2245 }
2246 static getSizePrefixedRootAsTypeAliases(bb, obj) {
2247 bb.setPosition(bb.position() + flatbuffers9.SIZE_PREFIX_LENGTH);
2248 return (obj || new TypeAliases()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
2249 }
2250 i8() {
2251 const offset = this.bb.__offset(this.bb_pos, 4);
2252 return offset ? this.bb.readInt8(this.bb_pos + offset) : 0;
2253 }
2254 mutate_i8(value) {
2255 const offset = this.bb.__offset(this.bb_pos, 4);
2256 if (offset === 0) {
2257 return false;
2258 }
2259 this.bb.writeInt8(this.bb_pos + offset, value);
2260 return true;
2261 }
2262 u8() {
2263 const offset = this.bb.__offset(this.bb_pos, 6);
2264 return offset ? this.bb.readUint8(this.bb_pos + offset) : 0;
2265 }
2266 mutate_u8(value) {
2267 const offset = this.bb.__offset(this.bb_pos, 6);
2268 if (offset === 0) {
2269 return false;
2270 }
2271 this.bb.writeUint8(this.bb_pos + offset, value);
2272 return true;
2273 }
2274 i16() {
2275 const offset = this.bb.__offset(this.bb_pos, 8);
2276 return offset ? this.bb.readInt16(this.bb_pos + offset) : 0;
2277 }
2278 mutate_i16(value) {
2279 const offset = this.bb.__offset(this.bb_pos, 8);
2280 if (offset === 0) {
2281 return false;
2282 }
2283 this.bb.writeInt16(this.bb_pos + offset, value);
2284 return true;
2285 }
2286 u16() {
2287 const offset = this.bb.__offset(this.bb_pos, 10);
2288 return offset ? this.bb.readUint16(this.bb_pos + offset) : 0;
2289 }
2290 mutate_u16(value) {
2291 const offset = this.bb.__offset(this.bb_pos, 10);
2292 if (offset === 0) {
2293 return false;
2294 }
2295 this.bb.writeUint16(this.bb_pos + offset, value);
2296 return true;
2297 }
2298 i32() {
2299 const offset = this.bb.__offset(this.bb_pos, 12);
2300 return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
2301 }
2302 mutate_i32(value) {
2303 const offset = this.bb.__offset(this.bb_pos, 12);
2304 if (offset === 0) {
2305 return false;
2306 }
2307 this.bb.writeInt32(this.bb_pos + offset, value);
2308 return true;
2309 }
2310 u32() {
2311 const offset = this.bb.__offset(this.bb_pos, 14);
2312 return offset ? this.bb.readUint32(this.bb_pos + offset) : 0;
2313 }
2314 mutate_u32(value) {
2315 const offset = this.bb.__offset(this.bb_pos, 14);
2316 if (offset === 0) {
2317 return false;
2318 }
2319 this.bb.writeUint32(this.bb_pos + offset, value);
2320 return true;
2321 }
2322 i64() {
2323 const offset = this.bb.__offset(this.bb_pos, 16);
2324 return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt("0");
2325 }
2326 mutate_i64(value) {
2327 const offset = this.bb.__offset(this.bb_pos, 16);
2328 if (offset === 0) {
2329 return false;
2330 }
2331 this.bb.writeInt64(this.bb_pos + offset, value);
2332 return true;
2333 }
2334 u64() {
2335 const offset = this.bb.__offset(this.bb_pos, 18);
2336 return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt("0");
2337 }
2338 mutate_u64(value) {
2339 const offset = this.bb.__offset(this.bb_pos, 18);
2340 if (offset === 0) {
2341 return false;
2342 }
2343 this.bb.writeUint64(this.bb_pos + offset, value);
2344 return true;
2345 }
2346 f32() {
2347 const offset = this.bb.__offset(this.bb_pos, 20);
2348 return offset ? this.bb.readFloat32(this.bb_pos + offset) : 0;
2349 }
2350 mutate_f32(value) {
2351 const offset = this.bb.__offset(this.bb_pos, 20);
2352 if (offset === 0) {
2353 return false;
2354 }
2355 this.bb.writeFloat32(this.bb_pos + offset, value);
2356 return true;
2357 }
2358 f64() {
2359 const offset = this.bb.__offset(this.bb_pos, 22);
2360 return offset ? this.bb.readFloat64(this.bb_pos + offset) : 0;
2361 }
2362 mutate_f64(value) {
2363 const offset = this.bb.__offset(this.bb_pos, 22);
2364 if (offset === 0) {
2365 return false;
2366 }
2367 this.bb.writeFloat64(this.bb_pos + offset, value);
2368 return true;
2369 }
2370 v8(index) {
2371 const offset = this.bb.__offset(this.bb_pos, 24);
2372 return offset ? this.bb.readInt8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
2373 }
2374 v8Length() {
2375 const offset = this.bb.__offset(this.bb_pos, 24);
2376 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
2377 }
2378 v8Array() {
2379 const offset = this.bb.__offset(this.bb_pos, 24);
2380 return offset ? new Int8Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
2381 }
2382 vf64(index) {
2383 const offset = this.bb.__offset(this.bb_pos, 26);
2384 return offset ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + offset) + index * 8) : 0;
2385 }
2386 vf64Length() {
2387 const offset = this.bb.__offset(this.bb_pos, 26);
2388 return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
2389 }
2390 vf64Array() {
2391 const offset = this.bb.__offset(this.bb_pos, 26);
2392 return offset ? new Float64Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;
2393 }
2394 static getFullyQualifiedName() {
2395 return "MyGame.Example.TypeAliases";
2396 }
2397 static startTypeAliases(builder) {
2398 builder.startObject(12);
2399 }
2400 static addI8(builder, i8) {
2401 builder.addFieldInt8(0, i8, 0);
2402 }
2403 static addU8(builder, u8) {
2404 builder.addFieldInt8(1, u8, 0);
2405 }
2406 static addI16(builder, i16) {
2407 builder.addFieldInt16(2, i16, 0);
2408 }
2409 static addU16(builder, u16) {
2410 builder.addFieldInt16(3, u16, 0);
2411 }
2412 static addI32(builder, i32) {
2413 builder.addFieldInt32(4, i32, 0);
2414 }
2415 static addU32(builder, u32) {
2416 builder.addFieldInt32(5, u32, 0);
2417 }
2418 static addI64(builder, i64) {
2419 builder.addFieldInt64(6, i64, BigInt("0"));
2420 }
2421 static addU64(builder, u64) {
2422 builder.addFieldInt64(7, u64, BigInt("0"));
2423 }
2424 static addF32(builder, f32) {
2425 builder.addFieldFloat32(8, f32, 0);
2426 }
2427 static addF64(builder, f64) {
2428 builder.addFieldFloat64(9, f64, 0);
2429 }
2430 static addV8(builder, v8Offset) {
2431 builder.addFieldOffset(10, v8Offset, 0);
2432 }
2433 static createV8Vector(builder, data) {
2434 builder.startVector(1, data.length, 1);
2435 for (let i = data.length - 1; i >= 0; i--) {
2436 builder.addInt8(data[i]);
2437 }
2438 return builder.endVector();
2439 }
2440 static startV8Vector(builder, numElems) {
2441 builder.startVector(1, numElems, 1);
2442 }
2443 static addVf64(builder, vf64Offset) {
2444 builder.addFieldOffset(11, vf64Offset, 0);
2445 }
2446 static createVf64Vector(builder, data) {
2447 builder.startVector(8, data.length, 8);
2448 for (let i = data.length - 1; i >= 0; i--) {
2449 builder.addFloat64(data[i]);
2450 }
2451 return builder.endVector();
2452 }
2453 static startVf64Vector(builder, numElems) {
2454 builder.startVector(8, numElems, 8);
2455 }
2456 static endTypeAliases(builder) {
2457 const offset = builder.endObject();
2458 return offset;
2459 }
2460 static createTypeAliases(builder, i8, u8, i16, u16, i32, u32, i64, u64, f32, f64, v8Offset, vf64Offset) {
2461 TypeAliases.startTypeAliases(builder);
2462 TypeAliases.addI8(builder, i8);
2463 TypeAliases.addU8(builder, u8);
2464 TypeAliases.addI16(builder, i16);
2465 TypeAliases.addU16(builder, u16);
2466 TypeAliases.addI32(builder, i32);
2467 TypeAliases.addU32(builder, u32);
2468 TypeAliases.addI64(builder, i64);
2469 TypeAliases.addU64(builder, u64);
2470 TypeAliases.addF32(builder, f32);
2471 TypeAliases.addF64(builder, f64);
2472 TypeAliases.addV8(builder, v8Offset);
2473 TypeAliases.addVf64(builder, vf64Offset);
2474 return TypeAliases.endTypeAliases(builder);
2475 }
2476 serialize() {
2477 return this.bb.bytes();
2478 }
2479 static deserialize(buffer) {
2480 return TypeAliases.getRootAsTypeAliases(new flatbuffers9.ByteBuffer(buffer));
2481 }
2482 unpack() {
2483 return new TypeAliasesT(this.i8(), this.u8(), this.i16(), this.u16(), this.i32(), this.u32(), this.i64(), this.u64(), this.f32(), this.f64(), this.bb.createScalarList(this.v8.bind(this), this.v8Length()), this.bb.createScalarList(this.vf64.bind(this), this.vf64Length()));
2484 }
2485 unpackTo(_o) {
2486 _o.i8 = this.i8();
2487 _o.u8 = this.u8();
2488 _o.i16 = this.i16();
2489 _o.u16 = this.u16();
2490 _o.i32 = this.i32();
2491 _o.u32 = this.u32();
2492 _o.i64 = this.i64();
2493 _o.u64 = this.u64();
2494 _o.f32 = this.f32();
2495 _o.f64 = this.f64();
2496 _o.v8 = this.bb.createScalarList(this.v8.bind(this), this.v8Length());
2497 _o.vf64 = this.bb.createScalarList(this.vf64.bind(this), this.vf64Length());
2498 }
2499};
2500var TypeAliasesT = class {
2501 constructor(i8 = 0, u8 = 0, i16 = 0, u16 = 0, i32 = 0, u32 = 0, i64 = BigInt("0"), u64 = BigInt("0"), f32 = 0, f64 = 0, v8 = [], vf64 = []) {
2502 this.i8 = i8;
2503 this.u8 = u8;
2504 this.i16 = i16;
2505 this.u16 = u16;
2506 this.i32 = i32;
2507 this.u32 = u32;
2508 this.i64 = i64;
2509 this.u64 = u64;
2510 this.f32 = f32;
2511 this.f64 = f64;
2512 this.v8 = v8;
2513 this.vf64 = vf64;
2514 }
2515 pack(builder) {
2516 const v8 = TypeAliases.createV8Vector(builder, this.v8);
2517 const vf64 = TypeAliases.createVf64Vector(builder, this.vf64);
2518 return TypeAliases.createTypeAliases(builder, this.i8, this.u8, this.i16, this.u16, this.i32, this.u32, this.i64, this.u64, this.f32, this.f64, v8, vf64);
2519 }
2520};
2521
2522// my-game/example2.js
2523var example2_exports = {};
2524__export(example2_exports, {
2525 Monster: () => Monster,
2526 MonsterT: () => MonsterT
2527});
2528
2529// my-game/other-name-space.js
2530var other_name_space_exports = {};
2531__export(other_name_space_exports, {
2532 FromInclude: () => FromInclude,
2533 TableB: () => TableB,
2534 TableBT: () => TableBT,
2535 Unused: () => Unused,
2536 UnusedT: () => UnusedT
2537});
2538
2539// my-game/other-name-space/from-include.js
2540var FromInclude;
2541(function(FromInclude2) {
2542 FromInclude2["IncludeVal"] = "0";
2543})(FromInclude = FromInclude || (FromInclude = {}));
2544
2545// my-game/other-name-space/unused.js
2546var Unused = class {
2547 constructor() {
2548 this.bb = null;
2549 this.bb_pos = 0;
2550 }
2551 __init(i, bb) {
2552 this.bb_pos = i;
2553 this.bb = bb;
2554 return this;
2555 }
2556 a() {
2557 return this.bb.readInt32(this.bb_pos);
2558 }
2559 mutate_a(value) {
2560 this.bb.writeInt32(this.bb_pos + 0, value);
2561 return true;
2562 }
2563 static getFullyQualifiedName() {
2564 return "MyGame.OtherNameSpace.Unused";
2565 }
2566 static sizeOf() {
2567 return 4;
2568 }
2569 static createUnused(builder, a) {
2570 builder.prep(4, 4);
2571 builder.writeInt32(a);
2572 return builder.offset();
2573 }
2574 unpack() {
2575 return new UnusedT(this.a());
2576 }
2577 unpackTo(_o) {
2578 _o.a = this.a();
2579 }
2580};
2581var UnusedT = class {
2582 constructor(a = 0) {
2583 this.a = a;
2584 }
2585 pack(builder) {
2586 return Unused.createUnused(builder, this.a);
2587 }
2588};
View as plain text