@draug/engine 1.0.20 → 1.0.23

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/dist/index.cjs CHANGED
@@ -1,1043 +1,78 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
23
- Asset: () => Asset,
24
- AssetState: () => AssetState,
25
- AssetStorage: () => AssetStorage,
26
- AssetsManager: () => AssetsManager,
27
- Clock: () => Clock,
28
- Commands: () => Commands,
29
- Component: () => Component,
30
- ComponentAlreadyRegisteredError: () => ComponentAlreadyRegisteredError,
31
- ComponentStorage: () => ComponentStorage,
32
- ComponentsManager: () => ComponentsManager,
33
- DAGNode: () => DAGNode,
34
- Engine: () => Engine,
35
- EntitiesManager: () => EntitiesManager,
36
- EntityMaskNotFoundError: () => EntityMaskNotFoundError,
37
- EntityRef: () => EntityRef,
38
- ErrDAGCycleDetected: () => ErrDAGCycleDetected,
39
- ErrMissingPluginMetadata: () => ErrMissingPluginMetadata,
40
- ErrMissingSystemMetadata: () => ErrMissingSystemMetadata,
41
- ErrNotAPlugin: () => ErrNotAPlugin,
42
- ErrNotASystem: () => ErrNotASystem,
43
- ErrPluginNotInit: () => ErrPluginNotInit,
44
- ErrUnknownPlugin: () => ErrUnknownPlugin,
45
- EventBuffer: () => EventBuffer,
46
- EventBus: () => EventBus,
47
- LogLevel: () => LogLevel,
48
- Loop: () => Loop,
49
- ObjectPool: () => ObjectPool,
50
- Plugin: () => Plugin,
51
- PluginBase: () => PluginBase,
52
- PluginError: () => PluginError,
53
- PluginsManager: () => PluginsManager,
54
- Resource: () => Resource,
55
- ResourcesManager: () => ResourcesManager,
56
- Runtime: () => Runtime,
57
- System: () => System,
58
- SystemBase: () => SystemBase,
59
- SystemError: () => SystemError,
60
- SystemPhase: () => SystemPhase,
61
- SystemsManager: () => SystemsManager,
62
- UnregisteredComponentStorageError: () => UnregisteredComponentStorageError,
63
- VisitedState: () => VisitedState,
64
- World: () => World3,
65
- createEventKey: () => createEventKey,
66
- entry: () => entry,
67
- getPluginMetadata: () => getPluginMetadata,
68
- getResourceMetadata: () => getResourceMetadata,
69
- getSystemMetadata: () => getSystemMetadata,
70
- isPlugin: () => isPlugin,
71
- isSystem: () => isSystem,
72
- topologicalSort: () => topologicalSort
73
- });
74
- module.exports = __toCommonJS(index_exports);
75
-
76
- // src/core/graph/dag.ts
77
- var VisitedState = /* @__PURE__ */ ((VisitedState2) => {
78
- VisitedState2[VisitedState2["Unvisited"] = 0] = "Unvisited";
79
- VisitedState2[VisitedState2["Visiting"] = 1] = "Visiting";
80
- VisitedState2[VisitedState2["Visited"] = 2] = "Visited";
81
- return VisitedState2;
82
- })(VisitedState || {});
83
- var DAGNode = class {
84
- data;
85
- vertices = [];
86
- constructor(data, vertices) {
87
- this.data = data;
88
- if (vertices)
89
- this.vertices = vertices;
90
- }
91
- };
92
- var ErrDAGCycleDetected = class extends Error {
93
- constructor() {
94
- super(`Cycle detected!`);
95
- }
96
- };
97
- function topologicalSort(nodes) {
98
- const visited = /* @__PURE__ */ new Map();
99
- const result = [];
100
- const dfs = (node) => {
101
- const state = visited.get(node) ?? 0 /* Unvisited */;
102
- if (state === 2 /* Visited */) return;
103
- if (state === 1 /* Visiting */) {
104
- throw new ErrDAGCycleDetected();
105
- }
106
- visited.set(node, 1 /* Visiting */);
107
- for (const child of node.vertices) {
108
- dfs(child);
109
- }
110
- visited.set(node, 2 /* Visited */);
111
- result.push(node);
112
- };
113
- for (const node of nodes) {
114
- dfs(node);
115
- }
116
- return result.reverse();
117
- }
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _class; var _class2; var _class3; var _class4; var _class5; var _class6;
2
+
3
+ var _chunkCNBFO5GJcjs = require('./chunk-CNBFO5GJ.cjs');
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
+
118
33
 
