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