@formvk/shared 0.1.0 → 1.0.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 CHANGED
@@ -1,95 +1,96 @@
1
+ import { Path as e } from "@formvk/path";
1
2
  // 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);
3
+ var t = Object.prototype.toString;
4
+ function n(e) {
5
+ return (t) => r(t) === `[object ${e}]`;
8
6
  }
9
7
  function r(e) {
10
- return typeof e == "function";
8
+ return t.call(e);
11
9
  }
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;
10
+ function i(e) {
11
+ return typeof e == "function";
15
12
  }
13
+ var a = Array.isArray, o = n("Object"), s = n("String"), c = n("Boolean"), l = n("Number");
16
14
  function u(e) {
17
- return e && e instanceof Set;
15
+ return e && e instanceof Map;
18
16
  }
19
17
  function d(e) {
20
- return e && e instanceof WeakMap;
18
+ return e && e instanceof Set;
21
19
  }
22
20
  function f(e) {
23
- return e && e instanceof WeakSet;
21
+ return e && e instanceof WeakMap;
24
22
  }
25
23
  function p(e) {
26
- return c(e) || /^\d+$/.test(e);
24
+ return e && e instanceof WeakSet;
27
25
  }
28
26
  function m(e) {
27
+ return l(e) || /^\d+$/.test(e);
28
+ }
29
+ function h(e) {
29
30
  return typeof e == "object";
30
31
  }