119
- // src/ecs/system.ts
120
- var SystemError = class extends Error {
121
- constructor(target) {
122
- super(`[System Error] (System "${target.name}".`);
123
- }
124
- };
125
- var ErrNotASystem = class extends Error {
126
- constructor(target) {
127
- super(`Provided class "${target.name}" is not a System! Extend your class from SystemBase.`);
128
- }
129
- };
130
- var ErrMissingSystemMetadata = class extends SystemError {
131
- constructor(target) {
132
- super(target);
133
- this.message = `${this.message}: Missing system metadata! Define system class with @System decorator.`;
134
- }
135
- };
136
- var SystemPhase = /* @__PURE__ */ ((SystemPhase2) => {
137
- SystemPhase2[SystemPhase2["PRE"] = 0] = "PRE";
138
- SystemPhase2[SystemPhase2["MAIN"] = 1] = "MAIN";
139
- SystemPhase2[SystemPhase2["POST"] = 2] = "POST";
140
- return SystemPhase2;
141
- })(SystemPhase || {});
142
- var SystemMetadataSymbol = /* @__PURE__ */ Symbol("system");
143
- function System(props) {
144
- return (target) => {
145
- const systemTarget = target;
146
- if ("__proto__" in systemTarget && systemTarget.__proto__ !== SystemBase) {
147
- throw new ErrNotASystem(target);
148
- }
149
- const query = { ...props.query };
150
- const requiredComponents = new Set(props.requiredComponents);
151
- const computeAfter = new Set(props.computeAfter);
152
- const phase = props.phase ?? 1 /* MAIN */;
153
- const name = props.name ?? target.name;
154
- const metadata = { query, requiredComponents, computeAfter, phase, name };
155
- systemTarget[SystemMetadataSymbol] = metadata;
156
- };
157
- }
158
- function getSystemMetadata(system) {
159
- if (hasMetadata(system)) {
160
- return system[SystemMetadataSymbol];
161
- }
162
- throw new ErrMissingSystemMetadata(system);
163
- }
164
- function hasMetadata(ctor) {
165
- return SystemMetadataSymbol in ctor;
166
- }
167
- function isSystem(ctor) {
168
- return hasMetadata(ctor);
169
- }
170
- var SystemBase = class {
171
- };
172
- var SystemsManager = class {
173
- constructor(world, logger) {
174
- this.world = world;
175
- this.logger = logger;
176
- }
177
- world;
178
- logger;
179
- systems_ = /* @__PURE__ */ new Map();
180
- executionOrder_ = [];
181
- requiredComponents_ = /* @__PURE__ */ new Set();
182
- dirty_ = true;
183
- getRequiredComponents() {
184
- return Array.from(this.requiredComponents_);
185
- }
186
- register(sys) {
187
- const ctor = sys.constructor;
188
- if (this.systems_.has(ctor)) throw new Error("Duplicate system");
189
- const { query, requiredComponents } = getSystemMetadata(ctor);
190
- this.systems_.set(ctor, sys);
191
- const q = query;
192
- for (const c of q.include ?? [])
193
- this.requiredComponents_.add(c);
194
- for (const c of q.exclude ?? [])
195
- this.requiredComponents_.add(c);
196
- for (const c of q.anyOf ?? [])
197
- this.requiredComponents_.add(c);
198
- for (const c of requiredComponents)
199
- this.requiredComponents_.add(c);
200
- const meta = getSystemMetadata(ctor);
201
- this.logger.debug(() => `[Systems]: system "${meta.name}" was registered`);
202
- }
203
- build() {
204
- this.buildSystemsArray();
205
- for (const sys of this.systems_.values()) {
206
- sys.onInit?.({ world: this.world, logger: this.logger });
207
- }
208
- this.logger.debug(() => `Built ${this.systems_.size} systems`);
209
- this.dirty_ = false;
210
- }
211
- rebuild() {
212
- this.build();
213
- }
214
- get(ctor) {
215
- const s = this.systems_.get(ctor);
216
- if (!s)
217
- throw new Error("System not registered");
218
- return s;
219
- }
220
- update(time) {
221
- if (this.dirty_)
222
- this.rebuild();
223
- this.world.events.swapAll();
224
- for (const s of this.executionOrder_) {
225
- const { query } = getSystemMetadata(s.constructor);
226
- const entities = this.world.query(query);
227
- s.compute({
228
- world: this.world,
229
- entities,
230
- time,
231
- logger: this.logger
232
- });
233
- }
234
- }
235
- buildSystemsArray() {
236
- const pre = [];
237
- const main = [];
238
- const post = [];
239
- const map = /* @__PURE__ */ new Map();
240
- for (const [ctor, system] of this.systems_.entries()) {
241
- const meta = getSystemMetadata(ctor);
242
- switch (meta.phase) {
243
- case 0 /* PRE */:
244
- pre.push(system);
245
- break;
246
- case 1 /* MAIN */:
247
- post.push(system);
248
- break;
249
- default:
250
- main.push(system);
251
- map.set(ctor, new DAGNode(system));
252
- break;
253
- }
254
- }
255
- for (const ctor of map.keys()) {
256
- const currentNode = map.get(ctor);
257
- const { computeAfter } = getSystemMetadata(ctor);
258
- for (const depCtor of computeAfter ?? []) {
259
- const depNode = map.get(depCtor);
260
- if (!depNode) {
261
- throw new Error(`Dependency ${depCtor.name} not registered`);
262
- }
263
- depNode.vertices.push(currentNode);
264
- }
265
- }
266
- this.executionOrder_ = [
267
- ...pre,
268
- ...topologicalSort(map.values()).map((x) => x.data),
269
- ...post
270
- ];
271
- }
272
- };
273
34
 
274
- // src/ecs/entity.ts
275
- var UnregisteredComponentStorageError = class extends Error {
276
- constructor(component) {
277
- super(`Cannot get storage for component ${component.name}. Seems like it's not registered in world.`);
278
- }
279
- };
280
- var EntityMaskNotFoundError = class extends Error {
281
- constructor(id2) {
282
- super(`Cannot find bitmask for entity [${id2}]. Seems like it's not registered in the EntityManager.`);
283
- }
284
- };
285
- var EntitiesManager = class {
286
- constructor(logger) {
287
- this.logger = logger;
288
- }
289
- logger;
290
- id_ = 0;
291
- nextId() {
292
- return ++this.id_;
293
- }
294
- create() {
295
- const id2 = this.nextId();
296
- this.logger.debug(() => `[Entities]: Created new entity with ID ${id2}`);
297
- return id2;
298
- }
299
- };
300
- var EntityRef = class {
301
- constructor(world, id2) {
302
- this.world = world;
303
- this.id = id2;
304
- }
305
- world;
306
- id;
307
- with(...components) {
308
- return components.map((c) => {
309
- const s = this.world.components.getStorage(c);
310
- return s.tryGet(this.id);
311
- });
312
- }
313
- };
314
35
 
315
- // src/ecs/constant.ts
316
- var ECS_DEFAULTS = {
317
- MAX_ENTITY_COUNT: Math.pow(2, 12)
318
- };
319
36
 
320
- // src/ecs/events-buffer.ts
321
- var EventBuffer = class {
322
- readBuf = [];
323
- writeBuf = [];
324
- write(event) {
325
- this.writeBuf.push(event);
326
- }
327
- /**
328
- * Advances the buffer to the next frame.
329
- *
330
- * Performs a double-buffer flip:
331
- * - Promotes all events written during the previous frame (`writeBuf`)
332
- * to be readable in the current frame (`readBuf`).
333
- * - Reuses the previous `readBuf` as the new `writeBuf` and clears it
334
- * to collect events for the next frame.
335
- *
336
- * After calling this method:
337
- * - `get()` will return a stable snapshot of events produced in the previous frame.
338
- * - `add()` will write into an empty buffer for the current frame.
339
- *
340
- * Guarantees:
341
- * - No events written during the current frame are visible until the next `swap()`.
342
- * - Readers observe a consistent, immutable snapshot within a frame.
343
- *
344
- * Expected to be called exactly once per frame, before system execution.
345
- */
346
- swap() {
347
- const tmp = this.readBuf;
348
- this.readBuf = this.writeBuf;
349
- this.writeBuf = tmp;
350
- this.writeBuf.length = 0;
351
- }
352
- read() {
353
- return this.readBuf;
354
- }
355
- size() {
356
- return this.readBuf.length;
357
- }
358
- };
359
- function createEventKey(description) {
360
- return Symbol(description);
361
- }
362
- var EventBus = class {
363
- storage = /* @__PURE__ */ new Map();
364
- swapAll() {
365
- this.storage.forEach((s) => s.swap());
366
- }
367
- getBuffer(key) {
368
- let buf = this.storage.get(key);
369
- if (!buf) {
370
- buf = new EventBuffer();
371
- this.storage.set(key, buf);
372
- }
373
- return buf;
374
- }
375
- };
376
37
 
