@formvk/shared 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,1347 @@
1
+ // src/checkers.ts
2
+ var e = Object.prototype.toString;
3
+ function t(e) {
4
+ return (t) => n(t) === `[object ${e}]`;
5
+ }
6
+ function n(t) {
7
+ return e.call(t);
8
+ }
9
+ function r(e) {
10
+ return typeof e == "function";
11
+ }
12
+ var i = Array.isArray, a = t("Object"), o = t("String"), s = t("Boolean"), c = t("Number");
13
+ function l(e) {
14
+ return e && e instanceof Map;
15
+ }
16
+ function u(e) {
17
+ return e && e instanceof Set;
18
+ }
19
+ function d(e) {
20
+ return e && e instanceof WeakMap;
21
+ }
22
+ function f(e) {
23
+ return e && e instanceof WeakSet;
24
+ }
25
+ function p(e) {
26
+ return c(e) || /^\d+$/.test(e);
27
+ }
28
+ function m(e) {
29
+ return typeof e == "object";
30
+ }
31
+ var ee = t("RegExp");
32
+ function te(e) {
33
+ return e && e.$$typeof && e._owner;
34
+ }
35
+ function ne(e) {
36
+ return Object.prototype.toString.call(e).indexOf("HTML") > -1;
37
+ }
38
+ // src/array.ts
39
+ function h(e) {
40
+ return i(e) ? e : e ? [e] : [];
41
+ }
42
+ function g(e, t, n) {
43
+ if (i(e) || o(e)) {
44
+ if (n) {
45
+ for (let n = e.length - 1; n >= 0; n--) if (t(e[n], n) === !1) return;
46
+ } else for (let n = 0; n < e.length; n++) if (t(e[n], n) === !1) return;
47
+ } else if (m(e)) {
48
+ let n = e, r;
49
+ for (r in n) if (Object.hasOwnProperty.call(n, r) && t(n[r], r) === !1) return;
50
+ }
51
+ }
52
+ function re(e, t, n) {
53
+ let r = i(e) || o(e) ? [] : {};
54
+ return g(e, (e, n) => {
55
+ let a = t(e, n);
56
+ i(r) ? r.push(a) : r[n] = a;
57
+ }, n), r;
58
+ }
59
+ function ie(e, t, n, r) {
60
+ let i = n;
61
+ return g(e, (e, n) => {
62
+ i = t(i, e, n);
63
+ }, r), i;
64
+ }
65
+ function ae(e, t, n) {
66
+ let r = !0;
67
+ return g(e, (e, n) => {
68
+ if (!t(e, n)) return r = !1, !1;
69
+ }, n), r;
70
+ }
71
+ function oe(e, t, n) {
72
+ let r = !1;
73
+ return g(e, (e, n) => {
74
+ if (t(e, n)) return r = !0, !1;
75
+ }, n), r;
76
+ }
77
+ function se(e, t, n) {
78
+ let r = -1;
79
+ return g(e, (e, n) => {
80
+ if (t(e, n)) return r = n, !1;
81
+ }, n), r;
82
+ }
83
+ function ce(e, t, n) {
84
+ let r;
85
+ return g(e, (e, n) => {
86
+ if (t(e, n)) return r = e, !1;
87
+ }, n), r;
88
+ }
89
+ function le(e, t, n) {
90
+ return o(e) ? e.includes(t) : oe(e, (e) => e === t, n);
91
+ }
92
+ function ue(e, t, n) {
93
+ if (t === n || n < 0 || t < 0 || n > e.length - 1 || t > e.length - 1) return e;
94
+ if (t < n) {
95
+ let r = e[t];
96
+ for (let r = t; r < n; r++) e[r] = e[r + 1];
97
+ e[n] = r;
98
+ } else {
99
+ let r = e[t];
100
+ for (let r = t; r > n; r--) e[r] = e[r - 1];
101
+ e[n] = r;
102
+ }
103
+ return e;
104
+ }
105
+ // src/global.ts
106
+ /* istanbul ignore next */
107
+ function de() {
108
+ try {
109
+ if (typeof self < "u") return self;
110
+ } catch {}
111
+ try {
112
+ if (typeof window < "u") return window;
113
+ } catch {}
114
+ try {
115
+ if (typeof global < "u") return global;
116
+ } catch {}
117
+ return Function("return this")();
118
+ }
119
+ var fe = de();
120
+ // src/instanceof.ts
121
+ function _(e, t) {
122
+ if (r(t)) return e instanceof t;
123
+ if (o(t)) {
124
+ let n = fe[t];
125
+ return n ? e instanceof n : !1;
126
+ }
127
+ return !1;
128
+ }
129
+ // src/compare.ts
130
+ var pe = i, me = Object.keys, he = Object.prototype.hasOwnProperty;
131
+ function v(e, t) {
132
+ if (e === t) return !0;
133
+ if (e && t && typeof e == "object" && typeof t == "object") {
134
+ let n = pe(e), r = pe(t), i, a, o;
135
+ if (n && r) {
136
+ if (a = e.length, a !== t.length) return !1;
137
+ for (i = a; i-- !== 0;) if (!v(e[i], t[i])) return !1;
138
+ return !0;
139
+ }
140
+ if (n !== r) return !1;
141
+ let s = e && e._isAMomentObject, c = t && t._isAMomentObject;
142
+ if (s !== c) return !1;
143
+ if (s && c) return e.isSame(t);
144
+ let l = e && e.toJS;
145
+ if (l !== (t && t.toJS)) return !1;
146
+ if (l) return e.is ? e.is(t) : e === t;
147
+ let u = _(e, "Date"), d = _(t, "Date");
148
+ if (u !== d) return !1;
149
+ if (u && d) return e.getTime() === t.getTime();
150
+ let f = _(e, "RegExp"), p = _(t, "RegExp");
151
+ if (f !== p) return !1;
152
+ if (f && p) return e.toString() === t.toString();
153
+ let m = _(e, "URL"), ee = _(t, "URL");
154
+ if (m !== ee) return !1;
155
+ if (m && ee) return e.href === t.href;
156
+ let te = e && e.toJSON, ne = t && t.toJSON;
157
+ if (te !== ne) return !1;
158
+ if (te && ne) return v(e.toJSON(), t.toJSON());
159
+ let h = me(e);
160
+ if (a = h.length, a !== me(t).length) return !1;
161
+ for (i = a; i-- !== 0;) if (!he.call(t, h[i])) return !1;
162
+ for (i = a; i-- !== 0;) if (o = h[i], !(o === "_owner" && e.$$typeof) && !v(e[o], t[o])) return !1;
163
+ return !0;
164
+ }
165
+ return e !== e && t !== t;
166
+ }
167
+ var ge = function(e, t) {
168
+ try {
169
+ return v(e, t);
170
+ } catch (e) {
171
+ let t = e;
172
+ /* istanbul ignore next */
173
+ if (t.message && t.message.match(/stack|recursion/i) || t.number === -2146828260) return console.warn("Warning: react-fast-compare does not handle circular references.", t.name, t.message), !1;
174
+ /* istanbul ignore next */
175
+ throw e;
176
+ }
177
+ };
178
+ // src/clone.ts
179
+ function _e(e) {
180
+ if (Array.isArray(e)) return e.slice(0);
181
+ if (a(e)) {
182
+ let t = e;
183
+ return "$$typeof" in t && "_owner" in t || t._isAMomentObject || t._isJSONSchemaObject || r(t.toJS) || r(t.toJSON) ? e : { ...t };
184
+ }
185
+ return typeof e == "object" ? new e.constructor(e) : e;
186
+ }
187
+ function ve(e) {
188
+ if (Array.isArray(e)) {
189
+ let t = [];
190
+ return e.forEach((e) => {
191
+ t.push(ve(e));
192
+ }), t;
193
+ }
194
+ if (a(e)) {
195
+ let t = e;
196
+ if ("$$typeof" in t && "_owner" in t || t._isAMomentObject || t._isJSONSchemaObject) return e;
197
+ if (r(t.toJS)) return t.toJS();
198
+ if (r(t.toJSON)) return t.toJSON();
199
+ let n = {};
200
+ for (let e in t) Object.hasOwnProperty.call(t, e) && (n[e] = ve(t[e]));
201
+ return n;
202
+ }
203
+ return e;
204
+ }
205
+ // src/isEmpty.ts
206
+ var ye = Object.prototype.hasOwnProperty, be = Object.prototype.toString;
207
+ function xe(e) {
208
+ return e === void 0;
209
+ }
210
+ function y(e) {
211
+ return e != null;
212
+ }
213
+ function Se(e, t = !1) {
214
+ if (e == null) return !0;
215
+ if (typeof e == "boolean" || typeof e == "number") return !1;
216
+ if (typeof e == "string" || typeof e == "function") return e.length === 0;
217
+ if (Array.isArray(e)) {
218
+ if (e.length === 0) return !0;
219
+ for (let n = 0; n < e.length; n++) if (t) {
220
+ if (e[n] !== void 0 && e[n] !== null) return !1;
221
+ } else if (e[n] !== void 0 && e[n] !== null && e[n] !== "" && e[n] !== 0) return !1;
222
+ return !0;
223
+ }
224
+ if (_(e, "Error")) return e.message === "";
225
+ if (e.toString === be) switch (e.toString()) {
226
+ case "[object File]":
227
+ case "[object Map]":
228
+ case "[object Set]": return e.size === 0;
229
+ case "[object Object]":
230
+ for (let t in e) if (ye.call(e, t)) return !1;
231
+ return !0;
232
+ }
233
+ return !1;
234
+ }
235
+ // src/string.ts
236
+ function Ce() {
237
+ return /* @__PURE__ */ RegExp("[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))", "g");
238
+ }
239
+ var we = "[\ud800-\udbff][\udc00-\udfff]";
240
+ function Te(e) {
241
+ return e && e.exact ? RegExp(`^${we}$`) : new RegExp(we, "g");
242
+ }
243
+ function Ee(e) {
244
+ return typeof e == "string" ? e.replace(Ce(), "") : e;
245
+ }
246
+ function De(e) {
247
+ return Ee(e).replace(Te(), " ").length;
248
+ }
249
+ function Oe(e) {
250
+ return e.toLowerCase();
251
+ }
252
+ function ke(e) {
253
+ return e.split(/[-_\s]+/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("");
254
+ }
255
+ // ../path/dist/index.js
256
+ var Ae = Object.prototype.toString;
257
+ function b(e) {
258
+ return (t) => Ae.call(t) === `[object ${e}]`;
259
+ }
260
+ var je = b("Function"), x = Array.isArray || b("Array"), S = b("String"), C = b("Number");
261
+ function Me(e) {
262
+ return typeof e == "object";
263
+ }
264
+ var Ne = b("RegExp");
265
+ function Pe(e) {
266
+ return C(e) || /^(\d+)(\.\d+)?$/.test(e);
267
+ }
268
+ var Fe = x, Ie = Object.keys, Le = Object.prototype.hasOwnProperty;
269
+ function Re(e) {
270
+ return Array.isArray(e) ? e : e === void 0 ? [] : [e];
271
+ }
272
+ function w(e, t) {
273
+ if (e === t) return !0;
274
+ if (e && t && typeof e == "object" && typeof t == "object") {
275
+ let n = Fe(e), r = Fe(t), i, a, o;
276
+ if (n && r) {
277
+ if (a = e.length, a !== t.length) return !1;
278
+ for (i = a; i-- !== 0;) if (!w(e[i], t[i])) return !1;
279
+ return !0;
280
+ }
281
+ if (n !== r) return !1;
282
+ let s = Ie(e);
283
+ if (a = s.length, a !== Ie(t).length) return !1;
284
+ for (i = a; i-- !== 0;) if (!Le.call(t, s[i])) return !1;
285
+ for (i = a; i-- !== 0;) if (o = s[i], !w(e[o], t[o])) return !1;
286
+ return !0;
287
+ }
288
+ return e !== e && t !== t;
289
+ }
290
+ function ze(e, t) {
291
+ return e = typeof e == "symbol" ? e : `${e}`, t = typeof t == "symbol" ? t : `${t}`, e === t;
292
+ }
293
+ function T(e) {
294
+ return (t) => t && t.type === e;
295
+ }
296
+ var Be = T("Identifier"), Ve = T("IgnoreExpression"), He = T("DotOperator"), Ue = T("WildcardOperator"), We = T("ExpandOperator"), Ge = T("GroupExpression"), Ke = T("RangeExpression"), qe = T("DestructorExpression"), Je = T("ObjectPattern"), Ye = T("ArrayPattern"), Xe = /* @__PURE__ */ new Map();
297
+ function Ze(e) {
298
+ return e != null;
299
+ }
300
+ function E(e) {
301
+ return Xe.get(e);
302
+ }
303
+ function Qe(e, t) {
304
+ Xe.set(e, t);
305
+ }
306
+ function D(e) {
307
+ let t = [];
308
+ if (Je(e)) {
309
+ let n = 0;
310
+ return e.properties.forEach((e) => {
311
+ t[n] = { path: [] }, t[n].key = e.key.value, t[n].path.push(e.key.value), Be(e.value) && (t[n].key = e.value.value);
312
+ let r = t[n].path, i = D(e.value), a = n;
313
+ i.forEach((e) => {
314
+ t[a] ? (t[a].key = e.key, t[a].path = r.concat(e.path)) : t[a] = {
315
+ key: e.key,
316
+ path: r.concat(e.path)
317
+ }, a++;
318
+ }), a > n ? n = a : n++;
319
+ }), t;
320
+ }
321
+ if (Ye(e)) {
322
+ let n = 0;
323
+ return e.elements.forEach((e, r) => {
324
+ t[n] = { path: [] }, t[n].key = r, t[n].path.push(r), Be(e) && (t[n].key = e.value);
325
+ let i = t[n].path, a = D(e), o = n;
326
+ a.forEach((e) => {
327
+ t[o] ? (t[o].key = e.key, t[o].path = i.concat(e.path)) : t[o] = {
328
+ key: e.key,
329
+ path: i.concat(e.path)
330
+ }, o++;
331
+ }), o > n ? n = o : n++;
332
+ }), t;
333
+ }
334
+ return qe(e) ? D(e.value) : t;
335
+ }
336
+ function $e(e, t, n, r) {
337
+ t.forEach(({ key: t, path: i }) => {
338
+ r.setIn([t], e, r.getIn(i, n));
339
+ });
340
+ }
341
+ function et(e, t, n) {
342
+ let r = {};
343
+ return t.length && C(t[0].path[0]) && (r = []), e = Ze(e) ? e : {}, t.forEach(({ key: t, path: i }) => {
344
+ n.setIn(i, r, e[t]);
345
+ }), r;
346
+ }
347
+ function tt(e, t, n) {
348
+ t.forEach(({ key: t }) => {
349
+ n.deleteIn?.([t], e);
350
+ });
351
+ }
352
+ function nt(e, t, n, r) {
353
+ return t.every(({ key: t }) => r.existIn?.([t], e, n));
354
+ }
355
+ var rt = class {
356
+ tree;
357
+ stack;
358
+ record;
359
+ excluding;
360
+ wildcards;
361
+ path = [];
362
+ constructor(e, t) {
363
+ this.tree = e, this.stack = [], this.excluding = !1, this.wildcards = [], this.record = t;
364
+ }
365
+ next(e, t) {
366
+ if (e.after) return this.matchNode(e.after, t);
367
+ if (Ue(e) && !e.filter) return this.excluding ? !1 : t === 0 || e.optional ? !0 : !!this.take(t);
368
+ if (t === this.path.length - 1) return !!this.take(t);
369
+ {
370
+ let e = this.wildcards.pop();
371
+ if (e && e.after) return this.next(e, t);
372
+ }
373
+ return !1;
374
+ }
375
+ shot() {
376
+ this.record && this.record.score >= 0 && this.record.score++;
377
+ }
378
+ take(e) {
379
+ return String(this.path[e] ?? "");
380
+ }
381
+ matchExcludeIdentifier(e, t, n) {
382
+ let r = n === this.path.length - 1, i = n < this.path.length;
383
+ if (t.after || (this.excluding = !1), e) {
384
+ if (t.after) return this.next(t, n);
385
+ if (r) return !1;
386
+ }
387
+ return r ? !0 : i;
388
+ }
389
+ matchIdentifier(e, t) {
390
+ let n = this.take(t), r = !1;
391
+ return We(e.after) ? (n.indexOf(e.value) === 0 && (this.shot(), r = !0), this.excluding ? this.matchExcludeIdentifier(r, e.after, t) : r && this.next(e.after, t)) : (n === e.value && (this.shot(), r = !0), this.excluding ? this.matchExcludeIdentifier(r, e, t) : r && this.next(e, t));
392
+ }
393
+ matchIgnoreExpression(e, t) {
394
+ return w(e.value, this.take(t)) && this.next(e, t);
395
+ }
396
+ matchDestructorExpression(e, t) {
397
+ return w(e.source, this.take(t)) && this.next(e, t);
398
+ }
399
+ matchExpandOperator(e, t) {
400
+ return this.next(e, t);
401
+ }
402
+ matchWildcardOperator(e, t) {
403
+ let n = !1;
404
+ return e.filter ? (this.stack.push(e), n = this.matchNode(e.filter, t), this.stack.pop()) : n = this.next(e, t), n;
405
+ }
406
+ matchGroupExpression(e, t) {
407
+ let n = !1;
408
+ return e.isExclude && (n = !this.excluding), Re(e.value)[n ? "every" : "some"]((e) => (this.wildcards = this.stack.slice(), this.excluding = n, this.matchNode(e, t)));
409
+ }
410
+ matchRangeExpression(e, t) {
411
+ let n = Number(this.take(t));
412
+ return e.start ? e.end ? n >= Number(e.start.value) && n <= Number(e.end.value) : n >= Number(e.start.value) : e.end ? n <= Number(e.end.value) : (this.wildcards = this.stack.slice(), this.next(e, t));
413
+ }
414
+ matchNode(e, t = 0) {
415
+ return He(e) ? this.next(e, t + 1) : Be(e) ? this.matchIdentifier(e, t) : Ve(e) ? this.matchIgnoreExpression(e, t) : qe(e) ? this.matchDestructorExpression(e, t) : We(e) ? this.matchExpandOperator(e, t) : Ue(e) ? this.matchWildcardOperator(e, t) : Ge(e) ? this.matchGroupExpression(e, t) : Ke(e) ? this.matchRangeExpression(e, t) : !1;
416
+ }
417
+ match(e) {
418
+ return this.path = e, {
419
+ matched: this.matchNode(this.tree),
420
+ record: this.record
421
+ };
422
+ }
423
+ static matchSegments(e, t, n) {
424
+ if (e.length !== t.length) return {
425
+ matched: !1,
426
+ record: n
427
+ };
428
+ function r(i = 0) {
429
+ let a = ze(e[i], t[i]);
430
+ return n?.score >= 0 && n.score++, a && (i < e.length - 1 ? r(i + 1) : !0);
431
+ }
432
+ return {
433
+ matched: r(),
434
+ record: n
435
+ };
436
+ }
437
+ };
438
+ function O(e, t) {
439
+ return {
440
+ flag: e,
441
+ ...t
442
+ };
443
+ }
444
+ var it = O("[]"), at = O("[\\d]"), k = O("[[]]"), ot = O("()"), st = O("{}"), A = O("{x}");
445
+ function j(e, t) {
446
+ return {
447
+ flag: e,
448
+ ...t
449
+ };
450
+ }
451
+ var M = j("name", { expectNext(e) {
452
+ return this.includesContext(A) ? e === M || e === W || e === B || e === R || e === I : e === F || e === W || e === K || e === B || e === U || e === I || e === G || e === z;
453
+ } }), N = j("*", { expectNext(e) {
454
+ return e === F || e === H || e === z || e === K || e === W || e === U;
455
+ } }), P = j("**", { expectNext(e) {
456
+ return e === F || e === z || e === K || e === W || e === U;
457
+ } }), F = j(".", {
458
+ expectNext(e) {
459
+ return e === F || e === M || e === V || e === N || e === P || e === z || e === L || e === K;
460
+ },
461
+ expectPrev(e) {
462
+ return e === F || e === M || e === lt || e === N || e === U || e === B || e === G || e === R;
463
+ }
464
+ }), ct = j("!", { expectNext(e) {
465
+ return e === M || e === V;
466
+ } }), I = j(":", { expectNext(e) {
467
+ return this.includesContext(A) ? e === M || e === L || e === z : e === M || e === V || e === B;
468
+ } }), L = j("{", {
469
+ expectNext(e) {
470
+ return e === M;
471
+ },
472
+ expectPrev(e) {
473
+ return this.includesContext(A) ? e === I || e === W || e === z : e === F || e === I || e === H;
474
+ },
475
+ updateContext() {
476
+ this.state.context.push(st);
477
+ }
478
+ }), R = j("}", {
479
+ expectNext(e) {
480
+ return this.includesContext(A) ? e === W || e === R || e === K || e === B : e === F || e === K || e === W;
481
+ },
482
+ expectPrev(e) {
483
+ return e === M || e === R || e === B;
484
+ },
485
+ updateContext() {
486
+ this.state.context.pop();
487
+ }
488
+ }), z = j("[", {
489
+ expectNext(e) {
490
+ return this.includesContext(A) ? e === M || e === z || e === L || e === B : e === M || e === V || e === I || e === z || e === ut || e === B;
491
+ },
492
+ expectPrev(e) {
493
+ return this.includesContext(A) ? e === I || e === W || e === z : e === N || e === z || e === F || e === M || e === H || e == W;
494
+ },
495
+ updateContext() {
496
+ this.state.context.push(it);
497
+ }
498
+ }), B = j("]", {
499
+ expectNext(e) {
500
+ return this.includesContext(A) ? e === W || e === R || e === B || e === K : e === F || e === K || e === W || e === U || e === B;
501
+ },
502
+ updateContext() {
503
+ if (!this.includesContext(at)) {
504
+ if (!this.includesContext(it)) throw this.unExpect();
505
+ this.state.context.pop();
506
+ }
507
+ }
508
+ }), V = j("[[", { updateContext() {
509
+ this.state.context.push(k);
510
+ } }), lt = j("]]", { updateContext() {
511
+ if (this.curContext() !== k) throw this.unExpect();
512
+ this.state.context.pop();
513
+ } }), H = j("(", {
514
+ expectNext(e) {
515
+ return e === M || e === V || e === L || e === ct || e === z;
516
+ },
517
+ expectPrev(e) {
518
+ return e === N;
519
+ },
520
+ updateContext() {
521
+ this.state.context.push(ot);
522
+ }
523
+ }), U = j(")", {
524
+ expectNext(e) {
525
+ return e === F || e === K || e === W || e === U;
526
+ },
527
+ updateContext() {
528
+ if (this.curContext() !== ot) throw this.unExpect();
529
+ this.state.context.pop();
530
+ }
531
+ }), W = j(",", { expectNext(e) {
532
+ return e === M || e === V || e === z || e === L;
533
+ } }), ut = j("ignore", {
534
+ expectNext(e) {
535
+ return e === lt;
536
+ },
537
+ expectPrev(e) {
538
+ return e == V;
539
+ }
540
+ }), G = j("expandTok", { expectNext(e) {
541
+ return e === F || e === K || e === W || e === U;
542
+ } }), K = j("eof"), dt = /[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;
543
+ function ft(e, t) {
544
+ return e.codePointAt(t);
545
+ }
546
+ function pt(e) {
547
+ return e === 42 || e === 46 || e === 33 || e === 91 || e === 93 || e === 40 || e === 41 || e === 44 || e === 58 || e === 126 || e === 123 || e === 125;
548
+ }
549
+ function mt(e, t) {
550
+ let n = Error(e);
551
+ return Object.assign(n, t), n;
552
+ }
553
+ function ht(e, t, n) {
554
+ let r = "";
555
+ for (let i = t; i < n; i++) {
556
+ let t = e.charAt(i);
557
+ t !== "\\" && (r += t);
558
+ }
559
+ return r;
560
+ }
561
+ var gt = class {
562
+ input;
563
+ state;
564
+ type_;
565
+ constructor(e) {
566
+ this.input = e, this.state = {
567
+ context: [],
568
+ pos: 0
569
+ };
570
+ }
571
+ curContext() {
572
+ return this.state.context[this.state.context.length - 1];
573
+ }
574
+ includesContext(e) {
575
+ for (let t = this.state.context.length - 1; t >= 0; t--) if (this.state.context[t] === e) return !0;
576
+ return !1;
577
+ }
578
+ unExpect(e) {
579
+ return e ||= this.state.type, mt(`UnExpect token "${e.flag}" in ${this.state.pos} char.`, { pos: this.state.pos });
580
+ }
581
+ expectNext(e, t) {
582
+ if (e && e.expectNext && t && !e.expectNext.call(this, t)) throw mt(`UnExpect token "${t.flag}" token should not be behind "${e.flag}" token.(${this.state.pos}th char)`, { pos: this.state.pos });
583
+ }
584
+ expectPrev(e, t) {
585
+ if (e && e.expectPrev && t && !e.expectPrev.call(this, t)) throw mt(`Unexpect token "${e.flag}" should not be behind "${t.flag}"(${this.state.pos}th char).`, { pos: this.state.pos });
586
+ }
587
+ match(e) {
588
+ return this.state.type === e;
589
+ }
590
+ skipSpace() {
591
+ if (this.curContext() !== k) loop: for (; this.state.pos < this.input.length;) {
592
+ let e = this.input.charCodeAt(this.state.pos);
593
+ switch (e) {
594
+ case 32:
595
+ case 160:
596
+ ++this.state.pos;
597
+ break;
598
+ case 13: this.input.charCodeAt(this.state.pos + 1) === 10 && ++this.state.pos;
599
+ case 10:
600
+ case 8232:
601
+ case 8233:
602
+ ++this.state.pos;
603
+ break;
604
+ default: if (e > 8 && e < 14 || e >= 5760 && dt.test(String.fromCharCode(e))) ++this.state.pos;
605
+ else break loop;
606
+ }
607
+ }
608
+ }
609
+ next() {
610
+ if (this.type_ = this.state.type, this.input.length <= this.state.pos) return this.finishToken(K);
611
+ this.skipSpace(), this.readToken(this.getCode(), this.state.pos > 0 ? this.getCode(this.state.pos - 1) : -Infinity);
612
+ }
613
+ getCode(e = this.state.pos) {
614
+ return ft(this.input, e);
615
+ }
616
+ eat(e) {
617
+ return this.match(e) ? (this.next(), !0) : !1;
618
+ }
619
+ readKeyWord() {
620
+ let e = this.state.pos, t = "";
621
+ for (;;) {
622
+ let n = this.getCode(), r = this.getCode(this.state.pos - 1);
623
+ if (this.input.length === this.state.pos) {
624
+ t = ht(this.input, e, this.state.pos + 1);
625
+ break;
626
+ }
627
+ if (!pt(n) || r === 92) {
628
+ if (n === 32 || n === 160 || n === 10 || n === 8232 || n === 8233 || n === 13 && this.input.charCodeAt(this.state.pos + 1) === 10 || n > 8 && n < 14 || n >= 5760 && dt.test(String.fromCharCode(n))) {
629
+ t = ht(this.input, e, this.state.pos);
630
+ break;
631
+ }
632
+ this.state.pos++;
633
+ } else {
634
+ t = ht(this.input, e, this.state.pos);
635
+ break;
636
+ }
637
+ }
638
+ this.finishToken(M, t);
639
+ }
640
+ readIgnoreString() {
641
+ let e = this.state.pos, t, n = "";
642
+ for (;;) {
643
+ let r = this.getCode();
644
+ if (this.state.pos >= this.input.length) break;
645
+ if ((r === 91 || r === 93) && t === 92) this.state.pos++, t = void 0;
646
+ else if (r == 93 && t === 93) {
647
+ n = this.input.slice(e, this.state.pos - 1).replace(/\\([\\[\]])/g, "$1"), this.state.pos++;
648
+ break;
649
+ } else this.state.pos++, t = r;
650
+ }
651
+ this.finishToken(ut, n), this.finishToken(lt);
652
+ }
653
+ finishToken(e, t) {
654
+ let n = this.state.type;
655
+ this.state.type = e, t !== void 0 && (this.state.value = t), this.expectNext(n, e), this.expectPrev(e, n), e.updateContext && e.updateContext.call(this, n);
656
+ }
657
+ readToken(e, t) {
658
+ if (t === 92) return this.readKeyWord();
659
+ if (this.input.length <= this.state.pos) this.finishToken(K);
660
+ else if (this.curContext() === k) this.readIgnoreString();
661
+ else if (e === 123) this.state.pos++, this.finishToken(L);
662
+ else if (e === 125) this.state.pos++, this.finishToken(R);
663
+ else if (e === 42) {
664
+ if (this.state.pos++, this.getCode() === 42) return this.state.pos++, this.finishToken(P);
665
+ this.finishToken(N);
666
+ } else if (e === 33) this.state.pos++, this.finishToken(ct);
667
+ else if (e === 46) this.state.pos++, this.finishToken(F);
668
+ else if (e === 91) {
669
+ if (this.state.pos++, this.getCode() === 91) return this.state.pos++, this.finishToken(V);
670
+ this.finishToken(z);
671
+ } else e === 126 ? (this.state.pos++, this.finishToken(G)) : e === 93 ? (this.state.pos++, this.finishToken(B)) : e === 40 ? (this.state.pos++, this.finishToken(H)) : e === 41 ? (this.state.pos++, this.finishToken(U)) : e === 44 ? (this.state.pos++, this.finishToken(W)) : e === 58 ? (this.state.pos++, this.finishToken(I)) : this.readKeyWord();
672
+ }
673
+ };
674
+ function _t(e = [], t) {
675
+ let n = e.length;
676
+ function r(i = 0) {
677
+ let a = i < n - 1 ? r(i + 1) : t, o = a && {
678
+ type: "DotOperator",
679
+ after: a
680
+ };
681
+ return {
682
+ type: "Identifier",
683
+ value: e[i],
684
+ after: o
685
+ };
686
+ }
687
+ return r();
688
+ }
689
+ function vt(e, t, n) {
690
+ if (Pe(e) && Pe(t)) {
691
+ if (n === "+") return String(Number(e) + Number(t));
692
+ if (n === "-") return String(Number(e) - Number(t));
693
+ if (n === "*") return String(Number(e) * Number(t));
694
+ if (n === "/") return String(Number(e) / Number(t));
695
+ } else {
696
+ if (n === "+") return String(e) + String(t);
697
+ if (n === "-" || n === "*" || n === "/") return "NaN";
698
+ }
699
+ return String(Number(t));
700
+ }
701
+ var yt = class extends gt {
702
+ isMatchPattern = !1;
703
+ isWildMatchPattern = !1;
704
+ haveExcludePattern = !1;
705
+ haveRelativePattern = !1;
706
+ base;
707
+ relative;
708
+ data;
709
+ constructor(e, t) {
710
+ super(e), this.base = t;
711
+ }
712
+ parse() {
713
+ let e;
714
+ return this.data = { segments: [] }, this.eat(K) || (this.next(), e = this.parseAtom(this.state.type)), this.data.tree = e, e;
715
+ }
716
+ append(e, t) {
717
+ e && t && (e.after = t);
718
+ }
719
+ parseAtom(e) {
720
+ switch (e) {
721
+ case L:
722
+ case z: return this.includesContext(A) ? e === L ? this.parseObjectPattern() : this.parseArrayPattern() : this.parseDestructorExpression();
723
+ case M: return this.parseIdentifier();
724
+ case G: return this.parseExpandOperator();
725
+ case P:
726
+ case N: return this.parseWildcardOperator();
727
+ case V: return this.parseIgnoreExpression();
728
+ case F: return this.parseDotOperator();
729
+ }
730
+ }
731
+ pushSegments(e) {
732
+ this.data.segments.push(e);
733
+ }
734
+ parseIdentifier() {
735
+ let e = {
736
+ type: "Identifier",
737
+ value: this.state.value
738
+ }, t = !this.includesContext(A) && !this.isMatchPattern && !this.isWildMatchPattern;
739
+ if (this.next(), this.includesContext(at)) {
740
+ if (this.state.type !== B) throw this.unExpect();
741
+ this.state.context.pop(), this.next();
742
+ } else t && this.pushSegments(e.value);
743
+ if (this.state.type === z) {
744
+ if (this.next(), this.state.type !== M) throw this.unExpect();
745
+ this.state.context.push(at);
746
+ let t = !1;
747
+ /^\d+$/.test(this.state.value) && (t = !0);
748
+ let n = this.state.value;
749
+ this.pushSegments(t ? Number(n) : n);
750
+ let r = this.parseAtom(this.state.type);
751
+ t && (r.arrayIndex = !0), this.append(e, r);
752
+ } else this.append(e, this.parseAtom(this.state.type));
753
+ return e;
754
+ }
755
+ parseExpandOperator() {
756
+ let e = { type: "ExpandOperator" };
757
+ return this.isMatchPattern = !0, this.isWildMatchPattern = !0, this.data.segments = [], this.next(), this.append(e, this.parseAtom(this.state.type)), e;
758
+ }
759
+ parseWildcardOperator() {
760
+ let e = { type: "WildcardOperator" };
761
+ return this.state.type === P && (e.optional = !0), this.isMatchPattern = !0, this.isWildMatchPattern = !0, this.data.segments = [], this.next(), this.state.type === H ? e.filter = this.parseGroupExpression(e) : this.state.type === z && (e.filter = this.parseRangeExpression(e)), this.append(e, this.parseAtom(this.state.type)), e;
762
+ }
763
+ parseDestructorExpression() {
764
+ let e = { type: "DestructorExpression" };
765
+ this.state.context.push(A);
766
+ let t = this.state.pos - 1;
767
+ e.value = this.state.type === L ? this.parseObjectPattern() : this.parseArrayPattern();
768
+ let n = this.state.pos;
769
+ return this.state.context.pop(), e.source = this.input.substring(t, n).replace(/\[\s*([\\+\-\\*\\/])?\s*([^,\]\s]*)\s*\]/, (e, t, n) => this.relative === void 0 ? e : t ? n ? vt(this.relative, n, t) : vt(this.relative, 1, t) : n ? vt(this.relative, n, "+") : String(this.relative)).replace(/\s*\.\s*/g, "").replace(/\s*/g, ""), this.relative === void 0 && Qe(e.source, D(e)), this.relative = void 0, this.pushSegments(e.source), this.next(), this.append(e, this.parseAtom(this.state.type)), e;
770
+ }
771
+ parseArrayPattern() {
772
+ let e = {
773
+ type: "ArrayPattern",
774
+ elements: []
775
+ };
776
+ return this.next(), e.elements = this.parseArrayPatternElements(), e;
777
+ }
778
+ parseArrayPatternElements() {
779
+ let e = [];
780
+ for (; this.state.type !== B && this.state.type !== K;) {
781
+ if (e.push(this.parseAtom(this.state.type)), this.state.type === B) return this.includesContext(A) && this.next(), e;
782
+ this.next();
783
+ }
784
+ return e;
785
+ }
786
+ parseObjectPattern() {
787
+ let e = {
788
+ type: "ObjectPattern",
789
+ properties: []
790
+ };
791
+ return this.next(), e.properties = this.parseObjectProperties(), e;
792
+ }
793
+ parseObjectProperties() {
794
+ let e = [];
795
+ for (; this.state.type !== R && this.state.type !== K;) {
796
+ let t = {
797
+ type: "ObjectPatternProperty",
798
+ key: this.parseAtom(this.state.type)
799
+ };
800
+ if (e.push(t), this.state.type === I && (this.next(), t.value = this.parseAtom(this.state.type)), this.state.type === R) return this.includesContext(A) && this.next(), e;
801
+ this.next();
802
+ }
803
+ return e;
804
+ }
805
+ parseDotOperator() {
806
+ let e = { type: "DotOperator" };
807
+ if (!this.type_ && this.base) {
808
+ if (this.base.isMatchPattern) throw Error("Base path must be an absolute path.");
809
+ for (this.data.segments = this.base.toArr(); this.state.type === F;) this.relative = this.data.segments.pop(), this.haveRelativePattern = !0, this.next();
810
+ return _t(this.data.segments.slice(), this.parseAtom(this.state.type));
811
+ }
812
+ return this.next(), this.append(e, this.parseAtom(this.state.type)), e;
813
+ }
814
+ parseIgnoreExpression() {
815
+ this.next();
816
+ let e = String(this.state.value).replace(/\s*/g, ""), t = {
817
+ type: "IgnoreExpression",
818
+ value: e
819
+ };
820
+ return this.pushSegments(e), this.next(), this.append(t, this.parseAtom(this.state.type)), this.next(), t;
821
+ }
822
+ parseGroupExpression(e) {
823
+ let t = {
824
+ type: "GroupExpression",
825
+ value: []
826
+ };
827
+ this.isMatchPattern = !0, this.data.segments = [], this.next();
828
+ loop: for (;;) switch (this.state.type) {
829
+ case W:
830
+ this.next();
831
+ break;
832
+ case ct:
833
+ t.isExclude = !0, this.haveExcludePattern = !0, this.next();
834
+ break;
835
+ case K: break loop;
836
+ case U: break loop;
837
+ default: t.value.push(this.parseAtom(this.state.type));
838
+ }
839
+ return this.next(), this.append(e, this.parseAtom(this.state.type)), t;
840
+ }
841
+ parseRangeExpression(e) {
842
+ let t = { type: "RangeExpression" };
843
+ this.next(), this.isMatchPattern = !0, this.data.segments = [];
844
+ let n = !1, r = !1;
845
+ loop: for (;;) switch (this.state.type) {
846
+ case I:
847
+ r = !0, n = !0, this.next();
848
+ break;
849
+ case B:
850
+ !r && !t.end && (t.end = t.start);
851
+ break loop;
852
+ case W: throw this.unExpect();
853
+ case K: break loop;
854
+ default: n ? t.end = this.parseAtom(this.state.type) : t.start = this.parseAtom(this.state.type);
855
+ }
856
+ return this.next(), this.append(e, this.parseAtom(this.state.type)), t;
857
+ }
858
+ }, q = /* @__PURE__ */ new Map(), bt = Symbol("PATH_MATCHER");
859
+ function xt(e) {
860
+ return je(e) && e[bt] === !0;
861
+ }
862
+ function J(e) {
863
+ return e != null;
864
+ }
865
+ function St(e) {
866
+ return e.indexOf("*") === -1 && e.indexOf("~") === -1 && e.indexOf("[") === -1 && e.indexOf("]") === -1 && e.indexOf(",") === -1 && e.indexOf(":") === -1 && e.indexOf(" ") === -1 && e[0] !== ".";
867
+ }
868
+ function Ct(e) {
869
+ return typeof e == "object" || typeof e == "function";
870
+ }
871
+ function wt(e) {
872
+ return S(e) ? /^\d+$/.test(e) : C(e);
873
+ }
874
+ function Y(e, t) {
875
+ for (let n = 0; n < e.length; n++) {
876
+ let r = e[n], i = E(r);
877
+ if (i) {
878
+ t = et(t, i, {
879
+ setIn: X,
880
+ getIn: Y
881
+ });
882
+ break;
883
+ }
884
+ if (!J(t)) return;
885
+ t = t[r];
886
+ }
887
+ return t;
888
+ }
889
+ function X(e, t, n) {
890
+ for (let r = 0; r < e.length; r++) {
891
+ let i = e[r], a = E(i);
892
+ if (a) {
893
+ $e(t, a, n, {
894
+ setIn: X,
895
+ getIn: Y
896
+ });
897
+ break;
898
+ }
899
+ if (!J(t) || !Ct(t) || x(t) && !wt(i)) return;
900
+ if (!J(t[i])) {
901
+ if (n === void 0) {
902
+ t[i] === null && (t[i] = n);
903
+ return;
904
+ }
905
+ r < e.length - 1 && (t[i] = C(e[r + 1]) ? [] : {});
906
+ }
907
+ r === e.length - 1 && (t[i] = n), t = t[i];
908
+ }
909
+ }
910
+ function Tt(e, t) {
911
+ for (let n = 0; n < e.length; n++) {
912
+ let r = e[n], i = E(r);
913
+ if (i) {
914
+ tt(t, i, {
915
+ setIn: X,
916
+ getIn: Y,
917
+ deleteIn: Tt
918
+ });
919
+ break;
920
+ }
921
+ if (n === e.length - 1 && J(t)) {
922
+ delete t[r];
923
+ return;
924
+ }
925
+ if (!J(t) || !Ct(t) || (t = t[r], !Me(t))) return;
926
+ }
927
+ }
928
+ var Et = Object.prototype.hasOwnProperty;
929
+ function Dt(e, t, n) {
930
+ n instanceof Z && (n = n.length);
931
+ for (let r = n; r < e.length; r++) {
932
+ let i = e[r], a = E(i);
933
+ if (a) return nt(t, a, n, {
934
+ setIn: X,
935
+ getIn: Y,
936
+ deleteIn: Tt,
937
+ existIn: Dt
938
+ });
939
+ if (r === e.length - 1) return Et.call(t, i);
940
+ if (!J(t) || !Ct(t) || (t = t[i], !Me(t))) return !1;
941
+ }
942
+ }
943
+ function Ot(e, t) {
944
+ if (e instanceof Z) return {
945
+ entire: e.entire,
946
+ segments: e.segments.slice(),
947
+ isRegExp: !1,
948
+ haveRelativePattern: e.haveRelativePattern,
949
+ isWildMatchPattern: e.isWildMatchPattern,
950
+ isMatchPattern: e.isMatchPattern,
951
+ haveExcludePattern: e.haveExcludePattern,
952
+ tree: e.tree
953
+ };
954
+ if (S(e)) {
955
+ if (!e) return {
956
+ entire: "",
957
+ segments: [],
958
+ isRegExp: !1,
959
+ isWildMatchPattern: !1,
960
+ haveRelativePattern: !1,
961
+ haveExcludePattern: !1,
962
+ isMatchPattern: !1
963
+ };
964
+ if (St(e)) return {
965
+ entire: e,
966
+ segments: e.split("."),
967
+ isRegExp: !1,
968
+ haveRelativePattern: !1,
969
+ isWildMatchPattern: !1,
970
+ haveExcludePattern: !1,
971
+ isMatchPattern: !1
972
+ };
973
+ let n = new yt(e, Z.parse(t)), r = n.parse();
974
+ if (n.isMatchPattern) return {
975
+ entire: e,
976
+ segments: [],
977
+ isRegExp: !1,
978
+ haveRelativePattern: !1,
979
+ isWildMatchPattern: n.isWildMatchPattern,
980
+ haveExcludePattern: n.haveExcludePattern,
981
+ isMatchPattern: !0,
982
+ tree: r
983
+ };
984
+ {
985
+ let e = n.data.segments;
986
+ return {
987
+ entire: e.join("."),
988
+ segments: e,
989
+ tree: r,
990
+ isRegExp: !1,
991
+ haveRelativePattern: n.haveRelativePattern,
992
+ isWildMatchPattern: !1,
993
+ haveExcludePattern: !1,
994
+ isMatchPattern: !1
995
+ };
996
+ }
997
+ }
998
+ return xt(e) ? Ot(e.path) : x(e) ? {
999
+ entire: e.join("."),
1000
+ segments: e.reduce((e, t) => e.concat(kt(t)), []),
1001
+ isRegExp: !1,
1002
+ haveRelativePattern: !1,
1003
+ isWildMatchPattern: !1,
1004
+ haveExcludePattern: !1,
1005
+ isMatchPattern: !1
1006
+ } : Ne(e) ? {
1007
+ entire: e,
1008
+ segments: [],
1009
+ isRegExp: !0,
1010
+ haveRelativePattern: !1,
1011
+ isWildMatchPattern: !1,
1012
+ haveExcludePattern: !1,
1013
+ isMatchPattern: !0
1014
+ } : {
1015
+ entire: "",
1016
+ isRegExp: !1,
1017
+ segments: e === void 0 ? [] : [e],
1018
+ haveRelativePattern: !1,
1019
+ isWildMatchPattern: !1,
1020
+ haveExcludePattern: !1,
1021
+ isMatchPattern: !1
1022
+ };
1023
+ }
1024
+ function kt(e) {
1025
+ if (S(e)) {
1026
+ e = e.replace(/\s*/g, "");
1027
+ try {
1028
+ let { segments: t, isMatchPattern: n } = Ot(e);
1029
+ return n ? e : t;
1030
+ } catch {
1031
+ return e;
1032
+ }
1033
+ }
1034
+ return e instanceof Z ? e.segments : e;
1035
+ }
1036
+ var Z = class e {
1037
+ entire;
1038
+ segments;
1039
+ isMatchPattern;
1040
+ isWildMatchPattern;
1041
+ isRegExp;
1042
+ haveRelativePattern;
1043
+ haveExcludePattern;
1044
+ matchScore = 0;
1045
+ tree;
1046
+ matchCache;
1047
+ includesCache;
1048
+ constructor(e, t) {
1049
+ let { tree: n, segments: r, entire: i, isRegExp: a, isMatchPattern: o, isWildMatchPattern: s, haveRelativePattern: c, haveExcludePattern: l } = Ot(e, t);
1050
+ this.entire = i, this.segments = r, this.isMatchPattern = o, this.isWildMatchPattern = s, this.haveRelativePattern = c, this.isRegExp = a, this.haveExcludePattern = l, this.tree = n, this.matchCache = /* @__PURE__ */ new Map(), this.includesCache = /* @__PURE__ */ new Map();
1051
+ }
1052
+ toString() {
1053
+ return this.entire?.toString();
1054
+ }
1055
+ toArr() {
1056
+ return this.segments?.slice();
1057
+ }
1058
+ get length() {
1059
+ return this.segments.length;
1060
+ }
1061
+ concat = (...t) => {
1062
+ if (this.isMatchPattern || this.isRegExp) throw Error(`${this.entire} cannot be concat`);
1063
+ let n = new e("");
1064
+ return n.segments = this.segments.concat(...t.map((e) => kt(e))), n.entire = n.segments.join("."), n;
1065
+ };
1066
+ slice = (t, n) => {
1067
+ if (this.isMatchPattern || this.isRegExp) throw Error(`${this.entire} cannot be slice`);
1068
+ let r = new e("");
1069
+ return r.segments = this.segments.slice(t, n), r.entire = r.segments.join("."), r;
1070
+ };
1071
+ push = (...e) => this.concat(...e);
1072
+ pop = () => {
1073
+ if (this.isMatchPattern || this.isRegExp) throw Error(`${this.entire} cannot be pop`);
1074
+ return new e(this.segments.slice(0, this.segments.length - 1));
1075
+ };
1076
+ splice = (t, n, ...r) => {
1077
+ if (this.isMatchPattern || this.isRegExp) throw Error(`${this.entire} cannot be splice`);
1078
+ r = r.reduce((e, t) => e.concat(kt(t)), []);
1079
+ let i = this.segments.slice();
1080
+ return i.splice(t, n, ...r), new e(i);
1081
+ };
1082
+ forEach = (e) => {
1083
+ if (this.isMatchPattern || this.isRegExp) throw Error(`${this.entire} cannot be each`);
1084
+ this.segments.forEach(e);
1085
+ };
1086
+ map = (e) => {
1087
+ if (this.isMatchPattern || this.isRegExp) throw Error(`${this.entire} cannot be map`);
1088
+ return this.segments.map(e);
1089
+ };
1090
+ reduce = (e, t) => {
1091
+ if (this.isMatchPattern || this.isRegExp) throw Error(`${this.entire} cannot be reduce`);
1092
+ return this.segments.reduce(e, t);
1093
+ };
1094
+ parent = () => this.slice(0, this.length - 1);
1095
+ includes = (t) => {
1096
+ let { entire: n, segments: r, isMatchPattern: i } = e.parse(t), a = this.includesCache.get(n);
1097
+ if (a !== void 0) return a;
1098
+ let o = (e) => (this.includesCache.set(n, e), e);
1099
+ if (this.isMatchPattern) {
1100
+ if (i) throw Error(`${this.entire} cannot be used to match ${n}`);
1101
+ return o(this.match(r));
1102
+ }
1103
+ if (i) throw Error(`${this.entire} cannot be used to match ${n}`);
1104
+ if (r.length > this.segments.length) return o(!1);
1105
+ for (let e = 0; e < r.length; e++) if (!w(String(r[e]), String(this.segments[e]))) return o(!1);
1106
+ return o(!0);
1107
+ };
1108
+ transform = (e, t) => {
1109
+ if (!je(t)) return "";
1110
+ if (this.isMatchPattern) throw Error(`${this.entire} cannot be transformed`);
1111
+ let n = new RegExp(e);
1112
+ return t(...this.segments.filter((e) => n.test(e)));
1113
+ };
1114
+ match = (t) => {
1115
+ let n = e.parse(t), r = this.matchCache.get(n.entire);
1116
+ if (r !== void 0) return r.record && r.record.score !== void 0 && (this.matchScore = r.record.score), r.matched;
1117
+ let i = (e) => (this.matchCache.set(n.entire, e), e);
1118
+ if (n.isMatchPattern) {
1119
+ if (this.isMatchPattern) throw Error(`${n.entire} cannot match ${this.entire}`);
1120
+ return this.matchScore = 0, i(n.match(this.segments));
1121
+ }
1122
+ if (this.isMatchPattern) {
1123
+ if (this.isRegExp) try {
1124
+ return this.entire.test(String(n.entire));
1125
+ } finally {
1126
+ this.entire.lastIndex = 0;
1127
+ }
1128
+ let e = { score: 0 }, t = i(new rt(this.tree, e).match(n.segments));
1129
+ return this.matchScore = e.score, t.matched;
1130
+ }
1131
+ {
1132
+ let e = { score: 0 }, t = i(rt.matchSegments(this.segments, n.segments, e));
1133
+ return this.matchScore = e.score, t.matched;
1134
+ }
1135
+ };
1136
+ matchAliasGroup = (t, n) => {
1137
+ let r = e.parse(t), i = e.parse(n), a = this.match(r), o = this.matchScore, s = this.match(i), c = this.matchScore;
1138
+ return this.haveExcludePattern ? o >= c ? a : s : a || s;
1139
+ };
1140
+ existIn = (e, t = 0) => Dt(this.segments, e, t);
1141
+ getIn = (e) => Y(this.segments, e);
1142
+ setIn = (e, t) => (X(this.segments, e, t), e);
1143
+ deleteIn = (e) => (Tt(this.segments, e), e);
1144
+ ensureIn = (e, t) => {
1145
+ let n = this.getIn(e);
1146
+ return n === void 0 ? (this.setIn(e, t), this.getIn(e)) : n;
1147
+ };
1148
+ static match(t) {
1149
+ let n = e.parse(t), r = ((e) => n.match(e));
1150
+ return r[bt] = !0, r.path = n, r;
1151
+ }
1152
+ static isPathPattern(e) {
1153
+ return !!(S(e) || x(e) || Ne(e) || xt(e));
1154
+ }
1155
+ static transform(t, n, r) {
1156
+ return e.parse(t).transform(n, r);
1157
+ }
1158
+ static parse(t = "", n) {
1159
+ if (t instanceof e) return q.get(t.entire) || (q.set(t.entire, t), t);
1160
+ if (xt(t)) return e.parse(t.path);
1161
+ {
1162
+ let r = n ? e.parse(n) : "", i = `${t}:${r}`;
1163
+ return q.get(i) || (t = new e(t, n), q.set(i, t), t);
1164
+ }
1165
+ }
1166
+ static getIn = (t, n) => e.parse(n).getIn(t);
1167
+ static setIn = (t, n, r) => e.parse(n).setIn(t, r);
1168
+ static deleteIn = (t, n) => e.parse(n).deleteIn(t);
1169
+ static existIn = (t, n, r) => e.parse(n).existIn(t, r);
1170
+ static ensureIn = (t, n, r) => e.parse(n).ensureIn(t, r);
1171
+ }, At = {};
1172
+ function jt(e, t, n) {
1173
+ if (r(e)) return function(r, i, a, o, s) {
1174
+ return jt(t, n), e.apply(this, arguments);
1175
+ };
1176
+ o(e) && !At[e] && (At[e] = !0, console.warn(/* @__PURE__ */ Error(`${e} has been deprecated. Do not continue to use this api.${t || ""}`)));
1177
+ }
1178
+ // src/subscribable.ts
1179
+ var Mt = class {
1180
+ subscribers = { index: 0 };
1181
+ subscription;
1182
+ subscribe = (e) => {
1183
+ if (r(e)) {
1184
+ let t = this.subscribers.index + 1;
1185
+ return this.subscribers[t] = e, this.subscribers.index++, t;
1186
+ }
1187
+ };
1188
+ unsubscribe = (e) => {
1189
+ !e && typeof e != "number" ? this.subscribers = { index: 0 } : this.subscribers[e] && delete this.subscribers[e];
1190
+ };
1191
+ notify = (e, t) => {
1192
+ if (this.subscription && this.subscription && r(this.subscription.notify) && this.subscription.notify.call(this, e) === !1 || t) return;
1193
+ let n = (e) => this.subscription && r(this.subscription.filter) ? this.subscription.filter.call(this, e) : e;
1194
+ g(this.subscribers, (t) => {
1195
+ r(t) && t(n(e));
1196
+ });
1197
+ };
1198
+ };
1199
+ // src/middleware.ts
1200
+ function Nt(e, t = []) {
1201
+ function n(e, t) {
1202
+ let r = e;
1203
+ return Promise.resolve(t[0](e, (e) => n(e ?? r, t.slice(1))));
1204
+ }
1205
+ return new Promise((r, i) => {
1206
+ n(e, t.concat((e) => {
1207
+ r(e);
1208
+ })).catch(i);
1209
+ });
1210
+ }
1211
+ // src/merge.ts
1212
+ function Pt(e) {
1213
+ return Ft(e) && !It(e);
1214
+ }
1215
+ function Ft(e) {
1216
+ return !!e && typeof e == "object";
1217
+ }
1218
+ function It(e) {
1219
+ return "$$typeof" in e && "_owner" in e || e._isAMomentObject || e._isJSONSchemaObject || r(e.toJS) || r(e.toJSON) ? !0 : !a(e);
1220
+ }
1221
+ function Lt(e) {
1222
+ return Array.isArray(e) ? [] : {};
1223
+ }
1224
+ function Q(e, t) {
1225
+ return t.clone !== !1 && t.isMergeableObject?.(e) ? $(Lt(e), e, t) : e;
1226
+ }
1227
+ function Rt(e, t, n) {
1228
+ return e.concat(t).map(function(e) {
1229
+ return Q(e, n);
1230
+ });
1231
+ }
1232
+ function zt(e, t) {
1233
+ if (!t.customMerge) return $;
1234
+ let n = t.customMerge(e);
1235
+ return typeof n == "function" ? n : $;
1236
+ }
1237
+ function Bt(e) {
1238
+ return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(e).filter(function(t) {
1239
+ return e.propertyIsEnumerable(t);
1240
+ }) : [];
1241
+ }
1242
+ function Vt(e) {
1243
+ return y(e) ? Object.keys(e).concat(Bt(e)) : [];
1244
+ }
1245
+ function Ht(e, t) {
1246
+ /* istanbul ignore next */
1247
+ try {
1248
+ return t in e;
1249
+ } catch {
1250
+ return !1;
1251
+ }
1252
+ }
1253
+ function Ut(e, t) {
1254
+ return Ht(e, t) && !(Object.hasOwnProperty.call(e, t) && Object.propertyIsEnumerable.call(e, t));
1255
+ }
1256
+ function Wt(e, t, n) {
1257
+ let r = n.assign && e || {};
1258
+ return n.isMergeableObject?.(e) ? (n.assign || Vt(e).forEach(function(t) {
1259
+ r[t] = Q(e[t], n);
1260
+ }), Vt(t).forEach(function(i) {
1261
+ /* istanbul ignore next */
1262
+ Ut(e, i) || (Se(e[i]) ? r[i] = t[i] : Ht(e, i) && n.isMergeableObject(t[i]) ? r[i] = zt(i, n)(e[i], t[i], n) : r[i] = Q(t[i], n));
1263
+ }), r) : e;
1264
+ }
1265
+ function $(e, t, n) {
1266
+ n ||= {}, n.arrayMerge = n.arrayMerge || Rt, n.isMergeableObject = n.isMergeableObject || Pt, n.cloneUnlessOtherwiseSpecified = Q;
1267
+ let r = Array.isArray(t);
1268
+ return r === Array.isArray(e) ? r ? n.arrayMerge(e, t, n) : Wt(e, t, n) : Q(t, n);
1269
+ }
1270
+ function Gt(e, ...t) {
1271
+ function n(e, t) {
1272
+ if (!y(t)) return e;
1273
+ if (!y(e)) return t;
1274
+ let n = typeof e == "object", r = typeof t == "object", i = typeof e == "function", a = typeof t == "function";
1275
+ if (!n && !i) return t;
1276
+ if (!r && !a) return e;
1277
+ function o() {
1278
+ return typeof e == "function" ? e() : e;
1279
+ }
1280
+ function s() {
1281
+ return typeof t == "function" ? t() : t;
1282
+ }
1283
+ function c(e, t, n) {
1284
+ let r = s(), i = o();
1285
+ return t in r ? r[t] = n : t in i ? i[t] = n : r[t] = n, !0;
1286
+ }
1287
+ function l(e, t) {
1288
+ let n = s();
1289
+ return t in n ? n[t] : o()[t];
1290
+ }
1291
+ function u() {
1292
+ let e = s(), t = o(), n = Object.keys(t);
1293
+ for (let r in e) r in t || n.push(r);
1294
+ return n;
1295
+ }
1296
+ function d(e, t) {
1297
+ return {
1298
+ value: l(e, t),
1299
+ enumerable: !0,
1300
+ configurable: !0
1301
+ };
1302
+ }
1303
+ function f(e, t) {
1304
+ return t in s() || t in o();
1305
+ }
1306
+ function p() {
1307
+ return Object.getPrototypeOf({});
1308
+ }
1309
+ return new Proxy(Object.create(null), {
1310
+ set: c,
1311
+ get: l,
1312
+ ownKeys: u,
1313
+ getPrototypeOf: p,
1314
+ getOwnPropertyDescriptor: d,
1315
+ has: f
1316
+ });
1317
+ }
1318
+ return t.reduce((e, t) => n(e, t), e);
1319
+ }
1320
+ var Kt = $;
1321
+ // src/defaults.ts
1322
+ function qt(e) {
1323
+ if (e?._owner && e?.$$typeof || e?._isAMomentObject || e?._isJSONSchemaObject || e?.toJS || e?.toJSON) return !0;
1324
+ }
1325
+ function Jt(e) {
1326
+ return !qt(e) && typeof e == "object";
1327
+ }
1328
+ function Yt(e, t) {
1329
+ if (n(e) !== n(t) || !Jt(e) || !Jt(t)) return Se(t) ? e : t;
1330
+ {
1331
+ let n = i(e) ? [] : a(e) ? {} : e;
1332
+ return g(t, (t, r) => {
1333
+ n[r] = Yt(e[r], t);
1334
+ }), g(e, (e, t) => {
1335
+ y(n[t]) || (n[t] = e);
1336
+ }), n;
1337
+ }
1338
+ }
1339
+ for (var Xt = 36, Zt = ""; Xt--;) Zt += Xt.toString(36);
1340
+ function Qt(e) {
1341
+ let t = "", n = e || 11;
1342
+ for (; n--;) t += Zt[Math.random() * 36 | 0];
1343
+ return t;
1344
+ }
1345
+ export { Z as FormPath, Mt as Subscribable, Nt as applyMiddleware, ve as clone, Yt as defaults, jt as deprecate, g as each, ae as every, ce as find, se as findIndex, n as getType, fe as globalThisPolyfill, le as includes, _ as instOf, i as isArr, s as isBool, Se as isEmpty, ge as isEqual, r as isFn, ne as isHTMLElement, l as isMap, c as isNum, p as isNumberLike, m as isObj, a as isPlainObj, te as isReactElement, ee as isRegExp, u as isSet, o as isStr, xe as isUndef, y as isValid, d as isWeakMap, f as isWeakSet, Gt as lazyMerge, Oe as lowerCase, re as map, Kt as merge, ue as move, ke as pascalCase, ie as reduce, _e as shallowClone, oe as some, De as stringLength, h as toArr, Qt as uid };
1346
+
1347
+ //# sourceMappingURL=index.js.map