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