377
- // src/core/memory/pool.ts
378
- var ObjectPool = class {
379
- pool_;
380
- factory_;
381
- cursor_;
382
- constructor(factory, initialSize = 0) {
383
- this.pool_ = new Array(initialSize);
384
- this.factory_ = factory;
385
- this.cursor_ = initialSize - 1;
386
- }
387
- acquire() {
388
- if (this.cursor_ >= 0) {
389
- return this.pool_[this.cursor_--];
390
- }
391
- return this.factory_();
392
- }
393
- release(obj) {
394
- this.pool_[++this.cursor_] = obj;
395
- }
396
- grow() {
397
- const oldSize = this.pool_.length;
398
- const newSize = oldSize * 2;
399
- for (let i = oldSize; i < newSize; i++) this.pool_[i] = this.factory_();
400
- this.cursor_ = newSize - 1;
401
- this.pool_.length = newSize;
402
- }
403
- };
404
38
 
405
- // src/ecs/components/component-storage.ts
406
- var import_bitmap_index = require("bitmap-index");
407
- var ComponentStorage = class {
408
- bits_;
409
- data_ = [];
410
- entityIds_ = [];
411
- indexMap_ = /* @__PURE__ */ new Map();
412
- pool_;
413
- id_ = 0;
414
- size_ = 0;
415
- cls;
416
- constructor(cap = ECS_DEFAULTS.MAX_ENTITY_COUNT, factory, cls) {
417
- this.bits_ = new import_bitmap_index.Bitmap(cap);
418
- this.pool_ = new ObjectPool(factory, 0);
419
- this.cls = cls;
420
- }
421
- bitmap() {
422
- return this.bits_;
423
- }
424
- get id() {
425
- return this.id_;
426
- }
427
- _internalSetId(id2) {
428
- return this.id_ = id2;
429
- }
430
- add(id2, initFn) {
431
- if (this.indexMap_.has(id2)) {
432
- throw new Error(`[ComponentStorage "${this.cls.name}"]: Entity ${id2} already has this component`);
433
- }
434
- const obj = this.pool_.acquire();
435
- initFn?.(obj);
436
- const index = this.data_.length;
437
- this.data_.push(obj);
438
- this.entityIds_.push(id2);
439
- this.indexMap_.set(id2, index);
440
- this.bits_.set(id2);
441
- this.size_++;
442
- return obj;
443
- }
444
- remove(id2) {
445
- const index = this.indexMap_.get(id2);
446
- if (index === void 0) return;
447
- this.bits_.remove(id2);
448
- const lastIndex = this.data_.length - 1;
449
- const lastEntityId = this.entityIds_[lastIndex];
450
- const removedObj = this.data_[index];
451
- if (index !== lastIndex) {
452
- this.data_[index] = this.data_[lastIndex];
453
- this.entityIds_[index] = lastEntityId;
454
- this.indexMap_.set(lastEntityId, index);
455
- }
456
- this.data_.pop();
457
- this.entityIds_.pop();
458
- this.indexMap_.delete(id2);
459
- this.pool_.release(removedObj);
460
- this.size_--;
461
- }
462
- get(id2) {
463
- const index = this.indexMap_.get(id2);
464
- return index !== void 0 ? this.data_[index] : null;
465
- }
466
- tryGet(id2) {
467
- const index = this.indexMap_.get(id2);
468
- if (index === void 0)
469
- throw new Error(`[ComponentStorage "${this.cls.name}"]: Requesting non-existing item with ID ${id2}.`);
470
- return this.data_[index];
471
- }
472
- writeComponentsToBuf(ids, out) {
473
- let len = 0;
474
- for (const id2 of ids) {
475
- const index = this.indexMap_.get(id2);
476
- if (index !== void 0) out[len++] = this.data_[index];
477
- }
478
- return len;
479
- }
480
- has(id2) {
481
- return this.bits_.contains(id2);
482
- }
483
- size() {
484
- return this.size_;
485
- }
486
- forEach(cb) {
487
- for (const id2 of this.entityIds_) {
488
- cb(id2);
489
- }
490
- }
491
- };
492
39
 
493
- // src/ecs/components/utils.ts
494
- var registry = /* @__PURE__ */ new Map();
495
- var id = 0;
496
- var ComponentMetadataSymbol = /* @__PURE__ */ Symbol("component");
497
- function Component(options) {
498
- return (target) => {
499
- const metadata = {
500
- name: options.name,
501
- id: ++id
502
- };
503
- registry.set(target, metadata.id);
504
- target[ComponentMetadataSymbol] = metadata;
505
- };
506
- }
507
- function getComponentId(ctor) {
508
- const id2 = registry.get(ctor);
509
- if (id2 === void 0) {
510
- throw new Error(`Component not registered: ${ctor.name}`);
511
- }
512
- return id2;
513
- }
514
- var ErrNotComponent = class extends Error {
515
- constructor(ctor) {
516
- super(`Class ${ctor.name} is not a Component. Use @Component decorator to define components.`);
517
- }
518
- };
519
- function getComponentMetadata(component) {
520
- if (isComponent(component)) {
521
- return component[ComponentMetadataSymbol];
522
- }
523
- throw new ErrNotComponent(component);
524
- }
525
- function isComponent(ctor) {
526
- return ComponentMetadataSymbol in ctor;
527
- }
528
40
 
529
- // src/ecs/components/manager.ts
530
- var ComponentAlreadyRegisteredError = class extends Error {
531
- constructor(component) {
532
- super(`Component ${component.name} already registered!`);
533
- }
534
- };
535
- var ComponentsManager = class {
536
- constructor(logger, maxEntityCount = ECS_DEFAULTS.MAX_ENTITY_COUNT) {
537
- this.logger = logger;
538
- this.maxEntityCount = maxEntityCount;
539
- }
540
- logger;
541
- maxEntityCount;
542
- storages_ = /* @__PURE__ */ new Map();
543
- currId_ = 0;
544
- nextId() {
545
- return ++this.currId_;
546
- }
547
- register(component, opts) {
548
- if (this.storages_.has(component))
549
- return this.storages_.get(component);
550
- const store = this.createComponentStore(component, opts);
551
- this.storages_.set(component, store);
552
- const meta = getComponentMetadata(component);
553
- this.logger.debug(() => `[Components]: Registered component "${meta.name}"`);
554
- return store;
555
- }
556
- createComponentStore(component, opts) {
557
- const factory = opts?.factory ?? ((...args) => new component(...args));
558
- const store = new ComponentStorage(this.maxEntityCount, factory, component);
559
- store._internalSetId(this.nextId());
560
- return store;
561
- }
562
- getStorage(component) {
563
- const store = this.storages_.get(component);
564
- if (store === void 0)
565
- throw new UnregisteredComponentStorageError(component);
566
- return store;
567
- }
568
- getComponentId(ctor) {
569
- return getComponentId(ctor);
570
- }
571
- };
572
41
 
