@likec4/core 1.32.2 → 1.33.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.
Files changed (96) hide show
  1. package/dist/builder/index.d.mts +6 -4
  2. package/dist/builder/index.mjs +45 -13
  3. package/dist/compute-view/index.d.mts +6 -4
  4. package/dist/compute-view/index.mjs +33 -10
  5. package/dist/compute-view/relationships-view/index.d.mts +6 -4
  6. package/dist/compute-view/relationships-view/index.mjs +6 -3
  7. package/dist/index.d.mts +9 -138
  8. package/dist/index.mjs +31 -3712
  9. package/dist/model/connection/deployment/index.d.mts +10 -0
  10. package/dist/model/connection/deployment/index.mjs +18 -0
  11. package/dist/model/connection/index.d.mts +70 -0
  12. package/dist/model/connection/index.mjs +23 -0
  13. package/dist/model/connection/model/index.d.mts +10 -0
  14. package/dist/model/connection/model/index.mjs +11 -0
  15. package/dist/model/index.d.mts +14 -256
  16. package/dist/model/index.mjs +27 -5
  17. package/dist/shared/{core.Bdz6fBF1.d.mts → core.1pNeDdRk.d.mts} +92 -81
  18. package/dist/shared/{core.BuO4ncfY.d.mts → core.668kXpZq.d.mts} +42 -52
  19. package/dist/shared/core.8KM0D6va.mjs +33 -0
  20. package/dist/shared/core.B0oEIXqd.mjs +47 -0
  21. package/dist/shared/core.BH9nN-_I.mjs +22 -0
  22. package/dist/shared/core.BMCb0wJI.mjs +177 -0
  23. package/dist/shared/core.BTnf14gD.mjs +331 -0
  24. package/dist/shared/core.BgvIuGGU.mjs +3 -0
  25. package/dist/shared/core.BoyJPEen.mjs +21 -0
  26. package/dist/shared/{core.CUYDgv2-.mjs → core.Br7Fab9l.mjs} +12 -15
  27. package/dist/shared/{core.BrCnZFTn.mjs → core.Btl47GOn.mjs} +3 -3
  28. package/dist/shared/core.ByrmCl9I.mjs +5 -0
  29. package/dist/shared/core.C80Z37Eu.mjs +29 -0
  30. package/dist/shared/{core.Pf5I9o0e.d.mts → core.CF82MWyh.d.mts} +1 -1
  31. package/dist/shared/{core.rmvsy0n3.mjs → core.C_C-3c1S.mjs} +5 -198
  32. package/dist/shared/core.CeQbbp7K.d.mts +41 -0
  33. package/dist/shared/{core.DoK86JEe.mjs → core.CpwrZi3D.mjs} +2 -73
  34. package/dist/shared/{core.CpXlRyE5.mjs → core.CtKXPqN_.mjs} +5 -36
  35. package/dist/shared/core.CxGKeL-L.mjs +144 -0
  36. package/dist/shared/core.CzdwsPmY.d.mts +69 -0
  37. package/dist/shared/{core.Cy9smucx.mjs → core.D4npX2q8.mjs} +1 -3
  38. package/dist/shared/core.D56nCp7e.mjs +168 -0
  39. package/dist/shared/core.D5qVzkws.mjs +724 -0
  40. package/dist/shared/core.DDAPzd3T.d.mts +87 -0
  41. package/dist/shared/{core.CBpKAlhj.mjs → core.DDynPqbh.mjs} +96 -56
  42. package/dist/shared/{core.Bk7wEZFG.mjs → core.DXRAwwDB.mjs} +3 -2
  43. package/dist/shared/core.DcS-0zys.mjs +10 -0
  44. package/dist/shared/{core.CBxTtXMi.d.mts → core.De___iBS.d.mts} +3 -2
  45. package/dist/shared/core.DsMrjY2q.mjs +34 -0
  46. package/dist/shared/core.DuSLYTG6.d.mts +57 -0
  47. package/dist/shared/core.Dy-F3xRP.d.mts +83 -0
  48. package/dist/shared/{core.DaAyklhe.d.mts → core.OLInHaJx.d.mts} +30 -22
  49. package/dist/shared/core.XptQjhMA.mjs +1295 -0
  50. package/dist/shared/{core.cbA9VZ02.mjs → core.hoq9W4rW.mjs} +28 -1073
  51. package/dist/shared/core.zLlww-07.mjs +3 -0
  52. package/dist/theme/index.d.mts +134 -0
  53. package/dist/theme/index.mjs +3709 -0
  54. package/dist/types/aux.d.mts +3 -2
  55. package/dist/types/index.d.mts +9 -5
  56. package/dist/types/index.mjs +17 -146
  57. package/dist/utils/index.d.mts +15 -100
  58. package/dist/utils/index.mjs +25 -1315
  59. package/dist/utils/iterable/index.d.mts +100 -0
  60. package/dist/utils/iterable/index.mjs +24 -0
  61. package/package.json +23 -7
  62. package/src/builder/Builder.ts +13 -4
  63. package/src/builder/__snapshots__/Builder-style1.spec.ts.snap +0 -13
  64. package/src/builder/__snapshots__/Builder-style2.compute-model.json5 +2 -6
  65. package/src/builder/__snapshots__/Builder-style2.spec.ts.snap +0 -7
  66. package/src/compute-view/deployment-view/__test__/fixture.ts +15 -5
  67. package/src/compute-view/deployment-view/utils.ts +13 -13
  68. package/src/compute-view/dynamic-view/compute.ts +2 -1
  69. package/src/compute-view/element-view/__test__/__snapshots__/legacy.spec.ts.snap +2 -2
  70. package/src/compute-view/relationships-view/layout.ts +1 -1
  71. package/src/compute-view/utils/applyCustomElementProperties.ts +8 -0
  72. package/src/compute-view/utils/applyCustomRelationProperties.ts +2 -0
  73. package/src/compute-view/utils/buildComputedNodes.ts +4 -3
  74. package/src/compute-view/utils/merge-props-from-relationships.ts +6 -5
  75. package/src/compute-view/utils/view-hash.ts +24 -3
  76. package/src/model/DeploymentElementModel.ts +20 -16
  77. package/src/model/ElementModel.ts +9 -3
  78. package/src/model/RelationModel.ts +19 -16
  79. package/src/model/index.ts +2 -0
  80. package/src/model/types.ts +1 -0
  81. package/src/model/view/EdgeModel.ts +4 -3
  82. package/src/model/view/LikeC4ViewModel.ts +5 -0
  83. package/src/model/view/NodeModel.ts +4 -2
  84. package/src/theme/index.ts +12 -5
  85. package/src/types/RichText.ts +200 -0
  86. package/src/types/index.ts +2 -0
  87. package/src/types/model-deployment.ts +4 -3
  88. package/src/types/model-logical.ts +3 -3
  89. package/src/types/scalar.ts +47 -2
  90. package/src/types/view-common.ts +1 -1
  91. package/src/types/view-computed.ts +2 -4
  92. package/src/types/view-layouted.ts +9 -0
  93. package/src/utils/index.ts +4 -9
  94. package/src/utils/markdown/index.ts +2 -0
  95. package/src/utils/markdown/to-html.ts +32 -0
  96. package/src/utils/markdown/to-text.ts +14 -0
