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