@perplexdotgg/bounce 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/bounce.js CHANGED
@@ -1,1276 +1,4 @@
1
- // @__NO_SIDE_EFFECTS__
2
- function NumberType(defaultValue, readOnly) {
3
- return {
4
- monomorph: {
5
- serializedSize: 1
6
- },
7
- propertyType: 0,
8
- optional: defaultValue !== void 0,
9
- defaultValue,
10
- readOnly
11
- };
12
- }
13
- // @__NO_SIDE_EFFECTS__
14
- function StringType(defaultValue, readOnly, maxLength) {
15
- return {
16
- monomorph: maxLength === void 0 ? {
17
- serializedSize: 0,
18
- getDynamicSize: (str) => str.length
19
- } : {
20
- serializedSize: maxLength
21
- },
22
- propertyType: 1,
23
- optional: defaultValue !== void 0,
24
- defaultValue,
25
- readOnly
26
- };
27
- }
28
- // @__NO_SIDE_EFFECTS__
29
- function BooleanType(defaultValue, readOnly) {
30
- return {
31
- monomorph: {
32
- serializedSize: 1
33
- },
34
- propertyType: 2,
35
- optional: defaultValue !== void 0,
36
- defaultValue,
37
- readOnly
38
- };
39
- }
40
- // @__NO_SIDE_EFFECTS__
41
- function ReferenceListType(monomorphClass) {
42
- return {
43
- monomorph: {
44
- serializedSize: 1,
45
- // @ts-ignore
46
- theClass: monomorphClass
47
- },
48
- propertyType: 6,
49
- // this should really be false, but for some unknown reason that causes a recursive reference
50
- // on a class if it has both a ReferenceListType and a self-referencing LazyReferenceType
51
- optional: true,
52
- defaultValue: void 0,
53
- readOnly: false
54
- };
55
- }
56
- // @__NO_SIDE_EFFECTS__
57
- function LazyReferenceType(fn, readOnly) {
58
- return {
59
- monomorph: {
60
- serializedSize: 2,
61
- fnInArray: [fn],
62
- theClass: null
63
- },
64
- propertyType: 4,
65
- optional: true,
66
- defaultValue: null,
67
- readOnly
68
- };
69
- }
70
- // @__NO_SIDE_EFFECTS__
71
- function LazyReferenceListType(fn, readOnly) {
72
- return {
73
- monomorph: {
74
- serializedSize: 2,
75
- fnInArray: [fn],
76
- theClass: null
77
- },
78
- propertyType: 7,
79
- optional: true,
80
- defaultValue: null,
81
- readOnly
82
- };
83
- }
84
- // @__NO_SIDE_EFFECTS__
85
- function ReferenceType(monomorphClass, defaultValue, readOnly) {
86
- return {
87
- monomorph: monomorphClass,
88
- propertyType: 3,
89
- optional: true,
90
- defaultValue: null,
91
- readOnly
92
- };
93
- }
94
- // @__NO_SIDE_EFFECTS__
95
- function ChildType(monomorphClass, defaultValue, readOnly) {
96
- return {
97
- monomorph: monomorphClass,
98
- propertyType: 8,
99
- defaultValue,
100
- optional: defaultValue !== void 0,
101
- readOnly
102
- };
103
- }
104
- // @__NO_SIDE_EFFECTS__
105
- function makeSafeAsVariableName(name) {
106
- return name.replaceAll(".", "DOT");
107
- }
108
- function populatePropsQueue(props, propsQueue, keySoFar = "", monomorphPathSoFar = "", depth = 0) {
109
- for (const [key, maybePropertyDefinition] of Object.entries(props)) {
110
- const fullKey = keySoFar + key;
111
- const fullMonomorphPath = monomorphPathSoFar + key;
112
- const referencePath = keySoFar + "__reference__" + key;
113
- const uniqueKey = /* @__PURE__ */ makeSafeAsVariableName(fullKey);
114
- const theType = typeof maybePropertyDefinition;
115
- let propertyDefinition;
116
- if (theType === "object" && "monomorph" in maybePropertyDefinition) {
117
- propertyDefinition = maybePropertyDefinition;
118
- } else {
119
- if (theType === "function" && "serializedSize" in maybePropertyDefinition) {
120
- propertyDefinition = /* @__PURE__ */ ChildType(maybePropertyDefinition);
121
- } else if (theType === "number") {
122
- propertyDefinition = /* @__PURE__ */ NumberType(maybePropertyDefinition);
123
- } else if (theType === "boolean") {
124
- propertyDefinition = /* @__PURE__ */ BooleanType(maybePropertyDefinition);
125
- } else if (theType === "string") {
126
- propertyDefinition = /* @__PURE__ */ StringType(maybePropertyDefinition);
127
- } else {
128
- throw new Error(`Invalid property definition for key "${fullKey}", theType ${theType} ${"serializedSize" in maybePropertyDefinition}`);
129
- }
130
- props[key] = propertyDefinition;
131
- }
132
- propsQueue.push({
133
- key,
134
- fullKey,
135
- uniqueKey,
136
- parentKey: keySoFar ? keySoFar.substring(0, keySoFar.length - 1) : "",
137
- keyWithOptionalChaining: fullKey.replace(/\.([a-zA-Z])/g, (_, c3) => `?.${c3}`),
138
- monomorphPath: fullMonomorphPath,
139
- propertyDefinition,
140
- referencePath,
141
- depth
142
- });
143
- if (propertyDefinition.propertyType === 8) {
144
- populatePropsQueue(propertyDefinition.monomorph.propertyDefinitionMap, propsQueue, fullKey + ".", fullMonomorphPath + ".monomorph.propertyDefinitionMap.", depth + 1);
145
- }
146
- }
147
- }
148
- // @__NO_SIDE_EFFECTS__
149
- function stringifyDefaultValue(defaultValue) {
150
- return typeof defaultValue === "undefined" ? "null" : JSON.stringify(defaultValue);
151
- }
152
- // @__NO_SIDE_EFFECTS__
153
- function getClassCode(props, options = {}) {
154
- options = {
155
- debug: false,
156
- afterConstructorCode: "",
157
- ...options
158
- };
159
- let hasDynamicSize = false;
160
- let hasReferences = false;
161
- let hasPoolReferences = false;
162
- let hasRequiredProps = false;
163
- let dataHasBeenInitializedInResetCode = false;
164
- let beforeClassCode = "";
165
- let constructorCode = "";
166
- let customTypesConstructorCode = "";
167
- let constructorAndResetDataCode = "";
168
- let constructorAndResetDataDefaultValueCode = "";
169
- let onlyResetDataDefaultValueCode = "";
170
- let customTypesOnlyResetCode = "";
171
- let setCode = "";
172
- let customTypesBeforeDestroyCode = "";
173
- let copyCode = "";
174
- let toArrayCode = "";
175
- let toArrayCodeForPoolReferences = "";
176
- let setSerializedSizeInstanceCode = "";
177
- let fromArrayCode = "";
178
- let fromArrayCodeForPoolReferences = "";
179
- let fromArrayNoReferencesCode = "";
180
- let fromArrayNoReferencesCodeForPoolReferences = "";
181
- let fromArrayOnlyReferencesCode = "";
182
- let fromArrayOnlyReferencesCodeForPoolReferences = "";
183
- let fromArrayTemp;
184
- let referenceGettersAndSettersCode = "";
185
- let getDynamicSizeMethodCode = "";
186
- let previousDepth = 0;
187
- let previousKey = "";
188
- const propsQueue = [];
189
- populatePropsQueue(props, propsQueue);
190
- const monomorphsAlreadyAdded = /* @__PURE__ */ new Set();
191
- let propIndex = 0;
192
- let totalStaticSize = 0;
193
- while (propIndex < propsQueue.length) {
194
- const { depth, fullKey, propertyDefinition } = propsQueue[propIndex];
195
- propIndex++;
196
- if (!hasRequiredProps && propertyDefinition.propertyType !== 8 && propertyDefinition.optional !== true) {
197
- hasRequiredProps = true;
198
- }
199
- if (depth === 0) {
200
- if (!hasPoolReferences && propertyDefinition.propertyType === 8 && "hasPoolReferences" in propertyDefinition.monomorph) {
201
- hasPoolReferences = true;
202
- }
203
- if (propertyDefinition.propertyType === 3 || propertyDefinition.propertyType === 4 || propertyDefinition.propertyType === 6 || propertyDefinition.propertyType === 7) {
204
- hasReferences = true;
205
- totalStaticSize += 2;
206
- } else if (propertyDefinition.propertyType === 5) {
207
- hasPoolReferences = true;
208
- } else if (typeof propertyDefinition.monomorph.getDynamicSize === "function") {
209
- hasDynamicSize = true;
210
- getDynamicSizeMethodCode += `
211
- dynamicSize += this.${fullKey}.getDynamicSize(this.${fullKey});
212
- `;
213
- } else {
214
- totalStaticSize += propertyDefinition.monomorph.serializedSize;
215
- }
216
- }
217
- }
218
- if (hasPoolReferences) {
219
- totalStaticSize += 1;
220
- toArrayCodeForPoolReferences = `
221
- if (!skipPoolReferences) {
222
- array[offset++] = 1;
223
- `;
224
- fromArrayCodeForPoolReferences = `
225
- if (arrayOfData[offset++] === 1) {
226
- `;
227
- fromArrayOnlyReferencesCodeForPoolReferences = fromArrayCodeForPoolReferences;
228
- fromArrayNoReferencesCodeForPoolReferences = `
229
- offset++;
230
- `;
231
- if (hasDynamicSize) {
232
- getDynamicSizeMethodCode = getDynamicSizeMethodCode.replace("dynamicSize +", `getDynamicSize(skipPoolReferences) {
233
- let dynamicSize `);
234
- getDynamicSizeMethodCode += "}";
235
- setSerializedSizeInstanceCode = `
236
- const serializedSize = ${totalStaticSize} + this.getDynamicSize(skipPoolReferences);
237
- `;
238
- } else {
239
- setSerializedSizeInstanceCode += `
240
- const serializedSize = ${totalStaticSize} + (skipPoolReferences ? 0 : 0/*todo: this.getDynamicSize()*/);
241
- `;
242
- }
243
- } else if (hasDynamicSize) {
244
- getDynamicSizeMethodCode = getDynamicSizeMethodCode.replace("dynamicSize +", `getDynamicSize() {
245
- let dynamicSize `);
246
- getDynamicSizeMethodCode += "}";
247
- setSerializedSizeInstanceCode = `
248
- const serializedSize = ${totalStaticSize} + this.getDynamicSize();
249
- `;
250
- } else {
251
- setSerializedSizeInstanceCode += `
252
- const serializedSize = ${totalStaticSize};
253
- `;
254
- }
255
- if (hasReferences) {
256
- fromArrayCode += `
257
- let poolIndex;
258
- let referenceVersion;
259
- let reference;
260
- let poolArray;
261
- `;
262
- fromArrayOnlyReferencesCode += fromArrayCode;
263
- constructorAndResetDataDefaultValueCode = `
264
- if (data !== undefined) {
265
- ${constructorAndResetDataDefaultValueCode}
266
- }
267
- `;
268
- }
269
- propIndex = 0;
270
- while (propIndex < propsQueue.length) {
271
- const {
272
- fullKey,
273
- uniqueKey,
274
- parentKey,
275
- keyWithOptionalChaining,
276
- monomorphPath,
277
- propertyDefinition,
278
- referencePath,
279
- depth
280
- } = propsQueue[propIndex];
281
- propIndex++;
282
- if (depth === 0) {
283
- if ("monomorph" in propertyDefinition) {
284
- if ("hasDynamicSize" in propertyDefinition.monomorph && propertyDefinition.monomorph.hasDynamicSize) {
285
- hasDynamicSize = true;
286
- }
287
- if (propertyDefinition.propertyType === 8) {
288
- constructorCode += `
289
- this.${fullKey} = ${propertyDefinition.monomorph.name}.create(data${hasRequiredProps ? "" : "?"}.${fullKey});
290
- `;
291
- if (propertyDefinition.defaultValue === void 0) {
292
- onlyResetDataDefaultValueCode += `
293
- this.${fullKey}.reset(data?.${fullKey});
294
- `;
295
- } else {
296
- onlyResetDataDefaultValueCode += `
297
- this.${fullKey}.reset(data?.${fullKey}) ?? ${JSON.stringify(propertyDefinition.defaultValue)};
298
- `;
299
- }
300
- } else if (propertyDefinition.propertyType === 3 || propertyDefinition.propertyType === 4) {
301
- if (propertyDefinition.propertyType === 4) {
302
- const name = "lazyRefMonomorph" + propIndex;
303
- constructorCode += `
304
- if (!${name}.theClass) {
305
- ${name}.theClass = ${name}.fnInArray[0]();
306
- }
307
- this.__reference__${fullKey} = new ${name}.theClass.Reference(data${hasRequiredProps ? "" : "?"}.${fullKey});
308
- `;
309
- } else {
310
- constructorCode += `
311
- this.__reference__${fullKey} = new ${propertyDefinition.monomorph.name}.Reference(data${hasRequiredProps ? "" : "?"}.${fullKey});
312
- `;
313
- }
314
- referenceGettersAndSettersCode += `
315
- get ${fullKey}() {
316
- const refInstance = this.__reference__${fullKey};
317
- if (!refInstance.reference || refInstance.reference.version !== refInstance.version) {
318
- return null;
319
- }
320
- return refInstance.reference;
321
- }
322
-
323
- set ${fullKey}(value) {
324
- const refInstance = this.__reference__${fullKey};
325
- if (!value || (value.version & 1)) {
326
- refInstance.version = -1;
327
- refInstance.reference = null;
328
- } else {
329
- refInstance.version = value.version;
330
- refInstance.reference = value;
331
- }
332
- }
333
- `;
334
- } else if (propertyDefinition.propertyType === 7) {
335
- const name = "lazyRefList" + propIndex;
336
- constructorCode += `
337
- if (!${name}.theClass) {
338
- ${name}.theClass = ${name}.fnInArray[0]();
339
- }
340
- if (this.${fullKey}) {
341
- this.${fullKey}.length = 0;
342
- } else {
343
- this.${fullKey} = new ${name}.theClass.ReferenceList(data${hasRequiredProps ? "" : "?"}.${fullKey}?.pool || new ${name}.theClass.Pool(), data${hasRequiredProps ? "" : "?"}.${fullKey}?.maxLength, data${hasRequiredProps ? "" : "?"}.${fullKey}?.items, ${name}.theClass);
344
- }
345
- `;
346
- } else if (propertyDefinition.propertyType === 6) {
347
- const className = propertyDefinition.monomorph.theClass.name;
348
- constructorCode += `
349
- if (this.${fullKey}) {
350
- this.${fullKey}.length = 0;
351
- } else {
352
- this.${fullKey} = new ${className}.ReferenceList(data${hasRequiredProps ? "" : "?"}.${fullKey}?.pool || new ${className}.Pool(), data${hasRequiredProps ? "" : "?"}.${fullKey}?.maxLength, data${hasRequiredProps ? "" : "?"}.${fullKey}?.items, ${className});
353
- }
354
- `;
355
- } else if (propertyDefinition.propertyType === 9) {
356
- const customTypeConfig = propertyDefinition.monomorph;
357
- const params = {
358
- depth,
359
- key: fullKey,
360
- thisProperty: `this.${fullKey}`,
361
- dataProperty: `data${hasRequiredProps ? "" : "?"}.${fullKey}`,
362
- customTypeData: "customType" + propIndex
363
- };
364
- if (typeof customTypeConfig.constructorCode !== "undefined") {
365
- customTypesConstructorCode += typeof customTypeConfig.constructorCode === "function" ? customTypeConfig.constructorCode(params) : customTypeConfig.constructorCode;
366
- } else {
367
- customTypesConstructorCode += `
368
- this.${fullKey} = data${hasRequiredProps ? "" : "?"}.${fullKey} ?? ${/* @__PURE__ */ stringifyDefaultValue(propertyDefinition.defaultValue)}; // 111
369
- `;
370
- }
371
- if (typeof customTypeConfig.resetCode !== "undefined") {
372
- customTypesOnlyResetCode += typeof customTypeConfig.resetCode === "function" ? customTypeConfig.resetCode(params) : customTypeConfig.resetCode;
373
- } else {
374
- customTypesOnlyResetCode += `
375
- this.${fullKey} = data${hasRequiredProps ? "" : "?"}.${fullKey} ?? this.${fullKey} ?? ${/* @__PURE__ */ stringifyDefaultValue(propertyDefinition.defaultValue)};
376
- `;
377
- }
378
- if (typeof customTypeConfig.beforeDestroyCode !== "undefined") {
379
- customTypesBeforeDestroyCode += typeof customTypeConfig.beforeDestroyCode === "function" ? customTypeConfig.beforeDestroyCode(params) : customTypeConfig.beforeDestroyCode;
380
- } else {
381
- customTypesBeforeDestroyCode += `
382
- this.${fullKey} = null;
383
- `;
384
- }
385
- }
386
- }
387
- if (propertyDefinition.defaultValue !== void 0 && propertyDefinition.propertyType !== 6 && propertyDefinition.propertyType !== 7) {
388
- if (!dataHasBeenInitializedInResetCode) {
389
- dataHasBeenInitializedInResetCode = true;
390
- constructorAndResetDataDefaultValueCode += `
391
- data = data ?? {};
392
- `;
393
- }
394
- if (parentKey) {
395
- constructorAndResetDataDefaultValueCode += `
396
- data.${parentKey} = data.${parentKey} ?? {};
397
- `;
398
- }
399
- constructorAndResetDataDefaultValueCode += `
400
- data.${fullKey} = data.${fullKey} ?? ${JSON.stringify(propertyDefinition.defaultValue)};
401
- `;
402
- }
403
- if (propertyDefinition.propertyType !== 8 && propertyDefinition.propertyType !== 6 && propertyDefinition.propertyType !== 7 && propertyDefinition.propertyType !== 9) {
404
- if (hasRequiredProps) {
405
- if (propertyDefinition.optional) {
406
- constructorAndResetDataCode += `
407
- this.${fullKey} = data.${fullKey} ?? ${propertyDefinition.defaultValue};
408
- `;
409
- } else {
410
- constructorAndResetDataCode += `
411
- this.${fullKey} = data.${fullKey};
412
- `;
413
- }
414
- } else {
415
- constructorAndResetDataCode += `
416
- this.${fullKey} = data.${keyWithOptionalChaining};
417
- `;
418
- }
419
- }
420
- }
421
- if (previousDepth < depth) {
422
- setCode += `
423
- if (data.${previousKey} !== undefined) {
424
- `;
425
- previousDepth = depth;
426
- } else if (previousDepth > depth) {
427
- while (previousDepth > depth) {
428
- setCode += `
429
- }
430
- `;
431
- previousDepth--;
432
- }
433
- }
434
- previousKey = fullKey;
435
- if (propertyDefinition.propertyType === 8 || propertyDefinition.propertyType === 3 || propertyDefinition.propertyType === 5) {
436
- const monomorph = propertyDefinition.monomorph;
437
- if (!monomorphsAlreadyAdded.has(monomorph.name)) {
438
- beforeClassCode += `
439
- const ${monomorph.name} = input.${monomorphPath}.monomorph;
440
- `;
441
- monomorphsAlreadyAdded.add(monomorph.name);
442
- }
443
- } else if (propertyDefinition.propertyType === 6) {
444
- const monomorph = propertyDefinition.monomorph;
445
- const className = monomorph.theClass.name;
446
- if (!monomorphsAlreadyAdded.has(className)) {
447
- beforeClassCode += `
448
- const ${className} = input.${monomorphPath}.monomorph.theClass;
449
- `;
450
- monomorphsAlreadyAdded.add(className);
451
- }
452
- } else if (propertyDefinition.propertyType === 4) {
453
- const name = "lazyRefMonomorph" + propIndex;
454
- if (!monomorphsAlreadyAdded.has(name)) {
455
- beforeClassCode += `
456
- const ${name} = input.${monomorphPath}.monomorph;
457
- `;
458
- monomorphsAlreadyAdded.add(name);
459
- }
460
- } else if (propertyDefinition.propertyType === 7) {
461
- const name = "lazyRefList" + propIndex;
462
- if (!monomorphsAlreadyAdded.has(name)) {
463
- beforeClassCode += `
464
- const ${name} = input.${monomorphPath}.monomorph;
465
- `;
466
- monomorphsAlreadyAdded.add(name);
467
- }
468
- } else if (propertyDefinition.propertyType === 9) {
469
- const customTypeConfig = propertyDefinition.monomorph;
470
- const name = "customType" + propIndex;
471
- if (customTypeConfig.beforeClassCode || customTypeConfig.constructorCode || customTypeConfig.resetCode || customTypeConfig.beforeDestroyCode) {
472
- beforeClassCode += `
473
- const ${name} = input.${monomorphPath}.monomorph.data;
474
- `;
475
- }
476
- if (customTypeConfig.beforeClassCode) {
477
- beforeClassCode += typeof customTypeConfig.beforeClassCode === "function" ? customTypeConfig.beforeClassCode({
478
- depth,
479
- key: fullKey,
480
- // thisProperty: `this.${fullKey}`,
481
- // dataProperty: `data${hasRequiredProps ? '' : '?'}.${fullKey}`,
482
- customTypeData: name
483
- }) : customTypeConfig.beforeClassCode;
484
- }
485
- }
486
- if (propertyDefinition.propertyType !== 8) {
487
- if (propertyDefinition.propertyType === 6 || propertyDefinition.propertyType === 7) {
488
- setCode += `
489
- if (data.${fullKey} !== undefined) {
490
- this.${fullKey}.length = 0;
491
- }
492
- `;
493
- copyCode += `
494
- this.${fullKey}.maxLength = other.${fullKey}.maxLength;
495
-
496
- const ${uniqueKey}length = other.${fullKey}.length;
497
- this.${fullKey}.length = ${uniqueKey}length;
498
- for (let i = 0; i < ${uniqueKey}length; i++) {
499
- this.${fullKey}.arrayOfIndices[i] = other.${fullKey}.arrayOfIndices[i];
500
- this.${fullKey}.arrayOfVersions[i] = other.${fullKey}.arrayOfVersions[i];
501
- }
502
- `;
503
- } else if (propertyDefinition.propertyType === 9) {
504
- const customTypeConfig = propertyDefinition.monomorph;
505
- const params = {
506
- depth,
507
- key: fullKey,
508
- thisProperty: `this.${fullKey}`,
509
- dataProperty: `data.${fullKey}`,
510
- customTypeData: "customType" + propIndex
511
- };
512
- if (typeof customTypeConfig.setCode !== "undefined") {
513
- setCode += typeof customTypeConfig.setCode === "function" ? customTypeConfig.setCode(params) : customTypeConfig.setCode;
514
- } else {
515
- setCode += `
516
- if (data.${fullKey} !== undefined) {
517
- this.${fullKey} = data.${fullKey};
518
- }
519
- `;
520
- }
521
- if (typeof customTypeConfig.copyCode !== "undefined") {
522
- copyCode += typeof customTypeConfig.copyCode === "function" ? customTypeConfig.copyCode({
523
- depth,
524
- key: fullKey,
525
- thisProperty: `this.${fullKey}`,
526
- otherProperty: `other.${fullKey}`,
527
- customTypeData: "customType" + propIndex
528
- }) : customTypeConfig.copyCode;
529
- } else {
530
- copyCode += `
531
- this.${fullKey} = other.${fullKey};
532
- `;
533
- }
534
- } else {
535
- setCode += `
536
- if (data.${fullKey} !== undefined) {
537
- this.${fullKey} = data.${fullKey};
538
- }
539
- `;
540
- copyCode += `
541
- this.${fullKey} = other.${fullKey};
542
- `;
543
- }
544
- switch (propertyDefinition.propertyType) {
545
- case 0:
546
- toArrayCode += `
547
- array[offset++] = this.${fullKey};
548
- `;
549
- fromArrayTemp = `
550
- this.${fullKey} = arrayOfData[offset++];
551
- `;
552
- fromArrayCode += fromArrayTemp;
553
- fromArrayNoReferencesCode += fromArrayTemp;
554
- fromArrayOnlyReferencesCode += `
555
- offset++;
556
- `;
557
- break;
558
- case 1:
559
- toArrayCode += `
560
- throw new Error('serializing strings is not implemented yet');
561
- `;
562
- fromArrayTemp = `
563
- throw new Error('serializing strings is not implemented yet');
564
- `;
565
- fromArrayCode += fromArrayTemp;
566
- fromArrayNoReferencesCode += fromArrayTemp;
567
- fromArrayOnlyReferencesCode += fromArrayTemp;
568
- break;
569
- case 2:
570
- toArrayCode += `
571
- array[offset++] = Number(this.${fullKey});
572
- `;
573
- fromArrayTemp = `
574
- this.${fullKey} = Boolean(arrayOfData[offset++]);
575
- `;
576
- fromArrayCode += fromArrayTemp;
577
- fromArrayNoReferencesCode += fromArrayTemp;
578
- fromArrayOnlyReferencesCode += `
579
- offset++;
580
- `;
581
- break;
582
- case 3:
583
- case 4:
584
- toArrayCode += `
585
- if (this.${referencePath}.reference && this.${referencePath}.version === this.${referencePath}.reference.version) {
586
- array[offset++] = this.${referencePath}.reference.index;
587
- array[offset++] = this.${referencePath}.version;
588
- } else {
589
- array[offset++] = -1;
590
- array[offset++] = -1;
591
- }
592
- `;
593
- fromArrayTemp = `
594
- poolIndex = arrayOfData[offset++];
595
- if (poolIndex === -1) {
596
- this.${referencePath}.reference = null;
597
- this.${referencePath}.version = -1;
598
- offset++; ${""}
599
- } else {
600
- poolArray = references.${fullKey}.array;
601
- reference = poolArray[poolIndex];
602
- referenceVersion = arrayOfData[offset++];
603
-
604
- if (reference && reference.version === referenceVersion) {
605
- this.${referencePath}.reference = reference;
606
- this.${referencePath}.version = referenceVersion;
607
- } else {
608
- this.${referencePath}.reference = null;
609
- this.${referencePath}.version = -1;
610
- }
611
- }
612
- `;
613
- fromArrayCode += fromArrayTemp;
614
- fromArrayOnlyReferencesCode += fromArrayTemp;
615
- fromArrayNoReferencesCode += `
616
- offset += 2;
617
- `;
618
- break;
619
- case 6:
620
- toArrayCode += `
621
- array[offset++] = this.${fullKey}.length;
622
- for (let i = 0; i < this.${fullKey}.length; i++) {
623
- array[offset++] = this.${fullKey}.arrayOfIndices[i];
624
- array[offset++] = this.${fullKey}.arrayOfVersions[i];
625
- }
626
- `;
627
- fromArrayTemp = `
628
- const ${uniqueKey}ListLength = arrayOfData[offset++];
629
- for (let i = 0; i < ${uniqueKey}ListLength; i++) {
630
- this.${fullKey}.arrayOfIndices[i] = arrayOfData[offset++];
631
- this.${fullKey}.arrayOfVersions[i] = arrayOfData[offset++];
632
- }
633
-
634
- this.${fullKey}.pool = references.${fullKey};
635
- `;
636
- fromArrayCode += fromArrayTemp;
637
- fromArrayOnlyReferencesCode += fromArrayTemp;
638
- fromArrayNoReferencesCode += `
639
- offset += arrayOfData[offset++] * 2;
640
- `;
641
- break;
642
- case 5:
643
- toArrayCodeForPoolReferences += `
644
- if (this.${fullKey} && this.${fullKey}.length > 0) {
645
- array[offset++] = 1; // indicates that the pool reference is not empty
646
- offset = this.${fullKey}.toArray(array, offset);
647
- } else {
648
- array[offset++] = 0; // indicates that the pool reference is empty
649
- }
650
- `;
651
- fromArrayCodeForPoolReferences += `
652
- if (arrayOfData[offset++] === 1) {
653
- this.${fullKey} = references.${fullKey} || this.${fullKey} || new ${propertyDefinition.monomorph.name}.Pool();
654
- offset = this.${fullKey}.fromArray(arrayOfData, ${propertyDefinition.monomorph.hasReferences ? `references.${fullKey}, ` : ""} offset);
655
- } else {
656
- this.${fullKey} = null;
657
- }
658
- `;
659
- fromArrayOnlyReferencesCodeForPoolReferences += `
660
- if (arrayOfData[offset++] === 1) {
661
- this.${fullKey} = references.${fullKey} || this.${fullKey} || new ${propertyDefinition.monomorph.name}.Pool();
662
- offset = this.${fullKey}.fromArrayOnlyReferences(arrayOfData, ${propertyDefinition.monomorph.hasReferences ? `references.${fullKey}, ` : ""} offset);
663
- } else {
664
- this.${fullKey} = null;
665
- }
666
- `;
667
- fromArrayNoReferencesCodeForPoolReferences += `
668
- if (arrayOfData[offset++] === 1) {
669
- this.${fullKey} = references.${fullKey} || this.${fullKey} || new ${propertyDefinition.monomorph.name}.Pool();
670
- offset = this.${fullKey}.fromArrayNoReferences(arrayOfData, ${propertyDefinition.monomorph.hasReferences ? `references.${fullKey}, ` : ""} offset);
671
- }
672
- `;
673
- break;
674
- }
675
- }
676
- }
677
- if (hasPoolReferences) {
678
- toArrayCodeForPoolReferences += `
679
- } else {
680
- array[offset++] = 0; // indicates that pool references were skipped
681
- }
682
- `;
683
- fromArrayCodeForPoolReferences += `
684
- }
685
- `;
686
- fromArrayOnlyReferencesCodeForPoolReferences += `
687
- }
688
- `;
689
- }
690
- while (previousDepth > 0) {
691
- setCode += `
692
- }
693
- `;
694
- previousDepth--;
695
- }
696
- const code = `
697
- ${beforeClassCode}
698
-
699
- function iterateOverPool(pool) {
700
- let index = 0;
701
- let nonEmpty = 0;
702
- const array = pool.array;
703
- const maxLength = pool.maxLength;
704
- const iteratorResult = {
705
- done: false,
706
- value: null,
707
- };
708
-
709
- return {
710
- next() {
711
- ${""}
712
- while (index < (pool.length + pool.freeIndices.length) && (!array[index] || (array[index].version & 1) === 1)) {
713
- index++;
714
- }
715
-
716
- ${""}
717
- if (index >= maxLength || nonEmpty >= pool.length) {
718
- iteratorResult.done = true;
719
- iteratorResult.value = null;
720
- return iteratorResult;
721
- }
722
-
723
- const value = array[index];
724
- index++;
725
- nonEmpty++;
726
- iteratorResult.done = false;
727
- iteratorResult.value = value;
728
- return iteratorResult;
729
- }
730
- };
731
- }
732
-
733
- function iterateOverReferenceList(referenceList, fixDestroyed = true) {
734
- let index = 0;
735
- const poolArray = referenceList.pool.array;
736
- const arrayOfIndices = referenceList.arrayOfIndices;
737
- const arrayOfVersions = referenceList.arrayOfVersions;
738
- const iteratorResult = {
739
- done: false,
740
- value: null,
741
- };
742
- let poolItem;
743
-
744
- return {
745
- next() {
746
- if (!arrayOfIndices.length || index >= arrayOfIndices.length) {
747
- iteratorResult.done = true;
748
- iteratorResult.value = null;
749
- return iteratorResult;
750
- }
751
-
752
- poolItem = poolArray[arrayOfIndices[index]];
753
-
754
- ${""}
755
- while (index < arrayOfIndices.length && (((poolItem.version & 1) === 1) || poolItem.version !== arrayOfVersions[index])) {
756
- if (fixDestroyed) {
757
- if (index < arrayOfIndices.length - 1) {
758
- arrayOfIndices[index] = arrayOfIndices[arrayOfIndices.length - 1];
759
- arrayOfVersions[index] = arrayOfVersions[arrayOfVersions.length - 1];
760
- poolItem = poolArray[arrayOfIndices[index]];
761
- }
762
-
763
- referenceList.length -= 1;
764
- } else {
765
- index++;
766
- if (index < arrayOfIndices.length) {
767
- poolItem = poolArray[arrayOfIndices[index]];
768
- }
769
- }
770
- }
771
-
772
- if (index >= arrayOfIndices.length) {
773
- iteratorResult.done = true;
774
- iteratorResult.value = null;
775
- return iteratorResult;
776
- }
777
-
778
- index++;
779
- iteratorResult.done = false;
780
- iteratorResult.value = poolItem;
781
- return iteratorResult;
782
- }
783
- };
784
- }
785
-
786
- const theClass = class {
787
- static hasDynamicSize = ${hasDynamicSize};
788
-
789
- constructor(data, index, pool) {
790
- ${constructorAndResetDataDefaultValueCode}
791
- ${constructorCode}
792
- ${constructorAndResetDataCode}
793
- ${customTypesConstructorCode}
794
- this.index = index;
795
- this.version = 0; ${""}
796
- this.pool = (pool === undefined) ? null : pool;
797
- ${options.afterConstructorCode}
798
- }
799
-
800
- ${referenceGettersAndSettersCode}
801
-
802
- reset(data) {
803
- ${constructorAndResetDataDefaultValueCode}
804
- ${onlyResetDataDefaultValueCode}
805
- ${constructorAndResetDataCode}
806
- ${customTypesOnlyResetCode}
807
- return this;
808
- }
809
-
810
- set(data) {
811
- ${setCode}
812
- return this;
813
- }
814
-
815
- copy(other) {
816
- ${copyCode}
817
- return this;
818
- }
819
-
820
- destroy() {
821
- ${customTypesBeforeDestroyCode}
822
- if (this.version & 1 === 1) {
823
- ${""}
824
- return;
825
- }
826
- this.version++; // becomes odd, meaning deleted
827
- if (this.pool) {
828
- this.pool.length--;
829
- this.pool.freeIndices.push(this.index);
830
- }
831
- }
832
-
833
- isDestroyed() {
834
- return Boolean(this.version & 1);
835
- }
836
-
837
- iterateOverPool() {
838
- if (!this.pool) {
839
- throw new Error("Pool is not set");
840
- }
841
- // call the static method
842
- return theClass.iterateOverPool(this.pool);
843
- }
844
-
845
- createInPool(data) {
846
- if (!this.pool) {
847
- throw new Error("Pool is not set");
848
- }
849
- return this.constructor.create(data, this.pool);
850
- }
851
-
852
- ${getDynamicSizeMethodCode}
853
-
854
- toArray(array, startOffset = 0${hasPoolReferences ? ", skipPoolReferences = false" : ""}) {
855
- ${""}
856
- ${setSerializedSizeInstanceCode}
857
-
858
- if (array === undefined) {
859
- array = new Array(serializedSize + startOffset);
860
- ${""}
861
- } else if (ArrayBuffer.isView(array) && array.length < serializedSize + startOffset) {
862
- throw new Error("Array is too small to write data into, needed "+(serializedSize + startOffset)+" but typed array is of length "+array.length);
863
- }
864
-
865
- let offset = startOffset;
866
-
867
- ${toArrayCode}
868
-
869
- ${toArrayCodeForPoolReferences}
870
-
871
- return offset;
872
- }
873
-
874
- fromArray(arrayOfData, ${hasReferences || hasPoolReferences ? "references," : ""} startOffset = 0) {
875
- let offset = startOffset;
876
-
877
- ${fromArrayCode}
878
-
879
- ${fromArrayCodeForPoolReferences}
880
-
881
- return offset;
882
- }
883
-
884
- fromArrayNoReferences(arrayOfData, startOffset = 0) {
885
- let offset = startOffset;
886
-
887
- ${fromArrayNoReferencesCode}
888
-
889
- ${fromArrayNoReferencesCodeForPoolReferences}
890
-
891
- return offset;
892
- }
893
-
894
- fromArrayOnlyReferences(arrayOfData, references, startOffset = 0) {
895
- let offset = startOffset;
896
-
897
- ${fromArrayOnlyReferencesCode}
898
-
899
- ${fromArrayOnlyReferencesCodeForPoolReferences}
900
-
901
- return offset;
902
- }
903
-
904
- static get ReferenceList() {
905
- if (!this.DynamicReferenceListClass) {
906
- const currentClass = this;
907
- this.DynamicReferenceListClass = class {
908
- constructor(pool, maxLength = Infinity, data = undefined, classConstructor = currentClass) {
909
- this.pool = pool;
910
- this.maxLength = maxLength;
911
- this.arrayOfIndices = [];
912
- this.arrayOfVersions = [];
913
- this.classConstructor = classConstructor;
914
-
915
- if (data?.length) {
916
- for (const item of data) {
917
- this.create(item);
918
- }
919
- }
920
- }
921
-
922
- get length() {
923
- return this.arrayOfIndices.length;
924
- }
925
-
926
- set length(v) {
927
- this.arrayOfIndices.length = v;
928
- this.arrayOfVersions.length = v;
929
- }
930
-
931
- push(instance) {
932
- if (this.length >= this.maxLength) {
933
- throw new Error("Could not add instance to reference list, reference list maxLength of "+this.maxLength+" has been reached");
934
- }
935
- if (instance.pool !== this.pool) {
936
- throw new Error("Could not add instance to reference list, instance does not belong to the same pool as the reference list");
937
- }
938
- const length = this.length;
939
- this.arrayOfIndices[length] = instance.index;
940
- this.arrayOfVersions[length] = instance.version;
941
- return length;
942
- }
943
-
944
- getAtIndex(index, fixDestroyed = true) {
945
- if (index < 0 || index >= this.arrayOfIndices.length) {
946
- return null;
947
- }
948
- let poolItem = this.pool.array[this.arrayOfIndices[index]];
949
-
950
- if (fixDestroyed) {
951
- while (index < this.arrayOfIndices.length && ((poolItem.version & 1) === 1 || poolItem.version !== this.arrayOfVersions[index])) {
952
- if (index < this.arrayOfIndices.length - 1) {
953
- this.arrayOfIndices[index] = this.arrayOfIndices[this.arrayOfIndices.length - 1];
954
- this.arrayOfVersions[index] = this.arrayOfVersions[this.arrayOfVersions.length - 1];
955
- }
956
-
957
- this.length -= 1;
958
-
959
- if (index < this.arrayOfIndices.length) {
960
- poolItem = this.pool.array[this.arrayOfIndices[index]];
961
- } else {
962
- return null;
963
- }
964
- }
965
- } else if ((poolItem.version & 1) === 1 || poolItem.version !== this.arrayOfVersions[index]) {
966
- return null;
967
- }
968
-
969
- return poolItem;
970
- }
971
-
972
- remove(instance) {
973
- for (let i = 0; i < this.arrayOfIndices.length; i++) {
974
- if (this.arrayOfIndices[i] === instance.index && this.arrayOfVersions[i] === instance.version) {
975
- if (i < this.arrayOfIndices.length - 1) {
976
- this.arrayOfIndices[i] = this.arrayOfIndices[this.arrayOfIndices.length - 1];
977
- this.arrayOfVersions[i] = this.arrayOfVersions[this.arrayOfVersions.length - 1];
978
- }
979
- this.length -= 1;
980
- return i;
981
- }
982
- }
983
- return -1;
984
- }
985
-
986
- removeIndex(index) {
987
- if (index < 0 || index >= this.arrayOfIndices.length) {
988
- return false;
989
- }
990
- if (index < this.arrayOfIndices.length - 1) {
991
- this.arrayOfIndices[index] = this.arrayOfIndices[this.arrayOfIndices.length - 1];
992
- this.arrayOfVersions[index] = this.arrayOfVersions[this.arrayOfVersions.length - 1];
993
- }
994
- this.length -= 1;
995
- return true;
996
- }
997
-
998
- clear() {
999
- this.length = 0;
1000
- }
1001
-
1002
- create(data) {
1003
- const instance = this.classConstructor.create(data, this.pool);
1004
- const length = this.length;
1005
- this.arrayOfIndices[length] = instance.index;
1006
- this.arrayOfVersions[length] = instance.version;
1007
- return instance;
1008
- }
1009
-
1010
- [Symbol.iterator]() {
1011
- return iterateOverReferenceList(this, true);
1012
- }
1013
-
1014
- get iterateIgnoreEmpty() {
1015
- const self = this;
1016
- return {
1017
- [Symbol.iterator]() {
1018
- return iterateOverReferenceList(self, false);
1019
- }
1020
- };
1021
- }
1022
- }
1023
- }
1024
-
1025
- return this.DynamicReferenceListClass;
1026
- }
1027
-
1028
- static get Pool() {
1029
- if (!this.DynamicPoolClass) {
1030
- const currentClass = this;
1031
- this.DynamicPoolClass = class {
1032
- constructor(length = Infinity, classConstructor = currentClass) {
1033
- this.length = 0;
1034
- this.maxLength = length;
1035
- this.array = new Array(isFinite(length) ? length : undefined);
1036
- this.freeIndices = [1];
1037
- this.freeIndices.pop();
1038
- this.classConstructor = classConstructor;
1039
- }
1040
-
1041
- [Symbol.iterator]() {
1042
- return iterateOverPool(this);
1043
- }
1044
-
1045
- create(data) {
1046
- return this.classConstructor.create(data, this);
1047
- }
1048
-
1049
- toArray(array, startOffset = 0${hasPoolReferences ? ", skipPoolReferences = false" : ""}) {
1050
- let offset = startOffset;
1051
-
1052
- if (this.maxLength > 0 && isFinite(this.length)) {
1053
- array[offset++] = isFinite(this.maxLength) ? this.maxLength : -1;
1054
- array[offset++] = this.length + this.freeIndices.length;
1055
- }
1056
-
1057
- array[offset++] = this.freeIndices.length;
1058
- for (let i = 0; i < this.freeIndices.length; i++) {
1059
- array[offset++] = this.freeIndices[i];
1060
- }
1061
-
1062
- ${""}
1063
-
1064
- for (let i = 0; i < this.length + this.freeIndices.length; i++) {
1065
- const instance = this.array[i];
1066
- if (instance === undefined) {
1067
- array[offset++] = -1;
1068
- continue;
1069
- }
1070
- array[offset++] = instance.version;
1071
- if (instance.version & 1) {${""}
1072
- continue;
1073
- }
1074
- offset = instance.toArray(array, offset${hasPoolReferences ? ", skipPoolReferences" : ""});
1075
- }
1076
-
1077
- return offset;
1078
- }
1079
-
1080
- fromArray(arrayOfData, ${hasReferences ? "references," : ""} startOffset = 0, classConstructor = this.classConstructor) {
1081
- let offset = startOffset;
1082
-
1083
- this.maxLength = arrayOfData[offset++];
1084
- if (this.maxLength === -1) {
1085
- this.maxLength = Infinity;
1086
- }
1087
- const usedLength = arrayOfData[offset++];
1088
- this.length = 0;
1089
-
1090
- const freeIndicesLength = arrayOfData[offset++];
1091
- this.freeIndices.length = freeIndicesLength;
1092
- for (let i = 0; i < freeIndicesLength; i++) {
1093
- this.freeIndices[i] = arrayOfData[offset++];
1094
- }
1095
-
1096
-
1097
- for (let i = 0; i < usedLength; i++) {
1098
- const version = arrayOfData[offset++];
1099
-
1100
- if (version & 1) {
1101
- if (this.array[i]) {
1102
- this.array[i].version = version;
1103
- }
1104
- continue;
1105
- }
1106
-
1107
- this.length++;
1108
-
1109
- if (this.array[i] === undefined) {
1110
- this.array[i] = new classConstructor(undefined, i, this);
1111
- }
1112
-
1113
- this.array[i].version = version;
1114
-
1115
- offset = this.array[i].fromArray(arrayOfData, ${hasReferences ? "references, " : ""} offset);
1116
- }
1117
-
1118
- return offset;
1119
- }
1120
-
1121
- ${hasReferences ? `
1122
- fromArrayNoReferences(arrayOfData, startOffset = 0, classConstructor = this.classConstructor) {
1123
- let offset = startOffset;
1124
-
1125
- this.maxLength = arrayOfData[offset++];
1126
- if (this.maxLength === -1) {
1127
- this.maxLength = Infinity;
1128
- }
1129
- const usedLength = arrayOfData[offset++];
1130
- this.length = 0;
1131
-
1132
- const freeIndicesLength = arrayOfData[offset++];
1133
- this.freeIndices.length = freeIndicesLength;
1134
- for (let i = 0; i < freeIndicesLength; i++) {
1135
- this.freeIndices[i] = arrayOfData[offset++];
1136
- }
1137
-
1138
- for (let i = 0; i < usedLength; i++) {
1139
- const version = arrayOfData[offset++];
1140
-
1141
- if (version & 1) {
1142
- if (this.array[i]) {
1143
- this.array[i].version = version;
1144
- }
1145
- continue;
1146
- }
1147
-
1148
- this.length++;
1149
-
1150
- if (this.array[i] === undefined) {
1151
- this.array[i] = new classConstructor(undefined, i, this);
1152
- }
1153
-
1154
- this.array[i].version = version;
1155
-
1156
- offset = this.array[i].fromArrayNoReferences(arrayOfData, offset);
1157
- }
1158
-
1159
- return offset;
1160
- }
1161
-
1162
- fromArrayOnlyReferences(arrayOfData, references, startOffset = 0, classConstructor = this.classConstructor) {
1163
- let offset = startOffset;
1164
-
1165
- this.maxLength = arrayOfData[offset++];
1166
- if (this.maxLength === -1) {
1167
- this.maxLength = Infinity;
1168
- }
1169
- const usedLength = arrayOfData[offset++];
1170
- this.length = 0;
1171
-
1172
- const freeIndicesLength = arrayOfData[offset++];
1173
- this.freeIndices.length = freeIndicesLength;
1174
- for (let i = 0; i < freeIndicesLength; i++) {
1175
- this.freeIndices[i] = arrayOfData[offset++];
1176
- }
1177
-
1178
- for (let i = 0; i < usedLength; i++) {
1179
- const version = arrayOfData[offset++];
1180
-
1181
- if (version & 1) {
1182
- if (this.array[i]) {
1183
- this.array[i].version = version;
1184
- }
1185
- continue;
1186
- }
1187
-
1188
- this.length++;
1189
-
1190
- if (this.array[i] === undefined) {
1191
- this.array[i] = new classConstructor(undefined, i, this);
1192
- }
1193
-
1194
- this.array[i].version = version;
1195
-
1196
- offset = this.array[i].fromArrayOnlyReferences(arrayOfData, references, offset);
1197
- }
1198
-
1199
- return offset;
1200
- }
1201
- ` : ""}
1202
- }
1203
- }
1204
-
1205
- return this.DynamicPoolClass;
1206
- }
1207
- }
1208
-
1209
- theClass.propertyDefinitionMap = input;
1210
-
1211
- theClass.create = function(data, pool) {
1212
- if (pool === undefined) {
1213
- return new this(data);
1214
- }
1215
- if (pool.length >= pool.maxLength) {
1216
- throw new Error("Could not create instance, pool maxLength of "+pool.maxLength+" has been reached");
1217
- }
1218
- if (pool.freeIndices.length) {
1219
- const index = pool.freeIndices.pop();
1220
- pool.length++;
1221
- const instance = pool.array[index];
1222
- instance.version++; ${""}
1223
- instance.reset(data);
1224
- return instance;
1225
- } else {
1226
- const instance = new this(data, pool.length, pool);
1227
- pool.array[pool.length] = instance;
1228
- pool.length++;
1229
- return instance;
1230
- }
1231
- }
1232
-
1233
- theClass.createFromArray = function(dataArray, ${hasReferences ? "references," : ""} startOffset = 0, pool) {
1234
- const instance = this.create(undefined, pool);
1235
- instance.fromArray(dataArray, ${hasReferences ? "references," : ""} startOffset);
1236
- return instance;
1237
- }
1238
-
1239
- theClass.serializedSize = ${hasDynamicSize ? 0 : totalStaticSize};
1240
-
1241
- theClass.iterateOverPool = function(pool) {
1242
- return {
1243
- [Symbol.iterator]() {
1244
- return iterateOverPool(pool);
1245
- },
1246
- };
1247
- }
1248
-
1249
- theClass.Reference = class {
1250
- constructor(reference) {
1251
- if (reference && !(reference.version & 1)) {
1252
- this.reference = reference;
1253
- this.version = reference.version;
1254
- } else {
1255
- this.reference = null;
1256
- this.version = -1;
1257
- }
1258
- }
1259
- }
1260
-
1261
- theClass.hasReferences = ${hasReferences};
1262
-
1263
- return theClass;
1264
- `;
1265
- if (options.debug) {
1266
- console.log("code", code);
1267
- }
1268
- return code;
1269
- }
1270
- // @__NO_SIDE_EFFECTS__
1271
- function createClass(props, options = {}) {
1272
- return new Function("input", /* @__PURE__ */ getClassCode(props, options))(props, options);
1273
- }
1
+ import { createClass, ChildType, NumberType, LazyReferenceListType, BooleanType, LazyReferenceType, ReferenceListType, ReferenceType } from "monomorph";
1274
2
  const mat3Keys = ["e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7", "e8"];
