@busha/ramp-web-sdk 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/index.es.js +602 -602
- package/dist/index.umd.js +5 -5
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
const q = "busha-ramp-container",
|
|
1
|
+
var Fe = Object.defineProperty;
|
|
2
|
+
var $e = (r, e, t) => e in r ? Fe(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var R = (r, e, t) => $e(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
const q = "busha-ramp-container", X = "busha-ramp-loader", K = "busha-ramp-styles", ee = "busha-ramp-close-btn", z = "busha-ramp-iframe", Oe = "busha-ramp-form";
|
|
5
5
|
const Te = "INITIALIZED", oe = "CANCELLED", ke = "COMPLETED";
|
|
6
|
-
function Ce(
|
|
7
|
-
return
|
|
6
|
+
function Ce(r) {
|
|
7
|
+
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
|
|
8
8
|
}
|
|
9
9
|
var J, le;
|
|
10
10
|
function De() {
|
|
11
11
|
if (le) return J;
|
|
12
12
|
le = 1;
|
|
13
|
-
function
|
|
13
|
+
function r(c) {
|
|
14
14
|
this._maxSize = c, this.clear();
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
r.prototype.clear = function() {
|
|
17
17
|
this._size = 0, this._values = /* @__PURE__ */ Object.create(null);
|
|
18
|
-
},
|
|
18
|
+
}, r.prototype.get = function(c) {
|
|
19
19
|
return this._values[c];
|
|
20
|
-
},
|
|
21
|
-
return this._size >= this._maxSize && this.clear(), c in this._values || this._size++, this._values[c] =
|
|
20
|
+
}, r.prototype.set = function(c, m) {
|
|
21
|
+
return this._size >= this._maxSize && this.clear(), c in this._values || this._size++, this._values[c] = m;
|
|
22
22
|
};
|
|
23
|
-
var e = /[^.^\]^[]+|(?=\[\]|\.\.)/g, t = /^\d+$/,
|
|
23
|
+
var e = /[^.^\]^[]+|(?=\[\]|\.\.)/g, t = /^\d+$/, n = /^\d/, s = /[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g, a = /^\s*(['"]?)(.*?)(\1)\s*$/, i = 512, u = new r(i), o = new r(i), d = new r(i);
|
|
24
24
|
J = {
|
|
25
|
-
Cache:
|
|
25
|
+
Cache: r,
|
|
26
26
|
split: f,
|
|
27
27
|
normalizePath: l,
|
|
28
28
|
setter: function(c) {
|
|
29
|
-
var
|
|
30
|
-
return o.get(c) || o.set(c, function(O,
|
|
31
|
-
for (var
|
|
32
|
-
var D =
|
|
29
|
+
var m = l(c);
|
|
30
|
+
return o.get(c) || o.set(c, function(O, x) {
|
|
31
|
+
for (var _ = 0, T = m.length, C = O; _ < T - 1; ) {
|
|
32
|
+
var D = m[_];
|
|
33
33
|
if (D === "__proto__" || D === "constructor" || D === "prototype")
|
|
34
34
|
return O;
|
|
35
|
-
C = C[
|
|
35
|
+
C = C[m[_++]];
|
|
36
36
|
}
|
|
37
|
-
C[
|
|
37
|
+
C[m[_]] = x;
|
|
38
38
|
});
|
|
39
39
|
},
|
|
40
|
-
getter: function(c,
|
|
40
|
+
getter: function(c, m) {
|
|
41
41
|
var w = l(c);
|
|
42
|
-
return d.get(c) || d.set(c, function(
|
|
43
|
-
for (var
|
|
44
|
-
if (
|
|
42
|
+
return d.get(c) || d.set(c, function(x) {
|
|
43
|
+
for (var _ = 0, T = w.length; _ < T; )
|
|
44
|
+
if (x != null || !m) x = x[w[_++]];
|
|
45
45
|
else return;
|
|
46
|
-
return
|
|
46
|
+
return x;
|
|
47
47
|
});
|
|
48
48
|
},
|
|
49
49
|
join: function(c) {
|
|
50
|
-
return c.reduce(function(
|
|
51
|
-
return
|
|
50
|
+
return c.reduce(function(m, w) {
|
|
51
|
+
return m + (p(w) || t.test(w) ? "[" + w + "]" : (m ? "." : "") + w);
|
|
52
52
|
}, "");
|
|
53
53
|
},
|
|
54
|
-
forEach: function(c,
|
|
55
|
-
h(Array.isArray(c) ? c : f(c),
|
|
54
|
+
forEach: function(c, m, w) {
|
|
55
|
+
h(Array.isArray(c) ? c : f(c), m, w);
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
58
|
function l(c) {
|
|
59
59
|
return u.get(c) || u.set(
|
|
60
60
|
c,
|
|
61
|
-
f(c).map(function(
|
|
62
|
-
return
|
|
61
|
+
f(c).map(function(m) {
|
|
62
|
+
return m.replace(a, "$2");
|
|
63
63
|
})
|
|
64
64
|
);
|
|
65
65
|
}
|
|
66
66
|
function f(c) {
|
|
67
67
|
return c.match(e) || [""];
|
|
68
68
|
}
|
|
69
|
-
function h(c,
|
|
70
|
-
var O = c.length,
|
|
71
|
-
for (
|
|
72
|
-
|
|
69
|
+
function h(c, m, w) {
|
|
70
|
+
var O = c.length, x, _, T, C;
|
|
71
|
+
for (_ = 0; _ < O; _++)
|
|
72
|
+
x = c[_], x && (E(x) && (x = '"' + x + '"'), C = p(x), T = !C && /^\d+$/.test(x), m.call(w, x, C, T, _, c));
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function p(c) {
|
|
75
75
|
return typeof c == "string" && c && ["'", '"'].indexOf(c.charAt(0)) !== -1;
|
|
76
76
|
}
|
|
77
|
-
function
|
|
78
|
-
return c.match(
|
|
77
|
+
function y(c) {
|
|
78
|
+
return c.match(n) && !c.match(t);
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function b(c) {
|
|
81
81
|
return s.test(c);
|
|
82
82
|
}
|
|
83
|
-
function
|
|
84
|
-
return !
|
|
83
|
+
function E(c) {
|
|
84
|
+
return !p(c) && (y(c) || b(c));
|
|
85
85
|
}
|
|
86
86
|
return J;
|
|
87
87
|
}
|
|
88
|
-
var
|
|
88
|
+
var N = De(), Q, ce;
|
|
89
89
|
function Ae() {
|
|
90
90
|
if (ce) return Q;
|
|
91
91
|
ce = 1;
|
|
92
|
-
const
|
|
92
|
+
const r = /[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g, e = (l) => l.match(r) || [], t = (l) => l[0].toUpperCase() + l.slice(1), n = (l, f) => e(l).join(f).toLowerCase(), s = (l) => e(l).reduce(
|
|
93
93
|
(f, h) => `${f}${f ? h[0].toUpperCase() + h.slice(1).toLowerCase() : h.toLowerCase()}`,
|
|
94
94
|
""
|
|
95
95
|
);
|
|
@@ -98,9 +98,9 @@ function Ae() {
|
|
|
98
98
|
upperFirst: t,
|
|
99
99
|
camelCase: s,
|
|
100
100
|
pascalCase: (l) => t(s(l)),
|
|
101
|
-
snakeCase: (l) =>
|
|
102
|
-
kebabCase: (l) =>
|
|
103
|
-
sentenceCase: (l) => t(
|
|
101
|
+
snakeCase: (l) => n(l, "_"),
|
|
102
|
+
kebabCase: (l) => n(l, "-"),
|
|
103
|
+
sentenceCase: (l) => t(n(l, " ")),
|
|
104
104
|
titleCase: (l) => e(l).map(t).join(" ")
|
|
105
105
|
}, Q;
|
|
106
106
|
}
|
|
@@ -108,127 +108,127 @@ var W = Ae(), V = { exports: {} }, fe;
|
|
|
108
108
|
function Ie() {
|
|
109
109
|
if (fe) return V.exports;
|
|
110
110
|
fe = 1, V.exports = function(s) {
|
|
111
|
-
return
|
|
112
|
-
}, V.exports.array =
|
|
113
|
-
function
|
|
114
|
-
var
|
|
115
|
-
for (
|
|
116
|
-
if (!f.has(
|
|
111
|
+
return r(e(s), s);
|
|
112
|
+
}, V.exports.array = r;
|
|
113
|
+
function r(s, a) {
|
|
114
|
+
var i = s.length, u = new Array(i), o = {}, d = i, l = t(a), f = n(s);
|
|
115
|
+
for (a.forEach(function(p) {
|
|
116
|
+
if (!f.has(p[0]) || !f.has(p[1]))
|
|
117
117
|
throw new Error("Unknown node. There is an unknown node in the supplied edges.");
|
|
118
118
|
}); d--; )
|
|
119
119
|
o[d] || h(s[d], d, /* @__PURE__ */ new Set());
|
|
120
120
|
return u;
|
|
121
|
-
function h(
|
|
122
|
-
if (
|
|
123
|
-
var
|
|
121
|
+
function h(p, y, b) {
|
|
122
|
+
if (b.has(p)) {
|
|
123
|
+
var E;
|
|
124
124
|
try {
|
|
125
|
-
|
|
125
|
+
E = ", node was:" + JSON.stringify(p);
|
|
126
126
|
} catch {
|
|
127
|
-
|
|
127
|
+
E = "";
|
|
128
128
|
}
|
|
129
|
-
throw new Error("Cyclic dependency" +
|
|
129
|
+
throw new Error("Cyclic dependency" + E);
|
|
130
130
|
}
|
|
131
|
-
if (!f.has(
|
|
132
|
-
throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: " + JSON.stringify(
|
|
133
|
-
if (!o[
|
|
134
|
-
o[
|
|
135
|
-
var c = l.get(
|
|
136
|
-
if (c = Array.from(c),
|
|
137
|
-
|
|
131
|
+
if (!f.has(p))
|
|
132
|
+
throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: " + JSON.stringify(p));
|
|
133
|
+
if (!o[y]) {
|
|
134
|
+
o[y] = !0;
|
|
135
|
+
var c = l.get(p) || /* @__PURE__ */ new Set();
|
|
136
|
+
if (c = Array.from(c), y = c.length) {
|
|
137
|
+
b.add(p);
|
|
138
138
|
do {
|
|
139
|
-
var
|
|
140
|
-
h(
|
|
141
|
-
} while (
|
|
142
|
-
|
|
139
|
+
var m = c[--y];
|
|
140
|
+
h(m, f.get(m), b);
|
|
141
|
+
} while (y);
|
|
142
|
+
b.delete(p);
|
|
143
143
|
}
|
|
144
|
-
u[--
|
|
144
|
+
u[--i] = p;
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
function e(s) {
|
|
149
|
-
for (var
|
|
150
|
-
var o = s[
|
|
151
|
-
|
|
149
|
+
for (var a = /* @__PURE__ */ new Set(), i = 0, u = s.length; i < u; i++) {
|
|
150
|
+
var o = s[i];
|
|
151
|
+
a.add(o[0]), a.add(o[1]);
|
|
152
152
|
}
|
|
153
|
-
return Array.from(
|
|
153
|
+
return Array.from(a);
|
|
154
154
|
}
|
|
155
155
|
function t(s) {
|
|
156
|
-
for (var
|
|
157
|
-
var o = s[
|
|
158
|
-
|
|
156
|
+
for (var a = /* @__PURE__ */ new Map(), i = 0, u = s.length; i < u; i++) {
|
|
157
|
+
var o = s[i];
|
|
158
|
+
a.has(o[0]) || a.set(o[0], /* @__PURE__ */ new Set()), a.has(o[1]) || a.set(o[1], /* @__PURE__ */ new Set()), a.get(o[0]).add(o[1]);
|
|
159
159
|
}
|
|
160
|
-
return
|
|
160
|
+
return a;
|
|
161
161
|
}
|
|
162
|
-
function
|
|
163
|
-
for (var
|
|
164
|
-
|
|
165
|
-
return
|
|
162
|
+
function n(s) {
|
|
163
|
+
for (var a = /* @__PURE__ */ new Map(), i = 0, u = s.length; i < u; i++)
|
|
164
|
+
a.set(s[i], i);
|
|
165
|
+
return a;
|
|
166
166
|
}
|
|
167
167
|
return V.exports;
|
|
168
168
|
}
|
|
169
|
-
var
|
|
170
|
-
const
|
|
171
|
-
function
|
|
172
|
-
return
|
|
169
|
+
var Ue = Ie();
|
|
170
|
+
const je = /* @__PURE__ */ Ce(Ue), Ne = Object.prototype.toString, Le = Error.prototype.toString, Me = RegExp.prototype.toString, Pe = typeof Symbol < "u" ? Symbol.prototype.toString : () => "", Re = /^Symbol\((.*)\)(.*)$/;
|
|
171
|
+
function ze(r) {
|
|
172
|
+
return r != +r ? "NaN" : r === 0 && 1 / r < 0 ? "-0" : "" + r;
|
|
173
173
|
}
|
|
174
|
-
function de(
|
|
175
|
-
if (
|
|
176
|
-
const t = typeof
|
|
177
|
-
if (t === "number") return
|
|
178
|
-
if (t === "string") return e ? `"${
|
|
179
|
-
if (t === "function") return "[Function " + (
|
|
180
|
-
if (t === "symbol") return
|
|
181
|
-
const
|
|
182
|
-
return
|
|
174
|
+
function de(r, e = !1) {
|
|
175
|
+
if (r == null || r === !0 || r === !1) return "" + r;
|
|
176
|
+
const t = typeof r;
|
|
177
|
+
if (t === "number") return ze(r);
|
|
178
|
+
if (t === "string") return e ? `"${r}"` : r;
|
|
179
|
+
if (t === "function") return "[Function " + (r.name || "anonymous") + "]";
|
|
180
|
+
if (t === "symbol") return Pe.call(r).replace(Re, "Symbol($1)");
|
|
181
|
+
const n = Ne.call(r).slice(8, -1);
|
|
182
|
+
return n === "Date" ? isNaN(r.getTime()) ? "" + r : r.toISOString(r) : n === "Error" || r instanceof Error ? "[" + Le.call(r) + "]" : n === "RegExp" ? Me.call(r) : null;
|
|
183
183
|
}
|
|
184
|
-
function I(
|
|
185
|
-
let t = de(
|
|
186
|
-
return t !== null ? t : JSON.stringify(
|
|
187
|
-
let
|
|
188
|
-
return
|
|
184
|
+
function I(r, e) {
|
|
185
|
+
let t = de(r, e);
|
|
186
|
+
return t !== null ? t : JSON.stringify(r, function(n, s) {
|
|
187
|
+
let a = de(this[n], e);
|
|
188
|
+
return a !== null ? a : s;
|
|
189
189
|
}, 2);
|
|
190
190
|
}
|
|
191
|
-
function be(
|
|
192
|
-
return
|
|
191
|
+
function be(r) {
|
|
192
|
+
return r == null ? [] : [].concat(r);
|
|
193
193
|
}
|
|
194
194
|
let xe, ge, Ee, qe = /\$\{\s*(\w+)\s*\}/g;
|
|
195
195
|
xe = Symbol.toStringTag;
|
|
196
196
|
class he {
|
|
197
|
-
constructor(e, t,
|
|
198
|
-
this.name = void 0, this.message = void 0, this.value = void 0, this.path = void 0, this.type = void 0, this.params = void 0, this.errors = void 0, this.inner = void 0, this[xe] = "Error", this.name = "ValidationError", this.value = t, this.path =
|
|
199
|
-
if (
|
|
200
|
-
this.errors.push(...
|
|
201
|
-
const
|
|
202
|
-
this.inner.push(...
|
|
197
|
+
constructor(e, t, n, s) {
|
|
198
|
+
this.name = void 0, this.message = void 0, this.value = void 0, this.path = void 0, this.type = void 0, this.params = void 0, this.errors = void 0, this.inner = void 0, this[xe] = "Error", this.name = "ValidationError", this.value = t, this.path = n, this.type = s, this.errors = [], this.inner = [], be(e).forEach((a) => {
|
|
199
|
+
if (S.isError(a)) {
|
|
200
|
+
this.errors.push(...a.errors);
|
|
201
|
+
const i = a.inner.length ? a.inner : [a];
|
|
202
|
+
this.inner.push(...i);
|
|
203
203
|
} else
|
|
204
|
-
this.errors.push(
|
|
204
|
+
this.errors.push(a);
|
|
205
205
|
}), this.message = this.errors.length > 1 ? `${this.errors.length} errors occurred` : this.errors[0];
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
ge = Symbol.hasInstance;
|
|
209
209
|
Ee = Symbol.toStringTag;
|
|
210
|
-
class
|
|
210
|
+
class S extends Error {
|
|
211
211
|
static formatError(e, t) {
|
|
212
|
-
const
|
|
212
|
+
const n = t.label || t.path || "this";
|
|
213
213
|
return t = Object.assign({}, t, {
|
|
214
|
-
path:
|
|
214
|
+
path: n,
|
|
215
215
|
originalPath: t.path
|
|
216
|
-
}), typeof e == "string" ? e.replace(qe, (s,
|
|
216
|
+
}), typeof e == "string" ? e.replace(qe, (s, a) => I(t[a])) : typeof e == "function" ? e(t) : e;
|
|
217
217
|
}
|
|
218
218
|
static isError(e) {
|
|
219
219
|
return e && e.name === "ValidationError";
|
|
220
220
|
}
|
|
221
|
-
constructor(e, t,
|
|
222
|
-
const
|
|
223
|
-
if (
|
|
224
|
-
return
|
|
225
|
-
super(), this.value = void 0, this.path = void 0, this.type = void 0, this.params = void 0, this.errors = [], this.inner = [], this[Ee] = "Error", this.name =
|
|
221
|
+
constructor(e, t, n, s, a) {
|
|
222
|
+
const i = new he(e, t, n, s);
|
|
223
|
+
if (a)
|
|
224
|
+
return i;
|
|
225
|
+
super(), this.value = void 0, this.path = void 0, this.type = void 0, this.params = void 0, this.errors = [], this.inner = [], this[Ee] = "Error", this.name = i.name, this.message = i.message, this.type = i.type, this.value = i.value, this.path = i.path, this.errors = i.errors, this.inner = i.inner, Error.captureStackTrace && Error.captureStackTrace(this, S);
|
|
226
226
|
}
|
|
227
227
|
static [ge](e) {
|
|
228
228
|
return he[Symbol.hasInstance](e) || super[Symbol.hasInstance](e);
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
|
-
let
|
|
231
|
+
let F = {
|
|
232
232
|
default: "${path} is invalid",
|
|
233
233
|
required: "${path} is a required field",
|
|
234
234
|
defined: "${path} must be defined",
|
|
@@ -236,15 +236,15 @@ let $ = {
|
|
|
236
236
|
oneOf: "${path} must be one of the following values: ${values}",
|
|
237
237
|
notOneOf: "${path} must not be one of the following values: ${values}",
|
|
238
238
|
notType: ({
|
|
239
|
-
path:
|
|
239
|
+
path: r,
|
|
240
240
|
type: e,
|
|
241
241
|
value: t,
|
|
242
|
-
originalValue:
|
|
242
|
+
originalValue: n
|
|
243
243
|
}) => {
|
|
244
|
-
const s =
|
|
245
|
-
return e !== "mixed" ? `${
|
|
244
|
+
const s = n != null && n !== t ? ` (cast from the value \`${I(n, !0)}\`).` : ".";
|
|
245
|
+
return e !== "mixed" ? `${r} must be a \`${e}\` type, but the final value was: \`${I(t, !0)}\`` + s : `${r} must match the configured type. The validated value was: \`${I(t, !0)}\`` + s;
|
|
246
246
|
}
|
|
247
|
-
},
|
|
247
|
+
}, v = {
|
|
248
248
|
length: "${path} must be exactly ${length} characters",
|
|
249
249
|
min: "${path} must be at least ${min} characters",
|
|
250
250
|
max: "${path} must be at most ${max} characters",
|
|
@@ -279,22 +279,22 @@ let $ = {
|
|
|
279
279
|
max: "${path} field must have less than or equal to ${max} items",
|
|
280
280
|
length: "${path} must have ${length} items"
|
|
281
281
|
}, Ye = {
|
|
282
|
-
notType: (
|
|
282
|
+
notType: (r) => {
|
|
283
283
|
const {
|
|
284
284
|
path: e,
|
|
285
285
|
value: t,
|
|
286
|
-
spec:
|
|
287
|
-
} =
|
|
286
|
+
spec: n
|
|
287
|
+
} = r, s = n.types.length;
|
|
288
288
|
if (Array.isArray(t)) {
|
|
289
289
|
if (t.length < s) return `${e} tuple value has too few items, expected a length of ${s} but got ${t.length} for value: \`${I(t, !0)}\``;
|
|
290
290
|
if (t.length > s) return `${e} tuple value has too many items, expected a length of ${s} but got ${t.length} for value: \`${I(t, !0)}\``;
|
|
291
291
|
}
|
|
292
|
-
return
|
|
292
|
+
return S.formatError(F.notType, r);
|
|
293
293
|
}
|
|
294
294
|
};
|
|
295
295
|
Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
296
|
-
mixed:
|
|
297
|
-
string:
|
|
296
|
+
mixed: F,
|
|
297
|
+
string: v,
|
|
298
298
|
number: Ve,
|
|
299
299
|
date: te,
|
|
300
300
|
object: B,
|
|
@@ -302,18 +302,18 @@ Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
|
302
302
|
boolean: Ze,
|
|
303
303
|
tuple: Ye
|
|
304
304
|
});
|
|
305
|
-
const
|
|
306
|
-
class
|
|
305
|
+
const re = (r) => r && r.__isYupSchema__;
|
|
306
|
+
class G {
|
|
307
307
|
static fromOptions(e, t) {
|
|
308
308
|
if (!t.then && !t.otherwise) throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");
|
|
309
309
|
let {
|
|
310
|
-
is:
|
|
310
|
+
is: n,
|
|
311
311
|
then: s,
|
|
312
|
-
otherwise:
|
|
313
|
-
} = t,
|
|
314
|
-
return new
|
|
312
|
+
otherwise: a
|
|
313
|
+
} = t, i = typeof n == "function" ? n : (...u) => u.every((o) => o === n);
|
|
314
|
+
return new G(e, (u, o) => {
|
|
315
315
|
var d;
|
|
316
|
-
let l =
|
|
316
|
+
let l = i(...u) ? s : a;
|
|
317
317
|
return (d = l == null ? void 0 : l(o)) != null ? d : o;
|
|
318
318
|
});
|
|
319
319
|
}
|
|
@@ -321,14 +321,14 @@ class H {
|
|
|
321
321
|
this.fn = void 0, this.refs = e, this.refs = e, this.fn = t;
|
|
322
322
|
}
|
|
323
323
|
resolve(e, t) {
|
|
324
|
-
let
|
|
324
|
+
let n = this.refs.map((a) => (
|
|
325
325
|
// TODO: ? operator here?
|
|
326
|
-
|
|
327
|
-
)), s = this.fn(
|
|
326
|
+
a.getValue(t == null ? void 0 : t.value, t == null ? void 0 : t.parent, t == null ? void 0 : t.context)
|
|
327
|
+
)), s = this.fn(n, e, t);
|
|
328
328
|
if (s === void 0 || // @ts-ignore this can be base
|
|
329
329
|
s === e)
|
|
330
330
|
return e;
|
|
331
|
-
if (!
|
|
331
|
+
if (!re(s)) throw new TypeError("conditions must return a schema object");
|
|
332
332
|
return s.resolve(t);
|
|
333
333
|
}
|
|
334
334
|
}
|
|
@@ -336,16 +336,16 @@ const Z = {
|
|
|
336
336
|
context: "$",
|
|
337
337
|
value: "."
|
|
338
338
|
};
|
|
339
|
-
class
|
|
339
|
+
class L {
|
|
340
340
|
constructor(e, t = {}) {
|
|
341
341
|
if (this.key = void 0, this.isContext = void 0, this.isValue = void 0, this.isSibling = void 0, this.path = void 0, this.getter = void 0, this.map = void 0, typeof e != "string") throw new TypeError("ref must be a string, got: " + e);
|
|
342
342
|
if (this.key = e.trim(), e === "") throw new TypeError("ref must be a non-empty string");
|
|
343
343
|
this.isContext = this.key[0] === Z.context, this.isValue = this.key[0] === Z.value, this.isSibling = !this.isContext && !this.isValue;
|
|
344
|
-
let
|
|
345
|
-
this.path = this.key.slice(
|
|
344
|
+
let n = this.isContext ? Z.context : this.isValue ? Z.value : "";
|
|
345
|
+
this.path = this.key.slice(n.length), this.getter = this.path && N.getter(this.path, !0), this.map = t.map;
|
|
346
346
|
}
|
|
347
|
-
getValue(e, t,
|
|
348
|
-
let s = this.isContext ?
|
|
347
|
+
getValue(e, t, n) {
|
|
348
|
+
let s = this.isContext ? n : this.isValue ? e : t;
|
|
349
349
|
return this.getter && (s = this.getter(s || {})), this.map && (s = this.map(s)), s;
|
|
350
350
|
}
|
|
351
351
|
/**
|
|
@@ -374,160 +374,160 @@ class P {
|
|
|
374
374
|
return e && e.__isYupRef;
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
|
-
|
|
378
|
-
const
|
|
379
|
-
function M(
|
|
377
|
+
L.prototype.__isYupRef = !0;
|
|
378
|
+
const j = (r) => r == null;
|
|
379
|
+
function M(r) {
|
|
380
380
|
function e({
|
|
381
381
|
value: t,
|
|
382
|
-
path:
|
|
382
|
+
path: n = "",
|
|
383
383
|
options: s,
|
|
384
|
-
originalValue:
|
|
385
|
-
schema:
|
|
384
|
+
originalValue: a,
|
|
385
|
+
schema: i
|
|
386
386
|
}, u, o) {
|
|
387
387
|
const {
|
|
388
388
|
name: d,
|
|
389
389
|
test: l,
|
|
390
390
|
params: f,
|
|
391
391
|
message: h,
|
|
392
|
-
skipAbsent:
|
|
393
|
-
} =
|
|
392
|
+
skipAbsent: p
|
|
393
|
+
} = r;
|
|
394
394
|
let {
|
|
395
|
-
parent:
|
|
396
|
-
context:
|
|
397
|
-
abortEarly:
|
|
398
|
-
disableStackTrace: c =
|
|
395
|
+
parent: y,
|
|
396
|
+
context: b,
|
|
397
|
+
abortEarly: E = i.spec.abortEarly,
|
|
398
|
+
disableStackTrace: c = i.spec.disableStackTrace
|
|
399
399
|
} = s;
|
|
400
|
-
function
|
|
401
|
-
return
|
|
400
|
+
function m(g) {
|
|
401
|
+
return L.isRef(g) ? g.getValue(t, y, b) : g;
|
|
402
402
|
}
|
|
403
|
-
function w(
|
|
404
|
-
const
|
|
403
|
+
function w(g = {}) {
|
|
404
|
+
const U = Object.assign({
|
|
405
405
|
value: t,
|
|
406
|
-
originalValue:
|
|
407
|
-
label:
|
|
408
|
-
path:
|
|
409
|
-
spec:
|
|
410
|
-
disableStackTrace:
|
|
411
|
-
}, f,
|
|
412
|
-
for (const ue of Object.keys(
|
|
413
|
-
const ae = new
|
|
414
|
-
return ae.params =
|
|
406
|
+
originalValue: a,
|
|
407
|
+
label: i.spec.label,
|
|
408
|
+
path: g.path || n,
|
|
409
|
+
spec: i.spec,
|
|
410
|
+
disableStackTrace: g.disableStackTrace || c
|
|
411
|
+
}, f, g.params);
|
|
412
|
+
for (const ue of Object.keys(U)) U[ue] = m(U[ue]);
|
|
413
|
+
const ae = new S(S.formatError(g.message || h, U), t, U.path, g.type || d, U.disableStackTrace);
|
|
414
|
+
return ae.params = U, ae;
|
|
415
415
|
}
|
|
416
|
-
const O =
|
|
417
|
-
let
|
|
418
|
-
path:
|
|
419
|
-
parent:
|
|
416
|
+
const O = E ? u : o;
|
|
417
|
+
let x = {
|
|
418
|
+
path: n,
|
|
419
|
+
parent: y,
|
|
420
420
|
type: d,
|
|
421
421
|
from: s.from,
|
|
422
422
|
createError: w,
|
|
423
|
-
resolve:
|
|
423
|
+
resolve: m,
|
|
424
424
|
options: s,
|
|
425
|
-
originalValue:
|
|
426
|
-
schema:
|
|
425
|
+
originalValue: a,
|
|
426
|
+
schema: i
|
|
427
427
|
};
|
|
428
|
-
const
|
|
429
|
-
|
|
430
|
-
}, T = (
|
|
431
|
-
|
|
428
|
+
const _ = (g) => {
|
|
429
|
+
S.isError(g) ? O(g) : g ? o(null) : O(w());
|
|
430
|
+
}, T = (g) => {
|
|
431
|
+
S.isError(g) ? O(g) : u(g);
|
|
432
432
|
};
|
|
433
|
-
if (
|
|
434
|
-
return
|
|
433
|
+
if (p && j(t))
|
|
434
|
+
return _(!0);
|
|
435
435
|
let D;
|
|
436
436
|
try {
|
|
437
437
|
var ie;
|
|
438
|
-
if (D = l.call(
|
|
438
|
+
if (D = l.call(x, t, x), typeof ((ie = D) == null ? void 0 : ie.then) == "function") {
|
|
439
439
|
if (s.sync)
|
|
440
|
-
throw new Error(`Validation test of type: "${
|
|
441
|
-
return Promise.resolve(D).then(
|
|
440
|
+
throw new Error(`Validation test of type: "${x.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);
|
|
441
|
+
return Promise.resolve(D).then(_, T);
|
|
442
442
|
}
|
|
443
|
-
} catch (
|
|
444
|
-
T(
|
|
443
|
+
} catch (g) {
|
|
444
|
+
T(g);
|
|
445
445
|
return;
|
|
446
446
|
}
|
|
447
|
-
|
|
447
|
+
_(D);
|
|
448
448
|
}
|
|
449
|
-
return e.OPTIONS =
|
|
449
|
+
return e.OPTIONS = r, e;
|
|
450
450
|
}
|
|
451
|
-
function
|
|
452
|
-
let s,
|
|
453
|
-
return e ? (
|
|
451
|
+
function Xe(r, e, t, n = t) {
|
|
452
|
+
let s, a, i;
|
|
453
|
+
return e ? (N.forEach(e, (u, o, d) => {
|
|
454
454
|
let l = o ? u.slice(1, u.length - 1) : u;
|
|
455
|
-
|
|
456
|
-
context:
|
|
455
|
+
r = r.resolve({
|
|
456
|
+
context: n,
|
|
457
457
|
parent: s,
|
|
458
458
|
value: t
|
|
459
459
|
});
|
|
460
|
-
let f =
|
|
461
|
-
if (
|
|
462
|
-
if (f && !d) throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${
|
|
460
|
+
let f = r.type === "tuple", h = d ? parseInt(l, 10) : 0;
|
|
461
|
+
if (r.innerType || f) {
|
|
462
|
+
if (f && !d) throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${i}" must contain an index to the tuple element, e.g. "${i}[0]"`);
|
|
463
463
|
if (t && h >= t.length)
|
|
464
464
|
throw new Error(`Yup.reach cannot resolve an array item at index: ${u}, in the path: ${e}. because there is no value at that index. `);
|
|
465
|
-
s = t, t = t && t[h],
|
|
465
|
+
s = t, t = t && t[h], r = f ? r.spec.types[h] : r.innerType;
|
|
466
466
|
}
|
|
467
467
|
if (!d) {
|
|
468
|
-
if (!
|
|
469
|
-
s = t, t = t && t[l],
|
|
468
|
+
if (!r.fields || !r.fields[l]) throw new Error(`The schema does not contain the path: ${e}. (failed at: ${i} which is a type: "${r.type}")`);
|
|
469
|
+
s = t, t = t && t[l], r = r.fields[l];
|
|
470
470
|
}
|
|
471
|
-
|
|
471
|
+
a = l, i = o ? "[" + u + "]" : "." + u;
|
|
472
472
|
}), {
|
|
473
|
-
schema:
|
|
473
|
+
schema: r,
|
|
474
474
|
parent: s,
|
|
475
|
-
parentPath:
|
|
475
|
+
parentPath: a
|
|
476
476
|
}) : {
|
|
477
477
|
parent: s,
|
|
478
478
|
parentPath: e,
|
|
479
|
-
schema:
|
|
479
|
+
schema: r
|
|
480
480
|
};
|
|
481
481
|
}
|
|
482
|
-
class
|
|
482
|
+
class H extends Set {
|
|
483
483
|
describe() {
|
|
484
484
|
const e = [];
|
|
485
485
|
for (const t of this.values())
|
|
486
|
-
e.push(
|
|
486
|
+
e.push(L.isRef(t) ? t.describe() : t);
|
|
487
487
|
return e;
|
|
488
488
|
}
|
|
489
489
|
resolveAll(e) {
|
|
490
490
|
let t = [];
|
|
491
|
-
for (const
|
|
492
|
-
t.push(e(
|
|
491
|
+
for (const n of this.values())
|
|
492
|
+
t.push(e(n));
|
|
493
493
|
return t;
|
|
494
494
|
}
|
|
495
495
|
clone() {
|
|
496
|
-
return new
|
|
496
|
+
return new H(this.values());
|
|
497
497
|
}
|
|
498
498
|
merge(e, t) {
|
|
499
|
-
const
|
|
500
|
-
return e.forEach((s) =>
|
|
499
|
+
const n = this.clone();
|
|
500
|
+
return e.forEach((s) => n.add(s)), t.forEach((s) => n.delete(s)), n;
|
|
501
501
|
}
|
|
502
502
|
}
|
|
503
|
-
function
|
|
504
|
-
if (
|
|
505
|
-
if (e.has(
|
|
503
|
+
function P(r, e = /* @__PURE__ */ new Map()) {
|
|
504
|
+
if (re(r) || !r || typeof r != "object") return r;
|
|
505
|
+
if (e.has(r)) return e.get(r);
|
|
506
506
|
let t;
|
|
507
|
-
if (
|
|
508
|
-
t = new Date(
|
|
509
|
-
else if (
|
|
510
|
-
t = new RegExp(
|
|
511
|
-
else if (Array.isArray(
|
|
512
|
-
t = new Array(
|
|
513
|
-
for (let
|
|
514
|
-
} else if (
|
|
515
|
-
t = /* @__PURE__ */ new Map(), e.set(
|
|
516
|
-
for (const [
|
|
517
|
-
} else if (
|
|
518
|
-
t = /* @__PURE__ */ new Set(), e.set(
|
|
519
|
-
for (const
|
|
520
|
-
} else if (
|
|
521
|
-
t = {}, e.set(
|
|
522
|
-
for (const [
|
|
507
|
+
if (r instanceof Date)
|
|
508
|
+
t = new Date(r.getTime()), e.set(r, t);
|
|
509
|
+
else if (r instanceof RegExp)
|
|
510
|
+
t = new RegExp(r), e.set(r, t);
|
|
511
|
+
else if (Array.isArray(r)) {
|
|
512
|
+
t = new Array(r.length), e.set(r, t);
|
|
513
|
+
for (let n = 0; n < r.length; n++) t[n] = P(r[n], e);
|
|
514
|
+
} else if (r instanceof Map) {
|
|
515
|
+
t = /* @__PURE__ */ new Map(), e.set(r, t);
|
|
516
|
+
for (const [n, s] of r.entries()) t.set(n, P(s, e));
|
|
517
|
+
} else if (r instanceof Set) {
|
|
518
|
+
t = /* @__PURE__ */ new Set(), e.set(r, t);
|
|
519
|
+
for (const n of r) t.add(P(n, e));
|
|
520
|
+
} else if (r instanceof Object) {
|
|
521
|
+
t = {}, e.set(r, t);
|
|
522
|
+
for (const [n, s] of Object.entries(r)) t[n] = P(s, e);
|
|
523
523
|
} else
|
|
524
|
-
throw Error(`Unable to clone ${
|
|
524
|
+
throw Error(`Unable to clone ${r}`);
|
|
525
525
|
return t;
|
|
526
526
|
}
|
|
527
|
-
class
|
|
527
|
+
class $ {
|
|
528
528
|
constructor(e) {
|
|
529
|
-
this.type = void 0, this.deps = [], this.tests = void 0, this.transforms = void 0, this.conditions = [], this._mutate = void 0, this.internalTests = {}, this._whitelist = new
|
|
530
|
-
this.typeError(
|
|
529
|
+
this.type = void 0, this.deps = [], this.tests = void 0, this.transforms = void 0, this.conditions = [], this._mutate = void 0, this.internalTests = {}, this._whitelist = new H(), this._blacklist = new H(), this.exclusiveTests = /* @__PURE__ */ Object.create(null), this._typeCheck = void 0, this.spec = void 0, this.tests = [], this.transforms = [], this.withMutation(() => {
|
|
530
|
+
this.typeError(F.notType);
|
|
531
531
|
}), this.type = e.type, this._typeCheck = e.check, this.spec = Object.assign({
|
|
532
532
|
strip: !1,
|
|
533
533
|
strict: !1,
|
|
@@ -549,7 +549,7 @@ class S {
|
|
|
549
549
|
if (this._mutate)
|
|
550
550
|
return e && Object.assign(this.spec, e), this;
|
|
551
551
|
const t = Object.create(Object.getPrototypeOf(this));
|
|
552
|
-
return t.type = this.type, t._typeCheck = this._typeCheck, t._whitelist = this._whitelist.clone(), t._blacklist = this._blacklist.clone(), t.internalTests = Object.assign({}, this.internalTests), t.exclusiveTests = Object.assign({}, this.exclusiveTests), t.deps = [...this.deps], t.conditions = [...this.conditions], t.tests = [...this.tests], t.transforms = [...this.transforms], t.spec =
|
|
552
|
+
return t.type = this.type, t._typeCheck = this._typeCheck, t._whitelist = this._whitelist.clone(), t._blacklist = this._blacklist.clone(), t.internalTests = Object.assign({}, this.internalTests), t.exclusiveTests = Object.assign({}, this.exclusiveTests), t.deps = [...this.deps], t.conditions = [...this.conditions], t.tests = [...this.tests], t.transforms = [...this.transforms], t.spec = P(Object.assign({}, this.spec, e)), t;
|
|
553
553
|
}
|
|
554
554
|
label(e) {
|
|
555
555
|
let t = this.clone();
|
|
@@ -563,19 +563,19 @@ class S {
|
|
|
563
563
|
withMutation(e) {
|
|
564
564
|
let t = this._mutate;
|
|
565
565
|
this._mutate = !0;
|
|
566
|
-
let
|
|
567
|
-
return this._mutate = t,
|
|
566
|
+
let n = e(this);
|
|
567
|
+
return this._mutate = t, n;
|
|
568
568
|
}
|
|
569
569
|
concat(e) {
|
|
570
570
|
if (!e || e === this) return this;
|
|
571
571
|
if (e.type !== this.type && this.type !== "mixed") throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);
|
|
572
|
-
let t = this,
|
|
573
|
-
const s = Object.assign({}, t.spec,
|
|
574
|
-
return
|
|
575
|
-
e.tests.forEach((
|
|
576
|
-
|
|
572
|
+
let t = this, n = e.clone();
|
|
573
|
+
const s = Object.assign({}, t.spec, n.spec);
|
|
574
|
+
return n.spec = s, n.internalTests = Object.assign({}, t.internalTests, n.internalTests), n._whitelist = t._whitelist.merge(e._whitelist, e._blacklist), n._blacklist = t._blacklist.merge(e._blacklist, e._whitelist), n.tests = t.tests, n.exclusiveTests = t.exclusiveTests, n.withMutation((a) => {
|
|
575
|
+
e.tests.forEach((i) => {
|
|
576
|
+
a.test(i.OPTIONS);
|
|
577
577
|
});
|
|
578
|
-
}),
|
|
578
|
+
}), n.transforms = [...t.transforms, ...n.transforms], n;
|
|
579
579
|
}
|
|
580
580
|
isType(e) {
|
|
581
581
|
return e == null ? !!(this.spec.nullable && e === null || this.spec.optional && e === void 0) : this._typeCheck(e);
|
|
@@ -583,47 +583,47 @@ class S {
|
|
|
583
583
|
resolve(e) {
|
|
584
584
|
let t = this;
|
|
585
585
|
if (t.conditions.length) {
|
|
586
|
-
let
|
|
587
|
-
t = t.clone(), t.conditions = [], t =
|
|
586
|
+
let n = t.conditions;
|
|
587
|
+
t = t.clone(), t.conditions = [], t = n.reduce((s, a) => a.resolve(s, e), t), t = t.resolve(e);
|
|
588
588
|
}
|
|
589
589
|
return t;
|
|
590
590
|
}
|
|
591
591
|
resolveOptions(e) {
|
|
592
|
-
var t,
|
|
592
|
+
var t, n, s, a;
|
|
593
593
|
return Object.assign({}, e, {
|
|
594
594
|
from: e.from || [],
|
|
595
595
|
strict: (t = e.strict) != null ? t : this.spec.strict,
|
|
596
|
-
abortEarly: (
|
|
596
|
+
abortEarly: (n = e.abortEarly) != null ? n : this.spec.abortEarly,
|
|
597
597
|
recursive: (s = e.recursive) != null ? s : this.spec.recursive,
|
|
598
|
-
disableStackTrace: (
|
|
598
|
+
disableStackTrace: (a = e.disableStackTrace) != null ? a : this.spec.disableStackTrace
|
|
599
599
|
});
|
|
600
600
|
}
|
|
601
601
|
/**
|
|
602
602
|
* Run the configured transform pipeline over an input value.
|
|
603
603
|
*/
|
|
604
604
|
cast(e, t = {}) {
|
|
605
|
-
let
|
|
605
|
+
let n = this.resolve(Object.assign({
|
|
606
606
|
value: e
|
|
607
|
-
}, t)), s = t.assert === "ignore-optionality",
|
|
608
|
-
if (t.assert !== !1 && !
|
|
609
|
-
if (s &&
|
|
610
|
-
return
|
|
611
|
-
let
|
|
612
|
-
throw new TypeError(`The value of ${t.path || "field"} could not be cast to a value that satisfies the schema type: "${
|
|
607
|
+
}, t)), s = t.assert === "ignore-optionality", a = n._cast(e, t);
|
|
608
|
+
if (t.assert !== !1 && !n.isType(a)) {
|
|
609
|
+
if (s && j(a))
|
|
610
|
+
return a;
|
|
611
|
+
let i = I(e), u = I(a);
|
|
612
|
+
throw new TypeError(`The value of ${t.path || "field"} could not be cast to a value that satisfies the schema type: "${n.type}".
|
|
613
613
|
|
|
614
|
-
attempted value: ${
|
|
615
|
-
` + (u !==
|
|
614
|
+
attempted value: ${i}
|
|
615
|
+
` + (u !== i ? `result of cast: ${u}` : ""));
|
|
616
616
|
}
|
|
617
|
-
return
|
|
617
|
+
return a;
|
|
618
618
|
}
|
|
619
619
|
_cast(e, t) {
|
|
620
|
-
let
|
|
621
|
-
return
|
|
620
|
+
let n = e === void 0 ? e : this.transforms.reduce((s, a) => a.call(this, s, e, this), e);
|
|
621
|
+
return n === void 0 && (n = this.getDefault(t)), n;
|
|
622
622
|
}
|
|
623
|
-
_validate(e, t = {},
|
|
623
|
+
_validate(e, t = {}, n, s) {
|
|
624
624
|
let {
|
|
625
|
-
path:
|
|
626
|
-
originalValue:
|
|
625
|
+
path: a,
|
|
626
|
+
originalValue: i = e,
|
|
627
627
|
strict: u = this.spec.strict
|
|
628
628
|
} = t, o = e;
|
|
629
629
|
u || (o = this._cast(o, Object.assign({
|
|
@@ -633,75 +633,75 @@ attempted value: ${a}
|
|
|
633
633
|
for (let l of Object.values(this.internalTests))
|
|
634
634
|
l && d.push(l);
|
|
635
635
|
this.runTests({
|
|
636
|
-
path:
|
|
636
|
+
path: a,
|
|
637
637
|
value: o,
|
|
638
|
-
originalValue:
|
|
638
|
+
originalValue: i,
|
|
639
639
|
options: t,
|
|
640
640
|
tests: d
|
|
641
|
-
},
|
|
641
|
+
}, n, (l) => {
|
|
642
642
|
if (l.length)
|
|
643
643
|
return s(l, o);
|
|
644
644
|
this.runTests({
|
|
645
|
-
path:
|
|
645
|
+
path: a,
|
|
646
646
|
value: o,
|
|
647
|
-
originalValue:
|
|
647
|
+
originalValue: i,
|
|
648
648
|
options: t,
|
|
649
649
|
tests: this.tests
|
|
650
|
-
},
|
|
650
|
+
}, n, s);
|
|
651
651
|
});
|
|
652
652
|
}
|
|
653
653
|
/**
|
|
654
654
|
* Executes a set of validations, either schema, produced Tests or a nested
|
|
655
655
|
* schema validate result.
|
|
656
656
|
*/
|
|
657
|
-
runTests(e, t,
|
|
657
|
+
runTests(e, t, n) {
|
|
658
658
|
let s = !1, {
|
|
659
|
-
tests:
|
|
660
|
-
value:
|
|
659
|
+
tests: a,
|
|
660
|
+
value: i,
|
|
661
661
|
originalValue: u,
|
|
662
662
|
path: o,
|
|
663
663
|
options: d
|
|
664
|
-
} = e, l = (
|
|
665
|
-
s || (s = !0, t(
|
|
666
|
-
}, f = (
|
|
667
|
-
s || (s = !0,
|
|
668
|
-
}, h =
|
|
664
|
+
} = e, l = (b) => {
|
|
665
|
+
s || (s = !0, t(b, i));
|
|
666
|
+
}, f = (b) => {
|
|
667
|
+
s || (s = !0, n(b, i));
|
|
668
|
+
}, h = a.length, p = [];
|
|
669
669
|
if (!h) return f([]);
|
|
670
|
-
let
|
|
671
|
-
value:
|
|
670
|
+
let y = {
|
|
671
|
+
value: i,
|
|
672
672
|
originalValue: u,
|
|
673
673
|
path: o,
|
|
674
674
|
options: d,
|
|
675
675
|
schema: this
|
|
676
676
|
};
|
|
677
|
-
for (let
|
|
678
|
-
const
|
|
679
|
-
|
|
680
|
-
|
|
677
|
+
for (let b = 0; b < a.length; b++) {
|
|
678
|
+
const E = a[b];
|
|
679
|
+
E(y, l, function(m) {
|
|
680
|
+
m && (Array.isArray(m) ? p.push(...m) : p.push(m)), --h <= 0 && f(p);
|
|
681
681
|
});
|
|
682
682
|
}
|
|
683
683
|
}
|
|
684
684
|
asNestedTest({
|
|
685
685
|
key: e,
|
|
686
686
|
index: t,
|
|
687
|
-
parent:
|
|
687
|
+
parent: n,
|
|
688
688
|
parentPath: s,
|
|
689
|
-
originalParent:
|
|
690
|
-
options:
|
|
689
|
+
originalParent: a,
|
|
690
|
+
options: i
|
|
691
691
|
}) {
|
|
692
692
|
const u = e ?? t;
|
|
693
693
|
if (u == null)
|
|
694
694
|
throw TypeError("Must include `key` or `index` for nested validations");
|
|
695
695
|
const o = typeof u == "number";
|
|
696
|
-
let d =
|
|
697
|
-
const l = Object.assign({},
|
|
696
|
+
let d = n[u];
|
|
697
|
+
const l = Object.assign({}, i, {
|
|
698
698
|
// Nested validations fields are always strict:
|
|
699
699
|
// 1. parent isn't strict so the casting will also have cast inner values
|
|
700
700
|
// 2. parent is strict in which case the nested values weren't cast either
|
|
701
701
|
strict: !0,
|
|
702
|
-
parent:
|
|
702
|
+
parent: n,
|
|
703
703
|
value: d,
|
|
704
|
-
originalValue:
|
|
704
|
+
originalValue: a[u],
|
|
705
705
|
// FIXME: tests depend on `index` being passed around deeply,
|
|
706
706
|
// we should not let the options.key/index bleed through
|
|
707
707
|
key: void 0,
|
|
@@ -709,50 +709,50 @@ attempted value: ${a}
|
|
|
709
709
|
[o ? "index" : "key"]: u,
|
|
710
710
|
path: o || u.includes(".") ? `${s || ""}[${o ? u : `"${u}"`}]` : (s ? `${s}.` : "") + e
|
|
711
711
|
});
|
|
712
|
-
return (f, h,
|
|
712
|
+
return (f, h, p) => this.resolve(l)._validate(d, l, h, p);
|
|
713
713
|
}
|
|
714
714
|
validate(e, t) {
|
|
715
|
-
var
|
|
715
|
+
var n;
|
|
716
716
|
let s = this.resolve(Object.assign({}, t, {
|
|
717
717
|
value: e
|
|
718
|
-
})),
|
|
719
|
-
return new Promise((
|
|
720
|
-
|
|
718
|
+
})), a = (n = t == null ? void 0 : t.disableStackTrace) != null ? n : s.spec.disableStackTrace;
|
|
719
|
+
return new Promise((i, u) => s._validate(e, t, (o, d) => {
|
|
720
|
+
S.isError(o) && (o.value = d), u(o);
|
|
721
721
|
}, (o, d) => {
|
|
722
|
-
o.length ? u(new
|
|
722
|
+
o.length ? u(new S(o, d, void 0, void 0, a)) : i(d);
|
|
723
723
|
}));
|
|
724
724
|
}
|
|
725
725
|
validateSync(e, t) {
|
|
726
|
-
var
|
|
726
|
+
var n;
|
|
727
727
|
let s = this.resolve(Object.assign({}, t, {
|
|
728
728
|
value: e
|
|
729
|
-
})),
|
|
729
|
+
})), a, i = (n = t == null ? void 0 : t.disableStackTrace) != null ? n : s.spec.disableStackTrace;
|
|
730
730
|
return s._validate(e, Object.assign({}, t, {
|
|
731
731
|
sync: !0
|
|
732
732
|
}), (u, o) => {
|
|
733
|
-
throw
|
|
733
|
+
throw S.isError(u) && (u.value = o), u;
|
|
734
734
|
}, (u, o) => {
|
|
735
|
-
if (u.length) throw new
|
|
736
|
-
|
|
737
|
-
}),
|
|
735
|
+
if (u.length) throw new S(u, e, void 0, void 0, i);
|
|
736
|
+
a = o;
|
|
737
|
+
}), a;
|
|
738
738
|
}
|
|
739
739
|
isValid(e, t) {
|
|
740
|
-
return this.validate(e, t).then(() => !0, (
|
|
741
|
-
if (
|
|
742
|
-
throw
|
|
740
|
+
return this.validate(e, t).then(() => !0, (n) => {
|
|
741
|
+
if (S.isError(n)) return !1;
|
|
742
|
+
throw n;
|
|
743
743
|
});
|
|
744
744
|
}
|
|
745
745
|
isValidSync(e, t) {
|
|
746
746
|
try {
|
|
747
747
|
return this.validateSync(e, t), !0;
|
|
748
|
-
} catch (
|
|
749
|
-
if (
|
|
750
|
-
throw
|
|
748
|
+
} catch (n) {
|
|
749
|
+
if (S.isError(n)) return !1;
|
|
750
|
+
throw n;
|
|
751
751
|
}
|
|
752
752
|
}
|
|
753
753
|
_getDefault(e) {
|
|
754
754
|
let t = this.spec.default;
|
|
755
|
-
return t == null ? t : typeof t == "function" ? t.call(this, e) :
|
|
755
|
+
return t == null ? t : typeof t == "function" ? t.call(this, e) : P(t);
|
|
756
756
|
}
|
|
757
757
|
getDefault(e) {
|
|
758
758
|
return this.resolve(e || {})._getDefault(e);
|
|
@@ -768,42 +768,42 @@ attempted value: ${a}
|
|
|
768
768
|
});
|
|
769
769
|
}
|
|
770
770
|
nullability(e, t) {
|
|
771
|
-
const
|
|
771
|
+
const n = this.clone({
|
|
772
772
|
nullable: e
|
|
773
773
|
});
|
|
774
|
-
return
|
|
774
|
+
return n.internalTests.nullable = M({
|
|
775
775
|
message: t,
|
|
776
776
|
name: "nullable",
|
|
777
777
|
test(s) {
|
|
778
778
|
return s === null ? this.schema.spec.nullable : !0;
|
|
779
779
|
}
|
|
780
|
-
}),
|
|
780
|
+
}), n;
|
|
781
781
|
}
|
|
782
782
|
optionality(e, t) {
|
|
783
|
-
const
|
|
783
|
+
const n = this.clone({
|
|
784
784
|
optional: e
|
|
785
785
|
});
|
|
786
|
-
return
|
|
786
|
+
return n.internalTests.optionality = M({
|
|
787
787
|
message: t,
|
|
788
788
|
name: "optionality",
|
|
789
789
|
test(s) {
|
|
790
790
|
return s === void 0 ? this.schema.spec.optional : !0;
|
|
791
791
|
}
|
|
792
|
-
}),
|
|
792
|
+
}), n;
|
|
793
793
|
}
|
|
794
794
|
optional() {
|
|
795
795
|
return this.optionality(!0);
|
|
796
796
|
}
|
|
797
|
-
defined(e =
|
|
797
|
+
defined(e = F.defined) {
|
|
798
798
|
return this.optionality(!1, e);
|
|
799
799
|
}
|
|
800
800
|
nullable() {
|
|
801
801
|
return this.nullability(!0);
|
|
802
802
|
}
|
|
803
|
-
nonNullable(e =
|
|
803
|
+
nonNullable(e = F.notNull) {
|
|
804
804
|
return this.nullability(!1, e);
|
|
805
805
|
}
|
|
806
|
-
required(e =
|
|
806
|
+
required(e = F.required) {
|
|
807
807
|
return this.clone().withMutation((t) => t.nonNullable(e).defined(e));
|
|
808
808
|
}
|
|
809
809
|
notRequired() {
|
|
@@ -837,18 +837,18 @@ attempted value: ${a}
|
|
|
837
837
|
name: e[0],
|
|
838
838
|
message: e[1],
|
|
839
839
|
test: e[2]
|
|
840
|
-
}, t.message === void 0 && (t.message =
|
|
841
|
-
let
|
|
840
|
+
}, t.message === void 0 && (t.message = F.default), typeof t.test != "function") throw new TypeError("`test` is a required parameters");
|
|
841
|
+
let n = this.clone(), s = M(t), a = t.exclusive || t.name && n.exclusiveTests[t.name] === !0;
|
|
842
842
|
if (t.exclusive && !t.name)
|
|
843
843
|
throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");
|
|
844
|
-
return t.name && (
|
|
844
|
+
return t.name && (n.exclusiveTests[t.name] = !!t.exclusive), n.tests = n.tests.filter((i) => !(i.OPTIONS.name === t.name && (a || i.OPTIONS.test === s.OPTIONS.test))), n.tests.push(s), n;
|
|
845
845
|
}
|
|
846
846
|
when(e, t) {
|
|
847
847
|
!Array.isArray(e) && typeof e != "string" && (t = e, e = ".");
|
|
848
|
-
let
|
|
849
|
-
return s.forEach((
|
|
850
|
-
|
|
851
|
-
}),
|
|
848
|
+
let n = this.clone(), s = be(e).map((a) => new L(a));
|
|
849
|
+
return s.forEach((a) => {
|
|
850
|
+
a.isSibling && n.deps.push(a.key);
|
|
851
|
+
}), n.conditions.push(typeof t == "function" ? new G(s, t) : G.fromOptions(s, t)), n;
|
|
852
852
|
}
|
|
853
853
|
typeError(e) {
|
|
854
854
|
let t = this.clone();
|
|
@@ -856,8 +856,8 @@ attempted value: ${a}
|
|
|
856
856
|
message: e,
|
|
857
857
|
name: "typeError",
|
|
858
858
|
skipAbsent: !0,
|
|
859
|
-
test(
|
|
860
|
-
return this.schema._typeCheck(
|
|
859
|
+
test(n) {
|
|
860
|
+
return this.schema._typeCheck(n) ? !0 : this.createError({
|
|
861
861
|
params: {
|
|
862
862
|
type: this.schema.type
|
|
863
863
|
}
|
|
@@ -865,42 +865,42 @@ attempted value: ${a}
|
|
|
865
865
|
}
|
|
866
866
|
}), t;
|
|
867
867
|
}
|
|
868
|
-
oneOf(e, t =
|
|
869
|
-
let
|
|
868
|
+
oneOf(e, t = F.oneOf) {
|
|
869
|
+
let n = this.clone();
|
|
870
870
|
return e.forEach((s) => {
|
|
871
|
-
|
|
872
|
-
}),
|
|
871
|
+
n._whitelist.add(s), n._blacklist.delete(s);
|
|
872
|
+
}), n.internalTests.whiteList = M({
|
|
873
873
|
message: t,
|
|
874
874
|
name: "oneOf",
|
|
875
875
|
skipAbsent: !0,
|
|
876
876
|
test(s) {
|
|
877
|
-
let
|
|
878
|
-
return
|
|
877
|
+
let a = this.schema._whitelist, i = a.resolveAll(this.resolve);
|
|
878
|
+
return i.includes(s) ? !0 : this.createError({
|
|
879
879
|
params: {
|
|
880
|
-
values: Array.from(
|
|
881
|
-
resolved:
|
|
880
|
+
values: Array.from(a).join(", "),
|
|
881
|
+
resolved: i
|
|
882
882
|
}
|
|
883
883
|
});
|
|
884
884
|
}
|
|
885
|
-
}),
|
|
885
|
+
}), n;
|
|
886
886
|
}
|
|
887
|
-
notOneOf(e, t =
|
|
888
|
-
let
|
|
887
|
+
notOneOf(e, t = F.notOneOf) {
|
|
888
|
+
let n = this.clone();
|
|
889
889
|
return e.forEach((s) => {
|
|
890
|
-
|
|
891
|
-
}),
|
|
890
|
+
n._blacklist.add(s), n._whitelist.delete(s);
|
|
891
|
+
}), n.internalTests.blacklist = M({
|
|
892
892
|
message: t,
|
|
893
893
|
name: "notOneOf",
|
|
894
894
|
test(s) {
|
|
895
|
-
let
|
|
896
|
-
return
|
|
895
|
+
let a = this.schema._blacklist, i = a.resolveAll(this.resolve);
|
|
896
|
+
return i.includes(s) ? this.createError({
|
|
897
897
|
params: {
|
|
898
|
-
values: Array.from(
|
|
899
|
-
resolved:
|
|
898
|
+
values: Array.from(a).join(", "),
|
|
899
|
+
resolved: i
|
|
900
900
|
}
|
|
901
901
|
}) : !0;
|
|
902
902
|
}
|
|
903
|
-
}),
|
|
903
|
+
}), n;
|
|
904
904
|
}
|
|
905
905
|
strip(e = !0) {
|
|
906
906
|
let t = this.clone();
|
|
@@ -913,16 +913,16 @@ attempted value: ${a}
|
|
|
913
913
|
*/
|
|
914
914
|
describe(e) {
|
|
915
915
|
const t = (e ? this.resolve(e) : this).clone(), {
|
|
916
|
-
label:
|
|
916
|
+
label: n,
|
|
917
917
|
meta: s,
|
|
918
|
-
optional:
|
|
919
|
-
nullable:
|
|
918
|
+
optional: a,
|
|
919
|
+
nullable: i
|
|
920
920
|
} = t.spec;
|
|
921
921
|
return {
|
|
922
922
|
meta: s,
|
|
923
|
-
label:
|
|
924
|
-
optional:
|
|
925
|
-
nullable:
|
|
923
|
+
label: n,
|
|
924
|
+
optional: a,
|
|
925
|
+
nullable: i,
|
|
926
926
|
default: t.getDefault(e),
|
|
927
927
|
type: t.type,
|
|
928
928
|
oneOf: t._whitelist.describe(),
|
|
@@ -934,64 +934,64 @@ attempted value: ${a}
|
|
|
934
934
|
};
|
|
935
935
|
}
|
|
936
936
|
}
|
|
937
|
-
|
|
938
|
-
for (const
|
|
937
|
+
$.prototype.__isYupSchema__ = !0;
|
|
938
|
+
for (const r of ["validate", "validateSync"]) $.prototype[`${r}At`] = function(e, t, n = {}) {
|
|
939
939
|
const {
|
|
940
940
|
parent: s,
|
|
941
|
-
parentPath:
|
|
942
|
-
schema:
|
|
943
|
-
} =
|
|
944
|
-
return
|
|
941
|
+
parentPath: a,
|
|
942
|
+
schema: i
|
|
943
|
+
} = Xe(this, e, t, n.context);
|
|
944
|
+
return i[r](s && s[a], Object.assign({}, n, {
|
|
945
945
|
parent: s,
|
|
946
946
|
path: e
|
|
947
947
|
}));
|
|
948
948
|
};
|
|
949
|
-
for (const
|
|
950
|
-
for (const
|
|
951
|
-
const
|
|
952
|
-
function
|
|
953
|
-
const e =
|
|
954
|
-
if (!e) return Date.parse ? Date.parse(
|
|
949
|
+
for (const r of ["equals", "is"]) $.prototype[r] = $.prototype.oneOf;
|
|
950
|
+
for (const r of ["not", "nope"]) $.prototype[r] = $.prototype.notOneOf;
|
|
951
|
+
const Ge = /^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;
|
|
952
|
+
function He(r) {
|
|
953
|
+
const e = ne(r);
|
|
954
|
+
if (!e) return Date.parse ? Date.parse(r) : Number.NaN;
|
|
955
955
|
if (e.z === void 0 && e.plusMinus === void 0)
|
|
956
956
|
return new Date(e.year, e.month, e.day, e.hour, e.minute, e.second, e.millisecond).valueOf();
|
|
957
957
|
let t = 0;
|
|
958
958
|
return e.z !== "Z" && e.plusMinus !== void 0 && (t = e.hourOffset * 60 + e.minuteOffset, e.plusMinus === "+" && (t = 0 - t)), Date.UTC(e.year, e.month, e.day, e.hour, e.minute + t, e.second, e.millisecond);
|
|
959
959
|
}
|
|
960
|
-
function
|
|
960
|
+
function ne(r) {
|
|
961
961
|
var e, t;
|
|
962
|
-
const
|
|
963
|
-
return
|
|
964
|
-
year: k(
|
|
965
|
-
month: k(
|
|
966
|
-
day: k(
|
|
967
|
-
hour: k(
|
|
968
|
-
minute: k(
|
|
969
|
-
second: k(
|
|
970
|
-
millisecond:
|
|
962
|
+
const n = Ge.exec(r);
|
|
963
|
+
return n ? {
|
|
964
|
+
year: k(n[1]),
|
|
965
|
+
month: k(n[2], 1) - 1,
|
|
966
|
+
day: k(n[3], 1),
|
|
967
|
+
hour: k(n[4]),
|
|
968
|
+
minute: k(n[5]),
|
|
969
|
+
second: k(n[6]),
|
|
970
|
+
millisecond: n[7] ? (
|
|
971
971
|
// allow arbitrary sub-second precision beyond milliseconds
|
|
972
|
-
k(
|
|
972
|
+
k(n[7].substring(0, 3))
|
|
973
973
|
) : 0,
|
|
974
|
-
precision: (e = (t =
|
|
975
|
-
z:
|
|
976
|
-
plusMinus:
|
|
977
|
-
hourOffset: k(
|
|
978
|
-
minuteOffset: k(
|
|
974
|
+
precision: (e = (t = n[7]) == null ? void 0 : t.length) != null ? e : void 0,
|
|
975
|
+
z: n[8] || void 0,
|
|
976
|
+
plusMinus: n[9] || void 0,
|
|
977
|
+
hourOffset: k(n[10]),
|
|
978
|
+
minuteOffset: k(n[11])
|
|
979
979
|
} : null;
|
|
980
980
|
}
|
|
981
|
-
function k(
|
|
982
|
-
return Number(
|
|
981
|
+
function k(r, e = 0) {
|
|
982
|
+
return Number(r) || e;
|
|
983
983
|
}
|
|
984
|
-
let
|
|
984
|
+
let Ke = (
|
|
985
985
|
// eslint-disable-next-line
|
|
986
986
|
/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/
|
|
987
987
|
), Je = (
|
|
988
988
|
// eslint-disable-next-line
|
|
989
989
|
/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i
|
|
990
|
-
), Qe = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i, We = "^\\d{4}-\\d{2}-\\d{2}", et = "\\d{2}:\\d{2}:\\d{2}", tt = "(([+-]\\d{2}(:?\\d{2})?)|Z)",
|
|
990
|
+
), Qe = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i, We = "^\\d{4}-\\d{2}-\\d{2}", et = "\\d{2}:\\d{2}:\\d{2}", tt = "(([+-]\\d{2}(:?\\d{2})?)|Z)", nt = new RegExp(`${We}T${et}(\\.\\d+)?${tt}$`), rt = (r) => j(r) || r === r.trim(), st = {}.toString();
|
|
991
991
|
function A() {
|
|
992
|
-
return new
|
|
992
|
+
return new _e();
|
|
993
993
|
}
|
|
994
|
-
class
|
|
994
|
+
class _e extends $ {
|
|
995
995
|
constructor() {
|
|
996
996
|
super({
|
|
997
997
|
type: "string",
|
|
@@ -999,8 +999,8 @@ class we extends S {
|
|
|
999
999
|
return e instanceof String && (e = e.valueOf()), typeof e == "string";
|
|
1000
1000
|
}
|
|
1001
1001
|
}), this.withMutation(() => {
|
|
1002
|
-
this.transform((e, t,
|
|
1003
|
-
if (!
|
|
1002
|
+
this.transform((e, t, n) => {
|
|
1003
|
+
if (!n.spec.coerce || n.isType(e) || Array.isArray(e)) return e;
|
|
1004
1004
|
const s = e != null && e.toString ? e.toString() : e;
|
|
1005
1005
|
return s === st ? e : s;
|
|
1006
1006
|
});
|
|
@@ -1008,16 +1008,16 @@ class we extends S {
|
|
|
1008
1008
|
}
|
|
1009
1009
|
required(e) {
|
|
1010
1010
|
return super.required(e).withMutation((t) => t.test({
|
|
1011
|
-
message: e ||
|
|
1011
|
+
message: e || F.required,
|
|
1012
1012
|
name: "required",
|
|
1013
1013
|
skipAbsent: !0,
|
|
1014
|
-
test: (
|
|
1014
|
+
test: (n) => !!n.length
|
|
1015
1015
|
}));
|
|
1016
1016
|
}
|
|
1017
1017
|
notRequired() {
|
|
1018
1018
|
return super.notRequired().withMutation((e) => (e.tests = e.tests.filter((t) => t.OPTIONS.name !== "required"), e));
|
|
1019
1019
|
}
|
|
1020
|
-
length(e, t =
|
|
1020
|
+
length(e, t = v.length) {
|
|
1021
1021
|
return this.test({
|
|
1022
1022
|
message: t,
|
|
1023
1023
|
name: "length",
|
|
@@ -1026,12 +1026,12 @@ class we extends S {
|
|
|
1026
1026
|
length: e
|
|
1027
1027
|
},
|
|
1028
1028
|
skipAbsent: !0,
|
|
1029
|
-
test(
|
|
1030
|
-
return
|
|
1029
|
+
test(n) {
|
|
1030
|
+
return n.length === this.resolve(e);
|
|
1031
1031
|
}
|
|
1032
1032
|
});
|
|
1033
1033
|
}
|
|
1034
|
-
min(e, t =
|
|
1034
|
+
min(e, t = v.min) {
|
|
1035
1035
|
return this.test({
|
|
1036
1036
|
message: t,
|
|
1037
1037
|
name: "min",
|
|
@@ -1040,12 +1040,12 @@ class we extends S {
|
|
|
1040
1040
|
min: e
|
|
1041
1041
|
},
|
|
1042
1042
|
skipAbsent: !0,
|
|
1043
|
-
test(
|
|
1044
|
-
return
|
|
1043
|
+
test(n) {
|
|
1044
|
+
return n.length >= this.resolve(e);
|
|
1045
1045
|
}
|
|
1046
1046
|
});
|
|
1047
1047
|
}
|
|
1048
|
-
max(e, t =
|
|
1048
|
+
max(e, t = v.max) {
|
|
1049
1049
|
return this.test({
|
|
1050
1050
|
name: "max",
|
|
1051
1051
|
exclusive: !0,
|
|
@@ -1054,42 +1054,42 @@ class we extends S {
|
|
|
1054
1054
|
max: e
|
|
1055
1055
|
},
|
|
1056
1056
|
skipAbsent: !0,
|
|
1057
|
-
test(
|
|
1058
|
-
return
|
|
1057
|
+
test(n) {
|
|
1058
|
+
return n.length <= this.resolve(e);
|
|
1059
1059
|
}
|
|
1060
1060
|
});
|
|
1061
1061
|
}
|
|
1062
1062
|
matches(e, t) {
|
|
1063
|
-
let
|
|
1063
|
+
let n = !1, s, a;
|
|
1064
1064
|
return t && (typeof t == "object" ? {
|
|
1065
|
-
excludeEmptyString:
|
|
1065
|
+
excludeEmptyString: n = !1,
|
|
1066
1066
|
message: s,
|
|
1067
|
-
name:
|
|
1067
|
+
name: a
|
|
1068
1068
|
} = t : s = t), this.test({
|
|
1069
|
-
name:
|
|
1070
|
-
message: s ||
|
|
1069
|
+
name: a || "matches",
|
|
1070
|
+
message: s || v.matches,
|
|
1071
1071
|
params: {
|
|
1072
1072
|
regex: e
|
|
1073
1073
|
},
|
|
1074
1074
|
skipAbsent: !0,
|
|
1075
|
-
test: (
|
|
1075
|
+
test: (i) => i === "" && n || i.search(e) !== -1
|
|
1076
1076
|
});
|
|
1077
1077
|
}
|
|
1078
|
-
email(e =
|
|
1079
|
-
return this.matches(
|
|
1078
|
+
email(e = v.email) {
|
|
1079
|
+
return this.matches(Ke, {
|
|
1080
1080
|
name: "email",
|
|
1081
1081
|
message: e,
|
|
1082
1082
|
excludeEmptyString: !0
|
|
1083
1083
|
});
|
|
1084
1084
|
}
|
|
1085
|
-
url(e =
|
|
1085
|
+
url(e = v.url) {
|
|
1086
1086
|
return this.matches(Je, {
|
|
1087
1087
|
name: "url",
|
|
1088
1088
|
message: e,
|
|
1089
1089
|
excludeEmptyString: !0
|
|
1090
1090
|
});
|
|
1091
1091
|
}
|
|
1092
|
-
uuid(e =
|
|
1092
|
+
uuid(e = v.uuid) {
|
|
1093
1093
|
return this.matches(Qe, {
|
|
1094
1094
|
name: "uuid",
|
|
1095
1095
|
message: e,
|
|
@@ -1097,38 +1097,38 @@ class we extends S {
|
|
|
1097
1097
|
});
|
|
1098
1098
|
}
|
|
1099
1099
|
datetime(e) {
|
|
1100
|
-
let t = "",
|
|
1100
|
+
let t = "", n, s;
|
|
1101
1101
|
return e && (typeof e == "object" ? {
|
|
1102
1102
|
message: t = "",
|
|
1103
|
-
allowOffset:
|
|
1103
|
+
allowOffset: n = !1,
|
|
1104
1104
|
precision: s = void 0
|
|
1105
|
-
} = e : t = e), this.matches(
|
|
1105
|
+
} = e : t = e), this.matches(nt, {
|
|
1106
1106
|
name: "datetime",
|
|
1107
|
-
message: t ||
|
|
1107
|
+
message: t || v.datetime,
|
|
1108
1108
|
excludeEmptyString: !0
|
|
1109
1109
|
}).test({
|
|
1110
1110
|
name: "datetime_offset",
|
|
1111
|
-
message: t ||
|
|
1111
|
+
message: t || v.datetime_offset,
|
|
1112
1112
|
params: {
|
|
1113
|
-
allowOffset:
|
|
1113
|
+
allowOffset: n
|
|
1114
1114
|
},
|
|
1115
1115
|
skipAbsent: !0,
|
|
1116
|
-
test: (
|
|
1117
|
-
if (!
|
|
1118
|
-
const
|
|
1119
|
-
return
|
|
1116
|
+
test: (a) => {
|
|
1117
|
+
if (!a || n) return !0;
|
|
1118
|
+
const i = ne(a);
|
|
1119
|
+
return i ? !!i.z : !1;
|
|
1120
1120
|
}
|
|
1121
1121
|
}).test({
|
|
1122
1122
|
name: "datetime_precision",
|
|
1123
|
-
message: t ||
|
|
1123
|
+
message: t || v.datetime_precision,
|
|
1124
1124
|
params: {
|
|
1125
1125
|
precision: s
|
|
1126
1126
|
},
|
|
1127
1127
|
skipAbsent: !0,
|
|
1128
|
-
test: (
|
|
1129
|
-
if (!
|
|
1130
|
-
const
|
|
1131
|
-
return
|
|
1128
|
+
test: (a) => {
|
|
1129
|
+
if (!a || s == null) return !0;
|
|
1130
|
+
const i = ne(a);
|
|
1131
|
+
return i ? i.precision === s : !1;
|
|
1132
1132
|
}
|
|
1133
1133
|
});
|
|
1134
1134
|
}
|
|
@@ -1136,35 +1136,35 @@ class we extends S {
|
|
|
1136
1136
|
ensure() {
|
|
1137
1137
|
return this.default("").transform((e) => e === null ? "" : e);
|
|
1138
1138
|
}
|
|
1139
|
-
trim(e =
|
|
1139
|
+
trim(e = v.trim) {
|
|
1140
1140
|
return this.transform((t) => t != null ? t.trim() : t).test({
|
|
1141
1141
|
message: e,
|
|
1142
1142
|
name: "trim",
|
|
1143
|
-
test:
|
|
1143
|
+
test: rt
|
|
1144
1144
|
});
|
|
1145
1145
|
}
|
|
1146
|
-
lowercase(e =
|
|
1147
|
-
return this.transform((t) =>
|
|
1146
|
+
lowercase(e = v.lowercase) {
|
|
1147
|
+
return this.transform((t) => j(t) ? t : t.toLowerCase()).test({
|
|
1148
1148
|
message: e,
|
|
1149
1149
|
name: "string_case",
|
|
1150
1150
|
exclusive: !0,
|
|
1151
1151
|
skipAbsent: !0,
|
|
1152
|
-
test: (t) =>
|
|
1152
|
+
test: (t) => j(t) || t === t.toLowerCase()
|
|
1153
1153
|
});
|
|
1154
1154
|
}
|
|
1155
|
-
uppercase(e =
|
|
1156
|
-
return this.transform((t) =>
|
|
1155
|
+
uppercase(e = v.uppercase) {
|
|
1156
|
+
return this.transform((t) => j(t) ? t : t.toUpperCase()).test({
|
|
1157
1157
|
message: e,
|
|
1158
1158
|
name: "string_case",
|
|
1159
1159
|
exclusive: !0,
|
|
1160
1160
|
skipAbsent: !0,
|
|
1161
|
-
test: (t) =>
|
|
1161
|
+
test: (t) => j(t) || t === t.toUpperCase()
|
|
1162
1162
|
});
|
|
1163
1163
|
}
|
|
1164
1164
|
}
|
|
1165
|
-
A.prototype =
|
|
1166
|
-
let it = /* @__PURE__ */ new Date(""), at = (
|
|
1167
|
-
class se extends
|
|
1165
|
+
A.prototype = _e.prototype;
|
|
1166
|
+
let it = /* @__PURE__ */ new Date(""), at = (r) => Object.prototype.toString.call(r) === "[object Date]";
|
|
1167
|
+
class se extends $ {
|
|
1168
1168
|
constructor() {
|
|
1169
1169
|
super({
|
|
1170
1170
|
type: "date",
|
|
@@ -1172,22 +1172,22 @@ class se extends S {
|
|
|
1172
1172
|
return at(e) && !isNaN(e.getTime());
|
|
1173
1173
|
}
|
|
1174
1174
|
}), this.withMutation(() => {
|
|
1175
|
-
this.transform((e, t,
|
|
1175
|
+
this.transform((e, t, n) => !n.spec.coerce || n.isType(e) || e === null ? e : (e = He(e), isNaN(e) ? se.INVALID_DATE : new Date(e)));
|
|
1176
1176
|
});
|
|
1177
1177
|
}
|
|
1178
1178
|
prepareParam(e, t) {
|
|
1179
|
-
let
|
|
1180
|
-
if (
|
|
1181
|
-
|
|
1179
|
+
let n;
|
|
1180
|
+
if (L.isRef(e))
|
|
1181
|
+
n = e;
|
|
1182
1182
|
else {
|
|
1183
1183
|
let s = this.cast(e);
|
|
1184
1184
|
if (!this._typeCheck(s)) throw new TypeError(`\`${t}\` must be a Date or a value that can be \`cast()\` to a Date`);
|
|
1185
|
-
|
|
1185
|
+
n = s;
|
|
1186
1186
|
}
|
|
1187
|
-
return
|
|
1187
|
+
return n;
|
|
1188
1188
|
}
|
|
1189
1189
|
min(e, t = te.min) {
|
|
1190
|
-
let
|
|
1190
|
+
let n = this.prepareParam(e, "min");
|
|
1191
1191
|
return this.test({
|
|
1192
1192
|
message: t,
|
|
1193
1193
|
name: "min",
|
|
@@ -1197,12 +1197,12 @@ class se extends S {
|
|
|
1197
1197
|
},
|
|
1198
1198
|
skipAbsent: !0,
|
|
1199
1199
|
test(s) {
|
|
1200
|
-
return s >= this.resolve(
|
|
1200
|
+
return s >= this.resolve(n);
|
|
1201
1201
|
}
|
|
1202
1202
|
});
|
|
1203
1203
|
}
|
|
1204
1204
|
max(e, t = te.max) {
|
|
1205
|
-
let
|
|
1205
|
+
let n = this.prepareParam(e, "max");
|
|
1206
1206
|
return this.test({
|
|
1207
1207
|
message: t,
|
|
1208
1208
|
name: "max",
|
|
@@ -1212,76 +1212,76 @@ class se extends S {
|
|
|
1212
1212
|
},
|
|
1213
1213
|
skipAbsent: !0,
|
|
1214
1214
|
test(s) {
|
|
1215
|
-
return s <= this.resolve(
|
|
1215
|
+
return s <= this.resolve(n);
|
|
1216
1216
|
}
|
|
1217
1217
|
});
|
|
1218
1218
|
}
|
|
1219
1219
|
}
|
|
1220
1220
|
se.INVALID_DATE = it;
|
|
1221
|
-
function ut(
|
|
1222
|
-
let t = [],
|
|
1223
|
-
function i
|
|
1224
|
-
let o =
|
|
1225
|
-
|
|
1221
|
+
function ut(r, e = []) {
|
|
1222
|
+
let t = [], n = /* @__PURE__ */ new Set(), s = new Set(e.map(([i, u]) => `${i}-${u}`));
|
|
1223
|
+
function a(i, u) {
|
|
1224
|
+
let o = N.split(i)[0];
|
|
1225
|
+
n.add(o), s.has(`${u}-${o}`) || t.push([u, o]);
|
|
1226
1226
|
}
|
|
1227
|
-
for (const
|
|
1228
|
-
let u =
|
|
1229
|
-
|
|
1227
|
+
for (const i of Object.keys(r)) {
|
|
1228
|
+
let u = r[i];
|
|
1229
|
+
n.add(i), L.isRef(u) && u.isSibling ? a(u.path, i) : re(u) && "deps" in u && u.deps.forEach((o) => a(o, i));
|
|
1230
1230
|
}
|
|
1231
|
-
return
|
|
1231
|
+
return je.array(Array.from(n), t).reverse();
|
|
1232
1232
|
}
|
|
1233
|
-
function pe(
|
|
1233
|
+
function pe(r, e) {
|
|
1234
1234
|
let t = 1 / 0;
|
|
1235
|
-
return
|
|
1236
|
-
var
|
|
1237
|
-
if ((
|
|
1235
|
+
return r.some((n, s) => {
|
|
1236
|
+
var a;
|
|
1237
|
+
if ((a = e.path) != null && a.includes(n))
|
|
1238
1238
|
return t = s, !0;
|
|
1239
1239
|
}), t;
|
|
1240
1240
|
}
|
|
1241
|
-
function
|
|
1242
|
-
return (e, t) => pe(
|
|
1241
|
+
function we(r) {
|
|
1242
|
+
return (e, t) => pe(r, e) - pe(r, t);
|
|
1243
1243
|
}
|
|
1244
|
-
const ot = (
|
|
1245
|
-
if (typeof
|
|
1246
|
-
return
|
|
1247
|
-
let
|
|
1244
|
+
const ot = (r, e, t) => {
|
|
1245
|
+
if (typeof r != "string")
|
|
1246
|
+
return r;
|
|
1247
|
+
let n = r;
|
|
1248
1248
|
try {
|
|
1249
|
-
|
|
1249
|
+
n = JSON.parse(r);
|
|
1250
1250
|
} catch {
|
|
1251
1251
|
}
|
|
1252
|
-
return t.isType(
|
|
1252
|
+
return t.isType(n) ? n : r;
|
|
1253
1253
|
};
|
|
1254
|
-
function Y(
|
|
1255
|
-
if ("fields" in
|
|
1254
|
+
function Y(r) {
|
|
1255
|
+
if ("fields" in r) {
|
|
1256
1256
|
const e = {};
|
|
1257
|
-
for (const [t,
|
|
1258
|
-
e[t] = Y(
|
|
1259
|
-
return
|
|
1257
|
+
for (const [t, n] of Object.entries(r.fields))
|
|
1258
|
+
e[t] = Y(n);
|
|
1259
|
+
return r.setFields(e);
|
|
1260
1260
|
}
|
|
1261
|
-
if (
|
|
1262
|
-
const e =
|
|
1261
|
+
if (r.type === "array") {
|
|
1262
|
+
const e = r.optional();
|
|
1263
1263
|
return e.innerType && (e.innerType = Y(e.innerType)), e;
|
|
1264
1264
|
}
|
|
1265
|
-
return
|
|
1266
|
-
types:
|
|
1267
|
-
}) : "optional" in
|
|
1265
|
+
return r.type === "tuple" ? r.optional().clone({
|
|
1266
|
+
types: r.spec.types.map(Y)
|
|
1267
|
+
}) : "optional" in r ? r.optional() : r;
|
|
1268
1268
|
}
|
|
1269
|
-
const lt = (
|
|
1270
|
-
const t = [...
|
|
1271
|
-
if (t.length === 1) return t[0] in
|
|
1272
|
-
let
|
|
1273
|
-
return !!(s &&
|
|
1269
|
+
const lt = (r, e) => {
|
|
1270
|
+
const t = [...N.normalizePath(e)];
|
|
1271
|
+
if (t.length === 1) return t[0] in r;
|
|
1272
|
+
let n = t.pop(), s = N.getter(N.join(t), !0)(r);
|
|
1273
|
+
return !!(s && n in s);
|
|
1274
1274
|
};
|
|
1275
|
-
let me = (
|
|
1276
|
-
function ye(
|
|
1277
|
-
let t = Object.keys(
|
|
1278
|
-
return Object.keys(e).filter((
|
|
1275
|
+
let me = (r) => Object.prototype.toString.call(r) === "[object Object]";
|
|
1276
|
+
function ye(r, e) {
|
|
1277
|
+
let t = Object.keys(r.fields);
|
|
1278
|
+
return Object.keys(e).filter((n) => t.indexOf(n) === -1);
|
|
1279
1279
|
}
|
|
1280
|
-
const ct =
|
|
1281
|
-
function
|
|
1282
|
-
return new
|
|
1280
|
+
const ct = we([]);
|
|
1281
|
+
function ve(r) {
|
|
1282
|
+
return new Se(r);
|
|
1283
1283
|
}
|
|
1284
|
-
class
|
|
1284
|
+
class Se extends $ {
|
|
1285
1285
|
constructor(e) {
|
|
1286
1286
|
super({
|
|
1287
1287
|
type: "object",
|
|
@@ -1293,69 +1293,69 @@ class Fe extends S {
|
|
|
1293
1293
|
});
|
|
1294
1294
|
}
|
|
1295
1295
|
_cast(e, t = {}) {
|
|
1296
|
-
var
|
|
1296
|
+
var n;
|
|
1297
1297
|
let s = super._cast(e, t);
|
|
1298
1298
|
if (s === void 0) return this.getDefault(t);
|
|
1299
1299
|
if (!this._typeCheck(s)) return s;
|
|
1300
|
-
let
|
|
1300
|
+
let a = this.fields, i = (n = t.stripUnknown) != null ? n : this.spec.noUnknown, u = [].concat(this._nodes, Object.keys(s).filter((f) => !this._nodes.includes(f))), o = {}, d = Object.assign({}, t, {
|
|
1301
1301
|
parent: o,
|
|
1302
1302
|
__validating: t.__validating || !1
|
|
1303
1303
|
}), l = !1;
|
|
1304
1304
|
for (const f of u) {
|
|
1305
|
-
let h =
|
|
1305
|
+
let h = a[f], p = f in s;
|
|
1306
1306
|
if (h) {
|
|
1307
|
-
let
|
|
1307
|
+
let y, b = s[f];
|
|
1308
1308
|
d.path = (t.path ? `${t.path}.` : "") + f, h = h.resolve({
|
|
1309
|
-
value:
|
|
1309
|
+
value: b,
|
|
1310
1310
|
context: t.context,
|
|
1311
1311
|
parent: o
|
|
1312
1312
|
});
|
|
1313
|
-
let
|
|
1314
|
-
if (
|
|
1313
|
+
let E = h instanceof $ ? h.spec : void 0, c = E == null ? void 0 : E.strict;
|
|
1314
|
+
if (E != null && E.strip) {
|
|
1315
1315
|
l = l || f in s;
|
|
1316
1316
|
continue;
|
|
1317
1317
|
}
|
|
1318
|
-
|
|
1318
|
+
y = !t.__validating || !c ? (
|
|
1319
1319
|
// TODO: use _cast, this is double resolving
|
|
1320
1320
|
h.cast(s[f], d)
|
|
1321
|
-
) : s[f],
|
|
1322
|
-
} else
|
|
1323
|
-
(
|
|
1321
|
+
) : s[f], y !== void 0 && (o[f] = y);
|
|
1322
|
+
} else p && !i && (o[f] = s[f]);
|
|
1323
|
+
(p !== f in o || o[f] !== s[f]) && (l = !0);
|
|
1324
1324
|
}
|
|
1325
1325
|
return l ? o : s;
|
|
1326
1326
|
}
|
|
1327
|
-
_validate(e, t = {},
|
|
1327
|
+
_validate(e, t = {}, n, s) {
|
|
1328
1328
|
let {
|
|
1329
|
-
from:
|
|
1330
|
-
originalValue:
|
|
1329
|
+
from: a = [],
|
|
1330
|
+
originalValue: i = e,
|
|
1331
1331
|
recursive: u = this.spec.recursive
|
|
1332
1332
|
} = t;
|
|
1333
1333
|
t.from = [{
|
|
1334
1334
|
schema: this,
|
|
1335
|
-
value:
|
|
1336
|
-
}, ...
|
|
1335
|
+
value: i
|
|
1336
|
+
}, ...a], t.__validating = !0, t.originalValue = i, super._validate(e, t, n, (o, d) => {
|
|
1337
1337
|
if (!u || !me(d)) {
|
|
1338
1338
|
s(o, d);
|
|
1339
1339
|
return;
|
|
1340
1340
|
}
|
|
1341
|
-
|
|
1341
|
+
i = i || d;
|
|
1342
1342
|
let l = [];
|
|
1343
1343
|
for (let f of this._nodes) {
|
|
1344
1344
|
let h = this.fields[f];
|
|
1345
|
-
!h ||
|
|
1345
|
+
!h || L.isRef(h) || l.push(h.asNestedTest({
|
|
1346
1346
|
options: t,
|
|
1347
1347
|
key: f,
|
|
1348
1348
|
parent: d,
|
|
1349
1349
|
parentPath: t.path,
|
|
1350
|
-
originalParent:
|
|
1350
|
+
originalParent: i
|
|
1351
1351
|
}));
|
|
1352
1352
|
}
|
|
1353
1353
|
this.runTests({
|
|
1354
1354
|
tests: l,
|
|
1355
1355
|
value: d,
|
|
1356
|
-
originalValue:
|
|
1356
|
+
originalValue: i,
|
|
1357
1357
|
options: t
|
|
1358
|
-
},
|
|
1358
|
+
}, n, (f) => {
|
|
1359
1359
|
s(f.sort(this._sortErrors).concat(o), d);
|
|
1360
1360
|
});
|
|
1361
1361
|
});
|
|
@@ -1365,14 +1365,14 @@ class Fe extends S {
|
|
|
1365
1365
|
return t.fields = Object.assign({}, this.fields), t._nodes = this._nodes, t._excludedEdges = this._excludedEdges, t._sortErrors = this._sortErrors, t;
|
|
1366
1366
|
}
|
|
1367
1367
|
concat(e) {
|
|
1368
|
-
let t = super.concat(e),
|
|
1369
|
-
for (let [s,
|
|
1370
|
-
const
|
|
1371
|
-
|
|
1368
|
+
let t = super.concat(e), n = t.fields;
|
|
1369
|
+
for (let [s, a] of Object.entries(this.fields)) {
|
|
1370
|
+
const i = n[s];
|
|
1371
|
+
n[s] = i === void 0 ? a : i;
|
|
1372
1372
|
}
|
|
1373
1373
|
return t.withMutation((s) => (
|
|
1374
1374
|
// XXX: excludes here is wrong
|
|
1375
|
-
s.setFields(
|
|
1375
|
+
s.setFields(n, [...this._excludedEdges, ...e._excludedEdges])
|
|
1376
1376
|
));
|
|
1377
1377
|
}
|
|
1378
1378
|
_getDefault(e) {
|
|
@@ -1381,30 +1381,30 @@ class Fe extends S {
|
|
|
1381
1381
|
if (!this._nodes.length)
|
|
1382
1382
|
return;
|
|
1383
1383
|
let t = {};
|
|
1384
|
-
return this._nodes.forEach((
|
|
1384
|
+
return this._nodes.forEach((n) => {
|
|
1385
1385
|
var s;
|
|
1386
|
-
const
|
|
1387
|
-
let
|
|
1388
|
-
(s =
|
|
1389
|
-
parent:
|
|
1390
|
-
value:
|
|
1391
|
-
})), t[
|
|
1386
|
+
const a = this.fields[n];
|
|
1387
|
+
let i = e;
|
|
1388
|
+
(s = i) != null && s.value && (i = Object.assign({}, i, {
|
|
1389
|
+
parent: i.value,
|
|
1390
|
+
value: i.value[n]
|
|
1391
|
+
})), t[n] = a && "getDefault" in a ? a.getDefault(i) : void 0;
|
|
1392
1392
|
}), t;
|
|
1393
1393
|
}
|
|
1394
1394
|
setFields(e, t) {
|
|
1395
|
-
let
|
|
1396
|
-
return
|
|
1395
|
+
let n = this.clone();
|
|
1396
|
+
return n.fields = e, n._nodes = ut(e, t), n._sortErrors = we(Object.keys(e)), t && (n._excludedEdges = t), n;
|
|
1397
1397
|
}
|
|
1398
1398
|
shape(e, t = []) {
|
|
1399
|
-
return this.clone().withMutation((
|
|
1400
|
-
let s =
|
|
1401
|
-
return t.length && (Array.isArray(t[0]) || (t = [t]), s = [...
|
|
1399
|
+
return this.clone().withMutation((n) => {
|
|
1400
|
+
let s = n._excludedEdges;
|
|
1401
|
+
return t.length && (Array.isArray(t[0]) || (t = [t]), s = [...n._excludedEdges, ...t]), n.setFields(Object.assign(n.fields, e), s);
|
|
1402
1402
|
});
|
|
1403
1403
|
}
|
|
1404
1404
|
partial() {
|
|
1405
1405
|
const e = {};
|
|
1406
|
-
for (const [t,
|
|
1407
|
-
e[t] = "optional" in
|
|
1406
|
+
for (const [t, n] of Object.entries(this.fields))
|
|
1407
|
+
e[t] = "optional" in n && n.optional instanceof Function ? n.optional() : n;
|
|
1408
1408
|
return this.setFields(e);
|
|
1409
1409
|
}
|
|
1410
1410
|
deepPartial() {
|
|
@@ -1412,22 +1412,22 @@ class Fe extends S {
|
|
|
1412
1412
|
}
|
|
1413
1413
|
pick(e) {
|
|
1414
1414
|
const t = {};
|
|
1415
|
-
for (const
|
|
1416
|
-
this.fields[
|
|
1417
|
-
return this.setFields(t, this._excludedEdges.filter(([
|
|
1415
|
+
for (const n of e)
|
|
1416
|
+
this.fields[n] && (t[n] = this.fields[n]);
|
|
1417
|
+
return this.setFields(t, this._excludedEdges.filter(([n, s]) => e.includes(n) && e.includes(s)));
|
|
1418
1418
|
}
|
|
1419
1419
|
omit(e) {
|
|
1420
1420
|
const t = [];
|
|
1421
|
-
for (const
|
|
1422
|
-
e.includes(
|
|
1421
|
+
for (const n of Object.keys(this.fields))
|
|
1422
|
+
e.includes(n) || t.push(n);
|
|
1423
1423
|
return this.pick(t);
|
|
1424
1424
|
}
|
|
1425
|
-
from(e, t,
|
|
1426
|
-
let s =
|
|
1427
|
-
return this.transform((
|
|
1428
|
-
if (!
|
|
1429
|
-
let
|
|
1430
|
-
return lt(
|
|
1425
|
+
from(e, t, n) {
|
|
1426
|
+
let s = N.getter(e, !0);
|
|
1427
|
+
return this.transform((a) => {
|
|
1428
|
+
if (!a) return a;
|
|
1429
|
+
let i = a;
|
|
1430
|
+
return lt(a, e) && (i = Object.assign({}, a), n || delete i[e], i[t] = s(a)), i;
|
|
1431
1431
|
});
|
|
1432
1432
|
}
|
|
1433
1433
|
/** Parse an input JSON string to an object */
|
|
@@ -1444,10 +1444,10 @@ class Fe extends S {
|
|
|
1444
1444
|
message: e || B.exact,
|
|
1445
1445
|
test(t) {
|
|
1446
1446
|
if (t == null) return !0;
|
|
1447
|
-
const
|
|
1448
|
-
return
|
|
1447
|
+
const n = ye(this.schema, t);
|
|
1448
|
+
return n.length === 0 || this.createError({
|
|
1449
1449
|
params: {
|
|
1450
|
-
properties:
|
|
1450
|
+
properties: n.join(", ")
|
|
1451
1451
|
}
|
|
1452
1452
|
});
|
|
1453
1453
|
}
|
|
@@ -1460,21 +1460,21 @@ class Fe extends S {
|
|
|
1460
1460
|
}
|
|
1461
1461
|
noUnknown(e = !0, t = B.noUnknown) {
|
|
1462
1462
|
typeof e != "boolean" && (t = e, e = !0);
|
|
1463
|
-
let
|
|
1463
|
+
let n = this.test({
|
|
1464
1464
|
name: "noUnknown",
|
|
1465
1465
|
exclusive: !0,
|
|
1466
1466
|
message: t,
|
|
1467
1467
|
test(s) {
|
|
1468
1468
|
if (s == null) return !0;
|
|
1469
|
-
const
|
|
1470
|
-
return !e ||
|
|
1469
|
+
const a = ye(this.schema, s);
|
|
1470
|
+
return !e || a.length === 0 || this.createError({
|
|
1471
1471
|
params: {
|
|
1472
|
-
unknown:
|
|
1472
|
+
unknown: a.join(", ")
|
|
1473
1473
|
}
|
|
1474
1474
|
});
|
|
1475
1475
|
}
|
|
1476
1476
|
});
|
|
1477
|
-
return
|
|
1477
|
+
return n.spec.noUnknown = e, n;
|
|
1478
1478
|
}
|
|
1479
1479
|
unknown(e = !0, t = B.noUnknown) {
|
|
1480
1480
|
return this.noUnknown(!e, t);
|
|
@@ -1482,9 +1482,9 @@ class Fe extends S {
|
|
|
1482
1482
|
transformKeys(e) {
|
|
1483
1483
|
return this.transform((t) => {
|
|
1484
1484
|
if (!t) return t;
|
|
1485
|
-
const
|
|
1486
|
-
for (const s of Object.keys(t))
|
|
1487
|
-
return
|
|
1485
|
+
const n = {};
|
|
1486
|
+
for (const s of Object.keys(t)) n[e(s)] = t[s];
|
|
1487
|
+
return n;
|
|
1488
1488
|
});
|
|
1489
1489
|
}
|
|
1490
1490
|
camelCase() {
|
|
@@ -1497,25 +1497,25 @@ class Fe extends S {
|
|
|
1497
1497
|
return this.transformKeys((e) => W.snakeCase(e).toUpperCase());
|
|
1498
1498
|
}
|
|
1499
1499
|
describe(e) {
|
|
1500
|
-
const t = (e ? this.resolve(e) : this).clone(),
|
|
1501
|
-
|
|
1502
|
-
for (const [
|
|
1500
|
+
const t = (e ? this.resolve(e) : this).clone(), n = super.describe(e);
|
|
1501
|
+
n.fields = {};
|
|
1502
|
+
for (const [a, i] of Object.entries(t.fields)) {
|
|
1503
1503
|
var s;
|
|
1504
1504
|
let u = e;
|
|
1505
1505
|
(s = u) != null && s.value && (u = Object.assign({}, u, {
|
|
1506
1506
|
parent: u.value,
|
|
1507
|
-
value: u.value[
|
|
1508
|
-
})),
|
|
1507
|
+
value: u.value[a]
|
|
1508
|
+
})), n.fields[a] = i.describe(u);
|
|
1509
1509
|
}
|
|
1510
|
-
return
|
|
1510
|
+
return n;
|
|
1511
1511
|
}
|
|
1512
1512
|
}
|
|
1513
|
-
|
|
1513
|
+
ve.prototype = Se.prototype;
|
|
1514
1514
|
const ft = "#000639", dt = '<svg width="40" height="41" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 10.5C0 4.977 4.477.5 10 .5h20c5.523 0 10 4.477 10 10v20c0 5.523-4.477 10-10 10H10c-5.523 0-10-4.477-10-10v-20Z" fill="#F1F1F1"/><path fill-rule="evenodd" clip-rule="evenodd" d="M25.927 15.78a.75.75 0 1 0-1.06-1.06l-4.793 4.793-4.793-4.793a.75.75 0 0 0-1.061 1.06l4.793 4.793-4.793 4.793a.75.75 0 1 0 1.06 1.061l4.794-4.793 4.793 4.793a.75.75 0 0 0 1.06-1.06l-4.793-4.794 4.793-4.793Z" fill="#000639"/></svg>';
|
|
1515
1515
|
function ht() {
|
|
1516
|
-
if (document.head.querySelector(`#${
|
|
1516
|
+
if (document.head.querySelector(`#${K}`)) return;
|
|
1517
1517
|
const e = document.createElement("style");
|
|
1518
|
-
e.id =
|
|
1518
|
+
e.id = K, e.dataset.testid = K, document.head.appendChild(e), e.textContent = `
|
|
1519
1519
|
|
|
1520
1520
|
#${q}, #${q} * {
|
|
1521
1521
|
margin: 0;
|
|
@@ -1523,14 +1523,14 @@ function ht() {
|
|
|
1523
1523
|
box-sizing: border-box;
|
|
1524
1524
|
}
|
|
1525
1525
|
|
|
1526
|
-
#${
|
|
1526
|
+
#${X} {
|
|
1527
1527
|
position: absolute;
|
|
1528
1528
|
top: 50%;
|
|
1529
1529
|
left: 50%;
|
|
1530
1530
|
transform: translate(-50%, -50%);
|
|
1531
1531
|
}
|
|
1532
1532
|
|
|
1533
|
-
#${
|
|
1533
|
+
#${z} {
|
|
1534
1534
|
position: absolute;
|
|
1535
1535
|
top: 50%;
|
|
1536
1536
|
left: 50%;
|
|
@@ -1548,8 +1548,8 @@ function ht() {
|
|
|
1548
1548
|
}
|
|
1549
1549
|
`;
|
|
1550
1550
|
}
|
|
1551
|
-
function pt(
|
|
1552
|
-
|
|
1551
|
+
function pt(r) {
|
|
1552
|
+
ve({
|
|
1553
1553
|
fiatAmount: A().optional(),
|
|
1554
1554
|
fiatCurrency: A().optional(),
|
|
1555
1555
|
cryptoAmount: A().optional(),
|
|
@@ -1557,64 +1557,64 @@ function pt(n) {
|
|
|
1557
1557
|
publicKey: A().required("Public key is required"),
|
|
1558
1558
|
redirectUrl: A().optional(),
|
|
1559
1559
|
side: A().oneOf(["buy", "sell"]).required()
|
|
1560
|
-
}).validateSync(
|
|
1560
|
+
}).validateSync(r, { abortEarly: !1 });
|
|
1561
1561
|
}
|
|
1562
1562
|
function mt() {
|
|
1563
|
-
const
|
|
1564
|
-
return
|
|
1563
|
+
const r = document.createElement("div");
|
|
1564
|
+
return r.id = q, r.dataset.testid = q, r.style.position = "fixed", r.style.top = "0px", r.style.left = "0px", r.style.width = "100%", r.style.height = "100%", r.style.zIndex = "999999999", r.style.backgroundColor = "rgba(0, 0, 0, 0.4)", r;
|
|
1565
1565
|
}
|
|
1566
1566
|
function yt() {
|
|
1567
|
-
const
|
|
1568
|
-
return
|
|
1567
|
+
const r = document.createElement("button");
|
|
1568
|
+
return r.id = ee, r.dataset.testid = ee, r.setAttribute("type", "button"), r.style.width = "40px", r.style.height = "40px", r.style.position = "absolute", r.style.right = "0", r.style.zIndex = "40", r.style.backgroundColor = "transparent", r.style.border = "none", r.innerHTML = dt, r;
|
|
1569
1569
|
}
|
|
1570
1570
|
function bt() {
|
|
1571
|
-
const
|
|
1572
|
-
return
|
|
1571
|
+
const r = document.createElement("div");
|
|
1572
|
+
return r.id = X, r.dataset.testid = X, r.style.width = "40px", r.style.height = "40px", r.style.backgroundColor = "transparent", r.style.border = `2px solid ${ft}`, r.style.borderLeftColor = "transparent", r.style.borderBottomColor = "transparent", r.style.borderRadius = "100%", r.animate && r.animate(
|
|
1573
1573
|
[{ transform: "rotate(0)" }, { transform: "rotate(360deg)" }],
|
|
1574
1574
|
{
|
|
1575
1575
|
duration: 300,
|
|
1576
1576
|
iterations: 1 / 0
|
|
1577
1577
|
}
|
|
1578
|
-
),
|
|
1578
|
+
), r;
|
|
1579
1579
|
}
|
|
1580
1580
|
function xt() {
|
|
1581
|
-
const
|
|
1582
|
-
return
|
|
1581
|
+
const r = document.createElement("iframe");
|
|
1582
|
+
return r.dataset.testid = z, r.name = z, r.id = z, r.allow = "clipboard-write self undefined", r;
|
|
1583
1583
|
}
|
|
1584
|
-
function gt(
|
|
1585
|
-
const
|
|
1586
|
-
|
|
1587
|
-
const
|
|
1588
|
-
|
|
1589
|
-
for (const
|
|
1590
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
1591
|
-
const
|
|
1592
|
-
|
|
1584
|
+
function gt({ sandbox: r, ...e }) {
|
|
1585
|
+
const t = r ?? !1, a = e.side === "buy" ? void 0 : void 0, i = document.createElement("form");
|
|
1586
|
+
i.target = z, i.dataset.testid = Oe, i.action = a ?? "", i.method = "GET", i.style.display = "none", ((f) => {
|
|
1587
|
+
const h = process.env.NODE_ENV === "production", p = ["onSuccess", "onClose"];
|
|
1588
|
+
h && p.push("side");
|
|
1589
|
+
for (const y in f) {
|
|
1590
|
+
if (!Object.prototype.hasOwnProperty.call(f, y) || p.includes(y)) continue;
|
|
1591
|
+
const b = f[y], E = document.createElement("input");
|
|
1592
|
+
E.name = y, E.value = String(b), i.appendChild(E);
|
|
1593
1593
|
}
|
|
1594
|
-
})(
|
|
1595
|
-
const
|
|
1596
|
-
|
|
1597
|
-
const
|
|
1598
|
-
return
|
|
1594
|
+
})(e);
|
|
1595
|
+
const o = "POPUP", d = document.createElement("input");
|
|
1596
|
+
d.name = "displayMode", d.value = o;
|
|
1597
|
+
const l = document.createElement("input");
|
|
1598
|
+
return l.name = "parentOrigin", l.value = window.location.origin, i.appendChild(d), i.appendChild(l), i;
|
|
1599
1599
|
}
|
|
1600
|
-
class
|
|
1600
|
+
class _t {
|
|
1601
1601
|
constructor(e) {
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
const t = process.env.NODE_ENV === "test",
|
|
1602
|
+
R(this, "payload");
|
|
1603
|
+
R(this, "container", null);
|
|
1604
|
+
R(this, "boundClose");
|
|
1605
|
+
R(this, "onMessage", (e) => {
|
|
1606
|
+
const t = process.env.NODE_ENV === "test", n = this.payload.sandboxMode ?? !1, i = this.payload.side === "buy" ? void 0 : void 0;
|
|
1607
1607
|
if (t) {
|
|
1608
1608
|
if (e.source !== window) return;
|
|
1609
1609
|
} else {
|
|
1610
|
-
if (!
|
|
1611
|
-
const
|
|
1612
|
-
if (e.origin !==
|
|
1610
|
+
if (!i) return;
|
|
1611
|
+
const u = new URL(i);
|
|
1612
|
+
if (e.origin !== u.origin) return;
|
|
1613
1613
|
}
|
|
1614
1614
|
if (this.payload) {
|
|
1615
1615
|
if (e.data.status === Te) {
|
|
1616
|
-
const
|
|
1617
|
-
|
|
1616
|
+
const u = document.getElementById(X);
|
|
1617
|
+
u && u.remove();
|
|
1618
1618
|
}
|
|
1619
1619
|
e.data.status === oe && (this.payload.onClose && this.payload.onClose(e.data), this.cleanup()), e.data.status === ke && (this.payload.onSuccess && this.payload.onSuccess(e.data), this.cleanup());
|
|
1620
1620
|
}
|
|
@@ -1625,8 +1625,8 @@ class wt {
|
|
|
1625
1625
|
this.container = mt();
|
|
1626
1626
|
const e = bt(), t = yt();
|
|
1627
1627
|
t.addEventListener("click", this.boundClose), this.container.appendChild(e), this.container.appendChild(t);
|
|
1628
|
-
const
|
|
1629
|
-
this.container.appendChild(
|
|
1628
|
+
const n = xt();
|
|
1629
|
+
this.container.appendChild(n), document.body.appendChild(this.container);
|
|
1630
1630
|
const s = gt(this.payload);
|
|
1631
1631
|
this.container.appendChild(s), s.submit(), window.addEventListener("message", this.onMessage);
|
|
1632
1632
|
}
|
|
@@ -1642,5 +1642,5 @@ class wt {
|
|
|
1642
1642
|
}
|
|
1643
1643
|
}
|
|
1644
1644
|
export {
|
|
1645
|
-
|
|
1645
|
+
_t as BushaRampWidget
|
|
1646
1646
|
};
|