573
- // src/ecs/resources/resources.ts
574
- var ResourceMetadataSymbol = /* @__PURE__ */ Symbol("resource");
575
- function Resource(params) {
576
- return (target) => {
577
- const metadata = {
578
- name: params.name
579
- };
580
- target[ResourceMetadataSymbol] = metadata;
581
- };
582
- }
583
- var ErrNotResource = class extends Error {
584
- constructor(ctor) {
585
- super(`Class ${ctor.name} is not a Resource. Use @Resource decorator to define resources.`);
586
- }
587
- };
588
- function getResourceMetadata(resource) {
589
- if (isResource(resource)) {
590
- return resource[ResourceMetadataSymbol];
591
- }
592
- throw new ErrNotResource(resource);
593
- }
594
- function isResource(ctor) {
595
- return ResourceMetadataSymbol in ctor;
596
- }
597
- var ResourcesManager = class {
598
- constructor(logger) {
599
- this.logger = logger;
600
- }
601
- logger;
602
- items_ = /* @__PURE__ */ new Map();
603
- insert(type, value) {
604
- this.items_.set(type, value);
605
- const metadata = getResourceMetadata(type);
606
- this.logger.debug(() => `[Resources]: Inserted new Resource "${metadata.name}"`);
607
- return value;
608
- }
609
- get(type) {
610
- const value = this.items_.get(type);
611
- const meta = getResourceMetadata(type);
612
- if (!value)
613
- throw new Error(`Resource of class ${meta.name} does not exist!`);
614
- return value;
615
- }
616
- getOrInsert(type, factory) {
617
- let value = this.items_.get(type) ?? null;
618
- if (value === null) {
619
- value = factory();
620
- this.insert(type, value);
621
- }
622
- return value;
623
- }
624
- remove(type) {
625
- const meta = getResourceMetadata(type);
626
- this.logger.debug(() => `[Resources]: Removed resource "${meta.name}"`);
627
- this.items_.delete(type);
628
- }
629
- };
630
42
 
631
- // src/ecs/command.ts
632
- function entry(component, init = () => {
633
- }) {
634
- return [component, init];
635
- }
636
- var Commands = class {
637
- constructor(world, logger) {
638
- this.world = world;
639
- this.logger = logger;
640
- }
641
- world;
642
- logger;
643
- commandsQueue_ = [];
644
- add(cmd) {
645
- this.commandsQueue_.push(cmd);
646
- }
647
- flush(world) {
648
- for (const cmd of this.commandsQueue_)
649
- cmd(world);
650
- this.commandsQueue_.length = 0;
651
- }
652
- createEntity(...entries) {
653
- const id2 = this.world.entities.create();
654
- const cmd = (world) => {
655
- for (const [cls, initFn] of entries) {
656
- world.addComponent(id2, cls, initFn);
657
- }
658
- };
659
- this.add(cmd);
660
- this.logger.debug(() => {
661
- const components = entries.map((x) => getComponentMetadata(x[0]).name).join(", ");
662
- return `[Commands.createEntity]: Created new entity with ID ${id2}. Linked components: [${components}]`;
663
- });
664
- return id2;
665
- }
666
- };
667
43
 
668
- // src/ecs/query.ts
669
- var import_bitmap_index2 = require("bitmap-index");
670
- var QueryManager = class {
671
- constructor(world) {
672
- this.world = world;
673
- }
674
- world;
675
- cache = /* @__PURE__ */ new Map();
676
- get(params) {
677
- const key = this.getKey(params);
678
- let entry2 = this.cache.get(key);
679
- if (!entry2) {
680
- entry2 = {
681
- params,
682
- bitmap: this.compute(params),
683
- dirty: false,
684
- deps: this.collectDeps(params)
685
- };
686
- this.cache.set(key, entry2);
687
- }
688
- if (entry2.dirty) {
689
- entry2.bitmap = this.compute(entry2.params);
690
- entry2.dirty = false;
691
- }
692
- let targetBitmap = entry2.bitmap;
693
- if (params.excludeEntitiesIds?.length) {
694
- targetBitmap = entry2.bitmap.clone();
695
- const excludeBm = new import_bitmap_index2.Bitmap();
696
- for (const id2 of params.excludeEntitiesIds) {
697
- excludeBm.set(id2);
698
- }
699
- targetBitmap.andNot(excludeBm);
700
- }
701
- if (params.filter) {
702
- const result = [];
703
- targetBitmap.range((id2) => {
704
- if (params.filter(id2)) result.push(id2);
705
- });
706
- return result;
707
- }
708
- return this.extractIds(targetBitmap);
709
- }
710
- invalidate(component) {
711
- for (const entry2 of this.cache.values()) {
712
- if (entry2.deps.has(component)) {
713
- entry2.dirty = true;
714
- }
715
- }
716
- }
717
- getKey(q) {
718
- return [
719
- this.ids(q.include),
720
- this.ids(q.exclude),
721
- this.ids(q.anyOf)
722
- ].join("|");
723
- }
724
- ids(arr) {
725
- if (!arr || arr.length === 0) return "";
726
- return arr.map((c) => this.world.components.getComponentId(c)).sort((a, b) => a - b).join(",");
727
- }
728
- collectDeps(q) {
729
- const set = /* @__PURE__ */ new Set();
730
- q.include?.forEach((c) => set.add(c));
731
- q.exclude?.forEach((c) => set.add(c));
732
- q.anyOf?.forEach((c) => set.add(c));
733
- return set;
734
- }
735
- compute(params) {
736
- let result = this.combineBitmaps(params.include, "and");
737
- const any = this.combineBitmaps(params.anyOf, "or");
738
- if (any) {
739
- result = result ? result.and(any) : any;
740
- }
741
- if (!result) {
742
- return new import_bitmap_index2.Bitmap();
743
- }
744
- this.applyExclusions(result, params.exclude);
745
- return result;
746
- }
747
- combineBitmaps(components, op) {
748
- if (!components?.length) return null;
749
- let result = null;
750
- let hasAtLeastOneValid = false;
751
- for (const c of components) {
752
- const bm = this.world.components.getStorage(c)?.bitmap();
753
- if (!bm) {
754
- if (op === "and") {
755
- return new import_bitmap_index2.Bitmap();
756
- }
757
- continue;
758
- }
759
- hasAtLeastOneValid = true;
760
- if (!result) {
761
- result = bm.clone();
762
- } else {
763
- op === "and" ? result.and(bm) : result.or(bm);
764
- }
765
- }
766
- if (op === "or" && !hasAtLeastOneValid) {
767
- return new import_bitmap_index2.Bitmap();
768
- }
769
- return result;
770
- }
771
- applyExclusions(target, excludeComponents) {
772
- if (excludeComponents?.length) {
773
- for (const c of excludeComponents) {
774
- const bm = this.world.components.getStorage(c)?.bitmap();
775
- if (bm) target.andNot(bm);
776
- }
777
- }
778
- }
779
- extractIds(bitmap) {
780
- const result = [];
781
- bitmap.range((id2) => {
782
- result.push(id2);
783
- });
784
- return result;
785
- }
786
- };
787
44
 
