@blackglory/match 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/LICENSE +21 -0
  3. package/README.md +273 -0
  4. package/dist/es2015/index.min.mjs +2 -0
  5. package/dist/es2015/index.min.mjs.map +1 -0
  6. package/dist/es2015/index.mjs +3918 -0
  7. package/dist/es2015/index.mjs.map +1 -0
  8. package/dist/es2015/index.umd.js +3944 -0
  9. package/dist/es2015/index.umd.js.map +1 -0
  10. package/dist/es2015/index.umd.min.js +2 -0
  11. package/dist/es2015/index.umd.min.js.map +1 -0
  12. package/dist/es2018/index.min.mjs +2 -0
  13. package/dist/es2018/index.min.mjs.map +1 -0
  14. package/dist/es2018/index.mjs +3926 -0
  15. package/dist/es2018/index.mjs.map +1 -0
  16. package/dist/es2018/index.umd.js +3952 -0
  17. package/dist/es2018/index.umd.js.map +1 -0
  18. package/dist/es2018/index.umd.min.js +2 -0
  19. package/dist/es2018/index.umd.min.js.map +1 -0
  20. package/lib/es2015/index.d.ts +17 -0
  21. package/lib/es2015/index.js +38 -0
  22. package/lib/es2015/index.js.map +1 -0
  23. package/lib/es2015/match-element.d.ts +4 -0
  24. package/lib/es2015/match-element.js +22 -0
  25. package/lib/es2015/match-element.js.map +1 -0
  26. package/lib/es2015/match.d.ts +4 -0
  27. package/lib/es2015/match.js +22 -0
  28. package/lib/es2015/match.js.map +1 -0
  29. package/lib/es2015/matchers/any-of.d.ts +6 -0
  30. package/lib/es2015/matchers/any-of.js +10 -0
  31. package/lib/es2015/matchers/any-of.js.map +1 -0
  32. package/lib/es2015/matchers/child-nodes.d.ts +2 -0
  33. package/lib/es2015/matchers/child-nodes.js +23 -0
  34. package/lib/es2015/matchers/child-nodes.js.map +1 -0
  35. package/lib/es2015/matchers/children.d.ts +2 -0
  36. package/lib/es2015/matchers/children.js +23 -0
  37. package/lib/es2015/matchers/children.js.map +1 -0
  38. package/lib/es2015/matchers/css.d.ts +3 -0
  39. package/lib/es2015/matchers/css.js +18 -0
  40. package/lib/es2015/matchers/css.js.map +1 -0
  41. package/lib/es2015/matchers/element.d.ts +4 -0
  42. package/lib/es2015/matchers/element.js +34 -0
  43. package/lib/es2015/matchers/element.js.map +1 -0
  44. package/lib/es2015/matchers/multiple.d.ts +10 -0
  45. package/lib/es2015/matchers/multiple.js +42 -0
  46. package/lib/es2015/matchers/multiple.js.map +1 -0
  47. package/lib/es2015/matchers/node.d.ts +4 -0
  48. package/lib/es2015/matchers/node.js +31 -0
  49. package/lib/es2015/matchers/node.js.map +1 -0
  50. package/lib/es2015/matchers/optional.d.ts +2 -0
  51. package/lib/es2015/matchers/optional.js +9 -0
  52. package/lib/es2015/matchers/optional.js.map +1 -0
  53. package/lib/es2015/matchers/repeat.d.ts +2 -0
  54. package/lib/es2015/matchers/repeat.js +20 -0
  55. package/lib/es2015/matchers/repeat.js.map +1 -0
  56. package/lib/es2015/matchers/tap.d.ts +2 -0
  57. package/lib/es2015/matchers/tap.js +12 -0
  58. package/lib/es2015/matchers/tap.js.map +1 -0
  59. package/lib/es2015/matchers/text-content-equals.d.ts +7 -0
  60. package/lib/es2015/matchers/text-content-equals.js +20 -0
  61. package/lib/es2015/matchers/text-content-equals.js.map +1 -0
  62. package/lib/es2015/matchers/text-content-includes.d.ts +7 -0
  63. package/lib/es2015/matchers/text-content-includes.js +20 -0
  64. package/lib/es2015/matchers/text-content-includes.js.map +1 -0
  65. package/lib/es2015/matchers/text-content-matches.d.ts +6 -0
  66. package/lib/es2015/matchers/text-content-matches.js +16 -0
  67. package/lib/es2015/matchers/text-content-matches.js.map +1 -0
  68. package/lib/es2015/matchers/text-node.d.ts +4 -0
  69. package/lib/es2015/matchers/text-node.js +34 -0
  70. package/lib/es2015/matchers/text-node.js.map +1 -0
  71. package/lib/es2015/matchers/xpath.d.ts +3 -0
  72. package/lib/es2015/matchers/xpath.js +34 -0
  73. package/lib/es2015/matchers/xpath.js.map +1 -0
  74. package/lib/es2015/types.d.ts +18 -0
  75. package/lib/es2015/types.js +3 -0
  76. package/lib/es2015/types.js.map +1 -0
  77. package/lib/es2015/utils/concat.d.ts +1 -0
  78. package/lib/es2015/utils/concat.js +14 -0
  79. package/lib/es2015/utils/concat.js.map +1 -0
  80. package/lib/es2015/utils/match-multiple.d.ts +2 -0
  81. package/lib/es2015/utils/match-multiple.js +21 -0
  82. package/lib/es2015/utils/match-multiple.js.map +1 -0
  83. package/lib/es2015/utils/match-one-by-one.d.ts +2 -0
  84. package/lib/es2015/utils/match-one-by-one.js +38 -0
  85. package/lib/es2015/utils/match-one-by-one.js.map +1 -0
  86. package/lib/es2015/utils/merge.d.ts +5 -0
  87. package/lib/es2015/utils/merge.js +30 -0
  88. package/lib/es2015/utils/merge.js.map +1 -0
  89. package/lib/es2015/utils/next-element-sibling.d.ts +1 -0
  90. package/lib/es2015/utils/next-element-sibling.js +11 -0
  91. package/lib/es2015/utils/next-element-sibling.js.map +1 -0
  92. package/lib/es2015/utils/next-sibling.d.ts +1 -0
  93. package/lib/es2015/utils/next-sibling.js +11 -0
  94. package/lib/es2015/utils/next-sibling.js.map +1 -0
  95. package/lib/es2018/index.d.ts +17 -0
  96. package/lib/es2018/index.js +38 -0
  97. package/lib/es2018/index.js.map +1 -0
  98. package/lib/es2018/match-element.d.ts +4 -0
  99. package/lib/es2018/match-element.js +22 -0
  100. package/lib/es2018/match-element.js.map +1 -0
  101. package/lib/es2018/match.d.ts +4 -0
  102. package/lib/es2018/match.js +22 -0
  103. package/lib/es2018/match.js.map +1 -0
  104. package/lib/es2018/matchers/any-of.d.ts +6 -0
  105. package/lib/es2018/matchers/any-of.js +10 -0
  106. package/lib/es2018/matchers/any-of.js.map +1 -0
  107. package/lib/es2018/matchers/child-nodes.d.ts +2 -0
  108. package/lib/es2018/matchers/child-nodes.js +27 -0
  109. package/lib/es2018/matchers/child-nodes.js.map +1 -0
  110. package/lib/es2018/matchers/children.d.ts +2 -0
  111. package/lib/es2018/matchers/children.js +27 -0
  112. package/lib/es2018/matchers/children.js.map +1 -0
  113. package/lib/es2018/matchers/css.d.ts +3 -0
  114. package/lib/es2018/matchers/css.js +18 -0
  115. package/lib/es2018/matchers/css.js.map +1 -0
  116. package/lib/es2018/matchers/element.d.ts +4 -0
  117. package/lib/es2018/matchers/element.js +34 -0
  118. package/lib/es2018/matchers/element.js.map +1 -0
  119. package/lib/es2018/matchers/multiple.d.ts +10 -0
  120. package/lib/es2018/matchers/multiple.js +42 -0
  121. package/lib/es2018/matchers/multiple.js.map +1 -0
  122. package/lib/es2018/matchers/node.d.ts +4 -0
  123. package/lib/es2018/matchers/node.js +31 -0
  124. package/lib/es2018/matchers/node.js.map +1 -0
  125. package/lib/es2018/matchers/optional.d.ts +2 -0
  126. package/lib/es2018/matchers/optional.js +9 -0
  127. package/lib/es2018/matchers/optional.js.map +1 -0
  128. package/lib/es2018/matchers/repeat.d.ts +2 -0
  129. package/lib/es2018/matchers/repeat.js +20 -0
  130. package/lib/es2018/matchers/repeat.js.map +1 -0
  131. package/lib/es2018/matchers/tap.d.ts +2 -0
  132. package/lib/es2018/matchers/tap.js +12 -0
  133. package/lib/es2018/matchers/tap.js.map +1 -0
  134. package/lib/es2018/matchers/text-content-equals.d.ts +7 -0
  135. package/lib/es2018/matchers/text-content-equals.js +20 -0
  136. package/lib/es2018/matchers/text-content-equals.js.map +1 -0
  137. package/lib/es2018/matchers/text-content-includes.d.ts +7 -0
  138. package/lib/es2018/matchers/text-content-includes.js +20 -0
  139. package/lib/es2018/matchers/text-content-includes.js.map +1 -0
  140. package/lib/es2018/matchers/text-content-matches.d.ts +6 -0
  141. package/lib/es2018/matchers/text-content-matches.js +16 -0
  142. package/lib/es2018/matchers/text-content-matches.js.map +1 -0
  143. package/lib/es2018/matchers/text-node.d.ts +4 -0
  144. package/lib/es2018/matchers/text-node.js +34 -0
  145. package/lib/es2018/matchers/text-node.js.map +1 -0
  146. package/lib/es2018/matchers/xpath.d.ts +3 -0
  147. package/lib/es2018/matchers/xpath.js +34 -0
  148. package/lib/es2018/matchers/xpath.js.map +1 -0
  149. package/lib/es2018/types.d.ts +18 -0
  150. package/lib/es2018/types.js +3 -0
  151. package/lib/es2018/types.js.map +1 -0
  152. package/lib/es2018/utils/concat.d.ts +1 -0
  153. package/lib/es2018/utils/concat.js +14 -0
  154. package/lib/es2018/utils/concat.js.map +1 -0
  155. package/lib/es2018/utils/match-multiple.d.ts +2 -0
  156. package/lib/es2018/utils/match-multiple.js +21 -0
  157. package/lib/es2018/utils/match-multiple.js.map +1 -0
  158. package/lib/es2018/utils/match-one-by-one.d.ts +2 -0
  159. package/lib/es2018/utils/match-one-by-one.js +38 -0
  160. package/lib/es2018/utils/match-one-by-one.js.map +1 -0
  161. package/lib/es2018/utils/merge.d.ts +5 -0
  162. package/lib/es2018/utils/merge.js +30 -0
  163. package/lib/es2018/utils/merge.js.map +1 -0
  164. package/lib/es2018/utils/next-element-sibling.d.ts +1 -0
  165. package/lib/es2018/utils/next-element-sibling.js +11 -0
  166. package/lib/es2018/utils/next-element-sibling.js.map +1 -0
  167. package/lib/es2018/utils/next-sibling.d.ts +1 -0
  168. package/lib/es2018/utils/next-sibling.js +11 -0
  169. package/lib/es2018/utils/next-sibling.js.map +1 -0
  170. package/package.json +78 -0