31
- var ee = t("RegExp");
32
- function te(e) {
32
+ var g = n("RegExp");
33
+ function _(e) {
33
34
  return e && e.$$typeof && e._owner;
34
35
  }
35
- function ne(e) {
36
+ function v(e) {
36
37
  return Object.prototype.toString.call(e).indexOf("HTML") > -1;
37
38
  }
38
39
  // src/array.ts
39
- function h(e) {
40
- return i(e) ? e : e ? [e] : [];
40
+ function y(e) {
41
+ return a(e) ? e : e ? [e] : [];
41
42
  }
42
- function g(e, t, n) {
43
- if (i(e) || o(e)) {
43
+ function b(e, t, n) {
44
+ if (a(e) || s(e)) {
44
45
  if (n) {
45
46
  for (let n = e.length - 1; n >= 0; n--) if (t(e[n], n) === !1) return;
46
47
  } else for (let n = 0; n < e.length; n++) if (t(e[n], n) === !1) return;
47
- } else if (m(e)) {
48
+ } else if (h(e)) {
48
49
  let n = e, r;
49
50
  for (r in n) if (Object.hasOwnProperty.call(n, r) && t(n[r], r) === !1) return;
50
51
  }
51
52
  }
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;
53
+ function x(e, t, n) {
54
+ let r = a(e) || s(e) ? [] : {};
55
+ return b(e, (e, n) => {
56
+ let i = t(e, n);
57
+ a(r) ? r.push(i) : r[n] = i;
57
58
  }, n), r;
58
59
  }
59
- function ie(e, t, n, r) {
60
+ function ee(e, t, n, r) {
60
61
  let i = n;
61
- return g(e, (e, n) => {
62
+ return b(e, (e, n) => {
62
63
  i = t(i, e, n);
63
64
  }, r), i;
64
65
  }
65
- function ae(e, t, n) {
66
+ function S(e, t, n) {
66
67
  let r = !0;
67
- return g(e, (e, n) => {
68
+ return b(e, (e, n) => {
68
69
  if (!t(e, n)) return r = !1, !1;
69
70
  }, n), r;
70
71
  }
71
- function oe(e, t, n) {
72
+ function C(e, t, n) {
72
73
  let r = !1;
73
- return g(e, (e, n) => {
74
+ return b(e, (e, n) => {
74
75
  if (t(e, n)) return r = !0, !1;
75
76
  }, n), r;
76
77
  }
77
- function se(e, t, n) {
78
+ function te(e, t, n) {
78
79
  let r = -1;
79
- return g(e, (e, n) => {
80
+ return b(e, (e, n) => {
80
81
  if (t(e, n)) return r = n, !1;
81
82
  }, n), r;
82
83
  }
83
- function ce(e, t, n) {
84
+ function ne(e, t, n) {
84
85
  let r;
85
- return g(e, (e, n) => {
86
+ return b(e, (e, n) => {
86
87
  if (t(e, n)) return r = e, !1;
87
88
  }, n), r;
88
89
  }
89
- function le(e, t, n) {
90
- return o(e) ? e.includes(t) : oe(e, (e) => e === t, n);
90
+ function re(e, t, n) {
91
+ return s(e) ? e.includes(t) : C(e, (e) => e === t, n);
91
92
  }
92
- function ue(e, t, n) {
93
+ function ie(e, t, n) {
93
94
  if (t === n || n < 0 || t < 0 || n > e.length - 1 || t > e.length - 1) return e;
94
95
  if (t < n) {
95
96
  let r = e[t];
@@ -104,7 +105,7 @@ function ue(e, t, n) {
104
105
  }
105
106
  // src/global.ts
106
107
  /* istanbul ignore next */
107
- function de() {
108
+ function ae() {
108
109
  try {
109
110
  if (typeof self < "u") return self;
110
111
  } catch {}
@@ -116,25 +117,25 @@ function de() {
116
117
  } catch {}
117
118
  return Function("return this")();
118
119
  }
119
- var fe = de();
120
+ var w = ae();
120
121
  // src/instanceof.ts
121
- function _(e, t) {
122
- if (r(t)) return e instanceof t;
123
- if (o(t)) {
124
- let n = fe[t];
122
+ function T(e, t) {
123
+ if (i(t)) return e instanceof t;
124
+ if (s(t)) {
125
+ let n = w[t];
125
126
  return n ? e instanceof n : !1;
126
127
  }
127
128
  return !1;
128
129
  }
129
130
  // src/compare.ts
130
- var pe = i, me = Object.keys, he = Object.prototype.hasOwnProperty;
131
- function v(e, t) {
131
+ var E = a, D = Object.keys, O = Object.prototype.hasOwnProperty;
132
+ function k(e, t) {
132
133
  if (e === t) return !0;
133
134
  if (e && t && typeof e == "object" && typeof t == "object") {
134
- let n = pe(e), r = pe(t), i, a, o;
135
+ let n = E(e), r = E(t), i, a, o;
135
136
  if (n && r) {
136
137
  if (a = e.length, a !== t.length) return !1;
137
- for (i = a; i-- !== 0;) if (!v(e[i], t[i])) return !1;
138
+ for (i = a; i-- !== 0;) if (!k(e[i], t[i])) return !1;
138
139
  return !0;
139
140
  }
140
141
  if (n !== r) return !1;
@@ -144,29 +145,29 @@ function v(e, t) {
144
145
  let l = e && e.toJS;
145
146
  if (l !== (t && t.toJS)) return !1;
146
147
  if (l) return e.is ? e.is(t) : e === t;
147
- let u = _(e, "Date"), d = _(t, "Date");
148
+ let u = T(e, "Date"), d = T(t, "Date");
148
149
  if (u !== d) return !1;
149
150
  if (u && d) return e.getTime() === t.getTime();
150
- let f = _(e, "RegExp"), p = _(t, "RegExp");
151
+ let f = T(e, "RegExp"), p = T(t, "RegExp");
151
152
  if (f !== p) return !1;
152
153
  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;
154
+ let m = T(e, "URL"), h = T(t, "URL");
155
+ if (m !== h) return !1;
156
+ if (m && h) return e.href === t.href;
157
+ let g = e && e.toJSON, _ = t && t.toJSON;
158
+ if (g !== _) return !1;
159
+ if (g && _) return k(e.toJSON(), t.toJSON());
160
+ let v = D(e);
161
+ if (a = v.length, a !== D(t).length) return !1;
162
+ for (i = a; i-- !== 0;) if (!O.call(t, v[i])) return !1;
163
+ for (i = a; i-- !== 0;) if (o = v[i], !(o === "_owner" && e.$$typeof) && !k(e[o], t[o])) return !1;
163
164
  return !0;
164
165
  }
165
166
  return e !== e && t !== t;
166
167
  }
167
- var ge = function(e, t) {
168
+ var A = function(e, t) {
168
169
  try {
169
- return v(e, t);
170
+ return k(e, t);
170
171
  } catch (e) {
171
172
  let t = e;
172
173
  /* istanbul ignore next */
@@ -176,41 +177,41 @@ var ge = function(e, t) {
176
177
  }
177
178
  };
178
179
  // src/clone.ts
179
- function _e(e) {
180
+ function oe(e) {
180
181
  if (Array.isArray(e)) return e.slice(0);
181
- if (a(e)) {
182
+ if (o(e)) {
182
183
  let t = e;
183
- return "$$typeof" in t && "_owner" in t || t._isAMomentObject || t._isJSONSchemaObject || r(t.toJS) || r(t.toJSON) ? e : { ...t };
184
+ return "$$typeof" in t && "_owner" in t || t._isAMomentObject || t._isJSONSchemaObject || i(t.toJS) || i(t.toJSON) ? e : { ...t };
184
185
  }
185
186
  return typeof e == "object" ? new e.constructor(e) : e;
186
187
  }
187
- function ve(e) {
188
+ function j(e) {
188
189
  if (Array.isArray(e)) {
189
190
  let t = [];
190
191
  return e.forEach((e) => {
191
- t.push(ve(e));
192
+ t.push(j(e));
192
193
  }), t;
193
194
  }
194
- if (a(e)) {
195
+ if (o(e)) {
195
196
  let t = e;
196
197
  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();
198
+ if (i(t.toJS)) return t.toJS();
199
+ if (i(t.toJSON)) return t.toJSON();
199
200
  let n = {};
200
- for (let e in t) Object.hasOwnProperty.call(t, e) && (n[e] = ve(t[e]));
201
+ for (let e in t) Object.hasOwnProperty.call(t, e) && (n[e] = j(t[e]));
201
202
  return n;
202
203
  }
203
204
  return e;
204
205
  }
205
206
  // src/isEmpty.ts
206
- var ye = Object.prototype.hasOwnProperty, be = Object.prototype.toString;
207
- function xe(e) {
207
+ var se = Object.prototype.hasOwnProperty, ce = Object.prototype.toString;
208
+ function le(e) {
208
209
  return e === void 0;
209
210
  }
210
- function y(e) {
211
+ function M(e) {
211
212
  return e != null;
212
213
  }
213
- function Se(e, t = !1) {
214
+ function N(e, t = !1) {
214
215
  if (e == null) return !0;
215
216
  if (typeof e == "boolean" || typeof e == "number") return !1;
216
217
  if (typeof e == "string" || typeof e == "function") return e.length === 0;
@@ -221,966 +222,51 @@ function Se(e, t = !1) {
221
222
  } else if (e[n] !== void 0 && e[n] !== null && e[n] !== "" && e[n] !== 0) return !1;
222
223
  return !0;
223
224
  }
224
- if (_(e, "Error")) return e.message === "";
225
- if (e.toString === be) switch (e.toString()) {
225
+ if (T(e, "Error")) return e.message === "";
226
+ if (e.toString === ce) switch (e.toString()) {
226
227
  case "[object File]":
227
228
  case "[object Map]":
228
229
  case "[object Set]": return e.size === 0;
229
230
  case "[object Object]":
230
- for (let t in e) if (ye.call(e, t)) return !1;
231
+ for (let t in e) if (se.call(e, t)) return !1;
231
232
  return !0;
232
233
  }
233
234
  return !1;
234
235
  }
235
236
  // src/string.ts
236
- function Ce() {
237
+ function P() {
237
238
  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
  }
239
- var we = "[\ud800-\udbff][\udc00-\udfff]";
240
- function Te(e) {
241
- return e && e.exact ? RegExp(`^${we}$`) : new RegExp(we, "g");
240
+ var F = "[\ud800-\udbff][\udc00-\udfff]";
241
+ function I(e) {
242
+ return e && e.exact ? RegExp(`^${F}$`) : new RegExp(F, "g");
242
243
  }
243
- function Ee(e) {
244
- return typeof e == "string" ? e.replace(Ce(), "") : e;
244
+ function L(e) {
245
+ return typeof e == "string" ? e.replace(P(), "") : e;
245
246
  }
246
- function De(e) {
247
- return Ee(e).replace(Te(), " ").length;
247
+ function R(e) {
248
+ return L(e).replace(I(), " ").length;
248
249
  }
249
- function Oe(e) {
250
+ function z(e) {
250
251
  return e.toLowerCase();
251
252
  }
252
- function ke(e) {
253
+ function B(e) {
253
254
  return e.split(/[-_\s]+/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("");
254
255
  }
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
256
+ // src/deprecate.ts
257
+ var V = {};
258
+ function H(e, t, n) {
259
+ if (i(e)) return function(r, i, a, o, s) {
260
+ return H(t, n), e.apply(this, arguments);
953
261
  };
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 || ""}`)));
262
+ s(e) && !V[e] && (V[e] = !0, console.warn(/* @__PURE__ */ Error(`${e} has been deprecated. Do not continue to use this api.${t || ""}`)));
1177
263
  }
1178
264
  // src/subscribable.ts
1179
- var Mt = class {
265
+ var U = class {
1180
266
  subscribers = { index: 0 };
1181
267
  subscription;
1182
268
  subscribe = (e) => {
1183
- if (r(e)) {
269
+ if (i(e)) {
1184
270
  let t = this.subscribers.index + 1;
1185
271
  return this.subscribers[t] = e, this.subscribers.index++, t;
1186
272
  }
@@ -1189,15 +275,15 @@ var Mt = class {
1189
275
  !e && typeof e != "number" ? this.subscribers = { index: 0 } : this.subscribers[e] && delete this.subscribers[e];
1190
276
  };
1191
277
  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));
278
+ if (this.subscription && this.subscription && i(this.subscription.notify) && this.subscription.notify.call(this, e) === !1 || t) return;
279
+ let n = (e) => this.subscription && i(this.subscription.filter) ? this.subscription.filter.call(this, e) : e;
280
+ b(this.subscribers, (t) => {
281
+ i(t) && t(n(e));
1196
282
  });
1197
283
  };
1198
284
  };
1199
285
  // src/middleware.ts
1200
- function Nt(e, t = []) {
286
+ function W(e, t = []) {
1201
287
  function n(e, t) {
1202
288
  let r = e;
1203
289
  return Promise.resolve(t[0](e, (e) => n(e ?? r, t.slice(1))));
@@ -1209,40 +295,40 @@ function Nt(e, t = []) {
1209
295
  });
1210
296
  }
1211
297
  // src/merge.ts
1212
- function Pt(e) {
1213
- return Ft(e) && !It(e);
298
+ function ue(e) {
299
+ return de(e) && !fe(e);
1214
300
  }
1215
- function Ft(e) {
301
+ function de(e) {
1216
302
  return !!e && typeof e == "object";
1217
303
  }
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);
304
+ function fe(e) {
305
+ return "$$typeof" in e && "_owner" in e || e._isAMomentObject || e._isJSONSchemaObject || i(e.toJS) || i(e.toJSON) ? !0 : !o(e);
1220
306
  }
1221
- function Lt(e) {
307
+ function pe(e) {
1222
308
  return Array.isArray(e) ? [] : {};
1223
309
  }
1224
- function Q(e, t) {
1225
- return t.clone !== !1 && t.isMergeableObject?.(e) ? $(Lt(e), e, t) : e;
310
+ function G(e, t) {
311
+ return t.clone !== !1 && t.isMergeableObject?.(e) ? J(pe(e), e, t) : e;
1226
312
  }
1227
- function Rt(e, t, n) {
313
+ function me(e, t, n) {
1228
314
  return e.concat(t).map(function(e) {
1229
- return Q(e, n);
315
+ return G(e, n);
1230
316
  });
1231
317
  }
1232
- function zt(e, t) {
1233
- if (!t.customMerge) return $;
318
+ function he(e, t) {
319
+ if (!t.customMerge) return J;
1234
320
  let n = t.customMerge(e);
1235
- return typeof n == "function" ? n : $;
321
+ return typeof n == "function" ? n : J;
1236
322
  }
1237
- function Bt(e) {
323
+ function ge(e) {
1238
324
  return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(e).filter(function(t) {
1239
325
  return e.propertyIsEnumerable(t);
1240
326
  }) : [];
1241
327
  }
1242
- function Vt(e) {
1243
- return y(e) ? Object.keys(e).concat(Bt(e)) : [];
328
+ function K(e) {
329
+ return M(e) ? Object.keys(e).concat(ge(e)) : [];
1244
330
  }
1245
- function Ht(e, t) {
331
+ function q(e, t) {
1246
332
  /* istanbul ignore next */
1247
333
  try {
1248
334
  return t in e;
@@ -1250,27 +336,27 @@ function Ht(e, t) {
1250
336
  return !1;
1251
337
  }
1252
338
  }
1253
- function Ut(e, t) {
1254
- return Ht(e, t) && !(Object.hasOwnProperty.call(e, t) && Object.propertyIsEnumerable.call(e, t));
339
+ function _e(e, t) {
340
+ return q(e, t) && !(Object.hasOwnProperty.call(e, t) && Object.propertyIsEnumerable.call(e, t));
1255
341
  }
1256
- function Wt(e, t, n) {
342
+ function ve(e, t, n) {
1257
343
  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) {
344
+ return n.isMergeableObject?.(e) ? (n.assign || K(e).forEach(function(t) {
345
+ r[t] = G(e[t], n);
346
+ }), K(t).forEach(function(i) {
1261
347
  /* 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));
348
+ _e(e, i) || (N(e[i]) ? r[i] = t[i] : q(e, i) && n.isMergeableObject(t[i]) ? r[i] = he(i, n)(e[i], t[i], n) : r[i] = G(t[i], n));
1263
349
  }), r) : e;
1264
350
  }
1265
- function $(e, t, n) {
1266
- n ||= {}, n.arrayMerge = n.arrayMerge || Rt, n.isMergeableObject = n.isMergeableObject || Pt, n.cloneUnlessOtherwiseSpecified = Q;
351
+ function J(e, t, n) {
352
+ n ||= {}, n.arrayMerge = n.arrayMerge || me, n.isMergeableObject = n.isMergeableObject || ue, n.cloneUnlessOtherwiseSpecified = G;
1267
353
  let r = Array.isArray(t);
1268
- return r === Array.isArray(e) ? r ? n.arrayMerge(e, t, n) : Wt(e, t, n) : Q(t, n);
354
+ return r === Array.isArray(e) ? r ? n.arrayMerge(e, t, n) : ve(e, t, n) : G(t, n);
1269
355
  }
1270
- function Gt(e, ...t) {
356
+ function ye(e, ...t) {
1271
357
  function n(e, t) {
1272
- if (!y(t)) return e;
1273
- if (!y(e)) return t;
358
+ if (!M(t)) return e;
359
+ if (!M(e)) return t;
1274
360
  let n = typeof e == "object", r = typeof t == "object", i = typeof e == "function", a = typeof t == "function";
1275
361
  if (!n && !i) return t;
1276
362
  if (!r && !a) return e;
@@ -1317,31 +403,31 @@ function Gt(e, ...t) {
1317
403
  }
1318
404
  return t.reduce((e, t) => n(e, t), e);
1319
405
  }
1320
- var Kt = $;
406
+ var be = J;
1321
407
  // src/defaults.ts
1322
- function qt(e) {
408
+ function Y(e) {
1323
409
  if (e?._owner && e?.$$typeof || e?._isAMomentObject || e?._isJSONSchemaObject || e?.toJS || e?.toJSON) return !0;
1324
410
  }
1325
- function Jt(e) {
1326
- return !qt(e) && typeof e == "object";
411
+ function X(e) {
412
+ return !Y(e) && typeof e == "object";
1327
413
  }
1328
- function Yt(e, t) {
1329
- if (n(e) !== n(t) || !Jt(e) || !Jt(t)) return Se(t) ? e : t;
414
+ function Z(e, t) {
415
+ if (r(e) !== r(t) || !X(e) || !X(t)) return N(t) ? e : t;
1330
416
  {
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);
417
+ let n = a(e) ? [] : o(e) ? {} : e;
418
+ return b(t, (t, r) => {
419
+ n[r] = Z(e[r], t);
420
+ }), b(e, (e, t) => {
421
+ M(n[t]) || (n[t] = e);
1336
422
  }), n;
1337
423
  }
1338
424
  }
1339
- for (var Xt = 36, Zt = ""; Xt--;) Zt += Xt.toString(36);
1340
- function Qt(e) {
425
+ for (var Q = 36, $ = ""; Q--;) $ += Q.toString(36);
426
+ function xe(e) {
1341
427
  let t = "", n = e || 11;
1342
- for (; n--;) t += Zt[Math.random() * 36 | 0];
428
+ for (; n--;) t += $[Math.random() * 36 | 0];
1343
429
  return t;
1344
430
  }
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 };
431
+ export { e as FormPath, U as Subscribable, W as applyMiddleware, j as clone, Z as defaults, H as deprecate, b as each, S as every, ne as find, te as findIndex, r as getType, w as globalThisPolyfill, re as includes, T as instOf, a as isArr, c as isBool, N as isEmpty, A as isEqual, i as isFn, v as isHTMLElement, u as isMap, l as isNum, m as isNumberLike, h as isObj, o as isPlainObj, _ as isReactElement, g as isRegExp, d as isSet, s as isStr, le as isUndef, M as isValid, f as isWeakMap, p as isWeakSet, ye as lazyMerge, z as lowerCase, x as map, be as merge, ie as move, B as pascalCase, ee as reduce, oe as shallowClone, C as some, R as stringLength, y as toArr, xe as uid };
1346
432
 
1347
433
  //# sourceMappingURL=index.js.map