xcstrings-cli 1.6.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +90 -27
- package/dist/index.js +1793 -1368
- package/package.json +5 -3
package/dist/index.js
CHANGED
|
@@ -1,352 +1,197 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
import { hideBin as
|
|
4
|
-
import {
|
|
5
|
-
import { cosmiconfig as
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
const n = await wi(e, "utf-8");
|
|
13
|
-
return JSON.parse(n);
|
|
14
|
-
}
|
|
15
|
-
async function An(e, n) {
|
|
16
|
-
const i = JSON.stringify(n, null, 2), r = Si(i);
|
|
17
|
-
await yn(e, r + `
|
|
18
|
-
`, "utf-8");
|
|
19
|
-
}
|
|
20
|
-
function Si(e) {
|
|
21
|
-
let n = "", i = !1, r = !1;
|
|
22
|
-
for (let o = 0; o < e.length; o++) {
|
|
23
|
-
const t = e[o];
|
|
24
|
-
if (i && t === "\\" && !r) {
|
|
25
|
-
r = !0, n += t;
|
|
26
|
-
continue;
|
|
27
|
-
}
|
|
28
|
-
if (r) {
|
|
29
|
-
r = !1, n += t;
|
|
30
|
-
continue;
|
|
31
|
-
}
|
|
32
|
-
if (t === '"') {
|
|
33
|
-
i = !i, n += t;
|
|
34
|
-
continue;
|
|
35
|
-
}
|
|
36
|
-
if (!i && t === ":") {
|
|
37
|
-
n += " :";
|
|
38
|
-
continue;
|
|
39
|
-
}
|
|
40
|
-
n += t;
|
|
41
|
-
}
|
|
42
|
-
return n;
|
|
43
|
-
}
|
|
44
|
-
const Ce = "xcstrings-cli", Qe = Ai(Ce, {
|
|
2
|
+
import Tr from "yargs";
|
|
3
|
+
import { hideBin as Lr } from "yargs/helpers";
|
|
4
|
+
import { resolve as Fe, relative as be } from "node:path";
|
|
5
|
+
import { cosmiconfig as jr } from "cosmiconfig";
|
|
6
|
+
import Be from "json5";
|
|
7
|
+
import { select as Ir, checkbox as ln, confirm as Nr } from "@inquirer/prompts";
|
|
8
|
+
import C from "chalk";
|
|
9
|
+
import { readFile as Rr, writeFile as jn, readdir as In } from "node:fs/promises";
|
|
10
|
+
import { XcodeProject as Mr } from "@bacons/xcode";
|
|
11
|
+
const je = "xcstrings-cli", an = jr(je, {
|
|
45
12
|
searchPlaces: [
|
|
46
|
-
`${
|
|
47
|
-
`${
|
|
13
|
+
`${je}.json`,
|
|
14
|
+
`${je}.json5`
|
|
48
15
|
],
|
|
49
16
|
loaders: {
|
|
50
|
-
".json5": async (e, n) =>
|
|
17
|
+
".json5": async (e, n) => Be.parse(n)
|
|
51
18
|
},
|
|
52
19
|
cache: !1
|
|
53
20
|
});
|
|
54
|
-
async function
|
|
21
|
+
async function Ke(e) {
|
|
55
22
|
if (e) {
|
|
56
|
-
const
|
|
57
|
-
return
|
|
23
|
+
const r = await an.load(e);
|
|
24
|
+
return r ? r.config : null;
|
|
58
25
|
}
|
|
59
|
-
const n = await
|
|
26
|
+
const n = await an.search();
|
|
60
27
|
return n ? n.config : null;
|
|
61
28
|
}
|
|
62
|
-
function
|
|
63
|
-
|
|
64
|
-
|
|
29
|
+
function cn(e, n) {
|
|
30
|
+
if (!e || e.length === 0) return null;
|
|
31
|
+
for (const r of e)
|
|
32
|
+
if (typeof r != "string" && r.alias === n)
|
|
33
|
+
return r.path;
|
|
34
|
+
return null;
|
|
65
35
|
}
|
|
66
|
-
async function
|
|
67
|
-
const n =
|
|
68
|
-
if (
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (o.localizations)
|
|
74
|
-
for (const t of Object.keys(o.localizations))
|
|
75
|
-
i.add(t);
|
|
76
|
-
}
|
|
77
|
-
return Array.from(i).sort();
|
|
78
|
-
}
|
|
79
|
-
async function bn(e, n) {
|
|
80
|
-
const { sourceLanguage: i } = await ve(e);
|
|
81
|
-
if (!i)
|
|
82
|
-
throw new Error('The xcstrings file is missing "sourceLanguage".');
|
|
83
|
-
const r = await Re(n);
|
|
84
|
-
if (r?.xcodeprojPaths && r.xcodeprojPaths.length > 0) {
|
|
85
|
-
const l = /* @__PURE__ */ new Set();
|
|
86
|
-
l.add(i);
|
|
87
|
-
for (const a of r.xcodeprojPaths)
|
|
88
|
-
Ei(a).forEach((u) => l.add(u));
|
|
89
|
-
return Array.from(l).sort();
|
|
90
|
-
}
|
|
91
|
-
const o = await Oi(e), t = new Set(o);
|
|
92
|
-
return t.add(i), Array.from(t).sort();
|
|
93
|
-
}
|
|
94
|
-
async function Fi(e, n, i, r, o, t, l) {
|
|
95
|
-
const a = await ve(e);
|
|
96
|
-
if (!a.sourceLanguage)
|
|
97
|
-
throw new Error('The xcstrings file is missing "sourceLanguage".');
|
|
98
|
-
const c = a.sourceLanguage;
|
|
99
|
-
a.strings || (a.strings = {});
|
|
100
|
-
const s = (await Re(o))?.missingLanguagePolicy || "skip";
|
|
101
|
-
let p;
|
|
102
|
-
const h = async (g) => s === "include" ? !0 : (p || (p = await bn(e, o)), p.includes(g)), d = {
|
|
103
|
-
...a.strings[n],
|
|
104
|
-
extractionState: "manual"
|
|
105
|
-
};
|
|
106
|
-
if (i && (d.comment = i), t !== void 0) {
|
|
107
|
-
const g = l ?? c;
|
|
108
|
-
if (!await h(g))
|
|
109
|
-
throw new Error(`Language "${g}" is not supported.`);
|
|
110
|
-
d.localizations = d.localizations || {}, d.localizations[g] = {
|
|
111
|
-
stringUnit: {
|
|
112
|
-
state: "translated",
|
|
113
|
-
value: t
|
|
114
|
-
}
|
|
115
|
-
};
|
|
36
|
+
async function Pr(e, n, r) {
|
|
37
|
+
const i = n?.xcstringsPaths, t = i?.some((c) => typeof c != "string") ?? !1, l = e.startsWith("alias:") ? e.slice(6) : null;
|
|
38
|
+
if (l) {
|
|
39
|
+
const c = cn(i, l);
|
|
40
|
+
if (!c)
|
|
41
|
+
throw new Error(`Unknown alias: ${l}`);
|
|
42
|
+
return c;
|
|
116
43
|
}
|
|
117
|
-
const
|
|
118
|
-
if (
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
for (const [C, L] of g)
|
|
128
|
-
d.localizations[C] = {
|
|
129
|
-
stringUnit: {
|
|
130
|
-
state: "translated",
|
|
131
|
-
value: L
|
|
132
|
-
}
|
|
133
|
-
};
|
|
44
|
+
const o = cn(i, e);
|
|
45
|
+
if (o)
|
|
46
|
+
return o;
|
|
47
|
+
const a = !e.includes("/") && !e.endsWith(".xcstrings");
|
|
48
|
+
if (t && a)
|
|
49
|
+
throw new Error(`Unknown alias: ${e}`);
|
|
50
|
+
if (e === r && i && i.length > 0) {
|
|
51
|
+
if (i.length === 1) {
|
|
52
|
+
const s = i[0];
|
|
53
|
+
return typeof s == "string" ? s : s.path;
|
|
134
54
|
}
|
|
55
|
+
const c = i.map((s) => typeof s == "string" ? { name: s, value: s } : { name: `${s.alias} (${s.path})`, value: s.path });
|
|
56
|
+
return await Ir({
|
|
57
|
+
message: "Select xcstrings file:",
|
|
58
|
+
choices: c
|
|
59
|
+
});
|
|
135
60
|
}
|
|
136
|
-
|
|
61
|
+
return e;
|
|
137
62
|
}
|
|
138
|
-
function
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
e.localizations[t] && (o[r] ??= [], o[r].push(t), i || delete e.localizations[t]);
|
|
142
|
-
!i && e.localizations && Object.keys(e.localizations).length === 0 && delete e.localizations;
|
|
143
|
-
}
|
|
63
|
+
async function me(e) {
|
|
64
|
+
const n = await Rr(e, "utf-8");
|
|
65
|
+
return JSON.parse(n);
|
|
144
66
|
}
|
|
145
|
-
async function
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
67
|
+
async function Nn(e, n) {
|
|
68
|
+
const r = JSON.stringify(n, null, 2), i = Dr(r);
|
|
69
|
+
await jn(e, i + `
|
|
70
|
+
`, "utf-8");
|
|
71
|
+
}
|
|
72
|
+
function Dr(e) {
|
|
73
|
+
let n = "", r = !1, i = !1;
|
|
74
|
+
for (let t = 0; t < e.length; t++) {
|
|
75
|
+
const l = e[t];
|
|
76
|
+
if (r && l === "\\" && !i) {
|
|
77
|
+
i = !0, n += l;
|
|
153
78
|
continue;
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
79
|
+
}
|
|
80
|
+
if (i) {
|
|
81
|
+
i = !1, n += l;
|
|
157
82
|
continue;
|
|
158
83
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
return !r && c && await An(e, o), t;
|
|
164
|
-
}
|
|
165
|
-
const _e = "xcstrings-cli.json5";
|
|
166
|
-
async function Ti(e) {
|
|
167
|
-
const n = [];
|
|
168
|
-
async function i(r) {
|
|
169
|
-
try {
|
|
170
|
-
const o = await wn(r, { withFileTypes: !0 });
|
|
171
|
-
for (const t of o) {
|
|
172
|
-
const l = xe(r, t.name);
|
|
173
|
-
t.isDirectory() ? !t.name.startsWith(".") && t.name !== "node_modules" && await i(l) : t.name.endsWith(".xcstrings") && n.push(l);
|
|
174
|
-
}
|
|
175
|
-
} catch {
|
|
84
|
+
if (l === '"') {
|
|
85
|
+
r = !r, n += l;
|
|
86
|
+
continue;
|
|
176
87
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
let i = e;
|
|
183
|
-
try {
|
|
184
|
-
const r = await wn(i, { withFileTypes: !0 });
|
|
185
|
-
for (const o of r)
|
|
186
|
-
o.isDirectory() && o.name.endsWith(".xcodeproj") && n.push(xe(i, o.name));
|
|
187
|
-
} catch {
|
|
88
|
+
if (!r && l === ":") {
|
|
89
|
+
n += " :";
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
n += l;
|
|
188
93
|
}
|
|
189
94
|
return n;
|
|
190
95
|
}
|
|
191
|
-
|
|
192
|
-
const e = process.cwd();
|
|
193
|
-
console.log(), console.log(b.bold.cyan("🚀 xcstrings-cli Configuration Setup")), console.log(b.dim("─".repeat(40))), console.log(), console.log(b.yellow("🔍 Searching for .xcstrings files..."));
|
|
194
|
-
const n = await Ti(e);
|
|
195
|
-
console.log(b.yellow("🔍 Searching for .xcodeproj directories..."));
|
|
196
|
-
const i = await ji(e);
|
|
197
|
-
console.log();
|
|
198
|
-
let r = [];
|
|
199
|
-
if (n.length > 0) {
|
|
200
|
-
console.log(b.green(`✓ Found ${n.length} .xcstrings file(s)`)), console.log();
|
|
201
|
-
const u = n.map((s) => ({
|
|
202
|
-
name: b.white(ce(e, s)) + b.dim(` (${s})`),
|
|
203
|
-
value: ce(e, s),
|
|
204
|
-
checked: !0
|
|
205
|
-
}));
|
|
206
|
-
r = await Xe({
|
|
207
|
-
message: b.bold("Select .xcstrings files to manage:"),
|
|
208
|
-
choices: u
|
|
209
|
-
});
|
|
210
|
-
} else
|
|
211
|
-
console.log(b.dim(" No .xcstrings files found in current directory"));
|
|
212
|
-
console.log();
|
|
213
|
-
let o = [];
|
|
214
|
-
if (i.length > 0) {
|
|
215
|
-
console.log(b.green(`✓ Found ${i.length} .xcodeproj director${i.length === 1 ? "y" : "ies"}`)), console.log();
|
|
216
|
-
const u = i.map((s) => ({
|
|
217
|
-
name: b.white(ce(e, s) || s) + b.dim(` (${s})`),
|
|
218
|
-
value: ce(e, s) || s,
|
|
219
|
-
checked: !0
|
|
220
|
-
}));
|
|
221
|
-
o = await Xe({
|
|
222
|
-
message: b.bold("Select .xcodeproj directories for language detection:"),
|
|
223
|
-
choices: u
|
|
224
|
-
});
|
|
225
|
-
} else
|
|
226
|
-
console.log(b.dim(" No .xcodeproj directories found"));
|
|
227
|
-
if (console.log(), console.log(b.dim("─".repeat(40))), console.log(), console.log(b.bold("📋 Configuration Summary:")), console.log(), console.log(b.cyan(" xcstringsPaths:")), r.length > 0 ? r.forEach((u) => console.log(b.white(` • ${u}`))) : console.log(b.dim(" (none)")), console.log(), console.log(b.cyan(" xcodeprojPaths:")), o.length > 0 ? o.forEach((u) => console.log(b.white(` • ${u}`))) : console.log(b.dim(" (none)")), console.log(), !await Ci({
|
|
228
|
-
message: b.bold(`Create ${b.yellow(_e)}?`),
|
|
229
|
-
default: !0
|
|
230
|
-
})) {
|
|
231
|
-
console.log(b.dim(" Configuration cancelled."));
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
|
-
const l = r.map((u) => ` "${u}"`).join(`,
|
|
235
|
-
`), a = o.map((u) => ` "${u}"`).join(`,
|
|
236
|
-
`), c = `{
|
|
237
|
-
// Paths to .xcstrings files to manage. Specify relative or absolute paths.
|
|
238
|
-
xcstringsPaths: [
|
|
239
|
-
${l}
|
|
240
|
-
],
|
|
241
|
-
// Paths to .xcodeproj directories. Used for discovering supported languages.
|
|
242
|
-
xcodeprojPaths: [
|
|
243
|
-
${a}
|
|
244
|
-
],
|
|
245
|
-
// Behavior for handling missing languages when adding strings.
|
|
246
|
-
missingLanguagePolicy: "skip",
|
|
247
|
-
}
|
|
248
|
-
`;
|
|
249
|
-
await yn(_e, c, "utf-8"), console.log(), console.log(b.bold.green(`✓ Created ${_e}`)), console.log(b.dim(` Run ${b.cyan("xcstrings --help")} to see available commands.`)), console.log();
|
|
250
|
-
}
|
|
251
|
-
function Ni(e) {
|
|
96
|
+
function Br(e) {
|
|
252
97
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
253
98
|
}
|
|
254
|
-
var
|
|
255
|
-
function
|
|
256
|
-
if (
|
|
257
|
-
|
|
258
|
-
function e(
|
|
99
|
+
var ue = { exports: {} }, Ie, un;
|
|
100
|
+
function Ur() {
|
|
101
|
+
if (un) return Ie;
|
|
102
|
+
un = 1;
|
|
103
|
+
function e(r) {
|
|
259
104
|
try {
|
|
260
|
-
return JSON.stringify(
|
|
105
|
+
return JSON.stringify(r);
|
|
261
106
|
} catch {
|
|
262
107
|
return '"[Circular]"';
|
|
263
108
|
}
|
|
264
109
|
}
|
|
265
|
-
|
|
266
|
-
function n(
|
|
267
|
-
var
|
|
268
|
-
if (typeof
|
|
269
|
-
var a =
|
|
270
|
-
if (a === 1) return
|
|
110
|
+
Ie = n;
|
|
111
|
+
function n(r, i, t) {
|
|
112
|
+
var l = t && t.stringify || e, o = 1;
|
|
113
|
+
if (typeof r == "object" && r !== null) {
|
|
114
|
+
var a = i.length + o;
|
|
115
|
+
if (a === 1) return r;
|
|
271
116
|
var c = new Array(a);
|
|
272
|
-
c[0] =
|
|
117
|
+
c[0] = l(r);
|
|
273
118
|
for (var u = 1; u < a; u++)
|
|
274
|
-
c[u] =
|
|
119
|
+
c[u] = l(i[u]);
|
|
275
120
|
return c.join(" ");
|
|
276
121
|
}
|
|
277
|
-
if (typeof
|
|
278
|
-
return
|
|
279
|
-
var s =
|
|
280
|
-
if (s === 0) return
|
|
281
|
-
for (var
|
|
282
|
-
if (
|
|
283
|
-
switch (
|
|
122
|
+
if (typeof r != "string")
|
|
123
|
+
return r;
|
|
124
|
+
var s = i.length;
|
|
125
|
+
if (s === 0) return r;
|
|
126
|
+
for (var f = "", g = 1 - o, h = -1, x = r && r.length || 0, d = 0; d < x; ) {
|
|
127
|
+
if (r.charCodeAt(d) === 37 && d + 1 < x) {
|
|
128
|
+
switch (h = h > -1 ? h : 0, r.charCodeAt(d + 1)) {
|
|
284
129
|
case 100:
|
|
285
130
|
// 'd'
|
|
286
131
|
case 102:
|
|
287
|
-
if (
|
|
288
|
-
|
|
132
|
+
if (g >= s || i[g] == null) break;
|
|
133
|
+
h < d && (f += r.slice(h, d)), f += Number(i[g]), h = d + 2, d++;
|
|
289
134
|
break;
|
|
290
135
|
case 105:
|
|
291
|
-
if (
|
|
292
|
-
|
|
136
|
+
if (g >= s || i[g] == null) break;
|
|
137
|
+
h < d && (f += r.slice(h, d)), f += Math.floor(Number(i[g])), h = d + 2, d++;
|
|
293
138
|
break;
|
|
294
139
|
case 79:
|
|
295
140
|
// 'O'
|
|
296
141
|
case 111:
|
|
297
142
|
// 'o'
|
|
298
143
|
case 106:
|
|
299
|
-
if (
|
|
300
|
-
|
|
301
|
-
var
|
|
302
|
-
if (
|
|
303
|
-
|
|
144
|
+
if (g >= s || i[g] === void 0) break;
|
|
145
|
+
h < d && (f += r.slice(h, d));
|
|
146
|
+
var A = typeof i[g];
|
|
147
|
+
if (A === "string") {
|
|
148
|
+
f += "'" + i[g] + "'", h = d + 2, d++;
|
|
304
149
|
break;
|
|
305
150
|
}
|
|
306
|
-
if (
|
|
307
|
-
|
|
151
|
+
if (A === "function") {
|
|
152
|
+
f += i[g].name || "<anonymous>", h = d + 2, d++;
|
|
308
153
|
break;
|
|
309
154
|
}
|
|
310
|
-
|
|
155
|
+
f += l(i[g]), h = d + 2, d++;
|
|
311
156
|
break;
|
|
312
157
|
case 115:
|
|
313
|
-
if (
|
|
158
|
+
if (g >= s)
|
|
314
159
|
break;
|
|
315
|
-
|
|
160
|
+
h < d && (f += r.slice(h, d)), f += String(i[g]), h = d + 2, d++;
|
|
316
161
|
break;
|
|
317
162
|
case 37:
|
|
318
|
-
|
|
163
|
+
h < d && (f += r.slice(h, d)), f += "%", h = d + 2, d++, g--;
|
|
319
164
|
break;
|
|
320
165
|
}
|
|
321
|
-
++
|
|
166
|
+
++g;
|
|
322
167
|
}
|
|
323
|
-
++
|
|
168
|
+
++d;
|
|
324
169
|
}
|
|
325
|
-
return
|
|
326
|
-
}
|
|
327
|
-
return
|
|
328
|
-
}
|
|
329
|
-
var
|
|
330
|
-
function
|
|
331
|
-
if (
|
|
332
|
-
|
|
333
|
-
const e =
|
|
334
|
-
|
|
335
|
-
const n =
|
|
336
|
-
mapHttpRequest:
|
|
337
|
-
mapHttpResponse:
|
|
338
|
-
wrapRequestSerializer:
|
|
339
|
-
wrapResponseSerializer:
|
|
340
|
-
wrapErrorSerializer:
|
|
341
|
-
req:
|
|
342
|
-
res:
|
|
343
|
-
err:
|
|
344
|
-
errWithCause:
|
|
170
|
+
return h === -1 ? r : (h < x && (f += r.slice(h)), f);
|
|
171
|
+
}
|
|
172
|
+
return Ie;
|
|
173
|
+
}
|
|
174
|
+
var sn;
|
|
175
|
+
function Yr() {
|
|
176
|
+
if (sn) return ue.exports;
|
|
177
|
+
sn = 1;
|
|
178
|
+
const e = Ur();
|
|
179
|
+
ue.exports = s;
|
|
180
|
+
const n = kr().console || {}, r = {
|
|
181
|
+
mapHttpRequest: X,
|
|
182
|
+
mapHttpResponse: X,
|
|
183
|
+
wrapRequestSerializer: B,
|
|
184
|
+
wrapResponseSerializer: B,
|
|
185
|
+
wrapErrorSerializer: B,
|
|
186
|
+
req: X,
|
|
187
|
+
res: X,
|
|
188
|
+
err: Y,
|
|
189
|
+
errWithCause: Y
|
|
345
190
|
};
|
|
346
|
-
function
|
|
347
|
-
return
|
|
191
|
+
function i(p, m) {
|
|
192
|
+
return p === "silent" ? 1 / 0 : m.levels.values[p];
|
|
348
193
|
}
|
|
349
|
-
const
|
|
194
|
+
const t = Symbol("pino.logFuncs"), l = Symbol("pino.hierarchy"), o = {
|
|
350
195
|
error: "log",
|
|
351
196
|
fatal: "error",
|
|
352
197
|
warn: "error",
|
|
@@ -354,98 +199,98 @@ function Mi() {
|
|
|
354
199
|
debug: "log",
|
|
355
200
|
trace: "log"
|
|
356
201
|
};
|
|
357
|
-
function a(
|
|
202
|
+
function a(p, m) {
|
|
358
203
|
const w = {
|
|
359
204
|
logger: m,
|
|
360
|
-
parent:
|
|
205
|
+
parent: p[l]
|
|
361
206
|
};
|
|
362
|
-
m[
|
|
363
|
-
}
|
|
364
|
-
function c(
|
|
365
|
-
const
|
|
366
|
-
m.forEach((
|
|
367
|
-
_
|
|
368
|
-
}),
|
|
369
|
-
}
|
|
370
|
-
function u(
|
|
371
|
-
return Array.isArray(
|
|
372
|
-
return
|
|
373
|
-
}) :
|
|
374
|
-
}
|
|
375
|
-
function s(
|
|
376
|
-
|
|
377
|
-
const m =
|
|
207
|
+
m[l] = w;
|
|
208
|
+
}
|
|
209
|
+
function c(p, m, w) {
|
|
210
|
+
const S = {};
|
|
211
|
+
m.forEach((_) => {
|
|
212
|
+
S[_] = w[_] ? w[_] : n[_] || n[o[_] || "log"] || ce;
|
|
213
|
+
}), p[t] = S;
|
|
214
|
+
}
|
|
215
|
+
function u(p, m) {
|
|
216
|
+
return Array.isArray(p) ? p.filter(function(S) {
|
|
217
|
+
return S !== "!stdSerializers.err";
|
|
218
|
+
}) : p === !0 ? Object.keys(m) : !1;
|
|
219
|
+
}
|
|
220
|
+
function s(p) {
|
|
221
|
+
p = p || {}, p.browser = p.browser || {};
|
|
222
|
+
const m = p.browser.transmit;
|
|
378
223
|
if (m && typeof m.send != "function")
|
|
379
224
|
throw Error("pino: transmit option must have a send function");
|
|
380
|
-
const w =
|
|
381
|
-
|
|
382
|
-
const
|
|
383
|
-
let
|
|
384
|
-
Array.isArray(
|
|
385
|
-
const
|
|
386
|
-
typeof w == "function" &&
|
|
387
|
-
w[
|
|
388
|
-
}), (
|
|
389
|
-
const j =
|
|
390
|
-
|
|
391
|
-
get:
|
|
392
|
-
}), Object.defineProperty(
|
|
393
|
-
get:
|
|
394
|
-
set:
|
|
225
|
+
const w = p.browser.write || n;
|
|
226
|
+
p.browser.write && (p.browser.asObject = !0);
|
|
227
|
+
const S = p.serializers || {}, _ = u(p.browser.serialize, S);
|
|
228
|
+
let M = p.browser.serialize;
|
|
229
|
+
Array.isArray(p.browser.serialize) && p.browser.serialize.indexOf("!stdSerializers.err") > -1 && (M = !1);
|
|
230
|
+
const $ = Object.keys(p.customLevels || {}), k = ["error", "fatal", "warn", "info", "debug", "trace"].concat($);
|
|
231
|
+
typeof w == "function" && k.forEach(function(P) {
|
|
232
|
+
w[P] = w;
|
|
233
|
+
}), (p.enabled === !1 || p.browser.disabled) && (p.level = "silent");
|
|
234
|
+
const j = p.level || "info", b = Object.create(w);
|
|
235
|
+
b.log || (b.log = ce), c(b, k, w), a({}, b), Object.defineProperty(b, "levelVal", {
|
|
236
|
+
get: xe
|
|
237
|
+
}), Object.defineProperty(b, "level", {
|
|
238
|
+
get: Q,
|
|
239
|
+
set: Or
|
|
395
240
|
});
|
|
396
|
-
const
|
|
241
|
+
const U = {
|
|
397
242
|
transmit: m,
|
|
398
|
-
serialize:
|
|
399
|
-
asObject:
|
|
400
|
-
formatters:
|
|
401
|
-
levels:
|
|
402
|
-
timestamp:
|
|
243
|
+
serialize: _,
|
|
244
|
+
asObject: p.browser.asObject,
|
|
245
|
+
formatters: p.browser.formatters,
|
|
246
|
+
levels: k,
|
|
247
|
+
timestamp: ae(p)
|
|
403
248
|
};
|
|
404
|
-
|
|
405
|
-
function
|
|
406
|
-
return
|
|
249
|
+
b.levels = f(p), b.level = j, b.setMaxListeners = b.getMaxListeners = b.emit = b.addListener = b.on = b.prependListener = b.once = b.prependOnceListener = b.removeListener = b.removeAllListeners = b.listeners = b.listenerCount = b.eventNames = b.write = b.flush = ce, b.serializers = S, b._serialize = _, b._stdErrSerialize = M, b.child = Fr, m && (b._logEvent = W());
|
|
250
|
+
function xe() {
|
|
251
|
+
return i(this.level, this);
|
|
407
252
|
}
|
|
408
|
-
function
|
|
253
|
+
function Q() {
|
|
409
254
|
return this._level;
|
|
410
255
|
}
|
|
411
|
-
function
|
|
412
|
-
if (
|
|
413
|
-
throw Error("unknown level " +
|
|
414
|
-
this._level =
|
|
415
|
-
|
|
256
|
+
function Or(P) {
|
|
257
|
+
if (P !== "silent" && !this.levels.values[P])
|
|
258
|
+
throw Error("unknown level " + P);
|
|
259
|
+
this._level = P, x(this, U, b, "error"), x(this, U, b, "fatal"), x(this, U, b, "warn"), x(this, U, b, "info"), x(this, U, b, "debug"), x(this, U, b, "trace"), $.forEach((J) => {
|
|
260
|
+
x(this, U, b, J);
|
|
416
261
|
});
|
|
417
262
|
}
|
|
418
|
-
function
|
|
419
|
-
if (!
|
|
263
|
+
function Fr(P, J) {
|
|
264
|
+
if (!P)
|
|
420
265
|
throw new Error("missing bindings for child Pino");
|
|
421
|
-
|
|
422
|
-
const
|
|
423
|
-
if (
|
|
424
|
-
var
|
|
425
|
-
delete
|
|
266
|
+
J = J || {}, _ && P.serializers && (J.serializers = P.serializers);
|
|
267
|
+
const nn = J.serializers;
|
|
268
|
+
if (_ && nn) {
|
|
269
|
+
var ve = Object.assign({}, S, nn), rn = p.browser.serialize === !0 ? Object.keys(ve) : _;
|
|
270
|
+
delete P.serializers, v([P], rn, ve, this._stdErrSerialize);
|
|
426
271
|
}
|
|
427
|
-
function
|
|
428
|
-
this._childLevel = (
|
|
429
|
-
[].concat(
|
|
272
|
+
function tn(on) {
|
|
273
|
+
this._childLevel = (on._childLevel | 0) + 1, this.bindings = P, ve && (this.serializers = ve, this._serialize = rn), m && (this._logEvent = W(
|
|
274
|
+
[].concat(on._logEvent.bindings, P)
|
|
430
275
|
));
|
|
431
276
|
}
|
|
432
|
-
|
|
433
|
-
const
|
|
434
|
-
return a(this,
|
|
277
|
+
tn.prototype = this;
|
|
278
|
+
const Le = new tn(this);
|
|
279
|
+
return a(this, Le), Le.level = this.level, Le;
|
|
435
280
|
}
|
|
436
|
-
return
|
|
281
|
+
return b;
|
|
437
282
|
}
|
|
438
|
-
function p
|
|
439
|
-
const m =
|
|
283
|
+
function f(p) {
|
|
284
|
+
const m = p.customLevels || {}, w = Object.assign({}, s.levels.values, m), S = Object.assign({}, s.levels.labels, g(m));
|
|
440
285
|
return {
|
|
441
286
|
values: w,
|
|
442
|
-
labels:
|
|
287
|
+
labels: S
|
|
443
288
|
};
|
|
444
289
|
}
|
|
445
|
-
function
|
|
290
|
+
function g(p) {
|
|
446
291
|
const m = {};
|
|
447
|
-
return Object.keys(
|
|
448
|
-
m[
|
|
292
|
+
return Object.keys(p).forEach(function(w) {
|
|
293
|
+
m[p[w]] = w;
|
|
449
294
|
}), m;
|
|
450
295
|
}
|
|
451
296
|
s.levels = {
|
|
@@ -465,132 +310,132 @@ function Mi() {
|
|
|
465
310
|
50: "error",
|
|
466
311
|
60: "fatal"
|
|
467
312
|
}
|
|
468
|
-
}, s.stdSerializers =
|
|
469
|
-
function
|
|
313
|
+
}, s.stdSerializers = r, s.stdTimeFunctions = Object.assign({}, { nullTime: Ze, epochTime: en, unixTime: Sr, isoTime: _r });
|
|
314
|
+
function h(p) {
|
|
470
315
|
const m = [];
|
|
471
|
-
|
|
472
|
-
let w =
|
|
316
|
+
p.bindings && m.push(p.bindings);
|
|
317
|
+
let w = p[l];
|
|
473
318
|
for (; w.parent; )
|
|
474
319
|
w = w.parent, w.logger.bindings && m.push(w.logger.bindings);
|
|
475
320
|
return m.reverse();
|
|
476
321
|
}
|
|
477
|
-
function
|
|
478
|
-
if (Object.defineProperty(
|
|
479
|
-
value:
|
|
322
|
+
function x(p, m, w, S) {
|
|
323
|
+
if (Object.defineProperty(p, S, {
|
|
324
|
+
value: i(p.level, w) > i(S, w) ? ce : w[t][S],
|
|
480
325
|
writable: !0,
|
|
481
326
|
enumerable: !0,
|
|
482
327
|
configurable: !0
|
|
483
|
-
}), !m.transmit &&
|
|
328
|
+
}), !m.transmit && p[S] === ce)
|
|
484
329
|
return;
|
|
485
|
-
|
|
486
|
-
const
|
|
487
|
-
|
|
330
|
+
p[S] = A(p, m, w, S);
|
|
331
|
+
const _ = h(p);
|
|
332
|
+
_.length !== 0 && (p[S] = d(_, p[S]));
|
|
488
333
|
}
|
|
489
|
-
function
|
|
334
|
+
function d(p, m) {
|
|
490
335
|
return function() {
|
|
491
|
-
return m.apply(this, [...
|
|
336
|
+
return m.apply(this, [...p, ...arguments]);
|
|
492
337
|
};
|
|
493
338
|
}
|
|
494
|
-
function
|
|
495
|
-
return /* @__PURE__ */ (function(
|
|
339
|
+
function A(p, m, w, S) {
|
|
340
|
+
return /* @__PURE__ */ (function(_) {
|
|
496
341
|
return function() {
|
|
497
|
-
const
|
|
498
|
-
for (var
|
|
499
|
-
if (m.serialize && !m.asObject &&
|
|
500
|
-
const
|
|
501
|
-
if (
|
|
502
|
-
|
|
503
|
-
ts:
|
|
504
|
-
methodLevel:
|
|
505
|
-
methodValue:
|
|
506
|
-
transmitValue: w.levels.values[m.transmit.level ||
|
|
342
|
+
const $ = m.timestamp(), k = new Array(arguments.length), j = Object.getPrototypeOf && Object.getPrototypeOf(this) === n ? n : this;
|
|
343
|
+
for (var b = 0; b < k.length; b++) k[b] = arguments[b];
|
|
344
|
+
if (m.serialize && !m.asObject && v(k, this._serialize, this.serializers, this._stdErrSerialize), m.asObject || m.formatters ? _.call(j, E(this, S, k, $, m.formatters)) : _.apply(j, k), m.transmit) {
|
|
345
|
+
const U = m.transmit.level || p._level, xe = w.levels.values[U], Q = w.levels.values[S];
|
|
346
|
+
if (Q < xe) return;
|
|
347
|
+
K(this, {
|
|
348
|
+
ts: $,
|
|
349
|
+
methodLevel: S,
|
|
350
|
+
methodValue: Q,
|
|
351
|
+
transmitValue: w.levels.values[m.transmit.level || p._level],
|
|
507
352
|
send: m.transmit.send,
|
|
508
|
-
val:
|
|
509
|
-
},
|
|
353
|
+
val: i(p._level, w)
|
|
354
|
+
}, k);
|
|
510
355
|
}
|
|
511
356
|
};
|
|
512
|
-
})(
|
|
357
|
+
})(p[t][S]);
|
|
513
358
|
}
|
|
514
|
-
function
|
|
359
|
+
function E(p, m, w, S, _ = {}) {
|
|
515
360
|
const {
|
|
516
|
-
level:
|
|
517
|
-
log:
|
|
518
|
-
} =
|
|
519
|
-
|
|
520
|
-
const
|
|
521
|
-
let j =
|
|
522
|
-
const
|
|
523
|
-
|
|
524
|
-
let
|
|
525
|
-
if (
|
|
526
|
-
for (;
|
|
527
|
-
Object.assign(
|
|
528
|
-
j =
|
|
529
|
-
} else typeof j == "string" && (j = e(
|
|
530
|
-
return j !== void 0 && (
|
|
531
|
-
}
|
|
532
|
-
function
|
|
533
|
-
for (const
|
|
534
|
-
if (
|
|
535
|
-
|
|
536
|
-
else if (typeof
|
|
537
|
-
for (const
|
|
538
|
-
m && m.indexOf(
|
|
539
|
-
}
|
|
540
|
-
function
|
|
541
|
-
const
|
|
542
|
-
|
|
361
|
+
level: M = () => p.levels.values[m],
|
|
362
|
+
log: $ = (Q) => Q
|
|
363
|
+
} = _;
|
|
364
|
+
p._serialize && v(w, p._serialize, p.serializers, p._stdErrSerialize);
|
|
365
|
+
const k = w.slice();
|
|
366
|
+
let j = k[0];
|
|
367
|
+
const b = {};
|
|
368
|
+
S && (b.time = S), b.level = M(m, p.levels.values[m]);
|
|
369
|
+
let U = (p._childLevel | 0) + 1;
|
|
370
|
+
if (U < 1 && (U = 1), j !== null && typeof j == "object") {
|
|
371
|
+
for (; U-- && typeof k[0] == "object"; )
|
|
372
|
+
Object.assign(b, k.shift());
|
|
373
|
+
j = k.length ? e(k.shift(), k) : void 0;
|
|
374
|
+
} else typeof j == "string" && (j = e(k.shift(), k));
|
|
375
|
+
return j !== void 0 && (b.msg = j), $(b);
|
|
376
|
+
}
|
|
377
|
+
function v(p, m, w, S) {
|
|
378
|
+
for (const _ in p)
|
|
379
|
+
if (S && p[_] instanceof Error)
|
|
380
|
+
p[_] = s.stdSerializers.err(p[_]);
|
|
381
|
+
else if (typeof p[_] == "object" && !Array.isArray(p[_]))
|
|
382
|
+
for (const M in p[_])
|
|
383
|
+
m && m.indexOf(M) > -1 && M in w && (p[_][M] = w[M](p[_][M]));
|
|
384
|
+
}
|
|
385
|
+
function K(p, m, w) {
|
|
386
|
+
const S = m.send, _ = m.ts, M = m.methodLevel, $ = m.methodValue, k = m.val, j = p._logEvent.bindings;
|
|
387
|
+
v(
|
|
543
388
|
w,
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
),
|
|
548
|
-
return j.indexOf(
|
|
549
|
-
}),
|
|
550
|
-
}
|
|
551
|
-
function
|
|
389
|
+
p._serialize || Object.keys(p.serializers),
|
|
390
|
+
p.serializers,
|
|
391
|
+
p._stdErrSerialize === void 0 ? !0 : p._stdErrSerialize
|
|
392
|
+
), p._logEvent.ts = _, p._logEvent.messages = w.filter(function(b) {
|
|
393
|
+
return j.indexOf(b) === -1;
|
|
394
|
+
}), p._logEvent.level.label = M, p._logEvent.level.value = $, S(M, p._logEvent, k), p._logEvent = W(j);
|
|
395
|
+
}
|
|
396
|
+
function W(p) {
|
|
552
397
|
return {
|
|
553
398
|
ts: 0,
|
|
554
399
|
messages: [],
|
|
555
|
-
bindings:
|
|
400
|
+
bindings: p || [],
|
|
556
401
|
level: { label: "", value: 0 }
|
|
557
402
|
};
|
|
558
403
|
}
|
|
559
|
-
function
|
|
404
|
+
function Y(p) {
|
|
560
405
|
const m = {
|
|
561
|
-
type:
|
|
562
|
-
msg:
|
|
563
|
-
stack:
|
|
406
|
+
type: p.constructor.name,
|
|
407
|
+
msg: p.message,
|
|
408
|
+
stack: p.stack
|
|
564
409
|
};
|
|
565
|
-
for (const w in
|
|
566
|
-
m[w] === void 0 && (m[w] =
|
|
410
|
+
for (const w in p)
|
|
411
|
+
m[w] === void 0 && (m[w] = p[w]);
|
|
567
412
|
return m;
|
|
568
413
|
}
|
|
569
|
-
function
|
|
570
|
-
return typeof
|
|
414
|
+
function ae(p) {
|
|
415
|
+
return typeof p.timestamp == "function" ? p.timestamp : p.timestamp === !1 ? Ze : en;
|
|
571
416
|
}
|
|
572
|
-
function
|
|
417
|
+
function X() {
|
|
573
418
|
return {};
|
|
574
419
|
}
|
|
575
|
-
function
|
|
576
|
-
return
|
|
420
|
+
function B(p) {
|
|
421
|
+
return p;
|
|
577
422
|
}
|
|
578
|
-
function
|
|
423
|
+
function ce() {
|
|
579
424
|
}
|
|
580
|
-
function
|
|
425
|
+
function Ze() {
|
|
581
426
|
return !1;
|
|
582
427
|
}
|
|
583
|
-
function
|
|
428
|
+
function en() {
|
|
584
429
|
return Date.now();
|
|
585
430
|
}
|
|
586
|
-
function
|
|
431
|
+
function Sr() {
|
|
587
432
|
return Math.round(Date.now() / 1e3);
|
|
588
433
|
}
|
|
589
|
-
function
|
|
434
|
+
function _r() {
|
|
590
435
|
return new Date(Date.now()).toISOString();
|
|
591
436
|
}
|
|
592
|
-
function
|
|
593
|
-
function
|
|
437
|
+
function kr() {
|
|
438
|
+
function p(m) {
|
|
594
439
|
return typeof m < "u" && m;
|
|
595
440
|
}
|
|
596
441
|
try {
|
|
@@ -601,104 +446,146 @@ function Mi() {
|
|
|
601
446
|
configurable: !0
|
|
602
447
|
}), globalThis;
|
|
603
448
|
} catch {
|
|
604
|
-
return
|
|
449
|
+
return p(self) || p(window) || p(this) || {};
|
|
605
450
|
}
|
|
606
451
|
}
|
|
607
|
-
return
|
|
452
|
+
return ue.exports.default = s, ue.exports.pino = s, ue.exports;
|
|
608
453
|
}
|
|
609
|
-
var
|
|
610
|
-
const
|
|
454
|
+
var zr = Yr();
|
|
455
|
+
const $r = /* @__PURE__ */ Br(zr), ne = $r({
|
|
611
456
|
level: process.env.LOG_LEVEL || "info"
|
|
612
457
|
});
|
|
613
|
-
function
|
|
458
|
+
function Hr() {
|
|
459
|
+
return {
|
|
460
|
+
command: "languages",
|
|
461
|
+
describe: "List supported languages from xcodeproj or xcstrings",
|
|
462
|
+
handler: async (e) => {
|
|
463
|
+
const n = await Rn(e.path, e.config);
|
|
464
|
+
ne.info(n.join(" "));
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
function Kr(e) {
|
|
469
|
+
const n = Fe(e, "project.pbxproj");
|
|
470
|
+
return (Mr.open(n).rootObject.props.knownRegions ?? []).filter((l) => l !== "Base").sort();
|
|
471
|
+
}
|
|
472
|
+
async function Wr(e) {
|
|
473
|
+
const n = await me(e), r = /* @__PURE__ */ new Set();
|
|
474
|
+
if (!n.sourceLanguage)
|
|
475
|
+
throw new Error('The xcstrings file is missing "sourceLanguage".');
|
|
476
|
+
r.add(n.sourceLanguage);
|
|
477
|
+
for (const i of Object.keys(n.strings)) {
|
|
478
|
+
const t = n.strings[i];
|
|
479
|
+
if (t.localizations)
|
|
480
|
+
for (const l of Object.keys(t.localizations))
|
|
481
|
+
r.add(l);
|
|
482
|
+
}
|
|
483
|
+
return Array.from(r).sort();
|
|
484
|
+
}
|
|
485
|
+
async function Rn(e, n) {
|
|
486
|
+
const { sourceLanguage: r } = await me(e);
|
|
487
|
+
if (!r)
|
|
488
|
+
throw new Error('The xcstrings file is missing "sourceLanguage".');
|
|
489
|
+
const i = await Ke(n);
|
|
490
|
+
if (i?.xcodeprojPaths && i.xcodeprojPaths.length > 0) {
|
|
491
|
+
const o = /* @__PURE__ */ new Set();
|
|
492
|
+
o.add(r);
|
|
493
|
+
for (const a of i.xcodeprojPaths)
|
|
494
|
+
Kr(a).forEach((u) => o.add(u));
|
|
495
|
+
return Array.from(o).sort();
|
|
496
|
+
}
|
|
497
|
+
const t = await Wr(e), l = new Set(t);
|
|
498
|
+
return l.add(r), Array.from(l).sort();
|
|
499
|
+
}
|
|
500
|
+
function Mn(e) {
|
|
614
501
|
return typeof e > "u" || e === null;
|
|
615
502
|
}
|
|
616
|
-
function
|
|
503
|
+
function Gr(e) {
|
|
617
504
|
return typeof e == "object" && e !== null;
|
|
618
505
|
}
|
|
619
|
-
function
|
|
620
|
-
return Array.isArray(e) ? e :
|
|
506
|
+
function qr(e) {
|
|
507
|
+
return Array.isArray(e) ? e : Mn(e) ? [] : [e];
|
|
621
508
|
}
|
|
622
|
-
function
|
|
623
|
-
var
|
|
509
|
+
function Vr(e, n) {
|
|
510
|
+
var r, i, t, l;
|
|
624
511
|
if (n)
|
|
625
|
-
for (
|
|
626
|
-
|
|
512
|
+
for (l = Object.keys(n), r = 0, i = l.length; r < i; r += 1)
|
|
513
|
+
t = l[r], e[t] = n[t];
|
|
627
514
|
return e;
|
|
628
515
|
}
|
|
629
|
-
function
|
|
630
|
-
var
|
|
631
|
-
for (
|
|
632
|
-
|
|
633
|
-
return
|
|
516
|
+
function Xr(e, n) {
|
|
517
|
+
var r = "", i;
|
|
518
|
+
for (i = 0; i < n; i += 1)
|
|
519
|
+
r += e;
|
|
520
|
+
return r;
|
|
634
521
|
}
|
|
635
|
-
function
|
|
522
|
+
function Qr(e) {
|
|
636
523
|
return e === 0 && Number.NEGATIVE_INFINITY === 1 / e;
|
|
637
524
|
}
|
|
638
|
-
var
|
|
639
|
-
isNothing:
|
|
640
|
-
isObject:
|
|
641
|
-
toArray:
|
|
642
|
-
repeat:
|
|
643
|
-
isNegativeZero:
|
|
644
|
-
extend:
|
|
525
|
+
var Jr = Mn, Zr = Gr, ei = qr, ni = Xr, ri = Qr, ii = Vr, F = {
|
|
526
|
+
isNothing: Jr,
|
|
527
|
+
isObject: Zr,
|
|
528
|
+
toArray: ei,
|
|
529
|
+
repeat: ni,
|
|
530
|
+
isNegativeZero: ri,
|
|
531
|
+
extend: ii
|
|
645
532
|
};
|
|
646
|
-
function
|
|
647
|
-
var
|
|
648
|
-
return e.mark ? (e.mark.name && (
|
|
533
|
+
function Pn(e, n) {
|
|
534
|
+
var r = "", i = e.reason || "(unknown reason)";
|
|
535
|
+
return e.mark ? (e.mark.name && (r += 'in "' + e.mark.name + '" '), r += "(" + (e.mark.line + 1) + ":" + (e.mark.column + 1) + ")", !n && e.mark.snippet && (r += `
|
|
649
536
|
|
|
650
|
-
` + e.mark.snippet),
|
|
537
|
+
` + e.mark.snippet), i + " " + r) : i;
|
|
651
538
|
}
|
|
652
|
-
function
|
|
653
|
-
Error.call(this), this.name = "YAMLException", this.reason = e, this.mark = n, this.message =
|
|
539
|
+
function fe(e, n) {
|
|
540
|
+
Error.call(this), this.name = "YAMLException", this.reason = e, this.mark = n, this.message = Pn(this, !1), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack || "";
|
|
654
541
|
}
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
return this.name + ": " +
|
|
542
|
+
fe.prototype = Object.create(Error.prototype);
|
|
543
|
+
fe.prototype.constructor = fe;
|
|
544
|
+
fe.prototype.toString = function(n) {
|
|
545
|
+
return this.name + ": " + Pn(this, n);
|
|
659
546
|
};
|
|
660
|
-
var I =
|
|
661
|
-
function
|
|
662
|
-
var
|
|
663
|
-
return
|
|
664
|
-
str:
|
|
665
|
-
pos:
|
|
547
|
+
var I = fe;
|
|
548
|
+
function Ne(e, n, r, i, t) {
|
|
549
|
+
var l = "", o = "", a = Math.floor(t / 2) - 1;
|
|
550
|
+
return i - n > a && (l = " ... ", n = i - a + l.length), r - i > a && (o = " ...", r = i + a - o.length), {
|
|
551
|
+
str: l + e.slice(n, r).replace(/\t/g, "→") + o,
|
|
552
|
+
pos: i - n + l.length
|
|
666
553
|
// relative position
|
|
667
554
|
};
|
|
668
555
|
}
|
|
669
|
-
function
|
|
556
|
+
function Re(e, n) {
|
|
670
557
|
return F.repeat(" ", n - e.length) + e;
|
|
671
558
|
}
|
|
672
|
-
function
|
|
559
|
+
function ti(e, n) {
|
|
673
560
|
if (n = Object.create(n || null), !e.buffer) return null;
|
|
674
561
|
n.maxLength || (n.maxLength = 79), typeof n.indent != "number" && (n.indent = 1), typeof n.linesBefore != "number" && (n.linesBefore = 3), typeof n.linesAfter != "number" && (n.linesAfter = 2);
|
|
675
|
-
for (var
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
var a = "", c, u, s = Math.min(e.line + n.linesAfter,
|
|
679
|
-
for (c = 1; c <= n.linesBefore && !(
|
|
680
|
-
u =
|
|
562
|
+
for (var r = /\r?\n|\r|\0/g, i = [0], t = [], l, o = -1; l = r.exec(e.buffer); )
|
|
563
|
+
t.push(l.index), i.push(l.index + l[0].length), e.position <= l.index && o < 0 && (o = i.length - 2);
|
|
564
|
+
o < 0 && (o = i.length - 1);
|
|
565
|
+
var a = "", c, u, s = Math.min(e.line + n.linesAfter, t.length).toString().length, f = n.maxLength - (n.indent + s + 3);
|
|
566
|
+
for (c = 1; c <= n.linesBefore && !(o - c < 0); c++)
|
|
567
|
+
u = Ne(
|
|
681
568
|
e.buffer,
|
|
682
|
-
|
|
683
|
-
o
|
|
684
|
-
e.position - (
|
|
685
|
-
|
|
686
|
-
), a = F.repeat(" ", n.indent) +
|
|
569
|
+
i[o - c],
|
|
570
|
+
t[o - c],
|
|
571
|
+
e.position - (i[o] - i[o - c]),
|
|
572
|
+
f
|
|
573
|
+
), a = F.repeat(" ", n.indent) + Re((e.line - c + 1).toString(), s) + " | " + u.str + `
|
|
687
574
|
` + a;
|
|
688
|
-
for (u =
|
|
575
|
+
for (u = Ne(e.buffer, i[o], t[o], e.position, f), a += F.repeat(" ", n.indent) + Re((e.line + 1).toString(), s) + " | " + u.str + `
|
|
689
576
|
`, a += F.repeat("-", n.indent + s + 3 + u.pos) + `^
|
|
690
|
-
`, c = 1; c <= n.linesAfter && !(
|
|
691
|
-
u =
|
|
577
|
+
`, c = 1; c <= n.linesAfter && !(o + c >= t.length); c++)
|
|
578
|
+
u = Ne(
|
|
692
579
|
e.buffer,
|
|
693
|
-
|
|
694
|
-
o
|
|
695
|
-
e.position - (
|
|
696
|
-
|
|
697
|
-
), a += F.repeat(" ", n.indent) +
|
|
580
|
+
i[o + c],
|
|
581
|
+
t[o + c],
|
|
582
|
+
e.position - (i[o] - i[o + c]),
|
|
583
|
+
f
|
|
584
|
+
), a += F.repeat(" ", n.indent) + Re((e.line + c + 1).toString(), s) + " | " + u.str + `
|
|
698
585
|
`;
|
|
699
586
|
return a.replace(/\n$/, "");
|
|
700
587
|
}
|
|
701
|
-
var
|
|
588
|
+
var oi = ti, li = [
|
|
702
589
|
"kind",
|
|
703
590
|
"multi",
|
|
704
591
|
"resolve",
|
|
@@ -709,41 +596,41 @@ var Qi = Xi, Ji = [
|
|
|
709
596
|
"representName",
|
|
710
597
|
"defaultStyle",
|
|
711
598
|
"styleAliases"
|
|
712
|
-
],
|
|
599
|
+
], ai = [
|
|
713
600
|
"scalar",
|
|
714
601
|
"sequence",
|
|
715
602
|
"mapping"
|
|
716
603
|
];
|
|
717
|
-
function
|
|
604
|
+
function ci(e) {
|
|
718
605
|
var n = {};
|
|
719
|
-
return e !== null && Object.keys(e).forEach(function(
|
|
720
|
-
e[
|
|
721
|
-
n[String(
|
|
606
|
+
return e !== null && Object.keys(e).forEach(function(r) {
|
|
607
|
+
e[r].forEach(function(i) {
|
|
608
|
+
n[String(i)] = r;
|
|
722
609
|
});
|
|
723
610
|
}), n;
|
|
724
611
|
}
|
|
725
|
-
function
|
|
726
|
-
if (n = n || {}, Object.keys(n).forEach(function(
|
|
727
|
-
if (
|
|
728
|
-
throw new I('Unknown option "' +
|
|
612
|
+
function ui(e, n) {
|
|
613
|
+
if (n = n || {}, Object.keys(n).forEach(function(r) {
|
|
614
|
+
if (li.indexOf(r) === -1)
|
|
615
|
+
throw new I('Unknown option "' + r + '" is met in definition of "' + e + '" YAML type.');
|
|
729
616
|
}), this.options = n, this.tag = e, this.kind = n.kind || null, this.resolve = n.resolve || function() {
|
|
730
617
|
return !0;
|
|
731
|
-
}, this.construct = n.construct || function(
|
|
732
|
-
return
|
|
733
|
-
}, this.instanceOf = n.instanceOf || null, this.predicate = n.predicate || null, this.represent = n.represent || null, this.representName = n.representName || null, this.defaultStyle = n.defaultStyle || null, this.multi = n.multi || !1, this.styleAliases =
|
|
618
|
+
}, this.construct = n.construct || function(r) {
|
|
619
|
+
return r;
|
|
620
|
+
}, this.instanceOf = n.instanceOf || null, this.predicate = n.predicate || null, this.represent = n.represent || null, this.representName = n.representName || null, this.defaultStyle = n.defaultStyle || null, this.multi = n.multi || !1, this.styleAliases = ci(n.styleAliases || null), ai.indexOf(this.kind) === -1)
|
|
734
621
|
throw new I('Unknown kind "' + this.kind + '" is specified for "' + e + '" YAML type.');
|
|
735
622
|
}
|
|
736
|
-
var
|
|
737
|
-
function
|
|
738
|
-
var
|
|
739
|
-
return e[n].forEach(function(
|
|
740
|
-
var
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
}),
|
|
744
|
-
}),
|
|
745
|
-
}
|
|
746
|
-
function
|
|
623
|
+
var T = ui;
|
|
624
|
+
function fn(e, n) {
|
|
625
|
+
var r = [];
|
|
626
|
+
return e[n].forEach(function(i) {
|
|
627
|
+
var t = r.length;
|
|
628
|
+
r.forEach(function(l, o) {
|
|
629
|
+
l.tag === i.tag && l.kind === i.kind && l.multi === i.multi && (t = o);
|
|
630
|
+
}), r[t] = i;
|
|
631
|
+
}), r;
|
|
632
|
+
}
|
|
633
|
+
function si() {
|
|
747
634
|
var e = {
|
|
748
635
|
scalar: {},
|
|
749
636
|
sequence: {},
|
|
@@ -755,79 +642,79 @@ function ir() {
|
|
|
755
642
|
mapping: [],
|
|
756
643
|
fallback: []
|
|
757
644
|
}
|
|
758
|
-
}, n,
|
|
759
|
-
function
|
|
760
|
-
|
|
645
|
+
}, n, r;
|
|
646
|
+
function i(t) {
|
|
647
|
+
t.multi ? (e.multi[t.kind].push(t), e.multi.fallback.push(t)) : e[t.kind][t.tag] = e.fallback[t.tag] = t;
|
|
761
648
|
}
|
|
762
|
-
for (n = 0,
|
|
763
|
-
arguments[n].forEach(
|
|
649
|
+
for (n = 0, r = arguments.length; n < r; n += 1)
|
|
650
|
+
arguments[n].forEach(i);
|
|
764
651
|
return e;
|
|
765
652
|
}
|
|
766
|
-
function
|
|
653
|
+
function Ue(e) {
|
|
767
654
|
return this.extend(e);
|
|
768
655
|
}
|
|
769
|
-
|
|
770
|
-
var
|
|
771
|
-
if (n instanceof
|
|
772
|
-
|
|
656
|
+
Ue.prototype.extend = function(n) {
|
|
657
|
+
var r = [], i = [];
|
|
658
|
+
if (n instanceof T)
|
|
659
|
+
i.push(n);
|
|
773
660
|
else if (Array.isArray(n))
|
|
774
|
-
|
|
661
|
+
i = i.concat(n);
|
|
775
662
|
else if (n && (Array.isArray(n.implicit) || Array.isArray(n.explicit)))
|
|
776
|
-
n.implicit && (
|
|
663
|
+
n.implicit && (r = r.concat(n.implicit)), n.explicit && (i = i.concat(n.explicit));
|
|
777
664
|
else
|
|
778
665
|
throw new I("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
|
|
779
|
-
|
|
780
|
-
if (!(
|
|
666
|
+
r.forEach(function(l) {
|
|
667
|
+
if (!(l instanceof T))
|
|
781
668
|
throw new I("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
782
|
-
if (
|
|
669
|
+
if (l.loadKind && l.loadKind !== "scalar")
|
|
783
670
|
throw new I("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
|
|
784
|
-
if (
|
|
671
|
+
if (l.multi)
|
|
785
672
|
throw new I("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
|
|
786
|
-
}),
|
|
787
|
-
if (!(
|
|
673
|
+
}), i.forEach(function(l) {
|
|
674
|
+
if (!(l instanceof T))
|
|
788
675
|
throw new I("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
789
676
|
});
|
|
790
|
-
var
|
|
791
|
-
return
|
|
677
|
+
var t = Object.create(Ue.prototype);
|
|
678
|
+
return t.implicit = (this.implicit || []).concat(r), t.explicit = (this.explicit || []).concat(i), t.compiledImplicit = fn(t, "implicit"), t.compiledExplicit = fn(t, "explicit"), t.compiledTypeMap = si(t.compiledImplicit, t.compiledExplicit), t;
|
|
792
679
|
};
|
|
793
|
-
var
|
|
680
|
+
var Dn = Ue, Bn = new T("tag:yaml.org,2002:str", {
|
|
794
681
|
kind: "scalar",
|
|
795
682
|
construct: function(e) {
|
|
796
683
|
return e !== null ? e : "";
|
|
797
684
|
}
|
|
798
|
-
}),
|
|
685
|
+
}), Un = new T("tag:yaml.org,2002:seq", {
|
|
799
686
|
kind: "sequence",
|
|
800
687
|
construct: function(e) {
|
|
801
688
|
return e !== null ? e : [];
|
|
802
689
|
}
|
|
803
|
-
}),
|
|
690
|
+
}), Yn = new T("tag:yaml.org,2002:map", {
|
|
804
691
|
kind: "mapping",
|
|
805
692
|
construct: function(e) {
|
|
806
693
|
return e !== null ? e : {};
|
|
807
694
|
}
|
|
808
|
-
}),
|
|
695
|
+
}), zn = new Dn({
|
|
809
696
|
explicit: [
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
697
|
+
Bn,
|
|
698
|
+
Un,
|
|
699
|
+
Yn
|
|
813
700
|
]
|
|
814
701
|
});
|
|
815
|
-
function
|
|
702
|
+
function fi(e) {
|
|
816
703
|
if (e === null) return !0;
|
|
817
704
|
var n = e.length;
|
|
818
705
|
return n === 1 && e === "~" || n === 4 && (e === "null" || e === "Null" || e === "NULL");
|
|
819
706
|
}
|
|
820
|
-
function
|
|
707
|
+
function pi() {
|
|
821
708
|
return null;
|
|
822
709
|
}
|
|
823
|
-
function
|
|
710
|
+
function hi(e) {
|
|
824
711
|
return e === null;
|
|
825
712
|
}
|
|
826
|
-
var
|
|
713
|
+
var $n = new T("tag:yaml.org,2002:null", {
|
|
827
714
|
kind: "scalar",
|
|
828
|
-
resolve:
|
|
829
|
-
construct:
|
|
830
|
-
predicate:
|
|
715
|
+
resolve: fi,
|
|
716
|
+
construct: pi,
|
|
717
|
+
predicate: hi,
|
|
831
718
|
represent: {
|
|
832
719
|
canonical: function() {
|
|
833
720
|
return "~";
|
|
@@ -847,22 +734,22 @@ var kn = new k("tag:yaml.org,2002:null", {
|
|
|
847
734
|
},
|
|
848
735
|
defaultStyle: "lowercase"
|
|
849
736
|
});
|
|
850
|
-
function
|
|
737
|
+
function di(e) {
|
|
851
738
|
if (e === null) return !1;
|
|
852
739
|
var n = e.length;
|
|
853
740
|
return n === 4 && (e === "true" || e === "True" || e === "TRUE") || n === 5 && (e === "false" || e === "False" || e === "FALSE");
|
|
854
741
|
}
|
|
855
|
-
function
|
|
742
|
+
function gi(e) {
|
|
856
743
|
return e === "true" || e === "True" || e === "TRUE";
|
|
857
744
|
}
|
|
858
|
-
function
|
|
745
|
+
function mi(e) {
|
|
859
746
|
return Object.prototype.toString.call(e) === "[object Boolean]";
|
|
860
747
|
}
|
|
861
|
-
var
|
|
748
|
+
var Hn = new T("tag:yaml.org,2002:bool", {
|
|
862
749
|
kind: "scalar",
|
|
863
|
-
resolve:
|
|
864
|
-
construct:
|
|
865
|
-
predicate:
|
|
750
|
+
resolve: di,
|
|
751
|
+
construct: gi,
|
|
752
|
+
predicate: mi,
|
|
866
753
|
represent: {
|
|
867
754
|
lowercase: function(e) {
|
|
868
755
|
return e ? "true" : "false";
|
|
@@ -876,73 +763,73 @@ var Tn = new k("tag:yaml.org,2002:bool", {
|
|
|
876
763
|
},
|
|
877
764
|
defaultStyle: "lowercase"
|
|
878
765
|
});
|
|
879
|
-
function
|
|
766
|
+
function yi(e) {
|
|
880
767
|
return 48 <= e && e <= 57 || 65 <= e && e <= 70 || 97 <= e && e <= 102;
|
|
881
768
|
}
|
|
882
|
-
function
|
|
769
|
+
function xi(e) {
|
|
883
770
|
return 48 <= e && e <= 55;
|
|
884
771
|
}
|
|
885
|
-
function
|
|
772
|
+
function vi(e) {
|
|
886
773
|
return 48 <= e && e <= 57;
|
|
887
774
|
}
|
|
888
|
-
function
|
|
775
|
+
function bi(e) {
|
|
889
776
|
if (e === null) return !1;
|
|
890
|
-
var n = e.length,
|
|
777
|
+
var n = e.length, r = 0, i = !1, t;
|
|
891
778
|
if (!n) return !1;
|
|
892
|
-
if (
|
|
893
|
-
if (
|
|
894
|
-
if (
|
|
895
|
-
for (
|
|
896
|
-
if (
|
|
897
|
-
if (
|
|
898
|
-
|
|
779
|
+
if (t = e[r], (t === "-" || t === "+") && (t = e[++r]), t === "0") {
|
|
780
|
+
if (r + 1 === n) return !0;
|
|
781
|
+
if (t = e[++r], t === "b") {
|
|
782
|
+
for (r++; r < n; r++)
|
|
783
|
+
if (t = e[r], t !== "_") {
|
|
784
|
+
if (t !== "0" && t !== "1") return !1;
|
|
785
|
+
i = !0;
|
|
899
786
|
}
|
|
900
|
-
return
|
|
787
|
+
return i && t !== "_";
|
|
901
788
|
}
|
|
902
|
-
if (
|
|
903
|
-
for (
|
|
904
|
-
if (
|
|
905
|
-
if (!
|
|
906
|
-
|
|
789
|
+
if (t === "x") {
|
|
790
|
+
for (r++; r < n; r++)
|
|
791
|
+
if (t = e[r], t !== "_") {
|
|
792
|
+
if (!yi(e.charCodeAt(r))) return !1;
|
|
793
|
+
i = !0;
|
|
907
794
|
}
|
|
908
|
-
return
|
|
795
|
+
return i && t !== "_";
|
|
909
796
|
}
|
|
910
|
-
if (
|
|
911
|
-
for (
|
|
912
|
-
if (
|
|
913
|
-
if (!
|
|
914
|
-
|
|
797
|
+
if (t === "o") {
|
|
798
|
+
for (r++; r < n; r++)
|
|
799
|
+
if (t = e[r], t !== "_") {
|
|
800
|
+
if (!xi(e.charCodeAt(r))) return !1;
|
|
801
|
+
i = !0;
|
|
915
802
|
}
|
|
916
|
-
return
|
|
803
|
+
return i && t !== "_";
|
|
917
804
|
}
|
|
918
805
|
}
|
|
919
|
-
if (
|
|
920
|
-
for (;
|
|
921
|
-
if (
|
|
922
|
-
if (!
|
|
806
|
+
if (t === "_") return !1;
|
|
807
|
+
for (; r < n; r++)
|
|
808
|
+
if (t = e[r], t !== "_") {
|
|
809
|
+
if (!vi(e.charCodeAt(r)))
|
|
923
810
|
return !1;
|
|
924
|
-
|
|
811
|
+
i = !0;
|
|
925
812
|
}
|
|
926
|
-
return !(!
|
|
813
|
+
return !(!i || t === "_");
|
|
927
814
|
}
|
|
928
|
-
function
|
|
929
|
-
var n = e,
|
|
930
|
-
if (n.indexOf("_") !== -1 && (n = n.replace(/_/g, "")),
|
|
931
|
-
if (
|
|
932
|
-
if (n[1] === "b") return
|
|
933
|
-
if (n[1] === "x") return
|
|
934
|
-
if (n[1] === "o") return
|
|
815
|
+
function wi(e) {
|
|
816
|
+
var n = e, r = 1, i;
|
|
817
|
+
if (n.indexOf("_") !== -1 && (n = n.replace(/_/g, "")), i = n[0], (i === "-" || i === "+") && (i === "-" && (r = -1), n = n.slice(1), i = n[0]), n === "0") return 0;
|
|
818
|
+
if (i === "0") {
|
|
819
|
+
if (n[1] === "b") return r * parseInt(n.slice(2), 2);
|
|
820
|
+
if (n[1] === "x") return r * parseInt(n.slice(2), 16);
|
|
821
|
+
if (n[1] === "o") return r * parseInt(n.slice(2), 8);
|
|
935
822
|
}
|
|
936
|
-
return
|
|
823
|
+
return r * parseInt(n, 10);
|
|
937
824
|
}
|
|
938
|
-
function
|
|
825
|
+
function Ai(e) {
|
|
939
826
|
return Object.prototype.toString.call(e) === "[object Number]" && e % 1 === 0 && !F.isNegativeZero(e);
|
|
940
827
|
}
|
|
941
|
-
var
|
|
828
|
+
var Kn = new T("tag:yaml.org,2002:int", {
|
|
942
829
|
kind: "scalar",
|
|
943
|
-
resolve:
|
|
944
|
-
construct:
|
|
945
|
-
predicate:
|
|
830
|
+
resolve: bi,
|
|
831
|
+
construct: wi,
|
|
832
|
+
predicate: Ai,
|
|
946
833
|
represent: {
|
|
947
834
|
binary: function(e) {
|
|
948
835
|
return e >= 0 ? "0b" + e.toString(2) : "-0b" + e.toString(2).slice(1);
|
|
@@ -965,22 +852,22 @@ var jn = new k("tag:yaml.org,2002:int", {
|
|
|
965
852
|
decimal: [10, "dec"],
|
|
966
853
|
hexadecimal: [16, "hex"]
|
|
967
854
|
}
|
|
968
|
-
}),
|
|
855
|
+
}), Ci = new RegExp(
|
|
969
856
|
// 2.5e4, 2.5 and integers
|
|
970
857
|
"^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"
|
|
971
858
|
);
|
|
972
|
-
function
|
|
973
|
-
return !(e === null || !
|
|
859
|
+
function Ei(e) {
|
|
860
|
+
return !(e === null || !Ci.test(e) || // Quick hack to not allow integers end with `_`
|
|
974
861
|
// Probably should update regexp & check speed
|
|
975
862
|
e[e.length - 1] === "_");
|
|
976
863
|
}
|
|
977
|
-
function
|
|
978
|
-
var n,
|
|
979
|
-
return n = e.replace(/_/g, "").toLowerCase(),
|
|
864
|
+
function Si(e) {
|
|
865
|
+
var n, r;
|
|
866
|
+
return n = e.replace(/_/g, "").toLowerCase(), r = n[0] === "-" ? -1 : 1, "+-".indexOf(n[0]) >= 0 && (n = n.slice(1)), n === ".inf" ? r === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY : n === ".nan" ? NaN : r * parseFloat(n, 10);
|
|
980
867
|
}
|
|
981
|
-
var
|
|
982
|
-
function
|
|
983
|
-
var
|
|
868
|
+
var _i = /^[-+]?[0-9]+e/;
|
|
869
|
+
function ki(e, n) {
|
|
870
|
+
var r;
|
|
984
871
|
if (isNaN(e))
|
|
985
872
|
switch (n) {
|
|
986
873
|
case "lowercase":
|
|
@@ -1010,217 +897,217 @@ function yr(e, n) {
|
|
|
1010
897
|
}
|
|
1011
898
|
else if (F.isNegativeZero(e))
|
|
1012
899
|
return "-0.0";
|
|
1013
|
-
return
|
|
900
|
+
return r = e.toString(10), _i.test(r) ? r.replace("e", ".e") : r;
|
|
1014
901
|
}
|
|
1015
|
-
function
|
|
902
|
+
function Oi(e) {
|
|
1016
903
|
return Object.prototype.toString.call(e) === "[object Number]" && (e % 1 !== 0 || F.isNegativeZero(e));
|
|
1017
904
|
}
|
|
1018
|
-
var
|
|
905
|
+
var Wn = new T("tag:yaml.org,2002:float", {
|
|
1019
906
|
kind: "scalar",
|
|
1020
|
-
resolve:
|
|
1021
|
-
construct:
|
|
1022
|
-
predicate:
|
|
1023
|
-
represent:
|
|
907
|
+
resolve: Ei,
|
|
908
|
+
construct: Si,
|
|
909
|
+
predicate: Oi,
|
|
910
|
+
represent: ki,
|
|
1024
911
|
defaultStyle: "lowercase"
|
|
1025
|
-
}),
|
|
912
|
+
}), Gn = zn.extend({
|
|
1026
913
|
implicit: [
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
914
|
+
$n,
|
|
915
|
+
Hn,
|
|
916
|
+
Kn,
|
|
917
|
+
Wn
|
|
1031
918
|
]
|
|
1032
|
-
}),
|
|
919
|
+
}), qn = Gn, Vn = new RegExp(
|
|
1033
920
|
"^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"
|
|
1034
|
-
),
|
|
921
|
+
), Xn = new RegExp(
|
|
1035
922
|
"^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$"
|
|
1036
923
|
);
|
|
1037
|
-
function
|
|
1038
|
-
return e === null ? !1 :
|
|
1039
|
-
}
|
|
1040
|
-
function
|
|
1041
|
-
var n,
|
|
1042
|
-
if (n =
|
|
1043
|
-
if (
|
|
1044
|
-
return new Date(Date.UTC(
|
|
1045
|
-
if (
|
|
924
|
+
function Fi(e) {
|
|
925
|
+
return e === null ? !1 : Vn.exec(e) !== null || Xn.exec(e) !== null;
|
|
926
|
+
}
|
|
927
|
+
function Ti(e) {
|
|
928
|
+
var n, r, i, t, l, o, a, c = 0, u = null, s, f, g;
|
|
929
|
+
if (n = Vn.exec(e), n === null && (n = Xn.exec(e)), n === null) throw new Error("Date resolve error");
|
|
930
|
+
if (r = +n[1], i = +n[2] - 1, t = +n[3], !n[4])
|
|
931
|
+
return new Date(Date.UTC(r, i, t));
|
|
932
|
+
if (l = +n[4], o = +n[5], a = +n[6], n[7]) {
|
|
1046
933
|
for (c = n[7].slice(0, 3); c.length < 3; )
|
|
1047
934
|
c += "0";
|
|
1048
935
|
c = +c;
|
|
1049
936
|
}
|
|
1050
|
-
return n[9] && (s = +n[10],
|
|
937
|
+
return n[9] && (s = +n[10], f = +(n[11] || 0), u = (s * 60 + f) * 6e4, n[9] === "-" && (u = -u)), g = new Date(Date.UTC(r, i, t, l, o, a, c)), u && g.setTime(g.getTime() - u), g;
|
|
1051
938
|
}
|
|
1052
|
-
function
|
|
939
|
+
function Li(e) {
|
|
1053
940
|
return e.toISOString();
|
|
1054
941
|
}
|
|
1055
|
-
var
|
|
942
|
+
var Qn = new T("tag:yaml.org,2002:timestamp", {
|
|
1056
943
|
kind: "scalar",
|
|
1057
|
-
resolve:
|
|
1058
|
-
construct:
|
|
944
|
+
resolve: Fi,
|
|
945
|
+
construct: Ti,
|
|
1059
946
|
instanceOf: Date,
|
|
1060
|
-
represent:
|
|
947
|
+
represent: Li
|
|
1061
948
|
});
|
|
1062
|
-
function
|
|
949
|
+
function ji(e) {
|
|
1063
950
|
return e === "<<" || e === null;
|
|
1064
951
|
}
|
|
1065
|
-
var
|
|
952
|
+
var Jn = new T("tag:yaml.org,2002:merge", {
|
|
1066
953
|
kind: "scalar",
|
|
1067
|
-
resolve:
|
|
1068
|
-
}),
|
|
954
|
+
resolve: ji
|
|
955
|
+
}), We = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
1069
956
|
\r`;
|
|
1070
|
-
function
|
|
957
|
+
function Ii(e) {
|
|
1071
958
|
if (e === null) return !1;
|
|
1072
|
-
var n,
|
|
1073
|
-
for (
|
|
1074
|
-
if (n =
|
|
959
|
+
var n, r, i = 0, t = e.length, l = We;
|
|
960
|
+
for (r = 0; r < t; r++)
|
|
961
|
+
if (n = l.indexOf(e.charAt(r)), !(n > 64)) {
|
|
1075
962
|
if (n < 0) return !1;
|
|
1076
|
-
|
|
963
|
+
i += 6;
|
|
1077
964
|
}
|
|
1078
|
-
return
|
|
1079
|
-
}
|
|
1080
|
-
function Er(e) {
|
|
1081
|
-
var n, i, r = e.replace(/[\r\n=]/g, ""), o = r.length, t = Me, l = 0, a = [];
|
|
1082
|
-
for (n = 0; n < o; n++)
|
|
1083
|
-
n % 4 === 0 && n && (a.push(l >> 16 & 255), a.push(l >> 8 & 255), a.push(l & 255)), l = l << 6 | t.indexOf(r.charAt(n));
|
|
1084
|
-
return i = o % 4 * 6, i === 0 ? (a.push(l >> 16 & 255), a.push(l >> 8 & 255), a.push(l & 255)) : i === 18 ? (a.push(l >> 10 & 255), a.push(l >> 2 & 255)) : i === 12 && a.push(l >> 4 & 255), new Uint8Array(a);
|
|
1085
|
-
}
|
|
1086
|
-
function Or(e) {
|
|
1087
|
-
var n = "", i = 0, r, o, t = e.length, l = Me;
|
|
1088
|
-
for (r = 0; r < t; r++)
|
|
1089
|
-
r % 3 === 0 && r && (n += l[i >> 18 & 63], n += l[i >> 12 & 63], n += l[i >> 6 & 63], n += l[i & 63]), i = (i << 8) + e[r];
|
|
1090
|
-
return o = t % 3, o === 0 ? (n += l[i >> 18 & 63], n += l[i >> 12 & 63], n += l[i >> 6 & 63], n += l[i & 63]) : o === 2 ? (n += l[i >> 10 & 63], n += l[i >> 4 & 63], n += l[i << 2 & 63], n += l[64]) : o === 1 && (n += l[i >> 2 & 63], n += l[i << 4 & 63], n += l[64], n += l[64]), n;
|
|
965
|
+
return i % 8 === 0;
|
|
1091
966
|
}
|
|
1092
|
-
function
|
|
967
|
+
function Ni(e) {
|
|
968
|
+
var n, r, i = e.replace(/[\r\n=]/g, ""), t = i.length, l = We, o = 0, a = [];
|
|
969
|
+
for (n = 0; n < t; n++)
|
|
970
|
+
n % 4 === 0 && n && (a.push(o >> 16 & 255), a.push(o >> 8 & 255), a.push(o & 255)), o = o << 6 | l.indexOf(i.charAt(n));
|
|
971
|
+
return r = t % 4 * 6, r === 0 ? (a.push(o >> 16 & 255), a.push(o >> 8 & 255), a.push(o & 255)) : r === 18 ? (a.push(o >> 10 & 255), a.push(o >> 2 & 255)) : r === 12 && a.push(o >> 4 & 255), new Uint8Array(a);
|
|
972
|
+
}
|
|
973
|
+
function Ri(e) {
|
|
974
|
+
var n = "", r = 0, i, t, l = e.length, o = We;
|
|
975
|
+
for (i = 0; i < l; i++)
|
|
976
|
+
i % 3 === 0 && i && (n += o[r >> 18 & 63], n += o[r >> 12 & 63], n += o[r >> 6 & 63], n += o[r & 63]), r = (r << 8) + e[i];
|
|
977
|
+
return t = l % 3, t === 0 ? (n += o[r >> 18 & 63], n += o[r >> 12 & 63], n += o[r >> 6 & 63], n += o[r & 63]) : t === 2 ? (n += o[r >> 10 & 63], n += o[r >> 4 & 63], n += o[r << 2 & 63], n += o[64]) : t === 1 && (n += o[r >> 2 & 63], n += o[r << 4 & 63], n += o[64], n += o[64]), n;
|
|
978
|
+
}
|
|
979
|
+
function Mi(e) {
|
|
1093
980
|
return Object.prototype.toString.call(e) === "[object Uint8Array]";
|
|
1094
981
|
}
|
|
1095
|
-
var
|
|
982
|
+
var Zn = new T("tag:yaml.org,2002:binary", {
|
|
1096
983
|
kind: "scalar",
|
|
1097
|
-
resolve:
|
|
1098
|
-
construct:
|
|
1099
|
-
predicate:
|
|
1100
|
-
represent:
|
|
1101
|
-
}),
|
|
1102
|
-
function
|
|
984
|
+
resolve: Ii,
|
|
985
|
+
construct: Ni,
|
|
986
|
+
predicate: Mi,
|
|
987
|
+
represent: Ri
|
|
988
|
+
}), Pi = Object.prototype.hasOwnProperty, Di = Object.prototype.toString;
|
|
989
|
+
function Bi(e) {
|
|
1103
990
|
if (e === null) return !0;
|
|
1104
|
-
var n = [],
|
|
1105
|
-
for (
|
|
1106
|
-
if (
|
|
1107
|
-
for (
|
|
1108
|
-
if (
|
|
1109
|
-
if (!
|
|
991
|
+
var n = [], r, i, t, l, o, a = e;
|
|
992
|
+
for (r = 0, i = a.length; r < i; r += 1) {
|
|
993
|
+
if (t = a[r], o = !1, Di.call(t) !== "[object Object]") return !1;
|
|
994
|
+
for (l in t)
|
|
995
|
+
if (Pi.call(t, l))
|
|
996
|
+
if (!o) o = !0;
|
|
1110
997
|
else return !1;
|
|
1111
|
-
if (!
|
|
1112
|
-
if (n.indexOf(
|
|
998
|
+
if (!o) return !1;
|
|
999
|
+
if (n.indexOf(l) === -1) n.push(l);
|
|
1113
1000
|
else return !1;
|
|
1114
1001
|
}
|
|
1115
1002
|
return !0;
|
|
1116
1003
|
}
|
|
1117
|
-
function
|
|
1004
|
+
function Ui(e) {
|
|
1118
1005
|
return e !== null ? e : [];
|
|
1119
1006
|
}
|
|
1120
|
-
var
|
|
1007
|
+
var er = new T("tag:yaml.org,2002:omap", {
|
|
1121
1008
|
kind: "sequence",
|
|
1122
|
-
resolve:
|
|
1123
|
-
construct:
|
|
1124
|
-
}),
|
|
1125
|
-
function
|
|
1009
|
+
resolve: Bi,
|
|
1010
|
+
construct: Ui
|
|
1011
|
+
}), Yi = Object.prototype.toString;
|
|
1012
|
+
function zi(e) {
|
|
1126
1013
|
if (e === null) return !0;
|
|
1127
|
-
var n,
|
|
1128
|
-
for (
|
|
1129
|
-
if (
|
|
1130
|
-
|
|
1014
|
+
var n, r, i, t, l, o = e;
|
|
1015
|
+
for (l = new Array(o.length), n = 0, r = o.length; n < r; n += 1) {
|
|
1016
|
+
if (i = o[n], Yi.call(i) !== "[object Object]" || (t = Object.keys(i), t.length !== 1)) return !1;
|
|
1017
|
+
l[n] = [t[0], i[t[0]]];
|
|
1131
1018
|
}
|
|
1132
1019
|
return !0;
|
|
1133
1020
|
}
|
|
1134
|
-
function
|
|
1021
|
+
function $i(e) {
|
|
1135
1022
|
if (e === null) return [];
|
|
1136
|
-
var n,
|
|
1137
|
-
for (
|
|
1138
|
-
|
|
1139
|
-
return
|
|
1023
|
+
var n, r, i, t, l, o = e;
|
|
1024
|
+
for (l = new Array(o.length), n = 0, r = o.length; n < r; n += 1)
|
|
1025
|
+
i = o[n], t = Object.keys(i), l[n] = [t[0], i[t[0]]];
|
|
1026
|
+
return l;
|
|
1140
1027
|
}
|
|
1141
|
-
var
|
|
1028
|
+
var nr = new T("tag:yaml.org,2002:pairs", {
|
|
1142
1029
|
kind: "sequence",
|
|
1143
|
-
resolve:
|
|
1144
|
-
construct:
|
|
1145
|
-
}),
|
|
1146
|
-
function
|
|
1030
|
+
resolve: zi,
|
|
1031
|
+
construct: $i
|
|
1032
|
+
}), Hi = Object.prototype.hasOwnProperty;
|
|
1033
|
+
function Ki(e) {
|
|
1147
1034
|
if (e === null) return !0;
|
|
1148
|
-
var n,
|
|
1149
|
-
for (n in
|
|
1150
|
-
if (
|
|
1035
|
+
var n, r = e;
|
|
1036
|
+
for (n in r)
|
|
1037
|
+
if (Hi.call(r, n) && r[n] !== null)
|
|
1151
1038
|
return !1;
|
|
1152
1039
|
return !0;
|
|
1153
1040
|
}
|
|
1154
|
-
function
|
|
1041
|
+
function Wi(e) {
|
|
1155
1042
|
return e !== null ? e : {};
|
|
1156
1043
|
}
|
|
1157
|
-
var
|
|
1044
|
+
var rr = new T("tag:yaml.org,2002:set", {
|
|
1158
1045
|
kind: "mapping",
|
|
1159
|
-
resolve:
|
|
1160
|
-
construct:
|
|
1161
|
-
}),
|
|
1046
|
+
resolve: Ki,
|
|
1047
|
+
construct: Wi
|
|
1048
|
+
}), Ge = qn.extend({
|
|
1162
1049
|
implicit: [
|
|
1163
|
-
|
|
1164
|
-
|
|
1050
|
+
Qn,
|
|
1051
|
+
Jn
|
|
1165
1052
|
],
|
|
1166
1053
|
explicit: [
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1054
|
+
Zn,
|
|
1055
|
+
er,
|
|
1056
|
+
nr,
|
|
1057
|
+
rr
|
|
1171
1058
|
]
|
|
1172
|
-
}),
|
|
1173
|
-
function
|
|
1059
|
+
}), q = Object.prototype.hasOwnProperty, Ee = 1, ir = 2, tr = 3, Se = 4, Me = 1, Gi = 2, pn = 3, qi = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/, Vi = /[\x85\u2028\u2029]/, Xi = /[,\[\]\{\}]/, or = /^(?:!|!!|![a-z\-]+!)$/i, lr = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
|
|
1060
|
+
function hn(e) {
|
|
1174
1061
|
return Object.prototype.toString.call(e);
|
|
1175
1062
|
}
|
|
1176
|
-
function
|
|
1063
|
+
function z(e) {
|
|
1177
1064
|
return e === 10 || e === 13;
|
|
1178
1065
|
}
|
|
1179
|
-
function
|
|
1066
|
+
function V(e) {
|
|
1180
1067
|
return e === 9 || e === 32;
|
|
1181
1068
|
}
|
|
1182
|
-
function
|
|
1069
|
+
function D(e) {
|
|
1183
1070
|
return e === 9 || e === 32 || e === 10 || e === 13;
|
|
1184
1071
|
}
|
|
1185
|
-
function
|
|
1072
|
+
function re(e) {
|
|
1186
1073
|
return e === 44 || e === 91 || e === 93 || e === 123 || e === 125;
|
|
1187
1074
|
}
|
|
1188
|
-
function
|
|
1075
|
+
function Qi(e) {
|
|
1189
1076
|
var n;
|
|
1190
1077
|
return 48 <= e && e <= 57 ? e - 48 : (n = e | 32, 97 <= n && n <= 102 ? n - 97 + 10 : -1);
|
|
1191
1078
|
}
|
|
1192
|
-
function
|
|
1079
|
+
function Ji(e) {
|
|
1193
1080
|
return e === 120 ? 2 : e === 117 ? 4 : e === 85 ? 8 : 0;
|
|
1194
1081
|
}
|
|
1195
|
-
function
|
|
1082
|
+
function Zi(e) {
|
|
1196
1083
|
return 48 <= e && e <= 57 ? e - 48 : -1;
|
|
1197
1084
|
}
|
|
1198
|
-
function
|
|
1085
|
+
function dn(e) {
|
|
1199
1086
|
return e === 48 ? "\0" : e === 97 ? "\x07" : e === 98 ? "\b" : e === 116 || e === 9 ? " " : e === 110 ? `
|
|
1200
1087
|
` : e === 118 ? "\v" : e === 102 ? "\f" : e === 114 ? "\r" : e === 101 ? "\x1B" : e === 32 ? " " : e === 34 ? '"' : e === 47 ? "/" : e === 92 ? "\\" : e === 78 ? "
" : e === 95 ? " " : e === 76 ? "\u2028" : e === 80 ? "\u2029" : "";
|
|
1201
1088
|
}
|
|
1202
|
-
function
|
|
1089
|
+
function et(e) {
|
|
1203
1090
|
return e <= 65535 ? String.fromCharCode(e) : String.fromCharCode(
|
|
1204
1091
|
(e - 65536 >> 10) + 55296,
|
|
1205
1092
|
(e - 65536 & 1023) + 56320
|
|
1206
1093
|
);
|
|
1207
1094
|
}
|
|
1208
|
-
function
|
|
1095
|
+
function ar(e, n, r) {
|
|
1209
1096
|
n === "__proto__" ? Object.defineProperty(e, n, {
|
|
1210
1097
|
configurable: !0,
|
|
1211
1098
|
enumerable: !0,
|
|
1212
1099
|
writable: !0,
|
|
1213
|
-
value:
|
|
1214
|
-
}) : e[n] =
|
|
1100
|
+
value: r
|
|
1101
|
+
}) : e[n] = r;
|
|
1215
1102
|
}
|
|
1216
|
-
var
|
|
1217
|
-
for (var
|
|
1218
|
-
|
|
1219
|
-
function
|
|
1220
|
-
this.input = e, this.filename = n.filename || null, this.schema = n.schema ||
|
|
1103
|
+
var cr = new Array(256), ur = new Array(256);
|
|
1104
|
+
for (var Z = 0; Z < 256; Z++)
|
|
1105
|
+
cr[Z] = dn(Z) ? 1 : 0, ur[Z] = dn(Z);
|
|
1106
|
+
function nt(e, n) {
|
|
1107
|
+
this.input = e, this.filename = n.filename || null, this.schema = n.schema || Ge, this.onWarning = n.onWarning || null, this.legacy = n.legacy || !1, this.json = n.json || !1, this.listener = n.listener || null, this.implicitTypes = this.schema.compiledImplicit, this.typeMap = this.schema.compiledTypeMap, this.length = e.length, this.position = 0, this.line = 0, this.lineStart = 0, this.lineIndent = 0, this.firstTabInLine = -1, this.documents = [];
|
|
1221
1108
|
}
|
|
1222
|
-
function
|
|
1223
|
-
var
|
|
1109
|
+
function sr(e, n) {
|
|
1110
|
+
var r = {
|
|
1224
1111
|
name: e.filename,
|
|
1225
1112
|
buffer: e.input.slice(0, -1),
|
|
1226
1113
|
// omit trailing \0
|
|
@@ -1228,395 +1115,395 @@ function Qn(e, n) {
|
|
|
1228
1115
|
line: e.line,
|
|
1229
1116
|
column: e.position - e.lineStart
|
|
1230
1117
|
};
|
|
1231
|
-
return
|
|
1118
|
+
return r.snippet = oi(r), new I(n, r);
|
|
1232
1119
|
}
|
|
1233
|
-
function
|
|
1234
|
-
throw
|
|
1120
|
+
function y(e, n) {
|
|
1121
|
+
throw sr(e, n);
|
|
1235
1122
|
}
|
|
1236
|
-
function
|
|
1237
|
-
e.onWarning && e.onWarning.call(null,
|
|
1123
|
+
function _e(e, n) {
|
|
1124
|
+
e.onWarning && e.onWarning.call(null, sr(e, n));
|
|
1238
1125
|
}
|
|
1239
|
-
var
|
|
1240
|
-
YAML: function(n,
|
|
1241
|
-
var
|
|
1242
|
-
n.version !== null &&
|
|
1126
|
+
var gn = {
|
|
1127
|
+
YAML: function(n, r, i) {
|
|
1128
|
+
var t, l, o;
|
|
1129
|
+
n.version !== null && y(n, "duplication of %YAML directive"), i.length !== 1 && y(n, "YAML directive accepts exactly one argument"), t = /^([0-9]+)\.([0-9]+)$/.exec(i[0]), t === null && y(n, "ill-formed argument of the YAML directive"), l = parseInt(t[1], 10), o = parseInt(t[2], 10), l !== 1 && y(n, "unacceptable YAML version of the document"), n.version = i[0], n.checkLineBreaks = o < 2, o !== 1 && o !== 2 && _e(n, "unsupported YAML version of the document");
|
|
1243
1130
|
},
|
|
1244
|
-
TAG: function(n,
|
|
1245
|
-
var
|
|
1246
|
-
|
|
1131
|
+
TAG: function(n, r, i) {
|
|
1132
|
+
var t, l;
|
|
1133
|
+
i.length !== 2 && y(n, "TAG directive accepts exactly two arguments"), t = i[0], l = i[1], or.test(t) || y(n, "ill-formed tag handle (first argument) of the TAG directive"), q.call(n.tagMap, t) && y(n, 'there is a previously declared suffix for "' + t + '" tag handle'), lr.test(l) || y(n, "ill-formed tag prefix (second argument) of the TAG directive");
|
|
1247
1134
|
try {
|
|
1248
|
-
|
|
1135
|
+
l = decodeURIComponent(l);
|
|
1249
1136
|
} catch {
|
|
1250
|
-
|
|
1137
|
+
y(n, "tag prefix is malformed: " + l);
|
|
1251
1138
|
}
|
|
1252
|
-
n.tagMap[
|
|
1139
|
+
n.tagMap[t] = l;
|
|
1253
1140
|
}
|
|
1254
1141
|
};
|
|
1255
|
-
function
|
|
1256
|
-
var
|
|
1257
|
-
if (n <
|
|
1258
|
-
if (a = e.input.slice(n,
|
|
1259
|
-
for (
|
|
1260
|
-
|
|
1261
|
-
else
|
|
1142
|
+
function G(e, n, r, i) {
|
|
1143
|
+
var t, l, o, a;
|
|
1144
|
+
if (n < r) {
|
|
1145
|
+
if (a = e.input.slice(n, r), i)
|
|
1146
|
+
for (t = 0, l = a.length; t < l; t += 1)
|
|
1147
|
+
o = a.charCodeAt(t), o === 9 || 32 <= o && o <= 1114111 || y(e, "expected valid JSON character");
|
|
1148
|
+
else qi.test(a) && y(e, "the stream contains non-printable characters");
|
|
1262
1149
|
e.result += a;
|
|
1263
1150
|
}
|
|
1264
1151
|
}
|
|
1265
|
-
function
|
|
1266
|
-
var
|
|
1267
|
-
for (F.isObject(
|
|
1268
|
-
|
|
1152
|
+
function mn(e, n, r, i) {
|
|
1153
|
+
var t, l, o, a;
|
|
1154
|
+
for (F.isObject(r) || y(e, "cannot merge mappings; the provided source object is unacceptable"), t = Object.keys(r), o = 0, a = t.length; o < a; o += 1)
|
|
1155
|
+
l = t[o], q.call(n, l) || (ar(n, l, r[l]), i[l] = !0);
|
|
1269
1156
|
}
|
|
1270
|
-
function
|
|
1157
|
+
function ie(e, n, r, i, t, l, o, a, c) {
|
|
1271
1158
|
var u, s;
|
|
1272
|
-
if (Array.isArray(
|
|
1273
|
-
for (
|
|
1274
|
-
Array.isArray(
|
|
1275
|
-
if (typeof
|
|
1276
|
-
if (Array.isArray(
|
|
1277
|
-
for (u = 0, s =
|
|
1278
|
-
|
|
1159
|
+
if (Array.isArray(t))
|
|
1160
|
+
for (t = Array.prototype.slice.call(t), u = 0, s = t.length; u < s; u += 1)
|
|
1161
|
+
Array.isArray(t[u]) && y(e, "nested arrays are not supported inside keys"), typeof t == "object" && hn(t[u]) === "[object Object]" && (t[u] = "[object Object]");
|
|
1162
|
+
if (typeof t == "object" && hn(t) === "[object Object]" && (t = "[object Object]"), t = String(t), n === null && (n = {}), i === "tag:yaml.org,2002:merge")
|
|
1163
|
+
if (Array.isArray(l))
|
|
1164
|
+
for (u = 0, s = l.length; u < s; u += 1)
|
|
1165
|
+
mn(e, n, l[u], r);
|
|
1279
1166
|
else
|
|
1280
|
-
|
|
1167
|
+
mn(e, n, l, r);
|
|
1281
1168
|
else
|
|
1282
|
-
!e.json && !
|
|
1169
|
+
!e.json && !q.call(r, t) && q.call(n, t) && (e.line = o || e.line, e.lineStart = a || e.lineStart, e.position = c || e.position, y(e, "duplicated mapping key")), ar(n, t, l), delete r[t];
|
|
1283
1170
|
return n;
|
|
1284
1171
|
}
|
|
1285
|
-
function
|
|
1172
|
+
function qe(e) {
|
|
1286
1173
|
var n;
|
|
1287
|
-
n = e.input.charCodeAt(e.position), n === 10 ? e.position++ : n === 13 ? (e.position++, e.input.charCodeAt(e.position) === 10 && e.position++) :
|
|
1174
|
+
n = e.input.charCodeAt(e.position), n === 10 ? e.position++ : n === 13 ? (e.position++, e.input.charCodeAt(e.position) === 10 && e.position++) : y(e, "a line break is expected"), e.line += 1, e.lineStart = e.position, e.firstTabInLine = -1;
|
|
1288
1175
|
}
|
|
1289
|
-
function O(e, n,
|
|
1290
|
-
for (var
|
|
1291
|
-
for (;
|
|
1292
|
-
|
|
1293
|
-
if (n &&
|
|
1176
|
+
function O(e, n, r) {
|
|
1177
|
+
for (var i = 0, t = e.input.charCodeAt(e.position); t !== 0; ) {
|
|
1178
|
+
for (; V(t); )
|
|
1179
|
+
t === 9 && e.firstTabInLine === -1 && (e.firstTabInLine = e.position), t = e.input.charCodeAt(++e.position);
|
|
1180
|
+
if (n && t === 35)
|
|
1294
1181
|
do
|
|
1295
|
-
|
|
1296
|
-
while (
|
|
1297
|
-
if (
|
|
1298
|
-
for (
|
|
1299
|
-
e.lineIndent++,
|
|
1182
|
+
t = e.input.charCodeAt(++e.position);
|
|
1183
|
+
while (t !== 10 && t !== 13 && t !== 0);
|
|
1184
|
+
if (z(t))
|
|
1185
|
+
for (qe(e), t = e.input.charCodeAt(e.position), i++, e.lineIndent = 0; t === 32; )
|
|
1186
|
+
e.lineIndent++, t = e.input.charCodeAt(++e.position);
|
|
1300
1187
|
else
|
|
1301
1188
|
break;
|
|
1302
1189
|
}
|
|
1303
|
-
return
|
|
1190
|
+
return r !== -1 && i !== 0 && e.lineIndent < r && _e(e, "deficient indentation"), i;
|
|
1304
1191
|
}
|
|
1305
|
-
function
|
|
1306
|
-
var n = e.position,
|
|
1307
|
-
return
|
|
1192
|
+
function Te(e) {
|
|
1193
|
+
var n = e.position, r;
|
|
1194
|
+
return r = e.input.charCodeAt(n), !!((r === 45 || r === 46) && r === e.input.charCodeAt(n + 1) && r === e.input.charCodeAt(n + 2) && (n += 3, r = e.input.charCodeAt(n), r === 0 || D(r)));
|
|
1308
1195
|
}
|
|
1309
|
-
function
|
|
1196
|
+
function Ve(e, n) {
|
|
1310
1197
|
n === 1 ? e.result += " " : n > 1 && (e.result += F.repeat(`
|
|
1311
1198
|
`, n - 1));
|
|
1312
1199
|
}
|
|
1313
|
-
function
|
|
1314
|
-
var
|
|
1315
|
-
if (
|
|
1200
|
+
function rt(e, n, r) {
|
|
1201
|
+
var i, t, l, o, a, c, u, s, f = e.kind, g = e.result, h;
|
|
1202
|
+
if (h = e.input.charCodeAt(e.position), D(h) || re(h) || h === 35 || h === 38 || h === 42 || h === 33 || h === 124 || h === 62 || h === 39 || h === 34 || h === 37 || h === 64 || h === 96 || (h === 63 || h === 45) && (t = e.input.charCodeAt(e.position + 1), D(t) || r && re(t)))
|
|
1316
1203
|
return !1;
|
|
1317
|
-
for (e.kind = "scalar", e.result = "",
|
|
1318
|
-
if (
|
|
1319
|
-
if (
|
|
1204
|
+
for (e.kind = "scalar", e.result = "", l = o = e.position, a = !1; h !== 0; ) {
|
|
1205
|
+
if (h === 58) {
|
|
1206
|
+
if (t = e.input.charCodeAt(e.position + 1), D(t) || r && re(t))
|
|
1320
1207
|
break;
|
|
1321
|
-
} else if (
|
|
1322
|
-
if (
|
|
1208
|
+
} else if (h === 35) {
|
|
1209
|
+
if (i = e.input.charCodeAt(e.position - 1), D(i))
|
|
1323
1210
|
break;
|
|
1324
1211
|
} else {
|
|
1325
|
-
if (e.position === e.lineStart &&
|
|
1212
|
+
if (e.position === e.lineStart && Te(e) || r && re(h))
|
|
1326
1213
|
break;
|
|
1327
|
-
if (
|
|
1214
|
+
if (z(h))
|
|
1328
1215
|
if (c = e.line, u = e.lineStart, s = e.lineIndent, O(e, !1, -1), e.lineIndent >= n) {
|
|
1329
|
-
a = !0,
|
|
1216
|
+
a = !0, h = e.input.charCodeAt(e.position);
|
|
1330
1217
|
continue;
|
|
1331
1218
|
} else {
|
|
1332
|
-
e.position =
|
|
1219
|
+
e.position = o, e.line = c, e.lineStart = u, e.lineIndent = s;
|
|
1333
1220
|
break;
|
|
1334
1221
|
}
|
|
1335
1222
|
}
|
|
1336
|
-
a && (
|
|
1223
|
+
a && (G(e, l, o, !1), Ve(e, e.line - c), l = o = e.position, a = !1), V(h) || (o = e.position + 1), h = e.input.charCodeAt(++e.position);
|
|
1337
1224
|
}
|
|
1338
|
-
return
|
|
1225
|
+
return G(e, l, o, !1), e.result ? !0 : (e.kind = f, e.result = g, !1);
|
|
1339
1226
|
}
|
|
1340
|
-
function
|
|
1341
|
-
var
|
|
1342
|
-
if (
|
|
1227
|
+
function it(e, n) {
|
|
1228
|
+
var r, i, t;
|
|
1229
|
+
if (r = e.input.charCodeAt(e.position), r !== 39)
|
|
1343
1230
|
return !1;
|
|
1344
|
-
for (e.kind = "scalar", e.result = "", e.position++,
|
|
1345
|
-
if (
|
|
1346
|
-
if (
|
|
1347
|
-
|
|
1231
|
+
for (e.kind = "scalar", e.result = "", e.position++, i = t = e.position; (r = e.input.charCodeAt(e.position)) !== 0; )
|
|
1232
|
+
if (r === 39)
|
|
1233
|
+
if (G(e, i, e.position, !0), r = e.input.charCodeAt(++e.position), r === 39)
|
|
1234
|
+
i = e.position, e.position++, t = e.position;
|
|
1348
1235
|
else
|
|
1349
1236
|
return !0;
|
|
1350
|
-
else
|
|
1351
|
-
|
|
1237
|
+
else z(r) ? (G(e, i, t, !0), Ve(e, O(e, !1, n)), i = t = e.position) : e.position === e.lineStart && Te(e) ? y(e, "unexpected end of the document within a single quoted scalar") : (e.position++, t = e.position);
|
|
1238
|
+
y(e, "unexpected end of the stream within a single quoted scalar");
|
|
1352
1239
|
}
|
|
1353
|
-
function
|
|
1354
|
-
var
|
|
1240
|
+
function tt(e, n) {
|
|
1241
|
+
var r, i, t, l, o, a;
|
|
1355
1242
|
if (a = e.input.charCodeAt(e.position), a !== 34)
|
|
1356
1243
|
return !1;
|
|
1357
|
-
for (e.kind = "scalar", e.result = "", e.position++,
|
|
1244
|
+
for (e.kind = "scalar", e.result = "", e.position++, r = i = e.position; (a = e.input.charCodeAt(e.position)) !== 0; ) {
|
|
1358
1245
|
if (a === 34)
|
|
1359
|
-
return
|
|
1246
|
+
return G(e, r, e.position, !0), e.position++, !0;
|
|
1360
1247
|
if (a === 92) {
|
|
1361
|
-
if (
|
|
1248
|
+
if (G(e, r, e.position, !0), a = e.input.charCodeAt(++e.position), z(a))
|
|
1362
1249
|
O(e, !1, n);
|
|
1363
|
-
else if (a < 256 &&
|
|
1364
|
-
e.result +=
|
|
1365
|
-
else if ((
|
|
1366
|
-
for (
|
|
1367
|
-
a = e.input.charCodeAt(++e.position), (
|
|
1368
|
-
e.result +=
|
|
1250
|
+
else if (a < 256 && cr[a])
|
|
1251
|
+
e.result += ur[a], e.position++;
|
|
1252
|
+
else if ((o = Ji(a)) > 0) {
|
|
1253
|
+
for (t = o, l = 0; t > 0; t--)
|
|
1254
|
+
a = e.input.charCodeAt(++e.position), (o = Qi(a)) >= 0 ? l = (l << 4) + o : y(e, "expected hexadecimal character");
|
|
1255
|
+
e.result += et(l), e.position++;
|
|
1369
1256
|
} else
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
} else
|
|
1373
|
-
}
|
|
1374
|
-
|
|
1375
|
-
}
|
|
1376
|
-
function
|
|
1377
|
-
var
|
|
1378
|
-
if (
|
|
1379
|
-
s = 93,
|
|
1380
|
-
else if (
|
|
1381
|
-
s = 125,
|
|
1257
|
+
y(e, "unknown escape sequence");
|
|
1258
|
+
r = i = e.position;
|
|
1259
|
+
} else z(a) ? (G(e, r, i, !0), Ve(e, O(e, !1, n)), r = i = e.position) : e.position === e.lineStart && Te(e) ? y(e, "unexpected end of the document within a double quoted scalar") : (e.position++, i = e.position);
|
|
1260
|
+
}
|
|
1261
|
+
y(e, "unexpected end of the stream within a double quoted scalar");
|
|
1262
|
+
}
|
|
1263
|
+
function ot(e, n) {
|
|
1264
|
+
var r = !0, i, t, l, o = e.tag, a, c = e.anchor, u, s, f, g, h, x = /* @__PURE__ */ Object.create(null), d, A, E, v;
|
|
1265
|
+
if (v = e.input.charCodeAt(e.position), v === 91)
|
|
1266
|
+
s = 93, h = !1, a = [];
|
|
1267
|
+
else if (v === 123)
|
|
1268
|
+
s = 125, h = !0, a = {};
|
|
1382
1269
|
else
|
|
1383
1270
|
return !1;
|
|
1384
|
-
for (e.anchor !== null && (e.anchorMap[e.anchor] = a),
|
|
1385
|
-
if (O(e, !0, n),
|
|
1386
|
-
return e.position++, e.tag =
|
|
1387
|
-
|
|
1388
|
-
}
|
|
1389
|
-
|
|
1390
|
-
}
|
|
1391
|
-
function
|
|
1392
|
-
var
|
|
1393
|
-
if (
|
|
1394
|
-
|
|
1395
|
-
else if (
|
|
1396
|
-
|
|
1271
|
+
for (e.anchor !== null && (e.anchorMap[e.anchor] = a), v = e.input.charCodeAt(++e.position); v !== 0; ) {
|
|
1272
|
+
if (O(e, !0, n), v = e.input.charCodeAt(e.position), v === s)
|
|
1273
|
+
return e.position++, e.tag = o, e.anchor = c, e.kind = h ? "mapping" : "sequence", e.result = a, !0;
|
|
1274
|
+
r ? v === 44 && y(e, "expected the node content, but found ','") : y(e, "missed comma between flow collection entries"), A = d = E = null, f = g = !1, v === 63 && (u = e.input.charCodeAt(e.position + 1), D(u) && (f = g = !0, e.position++, O(e, !0, n))), i = e.line, t = e.lineStart, l = e.position, te(e, n, Ee, !1, !0), A = e.tag, d = e.result, O(e, !0, n), v = e.input.charCodeAt(e.position), (g || e.line === i) && v === 58 && (f = !0, v = e.input.charCodeAt(++e.position), O(e, !0, n), te(e, n, Ee, !1, !0), E = e.result), h ? ie(e, a, x, A, d, E, i, t, l) : f ? a.push(ie(e, null, x, A, d, E, i, t, l)) : a.push(d), O(e, !0, n), v = e.input.charCodeAt(e.position), v === 44 ? (r = !0, v = e.input.charCodeAt(++e.position)) : r = !1;
|
|
1275
|
+
}
|
|
1276
|
+
y(e, "unexpected end of the stream within a flow collection");
|
|
1277
|
+
}
|
|
1278
|
+
function lt(e, n) {
|
|
1279
|
+
var r, i, t = Me, l = !1, o = !1, a = n, c = 0, u = !1, s, f;
|
|
1280
|
+
if (f = e.input.charCodeAt(e.position), f === 124)
|
|
1281
|
+
i = !1;
|
|
1282
|
+
else if (f === 62)
|
|
1283
|
+
i = !0;
|
|
1397
1284
|
else
|
|
1398
1285
|
return !1;
|
|
1399
|
-
for (e.kind = "scalar", e.result = "";
|
|
1400
|
-
if (
|
|
1401
|
-
|
|
1402
|
-
else if ((s =
|
|
1403
|
-
s === 0 ?
|
|
1286
|
+
for (e.kind = "scalar", e.result = ""; f !== 0; )
|
|
1287
|
+
if (f = e.input.charCodeAt(++e.position), f === 43 || f === 45)
|
|
1288
|
+
Me === t ? t = f === 43 ? pn : Gi : y(e, "repeat of a chomping mode identifier");
|
|
1289
|
+
else if ((s = Zi(f)) >= 0)
|
|
1290
|
+
s === 0 ? y(e, "bad explicit indentation width of a block scalar; it cannot be less than one") : o ? y(e, "repeat of an indentation width identifier") : (a = n + s - 1, o = !0);
|
|
1404
1291
|
else
|
|
1405
1292
|
break;
|
|
1406
|
-
if (
|
|
1293
|
+
if (V(f)) {
|
|
1407
1294
|
do
|
|
1408
|
-
|
|
1409
|
-
while (
|
|
1410
|
-
if (
|
|
1295
|
+
f = e.input.charCodeAt(++e.position);
|
|
1296
|
+
while (V(f));
|
|
1297
|
+
if (f === 35)
|
|
1411
1298
|
do
|
|
1412
|
-
|
|
1413
|
-
while (!
|
|
1299
|
+
f = e.input.charCodeAt(++e.position);
|
|
1300
|
+
while (!z(f) && f !== 0);
|
|
1414
1301
|
}
|
|
1415
|
-
for (;
|
|
1416
|
-
for (
|
|
1417
|
-
e.lineIndent++,
|
|
1418
|
-
if (!
|
|
1302
|
+
for (; f !== 0; ) {
|
|
1303
|
+
for (qe(e), e.lineIndent = 0, f = e.input.charCodeAt(e.position); (!o || e.lineIndent < a) && f === 32; )
|
|
1304
|
+
e.lineIndent++, f = e.input.charCodeAt(++e.position);
|
|
1305
|
+
if (!o && e.lineIndent > a && (a = e.lineIndent), z(f)) {
|
|
1419
1306
|
c++;
|
|
1420
1307
|
continue;
|
|
1421
1308
|
}
|
|
1422
1309
|
if (e.lineIndent < a) {
|
|
1423
|
-
|
|
1424
|
-
`,
|
|
1310
|
+
t === pn ? e.result += F.repeat(`
|
|
1311
|
+
`, l ? 1 + c : c) : t === Me && l && (e.result += `
|
|
1425
1312
|
`);
|
|
1426
1313
|
break;
|
|
1427
1314
|
}
|
|
1428
|
-
for (
|
|
1429
|
-
`,
|
|
1430
|
-
`, c + 1)) : c === 0 ?
|
|
1315
|
+
for (i ? V(f) ? (u = !0, e.result += F.repeat(`
|
|
1316
|
+
`, l ? 1 + c : c)) : u ? (u = !1, e.result += F.repeat(`
|
|
1317
|
+
`, c + 1)) : c === 0 ? l && (e.result += " ") : e.result += F.repeat(`
|
|
1431
1318
|
`, c) : e.result += F.repeat(`
|
|
1432
|
-
`,
|
|
1433
|
-
|
|
1434
|
-
|
|
1319
|
+
`, l ? 1 + c : c), l = !0, o = !0, c = 0, r = e.position; !z(f) && f !== 0; )
|
|
1320
|
+
f = e.input.charCodeAt(++e.position);
|
|
1321
|
+
G(e, r, e.position, !1);
|
|
1435
1322
|
}
|
|
1436
1323
|
return !0;
|
|
1437
1324
|
}
|
|
1438
|
-
function
|
|
1439
|
-
var
|
|
1325
|
+
function yn(e, n) {
|
|
1326
|
+
var r, i = e.tag, t = e.anchor, l = [], o, a = !1, c;
|
|
1440
1327
|
if (e.firstTabInLine !== -1) return !1;
|
|
1441
|
-
for (e.anchor !== null && (e.anchorMap[e.anchor] =
|
|
1328
|
+
for (e.anchor !== null && (e.anchorMap[e.anchor] = l), c = e.input.charCodeAt(e.position); c !== 0 && (e.firstTabInLine !== -1 && (e.position = e.firstTabInLine, y(e, "tab characters must not be used in indentation")), !(c !== 45 || (o = e.input.charCodeAt(e.position + 1), !D(o)))); ) {
|
|
1442
1329
|
if (a = !0, e.position++, O(e, !0, -1) && e.lineIndent <= n) {
|
|
1443
|
-
|
|
1330
|
+
l.push(null), c = e.input.charCodeAt(e.position);
|
|
1444
1331
|
continue;
|
|
1445
1332
|
}
|
|
1446
|
-
if (
|
|
1447
|
-
|
|
1333
|
+
if (r = e.line, te(e, n, tr, !1, !0), l.push(e.result), O(e, !0, -1), c = e.input.charCodeAt(e.position), (e.line === r || e.lineIndent > n) && c !== 0)
|
|
1334
|
+
y(e, "bad indentation of a sequence entry");
|
|
1448
1335
|
else if (e.lineIndent < n)
|
|
1449
1336
|
break;
|
|
1450
1337
|
}
|
|
1451
|
-
return a ? (e.tag =
|
|
1338
|
+
return a ? (e.tag = i, e.anchor = t, e.kind = "sequence", e.result = l, !0) : !1;
|
|
1452
1339
|
}
|
|
1453
|
-
function
|
|
1454
|
-
var
|
|
1340
|
+
function at(e, n, r) {
|
|
1341
|
+
var i, t, l, o, a, c, u = e.tag, s = e.anchor, f = {}, g = /* @__PURE__ */ Object.create(null), h = null, x = null, d = null, A = !1, E = !1, v;
|
|
1455
1342
|
if (e.firstTabInLine !== -1) return !1;
|
|
1456
|
-
for (e.anchor !== null && (e.anchorMap[e.anchor] =
|
|
1457
|
-
if (!
|
|
1458
|
-
|
|
1343
|
+
for (e.anchor !== null && (e.anchorMap[e.anchor] = f), v = e.input.charCodeAt(e.position); v !== 0; ) {
|
|
1344
|
+
if (!A && e.firstTabInLine !== -1 && (e.position = e.firstTabInLine, y(e, "tab characters must not be used in indentation")), i = e.input.charCodeAt(e.position + 1), l = e.line, (v === 63 || v === 58) && D(i))
|
|
1345
|
+
v === 63 ? (A && (ie(e, f, g, h, x, null, o, a, c), h = x = d = null), E = !0, A = !0, t = !0) : A ? (A = !1, t = !0) : y(e, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"), e.position += 1, v = i;
|
|
1459
1346
|
else {
|
|
1460
|
-
if (
|
|
1347
|
+
if (o = e.line, a = e.lineStart, c = e.position, !te(e, r, ir, !1, !0))
|
|
1461
1348
|
break;
|
|
1462
|
-
if (e.line ===
|
|
1463
|
-
for (
|
|
1464
|
-
|
|
1465
|
-
if (
|
|
1466
|
-
|
|
1467
|
-
else if (
|
|
1468
|
-
|
|
1349
|
+
if (e.line === l) {
|
|
1350
|
+
for (v = e.input.charCodeAt(e.position); V(v); )
|
|
1351
|
+
v = e.input.charCodeAt(++e.position);
|
|
1352
|
+
if (v === 58)
|
|
1353
|
+
v = e.input.charCodeAt(++e.position), D(v) || y(e, "a whitespace character is expected after the key-value separator within a block mapping"), A && (ie(e, f, g, h, x, null, o, a, c), h = x = d = null), E = !0, A = !1, t = !1, h = e.tag, x = e.result;
|
|
1354
|
+
else if (E)
|
|
1355
|
+
y(e, "can not read an implicit mapping pair; a colon is missed");
|
|
1469
1356
|
else
|
|
1470
1357
|
return e.tag = u, e.anchor = s, !0;
|
|
1471
|
-
} else if (
|
|
1472
|
-
|
|
1358
|
+
} else if (E)
|
|
1359
|
+
y(e, "can not read a block mapping entry; a multiline key may not be an implicit key");
|
|
1473
1360
|
else
|
|
1474
1361
|
return e.tag = u, e.anchor = s, !0;
|
|
1475
1362
|
}
|
|
1476
|
-
if ((e.line ===
|
|
1477
|
-
|
|
1363
|
+
if ((e.line === l || e.lineIndent > n) && (A && (o = e.line, a = e.lineStart, c = e.position), te(e, n, Se, !0, t) && (A ? x = e.result : d = e.result), A || (ie(e, f, g, h, x, d, o, a, c), h = x = d = null), O(e, !0, -1), v = e.input.charCodeAt(e.position)), (e.line === l || e.lineIndent > n) && v !== 0)
|
|
1364
|
+
y(e, "bad indentation of a mapping entry");
|
|
1478
1365
|
else if (e.lineIndent < n)
|
|
1479
1366
|
break;
|
|
1480
1367
|
}
|
|
1481
|
-
return
|
|
1368
|
+
return A && ie(e, f, g, h, x, null, o, a, c), E && (e.tag = u, e.anchor = s, e.kind = "mapping", e.result = f), E;
|
|
1482
1369
|
}
|
|
1483
|
-
function
|
|
1484
|
-
var n,
|
|
1485
|
-
if (
|
|
1486
|
-
if (e.tag !== null &&
|
|
1370
|
+
function ct(e) {
|
|
1371
|
+
var n, r = !1, i = !1, t, l, o;
|
|
1372
|
+
if (o = e.input.charCodeAt(e.position), o !== 33) return !1;
|
|
1373
|
+
if (e.tag !== null && y(e, "duplication of a tag property"), o = e.input.charCodeAt(++e.position), o === 60 ? (r = !0, o = e.input.charCodeAt(++e.position)) : o === 33 ? (i = !0, t = "!!", o = e.input.charCodeAt(++e.position)) : t = "!", n = e.position, r) {
|
|
1487
1374
|
do
|
|
1488
|
-
|
|
1489
|
-
while (
|
|
1490
|
-
e.position < e.length ? (
|
|
1375
|
+
o = e.input.charCodeAt(++e.position);
|
|
1376
|
+
while (o !== 0 && o !== 62);
|
|
1377
|
+
e.position < e.length ? (l = e.input.slice(n, e.position), o = e.input.charCodeAt(++e.position)) : y(e, "unexpected end of the stream within a verbatim tag");
|
|
1491
1378
|
} else {
|
|
1492
|
-
for (;
|
|
1493
|
-
|
|
1494
|
-
|
|
1379
|
+
for (; o !== 0 && !D(o); )
|
|
1380
|
+
o === 33 && (i ? y(e, "tag suffix cannot contain exclamation marks") : (t = e.input.slice(n - 1, e.position + 1), or.test(t) || y(e, "named tag handle cannot contain such characters"), i = !0, n = e.position + 1)), o = e.input.charCodeAt(++e.position);
|
|
1381
|
+
l = e.input.slice(n, e.position), Xi.test(l) && y(e, "tag suffix cannot contain flow indicator characters");
|
|
1495
1382
|
}
|
|
1496
|
-
|
|
1383
|
+
l && !lr.test(l) && y(e, "tag name cannot contain such characters: " + l);
|
|
1497
1384
|
try {
|
|
1498
|
-
|
|
1385
|
+
l = decodeURIComponent(l);
|
|
1499
1386
|
} catch {
|
|
1500
|
-
|
|
1387
|
+
y(e, "tag name is malformed: " + l);
|
|
1501
1388
|
}
|
|
1502
|
-
return
|
|
1389
|
+
return r ? e.tag = l : q.call(e.tagMap, t) ? e.tag = e.tagMap[t] + l : t === "!" ? e.tag = "!" + l : t === "!!" ? e.tag = "tag:yaml.org,2002:" + l : y(e, 'undeclared tag handle "' + t + '"'), !0;
|
|
1503
1390
|
}
|
|
1504
|
-
function
|
|
1505
|
-
var n,
|
|
1506
|
-
if (
|
|
1507
|
-
for (e.anchor !== null &&
|
|
1508
|
-
i = e.input.charCodeAt(++e.position);
|
|
1509
|
-
return e.position === n && x(e, "name of an anchor node must contain at least one character"), e.anchor = e.input.slice(n, e.position), !0;
|
|
1510
|
-
}
|
|
1511
|
-
function io(e) {
|
|
1512
|
-
var n, i, r;
|
|
1513
|
-
if (r = e.input.charCodeAt(e.position), r !== 42) return !1;
|
|
1514
|
-
for (r = e.input.charCodeAt(++e.position), n = e.position; r !== 0 && !M(r) && !V(r); )
|
|
1391
|
+
function ut(e) {
|
|
1392
|
+
var n, r;
|
|
1393
|
+
if (r = e.input.charCodeAt(e.position), r !== 38) return !1;
|
|
1394
|
+
for (e.anchor !== null && y(e, "duplication of an anchor property"), r = e.input.charCodeAt(++e.position), n = e.position; r !== 0 && !D(r) && !re(r); )
|
|
1515
1395
|
r = e.input.charCodeAt(++e.position);
|
|
1516
|
-
return e.position === n &&
|
|
1517
|
-
}
|
|
1518
|
-
function
|
|
1519
|
-
var
|
|
1520
|
-
if (
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1396
|
+
return e.position === n && y(e, "name of an anchor node must contain at least one character"), e.anchor = e.input.slice(n, e.position), !0;
|
|
1397
|
+
}
|
|
1398
|
+
function st(e) {
|
|
1399
|
+
var n, r, i;
|
|
1400
|
+
if (i = e.input.charCodeAt(e.position), i !== 42) return !1;
|
|
1401
|
+
for (i = e.input.charCodeAt(++e.position), n = e.position; i !== 0 && !D(i) && !re(i); )
|
|
1402
|
+
i = e.input.charCodeAt(++e.position);
|
|
1403
|
+
return e.position === n && y(e, "name of an alias node must contain at least one character"), r = e.input.slice(n, e.position), q.call(e.anchorMap, r) || y(e, 'unidentified alias "' + r + '"'), e.result = e.anchorMap[r], O(e, !0, -1), !0;
|
|
1404
|
+
}
|
|
1405
|
+
function te(e, n, r, i, t) {
|
|
1406
|
+
var l, o, a, c = 1, u = !1, s = !1, f, g, h, x, d, A;
|
|
1407
|
+
if (e.listener !== null && e.listener("open", e), e.tag = null, e.anchor = null, e.kind = null, e.result = null, l = o = a = Se === r || tr === r, i && O(e, !0, -1) && (u = !0, e.lineIndent > n ? c = 1 : e.lineIndent === n ? c = 0 : e.lineIndent < n && (c = -1)), c === 1)
|
|
1408
|
+
for (; ct(e) || ut(e); )
|
|
1409
|
+
O(e, !0, -1) ? (u = !0, a = l, e.lineIndent > n ? c = 1 : e.lineIndent === n ? c = 0 : e.lineIndent < n && (c = -1)) : a = !1;
|
|
1410
|
+
if (a && (a = u || t), (c === 1 || Se === r) && (Ee === r || ir === r ? d = n : d = n + 1, A = e.position - e.lineStart, c === 1 ? a && (yn(e, A) || at(e, A, d)) || ot(e, d) ? s = !0 : (o && lt(e, d) || it(e, d) || tt(e, d) ? s = !0 : st(e) ? (s = !0, (e.tag !== null || e.anchor !== null) && y(e, "alias node should not have any properties")) : rt(e, d, Ee === r) && (s = !0, e.tag === null && (e.tag = "?")), e.anchor !== null && (e.anchorMap[e.anchor] = e.result)) : c === 0 && (s = a && yn(e, A))), e.tag === null)
|
|
1524
1411
|
e.anchor !== null && (e.anchorMap[e.anchor] = e.result);
|
|
1525
1412
|
else if (e.tag === "?") {
|
|
1526
|
-
for (e.result !== null && e.kind !== "scalar" &&
|
|
1527
|
-
if (
|
|
1528
|
-
e.result =
|
|
1413
|
+
for (e.result !== null && e.kind !== "scalar" && y(e, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + e.kind + '"'), f = 0, g = e.implicitTypes.length; f < g; f += 1)
|
|
1414
|
+
if (x = e.implicitTypes[f], x.resolve(e.result)) {
|
|
1415
|
+
e.result = x.construct(e.result), e.tag = x.tag, e.anchor !== null && (e.anchorMap[e.anchor] = e.result);
|
|
1529
1416
|
break;
|
|
1530
1417
|
}
|
|
1531
1418
|
} else if (e.tag !== "!") {
|
|
1532
|
-
if (
|
|
1533
|
-
|
|
1419
|
+
if (q.call(e.typeMap[e.kind || "fallback"], e.tag))
|
|
1420
|
+
x = e.typeMap[e.kind || "fallback"][e.tag];
|
|
1534
1421
|
else
|
|
1535
|
-
for (
|
|
1536
|
-
if (e.tag.slice(0,
|
|
1537
|
-
|
|
1422
|
+
for (x = null, h = e.typeMap.multi[e.kind || "fallback"], f = 0, g = h.length; f < g; f += 1)
|
|
1423
|
+
if (e.tag.slice(0, h[f].tag.length) === h[f].tag) {
|
|
1424
|
+
x = h[f];
|
|
1538
1425
|
break;
|
|
1539
1426
|
}
|
|
1540
|
-
|
|
1427
|
+
x || y(e, "unknown tag !<" + e.tag + ">"), e.result !== null && x.kind !== e.kind && y(e, "unacceptable node kind for !<" + e.tag + '> tag; it should be "' + x.kind + '", not "' + e.kind + '"'), x.resolve(e.result, e.tag) ? (e.result = x.construct(e.result, e.tag), e.anchor !== null && (e.anchorMap[e.anchor] = e.result)) : y(e, "cannot resolve a node with !<" + e.tag + "> explicit tag");
|
|
1541
1428
|
}
|
|
1542
1429
|
return e.listener !== null && e.listener("close", e), e.tag !== null || e.anchor !== null || s;
|
|
1543
1430
|
}
|
|
1544
|
-
function
|
|
1545
|
-
var n = e.position,
|
|
1546
|
-
for (e.version = null, e.checkLineBreaks = e.legacy, e.tagMap = /* @__PURE__ */ Object.create(null), e.anchorMap = /* @__PURE__ */ Object.create(null); (
|
|
1547
|
-
for (
|
|
1548
|
-
|
|
1549
|
-
for (
|
|
1550
|
-
for (;
|
|
1551
|
-
|
|
1552
|
-
if (
|
|
1431
|
+
function ft(e) {
|
|
1432
|
+
var n = e.position, r, i, t, l = !1, o;
|
|
1433
|
+
for (e.version = null, e.checkLineBreaks = e.legacy, e.tagMap = /* @__PURE__ */ Object.create(null), e.anchorMap = /* @__PURE__ */ Object.create(null); (o = e.input.charCodeAt(e.position)) !== 0 && (O(e, !0, -1), o = e.input.charCodeAt(e.position), !(e.lineIndent > 0 || o !== 37)); ) {
|
|
1434
|
+
for (l = !0, o = e.input.charCodeAt(++e.position), r = e.position; o !== 0 && !D(o); )
|
|
1435
|
+
o = e.input.charCodeAt(++e.position);
|
|
1436
|
+
for (i = e.input.slice(r, e.position), t = [], i.length < 1 && y(e, "directive name must not be less than one character in length"); o !== 0; ) {
|
|
1437
|
+
for (; V(o); )
|
|
1438
|
+
o = e.input.charCodeAt(++e.position);
|
|
1439
|
+
if (o === 35) {
|
|
1553
1440
|
do
|
|
1554
|
-
|
|
1555
|
-
while (
|
|
1441
|
+
o = e.input.charCodeAt(++e.position);
|
|
1442
|
+
while (o !== 0 && !z(o));
|
|
1556
1443
|
break;
|
|
1557
1444
|
}
|
|
1558
|
-
if (
|
|
1559
|
-
for (
|
|
1560
|
-
|
|
1561
|
-
|
|
1445
|
+
if (z(o)) break;
|
|
1446
|
+
for (r = e.position; o !== 0 && !D(o); )
|
|
1447
|
+
o = e.input.charCodeAt(++e.position);
|
|
1448
|
+
t.push(e.input.slice(r, e.position));
|
|
1562
1449
|
}
|
|
1563
|
-
|
|
1450
|
+
o !== 0 && qe(e), q.call(gn, i) ? gn[i](e, i, t) : _e(e, 'unknown document directive "' + i + '"');
|
|
1564
1451
|
}
|
|
1565
|
-
if (O(e, !0, -1), e.lineIndent === 0 && e.input.charCodeAt(e.position) === 45 && e.input.charCodeAt(e.position + 1) === 45 && e.input.charCodeAt(e.position + 2) === 45 ? (e.position += 3, O(e, !0, -1)) :
|
|
1452
|
+
if (O(e, !0, -1), e.lineIndent === 0 && e.input.charCodeAt(e.position) === 45 && e.input.charCodeAt(e.position + 1) === 45 && e.input.charCodeAt(e.position + 2) === 45 ? (e.position += 3, O(e, !0, -1)) : l && y(e, "directives end mark is expected"), te(e, e.lineIndent - 1, Se, !1, !0), O(e, !0, -1), e.checkLineBreaks && Vi.test(e.input.slice(n, e.position)) && _e(e, "non-ASCII line breaks are interpreted as content"), e.documents.push(e.result), e.position === e.lineStart && Te(e)) {
|
|
1566
1453
|
e.input.charCodeAt(e.position) === 46 && (e.position += 3, O(e, !0, -1));
|
|
1567
1454
|
return;
|
|
1568
1455
|
}
|
|
1569
1456
|
if (e.position < e.length - 1)
|
|
1570
|
-
|
|
1457
|
+
y(e, "end of the stream or a document separator is expected");
|
|
1571
1458
|
else
|
|
1572
1459
|
return;
|
|
1573
1460
|
}
|
|
1574
|
-
function
|
|
1461
|
+
function fr(e, n) {
|
|
1575
1462
|
e = String(e), n = n || {}, e.length !== 0 && (e.charCodeAt(e.length - 1) !== 10 && e.charCodeAt(e.length - 1) !== 13 && (e += `
|
|
1576
1463
|
`), e.charCodeAt(0) === 65279 && (e = e.slice(1)));
|
|
1577
|
-
var
|
|
1578
|
-
for (
|
|
1579
|
-
|
|
1580
|
-
for (;
|
|
1581
|
-
|
|
1582
|
-
return
|
|
1583
|
-
}
|
|
1584
|
-
function
|
|
1585
|
-
n !== null && typeof n == "object" && typeof
|
|
1586
|
-
var
|
|
1464
|
+
var r = new nt(e, n), i = e.indexOf("\0");
|
|
1465
|
+
for (i !== -1 && (r.position = i, y(r, "null byte is not allowed in input")), r.input += "\0"; r.input.charCodeAt(r.position) === 32; )
|
|
1466
|
+
r.lineIndent += 1, r.position += 1;
|
|
1467
|
+
for (; r.position < r.length - 1; )
|
|
1468
|
+
ft(r);
|
|
1469
|
+
return r.documents;
|
|
1470
|
+
}
|
|
1471
|
+
function pt(e, n, r) {
|
|
1472
|
+
n !== null && typeof n == "object" && typeof r > "u" && (r = n, n = null);
|
|
1473
|
+
var i = fr(e, r);
|
|
1587
1474
|
if (typeof n != "function")
|
|
1588
|
-
return
|
|
1589
|
-
for (var
|
|
1590
|
-
n(
|
|
1591
|
-
}
|
|
1592
|
-
function
|
|
1593
|
-
var
|
|
1594
|
-
if (
|
|
1595
|
-
if (
|
|
1596
|
-
return
|
|
1475
|
+
return i;
|
|
1476
|
+
for (var t = 0, l = i.length; t < l; t += 1)
|
|
1477
|
+
n(i[t]);
|
|
1478
|
+
}
|
|
1479
|
+
function ht(e, n) {
|
|
1480
|
+
var r = fr(e, n);
|
|
1481
|
+
if (r.length !== 0) {
|
|
1482
|
+
if (r.length === 1)
|
|
1483
|
+
return r[0];
|
|
1597
1484
|
throw new I("expected a single document in the stream, but found more");
|
|
1598
1485
|
}
|
|
1599
1486
|
}
|
|
1600
|
-
var
|
|
1601
|
-
loadAll:
|
|
1602
|
-
load:
|
|
1603
|
-
},
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
var
|
|
1487
|
+
var dt = pt, gt = ht, pr = {
|
|
1488
|
+
loadAll: dt,
|
|
1489
|
+
load: gt
|
|
1490
|
+
}, hr = Object.prototype.toString, dr = Object.prototype.hasOwnProperty, Xe = 65279, mt = 9, pe = 10, yt = 13, xt = 32, vt = 33, bt = 34, Ye = 35, wt = 37, At = 38, Ct = 39, Et = 42, gr = 44, St = 45, ke = 58, _t = 61, kt = 62, Ot = 63, Ft = 64, mr = 91, yr = 93, Tt = 96, xr = 123, Lt = 124, vr = 125, L = {};
|
|
1491
|
+
L[0] = "\\0";
|
|
1492
|
+
L[7] = "\\a";
|
|
1493
|
+
L[8] = "\\b";
|
|
1494
|
+
L[9] = "\\t";
|
|
1495
|
+
L[10] = "\\n";
|
|
1496
|
+
L[11] = "\\v";
|
|
1497
|
+
L[12] = "\\f";
|
|
1498
|
+
L[13] = "\\r";
|
|
1499
|
+
L[27] = "\\e";
|
|
1500
|
+
L[34] = '\\"';
|
|
1501
|
+
L[92] = "\\\\";
|
|
1502
|
+
L[133] = "\\N";
|
|
1503
|
+
L[160] = "\\_";
|
|
1504
|
+
L[8232] = "\\L";
|
|
1505
|
+
L[8233] = "\\P";
|
|
1506
|
+
var jt = [
|
|
1620
1507
|
"y",
|
|
1621
1508
|
"Y",
|
|
1622
1509
|
"yes",
|
|
@@ -1633,238 +1520,238 @@ var So = [
|
|
|
1633
1520
|
"off",
|
|
1634
1521
|
"Off",
|
|
1635
1522
|
"OFF"
|
|
1636
|
-
],
|
|
1637
|
-
function
|
|
1638
|
-
var
|
|
1523
|
+
], It = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
|
|
1524
|
+
function Nt(e, n) {
|
|
1525
|
+
var r, i, t, l, o, a, c;
|
|
1639
1526
|
if (n === null) return {};
|
|
1640
|
-
for (
|
|
1641
|
-
|
|
1642
|
-
return
|
|
1527
|
+
for (r = {}, i = Object.keys(n), t = 0, l = i.length; t < l; t += 1)
|
|
1528
|
+
o = i[t], a = String(n[o]), o.slice(0, 2) === "!!" && (o = "tag:yaml.org,2002:" + o.slice(2)), c = e.compiledTypeMap.fallback[o], c && dr.call(c.styleAliases, a) && (a = c.styleAliases[a]), r[o] = a;
|
|
1529
|
+
return r;
|
|
1643
1530
|
}
|
|
1644
|
-
function
|
|
1645
|
-
var n,
|
|
1531
|
+
function Rt(e) {
|
|
1532
|
+
var n, r, i;
|
|
1646
1533
|
if (n = e.toString(16).toUpperCase(), e <= 255)
|
|
1647
|
-
|
|
1534
|
+
r = "x", i = 2;
|
|
1648
1535
|
else if (e <= 65535)
|
|
1649
|
-
|
|
1536
|
+
r = "u", i = 4;
|
|
1650
1537
|
else if (e <= 4294967295)
|
|
1651
|
-
|
|
1538
|
+
r = "U", i = 8;
|
|
1652
1539
|
else
|
|
1653
1540
|
throw new I("code point within a string may not be greater than 0xFFFFFFFF");
|
|
1654
|
-
return "\\" +
|
|
1541
|
+
return "\\" + r + F.repeat("0", i - n.length) + n;
|
|
1655
1542
|
}
|
|
1656
|
-
var
|
|
1657
|
-
function
|
|
1658
|
-
this.schema = e.schema ||
|
|
1543
|
+
var Mt = 1, he = 2;
|
|
1544
|
+
function Pt(e) {
|
|
1545
|
+
this.schema = e.schema || Ge, this.indent = Math.max(1, e.indent || 2), this.noArrayIndent = e.noArrayIndent || !1, this.skipInvalid = e.skipInvalid || !1, this.flowLevel = F.isNothing(e.flowLevel) ? -1 : e.flowLevel, this.styleMap = Nt(this.schema, e.styles || null), this.sortKeys = e.sortKeys || !1, this.lineWidth = e.lineWidth || 80, this.noRefs = e.noRefs || !1, this.noCompatMode = e.noCompatMode || !1, this.condenseFlow = e.condenseFlow || !1, this.quotingType = e.quotingType === '"' ? he : Mt, this.forceQuotes = e.forceQuotes || !1, this.replacer = typeof e.replacer == "function" ? e.replacer : null, this.implicitTypes = this.schema.compiledImplicit, this.explicitTypes = this.schema.compiledExplicit, this.tag = null, this.result = "", this.duplicates = [], this.usedDuplicates = null;
|
|
1659
1546
|
}
|
|
1660
|
-
function
|
|
1661
|
-
for (var
|
|
1662
|
-
|
|
1663
|
-
`,
|
|
1664
|
-
` && (
|
|
1665
|
-
return
|
|
1547
|
+
function xn(e, n) {
|
|
1548
|
+
for (var r = F.repeat(" ", n), i = 0, t = -1, l = "", o, a = e.length; i < a; )
|
|
1549
|
+
t = e.indexOf(`
|
|
1550
|
+
`, i), t === -1 ? (o = e.slice(i), i = a) : (o = e.slice(i, t + 1), i = t + 1), o.length && o !== `
|
|
1551
|
+
` && (l += r), l += o;
|
|
1552
|
+
return l;
|
|
1666
1553
|
}
|
|
1667
|
-
function
|
|
1554
|
+
function ze(e, n) {
|
|
1668
1555
|
return `
|
|
1669
1556
|
` + F.repeat(" ", e.indent * n);
|
|
1670
1557
|
}
|
|
1671
|
-
function
|
|
1672
|
-
var
|
|
1673
|
-
for (
|
|
1674
|
-
if (
|
|
1558
|
+
function Dt(e, n) {
|
|
1559
|
+
var r, i, t;
|
|
1560
|
+
for (r = 0, i = e.implicitTypes.length; r < i; r += 1)
|
|
1561
|
+
if (t = e.implicitTypes[r], t.resolve(n))
|
|
1675
1562
|
return !0;
|
|
1676
1563
|
return !1;
|
|
1677
1564
|
}
|
|
1678
|
-
function
|
|
1679
|
-
return e ===
|
|
1565
|
+
function Oe(e) {
|
|
1566
|
+
return e === xt || e === mt;
|
|
1680
1567
|
}
|
|
1681
|
-
function
|
|
1682
|
-
return 32 <= e && e <= 126 || 161 <= e && e <= 55295 && e !== 8232 && e !== 8233 || 57344 <= e && e <= 65533 && e !==
|
|
1568
|
+
function de(e) {
|
|
1569
|
+
return 32 <= e && e <= 126 || 161 <= e && e <= 55295 && e !== 8232 && e !== 8233 || 57344 <= e && e <= 65533 && e !== Xe || 65536 <= e && e <= 1114111;
|
|
1683
1570
|
}
|
|
1684
|
-
function
|
|
1685
|
-
return
|
|
1571
|
+
function vn(e) {
|
|
1572
|
+
return de(e) && e !== Xe && e !== yt && e !== pe;
|
|
1686
1573
|
}
|
|
1687
|
-
function
|
|
1688
|
-
var
|
|
1574
|
+
function bn(e, n, r) {
|
|
1575
|
+
var i = vn(e), t = i && !Oe(e);
|
|
1689
1576
|
return (
|
|
1690
1577
|
// ns-plain-safe
|
|
1691
|
-
(
|
|
1578
|
+
(r ? (
|
|
1692
1579
|
// c = flow-in
|
|
1693
|
-
|
|
1694
|
-
) :
|
|
1580
|
+
i
|
|
1581
|
+
) : i && e !== gr && e !== mr && e !== yr && e !== xr && e !== vr) && e !== Ye && !(n === ke && !t) || vn(n) && !Oe(n) && e === Ye || n === ke && t
|
|
1695
1582
|
);
|
|
1696
1583
|
}
|
|
1697
|
-
function
|
|
1698
|
-
return
|
|
1584
|
+
function Bt(e) {
|
|
1585
|
+
return de(e) && e !== Xe && !Oe(e) && e !== St && e !== Ot && e !== ke && e !== gr && e !== mr && e !== yr && e !== xr && e !== vr && e !== Ye && e !== At && e !== Et && e !== vt && e !== Lt && e !== _t && e !== kt && e !== Ct && e !== bt && e !== wt && e !== Ft && e !== Tt;
|
|
1699
1586
|
}
|
|
1700
|
-
function
|
|
1701
|
-
return !
|
|
1587
|
+
function Ut(e) {
|
|
1588
|
+
return !Oe(e) && e !== ke;
|
|
1702
1589
|
}
|
|
1703
|
-
function
|
|
1704
|
-
var
|
|
1705
|
-
return
|
|
1590
|
+
function se(e, n) {
|
|
1591
|
+
var r = e.charCodeAt(n), i;
|
|
1592
|
+
return r >= 55296 && r <= 56319 && n + 1 < e.length && (i = e.charCodeAt(n + 1), i >= 56320 && i <= 57343) ? (r - 55296) * 1024 + i - 56320 + 65536 : r;
|
|
1706
1593
|
}
|
|
1707
|
-
function
|
|
1594
|
+
function br(e) {
|
|
1708
1595
|
var n = /^\n* /;
|
|
1709
1596
|
return n.test(e);
|
|
1710
1597
|
}
|
|
1711
|
-
var
|
|
1712
|
-
function
|
|
1713
|
-
var c, u = 0, s = null,
|
|
1714
|
-
if (n ||
|
|
1598
|
+
var wr = 1, $e = 2, Ar = 3, Cr = 4, ee = 5;
|
|
1599
|
+
function Yt(e, n, r, i, t, l, o, a) {
|
|
1600
|
+
var c, u = 0, s = null, f = !1, g = !1, h = i !== -1, x = -1, d = Bt(se(e, 0)) && Ut(se(e, e.length - 1));
|
|
1601
|
+
if (n || o)
|
|
1715
1602
|
for (c = 0; c < e.length; u >= 65536 ? c += 2 : c++) {
|
|
1716
|
-
if (u =
|
|
1717
|
-
return
|
|
1718
|
-
|
|
1603
|
+
if (u = se(e, c), !de(u))
|
|
1604
|
+
return ee;
|
|
1605
|
+
d = d && bn(u, s, a), s = u;
|
|
1719
1606
|
}
|
|
1720
1607
|
else {
|
|
1721
1608
|
for (c = 0; c < e.length; u >= 65536 ? c += 2 : c++) {
|
|
1722
|
-
if (u =
|
|
1723
|
-
|
|
1724
|
-
c -
|
|
1725
|
-
else if (!
|
|
1726
|
-
return
|
|
1727
|
-
|
|
1609
|
+
if (u = se(e, c), u === pe)
|
|
1610
|
+
f = !0, h && (g = g || // Foldable line = too long, and not more-indented.
|
|
1611
|
+
c - x - 1 > i && e[x + 1] !== " ", x = c);
|
|
1612
|
+
else if (!de(u))
|
|
1613
|
+
return ee;
|
|
1614
|
+
d = d && bn(u, s, a), s = u;
|
|
1728
1615
|
}
|
|
1729
|
-
|
|
1616
|
+
g = g || h && c - x - 1 > i && e[x + 1] !== " ";
|
|
1730
1617
|
}
|
|
1731
|
-
return !
|
|
1618
|
+
return !f && !g ? d && !o && !t(e) ? wr : l === he ? ee : $e : r > 9 && br(e) ? ee : o ? l === he ? ee : $e : g ? Cr : Ar;
|
|
1732
1619
|
}
|
|
1733
|
-
function
|
|
1620
|
+
function zt(e, n, r, i, t) {
|
|
1734
1621
|
e.dump = (function() {
|
|
1735
1622
|
if (n.length === 0)
|
|
1736
|
-
return e.quotingType ===
|
|
1737
|
-
if (!e.noCompatMode && (
|
|
1738
|
-
return e.quotingType ===
|
|
1739
|
-
var
|
|
1623
|
+
return e.quotingType === he ? '""' : "''";
|
|
1624
|
+
if (!e.noCompatMode && (jt.indexOf(n) !== -1 || It.test(n)))
|
|
1625
|
+
return e.quotingType === he ? '"' + n + '"' : "'" + n + "'";
|
|
1626
|
+
var l = e.indent * Math.max(1, r), o = e.lineWidth === -1 ? -1 : Math.max(Math.min(e.lineWidth, 40), e.lineWidth - l), a = i || e.flowLevel > -1 && r >= e.flowLevel;
|
|
1740
1627
|
function c(u) {
|
|
1741
|
-
return
|
|
1628
|
+
return Dt(e, u);
|
|
1742
1629
|
}
|
|
1743
|
-
switch (
|
|
1630
|
+
switch (Yt(
|
|
1744
1631
|
n,
|
|
1745
1632
|
a,
|
|
1746
1633
|
e.indent,
|
|
1747
|
-
|
|
1634
|
+
o,
|
|
1748
1635
|
c,
|
|
1749
1636
|
e.quotingType,
|
|
1750
|
-
e.forceQuotes && !
|
|
1751
|
-
|
|
1637
|
+
e.forceQuotes && !i,
|
|
1638
|
+
t
|
|
1752
1639
|
)) {
|
|
1753
|
-
case
|
|
1640
|
+
case wr:
|
|
1754
1641
|
return n;
|
|
1755
|
-
case
|
|
1642
|
+
case $e:
|
|
1756
1643
|
return "'" + n.replace(/'/g, "''") + "'";
|
|
1757
|
-
case
|
|
1758
|
-
return "|" +
|
|
1759
|
-
case
|
|
1760
|
-
return ">" +
|
|
1761
|
-
case
|
|
1762
|
-
return '"' +
|
|
1644
|
+
case Ar:
|
|
1645
|
+
return "|" + wn(n, e.indent) + An(xn(n, l));
|
|
1646
|
+
case Cr:
|
|
1647
|
+
return ">" + wn(n, e.indent) + An(xn($t(n, o), l));
|
|
1648
|
+
case ee:
|
|
1649
|
+
return '"' + Ht(n) + '"';
|
|
1763
1650
|
default:
|
|
1764
1651
|
throw new I("impossible error: invalid scalar style");
|
|
1765
1652
|
}
|
|
1766
1653
|
})();
|
|
1767
1654
|
}
|
|
1768
|
-
function
|
|
1769
|
-
var
|
|
1770
|
-
`,
|
|
1655
|
+
function wn(e, n) {
|
|
1656
|
+
var r = br(e) ? String(n) : "", i = e[e.length - 1] === `
|
|
1657
|
+
`, t = i && (e[e.length - 2] === `
|
|
1771
1658
|
` || e === `
|
|
1772
|
-
`),
|
|
1773
|
-
return
|
|
1659
|
+
`), l = t ? "+" : i ? "" : "-";
|
|
1660
|
+
return r + l + `
|
|
1774
1661
|
`;
|
|
1775
1662
|
}
|
|
1776
|
-
function
|
|
1663
|
+
function An(e) {
|
|
1777
1664
|
return e[e.length - 1] === `
|
|
1778
1665
|
` ? e.slice(0, -1) : e;
|
|
1779
1666
|
}
|
|
1780
|
-
function
|
|
1781
|
-
for (var
|
|
1667
|
+
function $t(e, n) {
|
|
1668
|
+
for (var r = /(\n+)([^\n]*)/g, i = (function() {
|
|
1782
1669
|
var u = e.indexOf(`
|
|
1783
1670
|
`);
|
|
1784
|
-
return u = u !== -1 ? u : e.length,
|
|
1785
|
-
})(),
|
|
1786
|
-
` || e[0] === " ",
|
|
1787
|
-
var a =
|
|
1788
|
-
|
|
1789
|
-
` : "") +
|
|
1671
|
+
return u = u !== -1 ? u : e.length, r.lastIndex = u, Cn(e.slice(0, u), n);
|
|
1672
|
+
})(), t = e[0] === `
|
|
1673
|
+
` || e[0] === " ", l, o; o = r.exec(e); ) {
|
|
1674
|
+
var a = o[1], c = o[2];
|
|
1675
|
+
l = c[0] === " ", i += a + (!t && !l && c !== "" ? `
|
|
1676
|
+
` : "") + Cn(c, n), t = l;
|
|
1790
1677
|
}
|
|
1791
|
-
return
|
|
1678
|
+
return i;
|
|
1792
1679
|
}
|
|
1793
|
-
function
|
|
1680
|
+
function Cn(e, n) {
|
|
1794
1681
|
if (e === "" || e[0] === " ") return e;
|
|
1795
|
-
for (var
|
|
1796
|
-
a =
|
|
1797
|
-
` + e.slice(
|
|
1682
|
+
for (var r = / [^ ]/g, i, t = 0, l, o = 0, a = 0, c = ""; i = r.exec(e); )
|
|
1683
|
+
a = i.index, a - t > n && (l = o > t ? o : a, c += `
|
|
1684
|
+
` + e.slice(t, l), t = l + 1), o = a;
|
|
1798
1685
|
return c += `
|
|
1799
|
-
`, e.length -
|
|
1800
|
-
` + e.slice(
|
|
1686
|
+
`, e.length - t > n && o > t ? c += e.slice(t, o) + `
|
|
1687
|
+
` + e.slice(o + 1) : c += e.slice(t), c.slice(1);
|
|
1801
1688
|
}
|
|
1802
|
-
function
|
|
1803
|
-
for (var n = "",
|
|
1804
|
-
|
|
1689
|
+
function Ht(e) {
|
|
1690
|
+
for (var n = "", r = 0, i, t = 0; t < e.length; r >= 65536 ? t += 2 : t++)
|
|
1691
|
+
r = se(e, t), i = L[r], !i && de(r) ? (n += e[t], r >= 65536 && (n += e[t + 1])) : n += i || Rt(r);
|
|
1805
1692
|
return n;
|
|
1806
1693
|
}
|
|
1807
|
-
function
|
|
1808
|
-
var
|
|
1809
|
-
for (
|
|
1810
|
-
a =
|
|
1811
|
-
e.tag =
|
|
1812
|
-
}
|
|
1813
|
-
function
|
|
1814
|
-
var
|
|
1815
|
-
for (
|
|
1816
|
-
c =
|
|
1817
|
-
e.tag =
|
|
1818
|
-
}
|
|
1819
|
-
function
|
|
1820
|
-
var
|
|
1821
|
-
for (
|
|
1822
|
-
s = "",
|
|
1823
|
-
e.tag =
|
|
1824
|
-
}
|
|
1825
|
-
function
|
|
1826
|
-
var
|
|
1694
|
+
function Kt(e, n, r) {
|
|
1695
|
+
var i = "", t = e.tag, l, o, a;
|
|
1696
|
+
for (l = 0, o = r.length; l < o; l += 1)
|
|
1697
|
+
a = r[l], e.replacer && (a = e.replacer.call(r, String(l), a)), (H(e, n, a, !1, !1) || typeof a > "u" && H(e, n, null, !1, !1)) && (i !== "" && (i += "," + (e.condenseFlow ? "" : " ")), i += e.dump);
|
|
1698
|
+
e.tag = t, e.dump = "[" + i + "]";
|
|
1699
|
+
}
|
|
1700
|
+
function En(e, n, r, i) {
|
|
1701
|
+
var t = "", l = e.tag, o, a, c;
|
|
1702
|
+
for (o = 0, a = r.length; o < a; o += 1)
|
|
1703
|
+
c = r[o], e.replacer && (c = e.replacer.call(r, String(o), c)), (H(e, n + 1, c, !0, !0, !1, !0) || typeof c > "u" && H(e, n + 1, null, !0, !0, !1, !0)) && ((!i || t !== "") && (t += ze(e, n)), e.dump && pe === e.dump.charCodeAt(0) ? t += "-" : t += "- ", t += e.dump);
|
|
1704
|
+
e.tag = l, e.dump = t || "[]";
|
|
1705
|
+
}
|
|
1706
|
+
function Wt(e, n, r) {
|
|
1707
|
+
var i = "", t = e.tag, l = Object.keys(r), o, a, c, u, s;
|
|
1708
|
+
for (o = 0, a = l.length; o < a; o += 1)
|
|
1709
|
+
s = "", i !== "" && (s += ", "), e.condenseFlow && (s += '"'), c = l[o], u = r[c], e.replacer && (u = e.replacer.call(r, c, u)), H(e, n, c, !1, !1) && (e.dump.length > 1024 && (s += "? "), s += e.dump + (e.condenseFlow ? '"' : "") + ":" + (e.condenseFlow ? "" : " "), H(e, n, u, !1, !1) && (s += e.dump, i += s));
|
|
1710
|
+
e.tag = t, e.dump = "{" + i + "}";
|
|
1711
|
+
}
|
|
1712
|
+
function Gt(e, n, r, i) {
|
|
1713
|
+
var t = "", l = e.tag, o = Object.keys(r), a, c, u, s, f, g;
|
|
1827
1714
|
if (e.sortKeys === !0)
|
|
1828
|
-
|
|
1715
|
+
o.sort();
|
|
1829
1716
|
else if (typeof e.sortKeys == "function")
|
|
1830
|
-
|
|
1717
|
+
o.sort(e.sortKeys);
|
|
1831
1718
|
else if (e.sortKeys)
|
|
1832
1719
|
throw new I("sortKeys must be a boolean or a function");
|
|
1833
|
-
for (a = 0, c =
|
|
1834
|
-
|
|
1835
|
-
e.tag =
|
|
1836
|
-
}
|
|
1837
|
-
function
|
|
1838
|
-
var
|
|
1839
|
-
for (
|
|
1840
|
-
if (a =
|
|
1841
|
-
if (
|
|
1842
|
-
if (c = e.styleMap[a.tag] || a.defaultStyle,
|
|
1843
|
-
|
|
1844
|
-
else if (
|
|
1845
|
-
|
|
1720
|
+
for (a = 0, c = o.length; a < c; a += 1)
|
|
1721
|
+
g = "", (!i || t !== "") && (g += ze(e, n)), u = o[a], s = r[u], e.replacer && (s = e.replacer.call(r, u, s)), H(e, n + 1, u, !0, !0, !0) && (f = e.tag !== null && e.tag !== "?" || e.dump && e.dump.length > 1024, f && (e.dump && pe === e.dump.charCodeAt(0) ? g += "?" : g += "? "), g += e.dump, f && (g += ze(e, n)), H(e, n + 1, s, !0, f) && (e.dump && pe === e.dump.charCodeAt(0) ? g += ":" : g += ": ", g += e.dump, t += g));
|
|
1722
|
+
e.tag = l, e.dump = t || "{}";
|
|
1723
|
+
}
|
|
1724
|
+
function Sn(e, n, r) {
|
|
1725
|
+
var i, t, l, o, a, c;
|
|
1726
|
+
for (t = r ? e.explicitTypes : e.implicitTypes, l = 0, o = t.length; l < o; l += 1)
|
|
1727
|
+
if (a = t[l], (a.instanceOf || a.predicate) && (!a.instanceOf || typeof n == "object" && n instanceof a.instanceOf) && (!a.predicate || a.predicate(n))) {
|
|
1728
|
+
if (r ? a.multi && a.representName ? e.tag = a.representName(n) : e.tag = a.tag : e.tag = "?", a.represent) {
|
|
1729
|
+
if (c = e.styleMap[a.tag] || a.defaultStyle, hr.call(a.represent) === "[object Function]")
|
|
1730
|
+
i = a.represent(n, c);
|
|
1731
|
+
else if (dr.call(a.represent, c))
|
|
1732
|
+
i = a.represent[c](n, c);
|
|
1846
1733
|
else
|
|
1847
1734
|
throw new I("!<" + a.tag + '> tag resolver accepts not "' + c + '" style');
|
|
1848
|
-
e.dump =
|
|
1735
|
+
e.dump = i;
|
|
1849
1736
|
}
|
|
1850
1737
|
return !0;
|
|
1851
1738
|
}
|
|
1852
1739
|
return !1;
|
|
1853
1740
|
}
|
|
1854
|
-
function
|
|
1855
|
-
e.tag = null, e.dump =
|
|
1856
|
-
var a =
|
|
1857
|
-
|
|
1858
|
-
var s = a === "[object Object]" || a === "[object Array]",
|
|
1859
|
-
if (s && (
|
|
1860
|
-
e.dump = "*ref_" +
|
|
1741
|
+
function H(e, n, r, i, t, l, o) {
|
|
1742
|
+
e.tag = null, e.dump = r, Sn(e, r, !1) || Sn(e, r, !0);
|
|
1743
|
+
var a = hr.call(e.dump), c = i, u;
|
|
1744
|
+
i && (i = e.flowLevel < 0 || e.flowLevel > n);
|
|
1745
|
+
var s = a === "[object Object]" || a === "[object Array]", f, g;
|
|
1746
|
+
if (s && (f = e.duplicates.indexOf(r), g = f !== -1), (e.tag !== null && e.tag !== "?" || g || e.indent !== 2 && n > 0) && (t = !1), g && e.usedDuplicates[f])
|
|
1747
|
+
e.dump = "*ref_" + f;
|
|
1861
1748
|
else {
|
|
1862
|
-
if (s &&
|
|
1863
|
-
|
|
1749
|
+
if (s && g && !e.usedDuplicates[f] && (e.usedDuplicates[f] = !0), a === "[object Object]")
|
|
1750
|
+
i && Object.keys(e.dump).length !== 0 ? (Gt(e, n, e.dump, t), g && (e.dump = "&ref_" + f + e.dump)) : (Wt(e, n, e.dump), g && (e.dump = "&ref_" + f + " " + e.dump));
|
|
1864
1751
|
else if (a === "[object Array]")
|
|
1865
|
-
|
|
1752
|
+
i && e.dump.length !== 0 ? (e.noArrayIndent && !o && n > 0 ? En(e, n - 1, e.dump, t) : En(e, n, e.dump, t), g && (e.dump = "&ref_" + f + e.dump)) : (Kt(e, n, e.dump), g && (e.dump = "&ref_" + f + " " + e.dump));
|
|
1866
1753
|
else if (a === "[object String]")
|
|
1867
|
-
e.tag !== "?" &&
|
|
1754
|
+
e.tag !== "?" && zt(e, e.dump, n, l, c);
|
|
1868
1755
|
else {
|
|
1869
1756
|
if (a === "[object Undefined]")
|
|
1870
1757
|
return !1;
|
|
@@ -1877,285 +1764,823 @@ function Y(e, n, i, r, o, t, l) {
|
|
|
1877
1764
|
}
|
|
1878
1765
|
return !0;
|
|
1879
1766
|
}
|
|
1880
|
-
function
|
|
1881
|
-
var
|
|
1882
|
-
for (
|
|
1883
|
-
n.duplicates.push(i[
|
|
1884
|
-
n.usedDuplicates = new Array(
|
|
1767
|
+
function qt(e, n) {
|
|
1768
|
+
var r = [], i = [], t, l;
|
|
1769
|
+
for (He(e, r, i), t = 0, l = i.length; t < l; t += 1)
|
|
1770
|
+
n.duplicates.push(r[i[t]]);
|
|
1771
|
+
n.usedDuplicates = new Array(l);
|
|
1885
1772
|
}
|
|
1886
|
-
function
|
|
1887
|
-
var
|
|
1773
|
+
function He(e, n, r) {
|
|
1774
|
+
var i, t, l;
|
|
1888
1775
|
if (e !== null && typeof e == "object")
|
|
1889
|
-
if (
|
|
1890
|
-
|
|
1776
|
+
if (t = n.indexOf(e), t !== -1)
|
|
1777
|
+
r.indexOf(t) === -1 && r.push(t);
|
|
1891
1778
|
else if (n.push(e), Array.isArray(e))
|
|
1892
|
-
for (
|
|
1893
|
-
|
|
1779
|
+
for (t = 0, l = e.length; t < l; t += 1)
|
|
1780
|
+
He(e[t], n, r);
|
|
1894
1781
|
else
|
|
1895
|
-
for (
|
|
1896
|
-
|
|
1782
|
+
for (i = Object.keys(e), t = 0, l = i.length; t < l; t += 1)
|
|
1783
|
+
He(e[i[t]], n, r);
|
|
1897
1784
|
}
|
|
1898
|
-
function
|
|
1785
|
+
function Vt(e, n) {
|
|
1899
1786
|
n = n || {};
|
|
1900
|
-
var
|
|
1901
|
-
|
|
1902
|
-
var
|
|
1903
|
-
return
|
|
1787
|
+
var r = new Pt(n);
|
|
1788
|
+
r.noRefs || qt(e, r);
|
|
1789
|
+
var i = e;
|
|
1790
|
+
return r.replacer && (i = r.replacer.call({ "": i }, "", i)), H(r, 0, i, !0, !0) ? r.dump + `
|
|
1904
1791
|
` : "";
|
|
1905
1792
|
}
|
|
1906
|
-
var
|
|
1907
|
-
dump:
|
|
1793
|
+
var Xt = Vt, Qt = {
|
|
1794
|
+
dump: Xt
|
|
1908
1795
|
};
|
|
1909
|
-
function
|
|
1796
|
+
function Qe(e, n) {
|
|
1910
1797
|
return function() {
|
|
1911
1798
|
throw new Error("Function yaml." + e + " is removed in js-yaml 4. Use yaml." + n + " instead, which is now safe by default.");
|
|
1912
1799
|
};
|
|
1913
1800
|
}
|
|
1914
|
-
var
|
|
1915
|
-
binary:
|
|
1916
|
-
float:
|
|
1917
|
-
map:
|
|
1918
|
-
null:
|
|
1919
|
-
pairs:
|
|
1920
|
-
set:
|
|
1921
|
-
timestamp:
|
|
1922
|
-
bool:
|
|
1923
|
-
int:
|
|
1924
|
-
merge:
|
|
1925
|
-
omap:
|
|
1926
|
-
seq:
|
|
1927
|
-
str:
|
|
1928
|
-
},
|
|
1929
|
-
Type:
|
|
1930
|
-
Schema:
|
|
1931
|
-
FAILSAFE_SCHEMA:
|
|
1932
|
-
JSON_SCHEMA:
|
|
1933
|
-
CORE_SCHEMA:
|
|
1934
|
-
DEFAULT_SCHEMA:
|
|
1935
|
-
load:
|
|
1936
|
-
loadAll:
|
|
1937
|
-
dump:
|
|
1938
|
-
YAMLException:
|
|
1939
|
-
types:
|
|
1940
|
-
safeLoad:
|
|
1941
|
-
safeLoadAll:
|
|
1942
|
-
safeDump:
|
|
1801
|
+
var Jt = T, Zt = Dn, eo = zn, no = Gn, ro = qn, io = Ge, to = pr.load, oo = pr.loadAll, lo = Qt.dump, ao = I, co = {
|
|
1802
|
+
binary: Zn,
|
|
1803
|
+
float: Wn,
|
|
1804
|
+
map: Yn,
|
|
1805
|
+
null: $n,
|
|
1806
|
+
pairs: nr,
|
|
1807
|
+
set: rr,
|
|
1808
|
+
timestamp: Qn,
|
|
1809
|
+
bool: Hn,
|
|
1810
|
+
int: Kn,
|
|
1811
|
+
merge: Jn,
|
|
1812
|
+
omap: er,
|
|
1813
|
+
seq: Un,
|
|
1814
|
+
str: Bn
|
|
1815
|
+
}, uo = Qe("safeLoad", "load"), so = Qe("safeLoadAll", "loadAll"), fo = Qe("safeDump", "dump"), _n = {
|
|
1816
|
+
Type: Jt,
|
|
1817
|
+
Schema: Zt,
|
|
1818
|
+
FAILSAFE_SCHEMA: eo,
|
|
1819
|
+
JSON_SCHEMA: no,
|
|
1820
|
+
CORE_SCHEMA: ro,
|
|
1821
|
+
DEFAULT_SCHEMA: io,
|
|
1822
|
+
load: to,
|
|
1823
|
+
loadAll: oo,
|
|
1824
|
+
dump: lo,
|
|
1825
|
+
YAMLException: ao,
|
|
1826
|
+
types: co,
|
|
1827
|
+
safeLoad: uo,
|
|
1828
|
+
safeLoadAll: so,
|
|
1829
|
+
safeDump: fo
|
|
1943
1830
|
};
|
|
1944
|
-
const
|
|
1831
|
+
const we = (e, n) => {
|
|
1945
1832
|
if (e && typeof e == "object" && !Array.isArray(e))
|
|
1946
1833
|
return e;
|
|
1947
1834
|
throw new Error(`Parsed --strings as ${n}, but it was not an object.`);
|
|
1948
|
-
},
|
|
1949
|
-
const
|
|
1950
|
-
if (!
|
|
1835
|
+
}, Ae = (e) => e instanceof Error ? e.message : String(e), Ce = (e, n) => {
|
|
1836
|
+
const r = e.trim();
|
|
1837
|
+
if (!r)
|
|
1951
1838
|
return {};
|
|
1952
1839
|
if (n === "json")
|
|
1953
1840
|
try {
|
|
1954
|
-
return
|
|
1955
|
-
} catch (
|
|
1956
|
-
throw new Error(`Failed to parse --strings as JSON. Hint: check --strings-format=json. ${
|
|
1841
|
+
return we(Be.parse(r), "json");
|
|
1842
|
+
} catch (t) {
|
|
1843
|
+
throw new Error(`Failed to parse --strings as JSON. Hint: check --strings-format=json. ${Ae(t)}`);
|
|
1957
1844
|
}
|
|
1958
1845
|
if (n === "yaml")
|
|
1959
1846
|
try {
|
|
1960
|
-
return
|
|
1961
|
-
} catch (
|
|
1962
|
-
throw new Error(`Failed to parse --strings as YAML. Hint: check --strings-format=yaml. ${
|
|
1847
|
+
return we(_n.load(r), "yaml");
|
|
1848
|
+
} catch (t) {
|
|
1849
|
+
throw new Error(`Failed to parse --strings as YAML. Hint: check --strings-format=yaml. ${Ae(t)}`);
|
|
1963
1850
|
}
|
|
1964
|
-
const
|
|
1851
|
+
const i = [];
|
|
1965
1852
|
try {
|
|
1966
|
-
return
|
|
1967
|
-
} catch (
|
|
1968
|
-
|
|
1853
|
+
return we(_n.load(r), "yaml");
|
|
1854
|
+
} catch (t) {
|
|
1855
|
+
i.push(`yaml error: ${Ae(t)}`);
|
|
1969
1856
|
}
|
|
1970
1857
|
try {
|
|
1971
|
-
return
|
|
1972
|
-
} catch (
|
|
1973
|
-
|
|
1858
|
+
return we(Be.parse(r), "json");
|
|
1859
|
+
} catch (t) {
|
|
1860
|
+
i.push(`json error: ${Ae(t)}`);
|
|
1974
1861
|
}
|
|
1975
|
-
throw new Error(`Failed to parse --strings input. Provide valid YAML or JSON, or specify --strings-format. ${
|
|
1862
|
+
throw new Error(`Failed to parse --strings input. Provide valid YAML or JSON, or specify --strings-format. ${i.join(" | ")}`);
|
|
1976
1863
|
};
|
|
1977
|
-
async function
|
|
1864
|
+
async function Er() {
|
|
1978
1865
|
return new Promise((e) => {
|
|
1979
1866
|
let n = "";
|
|
1980
|
-
process.stdin.setEncoding("utf8"), process.stdin.on("data", (
|
|
1981
|
-
n +=
|
|
1867
|
+
process.stdin.setEncoding("utf8"), process.stdin.on("data", (r) => {
|
|
1868
|
+
n += r;
|
|
1982
1869
|
}), process.stdin.on("end", () => {
|
|
1983
1870
|
e(n);
|
|
1984
1871
|
}), process.stdin.readableEnded && e("");
|
|
1985
1872
|
});
|
|
1986
1873
|
}
|
|
1987
|
-
async function
|
|
1874
|
+
async function po(e, n = Er, r = "auto") {
|
|
1988
1875
|
if (e !== void 0) {
|
|
1989
1876
|
if (e === "") {
|
|
1990
|
-
const
|
|
1991
|
-
return
|
|
1877
|
+
const i = await n();
|
|
1878
|
+
return i.trim() ? Ce(i, r) : void 0;
|
|
1992
1879
|
}
|
|
1993
1880
|
if (typeof e == "string")
|
|
1994
|
-
return
|
|
1881
|
+
return Ce(e, r);
|
|
1995
1882
|
if (Array.isArray(e)) {
|
|
1996
|
-
const
|
|
1997
|
-
for (const
|
|
1998
|
-
typeof
|
|
1999
|
-
return
|
|
1883
|
+
const i = {};
|
|
1884
|
+
for (const t of e)
|
|
1885
|
+
typeof t == "string" && Object.assign(i, Ce(t, r));
|
|
1886
|
+
return i;
|
|
2000
1887
|
}
|
|
2001
1888
|
if (typeof e == "boolean" && e === !0) {
|
|
2002
|
-
const
|
|
2003
|
-
return
|
|
1889
|
+
const i = await n();
|
|
1890
|
+
return i.trim() ? Ce(i, r) : void 0;
|
|
2004
1891
|
}
|
|
2005
1892
|
}
|
|
2006
1893
|
}
|
|
2007
|
-
async function
|
|
1894
|
+
async function ho({
|
|
2008
1895
|
path: e,
|
|
2009
1896
|
key: n,
|
|
2010
|
-
comment:
|
|
2011
|
-
stringsArg:
|
|
2012
|
-
stringsFormat:
|
|
2013
|
-
defaultString:
|
|
2014
|
-
language:
|
|
2015
|
-
stdinReader: a =
|
|
1897
|
+
comment: r,
|
|
1898
|
+
stringsArg: i,
|
|
1899
|
+
stringsFormat: t,
|
|
1900
|
+
defaultString: l,
|
|
1901
|
+
language: o,
|
|
1902
|
+
stdinReader: a = Er,
|
|
2016
1903
|
configPath: c
|
|
2017
1904
|
}) {
|
|
2018
|
-
const u = await
|
|
2019
|
-
await
|
|
1905
|
+
const u = await po(i, a, t);
|
|
1906
|
+
await mo(e, n, r, u, c, l, o);
|
|
1907
|
+
}
|
|
1908
|
+
function go() {
|
|
1909
|
+
return {
|
|
1910
|
+
command: "add",
|
|
1911
|
+
describe: "Add a string",
|
|
1912
|
+
builder: (e) => e.option("key", {
|
|
1913
|
+
type: "string",
|
|
1914
|
+
describe: "The key of the string",
|
|
1915
|
+
demandOption: !0
|
|
1916
|
+
}).option("comment", {
|
|
1917
|
+
type: "string",
|
|
1918
|
+
describe: "The comment for the string"
|
|
1919
|
+
}).option("language", {
|
|
1920
|
+
type: "string",
|
|
1921
|
+
alias: "l",
|
|
1922
|
+
describe: "The language of the string provided with --text"
|
|
1923
|
+
}).option("text", {
|
|
1924
|
+
type: "string",
|
|
1925
|
+
describe: "The string value for the default language"
|
|
1926
|
+
}).option("strings", {
|
|
1927
|
+
type: "string",
|
|
1928
|
+
describe: "The strings JSON or YAML"
|
|
1929
|
+
}).option("strings-format", {
|
|
1930
|
+
type: "string",
|
|
1931
|
+
choices: ["auto", "json", "yaml"],
|
|
1932
|
+
default: "auto",
|
|
1933
|
+
describe: "Format for the data provided with --strings"
|
|
1934
|
+
}),
|
|
1935
|
+
handler: async (e) => {
|
|
1936
|
+
await ho({
|
|
1937
|
+
path: e.path,
|
|
1938
|
+
key: e.key,
|
|
1939
|
+
comment: e.comment,
|
|
1940
|
+
stringsArg: e.strings,
|
|
1941
|
+
stringsFormat: e["strings-format"],
|
|
1942
|
+
defaultString: e.text,
|
|
1943
|
+
language: e.language,
|
|
1944
|
+
stdinReader: void 0,
|
|
1945
|
+
configPath: e.config
|
|
1946
|
+
}), ne.info(C.green(`✓ Added key "${e.key}"`));
|
|
1947
|
+
}
|
|
1948
|
+
};
|
|
2020
1949
|
}
|
|
2021
|
-
function
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
1950
|
+
async function mo(e, n, r, i, t, l, o) {
|
|
1951
|
+
const a = await me(e);
|
|
1952
|
+
if (!a.sourceLanguage)
|
|
1953
|
+
throw new Error('The xcstrings file is missing "sourceLanguage".');
|
|
1954
|
+
const c = a.sourceLanguage;
|
|
1955
|
+
a.strings || (a.strings = {});
|
|
1956
|
+
const s = (await Ke(t))?.missingLanguagePolicy || "skip";
|
|
1957
|
+
let f;
|
|
1958
|
+
const g = async (d) => s === "include" ? !0 : (f || (f = await Rn(e, t)), f.includes(d)), h = {
|
|
1959
|
+
...a.strings[n],
|
|
1960
|
+
extractionState: "manual"
|
|
1961
|
+
};
|
|
1962
|
+
if (r && (h.comment = r), l !== void 0) {
|
|
1963
|
+
const d = o ?? c;
|
|
1964
|
+
if (!await g(d))
|
|
1965
|
+
throw new Error(`Language "${d}" is not supported.`);
|
|
1966
|
+
h.localizations = h.localizations || {}, h.localizations[d] = {
|
|
1967
|
+
stringUnit: {
|
|
1968
|
+
state: "translated",
|
|
1969
|
+
value: l
|
|
1970
|
+
}
|
|
1971
|
+
};
|
|
1972
|
+
}
|
|
1973
|
+
const x = i ? { ...i } : void 0;
|
|
1974
|
+
if (x) {
|
|
1975
|
+
const d = [];
|
|
1976
|
+
for (const [A, E] of Object.entries(x)) {
|
|
1977
|
+
if (l !== void 0 && A === (o ?? c))
|
|
1978
|
+
continue;
|
|
1979
|
+
(s === "include" ? !0 : A === c || await g(A)) && d.push([A, E]);
|
|
1980
|
+
}
|
|
1981
|
+
if (d.length > 0) {
|
|
1982
|
+
h.localizations = h.localizations || {};
|
|
1983
|
+
for (const [A, E] of d)
|
|
1984
|
+
h.localizations[A] = {
|
|
1985
|
+
stringUnit: {
|
|
1986
|
+
state: "translated",
|
|
1987
|
+
value: E
|
|
1988
|
+
}
|
|
1989
|
+
};
|
|
1990
|
+
}
|
|
1991
|
+
}
|
|
1992
|
+
a.strings[n] = h, await Nn(e, a);
|
|
1993
|
+
}
|
|
1994
|
+
function yo() {
|
|
1995
|
+
return {
|
|
1996
|
+
command: "remove",
|
|
1997
|
+
describe: "Remove a string",
|
|
1998
|
+
builder: (e) => e.option("key", {
|
|
1999
|
+
type: "string",
|
|
2000
|
+
describe: "The key to remove",
|
|
2001
|
+
alias: "k"
|
|
2002
|
+
}).option("languages", {
|
|
2003
|
+
type: "string",
|
|
2004
|
+
array: !0,
|
|
2005
|
+
describe: "Languages to remove",
|
|
2006
|
+
alias: "l"
|
|
2007
|
+
}).option("dry-run", {
|
|
2008
|
+
type: "boolean",
|
|
2009
|
+
default: !1,
|
|
2010
|
+
describe: "Show what would be removed without writing changes",
|
|
2011
|
+
alias: "n"
|
|
2012
|
+
}).check((n) => {
|
|
2013
|
+
if (n.key || n.languages && n.languages.length > 0)
|
|
2014
|
+
return !0;
|
|
2015
|
+
throw new Error("Either --key or --languages must be provided");
|
|
2016
|
+
}),
|
|
2017
|
+
handler: async (e) => {
|
|
2018
|
+
const n = await vo(
|
|
2019
|
+
e.path,
|
|
2020
|
+
e.key,
|
|
2021
|
+
e.languages,
|
|
2022
|
+
e.dryRun === !0
|
|
2023
|
+
), r = Object.entries(n).map(([i, t]) => `- [${t.join(" ")}] ${i}`).join(`
|
|
2024
|
+
`);
|
|
2025
|
+
if (e.dryRun) {
|
|
2026
|
+
r.length === 0 ? ne.info(C.yellow("No matching strings found.")) : ne.info(C.blue(`Would remove:
|
|
2027
|
+
${r}`));
|
|
2028
|
+
return;
|
|
2029
|
+
}
|
|
2030
|
+
r.length === 0 ? ne.info(C.yellow("No matching strings found.")) : ne.info(C.green(`✓ Removed
|
|
2031
|
+
${r}`));
|
|
2032
|
+
}
|
|
2033
|
+
};
|
|
2027
2034
|
}
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
throw new Error(`Unknown alias: ${t}`);
|
|
2034
|
-
return c;
|
|
2035
|
+
function xo(e, n, r, i, t) {
|
|
2036
|
+
if (e.localizations) {
|
|
2037
|
+
for (const l of n)
|
|
2038
|
+
e.localizations[l] && (t[i] ??= [], t[i].push(l), r || delete e.localizations[l]);
|
|
2039
|
+
!r && e.localizations && Object.keys(e.localizations).length === 0 && delete e.localizations;
|
|
2035
2040
|
}
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2041
|
+
}
|
|
2042
|
+
async function vo(e, n, r, i = !1) {
|
|
2043
|
+
const t = await me(e), l = {}, o = t.strings || {};
|
|
2044
|
+
t.strings = o;
|
|
2045
|
+
const a = n ? [n] : Object.keys(o);
|
|
2046
|
+
let c = !1;
|
|
2047
|
+
for (const u of a) {
|
|
2048
|
+
const s = o[u];
|
|
2049
|
+
if (!s)
|
|
2050
|
+
continue;
|
|
2051
|
+
if (!r || r.length === 0) {
|
|
2052
|
+
const h = Object.keys(s.localizations ?? {});
|
|
2053
|
+
l[u] = h, i || delete o[u], c = !0;
|
|
2054
|
+
continue;
|
|
2046
2055
|
}
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2056
|
+
xo(s, r, i, u, l);
|
|
2057
|
+
const f = l[u]?.length ?? 0;
|
|
2058
|
+
!(s.localizations && Object.keys(s.localizations).length > 0) && f > 0 && (i || delete o[u]), f > 0 && (c = !0);
|
|
2059
|
+
}
|
|
2060
|
+
return !i && c && await Nn(e, t), l;
|
|
2061
|
+
}
|
|
2062
|
+
const Pe = "xcstrings-cli.json5";
|
|
2063
|
+
function bo() {
|
|
2064
|
+
return {
|
|
2065
|
+
command: "init",
|
|
2066
|
+
describe: "Initialize configuration file",
|
|
2067
|
+
handler: async () => {
|
|
2068
|
+
await Co();
|
|
2069
|
+
}
|
|
2070
|
+
};
|
|
2071
|
+
}
|
|
2072
|
+
async function wo(e) {
|
|
2073
|
+
const n = [];
|
|
2074
|
+
async function r(i) {
|
|
2075
|
+
try {
|
|
2076
|
+
const t = await In(i, { withFileTypes: !0 });
|
|
2077
|
+
for (const l of t) {
|
|
2078
|
+
const o = Fe(i, l.name);
|
|
2079
|
+
l.isDirectory() ? !l.name.startsWith(".") && l.name !== "node_modules" && await r(o) : l.name.endsWith(".xcstrings") && n.push(o);
|
|
2080
|
+
}
|
|
2081
|
+
} catch {
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2084
|
+
return await r(e), n;
|
|
2085
|
+
}
|
|
2086
|
+
async function Ao(e) {
|
|
2087
|
+
const n = [];
|
|
2088
|
+
let r = e;
|
|
2089
|
+
try {
|
|
2090
|
+
const i = await In(r, { withFileTypes: !0 });
|
|
2091
|
+
for (const t of i)
|
|
2092
|
+
t.isDirectory() && t.name.endsWith(".xcodeproj") && n.push(Fe(r, t.name));
|
|
2093
|
+
} catch {
|
|
2094
|
+
}
|
|
2095
|
+
return n;
|
|
2096
|
+
}
|
|
2097
|
+
async function Co() {
|
|
2098
|
+
const e = process.cwd();
|
|
2099
|
+
console.log(), console.log(C.bold.cyan("🚀 xcstrings-cli Configuration Setup")), console.log(C.dim("─".repeat(40))), console.log(), console.log(C.yellow("🔍 Searching for .xcstrings files..."));
|
|
2100
|
+
const n = await wo(e);
|
|
2101
|
+
console.log(C.yellow("🔍 Searching for .xcodeproj directories..."));
|
|
2102
|
+
const r = await Ao(e);
|
|
2103
|
+
console.log();
|
|
2104
|
+
let i = [];
|
|
2105
|
+
if (n.length > 0) {
|
|
2106
|
+
console.log(C.green(`✓ Found ${n.length} .xcstrings file(s)`)), console.log();
|
|
2107
|
+
const u = n.map((s) => ({
|
|
2108
|
+
name: C.white(be(e, s)) + C.dim(` (${s})`),
|
|
2109
|
+
value: be(e, s),
|
|
2110
|
+
checked: !0
|
|
2111
|
+
}));
|
|
2112
|
+
i = await ln({
|
|
2113
|
+
message: C.bold("Select .xcstrings files to manage:"),
|
|
2114
|
+
choices: u
|
|
2051
2115
|
});
|
|
2116
|
+
} else
|
|
2117
|
+
console.log(C.dim(" No .xcstrings files found in current directory"));
|
|
2118
|
+
console.log();
|
|
2119
|
+
let t = [];
|
|
2120
|
+
if (r.length > 0) {
|
|
2121
|
+
console.log(C.green(`✓ Found ${r.length} .xcodeproj director${r.length === 1 ? "y" : "ies"}`)), console.log();
|
|
2122
|
+
const u = r.map((s) => ({
|
|
2123
|
+
name: C.white(be(e, s) || s) + C.dim(` (${s})`),
|
|
2124
|
+
value: be(e, s) || s,
|
|
2125
|
+
checked: !0
|
|
2126
|
+
}));
|
|
2127
|
+
t = await ln({
|
|
2128
|
+
message: C.bold("Select .xcodeproj directories for language detection:"),
|
|
2129
|
+
choices: u
|
|
2130
|
+
});
|
|
2131
|
+
} else
|
|
2132
|
+
console.log(C.dim(" No .xcodeproj directories found"));
|
|
2133
|
+
if (console.log(), console.log(C.dim("─".repeat(40))), console.log(), console.log(C.bold("📋 Configuration Summary:")), console.log(), console.log(C.cyan(" xcstringsPaths:")), i.length > 0 ? i.forEach((u) => console.log(C.white(` • ${u}`))) : console.log(C.dim(" (none)")), console.log(), console.log(C.cyan(" xcodeprojPaths:")), t.length > 0 ? t.forEach((u) => console.log(C.white(` • ${u}`))) : console.log(C.dim(" (none)")), console.log(), !await Nr({
|
|
2134
|
+
message: C.bold(`Create ${C.yellow(Pe)}?`),
|
|
2135
|
+
default: !0
|
|
2136
|
+
})) {
|
|
2137
|
+
console.log(C.dim(" Configuration cancelled."));
|
|
2138
|
+
return;
|
|
2052
2139
|
}
|
|
2053
|
-
|
|
2140
|
+
const o = i.map((u) => ` "${u}"`).join(`,
|
|
2141
|
+
`), a = t.map((u) => ` "${u}"`).join(`,
|
|
2142
|
+
`), c = `{
|
|
2143
|
+
// Paths to .xcstrings files to manage. Specify relative or absolute paths.
|
|
2144
|
+
xcstringsPaths: [
|
|
2145
|
+
${o}
|
|
2146
|
+
],
|
|
2147
|
+
// Paths to .xcodeproj directories. Used for discovering supported languages.
|
|
2148
|
+
xcodeprojPaths: [
|
|
2149
|
+
${a}
|
|
2150
|
+
],
|
|
2151
|
+
// Behavior for handling missing languages when adding strings.
|
|
2152
|
+
missingLanguagePolicy: "skip",
|
|
2054
2153
|
}
|
|
2055
|
-
|
|
2056
|
-
|
|
2154
|
+
`;
|
|
2155
|
+
await jn(Pe, c, "utf-8"), console.log(), console.log(C.bold.green(`✓ Created ${Pe}`)), console.log(C.dim(` Run ${C.cyan("xcstrings --help")} to see available commands.`)), console.log();
|
|
2156
|
+
}
|
|
2157
|
+
var Eo = Object.prototype.toString, le = Array.isArray || function(n) {
|
|
2158
|
+
return Eo.call(n) === "[object Array]";
|
|
2159
|
+
};
|
|
2160
|
+
function Je(e) {
|
|
2161
|
+
return typeof e == "function";
|
|
2162
|
+
}
|
|
2163
|
+
function So(e) {
|
|
2164
|
+
return le(e) ? "array" : typeof e;
|
|
2165
|
+
}
|
|
2166
|
+
function De(e) {
|
|
2167
|
+
return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
|
|
2168
|
+
}
|
|
2169
|
+
function kn(e, n) {
|
|
2170
|
+
return e != null && typeof e == "object" && n in e;
|
|
2171
|
+
}
|
|
2172
|
+
function _o(e, n) {
|
|
2173
|
+
return e != null && typeof e != "object" && e.hasOwnProperty && e.hasOwnProperty(n);
|
|
2174
|
+
}
|
|
2175
|
+
var ko = RegExp.prototype.test;
|
|
2176
|
+
function Oo(e, n) {
|
|
2177
|
+
return ko.call(e, n);
|
|
2178
|
+
}
|
|
2179
|
+
var Fo = /\S/;
|
|
2180
|
+
function To(e) {
|
|
2181
|
+
return !Oo(Fo, e);
|
|
2182
|
+
}
|
|
2183
|
+
var Lo = {
|
|
2184
|
+
"&": "&",
|
|
2185
|
+
"<": "<",
|
|
2186
|
+
">": ">",
|
|
2187
|
+
'"': """,
|
|
2188
|
+
"'": "'",
|
|
2189
|
+
"/": "/",
|
|
2190
|
+
"`": "`",
|
|
2191
|
+
"=": "="
|
|
2192
|
+
};
|
|
2193
|
+
function jo(e) {
|
|
2194
|
+
return String(e).replace(/[&<>"'`=\/]/g, function(r) {
|
|
2195
|
+
return Lo[r];
|
|
2196
|
+
});
|
|
2197
|
+
}
|
|
2198
|
+
var Io = /\s*/, No = /\s+/, On = /\s*=/, Ro = /\s*\}/, Mo = /#|\^|\/|>|\{|&|=|!/;
|
|
2199
|
+
function Po(e, n) {
|
|
2200
|
+
if (!e)
|
|
2201
|
+
return [];
|
|
2202
|
+
var r = !1, i = [], t = [], l = [], o = !1, a = !1, c = "", u = 0;
|
|
2203
|
+
function s() {
|
|
2204
|
+
if (o && !a)
|
|
2205
|
+
for (; l.length; )
|
|
2206
|
+
delete t[l.pop()];
|
|
2207
|
+
else
|
|
2208
|
+
l = [];
|
|
2209
|
+
o = !1, a = !1;
|
|
2210
|
+
}
|
|
2211
|
+
var f, g, h;
|
|
2212
|
+
function x(B) {
|
|
2213
|
+
if (typeof B == "string" && (B = B.split(No, 2)), !le(B) || B.length !== 2)
|
|
2214
|
+
throw new Error("Invalid tags: " + B);
|
|
2215
|
+
f = new RegExp(De(B[0]) + "\\s*"), g = new RegExp("\\s*" + De(B[1])), h = new RegExp("\\s*" + De("}" + B[1]));
|
|
2216
|
+
}
|
|
2217
|
+
x(n || N.tags);
|
|
2218
|
+
for (var d = new ye(e), A, E, v, K, W, Y; !d.eos(); ) {
|
|
2219
|
+
if (A = d.pos, v = d.scanUntil(f), v)
|
|
2220
|
+
for (var ae = 0, X = v.length; ae < X; ++ae)
|
|
2221
|
+
K = v.charAt(ae), To(K) ? (l.push(t.length), c += K) : (a = !0, r = !0, c += " "), t.push(["text", K, A, A + 1]), A += 1, K === `
|
|
2222
|
+
` && (s(), c = "", u = 0, r = !1);
|
|
2223
|
+
if (!d.scan(f))
|
|
2224
|
+
break;
|
|
2225
|
+
if (o = !0, E = d.scan(Mo) || "name", d.scan(Io), E === "=" ? (v = d.scanUntil(On), d.scan(On), d.scanUntil(g)) : E === "{" ? (v = d.scanUntil(h), d.scan(Ro), d.scanUntil(g), E = "&") : v = d.scanUntil(g), !d.scan(g))
|
|
2226
|
+
throw new Error("Unclosed tag at " + d.pos);
|
|
2227
|
+
if (E == ">" ? W = [E, v, A, d.pos, c, u, r] : W = [E, v, A, d.pos], u++, t.push(W), E === "#" || E === "^")
|
|
2228
|
+
i.push(W);
|
|
2229
|
+
else if (E === "/") {
|
|
2230
|
+
if (Y = i.pop(), !Y)
|
|
2231
|
+
throw new Error('Unopened section "' + v + '" at ' + A);
|
|
2232
|
+
if (Y[1] !== v)
|
|
2233
|
+
throw new Error('Unclosed section "' + Y[1] + '" at ' + A);
|
|
2234
|
+
} else E === "name" || E === "{" || E === "&" ? a = !0 : E === "=" && x(v);
|
|
2235
|
+
}
|
|
2236
|
+
if (s(), Y = i.pop(), Y)
|
|
2237
|
+
throw new Error('Unclosed section "' + Y[1] + '" at ' + d.pos);
|
|
2238
|
+
return Bo(Do(t));
|
|
2239
|
+
}
|
|
2240
|
+
function Do(e) {
|
|
2241
|
+
for (var n = [], r, i, t = 0, l = e.length; t < l; ++t)
|
|
2242
|
+
r = e[t], r && (r[0] === "text" && i && i[0] === "text" ? (i[1] += r[1], i[3] = r[3]) : (n.push(r), i = r));
|
|
2243
|
+
return n;
|
|
2244
|
+
}
|
|
2245
|
+
function Bo(e) {
|
|
2246
|
+
for (var n = [], r = n, i = [], t, l, o = 0, a = e.length; o < a; ++o)
|
|
2247
|
+
switch (t = e[o], t[0]) {
|
|
2248
|
+
case "#":
|
|
2249
|
+
case "^":
|
|
2250
|
+
r.push(t), i.push(t), r = t[4] = [];
|
|
2251
|
+
break;
|
|
2252
|
+
case "/":
|
|
2253
|
+
l = i.pop(), l[5] = t[2], r = i.length > 0 ? i[i.length - 1][4] : n;
|
|
2254
|
+
break;
|
|
2255
|
+
default:
|
|
2256
|
+
r.push(t);
|
|
2257
|
+
}
|
|
2258
|
+
return n;
|
|
2259
|
+
}
|
|
2260
|
+
function ye(e) {
|
|
2261
|
+
this.string = e, this.tail = e, this.pos = 0;
|
|
2262
|
+
}
|
|
2263
|
+
ye.prototype.eos = function() {
|
|
2264
|
+
return this.tail === "";
|
|
2265
|
+
};
|
|
2266
|
+
ye.prototype.scan = function(n) {
|
|
2267
|
+
var r = this.tail.match(n);
|
|
2268
|
+
if (!r || r.index !== 0)
|
|
2269
|
+
return "";
|
|
2270
|
+
var i = r[0];
|
|
2271
|
+
return this.tail = this.tail.substring(i.length), this.pos += i.length, i;
|
|
2272
|
+
};
|
|
2273
|
+
ye.prototype.scanUntil = function(n) {
|
|
2274
|
+
var r = this.tail.search(n), i;
|
|
2275
|
+
switch (r) {
|
|
2276
|
+
case -1:
|
|
2277
|
+
i = this.tail, this.tail = "";
|
|
2278
|
+
break;
|
|
2279
|
+
case 0:
|
|
2280
|
+
i = "";
|
|
2281
|
+
break;
|
|
2282
|
+
default:
|
|
2283
|
+
i = this.tail.substring(0, r), this.tail = this.tail.substring(r);
|
|
2284
|
+
}
|
|
2285
|
+
return this.pos += i.length, i;
|
|
2286
|
+
};
|
|
2287
|
+
function oe(e, n) {
|
|
2288
|
+
this.view = e, this.cache = { ".": this.view }, this.parent = n;
|
|
2289
|
+
}
|
|
2290
|
+
oe.prototype.push = function(n) {
|
|
2291
|
+
return new oe(n, this);
|
|
2292
|
+
};
|
|
2293
|
+
oe.prototype.lookup = function(n) {
|
|
2294
|
+
var r = this.cache, i;
|
|
2295
|
+
if (r.hasOwnProperty(n))
|
|
2296
|
+
i = r[n];
|
|
2297
|
+
else {
|
|
2298
|
+
for (var t = this, l, o, a, c = !1; t; ) {
|
|
2299
|
+
if (n.indexOf(".") > 0)
|
|
2300
|
+
for (l = t.view, o = n.split("."), a = 0; l != null && a < o.length; )
|
|
2301
|
+
a === o.length - 1 && (c = kn(l, o[a]) || _o(l, o[a])), l = l[o[a++]];
|
|
2302
|
+
else
|
|
2303
|
+
l = t.view[n], c = kn(t.view, n);
|
|
2304
|
+
if (c) {
|
|
2305
|
+
i = l;
|
|
2306
|
+
break;
|
|
2307
|
+
}
|
|
2308
|
+
t = t.parent;
|
|
2309
|
+
}
|
|
2310
|
+
r[n] = i;
|
|
2311
|
+
}
|
|
2312
|
+
return Je(i) && (i = i.call(this.view)), i;
|
|
2313
|
+
};
|
|
2314
|
+
function R() {
|
|
2315
|
+
this.templateCache = {
|
|
2316
|
+
_cache: {},
|
|
2317
|
+
set: function(n, r) {
|
|
2318
|
+
this._cache[n] = r;
|
|
2319
|
+
},
|
|
2320
|
+
get: function(n) {
|
|
2321
|
+
return this._cache[n];
|
|
2322
|
+
},
|
|
2323
|
+
clear: function() {
|
|
2324
|
+
this._cache = {};
|
|
2325
|
+
}
|
|
2326
|
+
};
|
|
2327
|
+
}
|
|
2328
|
+
R.prototype.clearCache = function() {
|
|
2329
|
+
typeof this.templateCache < "u" && this.templateCache.clear();
|
|
2330
|
+
};
|
|
2331
|
+
R.prototype.parse = function(n, r) {
|
|
2332
|
+
var i = this.templateCache, t = n + ":" + (r || N.tags).join(":"), l = typeof i < "u", o = l ? i.get(t) : void 0;
|
|
2333
|
+
return o == null && (o = Po(n, r), l && i.set(t, o)), o;
|
|
2334
|
+
};
|
|
2335
|
+
R.prototype.render = function(n, r, i, t) {
|
|
2336
|
+
var l = this.getConfigTags(t), o = this.parse(n, l), a = r instanceof oe ? r : new oe(r, void 0);
|
|
2337
|
+
return this.renderTokens(o, a, i, n, t);
|
|
2338
|
+
};
|
|
2339
|
+
R.prototype.renderTokens = function(n, r, i, t, l) {
|
|
2340
|
+
for (var o = "", a, c, u, s = 0, f = n.length; s < f; ++s)
|
|
2341
|
+
u = void 0, a = n[s], c = a[0], c === "#" ? u = this.renderSection(a, r, i, t, l) : c === "^" ? u = this.renderInverted(a, r, i, t, l) : c === ">" ? u = this.renderPartial(a, r, i, l) : c === "&" ? u = this.unescapedValue(a, r) : c === "name" ? u = this.escapedValue(a, r, l) : c === "text" && (u = this.rawValue(a)), u !== void 0 && (o += u);
|
|
2342
|
+
return o;
|
|
2343
|
+
};
|
|
2344
|
+
R.prototype.renderSection = function(n, r, i, t, l) {
|
|
2345
|
+
var o = this, a = "", c = r.lookup(n[1]);
|
|
2346
|
+
function u(g) {
|
|
2347
|
+
return o.render(g, r, i, l);
|
|
2348
|
+
}
|
|
2349
|
+
if (c) {
|
|
2350
|
+
if (le(c))
|
|
2351
|
+
for (var s = 0, f = c.length; s < f; ++s)
|
|
2352
|
+
a += this.renderTokens(n[4], r.push(c[s]), i, t, l);
|
|
2353
|
+
else if (typeof c == "object" || typeof c == "string" || typeof c == "number")
|
|
2354
|
+
a += this.renderTokens(n[4], r.push(c), i, t, l);
|
|
2355
|
+
else if (Je(c)) {
|
|
2356
|
+
if (typeof t != "string")
|
|
2357
|
+
throw new Error("Cannot use higher-order sections without the original template");
|
|
2358
|
+
c = c.call(r.view, t.slice(n[3], n[5]), u), c != null && (a += c);
|
|
2359
|
+
} else
|
|
2360
|
+
a += this.renderTokens(n[4], r, i, t, l);
|
|
2361
|
+
return a;
|
|
2362
|
+
}
|
|
2363
|
+
};
|
|
2364
|
+
R.prototype.renderInverted = function(n, r, i, t, l) {
|
|
2365
|
+
var o = r.lookup(n[1]);
|
|
2366
|
+
if (!o || le(o) && o.length === 0)
|
|
2367
|
+
return this.renderTokens(n[4], r, i, t, l);
|
|
2368
|
+
};
|
|
2369
|
+
R.prototype.indentPartial = function(n, r, i) {
|
|
2370
|
+
for (var t = r.replace(/[^ \t]/g, ""), l = n.split(`
|
|
2371
|
+
`), o = 0; o < l.length; o++)
|
|
2372
|
+
l[o].length && (o > 0 || !i) && (l[o] = t + l[o]);
|
|
2373
|
+
return l.join(`
|
|
2374
|
+
`);
|
|
2375
|
+
};
|
|
2376
|
+
R.prototype.renderPartial = function(n, r, i, t) {
|
|
2377
|
+
if (i) {
|
|
2378
|
+
var l = this.getConfigTags(t), o = Je(i) ? i(n[1]) : i[n[1]];
|
|
2379
|
+
if (o != null) {
|
|
2380
|
+
var a = n[6], c = n[5], u = n[4], s = o;
|
|
2381
|
+
c == 0 && u && (s = this.indentPartial(o, u, a));
|
|
2382
|
+
var f = this.parse(s, l);
|
|
2383
|
+
return this.renderTokens(f, r, i, s, t);
|
|
2384
|
+
}
|
|
2385
|
+
}
|
|
2386
|
+
};
|
|
2387
|
+
R.prototype.unescapedValue = function(n, r) {
|
|
2388
|
+
var i = r.lookup(n[1]);
|
|
2389
|
+
if (i != null)
|
|
2390
|
+
return i;
|
|
2391
|
+
};
|
|
2392
|
+
R.prototype.escapedValue = function(n, r, i) {
|
|
2393
|
+
var t = this.getConfigEscape(i) || N.escape, l = r.lookup(n[1]);
|
|
2394
|
+
if (l != null)
|
|
2395
|
+
return typeof l == "number" && t === N.escape ? String(l) : t(l);
|
|
2396
|
+
};
|
|
2397
|
+
R.prototype.rawValue = function(n) {
|
|
2398
|
+
return n[1];
|
|
2399
|
+
};
|
|
2400
|
+
R.prototype.getConfigTags = function(n) {
|
|
2401
|
+
return le(n) ? n : n && typeof n == "object" ? n.tags : void 0;
|
|
2402
|
+
};
|
|
2403
|
+
R.prototype.getConfigEscape = function(n) {
|
|
2404
|
+
if (n && typeof n == "object" && !le(n))
|
|
2405
|
+
return n.escape;
|
|
2406
|
+
};
|
|
2407
|
+
var N = {
|
|
2408
|
+
name: "mustache.js",
|
|
2409
|
+
version: "4.2.0",
|
|
2410
|
+
tags: ["{{", "}}"],
|
|
2411
|
+
clearCache: void 0,
|
|
2412
|
+
escape: void 0,
|
|
2413
|
+
parse: void 0,
|
|
2414
|
+
render: void 0,
|
|
2415
|
+
Scanner: void 0,
|
|
2416
|
+
Context: void 0,
|
|
2417
|
+
Writer: void 0,
|
|
2418
|
+
/**
|
|
2419
|
+
* Allows a user to override the default caching strategy, by providing an
|
|
2420
|
+
* object with set, get and clear methods. This can also be used to disable
|
|
2421
|
+
* the cache by setting it to the literal `undefined`.
|
|
2422
|
+
*/
|
|
2423
|
+
set templateCache(e) {
|
|
2424
|
+
ge.templateCache = e;
|
|
2425
|
+
},
|
|
2426
|
+
/**
|
|
2427
|
+
* Gets the default or overridden caching object from the default writer.
|
|
2428
|
+
*/
|
|
2429
|
+
get templateCache() {
|
|
2430
|
+
return ge.templateCache;
|
|
2431
|
+
}
|
|
2432
|
+
}, ge = new R();
|
|
2433
|
+
N.clearCache = function() {
|
|
2434
|
+
return ge.clearCache();
|
|
2435
|
+
};
|
|
2436
|
+
N.parse = function(n, r) {
|
|
2437
|
+
return ge.parse(n, r);
|
|
2438
|
+
};
|
|
2439
|
+
N.render = function(n, r, i, t) {
|
|
2440
|
+
if (typeof n != "string")
|
|
2441
|
+
throw new TypeError('Invalid template! Template should be a "string" but "' + So(n) + '" was given as the first argument for mustache#render(template, view, partials)');
|
|
2442
|
+
return ge.render(n, r, i, t);
|
|
2443
|
+
};
|
|
2444
|
+
N.escape = jo;
|
|
2445
|
+
N.Scanner = ye;
|
|
2446
|
+
N.Context = oe;
|
|
2447
|
+
N.Writer = R;
|
|
2448
|
+
function Fn(e, {
|
|
2449
|
+
glob: n,
|
|
2450
|
+
regex: r,
|
|
2451
|
+
substring: i
|
|
2452
|
+
}) {
|
|
2453
|
+
const t = [n, r, i].filter((l) => l !== void 0);
|
|
2454
|
+
if (t.length !== 0) {
|
|
2455
|
+
if (t.length > 1)
|
|
2456
|
+
throw new Error(`Specify only one of --${e}, --${e}-glob, --${e}-regex, --${e}-substring`);
|
|
2457
|
+
return r !== void 0 ? { pattern: r, mode: "regex" } : i !== void 0 ? { pattern: i, mode: "substring" } : { pattern: n, mode: "glob" };
|
|
2458
|
+
}
|
|
2459
|
+
}
|
|
2460
|
+
function Uo() {
|
|
2461
|
+
return {
|
|
2462
|
+
command: "list",
|
|
2463
|
+
describe: "List strings in the xcstrings file",
|
|
2464
|
+
builder: (e) => e.option("key", {
|
|
2465
|
+
type: "string",
|
|
2466
|
+
describe: "Filter keys by glob (default)"
|
|
2467
|
+
}).option("key-glob", {
|
|
2468
|
+
type: "string",
|
|
2469
|
+
describe: "Filter keys by glob (explicit)"
|
|
2470
|
+
}).option("key-regex", {
|
|
2471
|
+
type: "string",
|
|
2472
|
+
describe: "Filter keys by regex"
|
|
2473
|
+
}).option("key-substring", {
|
|
2474
|
+
type: "string",
|
|
2475
|
+
describe: "Filter keys by substring match"
|
|
2476
|
+
}).option("text", {
|
|
2477
|
+
type: "string",
|
|
2478
|
+
describe: "Filter translations by glob (default)"
|
|
2479
|
+
}).option("text-glob", {
|
|
2480
|
+
type: "string",
|
|
2481
|
+
describe: "Filter translations by glob (explicit)"
|
|
2482
|
+
}).option("text-regex", {
|
|
2483
|
+
type: "string",
|
|
2484
|
+
describe: "Filter translations by regex"
|
|
2485
|
+
}).option("text-substring", {
|
|
2486
|
+
type: "string",
|
|
2487
|
+
describe: "Filter translations by substring match"
|
|
2488
|
+
}).option("languages", {
|
|
2489
|
+
type: "string",
|
|
2490
|
+
array: !0,
|
|
2491
|
+
alias: "l",
|
|
2492
|
+
describe: "Include only these languages"
|
|
2493
|
+
}).option("format", {
|
|
2494
|
+
type: "string",
|
|
2495
|
+
describe: "Mustache template. Available variables: {{language}}, {{key}}, {{text}}"
|
|
2496
|
+
}).check((n) => {
|
|
2497
|
+
const r = [n.key, n["key-glob"]].filter((c) => c !== void 0).length, i = n["key-regex"] ? 1 : 0, t = n["key-substring"] ? 1 : 0;
|
|
2498
|
+
if (r + i + t > 1)
|
|
2499
|
+
throw new Error("Specify only one of --key/--key-glob, --key-regex, or --key-substring");
|
|
2500
|
+
const l = [n.text, n["text-glob"]].filter((c) => c !== void 0).length, o = n["text-regex"] ? 1 : 0, a = n["text-substring"] ? 1 : 0;
|
|
2501
|
+
if (l + o + a > 1)
|
|
2502
|
+
throw new Error("Specify only one of --text/--text-glob, --text-regex, or --text-substring");
|
|
2503
|
+
return !0;
|
|
2504
|
+
}),
|
|
2505
|
+
handler: async (e) => {
|
|
2506
|
+
const n = [e.key, e["key-glob"]].filter((o) => o !== void 0), r = [e.text, e["text-glob"]].filter((o) => o !== void 0), i = Fn("key", {
|
|
2507
|
+
glob: n[0],
|
|
2508
|
+
regex: e["key-regex"],
|
|
2509
|
+
substring: e["key-substring"]
|
|
2510
|
+
}), t = Fn("text", {
|
|
2511
|
+
glob: r[0],
|
|
2512
|
+
regex: e["text-regex"],
|
|
2513
|
+
substring: e["text-substring"]
|
|
2514
|
+
}), l = await $o({
|
|
2515
|
+
path: e.path,
|
|
2516
|
+
languages: e.languages,
|
|
2517
|
+
keyFilter: i,
|
|
2518
|
+
textFilter: t,
|
|
2519
|
+
format: e.format
|
|
2520
|
+
});
|
|
2521
|
+
l && console.log(l);
|
|
2522
|
+
}
|
|
2523
|
+
};
|
|
2524
|
+
}
|
|
2525
|
+
function Yo(e) {
|
|
2526
|
+
const n = e.replace(/[.+^${}()|\\]/g, "\\$&").replace(/\*/g, ".*").replace(/\?/g, ".");
|
|
2527
|
+
return new RegExp(`^${n}$`);
|
|
2528
|
+
}
|
|
2529
|
+
function Tn(e) {
|
|
2530
|
+
if (!e) return () => !0;
|
|
2531
|
+
if (e.mode === "regex") {
|
|
2532
|
+
const r = new RegExp(e.pattern);
|
|
2533
|
+
return (i) => r.test(i);
|
|
2534
|
+
}
|
|
2535
|
+
if (e.mode === "substring") {
|
|
2536
|
+
const r = e.pattern;
|
|
2537
|
+
return (i) => i.includes(r);
|
|
2538
|
+
}
|
|
2539
|
+
const n = Yo(e.pattern);
|
|
2540
|
+
return (r) => n.test(r);
|
|
2541
|
+
}
|
|
2542
|
+
function zo(e, n) {
|
|
2543
|
+
const r = N.escape;
|
|
2544
|
+
N.escape = (i) => i;
|
|
2545
|
+
try {
|
|
2546
|
+
return N.render(e, n);
|
|
2547
|
+
} finally {
|
|
2548
|
+
N.escape = r;
|
|
2549
|
+
}
|
|
2550
|
+
}
|
|
2551
|
+
async function $o(e) {
|
|
2552
|
+
const r = (await me(e.path)).strings ?? {}, i = Tn(e.keyFilter), t = Tn(e.textFilter), l = e.languages ? new Set(e.languages) : null, o = !!e.format, a = [];
|
|
2553
|
+
for (const c of Object.keys(r)) {
|
|
2554
|
+
if (!i(c)) continue;
|
|
2555
|
+
const s = r[c]?.localizations ?? {}, f = Object.keys(s), g = [];
|
|
2556
|
+
for (const h of f) {
|
|
2557
|
+
if (l && !l.has(h)) continue;
|
|
2558
|
+
const x = s[h]?.stringUnit?.value ?? "";
|
|
2559
|
+
t(x) && (o && e.format ? g.push(zo(e.format, { language: h, key: c, text: x })) : g.push(` ${h}: ${JSON.stringify(x)}`));
|
|
2560
|
+
}
|
|
2561
|
+
g.length !== 0 && (o ? a.push(...g) : a.push(`${c}:`, ...g));
|
|
2562
|
+
}
|
|
2563
|
+
return a.join(`
|
|
2564
|
+
`);
|
|
2565
|
+
}
|
|
2566
|
+
const Ln = Fe(process.cwd(), "Localizable.xcstrings");
|
|
2567
|
+
Tr(Lr(process.argv)).scriptName("xcstrings").usage("$0 <cmd> [args]").option("config", {
|
|
2057
2568
|
type: "string",
|
|
2058
2569
|
describe: "Path to config file"
|
|
2059
2570
|
}).option("path", {
|
|
2060
2571
|
type: "string",
|
|
2061
2572
|
describe: "Path to xcstrings file",
|
|
2062
|
-
default:
|
|
2573
|
+
default: Ln
|
|
2063
2574
|
}).middleware(async (e) => {
|
|
2064
|
-
const n = await
|
|
2065
|
-
e.path = await
|
|
2066
|
-
}).command(
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
(
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
describe: "The comment for the string"
|
|
2076
|
-
}).option("language", {
|
|
2077
|
-
type: "string",
|
|
2078
|
-
alias: "l",
|
|
2079
|
-
describe: "The language of the string provided with --text"
|
|
2080
|
-
}).option("text", {
|
|
2081
|
-
type: "string",
|
|
2082
|
-
describe: "The string value for the default language"
|
|
2083
|
-
}).option("strings", {
|
|
2084
|
-
type: "string",
|
|
2085
|
-
describe: "The strings JSON or YAML"
|
|
2086
|
-
}).option("strings-format", {
|
|
2087
|
-
type: "string",
|
|
2088
|
-
choices: ["auto", "json", "yaml"],
|
|
2089
|
-
default: "auto",
|
|
2090
|
-
describe: "Format for the data provided with --strings"
|
|
2091
|
-
}),
|
|
2092
|
-
async (e) => {
|
|
2093
|
-
await tl({
|
|
2094
|
-
path: e.path,
|
|
2095
|
-
key: e.key,
|
|
2096
|
-
comment: e.comment,
|
|
2097
|
-
stringsArg: e.strings,
|
|
2098
|
-
stringsFormat: e["strings-format"],
|
|
2099
|
-
defaultString: e.text,
|
|
2100
|
-
language: e.language,
|
|
2101
|
-
stdinReader: void 0,
|
|
2102
|
-
configPath: e.config
|
|
2103
|
-
}), W.info(b.green(`✓ Added key "${e.key}"`));
|
|
2104
|
-
}
|
|
2105
|
-
).command(
|
|
2106
|
-
"remove",
|
|
2107
|
-
"Remove a string",
|
|
2108
|
-
(e) => e.option("key", {
|
|
2109
|
-
type: "string",
|
|
2110
|
-
describe: "The key to remove",
|
|
2111
|
-
alias: "k"
|
|
2112
|
-
}).option("languages", {
|
|
2113
|
-
type: "string",
|
|
2114
|
-
array: !0,
|
|
2115
|
-
describe: "Languages to remove",
|
|
2116
|
-
alias: "l"
|
|
2117
|
-
}).option("dry-run", {
|
|
2118
|
-
type: "boolean",
|
|
2119
|
-
default: !1,
|
|
2120
|
-
describe: "Show what would be removed without writing changes",
|
|
2121
|
-
alias: "n"
|
|
2122
|
-
}).check((n) => {
|
|
2123
|
-
if (n.key || n.languages && n.languages.length > 0)
|
|
2124
|
-
return !0;
|
|
2125
|
-
throw new Error("Either --key or --languages must be provided");
|
|
2126
|
-
}),
|
|
2127
|
-
async (e) => {
|
|
2128
|
-
const n = await ki(
|
|
2129
|
-
e.path,
|
|
2130
|
-
e.key,
|
|
2131
|
-
e.languages,
|
|
2132
|
-
e.dryRun === !0
|
|
2133
|
-
), i = Object.entries(n).map(([r, o]) => `- [${o.join(" ")}] ${r}`).join(`
|
|
2134
|
-
`);
|
|
2135
|
-
if (e.dryRun) {
|
|
2136
|
-
i.length === 0 ? W.info(b.yellow("No matching strings found.")) : W.info(b.blue(`Would remove:
|
|
2137
|
-
${i}`));
|
|
2138
|
-
return;
|
|
2139
|
-
}
|
|
2140
|
-
i.length === 0 ? W.info(b.yellow("No matching strings found.")) : W.info(b.green(`✓ Removed
|
|
2141
|
-
${i}`));
|
|
2142
|
-
}
|
|
2143
|
-
).command(
|
|
2144
|
-
"init",
|
|
2145
|
-
"Initialize configuration file",
|
|
2146
|
-
(e) => e,
|
|
2147
|
-
async () => {
|
|
2148
|
-
await Ii();
|
|
2149
|
-
}
|
|
2150
|
-
).command(
|
|
2151
|
-
"languages",
|
|
2152
|
-
"List supported languages from xcodeproj or xcstrings",
|
|
2153
|
-
(e) => e,
|
|
2154
|
-
async (e) => {
|
|
2155
|
-
const n = await bn(e.path, e.config);
|
|
2156
|
-
W.info(n.join(" "));
|
|
2157
|
-
}
|
|
2158
|
-
).demandCommand(1, "").strictCommands().recommendCommands().showHelpOnFail(!0).fail((e, n, i) => {
|
|
2159
|
-
const r = e || n?.message;
|
|
2160
|
-
r && (console.error(b.red(r)), console.log(), i.showHelp(), process.exit(1)), n && (console.error(n), process.exit(1)), i.showHelp(), process.exit(1);
|
|
2575
|
+
const n = await Ke(e.config);
|
|
2576
|
+
e.path = await Pr(e.path, n, Ln);
|
|
2577
|
+
}).command([
|
|
2578
|
+
go(),
|
|
2579
|
+
yo(),
|
|
2580
|
+
bo(),
|
|
2581
|
+
Hr(),
|
|
2582
|
+
Uo()
|
|
2583
|
+
]).demandCommand(1, "").strictCommands().recommendCommands().showHelpOnFail(!0).fail((e, n, r) => {
|
|
2584
|
+
const i = e || n?.message;
|
|
2585
|
+
i && (console.error(C.red(i)), console.log(), r.showHelp(), process.exit(1)), n && (console.error(n), process.exit(1)), r.showHelp(), process.exit(1);
|
|
2161
2586
|
}).help().argv;
|