@makeswift/runtime 0.0.0-018e17a
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/actions.cjs.js +91 -0
- package/dist/actions.cjs.js.map +1 -0
- package/dist/actions.es.js +80 -0
- package/dist/actions.es.js.map +1 -0
- package/dist/box-model.cjs.js +9 -0
- package/dist/box-model.cjs.js.map +1 -0
- package/dist/box-model.es.js +3 -0
- package/dist/box-model.es.js.map +1 -0
- package/dist/box-models.cjs.js +236 -0
- package/dist/box-models.cjs.js.map +1 -0
- package/dist/box-models.es.js +227 -0
- package/dist/box-models.es.js.map +1 -0
- package/dist/components.cjs.js +305 -0
- package/dist/components.cjs.js.map +1 -0
- package/dist/components.es.js +298 -0
- package/dist/components.es.js.map +1 -0
- package/dist/main.cjs.js +8 -0
- package/dist/main.cjs.js.map +1 -0
- package/dist/main.es.js +2 -0
- package/dist/main.es.js.map +1 -0
- package/dist/prop-controllers.cjs.js +177 -0
- package/dist/prop-controllers.cjs.js.map +1 -0
- package/dist/prop-controllers.es.js +174 -0
- package/dist/prop-controllers.es.js.map +1 -0
- package/dist/react-builder-preview.cjs.js +4301 -0
- package/dist/react-builder-preview.cjs.js.map +1 -0
- package/dist/react-builder-preview.es.js +4294 -0
- package/dist/react-builder-preview.es.js.map +1 -0
- package/dist/react.cjs.js +13 -0
- package/dist/react.cjs.js.map +1 -0
- package/dist/react.cjs2.js +835 -0
- package/dist/react.cjs2.js.map +1 -0
- package/dist/react.es.js +4 -0
- package/dist/react.es.js.map +1 -0
- package/dist/react.es2.js +810 -0
- package/dist/react.es2.js.map +1 -0
- package/dist/types/box-model.d.ts +3 -0
- package/dist/types/box-model.d.ts.map +1 -0
- package/dist/types/components/Root/Root.d.ts +11 -0
- package/dist/types/components/Root/Root.d.ts.map +1 -0
- package/dist/types/components/Root/components/Placeholder/index.d.ts +5 -0
- package/dist/types/components/Root/components/Placeholder/index.d.ts.map +1 -0
- package/dist/types/components/Root/index.d.ts +2 -0
- package/dist/types/components/Root/index.d.ts.map +1 -0
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/components/index.d.ts.map +1 -0
- package/dist/types/components/utils/columns.d.ts +2 -0
- package/dist/types/components/utils/columns.d.ts.map +1 -0
- package/dist/types/components/utils/cssMediaRules.d.ts +18 -0
- package/dist/types/components/utils/cssMediaRules.d.ts.map +1 -0
- package/dist/types/components/utils/devices.d.ts +16 -0
- package/dist/types/components/utils/devices.d.ts.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/prop-controllers/descriptors.d.ts +656 -0
- package/dist/types/prop-controllers/descriptors.d.ts.map +1 -0
- package/dist/types/prop-controllers/index.d.ts +3 -0
- package/dist/types/prop-controllers/index.d.ts.map +1 -0
- package/dist/types/react.d.ts +4 -0
- package/dist/types/react.d.ts.map +1 -0
- package/dist/types/runtimes/react.d.ts +28 -0
- package/dist/types/runtimes/react.d.ts.map +1 -0
- package/dist/types/state/actions.d.ts +124 -0
- package/dist/types/state/actions.d.ts.map +1 -0
- package/dist/types/state/modules/box-models.d.ts +22 -0
- package/dist/types/state/modules/box-models.d.ts.map +1 -0
- package/dist/types/state/modules/components-meta.d.ts +14 -0
- package/dist/types/state/modules/components-meta.d.ts.map +1 -0
- package/dist/types/state/modules/prop-controllers.d.ts +10 -0
- package/dist/types/state/modules/prop-controllers.d.ts.map +1 -0
- package/dist/types/state/modules/react-components.d.ts +10 -0
- package/dist/types/state/modules/react-components.d.ts.map +1 -0
- package/dist/types/state/modules/read-only-documents.d.ts +28 -0
- package/dist/types/state/modules/read-only-documents.d.ts.map +1 -0
- package/dist/types/state/modules/read-write-documents.d.ts +13 -0
- package/dist/types/state/modules/read-write-documents.d.ts.map +1 -0
- package/dist/types/state/react-builder-preview.d.ts +39 -0
- package/dist/types/state/react-builder-preview.d.ts.map +1 -0
- package/dist/types/state/react-page.d.ts +28 -0
- package/dist/types/state/react-page.d.ts.map +1 -0
- package/dist/types/utils/deepEqual.d.ts +3 -0
- package/dist/types/utils/deepEqual.d.ts.map +1 -0
- package/dist/types/utils/is.d.ts +2 -0
- package/dist/types/utils/is.d.ts.map +1 -0
- package/dist/types/utils/shallowEqual.d.ts +3 -0
- package/dist/types/utils/shallowEqual.d.ts.map +1 -0
- package/package.json +103 -0
|
@@ -0,0 +1,4301 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports[Symbol.toStringTag] = "Module";
|
|
3
|
+
var react = require("./react.cjs2.js");
|
|
4
|
+
var actions = require("./actions.cjs.js");
|
|
5
|
+
var boxModels = require("./box-models.cjs.js");
|
|
6
|
+
require("react");
|
|
7
|
+
function is$1(x, y) {
|
|
8
|
+
if (x === y)
|
|
9
|
+
return x !== 0 || y !== 0 || 1 / x === 1 / y;
|
|
10
|
+
return x !== x && y !== y;
|
|
11
|
+
}
|
|
12
|
+
const { hasOwnProperty: hasOwnProperty$2 } = Object.prototype;
|
|
13
|
+
const shallowEqual = (a, b) => {
|
|
14
|
+
if (is$1(a, b))
|
|
15
|
+
return true;
|
|
16
|
+
if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
|
|
17
|
+
return false;
|
|
18
|
+
const keysA = Object.keys(a);
|
|
19
|
+
const keysB = Object.keys(b);
|
|
20
|
+
if (keysA.length !== keysB.length)
|
|
21
|
+
return false;
|
|
22
|
+
for (let i = 0; i < keysA.length; i += 1) {
|
|
23
|
+
if (!hasOwnProperty$2.call(b, keysA[i]) || !is$1(a[keysA[i]], b[keysA[i]]))
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
return true;
|
|
27
|
+
};
|
|
28
|
+
const { hasOwnProperty: hasOwnProperty$1 } = Object.prototype;
|
|
29
|
+
const deepEqual$1 = (a, b) => {
|
|
30
|
+
if (shallowEqual(a, b))
|
|
31
|
+
return true;
|
|
32
|
+
if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
|
|
33
|
+
return false;
|
|
34
|
+
const keysA = Object.keys(a);
|
|
35
|
+
const keysB = Object.keys(b);
|
|
36
|
+
if (keysA.length !== keysB.length)
|
|
37
|
+
return false;
|
|
38
|
+
for (let i = 0; i < keysA.length; i += 1) {
|
|
39
|
+
if (!hasOwnProperty$1.call(b, keysA[i]) || !deepEqual$1(a[keysA[i]], b[keysA[i]]))
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
return true;
|
|
43
|
+
};
|
|
44
|
+
var DELETE = "delete";
|
|
45
|
+
var SHIFT = 5;
|
|
46
|
+
var SIZE = 1 << SHIFT;
|
|
47
|
+
var MASK = SIZE - 1;
|
|
48
|
+
var NOT_SET = {};
|
|
49
|
+
function MakeRef() {
|
|
50
|
+
return { value: false };
|
|
51
|
+
}
|
|
52
|
+
function SetRef(ref) {
|
|
53
|
+
if (ref) {
|
|
54
|
+
ref.value = true;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function OwnerID() {
|
|
58
|
+
}
|
|
59
|
+
function ensureSize(iter) {
|
|
60
|
+
if (iter.size === void 0) {
|
|
61
|
+
iter.size = iter.__iterate(returnTrue);
|
|
62
|
+
}
|
|
63
|
+
return iter.size;
|
|
64
|
+
}
|
|
65
|
+
function wrapIndex(iter, index) {
|
|
66
|
+
if (typeof index !== "number") {
|
|
67
|
+
var uint32Index = index >>> 0;
|
|
68
|
+
if ("" + uint32Index !== index || uint32Index === 4294967295) {
|
|
69
|
+
return NaN;
|
|
70
|
+
}
|
|
71
|
+
index = uint32Index;
|
|
72
|
+
}
|
|
73
|
+
return index < 0 ? ensureSize(iter) + index : index;
|
|
74
|
+
}
|
|
75
|
+
function returnTrue() {
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
function wholeSlice(begin, end, size) {
|
|
79
|
+
return (begin === 0 && !isNeg(begin) || size !== void 0 && begin <= -size) && (end === void 0 || size !== void 0 && end >= size);
|
|
80
|
+
}
|
|
81
|
+
function resolveBegin(begin, size) {
|
|
82
|
+
return resolveIndex(begin, size, 0);
|
|
83
|
+
}
|
|
84
|
+
function resolveEnd(end, size) {
|
|
85
|
+
return resolveIndex(end, size, size);
|
|
86
|
+
}
|
|
87
|
+
function resolveIndex(index, size, defaultIndex) {
|
|
88
|
+
return index === void 0 ? defaultIndex : isNeg(index) ? size === Infinity ? size : Math.max(0, size + index) | 0 : size === void 0 || size === index ? index : Math.min(size, index) | 0;
|
|
89
|
+
}
|
|
90
|
+
function isNeg(value) {
|
|
91
|
+
return value < 0 || value === 0 && 1 / value === -Infinity;
|
|
92
|
+
}
|
|
93
|
+
var IS_COLLECTION_SYMBOL = "@@__IMMUTABLE_ITERABLE__@@";
|
|
94
|
+
function isCollection(maybeCollection) {
|
|
95
|
+
return Boolean(maybeCollection && maybeCollection[IS_COLLECTION_SYMBOL]);
|
|
96
|
+
}
|
|
97
|
+
var IS_KEYED_SYMBOL = "@@__IMMUTABLE_KEYED__@@";
|
|
98
|
+
function isKeyed(maybeKeyed) {
|
|
99
|
+
return Boolean(maybeKeyed && maybeKeyed[IS_KEYED_SYMBOL]);
|
|
100
|
+
}
|
|
101
|
+
var IS_INDEXED_SYMBOL = "@@__IMMUTABLE_INDEXED__@@";
|
|
102
|
+
function isIndexed(maybeIndexed) {
|
|
103
|
+
return Boolean(maybeIndexed && maybeIndexed[IS_INDEXED_SYMBOL]);
|
|
104
|
+
}
|
|
105
|
+
function isAssociative(maybeAssociative) {
|
|
106
|
+
return isKeyed(maybeAssociative) || isIndexed(maybeAssociative);
|
|
107
|
+
}
|
|
108
|
+
var Collection = function Collection2(value) {
|
|
109
|
+
return isCollection(value) ? value : Seq(value);
|
|
110
|
+
};
|
|
111
|
+
var KeyedCollection = /* @__PURE__ */ function(Collection3) {
|
|
112
|
+
function KeyedCollection2(value) {
|
|
113
|
+
return isKeyed(value) ? value : KeyedSeq(value);
|
|
114
|
+
}
|
|
115
|
+
if (Collection3)
|
|
116
|
+
KeyedCollection2.__proto__ = Collection3;
|
|
117
|
+
KeyedCollection2.prototype = Object.create(Collection3 && Collection3.prototype);
|
|
118
|
+
KeyedCollection2.prototype.constructor = KeyedCollection2;
|
|
119
|
+
return KeyedCollection2;
|
|
120
|
+
}(Collection);
|
|
121
|
+
var IndexedCollection = /* @__PURE__ */ function(Collection3) {
|
|
122
|
+
function IndexedCollection2(value) {
|
|
123
|
+
return isIndexed(value) ? value : IndexedSeq(value);
|
|
124
|
+
}
|
|
125
|
+
if (Collection3)
|
|
126
|
+
IndexedCollection2.__proto__ = Collection3;
|
|
127
|
+
IndexedCollection2.prototype = Object.create(Collection3 && Collection3.prototype);
|
|
128
|
+
IndexedCollection2.prototype.constructor = IndexedCollection2;
|
|
129
|
+
return IndexedCollection2;
|
|
130
|
+
}(Collection);
|
|
131
|
+
var SetCollection = /* @__PURE__ */ function(Collection3) {
|
|
132
|
+
function SetCollection2(value) {
|
|
133
|
+
return isCollection(value) && !isAssociative(value) ? value : SetSeq(value);
|
|
134
|
+
}
|
|
135
|
+
if (Collection3)
|
|
136
|
+
SetCollection2.__proto__ = Collection3;
|
|
137
|
+
SetCollection2.prototype = Object.create(Collection3 && Collection3.prototype);
|
|
138
|
+
SetCollection2.prototype.constructor = SetCollection2;
|
|
139
|
+
return SetCollection2;
|
|
140
|
+
}(Collection);
|
|
141
|
+
Collection.Keyed = KeyedCollection;
|
|
142
|
+
Collection.Indexed = IndexedCollection;
|
|
143
|
+
Collection.Set = SetCollection;
|
|
144
|
+
var IS_SEQ_SYMBOL = "@@__IMMUTABLE_SEQ__@@";
|
|
145
|
+
function isSeq(maybeSeq) {
|
|
146
|
+
return Boolean(maybeSeq && maybeSeq[IS_SEQ_SYMBOL]);
|
|
147
|
+
}
|
|
148
|
+
var IS_RECORD_SYMBOL = "@@__IMMUTABLE_RECORD__@@";
|
|
149
|
+
function isRecord(maybeRecord) {
|
|
150
|
+
return Boolean(maybeRecord && maybeRecord[IS_RECORD_SYMBOL]);
|
|
151
|
+
}
|
|
152
|
+
function isImmutable(maybeImmutable) {
|
|
153
|
+
return isCollection(maybeImmutable) || isRecord(maybeImmutable);
|
|
154
|
+
}
|
|
155
|
+
var IS_ORDERED_SYMBOL = "@@__IMMUTABLE_ORDERED__@@";
|
|
156
|
+
function isOrdered(maybeOrdered) {
|
|
157
|
+
return Boolean(maybeOrdered && maybeOrdered[IS_ORDERED_SYMBOL]);
|
|
158
|
+
}
|
|
159
|
+
var ITERATE_KEYS = 0;
|
|
160
|
+
var ITERATE_VALUES = 1;
|
|
161
|
+
var ITERATE_ENTRIES = 2;
|
|
162
|
+
var REAL_ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator;
|
|
163
|
+
var FAUX_ITERATOR_SYMBOL = "@@iterator";
|
|
164
|
+
var ITERATOR_SYMBOL = REAL_ITERATOR_SYMBOL || FAUX_ITERATOR_SYMBOL;
|
|
165
|
+
var Iterator = function Iterator2(next) {
|
|
166
|
+
this.next = next;
|
|
167
|
+
};
|
|
168
|
+
Iterator.prototype.toString = function toString2() {
|
|
169
|
+
return "[Iterator]";
|
|
170
|
+
};
|
|
171
|
+
Iterator.KEYS = ITERATE_KEYS;
|
|
172
|
+
Iterator.VALUES = ITERATE_VALUES;
|
|
173
|
+
Iterator.ENTRIES = ITERATE_ENTRIES;
|
|
174
|
+
Iterator.prototype.inspect = Iterator.prototype.toSource = function() {
|
|
175
|
+
return this.toString();
|
|
176
|
+
};
|
|
177
|
+
Iterator.prototype[ITERATOR_SYMBOL] = function() {
|
|
178
|
+
return this;
|
|
179
|
+
};
|
|
180
|
+
function iteratorValue(type, k, v, iteratorResult) {
|
|
181
|
+
var value = type === 0 ? k : type === 1 ? v : [k, v];
|
|
182
|
+
iteratorResult ? iteratorResult.value = value : iteratorResult = {
|
|
183
|
+
value,
|
|
184
|
+
done: false
|
|
185
|
+
};
|
|
186
|
+
return iteratorResult;
|
|
187
|
+
}
|
|
188
|
+
function iteratorDone() {
|
|
189
|
+
return { value: void 0, done: true };
|
|
190
|
+
}
|
|
191
|
+
function hasIterator(maybeIterable) {
|
|
192
|
+
if (Array.isArray(maybeIterable)) {
|
|
193
|
+
return true;
|
|
194
|
+
}
|
|
195
|
+
return !!getIteratorFn(maybeIterable);
|
|
196
|
+
}
|
|
197
|
+
function isIterator(maybeIterator) {
|
|
198
|
+
return maybeIterator && typeof maybeIterator.next === "function";
|
|
199
|
+
}
|
|
200
|
+
function getIterator(iterable) {
|
|
201
|
+
var iteratorFn = getIteratorFn(iterable);
|
|
202
|
+
return iteratorFn && iteratorFn.call(iterable);
|
|
203
|
+
}
|
|
204
|
+
function getIteratorFn(iterable) {
|
|
205
|
+
var iteratorFn = iterable && (REAL_ITERATOR_SYMBOL && iterable[REAL_ITERATOR_SYMBOL] || iterable[FAUX_ITERATOR_SYMBOL]);
|
|
206
|
+
if (typeof iteratorFn === "function") {
|
|
207
|
+
return iteratorFn;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
function isEntriesIterable(maybeIterable) {
|
|
211
|
+
var iteratorFn = getIteratorFn(maybeIterable);
|
|
212
|
+
return iteratorFn && iteratorFn === maybeIterable.entries;
|
|
213
|
+
}
|
|
214
|
+
function isKeysIterable(maybeIterable) {
|
|
215
|
+
var iteratorFn = getIteratorFn(maybeIterable);
|
|
216
|
+
return iteratorFn && iteratorFn === maybeIterable.keys;
|
|
217
|
+
}
|
|
218
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
219
|
+
function isArrayLike(value) {
|
|
220
|
+
if (Array.isArray(value) || typeof value === "string") {
|
|
221
|
+
return true;
|
|
222
|
+
}
|
|
223
|
+
return value && typeof value === "object" && Number.isInteger(value.length) && value.length >= 0 && (value.length === 0 ? Object.keys(value).length === 1 : value.hasOwnProperty(value.length - 1));
|
|
224
|
+
}
|
|
225
|
+
var Seq = /* @__PURE__ */ function(Collection3) {
|
|
226
|
+
function Seq2(value) {
|
|
227
|
+
return value === null || value === void 0 ? emptySequence() : isImmutable(value) ? value.toSeq() : seqFromValue(value);
|
|
228
|
+
}
|
|
229
|
+
if (Collection3)
|
|
230
|
+
Seq2.__proto__ = Collection3;
|
|
231
|
+
Seq2.prototype = Object.create(Collection3 && Collection3.prototype);
|
|
232
|
+
Seq2.prototype.constructor = Seq2;
|
|
233
|
+
Seq2.prototype.toSeq = function toSeq2() {
|
|
234
|
+
return this;
|
|
235
|
+
};
|
|
236
|
+
Seq2.prototype.toString = function toString4() {
|
|
237
|
+
return this.__toString("Seq {", "}");
|
|
238
|
+
};
|
|
239
|
+
Seq2.prototype.cacheResult = function cacheResult() {
|
|
240
|
+
if (!this._cache && this.__iterateUncached) {
|
|
241
|
+
this._cache = this.entrySeq().toArray();
|
|
242
|
+
this.size = this._cache.length;
|
|
243
|
+
}
|
|
244
|
+
return this;
|
|
245
|
+
};
|
|
246
|
+
Seq2.prototype.__iterate = function __iterate(fn, reverse3) {
|
|
247
|
+
var cache = this._cache;
|
|
248
|
+
if (cache) {
|
|
249
|
+
var size = cache.length;
|
|
250
|
+
var i = 0;
|
|
251
|
+
while (i !== size) {
|
|
252
|
+
var entry = cache[reverse3 ? size - ++i : i++];
|
|
253
|
+
if (fn(entry[1], entry[0], this) === false) {
|
|
254
|
+
break;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return i;
|
|
258
|
+
}
|
|
259
|
+
return this.__iterateUncached(fn, reverse3);
|
|
260
|
+
};
|
|
261
|
+
Seq2.prototype.__iterator = function __iterator(type, reverse3) {
|
|
262
|
+
var cache = this._cache;
|
|
263
|
+
if (cache) {
|
|
264
|
+
var size = cache.length;
|
|
265
|
+
var i = 0;
|
|
266
|
+
return new Iterator(function() {
|
|
267
|
+
if (i === size) {
|
|
268
|
+
return iteratorDone();
|
|
269
|
+
}
|
|
270
|
+
var entry = cache[reverse3 ? size - ++i : i++];
|
|
271
|
+
return iteratorValue(type, entry[0], entry[1]);
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
return this.__iteratorUncached(type, reverse3);
|
|
275
|
+
};
|
|
276
|
+
return Seq2;
|
|
277
|
+
}(Collection);
|
|
278
|
+
var KeyedSeq = /* @__PURE__ */ function(Seq2) {
|
|
279
|
+
function KeyedSeq2(value) {
|
|
280
|
+
return value === null || value === void 0 ? emptySequence().toKeyedSeq() : isCollection(value) ? isKeyed(value) ? value.toSeq() : value.fromEntrySeq() : isRecord(value) ? value.toSeq() : keyedSeqFromValue(value);
|
|
281
|
+
}
|
|
282
|
+
if (Seq2)
|
|
283
|
+
KeyedSeq2.__proto__ = Seq2;
|
|
284
|
+
KeyedSeq2.prototype = Object.create(Seq2 && Seq2.prototype);
|
|
285
|
+
KeyedSeq2.prototype.constructor = KeyedSeq2;
|
|
286
|
+
KeyedSeq2.prototype.toKeyedSeq = function toKeyedSeq3() {
|
|
287
|
+
return this;
|
|
288
|
+
};
|
|
289
|
+
return KeyedSeq2;
|
|
290
|
+
}(Seq);
|
|
291
|
+
var IndexedSeq = /* @__PURE__ */ function(Seq2) {
|
|
292
|
+
function IndexedSeq2(value) {
|
|
293
|
+
return value === null || value === void 0 ? emptySequence() : isCollection(value) ? isKeyed(value) ? value.entrySeq() : value.toIndexedSeq() : isRecord(value) ? value.toSeq().entrySeq() : indexedSeqFromValue(value);
|
|
294
|
+
}
|
|
295
|
+
if (Seq2)
|
|
296
|
+
IndexedSeq2.__proto__ = Seq2;
|
|
297
|
+
IndexedSeq2.prototype = Object.create(Seq2 && Seq2.prototype);
|
|
298
|
+
IndexedSeq2.prototype.constructor = IndexedSeq2;
|
|
299
|
+
IndexedSeq2.of = function of() {
|
|
300
|
+
return IndexedSeq2(arguments);
|
|
301
|
+
};
|
|
302
|
+
IndexedSeq2.prototype.toIndexedSeq = function toIndexedSeq2() {
|
|
303
|
+
return this;
|
|
304
|
+
};
|
|
305
|
+
IndexedSeq2.prototype.toString = function toString4() {
|
|
306
|
+
return this.__toString("Seq [", "]");
|
|
307
|
+
};
|
|
308
|
+
return IndexedSeq2;
|
|
309
|
+
}(Seq);
|
|
310
|
+
var SetSeq = /* @__PURE__ */ function(Seq2) {
|
|
311
|
+
function SetSeq2(value) {
|
|
312
|
+
return (isCollection(value) && !isAssociative(value) ? value : IndexedSeq(value)).toSetSeq();
|
|
313
|
+
}
|
|
314
|
+
if (Seq2)
|
|
315
|
+
SetSeq2.__proto__ = Seq2;
|
|
316
|
+
SetSeq2.prototype = Object.create(Seq2 && Seq2.prototype);
|
|
317
|
+
SetSeq2.prototype.constructor = SetSeq2;
|
|
318
|
+
SetSeq2.of = function of() {
|
|
319
|
+
return SetSeq2(arguments);
|
|
320
|
+
};
|
|
321
|
+
SetSeq2.prototype.toSetSeq = function toSetSeq2() {
|
|
322
|
+
return this;
|
|
323
|
+
};
|
|
324
|
+
return SetSeq2;
|
|
325
|
+
}(Seq);
|
|
326
|
+
Seq.isSeq = isSeq;
|
|
327
|
+
Seq.Keyed = KeyedSeq;
|
|
328
|
+
Seq.Set = SetSeq;
|
|
329
|
+
Seq.Indexed = IndexedSeq;
|
|
330
|
+
Seq.prototype[IS_SEQ_SYMBOL] = true;
|
|
331
|
+
var ArraySeq = /* @__PURE__ */ function(IndexedSeq2) {
|
|
332
|
+
function ArraySeq2(array) {
|
|
333
|
+
this._array = array;
|
|
334
|
+
this.size = array.length;
|
|
335
|
+
}
|
|
336
|
+
if (IndexedSeq2)
|
|
337
|
+
ArraySeq2.__proto__ = IndexedSeq2;
|
|
338
|
+
ArraySeq2.prototype = Object.create(IndexedSeq2 && IndexedSeq2.prototype);
|
|
339
|
+
ArraySeq2.prototype.constructor = ArraySeq2;
|
|
340
|
+
ArraySeq2.prototype.get = function get10(index, notSetValue) {
|
|
341
|
+
return this.has(index) ? this._array[wrapIndex(this, index)] : notSetValue;
|
|
342
|
+
};
|
|
343
|
+
ArraySeq2.prototype.__iterate = function __iterate(fn, reverse3) {
|
|
344
|
+
var array = this._array;
|
|
345
|
+
var size = array.length;
|
|
346
|
+
var i = 0;
|
|
347
|
+
while (i !== size) {
|
|
348
|
+
var ii = reverse3 ? size - ++i : i++;
|
|
349
|
+
if (fn(array[ii], ii, this) === false) {
|
|
350
|
+
break;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
return i;
|
|
354
|
+
};
|
|
355
|
+
ArraySeq2.prototype.__iterator = function __iterator(type, reverse3) {
|
|
356
|
+
var array = this._array;
|
|
357
|
+
var size = array.length;
|
|
358
|
+
var i = 0;
|
|
359
|
+
return new Iterator(function() {
|
|
360
|
+
if (i === size) {
|
|
361
|
+
return iteratorDone();
|
|
362
|
+
}
|
|
363
|
+
var ii = reverse3 ? size - ++i : i++;
|
|
364
|
+
return iteratorValue(type, ii, array[ii]);
|
|
365
|
+
});
|
|
366
|
+
};
|
|
367
|
+
return ArraySeq2;
|
|
368
|
+
}(IndexedSeq);
|
|
369
|
+
var ObjectSeq = /* @__PURE__ */ function(KeyedSeq2) {
|
|
370
|
+
function ObjectSeq2(object) {
|
|
371
|
+
var keys2 = Object.keys(object);
|
|
372
|
+
this._object = object;
|
|
373
|
+
this._keys = keys2;
|
|
374
|
+
this.size = keys2.length;
|
|
375
|
+
}
|
|
376
|
+
if (KeyedSeq2)
|
|
377
|
+
ObjectSeq2.__proto__ = KeyedSeq2;
|
|
378
|
+
ObjectSeq2.prototype = Object.create(KeyedSeq2 && KeyedSeq2.prototype);
|
|
379
|
+
ObjectSeq2.prototype.constructor = ObjectSeq2;
|
|
380
|
+
ObjectSeq2.prototype.get = function get10(key, notSetValue) {
|
|
381
|
+
if (notSetValue !== void 0 && !this.has(key)) {
|
|
382
|
+
return notSetValue;
|
|
383
|
+
}
|
|
384
|
+
return this._object[key];
|
|
385
|
+
};
|
|
386
|
+
ObjectSeq2.prototype.has = function has4(key) {
|
|
387
|
+
return hasOwnProperty.call(this._object, key);
|
|
388
|
+
};
|
|
389
|
+
ObjectSeq2.prototype.__iterate = function __iterate(fn, reverse3) {
|
|
390
|
+
var object = this._object;
|
|
391
|
+
var keys2 = this._keys;
|
|
392
|
+
var size = keys2.length;
|
|
393
|
+
var i = 0;
|
|
394
|
+
while (i !== size) {
|
|
395
|
+
var key = keys2[reverse3 ? size - ++i : i++];
|
|
396
|
+
if (fn(object[key], key, this) === false) {
|
|
397
|
+
break;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
return i;
|
|
401
|
+
};
|
|
402
|
+
ObjectSeq2.prototype.__iterator = function __iterator(type, reverse3) {
|
|
403
|
+
var object = this._object;
|
|
404
|
+
var keys2 = this._keys;
|
|
405
|
+
var size = keys2.length;
|
|
406
|
+
var i = 0;
|
|
407
|
+
return new Iterator(function() {
|
|
408
|
+
if (i === size) {
|
|
409
|
+
return iteratorDone();
|
|
410
|
+
}
|
|
411
|
+
var key = keys2[reverse3 ? size - ++i : i++];
|
|
412
|
+
return iteratorValue(type, key, object[key]);
|
|
413
|
+
});
|
|
414
|
+
};
|
|
415
|
+
return ObjectSeq2;
|
|
416
|
+
}(KeyedSeq);
|
|
417
|
+
ObjectSeq.prototype[IS_ORDERED_SYMBOL] = true;
|
|
418
|
+
var CollectionSeq = /* @__PURE__ */ function(IndexedSeq2) {
|
|
419
|
+
function CollectionSeq2(collection) {
|
|
420
|
+
this._collection = collection;
|
|
421
|
+
this.size = collection.length || collection.size;
|
|
422
|
+
}
|
|
423
|
+
if (IndexedSeq2)
|
|
424
|
+
CollectionSeq2.__proto__ = IndexedSeq2;
|
|
425
|
+
CollectionSeq2.prototype = Object.create(IndexedSeq2 && IndexedSeq2.prototype);
|
|
426
|
+
CollectionSeq2.prototype.constructor = CollectionSeq2;
|
|
427
|
+
CollectionSeq2.prototype.__iterateUncached = function __iterateUncached(fn, reverse3) {
|
|
428
|
+
if (reverse3) {
|
|
429
|
+
return this.cacheResult().__iterate(fn, reverse3);
|
|
430
|
+
}
|
|
431
|
+
var collection = this._collection;
|
|
432
|
+
var iterator = getIterator(collection);
|
|
433
|
+
var iterations = 0;
|
|
434
|
+
if (isIterator(iterator)) {
|
|
435
|
+
var step;
|
|
436
|
+
while (!(step = iterator.next()).done) {
|
|
437
|
+
if (fn(step.value, iterations++, this) === false) {
|
|
438
|
+
break;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
return iterations;
|
|
443
|
+
};
|
|
444
|
+
CollectionSeq2.prototype.__iteratorUncached = function __iteratorUncached(type, reverse3) {
|
|
445
|
+
if (reverse3) {
|
|
446
|
+
return this.cacheResult().__iterator(type, reverse3);
|
|
447
|
+
}
|
|
448
|
+
var collection = this._collection;
|
|
449
|
+
var iterator = getIterator(collection);
|
|
450
|
+
if (!isIterator(iterator)) {
|
|
451
|
+
return new Iterator(iteratorDone);
|
|
452
|
+
}
|
|
453
|
+
var iterations = 0;
|
|
454
|
+
return new Iterator(function() {
|
|
455
|
+
var step = iterator.next();
|
|
456
|
+
return step.done ? step : iteratorValue(type, iterations++, step.value);
|
|
457
|
+
});
|
|
458
|
+
};
|
|
459
|
+
return CollectionSeq2;
|
|
460
|
+
}(IndexedSeq);
|
|
461
|
+
var EMPTY_SEQ;
|
|
462
|
+
function emptySequence() {
|
|
463
|
+
return EMPTY_SEQ || (EMPTY_SEQ = new ArraySeq([]));
|
|
464
|
+
}
|
|
465
|
+
function keyedSeqFromValue(value) {
|
|
466
|
+
var seq = maybeIndexedSeqFromValue(value);
|
|
467
|
+
if (seq) {
|
|
468
|
+
return seq.fromEntrySeq();
|
|
469
|
+
}
|
|
470
|
+
if (typeof value === "object") {
|
|
471
|
+
return new ObjectSeq(value);
|
|
472
|
+
}
|
|
473
|
+
throw new TypeError("Expected Array or collection object of [k, v] entries, or keyed object: " + value);
|
|
474
|
+
}
|
|
475
|
+
function indexedSeqFromValue(value) {
|
|
476
|
+
var seq = maybeIndexedSeqFromValue(value);
|
|
477
|
+
if (seq) {
|
|
478
|
+
return seq;
|
|
479
|
+
}
|
|
480
|
+
throw new TypeError("Expected Array or collection object of values: " + value);
|
|
481
|
+
}
|
|
482
|
+
function seqFromValue(value) {
|
|
483
|
+
var seq = maybeIndexedSeqFromValue(value);
|
|
484
|
+
if (seq) {
|
|
485
|
+
return isEntriesIterable(value) ? seq.fromEntrySeq() : isKeysIterable(value) ? seq.toSetSeq() : seq;
|
|
486
|
+
}
|
|
487
|
+
if (typeof value === "object") {
|
|
488
|
+
return new ObjectSeq(value);
|
|
489
|
+
}
|
|
490
|
+
throw new TypeError("Expected Array or collection object of values, or keyed object: " + value);
|
|
491
|
+
}
|
|
492
|
+
function maybeIndexedSeqFromValue(value) {
|
|
493
|
+
return isArrayLike(value) ? new ArraySeq(value) : hasIterator(value) ? new CollectionSeq(value) : void 0;
|
|
494
|
+
}
|
|
495
|
+
var IS_MAP_SYMBOL = "@@__IMMUTABLE_MAP__@@";
|
|
496
|
+
function isMap(maybeMap) {
|
|
497
|
+
return Boolean(maybeMap && maybeMap[IS_MAP_SYMBOL]);
|
|
498
|
+
}
|
|
499
|
+
function isOrderedMap(maybeOrderedMap) {
|
|
500
|
+
return isMap(maybeOrderedMap) && isOrdered(maybeOrderedMap);
|
|
501
|
+
}
|
|
502
|
+
function isValueObject(maybeValue) {
|
|
503
|
+
return Boolean(maybeValue && typeof maybeValue.equals === "function" && typeof maybeValue.hashCode === "function");
|
|
504
|
+
}
|
|
505
|
+
function is(valueA, valueB) {
|
|
506
|
+
if (valueA === valueB || valueA !== valueA && valueB !== valueB) {
|
|
507
|
+
return true;
|
|
508
|
+
}
|
|
509
|
+
if (!valueA || !valueB) {
|
|
510
|
+
return false;
|
|
511
|
+
}
|
|
512
|
+
if (typeof valueA.valueOf === "function" && typeof valueB.valueOf === "function") {
|
|
513
|
+
valueA = valueA.valueOf();
|
|
514
|
+
valueB = valueB.valueOf();
|
|
515
|
+
if (valueA === valueB || valueA !== valueA && valueB !== valueB) {
|
|
516
|
+
return true;
|
|
517
|
+
}
|
|
518
|
+
if (!valueA || !valueB) {
|
|
519
|
+
return false;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
return !!(isValueObject(valueA) && isValueObject(valueB) && valueA.equals(valueB));
|
|
523
|
+
}
|
|
524
|
+
var imul = typeof Math.imul === "function" && Math.imul(4294967295, 2) === -2 ? Math.imul : function imul2(a, b) {
|
|
525
|
+
a |= 0;
|
|
526
|
+
b |= 0;
|
|
527
|
+
var c = a & 65535;
|
|
528
|
+
var d = b & 65535;
|
|
529
|
+
return c * d + ((a >>> 16) * d + c * (b >>> 16) << 16 >>> 0) | 0;
|
|
530
|
+
};
|
|
531
|
+
function smi(i32) {
|
|
532
|
+
return i32 >>> 1 & 1073741824 | i32 & 3221225471;
|
|
533
|
+
}
|
|
534
|
+
var defaultValueOf = Object.prototype.valueOf;
|
|
535
|
+
function hash(o) {
|
|
536
|
+
if (o == null) {
|
|
537
|
+
return hashNullish(o);
|
|
538
|
+
}
|
|
539
|
+
if (typeof o.hashCode === "function") {
|
|
540
|
+
return smi(o.hashCode(o));
|
|
541
|
+
}
|
|
542
|
+
var v = valueOf(o);
|
|
543
|
+
if (v == null) {
|
|
544
|
+
return hashNullish(v);
|
|
545
|
+
}
|
|
546
|
+
switch (typeof v) {
|
|
547
|
+
case "boolean":
|
|
548
|
+
return v ? 1108378657 : 1108378656;
|
|
549
|
+
case "number":
|
|
550
|
+
return hashNumber(v);
|
|
551
|
+
case "string":
|
|
552
|
+
return v.length > STRING_HASH_CACHE_MIN_STRLEN ? cachedHashString(v) : hashString(v);
|
|
553
|
+
case "object":
|
|
554
|
+
case "function":
|
|
555
|
+
return hashJSObj(v);
|
|
556
|
+
case "symbol":
|
|
557
|
+
return hashSymbol(v);
|
|
558
|
+
default:
|
|
559
|
+
if (typeof v.toString === "function") {
|
|
560
|
+
return hashString(v.toString());
|
|
561
|
+
}
|
|
562
|
+
throw new Error("Value type " + typeof v + " cannot be hashed.");
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
function hashNullish(nullish) {
|
|
566
|
+
return nullish === null ? 1108378658 : 1108378659;
|
|
567
|
+
}
|
|
568
|
+
function hashNumber(n) {
|
|
569
|
+
if (n !== n || n === Infinity) {
|
|
570
|
+
return 0;
|
|
571
|
+
}
|
|
572
|
+
var hash2 = n | 0;
|
|
573
|
+
if (hash2 !== n) {
|
|
574
|
+
hash2 ^= n * 4294967295;
|
|
575
|
+
}
|
|
576
|
+
while (n > 4294967295) {
|
|
577
|
+
n /= 4294967295;
|
|
578
|
+
hash2 ^= n;
|
|
579
|
+
}
|
|
580
|
+
return smi(hash2);
|
|
581
|
+
}
|
|
582
|
+
function cachedHashString(string) {
|
|
583
|
+
var hashed = stringHashCache[string];
|
|
584
|
+
if (hashed === void 0) {
|
|
585
|
+
hashed = hashString(string);
|
|
586
|
+
if (STRING_HASH_CACHE_SIZE === STRING_HASH_CACHE_MAX_SIZE) {
|
|
587
|
+
STRING_HASH_CACHE_SIZE = 0;
|
|
588
|
+
stringHashCache = {};
|
|
589
|
+
}
|
|
590
|
+
STRING_HASH_CACHE_SIZE++;
|
|
591
|
+
stringHashCache[string] = hashed;
|
|
592
|
+
}
|
|
593
|
+
return hashed;
|
|
594
|
+
}
|
|
595
|
+
function hashString(string) {
|
|
596
|
+
var hashed = 0;
|
|
597
|
+
for (var ii = 0; ii < string.length; ii++) {
|
|
598
|
+
hashed = 31 * hashed + string.charCodeAt(ii) | 0;
|
|
599
|
+
}
|
|
600
|
+
return smi(hashed);
|
|
601
|
+
}
|
|
602
|
+
function hashSymbol(sym) {
|
|
603
|
+
var hashed = symbolMap[sym];
|
|
604
|
+
if (hashed !== void 0) {
|
|
605
|
+
return hashed;
|
|
606
|
+
}
|
|
607
|
+
hashed = nextHash();
|
|
608
|
+
symbolMap[sym] = hashed;
|
|
609
|
+
return hashed;
|
|
610
|
+
}
|
|
611
|
+
function hashJSObj(obj) {
|
|
612
|
+
var hashed;
|
|
613
|
+
if (usingWeakMap) {
|
|
614
|
+
hashed = weakMap.get(obj);
|
|
615
|
+
if (hashed !== void 0) {
|
|
616
|
+
return hashed;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
hashed = obj[UID_HASH_KEY];
|
|
620
|
+
if (hashed !== void 0) {
|
|
621
|
+
return hashed;
|
|
622
|
+
}
|
|
623
|
+
if (!canDefineProperty) {
|
|
624
|
+
hashed = obj.propertyIsEnumerable && obj.propertyIsEnumerable[UID_HASH_KEY];
|
|
625
|
+
if (hashed !== void 0) {
|
|
626
|
+
return hashed;
|
|
627
|
+
}
|
|
628
|
+
hashed = getIENodeHash(obj);
|
|
629
|
+
if (hashed !== void 0) {
|
|
630
|
+
return hashed;
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
hashed = nextHash();
|
|
634
|
+
if (usingWeakMap) {
|
|
635
|
+
weakMap.set(obj, hashed);
|
|
636
|
+
} else if (isExtensible !== void 0 && isExtensible(obj) === false) {
|
|
637
|
+
throw new Error("Non-extensible objects are not allowed as keys.");
|
|
638
|
+
} else if (canDefineProperty) {
|
|
639
|
+
Object.defineProperty(obj, UID_HASH_KEY, {
|
|
640
|
+
enumerable: false,
|
|
641
|
+
configurable: false,
|
|
642
|
+
writable: false,
|
|
643
|
+
value: hashed
|
|
644
|
+
});
|
|
645
|
+
} else if (obj.propertyIsEnumerable !== void 0 && obj.propertyIsEnumerable === obj.constructor.prototype.propertyIsEnumerable) {
|
|
646
|
+
obj.propertyIsEnumerable = function() {
|
|
647
|
+
return this.constructor.prototype.propertyIsEnumerable.apply(this, arguments);
|
|
648
|
+
};
|
|
649
|
+
obj.propertyIsEnumerable[UID_HASH_KEY] = hashed;
|
|
650
|
+
} else if (obj.nodeType !== void 0) {
|
|
651
|
+
obj[UID_HASH_KEY] = hashed;
|
|
652
|
+
} else {
|
|
653
|
+
throw new Error("Unable to set a non-enumerable property on object.");
|
|
654
|
+
}
|
|
655
|
+
return hashed;
|
|
656
|
+
}
|
|
657
|
+
var isExtensible = Object.isExtensible;
|
|
658
|
+
var canDefineProperty = function() {
|
|
659
|
+
try {
|
|
660
|
+
Object.defineProperty({}, "@", {});
|
|
661
|
+
return true;
|
|
662
|
+
} catch (e) {
|
|
663
|
+
return false;
|
|
664
|
+
}
|
|
665
|
+
}();
|
|
666
|
+
function getIENodeHash(node) {
|
|
667
|
+
if (node && node.nodeType > 0) {
|
|
668
|
+
switch (node.nodeType) {
|
|
669
|
+
case 1:
|
|
670
|
+
return node.uniqueID;
|
|
671
|
+
case 9:
|
|
672
|
+
return node.documentElement && node.documentElement.uniqueID;
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
function valueOf(obj) {
|
|
677
|
+
return obj.valueOf !== defaultValueOf && typeof obj.valueOf === "function" ? obj.valueOf(obj) : obj;
|
|
678
|
+
}
|
|
679
|
+
function nextHash() {
|
|
680
|
+
var nextHash2 = ++_objHashUID;
|
|
681
|
+
if (_objHashUID & 1073741824) {
|
|
682
|
+
_objHashUID = 0;
|
|
683
|
+
}
|
|
684
|
+
return nextHash2;
|
|
685
|
+
}
|
|
686
|
+
var usingWeakMap = typeof WeakMap === "function";
|
|
687
|
+
var weakMap;
|
|
688
|
+
if (usingWeakMap) {
|
|
689
|
+
weakMap = /* @__PURE__ */ new WeakMap();
|
|
690
|
+
}
|
|
691
|
+
var symbolMap = /* @__PURE__ */ Object.create(null);
|
|
692
|
+
var _objHashUID = 0;
|
|
693
|
+
var UID_HASH_KEY = "__immutablehash__";
|
|
694
|
+
if (typeof Symbol === "function") {
|
|
695
|
+
UID_HASH_KEY = Symbol(UID_HASH_KEY);
|
|
696
|
+
}
|
|
697
|
+
var STRING_HASH_CACHE_MIN_STRLEN = 16;
|
|
698
|
+
var STRING_HASH_CACHE_MAX_SIZE = 255;
|
|
699
|
+
var STRING_HASH_CACHE_SIZE = 0;
|
|
700
|
+
var stringHashCache = {};
|
|
701
|
+
var ToKeyedSequence = /* @__PURE__ */ function(KeyedSeq2) {
|
|
702
|
+
function ToKeyedSequence2(indexed, useKeys) {
|
|
703
|
+
this._iter = indexed;
|
|
704
|
+
this._useKeys = useKeys;
|
|
705
|
+
this.size = indexed.size;
|
|
706
|
+
}
|
|
707
|
+
if (KeyedSeq2)
|
|
708
|
+
ToKeyedSequence2.__proto__ = KeyedSeq2;
|
|
709
|
+
ToKeyedSequence2.prototype = Object.create(KeyedSeq2 && KeyedSeq2.prototype);
|
|
710
|
+
ToKeyedSequence2.prototype.constructor = ToKeyedSequence2;
|
|
711
|
+
ToKeyedSequence2.prototype.get = function get10(key, notSetValue) {
|
|
712
|
+
return this._iter.get(key, notSetValue);
|
|
713
|
+
};
|
|
714
|
+
ToKeyedSequence2.prototype.has = function has4(key) {
|
|
715
|
+
return this._iter.has(key);
|
|
716
|
+
};
|
|
717
|
+
ToKeyedSequence2.prototype.valueSeq = function valueSeq2() {
|
|
718
|
+
return this._iter.valueSeq();
|
|
719
|
+
};
|
|
720
|
+
ToKeyedSequence2.prototype.reverse = function reverse3() {
|
|
721
|
+
var this$1$1 = this;
|
|
722
|
+
var reversedSequence = reverseFactory(this, true);
|
|
723
|
+
if (!this._useKeys) {
|
|
724
|
+
reversedSequence.valueSeq = function() {
|
|
725
|
+
return this$1$1._iter.toSeq().reverse();
|
|
726
|
+
};
|
|
727
|
+
}
|
|
728
|
+
return reversedSequence;
|
|
729
|
+
};
|
|
730
|
+
ToKeyedSequence2.prototype.map = function map2(mapper, context) {
|
|
731
|
+
var this$1$1 = this;
|
|
732
|
+
var mappedSequence = mapFactory(this, mapper, context);
|
|
733
|
+
if (!this._useKeys) {
|
|
734
|
+
mappedSequence.valueSeq = function() {
|
|
735
|
+
return this$1$1._iter.toSeq().map(mapper, context);
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
return mappedSequence;
|
|
739
|
+
};
|
|
740
|
+
ToKeyedSequence2.prototype.__iterate = function __iterate(fn, reverse3) {
|
|
741
|
+
var this$1$1 = this;
|
|
742
|
+
return this._iter.__iterate(function(v, k) {
|
|
743
|
+
return fn(v, k, this$1$1);
|
|
744
|
+
}, reverse3);
|
|
745
|
+
};
|
|
746
|
+
ToKeyedSequence2.prototype.__iterator = function __iterator(type, reverse3) {
|
|
747
|
+
return this._iter.__iterator(type, reverse3);
|
|
748
|
+
};
|
|
749
|
+
return ToKeyedSequence2;
|
|
750
|
+
}(KeyedSeq);
|
|
751
|
+
ToKeyedSequence.prototype[IS_ORDERED_SYMBOL] = true;
|
|
752
|
+
var ToIndexedSequence = /* @__PURE__ */ function(IndexedSeq2) {
|
|
753
|
+
function ToIndexedSequence2(iter) {
|
|
754
|
+
this._iter = iter;
|
|
755
|
+
this.size = iter.size;
|
|
756
|
+
}
|
|
757
|
+
if (IndexedSeq2)
|
|
758
|
+
ToIndexedSequence2.__proto__ = IndexedSeq2;
|
|
759
|
+
ToIndexedSequence2.prototype = Object.create(IndexedSeq2 && IndexedSeq2.prototype);
|
|
760
|
+
ToIndexedSequence2.prototype.constructor = ToIndexedSequence2;
|
|
761
|
+
ToIndexedSequence2.prototype.includes = function includes3(value) {
|
|
762
|
+
return this._iter.includes(value);
|
|
763
|
+
};
|
|
764
|
+
ToIndexedSequence2.prototype.__iterate = function __iterate(fn, reverse3) {
|
|
765
|
+
var this$1$1 = this;
|
|
766
|
+
var i = 0;
|
|
767
|
+
reverse3 && ensureSize(this);
|
|
768
|
+
return this._iter.__iterate(function(v) {
|
|
769
|
+
return fn(v, reverse3 ? this$1$1.size - ++i : i++, this$1$1);
|
|
770
|
+
}, reverse3);
|
|
771
|
+
};
|
|
772
|
+
ToIndexedSequence2.prototype.__iterator = function __iterator(type, reverse3) {
|
|
773
|
+
var this$1$1 = this;
|
|
774
|
+
var iterator = this._iter.__iterator(ITERATE_VALUES, reverse3);
|
|
775
|
+
var i = 0;
|
|
776
|
+
reverse3 && ensureSize(this);
|
|
777
|
+
return new Iterator(function() {
|
|
778
|
+
var step = iterator.next();
|
|
779
|
+
return step.done ? step : iteratorValue(type, reverse3 ? this$1$1.size - ++i : i++, step.value, step);
|
|
780
|
+
});
|
|
781
|
+
};
|
|
782
|
+
return ToIndexedSequence2;
|
|
783
|
+
}(IndexedSeq);
|
|
784
|
+
var ToSetSequence = /* @__PURE__ */ function(SetSeq2) {
|
|
785
|
+
function ToSetSequence2(iter) {
|
|
786
|
+
this._iter = iter;
|
|
787
|
+
this.size = iter.size;
|
|
788
|
+
}
|
|
789
|
+
if (SetSeq2)
|
|
790
|
+
ToSetSequence2.__proto__ = SetSeq2;
|
|
791
|
+
ToSetSequence2.prototype = Object.create(SetSeq2 && SetSeq2.prototype);
|
|
792
|
+
ToSetSequence2.prototype.constructor = ToSetSequence2;
|
|
793
|
+
ToSetSequence2.prototype.has = function has4(key) {
|
|
794
|
+
return this._iter.includes(key);
|
|
795
|
+
};
|
|
796
|
+
ToSetSequence2.prototype.__iterate = function __iterate(fn, reverse3) {
|
|
797
|
+
var this$1$1 = this;
|
|
798
|
+
return this._iter.__iterate(function(v) {
|
|
799
|
+
return fn(v, v, this$1$1);
|
|
800
|
+
}, reverse3);
|
|
801
|
+
};
|
|
802
|
+
ToSetSequence2.prototype.__iterator = function __iterator(type, reverse3) {
|
|
803
|
+
var iterator = this._iter.__iterator(ITERATE_VALUES, reverse3);
|
|
804
|
+
return new Iterator(function() {
|
|
805
|
+
var step = iterator.next();
|
|
806
|
+
return step.done ? step : iteratorValue(type, step.value, step.value, step);
|
|
807
|
+
});
|
|
808
|
+
};
|
|
809
|
+
return ToSetSequence2;
|
|
810
|
+
}(SetSeq);
|
|
811
|
+
var FromEntriesSequence = /* @__PURE__ */ function(KeyedSeq2) {
|
|
812
|
+
function FromEntriesSequence2(entries2) {
|
|
813
|
+
this._iter = entries2;
|
|
814
|
+
this.size = entries2.size;
|
|
815
|
+
}
|
|
816
|
+
if (KeyedSeq2)
|
|
817
|
+
FromEntriesSequence2.__proto__ = KeyedSeq2;
|
|
818
|
+
FromEntriesSequence2.prototype = Object.create(KeyedSeq2 && KeyedSeq2.prototype);
|
|
819
|
+
FromEntriesSequence2.prototype.constructor = FromEntriesSequence2;
|
|
820
|
+
FromEntriesSequence2.prototype.entrySeq = function entrySeq2() {
|
|
821
|
+
return this._iter.toSeq();
|
|
822
|
+
};
|
|
823
|
+
FromEntriesSequence2.prototype.__iterate = function __iterate(fn, reverse3) {
|
|
824
|
+
var this$1$1 = this;
|
|
825
|
+
return this._iter.__iterate(function(entry) {
|
|
826
|
+
if (entry) {
|
|
827
|
+
validateEntry(entry);
|
|
828
|
+
var indexedCollection = isCollection(entry);
|
|
829
|
+
return fn(indexedCollection ? entry.get(1) : entry[1], indexedCollection ? entry.get(0) : entry[0], this$1$1);
|
|
830
|
+
}
|
|
831
|
+
}, reverse3);
|
|
832
|
+
};
|
|
833
|
+
FromEntriesSequence2.prototype.__iterator = function __iterator(type, reverse3) {
|
|
834
|
+
var iterator = this._iter.__iterator(ITERATE_VALUES, reverse3);
|
|
835
|
+
return new Iterator(function() {
|
|
836
|
+
while (true) {
|
|
837
|
+
var step = iterator.next();
|
|
838
|
+
if (step.done) {
|
|
839
|
+
return step;
|
|
840
|
+
}
|
|
841
|
+
var entry = step.value;
|
|
842
|
+
if (entry) {
|
|
843
|
+
validateEntry(entry);
|
|
844
|
+
var indexedCollection = isCollection(entry);
|
|
845
|
+
return iteratorValue(type, indexedCollection ? entry.get(0) : entry[0], indexedCollection ? entry.get(1) : entry[1], step);
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
});
|
|
849
|
+
};
|
|
850
|
+
return FromEntriesSequence2;
|
|
851
|
+
}(KeyedSeq);
|
|
852
|
+
ToIndexedSequence.prototype.cacheResult = ToKeyedSequence.prototype.cacheResult = ToSetSequence.prototype.cacheResult = FromEntriesSequence.prototype.cacheResult = cacheResultThrough;
|
|
853
|
+
function flipFactory(collection) {
|
|
854
|
+
var flipSequence = makeSequence(collection);
|
|
855
|
+
flipSequence._iter = collection;
|
|
856
|
+
flipSequence.size = collection.size;
|
|
857
|
+
flipSequence.flip = function() {
|
|
858
|
+
return collection;
|
|
859
|
+
};
|
|
860
|
+
flipSequence.reverse = function() {
|
|
861
|
+
var reversedSequence = collection.reverse.apply(this);
|
|
862
|
+
reversedSequence.flip = function() {
|
|
863
|
+
return collection.reverse();
|
|
864
|
+
};
|
|
865
|
+
return reversedSequence;
|
|
866
|
+
};
|
|
867
|
+
flipSequence.has = function(key) {
|
|
868
|
+
return collection.includes(key);
|
|
869
|
+
};
|
|
870
|
+
flipSequence.includes = function(key) {
|
|
871
|
+
return collection.has(key);
|
|
872
|
+
};
|
|
873
|
+
flipSequence.cacheResult = cacheResultThrough;
|
|
874
|
+
flipSequence.__iterateUncached = function(fn, reverse3) {
|
|
875
|
+
var this$1$1 = this;
|
|
876
|
+
return collection.__iterate(function(v, k) {
|
|
877
|
+
return fn(k, v, this$1$1) !== false;
|
|
878
|
+
}, reverse3);
|
|
879
|
+
};
|
|
880
|
+
flipSequence.__iteratorUncached = function(type, reverse3) {
|
|
881
|
+
if (type === ITERATE_ENTRIES) {
|
|
882
|
+
var iterator = collection.__iterator(type, reverse3);
|
|
883
|
+
return new Iterator(function() {
|
|
884
|
+
var step = iterator.next();
|
|
885
|
+
if (!step.done) {
|
|
886
|
+
var k = step.value[0];
|
|
887
|
+
step.value[0] = step.value[1];
|
|
888
|
+
step.value[1] = k;
|
|
889
|
+
}
|
|
890
|
+
return step;
|
|
891
|
+
});
|
|
892
|
+
}
|
|
893
|
+
return collection.__iterator(type === ITERATE_VALUES ? ITERATE_KEYS : ITERATE_VALUES, reverse3);
|
|
894
|
+
};
|
|
895
|
+
return flipSequence;
|
|
896
|
+
}
|
|
897
|
+
function mapFactory(collection, mapper, context) {
|
|
898
|
+
var mappedSequence = makeSequence(collection);
|
|
899
|
+
mappedSequence.size = collection.size;
|
|
900
|
+
mappedSequence.has = function(key) {
|
|
901
|
+
return collection.has(key);
|
|
902
|
+
};
|
|
903
|
+
mappedSequence.get = function(key, notSetValue) {
|
|
904
|
+
var v = collection.get(key, NOT_SET);
|
|
905
|
+
return v === NOT_SET ? notSetValue : mapper.call(context, v, key, collection);
|
|
906
|
+
};
|
|
907
|
+
mappedSequence.__iterateUncached = function(fn, reverse3) {
|
|
908
|
+
var this$1$1 = this;
|
|
909
|
+
return collection.__iterate(function(v, k, c) {
|
|
910
|
+
return fn(mapper.call(context, v, k, c), k, this$1$1) !== false;
|
|
911
|
+
}, reverse3);
|
|
912
|
+
};
|
|
913
|
+
mappedSequence.__iteratorUncached = function(type, reverse3) {
|
|
914
|
+
var iterator = collection.__iterator(ITERATE_ENTRIES, reverse3);
|
|
915
|
+
return new Iterator(function() {
|
|
916
|
+
var step = iterator.next();
|
|
917
|
+
if (step.done) {
|
|
918
|
+
return step;
|
|
919
|
+
}
|
|
920
|
+
var entry = step.value;
|
|
921
|
+
var key = entry[0];
|
|
922
|
+
return iteratorValue(type, key, mapper.call(context, entry[1], key, collection), step);
|
|
923
|
+
});
|
|
924
|
+
};
|
|
925
|
+
return mappedSequence;
|
|
926
|
+
}
|
|
927
|
+
function reverseFactory(collection, useKeys) {
|
|
928
|
+
var this$1$1 = this;
|
|
929
|
+
var reversedSequence = makeSequence(collection);
|
|
930
|
+
reversedSequence._iter = collection;
|
|
931
|
+
reversedSequence.size = collection.size;
|
|
932
|
+
reversedSequence.reverse = function() {
|
|
933
|
+
return collection;
|
|
934
|
+
};
|
|
935
|
+
if (collection.flip) {
|
|
936
|
+
reversedSequence.flip = function() {
|
|
937
|
+
var flipSequence = flipFactory(collection);
|
|
938
|
+
flipSequence.reverse = function() {
|
|
939
|
+
return collection.flip();
|
|
940
|
+
};
|
|
941
|
+
return flipSequence;
|
|
942
|
+
};
|
|
943
|
+
}
|
|
944
|
+
reversedSequence.get = function(key, notSetValue) {
|
|
945
|
+
return collection.get(useKeys ? key : -1 - key, notSetValue);
|
|
946
|
+
};
|
|
947
|
+
reversedSequence.has = function(key) {
|
|
948
|
+
return collection.has(useKeys ? key : -1 - key);
|
|
949
|
+
};
|
|
950
|
+
reversedSequence.includes = function(value) {
|
|
951
|
+
return collection.includes(value);
|
|
952
|
+
};
|
|
953
|
+
reversedSequence.cacheResult = cacheResultThrough;
|
|
954
|
+
reversedSequence.__iterate = function(fn, reverse3) {
|
|
955
|
+
var this$1$12 = this;
|
|
956
|
+
var i = 0;
|
|
957
|
+
reverse3 && ensureSize(collection);
|
|
958
|
+
return collection.__iterate(function(v, k) {
|
|
959
|
+
return fn(v, useKeys ? k : reverse3 ? this$1$12.size - ++i : i++, this$1$12);
|
|
960
|
+
}, !reverse3);
|
|
961
|
+
};
|
|
962
|
+
reversedSequence.__iterator = function(type, reverse3) {
|
|
963
|
+
var i = 0;
|
|
964
|
+
reverse3 && ensureSize(collection);
|
|
965
|
+
var iterator = collection.__iterator(ITERATE_ENTRIES, !reverse3);
|
|
966
|
+
return new Iterator(function() {
|
|
967
|
+
var step = iterator.next();
|
|
968
|
+
if (step.done) {
|
|
969
|
+
return step;
|
|
970
|
+
}
|
|
971
|
+
var entry = step.value;
|
|
972
|
+
return iteratorValue(type, useKeys ? entry[0] : reverse3 ? this$1$1.size - ++i : i++, entry[1], step);
|
|
973
|
+
});
|
|
974
|
+
};
|
|
975
|
+
return reversedSequence;
|
|
976
|
+
}
|
|
977
|
+
function filterFactory(collection, predicate, context, useKeys) {
|
|
978
|
+
var filterSequence = makeSequence(collection);
|
|
979
|
+
if (useKeys) {
|
|
980
|
+
filterSequence.has = function(key) {
|
|
981
|
+
var v = collection.get(key, NOT_SET);
|
|
982
|
+
return v !== NOT_SET && !!predicate.call(context, v, key, collection);
|
|
983
|
+
};
|
|
984
|
+
filterSequence.get = function(key, notSetValue) {
|
|
985
|
+
var v = collection.get(key, NOT_SET);
|
|
986
|
+
return v !== NOT_SET && predicate.call(context, v, key, collection) ? v : notSetValue;
|
|
987
|
+
};
|
|
988
|
+
}
|
|
989
|
+
filterSequence.__iterateUncached = function(fn, reverse3) {
|
|
990
|
+
var this$1$1 = this;
|
|
991
|
+
var iterations = 0;
|
|
992
|
+
collection.__iterate(function(v, k, c) {
|
|
993
|
+
if (predicate.call(context, v, k, c)) {
|
|
994
|
+
iterations++;
|
|
995
|
+
return fn(v, useKeys ? k : iterations - 1, this$1$1);
|
|
996
|
+
}
|
|
997
|
+
}, reverse3);
|
|
998
|
+
return iterations;
|
|
999
|
+
};
|
|
1000
|
+
filterSequence.__iteratorUncached = function(type, reverse3) {
|
|
1001
|
+
var iterator = collection.__iterator(ITERATE_ENTRIES, reverse3);
|
|
1002
|
+
var iterations = 0;
|
|
1003
|
+
return new Iterator(function() {
|
|
1004
|
+
while (true) {
|
|
1005
|
+
var step = iterator.next();
|
|
1006
|
+
if (step.done) {
|
|
1007
|
+
return step;
|
|
1008
|
+
}
|
|
1009
|
+
var entry = step.value;
|
|
1010
|
+
var key = entry[0];
|
|
1011
|
+
var value = entry[1];
|
|
1012
|
+
if (predicate.call(context, value, key, collection)) {
|
|
1013
|
+
return iteratorValue(type, useKeys ? key : iterations++, value, step);
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
});
|
|
1017
|
+
};
|
|
1018
|
+
return filterSequence;
|
|
1019
|
+
}
|
|
1020
|
+
function countByFactory(collection, grouper, context) {
|
|
1021
|
+
var groups = Map$1().asMutable();
|
|
1022
|
+
collection.__iterate(function(v, k) {
|
|
1023
|
+
groups.update(grouper.call(context, v, k, collection), 0, function(a) {
|
|
1024
|
+
return a + 1;
|
|
1025
|
+
});
|
|
1026
|
+
});
|
|
1027
|
+
return groups.asImmutable();
|
|
1028
|
+
}
|
|
1029
|
+
function groupByFactory(collection, grouper, context) {
|
|
1030
|
+
var isKeyedIter = isKeyed(collection);
|
|
1031
|
+
var groups = (isOrdered(collection) ? OrderedMap() : Map$1()).asMutable();
|
|
1032
|
+
collection.__iterate(function(v, k) {
|
|
1033
|
+
groups.update(grouper.call(context, v, k, collection), function(a) {
|
|
1034
|
+
return a = a || [], a.push(isKeyedIter ? [k, v] : v), a;
|
|
1035
|
+
});
|
|
1036
|
+
});
|
|
1037
|
+
var coerce = collectionClass(collection);
|
|
1038
|
+
return groups.map(function(arr) {
|
|
1039
|
+
return reify(collection, coerce(arr));
|
|
1040
|
+
}).asImmutable();
|
|
1041
|
+
}
|
|
1042
|
+
function sliceFactory(collection, begin, end, useKeys) {
|
|
1043
|
+
var originalSize = collection.size;
|
|
1044
|
+
if (wholeSlice(begin, end, originalSize)) {
|
|
1045
|
+
return collection;
|
|
1046
|
+
}
|
|
1047
|
+
var resolvedBegin = resolveBegin(begin, originalSize);
|
|
1048
|
+
var resolvedEnd = resolveEnd(end, originalSize);
|
|
1049
|
+
if (resolvedBegin !== resolvedBegin || resolvedEnd !== resolvedEnd) {
|
|
1050
|
+
return sliceFactory(collection.toSeq().cacheResult(), begin, end, useKeys);
|
|
1051
|
+
}
|
|
1052
|
+
var resolvedSize = resolvedEnd - resolvedBegin;
|
|
1053
|
+
var sliceSize;
|
|
1054
|
+
if (resolvedSize === resolvedSize) {
|
|
1055
|
+
sliceSize = resolvedSize < 0 ? 0 : resolvedSize;
|
|
1056
|
+
}
|
|
1057
|
+
var sliceSeq = makeSequence(collection);
|
|
1058
|
+
sliceSeq.size = sliceSize === 0 ? sliceSize : collection.size && sliceSize || void 0;
|
|
1059
|
+
if (!useKeys && isSeq(collection) && sliceSize >= 0) {
|
|
1060
|
+
sliceSeq.get = function(index, notSetValue) {
|
|
1061
|
+
index = wrapIndex(this, index);
|
|
1062
|
+
return index >= 0 && index < sliceSize ? collection.get(index + resolvedBegin, notSetValue) : notSetValue;
|
|
1063
|
+
};
|
|
1064
|
+
}
|
|
1065
|
+
sliceSeq.__iterateUncached = function(fn, reverse3) {
|
|
1066
|
+
var this$1$1 = this;
|
|
1067
|
+
if (sliceSize === 0) {
|
|
1068
|
+
return 0;
|
|
1069
|
+
}
|
|
1070
|
+
if (reverse3) {
|
|
1071
|
+
return this.cacheResult().__iterate(fn, reverse3);
|
|
1072
|
+
}
|
|
1073
|
+
var skipped = 0;
|
|
1074
|
+
var isSkipping = true;
|
|
1075
|
+
var iterations = 0;
|
|
1076
|
+
collection.__iterate(function(v, k) {
|
|
1077
|
+
if (!(isSkipping && (isSkipping = skipped++ < resolvedBegin))) {
|
|
1078
|
+
iterations++;
|
|
1079
|
+
return fn(v, useKeys ? k : iterations - 1, this$1$1) !== false && iterations !== sliceSize;
|
|
1080
|
+
}
|
|
1081
|
+
});
|
|
1082
|
+
return iterations;
|
|
1083
|
+
};
|
|
1084
|
+
sliceSeq.__iteratorUncached = function(type, reverse3) {
|
|
1085
|
+
if (sliceSize !== 0 && reverse3) {
|
|
1086
|
+
return this.cacheResult().__iterator(type, reverse3);
|
|
1087
|
+
}
|
|
1088
|
+
if (sliceSize === 0) {
|
|
1089
|
+
return new Iterator(iteratorDone);
|
|
1090
|
+
}
|
|
1091
|
+
var iterator = collection.__iterator(type, reverse3);
|
|
1092
|
+
var skipped = 0;
|
|
1093
|
+
var iterations = 0;
|
|
1094
|
+
return new Iterator(function() {
|
|
1095
|
+
while (skipped++ < resolvedBegin) {
|
|
1096
|
+
iterator.next();
|
|
1097
|
+
}
|
|
1098
|
+
if (++iterations > sliceSize) {
|
|
1099
|
+
return iteratorDone();
|
|
1100
|
+
}
|
|
1101
|
+
var step = iterator.next();
|
|
1102
|
+
if (useKeys || type === ITERATE_VALUES || step.done) {
|
|
1103
|
+
return step;
|
|
1104
|
+
}
|
|
1105
|
+
if (type === ITERATE_KEYS) {
|
|
1106
|
+
return iteratorValue(type, iterations - 1, void 0, step);
|
|
1107
|
+
}
|
|
1108
|
+
return iteratorValue(type, iterations - 1, step.value[1], step);
|
|
1109
|
+
});
|
|
1110
|
+
};
|
|
1111
|
+
return sliceSeq;
|
|
1112
|
+
}
|
|
1113
|
+
function takeWhileFactory(collection, predicate, context) {
|
|
1114
|
+
var takeSequence = makeSequence(collection);
|
|
1115
|
+
takeSequence.__iterateUncached = function(fn, reverse3) {
|
|
1116
|
+
var this$1$1 = this;
|
|
1117
|
+
if (reverse3) {
|
|
1118
|
+
return this.cacheResult().__iterate(fn, reverse3);
|
|
1119
|
+
}
|
|
1120
|
+
var iterations = 0;
|
|
1121
|
+
collection.__iterate(function(v, k, c) {
|
|
1122
|
+
return predicate.call(context, v, k, c) && ++iterations && fn(v, k, this$1$1);
|
|
1123
|
+
});
|
|
1124
|
+
return iterations;
|
|
1125
|
+
};
|
|
1126
|
+
takeSequence.__iteratorUncached = function(type, reverse3) {
|
|
1127
|
+
var this$1$1 = this;
|
|
1128
|
+
if (reverse3) {
|
|
1129
|
+
return this.cacheResult().__iterator(type, reverse3);
|
|
1130
|
+
}
|
|
1131
|
+
var iterator = collection.__iterator(ITERATE_ENTRIES, reverse3);
|
|
1132
|
+
var iterating = true;
|
|
1133
|
+
return new Iterator(function() {
|
|
1134
|
+
if (!iterating) {
|
|
1135
|
+
return iteratorDone();
|
|
1136
|
+
}
|
|
1137
|
+
var step = iterator.next();
|
|
1138
|
+
if (step.done) {
|
|
1139
|
+
return step;
|
|
1140
|
+
}
|
|
1141
|
+
var entry = step.value;
|
|
1142
|
+
var k = entry[0];
|
|
1143
|
+
var v = entry[1];
|
|
1144
|
+
if (!predicate.call(context, v, k, this$1$1)) {
|
|
1145
|
+
iterating = false;
|
|
1146
|
+
return iteratorDone();
|
|
1147
|
+
}
|
|
1148
|
+
return type === ITERATE_ENTRIES ? step : iteratorValue(type, k, v, step);
|
|
1149
|
+
});
|
|
1150
|
+
};
|
|
1151
|
+
return takeSequence;
|
|
1152
|
+
}
|
|
1153
|
+
function skipWhileFactory(collection, predicate, context, useKeys) {
|
|
1154
|
+
var skipSequence = makeSequence(collection);
|
|
1155
|
+
skipSequence.__iterateUncached = function(fn, reverse3) {
|
|
1156
|
+
var this$1$1 = this;
|
|
1157
|
+
if (reverse3) {
|
|
1158
|
+
return this.cacheResult().__iterate(fn, reverse3);
|
|
1159
|
+
}
|
|
1160
|
+
var isSkipping = true;
|
|
1161
|
+
var iterations = 0;
|
|
1162
|
+
collection.__iterate(function(v, k, c) {
|
|
1163
|
+
if (!(isSkipping && (isSkipping = predicate.call(context, v, k, c)))) {
|
|
1164
|
+
iterations++;
|
|
1165
|
+
return fn(v, useKeys ? k : iterations - 1, this$1$1);
|
|
1166
|
+
}
|
|
1167
|
+
});
|
|
1168
|
+
return iterations;
|
|
1169
|
+
};
|
|
1170
|
+
skipSequence.__iteratorUncached = function(type, reverse3) {
|
|
1171
|
+
var this$1$1 = this;
|
|
1172
|
+
if (reverse3) {
|
|
1173
|
+
return this.cacheResult().__iterator(type, reverse3);
|
|
1174
|
+
}
|
|
1175
|
+
var iterator = collection.__iterator(ITERATE_ENTRIES, reverse3);
|
|
1176
|
+
var skipping = true;
|
|
1177
|
+
var iterations = 0;
|
|
1178
|
+
return new Iterator(function() {
|
|
1179
|
+
var step;
|
|
1180
|
+
var k;
|
|
1181
|
+
var v;
|
|
1182
|
+
do {
|
|
1183
|
+
step = iterator.next();
|
|
1184
|
+
if (step.done) {
|
|
1185
|
+
if (useKeys || type === ITERATE_VALUES) {
|
|
1186
|
+
return step;
|
|
1187
|
+
}
|
|
1188
|
+
if (type === ITERATE_KEYS) {
|
|
1189
|
+
return iteratorValue(type, iterations++, void 0, step);
|
|
1190
|
+
}
|
|
1191
|
+
return iteratorValue(type, iterations++, step.value[1], step);
|
|
1192
|
+
}
|
|
1193
|
+
var entry = step.value;
|
|
1194
|
+
k = entry[0];
|
|
1195
|
+
v = entry[1];
|
|
1196
|
+
skipping && (skipping = predicate.call(context, v, k, this$1$1));
|
|
1197
|
+
} while (skipping);
|
|
1198
|
+
return type === ITERATE_ENTRIES ? step : iteratorValue(type, k, v, step);
|
|
1199
|
+
});
|
|
1200
|
+
};
|
|
1201
|
+
return skipSequence;
|
|
1202
|
+
}
|
|
1203
|
+
function concatFactory(collection, values2) {
|
|
1204
|
+
var isKeyedCollection = isKeyed(collection);
|
|
1205
|
+
var iters = [collection].concat(values2).map(function(v) {
|
|
1206
|
+
if (!isCollection(v)) {
|
|
1207
|
+
v = isKeyedCollection ? keyedSeqFromValue(v) : indexedSeqFromValue(Array.isArray(v) ? v : [v]);
|
|
1208
|
+
} else if (isKeyedCollection) {
|
|
1209
|
+
v = KeyedCollection(v);
|
|
1210
|
+
}
|
|
1211
|
+
return v;
|
|
1212
|
+
}).filter(function(v) {
|
|
1213
|
+
return v.size !== 0;
|
|
1214
|
+
});
|
|
1215
|
+
if (iters.length === 0) {
|
|
1216
|
+
return collection;
|
|
1217
|
+
}
|
|
1218
|
+
if (iters.length === 1) {
|
|
1219
|
+
var singleton = iters[0];
|
|
1220
|
+
if (singleton === collection || isKeyedCollection && isKeyed(singleton) || isIndexed(collection) && isIndexed(singleton)) {
|
|
1221
|
+
return singleton;
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
var concatSeq = new ArraySeq(iters);
|
|
1225
|
+
if (isKeyedCollection) {
|
|
1226
|
+
concatSeq = concatSeq.toKeyedSeq();
|
|
1227
|
+
} else if (!isIndexed(collection)) {
|
|
1228
|
+
concatSeq = concatSeq.toSetSeq();
|
|
1229
|
+
}
|
|
1230
|
+
concatSeq = concatSeq.flatten(true);
|
|
1231
|
+
concatSeq.size = iters.reduce(function(sum, seq) {
|
|
1232
|
+
if (sum !== void 0) {
|
|
1233
|
+
var size = seq.size;
|
|
1234
|
+
if (size !== void 0) {
|
|
1235
|
+
return sum + size;
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
}, 0);
|
|
1239
|
+
return concatSeq;
|
|
1240
|
+
}
|
|
1241
|
+
function flattenFactory(collection, depth, useKeys) {
|
|
1242
|
+
var flatSequence = makeSequence(collection);
|
|
1243
|
+
flatSequence.__iterateUncached = function(fn, reverse3) {
|
|
1244
|
+
if (reverse3) {
|
|
1245
|
+
return this.cacheResult().__iterate(fn, reverse3);
|
|
1246
|
+
}
|
|
1247
|
+
var iterations = 0;
|
|
1248
|
+
var stopped = false;
|
|
1249
|
+
function flatDeep(iter, currentDepth) {
|
|
1250
|
+
iter.__iterate(function(v, k) {
|
|
1251
|
+
if ((!depth || currentDepth < depth) && isCollection(v)) {
|
|
1252
|
+
flatDeep(v, currentDepth + 1);
|
|
1253
|
+
} else {
|
|
1254
|
+
iterations++;
|
|
1255
|
+
if (fn(v, useKeys ? k : iterations - 1, flatSequence) === false) {
|
|
1256
|
+
stopped = true;
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
return !stopped;
|
|
1260
|
+
}, reverse3);
|
|
1261
|
+
}
|
|
1262
|
+
flatDeep(collection, 0);
|
|
1263
|
+
return iterations;
|
|
1264
|
+
};
|
|
1265
|
+
flatSequence.__iteratorUncached = function(type, reverse3) {
|
|
1266
|
+
if (reverse3) {
|
|
1267
|
+
return this.cacheResult().__iterator(type, reverse3);
|
|
1268
|
+
}
|
|
1269
|
+
var iterator = collection.__iterator(type, reverse3);
|
|
1270
|
+
var stack = [];
|
|
1271
|
+
var iterations = 0;
|
|
1272
|
+
return new Iterator(function() {
|
|
1273
|
+
while (iterator) {
|
|
1274
|
+
var step = iterator.next();
|
|
1275
|
+
if (step.done !== false) {
|
|
1276
|
+
iterator = stack.pop();
|
|
1277
|
+
continue;
|
|
1278
|
+
}
|
|
1279
|
+
var v = step.value;
|
|
1280
|
+
if (type === ITERATE_ENTRIES) {
|
|
1281
|
+
v = v[1];
|
|
1282
|
+
}
|
|
1283
|
+
if ((!depth || stack.length < depth) && isCollection(v)) {
|
|
1284
|
+
stack.push(iterator);
|
|
1285
|
+
iterator = v.__iterator(type, reverse3);
|
|
1286
|
+
} else {
|
|
1287
|
+
return useKeys ? step : iteratorValue(type, iterations++, v, step);
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
return iteratorDone();
|
|
1291
|
+
});
|
|
1292
|
+
};
|
|
1293
|
+
return flatSequence;
|
|
1294
|
+
}
|
|
1295
|
+
function flatMapFactory(collection, mapper, context) {
|
|
1296
|
+
var coerce = collectionClass(collection);
|
|
1297
|
+
return collection.toSeq().map(function(v, k) {
|
|
1298
|
+
return coerce(mapper.call(context, v, k, collection));
|
|
1299
|
+
}).flatten(true);
|
|
1300
|
+
}
|
|
1301
|
+
function interposeFactory(collection, separator) {
|
|
1302
|
+
var interposedSequence = makeSequence(collection);
|
|
1303
|
+
interposedSequence.size = collection.size && collection.size * 2 - 1;
|
|
1304
|
+
interposedSequence.__iterateUncached = function(fn, reverse3) {
|
|
1305
|
+
var this$1$1 = this;
|
|
1306
|
+
var iterations = 0;
|
|
1307
|
+
collection.__iterate(function(v) {
|
|
1308
|
+
return (!iterations || fn(separator, iterations++, this$1$1) !== false) && fn(v, iterations++, this$1$1) !== false;
|
|
1309
|
+
}, reverse3);
|
|
1310
|
+
return iterations;
|
|
1311
|
+
};
|
|
1312
|
+
interposedSequence.__iteratorUncached = function(type, reverse3) {
|
|
1313
|
+
var iterator = collection.__iterator(ITERATE_VALUES, reverse3);
|
|
1314
|
+
var iterations = 0;
|
|
1315
|
+
var step;
|
|
1316
|
+
return new Iterator(function() {
|
|
1317
|
+
if (!step || iterations % 2) {
|
|
1318
|
+
step = iterator.next();
|
|
1319
|
+
if (step.done) {
|
|
1320
|
+
return step;
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
return iterations % 2 ? iteratorValue(type, iterations++, separator) : iteratorValue(type, iterations++, step.value, step);
|
|
1324
|
+
});
|
|
1325
|
+
};
|
|
1326
|
+
return interposedSequence;
|
|
1327
|
+
}
|
|
1328
|
+
function sortFactory(collection, comparator, mapper) {
|
|
1329
|
+
if (!comparator) {
|
|
1330
|
+
comparator = defaultComparator;
|
|
1331
|
+
}
|
|
1332
|
+
var isKeyedCollection = isKeyed(collection);
|
|
1333
|
+
var index = 0;
|
|
1334
|
+
var entries2 = collection.toSeq().map(function(v, k) {
|
|
1335
|
+
return [k, v, index++, mapper ? mapper(v, k, collection) : v];
|
|
1336
|
+
}).valueSeq().toArray();
|
|
1337
|
+
entries2.sort(function(a, b) {
|
|
1338
|
+
return comparator(a[3], b[3]) || a[2] - b[2];
|
|
1339
|
+
}).forEach(isKeyedCollection ? function(v, i) {
|
|
1340
|
+
entries2[i].length = 2;
|
|
1341
|
+
} : function(v, i) {
|
|
1342
|
+
entries2[i] = v[1];
|
|
1343
|
+
});
|
|
1344
|
+
return isKeyedCollection ? KeyedSeq(entries2) : isIndexed(collection) ? IndexedSeq(entries2) : SetSeq(entries2);
|
|
1345
|
+
}
|
|
1346
|
+
function maxFactory(collection, comparator, mapper) {
|
|
1347
|
+
if (!comparator) {
|
|
1348
|
+
comparator = defaultComparator;
|
|
1349
|
+
}
|
|
1350
|
+
if (mapper) {
|
|
1351
|
+
var entry = collection.toSeq().map(function(v, k) {
|
|
1352
|
+
return [v, mapper(v, k, collection)];
|
|
1353
|
+
}).reduce(function(a, b) {
|
|
1354
|
+
return maxCompare(comparator, a[1], b[1]) ? b : a;
|
|
1355
|
+
});
|
|
1356
|
+
return entry && entry[0];
|
|
1357
|
+
}
|
|
1358
|
+
return collection.reduce(function(a, b) {
|
|
1359
|
+
return maxCompare(comparator, a, b) ? b : a;
|
|
1360
|
+
});
|
|
1361
|
+
}
|
|
1362
|
+
function maxCompare(comparator, a, b) {
|
|
1363
|
+
var comp = comparator(b, a);
|
|
1364
|
+
return comp === 0 && b !== a && (b === void 0 || b === null || b !== b) || comp > 0;
|
|
1365
|
+
}
|
|
1366
|
+
function zipWithFactory(keyIter, zipper, iters, zipAll2) {
|
|
1367
|
+
var zipSequence = makeSequence(keyIter);
|
|
1368
|
+
var sizes = new ArraySeq(iters).map(function(i) {
|
|
1369
|
+
return i.size;
|
|
1370
|
+
});
|
|
1371
|
+
zipSequence.size = zipAll2 ? sizes.max() : sizes.min();
|
|
1372
|
+
zipSequence.__iterate = function(fn, reverse3) {
|
|
1373
|
+
var iterator = this.__iterator(ITERATE_VALUES, reverse3);
|
|
1374
|
+
var step;
|
|
1375
|
+
var iterations = 0;
|
|
1376
|
+
while (!(step = iterator.next()).done) {
|
|
1377
|
+
if (fn(step.value, iterations++, this) === false) {
|
|
1378
|
+
break;
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
return iterations;
|
|
1382
|
+
};
|
|
1383
|
+
zipSequence.__iteratorUncached = function(type, reverse3) {
|
|
1384
|
+
var iterators = iters.map(function(i) {
|
|
1385
|
+
return i = Collection(i), getIterator(reverse3 ? i.reverse() : i);
|
|
1386
|
+
});
|
|
1387
|
+
var iterations = 0;
|
|
1388
|
+
var isDone = false;
|
|
1389
|
+
return new Iterator(function() {
|
|
1390
|
+
var steps;
|
|
1391
|
+
if (!isDone) {
|
|
1392
|
+
steps = iterators.map(function(i) {
|
|
1393
|
+
return i.next();
|
|
1394
|
+
});
|
|
1395
|
+
isDone = zipAll2 ? steps.every(function(s) {
|
|
1396
|
+
return s.done;
|
|
1397
|
+
}) : steps.some(function(s) {
|
|
1398
|
+
return s.done;
|
|
1399
|
+
});
|
|
1400
|
+
}
|
|
1401
|
+
if (isDone) {
|
|
1402
|
+
return iteratorDone();
|
|
1403
|
+
}
|
|
1404
|
+
return iteratorValue(type, iterations++, zipper.apply(null, steps.map(function(s) {
|
|
1405
|
+
return s.value;
|
|
1406
|
+
})));
|
|
1407
|
+
});
|
|
1408
|
+
};
|
|
1409
|
+
return zipSequence;
|
|
1410
|
+
}
|
|
1411
|
+
function reify(iter, seq) {
|
|
1412
|
+
return iter === seq ? iter : isSeq(iter) ? seq : iter.constructor(seq);
|
|
1413
|
+
}
|
|
1414
|
+
function validateEntry(entry) {
|
|
1415
|
+
if (entry !== Object(entry)) {
|
|
1416
|
+
throw new TypeError("Expected [K, V] tuple: " + entry);
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
function collectionClass(collection) {
|
|
1420
|
+
return isKeyed(collection) ? KeyedCollection : isIndexed(collection) ? IndexedCollection : SetCollection;
|
|
1421
|
+
}
|
|
1422
|
+
function makeSequence(collection) {
|
|
1423
|
+
return Object.create((isKeyed(collection) ? KeyedSeq : isIndexed(collection) ? IndexedSeq : SetSeq).prototype);
|
|
1424
|
+
}
|
|
1425
|
+
function cacheResultThrough() {
|
|
1426
|
+
if (this._iter.cacheResult) {
|
|
1427
|
+
this._iter.cacheResult();
|
|
1428
|
+
this.size = this._iter.size;
|
|
1429
|
+
return this;
|
|
1430
|
+
}
|
|
1431
|
+
return Seq.prototype.cacheResult.call(this);
|
|
1432
|
+
}
|
|
1433
|
+
function defaultComparator(a, b) {
|
|
1434
|
+
if (a === void 0 && b === void 0) {
|
|
1435
|
+
return 0;
|
|
1436
|
+
}
|
|
1437
|
+
if (a === void 0) {
|
|
1438
|
+
return 1;
|
|
1439
|
+
}
|
|
1440
|
+
if (b === void 0) {
|
|
1441
|
+
return -1;
|
|
1442
|
+
}
|
|
1443
|
+
return a > b ? 1 : a < b ? -1 : 0;
|
|
1444
|
+
}
|
|
1445
|
+
function arrCopy(arr, offset) {
|
|
1446
|
+
offset = offset || 0;
|
|
1447
|
+
var len = Math.max(0, arr.length - offset);
|
|
1448
|
+
var newArr = new Array(len);
|
|
1449
|
+
for (var ii = 0; ii < len; ii++) {
|
|
1450
|
+
newArr[ii] = arr[ii + offset];
|
|
1451
|
+
}
|
|
1452
|
+
return newArr;
|
|
1453
|
+
}
|
|
1454
|
+
function invariant(condition, error) {
|
|
1455
|
+
if (!condition) {
|
|
1456
|
+
throw new Error(error);
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
function assertNotInfinite(size) {
|
|
1460
|
+
invariant(size !== Infinity, "Cannot perform this action with an infinite size.");
|
|
1461
|
+
}
|
|
1462
|
+
function coerceKeyPath(keyPath) {
|
|
1463
|
+
if (isArrayLike(keyPath) && typeof keyPath !== "string") {
|
|
1464
|
+
return keyPath;
|
|
1465
|
+
}
|
|
1466
|
+
if (isOrdered(keyPath)) {
|
|
1467
|
+
return keyPath.toArray();
|
|
1468
|
+
}
|
|
1469
|
+
throw new TypeError("Invalid keyPath: expected Ordered Collection or Array: " + keyPath);
|
|
1470
|
+
}
|
|
1471
|
+
var toString = Object.prototype.toString;
|
|
1472
|
+
function isPlainObject(value) {
|
|
1473
|
+
if (!value || typeof value !== "object" || toString.call(value) !== "[object Object]") {
|
|
1474
|
+
return false;
|
|
1475
|
+
}
|
|
1476
|
+
var proto = Object.getPrototypeOf(value);
|
|
1477
|
+
if (proto === null) {
|
|
1478
|
+
return true;
|
|
1479
|
+
}
|
|
1480
|
+
var parentProto = proto;
|
|
1481
|
+
var nextProto = Object.getPrototypeOf(proto);
|
|
1482
|
+
while (nextProto !== null) {
|
|
1483
|
+
parentProto = nextProto;
|
|
1484
|
+
nextProto = Object.getPrototypeOf(parentProto);
|
|
1485
|
+
}
|
|
1486
|
+
return parentProto === proto;
|
|
1487
|
+
}
|
|
1488
|
+
function isDataStructure(value) {
|
|
1489
|
+
return typeof value === "object" && (isImmutable(value) || Array.isArray(value) || isPlainObject(value));
|
|
1490
|
+
}
|
|
1491
|
+
function quoteString(value) {
|
|
1492
|
+
try {
|
|
1493
|
+
return typeof value === "string" ? JSON.stringify(value) : String(value);
|
|
1494
|
+
} catch (_ignoreError) {
|
|
1495
|
+
return JSON.stringify(value);
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
function has(collection, key) {
|
|
1499
|
+
return isImmutable(collection) ? collection.has(key) : isDataStructure(collection) && hasOwnProperty.call(collection, key);
|
|
1500
|
+
}
|
|
1501
|
+
function get(collection, key, notSetValue) {
|
|
1502
|
+
return isImmutable(collection) ? collection.get(key, notSetValue) : !has(collection, key) ? notSetValue : typeof collection.get === "function" ? collection.get(key) : collection[key];
|
|
1503
|
+
}
|
|
1504
|
+
function shallowCopy(from) {
|
|
1505
|
+
if (Array.isArray(from)) {
|
|
1506
|
+
return arrCopy(from);
|
|
1507
|
+
}
|
|
1508
|
+
var to = {};
|
|
1509
|
+
for (var key in from) {
|
|
1510
|
+
if (hasOwnProperty.call(from, key)) {
|
|
1511
|
+
to[key] = from[key];
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
return to;
|
|
1515
|
+
}
|
|
1516
|
+
function remove(collection, key) {
|
|
1517
|
+
if (!isDataStructure(collection)) {
|
|
1518
|
+
throw new TypeError("Cannot update non-data-structure value: " + collection);
|
|
1519
|
+
}
|
|
1520
|
+
if (isImmutable(collection)) {
|
|
1521
|
+
if (!collection.remove) {
|
|
1522
|
+
throw new TypeError("Cannot update immutable value without .remove() method: " + collection);
|
|
1523
|
+
}
|
|
1524
|
+
return collection.remove(key);
|
|
1525
|
+
}
|
|
1526
|
+
if (!hasOwnProperty.call(collection, key)) {
|
|
1527
|
+
return collection;
|
|
1528
|
+
}
|
|
1529
|
+
var collectionCopy = shallowCopy(collection);
|
|
1530
|
+
if (Array.isArray(collectionCopy)) {
|
|
1531
|
+
collectionCopy.splice(key, 1);
|
|
1532
|
+
} else {
|
|
1533
|
+
delete collectionCopy[key];
|
|
1534
|
+
}
|
|
1535
|
+
return collectionCopy;
|
|
1536
|
+
}
|
|
1537
|
+
function set(collection, key, value) {
|
|
1538
|
+
if (!isDataStructure(collection)) {
|
|
1539
|
+
throw new TypeError("Cannot update non-data-structure value: " + collection);
|
|
1540
|
+
}
|
|
1541
|
+
if (isImmutable(collection)) {
|
|
1542
|
+
if (!collection.set) {
|
|
1543
|
+
throw new TypeError("Cannot update immutable value without .set() method: " + collection);
|
|
1544
|
+
}
|
|
1545
|
+
return collection.set(key, value);
|
|
1546
|
+
}
|
|
1547
|
+
if (hasOwnProperty.call(collection, key) && value === collection[key]) {
|
|
1548
|
+
return collection;
|
|
1549
|
+
}
|
|
1550
|
+
var collectionCopy = shallowCopy(collection);
|
|
1551
|
+
collectionCopy[key] = value;
|
|
1552
|
+
return collectionCopy;
|
|
1553
|
+
}
|
|
1554
|
+
function updateIn$1(collection, keyPath, notSetValue, updater) {
|
|
1555
|
+
if (!updater) {
|
|
1556
|
+
updater = notSetValue;
|
|
1557
|
+
notSetValue = void 0;
|
|
1558
|
+
}
|
|
1559
|
+
var updatedValue = updateInDeeply(isImmutable(collection), collection, coerceKeyPath(keyPath), 0, notSetValue, updater);
|
|
1560
|
+
return updatedValue === NOT_SET ? notSetValue : updatedValue;
|
|
1561
|
+
}
|
|
1562
|
+
function updateInDeeply(inImmutable, existing, keyPath, i, notSetValue, updater) {
|
|
1563
|
+
var wasNotSet = existing === NOT_SET;
|
|
1564
|
+
if (i === keyPath.length) {
|
|
1565
|
+
var existingValue = wasNotSet ? notSetValue : existing;
|
|
1566
|
+
var newValue = updater(existingValue);
|
|
1567
|
+
return newValue === existingValue ? existing : newValue;
|
|
1568
|
+
}
|
|
1569
|
+
if (!wasNotSet && !isDataStructure(existing)) {
|
|
1570
|
+
throw new TypeError("Cannot update within non-data-structure value in path [" + keyPath.slice(0, i).map(quoteString) + "]: " + existing);
|
|
1571
|
+
}
|
|
1572
|
+
var key = keyPath[i];
|
|
1573
|
+
var nextExisting = wasNotSet ? NOT_SET : get(existing, key, NOT_SET);
|
|
1574
|
+
var nextUpdated = updateInDeeply(nextExisting === NOT_SET ? inImmutable : isImmutable(nextExisting), nextExisting, keyPath, i + 1, notSetValue, updater);
|
|
1575
|
+
return nextUpdated === nextExisting ? existing : nextUpdated === NOT_SET ? remove(existing, key) : set(wasNotSet ? inImmutable ? emptyMap() : {} : existing, key, nextUpdated);
|
|
1576
|
+
}
|
|
1577
|
+
function setIn$1(collection, keyPath, value) {
|
|
1578
|
+
return updateIn$1(collection, keyPath, NOT_SET, function() {
|
|
1579
|
+
return value;
|
|
1580
|
+
});
|
|
1581
|
+
}
|
|
1582
|
+
function setIn(keyPath, v) {
|
|
1583
|
+
return setIn$1(this, keyPath, v);
|
|
1584
|
+
}
|
|
1585
|
+
function removeIn(collection, keyPath) {
|
|
1586
|
+
return updateIn$1(collection, keyPath, function() {
|
|
1587
|
+
return NOT_SET;
|
|
1588
|
+
});
|
|
1589
|
+
}
|
|
1590
|
+
function deleteIn(keyPath) {
|
|
1591
|
+
return removeIn(this, keyPath);
|
|
1592
|
+
}
|
|
1593
|
+
function update$1(collection, key, notSetValue, updater) {
|
|
1594
|
+
return updateIn$1(collection, [key], notSetValue, updater);
|
|
1595
|
+
}
|
|
1596
|
+
function update(key, notSetValue, updater) {
|
|
1597
|
+
return arguments.length === 1 ? key(this) : update$1(this, key, notSetValue, updater);
|
|
1598
|
+
}
|
|
1599
|
+
function updateIn(keyPath, notSetValue, updater) {
|
|
1600
|
+
return updateIn$1(this, keyPath, notSetValue, updater);
|
|
1601
|
+
}
|
|
1602
|
+
function merge$1() {
|
|
1603
|
+
var iters = [], len = arguments.length;
|
|
1604
|
+
while (len--)
|
|
1605
|
+
iters[len] = arguments[len];
|
|
1606
|
+
return mergeIntoKeyedWith(this, iters);
|
|
1607
|
+
}
|
|
1608
|
+
function mergeWith$1(merger) {
|
|
1609
|
+
var iters = [], len = arguments.length - 1;
|
|
1610
|
+
while (len-- > 0)
|
|
1611
|
+
iters[len] = arguments[len + 1];
|
|
1612
|
+
if (typeof merger !== "function") {
|
|
1613
|
+
throw new TypeError("Invalid merger function: " + merger);
|
|
1614
|
+
}
|
|
1615
|
+
return mergeIntoKeyedWith(this, iters, merger);
|
|
1616
|
+
}
|
|
1617
|
+
function mergeIntoKeyedWith(collection, collections, merger) {
|
|
1618
|
+
var iters = [];
|
|
1619
|
+
for (var ii = 0; ii < collections.length; ii++) {
|
|
1620
|
+
var collection$1 = KeyedCollection(collections[ii]);
|
|
1621
|
+
if (collection$1.size !== 0) {
|
|
1622
|
+
iters.push(collection$1);
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
if (iters.length === 0) {
|
|
1626
|
+
return collection;
|
|
1627
|
+
}
|
|
1628
|
+
if (collection.toSeq().size === 0 && !collection.__ownerID && iters.length === 1) {
|
|
1629
|
+
return collection.constructor(iters[0]);
|
|
1630
|
+
}
|
|
1631
|
+
return collection.withMutations(function(collection2) {
|
|
1632
|
+
var mergeIntoCollection = merger ? function(value, key) {
|
|
1633
|
+
update$1(collection2, key, NOT_SET, function(oldVal) {
|
|
1634
|
+
return oldVal === NOT_SET ? value : merger(oldVal, value, key);
|
|
1635
|
+
});
|
|
1636
|
+
} : function(value, key) {
|
|
1637
|
+
collection2.set(key, value);
|
|
1638
|
+
};
|
|
1639
|
+
for (var ii2 = 0; ii2 < iters.length; ii2++) {
|
|
1640
|
+
iters[ii2].forEach(mergeIntoCollection);
|
|
1641
|
+
}
|
|
1642
|
+
});
|
|
1643
|
+
}
|
|
1644
|
+
function mergeDeepWithSources(collection, sources, merger) {
|
|
1645
|
+
return mergeWithSources(collection, sources, deepMergerWith(merger));
|
|
1646
|
+
}
|
|
1647
|
+
function mergeWithSources(collection, sources, merger) {
|
|
1648
|
+
if (!isDataStructure(collection)) {
|
|
1649
|
+
throw new TypeError("Cannot merge into non-data-structure value: " + collection);
|
|
1650
|
+
}
|
|
1651
|
+
if (isImmutable(collection)) {
|
|
1652
|
+
return typeof merger === "function" && collection.mergeWith ? collection.mergeWith.apply(collection, [merger].concat(sources)) : collection.merge ? collection.merge.apply(collection, sources) : collection.concat.apply(collection, sources);
|
|
1653
|
+
}
|
|
1654
|
+
var isArray = Array.isArray(collection);
|
|
1655
|
+
var merged = collection;
|
|
1656
|
+
var Collection3 = isArray ? IndexedCollection : KeyedCollection;
|
|
1657
|
+
var mergeItem = isArray ? function(value) {
|
|
1658
|
+
if (merged === collection) {
|
|
1659
|
+
merged = shallowCopy(merged);
|
|
1660
|
+
}
|
|
1661
|
+
merged.push(value);
|
|
1662
|
+
} : function(value, key) {
|
|
1663
|
+
var hasVal = hasOwnProperty.call(merged, key);
|
|
1664
|
+
var nextVal = hasVal && merger ? merger(merged[key], value, key) : value;
|
|
1665
|
+
if (!hasVal || nextVal !== merged[key]) {
|
|
1666
|
+
if (merged === collection) {
|
|
1667
|
+
merged = shallowCopy(merged);
|
|
1668
|
+
}
|
|
1669
|
+
merged[key] = nextVal;
|
|
1670
|
+
}
|
|
1671
|
+
};
|
|
1672
|
+
for (var i = 0; i < sources.length; i++) {
|
|
1673
|
+
Collection3(sources[i]).forEach(mergeItem);
|
|
1674
|
+
}
|
|
1675
|
+
return merged;
|
|
1676
|
+
}
|
|
1677
|
+
function deepMergerWith(merger) {
|
|
1678
|
+
function deepMerger(oldValue, newValue, key) {
|
|
1679
|
+
return isDataStructure(oldValue) && isDataStructure(newValue) && areMergeable(oldValue, newValue) ? mergeWithSources(oldValue, [newValue], deepMerger) : merger ? merger(oldValue, newValue, key) : newValue;
|
|
1680
|
+
}
|
|
1681
|
+
return deepMerger;
|
|
1682
|
+
}
|
|
1683
|
+
function areMergeable(oldDataStructure, newDataStructure) {
|
|
1684
|
+
var oldSeq = Seq(oldDataStructure);
|
|
1685
|
+
var newSeq = Seq(newDataStructure);
|
|
1686
|
+
return isIndexed(oldSeq) === isIndexed(newSeq) && isKeyed(oldSeq) === isKeyed(newSeq);
|
|
1687
|
+
}
|
|
1688
|
+
function mergeDeep() {
|
|
1689
|
+
var iters = [], len = arguments.length;
|
|
1690
|
+
while (len--)
|
|
1691
|
+
iters[len] = arguments[len];
|
|
1692
|
+
return mergeDeepWithSources(this, iters);
|
|
1693
|
+
}
|
|
1694
|
+
function mergeDeepWith(merger) {
|
|
1695
|
+
var iters = [], len = arguments.length - 1;
|
|
1696
|
+
while (len-- > 0)
|
|
1697
|
+
iters[len] = arguments[len + 1];
|
|
1698
|
+
return mergeDeepWithSources(this, iters, merger);
|
|
1699
|
+
}
|
|
1700
|
+
function mergeIn(keyPath) {
|
|
1701
|
+
var iters = [], len = arguments.length - 1;
|
|
1702
|
+
while (len-- > 0)
|
|
1703
|
+
iters[len] = arguments[len + 1];
|
|
1704
|
+
return updateIn$1(this, keyPath, emptyMap(), function(m) {
|
|
1705
|
+
return mergeWithSources(m, iters);
|
|
1706
|
+
});
|
|
1707
|
+
}
|
|
1708
|
+
function mergeDeepIn(keyPath) {
|
|
1709
|
+
var iters = [], len = arguments.length - 1;
|
|
1710
|
+
while (len-- > 0)
|
|
1711
|
+
iters[len] = arguments[len + 1];
|
|
1712
|
+
return updateIn$1(this, keyPath, emptyMap(), function(m) {
|
|
1713
|
+
return mergeDeepWithSources(m, iters);
|
|
1714
|
+
});
|
|
1715
|
+
}
|
|
1716
|
+
function withMutations(fn) {
|
|
1717
|
+
var mutable = this.asMutable();
|
|
1718
|
+
fn(mutable);
|
|
1719
|
+
return mutable.wasAltered() ? mutable.__ensureOwner(this.__ownerID) : this;
|
|
1720
|
+
}
|
|
1721
|
+
function asMutable() {
|
|
1722
|
+
return this.__ownerID ? this : this.__ensureOwner(new OwnerID());
|
|
1723
|
+
}
|
|
1724
|
+
function asImmutable() {
|
|
1725
|
+
return this.__ensureOwner();
|
|
1726
|
+
}
|
|
1727
|
+
function wasAltered() {
|
|
1728
|
+
return this.__altered;
|
|
1729
|
+
}
|
|
1730
|
+
var Map$1 = /* @__PURE__ */ function(KeyedCollection2) {
|
|
1731
|
+
function Map2(value) {
|
|
1732
|
+
return value === null || value === void 0 ? emptyMap() : isMap(value) && !isOrdered(value) ? value : emptyMap().withMutations(function(map2) {
|
|
1733
|
+
var iter = KeyedCollection2(value);
|
|
1734
|
+
assertNotInfinite(iter.size);
|
|
1735
|
+
iter.forEach(function(v, k) {
|
|
1736
|
+
return map2.set(k, v);
|
|
1737
|
+
});
|
|
1738
|
+
});
|
|
1739
|
+
}
|
|
1740
|
+
if (KeyedCollection2)
|
|
1741
|
+
Map2.__proto__ = KeyedCollection2;
|
|
1742
|
+
Map2.prototype = Object.create(KeyedCollection2 && KeyedCollection2.prototype);
|
|
1743
|
+
Map2.prototype.constructor = Map2;
|
|
1744
|
+
Map2.of = function of() {
|
|
1745
|
+
var keyValues = [], len = arguments.length;
|
|
1746
|
+
while (len--)
|
|
1747
|
+
keyValues[len] = arguments[len];
|
|
1748
|
+
return emptyMap().withMutations(function(map2) {
|
|
1749
|
+
for (var i = 0; i < keyValues.length; i += 2) {
|
|
1750
|
+
if (i + 1 >= keyValues.length) {
|
|
1751
|
+
throw new Error("Missing value for key: " + keyValues[i]);
|
|
1752
|
+
}
|
|
1753
|
+
map2.set(keyValues[i], keyValues[i + 1]);
|
|
1754
|
+
}
|
|
1755
|
+
});
|
|
1756
|
+
};
|
|
1757
|
+
Map2.prototype.toString = function toString4() {
|
|
1758
|
+
return this.__toString("Map {", "}");
|
|
1759
|
+
};
|
|
1760
|
+
Map2.prototype.get = function get10(k, notSetValue) {
|
|
1761
|
+
return this._root ? this._root.get(0, void 0, k, notSetValue) : notSetValue;
|
|
1762
|
+
};
|
|
1763
|
+
Map2.prototype.set = function set2(k, v) {
|
|
1764
|
+
return updateMap(this, k, v);
|
|
1765
|
+
};
|
|
1766
|
+
Map2.prototype.remove = function remove2(k) {
|
|
1767
|
+
return updateMap(this, k, NOT_SET);
|
|
1768
|
+
};
|
|
1769
|
+
Map2.prototype.deleteAll = function deleteAll(keys2) {
|
|
1770
|
+
var collection = Collection(keys2);
|
|
1771
|
+
if (collection.size === 0) {
|
|
1772
|
+
return this;
|
|
1773
|
+
}
|
|
1774
|
+
return this.withMutations(function(map2) {
|
|
1775
|
+
collection.forEach(function(key) {
|
|
1776
|
+
return map2.remove(key);
|
|
1777
|
+
});
|
|
1778
|
+
});
|
|
1779
|
+
};
|
|
1780
|
+
Map2.prototype.clear = function clear() {
|
|
1781
|
+
if (this.size === 0) {
|
|
1782
|
+
return this;
|
|
1783
|
+
}
|
|
1784
|
+
if (this.__ownerID) {
|
|
1785
|
+
this.size = 0;
|
|
1786
|
+
this._root = null;
|
|
1787
|
+
this.__hash = void 0;
|
|
1788
|
+
this.__altered = true;
|
|
1789
|
+
return this;
|
|
1790
|
+
}
|
|
1791
|
+
return emptyMap();
|
|
1792
|
+
};
|
|
1793
|
+
Map2.prototype.sort = function sort2(comparator) {
|
|
1794
|
+
return OrderedMap(sortFactory(this, comparator));
|
|
1795
|
+
};
|
|
1796
|
+
Map2.prototype.sortBy = function sortBy2(mapper, comparator) {
|
|
1797
|
+
return OrderedMap(sortFactory(this, comparator, mapper));
|
|
1798
|
+
};
|
|
1799
|
+
Map2.prototype.map = function map2(mapper, context) {
|
|
1800
|
+
var this$1$1 = this;
|
|
1801
|
+
return this.withMutations(function(map3) {
|
|
1802
|
+
map3.forEach(function(value, key) {
|
|
1803
|
+
map3.set(key, mapper.call(context, value, key, this$1$1));
|
|
1804
|
+
});
|
|
1805
|
+
});
|
|
1806
|
+
};
|
|
1807
|
+
Map2.prototype.__iterator = function __iterator(type, reverse3) {
|
|
1808
|
+
return new MapIterator(this, type, reverse3);
|
|
1809
|
+
};
|
|
1810
|
+
Map2.prototype.__iterate = function __iterate(fn, reverse3) {
|
|
1811
|
+
var this$1$1 = this;
|
|
1812
|
+
var iterations = 0;
|
|
1813
|
+
this._root && this._root.iterate(function(entry) {
|
|
1814
|
+
iterations++;
|
|
1815
|
+
return fn(entry[1], entry[0], this$1$1);
|
|
1816
|
+
}, reverse3);
|
|
1817
|
+
return iterations;
|
|
1818
|
+
};
|
|
1819
|
+
Map2.prototype.__ensureOwner = function __ensureOwner(ownerID) {
|
|
1820
|
+
if (ownerID === this.__ownerID) {
|
|
1821
|
+
return this;
|
|
1822
|
+
}
|
|
1823
|
+
if (!ownerID) {
|
|
1824
|
+
if (this.size === 0) {
|
|
1825
|
+
return emptyMap();
|
|
1826
|
+
}
|
|
1827
|
+
this.__ownerID = ownerID;
|
|
1828
|
+
this.__altered = false;
|
|
1829
|
+
return this;
|
|
1830
|
+
}
|
|
1831
|
+
return makeMap(this.size, this._root, ownerID, this.__hash);
|
|
1832
|
+
};
|
|
1833
|
+
return Map2;
|
|
1834
|
+
}(KeyedCollection);
|
|
1835
|
+
Map$1.isMap = isMap;
|
|
1836
|
+
var MapPrototype = Map$1.prototype;
|
|
1837
|
+
MapPrototype[IS_MAP_SYMBOL] = true;
|
|
1838
|
+
MapPrototype[DELETE] = MapPrototype.remove;
|
|
1839
|
+
MapPrototype.removeAll = MapPrototype.deleteAll;
|
|
1840
|
+
MapPrototype.setIn = setIn;
|
|
1841
|
+
MapPrototype.removeIn = MapPrototype.deleteIn = deleteIn;
|
|
1842
|
+
MapPrototype.update = update;
|
|
1843
|
+
MapPrototype.updateIn = updateIn;
|
|
1844
|
+
MapPrototype.merge = MapPrototype.concat = merge$1;
|
|
1845
|
+
MapPrototype.mergeWith = mergeWith$1;
|
|
1846
|
+
MapPrototype.mergeDeep = mergeDeep;
|
|
1847
|
+
MapPrototype.mergeDeepWith = mergeDeepWith;
|
|
1848
|
+
MapPrototype.mergeIn = mergeIn;
|
|
1849
|
+
MapPrototype.mergeDeepIn = mergeDeepIn;
|
|
1850
|
+
MapPrototype.withMutations = withMutations;
|
|
1851
|
+
MapPrototype.wasAltered = wasAltered;
|
|
1852
|
+
MapPrototype.asImmutable = asImmutable;
|
|
1853
|
+
MapPrototype["@@transducer/init"] = MapPrototype.asMutable = asMutable;
|
|
1854
|
+
MapPrototype["@@transducer/step"] = function(result, arr) {
|
|
1855
|
+
return result.set(arr[0], arr[1]);
|
|
1856
|
+
};
|
|
1857
|
+
MapPrototype["@@transducer/result"] = function(obj) {
|
|
1858
|
+
return obj.asImmutable();
|
|
1859
|
+
};
|
|
1860
|
+
var ArrayMapNode = function ArrayMapNode2(ownerID, entries2) {
|
|
1861
|
+
this.ownerID = ownerID;
|
|
1862
|
+
this.entries = entries2;
|
|
1863
|
+
};
|
|
1864
|
+
ArrayMapNode.prototype.get = function get2(shift, keyHash, key, notSetValue) {
|
|
1865
|
+
var entries2 = this.entries;
|
|
1866
|
+
for (var ii = 0, len = entries2.length; ii < len; ii++) {
|
|
1867
|
+
if (is(key, entries2[ii][0])) {
|
|
1868
|
+
return entries2[ii][1];
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1871
|
+
return notSetValue;
|
|
1872
|
+
};
|
|
1873
|
+
ArrayMapNode.prototype.update = function update2(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
|
|
1874
|
+
var removed = value === NOT_SET;
|
|
1875
|
+
var entries2 = this.entries;
|
|
1876
|
+
var idx = 0;
|
|
1877
|
+
var len = entries2.length;
|
|
1878
|
+
for (; idx < len; idx++) {
|
|
1879
|
+
if (is(key, entries2[idx][0])) {
|
|
1880
|
+
break;
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
1883
|
+
var exists = idx < len;
|
|
1884
|
+
if (exists ? entries2[idx][1] === value : removed) {
|
|
1885
|
+
return this;
|
|
1886
|
+
}
|
|
1887
|
+
SetRef(didAlter);
|
|
1888
|
+
(removed || !exists) && SetRef(didChangeSize);
|
|
1889
|
+
if (removed && entries2.length === 1) {
|
|
1890
|
+
return;
|
|
1891
|
+
}
|
|
1892
|
+
if (!exists && !removed && entries2.length >= MAX_ARRAY_MAP_SIZE) {
|
|
1893
|
+
return createNodes(ownerID, entries2, key, value);
|
|
1894
|
+
}
|
|
1895
|
+
var isEditable = ownerID && ownerID === this.ownerID;
|
|
1896
|
+
var newEntries = isEditable ? entries2 : arrCopy(entries2);
|
|
1897
|
+
if (exists) {
|
|
1898
|
+
if (removed) {
|
|
1899
|
+
idx === len - 1 ? newEntries.pop() : newEntries[idx] = newEntries.pop();
|
|
1900
|
+
} else {
|
|
1901
|
+
newEntries[idx] = [key, value];
|
|
1902
|
+
}
|
|
1903
|
+
} else {
|
|
1904
|
+
newEntries.push([key, value]);
|
|
1905
|
+
}
|
|
1906
|
+
if (isEditable) {
|
|
1907
|
+
this.entries = newEntries;
|
|
1908
|
+
return this;
|
|
1909
|
+
}
|
|
1910
|
+
return new ArrayMapNode(ownerID, newEntries);
|
|
1911
|
+
};
|
|
1912
|
+
var BitmapIndexedNode = function BitmapIndexedNode2(ownerID, bitmap, nodes) {
|
|
1913
|
+
this.ownerID = ownerID;
|
|
1914
|
+
this.bitmap = bitmap;
|
|
1915
|
+
this.nodes = nodes;
|
|
1916
|
+
};
|
|
1917
|
+
BitmapIndexedNode.prototype.get = function get3(shift, keyHash, key, notSetValue) {
|
|
1918
|
+
if (keyHash === void 0) {
|
|
1919
|
+
keyHash = hash(key);
|
|
1920
|
+
}
|
|
1921
|
+
var bit = 1 << ((shift === 0 ? keyHash : keyHash >>> shift) & MASK);
|
|
1922
|
+
var bitmap = this.bitmap;
|
|
1923
|
+
return (bitmap & bit) === 0 ? notSetValue : this.nodes[popCount(bitmap & bit - 1)].get(shift + SHIFT, keyHash, key, notSetValue);
|
|
1924
|
+
};
|
|
1925
|
+
BitmapIndexedNode.prototype.update = function update3(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
|
|
1926
|
+
if (keyHash === void 0) {
|
|
1927
|
+
keyHash = hash(key);
|
|
1928
|
+
}
|
|
1929
|
+
var keyHashFrag = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;
|
|
1930
|
+
var bit = 1 << keyHashFrag;
|
|
1931
|
+
var bitmap = this.bitmap;
|
|
1932
|
+
var exists = (bitmap & bit) !== 0;
|
|
1933
|
+
if (!exists && value === NOT_SET) {
|
|
1934
|
+
return this;
|
|
1935
|
+
}
|
|
1936
|
+
var idx = popCount(bitmap & bit - 1);
|
|
1937
|
+
var nodes = this.nodes;
|
|
1938
|
+
var node = exists ? nodes[idx] : void 0;
|
|
1939
|
+
var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter);
|
|
1940
|
+
if (newNode === node) {
|
|
1941
|
+
return this;
|
|
1942
|
+
}
|
|
1943
|
+
if (!exists && newNode && nodes.length >= MAX_BITMAP_INDEXED_SIZE) {
|
|
1944
|
+
return expandNodes(ownerID, nodes, bitmap, keyHashFrag, newNode);
|
|
1945
|
+
}
|
|
1946
|
+
if (exists && !newNode && nodes.length === 2 && isLeafNode(nodes[idx ^ 1])) {
|
|
1947
|
+
return nodes[idx ^ 1];
|
|
1948
|
+
}
|
|
1949
|
+
if (exists && newNode && nodes.length === 1 && isLeafNode(newNode)) {
|
|
1950
|
+
return newNode;
|
|
1951
|
+
}
|
|
1952
|
+
var isEditable = ownerID && ownerID === this.ownerID;
|
|
1953
|
+
var newBitmap = exists ? newNode ? bitmap : bitmap ^ bit : bitmap | bit;
|
|
1954
|
+
var newNodes = exists ? newNode ? setAt(nodes, idx, newNode, isEditable) : spliceOut(nodes, idx, isEditable) : spliceIn(nodes, idx, newNode, isEditable);
|
|
1955
|
+
if (isEditable) {
|
|
1956
|
+
this.bitmap = newBitmap;
|
|
1957
|
+
this.nodes = newNodes;
|
|
1958
|
+
return this;
|
|
1959
|
+
}
|
|
1960
|
+
return new BitmapIndexedNode(ownerID, newBitmap, newNodes);
|
|
1961
|
+
};
|
|
1962
|
+
var HashArrayMapNode = function HashArrayMapNode2(ownerID, count2, nodes) {
|
|
1963
|
+
this.ownerID = ownerID;
|
|
1964
|
+
this.count = count2;
|
|
1965
|
+
this.nodes = nodes;
|
|
1966
|
+
};
|
|
1967
|
+
HashArrayMapNode.prototype.get = function get4(shift, keyHash, key, notSetValue) {
|
|
1968
|
+
if (keyHash === void 0) {
|
|
1969
|
+
keyHash = hash(key);
|
|
1970
|
+
}
|
|
1971
|
+
var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;
|
|
1972
|
+
var node = this.nodes[idx];
|
|
1973
|
+
return node ? node.get(shift + SHIFT, keyHash, key, notSetValue) : notSetValue;
|
|
1974
|
+
};
|
|
1975
|
+
HashArrayMapNode.prototype.update = function update4(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
|
|
1976
|
+
if (keyHash === void 0) {
|
|
1977
|
+
keyHash = hash(key);
|
|
1978
|
+
}
|
|
1979
|
+
var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;
|
|
1980
|
+
var removed = value === NOT_SET;
|
|
1981
|
+
var nodes = this.nodes;
|
|
1982
|
+
var node = nodes[idx];
|
|
1983
|
+
if (removed && !node) {
|
|
1984
|
+
return this;
|
|
1985
|
+
}
|
|
1986
|
+
var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter);
|
|
1987
|
+
if (newNode === node) {
|
|
1988
|
+
return this;
|
|
1989
|
+
}
|
|
1990
|
+
var newCount = this.count;
|
|
1991
|
+
if (!node) {
|
|
1992
|
+
newCount++;
|
|
1993
|
+
} else if (!newNode) {
|
|
1994
|
+
newCount--;
|
|
1995
|
+
if (newCount < MIN_HASH_ARRAY_MAP_SIZE) {
|
|
1996
|
+
return packNodes(ownerID, nodes, newCount, idx);
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
var isEditable = ownerID && ownerID === this.ownerID;
|
|
2000
|
+
var newNodes = setAt(nodes, idx, newNode, isEditable);
|
|
2001
|
+
if (isEditable) {
|
|
2002
|
+
this.count = newCount;
|
|
2003
|
+
this.nodes = newNodes;
|
|
2004
|
+
return this;
|
|
2005
|
+
}
|
|
2006
|
+
return new HashArrayMapNode(ownerID, newCount, newNodes);
|
|
2007
|
+
};
|
|
2008
|
+
var HashCollisionNode = function HashCollisionNode2(ownerID, keyHash, entries2) {
|
|
2009
|
+
this.ownerID = ownerID;
|
|
2010
|
+
this.keyHash = keyHash;
|
|
2011
|
+
this.entries = entries2;
|
|
2012
|
+
};
|
|
2013
|
+
HashCollisionNode.prototype.get = function get5(shift, keyHash, key, notSetValue) {
|
|
2014
|
+
var entries2 = this.entries;
|
|
2015
|
+
for (var ii = 0, len = entries2.length; ii < len; ii++) {
|
|
2016
|
+
if (is(key, entries2[ii][0])) {
|
|
2017
|
+
return entries2[ii][1];
|
|
2018
|
+
}
|
|
2019
|
+
}
|
|
2020
|
+
return notSetValue;
|
|
2021
|
+
};
|
|
2022
|
+
HashCollisionNode.prototype.update = function update5(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
|
|
2023
|
+
if (keyHash === void 0) {
|
|
2024
|
+
keyHash = hash(key);
|
|
2025
|
+
}
|
|
2026
|
+
var removed = value === NOT_SET;
|
|
2027
|
+
if (keyHash !== this.keyHash) {
|
|
2028
|
+
if (removed) {
|
|
2029
|
+
return this;
|
|
2030
|
+
}
|
|
2031
|
+
SetRef(didAlter);
|
|
2032
|
+
SetRef(didChangeSize);
|
|
2033
|
+
return mergeIntoNode(this, ownerID, shift, keyHash, [key, value]);
|
|
2034
|
+
}
|
|
2035
|
+
var entries2 = this.entries;
|
|
2036
|
+
var idx = 0;
|
|
2037
|
+
var len = entries2.length;
|
|
2038
|
+
for (; idx < len; idx++) {
|
|
2039
|
+
if (is(key, entries2[idx][0])) {
|
|
2040
|
+
break;
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
2043
|
+
var exists = idx < len;
|
|
2044
|
+
if (exists ? entries2[idx][1] === value : removed) {
|
|
2045
|
+
return this;
|
|
2046
|
+
}
|
|
2047
|
+
SetRef(didAlter);
|
|
2048
|
+
(removed || !exists) && SetRef(didChangeSize);
|
|
2049
|
+
if (removed && len === 2) {
|
|
2050
|
+
return new ValueNode(ownerID, this.keyHash, entries2[idx ^ 1]);
|
|
2051
|
+
}
|
|
2052
|
+
var isEditable = ownerID && ownerID === this.ownerID;
|
|
2053
|
+
var newEntries = isEditable ? entries2 : arrCopy(entries2);
|
|
2054
|
+
if (exists) {
|
|
2055
|
+
if (removed) {
|
|
2056
|
+
idx === len - 1 ? newEntries.pop() : newEntries[idx] = newEntries.pop();
|
|
2057
|
+
} else {
|
|
2058
|
+
newEntries[idx] = [key, value];
|
|
2059
|
+
}
|
|
2060
|
+
} else {
|
|
2061
|
+
newEntries.push([key, value]);
|
|
2062
|
+
}
|
|
2063
|
+
if (isEditable) {
|
|
2064
|
+
this.entries = newEntries;
|
|
2065
|
+
return this;
|
|
2066
|
+
}
|
|
2067
|
+
return new HashCollisionNode(ownerID, this.keyHash, newEntries);
|
|
2068
|
+
};
|
|
2069
|
+
var ValueNode = function ValueNode2(ownerID, keyHash, entry) {
|
|
2070
|
+
this.ownerID = ownerID;
|
|
2071
|
+
this.keyHash = keyHash;
|
|
2072
|
+
this.entry = entry;
|
|
2073
|
+
};
|
|
2074
|
+
ValueNode.prototype.get = function get6(shift, keyHash, key, notSetValue) {
|
|
2075
|
+
return is(key, this.entry[0]) ? this.entry[1] : notSetValue;
|
|
2076
|
+
};
|
|
2077
|
+
ValueNode.prototype.update = function update6(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
|
|
2078
|
+
var removed = value === NOT_SET;
|
|
2079
|
+
var keyMatch = is(key, this.entry[0]);
|
|
2080
|
+
if (keyMatch ? value === this.entry[1] : removed) {
|
|
2081
|
+
return this;
|
|
2082
|
+
}
|
|
2083
|
+
SetRef(didAlter);
|
|
2084
|
+
if (removed) {
|
|
2085
|
+
SetRef(didChangeSize);
|
|
2086
|
+
return;
|
|
2087
|
+
}
|
|
2088
|
+
if (keyMatch) {
|
|
2089
|
+
if (ownerID && ownerID === this.ownerID) {
|
|
2090
|
+
this.entry[1] = value;
|
|
2091
|
+
return this;
|
|
2092
|
+
}
|
|
2093
|
+
return new ValueNode(ownerID, this.keyHash, [key, value]);
|
|
2094
|
+
}
|
|
2095
|
+
SetRef(didChangeSize);
|
|
2096
|
+
return mergeIntoNode(this, ownerID, shift, hash(key), [key, value]);
|
|
2097
|
+
};
|
|
2098
|
+
ArrayMapNode.prototype.iterate = HashCollisionNode.prototype.iterate = function(fn, reverse3) {
|
|
2099
|
+
var entries2 = this.entries;
|
|
2100
|
+
for (var ii = 0, maxIndex = entries2.length - 1; ii <= maxIndex; ii++) {
|
|
2101
|
+
if (fn(entries2[reverse3 ? maxIndex - ii : ii]) === false) {
|
|
2102
|
+
return false;
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2105
|
+
};
|
|
2106
|
+
BitmapIndexedNode.prototype.iterate = HashArrayMapNode.prototype.iterate = function(fn, reverse3) {
|
|
2107
|
+
var nodes = this.nodes;
|
|
2108
|
+
for (var ii = 0, maxIndex = nodes.length - 1; ii <= maxIndex; ii++) {
|
|
2109
|
+
var node = nodes[reverse3 ? maxIndex - ii : ii];
|
|
2110
|
+
if (node && node.iterate(fn, reverse3) === false) {
|
|
2111
|
+
return false;
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
};
|
|
2115
|
+
ValueNode.prototype.iterate = function(fn, reverse3) {
|
|
2116
|
+
return fn(this.entry);
|
|
2117
|
+
};
|
|
2118
|
+
var MapIterator = /* @__PURE__ */ function(Iterator3) {
|
|
2119
|
+
function MapIterator2(map2, type, reverse3) {
|
|
2120
|
+
this._type = type;
|
|
2121
|
+
this._reverse = reverse3;
|
|
2122
|
+
this._stack = map2._root && mapIteratorFrame(map2._root);
|
|
2123
|
+
}
|
|
2124
|
+
if (Iterator3)
|
|
2125
|
+
MapIterator2.__proto__ = Iterator3;
|
|
2126
|
+
MapIterator2.prototype = Object.create(Iterator3 && Iterator3.prototype);
|
|
2127
|
+
MapIterator2.prototype.constructor = MapIterator2;
|
|
2128
|
+
MapIterator2.prototype.next = function next() {
|
|
2129
|
+
var type = this._type;
|
|
2130
|
+
var stack = this._stack;
|
|
2131
|
+
while (stack) {
|
|
2132
|
+
var node = stack.node;
|
|
2133
|
+
var index = stack.index++;
|
|
2134
|
+
var maxIndex = void 0;
|
|
2135
|
+
if (node.entry) {
|
|
2136
|
+
if (index === 0) {
|
|
2137
|
+
return mapIteratorValue(type, node.entry);
|
|
2138
|
+
}
|
|
2139
|
+
} else if (node.entries) {
|
|
2140
|
+
maxIndex = node.entries.length - 1;
|
|
2141
|
+
if (index <= maxIndex) {
|
|
2142
|
+
return mapIteratorValue(type, node.entries[this._reverse ? maxIndex - index : index]);
|
|
2143
|
+
}
|
|
2144
|
+
} else {
|
|
2145
|
+
maxIndex = node.nodes.length - 1;
|
|
2146
|
+
if (index <= maxIndex) {
|
|
2147
|
+
var subNode = node.nodes[this._reverse ? maxIndex - index : index];
|
|
2148
|
+
if (subNode) {
|
|
2149
|
+
if (subNode.entry) {
|
|
2150
|
+
return mapIteratorValue(type, subNode.entry);
|
|
2151
|
+
}
|
|
2152
|
+
stack = this._stack = mapIteratorFrame(subNode, stack);
|
|
2153
|
+
}
|
|
2154
|
+
continue;
|
|
2155
|
+
}
|
|
2156
|
+
}
|
|
2157
|
+
stack = this._stack = this._stack.__prev;
|
|
2158
|
+
}
|
|
2159
|
+
return iteratorDone();
|
|
2160
|
+
};
|
|
2161
|
+
return MapIterator2;
|
|
2162
|
+
}(Iterator);
|
|
2163
|
+
function mapIteratorValue(type, entry) {
|
|
2164
|
+
return iteratorValue(type, entry[0], entry[1]);
|
|
2165
|
+
}
|
|
2166
|
+
function mapIteratorFrame(node, prev) {
|
|
2167
|
+
return {
|
|
2168
|
+
node,
|
|
2169
|
+
index: 0,
|
|
2170
|
+
__prev: prev
|
|
2171
|
+
};
|
|
2172
|
+
}
|
|
2173
|
+
function makeMap(size, root, ownerID, hash2) {
|
|
2174
|
+
var map2 = Object.create(MapPrototype);
|
|
2175
|
+
map2.size = size;
|
|
2176
|
+
map2._root = root;
|
|
2177
|
+
map2.__ownerID = ownerID;
|
|
2178
|
+
map2.__hash = hash2;
|
|
2179
|
+
map2.__altered = false;
|
|
2180
|
+
return map2;
|
|
2181
|
+
}
|
|
2182
|
+
var EMPTY_MAP;
|
|
2183
|
+
function emptyMap() {
|
|
2184
|
+
return EMPTY_MAP || (EMPTY_MAP = makeMap(0));
|
|
2185
|
+
}
|
|
2186
|
+
function updateMap(map2, k, v) {
|
|
2187
|
+
var newRoot;
|
|
2188
|
+
var newSize;
|
|
2189
|
+
if (!map2._root) {
|
|
2190
|
+
if (v === NOT_SET) {
|
|
2191
|
+
return map2;
|
|
2192
|
+
}
|
|
2193
|
+
newSize = 1;
|
|
2194
|
+
newRoot = new ArrayMapNode(map2.__ownerID, [[k, v]]);
|
|
2195
|
+
} else {
|
|
2196
|
+
var didChangeSize = MakeRef();
|
|
2197
|
+
var didAlter = MakeRef();
|
|
2198
|
+
newRoot = updateNode(map2._root, map2.__ownerID, 0, void 0, k, v, didChangeSize, didAlter);
|
|
2199
|
+
if (!didAlter.value) {
|
|
2200
|
+
return map2;
|
|
2201
|
+
}
|
|
2202
|
+
newSize = map2.size + (didChangeSize.value ? v === NOT_SET ? -1 : 1 : 0);
|
|
2203
|
+
}
|
|
2204
|
+
if (map2.__ownerID) {
|
|
2205
|
+
map2.size = newSize;
|
|
2206
|
+
map2._root = newRoot;
|
|
2207
|
+
map2.__hash = void 0;
|
|
2208
|
+
map2.__altered = true;
|
|
2209
|
+
return map2;
|
|
2210
|
+
}
|
|
2211
|
+
return newRoot ? makeMap(newSize, newRoot) : emptyMap();
|
|
2212
|
+
}
|
|
2213
|
+
function updateNode(node, ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
|
|
2214
|
+
if (!node) {
|
|
2215
|
+
if (value === NOT_SET) {
|
|
2216
|
+
return node;
|
|
2217
|
+
}
|
|
2218
|
+
SetRef(didAlter);
|
|
2219
|
+
SetRef(didChangeSize);
|
|
2220
|
+
return new ValueNode(ownerID, keyHash, [key, value]);
|
|
2221
|
+
}
|
|
2222
|
+
return node.update(ownerID, shift, keyHash, key, value, didChangeSize, didAlter);
|
|
2223
|
+
}
|
|
2224
|
+
function isLeafNode(node) {
|
|
2225
|
+
return node.constructor === ValueNode || node.constructor === HashCollisionNode;
|
|
2226
|
+
}
|
|
2227
|
+
function mergeIntoNode(node, ownerID, shift, keyHash, entry) {
|
|
2228
|
+
if (node.keyHash === keyHash) {
|
|
2229
|
+
return new HashCollisionNode(ownerID, keyHash, [node.entry, entry]);
|
|
2230
|
+
}
|
|
2231
|
+
var idx1 = (shift === 0 ? node.keyHash : node.keyHash >>> shift) & MASK;
|
|
2232
|
+
var idx2 = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;
|
|
2233
|
+
var newNode;
|
|
2234
|
+
var nodes = idx1 === idx2 ? [mergeIntoNode(node, ownerID, shift + SHIFT, keyHash, entry)] : (newNode = new ValueNode(ownerID, keyHash, entry), idx1 < idx2 ? [node, newNode] : [newNode, node]);
|
|
2235
|
+
return new BitmapIndexedNode(ownerID, 1 << idx1 | 1 << idx2, nodes);
|
|
2236
|
+
}
|
|
2237
|
+
function createNodes(ownerID, entries2, key, value) {
|
|
2238
|
+
if (!ownerID) {
|
|
2239
|
+
ownerID = new OwnerID();
|
|
2240
|
+
}
|
|
2241
|
+
var node = new ValueNode(ownerID, hash(key), [key, value]);
|
|
2242
|
+
for (var ii = 0; ii < entries2.length; ii++) {
|
|
2243
|
+
var entry = entries2[ii];
|
|
2244
|
+
node = node.update(ownerID, 0, void 0, entry[0], entry[1]);
|
|
2245
|
+
}
|
|
2246
|
+
return node;
|
|
2247
|
+
}
|
|
2248
|
+
function packNodes(ownerID, nodes, count2, excluding) {
|
|
2249
|
+
var bitmap = 0;
|
|
2250
|
+
var packedII = 0;
|
|
2251
|
+
var packedNodes = new Array(count2);
|
|
2252
|
+
for (var ii = 0, bit = 1, len = nodes.length; ii < len; ii++, bit <<= 1) {
|
|
2253
|
+
var node = nodes[ii];
|
|
2254
|
+
if (node !== void 0 && ii !== excluding) {
|
|
2255
|
+
bitmap |= bit;
|
|
2256
|
+
packedNodes[packedII++] = node;
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
return new BitmapIndexedNode(ownerID, bitmap, packedNodes);
|
|
2260
|
+
}
|
|
2261
|
+
function expandNodes(ownerID, nodes, bitmap, including, node) {
|
|
2262
|
+
var count2 = 0;
|
|
2263
|
+
var expandedNodes = new Array(SIZE);
|
|
2264
|
+
for (var ii = 0; bitmap !== 0; ii++, bitmap >>>= 1) {
|
|
2265
|
+
expandedNodes[ii] = bitmap & 1 ? nodes[count2++] : void 0;
|
|
2266
|
+
}
|
|
2267
|
+
expandedNodes[including] = node;
|
|
2268
|
+
return new HashArrayMapNode(ownerID, count2 + 1, expandedNodes);
|
|
2269
|
+
}
|
|
2270
|
+
function popCount(x) {
|
|
2271
|
+
x -= x >> 1 & 1431655765;
|
|
2272
|
+
x = (x & 858993459) + (x >> 2 & 858993459);
|
|
2273
|
+
x = x + (x >> 4) & 252645135;
|
|
2274
|
+
x += x >> 8;
|
|
2275
|
+
x += x >> 16;
|
|
2276
|
+
return x & 127;
|
|
2277
|
+
}
|
|
2278
|
+
function setAt(array, idx, val, canEdit) {
|
|
2279
|
+
var newArray = canEdit ? array : arrCopy(array);
|
|
2280
|
+
newArray[idx] = val;
|
|
2281
|
+
return newArray;
|
|
2282
|
+
}
|
|
2283
|
+
function spliceIn(array, idx, val, canEdit) {
|
|
2284
|
+
var newLen = array.length + 1;
|
|
2285
|
+
if (canEdit && idx + 1 === newLen) {
|
|
2286
|
+
array[idx] = val;
|
|
2287
|
+
return array;
|
|
2288
|
+
}
|
|
2289
|
+
var newArray = new Array(newLen);
|
|
2290
|
+
var after = 0;
|
|
2291
|
+
for (var ii = 0; ii < newLen; ii++) {
|
|
2292
|
+
if (ii === idx) {
|
|
2293
|
+
newArray[ii] = val;
|
|
2294
|
+
after = -1;
|
|
2295
|
+
} else {
|
|
2296
|
+
newArray[ii] = array[ii + after];
|
|
2297
|
+
}
|
|
2298
|
+
}
|
|
2299
|
+
return newArray;
|
|
2300
|
+
}
|
|
2301
|
+
function spliceOut(array, idx, canEdit) {
|
|
2302
|
+
var newLen = array.length - 1;
|
|
2303
|
+
if (canEdit && idx === newLen) {
|
|
2304
|
+
array.pop();
|
|
2305
|
+
return array;
|
|
2306
|
+
}
|
|
2307
|
+
var newArray = new Array(newLen);
|
|
2308
|
+
var after = 0;
|
|
2309
|
+
for (var ii = 0; ii < newLen; ii++) {
|
|
2310
|
+
if (ii === idx) {
|
|
2311
|
+
after = 1;
|
|
2312
|
+
}
|
|
2313
|
+
newArray[ii] = array[ii + after];
|
|
2314
|
+
}
|
|
2315
|
+
return newArray;
|
|
2316
|
+
}
|
|
2317
|
+
var MAX_ARRAY_MAP_SIZE = SIZE / 4;
|
|
2318
|
+
var MAX_BITMAP_INDEXED_SIZE = SIZE / 2;
|
|
2319
|
+
var MIN_HASH_ARRAY_MAP_SIZE = SIZE / 4;
|
|
2320
|
+
var IS_LIST_SYMBOL = "@@__IMMUTABLE_LIST__@@";
|
|
2321
|
+
function isList(maybeList) {
|
|
2322
|
+
return Boolean(maybeList && maybeList[IS_LIST_SYMBOL]);
|
|
2323
|
+
}
|
|
2324
|
+
var List = /* @__PURE__ */ function(IndexedCollection2) {
|
|
2325
|
+
function List2(value) {
|
|
2326
|
+
var empty = emptyList();
|
|
2327
|
+
if (value === null || value === void 0) {
|
|
2328
|
+
return empty;
|
|
2329
|
+
}
|
|
2330
|
+
if (isList(value)) {
|
|
2331
|
+
return value;
|
|
2332
|
+
}
|
|
2333
|
+
var iter = IndexedCollection2(value);
|
|
2334
|
+
var size = iter.size;
|
|
2335
|
+
if (size === 0) {
|
|
2336
|
+
return empty;
|
|
2337
|
+
}
|
|
2338
|
+
assertNotInfinite(size);
|
|
2339
|
+
if (size > 0 && size < SIZE) {
|
|
2340
|
+
return makeList(0, size, SHIFT, null, new VNode(iter.toArray()));
|
|
2341
|
+
}
|
|
2342
|
+
return empty.withMutations(function(list) {
|
|
2343
|
+
list.setSize(size);
|
|
2344
|
+
iter.forEach(function(v, i) {
|
|
2345
|
+
return list.set(i, v);
|
|
2346
|
+
});
|
|
2347
|
+
});
|
|
2348
|
+
}
|
|
2349
|
+
if (IndexedCollection2)
|
|
2350
|
+
List2.__proto__ = IndexedCollection2;
|
|
2351
|
+
List2.prototype = Object.create(IndexedCollection2 && IndexedCollection2.prototype);
|
|
2352
|
+
List2.prototype.constructor = List2;
|
|
2353
|
+
List2.of = function of() {
|
|
2354
|
+
return this(arguments);
|
|
2355
|
+
};
|
|
2356
|
+
List2.prototype.toString = function toString4() {
|
|
2357
|
+
return this.__toString("List [", "]");
|
|
2358
|
+
};
|
|
2359
|
+
List2.prototype.get = function get10(index, notSetValue) {
|
|
2360
|
+
index = wrapIndex(this, index);
|
|
2361
|
+
if (index >= 0 && index < this.size) {
|
|
2362
|
+
index += this._origin;
|
|
2363
|
+
var node = listNodeFor(this, index);
|
|
2364
|
+
return node && node.array[index & MASK];
|
|
2365
|
+
}
|
|
2366
|
+
return notSetValue;
|
|
2367
|
+
};
|
|
2368
|
+
List2.prototype.set = function set2(index, value) {
|
|
2369
|
+
return updateList(this, index, value);
|
|
2370
|
+
};
|
|
2371
|
+
List2.prototype.remove = function remove2(index) {
|
|
2372
|
+
return !this.has(index) ? this : index === 0 ? this.shift() : index === this.size - 1 ? this.pop() : this.splice(index, 1);
|
|
2373
|
+
};
|
|
2374
|
+
List2.prototype.insert = function insert(index, value) {
|
|
2375
|
+
return this.splice(index, 0, value);
|
|
2376
|
+
};
|
|
2377
|
+
List2.prototype.clear = function clear() {
|
|
2378
|
+
if (this.size === 0) {
|
|
2379
|
+
return this;
|
|
2380
|
+
}
|
|
2381
|
+
if (this.__ownerID) {
|
|
2382
|
+
this.size = this._origin = this._capacity = 0;
|
|
2383
|
+
this._level = SHIFT;
|
|
2384
|
+
this._root = this._tail = this.__hash = void 0;
|
|
2385
|
+
this.__altered = true;
|
|
2386
|
+
return this;
|
|
2387
|
+
}
|
|
2388
|
+
return emptyList();
|
|
2389
|
+
};
|
|
2390
|
+
List2.prototype.push = function push() {
|
|
2391
|
+
var values2 = arguments;
|
|
2392
|
+
var oldSize = this.size;
|
|
2393
|
+
return this.withMutations(function(list) {
|
|
2394
|
+
setListBounds(list, 0, oldSize + values2.length);
|
|
2395
|
+
for (var ii = 0; ii < values2.length; ii++) {
|
|
2396
|
+
list.set(oldSize + ii, values2[ii]);
|
|
2397
|
+
}
|
|
2398
|
+
});
|
|
2399
|
+
};
|
|
2400
|
+
List2.prototype.pop = function pop() {
|
|
2401
|
+
return setListBounds(this, 0, -1);
|
|
2402
|
+
};
|
|
2403
|
+
List2.prototype.unshift = function unshift() {
|
|
2404
|
+
var values2 = arguments;
|
|
2405
|
+
return this.withMutations(function(list) {
|
|
2406
|
+
setListBounds(list, -values2.length);
|
|
2407
|
+
for (var ii = 0; ii < values2.length; ii++) {
|
|
2408
|
+
list.set(ii, values2[ii]);
|
|
2409
|
+
}
|
|
2410
|
+
});
|
|
2411
|
+
};
|
|
2412
|
+
List2.prototype.shift = function shift() {
|
|
2413
|
+
return setListBounds(this, 1);
|
|
2414
|
+
};
|
|
2415
|
+
List2.prototype.concat = function concat2() {
|
|
2416
|
+
var arguments$1 = arguments;
|
|
2417
|
+
var seqs = [];
|
|
2418
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
2419
|
+
var argument = arguments$1[i];
|
|
2420
|
+
var seq = IndexedCollection2(typeof argument !== "string" && hasIterator(argument) ? argument : [argument]);
|
|
2421
|
+
if (seq.size !== 0) {
|
|
2422
|
+
seqs.push(seq);
|
|
2423
|
+
}
|
|
2424
|
+
}
|
|
2425
|
+
if (seqs.length === 0) {
|
|
2426
|
+
return this;
|
|
2427
|
+
}
|
|
2428
|
+
if (this.size === 0 && !this.__ownerID && seqs.length === 1) {
|
|
2429
|
+
return this.constructor(seqs[0]);
|
|
2430
|
+
}
|
|
2431
|
+
return this.withMutations(function(list) {
|
|
2432
|
+
seqs.forEach(function(seq2) {
|
|
2433
|
+
return seq2.forEach(function(value) {
|
|
2434
|
+
return list.push(value);
|
|
2435
|
+
});
|
|
2436
|
+
});
|
|
2437
|
+
});
|
|
2438
|
+
};
|
|
2439
|
+
List2.prototype.setSize = function setSize(size) {
|
|
2440
|
+
return setListBounds(this, 0, size);
|
|
2441
|
+
};
|
|
2442
|
+
List2.prototype.map = function map2(mapper, context) {
|
|
2443
|
+
var this$1$1 = this;
|
|
2444
|
+
return this.withMutations(function(list) {
|
|
2445
|
+
for (var i = 0; i < this$1$1.size; i++) {
|
|
2446
|
+
list.set(i, mapper.call(context, list.get(i), i, this$1$1));
|
|
2447
|
+
}
|
|
2448
|
+
});
|
|
2449
|
+
};
|
|
2450
|
+
List2.prototype.slice = function slice3(begin, end) {
|
|
2451
|
+
var size = this.size;
|
|
2452
|
+
if (wholeSlice(begin, end, size)) {
|
|
2453
|
+
return this;
|
|
2454
|
+
}
|
|
2455
|
+
return setListBounds(this, resolveBegin(begin, size), resolveEnd(end, size));
|
|
2456
|
+
};
|
|
2457
|
+
List2.prototype.__iterator = function __iterator(type, reverse3) {
|
|
2458
|
+
var index = reverse3 ? this.size : 0;
|
|
2459
|
+
var values2 = iterateList(this, reverse3);
|
|
2460
|
+
return new Iterator(function() {
|
|
2461
|
+
var value = values2();
|
|
2462
|
+
return value === DONE ? iteratorDone() : iteratorValue(type, reverse3 ? --index : index++, value);
|
|
2463
|
+
});
|
|
2464
|
+
};
|
|
2465
|
+
List2.prototype.__iterate = function __iterate(fn, reverse3) {
|
|
2466
|
+
var index = reverse3 ? this.size : 0;
|
|
2467
|
+
var values2 = iterateList(this, reverse3);
|
|
2468
|
+
var value;
|
|
2469
|
+
while ((value = values2()) !== DONE) {
|
|
2470
|
+
if (fn(value, reverse3 ? --index : index++, this) === false) {
|
|
2471
|
+
break;
|
|
2472
|
+
}
|
|
2473
|
+
}
|
|
2474
|
+
return index;
|
|
2475
|
+
};
|
|
2476
|
+
List2.prototype.__ensureOwner = function __ensureOwner(ownerID) {
|
|
2477
|
+
if (ownerID === this.__ownerID) {
|
|
2478
|
+
return this;
|
|
2479
|
+
}
|
|
2480
|
+
if (!ownerID) {
|
|
2481
|
+
if (this.size === 0) {
|
|
2482
|
+
return emptyList();
|
|
2483
|
+
}
|
|
2484
|
+
this.__ownerID = ownerID;
|
|
2485
|
+
this.__altered = false;
|
|
2486
|
+
return this;
|
|
2487
|
+
}
|
|
2488
|
+
return makeList(this._origin, this._capacity, this._level, this._root, this._tail, ownerID, this.__hash);
|
|
2489
|
+
};
|
|
2490
|
+
return List2;
|
|
2491
|
+
}(IndexedCollection);
|
|
2492
|
+
List.isList = isList;
|
|
2493
|
+
var ListPrototype = List.prototype;
|
|
2494
|
+
ListPrototype[IS_LIST_SYMBOL] = true;
|
|
2495
|
+
ListPrototype[DELETE] = ListPrototype.remove;
|
|
2496
|
+
ListPrototype.merge = ListPrototype.concat;
|
|
2497
|
+
ListPrototype.setIn = setIn;
|
|
2498
|
+
ListPrototype.deleteIn = ListPrototype.removeIn = deleteIn;
|
|
2499
|
+
ListPrototype.update = update;
|
|
2500
|
+
ListPrototype.updateIn = updateIn;
|
|
2501
|
+
ListPrototype.mergeIn = mergeIn;
|
|
2502
|
+
ListPrototype.mergeDeepIn = mergeDeepIn;
|
|
2503
|
+
ListPrototype.withMutations = withMutations;
|
|
2504
|
+
ListPrototype.wasAltered = wasAltered;
|
|
2505
|
+
ListPrototype.asImmutable = asImmutable;
|
|
2506
|
+
ListPrototype["@@transducer/init"] = ListPrototype.asMutable = asMutable;
|
|
2507
|
+
ListPrototype["@@transducer/step"] = function(result, arr) {
|
|
2508
|
+
return result.push(arr);
|
|
2509
|
+
};
|
|
2510
|
+
ListPrototype["@@transducer/result"] = function(obj) {
|
|
2511
|
+
return obj.asImmutable();
|
|
2512
|
+
};
|
|
2513
|
+
var VNode = function VNode2(array, ownerID) {
|
|
2514
|
+
this.array = array;
|
|
2515
|
+
this.ownerID = ownerID;
|
|
2516
|
+
};
|
|
2517
|
+
VNode.prototype.removeBefore = function removeBefore(ownerID, level, index) {
|
|
2518
|
+
if (index === level ? 1 << level : this.array.length === 0) {
|
|
2519
|
+
return this;
|
|
2520
|
+
}
|
|
2521
|
+
var originIndex = index >>> level & MASK;
|
|
2522
|
+
if (originIndex >= this.array.length) {
|
|
2523
|
+
return new VNode([], ownerID);
|
|
2524
|
+
}
|
|
2525
|
+
var removingFirst = originIndex === 0;
|
|
2526
|
+
var newChild;
|
|
2527
|
+
if (level > 0) {
|
|
2528
|
+
var oldChild = this.array[originIndex];
|
|
2529
|
+
newChild = oldChild && oldChild.removeBefore(ownerID, level - SHIFT, index);
|
|
2530
|
+
if (newChild === oldChild && removingFirst) {
|
|
2531
|
+
return this;
|
|
2532
|
+
}
|
|
2533
|
+
}
|
|
2534
|
+
if (removingFirst && !newChild) {
|
|
2535
|
+
return this;
|
|
2536
|
+
}
|
|
2537
|
+
var editable = editableVNode(this, ownerID);
|
|
2538
|
+
if (!removingFirst) {
|
|
2539
|
+
for (var ii = 0; ii < originIndex; ii++) {
|
|
2540
|
+
editable.array[ii] = void 0;
|
|
2541
|
+
}
|
|
2542
|
+
}
|
|
2543
|
+
if (newChild) {
|
|
2544
|
+
editable.array[originIndex] = newChild;
|
|
2545
|
+
}
|
|
2546
|
+
return editable;
|
|
2547
|
+
};
|
|
2548
|
+
VNode.prototype.removeAfter = function removeAfter(ownerID, level, index) {
|
|
2549
|
+
if (index === (level ? 1 << level : 0) || this.array.length === 0) {
|
|
2550
|
+
return this;
|
|
2551
|
+
}
|
|
2552
|
+
var sizeIndex = index - 1 >>> level & MASK;
|
|
2553
|
+
if (sizeIndex >= this.array.length) {
|
|
2554
|
+
return this;
|
|
2555
|
+
}
|
|
2556
|
+
var newChild;
|
|
2557
|
+
if (level > 0) {
|
|
2558
|
+
var oldChild = this.array[sizeIndex];
|
|
2559
|
+
newChild = oldChild && oldChild.removeAfter(ownerID, level - SHIFT, index);
|
|
2560
|
+
if (newChild === oldChild && sizeIndex === this.array.length - 1) {
|
|
2561
|
+
return this;
|
|
2562
|
+
}
|
|
2563
|
+
}
|
|
2564
|
+
var editable = editableVNode(this, ownerID);
|
|
2565
|
+
editable.array.splice(sizeIndex + 1);
|
|
2566
|
+
if (newChild) {
|
|
2567
|
+
editable.array[sizeIndex] = newChild;
|
|
2568
|
+
}
|
|
2569
|
+
return editable;
|
|
2570
|
+
};
|
|
2571
|
+
var DONE = {};
|
|
2572
|
+
function iterateList(list, reverse3) {
|
|
2573
|
+
var left = list._origin;
|
|
2574
|
+
var right = list._capacity;
|
|
2575
|
+
var tailPos = getTailOffset(right);
|
|
2576
|
+
var tail = list._tail;
|
|
2577
|
+
return iterateNodeOrLeaf(list._root, list._level, 0);
|
|
2578
|
+
function iterateNodeOrLeaf(node, level, offset) {
|
|
2579
|
+
return level === 0 ? iterateLeaf(node, offset) : iterateNode(node, level, offset);
|
|
2580
|
+
}
|
|
2581
|
+
function iterateLeaf(node, offset) {
|
|
2582
|
+
var array = offset === tailPos ? tail && tail.array : node && node.array;
|
|
2583
|
+
var from = offset > left ? 0 : left - offset;
|
|
2584
|
+
var to = right - offset;
|
|
2585
|
+
if (to > SIZE) {
|
|
2586
|
+
to = SIZE;
|
|
2587
|
+
}
|
|
2588
|
+
return function() {
|
|
2589
|
+
if (from === to) {
|
|
2590
|
+
return DONE;
|
|
2591
|
+
}
|
|
2592
|
+
var idx = reverse3 ? --to : from++;
|
|
2593
|
+
return array && array[idx];
|
|
2594
|
+
};
|
|
2595
|
+
}
|
|
2596
|
+
function iterateNode(node, level, offset) {
|
|
2597
|
+
var values2;
|
|
2598
|
+
var array = node && node.array;
|
|
2599
|
+
var from = offset > left ? 0 : left - offset >> level;
|
|
2600
|
+
var to = (right - offset >> level) + 1;
|
|
2601
|
+
if (to > SIZE) {
|
|
2602
|
+
to = SIZE;
|
|
2603
|
+
}
|
|
2604
|
+
return function() {
|
|
2605
|
+
while (true) {
|
|
2606
|
+
if (values2) {
|
|
2607
|
+
var value = values2();
|
|
2608
|
+
if (value !== DONE) {
|
|
2609
|
+
return value;
|
|
2610
|
+
}
|
|
2611
|
+
values2 = null;
|
|
2612
|
+
}
|
|
2613
|
+
if (from === to) {
|
|
2614
|
+
return DONE;
|
|
2615
|
+
}
|
|
2616
|
+
var idx = reverse3 ? --to : from++;
|
|
2617
|
+
values2 = iterateNodeOrLeaf(array && array[idx], level - SHIFT, offset + (idx << level));
|
|
2618
|
+
}
|
|
2619
|
+
};
|
|
2620
|
+
}
|
|
2621
|
+
}
|
|
2622
|
+
function makeList(origin, capacity, level, root, tail, ownerID, hash2) {
|
|
2623
|
+
var list = Object.create(ListPrototype);
|
|
2624
|
+
list.size = capacity - origin;
|
|
2625
|
+
list._origin = origin;
|
|
2626
|
+
list._capacity = capacity;
|
|
2627
|
+
list._level = level;
|
|
2628
|
+
list._root = root;
|
|
2629
|
+
list._tail = tail;
|
|
2630
|
+
list.__ownerID = ownerID;
|
|
2631
|
+
list.__hash = hash2;
|
|
2632
|
+
list.__altered = false;
|
|
2633
|
+
return list;
|
|
2634
|
+
}
|
|
2635
|
+
var EMPTY_LIST;
|
|
2636
|
+
function emptyList() {
|
|
2637
|
+
return EMPTY_LIST || (EMPTY_LIST = makeList(0, 0, SHIFT));
|
|
2638
|
+
}
|
|
2639
|
+
function updateList(list, index, value) {
|
|
2640
|
+
index = wrapIndex(list, index);
|
|
2641
|
+
if (index !== index) {
|
|
2642
|
+
return list;
|
|
2643
|
+
}
|
|
2644
|
+
if (index >= list.size || index < 0) {
|
|
2645
|
+
return list.withMutations(function(list2) {
|
|
2646
|
+
index < 0 ? setListBounds(list2, index).set(0, value) : setListBounds(list2, 0, index + 1).set(index, value);
|
|
2647
|
+
});
|
|
2648
|
+
}
|
|
2649
|
+
index += list._origin;
|
|
2650
|
+
var newTail = list._tail;
|
|
2651
|
+
var newRoot = list._root;
|
|
2652
|
+
var didAlter = MakeRef();
|
|
2653
|
+
if (index >= getTailOffset(list._capacity)) {
|
|
2654
|
+
newTail = updateVNode(newTail, list.__ownerID, 0, index, value, didAlter);
|
|
2655
|
+
} else {
|
|
2656
|
+
newRoot = updateVNode(newRoot, list.__ownerID, list._level, index, value, didAlter);
|
|
2657
|
+
}
|
|
2658
|
+
if (!didAlter.value) {
|
|
2659
|
+
return list;
|
|
2660
|
+
}
|
|
2661
|
+
if (list.__ownerID) {
|
|
2662
|
+
list._root = newRoot;
|
|
2663
|
+
list._tail = newTail;
|
|
2664
|
+
list.__hash = void 0;
|
|
2665
|
+
list.__altered = true;
|
|
2666
|
+
return list;
|
|
2667
|
+
}
|
|
2668
|
+
return makeList(list._origin, list._capacity, list._level, newRoot, newTail);
|
|
2669
|
+
}
|
|
2670
|
+
function updateVNode(node, ownerID, level, index, value, didAlter) {
|
|
2671
|
+
var idx = index >>> level & MASK;
|
|
2672
|
+
var nodeHas = node && idx < node.array.length;
|
|
2673
|
+
if (!nodeHas && value === void 0) {
|
|
2674
|
+
return node;
|
|
2675
|
+
}
|
|
2676
|
+
var newNode;
|
|
2677
|
+
if (level > 0) {
|
|
2678
|
+
var lowerNode = node && node.array[idx];
|
|
2679
|
+
var newLowerNode = updateVNode(lowerNode, ownerID, level - SHIFT, index, value, didAlter);
|
|
2680
|
+
if (newLowerNode === lowerNode) {
|
|
2681
|
+
return node;
|
|
2682
|
+
}
|
|
2683
|
+
newNode = editableVNode(node, ownerID);
|
|
2684
|
+
newNode.array[idx] = newLowerNode;
|
|
2685
|
+
return newNode;
|
|
2686
|
+
}
|
|
2687
|
+
if (nodeHas && node.array[idx] === value) {
|
|
2688
|
+
return node;
|
|
2689
|
+
}
|
|
2690
|
+
if (didAlter) {
|
|
2691
|
+
SetRef(didAlter);
|
|
2692
|
+
}
|
|
2693
|
+
newNode = editableVNode(node, ownerID);
|
|
2694
|
+
if (value === void 0 && idx === newNode.array.length - 1) {
|
|
2695
|
+
newNode.array.pop();
|
|
2696
|
+
} else {
|
|
2697
|
+
newNode.array[idx] = value;
|
|
2698
|
+
}
|
|
2699
|
+
return newNode;
|
|
2700
|
+
}
|
|
2701
|
+
function editableVNode(node, ownerID) {
|
|
2702
|
+
if (ownerID && node && ownerID === node.ownerID) {
|
|
2703
|
+
return node;
|
|
2704
|
+
}
|
|
2705
|
+
return new VNode(node ? node.array.slice() : [], ownerID);
|
|
2706
|
+
}
|
|
2707
|
+
function listNodeFor(list, rawIndex) {
|
|
2708
|
+
if (rawIndex >= getTailOffset(list._capacity)) {
|
|
2709
|
+
return list._tail;
|
|
2710
|
+
}
|
|
2711
|
+
if (rawIndex < 1 << list._level + SHIFT) {
|
|
2712
|
+
var node = list._root;
|
|
2713
|
+
var level = list._level;
|
|
2714
|
+
while (node && level > 0) {
|
|
2715
|
+
node = node.array[rawIndex >>> level & MASK];
|
|
2716
|
+
level -= SHIFT;
|
|
2717
|
+
}
|
|
2718
|
+
return node;
|
|
2719
|
+
}
|
|
2720
|
+
}
|
|
2721
|
+
function setListBounds(list, begin, end) {
|
|
2722
|
+
if (begin !== void 0) {
|
|
2723
|
+
begin |= 0;
|
|
2724
|
+
}
|
|
2725
|
+
if (end !== void 0) {
|
|
2726
|
+
end |= 0;
|
|
2727
|
+
}
|
|
2728
|
+
var owner = list.__ownerID || new OwnerID();
|
|
2729
|
+
var oldOrigin = list._origin;
|
|
2730
|
+
var oldCapacity = list._capacity;
|
|
2731
|
+
var newOrigin = oldOrigin + begin;
|
|
2732
|
+
var newCapacity = end === void 0 ? oldCapacity : end < 0 ? oldCapacity + end : oldOrigin + end;
|
|
2733
|
+
if (newOrigin === oldOrigin && newCapacity === oldCapacity) {
|
|
2734
|
+
return list;
|
|
2735
|
+
}
|
|
2736
|
+
if (newOrigin >= newCapacity) {
|
|
2737
|
+
return list.clear();
|
|
2738
|
+
}
|
|
2739
|
+
var newLevel = list._level;
|
|
2740
|
+
var newRoot = list._root;
|
|
2741
|
+
var offsetShift = 0;
|
|
2742
|
+
while (newOrigin + offsetShift < 0) {
|
|
2743
|
+
newRoot = new VNode(newRoot && newRoot.array.length ? [void 0, newRoot] : [], owner);
|
|
2744
|
+
newLevel += SHIFT;
|
|
2745
|
+
offsetShift += 1 << newLevel;
|
|
2746
|
+
}
|
|
2747
|
+
if (offsetShift) {
|
|
2748
|
+
newOrigin += offsetShift;
|
|
2749
|
+
oldOrigin += offsetShift;
|
|
2750
|
+
newCapacity += offsetShift;
|
|
2751
|
+
oldCapacity += offsetShift;
|
|
2752
|
+
}
|
|
2753
|
+
var oldTailOffset = getTailOffset(oldCapacity);
|
|
2754
|
+
var newTailOffset = getTailOffset(newCapacity);
|
|
2755
|
+
while (newTailOffset >= 1 << newLevel + SHIFT) {
|
|
2756
|
+
newRoot = new VNode(newRoot && newRoot.array.length ? [newRoot] : [], owner);
|
|
2757
|
+
newLevel += SHIFT;
|
|
2758
|
+
}
|
|
2759
|
+
var oldTail = list._tail;
|
|
2760
|
+
var newTail = newTailOffset < oldTailOffset ? listNodeFor(list, newCapacity - 1) : newTailOffset > oldTailOffset ? new VNode([], owner) : oldTail;
|
|
2761
|
+
if (oldTail && newTailOffset > oldTailOffset && newOrigin < oldCapacity && oldTail.array.length) {
|
|
2762
|
+
newRoot = editableVNode(newRoot, owner);
|
|
2763
|
+
var node = newRoot;
|
|
2764
|
+
for (var level = newLevel; level > SHIFT; level -= SHIFT) {
|
|
2765
|
+
var idx = oldTailOffset >>> level & MASK;
|
|
2766
|
+
node = node.array[idx] = editableVNode(node.array[idx], owner);
|
|
2767
|
+
}
|
|
2768
|
+
node.array[oldTailOffset >>> SHIFT & MASK] = oldTail;
|
|
2769
|
+
}
|
|
2770
|
+
if (newCapacity < oldCapacity) {
|
|
2771
|
+
newTail = newTail && newTail.removeAfter(owner, 0, newCapacity);
|
|
2772
|
+
}
|
|
2773
|
+
if (newOrigin >= newTailOffset) {
|
|
2774
|
+
newOrigin -= newTailOffset;
|
|
2775
|
+
newCapacity -= newTailOffset;
|
|
2776
|
+
newLevel = SHIFT;
|
|
2777
|
+
newRoot = null;
|
|
2778
|
+
newTail = newTail && newTail.removeBefore(owner, 0, newOrigin);
|
|
2779
|
+
} else if (newOrigin > oldOrigin || newTailOffset < oldTailOffset) {
|
|
2780
|
+
offsetShift = 0;
|
|
2781
|
+
while (newRoot) {
|
|
2782
|
+
var beginIndex = newOrigin >>> newLevel & MASK;
|
|
2783
|
+
if (beginIndex !== newTailOffset >>> newLevel & MASK) {
|
|
2784
|
+
break;
|
|
2785
|
+
}
|
|
2786
|
+
if (beginIndex) {
|
|
2787
|
+
offsetShift += (1 << newLevel) * beginIndex;
|
|
2788
|
+
}
|
|
2789
|
+
newLevel -= SHIFT;
|
|
2790
|
+
newRoot = newRoot.array[beginIndex];
|
|
2791
|
+
}
|
|
2792
|
+
if (newRoot && newOrigin > oldOrigin) {
|
|
2793
|
+
newRoot = newRoot.removeBefore(owner, newLevel, newOrigin - offsetShift);
|
|
2794
|
+
}
|
|
2795
|
+
if (newRoot && newTailOffset < oldTailOffset) {
|
|
2796
|
+
newRoot = newRoot.removeAfter(owner, newLevel, newTailOffset - offsetShift);
|
|
2797
|
+
}
|
|
2798
|
+
if (offsetShift) {
|
|
2799
|
+
newOrigin -= offsetShift;
|
|
2800
|
+
newCapacity -= offsetShift;
|
|
2801
|
+
}
|
|
2802
|
+
}
|
|
2803
|
+
if (list.__ownerID) {
|
|
2804
|
+
list.size = newCapacity - newOrigin;
|
|
2805
|
+
list._origin = newOrigin;
|
|
2806
|
+
list._capacity = newCapacity;
|
|
2807
|
+
list._level = newLevel;
|
|
2808
|
+
list._root = newRoot;
|
|
2809
|
+
list._tail = newTail;
|
|
2810
|
+
list.__hash = void 0;
|
|
2811
|
+
list.__altered = true;
|
|
2812
|
+
return list;
|
|
2813
|
+
}
|
|
2814
|
+
return makeList(newOrigin, newCapacity, newLevel, newRoot, newTail);
|
|
2815
|
+
}
|
|
2816
|
+
function getTailOffset(size) {
|
|
2817
|
+
return size < SIZE ? 0 : size - 1 >>> SHIFT << SHIFT;
|
|
2818
|
+
}
|
|
2819
|
+
var OrderedMap = /* @__PURE__ */ function(Map2) {
|
|
2820
|
+
function OrderedMap2(value) {
|
|
2821
|
+
return value === null || value === void 0 ? emptyOrderedMap() : isOrderedMap(value) ? value : emptyOrderedMap().withMutations(function(map2) {
|
|
2822
|
+
var iter = KeyedCollection(value);
|
|
2823
|
+
assertNotInfinite(iter.size);
|
|
2824
|
+
iter.forEach(function(v, k) {
|
|
2825
|
+
return map2.set(k, v);
|
|
2826
|
+
});
|
|
2827
|
+
});
|
|
2828
|
+
}
|
|
2829
|
+
if (Map2)
|
|
2830
|
+
OrderedMap2.__proto__ = Map2;
|
|
2831
|
+
OrderedMap2.prototype = Object.create(Map2 && Map2.prototype);
|
|
2832
|
+
OrderedMap2.prototype.constructor = OrderedMap2;
|
|
2833
|
+
OrderedMap2.of = function of() {
|
|
2834
|
+
return this(arguments);
|
|
2835
|
+
};
|
|
2836
|
+
OrderedMap2.prototype.toString = function toString4() {
|
|
2837
|
+
return this.__toString("OrderedMap {", "}");
|
|
2838
|
+
};
|
|
2839
|
+
OrderedMap2.prototype.get = function get10(k, notSetValue) {
|
|
2840
|
+
var index = this._map.get(k);
|
|
2841
|
+
return index !== void 0 ? this._list.get(index)[1] : notSetValue;
|
|
2842
|
+
};
|
|
2843
|
+
OrderedMap2.prototype.clear = function clear() {
|
|
2844
|
+
if (this.size === 0) {
|
|
2845
|
+
return this;
|
|
2846
|
+
}
|
|
2847
|
+
if (this.__ownerID) {
|
|
2848
|
+
this.size = 0;
|
|
2849
|
+
this._map.clear();
|
|
2850
|
+
this._list.clear();
|
|
2851
|
+
this.__altered = true;
|
|
2852
|
+
return this;
|
|
2853
|
+
}
|
|
2854
|
+
return emptyOrderedMap();
|
|
2855
|
+
};
|
|
2856
|
+
OrderedMap2.prototype.set = function set2(k, v) {
|
|
2857
|
+
return updateOrderedMap(this, k, v);
|
|
2858
|
+
};
|
|
2859
|
+
OrderedMap2.prototype.remove = function remove2(k) {
|
|
2860
|
+
return updateOrderedMap(this, k, NOT_SET);
|
|
2861
|
+
};
|
|
2862
|
+
OrderedMap2.prototype.__iterate = function __iterate(fn, reverse3) {
|
|
2863
|
+
var this$1$1 = this;
|
|
2864
|
+
return this._list.__iterate(function(entry) {
|
|
2865
|
+
return entry && fn(entry[1], entry[0], this$1$1);
|
|
2866
|
+
}, reverse3);
|
|
2867
|
+
};
|
|
2868
|
+
OrderedMap2.prototype.__iterator = function __iterator(type, reverse3) {
|
|
2869
|
+
return this._list.fromEntrySeq().__iterator(type, reverse3);
|
|
2870
|
+
};
|
|
2871
|
+
OrderedMap2.prototype.__ensureOwner = function __ensureOwner(ownerID) {
|
|
2872
|
+
if (ownerID === this.__ownerID) {
|
|
2873
|
+
return this;
|
|
2874
|
+
}
|
|
2875
|
+
var newMap = this._map.__ensureOwner(ownerID);
|
|
2876
|
+
var newList = this._list.__ensureOwner(ownerID);
|
|
2877
|
+
if (!ownerID) {
|
|
2878
|
+
if (this.size === 0) {
|
|
2879
|
+
return emptyOrderedMap();
|
|
2880
|
+
}
|
|
2881
|
+
this.__ownerID = ownerID;
|
|
2882
|
+
this.__altered = false;
|
|
2883
|
+
this._map = newMap;
|
|
2884
|
+
this._list = newList;
|
|
2885
|
+
return this;
|
|
2886
|
+
}
|
|
2887
|
+
return makeOrderedMap(newMap, newList, ownerID, this.__hash);
|
|
2888
|
+
};
|
|
2889
|
+
return OrderedMap2;
|
|
2890
|
+
}(Map$1);
|
|
2891
|
+
OrderedMap.isOrderedMap = isOrderedMap;
|
|
2892
|
+
OrderedMap.prototype[IS_ORDERED_SYMBOL] = true;
|
|
2893
|
+
OrderedMap.prototype[DELETE] = OrderedMap.prototype.remove;
|
|
2894
|
+
function makeOrderedMap(map2, list, ownerID, hash2) {
|
|
2895
|
+
var omap = Object.create(OrderedMap.prototype);
|
|
2896
|
+
omap.size = map2 ? map2.size : 0;
|
|
2897
|
+
omap._map = map2;
|
|
2898
|
+
omap._list = list;
|
|
2899
|
+
omap.__ownerID = ownerID;
|
|
2900
|
+
omap.__hash = hash2;
|
|
2901
|
+
omap.__altered = false;
|
|
2902
|
+
return omap;
|
|
2903
|
+
}
|
|
2904
|
+
var EMPTY_ORDERED_MAP;
|
|
2905
|
+
function emptyOrderedMap() {
|
|
2906
|
+
return EMPTY_ORDERED_MAP || (EMPTY_ORDERED_MAP = makeOrderedMap(emptyMap(), emptyList()));
|
|
2907
|
+
}
|
|
2908
|
+
function updateOrderedMap(omap, k, v) {
|
|
2909
|
+
var map2 = omap._map;
|
|
2910
|
+
var list = omap._list;
|
|
2911
|
+
var i = map2.get(k);
|
|
2912
|
+
var has4 = i !== void 0;
|
|
2913
|
+
var newMap;
|
|
2914
|
+
var newList;
|
|
2915
|
+
if (v === NOT_SET) {
|
|
2916
|
+
if (!has4) {
|
|
2917
|
+
return omap;
|
|
2918
|
+
}
|
|
2919
|
+
if (list.size >= SIZE && list.size >= map2.size * 2) {
|
|
2920
|
+
newList = list.filter(function(entry, idx) {
|
|
2921
|
+
return entry !== void 0 && i !== idx;
|
|
2922
|
+
});
|
|
2923
|
+
newMap = newList.toKeyedSeq().map(function(entry) {
|
|
2924
|
+
return entry[0];
|
|
2925
|
+
}).flip().toMap();
|
|
2926
|
+
if (omap.__ownerID) {
|
|
2927
|
+
newMap.__ownerID = newList.__ownerID = omap.__ownerID;
|
|
2928
|
+
}
|
|
2929
|
+
} else {
|
|
2930
|
+
newMap = map2.remove(k);
|
|
2931
|
+
newList = i === list.size - 1 ? list.pop() : list.set(i, void 0);
|
|
2932
|
+
}
|
|
2933
|
+
} else if (has4) {
|
|
2934
|
+
if (v === list.get(i)[1]) {
|
|
2935
|
+
return omap;
|
|
2936
|
+
}
|
|
2937
|
+
newMap = map2;
|
|
2938
|
+
newList = list.set(i, [k, v]);
|
|
2939
|
+
} else {
|
|
2940
|
+
newMap = map2.set(k, list.size);
|
|
2941
|
+
newList = list.set(list.size, [k, v]);
|
|
2942
|
+
}
|
|
2943
|
+
if (omap.__ownerID) {
|
|
2944
|
+
omap.size = newMap.size;
|
|
2945
|
+
omap._map = newMap;
|
|
2946
|
+
omap._list = newList;
|
|
2947
|
+
omap.__hash = void 0;
|
|
2948
|
+
omap.__altered = true;
|
|
2949
|
+
return omap;
|
|
2950
|
+
}
|
|
2951
|
+
return makeOrderedMap(newMap, newList);
|
|
2952
|
+
}
|
|
2953
|
+
var IS_STACK_SYMBOL = "@@__IMMUTABLE_STACK__@@";
|
|
2954
|
+
function isStack(maybeStack) {
|
|
2955
|
+
return Boolean(maybeStack && maybeStack[IS_STACK_SYMBOL]);
|
|
2956
|
+
}
|
|
2957
|
+
var Stack = /* @__PURE__ */ function(IndexedCollection2) {
|
|
2958
|
+
function Stack2(value) {
|
|
2959
|
+
return value === null || value === void 0 ? emptyStack() : isStack(value) ? value : emptyStack().pushAll(value);
|
|
2960
|
+
}
|
|
2961
|
+
if (IndexedCollection2)
|
|
2962
|
+
Stack2.__proto__ = IndexedCollection2;
|
|
2963
|
+
Stack2.prototype = Object.create(IndexedCollection2 && IndexedCollection2.prototype);
|
|
2964
|
+
Stack2.prototype.constructor = Stack2;
|
|
2965
|
+
Stack2.of = function of() {
|
|
2966
|
+
return this(arguments);
|
|
2967
|
+
};
|
|
2968
|
+
Stack2.prototype.toString = function toString4() {
|
|
2969
|
+
return this.__toString("Stack [", "]");
|
|
2970
|
+
};
|
|
2971
|
+
Stack2.prototype.get = function get10(index, notSetValue) {
|
|
2972
|
+
var head = this._head;
|
|
2973
|
+
index = wrapIndex(this, index);
|
|
2974
|
+
while (head && index--) {
|
|
2975
|
+
head = head.next;
|
|
2976
|
+
}
|
|
2977
|
+
return head ? head.value : notSetValue;
|
|
2978
|
+
};
|
|
2979
|
+
Stack2.prototype.peek = function peek() {
|
|
2980
|
+
return this._head && this._head.value;
|
|
2981
|
+
};
|
|
2982
|
+
Stack2.prototype.push = function push() {
|
|
2983
|
+
var arguments$1 = arguments;
|
|
2984
|
+
if (arguments.length === 0) {
|
|
2985
|
+
return this;
|
|
2986
|
+
}
|
|
2987
|
+
var newSize = this.size + arguments.length;
|
|
2988
|
+
var head = this._head;
|
|
2989
|
+
for (var ii = arguments.length - 1; ii >= 0; ii--) {
|
|
2990
|
+
head = {
|
|
2991
|
+
value: arguments$1[ii],
|
|
2992
|
+
next: head
|
|
2993
|
+
};
|
|
2994
|
+
}
|
|
2995
|
+
if (this.__ownerID) {
|
|
2996
|
+
this.size = newSize;
|
|
2997
|
+
this._head = head;
|
|
2998
|
+
this.__hash = void 0;
|
|
2999
|
+
this.__altered = true;
|
|
3000
|
+
return this;
|
|
3001
|
+
}
|
|
3002
|
+
return makeStack(newSize, head);
|
|
3003
|
+
};
|
|
3004
|
+
Stack2.prototype.pushAll = function pushAll(iter) {
|
|
3005
|
+
iter = IndexedCollection2(iter);
|
|
3006
|
+
if (iter.size === 0) {
|
|
3007
|
+
return this;
|
|
3008
|
+
}
|
|
3009
|
+
if (this.size === 0 && isStack(iter)) {
|
|
3010
|
+
return iter;
|
|
3011
|
+
}
|
|
3012
|
+
assertNotInfinite(iter.size);
|
|
3013
|
+
var newSize = this.size;
|
|
3014
|
+
var head = this._head;
|
|
3015
|
+
iter.__iterate(function(value) {
|
|
3016
|
+
newSize++;
|
|
3017
|
+
head = {
|
|
3018
|
+
value,
|
|
3019
|
+
next: head
|
|
3020
|
+
};
|
|
3021
|
+
}, true);
|
|
3022
|
+
if (this.__ownerID) {
|
|
3023
|
+
this.size = newSize;
|
|
3024
|
+
this._head = head;
|
|
3025
|
+
this.__hash = void 0;
|
|
3026
|
+
this.__altered = true;
|
|
3027
|
+
return this;
|
|
3028
|
+
}
|
|
3029
|
+
return makeStack(newSize, head);
|
|
3030
|
+
};
|
|
3031
|
+
Stack2.prototype.pop = function pop() {
|
|
3032
|
+
return this.slice(1);
|
|
3033
|
+
};
|
|
3034
|
+
Stack2.prototype.clear = function clear() {
|
|
3035
|
+
if (this.size === 0) {
|
|
3036
|
+
return this;
|
|
3037
|
+
}
|
|
3038
|
+
if (this.__ownerID) {
|
|
3039
|
+
this.size = 0;
|
|
3040
|
+
this._head = void 0;
|
|
3041
|
+
this.__hash = void 0;
|
|
3042
|
+
this.__altered = true;
|
|
3043
|
+
return this;
|
|
3044
|
+
}
|
|
3045
|
+
return emptyStack();
|
|
3046
|
+
};
|
|
3047
|
+
Stack2.prototype.slice = function slice3(begin, end) {
|
|
3048
|
+
if (wholeSlice(begin, end, this.size)) {
|
|
3049
|
+
return this;
|
|
3050
|
+
}
|
|
3051
|
+
var resolvedBegin = resolveBegin(begin, this.size);
|
|
3052
|
+
var resolvedEnd = resolveEnd(end, this.size);
|
|
3053
|
+
if (resolvedEnd !== this.size) {
|
|
3054
|
+
return IndexedCollection2.prototype.slice.call(this, begin, end);
|
|
3055
|
+
}
|
|
3056
|
+
var newSize = this.size - resolvedBegin;
|
|
3057
|
+
var head = this._head;
|
|
3058
|
+
while (resolvedBegin--) {
|
|
3059
|
+
head = head.next;
|
|
3060
|
+
}
|
|
3061
|
+
if (this.__ownerID) {
|
|
3062
|
+
this.size = newSize;
|
|
3063
|
+
this._head = head;
|
|
3064
|
+
this.__hash = void 0;
|
|
3065
|
+
this.__altered = true;
|
|
3066
|
+
return this;
|
|
3067
|
+
}
|
|
3068
|
+
return makeStack(newSize, head);
|
|
3069
|
+
};
|
|
3070
|
+
Stack2.prototype.__ensureOwner = function __ensureOwner(ownerID) {
|
|
3071
|
+
if (ownerID === this.__ownerID) {
|
|
3072
|
+
return this;
|
|
3073
|
+
}
|
|
3074
|
+
if (!ownerID) {
|
|
3075
|
+
if (this.size === 0) {
|
|
3076
|
+
return emptyStack();
|
|
3077
|
+
}
|
|
3078
|
+
this.__ownerID = ownerID;
|
|
3079
|
+
this.__altered = false;
|
|
3080
|
+
return this;
|
|
3081
|
+
}
|
|
3082
|
+
return makeStack(this.size, this._head, ownerID, this.__hash);
|
|
3083
|
+
};
|
|
3084
|
+
Stack2.prototype.__iterate = function __iterate(fn, reverse3) {
|
|
3085
|
+
var this$1$1 = this;
|
|
3086
|
+
if (reverse3) {
|
|
3087
|
+
return new ArraySeq(this.toArray()).__iterate(function(v, k) {
|
|
3088
|
+
return fn(v, k, this$1$1);
|
|
3089
|
+
}, reverse3);
|
|
3090
|
+
}
|
|
3091
|
+
var iterations = 0;
|
|
3092
|
+
var node = this._head;
|
|
3093
|
+
while (node) {
|
|
3094
|
+
if (fn(node.value, iterations++, this) === false) {
|
|
3095
|
+
break;
|
|
3096
|
+
}
|
|
3097
|
+
node = node.next;
|
|
3098
|
+
}
|
|
3099
|
+
return iterations;
|
|
3100
|
+
};
|
|
3101
|
+
Stack2.prototype.__iterator = function __iterator(type, reverse3) {
|
|
3102
|
+
if (reverse3) {
|
|
3103
|
+
return new ArraySeq(this.toArray()).__iterator(type, reverse3);
|
|
3104
|
+
}
|
|
3105
|
+
var iterations = 0;
|
|
3106
|
+
var node = this._head;
|
|
3107
|
+
return new Iterator(function() {
|
|
3108
|
+
if (node) {
|
|
3109
|
+
var value = node.value;
|
|
3110
|
+
node = node.next;
|
|
3111
|
+
return iteratorValue(type, iterations++, value);
|
|
3112
|
+
}
|
|
3113
|
+
return iteratorDone();
|
|
3114
|
+
});
|
|
3115
|
+
};
|
|
3116
|
+
return Stack2;
|
|
3117
|
+
}(IndexedCollection);
|
|
3118
|
+
Stack.isStack = isStack;
|
|
3119
|
+
var StackPrototype = Stack.prototype;
|
|
3120
|
+
StackPrototype[IS_STACK_SYMBOL] = true;
|
|
3121
|
+
StackPrototype.shift = StackPrototype.pop;
|
|
3122
|
+
StackPrototype.unshift = StackPrototype.push;
|
|
3123
|
+
StackPrototype.unshiftAll = StackPrototype.pushAll;
|
|
3124
|
+
StackPrototype.withMutations = withMutations;
|
|
3125
|
+
StackPrototype.wasAltered = wasAltered;
|
|
3126
|
+
StackPrototype.asImmutable = asImmutable;
|
|
3127
|
+
StackPrototype["@@transducer/init"] = StackPrototype.asMutable = asMutable;
|
|
3128
|
+
StackPrototype["@@transducer/step"] = function(result, arr) {
|
|
3129
|
+
return result.unshift(arr);
|
|
3130
|
+
};
|
|
3131
|
+
StackPrototype["@@transducer/result"] = function(obj) {
|
|
3132
|
+
return obj.asImmutable();
|
|
3133
|
+
};
|
|
3134
|
+
function makeStack(size, head, ownerID, hash2) {
|
|
3135
|
+
var map2 = Object.create(StackPrototype);
|
|
3136
|
+
map2.size = size;
|
|
3137
|
+
map2._head = head;
|
|
3138
|
+
map2.__ownerID = ownerID;
|
|
3139
|
+
map2.__hash = hash2;
|
|
3140
|
+
map2.__altered = false;
|
|
3141
|
+
return map2;
|
|
3142
|
+
}
|
|
3143
|
+
var EMPTY_STACK;
|
|
3144
|
+
function emptyStack() {
|
|
3145
|
+
return EMPTY_STACK || (EMPTY_STACK = makeStack(0));
|
|
3146
|
+
}
|
|
3147
|
+
var IS_SET_SYMBOL = "@@__IMMUTABLE_SET__@@";
|
|
3148
|
+
function isSet(maybeSet) {
|
|
3149
|
+
return Boolean(maybeSet && maybeSet[IS_SET_SYMBOL]);
|
|
3150
|
+
}
|
|
3151
|
+
function isOrderedSet(maybeOrderedSet) {
|
|
3152
|
+
return isSet(maybeOrderedSet) && isOrdered(maybeOrderedSet);
|
|
3153
|
+
}
|
|
3154
|
+
function deepEqual(a, b) {
|
|
3155
|
+
if (a === b) {
|
|
3156
|
+
return true;
|
|
3157
|
+
}
|
|
3158
|
+
if (!isCollection(b) || a.size !== void 0 && b.size !== void 0 && a.size !== b.size || a.__hash !== void 0 && b.__hash !== void 0 && a.__hash !== b.__hash || isKeyed(a) !== isKeyed(b) || isIndexed(a) !== isIndexed(b) || isOrdered(a) !== isOrdered(b)) {
|
|
3159
|
+
return false;
|
|
3160
|
+
}
|
|
3161
|
+
if (a.size === 0 && b.size === 0) {
|
|
3162
|
+
return true;
|
|
3163
|
+
}
|
|
3164
|
+
var notAssociative = !isAssociative(a);
|
|
3165
|
+
if (isOrdered(a)) {
|
|
3166
|
+
var entries2 = a.entries();
|
|
3167
|
+
return b.every(function(v, k) {
|
|
3168
|
+
var entry = entries2.next().value;
|
|
3169
|
+
return entry && is(entry[1], v) && (notAssociative || is(entry[0], k));
|
|
3170
|
+
}) && entries2.next().done;
|
|
3171
|
+
}
|
|
3172
|
+
var flipped = false;
|
|
3173
|
+
if (a.size === void 0) {
|
|
3174
|
+
if (b.size === void 0) {
|
|
3175
|
+
if (typeof a.cacheResult === "function") {
|
|
3176
|
+
a.cacheResult();
|
|
3177
|
+
}
|
|
3178
|
+
} else {
|
|
3179
|
+
flipped = true;
|
|
3180
|
+
var _ = a;
|
|
3181
|
+
a = b;
|
|
3182
|
+
b = _;
|
|
3183
|
+
}
|
|
3184
|
+
}
|
|
3185
|
+
var allEqual = true;
|
|
3186
|
+
var bSize = b.__iterate(function(v, k) {
|
|
3187
|
+
if (notAssociative ? !a.has(v) : flipped ? !is(v, a.get(k, NOT_SET)) : !is(a.get(k, NOT_SET), v)) {
|
|
3188
|
+
allEqual = false;
|
|
3189
|
+
return false;
|
|
3190
|
+
}
|
|
3191
|
+
});
|
|
3192
|
+
return allEqual && a.size === bSize;
|
|
3193
|
+
}
|
|
3194
|
+
function mixin(ctor, methods) {
|
|
3195
|
+
var keyCopier = function(key) {
|
|
3196
|
+
ctor.prototype[key] = methods[key];
|
|
3197
|
+
};
|
|
3198
|
+
Object.keys(methods).forEach(keyCopier);
|
|
3199
|
+
Object.getOwnPropertySymbols && Object.getOwnPropertySymbols(methods).forEach(keyCopier);
|
|
3200
|
+
return ctor;
|
|
3201
|
+
}
|
|
3202
|
+
function toJS(value) {
|
|
3203
|
+
if (!value || typeof value !== "object") {
|
|
3204
|
+
return value;
|
|
3205
|
+
}
|
|
3206
|
+
if (!isCollection(value)) {
|
|
3207
|
+
if (!isDataStructure(value)) {
|
|
3208
|
+
return value;
|
|
3209
|
+
}
|
|
3210
|
+
value = Seq(value);
|
|
3211
|
+
}
|
|
3212
|
+
if (isKeyed(value)) {
|
|
3213
|
+
var result$1 = {};
|
|
3214
|
+
value.__iterate(function(v, k) {
|
|
3215
|
+
result$1[k] = toJS(v);
|
|
3216
|
+
});
|
|
3217
|
+
return result$1;
|
|
3218
|
+
}
|
|
3219
|
+
var result = [];
|
|
3220
|
+
value.__iterate(function(v) {
|
|
3221
|
+
result.push(toJS(v));
|
|
3222
|
+
});
|
|
3223
|
+
return result;
|
|
3224
|
+
}
|
|
3225
|
+
var Set = /* @__PURE__ */ function(SetCollection2) {
|
|
3226
|
+
function Set2(value) {
|
|
3227
|
+
return value === null || value === void 0 ? emptySet() : isSet(value) && !isOrdered(value) ? value : emptySet().withMutations(function(set2) {
|
|
3228
|
+
var iter = SetCollection2(value);
|
|
3229
|
+
assertNotInfinite(iter.size);
|
|
3230
|
+
iter.forEach(function(v) {
|
|
3231
|
+
return set2.add(v);
|
|
3232
|
+
});
|
|
3233
|
+
});
|
|
3234
|
+
}
|
|
3235
|
+
if (SetCollection2)
|
|
3236
|
+
Set2.__proto__ = SetCollection2;
|
|
3237
|
+
Set2.prototype = Object.create(SetCollection2 && SetCollection2.prototype);
|
|
3238
|
+
Set2.prototype.constructor = Set2;
|
|
3239
|
+
Set2.of = function of() {
|
|
3240
|
+
return this(arguments);
|
|
3241
|
+
};
|
|
3242
|
+
Set2.fromKeys = function fromKeys(value) {
|
|
3243
|
+
return this(KeyedCollection(value).keySeq());
|
|
3244
|
+
};
|
|
3245
|
+
Set2.intersect = function intersect(sets) {
|
|
3246
|
+
sets = Collection(sets).toArray();
|
|
3247
|
+
return sets.length ? SetPrototype.intersect.apply(Set2(sets.pop()), sets) : emptySet();
|
|
3248
|
+
};
|
|
3249
|
+
Set2.union = function union(sets) {
|
|
3250
|
+
sets = Collection(sets).toArray();
|
|
3251
|
+
return sets.length ? SetPrototype.union.apply(Set2(sets.pop()), sets) : emptySet();
|
|
3252
|
+
};
|
|
3253
|
+
Set2.prototype.toString = function toString4() {
|
|
3254
|
+
return this.__toString("Set {", "}");
|
|
3255
|
+
};
|
|
3256
|
+
Set2.prototype.has = function has4(value) {
|
|
3257
|
+
return this._map.has(value);
|
|
3258
|
+
};
|
|
3259
|
+
Set2.prototype.add = function add(value) {
|
|
3260
|
+
return updateSet(this, this._map.set(value, value));
|
|
3261
|
+
};
|
|
3262
|
+
Set2.prototype.remove = function remove2(value) {
|
|
3263
|
+
return updateSet(this, this._map.remove(value));
|
|
3264
|
+
};
|
|
3265
|
+
Set2.prototype.clear = function clear() {
|
|
3266
|
+
return updateSet(this, this._map.clear());
|
|
3267
|
+
};
|
|
3268
|
+
Set2.prototype.map = function map2(mapper, context) {
|
|
3269
|
+
var this$1$1 = this;
|
|
3270
|
+
var didChanges = false;
|
|
3271
|
+
var newMap = updateSet(this, this._map.mapEntries(function(ref) {
|
|
3272
|
+
var v = ref[1];
|
|
3273
|
+
var mapped = mapper.call(context, v, v, this$1$1);
|
|
3274
|
+
if (mapped !== v) {
|
|
3275
|
+
didChanges = true;
|
|
3276
|
+
}
|
|
3277
|
+
return [mapped, mapped];
|
|
3278
|
+
}, context));
|
|
3279
|
+
return didChanges ? newMap : this;
|
|
3280
|
+
};
|
|
3281
|
+
Set2.prototype.union = function union() {
|
|
3282
|
+
var iters = [], len = arguments.length;
|
|
3283
|
+
while (len--)
|
|
3284
|
+
iters[len] = arguments[len];
|
|
3285
|
+
iters = iters.filter(function(x) {
|
|
3286
|
+
return x.size !== 0;
|
|
3287
|
+
});
|
|
3288
|
+
if (iters.length === 0) {
|
|
3289
|
+
return this;
|
|
3290
|
+
}
|
|
3291
|
+
if (this.size === 0 && !this.__ownerID && iters.length === 1) {
|
|
3292
|
+
return this.constructor(iters[0]);
|
|
3293
|
+
}
|
|
3294
|
+
return this.withMutations(function(set2) {
|
|
3295
|
+
for (var ii = 0; ii < iters.length; ii++) {
|
|
3296
|
+
SetCollection2(iters[ii]).forEach(function(value) {
|
|
3297
|
+
return set2.add(value);
|
|
3298
|
+
});
|
|
3299
|
+
}
|
|
3300
|
+
});
|
|
3301
|
+
};
|
|
3302
|
+
Set2.prototype.intersect = function intersect() {
|
|
3303
|
+
var iters = [], len = arguments.length;
|
|
3304
|
+
while (len--)
|
|
3305
|
+
iters[len] = arguments[len];
|
|
3306
|
+
if (iters.length === 0) {
|
|
3307
|
+
return this;
|
|
3308
|
+
}
|
|
3309
|
+
iters = iters.map(function(iter) {
|
|
3310
|
+
return SetCollection2(iter);
|
|
3311
|
+
});
|
|
3312
|
+
var toRemove = [];
|
|
3313
|
+
this.forEach(function(value) {
|
|
3314
|
+
if (!iters.every(function(iter) {
|
|
3315
|
+
return iter.includes(value);
|
|
3316
|
+
})) {
|
|
3317
|
+
toRemove.push(value);
|
|
3318
|
+
}
|
|
3319
|
+
});
|
|
3320
|
+
return this.withMutations(function(set2) {
|
|
3321
|
+
toRemove.forEach(function(value) {
|
|
3322
|
+
set2.remove(value);
|
|
3323
|
+
});
|
|
3324
|
+
});
|
|
3325
|
+
};
|
|
3326
|
+
Set2.prototype.subtract = function subtract() {
|
|
3327
|
+
var iters = [], len = arguments.length;
|
|
3328
|
+
while (len--)
|
|
3329
|
+
iters[len] = arguments[len];
|
|
3330
|
+
if (iters.length === 0) {
|
|
3331
|
+
return this;
|
|
3332
|
+
}
|
|
3333
|
+
iters = iters.map(function(iter) {
|
|
3334
|
+
return SetCollection2(iter);
|
|
3335
|
+
});
|
|
3336
|
+
var toRemove = [];
|
|
3337
|
+
this.forEach(function(value) {
|
|
3338
|
+
if (iters.some(function(iter) {
|
|
3339
|
+
return iter.includes(value);
|
|
3340
|
+
})) {
|
|
3341
|
+
toRemove.push(value);
|
|
3342
|
+
}
|
|
3343
|
+
});
|
|
3344
|
+
return this.withMutations(function(set2) {
|
|
3345
|
+
toRemove.forEach(function(value) {
|
|
3346
|
+
set2.remove(value);
|
|
3347
|
+
});
|
|
3348
|
+
});
|
|
3349
|
+
};
|
|
3350
|
+
Set2.prototype.sort = function sort2(comparator) {
|
|
3351
|
+
return OrderedSet(sortFactory(this, comparator));
|
|
3352
|
+
};
|
|
3353
|
+
Set2.prototype.sortBy = function sortBy2(mapper, comparator) {
|
|
3354
|
+
return OrderedSet(sortFactory(this, comparator, mapper));
|
|
3355
|
+
};
|
|
3356
|
+
Set2.prototype.wasAltered = function wasAltered2() {
|
|
3357
|
+
return this._map.wasAltered();
|
|
3358
|
+
};
|
|
3359
|
+
Set2.prototype.__iterate = function __iterate(fn, reverse3) {
|
|
3360
|
+
var this$1$1 = this;
|
|
3361
|
+
return this._map.__iterate(function(k) {
|
|
3362
|
+
return fn(k, k, this$1$1);
|
|
3363
|
+
}, reverse3);
|
|
3364
|
+
};
|
|
3365
|
+
Set2.prototype.__iterator = function __iterator(type, reverse3) {
|
|
3366
|
+
return this._map.__iterator(type, reverse3);
|
|
3367
|
+
};
|
|
3368
|
+
Set2.prototype.__ensureOwner = function __ensureOwner(ownerID) {
|
|
3369
|
+
if (ownerID === this.__ownerID) {
|
|
3370
|
+
return this;
|
|
3371
|
+
}
|
|
3372
|
+
var newMap = this._map.__ensureOwner(ownerID);
|
|
3373
|
+
if (!ownerID) {
|
|
3374
|
+
if (this.size === 0) {
|
|
3375
|
+
return this.__empty();
|
|
3376
|
+
}
|
|
3377
|
+
this.__ownerID = ownerID;
|
|
3378
|
+
this._map = newMap;
|
|
3379
|
+
return this;
|
|
3380
|
+
}
|
|
3381
|
+
return this.__make(newMap, ownerID);
|
|
3382
|
+
};
|
|
3383
|
+
return Set2;
|
|
3384
|
+
}(SetCollection);
|
|
3385
|
+
Set.isSet = isSet;
|
|
3386
|
+
var SetPrototype = Set.prototype;
|
|
3387
|
+
SetPrototype[IS_SET_SYMBOL] = true;
|
|
3388
|
+
SetPrototype[DELETE] = SetPrototype.remove;
|
|
3389
|
+
SetPrototype.merge = SetPrototype.concat = SetPrototype.union;
|
|
3390
|
+
SetPrototype.withMutations = withMutations;
|
|
3391
|
+
SetPrototype.asImmutable = asImmutable;
|
|
3392
|
+
SetPrototype["@@transducer/init"] = SetPrototype.asMutable = asMutable;
|
|
3393
|
+
SetPrototype["@@transducer/step"] = function(result, arr) {
|
|
3394
|
+
return result.add(arr);
|
|
3395
|
+
};
|
|
3396
|
+
SetPrototype["@@transducer/result"] = function(obj) {
|
|
3397
|
+
return obj.asImmutable();
|
|
3398
|
+
};
|
|
3399
|
+
SetPrototype.__empty = emptySet;
|
|
3400
|
+
SetPrototype.__make = makeSet;
|
|
3401
|
+
function updateSet(set2, newMap) {
|
|
3402
|
+
if (set2.__ownerID) {
|
|
3403
|
+
set2.size = newMap.size;
|
|
3404
|
+
set2._map = newMap;
|
|
3405
|
+
return set2;
|
|
3406
|
+
}
|
|
3407
|
+
return newMap === set2._map ? set2 : newMap.size === 0 ? set2.__empty() : set2.__make(newMap);
|
|
3408
|
+
}
|
|
3409
|
+
function makeSet(map2, ownerID) {
|
|
3410
|
+
var set2 = Object.create(SetPrototype);
|
|
3411
|
+
set2.size = map2 ? map2.size : 0;
|
|
3412
|
+
set2._map = map2;
|
|
3413
|
+
set2.__ownerID = ownerID;
|
|
3414
|
+
return set2;
|
|
3415
|
+
}
|
|
3416
|
+
var EMPTY_SET;
|
|
3417
|
+
function emptySet() {
|
|
3418
|
+
return EMPTY_SET || (EMPTY_SET = makeSet(emptyMap()));
|
|
3419
|
+
}
|
|
3420
|
+
var Range = /* @__PURE__ */ function(IndexedSeq2) {
|
|
3421
|
+
function Range2(start, end, step) {
|
|
3422
|
+
if (!(this instanceof Range2)) {
|
|
3423
|
+
return new Range2(start, end, step);
|
|
3424
|
+
}
|
|
3425
|
+
invariant(step !== 0, "Cannot step a Range by 0");
|
|
3426
|
+
start = start || 0;
|
|
3427
|
+
if (end === void 0) {
|
|
3428
|
+
end = Infinity;
|
|
3429
|
+
}
|
|
3430
|
+
step = step === void 0 ? 1 : Math.abs(step);
|
|
3431
|
+
if (end < start) {
|
|
3432
|
+
step = -step;
|
|
3433
|
+
}
|
|
3434
|
+
this._start = start;
|
|
3435
|
+
this._end = end;
|
|
3436
|
+
this._step = step;
|
|
3437
|
+
this.size = Math.max(0, Math.ceil((end - start) / step - 1) + 1);
|
|
3438
|
+
if (this.size === 0) {
|
|
3439
|
+
if (EMPTY_RANGE) {
|
|
3440
|
+
return EMPTY_RANGE;
|
|
3441
|
+
}
|
|
3442
|
+
EMPTY_RANGE = this;
|
|
3443
|
+
}
|
|
3444
|
+
}
|
|
3445
|
+
if (IndexedSeq2)
|
|
3446
|
+
Range2.__proto__ = IndexedSeq2;
|
|
3447
|
+
Range2.prototype = Object.create(IndexedSeq2 && IndexedSeq2.prototype);
|
|
3448
|
+
Range2.prototype.constructor = Range2;
|
|
3449
|
+
Range2.prototype.toString = function toString4() {
|
|
3450
|
+
if (this.size === 0) {
|
|
3451
|
+
return "Range []";
|
|
3452
|
+
}
|
|
3453
|
+
return "Range [ " + this._start + "..." + this._end + (this._step !== 1 ? " by " + this._step : "") + " ]";
|
|
3454
|
+
};
|
|
3455
|
+
Range2.prototype.get = function get10(index, notSetValue) {
|
|
3456
|
+
return this.has(index) ? this._start + wrapIndex(this, index) * this._step : notSetValue;
|
|
3457
|
+
};
|
|
3458
|
+
Range2.prototype.includes = function includes3(searchValue) {
|
|
3459
|
+
var possibleIndex = (searchValue - this._start) / this._step;
|
|
3460
|
+
return possibleIndex >= 0 && possibleIndex < this.size && possibleIndex === Math.floor(possibleIndex);
|
|
3461
|
+
};
|
|
3462
|
+
Range2.prototype.slice = function slice3(begin, end) {
|
|
3463
|
+
if (wholeSlice(begin, end, this.size)) {
|
|
3464
|
+
return this;
|
|
3465
|
+
}
|
|
3466
|
+
begin = resolveBegin(begin, this.size);
|
|
3467
|
+
end = resolveEnd(end, this.size);
|
|
3468
|
+
if (end <= begin) {
|
|
3469
|
+
return new Range2(0, 0);
|
|
3470
|
+
}
|
|
3471
|
+
return new Range2(this.get(begin, this._end), this.get(end, this._end), this._step);
|
|
3472
|
+
};
|
|
3473
|
+
Range2.prototype.indexOf = function indexOf2(searchValue) {
|
|
3474
|
+
var offsetValue = searchValue - this._start;
|
|
3475
|
+
if (offsetValue % this._step === 0) {
|
|
3476
|
+
var index = offsetValue / this._step;
|
|
3477
|
+
if (index >= 0 && index < this.size) {
|
|
3478
|
+
return index;
|
|
3479
|
+
}
|
|
3480
|
+
}
|
|
3481
|
+
return -1;
|
|
3482
|
+
};
|
|
3483
|
+
Range2.prototype.lastIndexOf = function lastIndexOf2(searchValue) {
|
|
3484
|
+
return this.indexOf(searchValue);
|
|
3485
|
+
};
|
|
3486
|
+
Range2.prototype.__iterate = function __iterate(fn, reverse3) {
|
|
3487
|
+
var size = this.size;
|
|
3488
|
+
var step = this._step;
|
|
3489
|
+
var value = reverse3 ? this._start + (size - 1) * step : this._start;
|
|
3490
|
+
var i = 0;
|
|
3491
|
+
while (i !== size) {
|
|
3492
|
+
if (fn(value, reverse3 ? size - ++i : i++, this) === false) {
|
|
3493
|
+
break;
|
|
3494
|
+
}
|
|
3495
|
+
value += reverse3 ? -step : step;
|
|
3496
|
+
}
|
|
3497
|
+
return i;
|
|
3498
|
+
};
|
|
3499
|
+
Range2.prototype.__iterator = function __iterator(type, reverse3) {
|
|
3500
|
+
var size = this.size;
|
|
3501
|
+
var step = this._step;
|
|
3502
|
+
var value = reverse3 ? this._start + (size - 1) * step : this._start;
|
|
3503
|
+
var i = 0;
|
|
3504
|
+
return new Iterator(function() {
|
|
3505
|
+
if (i === size) {
|
|
3506
|
+
return iteratorDone();
|
|
3507
|
+
}
|
|
3508
|
+
var v = value;
|
|
3509
|
+
value += reverse3 ? -step : step;
|
|
3510
|
+
return iteratorValue(type, reverse3 ? size - ++i : i++, v);
|
|
3511
|
+
});
|
|
3512
|
+
};
|
|
3513
|
+
Range2.prototype.equals = function equals2(other) {
|
|
3514
|
+
return other instanceof Range2 ? this._start === other._start && this._end === other._end && this._step === other._step : deepEqual(this, other);
|
|
3515
|
+
};
|
|
3516
|
+
return Range2;
|
|
3517
|
+
}(IndexedSeq);
|
|
3518
|
+
var EMPTY_RANGE;
|
|
3519
|
+
function getIn$1(collection, searchKeyPath, notSetValue) {
|
|
3520
|
+
var keyPath = coerceKeyPath(searchKeyPath);
|
|
3521
|
+
var i = 0;
|
|
3522
|
+
while (i !== keyPath.length) {
|
|
3523
|
+
collection = get(collection, keyPath[i++], NOT_SET);
|
|
3524
|
+
if (collection === NOT_SET) {
|
|
3525
|
+
return notSetValue;
|
|
3526
|
+
}
|
|
3527
|
+
}
|
|
3528
|
+
return collection;
|
|
3529
|
+
}
|
|
3530
|
+
function getIn(searchKeyPath, notSetValue) {
|
|
3531
|
+
return getIn$1(this, searchKeyPath, notSetValue);
|
|
3532
|
+
}
|
|
3533
|
+
function hasIn$1(collection, keyPath) {
|
|
3534
|
+
return getIn$1(collection, keyPath, NOT_SET) !== NOT_SET;
|
|
3535
|
+
}
|
|
3536
|
+
function hasIn(searchKeyPath) {
|
|
3537
|
+
return hasIn$1(this, searchKeyPath);
|
|
3538
|
+
}
|
|
3539
|
+
function toObject() {
|
|
3540
|
+
assertNotInfinite(this.size);
|
|
3541
|
+
var object = {};
|
|
3542
|
+
this.__iterate(function(v, k) {
|
|
3543
|
+
object[k] = v;
|
|
3544
|
+
});
|
|
3545
|
+
return object;
|
|
3546
|
+
}
|
|
3547
|
+
Collection.isIterable = isCollection;
|
|
3548
|
+
Collection.isKeyed = isKeyed;
|
|
3549
|
+
Collection.isIndexed = isIndexed;
|
|
3550
|
+
Collection.isAssociative = isAssociative;
|
|
3551
|
+
Collection.isOrdered = isOrdered;
|
|
3552
|
+
Collection.Iterator = Iterator;
|
|
3553
|
+
mixin(Collection, {
|
|
3554
|
+
toArray: function toArray() {
|
|
3555
|
+
assertNotInfinite(this.size);
|
|
3556
|
+
var array = new Array(this.size || 0);
|
|
3557
|
+
var useTuples = isKeyed(this);
|
|
3558
|
+
var i = 0;
|
|
3559
|
+
this.__iterate(function(v, k) {
|
|
3560
|
+
array[i++] = useTuples ? [k, v] : v;
|
|
3561
|
+
});
|
|
3562
|
+
return array;
|
|
3563
|
+
},
|
|
3564
|
+
toIndexedSeq: function toIndexedSeq() {
|
|
3565
|
+
return new ToIndexedSequence(this);
|
|
3566
|
+
},
|
|
3567
|
+
toJS: function toJS$1() {
|
|
3568
|
+
return toJS(this);
|
|
3569
|
+
},
|
|
3570
|
+
toKeyedSeq: function toKeyedSeq() {
|
|
3571
|
+
return new ToKeyedSequence(this, true);
|
|
3572
|
+
},
|
|
3573
|
+
toMap: function toMap() {
|
|
3574
|
+
return Map$1(this.toKeyedSeq());
|
|
3575
|
+
},
|
|
3576
|
+
toObject,
|
|
3577
|
+
toOrderedMap: function toOrderedMap() {
|
|
3578
|
+
return OrderedMap(this.toKeyedSeq());
|
|
3579
|
+
},
|
|
3580
|
+
toOrderedSet: function toOrderedSet() {
|
|
3581
|
+
return OrderedSet(isKeyed(this) ? this.valueSeq() : this);
|
|
3582
|
+
},
|
|
3583
|
+
toSet: function toSet() {
|
|
3584
|
+
return Set(isKeyed(this) ? this.valueSeq() : this);
|
|
3585
|
+
},
|
|
3586
|
+
toSetSeq: function toSetSeq() {
|
|
3587
|
+
return new ToSetSequence(this);
|
|
3588
|
+
},
|
|
3589
|
+
toSeq: function toSeq() {
|
|
3590
|
+
return isIndexed(this) ? this.toIndexedSeq() : isKeyed(this) ? this.toKeyedSeq() : this.toSetSeq();
|
|
3591
|
+
},
|
|
3592
|
+
toStack: function toStack() {
|
|
3593
|
+
return Stack(isKeyed(this) ? this.valueSeq() : this);
|
|
3594
|
+
},
|
|
3595
|
+
toList: function toList() {
|
|
3596
|
+
return List(isKeyed(this) ? this.valueSeq() : this);
|
|
3597
|
+
},
|
|
3598
|
+
toString: function toString3() {
|
|
3599
|
+
return "[Collection]";
|
|
3600
|
+
},
|
|
3601
|
+
__toString: function __toString(head, tail) {
|
|
3602
|
+
if (this.size === 0) {
|
|
3603
|
+
return head + tail;
|
|
3604
|
+
}
|
|
3605
|
+
return head + " " + this.toSeq().map(this.__toStringMapper).join(", ") + " " + tail;
|
|
3606
|
+
},
|
|
3607
|
+
concat: function concat() {
|
|
3608
|
+
var values2 = [], len = arguments.length;
|
|
3609
|
+
while (len--)
|
|
3610
|
+
values2[len] = arguments[len];
|
|
3611
|
+
return reify(this, concatFactory(this, values2));
|
|
3612
|
+
},
|
|
3613
|
+
includes: function includes(searchValue) {
|
|
3614
|
+
return this.some(function(value) {
|
|
3615
|
+
return is(value, searchValue);
|
|
3616
|
+
});
|
|
3617
|
+
},
|
|
3618
|
+
entries: function entries() {
|
|
3619
|
+
return this.__iterator(ITERATE_ENTRIES);
|
|
3620
|
+
},
|
|
3621
|
+
every: function every(predicate, context) {
|
|
3622
|
+
assertNotInfinite(this.size);
|
|
3623
|
+
var returnValue = true;
|
|
3624
|
+
this.__iterate(function(v, k, c) {
|
|
3625
|
+
if (!predicate.call(context, v, k, c)) {
|
|
3626
|
+
returnValue = false;
|
|
3627
|
+
return false;
|
|
3628
|
+
}
|
|
3629
|
+
});
|
|
3630
|
+
return returnValue;
|
|
3631
|
+
},
|
|
3632
|
+
filter: function filter(predicate, context) {
|
|
3633
|
+
return reify(this, filterFactory(this, predicate, context, true));
|
|
3634
|
+
},
|
|
3635
|
+
find: function find(predicate, context, notSetValue) {
|
|
3636
|
+
var entry = this.findEntry(predicate, context);
|
|
3637
|
+
return entry ? entry[1] : notSetValue;
|
|
3638
|
+
},
|
|
3639
|
+
forEach: function forEach(sideEffect, context) {
|
|
3640
|
+
assertNotInfinite(this.size);
|
|
3641
|
+
return this.__iterate(context ? sideEffect.bind(context) : sideEffect);
|
|
3642
|
+
},
|
|
3643
|
+
join: function join(separator) {
|
|
3644
|
+
assertNotInfinite(this.size);
|
|
3645
|
+
separator = separator !== void 0 ? "" + separator : ",";
|
|
3646
|
+
var joined = "";
|
|
3647
|
+
var isFirst = true;
|
|
3648
|
+
this.__iterate(function(v) {
|
|
3649
|
+
isFirst ? isFirst = false : joined += separator;
|
|
3650
|
+
joined += v !== null && v !== void 0 ? v.toString() : "";
|
|
3651
|
+
});
|
|
3652
|
+
return joined;
|
|
3653
|
+
},
|
|
3654
|
+
keys: function keys() {
|
|
3655
|
+
return this.__iterator(ITERATE_KEYS);
|
|
3656
|
+
},
|
|
3657
|
+
map: function map(mapper, context) {
|
|
3658
|
+
return reify(this, mapFactory(this, mapper, context));
|
|
3659
|
+
},
|
|
3660
|
+
reduce: function reduce$1(reducer2, initialReduction, context) {
|
|
3661
|
+
return reduce(this, reducer2, initialReduction, context, arguments.length < 2, false);
|
|
3662
|
+
},
|
|
3663
|
+
reduceRight: function reduceRight(reducer2, initialReduction, context) {
|
|
3664
|
+
return reduce(this, reducer2, initialReduction, context, arguments.length < 2, true);
|
|
3665
|
+
},
|
|
3666
|
+
reverse: function reverse() {
|
|
3667
|
+
return reify(this, reverseFactory(this, true));
|
|
3668
|
+
},
|
|
3669
|
+
slice: function slice(begin, end) {
|
|
3670
|
+
return reify(this, sliceFactory(this, begin, end, true));
|
|
3671
|
+
},
|
|
3672
|
+
some: function some(predicate, context) {
|
|
3673
|
+
return !this.every(not(predicate), context);
|
|
3674
|
+
},
|
|
3675
|
+
sort: function sort(comparator) {
|
|
3676
|
+
return reify(this, sortFactory(this, comparator));
|
|
3677
|
+
},
|
|
3678
|
+
values: function values() {
|
|
3679
|
+
return this.__iterator(ITERATE_VALUES);
|
|
3680
|
+
},
|
|
3681
|
+
butLast: function butLast() {
|
|
3682
|
+
return this.slice(0, -1);
|
|
3683
|
+
},
|
|
3684
|
+
isEmpty: function isEmpty() {
|
|
3685
|
+
return this.size !== void 0 ? this.size === 0 : !this.some(function() {
|
|
3686
|
+
return true;
|
|
3687
|
+
});
|
|
3688
|
+
},
|
|
3689
|
+
count: function count(predicate, context) {
|
|
3690
|
+
return ensureSize(predicate ? this.toSeq().filter(predicate, context) : this);
|
|
3691
|
+
},
|
|
3692
|
+
countBy: function countBy(grouper, context) {
|
|
3693
|
+
return countByFactory(this, grouper, context);
|
|
3694
|
+
},
|
|
3695
|
+
equals: function equals(other) {
|
|
3696
|
+
return deepEqual(this, other);
|
|
3697
|
+
},
|
|
3698
|
+
entrySeq: function entrySeq() {
|
|
3699
|
+
var collection = this;
|
|
3700
|
+
if (collection._cache) {
|
|
3701
|
+
return new ArraySeq(collection._cache);
|
|
3702
|
+
}
|
|
3703
|
+
var entriesSequence = collection.toSeq().map(entryMapper).toIndexedSeq();
|
|
3704
|
+
entriesSequence.fromEntrySeq = function() {
|
|
3705
|
+
return collection.toSeq();
|
|
3706
|
+
};
|
|
3707
|
+
return entriesSequence;
|
|
3708
|
+
},
|
|
3709
|
+
filterNot: function filterNot(predicate, context) {
|
|
3710
|
+
return this.filter(not(predicate), context);
|
|
3711
|
+
},
|
|
3712
|
+
findEntry: function findEntry(predicate, context, notSetValue) {
|
|
3713
|
+
var found = notSetValue;
|
|
3714
|
+
this.__iterate(function(v, k, c) {
|
|
3715
|
+
if (predicate.call(context, v, k, c)) {
|
|
3716
|
+
found = [k, v];
|
|
3717
|
+
return false;
|
|
3718
|
+
}
|
|
3719
|
+
});
|
|
3720
|
+
return found;
|
|
3721
|
+
},
|
|
3722
|
+
findKey: function findKey(predicate, context) {
|
|
3723
|
+
var entry = this.findEntry(predicate, context);
|
|
3724
|
+
return entry && entry[0];
|
|
3725
|
+
},
|
|
3726
|
+
findLast: function findLast(predicate, context, notSetValue) {
|
|
3727
|
+
return this.toKeyedSeq().reverse().find(predicate, context, notSetValue);
|
|
3728
|
+
},
|
|
3729
|
+
findLastEntry: function findLastEntry(predicate, context, notSetValue) {
|
|
3730
|
+
return this.toKeyedSeq().reverse().findEntry(predicate, context, notSetValue);
|
|
3731
|
+
},
|
|
3732
|
+
findLastKey: function findLastKey(predicate, context) {
|
|
3733
|
+
return this.toKeyedSeq().reverse().findKey(predicate, context);
|
|
3734
|
+
},
|
|
3735
|
+
first: function first(notSetValue) {
|
|
3736
|
+
return this.find(returnTrue, null, notSetValue);
|
|
3737
|
+
},
|
|
3738
|
+
flatMap: function flatMap(mapper, context) {
|
|
3739
|
+
return reify(this, flatMapFactory(this, mapper, context));
|
|
3740
|
+
},
|
|
3741
|
+
flatten: function flatten(depth) {
|
|
3742
|
+
return reify(this, flattenFactory(this, depth, true));
|
|
3743
|
+
},
|
|
3744
|
+
fromEntrySeq: function fromEntrySeq() {
|
|
3745
|
+
return new FromEntriesSequence(this);
|
|
3746
|
+
},
|
|
3747
|
+
get: function get7(searchKey, notSetValue) {
|
|
3748
|
+
return this.find(function(_, key) {
|
|
3749
|
+
return is(key, searchKey);
|
|
3750
|
+
}, void 0, notSetValue);
|
|
3751
|
+
},
|
|
3752
|
+
getIn,
|
|
3753
|
+
groupBy: function groupBy(grouper, context) {
|
|
3754
|
+
return groupByFactory(this, grouper, context);
|
|
3755
|
+
},
|
|
3756
|
+
has: function has2(searchKey) {
|
|
3757
|
+
return this.get(searchKey, NOT_SET) !== NOT_SET;
|
|
3758
|
+
},
|
|
3759
|
+
hasIn,
|
|
3760
|
+
isSubset: function isSubset(iter) {
|
|
3761
|
+
iter = typeof iter.includes === "function" ? iter : Collection(iter);
|
|
3762
|
+
return this.every(function(value) {
|
|
3763
|
+
return iter.includes(value);
|
|
3764
|
+
});
|
|
3765
|
+
},
|
|
3766
|
+
isSuperset: function isSuperset(iter) {
|
|
3767
|
+
iter = typeof iter.isSubset === "function" ? iter : Collection(iter);
|
|
3768
|
+
return iter.isSubset(this);
|
|
3769
|
+
},
|
|
3770
|
+
keyOf: function keyOf(searchValue) {
|
|
3771
|
+
return this.findKey(function(value) {
|
|
3772
|
+
return is(value, searchValue);
|
|
3773
|
+
});
|
|
3774
|
+
},
|
|
3775
|
+
keySeq: function keySeq() {
|
|
3776
|
+
return this.toSeq().map(keyMapper).toIndexedSeq();
|
|
3777
|
+
},
|
|
3778
|
+
last: function last(notSetValue) {
|
|
3779
|
+
return this.toSeq().reverse().first(notSetValue);
|
|
3780
|
+
},
|
|
3781
|
+
lastKeyOf: function lastKeyOf(searchValue) {
|
|
3782
|
+
return this.toKeyedSeq().reverse().keyOf(searchValue);
|
|
3783
|
+
},
|
|
3784
|
+
max: function max(comparator) {
|
|
3785
|
+
return maxFactory(this, comparator);
|
|
3786
|
+
},
|
|
3787
|
+
maxBy: function maxBy(mapper, comparator) {
|
|
3788
|
+
return maxFactory(this, comparator, mapper);
|
|
3789
|
+
},
|
|
3790
|
+
min: function min(comparator) {
|
|
3791
|
+
return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator);
|
|
3792
|
+
},
|
|
3793
|
+
minBy: function minBy(mapper, comparator) {
|
|
3794
|
+
return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator, mapper);
|
|
3795
|
+
},
|
|
3796
|
+
rest: function rest() {
|
|
3797
|
+
return this.slice(1);
|
|
3798
|
+
},
|
|
3799
|
+
skip: function skip(amount) {
|
|
3800
|
+
return amount === 0 ? this : this.slice(Math.max(0, amount));
|
|
3801
|
+
},
|
|
3802
|
+
skipLast: function skipLast(amount) {
|
|
3803
|
+
return amount === 0 ? this : this.slice(0, -Math.max(0, amount));
|
|
3804
|
+
},
|
|
3805
|
+
skipWhile: function skipWhile(predicate, context) {
|
|
3806
|
+
return reify(this, skipWhileFactory(this, predicate, context, true));
|
|
3807
|
+
},
|
|
3808
|
+
skipUntil: function skipUntil(predicate, context) {
|
|
3809
|
+
return this.skipWhile(not(predicate), context);
|
|
3810
|
+
},
|
|
3811
|
+
sortBy: function sortBy(mapper, comparator) {
|
|
3812
|
+
return reify(this, sortFactory(this, comparator, mapper));
|
|
3813
|
+
},
|
|
3814
|
+
take: function take(amount) {
|
|
3815
|
+
return this.slice(0, Math.max(0, amount));
|
|
3816
|
+
},
|
|
3817
|
+
takeLast: function takeLast(amount) {
|
|
3818
|
+
return this.slice(-Math.max(0, amount));
|
|
3819
|
+
},
|
|
3820
|
+
takeWhile: function takeWhile(predicate, context) {
|
|
3821
|
+
return reify(this, takeWhileFactory(this, predicate, context));
|
|
3822
|
+
},
|
|
3823
|
+
takeUntil: function takeUntil(predicate, context) {
|
|
3824
|
+
return this.takeWhile(not(predicate), context);
|
|
3825
|
+
},
|
|
3826
|
+
update: function update7(fn) {
|
|
3827
|
+
return fn(this);
|
|
3828
|
+
},
|
|
3829
|
+
valueSeq: function valueSeq() {
|
|
3830
|
+
return this.toIndexedSeq();
|
|
3831
|
+
},
|
|
3832
|
+
hashCode: function hashCode() {
|
|
3833
|
+
return this.__hash || (this.__hash = hashCollection(this));
|
|
3834
|
+
}
|
|
3835
|
+
});
|
|
3836
|
+
var CollectionPrototype = Collection.prototype;
|
|
3837
|
+
CollectionPrototype[IS_COLLECTION_SYMBOL] = true;
|
|
3838
|
+
CollectionPrototype[ITERATOR_SYMBOL] = CollectionPrototype.values;
|
|
3839
|
+
CollectionPrototype.toJSON = CollectionPrototype.toArray;
|
|
3840
|
+
CollectionPrototype.__toStringMapper = quoteString;
|
|
3841
|
+
CollectionPrototype.inspect = CollectionPrototype.toSource = function() {
|
|
3842
|
+
return this.toString();
|
|
3843
|
+
};
|
|
3844
|
+
CollectionPrototype.chain = CollectionPrototype.flatMap;
|
|
3845
|
+
CollectionPrototype.contains = CollectionPrototype.includes;
|
|
3846
|
+
mixin(KeyedCollection, {
|
|
3847
|
+
flip: function flip() {
|
|
3848
|
+
return reify(this, flipFactory(this));
|
|
3849
|
+
},
|
|
3850
|
+
mapEntries: function mapEntries(mapper, context) {
|
|
3851
|
+
var this$1$1 = this;
|
|
3852
|
+
var iterations = 0;
|
|
3853
|
+
return reify(this, this.toSeq().map(function(v, k) {
|
|
3854
|
+
return mapper.call(context, [k, v], iterations++, this$1$1);
|
|
3855
|
+
}).fromEntrySeq());
|
|
3856
|
+
},
|
|
3857
|
+
mapKeys: function mapKeys(mapper, context) {
|
|
3858
|
+
var this$1$1 = this;
|
|
3859
|
+
return reify(this, this.toSeq().flip().map(function(k, v) {
|
|
3860
|
+
return mapper.call(context, k, v, this$1$1);
|
|
3861
|
+
}).flip());
|
|
3862
|
+
}
|
|
3863
|
+
});
|
|
3864
|
+
var KeyedCollectionPrototype = KeyedCollection.prototype;
|
|
3865
|
+
KeyedCollectionPrototype[IS_KEYED_SYMBOL] = true;
|
|
3866
|
+
KeyedCollectionPrototype[ITERATOR_SYMBOL] = CollectionPrototype.entries;
|
|
3867
|
+
KeyedCollectionPrototype.toJSON = toObject;
|
|
3868
|
+
KeyedCollectionPrototype.__toStringMapper = function(v, k) {
|
|
3869
|
+
return quoteString(k) + ": " + quoteString(v);
|
|
3870
|
+
};
|
|
3871
|
+
mixin(IndexedCollection, {
|
|
3872
|
+
toKeyedSeq: function toKeyedSeq2() {
|
|
3873
|
+
return new ToKeyedSequence(this, false);
|
|
3874
|
+
},
|
|
3875
|
+
filter: function filter2(predicate, context) {
|
|
3876
|
+
return reify(this, filterFactory(this, predicate, context, false));
|
|
3877
|
+
},
|
|
3878
|
+
findIndex: function findIndex(predicate, context) {
|
|
3879
|
+
var entry = this.findEntry(predicate, context);
|
|
3880
|
+
return entry ? entry[0] : -1;
|
|
3881
|
+
},
|
|
3882
|
+
indexOf: function indexOf(searchValue) {
|
|
3883
|
+
var key = this.keyOf(searchValue);
|
|
3884
|
+
return key === void 0 ? -1 : key;
|
|
3885
|
+
},
|
|
3886
|
+
lastIndexOf: function lastIndexOf(searchValue) {
|
|
3887
|
+
var key = this.lastKeyOf(searchValue);
|
|
3888
|
+
return key === void 0 ? -1 : key;
|
|
3889
|
+
},
|
|
3890
|
+
reverse: function reverse2() {
|
|
3891
|
+
return reify(this, reverseFactory(this, false));
|
|
3892
|
+
},
|
|
3893
|
+
slice: function slice2(begin, end) {
|
|
3894
|
+
return reify(this, sliceFactory(this, begin, end, false));
|
|
3895
|
+
},
|
|
3896
|
+
splice: function splice(index, removeNum) {
|
|
3897
|
+
var numArgs = arguments.length;
|
|
3898
|
+
removeNum = Math.max(removeNum || 0, 0);
|
|
3899
|
+
if (numArgs === 0 || numArgs === 2 && !removeNum) {
|
|
3900
|
+
return this;
|
|
3901
|
+
}
|
|
3902
|
+
index = resolveBegin(index, index < 0 ? this.count() : this.size);
|
|
3903
|
+
var spliced = this.slice(0, index);
|
|
3904
|
+
return reify(this, numArgs === 1 ? spliced : spliced.concat(arrCopy(arguments, 2), this.slice(index + removeNum)));
|
|
3905
|
+
},
|
|
3906
|
+
findLastIndex: function findLastIndex(predicate, context) {
|
|
3907
|
+
var entry = this.findLastEntry(predicate, context);
|
|
3908
|
+
return entry ? entry[0] : -1;
|
|
3909
|
+
},
|
|
3910
|
+
first: function first2(notSetValue) {
|
|
3911
|
+
return this.get(0, notSetValue);
|
|
3912
|
+
},
|
|
3913
|
+
flatten: function flatten2(depth) {
|
|
3914
|
+
return reify(this, flattenFactory(this, depth, false));
|
|
3915
|
+
},
|
|
3916
|
+
get: function get8(index, notSetValue) {
|
|
3917
|
+
index = wrapIndex(this, index);
|
|
3918
|
+
return index < 0 || this.size === Infinity || this.size !== void 0 && index > this.size ? notSetValue : this.find(function(_, key) {
|
|
3919
|
+
return key === index;
|
|
3920
|
+
}, void 0, notSetValue);
|
|
3921
|
+
},
|
|
3922
|
+
has: function has3(index) {
|
|
3923
|
+
index = wrapIndex(this, index);
|
|
3924
|
+
return index >= 0 && (this.size !== void 0 ? this.size === Infinity || index < this.size : this.indexOf(index) !== -1);
|
|
3925
|
+
},
|
|
3926
|
+
interpose: function interpose(separator) {
|
|
3927
|
+
return reify(this, interposeFactory(this, separator));
|
|
3928
|
+
},
|
|
3929
|
+
interleave: function interleave() {
|
|
3930
|
+
var collections = [this].concat(arrCopy(arguments));
|
|
3931
|
+
var zipped = zipWithFactory(this.toSeq(), IndexedSeq.of, collections);
|
|
3932
|
+
var interleaved = zipped.flatten(true);
|
|
3933
|
+
if (zipped.size) {
|
|
3934
|
+
interleaved.size = zipped.size * collections.length;
|
|
3935
|
+
}
|
|
3936
|
+
return reify(this, interleaved);
|
|
3937
|
+
},
|
|
3938
|
+
keySeq: function keySeq2() {
|
|
3939
|
+
return Range(0, this.size);
|
|
3940
|
+
},
|
|
3941
|
+
last: function last2(notSetValue) {
|
|
3942
|
+
return this.get(-1, notSetValue);
|
|
3943
|
+
},
|
|
3944
|
+
skipWhile: function skipWhile2(predicate, context) {
|
|
3945
|
+
return reify(this, skipWhileFactory(this, predicate, context, false));
|
|
3946
|
+
},
|
|
3947
|
+
zip: function zip() {
|
|
3948
|
+
var collections = [this].concat(arrCopy(arguments));
|
|
3949
|
+
return reify(this, zipWithFactory(this, defaultZipper, collections));
|
|
3950
|
+
},
|
|
3951
|
+
zipAll: function zipAll() {
|
|
3952
|
+
var collections = [this].concat(arrCopy(arguments));
|
|
3953
|
+
return reify(this, zipWithFactory(this, defaultZipper, collections, true));
|
|
3954
|
+
},
|
|
3955
|
+
zipWith: function zipWith(zipper) {
|
|
3956
|
+
var collections = arrCopy(arguments);
|
|
3957
|
+
collections[0] = this;
|
|
3958
|
+
return reify(this, zipWithFactory(this, zipper, collections));
|
|
3959
|
+
}
|
|
3960
|
+
});
|
|
3961
|
+
var IndexedCollectionPrototype = IndexedCollection.prototype;
|
|
3962
|
+
IndexedCollectionPrototype[IS_INDEXED_SYMBOL] = true;
|
|
3963
|
+
IndexedCollectionPrototype[IS_ORDERED_SYMBOL] = true;
|
|
3964
|
+
mixin(SetCollection, {
|
|
3965
|
+
get: function get9(value, notSetValue) {
|
|
3966
|
+
return this.has(value) ? value : notSetValue;
|
|
3967
|
+
},
|
|
3968
|
+
includes: function includes2(value) {
|
|
3969
|
+
return this.has(value);
|
|
3970
|
+
},
|
|
3971
|
+
keySeq: function keySeq3() {
|
|
3972
|
+
return this.valueSeq();
|
|
3973
|
+
}
|
|
3974
|
+
});
|
|
3975
|
+
var SetCollectionPrototype = SetCollection.prototype;
|
|
3976
|
+
SetCollectionPrototype.has = CollectionPrototype.includes;
|
|
3977
|
+
SetCollectionPrototype.contains = SetCollectionPrototype.includes;
|
|
3978
|
+
SetCollectionPrototype.keys = SetCollectionPrototype.values;
|
|
3979
|
+
mixin(KeyedSeq, KeyedCollectionPrototype);
|
|
3980
|
+
mixin(IndexedSeq, IndexedCollectionPrototype);
|
|
3981
|
+
mixin(SetSeq, SetCollectionPrototype);
|
|
3982
|
+
function reduce(collection, reducer2, reduction, context, useFirst, reverse3) {
|
|
3983
|
+
assertNotInfinite(collection.size);
|
|
3984
|
+
collection.__iterate(function(v, k, c) {
|
|
3985
|
+
if (useFirst) {
|
|
3986
|
+
useFirst = false;
|
|
3987
|
+
reduction = v;
|
|
3988
|
+
} else {
|
|
3989
|
+
reduction = reducer2.call(context, reduction, v, k, c);
|
|
3990
|
+
}
|
|
3991
|
+
}, reverse3);
|
|
3992
|
+
return reduction;
|
|
3993
|
+
}
|
|
3994
|
+
function keyMapper(v, k) {
|
|
3995
|
+
return k;
|
|
3996
|
+
}
|
|
3997
|
+
function entryMapper(v, k) {
|
|
3998
|
+
return [k, v];
|
|
3999
|
+
}
|
|
4000
|
+
function not(predicate) {
|
|
4001
|
+
return function() {
|
|
4002
|
+
return !predicate.apply(this, arguments);
|
|
4003
|
+
};
|
|
4004
|
+
}
|
|
4005
|
+
function neg(predicate) {
|
|
4006
|
+
return function() {
|
|
4007
|
+
return -predicate.apply(this, arguments);
|
|
4008
|
+
};
|
|
4009
|
+
}
|
|
4010
|
+
function defaultZipper() {
|
|
4011
|
+
return arrCopy(arguments);
|
|
4012
|
+
}
|
|
4013
|
+
function defaultNegComparator(a, b) {
|
|
4014
|
+
return a < b ? 1 : a > b ? -1 : 0;
|
|
4015
|
+
}
|
|
4016
|
+
function hashCollection(collection) {
|
|
4017
|
+
if (collection.size === Infinity) {
|
|
4018
|
+
return 0;
|
|
4019
|
+
}
|
|
4020
|
+
var ordered = isOrdered(collection);
|
|
4021
|
+
var keyed = isKeyed(collection);
|
|
4022
|
+
var h = ordered ? 1 : 0;
|
|
4023
|
+
var size = collection.__iterate(keyed ? ordered ? function(v, k) {
|
|
4024
|
+
h = 31 * h + hashMerge(hash(v), hash(k)) | 0;
|
|
4025
|
+
} : function(v, k) {
|
|
4026
|
+
h = h + hashMerge(hash(v), hash(k)) | 0;
|
|
4027
|
+
} : ordered ? function(v) {
|
|
4028
|
+
h = 31 * h + hash(v) | 0;
|
|
4029
|
+
} : function(v) {
|
|
4030
|
+
h = h + hash(v) | 0;
|
|
4031
|
+
});
|
|
4032
|
+
return murmurHashOfSize(size, h);
|
|
4033
|
+
}
|
|
4034
|
+
function murmurHashOfSize(size, h) {
|
|
4035
|
+
h = imul(h, 3432918353);
|
|
4036
|
+
h = imul(h << 15 | h >>> -15, 461845907);
|
|
4037
|
+
h = imul(h << 13 | h >>> -13, 5);
|
|
4038
|
+
h = (h + 3864292196 | 0) ^ size;
|
|
4039
|
+
h = imul(h ^ h >>> 16, 2246822507);
|
|
4040
|
+
h = imul(h ^ h >>> 13, 3266489909);
|
|
4041
|
+
h = smi(h ^ h >>> 16);
|
|
4042
|
+
return h;
|
|
4043
|
+
}
|
|
4044
|
+
function hashMerge(a, b) {
|
|
4045
|
+
return a ^ b + 2654435769 + (a << 6) + (a >> 2) | 0;
|
|
4046
|
+
}
|
|
4047
|
+
var OrderedSet = /* @__PURE__ */ function(Set2) {
|
|
4048
|
+
function OrderedSet2(value) {
|
|
4049
|
+
return value === null || value === void 0 ? emptyOrderedSet() : isOrderedSet(value) ? value : emptyOrderedSet().withMutations(function(set2) {
|
|
4050
|
+
var iter = SetCollection(value);
|
|
4051
|
+
assertNotInfinite(iter.size);
|
|
4052
|
+
iter.forEach(function(v) {
|
|
4053
|
+
return set2.add(v);
|
|
4054
|
+
});
|
|
4055
|
+
});
|
|
4056
|
+
}
|
|
4057
|
+
if (Set2)
|
|
4058
|
+
OrderedSet2.__proto__ = Set2;
|
|
4059
|
+
OrderedSet2.prototype = Object.create(Set2 && Set2.prototype);
|
|
4060
|
+
OrderedSet2.prototype.constructor = OrderedSet2;
|
|
4061
|
+
OrderedSet2.of = function of() {
|
|
4062
|
+
return this(arguments);
|
|
4063
|
+
};
|
|
4064
|
+
OrderedSet2.fromKeys = function fromKeys(value) {
|
|
4065
|
+
return this(KeyedCollection(value).keySeq());
|
|
4066
|
+
};
|
|
4067
|
+
OrderedSet2.prototype.toString = function toString4() {
|
|
4068
|
+
return this.__toString("OrderedSet {", "}");
|
|
4069
|
+
};
|
|
4070
|
+
return OrderedSet2;
|
|
4071
|
+
}(Set);
|
|
4072
|
+
OrderedSet.isOrderedSet = isOrderedSet;
|
|
4073
|
+
var OrderedSetPrototype = OrderedSet.prototype;
|
|
4074
|
+
OrderedSetPrototype[IS_ORDERED_SYMBOL] = true;
|
|
4075
|
+
OrderedSetPrototype.zip = IndexedCollectionPrototype.zip;
|
|
4076
|
+
OrderedSetPrototype.zipWith = IndexedCollectionPrototype.zipWith;
|
|
4077
|
+
OrderedSetPrototype.zipAll = IndexedCollectionPrototype.zipAll;
|
|
4078
|
+
OrderedSetPrototype.__empty = emptyOrderedSet;
|
|
4079
|
+
OrderedSetPrototype.__make = makeOrderedSet;
|
|
4080
|
+
function makeOrderedSet(map2, ownerID) {
|
|
4081
|
+
var set2 = Object.create(OrderedSetPrototype);
|
|
4082
|
+
set2.size = map2 ? map2.size : 0;
|
|
4083
|
+
set2._map = map2;
|
|
4084
|
+
set2.__ownerID = ownerID;
|
|
4085
|
+
return set2;
|
|
4086
|
+
}
|
|
4087
|
+
var EMPTY_ORDERED_SET;
|
|
4088
|
+
function emptyOrderedSet() {
|
|
4089
|
+
return EMPTY_ORDERED_SET || (EMPTY_ORDERED_SET = makeOrderedSet(emptyOrderedMap()));
|
|
4090
|
+
}
|
|
4091
|
+
function apply(data, operation) {
|
|
4092
|
+
let applied = data;
|
|
4093
|
+
operation.forEach((component) => {
|
|
4094
|
+
if (component.ld != null)
|
|
4095
|
+
applied = removeIn(applied, component.p);
|
|
4096
|
+
if (component.od != null)
|
|
4097
|
+
applied = removeIn(applied, component.p);
|
|
4098
|
+
if (component.li != null)
|
|
4099
|
+
applied = setIn$1(applied, component.p, component.li);
|
|
4100
|
+
if (component.oi != null)
|
|
4101
|
+
applied = setIn$1(applied, component.p, component.oi);
|
|
4102
|
+
});
|
|
4103
|
+
return applied;
|
|
4104
|
+
}
|
|
4105
|
+
function getInitialState({
|
|
4106
|
+
rootElements
|
|
4107
|
+
} = {}) {
|
|
4108
|
+
return react.getInitialState({ rootElements });
|
|
4109
|
+
}
|
|
4110
|
+
function getReadOnlyDocumentsStateSlice(state) {
|
|
4111
|
+
return state;
|
|
4112
|
+
}
|
|
4113
|
+
function getDocumentRootElement(state, documentKey) {
|
|
4114
|
+
return react.getDocumentRootElement(getReadOnlyDocumentsStateSlice(state), documentKey);
|
|
4115
|
+
}
|
|
4116
|
+
function reducer$1(state = getInitialState(), action) {
|
|
4117
|
+
switch (action.type) {
|
|
4118
|
+
case actions.ActionTypes.CHANGE_DOCUMENT: {
|
|
4119
|
+
const currentRootElement = getDocumentRootElement(state, action.payload.documentKey);
|
|
4120
|
+
if (currentRootElement == null)
|
|
4121
|
+
return state;
|
|
4122
|
+
const nextRootElement = apply(currentRootElement, action.payload.operation);
|
|
4123
|
+
return currentRootElement === nextRootElement ? state : new Map(state).set(action.payload.documentKey, react.createDocument(nextRootElement));
|
|
4124
|
+
}
|
|
4125
|
+
default:
|
|
4126
|
+
return state;
|
|
4127
|
+
}
|
|
4128
|
+
}
|
|
4129
|
+
const reducer = react.combineReducers({
|
|
4130
|
+
documents: reducer$1,
|
|
4131
|
+
reactComponents: react.reducer,
|
|
4132
|
+
boxModels: boxModels.reducer,
|
|
4133
|
+
componentsMeta: react.reducer$1,
|
|
4134
|
+
propControllers: react.reducer$2
|
|
4135
|
+
});
|
|
4136
|
+
function getBoxModelsStateSlice(state) {
|
|
4137
|
+
return state.boxModels;
|
|
4138
|
+
}
|
|
4139
|
+
function getMeasurables(state) {
|
|
4140
|
+
return boxModels.getMeasurables(getBoxModelsStateSlice(state));
|
|
4141
|
+
}
|
|
4142
|
+
function getBoxModels(state) {
|
|
4143
|
+
return boxModels.getBoxModels(getBoxModelsStateSlice(state));
|
|
4144
|
+
}
|
|
4145
|
+
function getBoxModel(state, elementKey) {
|
|
4146
|
+
return boxModels.getBoxModel(getBoxModelsStateSlice(state), elementKey);
|
|
4147
|
+
}
|
|
4148
|
+
function getComponentsMetaStateSlice(state) {
|
|
4149
|
+
return state.componentsMeta;
|
|
4150
|
+
}
|
|
4151
|
+
function getComponentsMeta(state) {
|
|
4152
|
+
return react.getComponentsMeta(getComponentsMetaStateSlice(state));
|
|
4153
|
+
}
|
|
4154
|
+
function getPropControllersStateSlice(state) {
|
|
4155
|
+
return state.propControllers;
|
|
4156
|
+
}
|
|
4157
|
+
function getComponentPropControllerDescriptors(state, componentType) {
|
|
4158
|
+
return react.getComponentPropControllerDescriptors(getPropControllersStateSlice(state), componentType);
|
|
4159
|
+
}
|
|
4160
|
+
function measureElements() {
|
|
4161
|
+
return (dispatch, getState) => {
|
|
4162
|
+
const measurables = getMeasurables(getState());
|
|
4163
|
+
const currentBoxModels = getBoxModels(getState());
|
|
4164
|
+
const measuredBoxModels = new Map(Array.from(measurables.entries()).map(([elementKey, measurable]) => {
|
|
4165
|
+
const boxModel = boxModels.measure(measurable);
|
|
4166
|
+
return boxModel ? [elementKey, boxModel] : null;
|
|
4167
|
+
}).filter((entry) => entry != null));
|
|
4168
|
+
const changedBoxModels = /* @__PURE__ */ new Map();
|
|
4169
|
+
currentBoxModels.forEach((_boxModel, elementKey) => {
|
|
4170
|
+
if (!measuredBoxModels.has(elementKey))
|
|
4171
|
+
changedBoxModels.set(elementKey, null);
|
|
4172
|
+
});
|
|
4173
|
+
measuredBoxModels.forEach((measuredBoxModel, elementKey) => {
|
|
4174
|
+
const currentBoxModel = getBoxModel(getState(), elementKey);
|
|
4175
|
+
if (currentBoxModel == null || !deepEqual$1(currentBoxModel, measuredBoxModel)) {
|
|
4176
|
+
changedBoxModels.set(elementKey, measuredBoxModel);
|
|
4177
|
+
}
|
|
4178
|
+
});
|
|
4179
|
+
if (changedBoxModels.size > 0) {
|
|
4180
|
+
dispatch({
|
|
4181
|
+
type: actions.ActionTypes.CHANGE_ELEMENT_BOX_MODELS,
|
|
4182
|
+
payload: { changedElementBoxModels: changedBoxModels }
|
|
4183
|
+
});
|
|
4184
|
+
}
|
|
4185
|
+
};
|
|
4186
|
+
}
|
|
4187
|
+
function startMeasuringElements() {
|
|
4188
|
+
return (dispatch) => {
|
|
4189
|
+
let animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest);
|
|
4190
|
+
return () => {
|
|
4191
|
+
cancelAnimationFrame(animationFrameHandle);
|
|
4192
|
+
};
|
|
4193
|
+
function handleAnimationFrameRequest() {
|
|
4194
|
+
dispatch(measureElements());
|
|
4195
|
+
animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest);
|
|
4196
|
+
}
|
|
4197
|
+
};
|
|
4198
|
+
}
|
|
4199
|
+
function getElementSize(element) {
|
|
4200
|
+
return {
|
|
4201
|
+
offsetWidth: element.offsetWidth,
|
|
4202
|
+
offsetHeight: element.offsetHeight,
|
|
4203
|
+
clientWidth: element.clientWidth,
|
|
4204
|
+
clientHeight: element.clientHeight,
|
|
4205
|
+
scrollWidth: element.scrollWidth,
|
|
4206
|
+
scrollHeight: element.scrollHeight,
|
|
4207
|
+
scrollTop: element.scrollTop,
|
|
4208
|
+
scrollLeft: element.scrollLeft
|
|
4209
|
+
};
|
|
4210
|
+
}
|
|
4211
|
+
function startMeasuringDocumentElement() {
|
|
4212
|
+
return (dispatch) => {
|
|
4213
|
+
let animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest);
|
|
4214
|
+
let lastSize;
|
|
4215
|
+
return () => {
|
|
4216
|
+
cancelAnimationFrame(animationFrameHandle);
|
|
4217
|
+
};
|
|
4218
|
+
function handleAnimationFrameRequest() {
|
|
4219
|
+
const nextSize = getElementSize(window.document.documentElement);
|
|
4220
|
+
if (!deepEqual$1(lastSize, nextSize)) {
|
|
4221
|
+
lastSize = nextSize;
|
|
4222
|
+
dispatch(actions.changeDocumentElementSize(nextSize));
|
|
4223
|
+
}
|
|
4224
|
+
animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest);
|
|
4225
|
+
}
|
|
4226
|
+
};
|
|
4227
|
+
}
|
|
4228
|
+
function initialize() {
|
|
4229
|
+
return (dispatch) => {
|
|
4230
|
+
const stopMeasuringElements = dispatch(startMeasuringElements());
|
|
4231
|
+
const stopMeasuringDocumentElement = dispatch(startMeasuringDocumentElement());
|
|
4232
|
+
return () => {
|
|
4233
|
+
stopMeasuringElements();
|
|
4234
|
+
stopMeasuringDocumentElement();
|
|
4235
|
+
};
|
|
4236
|
+
};
|
|
4237
|
+
}
|
|
4238
|
+
function measureBoxModelsMiddleware() {
|
|
4239
|
+
return ({ dispatch }) => (next) => {
|
|
4240
|
+
return (action) => {
|
|
4241
|
+
switch (action.type) {
|
|
4242
|
+
case actions.ActionTypes.CHANGE_COMPONENT_HANDLE: {
|
|
4243
|
+
if (boxModels.isMeasurable(action.payload.componentHandle)) {
|
|
4244
|
+
dispatch(actions.registerMeasurable(action.payload.elementKey, action.payload.componentHandle));
|
|
4245
|
+
} else {
|
|
4246
|
+
dispatch(actions.unregisterMeasurable(action.payload.elementKey));
|
|
4247
|
+
}
|
|
4248
|
+
break;
|
|
4249
|
+
}
|
|
4250
|
+
case actions.ActionTypes.UNMOUNT_COMPONENT:
|
|
4251
|
+
dispatch(actions.unregisterMeasurable(action.payload.elementKey));
|
|
4252
|
+
break;
|
|
4253
|
+
}
|
|
4254
|
+
return next(action);
|
|
4255
|
+
};
|
|
4256
|
+
};
|
|
4257
|
+
}
|
|
4258
|
+
function messageChannelMiddleware() {
|
|
4259
|
+
return ({ dispatch, getState }) => (next) => {
|
|
4260
|
+
const messageChannel = new MessageChannel();
|
|
4261
|
+
window.parent.postMessage(messageChannel.port2, "*", [messageChannel.port2]);
|
|
4262
|
+
messageChannel.port1.onmessage = (event) => dispatch(event.data);
|
|
4263
|
+
const state = getState();
|
|
4264
|
+
const registeredComponentsMeta = getComponentsMeta(state);
|
|
4265
|
+
registeredComponentsMeta.forEach((componentMeta, componentType) => {
|
|
4266
|
+
const propControllerDescriptors = getComponentPropControllerDescriptors(state, componentType);
|
|
4267
|
+
if (propControllerDescriptors != null) {
|
|
4268
|
+
messageChannel.port1.postMessage(actions.registerComponent(componentType, componentMeta, propControllerDescriptors));
|
|
4269
|
+
}
|
|
4270
|
+
});
|
|
4271
|
+
return (action) => {
|
|
4272
|
+
switch (action.type) {
|
|
4273
|
+
case actions.ActionTypes.CHANGE_ELEMENT_BOX_MODELS:
|
|
4274
|
+
case actions.ActionTypes.MOUNT_COMPONENT:
|
|
4275
|
+
case actions.ActionTypes.UNMOUNT_COMPONENT:
|
|
4276
|
+
case actions.ActionTypes.REGISTER_COMPONENT:
|
|
4277
|
+
case actions.ActionTypes.UNREGISTER_COMPONENT:
|
|
4278
|
+
case actions.ActionTypes.CHANGE_DOCUMENT_ELEMENT_SIZE:
|
|
4279
|
+
messageChannel.port1.postMessage(action);
|
|
4280
|
+
break;
|
|
4281
|
+
case actions.ActionTypes.CHANGE_DOCUMENT_ELEMENT_SCROLL_TOP:
|
|
4282
|
+
window.document.documentElement.scrollTop = action.payload.scrollTop;
|
|
4283
|
+
break;
|
|
4284
|
+
}
|
|
4285
|
+
return next(action);
|
|
4286
|
+
};
|
|
4287
|
+
};
|
|
4288
|
+
}
|
|
4289
|
+
function configureStore({
|
|
4290
|
+
preloadedState
|
|
4291
|
+
} = {}) {
|
|
4292
|
+
return react.createStore(reducer, preloadedState, react.applyMiddleware(react.thunk, measureBoxModelsMiddleware(), messageChannelMiddleware()));
|
|
4293
|
+
}
|
|
4294
|
+
exports.createBox = boxModels.createBox;
|
|
4295
|
+
exports.getBox = boxModels.getBox;
|
|
4296
|
+
exports.parse = boxModels.parse;
|
|
4297
|
+
exports.configureStore = configureStore;
|
|
4298
|
+
exports.initialize = initialize;
|
|
4299
|
+
exports.messageChannelMiddleware = messageChannelMiddleware;
|
|
4300
|
+
exports.startMeasuringElements = startMeasuringElements;
|
|
4301
|
+
//# sourceMappingURL=react-builder-preview.cjs.js.map
|