788
- // src/ecs/plugin/plugin.ts
789
- var PluginMetadataSymbol = /* @__PURE__ */ Symbol("plugin");
790
- function Plugin(metadata) {
791
- return (target) => {
792
- if ("__proto__" in target && target.__proto__ !== PluginBase)
793
- throw new ErrNotAPlugin(target);
794
- target[PluginMetadataSymbol] = metadata;
795
- };
796
- }
797
- function getPluginMetadata(plugin) {
798
- if (hasMetadata2(plugin)) {
799
- return plugin[PluginMetadataSymbol];
800
- }
801
- throw new ErrMissingPluginMetadata(plugin);
802
- }
803
- function hasMetadata2(ctor) {
804
- return PluginMetadataSymbol in ctor;
805
- }
806
- function isPlugin(ctor) {
807
- return hasMetadata2(ctor);
808
- }
809
- var PluginBase = class {
810
- onPluginLoad;
811
- onPluginUnload;
812
- onAfterWorldInit;
813
- };
814
- var PluginError = class extends Error {
815
- constructor(pluginId) {
816
- super(`Plugin error! Plugin [${pluginId}]`);
817
- }
818
- };
819
- var ErrNotAPlugin = class extends Error {
820
- constructor(target) {
821
- super(`Provided class ${target.name} is not a Plugin! Every plugin must extends of PluginBase class.`);
822
- }
823
- };
824
- var ErrMissingPluginMetadata = class extends Error {
825
- constructor(plugin) {
826
- super(`Provided class ${plugin.name}: Missing plugin metadata! Define plugin class with @Plugin decorator.`);
827
- }
828
- };
829
- var ErrUnknownPlugin = class extends PluginError {
830
- constructor(pluginId) {
831
- super(pluginId);
832
- this.message = `${super.message}: Plugin not found in manager.`;
833
- }
834
- };
835
- var ErrPluginNotInit = class extends PluginError {
836
- constructor(pluginId) {
837
- super(pluginId);
838
- this.message = `${super.message}: Plugin not initiated yet. You must use PluginsManager.build() before getting instance.`;
839
- }
840
- };
841
- var ErrMissingPluginDependency = class extends PluginError {
842
- constructor(pluginId, missingDepId) {
843
- super(pluginId);
844
- this.message = `${super.message}: Missing required dependency [${missingDepId}]. Install it first.`;
845
- }
846
- };
847
- var ErrDAGCycleDetectedPlugin = class extends Error {
848
- constructor() {
849
- super(`Cycle detected in plugin dependencies!`);
850
- }
851
- };
852
- var PluginsManager = class {
853
- constructor(logger) {
854
- this.logger = logger;
855
- }
856
- logger;
857
- plugins_ = /* @__PURE__ */ new Map();
858
- isInitiated_ = false;
859
- install(plugin, ...constructorProps) {
860
- if (!isPlugin(plugin))
861
- throw new ErrMissingPluginMetadata(plugin);
862
- const metadata = getPluginMetadata(plugin);
863
- if (this.plugins_.has(plugin))
864
- return;
865
- const entry2 = {
866
- ctor: plugin,
867
- ctorParams: constructorProps,
868
- metadata
869
- };
870
- this.plugins_.set(plugin, entry2);
871
- this.logger.debug(() => `[Plugins]: Installed plugin ${metadata.name} (${metadata.version})`);
872
- }
873
- build() {
874
- if (this.plugins_.size === 0) {
875
- return;
876
- }
877
- const nodes = /* @__PURE__ */ new Map();
878
- for (const id2 of this.plugins_.keys()) {
879
- nodes.set(id2, new DAGNode(id2));
880
- }
881
- for (const [plugin, entry2] of this.plugins_) {
882
- const node = nodes.get(plugin);
883
- const depPlugins = entry2.metadata.dependencies?.plugins ?? [];
884
- for (const dep of depPlugins) {
885
- const depNode = nodes.get(dep.plugin);
886
- if (!depNode) {
887
- throw new ErrMissingPluginDependency(plugin, dep.plugin);
888
- }
889
- depNode.vertices.push(node);
890
- }
891
- }
892
- let sortedNodes;
893
- try {
894
- sortedNodes = topologicalSort(nodes.values());
895
- } catch (e) {
896
- if (e instanceof ErrDAGCycleDetected) {
897
- throw new ErrDAGCycleDetectedPlugin();
898
- }
899
- throw e;
900
- }
901
- for (const node of sortedNodes) {
902
- const entry2 = this.plugins_.get(node.data);
903
- const { ctor, ctorParams } = entry2;
904
- const instance = new ctor(...ctorParams);
905
- entry2.instance = instance;
906
- instance.onPluginLoad?.();
907
- }
908
- this.isInitiated_ = true;
909
- this.logger.debug(() => `[Plugins]: Plugins built successfully!`);
910
- }
911
- /**
912
- * @internal
913
- */
914
- __internal__onAfterWorldInit(world) {
915
- for (const p of this.plugins_.values()) {
916
- p.instance?.onAfterWorldInit?.(world);
917
- }
918
- }
919
- getPluginMetadata(plugin) {
920
- const entry2 = this.plugins_.get(plugin);
921
- if (!entry2) throw new ErrUnknownPlugin(plugin);
922
- return entry2.metadata;
923
- }
924
- getPluginInstance(plugin) {
925
- const entry2 = this.plugins_.get(plugin);
926
- if (!entry2) throw new ErrUnknownPlugin(plugin);
927
- if (!entry2.instance) throw new ErrPluginNotInit(plugin);
928
- if (!this.isInitiated_) {
929
- throw new ErrPluginNotInit(plugin);
930
- }
931
- return entry2.instance;
932
- }
933
- resolveId(pluginOrId) {
934
- if (typeof pluginOrId === "string") {
935
- return pluginOrId;
936
- }
937
- if (!isPlugin(pluginOrId)) {
938
- throw new ErrMissingPluginMetadata(pluginOrId);
939
- }
940
- return getPluginMetadata(pluginOrId).id;
941
- }
942
- };
943
45
 
