@opentiny/tiny-robot 0.4.2-alpha.7 → 0.4.2-alpha.9
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/bubble/index.js +10 -9
- package/dist/index.d.ts +1130 -909
- package/dist/index.js +129 -118
- package/dist/index4.js +380 -317
- package/dist/index5.js +240 -187
- package/dist/index6.js +565 -514
- package/dist/layout/index.js +1243 -0
- package/dist/sender/index.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +3 -3
package/dist/index5.js
CHANGED
|
@@ -1,94 +1,150 @@
|
|
|
1
|
-
class
|
|
1
|
+
class E extends Error {
|
|
2
2
|
constructor(e, r) {
|
|
3
3
|
super(`${e} at position ${r}`), this.position = r;
|
|
4
4
|
}
|
|
5
5
|
}
|
|
6
|
-
const
|
|
7
|
-
function
|
|
6
|
+
const en = 32, Sn = 10, rn = 9, sn = 13, Nn = 160, En = 6158, kn = 8192, yn = 8203, An = 8239, On = 8287, $n = 12288, Qn = 65279;
|
|
7
|
+
function vn(n) {
|
|
8
8
|
return /^[0-9A-Fa-f]$/.test(n);
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function m(n) {
|
|
11
11
|
return n >= "0" && n <= "9";
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function Bn(n) {
|
|
14
14
|
return n >= " ";
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function A(n) {
|
|
17
17
|
return `,:[]/{}()
|
|
18
18
|
+`.includes(n);
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function R(n) {
|
|
21
21
|
return n >= "a" && n <= "z" || n >= "A" && n <= "Z" || n === "_" || n === "$";
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function U(n) {
|
|
24
24
|
return n >= "a" && n <= "z" || n >= "A" && n <= "Z" || n === "_" || n === "$" || n >= "0" && n <= "9";
|
|
25
25
|
}
|
|
26
|
-
const
|
|
27
|
-
function
|
|
26
|
+
const _ = /^(http|https|ftp|mailto|file|data|irc):\/\/$/, q = /^[A-Za-z0-9-._~:/?#@!$&'()*+;=]$/;
|
|
27
|
+
function z(n) {
|
|
28
28
|
return `,[]/{}
|
|
29
29
|
+`.includes(n);
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
return
|
|
31
|
+
function P(n) {
|
|
32
|
+
return $(n) || In.test(n);
|
|
33
33
|
}
|
|
34
|
-
const
|
|
35
|
-
function
|
|
34
|
+
const In = /^[[{\w-]$/;
|
|
35
|
+
function T(n) {
|
|
36
36
|
return n === `
|
|
37
37
|
` || n === "\r" || n === " " || n === "\b" || n === "\f";
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function b(n, e) {
|
|
40
40
|
const r = n.charCodeAt(e);
|
|
41
|
-
return r ===
|
|
41
|
+
return r === en || r === Sn || r === rn || r === sn;
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function Wn(n, e) {
|
|
44
44
|
const r = n.charCodeAt(e);
|
|
45
|
-
return r ===
|
|
45
|
+
return r === en || r === rn || r === sn;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function Un(n, e) {
|
|
48
48
|
const r = n.charCodeAt(e);
|
|
49
|
-
return r ===
|
|
49
|
+
return r === Nn || r === En || r >= kn && r <= yn || r === An || r === On || r === $n || r === Qn;
|
|
50
50
|
}
|
|
51
|
-
function
|
|
52
|
-
return
|
|
51
|
+
function $(n) {
|
|
52
|
+
return un(n) || V(n);
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function un(n) {
|
|
55
55
|
return n === '"' || n === "“" || n === "”";
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function X(n) {
|
|
58
58
|
return n === '"';
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function V(n) {
|
|
61
61
|
return n === "'" || n === "‘" || n === "’" || n === "`" || n === "´";
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function G(n) {
|
|
64
64
|
return n === "'";
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function O(n, e) {
|
|
67
67
|
let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
|
|
68
|
-
const
|
|
69
|
-
return
|
|
68
|
+
const l = n.lastIndexOf(e);
|
|
69
|
+
return l !== -1 ? n.substring(0, l) + (r ? "" : n.substring(l + 1)) : n;
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function f(n, e) {
|
|
72
72
|
let r = n.length;
|
|
73
|
-
if (!
|
|
73
|
+
if (!b(n, r - 1))
|
|
74
74
|
return n + e;
|
|
75
|
-
for (;
|
|
75
|
+
for (; b(n, r - 1); )
|
|
76
76
|
r--;
|
|
77
77
|
return n.substring(0, r) + e + n.substring(r);
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function Vn(n, e, r) {
|
|
80
80
|
return n.substring(0, e) + n.substring(e + r);
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function Dn(n) {
|
|
83
83
|
return /[,\n][ \t\r]*$/.test(n);
|
|
84
84
|
}
|
|
85
|
-
const
|
|
85
|
+
const jn = {
|
|
86
|
+
""": '"',
|
|
87
|
+
"&": "&",
|
|
88
|
+
"<": "<",
|
|
89
|
+
">": ">",
|
|
90
|
+
"'": "'"
|
|
91
|
+
}, Y = 12;
|
|
92
|
+
function x(n) {
|
|
93
|
+
if (n.charAt(0) !== "&")
|
|
94
|
+
return null;
|
|
95
|
+
const e = n.indexOf(";");
|
|
96
|
+
if (e === -1)
|
|
97
|
+
return null;
|
|
98
|
+
const r = n.substring(0, e + 1), l = jn[r];
|
|
99
|
+
if (l !== void 0)
|
|
100
|
+
return {
|
|
101
|
+
char: l,
|
|
102
|
+
length: r.length
|
|
103
|
+
};
|
|
104
|
+
if (n.charAt(1) === "#") {
|
|
105
|
+
const h = n.substring(2, e), p = h.charAt(0) === "x" || h.charAt(0) === "X", t = p ? h.substring(1) : h;
|
|
106
|
+
if (t.length > 0) {
|
|
107
|
+
const g = Number.parseInt(t, p ? 16 : 10);
|
|
108
|
+
if (!Number.isNaN(g) && g >= 0 && g <= 1114111)
|
|
109
|
+
return {
|
|
110
|
+
char: String.fromCodePoint(g),
|
|
111
|
+
length: r.length
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
function Jn(n) {
|
|
118
|
+
return n !== null && n.char === '"';
|
|
119
|
+
}
|
|
120
|
+
function Kn(n) {
|
|
121
|
+
return n !== null && n.char === "'";
|
|
122
|
+
}
|
|
123
|
+
function k(n, e) {
|
|
124
|
+
let r = 0;
|
|
125
|
+
for (let l = 0; l < n.length; l++)
|
|
126
|
+
n.charAt(l) === e && r++;
|
|
127
|
+
return r;
|
|
128
|
+
}
|
|
129
|
+
function Ln(n, e) {
|
|
130
|
+
switch (e) {
|
|
131
|
+
case ")":
|
|
132
|
+
return k(n, "(") > k(n, ")");
|
|
133
|
+
case "]":
|
|
134
|
+
return k(n, "[") > k(n, "]");
|
|
135
|
+
case "}":
|
|
136
|
+
return k(n, "{") > k(n, "}");
|
|
137
|
+
default:
|
|
138
|
+
return !1;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
const nn = {
|
|
86
142
|
"\b": "\\b",
|
|
87
143
|
"\f": "\\f",
|
|
88
144
|
"\n": "\\n",
|
|
89
145
|
"\r": "\\r",
|
|
90
146
|
" ": "\\t"
|
|
91
|
-
},
|
|
147
|
+
}, Mn = {
|
|
92
148
|
'"': '"',
|
|
93
149
|
"\\": "\\",
|
|
94
150
|
"/": "/",
|
|
@@ -100,44 +156,44 @@ const We = {
|
|
|
100
156
|
t: " "
|
|
101
157
|
// note that \u is handled separately in parseString()
|
|
102
158
|
};
|
|
103
|
-
function
|
|
159
|
+
function Hn(n) {
|
|
104
160
|
let e = 0, r = "";
|
|
105
|
-
|
|
106
|
-
const
|
|
107
|
-
for (
|
|
108
|
-
e++,
|
|
161
|
+
D(["```", "[```", "{```"]), p() || mn(), D(["```", "```]", "```}"]);
|
|
162
|
+
const h = y(",");
|
|
163
|
+
for (h && t(), P(n[e]) && Dn(r) ? (h || (r = f(r, ",")), an()) : h && (r = O(r, ",")); n[e] === "}" || n[e] === "]"; )
|
|
164
|
+
e++, t();
|
|
109
165
|
if (e >= n.length)
|
|
110
166
|
return r;
|
|
111
|
-
|
|
112
|
-
function
|
|
113
|
-
|
|
114
|
-
const i =
|
|
115
|
-
return
|
|
167
|
+
I();
|
|
168
|
+
function p() {
|
|
169
|
+
t();
|
|
170
|
+
const i = ln() || fn() || C() || dn() || hn() || K(!1) || pn();
|
|
171
|
+
return t(), i;
|
|
116
172
|
}
|
|
117
|
-
function
|
|
173
|
+
function t() {
|
|
118
174
|
let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !0;
|
|
119
175
|
const s = e;
|
|
120
|
-
let u =
|
|
176
|
+
let u = g(i);
|
|
121
177
|
do
|
|
122
|
-
u =
|
|
178
|
+
u = on(), u && (u = g(i));
|
|
123
179
|
while (u);
|
|
124
180
|
return e > s;
|
|
125
181
|
}
|
|
126
|
-
function
|
|
127
|
-
const s = i ?
|
|
182
|
+
function g(i) {
|
|
183
|
+
const s = i ? b : Wn;
|
|
128
184
|
let u = "";
|
|
129
185
|
for (; ; )
|
|
130
186
|
if (s(n, e))
|
|
131
187
|
u += n[e], e++;
|
|
132
|
-
else if (
|
|
188
|
+
else if (Un(n, e))
|
|
133
189
|
u += " ", e++;
|
|
134
190
|
else
|
|
135
191
|
break;
|
|
136
192
|
return u.length > 0 ? (r += u, !0) : !1;
|
|
137
193
|
}
|
|
138
|
-
function
|
|
194
|
+
function on() {
|
|
139
195
|
if (n[e] === "/" && n[e + 1] === "*") {
|
|
140
|
-
for (; e < n.length && !
|
|
196
|
+
for (; e < n.length && !Zn(n, e); )
|
|
141
197
|
e++;
|
|
142
198
|
return e += 2, !0;
|
|
143
199
|
}
|
|
@@ -149,17 +205,17 @@ function Be(n) {
|
|
|
149
205
|
}
|
|
150
206
|
return !1;
|
|
151
207
|
}
|
|
152
|
-
function
|
|
153
|
-
if (
|
|
154
|
-
if (
|
|
155
|
-
for (; e < n.length &&
|
|
208
|
+
function D(i) {
|
|
209
|
+
if (cn(i)) {
|
|
210
|
+
if (R(n[e]))
|
|
211
|
+
for (; e < n.length && U(n[e]); )
|
|
156
212
|
e++;
|
|
157
|
-
return
|
|
213
|
+
return t(), !0;
|
|
158
214
|
}
|
|
159
215
|
return !1;
|
|
160
216
|
}
|
|
161
|
-
function
|
|
162
|
-
|
|
217
|
+
function cn(i) {
|
|
218
|
+
g(!0);
|
|
163
219
|
for (const s of i) {
|
|
164
220
|
const u = e + s.length;
|
|
165
221
|
if (n.slice(e, u) === s)
|
|
@@ -167,178 +223,172 @@ function Be(n) {
|
|
|
167
223
|
}
|
|
168
224
|
return !1;
|
|
169
225
|
}
|
|
170
|
-
function
|
|
226
|
+
function y(i) {
|
|
171
227
|
return n[e] === i ? (r += n[e], e++, !0) : !1;
|
|
172
228
|
}
|
|
173
|
-
function
|
|
229
|
+
function Q(i) {
|
|
174
230
|
return n[e] === i ? (e++, !0) : !1;
|
|
175
231
|
}
|
|
176
|
-
function
|
|
177
|
-
return
|
|
232
|
+
function tn() {
|
|
233
|
+
return Q("\\");
|
|
178
234
|
}
|
|
179
|
-
function
|
|
180
|
-
return
|
|
235
|
+
function j() {
|
|
236
|
+
return t(), n[e] === "." && n[e + 1] === "." && n[e + 2] === "." ? (e += 3, t(), Q(","), !0) : !1;
|
|
181
237
|
}
|
|
182
|
-
function
|
|
238
|
+
function ln() {
|
|
183
239
|
if (n[e] === "{") {
|
|
184
|
-
r += "{", e++,
|
|
240
|
+
r += "{", e++, t(), Q(",") && t();
|
|
185
241
|
let i = !0;
|
|
186
242
|
for (; e < n.length && n[e] !== "}"; ) {
|
|
187
243
|
let s;
|
|
188
|
-
if (i ?
|
|
189
|
-
n[e] === "}" || n[e] === "{" || n[e] === "]" || n[e] === "[" || n[e] === void 0 ? r =
|
|
244
|
+
if (i ? s = !0 : (s = y(","), s || (r = f(r, ",")), t()), j(), !(C() || K(!0))) {
|
|
245
|
+
n[e] === "}" || n[e] === "{" || n[e] === "]" || n[e] === "[" || n[e] === void 0 ? i || (r = O(r, ",")) : bn();
|
|
190
246
|
break;
|
|
191
247
|
}
|
|
192
|
-
|
|
193
|
-
const
|
|
194
|
-
|
|
248
|
+
t();
|
|
249
|
+
const a = y(":"), N = e >= n.length;
|
|
250
|
+
a || (P(n[e]) || N ? r = f(r, ":") : Z()), p() || (a || N ? r += "null" : Z()), i = !1;
|
|
195
251
|
}
|
|
196
|
-
return n[e] === "}" ? (r += "}", e++) : r =
|
|
252
|
+
return n[e] === "}" ? (r += "}", e++) : r = f(r, "}"), !0;
|
|
197
253
|
}
|
|
198
254
|
return !1;
|
|
199
255
|
}
|
|
200
|
-
function
|
|
256
|
+
function fn() {
|
|
201
257
|
if (n[e] === "[") {
|
|
202
|
-
r += "[", e++,
|
|
258
|
+
r += "[", e++, t(), Q(",") && t();
|
|
203
259
|
let i = !0;
|
|
204
|
-
for (; e < n.length && n[e] !== "]"; )
|
|
205
|
-
if (i
|
|
206
|
-
r =
|
|
260
|
+
for (; e < n.length && n[e] !== "]"; ) {
|
|
261
|
+
if (i || y(",") || (r = f(r, ",")), j(), !p()) {
|
|
262
|
+
i || (r = O(r, ","));
|
|
207
263
|
break;
|
|
208
264
|
}
|
|
209
|
-
|
|
265
|
+
i = !1;
|
|
266
|
+
}
|
|
267
|
+
return n[e] === "]" ? (r += "]", e++) : r = f(r, "]"), !0;
|
|
210
268
|
}
|
|
211
269
|
return !1;
|
|
212
270
|
}
|
|
213
|
-
function
|
|
271
|
+
function an() {
|
|
214
272
|
let i = !0, s = !0;
|
|
215
273
|
for (; s; )
|
|
216
|
-
i ? i = !1 :
|
|
217
|
-
s || (r =
|
|
274
|
+
i ? i = !1 : y(",") || (r = f(r, ",")), s = p();
|
|
275
|
+
s || (r = O(r, ",")), r = `[
|
|
218
276
|
${r}
|
|
219
277
|
]`;
|
|
220
278
|
}
|
|
221
|
-
function
|
|
222
|
-
let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, s = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : -1
|
|
223
|
-
|
|
224
|
-
|
|
279
|
+
function C() {
|
|
280
|
+
let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, s = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : -1;
|
|
281
|
+
const u = n[e] === "\\";
|
|
282
|
+
u && (e++, $(n[e]) || I());
|
|
283
|
+
const a = n[e] === "&" ? x(n.slice(e, e + Y)) : null, N = Jn(a) || Kn(a);
|
|
284
|
+
if ($(n[e]) || N) {
|
|
285
|
+
const F = X(n[e]) ? X : G(n[e]) ? G : V(n[e]) ? V : un, v = e, B = r.length;
|
|
225
286
|
let o = '"';
|
|
226
|
-
for (e
|
|
287
|
+
for (e += N && a ? a.length : 1; ; ) {
|
|
227
288
|
if (e >= n.length) {
|
|
228
|
-
const
|
|
229
|
-
return !i &&
|
|
289
|
+
const c = L(e - 1);
|
|
290
|
+
return !i && A(n.charAt(c)) ? (e = v, r = r.substring(0, B), C(!0)) : (o = f(o, '"'), r += o, !0);
|
|
230
291
|
}
|
|
231
292
|
if (e === s)
|
|
232
|
-
return o =
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
return
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
if (
|
|
245
|
-
|
|
293
|
+
return o = f(o, '"'), r += o, !0;
|
|
294
|
+
const d = N && n[e] === "&" ? x(n.slice(e, e + Y)) : null;
|
|
295
|
+
if (d && a ? d.char === a.char : F(n[e])) {
|
|
296
|
+
const c = e, W = o.length;
|
|
297
|
+
if (o += '"', e += d ? d.length : 1, r += o, t(!1), i || e >= n.length || A(n[e]) && // only count the brackets inside the string when actually needed,
|
|
298
|
+
// i.e. when the quote is directly followed by a closing bracket
|
|
299
|
+
!Ln(o, n[e]) || $(n[e]) && !gn(e) || m(n[e]))
|
|
300
|
+
return J(), !0;
|
|
301
|
+
n[e] === "\\" && I();
|
|
302
|
+
const w = L(c - 1), H = n.charAt(w);
|
|
303
|
+
if (H === ",")
|
|
304
|
+
return e = v, r = r.substring(0, B), C(!1, w);
|
|
305
|
+
if (A(H))
|
|
306
|
+
return e = v, r = r.substring(0, B), C(!0);
|
|
307
|
+
r = r.substring(0, B), e = c + (d ? d.length : 1), o = `${o.substring(0, W)}\\${o.substring(W)}`;
|
|
308
|
+
} else if (i && z(n[e])) {
|
|
309
|
+
if (n[e - 1] === ":" && _.test(n.substring(v + 1, e + 2)))
|
|
310
|
+
for (; e < n.length && q.test(n[e]); )
|
|
246
311
|
o += n[e], e++;
|
|
247
|
-
return o =
|
|
312
|
+
return o = f(o, '"'), r += o, J(), !0;
|
|
313
|
+
} else if (d) {
|
|
314
|
+
const c = d.char;
|
|
315
|
+
c === '"' ? o += '\\"' : T(c) ? o += nn[c] : o += c, e += d.length;
|
|
248
316
|
} else if (n[e] === "\\") {
|
|
249
|
-
const
|
|
250
|
-
if (
|
|
317
|
+
const c = n.charAt(e + 1);
|
|
318
|
+
if (Mn[c] !== void 0)
|
|
251
319
|
o += n.slice(e, e + 2), e += 2;
|
|
252
|
-
else if (
|
|
253
|
-
let
|
|
254
|
-
for (;
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
} else
|
|
258
|
-
` ? (o += "\\n", e += 2) : (o +=
|
|
320
|
+
else if (c === "u") {
|
|
321
|
+
let w = 2;
|
|
322
|
+
for (; w < 6 && vn(n[e + w]); )
|
|
323
|
+
w++;
|
|
324
|
+
w === 6 ? (o += n.slice(e, e + 6), e += 6) : e + w >= n.length ? e = n.length : Cn();
|
|
325
|
+
} else c === `
|
|
326
|
+
` ? (o += "\\n", e += 2) : (o += c, e += 2);
|
|
259
327
|
} else {
|
|
260
|
-
const
|
|
261
|
-
|
|
328
|
+
const c = n.charAt(e);
|
|
329
|
+
c === '"' && n[e - 1] !== "\\" ? (o += `\\${c}`, e++) : T(c) ? (o += nn[c], e++) : (Bn(c) || wn(c), o += c, e++);
|
|
262
330
|
}
|
|
263
|
-
u &&
|
|
331
|
+
u && tn();
|
|
264
332
|
}
|
|
265
333
|
}
|
|
266
334
|
return !1;
|
|
267
335
|
}
|
|
268
|
-
function
|
|
336
|
+
function J() {
|
|
269
337
|
let i = !1;
|
|
270
|
-
for (
|
|
271
|
-
i = !0, e++,
|
|
338
|
+
for (t(); n[e] === "+"; ) {
|
|
339
|
+
i = !0, e++, t(), r = O(r, '"', !0);
|
|
272
340
|
const s = r.length;
|
|
273
|
-
|
|
341
|
+
C() ? r = Vn(r, s, 1) : r = f(r, '"');
|
|
274
342
|
}
|
|
275
343
|
return i;
|
|
276
344
|
}
|
|
277
|
-
function
|
|
345
|
+
function dn() {
|
|
278
346
|
const i = e;
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
for (; d(n[e]); )
|
|
286
|
-
e++;
|
|
287
|
-
if (n[e] === ".") {
|
|
288
|
-
if (e++, $())
|
|
289
|
-
return v(i), !0;
|
|
290
|
-
if (!d(n[e]))
|
|
291
|
-
return e = i, !1;
|
|
292
|
-
for (; d(n[e]); )
|
|
293
|
-
e++;
|
|
294
|
-
}
|
|
295
|
-
if (n[e] === "e" || n[e] === "E") {
|
|
296
|
-
if (e++, (n[e] === "-" || n[e] === "+") && e++, $())
|
|
297
|
-
return v(i), !0;
|
|
298
|
-
if (!d(n[e]))
|
|
299
|
-
return e = i, !1;
|
|
300
|
-
for (; d(n[e]); )
|
|
301
|
-
e++;
|
|
302
|
-
}
|
|
303
|
-
if (!$())
|
|
304
|
-
return e = i, !1;
|
|
347
|
+
let s = "", u = !1;
|
|
348
|
+
for (n[e] === "-" && (s += n[e], e++, !m(n[e]) && M() && (s += "0")), n[e] === "0" && m(n[e + 1]) && (u = !0); m(n[e]); )
|
|
349
|
+
s += n[e], e++;
|
|
350
|
+
if (n[e] === ".")
|
|
351
|
+
for ((s === "" || s === "-") && (s += "0"), s += n[e], e++, m(n[e]) || (s += "0"); m(n[e]); )
|
|
352
|
+
s += n[e], e++;
|
|
305
353
|
if (e > i) {
|
|
306
|
-
|
|
307
|
-
|
|
354
|
+
if (n[e] === "e" || n[e] === "E")
|
|
355
|
+
for (s === "-" && (u = !0), s += n[e], e++, (n[e] === "-" || n[e] === "+") && (s += n[e], e++), m(n[e]) || (s += "0"); m(n[e]); )
|
|
356
|
+
s += n[e], e++;
|
|
357
|
+
return M() ? (r += u ? `"${n.substring(i, e)}"` : s, !0) : (e = i, !1);
|
|
308
358
|
}
|
|
309
359
|
return !1;
|
|
310
360
|
}
|
|
311
|
-
function
|
|
312
|
-
return
|
|
313
|
-
|
|
361
|
+
function hn() {
|
|
362
|
+
return S("true", "true") || S("false", "false") || S("null", "null") || // repair Python keywords True, False, None
|
|
363
|
+
S("True", "true") || S("False", "false") || S("None", "null");
|
|
314
364
|
}
|
|
315
|
-
function
|
|
316
|
-
return n.slice(e, e + i.length) === i ? (r += s, e += i.length, !0) : !1;
|
|
365
|
+
function S(i, s) {
|
|
366
|
+
return n.slice(e, e + i.length) === i && !U(n[e + i.length]) ? (r += s, e += i.length, !0) : !1;
|
|
317
367
|
}
|
|
318
|
-
function
|
|
368
|
+
function K(i) {
|
|
319
369
|
const s = e;
|
|
320
|
-
if (
|
|
321
|
-
for (; e < n.length &&
|
|
370
|
+
if (R(n[e])) {
|
|
371
|
+
for (; e < n.length && U(n[e]); )
|
|
322
372
|
e++;
|
|
323
373
|
let u = e;
|
|
324
|
-
for (;
|
|
374
|
+
for (; b(n, u); )
|
|
325
375
|
u++;
|
|
326
376
|
if (n[u] === "(")
|
|
327
|
-
return e = u + 1,
|
|
377
|
+
return e = u + 1, p(), n[e] === ")" && (e++, n[e] === ";" && e++), !0;
|
|
328
378
|
}
|
|
329
|
-
for (; e < n.length && !
|
|
379
|
+
for (; e < n.length && !z(n[e]) && !$(n[e]) && (!i || n[e] !== ":"); )
|
|
330
380
|
e++;
|
|
331
|
-
if (n[e - 1] === ":" &&
|
|
332
|
-
for (; e < n.length &&
|
|
381
|
+
if (n[e - 1] === ":" && _.test(n.substring(s, e + 2)))
|
|
382
|
+
for (; e < n.length && q.test(n[e]); )
|
|
333
383
|
e++;
|
|
334
384
|
if (e > s) {
|
|
335
|
-
for (;
|
|
385
|
+
for (; b(n, e - 1) && e > 0; )
|
|
336
386
|
e--;
|
|
337
387
|
const u = n.slice(s, e);
|
|
338
388
|
return r += u === "undefined" ? "null" : JSON.stringify(u), n[e] === '"' && e++, !0;
|
|
339
389
|
}
|
|
340
390
|
}
|
|
341
|
-
function
|
|
391
|
+
function pn() {
|
|
342
392
|
if (n[e] === "/") {
|
|
343
393
|
const i = e;
|
|
344
394
|
for (e++; e < n.length && (n[e] !== "/" || n[e - 1] === "\\"); )
|
|
@@ -346,42 +396,45 @@ ${r}
|
|
|
346
396
|
return e++, r += JSON.stringify(n.substring(i, e)), !0;
|
|
347
397
|
}
|
|
348
398
|
}
|
|
349
|
-
function
|
|
399
|
+
function L(i) {
|
|
350
400
|
let s = i;
|
|
351
|
-
for (; s > 0 &&
|
|
401
|
+
for (; s > 0 && b(n, s); )
|
|
352
402
|
s--;
|
|
353
403
|
return s;
|
|
354
404
|
}
|
|
355
|
-
function
|
|
356
|
-
|
|
405
|
+
function gn(i) {
|
|
406
|
+
let s = i + 1;
|
|
407
|
+
for (; s < n.length && b(n, s); )
|
|
408
|
+
s++;
|
|
409
|
+
return s >= n.length || A(n[s]);
|
|
357
410
|
}
|
|
358
|
-
function
|
|
359
|
-
|
|
411
|
+
function M() {
|
|
412
|
+
return e >= n.length || A(n[e]) || b(n, e);
|
|
360
413
|
}
|
|
361
|
-
function
|
|
362
|
-
throw new
|
|
414
|
+
function wn(i) {
|
|
415
|
+
throw new E(`Invalid character ${JSON.stringify(i)}`, e);
|
|
363
416
|
}
|
|
364
|
-
function
|
|
365
|
-
throw new
|
|
417
|
+
function I() {
|
|
418
|
+
throw new E(`Unexpected character ${JSON.stringify(n[e])}`, e);
|
|
366
419
|
}
|
|
367
|
-
function
|
|
368
|
-
throw new
|
|
420
|
+
function mn() {
|
|
421
|
+
throw new E("Unexpected end of json string", n.length);
|
|
369
422
|
}
|
|
370
|
-
function
|
|
371
|
-
throw new
|
|
423
|
+
function bn() {
|
|
424
|
+
throw new E("Object key expected", e);
|
|
372
425
|
}
|
|
373
|
-
function
|
|
374
|
-
throw new
|
|
426
|
+
function Z() {
|
|
427
|
+
throw new E("Colon expected", e);
|
|
375
428
|
}
|
|
376
|
-
function
|
|
429
|
+
function Cn() {
|
|
377
430
|
const i = n.slice(e, e + 6);
|
|
378
|
-
throw new
|
|
431
|
+
throw new E(`Invalid unicode character "${i}"`, e);
|
|
379
432
|
}
|
|
380
433
|
}
|
|
381
|
-
function
|
|
434
|
+
function Zn(n, e) {
|
|
382
435
|
return n[e] === "*" && n[e + 1] === "/";
|
|
383
436
|
}
|
|
384
437
|
export {
|
|
385
|
-
|
|
386
|
-
|
|
438
|
+
E as JSONRepairError,
|
|
439
|
+
Hn as jsonrepair
|
|
387
440
|
};
|