1275
3
  const mat3Props = {
1276
4
  e0: 0,
@@ -1283,7 +11,7 @@ const mat3Props = {
1283
11
  e7: 0,
1284
12
  e8: 0
1285
13
  };
1286
- class Mat3 extends (/* @__PURE__ */ createClass(mat3Props)) {
14
+ class Mat3 extends createClass(mat3Props) {
1287
15
  adjointMatrix(a3) {
1288
16
  let a00 = a3.e0, a01 = a3.e1, a02 = a3.e2;
1289
17
  let a10 = a3.e3, a11 = a3.e4, a12 = a3.e5;
@@ -1697,7 +425,7 @@ const vec3Props = {
1697
425
  y: 0,
1698
426
  z: 0
1699
427
  };
1700
- class Vec3 extends (/* @__PURE__ */ createClass(vec3Props)) {
428
+ class Vec3 extends createClass(vec3Props) {
1701
429
  constructor(data, index, pool) {
1702
430
  if (Array.isArray(data)) {
1703
431
  data = {
@@ -2199,7 +927,7 @@ const lineProps = {
2199
927
  a: Vec3,
2200
928
  b: Vec3
2201
929
  };
2202
- class Line extends (/* @__PURE__ */ createClass(lineProps)) {
930
+ class Line extends createClass(lineProps) {
2203
931
  setFromPointAndDirection(point2, direction2, length) {
2204
932
  this.a.copy(point2);
2205
933
  this.b.addScaledToVector(point2, direction2, length);
@@ -2212,7 +940,7 @@ const quatProps = {
2212
940
  z: 0,
2213
941
  w: 1
2214
942
  };
2215
- class Quat extends (/* @__PURE__ */ createClass(quatProps)) {
943
+ class Quat extends createClass(quatProps) {
2216
944
  constructor(data, index, pool) {
2217
945
  if (Array.isArray(data)) {
2218
946
  data = {
@@ -2445,7 +1173,7 @@ const mat4Props = {
2445
1173
  e14: 0,
2446
1174
  e15: 0
2447
1175
  };
2448
- class Mat4 extends (/* @__PURE__ */ createClass(mat4Props)) {
1176
+ class Mat4 extends createClass(mat4Props) {
2449
1177
  multiply3x3(out, a3) {
2450
1178
  const x2 = a3.x;
2451
1179
  const y4 = a3.y;
@@ -2909,7 +1637,7 @@ const planeProps = {
2909
1637
  normal: Vec3,
2910
1638
  constant: 0
2911
1639
  };
2912
- class Plane extends (/* @__PURE__ */ createClass(planeProps)) {
1640
+ class Plane extends createClass(planeProps) {
2913
1641
  toObject() {
2914
1642
  return {
2915
1643
  normal: this.normal.toObject(),
@@ -2981,7 +1709,7 @@ const segmentProps = {
2981
1709
  pointA: Vec3,
2982
1710
  pointB: Vec3
2983
1711
  };
2984
- class Segment extends (/* @__PURE__ */ createClass(segmentProps)) {
1712
+ class Segment extends createClass(segmentProps) {
2985
1713
  computeCenter(out) {
2986
1714
  out.addVectors(this.pointA, this.pointB);
2987
1715
  out.scaleVector(out, 0.5);
@@ -3004,9 +1732,9 @@ const b$1 = /* @__PURE__ */ Vec3.create();
3004
1732
  const aabbProps = {
3005
1733
  min: Vec3,
3006
1734
  max: Vec3,
3007
- centroid: /* @__PURE__ */ ChildType(Vec3, void 0, true)
1735
+ centroid: ChildType(Vec3, void 0, true)
3008
1736
  };
3009
- class Aabb extends (/* @__PURE__ */ createClass(aabbProps)) {
1737
+ class Aabb extends createClass(aabbProps) {
3010
1738
  computeSupport(out, direction2) {
3011
1739
  out.x = direction2.x < 0 ? this.min.x : this.max.x;
3012
1740
  out.y = direction2.y < 0 ? this.min.y : this.max.y;
@@ -3280,20 +2008,20 @@ const aabbHalfExtents = /* @__PURE__ */ Vec3.create();
3280
2008
  const segmentCenter = /* @__PURE__ */ Vec3.create();
3281
2009
  const segmentHalfExtents = /* @__PURE__ */ Vec3.create();
3282
2010
  const triangleProps$1 = {
3283
- computedBounds: /* @__PURE__ */ ChildType(Aabb, void 0, true),
3284
- normal: /* @__PURE__ */ ChildType(Vec3, void 0, true),
2011
+ computedBounds: ChildType(Aabb, void 0, true),
2012
+ normal: ChildType(Vec3, void 0, true),
3285
2013
  a: Vec3,
3286
2014
  b: Vec3,
3287
2015
  c: Vec3,
3288
- subShapeId: /* @__PURE__ */ NumberType(0, true),
3289
- activeEdges: /* @__PURE__ */ NumberType(0, true)
2016
+ subShapeId: NumberType(0, true),
2017
+ activeEdges: NumberType(0, true)
3290
2018
  // aabb: { struct: Aabb, readOnly: true },
3291
2019
  // activeEdges: { struct: Uint32, optional: true },
3292
2020
  // translation: { struct: Vec3, optional: true },
3293
2021
  };
3294
2022
  const ab$5 = /* @__PURE__ */ Vec3.create();
3295
2023
  const ac$3 = /* @__PURE__ */ Vec3.create();
3296
- let Triangle$1 = class Triangle extends (/* @__PURE__ */ createClass(triangleProps$1)) {
2024
+ let Triangle$1 = class Triangle extends createClass(triangleProps$1) {
3297
2025
  // type: ShapeType.triangle = ShapeType.triangle;
3298
2026
  computeNormal(out) {
3299
2027
  ab$5.subtractVectors(this.b, this.a);
@@ -3368,11 +2096,11 @@ let Triangle$1 = class Triangle extends (/* @__PURE__ */ createClass(trianglePro
3368
2096
  };
3369
2097
  const faceProps = {
3370
2098
  numVertices: 0,
3371
- buffer: /* @__PURE__ */ LazyReferenceListType((() => Vec3))
2099
+ buffer: LazyReferenceListType((() => Vec3))
3372
2100
  };
3373
2101
  const triangle$1 = /* @__PURE__ */ Triangle$1.create();
3374
2102
  const tempVertex = /* @__PURE__ */ Vec3.create();
3375
- class Face extends (/* @__PURE__ */ createClass(faceProps)) {
2103
+ class Face extends createClass(faceProps) {
3376
2104
  clear() {
3377
2105
  this.numVertices = 0;
3378
2106
  }
@@ -3470,35 +2198,35 @@ var ConstraintType = /* @__PURE__ */ ((ConstraintType2) => {
3470
2198
  })(ConstraintType || {});
3471
2199
  const baseConstraintProps = {
3472
2200
  // unless we use require here, this file will be imported after it is needed
3473
- bodyA: /* @__PURE__ */ LazyReferenceType((() => Body)),
3474
- bodyB: /* @__PURE__ */ LazyReferenceType((() => Body)),
3475
- constraintPairNode: /* @__PURE__ */ LazyReferenceType((() => ConstraintPairNode)),
3476
- referenceFrame: /* @__PURE__ */ NumberType(
2201
+ bodyA: LazyReferenceType((() => Body)),
2202
+ bodyB: LazyReferenceType((() => Body)),
2203
+ constraintPairNode: LazyReferenceType((() => ConstraintPairNode)),
2204
+ referenceFrame: NumberType(
3477
2205
  0
3478
2206
  /* local */
3479
2207
  ),
3480
- isEnabled: /* @__PURE__ */ BooleanType(true)
2208
+ isEnabled: BooleanType(true)
3481
2209
  };
3482
2210
  const localToWorldTransformA$1 = /* @__PURE__ */ Mat4.create();
3483
2211
  const point$1 = /* @__PURE__ */ Vec3.create();
3484
2212
  const contactManifoldProps = {
3485
2213
  // meta data
3486
- bodyA: /* @__PURE__ */ LazyReferenceType((() => Body)),
3487
- bodyB: /* @__PURE__ */ LazyReferenceType((() => Body)),
2214
+ bodyA: LazyReferenceType((() => Body)),
2215
+ bodyB: LazyReferenceType((() => Body)),
3488
2216
  subShapeIdA: 0,
3489
2217
  subShapeIdB: 0,
3490
- nextContactManifold: /* @__PURE__ */ LazyReferenceType((() => ContactManifold)),
2218
+ nextContactManifold: LazyReferenceType((() => ContactManifold)),
3491
2219
  // geometric data
3492
2220
  baseTranslation: Vec3,
3493
2221
  firstWorldSpaceNormal: Vec3,
3494
2222
  worldSpaceNormal: Vec3,
3495
2223
  penetrationDepth: 0,
3496
2224
  numContacts: 0,
3497
- contactPointsA: /* @__PURE__ */ ReferenceListType(Vec3),
3498
- contactPointsB: /* @__PURE__ */ ReferenceListType(Vec3),
3499
- lambdas: /* @__PURE__ */ ReferenceListType(Vec3)
2225
+ contactPointsA: ReferenceListType(Vec3),
2226
+ contactPointsB: ReferenceListType(Vec3),
2227
+ lambdas: ReferenceListType(Vec3)
3500
2228
  };
3501
- class ContactManifold extends (/* @__PURE__ */ createClass(contactManifoldProps)) {
2229
+ class ContactManifold extends createClass(contactManifoldProps) {
3502
2230
  get maxContacts() {
3503
2231
  return this.contactPointsA.maxLength;
3504
2232
  }
@@ -3619,13 +2347,13 @@ class ContactManifoldPool {
3619
2347
  }
3620
2348
  }
3621
2349
  const contactPairProps = {
3622
- bodyA: /* @__PURE__ */ LazyReferenceType((() => Body)),
3623
- bodyB: /* @__PURE__ */ LazyReferenceType((() => Body)),
3624
- firstContactManifold: /* @__PURE__ */ ReferenceType(ContactManifold),
2350
+ bodyA: LazyReferenceType((() => Body)),
2351
+ bodyB: LazyReferenceType((() => Body)),
2352
+ firstContactManifold: ReferenceType(ContactManifold),
3625
2353
  translationAB: Vec3,
3626
2354
  rotationAB: Quat
3627
2355
  };
3628
- class ContactPair extends (/* @__PURE__ */ createClass(contactPairProps)) {
2356
+ class ContactPair extends createClass(contactPairProps) {
3629
2357
  get key() {
3630
2358
  return createContactPairKey(this.bodyA, this.bodyB);
3631
2359
  }
@@ -3652,9 +2380,9 @@ const directionalConstraintProps = {
3652
2380
  softness: 0,
3653
2381
  totalLambda: 0
3654
2382
  };
3655
- class DirectionalConstraint extends (/* @__PURE__ */ createClass(
2383
+ class DirectionalConstraint extends createClass(
3656
2384
  directionalConstraintProps
3657
- )) {
2385
+ ) {
3658
2386
  isSpringActive() {
3659
2387
  return this.softness !== 0;
3660
2388
  }
@@ -3791,9 +2519,9 @@ const contactConstraintProps = {
3791
2519
  localPositionA: Vec3,
3792
2520
  localPositionB: Vec3
3793
2521
  };
3794
- class ContactConstraint extends (/* @__PURE__ */ createClass(
2522
+ class ContactConstraint extends createClass(
3795
2523
  contactConstraintProps
3796
- )) {
2524
+ ) {
3797
2525
  getLambda(out, index) {
3798
2526
  out.x = this.normalConstraint.totalLambda;
3799
2527
  out.y = this.tangentConstraint.totalLambda;
@@ -3816,8 +2544,8 @@ class ContactConstraint extends (/* @__PURE__ */ createClass(
3816
2544
  }
3817
2545
  }
3818
2546
  const manifoldConstraintProps = {
3819
- bodyA: /* @__PURE__ */ LazyReferenceType((() => Body)),
3820
- bodyB: /* @__PURE__ */ LazyReferenceType((() => Body)),
2547
+ bodyA: LazyReferenceType((() => Body)),
2548
+ bodyB: LazyReferenceType((() => Body)),
3821
2549
  subShapeIdA: 0,
3822
2550
  subShapeIdB: 0,
3823
2551
  friction: 0,
@@ -3827,12 +2555,12 @@ const manifoldConstraintProps = {
3827
2555
  worldSpaceBitangent: Vec3,
3828
2556
  inverseMassA: 0,
3829
2557
  inverseMassB: 0,
3830
- contactConstraints: /* @__PURE__ */ ReferenceListType(ContactConstraint),
2558
+ contactConstraints: ReferenceListType(ContactConstraint),
3831
2559
  numContacts: 0
3832
2560
  };
3833
- class ManifoldConstraint extends (/* @__PURE__ */ createClass(
2561
+ class ManifoldConstraint extends createClass(
3834
2562
  manifoldConstraintProps
3835
- )) {
2563
+ ) {
3836
2564
  updateTangentDirections() {
3837
2565
  this.worldSpaceTangent.computeNormalizedPerpendicular(this.worldSpaceNormal);
3838
2566
  this.worldSpaceBitangent.crossVectors(this.worldSpaceNormal, this.worldSpaceTangent);
@@ -3939,7 +2667,7 @@ const tempTranslation = /* @__PURE__ */ Vec3.create();
3939
2667
  const tempRotation = /* @__PURE__ */ Quat.create();
3940
2668
  const rotation$2 = /* @__PURE__ */ Mat3.create();
3941
2669
  const inverseMatrix = /* @__PURE__ */ Mat4.create();
3942
- class Isometry extends (/* @__PURE__ */ createClass(isometryProps)) {
2670
+ class Isometry extends createClass(isometryProps) {
3943
2671
  fromRotationAndTranslation(rotation2, translation) {
3944
2672
  if (rotation2) {
3945
2673
  tempRotation.copy(rotation2);
@@ -4549,9 +3277,9 @@ const transformedConvexShapeProps = {
4549
3277
  transform: Isometry
4550
3278
  };
4551
3279
  const direction = /* @__PURE__ */ Vec3.create();
4552
- class TransformedConvexShape extends (/* @__PURE__ */ createClass(
3280
+ class TransformedConvexShape extends createClass(
4553
3281
  transformedConvexShapeProps
4554
- )) {
3282
+ ) {
4555
3283
  constructor() {
4556
3284
  super();
4557
3285
  this.object = null;
@@ -4566,9 +3294,9 @@ class TransformedConvexShape extends (/* @__PURE__ */ createClass(
4566
3294
  const convexRadiusObjectProps = {
4567
3295
  radius: 0
4568
3296
  };
4569
- class ConvexRadiusObject extends (/* @__PURE__ */ createClass(
3297
+ class ConvexRadiusObject extends createClass(
4570
3298
  convexRadiusObjectProps
4571
- )) {
3299
+ ) {
4572
3300
  constructor() {
4573
3301
  super();
4574
3302
  this.convexShape = null;
@@ -4618,7 +3346,7 @@ var ShapeType = /* @__PURE__ */ ((ShapeType2) => {
4618
3346
  const sphereNoConvexProps = {
4619
3347
  radius: 0
4620
3348
  };
4621
- class SphereNoConvex extends (/* @__PURE__ */ createClass(sphereNoConvexProps)) {
3349
+ class SphereNoConvex extends createClass(sphereNoConvexProps) {
4622
3350
  getConvexRadius() {
4623
3351
  return this.radius;
4624
3352
  }
@@ -4629,7 +3357,7 @@ class SphereNoConvex extends (/* @__PURE__ */ createClass(sphereNoConvexProps))
4629
3357
  const sphereWithConvexProps = {
4630
3358
  radius: 0
4631
3359
  };
4632
- class SphereWithConvex extends (/* @__PURE__ */ createClass(sphereWithConvexProps)) {
3360
+ class SphereWithConvex extends createClass(sphereWithConvexProps) {
4633
3361
  getConvexRadius() {
4634
3362
  return 0;
4635
3363
  }
@@ -4643,18 +3371,18 @@ class SphereWithConvex extends (/* @__PURE__ */ createClass(sphereWithConvexProp
4643
3371
  }
4644
3372
  }
4645
3373
  const sphereProps = {
4646
- computedCenterOfMass: /* @__PURE__ */ ChildType(Vec3, void 0, true),
4647
- computedVolume: /* @__PURE__ */ NumberType(0, true),
4648
- computedAabb: /* @__PURE__ */ ChildType(Aabb, void 0, true),
3374
+ computedCenterOfMass: ChildType(Vec3, void 0, true),
3375
+ computedVolume: NumberType(0, true),
3376
+ computedAabb: ChildType(Aabb, void 0, true),
4649
3377
  radius: 1,
4650
- copyForDiff: /* @__PURE__ */ LazyReferenceType((() => Sphere)),
4651
- sphereNoConvex: /* @__PURE__ */ ChildType(SphereNoConvex, void 0, true),
4652
- sphereWithConvex: /* @__PURE__ */ ChildType(SphereWithConvex, void 0, true)
3378
+ copyForDiff: LazyReferenceType((() => Sphere)),
3379
+ sphereNoConvex: ChildType(SphereNoConvex, void 0, true),
3380
+ sphereWithConvex: ChildType(SphereWithConvex, void 0, true)
4653
3381
  };
4654
3382
  const afterConstructorCode$a = `
4655
3383
  this.world = null;
4656
3384
  `;
4657
- class Sphere extends (/* @__PURE__ */ createClass(sphereProps, { afterConstructorCode: afterConstructorCode$a })) {
3385
+ class Sphere extends createClass(sphereProps, { afterConstructorCode: afterConstructorCode$a }) {
4658
3386
  constructor() {
4659
3387
  super(...arguments);
4660
3388
  this.type = ShapeType.sphere;
@@ -4753,9 +3481,9 @@ const defaultConvexRadius = 0.05;
4753
3481
  const boxSupportProps = {
4754
3482
  convexRadius: 0,
4755
3483
  // TODO: cannot used undefined default for this, possibly due to it being used as a deeply nested prop
4756
- computedAabb: /* @__PURE__ */ ChildType(Aabb, {}, true)
3484
+ computedAabb: ChildType(Aabb, {}, true)
4757
3485
  };
4758
- class BoxSupport extends (/* @__PURE__ */ createClass(boxSupportProps)) {
3486
+ class BoxSupport extends createClass(boxSupportProps) {
4759
3487
  computeSupport(out, direction2) {
4760
3488
  this.computedAabb.computeSupport(out, direction2);
4761
3489
  }
@@ -4764,20 +3492,20 @@ class BoxSupport extends (/* @__PURE__ */ createClass(boxSupportProps)) {
4764
3492
  }
4765
3493
  }
4766
3494
  const boxProps = {
4767
- computedCenterOfMass: /* @__PURE__ */ ChildType(Vec3, void 0, true),
4768
- computedVolume: /* @__PURE__ */ NumberType(0, true),
4769
- computedAabb: /* @__PURE__ */ ChildType(Aabb, void 0, true),
3495
+ computedCenterOfMass: ChildType(Vec3, void 0, true),
3496
+ computedVolume: NumberType(0, true),
3497
+ computedAabb: ChildType(Aabb, void 0, true),
4770
3498
  convexRadius: 0,
4771
3499
  width: 0,
4772
3500
  height: 0,
4773
3501
  depth: 0,
4774
- boxSupport: /* @__PURE__ */ ChildType(BoxSupport, void 0, true),
4775
- copyForDiff: /* @__PURE__ */ LazyReferenceType((() => Box))
3502
+ boxSupport: ChildType(BoxSupport, void 0, true),
3503
+ copyForDiff: LazyReferenceType((() => Box))
4776
3504
  };
4777
3505
  const afterConstructorCode$9 = `
4778
3506
  this.world = null;
4779
3507
  `;
4780
- class Box extends (/* @__PURE__ */ createClass(boxProps, { afterConstructorCode: afterConstructorCode$9 })) {
3508
+ class Box extends createClass(boxProps, { afterConstructorCode: afterConstructorCode$9 }) {
4781
3509
  constructor() {
4782
3510
  super(...arguments);
4783
3511
  this.type = ShapeType.box;
@@ -4895,22 +3623,22 @@ function updateShape$6(shape) {
4895
3623
  updateLocalBounds$6(shape);
4896
3624
  }
4897
3625
  const bodyPairNodeProps = {
4898
- bodyA: /* @__PURE__ */ LazyReferenceType((() => Body)),
4899
- bodyB: /* @__PURE__ */ LazyReferenceType((() => Body)),
4900
- edgeA: /* @__PURE__ */ LazyReferenceType((() => BodyPairEdge)),
4901
- edgeB: /* @__PURE__ */ LazyReferenceType((() => BodyPairEdge))
3626
+ bodyA: LazyReferenceType((() => Body)),
3627
+ bodyB: LazyReferenceType((() => Body)),
3628
+ edgeA: LazyReferenceType((() => BodyPairEdge)),
3629
+ edgeB: LazyReferenceType((() => BodyPairEdge))
4902
3630
  };
4903
- class BodyPairNode extends (/* @__PURE__ */ createClass(bodyPairNodeProps)) {
3631
+ class BodyPairNode extends createClass(bodyPairNodeProps) {
4904
3632
  containsStaticBody() {
4905
3633
  return this.bodyA.type === BodyType.static || this.bodyB.type === BodyType.static;
4906
3634
  }
4907
3635
  }
4908
3636
  const bodyPairEdgeProps = {
4909
- node: /* @__PURE__ */ LazyReferenceType((() => BodyPairNode)),
4910
- next: /* @__PURE__ */ LazyReferenceType((() => BodyPairEdge)),
4911
- prev: /* @__PURE__ */ LazyReferenceType((() => BodyPairEdge))
3637
+ node: LazyReferenceType((() => BodyPairNode)),
3638
+ next: LazyReferenceType((() => BodyPairEdge)),
3639
+ prev: LazyReferenceType((() => BodyPairEdge))
4912
3640
  };
4913
- class BodyPairEdge extends (/* @__PURE__ */ createClass(bodyPairEdgeProps)) {
3641
+ class BodyPairEdge extends createClass(bodyPairEdgeProps) {
4914
3642
  }
4915
3643
  class BodyPairsModule {
4916
3644
  constructor(bodyPool, nodesPool, edgesPool) {
@@ -5154,7 +3882,7 @@ const rayProps = {
5154
3882
  direction: Vec3,
5155
3883
  length: 0
5156
3884
  };
5157
- class Ray extends (/* @__PURE__ */ createClass(rayProps)) {
3885
+ class Ray extends createClass(rayProps) {
5158
3886
  intersectsAabb(aabb) {
5159
3887
  return aabb.intersectsRay(this);
5160
3888
  }
@@ -5270,14 +3998,14 @@ const halfExtents$2 = /* @__PURE__ */ Vec3.create();
5270
3998
  const nodeBounds$1 = /* @__PURE__ */ Aabb.create();
5271
3999
  const bodyBounds$1 = /* @__PURE__ */ Aabb.create();
5272
4000
  const bvhNodeProps$1 = {
5273
- parent: /* @__PURE__ */ LazyReferenceType((() => BvhNode)),
5274
- left: /* @__PURE__ */ LazyReferenceType((() => BvhNode)),
5275
- right: /* @__PURE__ */ LazyReferenceType((() => BvhNode)),
5276
- computedBounds: /* @__PURE__ */ ChildType(Aabb, void 0, true),
4001
+ parent: LazyReferenceType((() => BvhNode)),
4002
+ left: LazyReferenceType((() => BvhNode)),
4003
+ right: LazyReferenceType((() => BvhNode)),
4004
+ computedBounds: ChildType(Aabb, void 0, true),
5277
4005
  height: 0,
5278
- objects: /* @__PURE__ */ LazyReferenceListType((() => Body))
4006
+ objects: LazyReferenceListType((() => Body))
5279
4007
  };
5280
- class BvhNode extends (/* @__PURE__ */ createClass(bvhNodeProps$1)) {
4008
+ class BvhNode extends createClass(bvhNodeProps$1) {
5281
4009
  // objects: Body[] = [];
5282
4010
  isLeaf() {
5283
4011
  return this.left === null && this.right === null;
@@ -5793,7 +4521,7 @@ const basicTransformProps = {
5793
4521
  rotation: Quat,
5794
4522
  scale: 1
5795
4523
  };
5796
- class BasicTransform extends (/* @__PURE__ */ createClass(basicTransformProps)) {
4524
+ class BasicTransform extends createClass(basicTransformProps) {
5797
4525
  equals(other, tolerance = 1e-6) {
5798
4526
  return this.position.equals(other.position, tolerance) && this.rotation.equals(other.rotation, tolerance) && Math.abs(this.scale - other.scale) < tolerance;
5799
4527
  }
@@ -5801,7 +4529,7 @@ class BasicTransform extends (/* @__PURE__ */ createClass(basicTransformProps))
5801
4529
  const numberValueProps = {
5802
4530
  value: 0
5803
4531
  };
5804
- class NumberValue extends (/* @__PURE__ */ createClass(numberValueProps)) {
4532
+ class NumberValue extends createClass(numberValueProps) {
5805
4533
  toObject() {
5806
4534
  return {
5807
4535
  value: this.value
@@ -5868,7 +4596,7 @@ const convexHullPointProps = {
5868
4596
  numFaces: 0,
5869
4597
  faces: Vec3
5870
4598
  };
5871
- class ConvexHullPoint extends (/* @__PURE__ */ createClass(convexHullPointProps)) {
4599
+ class ConvexHullPoint extends createClass(convexHullPointProps) {
5872
4600
  toObject() {
5873
4601
  return {
5874
4602
  position: this.position.toObject(),
@@ -5881,7 +4609,7 @@ const convexHullFaceProps = {
5881
4609
  firstVertex: 0,
5882
4610
  numVertices: 0
5883
4611
  };
5884
- class ConvexHullFace extends (/* @__PURE__ */ createClass(convexHullFaceProps)) {
4612
+ class ConvexHullFace extends createClass(convexHullFaceProps) {
5885
4613
  toObject() {
5886
4614
  return {
5887
4615
  firstVertex: this.firstVertex,
@@ -5890,24 +4618,24 @@ class ConvexHullFace extends (/* @__PURE__ */ createClass(convexHullFaceProps))
5890
4618
  }
5891
4619
  }
5892
4620
  const convexHullProps = {
5893
- computedCenterOfMass: /* @__PURE__ */ ChildType(Vec3, void 0, true),
5894
- computedVolume: /* @__PURE__ */ NumberType(0, true),
5895
- computedAabb: /* @__PURE__ */ ChildType(Aabb, void 0, true),
4621
+ computedCenterOfMass: ChildType(Vec3, void 0, true),
4622
+ computedVolume: NumberType(0, true),
4623
+ computedAabb: ChildType(Aabb, void 0, true),
5896
4624
  convexRadius: 0,
5897
- innerRadius: /* @__PURE__ */ NumberType(0, true),
5898
- inertia: /* @__PURE__ */ ChildType(Mat3, void 0, true),
5899
- points: /* @__PURE__ */ ReferenceListType(ConvexHullPoint),
4625
+ innerRadius: NumberType(0, true),
4626
+ inertia: ChildType(Mat3, void 0, true),
4627
+ points: ReferenceListType(ConvexHullPoint),
5900
4628
  // { array: Float64Array(b), itemMaxCount: b / 7, itemSize: 7 } [ConvexHullPoint], points on the convex hull surface
5901
- faces: /* @__PURE__ */ ReferenceListType(ConvexHullFace),
4629
+ faces: ReferenceListType(ConvexHullFace),
5902
4630
  // { array: Float64Array(c), itemMaxCount: c / 2, itemSize: 2 } [ConvexHullFace], faces of the convex hull surface
5903
- planes: /* @__PURE__ */ ReferenceListType(Plane),
4631
+ planes: ReferenceListType(Plane),
5904
4632
  // { array: Float64Array(d), itemMaxCount: d / 4, itemSize: 4 } [Plane], planes of the convex hull surface
5905
- vertexIdx: /* @__PURE__ */ ReferenceListType(NumberValue),
4633
+ vertexIdx: ReferenceListType(NumberValue),
5906
4634
  // { array: Float64Array(e), itemMaxCount: e, itemSize: 1 } [Uint32], vertex indices for each of the faces
5907
- shapeNoConvexPoints: /* @__PURE__ */ ReferenceListType(Vec3),
4635
+ shapeNoConvexPoints: ReferenceListType(Vec3),
5908
4636
  // { array: Float64Array(f), itemMaxCount: f / 3, itemSize: 3 } [Vec3], transformed points used by ConvexHullNoConvex
5909
- translation: /* @__PURE__ */ ChildType(Vec3, { x: 0, y: 0, z: 0 }),
5910
- copyForDiff: /* @__PURE__ */ LazyReferenceType((() => ConvexHull))
4637
+ translation: ChildType(Vec3, { x: 0, y: 0, z: 0 }),
4638
+ copyForDiff: LazyReferenceType((() => ConvexHull))
5911
4639
  };
5912
4640
  const afterConstructorCode$8 = `
5913
4641
  this.world = null;
@@ -5915,7 +4643,7 @@ this.shapeNoConvex = null;
5915
4643
  this.shapeWithConvex = null;
5916
4644
  this.type = ${ShapeType.convexHull};
5917
4645
  `;
5918
- class ConvexHull extends (/* @__PURE__ */ createClass(convexHullProps, { afterConstructorCode: afterConstructorCode$8 })) {
4646
+ class ConvexHull extends createClass(convexHullProps, { afterConstructorCode: afterConstructorCode$8 }) {
5919
4647
  computeSupportShape(inMode, inScale) {
5920
4648
  if (this.convexRadius === 0) {
5921
4649
  this.shapeWithConvex.shape = this;
@@ -6105,9 +4833,9 @@ const cylinderSupportShapeProps = {
6105
4833
  radius: 0,
6106
4834
  convexRadius: 0
6107
4835
  };
6108
- class CylinderSupportShape extends (/* @__PURE__ */ createClass(
4836
+ class CylinderSupportShape extends createClass(
6109
4837
  cylinderSupportShapeProps
6110
- )) {
4838
+ ) {
6111
4839
  getConvexRadius() {
6112
4840
  return this.convexRadius;
6113
4841
  }
@@ -6131,20 +4859,20 @@ class CylinderSupportShape extends (/* @__PURE__ */ createClass(
6131
4859
  }
6132
4860
  }
6133
4861
  const cylinderProps = {
6134
- computedCenterOfMass: /* @__PURE__ */ ChildType(Vec3, void 0, true),
6135
- computedVolume: /* @__PURE__ */ NumberType(0, true),
6136
- computedAabb: /* @__PURE__ */ ChildType(Aabb, void 0, true),
4862
+ computedCenterOfMass: ChildType(Vec3, void 0, true),
4863
+ computedVolume: NumberType(0, true),
4864
+ computedAabb: ChildType(Aabb, void 0, true),
6137
4865
  radius: 0,
6138
4866
  halfHeight: 0,
6139
4867
  convexRadius: 0,
6140
- translation: /* @__PURE__ */ ChildType(Vec3, void 0, true),
6141
- supportShape: /* @__PURE__ */ ChildType(CylinderSupportShape, void 0, true),
6142
- copyForDiff: /* @__PURE__ */ LazyReferenceType((() => Cylinder))
4868
+ translation: ChildType(Vec3, void 0, true),
4869
+ supportShape: ChildType(CylinderSupportShape, void 0, true),
4870
+ copyForDiff: LazyReferenceType((() => Cylinder))
6143
4871
  };
6144
4872
  const afterConstructorCode$7 = `
6145
4873
  this.world = null;
6146
4874
  `;
6147
- class Cylinder extends (/* @__PURE__ */ createClass(cylinderProps, { afterConstructorCode: afterConstructorCode$7 })) {
4875
+ class Cylinder extends createClass(cylinderProps, { afterConstructorCode: afterConstructorCode$7 }) {
6148
4876
  constructor() {
6149
4877
  super(...arguments);
6150
4878
  this.type = ShapeType.cylinder;
@@ -6304,7 +5032,7 @@ const capsuleNoConvexProps = {
6304
5032
  halfHeightOfCylinder: Vec3,
6305
5033
  convexRadius: 0
6306
5034
  };
6307
- class CapsuleNoConvex extends (/* @__PURE__ */ createClass(capsuleNoConvexProps)) {
5035
+ class CapsuleNoConvex extends createClass(capsuleNoConvexProps) {
6308
5036
  computeSupport(out, direction2) {
6309
5037
  if (direction2.y > 0) {
6310
5038
  out.copy(this.halfHeightOfCylinder);
@@ -6323,9 +5051,9 @@ const capsuleWithConvexProps = {
6323
5051
  halfHeightOfCylinder: Vec3,
6324
5052
  radius: 0
6325
5053
  };
6326
- class CapsuleWithConvex extends (/* @__PURE__ */ createClass(
5054
+ class CapsuleWithConvex extends createClass(
6327
5055
  capsuleWithConvexProps
6328
- )) {
5056
+ ) {
6329
5057
  computeSupport(out, direction2) {
6330
5058
  const len = direction2.length();
6331
5059
  if (len > 0) {
@@ -6347,19 +5075,19 @@ class CapsuleWithConvex extends (/* @__PURE__ */ createClass(
6347
5075
  }
6348
5076
  }
6349
5077
  const capsuleProps = {
6350
- computedCenterOfMass: /* @__PURE__ */ ChildType(Vec3, void 0, true),
6351
- computedVolume: /* @__PURE__ */ NumberType(0, true),
6352
- computedAabb: /* @__PURE__ */ ChildType(Aabb, void 0, true),
5078
+ computedCenterOfMass: ChildType(Vec3, void 0, true),
5079
+ computedVolume: NumberType(0, true),
5080
+ computedAabb: ChildType(Aabb, void 0, true),
6353
5081
  radius: 0,
6354
5082
  height: 0,
6355
- copyForDiff: /* @__PURE__ */ LazyReferenceType((() => Capsule)),
6356
- capsuleNoConvex: /* @__PURE__ */ ChildType(CapsuleNoConvex, void 0, true),
6357
- capsuleWithConvex: /* @__PURE__ */ ChildType(CapsuleWithConvex, void 0, true)
5083
+ copyForDiff: LazyReferenceType((() => Capsule)),
5084
+ capsuleNoConvex: ChildType(CapsuleNoConvex, void 0, true),
5085
+ capsuleWithConvex: ChildType(CapsuleWithConvex, void 0, true)
6358
5086
  };
6359
5087
  const afterConstructorCode$6 = `
6360
5088
  this.world = null;
6361
5089
  `;
6362
- class Capsule extends (/* @__PURE__ */ createClass(capsuleProps, { afterConstructorCode: afterConstructorCode$6 })) {
5090
+ class Capsule extends createClass(capsuleProps, { afterConstructorCode: afterConstructorCode$6 }) {
6363
5091
  constructor() {
6364
5092
  super(...arguments);
6365
5093
  this.type = ShapeType.capsule;
@@ -6505,25 +5233,25 @@ function updateShape$3(shape) {
6505
5233
  updateLocalBounds$3(shape);
6506
5234
  }
6507
5235
  const transformedShapeProps = {
6508
- shapeType: /* @__PURE__ */ NumberType(ShapeType.box),
5236
+ shapeType: NumberType(ShapeType.box),
6509
5237
  // we need to do "as 'shape' ..." otherwise they are just 'string' and not the actual specific keys
6510
- ["shape" + ShapeType.box]: /* @__PURE__ */ ReferenceType(Box, void 0, true),
6511
- ["shape" + ShapeType.capsule]: /* @__PURE__ */ ReferenceType(Capsule, void 0, true),
5238
+ ["shape" + ShapeType.box]: ReferenceType(Box, void 0, true),
5239
+ ["shape" + ShapeType.capsule]: ReferenceType(Capsule, void 0, true),
6512
5240
  // compoundShape not supported
6513
- ["shape" + ShapeType.convexHull]: /* @__PURE__ */ ReferenceType(ConvexHull, void 0, true),
6514
- ["shape" + ShapeType.cylinder]: /* @__PURE__ */ ReferenceType(Cylinder, void 0, true),
5241
+ ["shape" + ShapeType.convexHull]: ReferenceType(ConvexHull, void 0, true),
5242
+ ["shape" + ShapeType.cylinder]: ReferenceType(Cylinder, void 0, true),
6515
5243
  // heightMap not supported
6516
- ["shape" + ShapeType.sphere]: /* @__PURE__ */ ReferenceType(Sphere, void 0, true),
5244
+ ["shape" + ShapeType.sphere]: ReferenceType(Sphere, void 0, true),
6517
5245
  // triangleMesh not supported
6518
5246
  transform: BasicTransform
6519
5247
  };
6520
5248
  const afterConstructorCode$5 = `
6521
5249
  this.world = null;
6522
5250
  `;
6523
- class TransformedShape extends (/* @__PURE__ */ createClass(
5251
+ class TransformedShape extends createClass(
6524
5252
  transformedShapeProps,
6525
5253
  { afterConstructorCode: afterConstructorCode$5 }
6526
- )) {
5254
+ ) {
6527
5255
  get shape() {
6528
5256
  return this["shape" + this.shapeType];
6529
5257
  }
@@ -6546,17 +5274,17 @@ const transformSubshapeToCompound = /* @__PURE__ */ Isometry.create();
6546
5274
  const subShapeDirection = /* @__PURE__ */ Vec3.create();
6547
5275
  const subShapeToWorld = /* @__PURE__ */ Isometry.create();
6548
5276
  const compoundShapeProps = {
6549
- computedCenterOfMass: /* @__PURE__ */ ChildType(Vec3, {}, true),
6550
- computedVolume: /* @__PURE__ */ NumberType(0, true),
6551
- computedAabb: /* @__PURE__ */ ChildType(Aabb, {}, true),
6552
- copyForDiff: /* @__PURE__ */ LazyReferenceType((() => CompoundShape)),
6553
- shapes: /* @__PURE__ */ ReferenceListType(TransformedShape)
5277
+ computedCenterOfMass: ChildType(Vec3, {}, true),
5278
+ computedVolume: NumberType(0, true),
5279
+ computedAabb: ChildType(Aabb, {}, true),
5280
+ copyForDiff: LazyReferenceType((() => CompoundShape)),
5281
+ shapes: ReferenceListType(TransformedShape)
6554
5282
  };
6555
5283
  const afterConstructorCode$4 = `
6556
5284
  this.world = null;
6557
5285
  `;
6558
5286
  const tempTransform = /* @__PURE__ */ BasicTransform.create();
6559
- class CompoundShape extends (/* @__PURE__ */ createClass(compoundShapeProps, { afterConstructorCode: afterConstructorCode$4 })) {
5287
+ class CompoundShape extends createClass(compoundShapeProps, { afterConstructorCode: afterConstructorCode$4 }) {
6560
5288
  constructor() {
6561
5289
  super(...arguments);
6562
5290
  this.type = ShapeType.compoundShape;
@@ -6761,10 +5489,10 @@ const scale$1 = /* @__PURE__ */ Vec3.create();
6761
5489
  const blockAabb = /* @__PURE__ */ Aabb.create();
6762
5490
  const normal$1 = /* @__PURE__ */ Vec3.create();
6763
5491
  const heightMapProps = {
6764
- computedCenterOfMass: /* @__PURE__ */ ChildType(Vec3, void 0, true),
6765
- computedVolume: /* @__PURE__ */ NumberType(0, true),
6766
- computedAabb: /* @__PURE__ */ ChildType(Aabb, {}, true),
6767
- copyForDiff: /* @__PURE__ */ LazyReferenceType((() => HeightMap)),
5492
+ computedCenterOfMass: ChildType(Vec3, void 0, true),
5493
+ computedVolume: NumberType(0, true),
5494
+ computedAabb: ChildType(Aabb, {}, true),
5495
+ copyForDiff: LazyReferenceType((() => HeightMap)),
6768
5496
  subdivisionsCount: 0,
6769
5497
  scale: Vec3,
6770
5498
  positionOffset: Vec3
@@ -6784,7 +5512,7 @@ this.activeEdges = [];
6784
5512
  this.stack = [];
6785
5513
  this.children = [0, 0, 0, 0];
6786
5514
  `;
6787
- class HeightMap extends (/* @__PURE__ */ createClass(heightMapProps, { afterConstructorCode: afterConstructorCode$3 })) {
5515
+ class HeightMap extends createClass(heightMapProps, { afterConstructorCode: afterConstructorCode$3 }) {
6788
5516
  constructor() {
6789
5517
  super(...arguments);
6790
5518
  this.type = ShapeType.heightMap;
@@ -7016,14 +5744,14 @@ function updateShape$1(shape) {
7016
5744
  updateLocalBounds$1(shape);
7017
5745
  }
7018
5746
  const bvhNodeProps = {
7019
- parent: /* @__PURE__ */ LazyReferenceType((() => TriangleMeshBvhNode)),
7020
- left: /* @__PURE__ */ LazyReferenceType((() => TriangleMeshBvhNode)),
7021
- right: /* @__PURE__ */ LazyReferenceType((() => TriangleMeshBvhNode)),
7022
- computedBounds: /* @__PURE__ */ ChildType(Aabb, void 0, true),
7023
- depth: /* @__PURE__ */ NumberType(0, true),
7024
- objects: /* @__PURE__ */ LazyReferenceListType((() => Triangle$1))
5747
+ parent: LazyReferenceType((() => TriangleMeshBvhNode)),
5748
+ left: LazyReferenceType((() => TriangleMeshBvhNode)),
5749
+ right: LazyReferenceType((() => TriangleMeshBvhNode)),
5750
+ computedBounds: ChildType(Aabb, void 0, true),
5751
+ depth: NumberType(0, true),
5752
+ objects: LazyReferenceListType((() => Triangle$1))
7025
5753
  };
7026
- class TriangleMeshBvhNode extends (/* @__PURE__ */ createClass(bvhNodeProps)) {
5754
+ class TriangleMeshBvhNode extends createClass(bvhNodeProps) {
7027
5755
  /**
7028
5756
  * if bvh node is an internal node, this will be an empty list
7029
5757
  * if bvh node is a leaf node, this will contain refs to the objects in the leaf
@@ -7079,11 +5807,11 @@ function splitObjects(objects) {
7079
5807
  return [leftObjects, rightObjects];
7080
5808
  }
7081
5809
  const triangleMeshBvhTreeProps = {
7082
- nodes: /* @__PURE__ */ ReferenceListType(TriangleMeshBvhNode)
5810
+ nodes: ReferenceListType(TriangleMeshBvhNode)
7083
5811
  };
7084
- class TriangleMeshBvhTree extends (/* @__PURE__ */ createClass(
5812
+ class TriangleMeshBvhTree extends createClass(
7085
5813
  triangleMeshBvhTreeProps
7086
- )) {
5814
+ ) {
7087
5815
  constructor() {
7088
5816
  super(...arguments);
7089
5817
  this.intersectStack = [];
@@ -7279,21 +6007,21 @@ const nodeBounds = /* @__PURE__ */ Aabb.create();
7279
6007
  const bodyBounds = /* @__PURE__ */ Aabb.create();
7280
6008
  const isometry$2 = /* @__PURE__ */ Isometry.create();
7281
6009
  const triangleMeshProps = {
7282
- computedCenterOfMass: /* @__PURE__ */ ChildType(Vec3, void 0, true),
7283
- computedVolume: /* @__PURE__ */ NumberType(0, true),
7284
- computedAabb: /* @__PURE__ */ ChildType(Aabb, void 0, true),
6010
+ computedCenterOfMass: ChildType(Vec3, void 0, true),
6011
+ computedVolume: NumberType(0, true),
6012
+ computedAabb: ChildType(Aabb, void 0, true),
7285
6013
  translation: Vec3,
7286
- inertia: /* @__PURE__ */ ChildType(Mat3, void 0, true),
7287
- vertexPositions: /* @__PURE__ */ ReferenceListType(Vec3),
7288
- faceIndices: /* @__PURE__ */ ReferenceListType(Vec3),
7289
- triangles: /* @__PURE__ */ ReferenceListType(Triangle$1),
7290
- copyForDiff: /* @__PURE__ */ LazyReferenceType((() => TriangleMesh)),
7291
- bvh: /* @__PURE__ */ LazyReferenceType((() => TriangleMeshBvhTree))
6014
+ inertia: ChildType(Mat3, void 0, true),
6015
+ vertexPositions: ReferenceListType(Vec3),
6016
+ faceIndices: ReferenceListType(Vec3),
6017
+ triangles: ReferenceListType(Triangle$1),
6018
+ copyForDiff: LazyReferenceType((() => TriangleMesh)),
6019
+ bvh: LazyReferenceType((() => TriangleMeshBvhTree))
7292
6020
  };
7293
6021
  const afterConstructorCode$2 = `
7294
6022
  this.world = null;
7295
6023
  `;
7296
- class TriangleMesh extends (/* @__PURE__ */ createClass(triangleMeshProps, { afterConstructorCode: afterConstructorCode$2 })) {
6024
+ class TriangleMesh extends createClass(triangleMeshProps, { afterConstructorCode: afterConstructorCode$2 }) {
7297
6025
  constructor() {
7298
6026
  super(...arguments);
7299
6027
  this.type = ShapeType.triangleMesh;
@@ -7395,26 +6123,26 @@ const constraintOptionsProps = {
7395
6123
  */
7396
6124
  strength: 1
7397
6125
  };
7398
- class ConstraintOptions extends (/* @__PURE__ */ createClass(
6126
+ class ConstraintOptions extends createClass(
7399
6127
  constraintOptionsProps
7400
- )) {
6128
+ ) {
7401
6129
  }
7402
6130
  const pointConstraintComponentProps = {
7403
- bodyA: /* @__PURE__ */ LazyReferenceType((() => Body)),
7404
- bodyB: /* @__PURE__ */ LazyReferenceType((() => Body)),
7405
- options: /* @__PURE__ */ ChildType(ConstraintOptions, {
6131
+ bodyA: LazyReferenceType((() => Body)),
6132
+ bodyB: LazyReferenceType((() => Body)),
6133
+ options: ChildType(ConstraintOptions, {
7406
6134
  positionBaumgarte: 0.8,
7407
6135
  velocityBaumgarte: 1,
7408
6136
  strength: 1
7409
6137
  }),
7410
- momentArmA: /* @__PURE__ */ ChildType(Vec3, void 0, true),
7411
- momentArmB: /* @__PURE__ */ ChildType(Vec3, void 0, true),
7412
- effectiveMass: /* @__PURE__ */ ChildType(Mat3, void 0, true),
7413
- effectiveInverseInertiaA: /* @__PURE__ */ ChildType(Mat3, void 0, true),
7414
- effectiveInverseInertiaB: /* @__PURE__ */ ChildType(Mat3, void 0, true),
7415
- totalLambda: /* @__PURE__ */ ChildType(Vec3, void 0, true)
6138
+ momentArmA: ChildType(Vec3, void 0, true),
6139
+ momentArmB: ChildType(Vec3, void 0, true),
6140
+ effectiveMass: ChildType(Mat3, void 0, true),
6141
+ effectiveInverseInertiaA: ChildType(Mat3, void 0, true),
6142
+ effectiveInverseInertiaB: ChildType(Mat3, void 0, true),
6143
+ totalLambda: ChildType(Vec3, void 0, true)
7416
6144
  };
7417
- class PointConstraintComponent extends (/* @__PURE__ */ createClass(pointConstraintComponentProps)) {
6145
+ class PointConstraintComponent extends createClass(pointConstraintComponentProps) {
7418
6146
  deactivate() {
7419
6147
  this.effectiveMass.zero();
7420
6148
  this.totalLambda.zero();
@@ -7527,11 +6255,11 @@ const pointConstraintProps = {
7527
6255
  ...baseConstraintProps,
7528
6256
  positionA: Vec3,
7529
6257
  positionB: Vec3,
7530
- localPositionA: /* @__PURE__ */ ChildType(Vec3, void 0, true),
7531
- localPositionB: /* @__PURE__ */ ChildType(Vec3, void 0, true),
6258
+ localPositionA: ChildType(Vec3, void 0, true),
6259
+ localPositionB: ChildType(Vec3, void 0, true),
7532
6260
  translationComponent: PointConstraintComponent
7533
6261
  };
7534
- class PointConstraint extends (/* @__PURE__ */ createClass(pointConstraintProps)) {
6262
+ class PointConstraint extends createClass(pointConstraintProps) {
7535
6263
  constructor() {
7536
6264
  super(...arguments);
7537
6265
  this.type = ConstraintType.pointConstraint;
@@ -7601,21 +6329,21 @@ PointConstraint.create = function() {
7601
6329
  return constraint;
7602
6330
  };
7603
6331
  const rotationEulerComponentProps = {
7604
- bodyA: /* @__PURE__ */ LazyReferenceType((() => Body)),
7605
- bodyB: /* @__PURE__ */ LazyReferenceType((() => Body)),
7606
- options: /* @__PURE__ */ ChildType(ConstraintOptions, {
6332
+ bodyA: LazyReferenceType((() => Body)),
6333
+ bodyB: LazyReferenceType((() => Body)),
6334
+ options: ChildType(ConstraintOptions, {
7607
6335
  positionBaumgarte: 0.8,
7608
6336
  velocityBaumgarte: 1,
7609
6337
  strength: 1
7610
6338
  }),
7611
- mInvI1: /* @__PURE__ */ ChildType(Mat3, void 0, true),
7612
- mInvI2: /* @__PURE__ */ ChildType(Mat3, void 0, true),
7613
- effectiveMassRotationComponent: /* @__PURE__ */ ChildType(Mat3, void 0, true),
7614
- totalLambdaRotationComponent: /* @__PURE__ */ ChildType(Vec3, void 0, true)
6339
+ mInvI1: ChildType(Mat3, void 0, true),
6340
+ mInvI2: ChildType(Mat3, void 0, true),
6341
+ effectiveMassRotationComponent: ChildType(Mat3, void 0, true),
6342
+ totalLambdaRotationComponent: ChildType(Vec3, void 0, true)
7615
6343
  };
7616
- class RotationEulerComponent extends (/* @__PURE__ */ createClass(
6344
+ class RotationEulerComponent extends createClass(
7617
6345
  rotationEulerComponentProps
7618
- )) {
6346
+ ) {
7619
6347
  deactivate() {
7620
6348
  this.effectiveMassRotationComponent.zero();
7621
6349
  this.totalLambdaRotationComponent.zero();
@@ -7709,25 +6437,25 @@ const transformWorldToLocalB$1 = /* @__PURE__ */ Mat4.create();
7709
6437
  const inverseRotationB = /* @__PURE__ */ Quat.create();
7710
6438
  const fixedConstraintProps = {
7711
6439
  ...baseConstraintProps,
7712
- positionA: /* @__PURE__ */ ChildType(Vec3, { x: 0, y: 0, z: 0 }),
7713
- positionB: /* @__PURE__ */ ChildType(Vec3, { x: 0, y: 0, z: 0 }),
7714
- axisXA: /* @__PURE__ */ ChildType(Vec3, { x: 1, y: 0, z: 0 }),
7715
- axisXB: /* @__PURE__ */ ChildType(Vec3, { x: 1, y: 0, z: 0 }),
7716
- axisYA: /* @__PURE__ */ ChildType(Vec3, { x: 0, y: 1, z: 0 }),
7717
- axisYB: /* @__PURE__ */ ChildType(Vec3, { x: 0, y: 1, z: 0 }),
7718
- localPositionA: /* @__PURE__ */ ChildType(Vec3, void 0, true),
7719
- localPositionB: /* @__PURE__ */ ChildType(Vec3, void 0, true),
7720
- localAxisXA: /* @__PURE__ */ ChildType(Vec3, void 0, true),
7721
- localAxisXB: /* @__PURE__ */ ChildType(Vec3, void 0, true),
7722
- localAxisYA: /* @__PURE__ */ ChildType(Vec3, void 0, true),
7723
- localAxisYB: /* @__PURE__ */ ChildType(Vec3, void 0, true),
7724
- localAxisZA: /* @__PURE__ */ ChildType(Vec3, void 0, true),
7725
- localAxisZB: /* @__PURE__ */ ChildType(Vec3, void 0, true),
7726
- inverseInitialRotationAToB: /* @__PURE__ */ ChildType(Quat, void 0, true),
6440
+ positionA: ChildType(Vec3),
6441
+ positionB: ChildType(Vec3),
6442
+ axisXA: ChildType(Vec3, { x: 1, y: 0, z: 0 }),
6443
+ axisXB: ChildType(Vec3, { x: 1, y: 0, z: 0 }),
6444
+ axisYA: ChildType(Vec3, { x: 0, y: 1, z: 0 }),
6445
+ axisYB: ChildType(Vec3, { x: 0, y: 1, z: 0 }),
6446
+ localPositionA: ChildType(Vec3, void 0, true),
6447
+ localPositionB: ChildType(Vec3, void 0, true),
6448
+ localAxisXA: ChildType(Vec3, void 0, true),
6449
+ localAxisXB: ChildType(Vec3, void 0, true),
6450
+ localAxisYA: ChildType(Vec3, void 0, true),
6451
+ localAxisYB: ChildType(Vec3, void 0, true),
6452
+ localAxisZA: ChildType(Vec3, void 0, true),
6453
+ localAxisZB: ChildType(Vec3, void 0, true),
6454
+ inverseInitialRotationAToB: ChildType(Quat, void 0, true),
7727
6455
  translationComponent: PointConstraintComponent,
7728
6456
  rotationComponent: RotationEulerComponent
7729
6457
  };
7730
- class FixedConstraint extends (/* @__PURE__ */ createClass(fixedConstraintProps)) {
6458
+ class FixedConstraint extends createClass(fixedConstraintProps) {
7731
6459
  constructor() {
7732
6460
  super(...arguments);
7733
6461
  this.type = ConstraintType.fixedConstraint;
@@ -7861,7 +6589,7 @@ var SpringMode = /* @__PURE__ */ ((SpringMode2) => {
7861
6589
  return SpringMode2;
7862
6590
  })(SpringMode || {});
7863
6591
  const springProps = {
7864
- mode: /* @__PURE__ */ NumberType(
6592
+ mode: NumberType(
7865
6593
  0
7866
6594
  /* UseFrequency */
7867
6595
  ),
@@ -7869,7 +6597,7 @@ const springProps = {
7869
6597
  frequency: 0,
7870
6598
  stiffness: 0
7871
6599
  };
7872
- class Spring extends (/* @__PURE__ */ createClass(springProps)) {
6600
+ class Spring extends createClass(springProps) {
7873
6601
  hasStiffness() {
7874
6602
  return this.frequency > 0;
7875
6603
  }
@@ -7881,7 +6609,7 @@ const springComponentProps = {
7881
6609
  bias: 0,
7882
6610
  softness: 0
7883
6611
  };
7884
- class SpringComponent extends (/* @__PURE__ */ createClass(springComponentProps)) {
6612
+ class SpringComponent extends createClass(springComponentProps) {
7885
6613
  getBias(lambda2) {
7886
6614
  return this.softness * lambda2 + this.bias;
7887
6615
  }
@@ -7924,22 +6652,22 @@ const inverseInertiaB$1 = /* @__PURE__ */ Mat3.create();
7924
6652
  const linearImpulse = /* @__PURE__ */ Vec3.create();
7925
6653
  const angularImpulse = /* @__PURE__ */ Vec3.create();
7926
6654
  const axisComponentProps = {
7927
- bodyA: /* @__PURE__ */ LazyReferenceType((() => Body)),
7928
- bodyB: /* @__PURE__ */ LazyReferenceType((() => Body)),
7929
- options: /* @__PURE__ */ ChildType(ConstraintOptions, {
6655
+ bodyA: LazyReferenceType((() => Body)),
6656
+ bodyB: LazyReferenceType((() => Body)),
6657
+ options: ChildType(ConstraintOptions, {
7930
6658
  positionBaumgarte: 0.8,
7931
6659
  velocityBaumgarte: 1,
7932
6660
  strength: 1
7933
6661
  }),
7934
- mR1PlusUxAxis: /* @__PURE__ */ ChildType(Vec3, { x: 0, y: 0, z: 0 }),
7935
- mR2xAxis: /* @__PURE__ */ ChildType(Vec3, { x: 0, y: 0, z: 0 }),
7936
- mInvI1_R1PlusUxAxis: /* @__PURE__ */ ChildType(Vec3, { x: 0, y: 0, z: 0 }),
7937
- mInvI2_R2xAxis: /* @__PURE__ */ ChildType(Vec3, { x: 0, y: 0, z: 0 }),
6662
+ mR1PlusUxAxis: ChildType(Vec3, { x: 0, y: 0, z: 0 }),
6663
+ mR2xAxis: ChildType(Vec3, { x: 0, y: 0, z: 0 }),
6664
+ mInvI1_R1PlusUxAxis: ChildType(Vec3, { x: 0, y: 0, z: 0 }),
6665
+ mInvI2_R2xAxis: ChildType(Vec3, { x: 0, y: 0, z: 0 }),
7938
6666
  effectiveMass: 0,
7939
6667
  totalLambda: 0,
7940
6668
  springComponent: SpringComponent
7941
6669
  };
7942
- class AxisComponent extends (/* @__PURE__ */ createClass(axisComponentProps)) {
6670
+ class AxisComponent extends createClass(axisComponentProps) {
7943
6671
  deactivate() {
7944
6672
  this.effectiveMass = 0;
7945
6673
  this.totalLambda = 0;
@@ -8096,21 +6824,21 @@ const armB = /* @__PURE__ */ Vec3.create();
8096
6824
  const vectorAB$5 = /* @__PURE__ */ Vec3.create();
8097
6825
  const distanceConstraintProps = {
8098
6826
  ...baseConstraintProps,
8099
- positionA: /* @__PURE__ */ ChildType(Vec3, { x: 0, y: 0, z: 0 }),
8100
- positionB: /* @__PURE__ */ ChildType(Vec3, { x: 0, y: 0, z: 0 }),
6827
+ positionA: ChildType(Vec3, { x: 0, y: 0, z: 0 }),
6828
+ positionB: ChildType(Vec3, { x: 0, y: 0, z: 0 }),
8101
6829
  minDistance: -1,
8102
6830
  maxDistance: -1,
8103
6831
  spring: Spring,
8104
6832
  axisComponent: AxisComponent,
8105
- localPositionA: /* @__PURE__ */ ChildType(Vec3, void 0, true),
8106
- localPositionB: /* @__PURE__ */ ChildType(Vec3, void 0, true),
8107
- worldPositionA: /* @__PURE__ */ ChildType(Vec3, void 0, true),
8108
- worldPositionB: /* @__PURE__ */ ChildType(Vec3, void 0, true),
8109
- worldNormal: /* @__PURE__ */ ChildType(Vec3, void 0, true),
8110
- minLambda: /* @__PURE__ */ NumberType(0, true),
8111
- maxLambda: /* @__PURE__ */ NumberType(0, true)
6833
+ localPositionA: ChildType(Vec3, void 0, true),
6834
+ localPositionB: ChildType(Vec3, void 0, true),
6835
+ worldPositionA: ChildType(Vec3, void 0, true),
6836
+ worldPositionB: ChildType(Vec3, void 0, true),
6837
+ worldNormal: ChildType(Vec3, void 0, true),
6838
+ minLambda: NumberType(0, true),
6839
+ maxLambda: NumberType(0, true)
8112
6840
  };
8113
- class DistanceConstraint extends (/* @__PURE__ */ createClass(distanceConstraintProps)) {
6841
+ class DistanceConstraint extends createClass(distanceConstraintProps) {
8114
6842
  constructor() {
8115
6843
  super(...arguments);
8116
6844
  this.type = ConstraintType.distanceConstraint;
@@ -8258,17 +6986,17 @@ var MotorMode = /* @__PURE__ */ ((MotorMode2) => {
8258
6986
  return MotorMode2;
8259
6987
  })(MotorMode || {});
8260
6988
  const motorProps = {
8261
- spring: /* @__PURE__ */ ChildType(Spring, { mode: SpringMode.UseFrequency, damping: 1, frequency: 2, stiffness: 2 }),
8262
- minForce: /* @__PURE__ */ NumberType(-Infinity),
8263
- maxForce: /* @__PURE__ */ NumberType(Infinity),
8264
- minTorque: /* @__PURE__ */ NumberType(-Infinity),
8265
- maxTorque: /* @__PURE__ */ NumberType(Infinity),
8266
- mode: /* @__PURE__ */ NumberType(
6989
+ spring: ChildType(Spring, { mode: SpringMode.UseFrequency, damping: 1, frequency: 2, stiffness: 2 }),
6990
+ minForce: NumberType(-Infinity),
6991
+ maxForce: NumberType(Infinity),
6992
+ minTorque: NumberType(-Infinity),
6993
+ maxTorque: NumberType(Infinity),
6994
+ mode: NumberType(
8267
6995
  0
8268
6996
  /* Off */
8269
6997
  )
8270
6998
  };
8271
- class Motor extends (/* @__PURE__ */ createClass(motorProps)) {
6999
+ class Motor extends createClass(motorProps) {
8272
7000
  isValid() {
8273
7001
  return this.spring.isValid() && this.minForce <= this.maxForce && this.minTorque <= this.maxTorque;
8274
7002
  }
@@ -8281,26 +7009,26 @@ const summedInverseInertia = /* @__PURE__ */ Mat3.create();
8281
7009
  const massBA = /* @__PURE__ */ Vec3.create();
8282
7010
  const massCA = /* @__PURE__ */ Vec3.create();
8283
7011
  const hingeComponentProps = {
8284
- bodyA: /* @__PURE__ */ LazyReferenceType((() => Body)),
8285
- bodyB: /* @__PURE__ */ LazyReferenceType((() => Body)),
8286
- options: /* @__PURE__ */ ChildType(ConstraintOptions, {
7012
+ bodyA: LazyReferenceType((() => Body)),
7013
+ bodyB: LazyReferenceType((() => Body)),
7014
+ options: ChildType(ConstraintOptions, {
8287
7015
  positionBaumgarte: 0.8,
8288
7016
  velocityBaumgarte: 1,
8289
7017
  strength: 1
8290
7018
  }),
8291
- axisA: /* @__PURE__ */ ChildType(Vec3, void 0, true),
8292
- axisB: /* @__PURE__ */ ChildType(Vec3, void 0, true),
8293
- axisC: /* @__PURE__ */ ChildType(Vec3, void 0, true),
8294
- crossBA: /* @__PURE__ */ ChildType(Vec3, void 0, true),
8295
- crossCA: /* @__PURE__ */ ChildType(Vec3, void 0, true),
8296
- effectiveMass00: /* @__PURE__ */ NumberType(0, true),
8297
- effectiveMass01: /* @__PURE__ */ NumberType(0, true),
8298
- effectiveMass10: /* @__PURE__ */ NumberType(0, true),
8299
- effectiveMass11: /* @__PURE__ */ NumberType(0, true),
8300
- inverseInertiaA: /* @__PURE__ */ ChildType(Mat3, void 0, true),
8301
- inverseInertiaB: /* @__PURE__ */ ChildType(Mat3, void 0, true),
8302
- totalLambdaA: /* @__PURE__ */ NumberType(0, true),
8303
- totalLambdaB: /* @__PURE__ */ NumberType(0, true)
7019
+ axisA: ChildType(Vec3, void 0, true),
7020
+ axisB: ChildType(Vec3, void 0, true),
7021
+ axisC: ChildType(Vec3, void 0, true),
7022
+ crossBA: ChildType(Vec3, void 0, true),
7023
+ crossCA: ChildType(Vec3, void 0, true),
7024
+ effectiveMass00: NumberType(0, true),
7025
+ effectiveMass01: NumberType(0, true),
7026
+ effectiveMass10: NumberType(0, true),
7027
+ effectiveMass11: NumberType(0, true),
7028
+ inverseInertiaA: ChildType(Mat3, void 0, true),
7029
+ inverseInertiaB: ChildType(Mat3, void 0, true),
7030
+ totalLambdaA: NumberType(0, true),
7031
+ totalLambdaB: NumberType(0, true)
8304
7032
  };
8305
7033
  function getOrthogonalVector(out, a3) {
8306
7034
  if (Math.abs(a3.x) > Math.abs(a3.y)) {
@@ -8309,7 +7037,7 @@ function getOrthogonalVector(out, a3) {
8309
7037
  out.fromArray([0, a3.z, -a3.y]);
8310
7038
  }
8311
7039
  }
8312
- class HingeComponent extends (/* @__PURE__ */ createClass(hingeComponentProps)) {
7040
+ class HingeComponent extends createClass(hingeComponentProps) {
8313
7041
  deactivate() {
8314
7042
  this.effectiveMass00 = 0;
8315
7043
  this.effectiveMass01 = 0;
@@ -8428,20 +7156,20 @@ const spinBA = /* @__PURE__ */ Vec3.create();
8428
7156
  const deltaSpin$1 = /* @__PURE__ */ Vec3.create();
8429
7157
  const inverseEffectiveMass = /* @__PURE__ */ Vec3.create();
8430
7158
  const angleComponentProps = {
8431
- bodyA: /* @__PURE__ */ LazyReferenceType((() => Body)),
8432
- bodyB: /* @__PURE__ */ LazyReferenceType((() => Body)),
8433
- options: /* @__PURE__ */ ChildType(ConstraintOptions, {
7159
+ bodyA: LazyReferenceType((() => Body)),
7160
+ bodyB: LazyReferenceType((() => Body)),
7161
+ options: ChildType(ConstraintOptions, {
8434
7162
  positionBaumgarte: 0.8,
8435
7163
  velocityBaumgarte: 1,
8436
7164
  strength: 1
8437
7165
  }),
8438
- springConstraintPart: /* @__PURE__ */ ChildType(SpringComponent, void 0, true),
8439
- effectiveMass: /* @__PURE__ */ NumberType(0, true),
8440
- effectiveInverseInertiaA: /* @__PURE__ */ ChildType(Vec3, void 0, true),
8441
- effectiveInverseInertiaB: /* @__PURE__ */ ChildType(Vec3, void 0, true),
8442
- totalLambda: /* @__PURE__ */ NumberType(0, true)
7166
+ springConstraintPart: ChildType(SpringComponent, void 0, true),
7167
+ effectiveMass: NumberType(0, true),
7168
+ effectiveInverseInertiaA: ChildType(Vec3, void 0, true),
7169
+ effectiveInverseInertiaB: ChildType(Vec3, void 0, true),
7170
+ totalLambda: NumberType(0, true)
8443
7171
  };
8444
- class AngleComponent extends (/* @__PURE__ */ createClass(angleComponentProps)) {
7172
+ class AngleComponent extends createClass(angleComponentProps) {
8445
7173
  deactivate() {
8446
7174
  this.effectiveMass = 0;
8447
7175
  this.totalLambda = 0;
@@ -8597,37 +7325,37 @@ const transformLocalToWorld = /* @__PURE__ */ Mat4.create();
8597
7325
  const hingeConstraintProps = {
8598
7326
  ...baseConstraintProps,
8599
7327
  // init data
8600
- pointA: /* @__PURE__ */ ChildType(Vec3, { x: 0, y: 0, z: 0 }),
8601
- pointB: /* @__PURE__ */ ChildType(Vec3, { x: 0, y: 0, z: 0 }),
8602
- hingeA: /* @__PURE__ */ ChildType(Vec3, { x: 1, y: 0, z: 0 }),
8603
- hingeB: /* @__PURE__ */ ChildType(Vec3, { x: 1, y: 0, z: 0 }),
8604
- normalA: /* @__PURE__ */ ChildType(Vec3, { x: 0, y: 1, z: 0 }),
8605
- normalB: /* @__PURE__ */ ChildType(Vec3, { x: 0, y: 1, z: 0 }),
7328
+ pointA: ChildType(Vec3, { x: 0, y: 0, z: 0 }),
7329
+ pointB: ChildType(Vec3, { x: 0, y: 0, z: 0 }),
7330
+ hingeA: ChildType(Vec3, { x: 1, y: 0, z: 0 }),
7331
+ hingeB: ChildType(Vec3, { x: 1, y: 0, z: 0 }),
7332
+ normalA: ChildType(Vec3, { x: 0, y: 1, z: 0 }),
7333
+ normalB: ChildType(Vec3, { x: 0, y: 1, z: 0 }),
8606
7334
  spring: Spring,
8607
7335
  motor: Motor,
8608
- minHingeAngle: /* @__PURE__ */ NumberType(-Math.PI),
8609
- maxHingeAngle: /* @__PURE__ */ NumberType(+Math.PI),
7336
+ minHingeAngle: NumberType(-Math.PI),
7337
+ maxHingeAngle: NumberType(+Math.PI),
8610
7338
  maxFrictionTorque: 0,
8611
7339
  // constraint data
8612
- localPointA: /* @__PURE__ */ ChildType(Vec3, void 0, true),
8613
- localPointB: /* @__PURE__ */ ChildType(Vec3, void 0, true),
8614
- localHingeA: /* @__PURE__ */ ChildType(Vec3, void 0, true),
8615
- localHingeB: /* @__PURE__ */ ChildType(Vec3, void 0, true),
8616
- localNormalA: /* @__PURE__ */ ChildType(Vec3, void 0, true),
8617
- localNormalB: /* @__PURE__ */ ChildType(Vec3, void 0, true),
8618
- inverseInitialRotationAB: /* @__PURE__ */ ChildType(Quat, void 0, true),
8619
- areLimitsEnabled: /* @__PURE__ */ BooleanType(false, true),
7340
+ localPointA: ChildType(Vec3, void 0, true),
7341
+ localPointB: ChildType(Vec3, void 0, true),
7342
+ localHingeA: ChildType(Vec3, void 0, true),
7343
+ localHingeB: ChildType(Vec3, void 0, true),
7344
+ localNormalA: ChildType(Vec3, void 0, true),
7345
+ localNormalB: ChildType(Vec3, void 0, true),
7346
+ inverseInitialRotationAB: ChildType(Quat, void 0, true),
7347
+ areLimitsEnabled: BooleanType(false, true),
8620
7348
  targetAngularSpeed: 0,
8621
7349
  targetAngle: 0,
8622
- hingeAngle: /* @__PURE__ */ NumberType(0, true),
8623
- axis1: /* @__PURE__ */ ChildType(Vec3, void 0, true),
7350
+ hingeAngle: NumberType(0, true),
7351
+ axis1: ChildType(Vec3, void 0, true),
8624
7352
  // constraint parts
8625
7353
  pointConstraintPart: PointConstraintComponent,
8626
7354
  rotationConstraintPart: HingeComponent,
8627
7355
  rotationLimitsConstraintPart: AngleComponent,
8628
7356
  motorConstraintPart: AngleComponent
8629
7357
  };
8630
- class HingeConstraint extends (/* @__PURE__ */ createClass(hingeConstraintProps)) {
7358
+ class HingeConstraint extends createClass(hingeConstraintProps) {
8631
7359
  constructor() {
8632
7360
  super(...arguments);
8633
7361
  this.type = ConstraintType.hingeConstraint;
@@ -8931,24 +7659,24 @@ HingeConstraint.create = function() {
8931
7659
  return constraint;
8932
7660
  };
8933
7661
  const constraintPairNodeProps = {
8934
- bodyA: /* @__PURE__ */ LazyReferenceType((() => Body)),
8935
- bodyB: /* @__PURE__ */ LazyReferenceType((() => Body)),
8936
- edgeA: /* @__PURE__ */ LazyReferenceType((() => ConstraintPairEdge)),
8937
- edgeB: /* @__PURE__ */ LazyReferenceType((() => ConstraintPairEdge)),
8938
- constraintType: /* @__PURE__ */ NumberType(ConstraintType.pointConstraint),
8939
- constraintPoint: /* @__PURE__ */ LazyReferenceType((() => PointConstraint)),
8940
- constraintFixed: /* @__PURE__ */ LazyReferenceType((() => FixedConstraint)),
8941
- constraintDistance: /* @__PURE__ */ LazyReferenceType((() => DistanceConstraint)),
8942
- constraintHinge: /* @__PURE__ */ LazyReferenceType((() => HingeConstraint))
7662
+ bodyA: LazyReferenceType((() => Body)),
7663
+ bodyB: LazyReferenceType((() => Body)),
7664
+ edgeA: LazyReferenceType((() => ConstraintPairEdge)),
7665
+ edgeB: LazyReferenceType((() => ConstraintPairEdge)),
7666
+ constraintType: NumberType(ConstraintType.pointConstraint),
7667
+ constraintPoint: LazyReferenceType((() => PointConstraint)),
7668
+ constraintFixed: LazyReferenceType((() => FixedConstraint)),
7669
+ constraintDistance: LazyReferenceType((() => DistanceConstraint)),
7670
+ constraintHinge: LazyReferenceType((() => HingeConstraint))
8943
7671
  };
8944
7672
  const afterConstructorCode$1 = `
8945
7673
  this.world = null;
8946
7674
  this.constraints = [null, null, null, null];
8947
7675
  `;
8948
- class ConstraintPairNode extends (/* @__PURE__ */ createClass(
7676
+ class ConstraintPairNode extends createClass(
8949
7677
  constraintPairNodeProps,
8950
7678
  { afterConstructorCode: afterConstructorCode$1 }
8951
- )) {
7679
+ ) {
8952
7680
  containsStaticBody() {
8953
7681
  return this.bodyA.type === BodyType.static || this.bodyB.type === BodyType.static;
8954
7682
  }
@@ -8966,13 +7694,13 @@ class ConstraintPairNode extends (/* @__PURE__ */ createClass(
8966
7694
  }
8967
7695
  }
8968
7696
  const constraintPairEdgeProps = {
8969
- node: /* @__PURE__ */ LazyReferenceType((() => ConstraintPairNode)),
8970
- next: /* @__PURE__ */ LazyReferenceType((() => ConstraintPairEdge)),
8971
- prev: /* @__PURE__ */ LazyReferenceType((() => ConstraintPairEdge))
7697
+ node: LazyReferenceType((() => ConstraintPairNode)),
7698
+ next: LazyReferenceType((() => ConstraintPairEdge)),
7699
+ prev: LazyReferenceType((() => ConstraintPairEdge))
8972
7700
  };
8973
- class ConstraintPairEdge extends (/* @__PURE__ */ createClass(
7701
+ class ConstraintPairEdge extends createClass(
8974
7702
  constraintPairEdgeProps
8975
- )) {
7703
+ ) {
8976
7704
  }
8977
7705
  class ConstraintPairsModule {
8978
7706
  constructor(constraintPairNodePool, constraintPairEdgePool) {
@@ -9214,7 +7942,7 @@ var ColliderType = /* @__PURE__ */ ((ColliderType2) => {
9214
7942
  return ColliderType2;
9215
7943
  })(ColliderType || {});
9216
7944
  const bodyProps = {
9217
- type: /* @__PURE__ */ NumberType(
7945
+ type: NumberType(
9218
7946
  0
9219
7947
  /* dynamic */
9220
7948
  ),
@@ -9222,55 +7950,55 @@ const bodyProps = {
9222
7950
  orientation: Quat,
9223
7951
  linearVelocity: Vec3,
9224
7952
  angularVelocity: Vec3,
9225
- computedCenterOfMassPosition: /* @__PURE__ */ ChildType(Vec3, void 0, true),
9226
- computedBounds: /* @__PURE__ */ ChildType(Aabb, void 0, true),
9227
- previousPosition: /* @__PURE__ */ ChildType(Vec3, void 0, true),
9228
- previousOrientation: /* @__PURE__ */ ChildType(Quat, void 0, true),
9229
- isSleeping: /* @__PURE__ */ BooleanType(false, true),
9230
- timeWithoutMoving: /* @__PURE__ */ NumberType(0, true),
7953
+ computedCenterOfMassPosition: ChildType(Vec3, void 0, true),
7954
+ computedBounds: ChildType(Aabb, void 0, true),
7955
+ previousPosition: ChildType(Vec3, void 0, true),
7956
+ previousOrientation: ChildType(Quat, void 0, true),
7957
+ isSleeping: BooleanType(false, true),
7958
+ timeWithoutMoving: NumberType(0, true),
9231
7959
  friction: 0,
9232
7960
  restitution: 0,
9233
- frictionFunction: /* @__PURE__ */ NumberType(CoefficientFunctionType.average),
9234
- restitutionFunction: /* @__PURE__ */ NumberType(CoefficientFunctionType.average),
7961
+ frictionFunction: NumberType(CoefficientFunctionType.average),
7962
+ restitutionFunction: NumberType(CoefficientFunctionType.average),
9235
7963
  mass: 0,
9236
7964
  density: 0,
9237
- inverseMass: /* @__PURE__ */ NumberType(0, true),
9238
- computedLocalInverseInertia: /* @__PURE__ */ ChildType(Mat3, void 0, true),
9239
- computedWorldInverseInertia: /* @__PURE__ */ ChildType(Mat3, void 0, true),
9240
- colliderType: /* @__PURE__ */ NumberType(
7965
+ inverseMass: NumberType(0, true),
7966
+ computedLocalInverseInertia: ChildType(Mat3, void 0, true),
7967
+ computedWorldInverseInertia: ChildType(Mat3, void 0, true),
7968
+ colliderType: NumberType(
9241
7969
  2
9242
7970
  /* resolveContact */
9243
7971
  ),
9244
7972
  gravityScale: 1,
9245
- linearForces: /* @__PURE__ */ ChildType(Vec3, void 0, true),
9246
- angularForces: /* @__PURE__ */ ChildType(Vec3, void 0, true),
9247
- copyForDiff: /* @__PURE__ */ LazyReferenceType((() => Body)),
9248
- firstPotentialPairEdge: /* @__PURE__ */ LazyReferenceType((() => BodyPairEdge)),
9249
- belongsToGroups: /* @__PURE__ */ NumberType(AllFlag),
9250
- collidesWithGroups: /* @__PURE__ */ NumberType(AllFlag),
9251
- node: /* @__PURE__ */ LazyReferenceType((() => BvhNode)),
9252
- shapeType: /* @__PURE__ */ NumberType(ShapeType.box),
7973
+ linearForces: ChildType(Vec3, void 0, true),
7974
+ angularForces: ChildType(Vec3, void 0, true),
7975
+ copyForDiff: LazyReferenceType((() => Body)),
7976
+ firstPotentialPairEdge: LazyReferenceType((() => BodyPairEdge)),
7977
+ belongsToGroups: NumberType(AllFlag),
7978
+ collidesWithGroups: NumberType(AllFlag),
7979
+ node: LazyReferenceType((() => BvhNode)),
7980
+ shapeType: NumberType(ShapeType.box),
9253
7981
  // we need to do "as 'shape' ..." otherwise they are just 'string' and not the actual specific keys
9254
- ["shape" + ShapeType.box]: /* @__PURE__ */ ReferenceType(Box, void 0, true),
9255
- ["shape" + ShapeType.capsule]: /* @__PURE__ */ ReferenceType(Capsule, void 0, true),
9256
- ["shape" + ShapeType.compoundShape]: /* @__PURE__ */ ReferenceType(CompoundShape, void 0, true),
9257
- ["shape" + ShapeType.convexHull]: /* @__PURE__ */ ReferenceType(ConvexHull, void 0, true),
9258
- ["shape" + ShapeType.cylinder]: /* @__PURE__ */ ReferenceType(Cylinder, void 0, true),
9259
- ["shape" + ShapeType.heightMap]: /* @__PURE__ */ ReferenceType(HeightMap, void 0, true),
9260
- ["shape" + ShapeType.sphere]: /* @__PURE__ */ ReferenceType(Sphere, void 0, true),
9261
- ["shape" + ShapeType.triangleMesh]: /* @__PURE__ */ ReferenceType(TriangleMesh, void 0, true),
9262
- isSleepingEnabled: /* @__PURE__ */ BooleanType(true),
7982
+ ["shape" + ShapeType.box]: ReferenceType(Box, void 0, true),
7983
+ ["shape" + ShapeType.capsule]: ReferenceType(Capsule, void 0, true),
7984
+ ["shape" + ShapeType.compoundShape]: ReferenceType(CompoundShape, void 0, true),
7985
+ ["shape" + ShapeType.convexHull]: ReferenceType(ConvexHull, void 0, true),
7986
+ ["shape" + ShapeType.cylinder]: ReferenceType(Cylinder, void 0, true),
7987
+ ["shape" + ShapeType.heightMap]: ReferenceType(HeightMap, void 0, true),
7988
+ ["shape" + ShapeType.sphere]: ReferenceType(Sphere, void 0, true),
7989
+ ["shape" + ShapeType.triangleMesh]: ReferenceType(TriangleMesh, void 0, true),
7990
+ isSleepingEnabled: BooleanType(true),
9263
7991
  linearDamping: -1,
9264
7992
  angularDamping: -1,
9265
- firstPotentialConstraintPairEdge: /* @__PURE__ */ LazyReferenceType(
7993
+ firstPotentialConstraintPairEdge: LazyReferenceType(
9266
7994
  (() => ConstraintPairEdge)
9267
7995
  ),
9268
- visitGeneration: /* @__PURE__ */ NumberType(0, true)
7996
+ visitGeneration: NumberType(0, true)
9269
7997
  };
9270
7998
  const afterConstructorCode = `
9271
7999
  this.world = null;
9272
8000
  `;
9273
- class Body extends (/* @__PURE__ */ createClass(bodyProps, { afterConstructorCode })) {
8001
+ class Body extends createClass(bodyProps, { afterConstructorCode }) {
9274
8002
  get shape() {
9275
8003
  return this["shape" + this.shapeType];
9276
8004
  }
@@ -9605,11 +8333,11 @@ var CollisionStatus = /* @__PURE__ */ ((CollisionStatus2) => {
9605
8333
  return CollisionStatus2;
9606
8334
  })(CollisionStatus || {});
9607
8335
  const collisionResultProps = {
9608
- status: /* @__PURE__ */ NumberType(
8336
+ status: NumberType(
9609
8337
  2
9610
8338
  /* Indeterminate */
9611
8339
  ),
9612
- hasContact: /* @__PURE__ */ BooleanType(false),
8340
+ hasContact: BooleanType(false),
9613
8341
  penetration: 0,
9614
8342
  contactPointA: Vec3,
9615
8343
  contactPointB: Vec3,
@@ -9619,15 +8347,15 @@ const collisionResultProps = {
9619
8347
  momentArmB: Vec3,
9620
8348
  surfaceNormalA: Vec3,
9621
8349
  surfaceNormalB: Vec3,
9622
- bodyA: /* @__PURE__ */ LazyReferenceType((() => Body)),
9623
- bodyB: /* @__PURE__ */ LazyReferenceType((() => Body)),
8350
+ bodyA: LazyReferenceType((() => Body)),
8351
+ bodyB: LazyReferenceType((() => Body)),
9624
8352
  subShapeIdA: 0,
9625
8353
  subShapeIdB: 0,
9626
- isBackFace: /* @__PURE__ */ BooleanType(false),
8354
+ isBackFace: BooleanType(false),
9627
8355
  faceA: Face,
9628
8356
  faceB: Face
9629
8357
  };
9630
- class CollisionResult extends (/* @__PURE__ */ createClass(collisionResultProps)) {
8358
+ class CollisionResult extends createClass(collisionResultProps) {
9631
8359
  /**
9632
8360
  * swaps the A and B data
9633
8361
  */
@@ -9701,11 +8429,11 @@ function createDefaultCollisionSettings() {
9701
8429
  };
9702
8430
  }
9703
8431
  const castResultProps = {
9704
- status: /* @__PURE__ */ NumberType(
8432
+ status: NumberType(
9705
8433
  2
9706
8434
  /* Indeterminate */
9707
8435
  ),
9708
- hasContact: /* @__PURE__ */ BooleanType(false),
8436
+ hasContact: BooleanType(false),
9709
8437
  penetration: 0,
9710
8438
  contactPointA: Vec3,
9711
8439
  contactPointB: Vec3,
@@ -9715,17 +8443,17 @@ const castResultProps = {
9715
8443
  momentArmB: Vec3,
9716
8444
  surfaceNormalA: Vec3,
9717
8445
  surfaceNormalB: Vec3,
9718
- bodyA: /* @__PURE__ */ LazyReferenceType((() => Body)),
9719
- bodyB: /* @__PURE__ */ LazyReferenceType((() => Body)),
8446
+ bodyA: LazyReferenceType((() => Body)),
8447
+ bodyB: LazyReferenceType((() => Body)),
9720
8448
  subShapeIdA: 0,
9721
8449
  subShapeIdB: 0,
9722
- isBackFace: /* @__PURE__ */ BooleanType(false),
8450
+ isBackFace: BooleanType(false),
9723
8451
  faceA: Face,
9724
8452
  faceB: Face,
9725
8453
  fraction: 0,
9726
- isBackFaceHit: /* @__PURE__ */ BooleanType(false)
8454
+ isBackFaceHit: BooleanType(false)
9727
8455
  };
9728
- class CastResult extends (/* @__PURE__ */ createClass(castResultProps)) {
8456
+ class CastResult extends createClass(castResultProps) {
9729
8457
  /**
9730
8458
  * swaps the A and B data
9731
8459
  */
@@ -9814,17 +8542,17 @@ const closestPointResultProps = {
9814
8542
  point: Vec3,
9815
8543
  pointSet: 0
9816
8544
  };
9817
- class ClosestPointResult extends (/* @__PURE__ */ createClass(
8545
+ class ClosestPointResult extends createClass(
9818
8546
  closestPointResultProps
9819
- )) {
8547
+ ) {
9820
8548
  }
9821
8549
  const barycentricCoordinatesResultProps = {
9822
8550
  u: 0,
9823
8551
  v: 0,
9824
8552
  w: 0,
9825
- isValid: /* @__PURE__ */ BooleanType(false)
8553
+ isValid: BooleanType(false)
9826
8554
  };
9827
- class BarycentricCoordinatesResult extends (/* @__PURE__ */ createClass(barycentricCoordinatesResultProps)) {
8555
+ class BarycentricCoordinatesResult extends createClass(barycentricCoordinatesResultProps) {
9828
8556
  }
9829
8557
  const ab$3 = /* @__PURE__ */ Vec3.create();
9830
8558
  const ac$2 = /* @__PURE__ */ Vec3.create();
@@ -10041,7 +8769,7 @@ const vec4Props = {
10041
8769
  z: 0,
10042
8770
  w: 0
10043
8771
  };
10044
- class Vec4 extends (/* @__PURE__ */ createClass(vec4Props)) {
8772
+ class Vec4 extends createClass(vec4Props) {
10045
8773
  }
10046
8774
  const ab$1 = /* @__PURE__ */ Vec3.create();
10047
8775
  const ac = /* @__PURE__ */ Vec3.create();
@@ -10147,11 +8875,11 @@ const closestPointToSimplexProps = {
10147
8875
  point: Vec3,
10148
8876
  squaredDistance: 0,
10149
8877
  pointSet: 0,
10150
- closestPointFound: /* @__PURE__ */ BooleanType(false)
8878
+ closestPointFound: BooleanType(false)
10151
8879
  };
10152
- class ClosestPointToSimplex extends (/* @__PURE__ */ createClass(
8880
+ class ClosestPointToSimplex extends createClass(
10153
8881
  closestPointToSimplexProps
10154
- )) {
8882
+ ) {
10155
8883
  }
10156
8884
  const gjkClosestPointsProps = {
10157
8885
  squaredDistance: 0,
@@ -10159,7 +8887,7 @@ const gjkClosestPointsProps = {
10159
8887
  pointA: Vec3,
10160
8888
  pointB: Vec3
10161
8889
  };
10162
- class GjkClosestPoints extends (/* @__PURE__ */ createClass(gjkClosestPointsProps)) {
8890
+ class GjkClosestPoints extends createClass(gjkClosestPointsProps) {
10163
8891
  }
10164
8892
  const gjkCastShapeResultProps = {
10165
8893
  isHitFound: false,
@@ -10168,7 +8896,7 @@ const gjkCastShapeResultProps = {
10168
8896
  pointA: Vec3,
10169
8897
  pointB: Vec3
10170
8898
  };
10171
- class GjkCastShapeResult extends (/* @__PURE__ */ createClass(gjkCastShapeResultProps)) {
8899
+ class GjkCastShapeResult extends createClass(gjkCastShapeResultProps) {
10172
8900
  }
10173
8901
  const transformedConvexObject = /* @__PURE__ */ new TransformedConvexObject();
10174
8902
  const y0 = /* @__PURE__ */ Vec3.create();
@@ -10652,11 +9380,11 @@ class GjkModule {
10652
9380
  }
10653
9381
  const v = /* @__PURE__ */ Vec3.create();
10654
9382
  const edgeProps = {
10655
- neighbourTriangle: /* @__PURE__ */ LazyReferenceType((() => Triangle2)),
9383
+ neighbourTriangle: LazyReferenceType((() => Triangle2)),
10656
9384
  neighbourEdge: 0,
10657
9385
  startIndex: 0
10658
9386
  };
10659
- class Edge extends (/* @__PURE__ */ createClass(edgeProps)) {
9387
+ class Edge extends createClass(edgeProps) {
10660
9388
  //
10661
9389
  }
10662
9390
  const triangleProps = {
@@ -10668,10 +9396,10 @@ const triangleProps = {
10668
9396
  closestLengthSq: Infinity,
10669
9397
  lambda0: 0,
10670
9398
  lambda1: 0,
10671
- lambdaRelativeTo0: /* @__PURE__ */ BooleanType(false),
10672
- closestPointInterior: /* @__PURE__ */ BooleanType(false),
10673
- removed: /* @__PURE__ */ BooleanType(false),
10674
- inQueue: /* @__PURE__ */ BooleanType(false),
9399
+ lambdaRelativeTo0: BooleanType(false),
9400
+ closestPointInterior: BooleanType(false),
9401
+ removed: BooleanType(false),
9402
+ inQueue: BooleanType(false),
10675
9403
  iteration: 0
10676
9404
  };
10677
9405
  const vectorAB$4 = /* @__PURE__ */ Vec3.create();
@@ -10752,7 +9480,7 @@ function initTriangle(m, inIdx0, inIdx1, inIdx2, inPositions, minTriangleArea, b
10752
9480
  }
10753
9481
  }
10754
9482
  }
10755
- class Triangle2 extends (/* @__PURE__ */ createClass(triangleProps)) {
9483
+ class Triangle2 extends createClass(triangleProps) {
10756
9484
  isFacing(inPosition) {
10757
9485
  vectorAB$4.subtractVectors(inPosition, this.centroid);
10758
9486
  return this.normal.dot(vectorAB$4) > 0;
@@ -11268,9 +9996,9 @@ const penetrationDepthProps = {
11268
9996
  pointA: Vec3,
11269
9997
  pointB: Vec3
11270
9998
  };
11271
- class PenetrationDepth extends (/* @__PURE__ */ createClass(
9999
+ class PenetrationDepth extends createClass(
11272
10000
  penetrationDepthProps
11273
- )) {
10001
+ ) {
11274
10002
  }
11275
10003
  const transformed_a = /* @__PURE__ */ new TransformedConvexObject();
11276
10004
  const closest = /* @__PURE__ */ GjkClosestPoints.create();
@@ -12546,6 +11274,14 @@ class CollideShapesModule {
12546
11274
  );
12547
11275
  }
12548
11276
  }
11277
+ const estimateCollisionResponseResultProps = {
11278
+ deltaLinearVelocityA: Vec3,
11279
+ deltaAngularVelocityA: Vec3,
11280
+ deltaLinearVelocityB: Vec3,
11281
+ deltaAngularVelocityB: Vec3
11282
+ };
11283
+ class EstimateCollisionResponseResult extends createClass(estimateCollisionResponseResultProps) {
11284
+ }
12549
11285
  function estimateCollisionResponse(result2, manifold, timeStepSizeSeconds) {
12550
11286
  result2.reset();
12551
11287
  const damping = 0.9;
@@ -13213,9 +11949,9 @@ const contactPairCacheCosMaxDeltaRotationDiv2 = Math.cos(degreesToRadians(2) / 2
13213
11949
  const negatedPenetrationAxis = /* @__PURE__ */ Vec3.create();
13214
11950
  const vec3BufferProps = {
13215
11951
  numItems: 0,
13216
- vec3List: /* @__PURE__ */ ReferenceListType(Vec3)
11952
+ vec3List: ReferenceListType(Vec3)
13217
11953
  };
13218
- class Vec3Buffer extends (/* @__PURE__ */ createClass(vec3BufferProps)) {
11954
+ class Vec3Buffer extends createClass(vec3BufferProps) {
13219
11955
  getVec3(out, index) {
13220
11956
  out.copy(this.vec3List.getAtIndex(index));
13221
11957
  }