944
- // src/ecs/world.ts
945
- var World3 = class {
946
- entities;
947
- components;
948
- systems;
949
- events;
950
- resources;
951
- commands;
952
- queries;
953
- plugins;
954
- logger;
955
- entityRefs_ = /* @__PURE__ */ new Map();
956
- updatesCount_ = 0;
957
- get updatesCount() {
958
- return this.updatesCount_;
959
- }
960
- constructor(params) {
961
- this.entities = new EntitiesManager(params.logger);
962
- this.components = new ComponentsManager(params.logger, params.maxEntityCount ?? ECS_DEFAULTS.MAX_ENTITY_COUNT);
963
- this.systems = new SystemsManager(this, params.logger);
964
- this.events = new EventBus();
965
- this.resources = new ResourcesManager(params.logger);
966
- this.commands = new Commands(this, params.logger);
967
- this.queries = new QueryManager(this);
968
- this.plugins = new PluginsManager(params.logger);
969
- this.logger = params.logger;
970
- }
971
- getEntityRef(id2) {
972
- let ref = this.entityRefs_.get(id2);
973
- if (!ref) {
974
- ref = new EntityRef(this, id2);
975
- this.entityRefs_.set(id2, ref);
976
- }
977
- return ref;
978
- }
979
- query(params) {
980
- return this.queries.get(params);
981
- }
982
- removeComponent(entity, component) {
983
- const id2 = typeof entity === "number" ? entity : entity.id;
984
- const storage = this.components.getStorage(component);
985
- storage.remove(id2);
986
- this.queries.invalidate(component);
987
- }
988
- addComponent(entity, component, initFn) {
989
- const storage = this.components.getStorage(component);
990
- let id2;
991
- if (typeof entity === "number") {
992
- id2 = entity;
993
- } else {
994
- id2 = entity.id;
995
- }
996
- const c = storage.add(id2, (o) => {
997
- if (initFn) {
998
- initFn(o);
999
- }
1000
- return o;
1001
- });
1002
- this.queries.invalidate(component);
1003
- return c;
1004
- }
1005
- update(clock) {
1006
- this.systems.update(clock.getTime());
1007
- this.commands.flush(this);
1008
- this.updatesCount_++;
1009
- }
1010
- build() {
1011
- this.plugins.build();
1012
- this.logger.debug(() => "World was built successfully");
1013
- }
1014
- };
46
+
47
+
48
+
49
+ var _chunkGUD2YACAcjs = require('./chunk-GUD2YACA.cjs');
1015
50
 
1016
51
  // src/runtime/runtime.ts
1017
52
  var Runtime = class {
1018
53
  constructor(loop) {
1019
54
  this.loop = loop;
1020
55
  }
1021
- loop;
56
+
1022
57
  run(world) {
1023
58
  this.loop.start(world);
1024
59
  }
1025
60
  };
1026
61
 
1027
62
  // src/runtime/clock.ts
1028
- var Clock = class {
1029
- constructor(timeSource_) {
63
+ var Clock = (_class = class {
64
+ constructor(timeSource_) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);
1030
65
  this.timeSource_ = timeSource_;
1031
66
  this.lastTimeMs_ = timeSource_.now();
1032
67
  }
1033
- timeSource_;
1034
- lastTimeMs_;
1035
- ellapsedTime_ = 0;
1036
- delta_ = 0;
1037
- time_ = {
68
+
69
+
70
+ __init() {this.ellapsedTime_ = 0}
71
+ __init2() {this.delta_ = 0}
72
+ __init3() {this.time_ = {
1038
73
  delta: 0,
1039
74
  elapsed: 0
1040
- };
75
+ }}
1041
76
  get deltaMs() {
1042
77
  return this.delta_;
1043
78
  }
@@ -1054,19 +89,19 @@ var Clock = class {
1054
89
  getTime() {
1055
90
  return this.time_;
1056
91
  }
1057
- };
92
+ }, _class);
1058
93
 
1059
94
  // src/runtime/loop.ts
