@holoscript/std 3.1.1 → 7.0.0
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/LICENSE +21 -0
- package/dist/__tests__/EconomicPrimitives.test.d.ts +2 -0
- package/dist/__tests__/EconomicTraits.test.d.ts +2 -0
- package/dist/__tests__/SimulationLabPrimitives.test.d.ts +2 -0
- package/dist/__tests__/collections.test.d.ts +2 -0
- package/dist/__tests__/events.test.d.ts +2 -0
- package/dist/__tests__/index.test.d.ts +2 -0
- package/dist/__tests__/index.test.d.ts.map +1 -0
- package/dist/__tests__/materials.test.d.ts +2 -0
- package/dist/__tests__/math.test.d.ts +2 -0
- package/dist/__tests__/physics.test.d.ts +2 -0
- package/dist/__tests__/spatial.test.d.ts +2 -0
- package/dist/__tests__/standard-library-fundamentals.test.d.ts +2 -0
- package/dist/__tests__/standard-library-fundamentals.test.d.ts.map +1 -0
- package/dist/__tests__/string-and-time-utilities.test.d.ts +2 -0
- package/dist/__tests__/string-and-time-utilities.test.d.ts.map +1 -0
- package/dist/__tests__/string-decoupled.test.d.ts +2 -0
- package/dist/__tests__/string.test.d.ts +2 -0
- package/dist/__tests__/time.test.d.ts +2 -0
- package/dist/chunk-DZHAVOCH.js +686 -0
- package/dist/chunk-DZHAVOCH.js.map +1 -0
- package/dist/chunk-P4O3WNG2.js +287 -0
- package/dist/chunk-P4O3WNG2.js.map +1 -0
- package/dist/chunk-PFX2JM4X.js +683 -0
- package/dist/chunk-PFX2JM4X.js.map +1 -0
- package/dist/chunk-PR4QN5HX.js +43 -0
- package/dist/chunk-PR4QN5HX.js.map +1 -0
- package/dist/chunk-WS6W35YC.js +443 -0
- package/dist/chunk-WS6W35YC.js.map +1 -0
- package/dist/chunk-XBA4ARST.js +9313 -0
- package/dist/chunk-XBA4ARST.js.map +1 -0
- package/dist/chunk-XJIFG7G3.js +348 -0
- package/dist/chunk-XJIFG7G3.js.map +1 -0
- package/dist/chunk-ZXVZAQCZ.js +470 -0
- package/dist/chunk-ZXVZAQCZ.js.map +1 -0
- package/dist/collections.cjs +715 -0
- package/dist/collections.cjs.map +1 -0
- package/dist/collections.d.ts +177 -0
- package/dist/collections.js +18 -0
- package/dist/collections.js.map +1 -0
- package/dist/events.d.ts +32 -0
- package/dist/fs/__tests__/file-watch-system.test.d.ts +2 -0
- package/dist/fs/__tests__/file-watch-system.test.d.ts.map +1 -0
- package/dist/fs/__tests__/path-utilities.test.d.ts +2 -0
- package/dist/fs/__tests__/path-utilities.test.d.ts.map +1 -0
- package/dist/fs/__tests__/path.test.d.ts +2 -0
- package/dist/fs/__tests__/path.test.d.ts.map +1 -0
- package/dist/fs/fs.d.ts +288 -0
- package/dist/fs/fs.d.ts.map +1 -0
- package/dist/fs/index.cjs +9338 -0
- package/dist/fs/index.cjs.map +1 -0
- package/dist/fs/index.d.ts +51 -0
- package/dist/fs/index.d.ts.map +1 -0
- package/dist/fs/index.js +204 -0
- package/dist/fs/index.js.map +1 -0
- package/dist/fs/path.d.ts +135 -0
- package/dist/fs/path.d.ts.map +1 -0
- package/dist/fs/watch.d.ts +133 -0
- package/dist/fs/watch.d.ts.map +1 -0
- package/dist/index.cjs +13326 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +102 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1275 -190
- package/dist/index.js.map +1 -0
- package/dist/materials.d.ts +50 -0
- package/dist/math.cjs +595 -0
- package/dist/math.cjs.map +1 -0
- package/dist/math.d.ts +162 -0
- package/dist/math.js +54 -0
- package/dist/math.js.map +1 -0
- package/dist/physics.d.ts +59 -0
- package/dist/spatial.d.ts +82 -0
- package/dist/string.basic.test.d.ts +5 -0
- package/dist/string.basic.test.d.ts.map +1 -0
- package/dist/string.cjs +422 -0
- package/dist/string.cjs.map +1 -0
- package/dist/string.d.ts +212 -0
- package/dist/string.d.ts.map +1 -1
- package/dist/string.js +108 -0
- package/dist/string.js.map +1 -0
- package/dist/string.test.d.ts +5 -0
- package/dist/string.test.d.ts.map +1 -0
- package/dist/time.cjs +512 -0
- package/dist/time.cjs.map +1 -0
- package/dist/time.d.ts +215 -0
- package/dist/time.js +44 -0
- package/dist/time.js.map +1 -0
- package/dist/traits/ARTraits.d.ts +14 -0
- package/dist/traits/EconomicPrimitives.cjs +335 -0
- package/dist/traits/EconomicPrimitives.cjs.map +1 -0
- package/dist/traits/EconomicPrimitives.d.ts +345 -0
- package/dist/traits/EconomicPrimitives.js +56 -0
- package/dist/traits/EconomicPrimitives.js.map +1 -0
- package/dist/traits/EconomicTraits.cjs +471 -0
- package/dist/traits/EconomicTraits.cjs.map +1 -0
- package/dist/traits/EconomicTraits.d.ts +71 -0
- package/dist/traits/EconomicTraits.js +18 -0
- package/dist/traits/EconomicTraits.js.map +1 -0
- package/dist/traits/IoTTraits.d.ts +14 -0
- package/dist/traits/SimulationLabPrimitives.d.ts +187 -0
- package/dist/traits/SimulationLabTraits.d.ts +42 -0
- package/dist/traits/VRRTraits.d.ts +150 -0
- package/dist/traits/__tests__/ARTraits.test.d.ts +2 -0
- package/dist/traits/__tests__/ARTraits.test.d.ts.map +1 -0
- package/dist/traits/__tests__/EconomicPrimitives.test.d.ts +2 -0
- package/dist/traits/__tests__/EconomicPrimitives.test.d.ts.map +1 -0
- package/dist/traits/__tests__/EconomicTraits.test.d.ts +2 -0
- package/dist/traits/__tests__/EconomicTraits.test.d.ts.map +1 -0
- package/dist/types.d.ts +202 -0
- package/dist/types.d.ts.map +1 -1
- package/error-utf8.log +6 -0
- package/error.log +0 -0
- package/package.json +35 -18
- package/src/__tests__/index.test.ts +14 -0
- package/src/__tests__/{Sprint33.test.ts → standard-library-fundamentals.test.ts} +91 -74
- package/src/__tests__/{Sprint56.test.ts → string-and-time-utilities.test.ts} +64 -64
- package/src/__tests__/string-decoupled.test.ts +6 -9
- package/src/fs/__tests__/file-watch-system.test.ts +675 -0
- package/src/fs/__tests__/path-utilities.test.ts +375 -0
- package/src/fs/__tests__/path.test.ts +287 -0
- package/src/fs/fs.ts +692 -0
- package/src/fs/index.ts +194 -0
- package/src/fs/path.ts +310 -0
- package/src/fs/watch.ts +413 -0
- package/src/index.ts +3 -1
- package/src/math.ts +1 -1
- package/src/string.basic.test.ts +1 -1
- package/src/string.test.ts +4 -4
- package/src/string.ts +32 -17
- package/src/time.ts +1 -1
- package/src/traits/ARTraits.ts +2 -2
- package/src/traits/IoTTraits.ts +2 -2
- package/src/traits/VRRTraits.ts +2 -2
- package/src/traits/__tests__/ARTraits.test.ts +8 -0
- package/src/traits/__tests__/EconomicPrimitives.test.ts +14 -0
- package/src/traits/__tests__/EconomicTraits.test.ts +16 -0
- package/src/types.ts +10 -3
- package/std_error.log +5 -0
- package/tsup.config.ts +20 -0
- package/dist/__tests__/Sprint33.test.d.ts.map +0 -1
- package/dist/__tests__/Sprint56.test.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,210 +1,1295 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
1
|
+
import {
|
|
2
|
+
HoloMap,
|
|
3
|
+
HoloSet,
|
|
4
|
+
List,
|
|
5
|
+
PriorityQueue,
|
|
6
|
+
SpatialGrid
|
|
7
|
+
} from "./chunk-PFX2JM4X.js";
|
|
8
|
+
import {
|
|
9
|
+
DEG_TO_RAD,
|
|
10
|
+
EPSILON,
|
|
11
|
+
HALF_PI,
|
|
12
|
+
PI,
|
|
13
|
+
RAD_TO_DEG,
|
|
14
|
+
TAU,
|
|
15
|
+
aabb,
|
|
16
|
+
aabbMath,
|
|
17
|
+
arrayToQuat,
|
|
18
|
+
arrayToVec3,
|
|
19
|
+
clamp,
|
|
20
|
+
colorToHex,
|
|
21
|
+
degToRad,
|
|
22
|
+
fract,
|
|
23
|
+
hsl,
|
|
24
|
+
inverseLerp,
|
|
25
|
+
lerp,
|
|
26
|
+
mod,
|
|
27
|
+
noise,
|
|
28
|
+
parseColor,
|
|
29
|
+
quat,
|
|
30
|
+
quatMath,
|
|
31
|
+
quatToArray,
|
|
32
|
+
radToDeg,
|
|
33
|
+
random,
|
|
34
|
+
ray,
|
|
35
|
+
remap,
|
|
36
|
+
rgb,
|
|
37
|
+
rgba,
|
|
38
|
+
sign,
|
|
39
|
+
smootherstep,
|
|
40
|
+
smoothstep,
|
|
41
|
+
step,
|
|
42
|
+
transform,
|
|
43
|
+
vec2,
|
|
44
|
+
vec2Math,
|
|
45
|
+
vec3,
|
|
46
|
+
vec3Math,
|
|
47
|
+
vec3ToArray,
|
|
48
|
+
vec4
|
|
49
|
+
} from "./chunk-DZHAVOCH.js";
|
|
50
|
+
import {
|
|
51
|
+
camelCase,
|
|
52
|
+
capitalize,
|
|
53
|
+
center,
|
|
54
|
+
chars,
|
|
55
|
+
collapseWhitespace,
|
|
56
|
+
constantCase,
|
|
57
|
+
containsIgnoreCase,
|
|
58
|
+
count,
|
|
59
|
+
dedent,
|
|
60
|
+
endsWithIgnoreCase,
|
|
61
|
+
escapeHtml,
|
|
62
|
+
escapeRegex,
|
|
63
|
+
extractTraits,
|
|
64
|
+
format,
|
|
65
|
+
formatBytes,
|
|
66
|
+
formatDuration,
|
|
67
|
+
formatNumber,
|
|
68
|
+
indent,
|
|
69
|
+
isAlpha,
|
|
70
|
+
isAlphanumeric,
|
|
71
|
+
isBlank,
|
|
72
|
+
isNotBlank,
|
|
73
|
+
isNumeric,
|
|
74
|
+
isValidIdentifier,
|
|
75
|
+
join,
|
|
76
|
+
kebabCase,
|
|
77
|
+
levenshtein,
|
|
78
|
+
lines,
|
|
79
|
+
numberWithCommas,
|
|
80
|
+
padLeft,
|
|
81
|
+
padRight,
|
|
82
|
+
pascalCase,
|
|
83
|
+
randomString,
|
|
84
|
+
removePrefix,
|
|
85
|
+
removeSuffix,
|
|
86
|
+
removeWhitespace,
|
|
87
|
+
repeat,
|
|
88
|
+
reverse,
|
|
89
|
+
similarity,
|
|
90
|
+
slugify,
|
|
91
|
+
snakeCase,
|
|
92
|
+
startsWithIgnoreCase,
|
|
93
|
+
titleCase,
|
|
94
|
+
truncate,
|
|
95
|
+
truncateMiddle,
|
|
96
|
+
unescapeHtml,
|
|
97
|
+
unwrap,
|
|
98
|
+
uuid,
|
|
99
|
+
wordWrap,
|
|
100
|
+
words,
|
|
101
|
+
wrap
|
|
102
|
+
} from "./chunk-XJIFG7G3.js";
|
|
103
|
+
import {
|
|
104
|
+
CountdownTimer,
|
|
105
|
+
DateTime,
|
|
106
|
+
FrameTimer,
|
|
107
|
+
IntervalTimer,
|
|
108
|
+
Stopwatch,
|
|
109
|
+
createTicker,
|
|
110
|
+
debounce,
|
|
111
|
+
hrTime,
|
|
112
|
+
measure,
|
|
113
|
+
now,
|
|
114
|
+
retry,
|
|
115
|
+
schedule,
|
|
116
|
+
scheduleFrame,
|
|
117
|
+
scheduleInterval,
|
|
118
|
+
sleep,
|
|
119
|
+
throttle,
|
|
120
|
+
timed,
|
|
121
|
+
waitUntil,
|
|
122
|
+
withTimeout
|
|
123
|
+
} from "./chunk-ZXVZAQCZ.js";
|
|
124
|
+
import {
|
|
125
|
+
fs_exports
|
|
126
|
+
} from "./chunk-XBA4ARST.js";
|
|
127
|
+
import {
|
|
128
|
+
DEFAULT_BONDING_CURVE,
|
|
129
|
+
DEFAULT_DEPRECIATION,
|
|
130
|
+
DEFAULT_PID,
|
|
131
|
+
DEFAULT_WEALTH_TAX,
|
|
132
|
+
bondingCurveBuyCost,
|
|
133
|
+
bondingCurvePrice,
|
|
134
|
+
bondingCurveSellRefund,
|
|
135
|
+
calculateDepreciation,
|
|
136
|
+
calculateRedistribution,
|
|
137
|
+
calculateRepairCost,
|
|
138
|
+
calculateTaxAmount,
|
|
139
|
+
calculateTaxRate,
|
|
140
|
+
createDualLoopPIDState,
|
|
141
|
+
createFaucetSinkMetrics,
|
|
142
|
+
createPIDState,
|
|
143
|
+
depreciatedValue,
|
|
144
|
+
executeTrade,
|
|
145
|
+
generateTxHash,
|
|
146
|
+
isDestroyed,
|
|
147
|
+
recordFaucet,
|
|
148
|
+
recordSink,
|
|
149
|
+
resetMetricsPeriod,
|
|
150
|
+
spatialPrice,
|
|
151
|
+
updateDualLoopPID,
|
|
152
|
+
updatePID
|
|
153
|
+
} from "./chunk-P4O3WNG2.js";
|
|
154
|
+
import {
|
|
155
|
+
EconomicTraits,
|
|
156
|
+
getEconomicTrait,
|
|
157
|
+
getEconomicTraitNames,
|
|
158
|
+
getRequiredPermissions,
|
|
159
|
+
validateTraitComposition
|
|
160
|
+
} from "./chunk-WS6W35YC.js";
|
|
161
|
+
import "./chunk-PR4QN5HX.js";
|
|
162
|
+
|
|
163
|
+
// src/spatial.ts
|
|
164
|
+
var Vec3 = class _Vec3 {
|
|
165
|
+
constructor(x = 0, y = 0, z = 0) {
|
|
166
|
+
this.x = x;
|
|
167
|
+
this.y = y;
|
|
168
|
+
this.z = z;
|
|
169
|
+
}
|
|
170
|
+
static zero() {
|
|
171
|
+
return new _Vec3(0, 0, 0);
|
|
172
|
+
}
|
|
173
|
+
static one() {
|
|
174
|
+
return new _Vec3(1, 1, 1);
|
|
175
|
+
}
|
|
176
|
+
static up() {
|
|
177
|
+
return new _Vec3(0, 1, 0);
|
|
178
|
+
}
|
|
179
|
+
static down() {
|
|
180
|
+
return new _Vec3(0, -1, 0);
|
|
181
|
+
}
|
|
182
|
+
static forward() {
|
|
183
|
+
return new _Vec3(0, 0, -1);
|
|
184
|
+
}
|
|
185
|
+
static right() {
|
|
186
|
+
return new _Vec3(1, 0, 0);
|
|
187
|
+
}
|
|
188
|
+
add(other) {
|
|
189
|
+
return new _Vec3(this.x + other.x, this.y + other.y, this.z + other.z);
|
|
190
|
+
}
|
|
191
|
+
sub(other) {
|
|
192
|
+
return new _Vec3(this.x - other.x, this.y - other.y, this.z - other.z);
|
|
193
|
+
}
|
|
194
|
+
mul(s) {
|
|
195
|
+
return new _Vec3(this.x * s, this.y * s, this.z * s);
|
|
196
|
+
}
|
|
197
|
+
div(s) {
|
|
198
|
+
return new _Vec3(this.x / s, this.y / s, this.z / s);
|
|
199
|
+
}
|
|
200
|
+
dot(other) {
|
|
201
|
+
return this.x * other.x + this.y * other.y + this.z * other.z;
|
|
202
|
+
}
|
|
203
|
+
cross(other) {
|
|
204
|
+
return new _Vec3(
|
|
205
|
+
this.y * other.z - this.z * other.y,
|
|
206
|
+
this.z * other.x - this.x * other.z,
|
|
207
|
+
this.x * other.y - this.y * other.x
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
length() {
|
|
211
|
+
return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
|
|
212
|
+
}
|
|
213
|
+
lengthSquared() {
|
|
214
|
+
return this.x * this.x + this.y * this.y + this.z * this.z;
|
|
215
|
+
}
|
|
216
|
+
normalize() {
|
|
217
|
+
const l = this.length();
|
|
218
|
+
return l > 0 ? this.div(l) : _Vec3.zero();
|
|
219
|
+
}
|
|
220
|
+
distanceTo(other) {
|
|
221
|
+
return this.sub(other).length();
|
|
222
|
+
}
|
|
223
|
+
lerp(other, t) {
|
|
224
|
+
return this.add(other.sub(this).mul(t));
|
|
225
|
+
}
|
|
226
|
+
toArray() {
|
|
227
|
+
return [this.x, this.y, this.z];
|
|
228
|
+
}
|
|
229
|
+
static fromArray(arr) {
|
|
230
|
+
return new _Vec3(arr[0] || 0, arr[1] || 0, arr[2] || 0);
|
|
231
|
+
}
|
|
232
|
+
equals(other, epsilon = 1e-6) {
|
|
233
|
+
return Math.abs(this.x - other.x) < epsilon && Math.abs(this.y - other.y) < epsilon && Math.abs(this.z - other.z) < epsilon;
|
|
234
|
+
}
|
|
235
|
+
toString() {
|
|
236
|
+
return `Vec3(${this.x}, ${this.y}, ${this.z})`;
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
var Quaternion = class _Quaternion {
|
|
240
|
+
constructor(x = 0, y = 0, z = 0, w = 1) {
|
|
241
|
+
this.x = x;
|
|
242
|
+
this.y = y;
|
|
243
|
+
this.z = z;
|
|
244
|
+
this.w = w;
|
|
245
|
+
}
|
|
246
|
+
static identity() {
|
|
247
|
+
return new _Quaternion(0, 0, 0, 1);
|
|
248
|
+
}
|
|
249
|
+
static fromEuler(x, y, z) {
|
|
250
|
+
const cx = Math.cos(x * 0.5), sx = Math.sin(x * 0.5);
|
|
251
|
+
const cy = Math.cos(y * 0.5), sy = Math.sin(y * 0.5);
|
|
252
|
+
const cz = Math.cos(z * 0.5), sz = Math.sin(z * 0.5);
|
|
253
|
+
return new _Quaternion(
|
|
254
|
+
sx * cy * cz - cx * sy * sz,
|
|
255
|
+
cx * sy * cz + sx * cy * sz,
|
|
256
|
+
cx * cy * sz - sx * sy * cz,
|
|
257
|
+
cx * cy * cz + sx * sy * sz
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
static fromAxisAngle(axis, angle) {
|
|
261
|
+
const half = angle * 0.5;
|
|
262
|
+
const s = Math.sin(half);
|
|
263
|
+
const n = axis.normalize();
|
|
264
|
+
return new _Quaternion(n.x * s, n.y * s, n.z * s, Math.cos(half));
|
|
265
|
+
}
|
|
266
|
+
multiply(other) {
|
|
267
|
+
return new _Quaternion(
|
|
268
|
+
this.w * other.x + this.x * other.w + this.y * other.z - this.z * other.y,
|
|
269
|
+
this.w * other.y - this.x * other.z + this.y * other.w + this.z * other.x,
|
|
270
|
+
this.w * other.z + this.x * other.y - this.y * other.x + this.z * other.w,
|
|
271
|
+
this.w * other.w - this.x * other.x - this.y * other.y - this.z * other.z
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
rotateVec3(v) {
|
|
275
|
+
const u = new Vec3(this.x, this.y, this.z);
|
|
276
|
+
const s = this.w;
|
|
277
|
+
return u.mul(2 * u.dot(v)).add(v.mul(s * s - u.dot(u))).add(u.cross(v).mul(2 * s));
|
|
278
|
+
}
|
|
279
|
+
slerp(other, t) {
|
|
280
|
+
let dot = this.x * other.x + this.y * other.y + this.z * other.z + this.w * other.w;
|
|
281
|
+
const neg = dot < 0;
|
|
282
|
+
if (neg) dot = -dot;
|
|
283
|
+
if (dot > 0.9995) {
|
|
284
|
+
const r = new _Quaternion(
|
|
285
|
+
this.x + t * ((neg ? -other.x : other.x) - this.x),
|
|
286
|
+
this.y + t * ((neg ? -other.y : other.y) - this.y),
|
|
287
|
+
this.z + t * ((neg ? -other.z : other.z) - this.z),
|
|
288
|
+
this.w + t * ((neg ? -other.w : other.w) - this.w)
|
|
289
|
+
);
|
|
290
|
+
const len = Math.sqrt(r.x * r.x + r.y * r.y + r.z * r.z + r.w * r.w);
|
|
291
|
+
return new _Quaternion(r.x / len, r.y / len, r.z / len, r.w / len);
|
|
95
292
|
}
|
|
293
|
+
const theta = Math.acos(dot);
|
|
294
|
+
const sinTheta = Math.sin(theta);
|
|
295
|
+
const a = Math.sin((1 - t) * theta) / sinTheta;
|
|
296
|
+
const b = Math.sin(t * theta) / sinTheta * (neg ? -1 : 1);
|
|
297
|
+
return new _Quaternion(
|
|
298
|
+
a * this.x + b * other.x,
|
|
299
|
+
a * this.y + b * other.y,
|
|
300
|
+
a * this.z + b * other.z,
|
|
301
|
+
a * this.w + b * other.w
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
normalize() {
|
|
305
|
+
const len = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);
|
|
306
|
+
return new _Quaternion(this.x / len, this.y / len, this.z / len, this.w / len);
|
|
307
|
+
}
|
|
308
|
+
toEuler() {
|
|
309
|
+
const sinr = 2 * (this.w * this.x + this.y * this.z);
|
|
310
|
+
const cosr = 1 - 2 * (this.x * this.x + this.y * this.y);
|
|
311
|
+
const sinp = 2 * (this.w * this.y - this.z * this.x);
|
|
312
|
+
const siny = 2 * (this.w * this.z + this.x * this.y);
|
|
313
|
+
const cosy = 1 - 2 * (this.y * this.y + this.z * this.z);
|
|
314
|
+
return new Vec3(
|
|
315
|
+
Math.atan2(sinr, cosr),
|
|
316
|
+
Math.abs(sinp) >= 1 ? Math.sign(sinp) * Math.PI / 2 : Math.asin(sinp),
|
|
317
|
+
Math.atan2(siny, cosy)
|
|
318
|
+
);
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
var Transform = class _Transform {
|
|
322
|
+
constructor(position = Vec3.zero(), rotation = Quaternion.identity(), scale = Vec3.one()) {
|
|
323
|
+
this.position = position;
|
|
324
|
+
this.rotation = rotation;
|
|
325
|
+
this.scale = scale;
|
|
326
|
+
}
|
|
327
|
+
static identity() {
|
|
328
|
+
return new _Transform();
|
|
329
|
+
}
|
|
330
|
+
transformPoint(point) {
|
|
331
|
+
const scaled = new Vec3(point.x * this.scale.x, point.y * this.scale.y, point.z * this.scale.z);
|
|
332
|
+
return this.rotation.rotateVec3(scaled).add(this.position);
|
|
333
|
+
}
|
|
334
|
+
transformDirection(dir) {
|
|
335
|
+
return this.rotation.rotateVec3(dir);
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
var Ray = class {
|
|
339
|
+
constructor(origin, direction) {
|
|
340
|
+
this.origin = origin;
|
|
341
|
+
this.direction = direction;
|
|
342
|
+
}
|
|
343
|
+
pointAt(t) {
|
|
344
|
+
return this.origin.add(this.direction.mul(t));
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
var AABB = class {
|
|
348
|
+
constructor(min, max) {
|
|
349
|
+
this.min = min;
|
|
350
|
+
this.max = max;
|
|
351
|
+
}
|
|
352
|
+
contains(point) {
|
|
353
|
+
return point.x >= this.min.x && point.x <= this.max.x && point.y >= this.min.y && point.y <= this.max.y && point.z >= this.min.z && point.z <= this.max.z;
|
|
354
|
+
}
|
|
355
|
+
intersects(other) {
|
|
356
|
+
return this.min.x <= other.max.x && this.max.x >= other.min.x && this.min.y <= other.max.y && this.max.y >= other.min.y && this.min.z <= other.max.z && this.max.z >= other.min.z;
|
|
357
|
+
}
|
|
358
|
+
center() {
|
|
359
|
+
return this.min.add(this.max).div(2);
|
|
360
|
+
}
|
|
361
|
+
size() {
|
|
362
|
+
return this.max.sub(this.min);
|
|
363
|
+
}
|
|
364
|
+
intersectsRay(ray2) {
|
|
365
|
+
let tmin = (this.min.x - ray2.origin.x) / ray2.direction.x;
|
|
366
|
+
let tmax = (this.max.x - ray2.origin.x) / ray2.direction.x;
|
|
367
|
+
if (tmin > tmax) [tmin, tmax] = [tmax, tmin];
|
|
368
|
+
let tymin = (this.min.y - ray2.origin.y) / ray2.direction.y;
|
|
369
|
+
let tymax = (this.max.y - ray2.origin.y) / ray2.direction.y;
|
|
370
|
+
if (tymin > tymax) [tymin, tymax] = [tymax, tymin];
|
|
371
|
+
if (tmin > tymax || tymin > tmax) return null;
|
|
372
|
+
tmin = Math.max(tmin, tymin);
|
|
373
|
+
tmax = Math.min(tmax, tymax);
|
|
374
|
+
let tzmin = (this.min.z - ray2.origin.z) / ray2.direction.z;
|
|
375
|
+
let tzmax = (this.max.z - ray2.origin.z) / ray2.direction.z;
|
|
376
|
+
if (tzmin > tzmax) [tzmin, tzmax] = [tzmax, tzmin];
|
|
377
|
+
if (tmin > tzmax || tzmin > tmax) return null;
|
|
378
|
+
return Math.max(tmin, tzmin);
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
function distance(a, b) {
|
|
382
|
+
return a.distanceTo(b);
|
|
96
383
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
*/
|
|
100
|
-
export function assertDefined(value, message) {
|
|
101
|
-
if (value === null || value === undefined) {
|
|
102
|
-
throw new Error(message ?? 'Value is null or undefined');
|
|
103
|
-
}
|
|
384
|
+
function lerp2(a, b, t) {
|
|
385
|
+
return a + (b - a) * t;
|
|
104
386
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
*
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
387
|
+
function clamp2(v, min, max) {
|
|
388
|
+
return Math.min(Math.max(v, min), max);
|
|
389
|
+
}
|
|
390
|
+
function degToRad2(deg) {
|
|
391
|
+
return deg * (Math.PI / 180);
|
|
392
|
+
}
|
|
393
|
+
function radToDeg2(rad) {
|
|
394
|
+
return rad * (180 / Math.PI);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// src/physics.ts
|
|
398
|
+
function createBoxCollider(halfExtents, options) {
|
|
399
|
+
return {
|
|
400
|
+
shape: "box",
|
|
401
|
+
isTrigger: false,
|
|
402
|
+
friction: 0.5,
|
|
403
|
+
restitution: 0,
|
|
404
|
+
halfExtents,
|
|
405
|
+
...options
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
function createSphereCollider(radius, options) {
|
|
409
|
+
return { shape: "sphere", isTrigger: false, friction: 0.5, restitution: 0, radius, ...options };
|
|
410
|
+
}
|
|
411
|
+
function createCapsuleCollider(radius, height, options) {
|
|
412
|
+
return {
|
|
413
|
+
shape: "capsule",
|
|
414
|
+
isTrigger: false,
|
|
415
|
+
friction: 0.5,
|
|
416
|
+
restitution: 0,
|
|
417
|
+
radius,
|
|
418
|
+
height,
|
|
419
|
+
...options
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
function createRigidbody(mass, options) {
|
|
423
|
+
return {
|
|
424
|
+
mass,
|
|
425
|
+
useGravity: true,
|
|
426
|
+
linearDamping: 0,
|
|
427
|
+
angularDamping: 0.05,
|
|
428
|
+
freezePosition: [false, false, false],
|
|
429
|
+
freezeRotation: [false, false, false],
|
|
430
|
+
isKinematic: false,
|
|
431
|
+
...options
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
// src/materials.ts
|
|
436
|
+
var MATERIAL_PRESETS = {
|
|
437
|
+
metal: { roughness: 0.2, metallic: 1 },
|
|
438
|
+
wood: { roughness: 0.85, metallic: 0, baseColor: "#8B6914" },
|
|
439
|
+
glass: { roughness: 0.05, metallic: 0, opacity: 0.3, ior: 1.5 },
|
|
440
|
+
plastic: { roughness: 0.4, metallic: 0 },
|
|
441
|
+
concrete: { roughness: 0.95, metallic: 0, baseColor: "#808080" },
|
|
442
|
+
fabric: { roughness: 0.9, metallic: 0, subsurface: 0.2 },
|
|
443
|
+
water: { roughness: 0.05, metallic: 0, opacity: 0.7, ior: 1.33 },
|
|
444
|
+
rubber: { roughness: 0.95, metallic: 0, baseColor: "#222222" },
|
|
445
|
+
marble: { roughness: 0.3, metallic: 0, baseColor: "#f0f0f0" },
|
|
446
|
+
skin: { roughness: 0.6, metallic: 0, subsurface: 0.5 },
|
|
447
|
+
foliage: { roughness: 0.8, metallic: 0, baseColor: "#2d5a27", subsurface: 0.3 },
|
|
448
|
+
chrome: { roughness: 0.05, metallic: 1, baseColor: "#cccccc" },
|
|
449
|
+
gold: { roughness: 0.2, metallic: 1, baseColor: "#ffd700" },
|
|
450
|
+
copper: { roughness: 0.3, metallic: 1, baseColor: "#b87333" },
|
|
451
|
+
ice: { roughness: 0.1, metallic: 0, opacity: 0.8, ior: 1.31 }
|
|
452
|
+
};
|
|
453
|
+
function createPBRMaterial(name, preset, overrides) {
|
|
454
|
+
const base = preset ? MATERIAL_PRESETS[preset] : {};
|
|
455
|
+
return {
|
|
456
|
+
name,
|
|
457
|
+
baseColor: "#ffffff",
|
|
458
|
+
roughness: 0.5,
|
|
459
|
+
metallic: 0,
|
|
460
|
+
...base,
|
|
461
|
+
...overrides
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
// src/events.ts
|
|
466
|
+
var EventBus = class {
|
|
467
|
+
listeners = /* @__PURE__ */ new Map();
|
|
468
|
+
wildcardListeners = [];
|
|
469
|
+
/** Register an event listener. */
|
|
470
|
+
on(event, handler) {
|
|
471
|
+
if (!this.listeners.has(event)) this.listeners.set(event, []);
|
|
472
|
+
const listener = { handler, once: false };
|
|
473
|
+
this.listeners.get(event).push(listener);
|
|
474
|
+
return () => this.off(event, handler);
|
|
475
|
+
}
|
|
476
|
+
/** Register a one-time event listener. */
|
|
477
|
+
once(event, handler) {
|
|
478
|
+
if (!this.listeners.has(event)) this.listeners.set(event, []);
|
|
479
|
+
const listener = { handler, once: true };
|
|
480
|
+
this.listeners.get(event).push(listener);
|
|
481
|
+
return () => this.off(event, handler);
|
|
482
|
+
}
|
|
483
|
+
/** Remove an event listener. */
|
|
484
|
+
off(event, handler) {
|
|
485
|
+
const list = this.listeners.get(event);
|
|
486
|
+
if (!list) return;
|
|
487
|
+
this.listeners.set(
|
|
488
|
+
event,
|
|
489
|
+
list.filter((l) => l.handler !== handler)
|
|
490
|
+
);
|
|
491
|
+
}
|
|
492
|
+
/** Emit an event to all registered listeners. */
|
|
493
|
+
emit(event, data) {
|
|
494
|
+
const list = this.listeners.get(event);
|
|
495
|
+
if (list) {
|
|
496
|
+
const remaining = [];
|
|
497
|
+
for (const l of list) {
|
|
498
|
+
l.handler(data);
|
|
499
|
+
if (!l.once) remaining.push(l);
|
|
500
|
+
}
|
|
501
|
+
this.listeners.set(event, remaining);
|
|
129
502
|
}
|
|
130
|
-
|
|
131
|
-
|
|
503
|
+
for (const l of this.wildcardListeners) {
|
|
504
|
+
l.handler({ event, data });
|
|
132
505
|
}
|
|
133
|
-
|
|
134
|
-
|
|
506
|
+
}
|
|
507
|
+
/** Listen to all events. */
|
|
508
|
+
onAny(handler) {
|
|
509
|
+
const listener = { handler, once: false };
|
|
510
|
+
this.wildcardListeners.push(listener);
|
|
511
|
+
return () => {
|
|
512
|
+
this.wildcardListeners = this.wildcardListeners.filter((l) => l !== listener);
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
/** Remove all listeners. */
|
|
516
|
+
clear() {
|
|
517
|
+
this.listeners.clear();
|
|
518
|
+
this.wildcardListeners = [];
|
|
519
|
+
}
|
|
520
|
+
/** Get count of listeners for an event (or all events). */
|
|
521
|
+
listenerCount(event) {
|
|
522
|
+
if (event) return (this.listeners.get(event) || []).length;
|
|
523
|
+
let total = this.wildcardListeners.length;
|
|
524
|
+
for (const [, list] of this.listeners) total += list.length;
|
|
525
|
+
return total;
|
|
526
|
+
}
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
// src/traits/SimulationLabPrimitives.ts
|
|
530
|
+
function isParameterRange(sweep) {
|
|
531
|
+
return "min" in sweep && "max" in sweep && "step" in sweep;
|
|
532
|
+
}
|
|
533
|
+
function expandSweep(sweep) {
|
|
534
|
+
if (!isParameterRange(sweep)) {
|
|
535
|
+
return sweep.values.slice();
|
|
536
|
+
}
|
|
537
|
+
const range = sweep;
|
|
538
|
+
if (range.step <= 0) return [range.min];
|
|
539
|
+
if (range.min > range.max) return [];
|
|
540
|
+
const values = [];
|
|
541
|
+
for (let v = range.min; v <= range.max + range.step * 1e-3; v += range.step) {
|
|
542
|
+
values.push(Math.round(v * 1e10) / 1e10);
|
|
543
|
+
}
|
|
544
|
+
return values;
|
|
545
|
+
}
|
|
546
|
+
function generateSweepCombinations(sweeps) {
|
|
547
|
+
if (sweeps.length === 0) return [{}];
|
|
548
|
+
const expanded = sweeps.map((s) => ({
|
|
549
|
+
name: s.name,
|
|
550
|
+
values: expandSweep(s)
|
|
551
|
+
}));
|
|
552
|
+
let combinations = [{}];
|
|
553
|
+
for (const { name, values } of expanded) {
|
|
554
|
+
const newCombinations = [];
|
|
555
|
+
for (const combo of combinations) {
|
|
556
|
+
for (const val of values) {
|
|
557
|
+
newCombinations.push({ ...combo, [name]: val });
|
|
558
|
+
}
|
|
135
559
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
560
|
+
combinations = newCombinations;
|
|
561
|
+
}
|
|
562
|
+
return combinations;
|
|
563
|
+
}
|
|
564
|
+
function mean(data) {
|
|
565
|
+
if (data.length === 0) return 0;
|
|
566
|
+
return data.reduce((sum, v) => sum + v, 0) / data.length;
|
|
567
|
+
}
|
|
568
|
+
function variance(data) {
|
|
569
|
+
if (data.length < 2) return 0;
|
|
570
|
+
const m = mean(data);
|
|
571
|
+
const squaredDiffs = data.reduce((sum, v) => sum + (v - m) ** 2, 0);
|
|
572
|
+
return squaredDiffs / (data.length - 1);
|
|
573
|
+
}
|
|
574
|
+
function standardDeviation(data) {
|
|
575
|
+
return Math.sqrt(variance(data));
|
|
576
|
+
}
|
|
577
|
+
function standardError(data) {
|
|
578
|
+
if (data.length === 0) return 0;
|
|
579
|
+
return standardDeviation(data) / Math.sqrt(data.length);
|
|
580
|
+
}
|
|
581
|
+
function cohensD(group1, group2) {
|
|
582
|
+
if (group1.length < 2 || group2.length < 2) return 0;
|
|
583
|
+
const m1 = mean(group1);
|
|
584
|
+
const m2 = mean(group2);
|
|
585
|
+
const v1 = variance(group1);
|
|
586
|
+
const v2 = variance(group2);
|
|
587
|
+
const n1 = group1.length;
|
|
588
|
+
const n2 = group2.length;
|
|
589
|
+
const pooledVar = ((n1 - 1) * v1 + (n2 - 1) * v2) / (n1 + n2 - 2);
|
|
590
|
+
const pooledStd = Math.sqrt(pooledVar);
|
|
591
|
+
if (pooledStd === 0) return 0;
|
|
592
|
+
return (m1 - m2) / pooledStd;
|
|
593
|
+
}
|
|
594
|
+
function tTest(group1, group2, alpha = 0.05, direction = "different") {
|
|
595
|
+
const n1 = group1.length;
|
|
596
|
+
const n2 = group2.length;
|
|
597
|
+
if (n1 < 2 || n2 < 2) {
|
|
598
|
+
return {
|
|
599
|
+
statistic: 0,
|
|
600
|
+
pValue: 1,
|
|
601
|
+
significant: false,
|
|
602
|
+
confidenceInterval: [0, 0],
|
|
603
|
+
effectSize: 0,
|
|
604
|
+
testName: "welch_t_test",
|
|
605
|
+
sampleSize: n1 + n2
|
|
606
|
+
};
|
|
607
|
+
}
|
|
608
|
+
const m1 = mean(group1);
|
|
609
|
+
const m2 = mean(group2);
|
|
610
|
+
const v1 = variance(group1);
|
|
611
|
+
const v2 = variance(group2);
|
|
612
|
+
const se = Math.sqrt(v1 / n1 + v2 / n2);
|
|
613
|
+
if (se === 0) {
|
|
614
|
+
return {
|
|
615
|
+
statistic: 0,
|
|
616
|
+
pValue: m1 === m2 ? 1 : 0,
|
|
617
|
+
significant: m1 !== m2,
|
|
618
|
+
confidenceInterval: [m1 - m2, m1 - m2],
|
|
619
|
+
effectSize: 0,
|
|
620
|
+
testName: "welch_t_test",
|
|
621
|
+
sampleSize: n1 + n2
|
|
622
|
+
};
|
|
623
|
+
}
|
|
624
|
+
const t = (m1 - m2) / se;
|
|
625
|
+
const num = (v1 / n1 + v2 / n2) ** 2;
|
|
626
|
+
const den = (v1 / n1) ** 2 / (n1 - 1) + (v2 / n2) ** 2 / (n2 - 1);
|
|
627
|
+
const df = num / den;
|
|
628
|
+
const pTwoTailed = tDistPValue(Math.abs(t), df);
|
|
629
|
+
let pValue;
|
|
630
|
+
switch (direction) {
|
|
631
|
+
case "greater":
|
|
632
|
+
pValue = t > 0 ? pTwoTailed / 2 : 1 - pTwoTailed / 2;
|
|
633
|
+
break;
|
|
634
|
+
case "less":
|
|
635
|
+
pValue = t < 0 ? pTwoTailed / 2 : 1 - pTwoTailed / 2;
|
|
636
|
+
break;
|
|
637
|
+
case "equal":
|
|
638
|
+
pValue = 1 - pTwoTailed;
|
|
639
|
+
break;
|
|
640
|
+
default:
|
|
641
|
+
pValue = pTwoTailed;
|
|
642
|
+
}
|
|
643
|
+
const tCrit = tDistCritical(alpha, df);
|
|
644
|
+
const diff = m1 - m2;
|
|
645
|
+
const ci = [diff - tCrit * se, diff + tCrit * se];
|
|
646
|
+
return {
|
|
647
|
+
statistic: t,
|
|
648
|
+
pValue,
|
|
649
|
+
significant: pValue < alpha,
|
|
650
|
+
confidenceInterval: ci,
|
|
651
|
+
effectSize: cohensD(group1, group2),
|
|
652
|
+
testName: "welch_t_test",
|
|
653
|
+
sampleSize: n1 + n2
|
|
654
|
+
};
|
|
655
|
+
}
|
|
656
|
+
function oneSampleTTest(data, populationMean, alpha = 0.05, direction = "different") {
|
|
657
|
+
const n = data.length;
|
|
658
|
+
if (n < 2) {
|
|
659
|
+
return {
|
|
660
|
+
statistic: 0,
|
|
661
|
+
pValue: 1,
|
|
662
|
+
significant: false,
|
|
663
|
+
confidenceInterval: [0, 0],
|
|
664
|
+
effectSize: 0,
|
|
665
|
+
testName: "one_sample_t_test",
|
|
666
|
+
sampleSize: n
|
|
667
|
+
};
|
|
668
|
+
}
|
|
669
|
+
const m = mean(data);
|
|
670
|
+
const se = standardError(data);
|
|
671
|
+
if (se === 0) {
|
|
672
|
+
return {
|
|
673
|
+
statistic: 0,
|
|
674
|
+
pValue: m === populationMean ? 1 : 0,
|
|
675
|
+
significant: m !== populationMean,
|
|
676
|
+
confidenceInterval: [m, m],
|
|
677
|
+
effectSize: 0,
|
|
678
|
+
testName: "one_sample_t_test",
|
|
679
|
+
sampleSize: n
|
|
680
|
+
};
|
|
681
|
+
}
|
|
682
|
+
const t = (m - populationMean) / se;
|
|
683
|
+
const df = n - 1;
|
|
684
|
+
const pTwoTailed = tDistPValue(Math.abs(t), df);
|
|
685
|
+
let pValue;
|
|
686
|
+
switch (direction) {
|
|
687
|
+
case "greater":
|
|
688
|
+
pValue = t > 0 ? pTwoTailed / 2 : 1 - pTwoTailed / 2;
|
|
689
|
+
break;
|
|
690
|
+
case "less":
|
|
691
|
+
pValue = t < 0 ? pTwoTailed / 2 : 1 - pTwoTailed / 2;
|
|
692
|
+
break;
|
|
693
|
+
default:
|
|
694
|
+
pValue = pTwoTailed;
|
|
695
|
+
}
|
|
696
|
+
const tCrit = tDistCritical(alpha, df);
|
|
697
|
+
const ci = [m - tCrit * se, m + tCrit * se];
|
|
698
|
+
const sd = standardDeviation(data);
|
|
699
|
+
const effectSize = sd > 0 ? (m - populationMean) / sd : 0;
|
|
700
|
+
return {
|
|
701
|
+
statistic: t,
|
|
702
|
+
pValue,
|
|
703
|
+
significant: pValue < alpha,
|
|
704
|
+
confidenceInterval: ci,
|
|
705
|
+
effectSize,
|
|
706
|
+
testName: "one_sample_t_test",
|
|
707
|
+
sampleSize: n
|
|
708
|
+
};
|
|
709
|
+
}
|
|
710
|
+
function mannWhitneyU(group1, group2, alpha = 0.05) {
|
|
711
|
+
const n1 = group1.length;
|
|
712
|
+
const n2 = group2.length;
|
|
713
|
+
if (n1 === 0 || n2 === 0) {
|
|
714
|
+
return {
|
|
715
|
+
statistic: 0,
|
|
716
|
+
pValue: 1,
|
|
717
|
+
significant: false,
|
|
718
|
+
confidenceInterval: [0, 0],
|
|
719
|
+
effectSize: 0,
|
|
720
|
+
testName: "mann_whitney_u",
|
|
721
|
+
sampleSize: n1 + n2
|
|
722
|
+
};
|
|
723
|
+
}
|
|
724
|
+
let u1 = 0;
|
|
725
|
+
for (const a of group1) {
|
|
726
|
+
for (const b of group2) {
|
|
727
|
+
if (a > b) u1++;
|
|
728
|
+
else if (a === b) u1 += 0.5;
|
|
141
729
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
*
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
730
|
+
}
|
|
731
|
+
const u2 = n1 * n2 - u1;
|
|
732
|
+
const u = Math.min(u1, u2);
|
|
733
|
+
const meanU = n1 * n2 / 2;
|
|
734
|
+
const sigmaU = Math.sqrt(n1 * n2 * (n1 + n2 + 1) / 12);
|
|
735
|
+
if (sigmaU === 0) {
|
|
736
|
+
return {
|
|
737
|
+
statistic: u,
|
|
738
|
+
pValue: 1,
|
|
739
|
+
significant: false,
|
|
740
|
+
confidenceInterval: [0, 0],
|
|
741
|
+
effectSize: 0,
|
|
742
|
+
testName: "mann_whitney_u",
|
|
743
|
+
sampleSize: n1 + n2
|
|
744
|
+
};
|
|
745
|
+
}
|
|
746
|
+
const z = (u - meanU) / sigmaU;
|
|
747
|
+
const pValue = 2 * normalCDF(-Math.abs(z));
|
|
748
|
+
const effectSize = 1 - 2 * u / (n1 * n2);
|
|
749
|
+
return {
|
|
750
|
+
statistic: u,
|
|
751
|
+
pValue,
|
|
752
|
+
significant: pValue < alpha,
|
|
753
|
+
confidenceInterval: [0, 0],
|
|
754
|
+
// CI not standard for U-test
|
|
755
|
+
effectSize,
|
|
756
|
+
testName: "mann_whitney_u",
|
|
757
|
+
sampleSize: n1 + n2
|
|
758
|
+
};
|
|
759
|
+
}
|
|
760
|
+
function chiSquaredTest(observed, expected, alpha = 0.05) {
|
|
761
|
+
if (observed.length !== expected.length || observed.length === 0) {
|
|
762
|
+
return {
|
|
763
|
+
statistic: 0,
|
|
764
|
+
pValue: 1,
|
|
765
|
+
significant: false,
|
|
766
|
+
confidenceInterval: [0, 0],
|
|
767
|
+
effectSize: 0,
|
|
768
|
+
testName: "chi_squared",
|
|
769
|
+
sampleSize: 0
|
|
770
|
+
};
|
|
771
|
+
}
|
|
772
|
+
let chiSq = 0;
|
|
773
|
+
let totalObserved = 0;
|
|
774
|
+
for (let i = 0; i < observed.length; i++) {
|
|
775
|
+
if (expected[i] <= 0) continue;
|
|
776
|
+
chiSq += (observed[i] - expected[i]) ** 2 / expected[i];
|
|
777
|
+
totalObserved += observed[i];
|
|
778
|
+
}
|
|
779
|
+
const df = observed.length - 1;
|
|
780
|
+
if (df <= 0) {
|
|
781
|
+
return {
|
|
782
|
+
statistic: chiSq,
|
|
783
|
+
pValue: 1,
|
|
784
|
+
significant: false,
|
|
785
|
+
confidenceInterval: [0, 0],
|
|
786
|
+
effectSize: 0,
|
|
787
|
+
testName: "chi_squared",
|
|
788
|
+
sampleSize: totalObserved
|
|
789
|
+
};
|
|
790
|
+
}
|
|
791
|
+
const pValue = chiSquaredPValue(chiSq, df);
|
|
792
|
+
const k = observed.length;
|
|
793
|
+
const effectSize = totalObserved > 0 ? Math.sqrt(chiSq / (totalObserved * (k - 1))) : 0;
|
|
794
|
+
return {
|
|
795
|
+
statistic: chiSq,
|
|
796
|
+
pValue,
|
|
797
|
+
significant: pValue < alpha,
|
|
798
|
+
confidenceInterval: [0, 0],
|
|
799
|
+
effectSize,
|
|
800
|
+
testName: "chi_squared",
|
|
801
|
+
sampleSize: totalObserved
|
|
802
|
+
};
|
|
803
|
+
}
|
|
804
|
+
function extractMetric(results, metricName) {
|
|
805
|
+
return results.filter((r) => metricName in r.values).map((r) => r.values[metricName]);
|
|
806
|
+
}
|
|
807
|
+
function groupByParameter(results, paramName) {
|
|
808
|
+
const groups = /* @__PURE__ */ new Map();
|
|
809
|
+
for (const r of results) {
|
|
810
|
+
const val = r.params[paramName];
|
|
811
|
+
if (val === void 0) continue;
|
|
812
|
+
if (!groups.has(val)) groups.set(val, []);
|
|
813
|
+
groups.get(val).push(r);
|
|
814
|
+
}
|
|
815
|
+
return groups;
|
|
816
|
+
}
|
|
817
|
+
function summarizeMetrics(results, metricName) {
|
|
818
|
+
const values = extractMetric(results, metricName);
|
|
819
|
+
if (values.length === 0) {
|
|
820
|
+
return { mean: 0, std: 0, min: 0, max: 0, n: 0 };
|
|
821
|
+
}
|
|
822
|
+
return {
|
|
823
|
+
mean: mean(values),
|
|
824
|
+
std: standardDeviation(values),
|
|
825
|
+
min: Math.min(...values),
|
|
826
|
+
max: Math.max(...values),
|
|
827
|
+
n: values.length
|
|
828
|
+
};
|
|
829
|
+
}
|
|
830
|
+
function normalCDF(x) {
|
|
831
|
+
if (x < -8) return 0;
|
|
832
|
+
if (x > 8) return 1;
|
|
833
|
+
const a1 = 0.254829592;
|
|
834
|
+
const a2 = -0.284496736;
|
|
835
|
+
const a3 = 1.421413741;
|
|
836
|
+
const a4 = -1.453152027;
|
|
837
|
+
const a5 = 1.061405429;
|
|
838
|
+
const p = 0.3275911;
|
|
839
|
+
const sign2 = x < 0 ? -1 : 1;
|
|
840
|
+
const absX = Math.abs(x);
|
|
841
|
+
const t = 1 / (1 + p * absX);
|
|
842
|
+
const y = 1 - ((((a5 * t + a4) * t + a3) * t + a2) * t + a1) * t * Math.exp(-absX * absX / 2);
|
|
843
|
+
return 0.5 * (1 + sign2 * y);
|
|
844
|
+
}
|
|
845
|
+
function tDistPValue(absT, df) {
|
|
846
|
+
if (df <= 0) return 1;
|
|
847
|
+
const z = absT * (1 - 1 / (4 * df)) / Math.sqrt(1 + absT * absT / (2 * df));
|
|
848
|
+
return 2 * (1 - normalCDF(z));
|
|
849
|
+
}
|
|
850
|
+
function tDistCritical(alpha, df) {
|
|
851
|
+
const p = 1 - alpha / 2;
|
|
852
|
+
const a = p - 0.5;
|
|
853
|
+
const r = a * a;
|
|
854
|
+
let z = a * (2.50662823884 + r * (-18.61500062529 + r * (41.39119773534 + r * -25.44106049637))) / (1 + r * (-8.4735109309 + r * (23.08336743743 + r * (-21.06224101826 + r * 3.13082909833))));
|
|
855
|
+
const g1 = (z ** 3 + z) / (4 * df);
|
|
856
|
+
const g2 = (5 * z ** 5 + 16 * z ** 3 + 3 * z) / (96 * df * df);
|
|
857
|
+
z = z + g1 + g2;
|
|
858
|
+
return Math.abs(z);
|
|
859
|
+
}
|
|
860
|
+
function chiSquaredPValue(chiSq, df) {
|
|
861
|
+
if (df <= 0) return 1;
|
|
862
|
+
if (chiSq <= 0) return 1;
|
|
863
|
+
const z = Math.pow(chiSq / df, 1 / 3) - (1 - 2 / (9 * df));
|
|
864
|
+
const denom = Math.sqrt(2 / (9 * df));
|
|
865
|
+
return 1 - normalCDF(z / denom);
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
// src/traits/SimulationLabTraits.ts
|
|
869
|
+
var SimulationLabTraits = {
|
|
870
|
+
simulation_lab: {
|
|
871
|
+
name: "@simulation_lab",
|
|
872
|
+
description: "Attaches scientific hypothesis testing to any HoloScript composition. Enables parameter sweeps, multi-epoch execution, statistical analysis, and exportable results. The universe gets one sample \u2014 HoloScript gives you infinite. Results are marketplace-sellable as verified simulation data.",
|
|
873
|
+
params: {
|
|
874
|
+
hypothesis: {
|
|
875
|
+
type: "string",
|
|
876
|
+
required: true,
|
|
877
|
+
description: "Human-readable hypothesis description."
|
|
878
|
+
},
|
|
879
|
+
null_hypothesis: {
|
|
880
|
+
type: "string",
|
|
881
|
+
required: false,
|
|
882
|
+
default: "",
|
|
883
|
+
description: "Formal null hypothesis (H0). Auto-generated if empty."
|
|
884
|
+
},
|
|
885
|
+
alternative_hypothesis: {
|
|
886
|
+
type: "string",
|
|
887
|
+
required: false,
|
|
888
|
+
default: "",
|
|
889
|
+
description: "Formal alternative hypothesis (H1). Auto-generated if empty."
|
|
890
|
+
},
|
|
891
|
+
direction: {
|
|
892
|
+
type: "string",
|
|
893
|
+
required: false,
|
|
894
|
+
default: "different",
|
|
895
|
+
description: "Expected direction of effect: greater | less | different | equal."
|
|
896
|
+
},
|
|
897
|
+
epochs: {
|
|
898
|
+
type: "number",
|
|
899
|
+
required: false,
|
|
900
|
+
default: 1e3,
|
|
901
|
+
description: "Number of simulation runs per parameter combination. More = higher power."
|
|
902
|
+
},
|
|
903
|
+
seed_start: {
|
|
904
|
+
type: "number",
|
|
905
|
+
required: false,
|
|
906
|
+
default: 0,
|
|
907
|
+
description: "Starting seed for reproducibility. Seeds increment per epoch."
|
|
908
|
+
},
|
|
909
|
+
confidence_level: {
|
|
910
|
+
type: "number",
|
|
911
|
+
required: false,
|
|
912
|
+
default: 0.95,
|
|
913
|
+
description: "Confidence level for statistical tests (0.0 - 1.0). Default 0.95 = \u03B1=0.05."
|
|
914
|
+
},
|
|
915
|
+
metrics: {
|
|
916
|
+
type: "string[]",
|
|
917
|
+
required: true,
|
|
918
|
+
description: "List of metric names to collect each epoch. Must match emitted metric events."
|
|
919
|
+
},
|
|
920
|
+
statistical_test: {
|
|
921
|
+
type: "string",
|
|
922
|
+
required: false,
|
|
923
|
+
default: "auto",
|
|
924
|
+
description: "Statistical test to use: t_test | mann_whitney_u | chi_squared | auto. Auto selects based on data distribution."
|
|
925
|
+
},
|
|
926
|
+
export_training_data: {
|
|
927
|
+
type: "boolean",
|
|
928
|
+
required: false,
|
|
929
|
+
default: false,
|
|
930
|
+
description: "Whether to export results as training data for DataForge pipeline."
|
|
931
|
+
},
|
|
932
|
+
marketplace_publishable: {
|
|
933
|
+
type: "boolean",
|
|
934
|
+
required: false,
|
|
935
|
+
default: false,
|
|
936
|
+
description: "Whether to package results for marketplace listing as verified simulation data."
|
|
937
|
+
},
|
|
938
|
+
max_duration_ms: {
|
|
939
|
+
type: "number",
|
|
940
|
+
required: false,
|
|
941
|
+
default: 3e5,
|
|
942
|
+
description: "Maximum wall-clock time for the entire experiment (5 min default). Prevents runaway simulations."
|
|
943
|
+
},
|
|
944
|
+
worker_count: {
|
|
945
|
+
type: "number",
|
|
946
|
+
required: false,
|
|
947
|
+
default: 4,
|
|
948
|
+
description: "Number of parallel workers for epoch execution."
|
|
949
|
+
}
|
|
950
|
+
},
|
|
951
|
+
validator: (params) => {
|
|
952
|
+
if (!params.hypothesis || typeof params.hypothesis !== "string") return false;
|
|
953
|
+
if (!params.metrics || !Array.isArray(params.metrics) || params.metrics.length === 0)
|
|
151
954
|
return false;
|
|
152
|
-
|
|
955
|
+
if (params.epochs !== void 0 && (params.epochs < 1 || params.epochs > 1e6))
|
|
153
956
|
return false;
|
|
154
|
-
|
|
957
|
+
if (params.confidence_level !== void 0 && (params.confidence_level <= 0 || params.confidence_level >= 1))
|
|
155
958
|
return false;
|
|
156
|
-
|
|
157
|
-
if (
|
|
158
|
-
|
|
159
|
-
|
|
959
|
+
if (params.direction !== void 0) {
|
|
960
|
+
if (!["greater", "less", "different", "equal"].includes(params.direction)) return false;
|
|
961
|
+
}
|
|
962
|
+
if (params.statistical_test !== void 0) {
|
|
963
|
+
if (!["t_test", "mann_whitney_u", "chi_squared", "auto"].includes(params.statistical_test))
|
|
964
|
+
return false;
|
|
965
|
+
}
|
|
966
|
+
return true;
|
|
967
|
+
},
|
|
968
|
+
composesWith: [
|
|
969
|
+
"@tradeable",
|
|
970
|
+
"@depreciating",
|
|
971
|
+
"@bonding_curved",
|
|
972
|
+
"@taxable_wealth",
|
|
973
|
+
"@pid_controlled"
|
|
974
|
+
],
|
|
975
|
+
compiler_hints: {
|
|
976
|
+
requires_runtime: [
|
|
977
|
+
"SimulationRuntime.runExperiment",
|
|
978
|
+
"SimulationRuntime.collectMetrics",
|
|
979
|
+
"SimulationRuntime.runStatisticalTest",
|
|
980
|
+
"SimulationRuntime.exportResults"
|
|
981
|
+
],
|
|
982
|
+
thread_safety: "worker_thread",
|
|
983
|
+
performance_budget_ms: 3e5,
|
|
984
|
+
// Experiment budget, not per-frame
|
|
985
|
+
batch_mode: true
|
|
160
986
|
}
|
|
161
|
-
|
|
162
|
-
|
|
987
|
+
}
|
|
988
|
+
};
|
|
989
|
+
function getSimulationTraitNames() {
|
|
990
|
+
return Object.keys(SimulationLabTraits).map((k) => SimulationLabTraits[k].name);
|
|
991
|
+
}
|
|
992
|
+
function getSimulationTrait(name) {
|
|
993
|
+
const key = name.startsWith("@") ? name.slice(1) : name;
|
|
994
|
+
return SimulationLabTraits[key];
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
// src/index.ts
|
|
998
|
+
function print(...args) {
|
|
999
|
+
console.log(...args);
|
|
1000
|
+
}
|
|
1001
|
+
function printError(...args) {
|
|
1002
|
+
console.error(...args);
|
|
1003
|
+
}
|
|
1004
|
+
function printWarn(...args) {
|
|
1005
|
+
console.warn(...args);
|
|
1006
|
+
}
|
|
1007
|
+
function assert(condition, message) {
|
|
1008
|
+
if (!condition) {
|
|
1009
|
+
throw new Error(message ?? "Assertion failed");
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
function assertDefined(value, message) {
|
|
1013
|
+
if (value === null || value === void 0) {
|
|
1014
|
+
throw new Error(message ?? "Value is null or undefined");
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
function unreachable(message) {
|
|
1018
|
+
throw new Error(message ?? "Unreachable code reached");
|
|
1019
|
+
}
|
|
1020
|
+
function todo(message) {
|
|
1021
|
+
throw new Error(`Not implemented: ${message ?? "No details"}`);
|
|
1022
|
+
}
|
|
1023
|
+
function clone(value) {
|
|
1024
|
+
if (value === null || typeof value !== "object") {
|
|
1025
|
+
return value;
|
|
1026
|
+
}
|
|
1027
|
+
if (Array.isArray(value)) {
|
|
1028
|
+
return value.map(clone);
|
|
1029
|
+
}
|
|
1030
|
+
if (value instanceof Date) {
|
|
1031
|
+
return new Date(value.getTime());
|
|
1032
|
+
}
|
|
1033
|
+
if (value instanceof Map) {
|
|
1034
|
+
return new Map([...value].map(([k, v]) => [clone(k), clone(v)]));
|
|
1035
|
+
}
|
|
1036
|
+
if (value instanceof Set) {
|
|
1037
|
+
return new Set([...value].map(clone));
|
|
1038
|
+
}
|
|
1039
|
+
const result = {};
|
|
1040
|
+
for (const key in value) {
|
|
1041
|
+
if (Object.prototype.hasOwnProperty.call(value, key)) {
|
|
1042
|
+
result[key] = clone(value[key]);
|
|
163
1043
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
1044
|
+
}
|
|
1045
|
+
return result;
|
|
1046
|
+
}
|
|
1047
|
+
function equals(a, b) {
|
|
1048
|
+
if (a === b) return true;
|
|
1049
|
+
if (a === null || b === null) return false;
|
|
1050
|
+
if (typeof a !== typeof b) return false;
|
|
1051
|
+
if (typeof a !== "object") return false;
|
|
1052
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
1053
|
+
if (a.length !== b.length) return false;
|
|
1054
|
+
return a.every((item, i) => equals(item, b[i]));
|
|
1055
|
+
}
|
|
1056
|
+
if (a instanceof Date && b instanceof Date) {
|
|
1057
|
+
return a.getTime() === b.getTime();
|
|
1058
|
+
}
|
|
1059
|
+
if (a instanceof Map && b instanceof Map) {
|
|
1060
|
+
if (a.size !== b.size) return false;
|
|
1061
|
+
for (const [key, value] of a) {
|
|
1062
|
+
if (!b.has(key) || !equals(value, b.get(key))) return false;
|
|
172
1063
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
180
|
-
return true;
|
|
1064
|
+
return true;
|
|
1065
|
+
}
|
|
1066
|
+
if (a instanceof Set && b instanceof Set) {
|
|
1067
|
+
if (a.size !== b.size) return false;
|
|
1068
|
+
for (const value of a) {
|
|
1069
|
+
if (!b.has(value)) return false;
|
|
181
1070
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
1071
|
+
return true;
|
|
1072
|
+
}
|
|
1073
|
+
const keysA = Object.keys(a);
|
|
1074
|
+
const keysB = Object.keys(b);
|
|
1075
|
+
if (keysA.length !== keysB.length) return false;
|
|
1076
|
+
return keysA.every(
|
|
1077
|
+
(key) => equals(a[key], b[key])
|
|
1078
|
+
);
|
|
187
1079
|
}
|
|
188
|
-
|
|
189
|
-
|
|
1080
|
+
function pipe(value, ...fns) {
|
|
1081
|
+
return fns.reduce((acc, fn) => fn(acc), value);
|
|
190
1082
|
}
|
|
191
|
-
|
|
192
|
-
|
|
1083
|
+
function compose(...fns) {
|
|
1084
|
+
return (value) => fns.reduceRight((acc, fn) => fn(acc), value);
|
|
193
1085
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
return value;
|
|
1086
|
+
function identity(value) {
|
|
1087
|
+
return value;
|
|
1088
|
+
}
|
|
1089
|
+
function noop() {
|
|
199
1090
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
*/
|
|
203
|
-
export function noop() { }
|
|
204
|
-
/**
|
|
205
|
-
* Create a constant function
|
|
206
|
-
*/
|
|
207
|
-
export function constant(value) {
|
|
208
|
-
return () => value;
|
|
1091
|
+
function constant(value) {
|
|
1092
|
+
return () => value;
|
|
209
1093
|
}
|
|
1094
|
+
export {
|
|
1095
|
+
AABB,
|
|
1096
|
+
CountdownTimer,
|
|
1097
|
+
DEFAULT_BONDING_CURVE,
|
|
1098
|
+
DEFAULT_DEPRECIATION,
|
|
1099
|
+
DEFAULT_PID,
|
|
1100
|
+
DEFAULT_WEALTH_TAX,
|
|
1101
|
+
DEG_TO_RAD,
|
|
1102
|
+
DateTime,
|
|
1103
|
+
EPSILON,
|
|
1104
|
+
EconomicTraits,
|
|
1105
|
+
EventBus,
|
|
1106
|
+
FrameTimer,
|
|
1107
|
+
HALF_PI,
|
|
1108
|
+
HoloMap,
|
|
1109
|
+
HoloSet,
|
|
1110
|
+
IntervalTimer,
|
|
1111
|
+
List,
|
|
1112
|
+
MATERIAL_PRESETS,
|
|
1113
|
+
HoloMap as Map,
|
|
1114
|
+
PI,
|
|
1115
|
+
PriorityQueue,
|
|
1116
|
+
Quaternion,
|
|
1117
|
+
RAD_TO_DEG,
|
|
1118
|
+
Ray,
|
|
1119
|
+
HoloSet as Set,
|
|
1120
|
+
SimulationLabTraits,
|
|
1121
|
+
SpatialGrid,
|
|
1122
|
+
Stopwatch,
|
|
1123
|
+
TAU,
|
|
1124
|
+
Transform,
|
|
1125
|
+
Vec3,
|
|
1126
|
+
aabb,
|
|
1127
|
+
aabbMath,
|
|
1128
|
+
arrayToQuat,
|
|
1129
|
+
arrayToVec3,
|
|
1130
|
+
assert,
|
|
1131
|
+
assertDefined,
|
|
1132
|
+
bondingCurveBuyCost,
|
|
1133
|
+
bondingCurvePrice,
|
|
1134
|
+
bondingCurveSellRefund,
|
|
1135
|
+
calculateDepreciation,
|
|
1136
|
+
calculateRedistribution,
|
|
1137
|
+
calculateRepairCost,
|
|
1138
|
+
calculateTaxAmount,
|
|
1139
|
+
calculateTaxRate,
|
|
1140
|
+
camelCase,
|
|
1141
|
+
capitalize,
|
|
1142
|
+
center,
|
|
1143
|
+
chars,
|
|
1144
|
+
chiSquaredTest,
|
|
1145
|
+
clamp,
|
|
1146
|
+
clone,
|
|
1147
|
+
cohensD,
|
|
1148
|
+
collapseWhitespace,
|
|
1149
|
+
colorToHex,
|
|
1150
|
+
compose,
|
|
1151
|
+
constant,
|
|
1152
|
+
constantCase,
|
|
1153
|
+
containsIgnoreCase,
|
|
1154
|
+
count,
|
|
1155
|
+
createBoxCollider,
|
|
1156
|
+
createCapsuleCollider,
|
|
1157
|
+
createDualLoopPIDState,
|
|
1158
|
+
createFaucetSinkMetrics,
|
|
1159
|
+
createPBRMaterial,
|
|
1160
|
+
createPIDState,
|
|
1161
|
+
createRigidbody,
|
|
1162
|
+
createSphereCollider,
|
|
1163
|
+
createTicker,
|
|
1164
|
+
debounce,
|
|
1165
|
+
dedent,
|
|
1166
|
+
degToRad,
|
|
1167
|
+
depreciatedValue,
|
|
1168
|
+
distance,
|
|
1169
|
+
endsWithIgnoreCase,
|
|
1170
|
+
equals,
|
|
1171
|
+
escapeHtml,
|
|
1172
|
+
escapeRegex,
|
|
1173
|
+
executeTrade,
|
|
1174
|
+
expandSweep,
|
|
1175
|
+
extractMetric,
|
|
1176
|
+
extractTraits,
|
|
1177
|
+
format,
|
|
1178
|
+
formatBytes,
|
|
1179
|
+
formatDuration,
|
|
1180
|
+
formatNumber,
|
|
1181
|
+
fract,
|
|
1182
|
+
fs_exports as fs,
|
|
1183
|
+
generateSweepCombinations,
|
|
1184
|
+
generateTxHash,
|
|
1185
|
+
getEconomicTrait,
|
|
1186
|
+
getEconomicTraitNames,
|
|
1187
|
+
getRequiredPermissions,
|
|
1188
|
+
getSimulationTrait,
|
|
1189
|
+
getSimulationTraitNames,
|
|
1190
|
+
groupByParameter,
|
|
1191
|
+
hrTime,
|
|
1192
|
+
hsl,
|
|
1193
|
+
identity,
|
|
1194
|
+
indent,
|
|
1195
|
+
inverseLerp,
|
|
1196
|
+
isAlpha,
|
|
1197
|
+
isAlphanumeric,
|
|
1198
|
+
isBlank,
|
|
1199
|
+
isDestroyed,
|
|
1200
|
+
isNotBlank,
|
|
1201
|
+
isNumeric,
|
|
1202
|
+
isParameterRange,
|
|
1203
|
+
isValidIdentifier,
|
|
1204
|
+
join,
|
|
1205
|
+
kebabCase,
|
|
1206
|
+
lerp,
|
|
1207
|
+
levenshtein,
|
|
1208
|
+
lines,
|
|
1209
|
+
mannWhitneyU,
|
|
1210
|
+
mean,
|
|
1211
|
+
measure,
|
|
1212
|
+
mod,
|
|
1213
|
+
noise,
|
|
1214
|
+
noop,
|
|
1215
|
+
now,
|
|
1216
|
+
numberWithCommas,
|
|
1217
|
+
oneSampleTTest,
|
|
1218
|
+
padLeft,
|
|
1219
|
+
padRight,
|
|
1220
|
+
parseColor,
|
|
1221
|
+
pascalCase,
|
|
1222
|
+
pipe,
|
|
1223
|
+
print,
|
|
1224
|
+
printError,
|
|
1225
|
+
printWarn,
|
|
1226
|
+
quat,
|
|
1227
|
+
quatMath,
|
|
1228
|
+
quatToArray,
|
|
1229
|
+
radToDeg,
|
|
1230
|
+
random,
|
|
1231
|
+
randomString,
|
|
1232
|
+
ray,
|
|
1233
|
+
recordFaucet,
|
|
1234
|
+
recordSink,
|
|
1235
|
+
remap,
|
|
1236
|
+
removePrefix,
|
|
1237
|
+
removeSuffix,
|
|
1238
|
+
removeWhitespace,
|
|
1239
|
+
repeat,
|
|
1240
|
+
resetMetricsPeriod,
|
|
1241
|
+
retry,
|
|
1242
|
+
reverse,
|
|
1243
|
+
rgb,
|
|
1244
|
+
rgba,
|
|
1245
|
+
schedule,
|
|
1246
|
+
scheduleFrame,
|
|
1247
|
+
scheduleInterval,
|
|
1248
|
+
sign,
|
|
1249
|
+
similarity,
|
|
1250
|
+
sleep,
|
|
1251
|
+
slugify,
|
|
1252
|
+
smootherstep,
|
|
1253
|
+
smoothstep,
|
|
1254
|
+
snakeCase,
|
|
1255
|
+
clamp2 as spatialClamp,
|
|
1256
|
+
degToRad2 as spatialDegToRad,
|
|
1257
|
+
lerp2 as spatialLerp,
|
|
1258
|
+
spatialPrice,
|
|
1259
|
+
radToDeg2 as spatialRadToDeg,
|
|
1260
|
+
standardDeviation,
|
|
1261
|
+
standardError,
|
|
1262
|
+
startsWithIgnoreCase,
|
|
1263
|
+
step,
|
|
1264
|
+
summarizeMetrics,
|
|
1265
|
+
tTest,
|
|
1266
|
+
throttle,
|
|
1267
|
+
timed,
|
|
1268
|
+
titleCase,
|
|
1269
|
+
radToDeg as toDegrees,
|
|
1270
|
+
degToRad as toRadians,
|
|
1271
|
+
todo,
|
|
1272
|
+
transform,
|
|
1273
|
+
truncate,
|
|
1274
|
+
truncateMiddle,
|
|
1275
|
+
unescapeHtml,
|
|
1276
|
+
unreachable,
|
|
1277
|
+
unwrap,
|
|
1278
|
+
updateDualLoopPID,
|
|
1279
|
+
updatePID,
|
|
1280
|
+
uuid,
|
|
1281
|
+
validateTraitComposition,
|
|
1282
|
+
variance,
|
|
1283
|
+
vec2,
|
|
1284
|
+
vec2Math,
|
|
1285
|
+
vec3,
|
|
1286
|
+
vec3Math,
|
|
1287
|
+
vec3ToArray,
|
|
1288
|
+
vec4,
|
|
1289
|
+
waitUntil,
|
|
1290
|
+
withTimeout,
|
|
1291
|
+
wordWrap,
|
|
1292
|
+
words,
|
|
1293
|
+
wrap as wrapString
|
|
1294
|
+
};
|
|
210
1295
|
//# sourceMappingURL=index.js.map
|