@@ -0,0 +1,1295 @@
1
+ import { r as getDefaultExportFromCjs, d as commonAncestor, f as compareFqnHierarchically } from './core.C_C-3c1S.mjs';
2
+ import { r as requireForeach, a as requireIterator } from './core.CtKXPqN_.mjs';
3
+
4
+ function o(r,n){let e=Math.ceil(r),t=Math.floor(n);if(t<e)throw new RangeError(`randomInteger: The range [${r.toString()},${n.toString()}] contains no integer`);return Math.floor(Math.random()*(t-e+1)+e)}
5
+
6
+ /**
7
+ * Mnemonist BiMap
8
+ * ================
9
+ *
10
+ * JavaScript implementation of a BiMap.
11
+ */
12
+
13
+ var biMap$1;
14
+ var hasRequiredBiMap;
15
+
16
+ function requireBiMap () {
17
+ if (hasRequiredBiMap) return biMap$1;
18
+ hasRequiredBiMap = 1;
19
+ var forEach = requireForeach();
20
+
21
+ /**
22
+ * Inverse Map.
23
+ *
24
+ * @constructor
25
+ */
26
+ function InverseMap(original) {
27
+
28
+ this.size = 0;
29
+ this.items = new Map();
30
+ this.inverse = original;
31
+ }
32
+
33
+ /**
34
+ * BiMap.
35
+ *
36
+ * @constructor
37
+ */
38
+ function BiMap() {
39
+
40
+ this.size = 0;
41
+ this.items = new Map();
42
+ this.inverse = new InverseMap(this);
43
+ }
44
+
45
+ /**
46
+ * Method used to clear the map.
47
+ *
48
+ * @return {undefined}
49
+ */
50
+ function clear() {
51
+ this.size = 0;
52
+ this.items.clear();
53
+ this.inverse.items.clear();
54
+ }
55
+
56
+ BiMap.prototype.clear = clear;
57
+ InverseMap.prototype.clear = clear;
58
+
59
+ /**
60
+ * Method used to set a relation.
61
+ *
62
+ * @param {any} key - Key.
63
+ * @param {any} value - Value.
64
+ * @return {BiMap|InverseMap}
65
+ */
66
+ function set(key, value) {
67
+
68
+ // First we need to attempt to see if the relation is not flawed
69
+ if (this.items.has(key)) {
70
+ var currentValue = this.items.get(key);
71
+
72
+ // The relation already exists, we do nothing
73
+ if (currentValue === value)
74
+ return this;
75
+ else
76
+ this.inverse.items.delete(currentValue);
77
+ }
78
+
79
+ if (this.inverse.items.has(value)) {
80
+ var currentKey = this.inverse.items.get(value);
81
+
82
+ if (currentKey === key)
83
+ return this;
84
+ else
85
+ this.items.delete(currentKey);
86
+ }
87
+
88
+ // Here we actually add the relation
89
+ this.items.set(key, value);
90
+ this.inverse.items.set(value, key);
91
+
92
+ // Size
93
+ this.size = this.items.size;
94
+ this.inverse.size = this.inverse.items.size;
95
+
96
+ return this;
97
+ }
98
+
99
+ BiMap.prototype.set = set;
100
+ InverseMap.prototype.set = set;
101
+
102
+ /**
103
+ * Method used to delete a relation.
104
+ *
105
+ * @param {any} key - Key.
106
+ * @return {boolean}
107
+ */
108
+ function del(key) {
109
+ if (this.items.has(key)) {
110
+ var currentValue = this.items.get(key);
111
+
112
+ this.items.delete(key);
113
+ this.inverse.items.delete(currentValue);
114
+
115
+ // Size
116
+ this.size = this.items.size;
117
+ this.inverse.size = this.inverse.items.size;
118
+
119
+ return true;
120
+ }
121
+
122
+ return false;
123
+ }
124
+
125
+ BiMap.prototype.delete = del;
126
+ InverseMap.prototype.delete = del;
127
+
128
+ /**
129
+ * Mapping some Map prototype function unto our two classes.
130
+ */
131
+ var METHODS = ['has', 'get', 'forEach', 'keys', 'values', 'entries'];
132
+
133
+ METHODS.forEach(function(name) {
134
+ BiMap.prototype[name] = InverseMap.prototype[name] = function() {
135
+ return Map.prototype[name].apply(this.items, arguments);
136
+ };
137
+ });
138
+
139
+ /**
140
+ * Attaching the #.values method to Symbol.iterator if possible.
141
+ */
142
+ if (typeof Symbol !== 'undefined') {
143
+ BiMap.prototype[Symbol.iterator] = BiMap.prototype.entries;
144
+ InverseMap.prototype[Symbol.iterator] = InverseMap.prototype.entries;
145
+ }
146
+
147
+ /**
148
+ * Convenience known methods.
149
+ */
150
+ BiMap.prototype.inspect = function() {
151
+ var dummy = {
152
+ left: this.items,
153
+ right: this.inverse.items
154
+ };
155
+
156
+ // Trick so that node displays the name of the constructor
157
+ Object.defineProperty(dummy, 'constructor', {
158
+ value: BiMap,
159
+ enumerable: false
160
+ });
161
+
162
+ return dummy;
163
+ };
164
+
165
+ if (typeof Symbol !== 'undefined')
166
+ BiMap.prototype[Symbol.for('nodejs.util.inspect.custom')] = BiMap.prototype.inspect;
167
+
168
+ InverseMap.prototype.inspect = function() {
169
+ var dummy = {
170
+ left: this.inverse.items,
171
+ right: this.items
172
+ };
173
+
174
+ // Trick so that node displays the name of the constructor
175
+ Object.defineProperty(dummy, 'constructor', {
176
+ value: InverseMap,
177
+ enumerable: false
178
+ });
179
+
180
+ return dummy;
181
+ };
182
+
183
+ if (typeof Symbol !== 'undefined')
184
+ InverseMap.prototype[Symbol.for('nodejs.util.inspect.custom')] = InverseMap.prototype.inspect;
185
+
186
+
187
+ /**
188
+ * Static @.from function taking an arbitrary iterable & converting it into
189
+ * a bimap.
190
+ *
191
+ * @param {Iterable} iterable - Target iterable.
192
+ * @return {BiMap}
193
+ */
194
+ BiMap.from = function(iterable) {
195
+ var bimap = new BiMap();
196
+
197
+ forEach(iterable, function(value, key) {
198
+ bimap.set(key, value);
199
+ });
200
+
201
+ return bimap;
202
+ };
203
+
204
+ /**
205
+ * Exporting.
206
+ */
207
+ biMap$1 = BiMap;
208
+ return biMap$1;
209
+ }
210
+
211
+ var biMapExports = /*@__PURE__*/ requireBiMap();
212
+ const biMap = /*@__PURE__*/getDefaultExportFromCjs(biMapExports);
213
+
214
+ /**
215
+ * Mnemonist DefaultWeakMap
216
+ * =========================
217
+ *
218
+ * JavaScript implementation of a default weak map that will return a constructed
219
+ * value any time one tries to access an non-existing key. It is similar to
220
+ * DefaultMap but uses ES6 WeakMap that only holds weak reference to keys.
221
+ */
222
+
223
+ var defaultWeakMap$1;
224
+ var hasRequiredDefaultWeakMap;
225
+
226
+ function requireDefaultWeakMap () {
227
+ if (hasRequiredDefaultWeakMap) return defaultWeakMap$1;
228
+ hasRequiredDefaultWeakMap = 1;
229
+ /**
230
+ * DefaultWeakMap.
231
+ *
232
+ * @constructor
233
+ */
234
+ function DefaultWeakMap(factory) {
235
+ if (typeof factory !== 'function')
236
+ throw new Error('mnemonist/DefaultWeakMap.constructor: expecting a function.');
237
+
238
+ this.items = new WeakMap();
239
+ this.factory = factory;
240
+ }
241
+
242
+ /**
243
+ * Method used to clear the structure.
244
+ *
245
+ * @return {undefined}
246
+ */
247
+ DefaultWeakMap.prototype.clear = function() {
248
+
249
+ // Properties
250
+ this.items = new WeakMap();
251
+ };
252
+
253
+ /**
254
+ * Method used to get the value set for given key. If the key does not exist,
255
+ * the value will be created using the provided factory.
256
+ *
257
+ * @param {any} key - Target key.
258
+ * @return {any}
259
+ */
260
+ DefaultWeakMap.prototype.get = function(key) {
261
+ var value = this.items.get(key);
262
+
263
+ if (typeof value === 'undefined') {
264
+ value = this.factory(key);
265
+ this.items.set(key, value);
266
+ }
267
+
268
+ return value;
269
+ };
270
+
271
+ /**
272
+ * Method used to get the value set for given key. If the key does not exist,
273
+ * a value won't be created.
274
+ *
275
+ * @param {any} key - Target key.
276
+ * @return {any}
277
+ */
278
+ DefaultWeakMap.prototype.peek = function(key) {
279
+ return this.items.get(key);
280
+ };
281
+
282
+ /**
283
+ * Method used to set a value for given key.
284
+ *
285
+ * @param {any} key - Target key.
286
+ * @param {any} value - Value.
287
+ * @return {DefaultMap}
288
+ */
289
+ DefaultWeakMap.prototype.set = function(key, value) {
290
+ this.items.set(key, value);
291
+ return this;
292
+ };
293
+
294
+ /**
295
+ * Method used to test the existence of a key in the map.
296
+ *
297
+ * @param {any} key - Target key.
298
+ * @return {boolean}
299
+ */
300
+ DefaultWeakMap.prototype.has = function(key) {
301
+ return this.items.has(key);
302
+ };
303
+
304
+ /**
305
+ * Method used to delete target key.
306
+ *
307
+ * @param {any} key - Target key.
308
+ * @return {boolean}
309
+ */
310
+ DefaultWeakMap.prototype.delete = function(key) {
311
+ return this.items.delete(key);
312
+ };
313
+
314
+ /**
315
+ * Convenience known methods.
316
+ */
317
+ DefaultWeakMap.prototype.inspect = function() {
318
+ return this.items;
319
+ };
320
+
321
+ if (typeof Symbol !== 'undefined')
322
+ DefaultWeakMap.prototype[Symbol.for('nodejs.util.inspect.custom')] = DefaultWeakMap.prototype.inspect;
323
+
324
+ /**
325
+ * Exporting.
326
+ */
327
+ defaultWeakMap$1 = DefaultWeakMap;
328
+ return defaultWeakMap$1;
329
+ }
330
+
331
+ var defaultWeakMapExports = /*@__PURE__*/ requireDefaultWeakMap();
332
+ const defaultWeakMap = /*@__PURE__*/getDefaultExportFromCjs(defaultWeakMapExports);
333
+
334
+ /**
335
+ * Mnemonist Linked List
336
+ * ======================
337
+ *
338
+ * Singly linked list implementation. Uses raw JavaScript objects as nodes
339
+ * as benchmarks proved it was the fastest thing to do.
340
+ */
341
+
342
+ var linkedList$1;
343
+ var hasRequiredLinkedList;
344
+
345
+ function requireLinkedList () {
346
+ if (hasRequiredLinkedList) return linkedList$1;
347
+ hasRequiredLinkedList = 1;
348
+ var Iterator = requireIterator(),
349
+ forEach = requireForeach();
350
+
351
+ /**
352
+ * Linked List.
353
+ *
354
+ * @constructor
355
+ */
356
+ function LinkedList() {
357
+ this.clear();
358
+ }
359
+
360
+ /**
361
+ * Method used to clear the list.
362
+ *
363
+ * @return {undefined}
364
+ */
365
+ LinkedList.prototype.clear = function() {
366
+
367
+ // Properties
368
+ this.head = null;
369
+ this.tail = null;
370
+ this.size = 0;
371
+ };
372
+
373
+ /**
374
+ * Method used to get the first item of the list.
375
+ *
376
+ * @return {any}
377
+ */
378
+ LinkedList.prototype.first = function() {
379
+ return this.head ? this.head.item : undefined;
380
+ };
381
+ LinkedList.prototype.peek = LinkedList.prototype.first;
382
+
383
+ /**
384
+ * Method used to get the last item of the list.
385
+ *
386
+ * @return {any}
387
+ */
388
+ LinkedList.prototype.last = function() {
389
+ return this.tail ? this.tail.item : undefined;
390
+ };
391
+
392
+ /**
393
+ * Method used to add an item at the end of the list.
394
+ *
395
+ * @param {any} item - The item to add.
396
+ * @return {number}
397
+ */
398
+ LinkedList.prototype.push = function(item) {
399
+ var node = {item: item, next: null};
400
+
401
+ if (!this.head) {
402
+ this.head = node;
403
+ this.tail = node;
404
+ }
405
+ else {
406
+ this.tail.next = node;
407
+ this.tail = node;
408
+ }
409
+
410
+ this.size++;
411
+
412
+ return this.size;
413
+ };
414
+
415
+ /**
416
+ * Method used to add an item at the beginning of the list.
417
+ *
418
+ * @param {any} item - The item to add.
419
+ * @return {number}
420
+ */
421
+ LinkedList.prototype.unshift = function(item) {
422
+ var node = {item: item, next: null};
423
+
424
+ if (!this.head) {
425
+ this.head = node;
426
+ this.tail = node;
427
+ }
428
+ else {
429
+ if (!this.head.next)
430
+ this.tail = this.head;
431
+ node.next = this.head;
432
+ this.head = node;
433
+ }
434
+
435
+ this.size++;
436
+
437
+ return this.size;
438
+ };
439
+
440
+ /**
441
+ * Method used to retrieve & remove the first item of the list.
442
+ *
443
+ * @return {any}
444
+ */
445
+ LinkedList.prototype.shift = function() {
446
+ if (!this.size)
447
+ return undefined;
448
+
449
+ var node = this.head;
450
+
451
+ this.head = node.next;
452
+ this.size--;
453
+
454
+ return node.item;
455
+ };
456
+
457
+ /**
458
+ * Method used to iterate over the list.
459
+ *
460
+ * @param {function} callback - Function to call for each item.
461
+ * @param {object} scope - Optional scope.
462
+ * @return {undefined}
463
+ */
464
+ LinkedList.prototype.forEach = function(callback, scope) {
465
+ if (!this.size)
466
+ return;
467
+
468
+ scope = arguments.length > 1 ? scope : this;
469
+
470
+ var n = this.head,
471
+ i = 0;
472
+
473
+ while (n) {
474
+ callback.call(scope, n.item, i, this);
475
+ n = n.next;
476
+ i++;
477
+ }
478
+ };
479
+
480
+ /**
481
+ * Method used to convert the list into an array.
482
+ *
483
+ * @return {array}
484
+ */
485
+ LinkedList.prototype.toArray = function() {
486
+ if (!this.size)
487
+ return [];
488
+
489
+ var array = new Array(this.size);
490
+
491
+ for (var i = 0, l = this.size, n = this.head; i < l; i++) {
492
+ array[i] = n.item;
493
+ n = n.next;
494
+ }
495
+
496
+ return array;
497
+ };
498
+
499
+ /**
500
+ * Method used to create an iterator over a list's values.
501
+ *
502
+ * @return {Iterator}
503
+ */
504
+ LinkedList.prototype.values = function() {
505
+ var n = this.head;
506
+
507
+ return new Iterator(function() {
508
+ if (!n)
509
+ return {
510
+ done: true
511
+ };
512
+
513
+ var value = n.item;
514
+ n = n.next;
515
+
516
+ return {
517
+ value: value,
518
+ done: false
519
+ };
520
+ });
521
+ };
522
+
523
+ /**
524
+ * Method used to create an iterator over a list's entries.
525
+ *
526
+ * @return {Iterator}
527
+ */
528
+ LinkedList.prototype.entries = function() {
529
+ var n = this.head,
530
+ i = 0;
531
+
532
+ return new Iterator(function() {
533
+ if (!n)
534
+ return {
535
+ done: true
536
+ };
537
+
538
+ var value = n.item;
539
+ n = n.next;
540
+ i++;
541
+
542
+ return {
543
+ value: [i - 1, value],
544
+ done: false
545
+ };
546
+ });
547
+ };
548
+
549
+ /**
550
+ * Attaching the #.values method to Symbol.iterator if possible.
551
+ */
552
+ if (typeof Symbol !== 'undefined')
553
+ LinkedList.prototype[Symbol.iterator] = LinkedList.prototype.values;
554
+
555
+ /**
556
+ * Convenience known methods.
557
+ */
558
+ LinkedList.prototype.toString = function() {
559
+ return this.toArray().join(',');
560
+ };
561
+
562
+ LinkedList.prototype.toJSON = function() {
563
+ return this.toArray();
564
+ };
565
+
566
+ LinkedList.prototype.inspect = function() {
567
+ var array = this.toArray();
568
+
569
+ // Trick so that node displays the name of the constructor
570
+ Object.defineProperty(array, 'constructor', {
571
+ value: LinkedList,
572
+ enumerable: false
573
+ });
574
+
575
+ return array;
576
+ };
577
+
578
+ if (typeof Symbol !== 'undefined')
579
+ LinkedList.prototype[Symbol.for('nodejs.util.inspect.custom')] = LinkedList.prototype.inspect;
580
+
581
+ /**
582
+ * Static @.from function taking an arbitrary iterable & converting it into
583
+ * a list.
584
+ *
585
+ * @param {Iterable} iterable - Target iterable.
586
+ * @return {LinkedList}
587
+ */
588
+ LinkedList.from = function(iterable) {
589
+ var list = new LinkedList();
590
+
591
+ forEach(iterable, function(value) {
592
+ list.push(value);
593
+ });
594
+
595
+ return list;
596
+ };
597
+
598
+ /**
599
+ * Exporting.
600
+ */
601
+ linkedList$1 = LinkedList;
602
+ return linkedList$1;
603
+ }
604
+
605
+ var linkedListExports = /*@__PURE__*/ requireLinkedList();
606
+ const linkedList = /*@__PURE__*/getDefaultExportFromCjs(linkedListExports);
607
+
608
+ /**
609
+ * Mnemonist MultiMap
610
+ * ===================
611
+ *
612
+ * Implementation of a MultiMap with custom container.
613
+ */
614
+
615
+ var multiMap$1;
616
+ var hasRequiredMultiMap;
617
+
618
+ function requireMultiMap () {
619
+ if (hasRequiredMultiMap) return multiMap$1;
620
+ hasRequiredMultiMap = 1;
621
+ var Iterator = requireIterator(),
622
+ forEach = requireForeach();
623
+
624
+ /**
625
+ * MultiMap.
626
+ *
627
+ * @constructor
628
+ */
629
+ function MultiMap(Container) {
630
+
631
+ this.Container = Container || Array;
632
+ this.items = new Map();
633
+ this.clear();
634
+
635
+ Object.defineProperty(this.items, 'constructor', {
636
+ value: MultiMap,
637
+ enumerable: false
638
+ });
639
+ }
640
+
641
+ /**
642
+ * Method used to clear the structure.
643
+ *
644
+ * @return {undefined}
645
+ */
646
+ MultiMap.prototype.clear = function() {
647
+
648
+ // Properties
649
+ this.size = 0;
650
+ this.dimension = 0;
651
+ this.items.clear();
652
+ };
653
+
654
+ /**
655
+ * Method used to set a value.
656
+ *
657
+ * @param {any} key - Key.
658
+ * @param {any} value - Value to add.
659
+ * @return {MultiMap}
660
+ */
661
+ MultiMap.prototype.set = function(key, value) {
662
+ var container = this.items.get(key),
663
+ sizeBefore;
664
+
665
+ if (!container) {
666
+ this.dimension++;
667
+ container = new this.Container();
668
+ this.items.set(key, container);
669
+ }
670
+
671
+ if (this.Container === Set) {
672
+ sizeBefore = container.size;
673
+ container.add(value);
674
+
675
+ if (sizeBefore < container.size)
676
+ this.size++;
677
+ }
678
+ else {
679
+ container.push(value);
680
+ this.size++;
681
+ }
682
+
683
+ return this;
684
+ };
685
+
686
+ /**
687
+ * Method used to delete the given key.
688
+ *
689
+ * @param {any} key - Key to delete.
690
+ * @return {boolean}
691
+ */
692
+ MultiMap.prototype.delete = function(key) {
693
+ var container = this.items.get(key);
694
+
695
+ if (!container)
696
+ return false;
697
+
698
+ this.size -= (this.Container === Set ? container.size : container.length);
699
+ this.dimension--;
700
+ this.items.delete(key);
701
+
702
+ return true;
703
+ };
704
+
705
+ /**
706
+ * Method used to delete the remove an item in the container stored at the
707
+ * given key.
708
+ *
709
+ * @param {any} key - Key to delete.
710
+ * @return {boolean}
711
+ */
712
+ MultiMap.prototype.remove = function(key, value) {
713
+ var container = this.items.get(key),
714
+ wasDeleted,
715
+ index;
716
+
717
+ if (!container)
718
+ return false;
719
+
720
+ if (this.Container === Set) {
721
+ wasDeleted = container.delete(value);
722
+
723
+ if (wasDeleted)
724
+ this.size--;
725
+
726
+ if (container.size === 0) {
727
+ this.items.delete(key);
728
+ this.dimension--;
729
+ }
730
+
731
+ return wasDeleted;
732
+ }
733
+ else {
734
+ index = container.indexOf(value);
735
+
736
+ if (index === -1)
737
+ return false;
738
+
739
+ this.size--;
740
+
741
+ if (container.length === 1) {
742
+ this.items.delete(key);
743
+ this.dimension--;
744
+
745
+ return true;
746
+ }
747
+
748
+ container.splice(index, 1);
749
+
750
+ return true;
751
+ }
752
+ };
753
+
754
+ /**
755
+ * Method used to return whether the given keys exists in the map.
756
+ *
757
+ * @param {any} key - Key to check.
758
+ * @return {boolean}
759
+ */
760
+ MultiMap.prototype.has = function(key) {
761
+ return this.items.has(key);
762
+ };
763
+
764
+ /**
765
+ * Method used to return the container stored at the given key or `undefined`.
766
+ *
767
+ * @param {any} key - Key to get.
768
+ * @return {boolean}
769
+ */
770
+ MultiMap.prototype.get = function(key) {
771
+ return this.items.get(key);
772
+ };
773
+
774
+ /**
775
+ * Method used to return the multiplicity of the given key, meaning the number
776
+ * of times it is set, or, more trivially, the size of the attached container.
777
+ *
778
+ * @param {any} key - Key to check.
779
+ * @return {number}
780
+ */
781
+ MultiMap.prototype.multiplicity = function(key) {
782
+ var container = this.items.get(key);
783
+
784
+ if (typeof container === 'undefined')
785
+ return 0;
786
+
787
+ return this.Container === Set ? container.size : container.length;
788
+ };
789
+ MultiMap.prototype.count = MultiMap.prototype.multiplicity;
790
+
791
+ /**
792
+ * Method used to iterate over each of the key/value pairs.
793
+ *
794
+ * @param {function} callback - Function to call for each item.
795
+ * @param {object} scope - Optional scope.
796
+ * @return {undefined}
797
+ */
798
+ MultiMap.prototype.forEach = function(callback, scope) {
799
+ scope = arguments.length > 1 ? scope : this;
800
+
801
+ // Inner iteration function is created here to avoid creating it in the loop
802
+ var key;
803
+ function inner(value) {
804
+ callback.call(scope, value, key);
805
+ }
806
+
807
+ this.items.forEach(function(container, k) {
808
+ key = k;
809
+ container.forEach(inner);
810
+ });
811
+ };
812
+
813
+ /**
814
+ * Method used to iterate over each of the associations.
815
+ *
816
+ * @param {function} callback - Function to call for each item.
817
+ * @param {object} scope - Optional scope.
818
+ * @return {undefined}
819
+ */
820
+ MultiMap.prototype.forEachAssociation = function(callback, scope) {
821
+ scope = arguments.length > 1 ? scope : this;
822
+
823
+ this.items.forEach(callback, scope);
824
+ };
825
+
826
+ /**
827
+ * Method returning an iterator over the map's keys.
828
+ *
829
+ * @return {Iterator}
830
+ */
831
+ MultiMap.prototype.keys = function() {
832
+ return this.items.keys();
833
+ };
834
+
835
+ /**
836
+ * Method returning an iterator over the map's keys.
837
+ *
838
+ * @return {Iterator}
839
+ */
840
+ MultiMap.prototype.values = function() {
841
+ var iterator = this.items.values(),
842
+ inContainer = false,
843
+ countainer,
844
+ step,
845
+ i,
846
+ l;
847
+
848
+ if (this.Container === Set)
849
+ return new Iterator(function next() {
850
+ if (!inContainer) {
851
+ step = iterator.next();
852
+
853
+ if (step.done)
854
+ return {done: true};
855
+
856
+ inContainer = true;
857
+ countainer = step.value.values();
858
+ }
859
+
860
+ step = countainer.next();
861
+
862
+ if (step.done) {
863
+ inContainer = false;
864
+ return next();
865
+ }
866
+
867
+ return {
868
+ done: false,
869
+ value: step.value
870
+ };
871
+ });
872
+
873
+ return new Iterator(function next() {
874
+ if (!inContainer) {
875
+ step = iterator.next();
876
+
877
+ if (step.done)
878
+ return {done: true};
879
+
880
+ inContainer = true;
881
+ countainer = step.value;
882
+ i = 0;
883
+ l = countainer.length;
884
+ }
885
+
886
+ if (i >= l) {
887
+ inContainer = false;
888
+ return next();
889
+ }
890
+
891
+ return {
892
+ done: false,
893
+ value: countainer[i++]
894
+ };
895
+ });
896
+ };
897
+
898
+ /**
899
+ * Method returning an iterator over the map's entries.
900
+ *
901
+ * @return {Iterator}
902
+ */
903
+ MultiMap.prototype.entries = function() {
904
+ var iterator = this.items.entries(),
905
+ inContainer = false,
906
+ countainer,
907
+ step,
908
+ key,
909
+ i,
910
+ l;
911
+
912
+ if (this.Container === Set)
913
+ return new Iterator(function next() {
914
+ if (!inContainer) {
915
+ step = iterator.next();
916
+
917
+ if (step.done)
918
+ return {done: true};
919
+
920
+ inContainer = true;
921
+ key = step.value[0];
922
+ countainer = step.value[1].values();
923
+ }
924
+
925
+ step = countainer.next();
926
+
927
+ if (step.done) {
928
+ inContainer = false;
929
+ return next();
930
+ }
931
+
932
+ return {
933
+ done: false,
934
+ value: [key, step.value]
935
+ };
936
+ });
937
+
938
+ return new Iterator(function next() {
939
+ if (!inContainer) {
940
+ step = iterator.next();
941
+
942
+ if (step.done)
943
+ return {done: true};
944
+
945
+ inContainer = true;
946
+ key = step.value[0];
947
+ countainer = step.value[1];
948
+ i = 0;
949
+ l = countainer.length;
950
+ }
951
+
952
+ if (i >= l) {
953
+ inContainer = false;
954
+ return next();
955
+ }
956
+
957
+ return {
958
+ done: false,
959
+ value: [key, countainer[i++]]
960
+ };
961
+ });
962
+ };
963
+
964
+ /**
965
+ * Method returning an iterator over the map's containers.
966
+ *
967
+ * @return {Iterator}
968
+ */
969
+ MultiMap.prototype.containers = function() {
970
+ return this.items.values();
971
+ };
972
+
973
+ /**
974
+ * Method returning an iterator over the map's associations.
975
+ *
976
+ * @return {Iterator}
977
+ */
978
+ MultiMap.prototype.associations = function() {
979
+ return this.items.entries();
980
+ };
981
+
982
+ /**
983
+ * Attaching the #.entries method to Symbol.iterator if possible.
984
+ */
985
+ if (typeof Symbol !== 'undefined')
986
+ MultiMap.prototype[Symbol.iterator] = MultiMap.prototype.entries;
987
+
988
+ /**
989
+ * Convenience known methods.
990
+ */
991
+ MultiMap.prototype.inspect = function() {
992
+ return this.items;
993
+ };
994
+
995
+ if (typeof Symbol !== 'undefined')
996
+ MultiMap.prototype[Symbol.for('nodejs.util.inspect.custom')] = MultiMap.prototype.inspect;
997
+ MultiMap.prototype.toJSON = function() {
998
+ return this.items;
999
+ };
1000
+
1001
+ /**
1002
+ * Static @.from function taking an arbitrary iterable & converting it into
1003
+ * a structure.
1004
+ *
1005
+ * @param {Iterable} iterable - Target iterable.
1006
+ * @param {Class} Container - Container.
1007
+ * @return {MultiMap}
1008
+ */
1009
+ MultiMap.from = function(iterable, Container) {
1010
+ var map = new MultiMap(Container);
1011
+
1012
+ forEach(iterable, function(value, key) {
1013
+ map.set(key, value);
1014
+ });
1015
+
1016
+ return map;
1017
+ };
1018
+
1019
+ /**
1020
+ * Exporting.
1021
+ */
1022
+ multiMap$1 = MultiMap;
1023
+ return multiMap$1;
1024
+ }
1025
+
1026
+ var multiMapExports = /*@__PURE__*/ requireMultiMap();
1027
+ const multiMap = /*@__PURE__*/getDefaultExportFromCjs(multiMapExports);
1028
+
1029
+ /**
1030
+ * Mnemonist Queue
1031
+ * ================
1032
+ *
1033
+ * Queue implementation based on the ideas of Queue.js that seems to beat
1034
+ * a LinkedList one in performance.
1035
+ */
1036
+
1037
+ var queue$1;
1038
+ var hasRequiredQueue;
1039
+
1040
+ function requireQueue () {
1041
+ if (hasRequiredQueue) return queue$1;
1042
+ hasRequiredQueue = 1;
1043
+ var Iterator = requireIterator(),
1044
+ forEach = requireForeach();
1045
+
1046
+ /**
1047
+ * Queue
1048
+ *
1049
+ * @constructor
1050
+ */
1051
+ function Queue() {
1052
+ this.clear();
1053
+ }
1054
+
1055
+ /**
1056
+ * Method used to clear the queue.
1057
+ *
1058
+ * @return {undefined}
1059
+ */
1060
+ Queue.prototype.clear = function() {
1061
+
1062
+ // Properties
1063
+ this.items = [];
1064
+ this.offset = 0;
1065
+ this.size = 0;
1066
+ };
1067
+
1068
+ /**
1069
+ * Method used to add an item to the queue.
1070
+ *
1071
+ * @param {any} item - Item to enqueue.
1072
+ * @return {number}
1073
+ */
1074
+ Queue.prototype.enqueue = function(item) {
1075
+
1076
+ this.items.push(item);
1077
+ return ++this.size;
1078
+ };
1079
+
1080
+ /**
1081
+ * Method used to retrieve & remove the first item of the queue.
1082
+ *
1083
+ * @return {any}
1084
+ */
1085
+ Queue.prototype.dequeue = function() {
1086
+ if (!this.size)
1087
+ return;
1088
+
1089
+ var item = this.items[this.offset];
1090
+
1091
+ if (++this.offset * 2 >= this.items.length) {
1092
+ this.items = this.items.slice(this.offset);
1093
+ this.offset = 0;
1094
+ }
1095
+
1096
+ this.size--;
1097
+
1098
+ return item;
1099
+ };
1100
+
1101
+ /**
1102
+ * Method used to retrieve the first item of the queue.
1103
+ *
1104
+ * @return {any}
1105
+ */
1106
+ Queue.prototype.peek = function() {
1107
+ if (!this.size)
1108
+ return;
1109
+
1110
+ return this.items[this.offset];
1111
+ };
1112
+
1113
+ /**
1114
+ * Method used to iterate over the queue.
1115
+ *
1116
+ * @param {function} callback - Function to call for each item.
1117
+ * @param {object} scope - Optional scope.
1118
+ * @return {undefined}
1119
+ */
1120
+ Queue.prototype.forEach = function(callback, scope) {
1121
+ scope = arguments.length > 1 ? scope : this;
1122
+
1123
+ for (var i = this.offset, j = 0, l = this.items.length; i < l; i++, j++)
1124
+ callback.call(scope, this.items[i], j, this);
1125
+ };
1126
+
1127
+ /*
1128
+ * Method used to convert the queue to a JavaScript array.
1129
+ *
1130
+ * @return {array}
1131
+ */
1132
+ Queue.prototype.toArray = function() {
1133
+ return this.items.slice(this.offset);
1134
+ };
1135
+
1136
+ /**
1137
+ * Method used to create an iterator over a queue's values.
1138
+ *
1139
+ * @return {Iterator}
1140
+ */
1141
+ Queue.prototype.values = function() {
1142
+ var items = this.items,
1143
+ i = this.offset;
1144
+
1145
+ return new Iterator(function() {
1146
+ if (i >= items.length)
1147
+ return {
1148
+ done: true
1149
+ };
1150
+
1151
+ var value = items[i];
1152
+ i++;
1153
+
1154
+ return {
1155
+ value: value,
1156
+ done: false
1157
+ };
1158
+ });
1159
+ };
1160
+
1161
+ /**
1162
+ * Method used to create an iterator over a queue's entries.
1163
+ *
1164
+ * @return {Iterator}
1165
+ */
1166
+ Queue.prototype.entries = function() {
1167
+ var items = this.items,
1168
+ i = this.offset,
1169
+ j = 0;
1170
+
1171
+ return new Iterator(function() {
1172
+ if (i >= items.length)
1173
+ return {
1174
+ done: true
1175
+ };
1176
+
1177
+ var value = items[i];
1178
+ i++;
1179
+
1180
+ return {
1181
+ value: [j++, value],
1182
+ done: false
1183
+ };
1184
+ });
1185
+ };
1186
+
1187
+ /**
1188
+ * Attaching the #.values method to Symbol.iterator if possible.
1189
+ */
1190
+ if (typeof Symbol !== 'undefined')
1191
+ Queue.prototype[Symbol.iterator] = Queue.prototype.values;
1192
+
1193
+ /**
1194
+ * Convenience known methods.
1195
+ */
1196
+ Queue.prototype.toString = function() {
1197
+ return this.toArray().join(',');
1198
+ };
1199
+
1200
+ Queue.prototype.toJSON = function() {
1201
+ return this.toArray();
1202
+ };
1203
+
1204
+ Queue.prototype.inspect = function() {
1205
+ var array = this.toArray();
1206
+
1207
+ // Trick so that node displays the name of the constructor
1208
+ Object.defineProperty(array, 'constructor', {
1209
+ value: Queue,
1210
+ enumerable: false
1211
+ });
1212
+
1213
+ return array;
1214
+ };
1215
+
1216
+ if (typeof Symbol !== 'undefined')
1217
+ Queue.prototype[Symbol.for('nodejs.util.inspect.custom')] = Queue.prototype.inspect;
1218
+
1219
+ /**
1220
+ * Static @.from function taking an arbitrary iterable & converting it into
1221
+ * a queue.
1222
+ *
1223
+ * @param {Iterable} iterable - Target iterable.
1224
+ * @return {Queue}
1225
+ */
1226
+ Queue.from = function(iterable) {
1227
+ var queue = new Queue();
1228
+
1229
+ forEach(iterable, function(value) {
1230
+ queue.enqueue(value);
1231
+ });
1232
+
1233
+ return queue;
1234
+ };
1235
+
1236
+ /**
1237
+ * Static @.of function taking an arbitrary number of arguments & converting it
1238
+ * into a queue.
1239
+ *
1240
+ * @param {...any} args
1241
+ * @return {Queue}
1242
+ */
1243
+ Queue.of = function() {
1244
+ return Queue.from(arguments);
1245
+ };
1246
+
1247
+ /**
1248
+ * Exporting.
1249
+ */
1250
+ queue$1 = Queue;
1251
+ return queue$1;
1252
+ }
1253
+
1254
+ var queueExports = /*@__PURE__*/ requireQueue();
1255
+ const queue = /*@__PURE__*/getDefaultExportFromCjs(queueExports);
1256
+
1257
+ const DELAY = "LIKEC4_DELAY";
1258
+ function delay(...args) {
1259
+ let ms = 100;
1260
+ if (args.length === 2) {
1261
+ ms = o(args[0], args[1]);
1262
+ } else if (args.length === 1) {
1263
+ ms = args[0];
1264
+ }
1265
+ return new Promise((resolve) => {
1266
+ setTimeout(() => {
1267
+ resolve(DELAY);
1268
+ }, ms ?? 100);
1269
+ });
1270
+ }
1271
+ function promiseNextTick() {
1272
+ return Promise.resolve().then(() => void 0);
1273
+ }
1274
+
1275
+ const compareRelations = (a, b) => {
1276
+ const parentA = commonAncestor(a.source.model, a.target.model);
1277
+ const parentB = commonAncestor(b.source.model, b.target.model);
1278
+ if (parentA && !parentB) {
1279
+ return 1;
1280
+ }
1281
+ if (!parentA && parentB) {
1282
+ return -1;
1283
+ }
1284
+ const compareParents = parentA && parentB ? compareFqnHierarchically(parentA, parentB) : 0;
1285
+ if (compareParents !== 0) {
1286
+ return compareParents;
1287
+ }
1288
+ const compareSource = compareFqnHierarchically(a.source.model, b.source.model);
1289
+ if (compareSource !== 0) {
1290
+ return compareSource;
1291
+ }
1292
+ return compareFqnHierarchically(a.target.model, b.target.model);
1293
+ };
1294
+
1295
+ export { delay as a, biMap as b, compareRelations as c, defaultWeakMap as d, linkedList as l, multiMap as m, promiseNextTick as p, queue as q };