@@ -0,0 +1,3926 @@
1
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
2
+
3
+ var es2018$6 = {};
4
+
5
+ var flatMap$1 = {};
6
+
7
+ var utils$1 = {};
8
+
9
+ utils$1.copyNodesToChildNodes = utils$1.cloneNodes = utils$1.clone = void 0;
10
+ function clone(node) {
11
+ return node.cloneNode(true);
12
+ }
13
+ utils$1.clone = clone;
14
+ function cloneNodes(nodes) {
15
+ return nodes.map(x => clone(x));
16
+ }
17
+ utils$1.cloneNodes = cloneNodes;
18
+ function copyNodesToChildNodes(nodes, node) {
19
+ nodes.forEach(x => node.appendChild(x));
20
+ }
21
+ utils$1.copyNodesToChildNodes = copyNodesToChildNodes;
22
+
23
+ var removeAllChildren$1 = {};
24
+
25
+ removeAllChildren$1.removeAllChildren = void 0;
26
+ function removeAllChildren(node) {
27
+ while (node.firstChild) {
28
+ node.removeChild(node.firstChild);
29
+ }
30
+ }
31
+ removeAllChildren$1.removeAllChildren = removeAllChildren;
32
+
33
+ flatMap$1.flatMap = void 0;
34
+ const utils_1$5 = utils$1;
35
+ const remove_all_children_1 = removeAllChildren$1;
36
+ function flatMap(node, fn) {
37
+ const newNodes = (0, utils_1$5.cloneNodes)(fn((0, utils_1$5.clone)(node)));
38
+ return newNodes.map(node => {
39
+ const newChildNodes = [];
40
+ for (const childNode of node.childNodes) {
41
+ newChildNodes.push(...(0, utils_1$5.cloneNodes)(flatMap(childNode, fn)));
42
+ }
43
+ (0, remove_all_children_1.removeAllChildren)(node);
44
+ (0, utils_1$5.copyNodesToChildNodes)(newChildNodes, node);
45
+ return node;
46
+ });
47
+ }
48
+ flatMap$1.flatMap = flatMap;
49
+
50
+ var map$3 = {};
51
+
52
+ map$3.map = void 0;
53
+ const utils_1$4 = utils$1;
54
+ function map$2(node, fn) {
55
+ const newNode = (0, utils_1$4.clone)(fn((0, utils_1$4.clone)(node)));
56
+ for (const node of newNode.childNodes) {
57
+ newNode.replaceChild(map$2(node, fn), node);
58
+ }
59
+ return newNode;
60
+ }
61
+ map$3.map = map$2;
62
+
63
+ var filter$3 = {};
64
+
65
+ filter$3.filter = void 0;
66
+ const flat_map_1$1 = flatMap$1;
67
+ function filter$2(node, predicate) {
68
+ const results = (0, flat_map_1$1.flatMap)(node, node => {
69
+ if (predicate(node)) {
70
+ return [node];
71
+ }
72
+ else {
73
+ return [];
74
+ }
75
+ });
76
+ if (results.length === 1)
77
+ return results[0];
78
+ return undefined;
79
+ }
80
+ filter$3.filter = filter$2;
81
+
82
+ var unwrap$1 = {};
83
+
84
+ var es2018$5 = {};
85
+
86
+ var middleware = {};
87
+
88
+ var chunkAsync$1 = {};
89
+
90
+ var es2018$4 = {};
91
+
92
+ var go$1 = {};
93
+
94
+ go$1.go = void 0;
95
+ function go(fn) {
96
+ return fn();
97
+ }
98
+ go$1.go = go;
99
+
100
+ (function (exports) {
101
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
102
+ if (k2 === undefined) k2 = k;
103
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
104
+ }) : (function(o, m, k, k2) {
105
+ if (k2 === undefined) k2 = k;
106
+ o[k2] = m[k];
107
+ }));
108
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
109
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
110
+ };__exportStar(go$1, exports);
111
+
112
+ }(es2018$4));
113
+
114
+ var es2018$3 = {};
115
+
116
+ var customError = {};
117
+
118
+ customError.CustomError = void 0;
119
+ class CustomError extends Error {
120
+ get name() {
121
+ return this.constructor.name;
122
+ }
123
+ }
124
+ customError.CustomError = CustomError;
125
+
126
+ var expectedError = {};
127
+
128
+ expectedError.ExpectedError = void 0;
129
+ const custom_error_1$1 = customError;
130
+ class ExpectedError extends custom_error_1$1.CustomError {
131
+ }
132
+ expectedError.ExpectedError = ExpectedError;
133
+
134
+ var assertionError = {};
135
+
136
+ assertionError.AssertionError = void 0;
137
+ const custom_error_1 = customError;
138
+ class AssertionError extends custom_error_1.CustomError {
139
+ }
140
+ assertionError.AssertionError = AssertionError;
141
+
142
+ var normalize$3 = {};
143
+
144
+ normalize$3.normalize = void 0;
145
+ function normalize$2(err) {
146
+ var _a;
147
+ return {
148
+ name: err.name,
149
+ message: err.message,
150
+ stack: (_a = err.stack) !== null && _a !== void 0 ? _a : null
151
+ };
152
+ }
153
+ normalize$3.normalize = normalize$2;
154
+
155
+ var refute$1 = {};
156
+
157
+ refute$1.refute = void 0;
158
+ const expected_error_1 = expectedError;
159
+ function refute(condition, message) {
160
+ if (condition)
161
+ throw new expected_error_1.ExpectedError(message);
162
+ }
163
+ refute$1.refute = refute;
164
+
165
+ var assert$1 = {};
166
+
167
+ assert$1.assert = void 0;
168
+ const assertion_error_1 = assertionError;
169
+ function assert(condition, message) {
170
+ if (!condition)
171
+ throw new assertion_error_1.AssertionError(message);
172
+ }
173
+ assert$1.assert = assert;
174
+
175
+ (function (exports) {
176
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
177
+ if (k2 === undefined) k2 = k;
178
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
179
+ }) : (function(o, m, k, k2) {
180
+ if (k2 === undefined) k2 = k;
181
+ o[k2] = m[k];
182
+ }));
183
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
184
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
185
+ };__exportStar(customError, exports);
186
+ __exportStar(expectedError, exports);
187
+ __exportStar(assertionError, exports);
188
+ __exportStar(normalize$3, exports);
189
+ __exportStar(refute$1, exports);
190
+ __exportStar(assert$1, exports);
191
+
192
+ }(es2018$3));
193
+
194
+ chunkAsync$1.chunkAsync = void 0;
195
+ const go_1$f = es2018$4;
196
+ const errors_1$m = es2018$3;
197
+ function chunkAsync(iterable, size) {
198
+ (0, errors_1$m.assert)(Number.isInteger(size), 'The parameter size must be an integer');
199
+ (0, errors_1$m.assert)(size > 0, 'The parameter size must be greater than 0');
200
+ return (0, go_1$f.go)(async function* () {
201
+ let buffer = [];
202
+ for await (const element of iterable) {
203
+ buffer.push(element);
204
+ if (buffer.length >= size) {
205
+ yield buffer;
206
+ buffer = [];
207
+ }
208
+ }
209
+ if (buffer.length)
210
+ yield buffer;
211
+ });
212
+ }
213
+ chunkAsync$1.chunkAsync = chunkAsync;
214
+
215
+ var chunkByAsync$1 = {};
216
+
217
+ var es2018$2 = {};
218
+
219
+ var array = {};
220
+
221
+ array.isntEmptyArray = array.isEmptyArray = array.isntArray = array.isArray = void 0;
222
+ function isArray(val) {
223
+ return Array.isArray(val);
224
+ }
225
+ array.isArray = isArray;
226
+ function isntArray(val) {
227
+ return !isArray(val);
228
+ }
229
+ array.isntArray = isntArray;
230
+ function isEmptyArray(val) {
231
+ return val.length === 0;
232
+ }
233
+ array.isEmptyArray = isEmptyArray;
234
+ function isntEmptyArray(val) {
235
+ return val.length !== 0;
236
+ }
237
+ array.isntEmptyArray = isntEmptyArray;
238
+
239
+ var asyncIterable = {};
240
+
241
+ var _null = {};
242
+
243
+ _null.isntNull = _null.isNull = void 0;
244
+ function isNull(val) {
245
+ return val === null;
246
+ }
247
+ _null.isNull = isNull;
248
+ function isntNull(val) {
249
+ return !isNull(val);
250
+ }
251
+ _null.isntNull = isntNull;
252
+
253
+ var _undefined = {};
254
+
255
+ _undefined.isntUndefined = _undefined.isUndefined = void 0;
256
+ function isUndefined(val) {
257
+ return val === undefined;
258
+ }
259
+ _undefined.isUndefined = isUndefined;
260
+ function isntUndefined(val) {
261
+ return !isUndefined(val);
262
+ }
263
+ _undefined.isntUndefined = isntUndefined;
264
+
265
+ asyncIterable.isntAsyncIterable = asyncIterable.isAsyncIterable = void 0;
266
+ const null_1$1 = _null;
267
+ const undefined_1$2 = _undefined;
268
+ function isAsyncIterable(val) {
269
+ return (0, null_1$1.isntNull)(val)
270
+ && (0, undefined_1$2.isntUndefined)(val)
271
+ && typeof val[Symbol.asyncIterator] === 'function';
272
+ }
273
+ asyncIterable.isAsyncIterable = isAsyncIterable;
274
+ function isntAsyncIterable(val) {
275
+ return !isAsyncIterable(val);
276
+ }
277
+ asyncIterable.isntAsyncIterable = isntAsyncIterable;
278
+
279
+ var bigint = {};
280
+
281
+ bigint.isntBigInt = bigint.isBigInt = void 0;
282
+ function isBigInt(val) {
283
+ return typeof val === 'bigint';
284
+ }
285
+ bigint.isBigInt = isBigInt;
286
+ function isntBigInt(val) {
287
+ return !isBigInt(val);
288
+ }
289
+ bigint.isntBigInt = isntBigInt;
290
+
291
+ var boolean = {};
292
+
293
+ boolean.isntBoolean = boolean.isBoolean = void 0;
294
+ function isBoolean(val) {
295
+ return typeof val === 'boolean';
296
+ }
297
+ boolean.isBoolean = isBoolean;
298
+ function isntBoolean(val) {
299
+ return !isBoolean(val);
300
+ }
301
+ boolean.isntBoolean = isntBoolean;
302
+
303
+ var char = {};
304
+
305
+ var string = {};
306
+
307
+ string.isntString = string.isString = void 0;
308
+ function isString(val) {
309
+ return typeof val === 'string';
310
+ }
311
+ string.isString = isString;
312
+ function isntString(val) {
313
+ return !isString(val);
314
+ }
315
+ string.isntString = isntString;
316
+
317
+ char.isntChar = char.isChar = void 0;
318
+ const string_1$1 = string;
319
+ function isChar(val) {
320
+ return (0, string_1$1.isString)(val)
321
+ && val.length === 1;
322
+ }
323
+ char.isChar = isChar;
324
+ function isntChar(val) {
325
+ return !isChar(val);
326
+ }
327
+ char.isntChar = isntChar;
328
+
329
+ var date = {};
330
+
331
+ date.isntDate = date.isDate = void 0;
332
+ function isDate(val) {
333
+ return val instanceof Date;
334
+ }
335
+ date.isDate = isDate;
336
+ function isntDate(val) {
337
+ return !isDate(val);
338
+ }
339
+ date.isntDate = isntDate;
340
+
341
+ var _enum = {};
342
+
343
+ _enum.inEnum = void 0;
344
+ function inEnum(val, _enum) {
345
+ return Object.values(_enum).includes(val);
346
+ }
347
+ _enum.inEnum = inEnum;
348
+
349
+ var error = {};
350
+
351
+ error.isntError = error.isError = void 0;
352
+ function isError(val) {
353
+ return val instanceof Error;
354
+ }
355
+ error.isError = isError;
356
+ function isntError(val) {
357
+ return !isError(val);
358
+ }
359
+ error.isntError = isntError;
360
+
361
+ var falsy = {};
362
+
363
+ falsy.isntFalsy = falsy.isFalsy = void 0;
364
+ function isFalsy(val) {
365
+ return !val;
366
+ }
367
+ falsy.isFalsy = isFalsy;
368
+ function isntFalsy(val) {
369
+ return !isFalsy(val);
370
+ }
371
+ falsy.isntFalsy = isntFalsy;
372
+
373
+ var _function = {};
374
+
375
+ _function.isntFunction = _function.isFunction = void 0;
376
+ function isFunction(val) {
377
+ return typeof val === 'function';
378
+ }
379
+ _function.isFunction = isFunction;
380
+ function isntFunction(val) {
381
+ return !isFunction(val);
382
+ }
383
+ _function.isntFunction = isntFunction;
384
+
385
+ var iterable = {};
386
+
387
+ iterable.isntIterable = iterable.isIterable = void 0;
388
+ const null_1 = _null;
389
+ const undefined_1$1 = _undefined;
390
+ function isIterable(val) {
391
+ return (0, null_1.isntNull)(val)
392
+ && (0, undefined_1$1.isntUndefined)(val)
393
+ && typeof val[Symbol.iterator] === 'function';
394
+ }
395
+ iterable.isIterable = isIterable;
396
+ function isntIterable(val) {
397
+ return !isIterable(val);
398
+ }
399
+ iterable.isntIterable = isntIterable;
400
+
401
+ var jsonRpc = {};
402
+
403
+ var object = {};
404
+
405
+ object.isntEmptyObject = object.isEmptyObject = object.isRecord = object.isntObject = object.isObject = void 0;
406
+ function isObject$1(val) {
407
+ return val !== null && typeof val === 'object';
408
+ }
409
+ object.isObject = isObject$1;
410
+ function isntObject(val) {
411
+ return !isObject$1(val);
412
+ }
413
+ object.isntObject = isntObject;
414
+ function isRecord(val) {
415
+ return isObject$1(val);
416
+ }
417
+ object.isRecord = isRecord;
418
+ function isEmptyObject(val) {
419
+ return Object.keys(val).length === 0;
420
+ }
421
+ object.isEmptyObject = isEmptyObject;
422
+ function isntEmptyObject(val) {
423
+ return Object.keys(val).length !== 0;
424
+ }
425
+ object.isntEmptyObject = isntEmptyObject;
426
+
427
+ var number = {};
428
+
429
+ number.isntNumber = number.isNumber = void 0;
430
+ function isNumber(val) {
431
+ return typeof val === 'number';
432
+ }
433
+ number.isNumber = isNumber;
434
+ function isntNumber(val) {
435
+ return !isNumber(val);
436
+ }
437
+ number.isntNumber = isntNumber;
438
+
439
+ jsonRpc.isntJsonRpcError = jsonRpc.isJsonRpcError = jsonRpc.isntJsonRpcSuccess = jsonRpc.isJsonRpcSuccess = jsonRpc.isntJsonRpcRequest = jsonRpc.isJsonRpcRequest = jsonRpc.isntJsonRpcNotification = jsonRpc.isJsonRpcNotification = void 0;
440
+ const array_1 = array;
441
+ const object_1 = object;
442
+ const string_1 = string;
443
+ const number_1 = number;
444
+ const undefined_1 = _undefined;
445
+ function isJsonRpcId(val) {
446
+ return (0, string_1.isString)(val) || (0, number_1.isNumber)(val);
447
+ }
448
+ function isJsonRpcParams(val) {
449
+ return (0, array_1.isArray)(val) || (0, object_1.isObject)(val);
450
+ }
451
+ function isJsonRpcNotification(val) {
452
+ return (0, object_1.isRecord)(val)
453
+ && (0, string_1.isString)(val.jsonrpc)
454
+ && (0, string_1.isString)(val.method)
455
+ && (0, undefined_1.isUndefined)(val.id)
456
+ && isJsonRpcParams(val.params);
457
+ }
458
+ jsonRpc.isJsonRpcNotification = isJsonRpcNotification;
459
+ function isntJsonRpcNotification(val) {
460
+ return !isJsonRpcNotification(val);
461
+ }
462
+ jsonRpc.isntJsonRpcNotification = isntJsonRpcNotification;
463
+ function isJsonRpcRequest(val) {
464
+ return (0, object_1.isRecord)(val)
465
+ && (0, string_1.isString)(val.jsonrpc)
466
+ && (0, string_1.isString)(val.method)
467
+ && isJsonRpcId(val.id)
468
+ && isJsonRpcParams(val.params);
469
+ }
470
+ jsonRpc.isJsonRpcRequest = isJsonRpcRequest;
471
+ function isntJsonRpcRequest(val) {
472
+ return !isJsonRpcRequest(val);
473
+ }
474
+ jsonRpc.isntJsonRpcRequest = isntJsonRpcRequest;
475
+ function isJsonRpcSuccess(val) {
476
+ return (0, object_1.isRecord)(val)
477
+ && (0, string_1.isString)(val.jsonrpc)
478
+ && (0, string_1.isString)(val.id)
479
+ && (0, undefined_1.isntUndefined)(val.result);
480
+ }
481
+ jsonRpc.isJsonRpcSuccess = isJsonRpcSuccess;
482
+ function isntJsonRpcSuccess(val) {
483
+ return !isJsonRpcSuccess(val);
484
+ }
485
+ jsonRpc.isntJsonRpcSuccess = isntJsonRpcSuccess;
486
+ function isJsonRpcError(val) {
487
+ return (0, object_1.isRecord)(val)
488
+ && (0, string_1.isString)(val.jsonrpc)
489
+ && isJsonRpcId(val.id)
490
+ && isJsonRpcErrorObject(val.error);
491
+ }
492
+ jsonRpc.isJsonRpcError = isJsonRpcError;
493
+ function isntJsonRpcError(val) {
494
+ return !isJsonRpcError(val);
495
+ }
496
+ jsonRpc.isntJsonRpcError = isntJsonRpcError;
497
+ function isJsonRpcErrorObject(val) {
498
+ return (0, object_1.isRecord)(val)
499
+ && (0, number_1.isNumber)(val.code)
500
+ && (0, string_1.isString)(val.message)
501
+ && ((0, undefined_1.isUndefined)(val.data) || (0, object_1.isObject)(val.data));
502
+ }
503
+
504
+ var json = {};
505
+
506
+ json.isntJson = json.isJson = void 0;
507
+ function isJson(val) {
508
+ try {
509
+ JSON.stringify(val);
510
+ return true;
511
+ }
512
+ catch (_a) {
513
+ return false;
514
+ }
515
+ }
516
+ json.isJson = isJson;
517
+ function isntJson(val) {
518
+ return !isntJson();
519
+ }
520
+ json.isntJson = isntJson;
521
+
522
+ var url = {};
523
+
524
+ url.isAbsoluteURL = void 0;
525
+ function isAbsoluteURL(str) {
526
+ try {
527
+ new URL(str);
528
+ return true;
529
+ }
530
+ catch (_a) {
531
+ return false;
532
+ }
533
+ }
534
+ url.isAbsoluteURL = isAbsoluteURL;
535
+
536
+ (function (exports) {
537
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
538
+ if (k2 === undefined) k2 = k;
539
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
540
+ }) : (function(o, m, k, k2) {
541
+ if (k2 === undefined) k2 = k;
542
+ o[k2] = m[k];
543
+ }));
544
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
545
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
546
+ };__exportStar(array, exports);
547
+ __exportStar(asyncIterable, exports);
548
+ __exportStar(bigint, exports);
549
+ __exportStar(boolean, exports);
550
+ __exportStar(char, exports);
551
+ __exportStar(date, exports);
552
+ __exportStar(_enum, exports);
553
+ __exportStar(error, exports);
554
+ __exportStar(falsy, exports);
555
+ __exportStar(_function, exports);
556
+ __exportStar(iterable, exports);
557
+ __exportStar(jsonRpc, exports);
558
+ __exportStar(json, exports);
559
+ __exportStar(_null, exports);
560
+ __exportStar(number, exports);
561
+ __exportStar(object, exports);
562
+ __exportStar(string, exports);
563
+ __exportStar(_undefined, exports);
564
+ __exportStar(url, exports);
565
+
566
+ }(es2018$2));
567
+
568
+ chunkByAsync$1.chunkByAsync = void 0;
569
+ const types_1$l = es2018$2;
570
+ function chunkByAsync(iterable, predicate) {
571
+ if ((0, types_1$l.isAsyncIterable)(iterable)) {
572
+ return chunkByAsyncIterable(iterable);
573
+ }
574
+ else {
575
+ return chunkByIterable(iterable);
576
+ }
577
+ async function* chunkByAsyncIterable(iterable) {
578
+ let buffer = [];
579
+ let index = 0;
580
+ for await (const element of iterable) {
581
+ buffer.push(element);
582
+ if (await predicate(element, index)) {
583
+ yield buffer;
584
+ buffer = [];
585
+ }
586
+ index++;
587
+ }
588
+ if (buffer.length)
589
+ yield buffer;
590
+ }
591
+ async function* chunkByIterable(iterable) {
592
+ let buffer = [];
593
+ let index = 0;
594
+ for (const element of iterable) {
595
+ buffer.push(element);
596
+ if (await predicate(element, index)) {
597
+ yield buffer;
598
+ buffer = [];
599
+ }
600
+ index++;
601
+ }
602
+ if (buffer.length)
603
+ yield buffer;
604
+ }
605
+ }
606
+ chunkByAsync$1.chunkByAsync = chunkByAsync;
607
+
608
+ var chunkBy$1 = {};
609
+
610
+ chunkBy$1.chunkBy = void 0;
611
+ function* chunkBy(iterable, predicate) {
612
+ let buffer = [];
613
+ let index = 0;
614
+ for (const element of iterable) {
615
+ buffer.push(element);
616
+ if (predicate(element, index)) {
617
+ yield buffer;
618
+ buffer = [];
619
+ }
620
+ index++;
621
+ }
622
+ if (buffer.length)
623
+ yield buffer;
624
+ }
625
+ chunkBy$1.chunkBy = chunkBy;
626
+
627
+ var chunk$1 = {};
628
+
629
+ chunk$1.chunk = void 0;
630
+ const go_1$e = es2018$4;
631
+ const errors_1$l = es2018$3;
632
+ function chunk(iterable, size) {
633
+ (0, errors_1$l.assert)(Number.isInteger(size), 'The parameter size must be an integer');
634
+ (0, errors_1$l.assert)(size > 0, 'The parameter size must be greater than 0');
635
+ return (0, go_1$e.go)(function* () {
636
+ let buffer = [];
637
+ for (const element of iterable) {
638
+ buffer.push(element);
639
+ if (buffer.length >= size) {
640
+ yield buffer;
641
+ buffer = [];
642
+ }
643
+ }
644
+ if (buffer.length)
645
+ yield buffer;
646
+ });
647
+ }
648
+ chunk$1.chunk = chunk;
649
+
650
+ var concatAsync$1 = {};
651
+
652
+ concatAsync$1.concatAsync = void 0;
653
+ const types_1$k = es2018$2;
654
+ const go_1$d = es2018$4;
655
+ function concatAsync(iterable, ...otherIterables) {
656
+ return (0, go_1$d.go)(async function* () {
657
+ for (const iter of [iterable, ...otherIterables]) {
658
+ if ((0, types_1$k.isAsyncIterable)(iter)) {
659
+ for await (const element of iter) {
660
+ yield element;
661
+ }
662
+ }
663
+ else {
664
+ for (const element of iter) {
665
+ yield element;
666
+ }
667
+ }
668
+ }
669
+ });
670
+ }
671
+ concatAsync$1.concatAsync = concatAsync;
672
+
673
+ var concat$2 = {};
674
+
675
+ concat$2.concat = void 0;
676
+ const go_1$c = es2018$4;
677
+ function concat$1(iterable, ...otherIterables) {
678
+ return (0, go_1$c.go)(function* () {
679
+ for (const iter of [iterable, ...otherIterables]) {
680
+ yield* iter;
681
+ }
682
+ });
683
+ }
684
+ concat$2.concat = concat$1;
685
+
686
+ var dropAsync$1 = {};
687
+
688
+ var utils = {};
689
+
690
+ utils.copyIterable = utils.copyAsyncIterable = void 0;
691
+ async function* copyAsyncIterable(iterable) {
692
+ for await (const element of iterable) {
693
+ yield element;
694
+ }
695
+ }
696
+ utils.copyAsyncIterable = copyAsyncIterable;
697
+ function* copyIterable(iterable) {
698
+ for (const element of iterable) {
699
+ yield element;
700
+ }
701
+ }
702
+ utils.copyIterable = copyIterable;
703
+
704
+ dropAsync$1.dropAsync = void 0;
705
+ const go_1$b = es2018$4;
706
+ const utils_1$3 = utils;
707
+ const errors_1$k = es2018$3;
708
+ function dropAsync(iterable, count) {
709
+ (0, errors_1$k.assert)(Number.isInteger(count), 'The parameter count must be an integer');
710
+ (0, errors_1$k.assert)(count >= 0, 'The parameter count must be greater than or equal to 0');
711
+ if (count === 0)
712
+ return (0, utils_1$3.copyAsyncIterable)(iterable);
713
+ return (0, go_1$b.go)(async function* () {
714
+ var _a;
715
+ const iterator = iterable[Symbol.asyncIterator]();
716
+ let done;
717
+ try {
718
+ let value;
719
+ while ({ value, done } = await iterator.next(), !done) {
720
+ if (count <= 0)
721
+ break;
722
+ count--;
723
+ }
724
+ while (!done) {
725
+ yield value;
726
+ ({ value, done } = await iterator.next());
727
+ }
728
+ }
729
+ finally {
730
+ if (!done)
731
+ await ((_a = iterator.return) === null || _a === void 0 ? void 0 : _a.call(iterator));
732
+ }
733
+ });
734
+ }
735
+ dropAsync$1.dropAsync = dropAsync;
736
+
737
+ var dropRightAsync$1 = {};
738
+
739
+ dropRightAsync$1.dropRightAsync = void 0;
740
+ const go_1$a = es2018$4;
741
+ const utils_1$2 = utils;
742
+ const errors_1$j = es2018$3;
743
+ function dropRightAsync(iterable, count) {
744
+ (0, errors_1$j.assert)(Number.isInteger(count), 'The parameter count must be an integer');
745
+ (0, errors_1$j.assert)(count >= 0, 'The parameter count must be greater than or equal to 0');
746
+ if (count === 0)
747
+ return (0, utils_1$2.copyAsyncIterable)(iterable);
748
+ return (0, go_1$a.go)(async function* () {
749
+ const arr = await toArrayAsync$2(iterable);
750
+ const result = arr.slice(0, -count);
751
+ for (const value of result) {
752
+ yield value;
753
+ }
754
+ });
755
+ }
756
+ dropRightAsync$1.dropRightAsync = dropRightAsync;
757
+ async function toArrayAsync$2(iterable) {
758
+ const result = [];
759
+ for await (const element of iterable) {
760
+ result.push(element);
761
+ }
762
+ return result;
763
+ }
764
+
765
+ var dropRight$1 = {};
766
+
767
+ dropRight$1.dropRight = void 0;
768
+ const go_1$9 = es2018$4;
769
+ const utils_1$1 = utils;
770
+ const errors_1$i = es2018$3;
771
+ function dropRight(iterable, count) {
772
+ (0, errors_1$i.assert)(Number.isInteger(count), 'The parameter count must be an integer');
773
+ (0, errors_1$i.assert)(count >= 0, 'The parameter count must be greater than or equal to 0');
774
+ if (count === 0)
775
+ return (0, utils_1$1.copyIterable)(iterable);
776
+ return (0, go_1$9.go)(function* () {
777
+ const arr = Array.from(iterable);
778
+ yield* arr.slice(0, -count);
779
+ });
780
+ }
781
+ dropRight$1.dropRight = dropRight;
782
+
783
+ var dropUntilAsync$1 = {};
784
+
785
+ dropUntilAsync$1.dropUntilAsync = void 0;
786
+ const types_1$j = es2018$2;
787
+ function dropUntilAsync(iterable, predicate) {
788
+ if ((0, types_1$j.isAsyncIterable)(iterable)) {
789
+ return dropUntilAsyncIterable(iterable);
790
+ }
791
+ else {
792
+ return dropUntilIterable(iterable);
793
+ }
794
+ async function* dropUntilAsyncIterable(iterable) {
795
+ var _a;
796
+ const iterator = iterable[Symbol.asyncIterator]();
797
+ let done;
798
+ try {
799
+ let index = 0;
800
+ let value;
801
+ while ({ value, done } = await iterator.next(), !done) {
802
+ if (await predicate(value, index++))
803
+ break;
804
+ }
805
+ while (!done) {
806
+ yield value;
807
+ ({ value, done } = await iterator.next());
808
+ }
809
+ }
810
+ finally {
811
+ if (!done)
812
+ await ((_a = iterator.return) === null || _a === void 0 ? void 0 : _a.call(iterator));
813
+ }
814
+ }
815
+ async function* dropUntilIterable(iterable) {
816
+ var _a;
817
+ const iterator = iterable[Symbol.iterator]();
818
+ let done;
819
+ try {
820
+ let index = 0;
821
+ let value;
822
+ while ({ value, done } = iterator.next(), !done) {
823
+ if (await predicate(value, index++))
824
+ break;
825
+ }
826
+ while (!done) {
827
+ yield value;
828
+ ({ value, done } = iterator.next());
829
+ }
830
+ }
831
+ finally {
832
+ if (!done)
833
+ (_a = iterator.return) === null || _a === void 0 ? void 0 : _a.call(iterator);
834
+ }
835
+ }
836
+ }
837
+ dropUntilAsync$1.dropUntilAsync = dropUntilAsync;
838
+
839
+ var dropUntil$1 = {};
840
+
841
+ dropUntil$1.dropUntil = void 0;
842
+ function* dropUntil(iterable, predicate) {
843
+ var _a;
844
+ const iterator = iterable[Symbol.iterator]();
845
+ let done;
846
+ try {
847
+ let index = 0;
848
+ let value;
849
+ while ({ value, done } = iterator.next(), !done) {
850
+ if (predicate(value, index++))
851
+ break;
852
+ }
853
+ while (!done) {
854
+ yield value;
855
+ ({ value, done } = iterator.next());
856
+ }
857
+ }
858
+ finally {
859
+ if (!done)
860
+ (_a = iterator.return) === null || _a === void 0 ? void 0 : _a.call(iterator);
861
+ }
862
+ }
863
+ dropUntil$1.dropUntil = dropUntil;
864
+
865
+ var drop$1 = {};
866
+
867
+ drop$1.drop = void 0;
868
+ const go_1$8 = es2018$4;
869
+ const utils_1 = utils;
870
+ const errors_1$h = es2018$3;
871
+ function drop(iterable, count) {
872
+ (0, errors_1$h.assert)(Number.isInteger(count), 'The parameter count must be an integer');
873
+ (0, errors_1$h.assert)(count >= 0, 'The parameter count must be greater than or equal to 0');
874
+ if (count === 0)
875
+ return (0, utils_1.copyIterable)(iterable);
876
+ return (0, go_1$8.go)(function* () {
877
+ var _a;
878
+ const iterator = iterable[Symbol.iterator]();
879
+ let done;
880
+ try {
881
+ let value;
882
+ while ({ value, done } = iterator.next(), !done) {
883
+ if (count <= 0)
884
+ break;
885
+ count--;
886
+ }
887
+ while (!done) {
888
+ yield value;
889
+ ({ value, done } = iterator.next());
890
+ }
891
+ }
892
+ finally {
893
+ if (!done)
894
+ (_a = iterator.return) === null || _a === void 0 ? void 0 : _a.call(iterator);
895
+ }
896
+ });
897
+ }
898
+ drop$1.drop = drop;
899
+
900
+ var filterAsync$1 = {};
901
+
902
+ filterAsync$1.filterAsync = void 0;
903
+ const types_1$i = es2018$2;
904
+ function filterAsync(iterable, predicate) {
905
+ if ((0, types_1$i.isAsyncIterable)(iterable)) {
906
+ return filterAsyncIterable(iterable);
907
+ }
908
+ else {
909
+ return filterIterable(iterable);
910
+ }
911
+ async function* filterAsyncIterable(iterable) {
912
+ let index = 0;
913
+ for await (const element of iterable) {
914
+ if (await predicate(element, index))
915
+ yield element;
916
+ index++;
917
+ }
918
+ }
919
+ async function* filterIterable(iterable) {
920
+ let index = 0;
921
+ for (const element of iterable) {
922
+ if (await predicate(element, index))
923
+ yield element;
924
+ index++;
925
+ }
926
+ }
927
+ }
928
+ filterAsync$1.filterAsync = filterAsync;
929
+
930
+ var filter$1 = {};
931
+
932
+ filter$1.filter = void 0;
933
+ function* filter(iterable, predicate) {
934
+ let index = 0;
935
+ for (const element of iterable) {
936
+ if (predicate(element, index))
937
+ yield element;
938
+ index++;
939
+ }
940
+ }
941
+ filter$1.filter = filter;
942
+
943
+ var flattenAsync$1 = {};
944
+
945
+ var flattenDeepAsync$1 = {};
946
+
947
+ var flattenByAsync$1 = {};
948
+
949
+ flattenByAsync$1.flattenByAsync = void 0;
950
+ const types_1$h = es2018$2;
951
+ function flattenByAsync(iterable, predicate) {
952
+ if ((0, types_1$h.isAsyncIterable)(iterable)) {
953
+ return flattenByAsyncIterable(iterable);
954
+ }
955
+ else {
956
+ return flattenByIterable(iterable);
957
+ }
958
+ async function* flattenByAsyncIterable(iterable) {
959
+ const level = 1;
960
+ for await (const element of iterable) {
961
+ if (isFiniteIterable$1(element) && await predicate(element, level)) {
962
+ yield* flatten(element, level + 1);
963
+ }
964
+ else {
965
+ yield element;
966
+ }
967
+ }
968
+ }
969
+ function flattenByIterable(iterable) {
970
+ return flatten(iterable, 1);
971
+ }
972
+ async function* flatten(iterable, level) {
973
+ for (const element of iterable) {
974
+ if (isFiniteIterable$1(element) && await predicate(element, level)) {
975
+ yield* flatten(element, level + 1);
976
+ }
977
+ else {
978
+ yield element;
979
+ }
980
+ }
981
+ }
982
+ }
983
+ flattenByAsync$1.flattenByAsync = flattenByAsync;
984
+ function isFiniteIterable$1(val) {
985
+ return (0, types_1$h.isIterable)(val) && (0, types_1$h.isntChar)(val);
986
+ }
987
+
988
+ flattenDeepAsync$1.flattenDeepAsync = void 0;
989
+ const flatten_by_async_1 = flattenByAsync$1;
990
+ const errors_1$g = es2018$3;
991
+ function flattenDeepAsync(iterable, depth = Infinity) {
992
+ (0, errors_1$g.assert)(depth === Infinity || Number.isInteger(depth), 'The parameter depth must be an integer');
993
+ (0, errors_1$g.assert)(depth >= 0, 'The parameter depth must be greater than or equal to 0');
994
+ return (0, flatten_by_async_1.flattenByAsync)(iterable, (_, level) => level <= depth);
995
+ }
996
+ flattenDeepAsync$1.flattenDeepAsync = flattenDeepAsync;
997
+
998
+ flattenAsync$1.flattenAsync = void 0;
999
+ const flatten_deep_async_1 = flattenDeepAsync$1;
1000
+ function flattenAsync(iterable) {
1001
+ return (0, flatten_deep_async_1.flattenDeepAsync)(iterable, 1);
1002
+ }
1003
+ flattenAsync$1.flattenAsync = flattenAsync;
1004
+
1005
+ var flattenBy$1 = {};
1006
+
1007
+ flattenBy$1.flattenBy = void 0;
1008
+ const types_1$g = es2018$2;
1009
+ function flattenBy(iterable, predicate) {
1010
+ return flatten(iterable, 1);
1011
+ function* flatten(iterable, level) {
1012
+ for (const element of iterable) {
1013
+ if (isFiniteIterable(element) && predicate(element, level)) {
1014
+ yield* flatten(element, level + 1);
1015
+ }
1016
+ else {
1017
+ yield element;
1018
+ }
1019
+ }
1020
+ }
1021
+ }
1022
+ flattenBy$1.flattenBy = flattenBy;
1023
+ function isFiniteIterable(val) {
1024
+ return (0, types_1$g.isIterable)(val) && (0, types_1$g.isntChar)(val);
1025
+ }
1026
+
1027
+ var flattenDeep$1 = {};
1028
+
1029
+ flattenDeep$1.flattenDeep = void 0;
1030
+ const flatten_by_1 = flattenBy$1;
1031
+ const errors_1$f = es2018$3;
1032
+ function flattenDeep(iterable, depth = Infinity) {
1033
+ (0, errors_1$f.assert)(depth === Infinity || Number.isInteger(depth), 'The parameter depth must be an integer');
1034
+ (0, errors_1$f.assert)(depth >= 0, 'The parameter depth must be greater than or equal to 0');
1035
+ return (0, flatten_by_1.flattenBy)(iterable, (_, level) => level <= depth);
1036
+ }
1037
+ flattenDeep$1.flattenDeep = flattenDeep;
1038
+
1039
+ var flatten$1 = {};
1040
+
1041
+ flatten$1.flatten = void 0;
1042
+ const flatten_deep_1 = flattenDeep$1;
1043
+ function flatten(iterable) {
1044
+ return (0, flatten_deep_1.flattenDeep)(iterable, 1);
1045
+ }
1046
+ flatten$1.flatten = flatten;
1047
+
1048
+ var mapAsync$1 = {};
1049
+
1050
+ mapAsync$1.mapAsync = void 0;
1051
+ const types_1$f = es2018$2;
1052
+ function mapAsync(iterable, fn) {
1053
+ if ((0, types_1$f.isAsyncIterable)(iterable)) {
1054
+ return mapAsyncIterable(iterable);
1055
+ }
1056
+ else {
1057
+ return mapIterable(iterable);
1058
+ }
1059
+ async function* mapAsyncIterable(iterable) {
1060
+ let index = 0;
1061
+ for await (const element of iterable) {
1062
+ yield await fn(element, index);
1063
+ index++;
1064
+ }
1065
+ }
1066
+ async function* mapIterable(iterable) {
1067
+ let index = 0;
1068
+ for (const element of iterable) {
1069
+ yield await fn(element, index);
1070
+ index++;
1071
+ }
1072
+ }
1073
+ }
1074
+ mapAsync$1.mapAsync = mapAsync;
1075
+
1076
+ var map$1 = {};
1077
+
1078
+ map$1.map = void 0;
1079
+ function* map(iterable, fn) {
1080
+ let index = 0;
1081
+ for (const element of iterable) {
1082
+ yield fn(element, index);
1083
+ index++;
1084
+ }
1085
+ }
1086
+ map$1.map = map;
1087
+
1088
+ var repeatAsync$1 = {};
1089
+
1090
+ repeatAsync$1.repeatAsync = void 0;
1091
+ const go_1$7 = es2018$4;
1092
+ const errors_1$e = es2018$3;
1093
+ function repeatAsync(iterable, times) {
1094
+ (0, errors_1$e.assert)(times === Infinity || Number.isInteger(times), 'The parameter times must be an integer');
1095
+ (0, errors_1$e.assert)(times >= 0, 'The parameter times must be greater than or equal to 0');
1096
+ if (times === Infinity)
1097
+ warnInfiniteLoop$1();
1098
+ return (0, go_1$7.go)(async function* () {
1099
+ const cache = [];
1100
+ if (times > 0) {
1101
+ for await (const element of iterable) {
1102
+ yield element;
1103
+ cache.push(element);
1104
+ }
1105
+ times--;
1106
+ }
1107
+ while (times > 0) {
1108
+ yield* cache;
1109
+ times--;
1110
+ }
1111
+ });
1112
+ }
1113
+ repeatAsync$1.repeatAsync = repeatAsync;
1114
+ function warnInfiniteLoop$1() {
1115
+ if (isProduction$1())
1116
+ return;
1117
+ console.warn('When iterable has no elements and times is Infinity, repeat() will be in dead loop');
1118
+ }
1119
+ function isProduction$1() {
1120
+ return process.env.NODE_ENV === 'production';
1121
+ }
1122
+
1123
+ var repeat$4 = {};
1124
+
1125
+ repeat$4.repeat = void 0;
1126
+ const go_1$6 = es2018$4;
1127
+ const errors_1$d = es2018$3;
1128
+ function repeat$3(iterable, times) {
1129
+ (0, errors_1$d.assert)(times === Infinity || Number.isInteger(times), 'The parameter times must be an integer');
1130
+ (0, errors_1$d.assert)(times >= 0, 'The parameter times must be greater than or equal to 0');
1131
+ if (times === Infinity)
1132
+ warnInfiniteLoop();
1133
+ return (0, go_1$6.go)(function* () {
1134
+ const cache = [];
1135
+ if (times > 0) {
1136
+ for (const element of iterable) {
1137
+ yield element;
1138
+ cache.push(element);
1139
+ }
1140
+ times--;
1141
+ }
1142
+ while (times > 0) {
1143
+ yield* cache;
1144
+ times--;
1145
+ }
1146
+ });
1147
+ }
1148
+ repeat$4.repeat = repeat$3;
1149
+ function warnInfiniteLoop() {
1150
+ if (isProduction())
1151
+ return;
1152
+ console.warn('When iterable has no elements and times is Infinity, repeat() will be in dead loop');
1153
+ }
1154
+ function isProduction() {
1155
+ return process.env.NODE_ENV === 'production';
1156
+ }
1157
+
1158
+ var sliceAsync$1 = {};
1159
+
1160
+ sliceAsync$1.sliceAsync = void 0;
1161
+ const go_1$5 = es2018$4;
1162
+ const errors_1$c = es2018$3;
1163
+ function sliceAsync(iterable, start, end = Infinity) {
1164
+ (0, errors_1$c.assert)(Number.isInteger(start), 'The parameter start must be an integer');
1165
+ (0, errors_1$c.assert)(start >= 0, 'The parameter start must be greater than or equal to 0');
1166
+ (0, errors_1$c.assert)(Number.isInteger(end), 'The parameter end must be an integer');
1167
+ (0, errors_1$c.assert)(end >= start, 'The parameter end must be greater than or equal to start');
1168
+ return (0, go_1$5.go)(async function* () {
1169
+ let index = 0;
1170
+ for await (const element of iterable) {
1171
+ if (index >= end)
1172
+ break;
1173
+ if (index >= start)
1174
+ yield element;
1175
+ index++;
1176
+ }
1177
+ });
1178
+ }
1179
+ sliceAsync$1.sliceAsync = sliceAsync;
1180
+
1181
+ var slice$1 = {};
1182
+
1183
+ slice$1.slice = void 0;
1184
+ const go_1$4 = es2018$4;
1185
+ const errors_1$b = es2018$3;
1186
+ function slice(iterable, start, end = Infinity) {
1187
+ (0, errors_1$b.assert)(Number.isInteger(start), 'The parameter start must be an integer');
1188
+ (0, errors_1$b.assert)(start >= 0, 'The parameter start must be greater than or equal to 0');
1189
+ (0, errors_1$b.assert)(Number.isInteger(end), 'The parameter end must be an integer');
1190
+ (0, errors_1$b.assert)(end >= start, 'The parameter end must be greater than or equal to start');
1191
+ return (0, go_1$4.go)(function* () {
1192
+ let index = 0;
1193
+ for (const element of iterable) {
1194
+ if (index >= end)
1195
+ break;
1196
+ if (index >= start)
1197
+ yield element;
1198
+ index++;
1199
+ }
1200
+ });
1201
+ }
1202
+ slice$1.slice = slice;
1203
+
1204
+ var splitAsync$1 = {};
1205
+
1206
+ splitAsync$1.splitAsync = void 0;
1207
+ async function* splitAsync(iterable, separator) {
1208
+ let buffer = [];
1209
+ for await (const element of iterable) {
1210
+ if (element === separator) {
1211
+ yield buffer;
1212
+ buffer = [];
1213
+ }
1214
+ else {
1215
+ buffer.push(element);
1216
+ }
1217
+ }
1218
+ yield buffer;
1219
+ }
1220
+ splitAsync$1.splitAsync = splitAsync;
1221
+
1222
+ var splitByAsync$1 = {};
1223
+
1224
+ splitByAsync$1.splitByAsync = void 0;
1225
+ const types_1$e = es2018$2;
1226
+ function splitByAsync(iterable, predicate) {
1227
+ if ((0, types_1$e.isAsyncIterable)(iterable)) {
1228
+ return splitByAsyncIterable(iterable);
1229
+ }
1230
+ else {
1231
+ return splitByIterable(iterable);
1232
+ }
1233
+ async function* splitByIterable(iterable) {
1234
+ let buffer = [];
1235
+ let index = 0;
1236
+ for (const element of iterable) {
1237
+ if (await predicate(element, index)) {
1238
+ yield buffer;
1239
+ buffer = [];
1240
+ }
1241
+ else {
1242
+ buffer.push(element);
1243
+ }
1244
+ index++;
1245
+ }
1246
+ yield buffer;
1247
+ }
1248
+ async function* splitByAsyncIterable(iterable) {
1249
+ let buffer = [];
1250
+ let index = 0;
1251
+ for await (const element of iterable) {
1252
+ if (await predicate(element, index)) {
1253
+ yield buffer;
1254
+ buffer = [];
1255
+ }
1256
+ else {
1257
+ buffer.push(element);
1258
+ }
1259
+ index++;
1260
+ }
1261
+ yield buffer;
1262
+ }
1263
+ }
1264
+ splitByAsync$1.splitByAsync = splitByAsync;
1265
+
1266
+ var splitBy$1 = {};
1267
+
1268
+ splitBy$1.splitBy = void 0;
1269
+ function* splitBy(iterable, predicate) {
1270
+ let buffer = [];
1271
+ let index = 0;
1272
+ for (const element of iterable) {
1273
+ if (predicate(element, index)) {
1274
+ yield buffer;
1275
+ buffer = [];
1276
+ }
1277
+ else {
1278
+ buffer.push(element);
1279
+ }
1280
+ index++;
1281
+ }
1282
+ yield buffer;
1283
+ }
1284
+ splitBy$1.splitBy = splitBy;
1285
+
1286
+ var split$1 = {};
1287
+
1288
+ split$1.split = void 0;
1289
+ function* split(iterable, separator) {
1290
+ let buffer = [];
1291
+ for (const element of iterable) {
1292
+ if (element === separator) {
1293
+ yield buffer;
1294
+ buffer = [];
1295
+ }
1296
+ else {
1297
+ buffer.push(element);
1298
+ }
1299
+ }
1300
+ yield buffer;
1301
+ }
1302
+ split$1.split = split;
1303
+
1304
+ var takeAsync$1 = {};
1305
+
1306
+ takeAsync$1.takeAsync = void 0;
1307
+ const go_1$3 = es2018$4;
1308
+ const errors_1$a = es2018$3;
1309
+ function takeAsync(iterable, count) {
1310
+ (0, errors_1$a.assert)(Number.isInteger(count), 'The parameter count must be an integer');
1311
+ (0, errors_1$a.assert)(count >= 0, 'The parameter count must be greater than or equal to 0');
1312
+ return (0, go_1$3.go)(async function* () {
1313
+ if (count === 0)
1314
+ return;
1315
+ for await (const element of iterable) {
1316
+ yield element;
1317
+ count--;
1318
+ if (count === 0)
1319
+ break;
1320
+ }
1321
+ });
1322
+ }
1323
+ takeAsync$1.takeAsync = takeAsync;
1324
+
1325
+ var takeRightAsync$1 = {};
1326
+
1327
+ takeRightAsync$1.takeRightAsync = void 0;
1328
+ const go_1$2 = es2018$4;
1329
+ const errors_1$9 = es2018$3;
1330
+ function takeRightAsync(iterable, count) {
1331
+ (0, errors_1$9.assert)(Number.isInteger(count), 'The parameter count must be an integer');
1332
+ (0, errors_1$9.assert)(count >= 0, 'The parameter count must be greater than or equal to 0');
1333
+ return (0, go_1$2.go)(async function* () {
1334
+ var _a;
1335
+ const iterator = iterable[Symbol.asyncIterator]();
1336
+ let done;
1337
+ try {
1338
+ const buffer = [];
1339
+ let value;
1340
+ while ({ value, done } = await iterator.next(), !done) {
1341
+ buffer.push(value);
1342
+ if (buffer.length > count)
1343
+ buffer.shift();
1344
+ }
1345
+ yield* buffer;
1346
+ }
1347
+ finally {
1348
+ if (!done)
1349
+ await ((_a = iterator.return) === null || _a === void 0 ? void 0 : _a.call(iterator));
1350
+ }
1351
+ });
1352
+ }
1353
+ takeRightAsync$1.takeRightAsync = takeRightAsync;
1354
+
1355
+ var takeRight$1 = {};
1356
+
1357
+ takeRight$1.takeRight = void 0;
1358
+ const go_1$1 = es2018$4;
1359
+ const errors_1$8 = es2018$3;
1360
+ function takeRight(iterable, count) {
1361
+ (0, errors_1$8.assert)(Number.isInteger(count), 'The parameter count must be an integer');
1362
+ (0, errors_1$8.assert)(count >= 0, 'The parameter count must be greater than or equal to 0');
1363
+ return (0, go_1$1.go)(function* () {
1364
+ var _a;
1365
+ const iterator = iterable[Symbol.iterator]();
1366
+ let done;
1367
+ try {
1368
+ const buffer = [];
1369
+ let value;
1370
+ while ({ value, done } = iterator.next(), !done) {
1371
+ buffer.push(value);
1372
+ if (buffer.length > count)
1373
+ buffer.shift();
1374
+ }
1375
+ yield* buffer;
1376
+ }
1377
+ finally {
1378
+ if (!done)
1379
+ (_a = iterator.return) === null || _a === void 0 ? void 0 : _a.call(iterator);
1380
+ }
1381
+ });
1382
+ }
1383
+ takeRight$1.takeRight = takeRight;
1384
+
1385
+ var takeUntilAsync$1 = {};
1386
+
1387
+ takeUntilAsync$1.takeUntilAsync = void 0;
1388
+ const types_1$d = es2018$2;
1389
+ function takeUntilAsync(iterable, predicate) {
1390
+ if ((0, types_1$d.isAsyncIterable)(iterable)) {
1391
+ return takeUntilAsyncIterable(iterable);
1392
+ }
1393
+ else {
1394
+ return takeUntilIterable(iterable);
1395
+ }
1396
+ async function* takeUntilAsyncIterable(iterable) {
1397
+ let index = 0;
1398
+ for await (const element of iterable) {
1399
+ if (await predicate(element, index))
1400
+ break;
1401
+ yield element;
1402
+ index++;
1403
+ }
1404
+ }
1405
+ async function* takeUntilIterable(iterable) {
1406
+ let index = 0;
1407
+ for (const element of iterable) {
1408
+ if (await predicate(element, index))
1409
+ break;
1410
+ yield element;
1411
+ index++;
1412
+ }
1413
+ }
1414
+ }
1415
+ takeUntilAsync$1.takeUntilAsync = takeUntilAsync;
1416
+
1417
+ var takeUntil$1 = {};
1418
+
1419
+ takeUntil$1.takeUntil = void 0;
1420
+ function* takeUntil(iterable, predicate) {
1421
+ let index = 0;
1422
+ for (const element of iterable) {
1423
+ if (predicate(element, index))
1424
+ break;
1425
+ yield element;
1426
+ index++;
1427
+ }
1428
+ }
1429
+ takeUntil$1.takeUntil = takeUntil;
1430
+
1431
+ var take$1 = {};
1432
+
1433
+ take$1.take = void 0;
1434
+ const go_1 = es2018$4;
1435
+ const errors_1$7 = es2018$3;
1436
+ function take(iterable, count) {
1437
+ (0, errors_1$7.assert)(Number.isInteger(count), 'The parameter count must be an integer');
1438
+ (0, errors_1$7.assert)(count >= 0, 'The parameter count must be greater than or equal to 0');
1439
+ return (0, go_1.go)(function* () {
1440
+ if (count === 0)
1441
+ return;
1442
+ for (const element of iterable) {
1443
+ yield element;
1444
+ count--;
1445
+ if (count === 0)
1446
+ break;
1447
+ }
1448
+ });
1449
+ }
1450
+ take$1.take = take;
1451
+
1452
+ var tapAsync$1 = {};
1453
+
1454
+ tapAsync$1.tapAsync = void 0;
1455
+ const types_1$c = es2018$2;
1456
+ function tapAsync(iterable, fn) {
1457
+ if ((0, types_1$c.isAsyncIterable)(iterable)) {
1458
+ return tapAsyncIterable(iterable);
1459
+ }
1460
+ else {
1461
+ return tapIterable(iterable);
1462
+ }
1463
+ async function* tapIterable(iterable) {
1464
+ let index = 0;
1465
+ for (const element of iterable) {
1466
+ await fn(element, index);
1467
+ yield element;
1468
+ index++;
1469
+ }
1470
+ }
1471
+ async function* tapAsyncIterable(iterable) {
1472
+ let index = 0;
1473
+ for await (const element of iterable) {
1474
+ await fn(element, index);
1475
+ yield element;
1476
+ index++;
1477
+ }
1478
+ }
1479
+ }
1480
+ tapAsync$1.tapAsync = tapAsync;
1481
+
1482
+ var tap$2 = {};
1483
+
1484
+ tap$2.tap = void 0;
1485
+ function* tap$1(iterable, fn) {
1486
+ let index = 0;
1487
+ for (const element of iterable) {
1488
+ fn(element, index);
1489
+ yield element;
1490
+ index++;
1491
+ }
1492
+ }
1493
+ tap$2.tap = tap$1;
1494
+
1495
+ var toAsyncIterable$1 = {};
1496
+
1497
+ toAsyncIterable$1.toAsyncIterable = void 0;
1498
+ async function* toAsyncIterable(iterable) {
1499
+ for (const value of iterable) {
1500
+ yield value;
1501
+ }
1502
+ }
1503
+ toAsyncIterable$1.toAsyncIterable = toAsyncIterable;
1504
+
1505
+ var transformAsync$1 = {};
1506
+
1507
+ transformAsync$1.transformAsync = void 0;
1508
+ async function* transformAsync(iterable, transformer) {
1509
+ yield* transformer(iterable);
1510
+ }
1511
+ transformAsync$1.transformAsync = transformAsync;
1512
+
1513
+ var transform$1 = {};
1514
+
1515
+ transform$1.transform = void 0;
1516
+ function* transform(iterable, transformer) {
1517
+ yield* transformer(iterable);
1518
+ }
1519
+ transform$1.transform = transform;
1520
+
1521
+ var uniqAsync$1 = {};
1522
+
1523
+ uniqAsync$1.uniqAsync = void 0;
1524
+ async function* uniqAsync(iterable) {
1525
+ const bucket = new Set();
1526
+ for await (const element of iterable) {
1527
+ if (!bucket.has(element)) {
1528
+ yield element;
1529
+ bucket.add(element);
1530
+ }
1531
+ }
1532
+ }
1533
+ uniqAsync$1.uniqAsync = uniqAsync;
1534
+
1535
+ var uniqByAsync$1 = {};
1536
+
1537
+ uniqByAsync$1.uniqByAsync = void 0;
1538
+ const types_1$b = es2018$2;
1539
+ function uniqByAsync(iterable, fn) {
1540
+ if ((0, types_1$b.isAsyncIterable)(iterable)) {
1541
+ return uniqByAsyncIterable(iterable);
1542
+ }
1543
+ else {
1544
+ return uniqByIterable(iterable);
1545
+ }
1546
+ async function* uniqByAsyncIterable(iterable) {
1547
+ const bucket = new Set();
1548
+ let index = 0;
1549
+ for await (const element of iterable) {
1550
+ const result = await fn(element, index);
1551
+ if (!bucket.has(result)) {
1552
+ yield element;
1553
+ bucket.add(result);
1554
+ }
1555
+ index++;
1556
+ }
1557
+ }
1558
+ async function* uniqByIterable(iterable) {
1559
+ const bucket = new Set();
1560
+ let index = 0;
1561
+ for (const element of iterable) {
1562
+ const result = await fn(element, index);
1563
+ if (!bucket.has(result)) {
1564
+ yield element;
1565
+ bucket.add(result);
1566
+ }
1567
+ index++;
1568
+ }
1569
+ }
1570
+ }
1571
+ uniqByAsync$1.uniqByAsync = uniqByAsync;
1572
+
1573
+ var uniqBy$1 = {};
1574
+
1575
+ uniqBy$1.uniqBy = void 0;
1576
+ function* uniqBy(iterable, fn) {
1577
+ const bucket = new Set();
1578
+ let index = 0;
1579
+ for (const element of iterable) {
1580
+ const result = fn(element, index);
1581
+ if (!bucket.has(result)) {
1582
+ yield element;
1583
+ bucket.add(result);
1584
+ }
1585
+ index++;
1586
+ }
1587
+ }
1588
+ uniqBy$1.uniqBy = uniqBy;
1589
+
1590
+ var uniq$1 = {};
1591
+
1592
+ uniq$1.uniq = void 0;
1593
+ function* uniq(iterable) {
1594
+ const bucket = new Set();
1595
+ for (const element of iterable) {
1596
+ if (!bucket.has(element)) {
1597
+ yield element;
1598
+ bucket.add(element);
1599
+ }
1600
+ }
1601
+ }
1602
+ uniq$1.uniq = uniq;
1603
+
1604
+ var zipAsync$1 = {};
1605
+
1606
+ zipAsync$1.zipAsync = void 0;
1607
+ const types_1$a = es2018$2;
1608
+ var Kind;
1609
+ (function (Kind) {
1610
+ Kind[Kind["Sync"] = 0] = "Sync";
1611
+ Kind[Kind["Async"] = 1] = "Async";
1612
+ })(Kind || (Kind = {}));
1613
+ function zipAsync(iterable, ...otherIterables) {
1614
+ return zipWithSize$1(iterable, ...otherIterables);
1615
+ }
1616
+ zipAsync$1.zipAsync = zipAsync;
1617
+ async function* zipWithSize$1(...iterables) {
1618
+ var _a, _b, _c, _d;
1619
+ const length = iterables.length;
1620
+ const iterators = iterables.map(iterable => {
1621
+ if ((0, types_1$a.isAsyncIterable)(iterable)) {
1622
+ return [Kind.Async, iterable[Symbol.asyncIterator]()];
1623
+ }
1624
+ else {
1625
+ return [Kind.Sync, iterable[Symbol.iterator]()];
1626
+ }
1627
+ });
1628
+ const dones = iterators.map(() => false);
1629
+ try {
1630
+ while (true) {
1631
+ const result = new Array(length);
1632
+ for (let i = 0; i < length; i++) {
1633
+ const [kind, iterator] = iterators[i];
1634
+ let temp;
1635
+ if (kind === Kind.Async) {
1636
+ temp = await iterator.next();
1637
+ }
1638
+ else {
1639
+ temp = iterator.next();
1640
+ }
1641
+ if (temp.done) {
1642
+ dones[i] = true;
1643
+ return;
1644
+ }
1645
+ result[i] = temp.value;
1646
+ }
1647
+ yield result;
1648
+ }
1649
+ }
1650
+ finally {
1651
+ const undoneIterators = iterators.filter((_, i) => !dones[i]);
1652
+ for (const [kind, iterator] of undoneIterators) {
1653
+ if (kind === Kind.Async) {
1654
+ await ((_b = (_a = iterator).return) === null || _b === void 0 ? void 0 : _b.call(_a));
1655
+ }
1656
+ else {
1657
+ (_d = (_c = iterator).return) === null || _d === void 0 ? void 0 : _d.call(_c);
1658
+ }
1659
+ }
1660
+ }
1661
+ }
1662
+
1663
+ var zip$1 = {};
1664
+
1665
+ zip$1.zip = void 0;
1666
+ function zip(iterable, ...otherIterables) {
1667
+ return zipWithSize(iterable, ...otherIterables);
1668
+ }
1669
+ zip$1.zip = zip;
1670
+ function* zipWithSize(...iterables) {
1671
+ const length = iterables.length;
1672
+ const iterators = iterables.map(iterable => iterable[Symbol.iterator]());
1673
+ const dones = iterators.map(() => false);
1674
+ try {
1675
+ while (true) {
1676
+ const result = new Array(length);
1677
+ for (let i = 0; i < length; i++) {
1678
+ const { value, done } = iterators[i].next();
1679
+ if (done) {
1680
+ dones[i] = true;
1681
+ return;
1682
+ }
1683
+ result[i] = value;
1684
+ }
1685
+ yield result;
1686
+ }
1687
+ }
1688
+ finally {
1689
+ const undoneIterators = iterators.filter((_, i) => !dones[i]);
1690
+ undoneIterators.forEach(x => { var _a; return (_a = x.return) === null || _a === void 0 ? void 0 : _a.call(x); });
1691
+ }
1692
+ }
1693
+
1694
+ (function (exports) {
1695
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
1696
+ if (k2 === undefined) k2 = k;
1697
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
1698
+ }) : (function(o, m, k, k2) {
1699
+ if (k2 === undefined) k2 = k;
1700
+ o[k2] = m[k];
1701
+ }));
1702
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
1703
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1704
+ };__exportStar(chunkAsync$1, exports);
1705
+ __exportStar(chunkByAsync$1, exports);
1706
+ __exportStar(chunkBy$1, exports);
1707
+ __exportStar(chunk$1, exports);
1708
+ __exportStar(concatAsync$1, exports);
1709
+ __exportStar(concat$2, exports);
1710
+ __exportStar(dropAsync$1, exports);
1711
+ __exportStar(dropRightAsync$1, exports);
1712
+ __exportStar(dropRight$1, exports);
1713
+ __exportStar(dropUntilAsync$1, exports);
1714
+ __exportStar(dropUntil$1, exports);
1715
+ __exportStar(drop$1, exports);
1716
+ __exportStar(filterAsync$1, exports);
1717
+ __exportStar(filter$1, exports);
1718
+ __exportStar(flattenAsync$1, exports);
1719
+ __exportStar(flattenByAsync$1, exports);
1720
+ __exportStar(flattenBy$1, exports);
1721
+ __exportStar(flattenDeepAsync$1, exports);
1722
+ __exportStar(flattenDeep$1, exports);
1723
+ __exportStar(flatten$1, exports);
1724
+ __exportStar(mapAsync$1, exports);
1725
+ __exportStar(map$1, exports);
1726
+ __exportStar(repeatAsync$1, exports);
1727
+ __exportStar(repeat$4, exports);
1728
+ __exportStar(sliceAsync$1, exports);
1729
+ __exportStar(slice$1, exports);
1730
+ __exportStar(splitAsync$1, exports);
1731
+ __exportStar(splitByAsync$1, exports);
1732
+ __exportStar(splitBy$1, exports);
1733
+ __exportStar(split$1, exports);
1734
+ __exportStar(takeAsync$1, exports);
1735
+ __exportStar(takeRightAsync$1, exports);
1736
+ __exportStar(takeRight$1, exports);
1737
+ __exportStar(takeUntilAsync$1, exports);
1738
+ __exportStar(takeUntil$1, exports);
1739
+ __exportStar(take$1, exports);
1740
+ __exportStar(tapAsync$1, exports);
1741
+ __exportStar(tap$2, exports);
1742
+ __exportStar(toAsyncIterable$1, exports);
1743
+ __exportStar(transformAsync$1, exports);
1744
+ __exportStar(transform$1, exports);
1745
+ __exportStar(uniqAsync$1, exports);
1746
+ __exportStar(uniqByAsync$1, exports);
1747
+ __exportStar(uniqBy$1, exports);
1748
+ __exportStar(uniq$1, exports);
1749
+ __exportStar(zipAsync$1, exports);
1750
+ __exportStar(zip$1, exports);
1751
+
1752
+ }(middleware));
1753
+
1754
+ var output = {};
1755
+
1756
+ var consume$1 = {};
1757
+
1758
+ consume$1.consume = void 0;
1759
+ function consume(iterable, consumer) {
1760
+ return consumer(iterable);
1761
+ }
1762
+ consume$1.consume = consume;
1763
+
1764
+ var eachAsync$1 = {};
1765
+
1766
+ eachAsync$1.eachAsync = void 0;
1767
+ const types_1$9 = es2018$2;
1768
+ function eachAsync(iterable, fn) {
1769
+ if ((0, types_1$9.isAsyncIterable)(iterable)) {
1770
+ return eachAsyncIterable(iterable);
1771
+ }
1772
+ else {
1773
+ return eachIterable(iterable);
1774
+ }
1775
+ async function eachAsyncIterable(iterable) {
1776
+ let index = 0;
1777
+ for await (const element of iterable) {
1778
+ await fn(element, index);
1779
+ index++;
1780
+ }
1781
+ }
1782
+ async function eachIterable(iterable) {
1783
+ let index = 0;
1784
+ for (const element of iterable) {
1785
+ await fn(element, index);
1786
+ index++;
1787
+ }
1788
+ }
1789
+ }
1790
+ eachAsync$1.eachAsync = eachAsync;
1791
+
1792
+ var each$1 = {};
1793
+
1794
+ each$1.each = void 0;
1795
+ function each(iterable, fn) {
1796
+ let index = 0;
1797
+ for (const element of iterable) {
1798
+ fn(element, index);
1799
+ index++;
1800
+ }
1801
+ }
1802
+ each$1.each = each;
1803
+
1804
+ var everyAsync$1 = {};
1805
+
1806
+ everyAsync$1.everyAsync = void 0;
1807
+ const types_1$8 = es2018$2;
1808
+ function everyAsync(iterable, predicate) {
1809
+ if ((0, types_1$8.isAsyncIterable)(iterable)) {
1810
+ return everyAsyncIterable(iterable);
1811
+ }
1812
+ else {
1813
+ return everyIterable(iterable);
1814
+ }
1815
+ async function everyIterable(iterable) {
1816
+ let index = 0;
1817
+ for (const element of iterable) {
1818
+ if (!await predicate(element, index))
1819
+ return false;
1820
+ index++;
1821
+ }
1822
+ return true;
1823
+ }
1824
+ async function everyAsyncIterable(iterable) {
1825
+ let index = 0;
1826
+ for await (const element of iterable) {
1827
+ if (!await predicate(element, index))
1828
+ return false;
1829
+ index++;
1830
+ }
1831
+ return true;
1832
+ }
1833
+ }
1834
+ everyAsync$1.everyAsync = everyAsync;
1835
+
1836
+ var every$1 = {};
1837
+
1838
+ every$1.every = void 0;
1839
+ function every(iterable, predicate) {
1840
+ let index = 0;
1841
+ for (const element of iterable) {
1842
+ if (!predicate(element, index))
1843
+ return false;
1844
+ index++;
1845
+ }
1846
+ return true;
1847
+ }
1848
+ every$1.every = every;
1849
+
1850
+ var findAsync$1 = {};
1851
+
1852
+ findAsync$1.findAsync = void 0;
1853
+ const types_1$7 = es2018$2;
1854
+ function findAsync(iterable, predicate) {
1855
+ if ((0, types_1$7.isAsyncIterable)(iterable)) {
1856
+ return findAsyncIterable(iterable);
1857
+ }
1858
+ else {
1859
+ return findIterable(iterable);
1860
+ }
1861
+ async function findIterable(iterable) {
1862
+ let index = 0;
1863
+ for (const element of iterable) {
1864
+ if (await predicate(element, index))
1865
+ return element;
1866
+ index++;
1867
+ }
1868
+ return undefined;
1869
+ }
1870
+ async function findAsyncIterable(iterable) {
1871
+ let index = 0;
1872
+ for await (const element of iterable) {
1873
+ if (await predicate(element, index))
1874
+ return element;
1875
+ index++;
1876
+ }
1877
+ return undefined;
1878
+ }
1879
+ }
1880
+ findAsync$1.findAsync = findAsync;
1881
+
1882
+ var find$3 = {};
1883
+
1884
+ find$3.find = void 0;
1885
+ function find$2(iterable, predicate) {
1886
+ let index = 0;
1887
+ for (const element of iterable) {
1888
+ if (predicate(element, index))
1889
+ return element;
1890
+ index++;
1891
+ }
1892
+ return undefined;
1893
+ }
1894
+ find$3.find = find$2;
1895
+
1896
+ var firstAsync$1 = {};
1897
+
1898
+ firstAsync$1.firstAsync = void 0;
1899
+ async function firstAsync(iterable) {
1900
+ for await (const element of iterable) {
1901
+ return element;
1902
+ }
1903
+ return undefined;
1904
+ }
1905
+ firstAsync$1.firstAsync = firstAsync;
1906
+
1907
+ var first$1 = {};
1908
+
1909
+ first$1.first = void 0;
1910
+ function first(iterable) {
1911
+ for (const element of iterable) {
1912
+ return element;
1913
+ }
1914
+ return undefined;
1915
+ }
1916
+ first$1.first = first;
1917
+
1918
+ var includesAsync$1 = {};
1919
+
1920
+ includesAsync$1.includesAsync = void 0;
1921
+ async function includesAsync(iterable, value) {
1922
+ for await (const element of iterable) {
1923
+ if (element === value)
1924
+ return true;
1925
+ }
1926
+ return false;
1927
+ }
1928
+ includesAsync$1.includesAsync = includesAsync;
1929
+
1930
+ var includes$1 = {};
1931
+
1932
+ includes$1.includes = void 0;
1933
+ function includes(iterable, value) {
1934
+ for (const element of iterable) {
1935
+ if (element === value)
1936
+ return true;
1937
+ }
1938
+ return false;
1939
+ }
1940
+ includes$1.includes = includes;
1941
+
1942
+ var matchAsync$1 = {};
1943
+
1944
+ matchAsync$1.matchAsync = void 0;
1945
+ async function matchAsync(iterable, sequence) {
1946
+ const sequenceLength = sequence.length;
1947
+ let matchCount = 0;
1948
+ for await (const element of iterable) {
1949
+ if (element === sequence[matchCount])
1950
+ matchCount++;
1951
+ if (matchCount === sequenceLength)
1952
+ return true;
1953
+ }
1954
+ return false;
1955
+ }
1956
+ matchAsync$1.matchAsync = matchAsync;
1957
+
1958
+ var match$2 = {};
1959
+
1960
+ match$2.match = void 0;
1961
+ function match$1(iterable, sequence) {
1962
+ const sequenceLength = sequence.length;
1963
+ let matchCount = 0;
1964
+ for (const element of iterable) {
1965
+ if (element === sequence[matchCount])
1966
+ matchCount++;
1967
+ if (matchCount === sequenceLength)
1968
+ return true;
1969
+ }
1970
+ return false;
1971
+ }
1972
+ match$2.match = match$1;
1973
+
1974
+ var reduceAsync$1 = {};
1975
+
1976
+ reduceAsync$1.reduceAsync = void 0;
1977
+ const types_1$6 = es2018$2;
1978
+ function reduceAsync(iterable, fn, initialValue) {
1979
+ if ((0, types_1$6.isUndefined)(initialValue)) {
1980
+ return reduceAsyncWithoutInitialValue(iterable, fn);
1981
+ }
1982
+ else {
1983
+ return reduceAsyncWithInitialValue(iterable, fn, initialValue);
1984
+ }
1985
+ }
1986
+ reduceAsync$1.reduceAsync = reduceAsync;
1987
+ function reduceAsyncWithInitialValue(iterable, fn, initialValue) {
1988
+ if ((0, types_1$6.isAsyncIterable)(iterable)) {
1989
+ return reduceAsyncIterable(iterable);
1990
+ }
1991
+ else {
1992
+ return reduceIterable(iterable);
1993
+ }
1994
+ async function reduceIterable(iterable) {
1995
+ let result = initialValue, index = 0;
1996
+ for (const currentValue of iterable) {
1997
+ result = await fn(result, currentValue, index++);
1998
+ }
1999
+ return result;
2000
+ }
2001
+ async function reduceAsyncIterable(iterable) {
2002
+ let result = initialValue, index = 0;
2003
+ for await (const currentValue of iterable) {
2004
+ result = await fn(result, currentValue, index++);
2005
+ }
2006
+ return result;
2007
+ }
2008
+ }
2009
+ function reduceAsyncWithoutInitialValue(iterable, fn) {
2010
+ if ((0, types_1$6.isAsyncIterable)(iterable)) {
2011
+ return reduceAsyncIterable(iterable);
2012
+ }
2013
+ else {
2014
+ return reduceIterable(iterable);
2015
+ }
2016
+ async function reduceAsyncIterable(iterable) {
2017
+ var _a;
2018
+ const iterator = iterable[Symbol.asyncIterator]();
2019
+ let done;
2020
+ try {
2021
+ let result = await readInitialValue(iterator);
2022
+ let index = 1;
2023
+ let value;
2024
+ while ({ value, done } = await iterator.next(), !done) {
2025
+ result = await fn(result, value, index++);
2026
+ }
2027
+ return result;
2028
+ }
2029
+ finally {
2030
+ if (!done)
2031
+ await ((_a = iterator.return) === null || _a === void 0 ? void 0 : _a.call(iterator));
2032
+ }
2033
+ async function readInitialValue(iterator) {
2034
+ const result = await iterator.next();
2035
+ if (result.done) {
2036
+ done = true;
2037
+ throw new Error('Reduce of empty iterable with no initial value');
2038
+ }
2039
+ return result.value;
2040
+ }
2041
+ }
2042
+ async function reduceIterable(iterable) {
2043
+ var _a;
2044
+ const iterator = iterable[Symbol.iterator]();
2045
+ let done;
2046
+ try {
2047
+ let result = readInitialValue(iterator);
2048
+ let index = 1;
2049
+ let value;
2050
+ while ({ value, done } = iterator.next(), !done) {
2051
+ result = await fn(result, value, index++);
2052
+ }
2053
+ return result;
2054
+ }
2055
+ finally {
2056
+ if (!done)
2057
+ (_a = iterator.return) === null || _a === void 0 ? void 0 : _a.call(iterator);
2058
+ }
2059
+ function readInitialValue(iterator) {
2060
+ const result = iterator.next();
2061
+ if (result.done) {
2062
+ done = true;
2063
+ throw new Error('Reduce of empty iterable with no initial value');
2064
+ }
2065
+ return result.value;
2066
+ }
2067
+ }
2068
+ }
2069
+
2070
+ var reduce$1 = {};
2071
+
2072
+ reduce$1.reduce = void 0;
2073
+ const types_1$5 = es2018$2;
2074
+ function reduce(iterable, fn, initialValue) {
2075
+ if ((0, types_1$5.isUndefined)(initialValue)) {
2076
+ return reduceWithoutInitialValue(iterable, fn);
2077
+ }
2078
+ else {
2079
+ return reduceWithInitialValue(iterable, fn, initialValue);
2080
+ }
2081
+ }
2082
+ reduce$1.reduce = reduce;
2083
+ function reduceWithInitialValue(iterable, fn, initialValue) {
2084
+ let result = initialValue, index = 0;
2085
+ for (const currentValue of iterable) {
2086
+ result = fn(result, currentValue, index++);
2087
+ }
2088
+ return result;
2089
+ }
2090
+ function reduceWithoutInitialValue(iterable, fn) {
2091
+ var _a;
2092
+ const iterator = iterable[Symbol.iterator]();
2093
+ let done;
2094
+ try {
2095
+ let result = readInitialValue(iterator);
2096
+ let index = 1;
2097
+ let value;
2098
+ while ({ value, done } = iterator.next(), !done) {
2099
+ result = fn(result, value, index++);
2100
+ }
2101
+ return result;
2102
+ }
2103
+ finally {
2104
+ if (!done)
2105
+ (_a = iterator.return) === null || _a === void 0 ? void 0 : _a.call(iterator);
2106
+ }
2107
+ function readInitialValue(iterator) {
2108
+ const result = iterator.next();
2109
+ if (result.done) {
2110
+ done = true;
2111
+ throw new Error('Reduce of empty iterable with no initial value');
2112
+ }
2113
+ return result.value;
2114
+ }
2115
+ }
2116
+
2117
+ var someAsync$1 = {};
2118
+
2119
+ someAsync$1.someAsync = void 0;
2120
+ const types_1$4 = es2018$2;
2121
+ function someAsync(iterable, predicate) {
2122
+ if ((0, types_1$4.isAsyncIterable)(iterable)) {
2123
+ return someAsyncIterable(iterable);
2124
+ }
2125
+ else {
2126
+ return someIterable(iterable);
2127
+ }
2128
+ async function someIterable(iterable) {
2129
+ let index = 0;
2130
+ for (const element of iterable) {
2131
+ if (await predicate(element, index))
2132
+ return true;
2133
+ index++;
2134
+ }
2135
+ return false;
2136
+ }
2137
+ async function someAsyncIterable(iterable) {
2138
+ let index = 0;
2139
+ for await (const element of iterable) {
2140
+ if (await predicate(element, index))
2141
+ return true;
2142
+ index++;
2143
+ }
2144
+ return false;
2145
+ }
2146
+ }
2147
+ someAsync$1.someAsync = someAsync;
2148
+
2149
+ var some$1 = {};
2150
+
2151
+ some$1.some = void 0;
2152
+ function some(iterable, predicate) {
2153
+ let index = 0;
2154
+ for (const element of iterable) {
2155
+ if (predicate(element, index))
2156
+ return true;
2157
+ index++;
2158
+ }
2159
+ return false;
2160
+ }
2161
+ some$1.some = some;
2162
+
2163
+ var lastAsync$1 = {};
2164
+
2165
+ lastAsync$1.lastAsync = void 0;
2166
+ async function lastAsync(iterable) {
2167
+ var _a;
2168
+ const iterator = iterable[Symbol.asyncIterator]();
2169
+ let done;
2170
+ try {
2171
+ let value;
2172
+ let result;
2173
+ while ({ value, done } = await iterator.next(), !done) {
2174
+ result = value;
2175
+ }
2176
+ return result;
2177
+ }
2178
+ finally {
2179
+ if (!done)
2180
+ await ((_a = iterator.return) === null || _a === void 0 ? void 0 : _a.call(iterator));
2181
+ }
2182
+ }
2183
+ lastAsync$1.lastAsync = lastAsync;
2184
+
2185
+ var last$1 = {};
2186
+
2187
+ last$1.last = void 0;
2188
+ function last(iterable) {
2189
+ var _a;
2190
+ const iterator = iterable[Symbol.iterator]();
2191
+ let done;
2192
+ try {
2193
+ let value;
2194
+ let result;
2195
+ while ({ value, done } = iterator.next(), !done) {
2196
+ result = value;
2197
+ }
2198
+ return result;
2199
+ }
2200
+ finally {
2201
+ if (!done)
2202
+ (_a = iterator.return) === null || _a === void 0 ? void 0 : _a.call(iterator);
2203
+ }
2204
+ }
2205
+ last$1.last = last;
2206
+
2207
+ var toArrayAsync$1 = {};
2208
+
2209
+ toArrayAsync$1.toArrayAsync = void 0;
2210
+ const consume_1$3 = consume$1;
2211
+ function toArrayAsync(iterable) {
2212
+ return (0, consume_1$3.consume)(iterable, async (iterable) => {
2213
+ const result = [];
2214
+ for await (const element of iterable) {
2215
+ result.push(element);
2216
+ }
2217
+ return result;
2218
+ });
2219
+ }
2220
+ toArrayAsync$1.toArrayAsync = toArrayAsync;
2221
+
2222
+ var toArray$1 = {};
2223
+
2224
+ toArray$1.toArray = void 0;
2225
+ const consume_1$2 = consume$1;
2226
+ function toArray(iterable) {
2227
+ return (0, consume_1$2.consume)(iterable, iterable => Array.from(iterable));
2228
+ }
2229
+ toArray$1.toArray = toArray;
2230
+
2231
+ var toSetAsync$1 = {};
2232
+
2233
+ toSetAsync$1.toSetAsync = void 0;
2234
+ const consume_1$1 = consume$1;
2235
+ function toSetAsync(iterable) {
2236
+ return (0, consume_1$1.consume)(iterable, async (iterable) => {
2237
+ const result = new Set();
2238
+ for await (const element of iterable) {
2239
+ result.add(element);
2240
+ }
2241
+ return result;
2242
+ });
2243
+ }
2244
+ toSetAsync$1.toSetAsync = toSetAsync;
2245
+
2246
+ var toSet$1 = {};
2247
+
2248
+ toSet$1.toSet = void 0;
2249
+ const consume_1 = consume$1;
2250
+ function toSet(iterable) {
2251
+ return (0, consume_1.consume)(iterable, iterable => new Set(iterable));
2252
+ }
2253
+ toSet$1.toSet = toSet;
2254
+
2255
+ (function (exports) {
2256
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
2257
+ if (k2 === undefined) k2 = k;
2258
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
2259
+ }) : (function(o, m, k, k2) {
2260
+ if (k2 === undefined) k2 = k;
2261
+ o[k2] = m[k];
2262
+ }));
2263
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
2264
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
2265
+ };__exportStar(consume$1, exports);
2266
+ __exportStar(eachAsync$1, exports);
2267
+ __exportStar(each$1, exports);
2268
+ __exportStar(everyAsync$1, exports);
2269
+ __exportStar(every$1, exports);
2270
+ __exportStar(findAsync$1, exports);
2271
+ __exportStar(find$3, exports);
2272
+ __exportStar(firstAsync$1, exports);
2273
+ __exportStar(first$1, exports);
2274
+ __exportStar(includesAsync$1, exports);
2275
+ __exportStar(includes$1, exports);
2276
+ __exportStar(matchAsync$1, exports);
2277
+ __exportStar(match$2, exports);
2278
+ __exportStar(reduceAsync$1, exports);
2279
+ __exportStar(reduce$1, exports);
2280
+ __exportStar(someAsync$1, exports);
2281
+ __exportStar(some$1, exports);
2282
+ __exportStar(lastAsync$1, exports);
2283
+ __exportStar(last$1, exports);
2284
+ __exportStar(toArrayAsync$1, exports);
2285
+ __exportStar(toArray$1, exports);
2286
+ __exportStar(toSetAsync$1, exports);
2287
+ __exportStar(toSet$1, exports);
2288
+
2289
+ }(output));
2290
+
2291
+ (function (exports) {
2292
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
2293
+ if (k2 === undefined) k2 = k;
2294
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
2295
+ }) : (function(o, m, k, k2) {
2296
+ if (k2 === undefined) k2 = k;
2297
+ o[k2] = m[k];
2298
+ }));
2299
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
2300
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
2301
+ };__exportStar(middleware, exports);
2302
+ __exportStar(output, exports);
2303
+
2304
+ }(es2018$5));
2305
+
2306
+ unwrap$1.unwrap = void 0;
2307
+ const flat_map_1 = flatMap$1;
2308
+ const iterable_operator_1$2 = es2018$5;
2309
+ function unwrap(node, predicate) {
2310
+ return (0, flat_map_1.flatMap)(node, node => {
2311
+ if (predicate(node)) {
2312
+ return (0, iterable_operator_1$2.toArray)((0, iterable_operator_1$2.flatten)((0, iterable_operator_1$2.map)(node.childNodes, node => unwrap(node, predicate))));
2313
+ }
2314
+ else {
2315
+ return [node];
2316
+ }
2317
+ });
2318
+ }
2319
+ unwrap$1.unwrap = unwrap;
2320
+
2321
+ var find$1 = {};
2322
+
2323
+ var findInDescendantNodes$1 = {};
2324
+
2325
+ var traverseDescendantNodes$1 = {};
2326
+
2327
+ traverseDescendantNodes$1.traverseDescendantNodes = void 0;
2328
+ function* traverseDescendantNodes(node) {
2329
+ for (const childNode of node.childNodes) {
2330
+ yield childNode;
2331
+ yield* traverseDescendantNodes(childNode);
2332
+ }
2333
+ }
2334
+ traverseDescendantNodes$1.traverseDescendantNodes = traverseDescendantNodes;
2335
+
2336
+ findInDescendantNodes$1.findInDescendantNodes = void 0;
2337
+ const traverse_descendant_nodes_1 = traverseDescendantNodes$1;
2338
+ const iterable_operator_1$1 = es2018$5;
2339
+ function findInDescendantNodes(node, predicate) {
2340
+ return (0, iterable_operator_1$1.find)((0, traverse_descendant_nodes_1.traverseDescendantNodes)(node), node => predicate(node));
2341
+ }
2342
+ findInDescendantNodes$1.findInDescendantNodes = findInDescendantNodes;
2343
+
2344
+ find$1.find = void 0;
2345
+ const find_in_descendant_nodes_1 = findInDescendantNodes$1;
2346
+ function find(node, predicate) {
2347
+ if (predicate(node))
2348
+ return node;
2349
+ return (0, find_in_descendant_nodes_1.findInDescendantNodes)(node, predicate);
2350
+ }
2351
+ find$1.find = find;
2352
+
2353
+ var parse$1 = {};
2354
+
2355
+ parse$1.parse = void 0;
2356
+ function parse(html) {
2357
+ const div = document.createElement('div');
2358
+ div.innerHTML = html;
2359
+ return [...div.childNodes];
2360
+ }
2361
+ parse$1.parse = parse;
2362
+
2363
+ var stringify$1 = {};
2364
+
2365
+ stringify$1.stringify = void 0;
2366
+ function stringify(nodes) {
2367
+ const div = document.createElement('div');
2368
+ nodes.forEach(x => div.append(x.cloneNode(true)));
2369
+ return div.innerHTML;
2370
+ }
2371
+ stringify$1.stringify = stringify;
2372
+
2373
+ var normalize$1 = {};
2374
+
2375
+ normalize$1.normalize = void 0;
2376
+ const parse_1 = parse$1;
2377
+ const stringify_1 = stringify$1;
2378
+ function normalize(html) {
2379
+ return (0, stringify_1.stringify)((0, parse_1.parse)(html));
2380
+ }
2381
+ normalize$1.normalize = normalize;
2382
+
2383
+ var removeAttributes$1 = {};
2384
+
2385
+ removeAttributes$1.removeAttributes = void 0;
2386
+ function removeAttributes(node, predicate) {
2387
+ if (node instanceof Element) {
2388
+ const attributeNames = Array.from(node.attributes).map(x => x.name);
2389
+ for (const name of attributeNames) {
2390
+ if (predicate(name)) {
2391
+ node.removeAttribute(name);
2392
+ }
2393
+ }
2394
+ }
2395
+ }
2396
+ removeAttributes$1.removeAttributes = removeAttributes;
2397
+
2398
+ var getBySelector$1 = {};
2399
+
2400
+ var isDocument$1 = {};
2401
+
2402
+ var nodeType = {};
2403
+
2404
+ (function (exports) {
2405
+ exports.NodeType = void 0;
2406
+ const nodeExists = 'Node' in globalThis;
2407
+ (function (NodeType) {
2408
+ NodeType[NodeType["ELEMENT_NODE"] = nodeExists
2409
+ ? globalThis.Node.ELEMENT_NODE
2410
+ : 1] = "ELEMENT_NODE";
2411
+ NodeType[NodeType["ATTRIBUTE_NODE"] = nodeExists
2412
+ ? globalThis.Node.ATTRIBUTE_NODE
2413
+ : 2] = "ATTRIBUTE_NODE";
2414
+ NodeType[NodeType["TEXT_NODE"] = nodeExists
2415
+ ? globalThis.Node.TEXT_NODE
2416
+ : 3] = "TEXT_NODE";
2417
+ NodeType[NodeType["CDATA_SECTION_NODE"] = nodeExists
2418
+ ? globalThis.Node.CDATA_SECTION_NODE
2419
+ : 4] = "CDATA_SECTION_NODE";
2420
+ NodeType[NodeType["ENTITY_REFERENCE_NODE"] = nodeExists
2421
+ ? globalThis.Node.ENTITY_REFERENCE_NODE
2422
+ : 5] = "ENTITY_REFERENCE_NODE";
2423
+ NodeType[NodeType["ENTITY_NODE"] = nodeExists
2424
+ ? globalThis.Node.ENTITY_NODE
2425
+ : 6] = "ENTITY_NODE";
2426
+ NodeType[NodeType["PROCESSING_INSTRUCTION_NODE"] = nodeExists
2427
+ ? globalThis.Node.PROCESSING_INSTRUCTION_NODE
2428
+ : 7] = "PROCESSING_INSTRUCTION_NODE";
2429
+ NodeType[NodeType["COMMENT_NODE"] = nodeExists
2430
+ ? globalThis.Node.COMMENT_NODE
2431
+ : 8] = "COMMENT_NODE";
2432
+ NodeType[NodeType["DOCUMENT_NODE"] = nodeExists
2433
+ ? globalThis.Node.DOCUMENT_NODE
2434
+ : 9] = "DOCUMENT_NODE";
2435
+ NodeType[NodeType["DOCUMENT_TYPE_NODE"] = nodeExists
2436
+ ? globalThis.Node.DOCUMENT_TYPE_NODE
2437
+ : 10] = "DOCUMENT_TYPE_NODE";
2438
+ NodeType[NodeType["DOCUMENT_FRAGMENT_NODE"] = nodeExists
2439
+ ? globalThis.Node.DOCUMENT_FRAGMENT_NODE
2440
+ : 11] = "DOCUMENT_FRAGMENT_NODE";
2441
+ NodeType[NodeType["NOTATION_NODE"] = nodeExists
2442
+ ? globalThis.Node.NOTATION_NODE
2443
+ : 12] = "NOTATION_NODE";
2444
+ })(exports.NodeType || (exports.NodeType = {}));
2445
+
2446
+ }(nodeType));
2447
+
2448
+ isDocument$1.isDocument = void 0;
2449
+ const node_type_1$2 = nodeType;
2450
+ const types_1$3 = es2018$2;
2451
+ function isDocument(val) {
2452
+ if ('HTMLDocument' in globalThis && val instanceof HTMLDocument)
2453
+ return true;
2454
+ return (0, types_1$3.isRecord)(val) && val.nodeType === node_type_1$2.NodeType.DOCUMENT_NODE;
2455
+ }
2456
+ isDocument$1.isDocument = isDocument;
2457
+
2458
+ var isElement$1 = {};
2459
+
2460
+ isElement$1.isElement = void 0;
2461
+ const node_type_1$1 = nodeType;
2462
+ const types_1$2 = es2018$2;
2463
+ function isElement(val) {
2464
+ if ('HTMLElement' in globalThis && val instanceof HTMLElement)
2465
+ return true;
2466
+ return (0, types_1$2.isRecord)(val) && val.nodeType === node_type_1$1.NodeType.ELEMENT_NODE;
2467
+ }
2468
+ isElement$1.isElement = isElement;
2469
+
2470
+ getBySelector$1.getBySelector = void 0;
2471
+ const is_document_1$2 = isDocument$1;
2472
+ const is_element_1$4 = isElement$1;
2473
+ function getBySelector(selectors) {
2474
+ const root = ((0, is_element_1$4.isElement)(this) || (0, is_document_1$2.isDocument)(this)
2475
+ ? this
2476
+ : document);
2477
+ const result = root.querySelector(selectors);
2478
+ if (result) {
2479
+ return result;
2480
+ }
2481
+ else {
2482
+ throw new Error(`Could not find any elements matching ${selectors}`);
2483
+ }
2484
+ }
2485
+ getBySelector$1.getBySelector = getBySelector;
2486
+
2487
+ var getAllBySelector$1 = {};
2488
+
2489
+ getAllBySelector$1.getAllBySelector = void 0;
2490
+ const is_document_1$1 = isDocument$1;
2491
+ const is_element_1$3 = isElement$1;
2492
+ function getAllBySelector(selectors) {
2493
+ const root = ((0, is_element_1$3.isElement)(this) || (0, is_document_1$1.isDocument)(this)
2494
+ ? this
2495
+ : document);
2496
+ const results = root.querySelectorAll(selectors);
2497
+ if (results.length) {
2498
+ return Array.from(results);
2499
+ }
2500
+ else {
2501
+ throw new Error(`Could not find any elements matching ${selectors}`);
2502
+ }
2503
+ }
2504
+ getAllBySelector$1.getAllBySelector = getAllBySelector;
2505
+
2506
+ var traverseAncestorNodes$1 = {};
2507
+
2508
+ traverseAncestorNodes$1.traverseAncestorNodes = void 0;
2509
+ function* traverseAncestorNodes(node) {
2510
+ const parentNode = node.parentNode;
2511
+ if (parentNode) {
2512
+ yield parentNode;
2513
+ yield* traverseAncestorNodes(parentNode);
2514
+ }
2515
+ }
2516
+ traverseAncestorNodes$1.traverseAncestorNodes = traverseAncestorNodes;
2517
+
2518
+ var findInAncestorNodes$1 = {};
2519
+
2520
+ findInAncestorNodes$1.findInAncestorNodes = void 0;
2521
+ const traverse_ancestor_nodes_1 = traverseAncestorNodes$1;
2522
+ const iterable_operator_1 = es2018$5;
2523
+ function findInAncestorNodes(node, predicate) {
2524
+ return (0, iterable_operator_1.find)((0, traverse_ancestor_nodes_1.traverseAncestorNodes)(node), node => predicate(node));
2525
+ }
2526
+ findInAncestorNodes$1.findInAncestorNodes = findInAncestorNodes;
2527
+
2528
+ var findInFollowingSiblingNodes$1 = {};
2529
+
2530
+ findInFollowingSiblingNodes$1.findInFollowingSiblingNodes = void 0;
2531
+ function findInFollowingSiblingNodes(node, predicate) {
2532
+ const nextNode = node.nextSibling;
2533
+ if (!nextNode)
2534
+ return undefined;
2535
+ if (predicate(nextNode)) {
2536
+ return nextNode;
2537
+ }
2538
+ else {
2539
+ return findInFollowingSiblingNodes(nextNode, predicate);
2540
+ }
2541
+ }
2542
+ findInFollowingSiblingNodes$1.findInFollowingSiblingNodes = findInFollowingSiblingNodes;
2543
+
2544
+ var findInPrecedingSiblingNodes$1 = {};
2545
+
2546
+ findInPrecedingSiblingNodes$1.findInPrecedingSiblingNodes = void 0;
2547
+ function findInPrecedingSiblingNodes(node, predicate) {
2548
+ const previousNode = node.previousSibling;
2549
+ if (!previousNode)
2550
+ return undefined;
2551
+ if (predicate(previousNode)) {
2552
+ return previousNode;
2553
+ }
2554
+ else {
2555
+ return findInPrecedingSiblingNodes(previousNode, predicate);
2556
+ }
2557
+ }
2558
+ findInPrecedingSiblingNodes$1.findInPrecedingSiblingNodes = findInPrecedingSiblingNodes;
2559
+
2560
+ var parentNode$1 = {};
2561
+
2562
+ parentNode$1.parentNode = void 0;
2563
+ const errors_1$6 = es2018$3;
2564
+ function parentNode(node, distance = 1) {
2565
+ (0, errors_1$6.assert)(Number.isInteger(distance), 'parameter distance must be an integer');
2566
+ (0, errors_1$6.assert)(distance >= 1, 'parameter distance must be greater than or equal to 1');
2567
+ return _parentNode(node, distance);
2568
+ }
2569
+ parentNode$1.parentNode = parentNode;
2570
+ function _parentNode(node, distance) {
2571
+ const currentNode = node.parentNode;
2572
+ if (!currentNode)
2573
+ return undefined;
2574
+ if (distance === 1) {
2575
+ return currentNode;
2576
+ }
2577
+ else {
2578
+ return _parentNode(currentNode, distance - 1);
2579
+ }
2580
+ }
2581
+
2582
+ var nextSibling$2 = {};
2583
+
2584
+ nextSibling$2.nextSibling = void 0;
2585
+ const errors_1$5 = es2018$3;
2586
+ function nextSibling$1(node, distance = 1) {
2587
+ (0, errors_1$5.assert)(Number.isInteger(distance), 'parameter distance must be an integer');
2588
+ (0, errors_1$5.assert)(distance >= 1, 'parameter distance must be greater than or equal to 1');
2589
+ return _nextSibling(node, distance);
2590
+ }
2591
+ nextSibling$2.nextSibling = nextSibling$1;
2592
+ function _nextSibling(node, distance) {
2593
+ const currentNode = node.nextSibling;
2594
+ if (!currentNode)
2595
+ return undefined;
2596
+ if (distance === 1) {
2597
+ return currentNode;
2598
+ }
2599
+ else {
2600
+ return _nextSibling(currentNode, distance - 1);
2601
+ }
2602
+ }
2603
+
2604
+ var previousSibling$1 = {};
2605
+
2606
+ previousSibling$1.previousSibling = void 0;
2607
+ const errors_1$4 = es2018$3;
2608
+ function previousSibling(node, distance = 1) {
2609
+ (0, errors_1$4.assert)(Number.isInteger(distance), 'parameter distance must be an integer');
2610
+ (0, errors_1$4.assert)(distance >= 1, 'parameter distance must be greater than or equal to 1');
2611
+ return _previousSibling(node, distance);
2612
+ }
2613
+ previousSibling$1.previousSibling = previousSibling;
2614
+ function _previousSibling(node, distance = 1) {
2615
+ const currentNode = node.previousSibling;
2616
+ if (!currentNode)
2617
+ return undefined;
2618
+ if (distance === 1) {
2619
+ return currentNode;
2620
+ }
2621
+ else {
2622
+ return _previousSibling(currentNode, distance - 1);
2623
+ }
2624
+ }
2625
+
2626
+ var nextElementSibling$2 = {};
2627
+
2628
+ nextElementSibling$2.nextElementSibling = void 0;
2629
+ const is_element_1$2 = isElement$1;
2630
+ const errors_1$3 = es2018$3;
2631
+ function nextElementSibling$1(node, distance = 1) {
2632
+ (0, errors_1$3.assert)(Number.isInteger(distance), 'parameter distance must be an integer');
2633
+ (0, errors_1$3.assert)(distance >= 1, 'parameter distance must be greater than or equal to 1');
2634
+ return _nextElementSibling(node, distance);
2635
+ }
2636
+ nextElementSibling$2.nextElementSibling = nextElementSibling$1;
2637
+ function _nextElementSibling(node, distance) {
2638
+ const currentNode = node.nextSibling;
2639
+ if (!currentNode)
2640
+ return undefined;
2641
+ if ((0, is_element_1$2.isElement)(currentNode)) {
2642
+ if (distance === 1) {
2643
+ return currentNode;
2644
+ }
2645
+ else {
2646
+ return _nextElementSibling(currentNode, distance - 1);
2647
+ }
2648
+ }
2649
+ else {
2650
+ return _nextElementSibling(currentNode, distance);
2651
+ }
2652
+ }
2653
+
2654
+ var previousElementSibling$1 = {};
2655
+
2656
+ previousElementSibling$1.previousElementSibling = void 0;
2657
+ const is_element_1$1 = isElement$1;
2658
+ const errors_1$2 = es2018$3;
2659
+ function previousElementSibling(node, distance = 1) {
2660
+ (0, errors_1$2.assert)(Number.isInteger(distance), 'parameter distance must be an integer');
2661
+ (0, errors_1$2.assert)(distance >= 1, 'parameter distance must be greater than or equal to 1');
2662
+ return _previousElementSibling(node, distance);
2663
+ }
2664
+ previousElementSibling$1.previousElementSibling = previousElementSibling;
2665
+ function _previousElementSibling(node, distance = 1) {
2666
+ const currentNode = node.previousSibling;
2667
+ if (!currentNode)
2668
+ return undefined;
2669
+ if ((0, is_element_1$1.isElement)(currentNode)) {
2670
+ if (distance === 1) {
2671
+ return currentNode;
2672
+ }
2673
+ else {
2674
+ return _previousElementSibling(currentNode, distance - 1);
2675
+ }
2676
+ }
2677
+ else {
2678
+ return _previousElementSibling(currentNode, distance);
2679
+ }
2680
+ }
2681
+
2682
+ var isntDocument$1 = {};
2683
+
2684
+ isntDocument$1.isntDocument = void 0;
2685
+ const is_document_1 = isDocument$1;
2686
+ function isntDocument(val) {
2687
+ return !(0, is_document_1.isDocument)(val);
2688
+ }
2689
+ isntDocument$1.isntDocument = isntDocument;
2690
+
2691
+ var isntElement$1 = {};
2692
+
2693
+ isntElement$1.isntElement = void 0;
2694
+ const is_element_1 = isElement$1;
2695
+ function isntElement(val) {
2696
+ return !(0, is_element_1.isElement)(val);
2697
+ }
2698
+ isntElement$1.isntElement = isntElement;
2699
+
2700
+ var isNode$1 = {};
2701
+
2702
+ isNode$1.isNode = void 0;
2703
+ const types_1$1 = es2018$2;
2704
+ function isNode(val) {
2705
+ if ('Node' in globalThis && val instanceof Node)
2706
+ return true;
2707
+ return (0, types_1$1.isObject)(val) && 'nodeType' in val;
2708
+ }
2709
+ isNode$1.isNode = isNode;
2710
+
2711
+ var isntNode$1 = {};
2712
+
2713
+ isntNode$1.isntNode = void 0;
2714
+ const is_node_1$1 = isNode$1;
2715
+ function isntNode(val) {
2716
+ return !(0, is_node_1$1.isNode)(val);
2717
+ }
2718
+ isntNode$1.isntNode = isntNode;
2719
+
2720
+ var isTextNode$1 = {};
2721
+
2722
+ isTextNode$1.isTextNode = void 0;
2723
+ const node_type_1 = nodeType;
2724
+ const types_1 = es2018$2;
2725
+ function isTextNode(val) {
2726
+ if ('Text' in globalThis && val instanceof Text)
2727
+ return true;
2728
+ return (0, types_1.isRecord)(val) && val.nodeType === node_type_1.NodeType.TEXT_NODE;
2729
+ }
2730
+ isTextNode$1.isTextNode = isTextNode;
2731
+
2732
+ var isntTextNode$1 = {};
2733
+
2734
+ isntTextNode$1.isntTextNode = void 0;
2735
+ const is_text_node_1 = isTextNode$1;
2736
+ function isntTextNode(val) {
2737
+ return !(0, is_text_node_1.isTextNode)(val);
2738
+ }
2739
+ isntTextNode$1.isntTextNode = isntTextNode;
2740
+
2741
+ var isParentNode$1 = {};
2742
+
2743
+ isParentNode$1.isParentNode = void 0;
2744
+ const is_node_1 = isNode$1;
2745
+ function isParentNode(val) {
2746
+ return (0, is_node_1.isNode)(val) && 'children' in val;
2747
+ }
2748
+ isParentNode$1.isParentNode = isParentNode;
2749
+
2750
+ var isntParentNode$1 = {};
2751
+
2752
+ isntParentNode$1.isntParentNode = void 0;
2753
+ const is_parent_node_1 = isParentNode$1;
2754
+ function isntParentNode(val) {
2755
+ return !(0, is_parent_node_1.isParentNode)(val);
2756
+ }
2757
+ isntParentNode$1.isntParentNode = isntParentNode;
2758
+
2759
+ var xpathResultType = {};
2760
+
2761
+ (function (exports) {
2762
+ exports.XPathResultType = void 0;
2763
+ const xpathResultExists = 'XPathResult' in globalThis;
2764
+ (function (XPathResultType) {
2765
+ XPathResultType[XPathResultType["ANY_TYPE"] = xpathResultExists
2766
+ ? globalThis.XPathResult.ANY_TYPE
2767
+ : 0] = "ANY_TYPE";
2768
+ XPathResultType[XPathResultType["NUMBER_TYPE"] = xpathResultExists
2769
+ ? globalThis.XPathResult.NUMBER_TYPE
2770
+ : 1] = "NUMBER_TYPE";
2771
+ XPathResultType[XPathResultType["STRING_TYPE"] = xpathResultExists
2772
+ ? globalThis.XPathResult.STRING_TYPE
2773
+ : 2] = "STRING_TYPE";
2774
+ XPathResultType[XPathResultType["BOOLEAN_TYPE"] = xpathResultExists
2775
+ ? globalThis.XPathResult.BOOLEAN_TYPE
2776
+ : 3] = "BOOLEAN_TYPE";
2777
+ XPathResultType[XPathResultType["UNORDERED_NODE_ITERATOR_TYPE"] = xpathResultExists
2778
+ ? globalThis.XPathResult.UNORDERED_NODE_ITERATOR_TYPE
2779
+ : 4] = "UNORDERED_NODE_ITERATOR_TYPE";
2780
+ XPathResultType[XPathResultType["ORDERED_NODE_ITERATOR_TYPE"] = xpathResultExists
2781
+ ? globalThis.XPathResult.ORDERED_NODE_ITERATOR_TYPE
2782
+ : 5] = "ORDERED_NODE_ITERATOR_TYPE";
2783
+ XPathResultType[XPathResultType["UNORDERED_NODE_SNAPSHOT_TYPE"] = xpathResultExists
2784
+ ? globalThis.XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE
2785
+ : 6] = "UNORDERED_NODE_SNAPSHOT_TYPE";
2786
+ XPathResultType[XPathResultType["ORDERED_NODE_SNAPSHOT_TYPE"] = xpathResultExists
2787
+ ? globalThis.XPathResult.ORDERED_NODE_SNAPSHOT_TYPE
2788
+ : 7] = "ORDERED_NODE_SNAPSHOT_TYPE";
2789
+ XPathResultType[XPathResultType["ANY_UNORDERED_NODE_TYPE"] = xpathResultExists
2790
+ ? globalThis.XPathResult.ANY_UNORDERED_NODE_TYPE
2791
+ : 8] = "ANY_UNORDERED_NODE_TYPE";
2792
+ XPathResultType[XPathResultType["FIRST_ORDERED_NODE_TYPE"] = xpathResultExists
2793
+ ? globalThis.XPathResult.FIRST_ORDERED_NODE_TYPE
2794
+ : 9] = "FIRST_ORDERED_NODE_TYPE";
2795
+ })(exports.XPathResultType || (exports.XPathResultType = {}));
2796
+
2797
+ }(xpathResultType));
2798
+
2799
+ var replaceBrWithNewline$1 = {};
2800
+
2801
+ replaceBrWithNewline$1.replaceBrWithNewline = void 0;
2802
+ const map_1 = map$3;
2803
+ function replaceBrWithNewline(node) {
2804
+ return (0, map_1.map)(node, node => {
2805
+ if (node.nodeName === 'BR') {
2806
+ return document.createTextNode('\n');
2807
+ }
2808
+ else {
2809
+ return node;
2810
+ }
2811
+ });
2812
+ }
2813
+ replaceBrWithNewline$1.replaceBrWithNewline = replaceBrWithNewline;
2814
+
2815
+ var isBefore$1 = {};
2816
+
2817
+ isBefore$1.isBefore = void 0;
2818
+ function isBefore(subject, object) {
2819
+ if (subject.compareDocumentPosition(object) & Node.DOCUMENT_POSITION_FOLLOWING) {
2820
+ return true;
2821
+ }
2822
+ else {
2823
+ return false;
2824
+ }
2825
+ }
2826
+ isBefore$1.isBefore = isBefore;
2827
+
2828
+ var isAfter$1 = {};
2829
+
2830
+ isAfter$1.isAfter = void 0;
2831
+ function isAfter(subject, object) {
2832
+ if (subject.compareDocumentPosition(object) & Node.DOCUMENT_POSITION_PRECEDING) {
2833
+ return true;
2834
+ }
2835
+ else {
2836
+ return false;
2837
+ }
2838
+ }
2839
+ isAfter$1.isAfter = isAfter;
2840
+
2841
+ (function (exports) {
2842
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
2843
+ if (k2 === undefined) k2 = k;
2844
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
2845
+ }) : (function(o, m, k, k2) {
2846
+ if (k2 === undefined) k2 = k;
2847
+ o[k2] = m[k];
2848
+ }));
2849
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
2850
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
2851
+ };__exportStar(flatMap$1, exports);
2852
+ __exportStar(map$3, exports);
2853
+ __exportStar(filter$3, exports);
2854
+ __exportStar(unwrap$1, exports);
2855
+ __exportStar(find$1, exports);
2856
+ __exportStar(parse$1, exports);
2857
+ __exportStar(stringify$1, exports);
2858
+ __exportStar(normalize$1, exports);
2859
+ __exportStar(removeAllChildren$1, exports);
2860
+ __exportStar(removeAttributes$1, exports);
2861
+ __exportStar(getBySelector$1, exports);
2862
+ __exportStar(getAllBySelector$1, exports);
2863
+ __exportStar(traverseAncestorNodes$1, exports);
2864
+ __exportStar(findInAncestorNodes$1, exports);
2865
+ __exportStar(traverseDescendantNodes$1, exports);
2866
+ __exportStar(findInDescendantNodes$1, exports);
2867
+ __exportStar(findInFollowingSiblingNodes$1, exports);
2868
+ __exportStar(findInPrecedingSiblingNodes$1, exports);
2869
+ __exportStar(parentNode$1, exports);
2870
+ __exportStar(nextSibling$2, exports);
2871
+ __exportStar(previousSibling$1, exports);
2872
+ __exportStar(nextElementSibling$2, exports);
2873
+ __exportStar(previousElementSibling$1, exports);
2874
+ __exportStar(isDocument$1, exports);
2875
+ __exportStar(isntDocument$1, exports);
2876
+ __exportStar(isElement$1, exports);
2877
+ __exportStar(isntElement$1, exports);
2878
+ __exportStar(isNode$1, exports);
2879
+ __exportStar(isntNode$1, exports);
2880
+ __exportStar(isTextNode$1, exports);
2881
+ __exportStar(isntTextNode$1, exports);
2882
+ __exportStar(isParentNode$1, exports);
2883
+ __exportStar(isntParentNode$1, exports);
2884
+ __exportStar(nodeType, exports);
2885
+ __exportStar(xpathResultType, exports);
2886
+ __exportStar(replaceBrWithNewline$1, exports);
2887
+ __exportStar(isBefore$1, exports);
2888
+ __exportStar(isAfter$1, exports);
2889
+
2890
+ }(es2018$6));
2891
+
2892
+ function matchOneByOne(context, source, ...matchers) {
2893
+ if (matchers.length === 0)
2894
+ return true;
2895
+ if (!source)
2896
+ return false;
2897
+ const [matcher, ...otherMatchers] = matchers;
2898
+ const result = Reflect.apply(matcher, context, [source]);
2899
+ // TerminalMatcher
2900
+ if (es2018$2.isBoolean(result)) {
2901
+ if (result) {
2902
+ const nextNode = context.next(source);
2903
+ return matchOneByOne(context, nextNode, ...otherMatchers);
2904
+ }
2905
+ else {
2906
+ return false;
2907
+ }
2908
+ }
2909
+ // 此处一定是成功匹配, 因为SkipMatcher在失败时会返回false.
2910
+ if (es2018$2.isNumber(result)) {
2911
+ const distance = result;
2912
+ const nextNode = context.next(source, distance);
2913
+ return matchOneByOne(context, nextNode, ...otherMatchers);
2914
+ }
2915
+ // SkipMatcher返回Iterable意味着存在多种可能性, 可能出现失败回溯.
2916
+ if (es2018$2.isIterable(result)) {
2917
+ for (const distance of result) {
2918
+ const nextNode = context.next(source, distance);
2919
+ if (matchOneByOne(context, nextNode, ...otherMatchers)) {
2920
+ return true;
2921
+ }
2922
+ }
2923
+ // 尝试了所有可能性, 未发现可以匹配的结果
2924
+ return false;
2925
+ }
2926
+ throw new Error('Unknown return value');
2927
+ }
2928
+
2929
+ function nextSibling(node, distance = 1) {
2930
+ if (distance === 0)
2931
+ return node;
2932
+ return es2018$6.nextSibling(node, distance);
2933
+ }
2934
+
2935
+ function match(node, ...matchers) {
2936
+ const document = es2018$6.isDocument(this) ? this : globalThis.document;
2937
+ const context = {
2938
+ document,
2939
+ collection: {},
2940
+ next: nextSibling
2941
+ };
2942
+ if (matchOneByOne(context, node, ...matchers)) {
2943
+ return context.collection;
2944
+ }
2945
+ else {
2946
+ return null;
2947
+ }
2948
+ }
2949
+
2950
+ function nextElementSibling(node, distance = 1) {
2951
+ if (distance === 0)
2952
+ return node;
2953
+ return es2018$6.nextElementSibling(node, distance);
2954
+ }
2955
+
2956
+ function matchElement(element, ...matchers) {
2957
+ const document = es2018$6.isDocument(this) ? this : globalThis.document;
2958
+ const context = {
2959
+ document,
2960
+ collection: {},
2961
+ next: nextElementSibling
2962
+ };
2963
+ if (matchOneByOne(context, element, ...matchers)) {
2964
+ return context.collection;
2965
+ }
2966
+ else {
2967
+ return null;
2968
+ }
2969
+ }
2970
+
2971
+ function anyOf(...matchers) {
2972
+ return function (node) {
2973
+ return matchers.some(match => match.call(this, node));
2974
+ };
2975
+ }
2976
+
2977
+ function merge(target, source) {
2978
+ for (const [key, value] of Object.entries(source)) {
2979
+ if (target[key]) {
2980
+ if (Array.isArray(target[key])) {
2981
+ if (Array.isArray(value)) {
2982
+ target[key] = [...target[key], ...value];
2983
+ }
2984
+ else {
2985
+ target[key] = [...target[key], value];
2986
+ }
2987
+ }
2988
+ else {
2989
+ if (Array.isArray(value)) {
2990
+ target[key] = [target[key], ...value];
2991
+ }
2992
+ else {
2993
+ target[key] = [target[key], value];
2994
+ }
2995
+ }
2996
+ }
2997
+ else {
2998
+ target[key] = value;
2999
+ }
3000
+ }
3001
+ }
3002
+
3003
+ function childNodes(...matchers) {
3004
+ return function (node) {
3005
+ // 空matchers意味着"childNodes应该为空".
3006
+ if (matchers.length === 0) {
3007
+ return node.childNodes.length === 0;
3008
+ }
3009
+ if (node.childNodes.length === 0)
3010
+ return false;
3011
+ const context = {
3012
+ ...this,
3013
+ collection: {},
3014
+ next: nextSibling
3015
+ };
3016
+ const result = matchOneByOne(context, node.childNodes[0], ...matchers);
3017
+ if (result) {
3018
+ merge(this.collection, context.collection);
3019
+ }
3020
+ return result;
3021
+ };
3022
+ }
3023
+
3024
+ function children(...matchers) {
3025
+ return function (element) {
3026
+ // 空matchers意味着"children应该为空".
3027
+ if (matchers.length === 0) {
3028
+ return element.children.length === 0;
3029
+ }
3030
+ if (element.children.length === 0)
3031
+ return false;
3032
+ const context = {
3033
+ ...this,
3034
+ collection: {},
3035
+ next: nextElementSibling
3036
+ };
3037
+ const result = matchOneByOne(context, element.children[0], ...matchers);
3038
+ if (result) {
3039
+ merge(this.collection, context.collection);
3040
+ }
3041
+ return result;
3042
+ };
3043
+ }
3044
+
3045
+ function concat(strings, values) {
3046
+ const result = [];
3047
+ for (let i = 0, len = values.length; i < len; i++) {
3048
+ result.push(strings[i]);
3049
+ result.push(values[i]);
3050
+ }
3051
+ result.push(strings[strings.length - 1]);
3052
+ return result;
3053
+ }
3054
+
3055
+ function css(...args) {
3056
+ if (es2018$2.isString(args[0])) {
3057
+ const [selector] = args;
3058
+ return (element) => element.matches(selector);
3059
+ }
3060
+ else {
3061
+ const [strings, ...values] = args;
3062
+ const selector = concat(strings, values).join('');
3063
+ return css(selector);
3064
+ }
3065
+ }
3066
+
3067
+ function element(...args) {
3068
+ if (Array.isArray(args[0])) {
3069
+ const [strings, ...values] = args;
3070
+ const name = concat(strings, values).join('');
3071
+ return (...matchers) => element(name, ...matchers);
3072
+ }
3073
+ if (es2018$2.isString(args[0])) {
3074
+ const [name, ...matchers] = args;
3075
+ return function (_element) {
3076
+ const result = element(...matchers).call(this, _element);
3077
+ if (result) {
3078
+ merge(this.collection, { [name]: _element });
3079
+ }
3080
+ return result;
3081
+ };
3082
+ }
3083
+ const [...matchers] = args;
3084
+ return function (element) {
3085
+ if (es2018$6.isntElement(element))
3086
+ return false;
3087
+ if (matchers.length === 0)
3088
+ return true;
3089
+ return matchers.every(match => match.call(this, element));
3090
+ };
3091
+ }
3092
+
3093
+ var es2018$1 = {};
3094
+
3095
+ var of$1 = {};
3096
+
3097
+ of$1.of = void 0;
3098
+ function* of(val) {
3099
+ yield val;
3100
+ }
3101
+ of$1.of = of;
3102
+
3103
+ var repeat$2 = {};
3104
+
3105
+ repeat$2.repeat = void 0;
3106
+ const errors_1$1 = es2018$3;
3107
+ function repeat$1(val, times = Infinity) {
3108
+ (0, errors_1$1.assert)(times === Infinity || Number.isInteger(times), 'The parameter times must be an integer');
3109
+ return (function* () {
3110
+ while (times-- > 0) {
3111
+ yield val;
3112
+ }
3113
+ })();
3114
+ }
3115
+ repeat$2.repeat = repeat$1;
3116
+
3117
+ var countdown$1 = {};
3118
+
3119
+ countdown$1.countdown = void 0;
3120
+ function* countdown(begin, end) {
3121
+ if (begin < end)
3122
+ return;
3123
+ for (let i = begin; i >= end; i--) {
3124
+ yield i;
3125
+ }
3126
+ }
3127
+ countdown$1.countdown = countdown;
3128
+
3129
+ var countup$1 = {};
3130
+
3131
+ countup$1.countup = void 0;
3132
+ function* countup(begin, end) {
3133
+ if (begin > end)
3134
+ return;
3135
+ for (let i = begin; i <= end; i++) {
3136
+ yield i;
3137
+ }
3138
+ }
3139
+ countup$1.countup = countup;
3140
+
3141
+ var range$1 = {};
3142
+
3143
+ range$1.range = void 0;
3144
+ const errors_1 = es2018$3;
3145
+ function range(start, end, step = 1) {
3146
+ (0, errors_1.assert)(step > 0, 'step parameter must be greater than 0');
3147
+ return rangeByUnsignedStep(start, end, step);
3148
+ }
3149
+ range$1.range = range;
3150
+ function* rangeByUnsignedStep(start, end, step) {
3151
+ if (start < end) {
3152
+ for (let i = start; i < end; i += step) {
3153
+ yield i;
3154
+ }
3155
+ }
3156
+ else {
3157
+ for (let i = start; i > end; i -= step) {
3158
+ yield i;
3159
+ }
3160
+ }
3161
+ }
3162
+
3163
+ var stringifyJsonStream = {};
3164
+
3165
+ stringifyJsonStream.stringifyJSONStream = void 0;
3166
+ function* stringifyJSONStream(iterable) {
3167
+ var _a;
3168
+ const iter = iterable[Symbol.iterator]();
3169
+ let done;
3170
+ try {
3171
+ let value;
3172
+ ({ value, done } = iter.next());
3173
+ yield '[';
3174
+ if (!done)
3175
+ yield JSON.stringify(value);
3176
+ while ({ value, done } = iter.next(), !done) {
3177
+ yield ',' + JSON.stringify(value);
3178
+ }
3179
+ yield ']';
3180
+ }
3181
+ finally {
3182
+ if (!done)
3183
+ (_a = iter.return) === null || _a === void 0 ? void 0 : _a.call(iter);
3184
+ }
3185
+ }
3186
+ stringifyJsonStream.stringifyJSONStream = stringifyJSONStream;
3187
+
3188
+ var stringifyJsonStreamAsync = {};
3189
+
3190
+ stringifyJsonStreamAsync.stringifyJSONStreamAsync = void 0;
3191
+ async function* stringifyJSONStreamAsync(asyncIterable) {
3192
+ var _a;
3193
+ const iter = asyncIterable[Symbol.asyncIterator]();
3194
+ let done;
3195
+ try {
3196
+ let value;
3197
+ ({ value, done } = await iter.next());
3198
+ yield '[';
3199
+ if (!done)
3200
+ yield JSON.stringify(value);
3201
+ while ({ value, done } = await iter.next(), !done) {
3202
+ yield ',' + JSON.stringify(value);
3203
+ }
3204
+ yield ']';
3205
+ }
3206
+ finally {
3207
+ if (!done)
3208
+ await ((_a = iter.return) === null || _a === void 0 ? void 0 : _a.call(iter));
3209
+ }
3210
+ }
3211
+ stringifyJsonStreamAsync.stringifyJSONStreamAsync = stringifyJSONStreamAsync;
3212
+
3213
+ var stringifyNdjsonStream = {};
3214
+
3215
+ stringifyNdjsonStream.stringifyNDJSONStream = void 0;
3216
+ function* stringifyNDJSONStream(iterable) {
3217
+ var _a;
3218
+ const iter = iterable[Symbol.iterator]();
3219
+ let done;
3220
+ try {
3221
+ let value;
3222
+ ({ value, done } = iter.next());
3223
+ if (!done)
3224
+ yield JSON.stringify(value);
3225
+ while ({ value, done } = iter.next(), !done) {
3226
+ yield '\n' + JSON.stringify(value);
3227
+ }
3228
+ }
3229
+ finally {
3230
+ if (!done)
3231
+ (_a = iter.return) === null || _a === void 0 ? void 0 : _a.call(iter);
3232
+ }
3233
+ }
3234
+ stringifyNdjsonStream.stringifyNDJSONStream = stringifyNDJSONStream;
3235
+
3236
+ var stringifyNdjsonStreamAsync = {};
3237
+
3238
+ stringifyNdjsonStreamAsync.stringifyNDJSONStreamAsync = void 0;
3239
+ async function* stringifyNDJSONStreamAsync(asyncIterable) {
3240
+ var _a;
3241
+ const iter = asyncIterable[Symbol.asyncIterator]();
3242
+ let done;
3243
+ try {
3244
+ let value;
3245
+ ({ value, done } = await iter.next());
3246
+ if (!done)
3247
+ yield JSON.stringify(value);
3248
+ while ({ value, done } = await iter.next(), !done) {
3249
+ yield '\n' + JSON.stringify(value);
3250
+ }
3251
+ }
3252
+ finally {
3253
+ if (!done)
3254
+ await ((_a = iter.return) === null || _a === void 0 ? void 0 : _a.call(iter));
3255
+ }
3256
+ }
3257
+ stringifyNdjsonStreamAsync.stringifyNDJSONStreamAsync = stringifyNDJSONStreamAsync;
3258
+
3259
+ var sse$1 = {};
3260
+
3261
+ sse$1.sse = void 0;
3262
+ function* sse(message) {
3263
+ if (message.event)
3264
+ yield `event: ${message.event}\n`;
3265
+ for (const line of message.data.split('\n')) {
3266
+ yield `data: ${line}\n`;
3267
+ }
3268
+ if (message.id)
3269
+ yield `id: ${message.id}\n`;
3270
+ if (message.retry)
3271
+ yield `retry: ${message.retry}\n`;
3272
+ yield '\n';
3273
+ }
3274
+ sse$1.sse = sse;
3275
+
3276
+ var reusableIterable = {};
3277
+
3278
+ var es2018 = {};
3279
+
3280
+ var lazy$1 = {};
3281
+
3282
+ /**
3283
+ * lodash (Custom Build) <https://lodash.com/>
3284
+ * Build: `lodash modularize exports="npm" -o ./`
3285
+ * Copyright jQuery Foundation and other contributors <https://jquery.org/>
3286
+ * Released under MIT license <https://lodash.com/license>
3287
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
3288
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
3289
+ */
3290
+
3291
+ /** Used as the `TypeError` message for "Functions" methods. */
3292
+ var FUNC_ERROR_TEXT = 'Expected a function';
3293
+
3294
+ /** Used as references for various `Number` constants. */
3295
+ var INFINITY = 1 / 0,
3296
+ MAX_INTEGER = 1.7976931348623157e+308,
3297
+ NAN = 0 / 0;
3298
+
3299
+ /** `Object#toString` result references. */
3300
+ var symbolTag = '[object Symbol]';
3301
+
3302
+ /** Used to match leading and trailing whitespace. */
3303
+ var reTrim = /^\s+|\s+$/g;
3304
+
3305
+ /** Used to detect bad signed hexadecimal string values. */
3306
+ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
3307
+
3308
+ /** Used to detect binary string values. */
3309
+ var reIsBinary = /^0b[01]+$/i;
3310
+
3311
+ /** Used to detect octal string values. */
3312
+ var reIsOctal = /^0o[0-7]+$/i;
3313
+
3314
+ /** Built-in method references without a dependency on `root`. */
3315
+ var freeParseInt = parseInt;
3316
+
3317
+ /** Used for built-in method references. */
3318
+ var objectProto = Object.prototype;
3319
+
3320
+ /**
3321
+ * Used to resolve the
3322
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
3323
+ * of values.
3324
+ */
3325
+ var objectToString = objectProto.toString;
3326
+
3327
+ /**
3328
+ * Creates a function that invokes `func`, with the `this` binding and arguments
3329
+ * of the created function, while it's called less than `n` times. Subsequent
3330
+ * calls to the created function return the result of the last `func` invocation.
3331
+ *
3332
+ * @static
3333
+ * @memberOf _
3334
+ * @since 3.0.0
3335
+ * @category Function
3336
+ * @param {number} n The number of calls at which `func` is no longer invoked.
3337
+ * @param {Function} func The function to restrict.
3338
+ * @returns {Function} Returns the new restricted function.
3339
+ * @example
3340
+ *
3341
+ * jQuery(element).on('click', _.before(5, addContactToList));
3342
+ * // => Allows adding up to 4 contacts to the list.
3343
+ */
3344
+ function before(n, func) {
3345
+ var result;
3346
+ if (typeof func != 'function') {
3347
+ throw new TypeError(FUNC_ERROR_TEXT);
3348
+ }
3349
+ n = toInteger(n);
3350
+ return function() {
3351
+ if (--n > 0) {
3352
+ result = func.apply(this, arguments);
3353
+ }
3354
+ if (n <= 1) {
3355
+ func = undefined;
3356
+ }
3357
+ return result;
3358
+ };
3359
+ }
3360
+
3361
+ /**
3362
+ * Creates a function that is restricted to invoking `func` once. Repeat calls
3363
+ * to the function return the value of the first invocation. The `func` is
3364
+ * invoked with the `this` binding and arguments of the created function.
3365
+ *
3366
+ * @static
3367
+ * @memberOf _
3368
+ * @since 0.1.0
3369
+ * @category Function
3370
+ * @param {Function} func The function to restrict.
3371
+ * @returns {Function} Returns the new restricted function.
3372
+ * @example
3373
+ *
3374
+ * var initialize = _.once(createApplication);
3375
+ * initialize();
3376
+ * initialize();
3377
+ * // => `createApplication` is invoked once
3378
+ */
3379
+ function once(func) {
3380
+ return before(2, func);
3381
+ }
3382
+
3383
+ /**
3384
+ * Checks if `value` is the
3385
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
3386
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
3387
+ *
3388
+ * @static
3389
+ * @memberOf _
3390
+ * @since 0.1.0
3391
+ * @category Lang
3392
+ * @param {*} value The value to check.
3393
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
3394
+ * @example
3395
+ *
3396
+ * _.isObject({});
3397
+ * // => true
3398
+ *
3399
+ * _.isObject([1, 2, 3]);
3400
+ * // => true
3401
+ *
3402
+ * _.isObject(_.noop);
3403
+ * // => true
3404
+ *
3405
+ * _.isObject(null);
3406
+ * // => false
3407
+ */
3408
+ function isObject(value) {
3409
+ var type = typeof value;
3410
+ return !!value && (type == 'object' || type == 'function');
3411
+ }
3412
+
3413
+ /**
3414
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
3415
+ * and has a `typeof` result of "object".
3416
+ *
3417
+ * @static
3418
+ * @memberOf _
3419
+ * @since 4.0.0
3420
+ * @category Lang
3421
+ * @param {*} value The value to check.
3422
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
3423
+ * @example
3424
+ *
3425
+ * _.isObjectLike({});
3426
+ * // => true
3427
+ *
3428
+ * _.isObjectLike([1, 2, 3]);
3429
+ * // => true
3430
+ *
3431
+ * _.isObjectLike(_.noop);
3432
+ * // => false
3433
+ *
3434
+ * _.isObjectLike(null);
3435
+ * // => false
3436
+ */
3437
+ function isObjectLike(value) {
3438
+ return !!value && typeof value == 'object';
3439
+ }
3440
+
3441
+ /**
3442
+ * Checks if `value` is classified as a `Symbol` primitive or object.
3443
+ *
3444
+ * @static
3445
+ * @memberOf _
3446
+ * @since 4.0.0
3447
+ * @category Lang
3448
+ * @param {*} value The value to check.
3449
+ * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
3450
+ * @example
3451
+ *
3452
+ * _.isSymbol(Symbol.iterator);
3453
+ * // => true
3454
+ *
3455
+ * _.isSymbol('abc');
3456
+ * // => false
3457
+ */
3458
+ function isSymbol(value) {
3459
+ return typeof value == 'symbol' ||
3460
+ (isObjectLike(value) && objectToString.call(value) == symbolTag);
3461
+ }
3462
+
3463
+ /**
3464
+ * Converts `value` to a finite number.
3465
+ *
3466
+ * @static
3467
+ * @memberOf _
3468
+ * @since 4.12.0
3469
+ * @category Lang
3470
+ * @param {*} value The value to convert.
3471
+ * @returns {number} Returns the converted number.
3472
+ * @example
3473
+ *
3474
+ * _.toFinite(3.2);
3475
+ * // => 3.2
3476
+ *
3477
+ * _.toFinite(Number.MIN_VALUE);
3478
+ * // => 5e-324
3479
+ *
3480
+ * _.toFinite(Infinity);
3481
+ * // => 1.7976931348623157e+308
3482
+ *
3483
+ * _.toFinite('3.2');
3484
+ * // => 3.2
3485
+ */
3486
+ function toFinite(value) {
3487
+ if (!value) {
3488
+ return value === 0 ? value : 0;
3489
+ }
3490
+ value = toNumber(value);
3491
+ if (value === INFINITY || value === -INFINITY) {
3492
+ var sign = (value < 0 ? -1 : 1);
3493
+ return sign * MAX_INTEGER;
3494
+ }
3495
+ return value === value ? value : 0;
3496
+ }
3497
+
3498
+ /**
3499
+ * Converts `value` to an integer.
3500
+ *
3501
+ * **Note:** This method is loosely based on
3502
+ * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
3503
+ *
3504
+ * @static
3505
+ * @memberOf _
3506
+ * @since 4.0.0
3507
+ * @category Lang
3508
+ * @param {*} value The value to convert.
3509
+ * @returns {number} Returns the converted integer.
3510
+ * @example
3511
+ *
3512
+ * _.toInteger(3.2);
3513
+ * // => 3
3514
+ *
3515
+ * _.toInteger(Number.MIN_VALUE);
3516
+ * // => 0
3517
+ *
3518
+ * _.toInteger(Infinity);
3519
+ * // => 1.7976931348623157e+308
3520
+ *
3521
+ * _.toInteger('3.2');
3522
+ * // => 3
3523
+ */
3524
+ function toInteger(value) {
3525
+ var result = toFinite(value),
3526
+ remainder = result % 1;
3527
+
3528
+ return result === result ? (remainder ? result - remainder : result) : 0;
3529
+ }
3530
+
3531
+ /**
3532
+ * Converts `value` to a number.
3533
+ *
3534
+ * @static
3535
+ * @memberOf _
3536
+ * @since 4.0.0
3537
+ * @category Lang
3538
+ * @param {*} value The value to process.
3539
+ * @returns {number} Returns the number.
3540
+ * @example
3541
+ *
3542
+ * _.toNumber(3.2);
3543
+ * // => 3.2
3544
+ *
3545
+ * _.toNumber(Number.MIN_VALUE);
3546
+ * // => 5e-324
3547
+ *
3548
+ * _.toNumber(Infinity);
3549
+ * // => Infinity
3550
+ *
3551
+ * _.toNumber('3.2');
3552
+ * // => 3.2
3553
+ */
3554
+ function toNumber(value) {
3555
+ if (typeof value == 'number') {
3556
+ return value;
3557
+ }
3558
+ if (isSymbol(value)) {
3559
+ return NAN;
3560
+ }
3561
+ if (isObject(value)) {
3562
+ var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
3563
+ value = isObject(other) ? (other + '') : other;
3564
+ }
3565
+ if (typeof value != 'string') {
3566
+ return value === 0 ? value : +value;
3567
+ }
3568
+ value = value.replace(reTrim, '');
3569
+ var isBinary = reIsBinary.test(value);
3570
+ return (isBinary || reIsOctal.test(value))
3571
+ ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
3572
+ : (reIsBadHex.test(value) ? NAN : +value);
3573
+ }
3574
+
3575
+ var lodash_once = once;
3576
+
3577
+ var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
3578
+ return (mod && mod.__esModule) ? mod : { "default": mod };
3579
+ };lazy$1.lazy = void 0;
3580
+ const lodash_once_1 = __importDefault(lodash_once);
3581
+ function lazy(getter) {
3582
+ return (0, lodash_once_1.default)(getter);
3583
+ }
3584
+ lazy$1.lazy = lazy;
3585
+
3586
+ var lazyFunction$1 = {};
3587
+
3588
+ lazyFunction$1.lazyFunction = void 0;
3589
+ const lazy_1 = lazy$1;
3590
+ function lazyFunction(getter) {
3591
+ const getFn = (0, lazy_1.lazy)(getter);
3592
+ return (...args) => getFn()(...args);
3593
+ }
3594
+ lazyFunction$1.lazyFunction = lazyFunction;
3595
+
3596
+ (function (exports) {
3597
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3598
+ if (k2 === undefined) k2 = k;
3599
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
3600
+ }) : (function(o, m, k, k2) {
3601
+ if (k2 === undefined) k2 = k;
3602
+ o[k2] = m[k];
3603
+ }));
3604
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
3605
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
3606
+ };__exportStar(lazy$1, exports);
3607
+ __exportStar(lazyFunction$1, exports);
3608
+
3609
+ }(es2018));
3610
+
3611
+ var __classPrivateFieldGet$1 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3612
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3613
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
3614
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
3615
+ };
3616
+ var __classPrivateFieldSet$1 = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3617
+ if (kind === "m") throw new TypeError("Private method is not writable");
3618
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
3619
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
3620
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
3621
+ };
3622
+ var _ReusableIterable_done;reusableIterable.ReusableIterable = void 0;
3623
+ const extra_lazy_1$1 = es2018;
3624
+ class ReusableIterable {
3625
+ constructor(iterable) {
3626
+ _ReusableIterable_done.set(this, void 0);
3627
+ this.getIterator = (0, extra_lazy_1$1.lazy)(() => iterable[Symbol.iterator]());
3628
+ }
3629
+ get done() {
3630
+ return __classPrivateFieldGet$1(this, _ReusableIterable_done, "f");
3631
+ }
3632
+ close() {
3633
+ var _a, _b;
3634
+ if (!this.done) {
3635
+ __classPrivateFieldSet$1(this, _ReusableIterable_done, true, "f");
3636
+ (_b = (_a = this.getIterator()).return) === null || _b === void 0 ? void 0 : _b.call(_a);
3637
+ }
3638
+ }
3639
+ [(_ReusableIterable_done = new WeakMap(), Symbol.iterator)]() {
3640
+ return {
3641
+ next: () => {
3642
+ if (__classPrivateFieldGet$1(this, _ReusableIterable_done, "f"))
3643
+ return { done: true, value: undefined };
3644
+ const { value, done } = this.getIterator().next();
3645
+ if (done) {
3646
+ __classPrivateFieldSet$1(this, _ReusableIterable_done, true, "f");
3647
+ }
3648
+ return { value, done };
3649
+ }
3650
+ };
3651
+ }
3652
+ }
3653
+ reusableIterable.ReusableIterable = ReusableIterable;
3654
+
3655
+ var reusableAsyncIterable = {};
3656
+
3657
+ var __classPrivateFieldGet = (commonjsGlobal && commonjsGlobal.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3658
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3659
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
3660
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
3661
+ };
3662
+ var __classPrivateFieldSet = (commonjsGlobal && commonjsGlobal.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3663
+ if (kind === "m") throw new TypeError("Private method is not writable");
3664
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
3665
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
3666
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
3667
+ };
3668
+ var _ReusableAsyncIterable_done;reusableAsyncIterable.ReusableAsyncIterable = void 0;
3669
+ const extra_lazy_1 = es2018;
3670
+ class ReusableAsyncIterable {
3671
+ constructor(iterable) {
3672
+ _ReusableAsyncIterable_done.set(this, void 0);
3673
+ this.getIterator = (0, extra_lazy_1.lazy)(() => iterable[Symbol.asyncIterator]());
3674
+ }
3675
+ get done() {
3676
+ return __classPrivateFieldGet(this, _ReusableAsyncIterable_done, "f");
3677
+ }
3678
+ async close() {
3679
+ var _a, _b;
3680
+ if (!this.done) {
3681
+ __classPrivateFieldSet(this, _ReusableAsyncIterable_done, true, "f");
3682
+ await ((_b = (_a = this.getIterator()).return) === null || _b === void 0 ? void 0 : _b.call(_a));
3683
+ }
3684
+ }
3685
+ [(_ReusableAsyncIterable_done = new WeakMap(), Symbol.asyncIterator)]() {
3686
+ return {
3687
+ next: async () => {
3688
+ if (__classPrivateFieldGet(this, _ReusableAsyncIterable_done, "f"))
3689
+ return { done: true, value: undefined };
3690
+ const { value, done } = await this.getIterator().next();
3691
+ if (done) {
3692
+ __classPrivateFieldSet(this, _ReusableAsyncIterable_done, true, "f");
3693
+ }
3694
+ return { value, done };
3695
+ }
3696
+ };
3697
+ }
3698
+ }
3699
+ reusableAsyncIterable.ReusableAsyncIterable = ReusableAsyncIterable;
3700
+
3701
+ (function (exports) {
3702
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3703
+ if (k2 === undefined) k2 = k;
3704
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
3705
+ }) : (function(o, m, k, k2) {
3706
+ if (k2 === undefined) k2 = k;
3707
+ o[k2] = m[k];
3708
+ }));
3709
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
3710
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
3711
+ };__exportStar(of$1, exports);
3712
+ __exportStar(repeat$2, exports);
3713
+ __exportStar(countdown$1, exports);
3714
+ __exportStar(countup$1, exports);
3715
+ __exportStar(range$1, exports);
3716
+ __exportStar(stringifyJsonStream, exports);
3717
+ __exportStar(stringifyJsonStreamAsync, exports);
3718
+ __exportStar(stringifyNdjsonStream, exports);
3719
+ __exportStar(stringifyNdjsonStreamAsync, exports);
3720
+ __exportStar(sse$1, exports);
3721
+ __exportStar(reusableIterable, exports);
3722
+ __exportStar(reusableAsyncIterable, exports);
3723
+
3724
+ }(es2018$1));
3725
+
3726
+ /**
3727
+ * @returns {number} 返回值为成功匹配的元素个数, 当此值等于ubound时, 代表匹配成功.
3728
+ */
3729
+ function matchMultiple(node, ubound, matcher) {
3730
+ let currentNode = node;
3731
+ for (const round of es2018$1.countup(1, ubound)) {
3732
+ if (!currentNode)
3733
+ return round - 1;
3734
+ const result = matcher.call(this, currentNode);
3735
+ if (result) {
3736
+ currentNode = this.next(currentNode);
3737
+ }
3738
+ else {
3739
+ return round - 1;
3740
+ }
3741
+ }
3742
+ return ubound;
3743
+ }
3744
+
3745
+ var Range;
3746
+ (function (Range) {
3747
+ Range[Range["Min"] = 0] = "Min";
3748
+ Range[Range["Max"] = 1] = "Max";
3749
+ })(Range || (Range = {}));
3750
+ function multiple([min, max], matcher, options = { greedy: true }) {
3751
+ es2018$3.assert(Number.isInteger(min), 'parameter min must be an integer');
3752
+ es2018$3.assert(Number.isInteger(max) || max === Infinity, 'parameter max must be an integer or Infinity');
3753
+ es2018$3.assert(min >= 0, 'parameter min must be greater than or equal to 0');
3754
+ es2018$3.assert(min <= max, 'parameter max must be greater than or equal to min');
3755
+ return function* (node) {
3756
+ if (options.greedy) {
3757
+ let ubound = max;
3758
+ while (true) {
3759
+ const round = matchMultiple.call(this, node, ubound, matcher);
3760
+ if (round < min)
3761
+ break;
3762
+ yield round;
3763
+ ubound = round - 1;
3764
+ if (ubound < min)
3765
+ break;
3766
+ }
3767
+ }
3768
+ else {
3769
+ for (const ubound of es2018$1.countup(min, max)) {
3770
+ const result = matchMultiple.call(this, node, ubound, matcher);
3771
+ // 如果匹配的节点数量少于ubound, 说明匹配失败, 即使尝试更长的匹配也不会成功.
3772
+ if (result < ubound)
3773
+ break;
3774
+ if (result === ubound)
3775
+ yield ubound;
3776
+ }
3777
+ }
3778
+ };
3779
+ }
3780
+
3781
+ function node(...args) {
3782
+ if (Array.isArray(args[0])) {
3783
+ const [strings, ...values] = args;
3784
+ const name = concat(strings, values).join('');
3785
+ return (...matchers) => node(name, ...matchers);
3786
+ }
3787
+ if (es2018$2.isString(args[0])) {
3788
+ const [name, ...matchers] = args;
3789
+ return function (_node) {
3790
+ const result = node(...matchers).call(this, _node);
3791
+ if (result) {
3792
+ merge(this.collection, { [name]: _node });
3793
+ }
3794
+ return result;
3795
+ };
3796
+ }
3797
+ const [...matchers] = args;
3798
+ return function (node) {
3799
+ if (matchers.length === 0)
3800
+ return true;
3801
+ return matchers.every(match => match.call(this, node));
3802
+ };
3803
+ }
3804
+
3805
+ function optional(matcher) {
3806
+ return multiple([0, 1], matcher, { greedy: true });
3807
+ }
3808
+
3809
+ function repeat(times, matcher) {
3810
+ es2018$3.assert(Number.isInteger(times), 'parameter times must be an integer');
3811
+ es2018$3.assert(times >= 0, 'parameter number must be greater than or equal to 0');
3812
+ return function (node) {
3813
+ const result = matchMultiple.call(this, node, times, matcher);
3814
+ if (result === times) {
3815
+ return times;
3816
+ }
3817
+ else {
3818
+ return false;
3819
+ }
3820
+ };
3821
+ }
3822
+
3823
+ function tap(matcher, callback) {
3824
+ return function (node) {
3825
+ const result = matcher.call(this, node);
3826
+ callback(result);
3827
+ return result;
3828
+ };
3829
+ }
3830
+
3831
+ function textContentEquals(text, { caseSensitive = true, trim = false } = {}) {
3832
+ return (node) => {
3833
+ if (es2018$2.isNull(node.textContent))
3834
+ return false;
3835
+ let textContent = node.textContent;
3836
+ if (!caseSensitive) {
3837
+ textContent = textContent.toLowerCase();
3838
+ text = text.toLowerCase();
3839
+ }
3840
+ if (trim)
3841
+ textContent = textContent.trim();
3842
+ return textContent === text;
3843
+ };
3844
+ }
3845
+
3846
+ function textContentIncludes(searchString, { caseSensitive = true, trim = false } = {}) {
3847
+ return (node) => {
3848
+ if (es2018$2.isNull(node.textContent))
3849
+ return false;
3850
+ let textContent = node.textContent;
3851
+ if (!caseSensitive) {
3852
+ textContent = textContent.toLowerCase();
3853
+ searchString = searchString.toLowerCase();
3854
+ }
3855
+ if (trim)
3856
+ textContent = textContent.trim();
3857
+ return textContent.includes(searchString);
3858
+ };
3859
+ }
3860
+
3861
+ function textContentMatches(pattern, { trim = false } = {}) {
3862
+ return (node) => {
3863
+ if (es2018$2.isNull(node.textContent))
3864
+ return false;
3865
+ let textContent = node.textContent;
3866
+ if (trim)
3867
+ textContent = textContent.trim();
3868
+ return pattern.test(textContent);
3869
+ };
3870
+ }
3871
+
3872
+ function textNode(...args) {
3873
+ if (Array.isArray(args[0])) {
3874
+ const [strings, ...values] = args;
3875
+ const name = concat(strings, values).join('');
3876
+ return (...matchers) => textNode(name, ...matchers);
3877
+ }
3878
+ if (es2018$2.isString(args[0])) {
3879
+ const [name, ...matchers] = args;
3880
+ return function (node) {
3881
+ const result = textNode(...matchers).call(this, node);
3882
+ if (result) {
3883
+ merge(this.collection, { [name]: node });
3884
+ }
3885
+ return result;
3886
+ };
3887
+ }
3888
+ const [...matchers] = args;
3889
+ return function (node) {
3890
+ if (es2018$6.isntTextNode(node))
3891
+ return false;
3892
+ if (matchers.length === 0)
3893
+ return true;
3894
+ return matchers.every(match => match.call(this, node));
3895
+ };
3896
+ }
3897
+
3898
+ const UNORDERED_NODE_ITERATOR_TYPE = 'XPathResult' in globalThis
3899
+ ? XPathResult.UNORDERED_NODE_ITERATOR_TYPE
3900
+ : 4;
3901
+ function xpath(...args) {
3902
+ if (es2018$2.isString(args[0])) {
3903
+ const [expression] = args;
3904
+ es2018$3.assert(expression.startsWith('//*'), 'XPath expressions must start with "//*"');
3905
+ return function (node) {
3906
+ return xpathMatches(this.document, expression, node);
3907
+ };
3908
+ }
3909
+ else {
3910
+ const [strings, ...values] = args;
3911
+ const expression = concat(strings, values).join('');
3912
+ return xpath(expression);
3913
+ }
3914
+ }
3915
+ function xpathMatches(document, expression, node) {
3916
+ const iterator = document.evaluate(expression, node, null, UNORDERED_NODE_ITERATOR_TYPE, null);
3917
+ let value;
3918
+ while ((value = iterator.iterateNext()) !== null) {
3919
+ if (value === node)
3920
+ return true;
3921
+ }
3922
+ return false;
3923
+ }
3924
+
3925
+ export { anyOf, childNodes, children, css, element, match, matchElement, multiple, node, optional, repeat, tap, textContentEquals, textContentIncludes, textContentMatches, textNode, xpath };
3926
+ //# sourceMappingURL=index.mjs.map