1060
- var Loop = class {
1061
- constructor(clock, stepFn, platformLoop) {
95
+ var Loop = (_class2 = class {
96
+ constructor(clock, stepFn, platformLoop) {;_class2.prototype.__init4.call(this);
1062
97
  this.clock = clock;
1063
98
  this.stepFn = stepFn;
1064
99
  this.platformLoop = platformLoop;
1065
100
  }
1066
- clock;
1067
- stepFn;
1068
- platformLoop;
1069
- running = false;
101
+
102
+
103
+
104
+ __init4() {this.running = false}
1070
105
  start(world) {
1071
106
  this.running = true;
1072
107
  const loop = () => {
@@ -1080,7 +115,7 @@ var Loop = class {
1080
115
  stop() {
1081
116
  this.running = false;
1082
117
  }
1083
- };
118
+ }, _class2);
1084
119
 
1085
120
  // src/assets/assets.ts
1086
121
  var AssetState = /* @__PURE__ */ ((AssetState2) => {
@@ -1089,21 +124,21 @@ var AssetState = /* @__PURE__ */ ((AssetState2) => {
1089
124
  AssetState2[AssetState2["READY"] = 3] = "READY";
1090
125
  return AssetState2;
1091
126
  })(AssetState || {});
1092
- var Asset = class {
1093
- constructor(id2, url, loader, disposer) {
1094
- this.id = id2;
127
+ var Asset = (_class3 = class {
128
+ constructor(id, url, loader, disposer) {;_class3.prototype.__init5.call(this);_class3.prototype.__init6.call(this);_class3.prototype.__init7.call(this);_class3.prototype.__init8.call(this);
129
+ this.id = id;
1095
130
  this.url = url;
1096
131
  this.loader = loader;
1097
132
  this.disposer = disposer;
1098
133
  }
1099
- id;
1100
- url;
1101
- loader;
1102
- disposer;
1103
- data_ = null;
1104
- state_ = 1 /* NOT_READY */;
1105
- loading_ = null;
1106
- disposed_ = false;
134
+
135
+
136
+
137
+
138
+ __init5() {this.data_ = null}
139
+ __init6() {this.state_ = 1} /* NOT_READY */
140
+ __init7() {this.loading_ = null}
141
+ __init8() {this.disposed_ = false}
1107
142
  async load() {
1108
143
  if (this.state_ === 3 /* READY */)
1109
144
  return this.data_;
@@ -1140,47 +175,47 @@ var Asset = class {
1140
175
  throw new Error("Data is not loaded yet!");
1141
176
  return this.data_;
1142
177
  }
1143
- };
1144
- var AssetStorage = class {
1145
- constructor(nextIdFn_, defaultLoader_, defaultDisposer_) {
178
+ }, _class3);
179
+ var AssetStorage = (_class4 = class {
180
+ constructor(nextIdFn_, defaultLoader_, defaultDisposer_) {;_class4.prototype.__init9.call(this);
1146
181
  this.nextIdFn_ = nextIdFn_;
1147
182
  this.defaultLoader_ = defaultLoader_;
1148
183
  this.defaultDisposer_ = defaultDisposer_;
1149
184
  }
1150
- nextIdFn_;
1151
- defaultLoader_;
1152
- defaultDisposer_;
1153
- items_ = /* @__PURE__ */ new Map();
1154
- newAsset(id2, url, loader, disposer) {
1155
- return new Asset(id2, url, loader, disposer);
185
+
186
+
187
+
188
+ __init9() {this.items_ = /* @__PURE__ */ new Map()}
189
+ newAsset(id, url, loader, disposer) {
190
+ return new Asset(id, url, loader, disposer);
1156
191
  }
1157
192
  add(url) {
1158
- const id2 = this.nextIdFn_();
1159
- const rs = this.newAsset(id2, url, this.defaultLoader_, this.defaultDisposer_);
1160
- this.items_.set(id2, rs);
193
+ const id = this.nextIdFn_();
194
+ const rs = this.newAsset(id, url, this.defaultLoader_, this.defaultDisposer_);
195
+ this.items_.set(id, rs);
1161
196
  return rs;
1162
197
  }
1163
198
  addCustom(url, customLoader, customDisposer) {
1164
- const id2 = this.nextIdFn_();
1165
- const rs = this.newAsset(id2, url, customLoader, customDisposer);
1166
- this.items_.set(id2, rs);
199
+ const id = this.nextIdFn_();
200
+ const rs = this.newAsset(id, url, customLoader, customDisposer);
201
+ this.items_.set(id, rs);
1167
202
  return rs;
1168
203
  }
1169
- get(id2) {
1170
- const item = this.items_.get(id2);
1171
- return item ?? null;
204
+ get(id) {
205
+ const item = this.items_.get(id);
206
+ return _nullishCoalesce(item, () => ( null));
1172
207
  }
1173
- tryGet(id2) {
1174
- const item = this.items_.get(id2);
208
+ tryGet(id) {
209
+ const item = this.items_.get(id);
1175
210
  if (!item)
1176
- throw new Error(`Asset with id ${id2} in storage ${this.constructor.name} not exist`);
211
+ throw new Error(`Asset with id ${id} in storage ${this.constructor.name} not exist`);
1177
212
  return item;
1178
213
  }
1179
- async remove(id2) {
1180
- const item = this.items_.get(id2);
214
+ async remove(id) {
215
+ const item = this.items_.get(id);
1181
216
  if (!item) return;
1182
217
  await item.dispose();
1183
- this.items_.delete(id2);
218
+ this.items_.delete(id);
1184
219
  }
1185
220
  async loadAll() {
1186
221
  await Promise.all(
@@ -1193,15 +228,15 @@ var AssetStorage = class {
1193
228
  );
1194
229
  this.items_.clear();
1195
230
  }
1196
- };
231
+ }, _class4);
1197
232
  var NOOP_DISPOSER = async () => {
1198
233
  };
1199
- var AssetsManager = class {
1200
- storages_ = /* @__PURE__ */ new Map();
1201
- currId = 0;
1202
- nextIdFn = () => {
234
+ var AssetsManager = (_class5 = class {constructor() { _class5.prototype.__init10.call(this);_class5.prototype.__init11.call(this);_class5.prototype.__init12.call(this); }
235
+ __init10() {this.storages_ = /* @__PURE__ */ new Map()}
236
+ __init11() {this.currId = 0}
237
+ __init12() {this.nextIdFn = () => {
1203
238
  return ++this.currId;
1204
- };
239
+ }}
1205
240
  register(res, defaultLoader, defaultDisposer = NOOP_DISPOSER) {
1206
241
  const storage = new AssetStorage(
1207
242
  this.nextIdFn,
@@ -1212,7 +247,7 @@ var AssetsManager = class {
1212
247
  return storage;
1213
248
  }
1214
249
  getStorage(res) {
1215
- return this.storages_.get(res) ?? null;
250
+ return _nullishCoalesce(this.storages_.get(res), () => ( null));
1216
251
  }
1217
252
  tryGetStorage(res) {
1218
253
  const s = this.storages_.get(res);
@@ -1226,7 +261,7 @@ var AssetsManager = class {
1226
261
  disposeAll() {
1227
262
  Array.from(this.storages_.values(), (s) => s.clearAll());
1228
263
  }
1229
- };
264
+ }, _class5);
1230
265
 
1231
266
  // src/logger/logger.ts
1232
267
  var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
@@ -1247,19 +282,30 @@ var NoopLogger = class {
1247
282
  }
1248
283
  };
1249
284
 
285
+ // src/std/utils.ts
286
+ function injectStd(world) {
287
+ world.components.register(_chunkGUD2YACAcjs.Transform);
288
+ world.components.register(_chunkGUD2YACAcjs.Velocity);
289
+ world.systems.register(new (0, _chunkCNBFO5GJcjs.MovementSystem)());
290
+ }
291
+
1250
292
  // src/engine.ts
1251
- var Engine = class {
1252
- runtime;
1253
- assets = new AssetsManager();
1254
- world;
1255
- logger;
1256
- constructor(params) {
293
+ var Engine = (_class6 = class {
294
+
295
+ __init13() {this.assets = new AssetsManager()}
296
+
297
+
298
+ constructor(params) {;_class6.prototype.__init13.call(this);
1257
299
  this.runtime = new Runtime(params.loop);
1258
- this.logger = params.logger ?? new NoopLogger();
1259
- this.world = new World3({
300
+ this.logger = _nullishCoalesce(params.logger, () => ( new NoopLogger()));
301
+ this.world = new (0, _chunkGUD2YACAcjs.World)({
1260
302
  logger: this.logger,
1261
- maxEntityCount: params.maxEntityCount ?? ECS_DEFAULTS.MAX_ENTITY_COUNT
303
+ maxEntityCount: _nullishCoalesce(params.maxEntityCount, () => ( _chunkGUD2YACAcjs.ECS_DEFAULTS.MAX_ENTITY_COUNT))
1262
304
  });
305
+ injectStd(this.world);
306
+ }
307
+ getTick() {
308
+ return this.world.updatesCount;
1263
309
  }
1264
310
  init() {
1265
311
  this.world.build();
@@ -1267,58 +313,57 @@ var Engine = class {
1267
313
  start() {
1268
314
  this.runtime.run(this.world);
1269
315
  }
1270
- };
1271
- // Annotate the CommonJS export names for ESM import in node:
1272
- 0 && (module.exports = {
1273
- Asset,
1274
- AssetState,
1275
- AssetStorage,
1276
- AssetsManager,
1277
- Clock,
1278
- Commands,
1279
- Component,
1280
- ComponentAlreadyRegisteredError,
1281
- ComponentStorage,
1282
- ComponentsManager,
1283
- DAGNode,
1284
- Engine,
1285
- EntitiesManager,
1286
- EntityMaskNotFoundError,
1287
- EntityRef,
1288
- ErrDAGCycleDetected,
1289
- ErrMissingPluginMetadata,
1290
- ErrMissingSystemMetadata,
1291
- ErrNotAPlugin,
1292
- ErrNotASystem,
1293
- ErrPluginNotInit,
1294
- ErrUnknownPlugin,
1295
- EventBuffer,
1296
- EventBus,
1297
- LogLevel,
1298
- Loop,
1299
- ObjectPool,
1300
- Plugin,
1301
- PluginBase,
1302
- PluginError,
1303
- PluginsManager,
1304
- Resource,
1305
- ResourcesManager,
1306
- Runtime,
1307
- System,
1308
- SystemBase,
1309
- SystemError,
1310
- SystemPhase,
1311
- SystemsManager,
1312
- UnregisteredComponentStorageError,
1313
- VisitedState,
1314
- World,
1315
- createEventKey,
1316
- entry,
1317
- getPluginMetadata,
1318
- getResourceMetadata,
1319
- getSystemMetadata,
1320
- isPlugin,
1321
- isSystem,
1322
- topologicalSort
1323
- });
316
+ }, _class6);
317
+
318
+
319
+
320
+
321
+
322
+
323
+
324
+
325
+
326
+
327
+
328
+
329
+
330
+
331
+
332
+
333
+
334
+
335
+
336
+
337
+
338
+
339
+
340
+
341
+
342
+
343
+
344
+
345
+
346
+
347
+
348
+
349
+
350
+
351
+
352
+
353
+
354
+
355
+
356
+
357
+
358
+
359
+
360
+
361
+
362
+
363
+
364
+
365
+
366
+
367
+
368
+ exports.Asset = Asset; exports.AssetState = AssetState; exports.AssetStorage = AssetStorage; exports.AssetsManager = AssetsManager; exports.Clock = Clock; exports.Commands = _chunkGUD2YACAcjs.Commands; exports.Component = _chunkGUD2YACAcjs.Component; exports.ComponentAlreadyRegisteredError = _chunkGUD2YACAcjs.ComponentAlreadyRegisteredError; exports.ComponentStorage = _chunkGUD2YACAcjs.ComponentStorage; exports.ComponentsManager = _chunkGUD2YACAcjs.ComponentsManager; exports.DAGNode = _chunkGUD2YACAcjs.DAGNode; exports.Engine = Engine; exports.EntitiesManager = _chunkGUD2YACAcjs.EntitiesManager; exports.EntityMaskNotFoundError = _chunkGUD2YACAcjs.EntityMaskNotFoundError; exports.EntityRef = _chunkGUD2YACAcjs.EntityRef; exports.ErrDAGCycleDetected = _chunkGUD2YACAcjs.ErrDAGCycleDetected; exports.ErrMissingPluginMetadata = _chunkGUD2YACAcjs.ErrMissingPluginMetadata; exports.ErrMissingSystemMetadata = _chunkGUD2YACAcjs.ErrMissingSystemMetadata; exports.ErrNotAPlugin = _chunkGUD2YACAcjs.ErrNotAPlugin; exports.ErrNotASystem = _chunkGUD2YACAcjs.ErrNotASystem; exports.ErrPluginNotInit = _chunkGUD2YACAcjs.ErrPluginNotInit; exports.ErrUnknownPlugin = _chunkGUD2YACAcjs.ErrUnknownPlugin; exports.EventBuffer = _chunkGUD2YACAcjs.EventBuffer; exports.EventBus = _chunkGUD2YACAcjs.EventBus; exports.LogLevel = LogLevel; exports.Loop = Loop; exports.ObjectPool = _chunkGUD2YACAcjs.ObjectPool; exports.Plugin = _chunkGUD2YACAcjs.Plugin; exports.PluginBase = _chunkGUD2YACAcjs.PluginBase; exports.PluginError = _chunkGUD2YACAcjs.PluginError; exports.PluginsManager = _chunkGUD2YACAcjs.PluginsManager; exports.Resource = _chunkGUD2YACAcjs.Resource; exports.ResourcesManager = _chunkGUD2YACAcjs.ResourcesManager; exports.Runtime = Runtime; exports.System = _chunkGUD2YACAcjs.System; exports.SystemBase = _chunkGUD2YACAcjs.SystemBase; exports.SystemError = _chunkGUD2YACAcjs.SystemError; exports.SystemPhase = _chunkGUD2YACAcjs.SystemPhase; exports.SystemsManager = _chunkGUD2YACAcjs.SystemsManager; exports.UnregisteredComponentStorageError = _chunkGUD2YACAcjs.UnregisteredComponentStorageError; exports.VisitedState = _chunkGUD2YACAcjs.VisitedState; exports.World = _chunkGUD2YACAcjs.World; exports.createEventKey = _chunkGUD2YACAcjs.createEventKey; exports.entry = _chunkGUD2YACAcjs.entry; exports.getPluginMetadata = _chunkGUD2YACAcjs.getPluginMetadata; exports.getResourceMetadata = _chunkGUD2YACAcjs.getResourceMetadata; exports.getSystemMetadata = _chunkGUD2YACAcjs.getSystemMetadata; exports.isPlugin = _chunkGUD2YACAcjs.isPlugin; exports.isSystem = _chunkGUD2YACAcjs.isSystem; exports.topologicalSort = _chunkGUD2YACAcjs.topologicalSort;
1324
369
  //# sourceMappingURL=index.cjs.map