@keycloak/keycloak-admin-ui 26.4.7 → 26.5.1
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/lib/.vite/manifest.json +53 -43
- package/lib/AddJWTAuthorizationGrant-CmYIQF47.js +69 -0
- package/lib/AddJWTAuthorizationGrant-CmYIQF47.js.map +1 -0
- package/lib/{AddKubernetesConnect-TKm82MxO.js → AddKubernetesConnect--zBiT7am.js} +4 -4
- package/lib/{AddKubernetesConnect-TKm82MxO.js.map → AddKubernetesConnect--zBiT7am.js.map} +1 -1
- package/lib/{AddOAuth2-Bg_V5CMD.js → AddOAuth2-BLRNGQKN.js} +15 -15
- package/lib/{AddOAuth2-Bg_V5CMD.js.map → AddOAuth2-BLRNGQKN.js.map} +1 -1
- package/lib/{AddSpiffeConnect-gH8LxYcP.js → AddSpiffeConnect-NfHagx80.js} +5 -5
- package/lib/{AddSpiffeConnect-gH8LxYcP.js.map → AddSpiffeConnect-NfHagx80.js.map} +1 -1
- package/lib/{CreateFlow-6M8Wg_2H.js → CreateFlow-Bf02T80Q.js} +2 -2
- package/lib/{CreateFlow-6M8Wg_2H.js.map → CreateFlow-Bf02T80Q.js.map} +1 -1
- package/lib/DetailOrganization-DWvk7gJ9.js +194 -0
- package/lib/DetailOrganization-DWvk7gJ9.js.map +1 -0
- package/lib/{ExecutorForm-BYCH7c3u.js → ExecutorForm-DHTRUoB1.js} +2 -2
- package/lib/{ExecutorForm-BYCH7c3u.js.map → ExecutorForm-DHTRUoB1.js.map} +1 -1
- package/lib/{FlowDetails-Dkl-8lLX.js → FlowDetails--N_U426z.js} +1021 -1048
- package/lib/{FlowDetails-Dkl-8lLX.js.map → FlowDetails--N_U426z.js.map} +1 -1
- package/lib/{NewOrganization-CBaP7xLv.js → NewOrganization-7we_ianL.js} +12 -12
- package/lib/{NewOrganization-CBaP7xLv.js.map → NewOrganization-7we_ianL.js.map} +1 -1
- package/lib/{PermissionConfigurationDetails-C0sgaW6Y.js → PermissionConfigurationDetails-u9MRYXxC.js} +18 -18
- package/lib/{PermissionConfigurationDetails-C0sgaW6Y.js.map → PermissionConfigurationDetails-u9MRYXxC.js.map} +1 -1
- package/lib/{PermissionDetails-CCdfBuaW.js → PermissionDetails-DxeSTYxA.js} +2 -2
- package/lib/{PermissionDetails-CCdfBuaW.js.map → PermissionDetails-DxeSTYxA.js.map} +1 -1
- package/lib/{RealmSection-CbqC2up8.js → RealmSection-DoqGXY7F.js} +7 -7
- package/lib/{RealmSection-CbqC2up8.js.map → RealmSection-DoqGXY7F.js.map} +1 -1
- package/lib/{ResourceDetails-DWXjggUc.js → ResourceDetails-Bn6Uim5l.js} +3 -3
- package/lib/{ResourceDetails-DWXjggUc.js.map → ResourceDetails-Bn6Uim5l.js.map} +1 -1
- package/lib/{ScopeDetails-dcHTfc9f.js → ScopeDetails-BCjTo6cS.js} +2 -2
- package/lib/{ScopeDetails-dcHTfc9f.js.map → ScopeDetails-BCjTo6cS.js.map} +1 -1
- package/lib/{ScopePicker-DNYZfIbU.js → ScopePicker-Dd6Cs54v.js} +7 -7
- package/lib/{ScopePicker-DNYZfIbU.js.map → ScopePicker-Dd6Cs54v.js.map} +1 -1
- package/lib/WorkflowDetailForm-alfgEItU.js +4938 -0
- package/lib/WorkflowDetailForm-alfgEItU.js.map +1 -0
- package/lib/WorkflowsSection-DflIdHaB.js +135 -0
- package/lib/WorkflowsSection-DflIdHaB.js.map +1 -0
- package/lib/client-scopes/details/SearchFilter.d.ts +1 -1
- package/lib/clients/constants.d.ts +2 -0
- package/lib/clients/keys/ImportKeyDialog.d.ts +3 -1
- package/lib/components/dynamic/ClaimDisplayComponent.d.ts +2 -0
- package/lib/components/dynamic/IdentityProviderMultiSelectComponent.d.ts +2 -0
- package/lib/components/dynamic/MultivaluedListComponent.d.ts +6 -1
- package/lib/components/dynamic/components.d.ts +2 -1
- package/lib/components/identity-provider/IdentityProviderSelect.d.ts +10 -0
- package/lib/components/users/UserDataTableAttributeSearchForm.d.ts +2 -1
- package/lib/groups/GroupRoleMapping.d.ts +2 -1
- package/lib/identity-providers/add/AddJWTAuthorizationGrant.d.ts +1 -0
- package/lib/identity-providers/add/JWTAuthorizationGrantAssertionSettings.d.ts +1 -0
- package/lib/identity-providers/add/JWTAuthorizationGrantSettings.d.ts +1 -0
- package/lib/identity-providers/add/JwksSettings.d.ts +5 -0
- package/lib/identity-providers/routes/IdentityProviderJWTAuthorizationGrant.d.ts +7 -0
- package/lib/{index-YEmLy1gM.js → index-Ddam0zn3.js} +28912 -27332
- package/lib/{index-YEmLy1gM.js.map → index-Ddam0zn3.js.map} +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/keycloak-admin-ui.js +147 -145
- package/lib/organizations/Invitations.d.ts +1 -0
- package/lib/organizations/MembersSection.d.ts +1 -0
- package/lib/realm-settings/TokensTab.d.ts +2 -2
- package/lib/utils/useIsFeatureEnabled.d.ts +1 -0
- package/lib/workflows/WorkflowDetailForm.d.ts +1 -0
- package/lib/workflows/routes/WorkflowDetail.d.ts +9 -0
- package/package.json +34 -22
- package/lib/CreateWorkflow-zbDnQ8Gr.js +0 -86
- package/lib/CreateWorkflow-zbDnQ8Gr.js.map +0 -1
- package/lib/DetailOrganization-DfVZ7YOx.js +0 -164
- package/lib/DetailOrganization-DfVZ7YOx.js.map +0 -1
- package/lib/WorkflowsSection-DZtAH1DA.js +0 -92
- package/lib/WorkflowsSection-DZtAH1DA.js.map +0 -1
- package/lib/workflows/CreateWorkflow.d.ts +0 -1
- package/lib/workflows/routes/AddWorkflow.d.ts +0 -7
|
@@ -0,0 +1,4938 @@
|
|
|
1
|
+
import { jsxs as tt, Fragment as Fs, jsx as j } from "react/jsx-runtime";
|
|
2
|
+
import { u as Rs, a as Us, _ as Vs, ao as Ys, b as Js, y as Gs, V as Ws, F as Qs, P as Hs, c as Xs, au as zs, al as xs, bJ as Zs, a7 as en, A as tn, e as sn, B as _t, bI as nn, bK as vt, d as Mt } from "./index-Ddam0zn3.js";
|
|
3
|
+
import { useTranslation as rn } from "react-i18next";
|
|
4
|
+
import { useNavigate as on, Link as Bt } from "react-router-dom";
|
|
5
|
+
const mt = /* @__PURE__ */ Symbol.for("yaml.alias"), ct = /* @__PURE__ */ Symbol.for("yaml.document"), W = /* @__PURE__ */ Symbol.for("yaml.map"), Gt = /* @__PURE__ */ Symbol.for("yaml.pair"), U = /* @__PURE__ */ Symbol.for("yaml.scalar"), de = /* @__PURE__ */ Symbol.for("yaml.seq"), D = /* @__PURE__ */ Symbol.for("yaml.node.type"), H = (s) => !!s && typeof s == "object" && s[D] === mt, ee = (s) => !!s && typeof s == "object" && s[D] === ct, pe = (s) => !!s && typeof s == "object" && s[D] === W, T = (s) => !!s && typeof s == "object" && s[D] === Gt, I = (s) => !!s && typeof s == "object" && s[D] === U, me = (s) => !!s && typeof s == "object" && s[D] === de;
|
|
6
|
+
function L(s) {
|
|
7
|
+
if (s && typeof s == "object")
|
|
8
|
+
switch (s[D]) {
|
|
9
|
+
case W:
|
|
10
|
+
case de:
|
|
11
|
+
return !0;
|
|
12
|
+
}
|
|
13
|
+
return !1;
|
|
14
|
+
}
|
|
15
|
+
function $(s) {
|
|
16
|
+
if (s && typeof s == "object")
|
|
17
|
+
switch (s[D]) {
|
|
18
|
+
case mt:
|
|
19
|
+
case W:
|
|
20
|
+
case U:
|
|
21
|
+
case de:
|
|
22
|
+
return !0;
|
|
23
|
+
}
|
|
24
|
+
return !1;
|
|
25
|
+
}
|
|
26
|
+
const Wt = (s) => (I(s) || L(s)) && !!s.anchor, B = /* @__PURE__ */ Symbol("break visit"), Qt = /* @__PURE__ */ Symbol("skip children"), R = /* @__PURE__ */ Symbol("remove node");
|
|
27
|
+
function te(s, e) {
|
|
28
|
+
const t = Ht(e);
|
|
29
|
+
ee(s) ? re(null, s.contents, t, Object.freeze([s])) === R && (s.contents = null) : re(null, s, t, Object.freeze([]));
|
|
30
|
+
}
|
|
31
|
+
te.BREAK = B;
|
|
32
|
+
te.SKIP = Qt;
|
|
33
|
+
te.REMOVE = R;
|
|
34
|
+
function re(s, e, t, n) {
|
|
35
|
+
const i = Xt(s, e, t, n);
|
|
36
|
+
if ($(i) || T(i))
|
|
37
|
+
return zt(s, n, i), re(s, i, t, n);
|
|
38
|
+
if (typeof i != "symbol") {
|
|
39
|
+
if (L(e)) {
|
|
40
|
+
n = Object.freeze(n.concat(e));
|
|
41
|
+
for (let r = 0; r < e.items.length; ++r) {
|
|
42
|
+
const o = re(r, e.items[r], t, n);
|
|
43
|
+
if (typeof o == "number")
|
|
44
|
+
r = o - 1;
|
|
45
|
+
else {
|
|
46
|
+
if (o === B)
|
|
47
|
+
return B;
|
|
48
|
+
o === R && (e.items.splice(r, 1), r -= 1);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
} else if (T(e)) {
|
|
52
|
+
n = Object.freeze(n.concat(e));
|
|
53
|
+
const r = re("key", e.key, t, n);
|
|
54
|
+
if (r === B)
|
|
55
|
+
return B;
|
|
56
|
+
r === R && (e.key = null);
|
|
57
|
+
const o = re("value", e.value, t, n);
|
|
58
|
+
if (o === B)
|
|
59
|
+
return B;
|
|
60
|
+
o === R && (e.value = null);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return i;
|
|
64
|
+
}
|
|
65
|
+
async function Re(s, e) {
|
|
66
|
+
const t = Ht(e);
|
|
67
|
+
ee(s) ? await oe(null, s.contents, t, Object.freeze([s])) === R && (s.contents = null) : await oe(null, s, t, Object.freeze([]));
|
|
68
|
+
}
|
|
69
|
+
Re.BREAK = B;
|
|
70
|
+
Re.SKIP = Qt;
|
|
71
|
+
Re.REMOVE = R;
|
|
72
|
+
async function oe(s, e, t, n) {
|
|
73
|
+
const i = await Xt(s, e, t, n);
|
|
74
|
+
if ($(i) || T(i))
|
|
75
|
+
return zt(s, n, i), oe(s, i, t, n);
|
|
76
|
+
if (typeof i != "symbol") {
|
|
77
|
+
if (L(e)) {
|
|
78
|
+
n = Object.freeze(n.concat(e));
|
|
79
|
+
for (let r = 0; r < e.items.length; ++r) {
|
|
80
|
+
const o = await oe(r, e.items[r], t, n);
|
|
81
|
+
if (typeof o == "number")
|
|
82
|
+
r = o - 1;
|
|
83
|
+
else {
|
|
84
|
+
if (o === B)
|
|
85
|
+
return B;
|
|
86
|
+
o === R && (e.items.splice(r, 1), r -= 1);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
} else if (T(e)) {
|
|
90
|
+
n = Object.freeze(n.concat(e));
|
|
91
|
+
const r = await oe("key", e.key, t, n);
|
|
92
|
+
if (r === B)
|
|
93
|
+
return B;
|
|
94
|
+
r === R && (e.key = null);
|
|
95
|
+
const o = await oe("value", e.value, t, n);
|
|
96
|
+
if (o === B)
|
|
97
|
+
return B;
|
|
98
|
+
o === R && (e.value = null);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return i;
|
|
102
|
+
}
|
|
103
|
+
function Ht(s) {
|
|
104
|
+
return typeof s == "object" && (s.Collection || s.Node || s.Value) ? Object.assign({
|
|
105
|
+
Alias: s.Node,
|
|
106
|
+
Map: s.Node,
|
|
107
|
+
Scalar: s.Node,
|
|
108
|
+
Seq: s.Node
|
|
109
|
+
}, s.Value && {
|
|
110
|
+
Map: s.Value,
|
|
111
|
+
Scalar: s.Value,
|
|
112
|
+
Seq: s.Value
|
|
113
|
+
}, s.Collection && {
|
|
114
|
+
Map: s.Collection,
|
|
115
|
+
Seq: s.Collection
|
|
116
|
+
}, s) : s;
|
|
117
|
+
}
|
|
118
|
+
function Xt(s, e, t, n) {
|
|
119
|
+
if (typeof t == "function")
|
|
120
|
+
return t(s, e, n);
|
|
121
|
+
if (pe(e))
|
|
122
|
+
return t.Map?.(s, e, n);
|
|
123
|
+
if (me(e))
|
|
124
|
+
return t.Seq?.(s, e, n);
|
|
125
|
+
if (T(e))
|
|
126
|
+
return t.Pair?.(s, e, n);
|
|
127
|
+
if (I(e))
|
|
128
|
+
return t.Scalar?.(s, e, n);
|
|
129
|
+
if (H(e))
|
|
130
|
+
return t.Alias?.(s, e, n);
|
|
131
|
+
}
|
|
132
|
+
function zt(s, e, t) {
|
|
133
|
+
const n = e[e.length - 1];
|
|
134
|
+
if (L(n))
|
|
135
|
+
n.items[s] = t;
|
|
136
|
+
else if (T(n))
|
|
137
|
+
s === "key" ? n.key = t : n.value = t;
|
|
138
|
+
else if (ee(n))
|
|
139
|
+
n.contents = t;
|
|
140
|
+
else {
|
|
141
|
+
const i = H(n) ? "alias" : "scalar";
|
|
142
|
+
throw new Error(`Cannot replace node with ${i} parent`);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
const ln = {
|
|
146
|
+
"!": "%21",
|
|
147
|
+
",": "%2C",
|
|
148
|
+
"[": "%5B",
|
|
149
|
+
"]": "%5D",
|
|
150
|
+
"{": "%7B",
|
|
151
|
+
"}": "%7D"
|
|
152
|
+
}, an = (s) => s.replace(/[!,[\]{}]/g, (e) => ln[e]);
|
|
153
|
+
class M {
|
|
154
|
+
constructor(e, t) {
|
|
155
|
+
this.docStart = null, this.docEnd = !1, this.yaml = Object.assign({}, M.defaultYaml, e), this.tags = Object.assign({}, M.defaultTags, t);
|
|
156
|
+
}
|
|
157
|
+
clone() {
|
|
158
|
+
const e = new M(this.yaml, this.tags);
|
|
159
|
+
return e.docStart = this.docStart, e;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* During parsing, get a Directives instance for the current document and
|
|
163
|
+
* update the stream state according to the current version's spec.
|
|
164
|
+
*/
|
|
165
|
+
atDocument() {
|
|
166
|
+
const e = new M(this.yaml, this.tags);
|
|
167
|
+
switch (this.yaml.version) {
|
|
168
|
+
case "1.1":
|
|
169
|
+
this.atNextDocument = !0;
|
|
170
|
+
break;
|
|
171
|
+
case "1.2":
|
|
172
|
+
this.atNextDocument = !1, this.yaml = {
|
|
173
|
+
explicit: M.defaultYaml.explicit,
|
|
174
|
+
version: "1.2"
|
|
175
|
+
}, this.tags = Object.assign({}, M.defaultTags);
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
return e;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* @param onError - May be called even if the action was successful
|
|
182
|
+
* @returns `true` on success
|
|
183
|
+
*/
|
|
184
|
+
add(e, t) {
|
|
185
|
+
this.atNextDocument && (this.yaml = { explicit: M.defaultYaml.explicit, version: "1.1" }, this.tags = Object.assign({}, M.defaultTags), this.atNextDocument = !1);
|
|
186
|
+
const n = e.trim().split(/[ \t]+/), i = n.shift();
|
|
187
|
+
switch (i) {
|
|
188
|
+
case "%TAG": {
|
|
189
|
+
if (n.length !== 2 && (t(0, "%TAG directive should contain exactly two parts"), n.length < 2))
|
|
190
|
+
return !1;
|
|
191
|
+
const [r, o] = n;
|
|
192
|
+
return this.tags[r] = o, !0;
|
|
193
|
+
}
|
|
194
|
+
case "%YAML": {
|
|
195
|
+
if (this.yaml.explicit = !0, n.length !== 1)
|
|
196
|
+
return t(0, "%YAML directive should contain exactly one part"), !1;
|
|
197
|
+
const [r] = n;
|
|
198
|
+
if (r === "1.1" || r === "1.2")
|
|
199
|
+
return this.yaml.version = r, !0;
|
|
200
|
+
{
|
|
201
|
+
const o = /^\d+\.\d+$/.test(r);
|
|
202
|
+
return t(6, `Unsupported YAML version ${r}`, o), !1;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
default:
|
|
206
|
+
return t(0, `Unknown directive ${i}`, !0), !1;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Resolves a tag, matching handles to those defined in %TAG directives.
|
|
211
|
+
*
|
|
212
|
+
* @returns Resolved tag, which may also be the non-specific tag `'!'` or a
|
|
213
|
+
* `'!local'` tag, or `null` if unresolvable.
|
|
214
|
+
*/
|
|
215
|
+
tagName(e, t) {
|
|
216
|
+
if (e === "!")
|
|
217
|
+
return "!";
|
|
218
|
+
if (e[0] !== "!")
|
|
219
|
+
return t(`Not a valid tag: ${e}`), null;
|
|
220
|
+
if (e[1] === "<") {
|
|
221
|
+
const o = e.slice(2, -1);
|
|
222
|
+
return o === "!" || o === "!!" ? (t(`Verbatim tags aren't resolved, so ${e} is invalid.`), null) : (e[e.length - 1] !== ">" && t("Verbatim tags must end with a >"), o);
|
|
223
|
+
}
|
|
224
|
+
const [, n, i] = e.match(/^(.*!)([^!]*)$/s);
|
|
225
|
+
i || t(`The ${e} tag has no suffix`);
|
|
226
|
+
const r = this.tags[n];
|
|
227
|
+
if (r)
|
|
228
|
+
try {
|
|
229
|
+
return r + decodeURIComponent(i);
|
|
230
|
+
} catch (o) {
|
|
231
|
+
return t(String(o)), null;
|
|
232
|
+
}
|
|
233
|
+
return n === "!" ? e : (t(`Could not resolve tag: ${e}`), null);
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Given a fully resolved tag, returns its printable string form,
|
|
237
|
+
* taking into account current tag prefixes and defaults.
|
|
238
|
+
*/
|
|
239
|
+
tagString(e) {
|
|
240
|
+
for (const [t, n] of Object.entries(this.tags))
|
|
241
|
+
if (e.startsWith(n))
|
|
242
|
+
return t + an(e.substring(n.length));
|
|
243
|
+
return e[0] === "!" ? e : `!<${e}>`;
|
|
244
|
+
}
|
|
245
|
+
toString(e) {
|
|
246
|
+
const t = this.yaml.explicit ? [`%YAML ${this.yaml.version || "1.2"}`] : [], n = Object.entries(this.tags);
|
|
247
|
+
let i;
|
|
248
|
+
if (e && n.length > 0 && $(e.contents)) {
|
|
249
|
+
const r = {};
|
|
250
|
+
te(e.contents, (o, l) => {
|
|
251
|
+
$(l) && l.tag && (r[l.tag] = !0);
|
|
252
|
+
}), i = Object.keys(r);
|
|
253
|
+
} else
|
|
254
|
+
i = [];
|
|
255
|
+
for (const [r, o] of n)
|
|
256
|
+
r === "!!" && o === "tag:yaml.org,2002:" || (!e || i.some((l) => l.startsWith(o))) && t.push(`%TAG ${r} ${o}`);
|
|
257
|
+
return t.join(`
|
|
258
|
+
`);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
M.defaultYaml = { explicit: !1, version: "1.2" };
|
|
262
|
+
M.defaultTags = { "!!": "tag:yaml.org,2002:" };
|
|
263
|
+
function xt(s) {
|
|
264
|
+
if (/[\x00-\x19\s,[\]{}]/.test(s)) {
|
|
265
|
+
const t = `Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;
|
|
266
|
+
throw new Error(t);
|
|
267
|
+
}
|
|
268
|
+
return !0;
|
|
269
|
+
}
|
|
270
|
+
function Zt(s) {
|
|
271
|
+
const e = /* @__PURE__ */ new Set();
|
|
272
|
+
return te(s, {
|
|
273
|
+
Value(t, n) {
|
|
274
|
+
n.anchor && e.add(n.anchor);
|
|
275
|
+
}
|
|
276
|
+
}), e;
|
|
277
|
+
}
|
|
278
|
+
function es(s, e) {
|
|
279
|
+
for (let t = 1; ; ++t) {
|
|
280
|
+
const n = `${s}${t}`;
|
|
281
|
+
if (!e.has(n))
|
|
282
|
+
return n;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
function cn(s, e) {
|
|
286
|
+
const t = [], n = /* @__PURE__ */ new Map();
|
|
287
|
+
let i = null;
|
|
288
|
+
return {
|
|
289
|
+
onAnchor: (r) => {
|
|
290
|
+
t.push(r), i ?? (i = Zt(s));
|
|
291
|
+
const o = es(e, i);
|
|
292
|
+
return i.add(o), o;
|
|
293
|
+
},
|
|
294
|
+
/**
|
|
295
|
+
* With circular references, the source node is only resolved after all
|
|
296
|
+
* of its child nodes are. This is why anchors are set only after all of
|
|
297
|
+
* the nodes have been created.
|
|
298
|
+
*/
|
|
299
|
+
setAnchors: () => {
|
|
300
|
+
for (const r of t) {
|
|
301
|
+
const o = n.get(r);
|
|
302
|
+
if (typeof o == "object" && o.anchor && (I(o.node) || L(o.node)))
|
|
303
|
+
o.node.anchor = o.anchor;
|
|
304
|
+
else {
|
|
305
|
+
const l = new Error("Failed to resolve repeated object (this should not happen)");
|
|
306
|
+
throw l.source = r, l;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
sourceObjects: n
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
function le(s, e, t, n) {
|
|
314
|
+
if (n && typeof n == "object")
|
|
315
|
+
if (Array.isArray(n))
|
|
316
|
+
for (let i = 0, r = n.length; i < r; ++i) {
|
|
317
|
+
const o = n[i], l = le(s, n, String(i), o);
|
|
318
|
+
l === void 0 ? delete n[i] : l !== o && (n[i] = l);
|
|
319
|
+
}
|
|
320
|
+
else if (n instanceof Map)
|
|
321
|
+
for (const i of Array.from(n.keys())) {
|
|
322
|
+
const r = n.get(i), o = le(s, n, i, r);
|
|
323
|
+
o === void 0 ? n.delete(i) : o !== r && n.set(i, o);
|
|
324
|
+
}
|
|
325
|
+
else if (n instanceof Set)
|
|
326
|
+
for (const i of Array.from(n)) {
|
|
327
|
+
const r = le(s, n, i, i);
|
|
328
|
+
r === void 0 ? n.delete(i) : r !== i && (n.delete(i), n.add(r));
|
|
329
|
+
}
|
|
330
|
+
else
|
|
331
|
+
for (const [i, r] of Object.entries(n)) {
|
|
332
|
+
const o = le(s, n, i, r);
|
|
333
|
+
o === void 0 ? delete n[i] : o !== r && (n[i] = o);
|
|
334
|
+
}
|
|
335
|
+
return s.call(e, t, n);
|
|
336
|
+
}
|
|
337
|
+
function P(s, e, t) {
|
|
338
|
+
if (Array.isArray(s))
|
|
339
|
+
return s.map((n, i) => P(n, String(i), t));
|
|
340
|
+
if (s && typeof s.toJSON == "function") {
|
|
341
|
+
if (!t || !Wt(s))
|
|
342
|
+
return s.toJSON(e, t);
|
|
343
|
+
const n = { aliasCount: 0, count: 1, res: void 0 };
|
|
344
|
+
t.anchors.set(s, n), t.onCreate = (r) => {
|
|
345
|
+
n.res = r, delete t.onCreate;
|
|
346
|
+
};
|
|
347
|
+
const i = s.toJSON(e, t);
|
|
348
|
+
return t.onCreate && t.onCreate(i), i;
|
|
349
|
+
}
|
|
350
|
+
return typeof s == "bigint" && !t?.keep ? Number(s) : s;
|
|
351
|
+
}
|
|
352
|
+
class yt {
|
|
353
|
+
constructor(e) {
|
|
354
|
+
Object.defineProperty(this, D, { value: e });
|
|
355
|
+
}
|
|
356
|
+
/** Create a copy of this node. */
|
|
357
|
+
clone() {
|
|
358
|
+
const e = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
|
|
359
|
+
return this.range && (e.range = this.range.slice()), e;
|
|
360
|
+
}
|
|
361
|
+
/** A plain JavaScript representation of this node. */
|
|
362
|
+
toJS(e, { mapAsMap: t, maxAliasCount: n, onAnchor: i, reviver: r } = {}) {
|
|
363
|
+
if (!ee(e))
|
|
364
|
+
throw new TypeError("A document argument is required");
|
|
365
|
+
const o = {
|
|
366
|
+
anchors: /* @__PURE__ */ new Map(),
|
|
367
|
+
doc: e,
|
|
368
|
+
keep: !0,
|
|
369
|
+
mapAsMap: t === !0,
|
|
370
|
+
mapKeyWarned: !1,
|
|
371
|
+
maxAliasCount: typeof n == "number" ? n : 100
|
|
372
|
+
}, l = P(this, "", o);
|
|
373
|
+
if (typeof i == "function")
|
|
374
|
+
for (const { count: a, res: c } of o.anchors.values())
|
|
375
|
+
i(c, a);
|
|
376
|
+
return typeof r == "function" ? le(r, { "": l }, "", l) : l;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
class Ue extends yt {
|
|
380
|
+
constructor(e) {
|
|
381
|
+
super(mt), this.source = e, Object.defineProperty(this, "tag", {
|
|
382
|
+
set() {
|
|
383
|
+
throw new Error("Alias nodes cannot have tags");
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Resolve the value of this alias within `doc`, finding the last
|
|
389
|
+
* instance of the `source` anchor before this node.
|
|
390
|
+
*/
|
|
391
|
+
resolve(e, t) {
|
|
392
|
+
let n;
|
|
393
|
+
t?.aliasResolveCache ? n = t.aliasResolveCache : (n = [], te(e, {
|
|
394
|
+
Node: (r, o) => {
|
|
395
|
+
(H(o) || Wt(o)) && n.push(o);
|
|
396
|
+
}
|
|
397
|
+
}), t && (t.aliasResolveCache = n));
|
|
398
|
+
let i;
|
|
399
|
+
for (const r of n) {
|
|
400
|
+
if (r === this)
|
|
401
|
+
break;
|
|
402
|
+
r.anchor === this.source && (i = r);
|
|
403
|
+
}
|
|
404
|
+
return i;
|
|
405
|
+
}
|
|
406
|
+
toJSON(e, t) {
|
|
407
|
+
if (!t)
|
|
408
|
+
return { source: this.source };
|
|
409
|
+
const { anchors: n, doc: i, maxAliasCount: r } = t, o = this.resolve(i, t);
|
|
410
|
+
if (!o) {
|
|
411
|
+
const a = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
412
|
+
throw new ReferenceError(a);
|
|
413
|
+
}
|
|
414
|
+
let l = n.get(o);
|
|
415
|
+
if (l || (P(o, null, t), l = n.get(o)), l?.res === void 0) {
|
|
416
|
+
const a = "This should not happen: Alias anchor was not resolved?";
|
|
417
|
+
throw new ReferenceError(a);
|
|
418
|
+
}
|
|
419
|
+
if (r >= 0 && (l.count += 1, l.aliasCount === 0 && (l.aliasCount = Me(i, o, n)), l.count * l.aliasCount > r)) {
|
|
420
|
+
const a = "Excessive alias count indicates a resource exhaustion attack";
|
|
421
|
+
throw new ReferenceError(a);
|
|
422
|
+
}
|
|
423
|
+
return l.res;
|
|
424
|
+
}
|
|
425
|
+
toString(e, t, n) {
|
|
426
|
+
const i = `*${this.source}`;
|
|
427
|
+
if (e) {
|
|
428
|
+
if (xt(this.source), e.options.verifyAliasOrder && !e.anchors.has(this.source)) {
|
|
429
|
+
const r = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
430
|
+
throw new Error(r);
|
|
431
|
+
}
|
|
432
|
+
if (e.implicitKey)
|
|
433
|
+
return `${i} `;
|
|
434
|
+
}
|
|
435
|
+
return i;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
function Me(s, e, t) {
|
|
439
|
+
if (H(e)) {
|
|
440
|
+
const n = e.resolve(s), i = t && n && t.get(n);
|
|
441
|
+
return i ? i.count * i.aliasCount : 0;
|
|
442
|
+
} else if (L(e)) {
|
|
443
|
+
let n = 0;
|
|
444
|
+
for (const i of e.items) {
|
|
445
|
+
const r = Me(s, i, t);
|
|
446
|
+
r > n && (n = r);
|
|
447
|
+
}
|
|
448
|
+
return n;
|
|
449
|
+
} else if (T(e)) {
|
|
450
|
+
const n = Me(s, e.key, t), i = Me(s, e.value, t);
|
|
451
|
+
return Math.max(n, i);
|
|
452
|
+
}
|
|
453
|
+
return 1;
|
|
454
|
+
}
|
|
455
|
+
const ts = (s) => !s || typeof s != "function" && typeof s != "object";
|
|
456
|
+
class N extends yt {
|
|
457
|
+
constructor(e) {
|
|
458
|
+
super(U), this.value = e;
|
|
459
|
+
}
|
|
460
|
+
toJSON(e, t) {
|
|
461
|
+
return t?.keep ? this.value : P(this.value, e, t);
|
|
462
|
+
}
|
|
463
|
+
toString() {
|
|
464
|
+
return String(this.value);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
N.BLOCK_FOLDED = "BLOCK_FOLDED";
|
|
468
|
+
N.BLOCK_LITERAL = "BLOCK_LITERAL";
|
|
469
|
+
N.PLAIN = "PLAIN";
|
|
470
|
+
N.QUOTE_DOUBLE = "QUOTE_DOUBLE";
|
|
471
|
+
N.QUOTE_SINGLE = "QUOTE_SINGLE";
|
|
472
|
+
const fn = "tag:yaml.org,2002:";
|
|
473
|
+
function un(s, e, t) {
|
|
474
|
+
if (e) {
|
|
475
|
+
const n = t.filter((r) => r.tag === e), i = n.find((r) => !r.format) ?? n[0];
|
|
476
|
+
if (!i)
|
|
477
|
+
throw new Error(`Tag ${e} not found`);
|
|
478
|
+
return i;
|
|
479
|
+
}
|
|
480
|
+
return t.find((n) => n.identify?.(s) && !n.format);
|
|
481
|
+
}
|
|
482
|
+
function Ne(s, e, t) {
|
|
483
|
+
if (ee(s) && (s = s.contents), $(s))
|
|
484
|
+
return s;
|
|
485
|
+
if (T(s)) {
|
|
486
|
+
const f = t.schema[W].createNode?.(t.schema, null, t);
|
|
487
|
+
return f.items.push(s), f;
|
|
488
|
+
}
|
|
489
|
+
(s instanceof String || s instanceof Number || s instanceof Boolean || typeof BigInt < "u" && s instanceof BigInt) && (s = s.valueOf());
|
|
490
|
+
const { aliasDuplicateObjects: n, onAnchor: i, onTagObj: r, schema: o, sourceObjects: l } = t;
|
|
491
|
+
let a;
|
|
492
|
+
if (n && s && typeof s == "object") {
|
|
493
|
+
if (a = l.get(s), a)
|
|
494
|
+
return a.anchor ?? (a.anchor = i(s)), new Ue(a.anchor);
|
|
495
|
+
a = { anchor: null, node: null }, l.set(s, a);
|
|
496
|
+
}
|
|
497
|
+
e?.startsWith("!!") && (e = fn + e.slice(2));
|
|
498
|
+
let c = un(s, e, o.tags);
|
|
499
|
+
if (!c) {
|
|
500
|
+
if (s && typeof s.toJSON == "function" && (s = s.toJSON()), !s || typeof s != "object") {
|
|
501
|
+
const f = new N(s);
|
|
502
|
+
return a && (a.node = f), f;
|
|
503
|
+
}
|
|
504
|
+
c = s instanceof Map ? o[W] : Symbol.iterator in Object(s) ? o[de] : o[W];
|
|
505
|
+
}
|
|
506
|
+
r && (r(c), delete t.onTagObj);
|
|
507
|
+
const d = c?.createNode ? c.createNode(t.schema, s, t) : typeof c?.nodeClass?.from == "function" ? c.nodeClass.from(t.schema, s, t) : new N(s);
|
|
508
|
+
return e ? d.tag = e : c.default || (d.tag = c.tag), a && (a.node = d), d;
|
|
509
|
+
}
|
|
510
|
+
function Pe(s, e, t) {
|
|
511
|
+
let n = t;
|
|
512
|
+
for (let i = e.length - 1; i >= 0; --i) {
|
|
513
|
+
const r = e[i];
|
|
514
|
+
if (typeof r == "number" && Number.isInteger(r) && r >= 0) {
|
|
515
|
+
const o = [];
|
|
516
|
+
o[r] = n, n = o;
|
|
517
|
+
} else
|
|
518
|
+
n = /* @__PURE__ */ new Map([[r, n]]);
|
|
519
|
+
}
|
|
520
|
+
return Ne(n, void 0, {
|
|
521
|
+
aliasDuplicateObjects: !1,
|
|
522
|
+
keepUndefined: !1,
|
|
523
|
+
onAnchor: () => {
|
|
524
|
+
throw new Error("This should not happen, please report a bug.");
|
|
525
|
+
},
|
|
526
|
+
schema: s,
|
|
527
|
+
sourceObjects: /* @__PURE__ */ new Map()
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
const ke = (s) => s == null || typeof s == "object" && !!s[Symbol.iterator]().next().done;
|
|
531
|
+
class ss extends yt {
|
|
532
|
+
constructor(e, t) {
|
|
533
|
+
super(e), Object.defineProperty(this, "schema", {
|
|
534
|
+
value: t,
|
|
535
|
+
configurable: !0,
|
|
536
|
+
enumerable: !1,
|
|
537
|
+
writable: !0
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* Create a copy of this collection.
|
|
542
|
+
*
|
|
543
|
+
* @param schema - If defined, overwrites the original's schema
|
|
544
|
+
*/
|
|
545
|
+
clone(e) {
|
|
546
|
+
const t = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
|
|
547
|
+
return e && (t.schema = e), t.items = t.items.map((n) => $(n) || T(n) ? n.clone(e) : n), this.range && (t.range = this.range.slice()), t;
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Adds a value to the collection. For `!!map` and `!!omap` the value must
|
|
551
|
+
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
552
|
+
* that already exists in the map.
|
|
553
|
+
*/
|
|
554
|
+
addIn(e, t) {
|
|
555
|
+
if (ke(e))
|
|
556
|
+
this.add(t);
|
|
557
|
+
else {
|
|
558
|
+
const [n, ...i] = e, r = this.get(n, !0);
|
|
559
|
+
if (L(r))
|
|
560
|
+
r.addIn(i, t);
|
|
561
|
+
else if (r === void 0 && this.schema)
|
|
562
|
+
this.set(n, Pe(this.schema, i, t));
|
|
563
|
+
else
|
|
564
|
+
throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`);
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Removes a value from the collection.
|
|
569
|
+
* @returns `true` if the item was found and removed.
|
|
570
|
+
*/
|
|
571
|
+
deleteIn(e) {
|
|
572
|
+
const [t, ...n] = e;
|
|
573
|
+
if (n.length === 0)
|
|
574
|
+
return this.delete(t);
|
|
575
|
+
const i = this.get(t, !0);
|
|
576
|
+
if (L(i))
|
|
577
|
+
return i.deleteIn(n);
|
|
578
|
+
throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`);
|
|
579
|
+
}
|
|
580
|
+
/**
|
|
581
|
+
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
582
|
+
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
583
|
+
* `true` (collections are always returned intact).
|
|
584
|
+
*/
|
|
585
|
+
getIn(e, t) {
|
|
586
|
+
const [n, ...i] = e, r = this.get(n, !0);
|
|
587
|
+
return i.length === 0 ? !t && I(r) ? r.value : r : L(r) ? r.getIn(i, t) : void 0;
|
|
588
|
+
}
|
|
589
|
+
hasAllNullValues(e) {
|
|
590
|
+
return this.items.every((t) => {
|
|
591
|
+
if (!T(t))
|
|
592
|
+
return !1;
|
|
593
|
+
const n = t.value;
|
|
594
|
+
return n == null || e && I(n) && n.value == null && !n.commentBefore && !n.comment && !n.tag;
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
/**
|
|
598
|
+
* Checks if the collection includes a value with the key `key`.
|
|
599
|
+
*/
|
|
600
|
+
hasIn(e) {
|
|
601
|
+
const [t, ...n] = e;
|
|
602
|
+
if (n.length === 0)
|
|
603
|
+
return this.has(t);
|
|
604
|
+
const i = this.get(t, !0);
|
|
605
|
+
return L(i) ? i.hasIn(n) : !1;
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
609
|
+
* boolean to add/remove the item from the set.
|
|
610
|
+
*/
|
|
611
|
+
setIn(e, t) {
|
|
612
|
+
const [n, ...i] = e;
|
|
613
|
+
if (i.length === 0)
|
|
614
|
+
this.set(n, t);
|
|
615
|
+
else {
|
|
616
|
+
const r = this.get(n, !0);
|
|
617
|
+
if (L(r))
|
|
618
|
+
r.setIn(i, t);
|
|
619
|
+
else if (r === void 0 && this.schema)
|
|
620
|
+
this.set(n, Pe(this.schema, i, t));
|
|
621
|
+
else
|
|
622
|
+
throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`);
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
const hn = (s) => s.replace(/^(?!$)(?: $)?/gm, "#");
|
|
627
|
+
function V(s, e) {
|
|
628
|
+
return /^\n+$/.test(s) ? s.substring(1) : e ? s.replace(/^(?! *$)/gm, e) : s;
|
|
629
|
+
}
|
|
630
|
+
const X = (s, e, t) => s.endsWith(`
|
|
631
|
+
`) ? V(t, e) : t.includes(`
|
|
632
|
+
`) ? `
|
|
633
|
+
` + V(t, e) : (s.endsWith(" ") ? "" : " ") + t, ns = "flow", ft = "block", Be = "quoted";
|
|
634
|
+
function Ve(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentWidth: r = 20, onFold: o, onOverflow: l } = {}) {
|
|
635
|
+
if (!i || i < 0)
|
|
636
|
+
return s;
|
|
637
|
+
i < r && (r = 0);
|
|
638
|
+
const a = Math.max(1 + r, 1 + i - e.length);
|
|
639
|
+
if (s.length <= a)
|
|
640
|
+
return s;
|
|
641
|
+
const c = [], d = {};
|
|
642
|
+
let f = i - e.length;
|
|
643
|
+
typeof n == "number" && (n > i - Math.max(2, r) ? c.push(0) : f = i - n);
|
|
644
|
+
let u, m, b = !1, h = -1, p = -1, y = -1;
|
|
645
|
+
t === ft && (h = Kt(s, h, e.length), h !== -1 && (f = h + a));
|
|
646
|
+
for (let k; k = s[h += 1]; ) {
|
|
647
|
+
if (t === Be && k === "\\") {
|
|
648
|
+
switch (p = h, s[h + 1]) {
|
|
649
|
+
case "x":
|
|
650
|
+
h += 3;
|
|
651
|
+
break;
|
|
652
|
+
case "u":
|
|
653
|
+
h += 5;
|
|
654
|
+
break;
|
|
655
|
+
case "U":
|
|
656
|
+
h += 9;
|
|
657
|
+
break;
|
|
658
|
+
default:
|
|
659
|
+
h += 1;
|
|
660
|
+
}
|
|
661
|
+
y = h;
|
|
662
|
+
}
|
|
663
|
+
if (k === `
|
|
664
|
+
`)
|
|
665
|
+
t === ft && (h = Kt(s, h, e.length)), f = h + e.length + a, u = void 0;
|
|
666
|
+
else {
|
|
667
|
+
if (k === " " && m && m !== " " && m !== `
|
|
668
|
+
` && m !== " ") {
|
|
669
|
+
const S = s[h + 1];
|
|
670
|
+
S && S !== " " && S !== `
|
|
671
|
+
` && S !== " " && (u = h);
|
|
672
|
+
}
|
|
673
|
+
if (h >= f)
|
|
674
|
+
if (u)
|
|
675
|
+
c.push(u), f = u + a, u = void 0;
|
|
676
|
+
else if (t === Be) {
|
|
677
|
+
for (; m === " " || m === " "; )
|
|
678
|
+
m = k, k = s[h += 1], b = !0;
|
|
679
|
+
const S = h > y + 1 ? h - 2 : p - 1;
|
|
680
|
+
if (d[S])
|
|
681
|
+
return s;
|
|
682
|
+
c.push(S), d[S] = !0, f = S + a, u = void 0;
|
|
683
|
+
} else
|
|
684
|
+
b = !0;
|
|
685
|
+
}
|
|
686
|
+
m = k;
|
|
687
|
+
}
|
|
688
|
+
if (b && l && l(), c.length === 0)
|
|
689
|
+
return s;
|
|
690
|
+
o && o();
|
|
691
|
+
let g = s.slice(0, c[0]);
|
|
692
|
+
for (let k = 0; k < c.length; ++k) {
|
|
693
|
+
const S = c[k], O = c[k + 1] || s.length;
|
|
694
|
+
S === 0 ? g = `
|
|
695
|
+
${e}${s.slice(0, O)}` : (t === Be && d[S] && (g += `${s[S]}\\`), g += `
|
|
696
|
+
${e}${s.slice(S + 1, O)}`);
|
|
697
|
+
}
|
|
698
|
+
return g;
|
|
699
|
+
}
|
|
700
|
+
function Kt(s, e, t) {
|
|
701
|
+
let n = e, i = e + 1, r = s[i];
|
|
702
|
+
for (; r === " " || r === " "; )
|
|
703
|
+
if (e < i + t)
|
|
704
|
+
r = s[++e];
|
|
705
|
+
else {
|
|
706
|
+
do
|
|
707
|
+
r = s[++e];
|
|
708
|
+
while (r && r !== `
|
|
709
|
+
`);
|
|
710
|
+
n = e, i = e + 1, r = s[i];
|
|
711
|
+
}
|
|
712
|
+
return n;
|
|
713
|
+
}
|
|
714
|
+
const Ye = (s, e) => ({
|
|
715
|
+
indentAtStart: e ? s.indent.length : s.indentAtStart,
|
|
716
|
+
lineWidth: s.options.lineWidth,
|
|
717
|
+
minContentWidth: s.options.minContentWidth
|
|
718
|
+
}), Je = (s) => /^(%|---|\.\.\.)/m.test(s);
|
|
719
|
+
function dn(s, e, t) {
|
|
720
|
+
if (!e || e < 0)
|
|
721
|
+
return !1;
|
|
722
|
+
const n = e - t, i = s.length;
|
|
723
|
+
if (i <= n)
|
|
724
|
+
return !1;
|
|
725
|
+
for (let r = 0, o = 0; r < i; ++r)
|
|
726
|
+
if (s[r] === `
|
|
727
|
+
`) {
|
|
728
|
+
if (r - o > n)
|
|
729
|
+
return !0;
|
|
730
|
+
if (o = r + 1, i - o <= n)
|
|
731
|
+
return !1;
|
|
732
|
+
}
|
|
733
|
+
return !0;
|
|
734
|
+
}
|
|
735
|
+
function Se(s, e) {
|
|
736
|
+
const t = JSON.stringify(s);
|
|
737
|
+
if (e.options.doubleQuotedAsJSON)
|
|
738
|
+
return t;
|
|
739
|
+
const { implicitKey: n } = e, i = e.options.doubleQuotedMinMultiLineLength, r = e.indent || (Je(s) ? " " : "");
|
|
740
|
+
let o = "", l = 0;
|
|
741
|
+
for (let a = 0, c = t[a]; c; c = t[++a])
|
|
742
|
+
if (c === " " && t[a + 1] === "\\" && t[a + 2] === "n" && (o += t.slice(l, a) + "\\ ", a += 1, l = a, c = "\\"), c === "\\")
|
|
743
|
+
switch (t[a + 1]) {
|
|
744
|
+
case "u":
|
|
745
|
+
{
|
|
746
|
+
o += t.slice(l, a);
|
|
747
|
+
const d = t.substr(a + 2, 4);
|
|
748
|
+
switch (d) {
|
|
749
|
+
case "0000":
|
|
750
|
+
o += "\\0";
|
|
751
|
+
break;
|
|
752
|
+
case "0007":
|
|
753
|
+
o += "\\a";
|
|
754
|
+
break;
|
|
755
|
+
case "000b":
|
|
756
|
+
o += "\\v";
|
|
757
|
+
break;
|
|
758
|
+
case "001b":
|
|
759
|
+
o += "\\e";
|
|
760
|
+
break;
|
|
761
|
+
case "0085":
|
|
762
|
+
o += "\\N";
|
|
763
|
+
break;
|
|
764
|
+
case "00a0":
|
|
765
|
+
o += "\\_";
|
|
766
|
+
break;
|
|
767
|
+
case "2028":
|
|
768
|
+
o += "\\L";
|
|
769
|
+
break;
|
|
770
|
+
case "2029":
|
|
771
|
+
o += "\\P";
|
|
772
|
+
break;
|
|
773
|
+
default:
|
|
774
|
+
d.substr(0, 2) === "00" ? o += "\\x" + d.substr(2) : o += t.substr(a, 6);
|
|
775
|
+
}
|
|
776
|
+
a += 5, l = a + 1;
|
|
777
|
+
}
|
|
778
|
+
break;
|
|
779
|
+
case "n":
|
|
780
|
+
if (n || t[a + 2] === '"' || t.length < i)
|
|
781
|
+
a += 1;
|
|
782
|
+
else {
|
|
783
|
+
for (o += t.slice(l, a) + `
|
|
784
|
+
|
|
785
|
+
`; t[a + 2] === "\\" && t[a + 3] === "n" && t[a + 4] !== '"'; )
|
|
786
|
+
o += `
|
|
787
|
+
`, a += 2;
|
|
788
|
+
o += r, t[a + 2] === " " && (o += "\\"), a += 1, l = a + 1;
|
|
789
|
+
}
|
|
790
|
+
break;
|
|
791
|
+
default:
|
|
792
|
+
a += 1;
|
|
793
|
+
}
|
|
794
|
+
return o = l ? o + t.slice(l) : t, n ? o : Ve(o, r, Be, Ye(e, !1));
|
|
795
|
+
}
|
|
796
|
+
function ut(s, e) {
|
|
797
|
+
if (e.options.singleQuote === !1 || e.implicitKey && s.includes(`
|
|
798
|
+
`) || /[ \t]\n|\n[ \t]/.test(s))
|
|
799
|
+
return Se(s, e);
|
|
800
|
+
const t = e.indent || (Je(s) ? " " : ""), n = "'" + s.replace(/'/g, "''").replace(/\n+/g, `$&
|
|
801
|
+
${t}`) + "'";
|
|
802
|
+
return e.implicitKey ? n : Ve(n, t, ns, Ye(e, !1));
|
|
803
|
+
}
|
|
804
|
+
function ae(s, e) {
|
|
805
|
+
const { singleQuote: t } = e.options;
|
|
806
|
+
let n;
|
|
807
|
+
if (t === !1)
|
|
808
|
+
n = Se;
|
|
809
|
+
else {
|
|
810
|
+
const i = s.includes('"'), r = s.includes("'");
|
|
811
|
+
i && !r ? n = ut : r && !i ? n = Se : n = t ? ut : Se;
|
|
812
|
+
}
|
|
813
|
+
return n(s, e);
|
|
814
|
+
}
|
|
815
|
+
let ht;
|
|
816
|
+
try {
|
|
817
|
+
ht = new RegExp(`(^|(?<!
|
|
818
|
+
))
|
|
819
|
+
+(?!
|
|
820
|
+
|$)`, "g");
|
|
821
|
+
} catch {
|
|
822
|
+
ht = /\n+(?!\n|$)/g;
|
|
823
|
+
}
|
|
824
|
+
function Ke({ comment: s, type: e, value: t }, n, i, r) {
|
|
825
|
+
const { blockQuote: o, commentString: l, lineWidth: a } = n.options;
|
|
826
|
+
if (!o || /\n[\t ]+$/.test(t))
|
|
827
|
+
return ae(t, n);
|
|
828
|
+
const c = n.indent || (n.forceBlockIndent || Je(t) ? " " : ""), d = o === "literal" ? !0 : o === "folded" || e === N.BLOCK_FOLDED ? !1 : e === N.BLOCK_LITERAL ? !0 : !dn(t, a, c.length);
|
|
829
|
+
if (!t)
|
|
830
|
+
return d ? `|
|
|
831
|
+
` : `>
|
|
832
|
+
`;
|
|
833
|
+
let f, u;
|
|
834
|
+
for (u = t.length; u > 0; --u) {
|
|
835
|
+
const O = t[u - 1];
|
|
836
|
+
if (O !== `
|
|
837
|
+
` && O !== " " && O !== " ")
|
|
838
|
+
break;
|
|
839
|
+
}
|
|
840
|
+
let m = t.substring(u);
|
|
841
|
+
const b = m.indexOf(`
|
|
842
|
+
`);
|
|
843
|
+
b === -1 ? f = "-" : t === m || b !== m.length - 1 ? (f = "+", r && r()) : f = "", m && (t = t.slice(0, -m.length), m[m.length - 1] === `
|
|
844
|
+
` && (m = m.slice(0, -1)), m = m.replace(ht, `$&${c}`));
|
|
845
|
+
let h = !1, p, y = -1;
|
|
846
|
+
for (p = 0; p < t.length; ++p) {
|
|
847
|
+
const O = t[p];
|
|
848
|
+
if (O === " ")
|
|
849
|
+
h = !0;
|
|
850
|
+
else if (O === `
|
|
851
|
+
`)
|
|
852
|
+
y = p;
|
|
853
|
+
else
|
|
854
|
+
break;
|
|
855
|
+
}
|
|
856
|
+
let g = t.substring(0, y < p ? y + 1 : p);
|
|
857
|
+
g && (t = t.substring(g.length), g = g.replace(/\n+/g, `$&${c}`));
|
|
858
|
+
let S = (h ? c ? "2" : "1" : "") + f;
|
|
859
|
+
if (s && (S += " " + l(s.replace(/ ?[\r\n]+/g, " ")), i && i()), !d) {
|
|
860
|
+
const O = t.replace(/\n+/g, `
|
|
861
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${c}`);
|
|
862
|
+
let A = !1;
|
|
863
|
+
const E = Ye(n, !0);
|
|
864
|
+
o !== "folded" && e !== N.BLOCK_FOLDED && (E.onOverflow = () => {
|
|
865
|
+
A = !0;
|
|
866
|
+
});
|
|
867
|
+
const w = Ve(`${g}${O}${m}`, c, ft, E);
|
|
868
|
+
if (!A)
|
|
869
|
+
return `>${S}
|
|
870
|
+
${c}${w}`;
|
|
871
|
+
}
|
|
872
|
+
return t = t.replace(/\n+/g, `$&${c}`), `|${S}
|
|
873
|
+
${c}${g}${t}${m}`;
|
|
874
|
+
}
|
|
875
|
+
function pn(s, e, t, n) {
|
|
876
|
+
const { type: i, value: r } = s, { actualString: o, implicitKey: l, indent: a, indentStep: c, inFlow: d } = e;
|
|
877
|
+
if (l && r.includes(`
|
|
878
|
+
`) || d && /[[\]{},]/.test(r))
|
|
879
|
+
return ae(r, e);
|
|
880
|
+
if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))
|
|
881
|
+
return l || d || !r.includes(`
|
|
882
|
+
`) ? ae(r, e) : Ke(s, e, t, n);
|
|
883
|
+
if (!l && !d && i !== N.PLAIN && r.includes(`
|
|
884
|
+
`))
|
|
885
|
+
return Ke(s, e, t, n);
|
|
886
|
+
if (Je(r)) {
|
|
887
|
+
if (a === "")
|
|
888
|
+
return e.forceBlockIndent = !0, Ke(s, e, t, n);
|
|
889
|
+
if (l && a === c)
|
|
890
|
+
return ae(r, e);
|
|
891
|
+
}
|
|
892
|
+
const f = r.replace(/\n+/g, `$&
|
|
893
|
+
${a}`);
|
|
894
|
+
if (o) {
|
|
895
|
+
const u = (h) => h.default && h.tag !== "tag:yaml.org,2002:str" && h.test?.test(f), { compat: m, tags: b } = e.doc.schema;
|
|
896
|
+
if (b.some(u) || m?.some(u))
|
|
897
|
+
return ae(r, e);
|
|
898
|
+
}
|
|
899
|
+
return l ? f : Ve(f, a, ns, Ye(e, !1));
|
|
900
|
+
}
|
|
901
|
+
function Ie(s, e, t, n) {
|
|
902
|
+
const { implicitKey: i, inFlow: r } = e, o = typeof s.value == "string" ? s : Object.assign({}, s, { value: String(s.value) });
|
|
903
|
+
let { type: l } = s;
|
|
904
|
+
l !== N.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value) && (l = N.QUOTE_DOUBLE);
|
|
905
|
+
const a = (d) => {
|
|
906
|
+
switch (d) {
|
|
907
|
+
case N.BLOCK_FOLDED:
|
|
908
|
+
case N.BLOCK_LITERAL:
|
|
909
|
+
return i || r ? ae(o.value, e) : Ke(o, e, t, n);
|
|
910
|
+
case N.QUOTE_DOUBLE:
|
|
911
|
+
return Se(o.value, e);
|
|
912
|
+
case N.QUOTE_SINGLE:
|
|
913
|
+
return ut(o.value, e);
|
|
914
|
+
case N.PLAIN:
|
|
915
|
+
return pn(o, e, t, n);
|
|
916
|
+
default:
|
|
917
|
+
return null;
|
|
918
|
+
}
|
|
919
|
+
};
|
|
920
|
+
let c = a(l);
|
|
921
|
+
if (c === null) {
|
|
922
|
+
const { defaultKeyType: d, defaultStringType: f } = e.options, u = i && d || f;
|
|
923
|
+
if (c = a(u), c === null)
|
|
924
|
+
throw new Error(`Unsupported default string type ${u}`);
|
|
925
|
+
}
|
|
926
|
+
return c;
|
|
927
|
+
}
|
|
928
|
+
function is(s, e) {
|
|
929
|
+
const t = Object.assign({
|
|
930
|
+
blockQuote: !0,
|
|
931
|
+
commentString: hn,
|
|
932
|
+
defaultKeyType: null,
|
|
933
|
+
defaultStringType: "PLAIN",
|
|
934
|
+
directives: null,
|
|
935
|
+
doubleQuotedAsJSON: !1,
|
|
936
|
+
doubleQuotedMinMultiLineLength: 40,
|
|
937
|
+
falseStr: "false",
|
|
938
|
+
flowCollectionPadding: !0,
|
|
939
|
+
indentSeq: !0,
|
|
940
|
+
lineWidth: 80,
|
|
941
|
+
minContentWidth: 20,
|
|
942
|
+
nullStr: "null",
|
|
943
|
+
simpleKeys: !1,
|
|
944
|
+
singleQuote: null,
|
|
945
|
+
trueStr: "true",
|
|
946
|
+
verifyAliasOrder: !0
|
|
947
|
+
}, s.schema.toStringOptions, e);
|
|
948
|
+
let n;
|
|
949
|
+
switch (t.collectionStyle) {
|
|
950
|
+
case "block":
|
|
951
|
+
n = !1;
|
|
952
|
+
break;
|
|
953
|
+
case "flow":
|
|
954
|
+
n = !0;
|
|
955
|
+
break;
|
|
956
|
+
default:
|
|
957
|
+
n = null;
|
|
958
|
+
}
|
|
959
|
+
return {
|
|
960
|
+
anchors: /* @__PURE__ */ new Set(),
|
|
961
|
+
doc: s,
|
|
962
|
+
flowCollectionPadding: t.flowCollectionPadding ? " " : "",
|
|
963
|
+
indent: "",
|
|
964
|
+
indentStep: typeof t.indent == "number" ? " ".repeat(t.indent) : " ",
|
|
965
|
+
inFlow: n,
|
|
966
|
+
options: t
|
|
967
|
+
};
|
|
968
|
+
}
|
|
969
|
+
function mn(s, e) {
|
|
970
|
+
if (e.tag) {
|
|
971
|
+
const i = s.filter((r) => r.tag === e.tag);
|
|
972
|
+
if (i.length > 0)
|
|
973
|
+
return i.find((r) => r.format === e.format) ?? i[0];
|
|
974
|
+
}
|
|
975
|
+
let t, n;
|
|
976
|
+
if (I(e)) {
|
|
977
|
+
n = e.value;
|
|
978
|
+
let i = s.filter((r) => r.identify?.(n));
|
|
979
|
+
if (i.length > 1) {
|
|
980
|
+
const r = i.filter((o) => o.test);
|
|
981
|
+
r.length > 0 && (i = r);
|
|
982
|
+
}
|
|
983
|
+
t = i.find((r) => r.format === e.format) ?? i.find((r) => !r.format);
|
|
984
|
+
} else
|
|
985
|
+
n = e, t = s.find((i) => i.nodeClass && n instanceof i.nodeClass);
|
|
986
|
+
if (!t) {
|
|
987
|
+
const i = n?.constructor?.name ?? (n === null ? "null" : typeof n);
|
|
988
|
+
throw new Error(`Tag not resolved for ${i} value`);
|
|
989
|
+
}
|
|
990
|
+
return t;
|
|
991
|
+
}
|
|
992
|
+
function yn(s, e, { anchors: t, doc: n }) {
|
|
993
|
+
if (!n.directives)
|
|
994
|
+
return "";
|
|
995
|
+
const i = [], r = (I(s) || L(s)) && s.anchor;
|
|
996
|
+
r && xt(r) && (t.add(r), i.push(`&${r}`));
|
|
997
|
+
const o = s.tag ?? (e.default ? null : e.tag);
|
|
998
|
+
return o && i.push(n.directives.tagString(o)), i.join(" ");
|
|
999
|
+
}
|
|
1000
|
+
function ue(s, e, t, n) {
|
|
1001
|
+
if (T(s))
|
|
1002
|
+
return s.toString(e, t, n);
|
|
1003
|
+
if (H(s)) {
|
|
1004
|
+
if (e.doc.directives)
|
|
1005
|
+
return s.toString(e);
|
|
1006
|
+
if (e.resolvedAliases?.has(s))
|
|
1007
|
+
throw new TypeError("Cannot stringify circular structure without alias nodes");
|
|
1008
|
+
e.resolvedAliases ? e.resolvedAliases.add(s) : e.resolvedAliases = /* @__PURE__ */ new Set([s]), s = s.resolve(e.doc);
|
|
1009
|
+
}
|
|
1010
|
+
let i;
|
|
1011
|
+
const r = $(s) ? s : e.doc.createNode(s, { onTagObj: (a) => i = a });
|
|
1012
|
+
i ?? (i = mn(e.doc.schema.tags, r));
|
|
1013
|
+
const o = yn(r, i, e);
|
|
1014
|
+
o.length > 0 && (e.indentAtStart = (e.indentAtStart ?? 0) + o.length + 1);
|
|
1015
|
+
const l = typeof i.stringify == "function" ? i.stringify(r, e, t, n) : I(r) ? Ie(r, e, t, n) : r.toString(e, t, n);
|
|
1016
|
+
return o ? I(r) || l[0] === "{" || l[0] === "[" ? `${o} ${l}` : `${o}
|
|
1017
|
+
${e.indent}${l}` : l;
|
|
1018
|
+
}
|
|
1019
|
+
function gn({ key: s, value: e }, t, n, i) {
|
|
1020
|
+
const { allNullValues: r, doc: o, indent: l, indentStep: a, options: { commentString: c, indentSeq: d, simpleKeys: f } } = t;
|
|
1021
|
+
let u = $(s) && s.comment || null;
|
|
1022
|
+
if (f) {
|
|
1023
|
+
if (u)
|
|
1024
|
+
throw new Error("With simple keys, key nodes cannot have comments");
|
|
1025
|
+
if (L(s) || !$(s) && typeof s == "object") {
|
|
1026
|
+
const E = "With simple keys, collection cannot be used as a key value";
|
|
1027
|
+
throw new Error(E);
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
let m = !f && (!s || u && e == null && !t.inFlow || L(s) || (I(s) ? s.type === N.BLOCK_FOLDED || s.type === N.BLOCK_LITERAL : typeof s == "object"));
|
|
1031
|
+
t = Object.assign({}, t, {
|
|
1032
|
+
allNullValues: !1,
|
|
1033
|
+
implicitKey: !m && (f || !r),
|
|
1034
|
+
indent: l + a
|
|
1035
|
+
});
|
|
1036
|
+
let b = !1, h = !1, p = ue(s, t, () => b = !0, () => h = !0);
|
|
1037
|
+
if (!m && !t.inFlow && p.length > 1024) {
|
|
1038
|
+
if (f)
|
|
1039
|
+
throw new Error("With simple keys, single line scalar must not span more than 1024 characters");
|
|
1040
|
+
m = !0;
|
|
1041
|
+
}
|
|
1042
|
+
if (t.inFlow) {
|
|
1043
|
+
if (r || e == null)
|
|
1044
|
+
return b && n && n(), p === "" ? "?" : m ? `? ${p}` : p;
|
|
1045
|
+
} else if (r && !f || e == null && m)
|
|
1046
|
+
return p = `? ${p}`, u && !b ? p += X(p, t.indent, c(u)) : h && i && i(), p;
|
|
1047
|
+
b && (u = null), m ? (u && (p += X(p, t.indent, c(u))), p = `? ${p}
|
|
1048
|
+
${l}:`) : (p = `${p}:`, u && (p += X(p, t.indent, c(u))));
|
|
1049
|
+
let y, g, k;
|
|
1050
|
+
$(e) ? (y = !!e.spaceBefore, g = e.commentBefore, k = e.comment) : (y = !1, g = null, k = null, e && typeof e == "object" && (e = o.createNode(e))), t.implicitKey = !1, !m && !u && I(e) && (t.indentAtStart = p.length + 1), h = !1, !d && a.length >= 2 && !t.inFlow && !m && me(e) && !e.flow && !e.tag && !e.anchor && (t.indent = t.indent.substring(2));
|
|
1051
|
+
let S = !1;
|
|
1052
|
+
const O = ue(e, t, () => S = !0, () => h = !0);
|
|
1053
|
+
let A = " ";
|
|
1054
|
+
if (u || y || g) {
|
|
1055
|
+
if (A = y ? `
|
|
1056
|
+
` : "", g) {
|
|
1057
|
+
const E = c(g);
|
|
1058
|
+
A += `
|
|
1059
|
+
${V(E, t.indent)}`;
|
|
1060
|
+
}
|
|
1061
|
+
O === "" && !t.inFlow ? A === `
|
|
1062
|
+
` && k && (A = `
|
|
1063
|
+
|
|
1064
|
+
`) : A += `
|
|
1065
|
+
${t.indent}`;
|
|
1066
|
+
} else if (!m && L(e)) {
|
|
1067
|
+
const E = O[0], w = O.indexOf(`
|
|
1068
|
+
`), C = w !== -1, J = t.inFlow ?? e.flow ?? e.items.length === 0;
|
|
1069
|
+
if (C || !J) {
|
|
1070
|
+
let se = !1;
|
|
1071
|
+
if (C && (E === "&" || E === "!")) {
|
|
1072
|
+
let _ = O.indexOf(" ");
|
|
1073
|
+
E === "&" && _ !== -1 && _ < w && O[_ + 1] === "!" && (_ = O.indexOf(" ", _ + 1)), (_ === -1 || w < _) && (se = !0);
|
|
1074
|
+
}
|
|
1075
|
+
se || (A = `
|
|
1076
|
+
${t.indent}`);
|
|
1077
|
+
}
|
|
1078
|
+
} else (O === "" || O[0] === `
|
|
1079
|
+
`) && (A = "");
|
|
1080
|
+
return p += A + O, t.inFlow ? S && n && n() : k && !S ? p += X(p, t.indent, c(k)) : h && i && i(), p;
|
|
1081
|
+
}
|
|
1082
|
+
function rs(s, e) {
|
|
1083
|
+
(s === "debug" || s === "warn") && console.warn(e);
|
|
1084
|
+
}
|
|
1085
|
+
const Le = "<<", Y = {
|
|
1086
|
+
identify: (s) => s === Le || typeof s == "symbol" && s.description === Le,
|
|
1087
|
+
default: "key",
|
|
1088
|
+
tag: "tag:yaml.org,2002:merge",
|
|
1089
|
+
test: /^<<$/,
|
|
1090
|
+
resolve: () => Object.assign(new N(Symbol(Le)), {
|
|
1091
|
+
addToJSMap: os
|
|
1092
|
+
}),
|
|
1093
|
+
stringify: () => Le
|
|
1094
|
+
}, bn = (s, e) => (Y.identify(e) || I(e) && (!e.type || e.type === N.PLAIN) && Y.identify(e.value)) && s?.doc.schema.tags.some((t) => t.tag === Y.tag && t.default);
|
|
1095
|
+
function os(s, e, t) {
|
|
1096
|
+
if (t = s && H(t) ? t.resolve(s.doc) : t, me(t))
|
|
1097
|
+
for (const n of t.items)
|
|
1098
|
+
st(s, e, n);
|
|
1099
|
+
else if (Array.isArray(t))
|
|
1100
|
+
for (const n of t)
|
|
1101
|
+
st(s, e, n);
|
|
1102
|
+
else
|
|
1103
|
+
st(s, e, t);
|
|
1104
|
+
}
|
|
1105
|
+
function st(s, e, t) {
|
|
1106
|
+
const n = s && H(t) ? t.resolve(s.doc) : t;
|
|
1107
|
+
if (!pe(n))
|
|
1108
|
+
throw new Error("Merge sources must be maps or map aliases");
|
|
1109
|
+
const i = n.toJSON(null, s, Map);
|
|
1110
|
+
for (const [r, o] of i)
|
|
1111
|
+
e instanceof Map ? e.has(r) || e.set(r, o) : e instanceof Set ? e.add(r) : Object.prototype.hasOwnProperty.call(e, r) || Object.defineProperty(e, r, {
|
|
1112
|
+
value: o,
|
|
1113
|
+
writable: !0,
|
|
1114
|
+
enumerable: !0,
|
|
1115
|
+
configurable: !0
|
|
1116
|
+
});
|
|
1117
|
+
return e;
|
|
1118
|
+
}
|
|
1119
|
+
function ls(s, e, { key: t, value: n }) {
|
|
1120
|
+
if ($(t) && t.addToJSMap)
|
|
1121
|
+
t.addToJSMap(s, e, n);
|
|
1122
|
+
else if (bn(s, t))
|
|
1123
|
+
os(s, e, n);
|
|
1124
|
+
else {
|
|
1125
|
+
const i = P(t, "", s);
|
|
1126
|
+
if (e instanceof Map)
|
|
1127
|
+
e.set(i, P(n, i, s));
|
|
1128
|
+
else if (e instanceof Set)
|
|
1129
|
+
e.add(i);
|
|
1130
|
+
else {
|
|
1131
|
+
const r = wn(t, i, s), o = P(n, r, s);
|
|
1132
|
+
r in e ? Object.defineProperty(e, r, {
|
|
1133
|
+
value: o,
|
|
1134
|
+
writable: !0,
|
|
1135
|
+
enumerable: !0,
|
|
1136
|
+
configurable: !0
|
|
1137
|
+
}) : e[r] = o;
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
return e;
|
|
1141
|
+
}
|
|
1142
|
+
function wn(s, e, t) {
|
|
1143
|
+
if (e === null)
|
|
1144
|
+
return "";
|
|
1145
|
+
if (typeof e != "object")
|
|
1146
|
+
return String(e);
|
|
1147
|
+
if ($(s) && t?.doc) {
|
|
1148
|
+
const n = is(t.doc, {});
|
|
1149
|
+
n.anchors = /* @__PURE__ */ new Set();
|
|
1150
|
+
for (const r of t.anchors.keys())
|
|
1151
|
+
n.anchors.add(r.anchor);
|
|
1152
|
+
n.inFlow = !0, n.inStringifyKey = !0;
|
|
1153
|
+
const i = s.toString(n);
|
|
1154
|
+
if (!t.mapKeyWarned) {
|
|
1155
|
+
let r = JSON.stringify(i);
|
|
1156
|
+
r.length > 40 && (r = r.substring(0, 36) + '..."'), rs(t.doc.options.logLevel, `Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`), t.mapKeyWarned = !0;
|
|
1157
|
+
}
|
|
1158
|
+
return i;
|
|
1159
|
+
}
|
|
1160
|
+
return JSON.stringify(e);
|
|
1161
|
+
}
|
|
1162
|
+
function gt(s, e, t) {
|
|
1163
|
+
const n = Ne(s, void 0, t), i = Ne(e, void 0, t);
|
|
1164
|
+
return new v(n, i);
|
|
1165
|
+
}
|
|
1166
|
+
class v {
|
|
1167
|
+
constructor(e, t = null) {
|
|
1168
|
+
Object.defineProperty(this, D, { value: Gt }), this.key = e, this.value = t;
|
|
1169
|
+
}
|
|
1170
|
+
clone(e) {
|
|
1171
|
+
let { key: t, value: n } = this;
|
|
1172
|
+
return $(t) && (t = t.clone(e)), $(n) && (n = n.clone(e)), new v(t, n);
|
|
1173
|
+
}
|
|
1174
|
+
toJSON(e, t) {
|
|
1175
|
+
const n = t?.mapAsMap ? /* @__PURE__ */ new Map() : {};
|
|
1176
|
+
return ls(t, n, this);
|
|
1177
|
+
}
|
|
1178
|
+
toString(e, t, n) {
|
|
1179
|
+
return e?.doc ? gn(this, e, t, n) : JSON.stringify(this);
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
function as(s, e, t) {
|
|
1183
|
+
return (e.inFlow ?? s.flow ? Sn : kn)(s, e, t);
|
|
1184
|
+
}
|
|
1185
|
+
function kn({ comment: s, items: e }, t, { blockItemPrefix: n, flowChars: i, itemIndent: r, onChompKeep: o, onComment: l }) {
|
|
1186
|
+
const { indent: a, options: { commentString: c } } = t, d = Object.assign({}, t, { indent: r, type: null });
|
|
1187
|
+
let f = !1;
|
|
1188
|
+
const u = [];
|
|
1189
|
+
for (let b = 0; b < e.length; ++b) {
|
|
1190
|
+
const h = e[b];
|
|
1191
|
+
let p = null;
|
|
1192
|
+
if ($(h))
|
|
1193
|
+
!f && h.spaceBefore && u.push(""), De(t, u, h.commentBefore, f), h.comment && (p = h.comment);
|
|
1194
|
+
else if (T(h)) {
|
|
1195
|
+
const g = $(h.key) ? h.key : null;
|
|
1196
|
+
g && (!f && g.spaceBefore && u.push(""), De(t, u, g.commentBefore, f));
|
|
1197
|
+
}
|
|
1198
|
+
f = !1;
|
|
1199
|
+
let y = ue(h, d, () => p = null, () => f = !0);
|
|
1200
|
+
p && (y += X(y, r, c(p))), f && p && (f = !1), u.push(n + y);
|
|
1201
|
+
}
|
|
1202
|
+
let m;
|
|
1203
|
+
if (u.length === 0)
|
|
1204
|
+
m = i.start + i.end;
|
|
1205
|
+
else {
|
|
1206
|
+
m = u[0];
|
|
1207
|
+
for (let b = 1; b < u.length; ++b) {
|
|
1208
|
+
const h = u[b];
|
|
1209
|
+
m += h ? `
|
|
1210
|
+
${a}${h}` : `
|
|
1211
|
+
`;
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
return s ? (m += `
|
|
1215
|
+
` + V(c(s), a), l && l()) : f && o && o(), m;
|
|
1216
|
+
}
|
|
1217
|
+
function Sn({ items: s }, e, { flowChars: t, itemIndent: n }) {
|
|
1218
|
+
const { indent: i, indentStep: r, flowCollectionPadding: o, options: { commentString: l } } = e;
|
|
1219
|
+
n += r;
|
|
1220
|
+
const a = Object.assign({}, e, {
|
|
1221
|
+
indent: n,
|
|
1222
|
+
inFlow: !0,
|
|
1223
|
+
type: null
|
|
1224
|
+
});
|
|
1225
|
+
let c = !1, d = 0;
|
|
1226
|
+
const f = [];
|
|
1227
|
+
for (let b = 0; b < s.length; ++b) {
|
|
1228
|
+
const h = s[b];
|
|
1229
|
+
let p = null;
|
|
1230
|
+
if ($(h))
|
|
1231
|
+
h.spaceBefore && f.push(""), De(e, f, h.commentBefore, !1), h.comment && (p = h.comment);
|
|
1232
|
+
else if (T(h)) {
|
|
1233
|
+
const g = $(h.key) ? h.key : null;
|
|
1234
|
+
g && (g.spaceBefore && f.push(""), De(e, f, g.commentBefore, !1), g.comment && (c = !0));
|
|
1235
|
+
const k = $(h.value) ? h.value : null;
|
|
1236
|
+
k ? (k.comment && (p = k.comment), k.commentBefore && (c = !0)) : h.value == null && g?.comment && (p = g.comment);
|
|
1237
|
+
}
|
|
1238
|
+
p && (c = !0);
|
|
1239
|
+
let y = ue(h, a, () => p = null);
|
|
1240
|
+
b < s.length - 1 && (y += ","), p && (y += X(y, n, l(p))), !c && (f.length > d || y.includes(`
|
|
1241
|
+
`)) && (c = !0), f.push(y), d = f.length;
|
|
1242
|
+
}
|
|
1243
|
+
const { start: u, end: m } = t;
|
|
1244
|
+
if (f.length === 0)
|
|
1245
|
+
return u + m;
|
|
1246
|
+
if (!c) {
|
|
1247
|
+
const b = f.reduce((h, p) => h + p.length + 2, 2);
|
|
1248
|
+
c = e.options.lineWidth > 0 && b > e.options.lineWidth;
|
|
1249
|
+
}
|
|
1250
|
+
if (c) {
|
|
1251
|
+
let b = u;
|
|
1252
|
+
for (const h of f)
|
|
1253
|
+
b += h ? `
|
|
1254
|
+
${r}${i}${h}` : `
|
|
1255
|
+
`;
|
|
1256
|
+
return `${b}
|
|
1257
|
+
${i}${m}`;
|
|
1258
|
+
} else
|
|
1259
|
+
return `${u}${o}${f.join(" ")}${o}${m}`;
|
|
1260
|
+
}
|
|
1261
|
+
function De({ indent: s, options: { commentString: e } }, t, n, i) {
|
|
1262
|
+
if (n && i && (n = n.replace(/^\n+/, "")), n) {
|
|
1263
|
+
const r = V(e(n), s);
|
|
1264
|
+
t.push(r.trimStart());
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
function z(s, e) {
|
|
1268
|
+
const t = I(e) ? e.value : e;
|
|
1269
|
+
for (const n of s)
|
|
1270
|
+
if (T(n) && (n.key === e || n.key === t || I(n.key) && n.key.value === t))
|
|
1271
|
+
return n;
|
|
1272
|
+
}
|
|
1273
|
+
class K extends ss {
|
|
1274
|
+
static get tagName() {
|
|
1275
|
+
return "tag:yaml.org,2002:map";
|
|
1276
|
+
}
|
|
1277
|
+
constructor(e) {
|
|
1278
|
+
super(W, e), this.items = [];
|
|
1279
|
+
}
|
|
1280
|
+
/**
|
|
1281
|
+
* A generic collection parsing method that can be extended
|
|
1282
|
+
* to other node classes that inherit from YAMLMap
|
|
1283
|
+
*/
|
|
1284
|
+
static from(e, t, n) {
|
|
1285
|
+
const { keepUndefined: i, replacer: r } = n, o = new this(e), l = (a, c) => {
|
|
1286
|
+
if (typeof r == "function")
|
|
1287
|
+
c = r.call(t, a, c);
|
|
1288
|
+
else if (Array.isArray(r) && !r.includes(a))
|
|
1289
|
+
return;
|
|
1290
|
+
(c !== void 0 || i) && o.items.push(gt(a, c, n));
|
|
1291
|
+
};
|
|
1292
|
+
if (t instanceof Map)
|
|
1293
|
+
for (const [a, c] of t)
|
|
1294
|
+
l(a, c);
|
|
1295
|
+
else if (t && typeof t == "object")
|
|
1296
|
+
for (const a of Object.keys(t))
|
|
1297
|
+
l(a, t[a]);
|
|
1298
|
+
return typeof e.sortMapEntries == "function" && o.items.sort(e.sortMapEntries), o;
|
|
1299
|
+
}
|
|
1300
|
+
/**
|
|
1301
|
+
* Adds a value to the collection.
|
|
1302
|
+
*
|
|
1303
|
+
* @param overwrite - If not set `true`, using a key that is already in the
|
|
1304
|
+
* collection will throw. Otherwise, overwrites the previous value.
|
|
1305
|
+
*/
|
|
1306
|
+
add(e, t) {
|
|
1307
|
+
let n;
|
|
1308
|
+
T(e) ? n = e : !e || typeof e != "object" || !("key" in e) ? n = new v(e, e?.value) : n = new v(e.key, e.value);
|
|
1309
|
+
const i = z(this.items, n.key), r = this.schema?.sortMapEntries;
|
|
1310
|
+
if (i) {
|
|
1311
|
+
if (!t)
|
|
1312
|
+
throw new Error(`Key ${n.key} already set`);
|
|
1313
|
+
I(i.value) && ts(n.value) ? i.value.value = n.value : i.value = n.value;
|
|
1314
|
+
} else if (r) {
|
|
1315
|
+
const o = this.items.findIndex((l) => r(n, l) < 0);
|
|
1316
|
+
o === -1 ? this.items.push(n) : this.items.splice(o, 0, n);
|
|
1317
|
+
} else
|
|
1318
|
+
this.items.push(n);
|
|
1319
|
+
}
|
|
1320
|
+
delete(e) {
|
|
1321
|
+
const t = z(this.items, e);
|
|
1322
|
+
return t ? this.items.splice(this.items.indexOf(t), 1).length > 0 : !1;
|
|
1323
|
+
}
|
|
1324
|
+
get(e, t) {
|
|
1325
|
+
const i = z(this.items, e)?.value;
|
|
1326
|
+
return (!t && I(i) ? i.value : i) ?? void 0;
|
|
1327
|
+
}
|
|
1328
|
+
has(e) {
|
|
1329
|
+
return !!z(this.items, e);
|
|
1330
|
+
}
|
|
1331
|
+
set(e, t) {
|
|
1332
|
+
this.add(new v(e, t), !0);
|
|
1333
|
+
}
|
|
1334
|
+
/**
|
|
1335
|
+
* @param ctx - Conversion context, originally set in Document#toJS()
|
|
1336
|
+
* @param {Class} Type - If set, forces the returned collection type
|
|
1337
|
+
* @returns Instance of Type, Map, or Object
|
|
1338
|
+
*/
|
|
1339
|
+
toJSON(e, t, n) {
|
|
1340
|
+
const i = n ? new n() : t?.mapAsMap ? /* @__PURE__ */ new Map() : {};
|
|
1341
|
+
t?.onCreate && t.onCreate(i);
|
|
1342
|
+
for (const r of this.items)
|
|
1343
|
+
ls(t, i, r);
|
|
1344
|
+
return i;
|
|
1345
|
+
}
|
|
1346
|
+
toString(e, t, n) {
|
|
1347
|
+
if (!e)
|
|
1348
|
+
return JSON.stringify(this);
|
|
1349
|
+
for (const i of this.items)
|
|
1350
|
+
if (!T(i))
|
|
1351
|
+
throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);
|
|
1352
|
+
return !e.allNullValues && this.hasAllNullValues(!1) && (e = Object.assign({}, e, { allNullValues: !0 })), as(this, e, {
|
|
1353
|
+
blockItemPrefix: "",
|
|
1354
|
+
flowChars: { start: "{", end: "}" },
|
|
1355
|
+
itemIndent: e.indent || "",
|
|
1356
|
+
onChompKeep: n,
|
|
1357
|
+
onComment: t
|
|
1358
|
+
});
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
const ye = {
|
|
1362
|
+
collection: "map",
|
|
1363
|
+
default: !0,
|
|
1364
|
+
nodeClass: K,
|
|
1365
|
+
tag: "tag:yaml.org,2002:map",
|
|
1366
|
+
resolve(s, e) {
|
|
1367
|
+
return pe(s) || e("Expected a mapping for this tag"), s;
|
|
1368
|
+
},
|
|
1369
|
+
createNode: (s, e, t) => K.from(s, e, t)
|
|
1370
|
+
};
|
|
1371
|
+
class Q extends ss {
|
|
1372
|
+
static get tagName() {
|
|
1373
|
+
return "tag:yaml.org,2002:seq";
|
|
1374
|
+
}
|
|
1375
|
+
constructor(e) {
|
|
1376
|
+
super(de, e), this.items = [];
|
|
1377
|
+
}
|
|
1378
|
+
add(e) {
|
|
1379
|
+
this.items.push(e);
|
|
1380
|
+
}
|
|
1381
|
+
/**
|
|
1382
|
+
* Removes a value from the collection.
|
|
1383
|
+
*
|
|
1384
|
+
* `key` must contain a representation of an integer for this to succeed.
|
|
1385
|
+
* It may be wrapped in a `Scalar`.
|
|
1386
|
+
*
|
|
1387
|
+
* @returns `true` if the item was found and removed.
|
|
1388
|
+
*/
|
|
1389
|
+
delete(e) {
|
|
1390
|
+
const t = $e(e);
|
|
1391
|
+
return typeof t != "number" ? !1 : this.items.splice(t, 1).length > 0;
|
|
1392
|
+
}
|
|
1393
|
+
get(e, t) {
|
|
1394
|
+
const n = $e(e);
|
|
1395
|
+
if (typeof n != "number")
|
|
1396
|
+
return;
|
|
1397
|
+
const i = this.items[n];
|
|
1398
|
+
return !t && I(i) ? i.value : i;
|
|
1399
|
+
}
|
|
1400
|
+
/**
|
|
1401
|
+
* Checks if the collection includes a value with the key `key`.
|
|
1402
|
+
*
|
|
1403
|
+
* `key` must contain a representation of an integer for this to succeed.
|
|
1404
|
+
* It may be wrapped in a `Scalar`.
|
|
1405
|
+
*/
|
|
1406
|
+
has(e) {
|
|
1407
|
+
const t = $e(e);
|
|
1408
|
+
return typeof t == "number" && t < this.items.length;
|
|
1409
|
+
}
|
|
1410
|
+
/**
|
|
1411
|
+
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
1412
|
+
* boolean to add/remove the item from the set.
|
|
1413
|
+
*
|
|
1414
|
+
* If `key` does not contain a representation of an integer, this will throw.
|
|
1415
|
+
* It may be wrapped in a `Scalar`.
|
|
1416
|
+
*/
|
|
1417
|
+
set(e, t) {
|
|
1418
|
+
const n = $e(e);
|
|
1419
|
+
if (typeof n != "number")
|
|
1420
|
+
throw new Error(`Expected a valid index, not ${e}.`);
|
|
1421
|
+
const i = this.items[n];
|
|
1422
|
+
I(i) && ts(t) ? i.value = t : this.items[n] = t;
|
|
1423
|
+
}
|
|
1424
|
+
toJSON(e, t) {
|
|
1425
|
+
const n = [];
|
|
1426
|
+
t?.onCreate && t.onCreate(n);
|
|
1427
|
+
let i = 0;
|
|
1428
|
+
for (const r of this.items)
|
|
1429
|
+
n.push(P(r, String(i++), t));
|
|
1430
|
+
return n;
|
|
1431
|
+
}
|
|
1432
|
+
toString(e, t, n) {
|
|
1433
|
+
return e ? as(this, e, {
|
|
1434
|
+
blockItemPrefix: "- ",
|
|
1435
|
+
flowChars: { start: "[", end: "]" },
|
|
1436
|
+
itemIndent: (e.indent || "") + " ",
|
|
1437
|
+
onChompKeep: n,
|
|
1438
|
+
onComment: t
|
|
1439
|
+
}) : JSON.stringify(this);
|
|
1440
|
+
}
|
|
1441
|
+
static from(e, t, n) {
|
|
1442
|
+
const { replacer: i } = n, r = new this(e);
|
|
1443
|
+
if (t && Symbol.iterator in Object(t)) {
|
|
1444
|
+
let o = 0;
|
|
1445
|
+
for (let l of t) {
|
|
1446
|
+
if (typeof i == "function") {
|
|
1447
|
+
const a = t instanceof Set ? l : String(o++);
|
|
1448
|
+
l = i.call(t, a, l);
|
|
1449
|
+
}
|
|
1450
|
+
r.items.push(Ne(l, void 0, n));
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
return r;
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
function $e(s) {
|
|
1457
|
+
let e = I(s) ? s.value : s;
|
|
1458
|
+
return e && typeof e == "string" && (e = Number(e)), typeof e == "number" && Number.isInteger(e) && e >= 0 ? e : null;
|
|
1459
|
+
}
|
|
1460
|
+
const ge = {
|
|
1461
|
+
collection: "seq",
|
|
1462
|
+
default: !0,
|
|
1463
|
+
nodeClass: Q,
|
|
1464
|
+
tag: "tag:yaml.org,2002:seq",
|
|
1465
|
+
resolve(s, e) {
|
|
1466
|
+
return me(s) || e("Expected a sequence for this tag"), s;
|
|
1467
|
+
},
|
|
1468
|
+
createNode: (s, e, t) => Q.from(s, e, t)
|
|
1469
|
+
}, Ge = {
|
|
1470
|
+
identify: (s) => typeof s == "string",
|
|
1471
|
+
default: !0,
|
|
1472
|
+
tag: "tag:yaml.org,2002:str",
|
|
1473
|
+
resolve: (s) => s,
|
|
1474
|
+
stringify(s, e, t, n) {
|
|
1475
|
+
return e = Object.assign({ actualString: !0 }, e), Ie(s, e, t, n);
|
|
1476
|
+
}
|
|
1477
|
+
}, We = {
|
|
1478
|
+
identify: (s) => s == null,
|
|
1479
|
+
createNode: () => new N(null),
|
|
1480
|
+
default: !0,
|
|
1481
|
+
tag: "tag:yaml.org,2002:null",
|
|
1482
|
+
test: /^(?:~|[Nn]ull|NULL)?$/,
|
|
1483
|
+
resolve: () => new N(null),
|
|
1484
|
+
stringify: ({ source: s }, e) => typeof s == "string" && We.test.test(s) ? s : e.options.nullStr
|
|
1485
|
+
}, bt = {
|
|
1486
|
+
identify: (s) => typeof s == "boolean",
|
|
1487
|
+
default: !0,
|
|
1488
|
+
tag: "tag:yaml.org,2002:bool",
|
|
1489
|
+
test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
|
|
1490
|
+
resolve: (s) => new N(s[0] === "t" || s[0] === "T"),
|
|
1491
|
+
stringify({ source: s, value: e }, t) {
|
|
1492
|
+
if (s && bt.test.test(s)) {
|
|
1493
|
+
const n = s[0] === "t" || s[0] === "T";
|
|
1494
|
+
if (e === n)
|
|
1495
|
+
return s;
|
|
1496
|
+
}
|
|
1497
|
+
return e ? t.options.trueStr : t.options.falseStr;
|
|
1498
|
+
}
|
|
1499
|
+
};
|
|
1500
|
+
function F({ format: s, minFractionDigits: e, tag: t, value: n }) {
|
|
1501
|
+
if (typeof n == "bigint")
|
|
1502
|
+
return String(n);
|
|
1503
|
+
const i = typeof n == "number" ? n : Number(n);
|
|
1504
|
+
if (!isFinite(i))
|
|
1505
|
+
return isNaN(i) ? ".nan" : i < 0 ? "-.inf" : ".inf";
|
|
1506
|
+
let r = Object.is(n, -0) ? "-0" : JSON.stringify(n);
|
|
1507
|
+
if (!s && e && (!t || t === "tag:yaml.org,2002:float") && /^\d/.test(r)) {
|
|
1508
|
+
let o = r.indexOf(".");
|
|
1509
|
+
o < 0 && (o = r.length, r += ".");
|
|
1510
|
+
let l = e - (r.length - o - 1);
|
|
1511
|
+
for (; l-- > 0; )
|
|
1512
|
+
r += "0";
|
|
1513
|
+
}
|
|
1514
|
+
return r;
|
|
1515
|
+
}
|
|
1516
|
+
const cs = {
|
|
1517
|
+
identify: (s) => typeof s == "number",
|
|
1518
|
+
default: !0,
|
|
1519
|
+
tag: "tag:yaml.org,2002:float",
|
|
1520
|
+
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
|
|
1521
|
+
resolve: (s) => s.slice(-3).toLowerCase() === "nan" ? NaN : s[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
|
1522
|
+
stringify: F
|
|
1523
|
+
}, fs = {
|
|
1524
|
+
identify: (s) => typeof s == "number",
|
|
1525
|
+
default: !0,
|
|
1526
|
+
tag: "tag:yaml.org,2002:float",
|
|
1527
|
+
format: "EXP",
|
|
1528
|
+
test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,
|
|
1529
|
+
resolve: (s) => parseFloat(s),
|
|
1530
|
+
stringify(s) {
|
|
1531
|
+
const e = Number(s.value);
|
|
1532
|
+
return isFinite(e) ? e.toExponential() : F(s);
|
|
1533
|
+
}
|
|
1534
|
+
}, us = {
|
|
1535
|
+
identify: (s) => typeof s == "number",
|
|
1536
|
+
default: !0,
|
|
1537
|
+
tag: "tag:yaml.org,2002:float",
|
|
1538
|
+
test: /^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,
|
|
1539
|
+
resolve(s) {
|
|
1540
|
+
const e = new N(parseFloat(s)), t = s.indexOf(".");
|
|
1541
|
+
return t !== -1 && s[s.length - 1] === "0" && (e.minFractionDigits = s.length - t - 1), e;
|
|
1542
|
+
},
|
|
1543
|
+
stringify: F
|
|
1544
|
+
}, Qe = (s) => typeof s == "bigint" || Number.isInteger(s), wt = (s, e, t, { intAsBigInt: n }) => n ? BigInt(s) : parseInt(s.substring(e), t);
|
|
1545
|
+
function hs(s, e, t) {
|
|
1546
|
+
const { value: n } = s;
|
|
1547
|
+
return Qe(n) && n >= 0 ? t + n.toString(e) : F(s);
|
|
1548
|
+
}
|
|
1549
|
+
const ds = {
|
|
1550
|
+
identify: (s) => Qe(s) && s >= 0,
|
|
1551
|
+
default: !0,
|
|
1552
|
+
tag: "tag:yaml.org,2002:int",
|
|
1553
|
+
format: "OCT",
|
|
1554
|
+
test: /^0o[0-7]+$/,
|
|
1555
|
+
resolve: (s, e, t) => wt(s, 2, 8, t),
|
|
1556
|
+
stringify: (s) => hs(s, 8, "0o")
|
|
1557
|
+
}, ps = {
|
|
1558
|
+
identify: Qe,
|
|
1559
|
+
default: !0,
|
|
1560
|
+
tag: "tag:yaml.org,2002:int",
|
|
1561
|
+
test: /^[-+]?[0-9]+$/,
|
|
1562
|
+
resolve: (s, e, t) => wt(s, 0, 10, t),
|
|
1563
|
+
stringify: F
|
|
1564
|
+
}, ms = {
|
|
1565
|
+
identify: (s) => Qe(s) && s >= 0,
|
|
1566
|
+
default: !0,
|
|
1567
|
+
tag: "tag:yaml.org,2002:int",
|
|
1568
|
+
format: "HEX",
|
|
1569
|
+
test: /^0x[0-9a-fA-F]+$/,
|
|
1570
|
+
resolve: (s, e, t) => wt(s, 2, 16, t),
|
|
1571
|
+
stringify: (s) => hs(s, 16, "0x")
|
|
1572
|
+
}, Nn = [
|
|
1573
|
+
ye,
|
|
1574
|
+
ge,
|
|
1575
|
+
Ge,
|
|
1576
|
+
We,
|
|
1577
|
+
bt,
|
|
1578
|
+
ds,
|
|
1579
|
+
ps,
|
|
1580
|
+
ms,
|
|
1581
|
+
cs,
|
|
1582
|
+
fs,
|
|
1583
|
+
us
|
|
1584
|
+
];
|
|
1585
|
+
function jt(s) {
|
|
1586
|
+
return typeof s == "bigint" || Number.isInteger(s);
|
|
1587
|
+
}
|
|
1588
|
+
const Ce = ({ value: s }) => JSON.stringify(s), On = [
|
|
1589
|
+
{
|
|
1590
|
+
identify: (s) => typeof s == "string",
|
|
1591
|
+
default: !0,
|
|
1592
|
+
tag: "tag:yaml.org,2002:str",
|
|
1593
|
+
resolve: (s) => s,
|
|
1594
|
+
stringify: Ce
|
|
1595
|
+
},
|
|
1596
|
+
{
|
|
1597
|
+
identify: (s) => s == null,
|
|
1598
|
+
createNode: () => new N(null),
|
|
1599
|
+
default: !0,
|
|
1600
|
+
tag: "tag:yaml.org,2002:null",
|
|
1601
|
+
test: /^null$/,
|
|
1602
|
+
resolve: () => null,
|
|
1603
|
+
stringify: Ce
|
|
1604
|
+
},
|
|
1605
|
+
{
|
|
1606
|
+
identify: (s) => typeof s == "boolean",
|
|
1607
|
+
default: !0,
|
|
1608
|
+
tag: "tag:yaml.org,2002:bool",
|
|
1609
|
+
test: /^true$|^false$/,
|
|
1610
|
+
resolve: (s) => s === "true",
|
|
1611
|
+
stringify: Ce
|
|
1612
|
+
},
|
|
1613
|
+
{
|
|
1614
|
+
identify: jt,
|
|
1615
|
+
default: !0,
|
|
1616
|
+
tag: "tag:yaml.org,2002:int",
|
|
1617
|
+
test: /^-?(?:0|[1-9][0-9]*)$/,
|
|
1618
|
+
resolve: (s, e, { intAsBigInt: t }) => t ? BigInt(s) : parseInt(s, 10),
|
|
1619
|
+
stringify: ({ value: s }) => jt(s) ? s.toString() : JSON.stringify(s)
|
|
1620
|
+
},
|
|
1621
|
+
{
|
|
1622
|
+
identify: (s) => typeof s == "number",
|
|
1623
|
+
default: !0,
|
|
1624
|
+
tag: "tag:yaml.org,2002:float",
|
|
1625
|
+
test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
|
|
1626
|
+
resolve: (s) => parseFloat(s),
|
|
1627
|
+
stringify: Ce
|
|
1628
|
+
}
|
|
1629
|
+
], An = {
|
|
1630
|
+
default: !0,
|
|
1631
|
+
tag: "",
|
|
1632
|
+
test: /^/,
|
|
1633
|
+
resolve(s, e) {
|
|
1634
|
+
return e(`Unresolved plain scalar ${JSON.stringify(s)}`), s;
|
|
1635
|
+
}
|
|
1636
|
+
}, In = [ye, ge].concat(On, An), kt = {
|
|
1637
|
+
identify: (s) => s instanceof Uint8Array,
|
|
1638
|
+
// Buffer inherits from Uint8Array
|
|
1639
|
+
default: !1,
|
|
1640
|
+
tag: "tag:yaml.org,2002:binary",
|
|
1641
|
+
/**
|
|
1642
|
+
* Returns a Buffer in node and an Uint8Array in browsers
|
|
1643
|
+
*
|
|
1644
|
+
* To use the resulting buffer as an image, you'll want to do something like:
|
|
1645
|
+
*
|
|
1646
|
+
* const blob = new Blob([buffer], { type: 'image/jpeg' })
|
|
1647
|
+
* document.querySelector('#photo').src = URL.createObjectURL(blob)
|
|
1648
|
+
*/
|
|
1649
|
+
resolve(s, e) {
|
|
1650
|
+
if (typeof atob == "function") {
|
|
1651
|
+
const t = atob(s.replace(/[\n\r]/g, "")), n = new Uint8Array(t.length);
|
|
1652
|
+
for (let i = 0; i < t.length; ++i)
|
|
1653
|
+
n[i] = t.charCodeAt(i);
|
|
1654
|
+
return n;
|
|
1655
|
+
} else
|
|
1656
|
+
return e("This environment does not support reading binary tags; either Buffer or atob is required"), s;
|
|
1657
|
+
},
|
|
1658
|
+
stringify({ comment: s, type: e, value: t }, n, i, r) {
|
|
1659
|
+
if (!t)
|
|
1660
|
+
return "";
|
|
1661
|
+
const o = t;
|
|
1662
|
+
let l;
|
|
1663
|
+
if (typeof btoa == "function") {
|
|
1664
|
+
let a = "";
|
|
1665
|
+
for (let c = 0; c < o.length; ++c)
|
|
1666
|
+
a += String.fromCharCode(o[c]);
|
|
1667
|
+
l = btoa(a);
|
|
1668
|
+
} else
|
|
1669
|
+
throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
|
|
1670
|
+
if (e ?? (e = N.BLOCK_LITERAL), e !== N.QUOTE_DOUBLE) {
|
|
1671
|
+
const a = Math.max(n.options.lineWidth - n.indent.length, n.options.minContentWidth), c = Math.ceil(l.length / a), d = new Array(c);
|
|
1672
|
+
for (let f = 0, u = 0; f < c; ++f, u += a)
|
|
1673
|
+
d[f] = l.substr(u, a);
|
|
1674
|
+
l = d.join(e === N.BLOCK_LITERAL ? `
|
|
1675
|
+
` : " ");
|
|
1676
|
+
}
|
|
1677
|
+
return Ie({ comment: s, type: e, value: l }, n, i, r);
|
|
1678
|
+
}
|
|
1679
|
+
};
|
|
1680
|
+
function ys(s, e) {
|
|
1681
|
+
if (me(s))
|
|
1682
|
+
for (let t = 0; t < s.items.length; ++t) {
|
|
1683
|
+
let n = s.items[t];
|
|
1684
|
+
if (!T(n)) {
|
|
1685
|
+
if (pe(n)) {
|
|
1686
|
+
n.items.length > 1 && e("Each pair must have its own sequence indicator");
|
|
1687
|
+
const i = n.items[0] || new v(new N(null));
|
|
1688
|
+
if (n.commentBefore && (i.key.commentBefore = i.key.commentBefore ? `${n.commentBefore}
|
|
1689
|
+
${i.key.commentBefore}` : n.commentBefore), n.comment) {
|
|
1690
|
+
const r = i.value ?? i.key;
|
|
1691
|
+
r.comment = r.comment ? `${n.comment}
|
|
1692
|
+
${r.comment}` : n.comment;
|
|
1693
|
+
}
|
|
1694
|
+
n = i;
|
|
1695
|
+
}
|
|
1696
|
+
s.items[t] = T(n) ? n : new v(n);
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1699
|
+
else
|
|
1700
|
+
e("Expected a sequence for this tag");
|
|
1701
|
+
return s;
|
|
1702
|
+
}
|
|
1703
|
+
function gs(s, e, t) {
|
|
1704
|
+
const { replacer: n } = t, i = new Q(s);
|
|
1705
|
+
i.tag = "tag:yaml.org,2002:pairs";
|
|
1706
|
+
let r = 0;
|
|
1707
|
+
if (e && Symbol.iterator in Object(e))
|
|
1708
|
+
for (let o of e) {
|
|
1709
|
+
typeof n == "function" && (o = n.call(e, String(r++), o));
|
|
1710
|
+
let l, a;
|
|
1711
|
+
if (Array.isArray(o))
|
|
1712
|
+
if (o.length === 2)
|
|
1713
|
+
l = o[0], a = o[1];
|
|
1714
|
+
else
|
|
1715
|
+
throw new TypeError(`Expected [key, value] tuple: ${o}`);
|
|
1716
|
+
else if (o && o instanceof Object) {
|
|
1717
|
+
const c = Object.keys(o);
|
|
1718
|
+
if (c.length === 1)
|
|
1719
|
+
l = c[0], a = o[l];
|
|
1720
|
+
else
|
|
1721
|
+
throw new TypeError(`Expected tuple with one key, not ${c.length} keys`);
|
|
1722
|
+
} else
|
|
1723
|
+
l = o;
|
|
1724
|
+
i.items.push(gt(l, a, t));
|
|
1725
|
+
}
|
|
1726
|
+
return i;
|
|
1727
|
+
}
|
|
1728
|
+
const St = {
|
|
1729
|
+
collection: "seq",
|
|
1730
|
+
default: !1,
|
|
1731
|
+
tag: "tag:yaml.org,2002:pairs",
|
|
1732
|
+
resolve: ys,
|
|
1733
|
+
createNode: gs
|
|
1734
|
+
};
|
|
1735
|
+
class ce extends Q {
|
|
1736
|
+
constructor() {
|
|
1737
|
+
super(), this.add = K.prototype.add.bind(this), this.delete = K.prototype.delete.bind(this), this.get = K.prototype.get.bind(this), this.has = K.prototype.has.bind(this), this.set = K.prototype.set.bind(this), this.tag = ce.tag;
|
|
1738
|
+
}
|
|
1739
|
+
/**
|
|
1740
|
+
* If `ctx` is given, the return type is actually `Map<unknown, unknown>`,
|
|
1741
|
+
* but TypeScript won't allow widening the signature of a child method.
|
|
1742
|
+
*/
|
|
1743
|
+
toJSON(e, t) {
|
|
1744
|
+
if (!t)
|
|
1745
|
+
return super.toJSON(e);
|
|
1746
|
+
const n = /* @__PURE__ */ new Map();
|
|
1747
|
+
t?.onCreate && t.onCreate(n);
|
|
1748
|
+
for (const i of this.items) {
|
|
1749
|
+
let r, o;
|
|
1750
|
+
if (T(i) ? (r = P(i.key, "", t), o = P(i.value, r, t)) : r = P(i, "", t), n.has(r))
|
|
1751
|
+
throw new Error("Ordered maps must not include duplicate keys");
|
|
1752
|
+
n.set(r, o);
|
|
1753
|
+
}
|
|
1754
|
+
return n;
|
|
1755
|
+
}
|
|
1756
|
+
static from(e, t, n) {
|
|
1757
|
+
const i = gs(e, t, n), r = new this();
|
|
1758
|
+
return r.items = i.items, r;
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1761
|
+
ce.tag = "tag:yaml.org,2002:omap";
|
|
1762
|
+
const Nt = {
|
|
1763
|
+
collection: "seq",
|
|
1764
|
+
identify: (s) => s instanceof Map,
|
|
1765
|
+
nodeClass: ce,
|
|
1766
|
+
default: !1,
|
|
1767
|
+
tag: "tag:yaml.org,2002:omap",
|
|
1768
|
+
resolve(s, e) {
|
|
1769
|
+
const t = ys(s, e), n = [];
|
|
1770
|
+
for (const { key: i } of t.items)
|
|
1771
|
+
I(i) && (n.includes(i.value) ? e(`Ordered maps must not include duplicate keys: ${i.value}`) : n.push(i.value));
|
|
1772
|
+
return Object.assign(new ce(), t);
|
|
1773
|
+
},
|
|
1774
|
+
createNode: (s, e, t) => ce.from(s, e, t)
|
|
1775
|
+
};
|
|
1776
|
+
function bs({ value: s, source: e }, t) {
|
|
1777
|
+
return e && (s ? ws : ks).test.test(e) ? e : s ? t.options.trueStr : t.options.falseStr;
|
|
1778
|
+
}
|
|
1779
|
+
const ws = {
|
|
1780
|
+
identify: (s) => s === !0,
|
|
1781
|
+
default: !0,
|
|
1782
|
+
tag: "tag:yaml.org,2002:bool",
|
|
1783
|
+
test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
|
|
1784
|
+
resolve: () => new N(!0),
|
|
1785
|
+
stringify: bs
|
|
1786
|
+
}, ks = {
|
|
1787
|
+
identify: (s) => s === !1,
|
|
1788
|
+
default: !0,
|
|
1789
|
+
tag: "tag:yaml.org,2002:bool",
|
|
1790
|
+
test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,
|
|
1791
|
+
resolve: () => new N(!1),
|
|
1792
|
+
stringify: bs
|
|
1793
|
+
}, En = {
|
|
1794
|
+
identify: (s) => typeof s == "number",
|
|
1795
|
+
default: !0,
|
|
1796
|
+
tag: "tag:yaml.org,2002:float",
|
|
1797
|
+
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
|
|
1798
|
+
resolve: (s) => s.slice(-3).toLowerCase() === "nan" ? NaN : s[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
|
1799
|
+
stringify: F
|
|
1800
|
+
}, Tn = {
|
|
1801
|
+
identify: (s) => typeof s == "number",
|
|
1802
|
+
default: !0,
|
|
1803
|
+
tag: "tag:yaml.org,2002:float",
|
|
1804
|
+
format: "EXP",
|
|
1805
|
+
test: /^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,
|
|
1806
|
+
resolve: (s) => parseFloat(s.replace(/_/g, "")),
|
|
1807
|
+
stringify(s) {
|
|
1808
|
+
const e = Number(s.value);
|
|
1809
|
+
return isFinite(e) ? e.toExponential() : F(s);
|
|
1810
|
+
}
|
|
1811
|
+
}, Ln = {
|
|
1812
|
+
identify: (s) => typeof s == "number",
|
|
1813
|
+
default: !0,
|
|
1814
|
+
tag: "tag:yaml.org,2002:float",
|
|
1815
|
+
test: /^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,
|
|
1816
|
+
resolve(s) {
|
|
1817
|
+
const e = new N(parseFloat(s.replace(/_/g, ""))), t = s.indexOf(".");
|
|
1818
|
+
if (t !== -1) {
|
|
1819
|
+
const n = s.substring(t + 1).replace(/_/g, "");
|
|
1820
|
+
n[n.length - 1] === "0" && (e.minFractionDigits = n.length);
|
|
1821
|
+
}
|
|
1822
|
+
return e;
|
|
1823
|
+
},
|
|
1824
|
+
stringify: F
|
|
1825
|
+
}, Ee = (s) => typeof s == "bigint" || Number.isInteger(s);
|
|
1826
|
+
function He(s, e, t, { intAsBigInt: n }) {
|
|
1827
|
+
const i = s[0];
|
|
1828
|
+
if ((i === "-" || i === "+") && (e += 1), s = s.substring(e).replace(/_/g, ""), n) {
|
|
1829
|
+
switch (t) {
|
|
1830
|
+
case 2:
|
|
1831
|
+
s = `0b${s}`;
|
|
1832
|
+
break;
|
|
1833
|
+
case 8:
|
|
1834
|
+
s = `0o${s}`;
|
|
1835
|
+
break;
|
|
1836
|
+
case 16:
|
|
1837
|
+
s = `0x${s}`;
|
|
1838
|
+
break;
|
|
1839
|
+
}
|
|
1840
|
+
const o = BigInt(s);
|
|
1841
|
+
return i === "-" ? BigInt(-1) * o : o;
|
|
1842
|
+
}
|
|
1843
|
+
const r = parseInt(s, t);
|
|
1844
|
+
return i === "-" ? -1 * r : r;
|
|
1845
|
+
}
|
|
1846
|
+
function Ot(s, e, t) {
|
|
1847
|
+
const { value: n } = s;
|
|
1848
|
+
if (Ee(n)) {
|
|
1849
|
+
const i = n.toString(e);
|
|
1850
|
+
return n < 0 ? "-" + t + i.substr(1) : t + i;
|
|
1851
|
+
}
|
|
1852
|
+
return F(s);
|
|
1853
|
+
}
|
|
1854
|
+
const $n = {
|
|
1855
|
+
identify: Ee,
|
|
1856
|
+
default: !0,
|
|
1857
|
+
tag: "tag:yaml.org,2002:int",
|
|
1858
|
+
format: "BIN",
|
|
1859
|
+
test: /^[-+]?0b[0-1_]+$/,
|
|
1860
|
+
resolve: (s, e, t) => He(s, 2, 2, t),
|
|
1861
|
+
stringify: (s) => Ot(s, 2, "0b")
|
|
1862
|
+
}, Cn = {
|
|
1863
|
+
identify: Ee,
|
|
1864
|
+
default: !0,
|
|
1865
|
+
tag: "tag:yaml.org,2002:int",
|
|
1866
|
+
format: "OCT",
|
|
1867
|
+
test: /^[-+]?0[0-7_]+$/,
|
|
1868
|
+
resolve: (s, e, t) => He(s, 1, 8, t),
|
|
1869
|
+
stringify: (s) => Ot(s, 8, "0")
|
|
1870
|
+
}, _n = {
|
|
1871
|
+
identify: Ee,
|
|
1872
|
+
default: !0,
|
|
1873
|
+
tag: "tag:yaml.org,2002:int",
|
|
1874
|
+
test: /^[-+]?[0-9][0-9_]*$/,
|
|
1875
|
+
resolve: (s, e, t) => He(s, 0, 10, t),
|
|
1876
|
+
stringify: F
|
|
1877
|
+
}, vn = {
|
|
1878
|
+
identify: Ee,
|
|
1879
|
+
default: !0,
|
|
1880
|
+
tag: "tag:yaml.org,2002:int",
|
|
1881
|
+
format: "HEX",
|
|
1882
|
+
test: /^[-+]?0x[0-9a-fA-F_]+$/,
|
|
1883
|
+
resolve: (s, e, t) => He(s, 2, 16, t),
|
|
1884
|
+
stringify: (s) => Ot(s, 16, "0x")
|
|
1885
|
+
};
|
|
1886
|
+
class fe extends K {
|
|
1887
|
+
constructor(e) {
|
|
1888
|
+
super(e), this.tag = fe.tag;
|
|
1889
|
+
}
|
|
1890
|
+
add(e) {
|
|
1891
|
+
let t;
|
|
1892
|
+
T(e) ? t = e : e && typeof e == "object" && "key" in e && "value" in e && e.value === null ? t = new v(e.key, null) : t = new v(e, null), z(this.items, t.key) || this.items.push(t);
|
|
1893
|
+
}
|
|
1894
|
+
/**
|
|
1895
|
+
* If `keepPair` is `true`, returns the Pair matching `key`.
|
|
1896
|
+
* Otherwise, returns the value of that Pair's key.
|
|
1897
|
+
*/
|
|
1898
|
+
get(e, t) {
|
|
1899
|
+
const n = z(this.items, e);
|
|
1900
|
+
return !t && T(n) ? I(n.key) ? n.key.value : n.key : n;
|
|
1901
|
+
}
|
|
1902
|
+
set(e, t) {
|
|
1903
|
+
if (typeof t != "boolean")
|
|
1904
|
+
throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);
|
|
1905
|
+
const n = z(this.items, e);
|
|
1906
|
+
n && !t ? this.items.splice(this.items.indexOf(n), 1) : !n && t && this.items.push(new v(e));
|
|
1907
|
+
}
|
|
1908
|
+
toJSON(e, t) {
|
|
1909
|
+
return super.toJSON(e, t, Set);
|
|
1910
|
+
}
|
|
1911
|
+
toString(e, t, n) {
|
|
1912
|
+
if (!e)
|
|
1913
|
+
return JSON.stringify(this);
|
|
1914
|
+
if (this.hasAllNullValues(!0))
|
|
1915
|
+
return super.toString(Object.assign({}, e, { allNullValues: !0 }), t, n);
|
|
1916
|
+
throw new Error("Set items must all have null values");
|
|
1917
|
+
}
|
|
1918
|
+
static from(e, t, n) {
|
|
1919
|
+
const { replacer: i } = n, r = new this(e);
|
|
1920
|
+
if (t && Symbol.iterator in Object(t))
|
|
1921
|
+
for (let o of t)
|
|
1922
|
+
typeof i == "function" && (o = i.call(t, o, o)), r.items.push(gt(o, null, n));
|
|
1923
|
+
return r;
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1926
|
+
fe.tag = "tag:yaml.org,2002:set";
|
|
1927
|
+
const At = {
|
|
1928
|
+
collection: "map",
|
|
1929
|
+
identify: (s) => s instanceof Set,
|
|
1930
|
+
nodeClass: fe,
|
|
1931
|
+
default: !1,
|
|
1932
|
+
tag: "tag:yaml.org,2002:set",
|
|
1933
|
+
createNode: (s, e, t) => fe.from(s, e, t),
|
|
1934
|
+
resolve(s, e) {
|
|
1935
|
+
if (pe(s)) {
|
|
1936
|
+
if (s.hasAllNullValues(!0))
|
|
1937
|
+
return Object.assign(new fe(), s);
|
|
1938
|
+
e("Set items must all have null values");
|
|
1939
|
+
} else
|
|
1940
|
+
e("Expected a mapping for this tag");
|
|
1941
|
+
return s;
|
|
1942
|
+
}
|
|
1943
|
+
};
|
|
1944
|
+
function It(s, e) {
|
|
1945
|
+
const t = s[0], n = t === "-" || t === "+" ? s.substring(1) : s, i = (o) => e ? BigInt(o) : Number(o), r = n.replace(/_/g, "").split(":").reduce((o, l) => o * i(60) + i(l), i(0));
|
|
1946
|
+
return t === "-" ? i(-1) * r : r;
|
|
1947
|
+
}
|
|
1948
|
+
function Ss(s) {
|
|
1949
|
+
let { value: e } = s, t = (o) => o;
|
|
1950
|
+
if (typeof e == "bigint")
|
|
1951
|
+
t = (o) => BigInt(o);
|
|
1952
|
+
else if (isNaN(e) || !isFinite(e))
|
|
1953
|
+
return F(s);
|
|
1954
|
+
let n = "";
|
|
1955
|
+
e < 0 && (n = "-", e *= t(-1));
|
|
1956
|
+
const i = t(60), r = [e % i];
|
|
1957
|
+
return e < 60 ? r.unshift(0) : (e = (e - r[0]) / i, r.unshift(e % i), e >= 60 && (e = (e - r[0]) / i, r.unshift(e))), n + r.map((o) => String(o).padStart(2, "0")).join(":").replace(/000000\d*$/, "");
|
|
1958
|
+
}
|
|
1959
|
+
const Ns = {
|
|
1960
|
+
identify: (s) => typeof s == "bigint" || Number.isInteger(s),
|
|
1961
|
+
default: !0,
|
|
1962
|
+
tag: "tag:yaml.org,2002:int",
|
|
1963
|
+
format: "TIME",
|
|
1964
|
+
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,
|
|
1965
|
+
resolve: (s, e, { intAsBigInt: t }) => It(s, t),
|
|
1966
|
+
stringify: Ss
|
|
1967
|
+
}, Os = {
|
|
1968
|
+
identify: (s) => typeof s == "number",
|
|
1969
|
+
default: !0,
|
|
1970
|
+
tag: "tag:yaml.org,2002:float",
|
|
1971
|
+
format: "TIME",
|
|
1972
|
+
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,
|
|
1973
|
+
resolve: (s) => It(s, !1),
|
|
1974
|
+
stringify: Ss
|
|
1975
|
+
}, Xe = {
|
|
1976
|
+
identify: (s) => s instanceof Date,
|
|
1977
|
+
default: !0,
|
|
1978
|
+
tag: "tag:yaml.org,2002:timestamp",
|
|
1979
|
+
// If the time zone is omitted, the timestamp is assumed to be specified in UTC. The time part
|
|
1980
|
+
// may be omitted altogether, resulting in a date format. In such a case, the time part is
|
|
1981
|
+
// assumed to be 00:00:00Z (start of day, UTC).
|
|
1982
|
+
test: RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),
|
|
1983
|
+
resolve(s) {
|
|
1984
|
+
const e = s.match(Xe.test);
|
|
1985
|
+
if (!e)
|
|
1986
|
+
throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
|
|
1987
|
+
const [, t, n, i, r, o, l] = e.map(Number), a = e[7] ? Number((e[7] + "00").substr(1, 3)) : 0;
|
|
1988
|
+
let c = Date.UTC(t, n - 1, i, r || 0, o || 0, l || 0, a);
|
|
1989
|
+
const d = e[8];
|
|
1990
|
+
if (d && d !== "Z") {
|
|
1991
|
+
let f = It(d, !1);
|
|
1992
|
+
Math.abs(f) < 30 && (f *= 60), c -= 6e4 * f;
|
|
1993
|
+
}
|
|
1994
|
+
return new Date(c);
|
|
1995
|
+
},
|
|
1996
|
+
stringify: ({ value: s }) => s?.toISOString().replace(/(T00:00:00)?\.000Z$/, "") ?? ""
|
|
1997
|
+
}, Pt = [
|
|
1998
|
+
ye,
|
|
1999
|
+
ge,
|
|
2000
|
+
Ge,
|
|
2001
|
+
We,
|
|
2002
|
+
ws,
|
|
2003
|
+
ks,
|
|
2004
|
+
$n,
|
|
2005
|
+
Cn,
|
|
2006
|
+
_n,
|
|
2007
|
+
vn,
|
|
2008
|
+
En,
|
|
2009
|
+
Tn,
|
|
2010
|
+
Ln,
|
|
2011
|
+
kt,
|
|
2012
|
+
Y,
|
|
2013
|
+
Nt,
|
|
2014
|
+
St,
|
|
2015
|
+
At,
|
|
2016
|
+
Ns,
|
|
2017
|
+
Os,
|
|
2018
|
+
Xe
|
|
2019
|
+
], Dt = /* @__PURE__ */ new Map([
|
|
2020
|
+
["core", Nn],
|
|
2021
|
+
["failsafe", [ye, ge, Ge]],
|
|
2022
|
+
["json", In],
|
|
2023
|
+
["yaml11", Pt],
|
|
2024
|
+
["yaml-1.1", Pt]
|
|
2025
|
+
]), qt = {
|
|
2026
|
+
binary: kt,
|
|
2027
|
+
bool: bt,
|
|
2028
|
+
float: us,
|
|
2029
|
+
floatExp: fs,
|
|
2030
|
+
floatNaN: cs,
|
|
2031
|
+
floatTime: Os,
|
|
2032
|
+
int: ps,
|
|
2033
|
+
intHex: ms,
|
|
2034
|
+
intOct: ds,
|
|
2035
|
+
intTime: Ns,
|
|
2036
|
+
map: ye,
|
|
2037
|
+
merge: Y,
|
|
2038
|
+
null: We,
|
|
2039
|
+
omap: Nt,
|
|
2040
|
+
pairs: St,
|
|
2041
|
+
seq: ge,
|
|
2042
|
+
set: At,
|
|
2043
|
+
timestamp: Xe
|
|
2044
|
+
}, Mn = {
|
|
2045
|
+
"tag:yaml.org,2002:binary": kt,
|
|
2046
|
+
"tag:yaml.org,2002:merge": Y,
|
|
2047
|
+
"tag:yaml.org,2002:omap": Nt,
|
|
2048
|
+
"tag:yaml.org,2002:pairs": St,
|
|
2049
|
+
"tag:yaml.org,2002:set": At,
|
|
2050
|
+
"tag:yaml.org,2002:timestamp": Xe
|
|
2051
|
+
};
|
|
2052
|
+
function nt(s, e, t) {
|
|
2053
|
+
const n = Dt.get(e);
|
|
2054
|
+
if (n && !s)
|
|
2055
|
+
return t && !n.includes(Y) ? n.concat(Y) : n.slice();
|
|
2056
|
+
let i = n;
|
|
2057
|
+
if (!i)
|
|
2058
|
+
if (Array.isArray(s))
|
|
2059
|
+
i = [];
|
|
2060
|
+
else {
|
|
2061
|
+
const r = Array.from(Dt.keys()).filter((o) => o !== "yaml11").map((o) => JSON.stringify(o)).join(", ");
|
|
2062
|
+
throw new Error(`Unknown schema "${e}"; use one of ${r} or define customTags array`);
|
|
2063
|
+
}
|
|
2064
|
+
if (Array.isArray(s))
|
|
2065
|
+
for (const r of s)
|
|
2066
|
+
i = i.concat(r);
|
|
2067
|
+
else typeof s == "function" && (i = s(i.slice()));
|
|
2068
|
+
return t && (i = i.concat(Y)), i.reduce((r, o) => {
|
|
2069
|
+
const l = typeof o == "string" ? qt[o] : o;
|
|
2070
|
+
if (!l) {
|
|
2071
|
+
const a = JSON.stringify(o), c = Object.keys(qt).map((d) => JSON.stringify(d)).join(", ");
|
|
2072
|
+
throw new Error(`Unknown custom tag ${a}; use one of ${c}`);
|
|
2073
|
+
}
|
|
2074
|
+
return r.includes(l) || r.push(l), r;
|
|
2075
|
+
}, []);
|
|
2076
|
+
}
|
|
2077
|
+
const Bn = (s, e) => s.key < e.key ? -1 : s.key > e.key ? 1 : 0;
|
|
2078
|
+
class ze {
|
|
2079
|
+
constructor({ compat: e, customTags: t, merge: n, resolveKnownTags: i, schema: r, sortMapEntries: o, toStringDefaults: l }) {
|
|
2080
|
+
this.compat = Array.isArray(e) ? nt(e, "compat") : e ? nt(null, e) : null, this.name = typeof r == "string" && r || "core", this.knownTags = i ? Mn : {}, this.tags = nt(t, this.name, n), this.toStringOptions = l ?? null, Object.defineProperty(this, W, { value: ye }), Object.defineProperty(this, U, { value: Ge }), Object.defineProperty(this, de, { value: ge }), this.sortMapEntries = typeof o == "function" ? o : o === !0 ? Bn : null;
|
|
2081
|
+
}
|
|
2082
|
+
clone() {
|
|
2083
|
+
const e = Object.create(ze.prototype, Object.getOwnPropertyDescriptors(this));
|
|
2084
|
+
return e.tags = this.tags.slice(), e;
|
|
2085
|
+
}
|
|
2086
|
+
}
|
|
2087
|
+
function Kn(s, e) {
|
|
2088
|
+
const t = [];
|
|
2089
|
+
let n = e.directives === !0;
|
|
2090
|
+
if (e.directives !== !1 && s.directives) {
|
|
2091
|
+
const a = s.directives.toString(s);
|
|
2092
|
+
a ? (t.push(a), n = !0) : s.directives.docStart && (n = !0);
|
|
2093
|
+
}
|
|
2094
|
+
n && t.push("---");
|
|
2095
|
+
const i = is(s, e), { commentString: r } = i.options;
|
|
2096
|
+
if (s.commentBefore) {
|
|
2097
|
+
t.length !== 1 && t.unshift("");
|
|
2098
|
+
const a = r(s.commentBefore);
|
|
2099
|
+
t.unshift(V(a, ""));
|
|
2100
|
+
}
|
|
2101
|
+
let o = !1, l = null;
|
|
2102
|
+
if (s.contents) {
|
|
2103
|
+
if ($(s.contents)) {
|
|
2104
|
+
if (s.contents.spaceBefore && n && t.push(""), s.contents.commentBefore) {
|
|
2105
|
+
const d = r(s.contents.commentBefore);
|
|
2106
|
+
t.push(V(d, ""));
|
|
2107
|
+
}
|
|
2108
|
+
i.forceBlockIndent = !!s.comment, l = s.contents.comment;
|
|
2109
|
+
}
|
|
2110
|
+
const a = l ? void 0 : () => o = !0;
|
|
2111
|
+
let c = ue(s.contents, i, () => l = null, a);
|
|
2112
|
+
l && (c += X(c, "", r(l))), (c[0] === "|" || c[0] === ">") && t[t.length - 1] === "---" ? t[t.length - 1] = `--- ${c}` : t.push(c);
|
|
2113
|
+
} else
|
|
2114
|
+
t.push(ue(s.contents, i));
|
|
2115
|
+
if (s.directives?.docEnd)
|
|
2116
|
+
if (s.comment) {
|
|
2117
|
+
const a = r(s.comment);
|
|
2118
|
+
a.includes(`
|
|
2119
|
+
`) ? (t.push("..."), t.push(V(a, ""))) : t.push(`... ${a}`);
|
|
2120
|
+
} else
|
|
2121
|
+
t.push("...");
|
|
2122
|
+
else {
|
|
2123
|
+
let a = s.comment;
|
|
2124
|
+
a && o && (a = a.replace(/^\n+/, "")), a && ((!o || l) && t[t.length - 1] !== "" && t.push(""), t.push(V(r(a), "")));
|
|
2125
|
+
}
|
|
2126
|
+
return t.join(`
|
|
2127
|
+
`) + `
|
|
2128
|
+
`;
|
|
2129
|
+
}
|
|
2130
|
+
class be {
|
|
2131
|
+
constructor(e, t, n) {
|
|
2132
|
+
this.commentBefore = null, this.comment = null, this.errors = [], this.warnings = [], Object.defineProperty(this, D, { value: ct });
|
|
2133
|
+
let i = null;
|
|
2134
|
+
typeof t == "function" || Array.isArray(t) ? i = t : n === void 0 && t && (n = t, t = void 0);
|
|
2135
|
+
const r = Object.assign({
|
|
2136
|
+
intAsBigInt: !1,
|
|
2137
|
+
keepSourceTokens: !1,
|
|
2138
|
+
logLevel: "warn",
|
|
2139
|
+
prettyErrors: !0,
|
|
2140
|
+
strict: !0,
|
|
2141
|
+
stringKeys: !1,
|
|
2142
|
+
uniqueKeys: !0,
|
|
2143
|
+
version: "1.2"
|
|
2144
|
+
}, n);
|
|
2145
|
+
this.options = r;
|
|
2146
|
+
let { version: o } = r;
|
|
2147
|
+
n?._directives ? (this.directives = n._directives.atDocument(), this.directives.yaml.explicit && (o = this.directives.yaml.version)) : this.directives = new M({ version: o }), this.setSchema(o, n), this.contents = e === void 0 ? null : this.createNode(e, i, n);
|
|
2148
|
+
}
|
|
2149
|
+
/**
|
|
2150
|
+
* Create a deep copy of this Document and its contents.
|
|
2151
|
+
*
|
|
2152
|
+
* Custom Node values that inherit from `Object` still refer to their original instances.
|
|
2153
|
+
*/
|
|
2154
|
+
clone() {
|
|
2155
|
+
const e = Object.create(be.prototype, {
|
|
2156
|
+
[D]: { value: ct }
|
|
2157
|
+
});
|
|
2158
|
+
return e.commentBefore = this.commentBefore, e.comment = this.comment, e.errors = this.errors.slice(), e.warnings = this.warnings.slice(), e.options = Object.assign({}, this.options), this.directives && (e.directives = this.directives.clone()), e.schema = this.schema.clone(), e.contents = $(this.contents) ? this.contents.clone(e.schema) : this.contents, this.range && (e.range = this.range.slice()), e;
|
|
2159
|
+
}
|
|
2160
|
+
/** Adds a value to the document. */
|
|
2161
|
+
add(e) {
|
|
2162
|
+
ne(this.contents) && this.contents.add(e);
|
|
2163
|
+
}
|
|
2164
|
+
/** Adds a value to the document. */
|
|
2165
|
+
addIn(e, t) {
|
|
2166
|
+
ne(this.contents) && this.contents.addIn(e, t);
|
|
2167
|
+
}
|
|
2168
|
+
/**
|
|
2169
|
+
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
2170
|
+
*
|
|
2171
|
+
* If `node` already has an anchor, `name` is ignored.
|
|
2172
|
+
* Otherwise, the `node.anchor` value will be set to `name`,
|
|
2173
|
+
* or if an anchor with that name is already present in the document,
|
|
2174
|
+
* `name` will be used as a prefix for a new unique anchor.
|
|
2175
|
+
* If `name` is undefined, the generated anchor will use 'a' as a prefix.
|
|
2176
|
+
*/
|
|
2177
|
+
createAlias(e, t) {
|
|
2178
|
+
if (!e.anchor) {
|
|
2179
|
+
const n = Zt(this);
|
|
2180
|
+
e.anchor = // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
2181
|
+
!t || n.has(t) ? es(t || "a", n) : t;
|
|
2182
|
+
}
|
|
2183
|
+
return new Ue(e.anchor);
|
|
2184
|
+
}
|
|
2185
|
+
createNode(e, t, n) {
|
|
2186
|
+
let i;
|
|
2187
|
+
if (typeof t == "function")
|
|
2188
|
+
e = t.call({ "": e }, "", e), i = t;
|
|
2189
|
+
else if (Array.isArray(t)) {
|
|
2190
|
+
const p = (g) => typeof g == "number" || g instanceof String || g instanceof Number, y = t.filter(p).map(String);
|
|
2191
|
+
y.length > 0 && (t = t.concat(y)), i = t;
|
|
2192
|
+
} else n === void 0 && t && (n = t, t = void 0);
|
|
2193
|
+
const { aliasDuplicateObjects: r, anchorPrefix: o, flow: l, keepUndefined: a, onTagObj: c, tag: d } = n ?? {}, { onAnchor: f, setAnchors: u, sourceObjects: m } = cn(
|
|
2194
|
+
this,
|
|
2195
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
2196
|
+
o || "a"
|
|
2197
|
+
), b = {
|
|
2198
|
+
aliasDuplicateObjects: r ?? !0,
|
|
2199
|
+
keepUndefined: a ?? !1,
|
|
2200
|
+
onAnchor: f,
|
|
2201
|
+
onTagObj: c,
|
|
2202
|
+
replacer: i,
|
|
2203
|
+
schema: this.schema,
|
|
2204
|
+
sourceObjects: m
|
|
2205
|
+
}, h = Ne(e, d, b);
|
|
2206
|
+
return l && L(h) && (h.flow = !0), u(), h;
|
|
2207
|
+
}
|
|
2208
|
+
/**
|
|
2209
|
+
* Convert a key and a value into a `Pair` using the current schema,
|
|
2210
|
+
* recursively wrapping all values as `Scalar` or `Collection` nodes.
|
|
2211
|
+
*/
|
|
2212
|
+
createPair(e, t, n = {}) {
|
|
2213
|
+
const i = this.createNode(e, null, n), r = this.createNode(t, null, n);
|
|
2214
|
+
return new v(i, r);
|
|
2215
|
+
}
|
|
2216
|
+
/**
|
|
2217
|
+
* Removes a value from the document.
|
|
2218
|
+
* @returns `true` if the item was found and removed.
|
|
2219
|
+
*/
|
|
2220
|
+
delete(e) {
|
|
2221
|
+
return ne(this.contents) ? this.contents.delete(e) : !1;
|
|
2222
|
+
}
|
|
2223
|
+
/**
|
|
2224
|
+
* Removes a value from the document.
|
|
2225
|
+
* @returns `true` if the item was found and removed.
|
|
2226
|
+
*/
|
|
2227
|
+
deleteIn(e) {
|
|
2228
|
+
return ke(e) ? this.contents == null ? !1 : (this.contents = null, !0) : ne(this.contents) ? this.contents.deleteIn(e) : !1;
|
|
2229
|
+
}
|
|
2230
|
+
/**
|
|
2231
|
+
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
2232
|
+
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
2233
|
+
* `true` (collections are always returned intact).
|
|
2234
|
+
*/
|
|
2235
|
+
get(e, t) {
|
|
2236
|
+
return L(this.contents) ? this.contents.get(e, t) : void 0;
|
|
2237
|
+
}
|
|
2238
|
+
/**
|
|
2239
|
+
* Returns item at `path`, or `undefined` if not found. By default unwraps
|
|
2240
|
+
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
2241
|
+
* `true` (collections are always returned intact).
|
|
2242
|
+
*/
|
|
2243
|
+
getIn(e, t) {
|
|
2244
|
+
return ke(e) ? !t && I(this.contents) ? this.contents.value : this.contents : L(this.contents) ? this.contents.getIn(e, t) : void 0;
|
|
2245
|
+
}
|
|
2246
|
+
/**
|
|
2247
|
+
* Checks if the document includes a value with the key `key`.
|
|
2248
|
+
*/
|
|
2249
|
+
has(e) {
|
|
2250
|
+
return L(this.contents) ? this.contents.has(e) : !1;
|
|
2251
|
+
}
|
|
2252
|
+
/**
|
|
2253
|
+
* Checks if the document includes a value at `path`.
|
|
2254
|
+
*/
|
|
2255
|
+
hasIn(e) {
|
|
2256
|
+
return ke(e) ? this.contents !== void 0 : L(this.contents) ? this.contents.hasIn(e) : !1;
|
|
2257
|
+
}
|
|
2258
|
+
/**
|
|
2259
|
+
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
2260
|
+
* boolean to add/remove the item from the set.
|
|
2261
|
+
*/
|
|
2262
|
+
set(e, t) {
|
|
2263
|
+
this.contents == null ? this.contents = Pe(this.schema, [e], t) : ne(this.contents) && this.contents.set(e, t);
|
|
2264
|
+
}
|
|
2265
|
+
/**
|
|
2266
|
+
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
2267
|
+
* boolean to add/remove the item from the set.
|
|
2268
|
+
*/
|
|
2269
|
+
setIn(e, t) {
|
|
2270
|
+
ke(e) ? this.contents = t : this.contents == null ? this.contents = Pe(this.schema, Array.from(e), t) : ne(this.contents) && this.contents.setIn(e, t);
|
|
2271
|
+
}
|
|
2272
|
+
/**
|
|
2273
|
+
* Change the YAML version and schema used by the document.
|
|
2274
|
+
* A `null` version disables support for directives, explicit tags, anchors, and aliases.
|
|
2275
|
+
* It also requires the `schema` option to be given as a `Schema` instance value.
|
|
2276
|
+
*
|
|
2277
|
+
* Overrides all previously set schema options.
|
|
2278
|
+
*/
|
|
2279
|
+
setSchema(e, t = {}) {
|
|
2280
|
+
typeof e == "number" && (e = String(e));
|
|
2281
|
+
let n;
|
|
2282
|
+
switch (e) {
|
|
2283
|
+
case "1.1":
|
|
2284
|
+
this.directives ? this.directives.yaml.version = "1.1" : this.directives = new M({ version: "1.1" }), n = { resolveKnownTags: !1, schema: "yaml-1.1" };
|
|
2285
|
+
break;
|
|
2286
|
+
case "1.2":
|
|
2287
|
+
case "next":
|
|
2288
|
+
this.directives ? this.directives.yaml.version = e : this.directives = new M({ version: e }), n = { resolveKnownTags: !0, schema: "core" };
|
|
2289
|
+
break;
|
|
2290
|
+
case null:
|
|
2291
|
+
this.directives && delete this.directives, n = null;
|
|
2292
|
+
break;
|
|
2293
|
+
default: {
|
|
2294
|
+
const i = JSON.stringify(e);
|
|
2295
|
+
throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`);
|
|
2296
|
+
}
|
|
2297
|
+
}
|
|
2298
|
+
if (t.schema instanceof Object)
|
|
2299
|
+
this.schema = t.schema;
|
|
2300
|
+
else if (n)
|
|
2301
|
+
this.schema = new ze(Object.assign(n, t));
|
|
2302
|
+
else
|
|
2303
|
+
throw new Error("With a null YAML version, the { schema: Schema } option is required");
|
|
2304
|
+
}
|
|
2305
|
+
// json & jsonArg are only used from toJSON()
|
|
2306
|
+
toJS({ json: e, jsonArg: t, mapAsMap: n, maxAliasCount: i, onAnchor: r, reviver: o } = {}) {
|
|
2307
|
+
const l = {
|
|
2308
|
+
anchors: /* @__PURE__ */ new Map(),
|
|
2309
|
+
doc: this,
|
|
2310
|
+
keep: !e,
|
|
2311
|
+
mapAsMap: n === !0,
|
|
2312
|
+
mapKeyWarned: !1,
|
|
2313
|
+
maxAliasCount: typeof i == "number" ? i : 100
|
|
2314
|
+
}, a = P(this.contents, t ?? "", l);
|
|
2315
|
+
if (typeof r == "function")
|
|
2316
|
+
for (const { count: c, res: d } of l.anchors.values())
|
|
2317
|
+
r(d, c);
|
|
2318
|
+
return typeof o == "function" ? le(o, { "": a }, "", a) : a;
|
|
2319
|
+
}
|
|
2320
|
+
/**
|
|
2321
|
+
* A JSON representation of the document `contents`.
|
|
2322
|
+
*
|
|
2323
|
+
* @param jsonArg Used by `JSON.stringify` to indicate the array index or
|
|
2324
|
+
* property name.
|
|
2325
|
+
*/
|
|
2326
|
+
toJSON(e, t) {
|
|
2327
|
+
return this.toJS({ json: !0, jsonArg: e, mapAsMap: !1, onAnchor: t });
|
|
2328
|
+
}
|
|
2329
|
+
/** A YAML representation of the document. */
|
|
2330
|
+
toString(e = {}) {
|
|
2331
|
+
if (this.errors.length > 0)
|
|
2332
|
+
throw new Error("Document with errors cannot be stringified");
|
|
2333
|
+
if ("indent" in e && (!Number.isInteger(e.indent) || Number(e.indent) <= 0)) {
|
|
2334
|
+
const t = JSON.stringify(e.indent);
|
|
2335
|
+
throw new Error(`"indent" option must be a positive integer, not ${t}`);
|
|
2336
|
+
}
|
|
2337
|
+
return Kn(this, e);
|
|
2338
|
+
}
|
|
2339
|
+
}
|
|
2340
|
+
function ne(s) {
|
|
2341
|
+
if (L(s))
|
|
2342
|
+
return !0;
|
|
2343
|
+
throw new Error("Expected a YAML collection as document contents");
|
|
2344
|
+
}
|
|
2345
|
+
class Et extends Error {
|
|
2346
|
+
constructor(e, t, n, i) {
|
|
2347
|
+
super(), this.name = e, this.code = n, this.message = i, this.pos = t;
|
|
2348
|
+
}
|
|
2349
|
+
}
|
|
2350
|
+
class x extends Et {
|
|
2351
|
+
constructor(e, t, n) {
|
|
2352
|
+
super("YAMLParseError", e, t, n);
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
class As extends Et {
|
|
2356
|
+
constructor(e, t, n) {
|
|
2357
|
+
super("YAMLWarning", e, t, n);
|
|
2358
|
+
}
|
|
2359
|
+
}
|
|
2360
|
+
const qe = (s, e) => (t) => {
|
|
2361
|
+
if (t.pos[0] === -1)
|
|
2362
|
+
return;
|
|
2363
|
+
t.linePos = t.pos.map((l) => e.linePos(l));
|
|
2364
|
+
const { line: n, col: i } = t.linePos[0];
|
|
2365
|
+
t.message += ` at line ${n}, column ${i}`;
|
|
2366
|
+
let r = i - 1, o = s.substring(e.lineStarts[n - 1], e.lineStarts[n]).replace(/[\n\r]+$/, "");
|
|
2367
|
+
if (r >= 60 && o.length > 80) {
|
|
2368
|
+
const l = Math.min(r - 39, o.length - 79);
|
|
2369
|
+
o = "…" + o.substring(l), r -= l - 1;
|
|
2370
|
+
}
|
|
2371
|
+
if (o.length > 80 && (o = o.substring(0, 79) + "…"), n > 1 && /^ *$/.test(o.substring(0, r))) {
|
|
2372
|
+
let l = s.substring(e.lineStarts[n - 2], e.lineStarts[n - 1]);
|
|
2373
|
+
l.length > 80 && (l = l.substring(0, 79) + `…
|
|
2374
|
+
`), o = l + o;
|
|
2375
|
+
}
|
|
2376
|
+
if (/[^ ]/.test(o)) {
|
|
2377
|
+
let l = 1;
|
|
2378
|
+
const a = t.linePos[1];
|
|
2379
|
+
a?.line === n && a.col > i && (l = Math.max(1, Math.min(a.col - i, 80 - r)));
|
|
2380
|
+
const c = " ".repeat(r) + "^".repeat(l);
|
|
2381
|
+
t.message += `:
|
|
2382
|
+
|
|
2383
|
+
${o}
|
|
2384
|
+
${c}
|
|
2385
|
+
`;
|
|
2386
|
+
}
|
|
2387
|
+
};
|
|
2388
|
+
function he(s, { flow: e, indicator: t, next: n, offset: i, onError: r, parentIndent: o, startOnNewline: l }) {
|
|
2389
|
+
let a = !1, c = l, d = l, f = "", u = "", m = !1, b = !1, h = null, p = null, y = null, g = null, k = null, S = null, O = null;
|
|
2390
|
+
for (const w of s)
|
|
2391
|
+
switch (b && (w.type !== "space" && w.type !== "newline" && w.type !== "comma" && r(w.offset, "MISSING_CHAR", "Tags and anchors must be separated from the next token by white space"), b = !1), h && (c && w.type !== "comment" && w.type !== "newline" && r(h, "TAB_AS_INDENT", "Tabs are not allowed as indentation"), h = null), w.type) {
|
|
2392
|
+
case "space":
|
|
2393
|
+
!e && (t !== "doc-start" || n?.type !== "flow-collection") && w.source.includes(" ") && (h = w), d = !0;
|
|
2394
|
+
break;
|
|
2395
|
+
case "comment": {
|
|
2396
|
+
d || r(w, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters");
|
|
2397
|
+
const C = w.source.substring(1) || " ";
|
|
2398
|
+
f ? f += u + C : f = C, u = "", c = !1;
|
|
2399
|
+
break;
|
|
2400
|
+
}
|
|
2401
|
+
case "newline":
|
|
2402
|
+
c ? f ? f += w.source : (!S || t !== "seq-item-ind") && (a = !0) : u += w.source, c = !0, m = !0, (p || y) && (g = w), d = !0;
|
|
2403
|
+
break;
|
|
2404
|
+
case "anchor":
|
|
2405
|
+
p && r(w, "MULTIPLE_ANCHORS", "A node can have at most one anchor"), w.source.endsWith(":") && r(w.offset + w.source.length - 1, "BAD_ALIAS", "Anchor ending in : is ambiguous", !0), p = w, O ?? (O = w.offset), c = !1, d = !1, b = !0;
|
|
2406
|
+
break;
|
|
2407
|
+
case "tag": {
|
|
2408
|
+
y && r(w, "MULTIPLE_TAGS", "A node can have at most one tag"), y = w, O ?? (O = w.offset), c = !1, d = !1, b = !0;
|
|
2409
|
+
break;
|
|
2410
|
+
}
|
|
2411
|
+
case t:
|
|
2412
|
+
(p || y) && r(w, "BAD_PROP_ORDER", `Anchors and tags must be after the ${w.source} indicator`), S && r(w, "UNEXPECTED_TOKEN", `Unexpected ${w.source} in ${e ?? "collection"}`), S = w, c = t === "seq-item-ind" || t === "explicit-key-ind", d = !1;
|
|
2413
|
+
break;
|
|
2414
|
+
case "comma":
|
|
2415
|
+
if (e) {
|
|
2416
|
+
k && r(w, "UNEXPECTED_TOKEN", `Unexpected , in ${e}`), k = w, c = !1, d = !1;
|
|
2417
|
+
break;
|
|
2418
|
+
}
|
|
2419
|
+
// else fallthrough
|
|
2420
|
+
default:
|
|
2421
|
+
r(w, "UNEXPECTED_TOKEN", `Unexpected ${w.type} token`), c = !1, d = !1;
|
|
2422
|
+
}
|
|
2423
|
+
const A = s[s.length - 1], E = A ? A.offset + A.source.length : i;
|
|
2424
|
+
return b && n && n.type !== "space" && n.type !== "newline" && n.type !== "comma" && (n.type !== "scalar" || n.source !== "") && r(n.offset, "MISSING_CHAR", "Tags and anchors must be separated from the next token by white space"), h && (c && h.indent <= o || n?.type === "block-map" || n?.type === "block-seq") && r(h, "TAB_AS_INDENT", "Tabs are not allowed as indentation"), {
|
|
2425
|
+
comma: k,
|
|
2426
|
+
found: S,
|
|
2427
|
+
spaceBefore: a,
|
|
2428
|
+
comment: f,
|
|
2429
|
+
hasNewline: m,
|
|
2430
|
+
anchor: p,
|
|
2431
|
+
tag: y,
|
|
2432
|
+
newlineAfterProp: g,
|
|
2433
|
+
end: E,
|
|
2434
|
+
start: O ?? E
|
|
2435
|
+
};
|
|
2436
|
+
}
|
|
2437
|
+
function Oe(s) {
|
|
2438
|
+
if (!s)
|
|
2439
|
+
return null;
|
|
2440
|
+
switch (s.type) {
|
|
2441
|
+
case "alias":
|
|
2442
|
+
case "scalar":
|
|
2443
|
+
case "double-quoted-scalar":
|
|
2444
|
+
case "single-quoted-scalar":
|
|
2445
|
+
if (s.source.includes(`
|
|
2446
|
+
`))
|
|
2447
|
+
return !0;
|
|
2448
|
+
if (s.end) {
|
|
2449
|
+
for (const e of s.end)
|
|
2450
|
+
if (e.type === "newline")
|
|
2451
|
+
return !0;
|
|
2452
|
+
}
|
|
2453
|
+
return !1;
|
|
2454
|
+
case "flow-collection":
|
|
2455
|
+
for (const e of s.items) {
|
|
2456
|
+
for (const t of e.start)
|
|
2457
|
+
if (t.type === "newline")
|
|
2458
|
+
return !0;
|
|
2459
|
+
if (e.sep) {
|
|
2460
|
+
for (const t of e.sep)
|
|
2461
|
+
if (t.type === "newline")
|
|
2462
|
+
return !0;
|
|
2463
|
+
}
|
|
2464
|
+
if (Oe(e.key) || Oe(e.value))
|
|
2465
|
+
return !0;
|
|
2466
|
+
}
|
|
2467
|
+
return !1;
|
|
2468
|
+
default:
|
|
2469
|
+
return !0;
|
|
2470
|
+
}
|
|
2471
|
+
}
|
|
2472
|
+
function dt(s, e, t) {
|
|
2473
|
+
if (e?.type === "flow-collection") {
|
|
2474
|
+
const n = e.end[0];
|
|
2475
|
+
n.indent === s && (n.source === "]" || n.source === "}") && Oe(e) && t(n, "BAD_INDENT", "Flow end indicator should be more indented than parent", !0);
|
|
2476
|
+
}
|
|
2477
|
+
}
|
|
2478
|
+
function Is(s, e, t) {
|
|
2479
|
+
const { uniqueKeys: n } = s.options;
|
|
2480
|
+
if (n === !1)
|
|
2481
|
+
return !1;
|
|
2482
|
+
const i = typeof n == "function" ? n : (r, o) => r === o || I(r) && I(o) && r.value === o.value;
|
|
2483
|
+
return e.some((r) => i(r.key, t));
|
|
2484
|
+
}
|
|
2485
|
+
const Ft = "All mapping items must start at the same column";
|
|
2486
|
+
function jn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
2487
|
+
const o = r?.nodeClass ?? K, l = new o(t.schema);
|
|
2488
|
+
t.atRoot && (t.atRoot = !1);
|
|
2489
|
+
let a = n.offset, c = null;
|
|
2490
|
+
for (const d of n.items) {
|
|
2491
|
+
const { start: f, key: u, sep: m, value: b } = d, h = he(f, {
|
|
2492
|
+
indicator: "explicit-key-ind",
|
|
2493
|
+
next: u ?? m?.[0],
|
|
2494
|
+
offset: a,
|
|
2495
|
+
onError: i,
|
|
2496
|
+
parentIndent: n.indent,
|
|
2497
|
+
startOnNewline: !0
|
|
2498
|
+
}), p = !h.found;
|
|
2499
|
+
if (p) {
|
|
2500
|
+
if (u && (u.type === "block-seq" ? i(a, "BLOCK_AS_IMPLICIT_KEY", "A block sequence may not be used as an implicit map key") : "indent" in u && u.indent !== n.indent && i(a, "BAD_INDENT", Ft)), !h.anchor && !h.tag && !m) {
|
|
2501
|
+
c = h.end, h.comment && (l.comment ? l.comment += `
|
|
2502
|
+
` + h.comment : l.comment = h.comment);
|
|
2503
|
+
continue;
|
|
2504
|
+
}
|
|
2505
|
+
(h.newlineAfterProp || Oe(u)) && i(u ?? f[f.length - 1], "MULTILINE_IMPLICIT_KEY", "Implicit keys need to be on a single line");
|
|
2506
|
+
} else h.found?.indent !== n.indent && i(a, "BAD_INDENT", Ft);
|
|
2507
|
+
t.atKey = !0;
|
|
2508
|
+
const y = h.end, g = u ? s(t, u, h, i) : e(t, y, f, null, h, i);
|
|
2509
|
+
t.schema.compat && dt(n.indent, u, i), t.atKey = !1, Is(t, l.items, g) && i(y, "DUPLICATE_KEY", "Map keys must be unique");
|
|
2510
|
+
const k = he(m ?? [], {
|
|
2511
|
+
indicator: "map-value-ind",
|
|
2512
|
+
next: b,
|
|
2513
|
+
offset: g.range[2],
|
|
2514
|
+
onError: i,
|
|
2515
|
+
parentIndent: n.indent,
|
|
2516
|
+
startOnNewline: !u || u.type === "block-scalar"
|
|
2517
|
+
});
|
|
2518
|
+
if (a = k.end, k.found) {
|
|
2519
|
+
p && (b?.type === "block-map" && !k.hasNewline && i(a, "BLOCK_AS_IMPLICIT_KEY", "Nested mappings are not allowed in compact mappings"), t.options.strict && h.start < k.found.offset - 1024 && i(g.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));
|
|
2520
|
+
const S = b ? s(t, b, k, i) : e(t, a, m, null, k, i);
|
|
2521
|
+
t.schema.compat && dt(n.indent, b, i), a = S.range[2];
|
|
2522
|
+
const O = new v(g, S);
|
|
2523
|
+
t.options.keepSourceTokens && (O.srcToken = d), l.items.push(O);
|
|
2524
|
+
} else {
|
|
2525
|
+
p && i(g.range, "MISSING_CHAR", "Implicit map keys need to be followed by map values"), k.comment && (g.comment ? g.comment += `
|
|
2526
|
+
` + k.comment : g.comment = k.comment);
|
|
2527
|
+
const S = new v(g);
|
|
2528
|
+
t.options.keepSourceTokens && (S.srcToken = d), l.items.push(S);
|
|
2529
|
+
}
|
|
2530
|
+
}
|
|
2531
|
+
return c && c < a && i(c, "IMPOSSIBLE", "Map comment with trailing content"), l.range = [n.offset, a, c ?? a], l;
|
|
2532
|
+
}
|
|
2533
|
+
function Pn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
2534
|
+
const o = r?.nodeClass ?? Q, l = new o(t.schema);
|
|
2535
|
+
t.atRoot && (t.atRoot = !1), t.atKey && (t.atKey = !1);
|
|
2536
|
+
let a = n.offset, c = null;
|
|
2537
|
+
for (const { start: d, value: f } of n.items) {
|
|
2538
|
+
const u = he(d, {
|
|
2539
|
+
indicator: "seq-item-ind",
|
|
2540
|
+
next: f,
|
|
2541
|
+
offset: a,
|
|
2542
|
+
onError: i,
|
|
2543
|
+
parentIndent: n.indent,
|
|
2544
|
+
startOnNewline: !0
|
|
2545
|
+
});
|
|
2546
|
+
if (!u.found)
|
|
2547
|
+
if (u.anchor || u.tag || f)
|
|
2548
|
+
f?.type === "block-seq" ? i(u.end, "BAD_INDENT", "All sequence items must start at the same column") : i(a, "MISSING_CHAR", "Sequence item without - indicator");
|
|
2549
|
+
else {
|
|
2550
|
+
c = u.end, u.comment && (l.comment = u.comment);
|
|
2551
|
+
continue;
|
|
2552
|
+
}
|
|
2553
|
+
const m = f ? s(t, f, u, i) : e(t, u.end, d, null, u, i);
|
|
2554
|
+
t.schema.compat && dt(n.indent, f, i), a = m.range[2], l.items.push(m);
|
|
2555
|
+
}
|
|
2556
|
+
return l.range = [n.offset, a, c ?? a], l;
|
|
2557
|
+
}
|
|
2558
|
+
function Te(s, e, t, n) {
|
|
2559
|
+
let i = "";
|
|
2560
|
+
if (s) {
|
|
2561
|
+
let r = !1, o = "";
|
|
2562
|
+
for (const l of s) {
|
|
2563
|
+
const { source: a, type: c } = l;
|
|
2564
|
+
switch (c) {
|
|
2565
|
+
case "space":
|
|
2566
|
+
r = !0;
|
|
2567
|
+
break;
|
|
2568
|
+
case "comment": {
|
|
2569
|
+
t && !r && n(l, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters");
|
|
2570
|
+
const d = a.substring(1) || " ";
|
|
2571
|
+
i ? i += o + d : i = d, o = "";
|
|
2572
|
+
break;
|
|
2573
|
+
}
|
|
2574
|
+
case "newline":
|
|
2575
|
+
i && (o += a), r = !0;
|
|
2576
|
+
break;
|
|
2577
|
+
default:
|
|
2578
|
+
n(l, "UNEXPECTED_TOKEN", `Unexpected ${c} at node end`);
|
|
2579
|
+
}
|
|
2580
|
+
e += a.length;
|
|
2581
|
+
}
|
|
2582
|
+
}
|
|
2583
|
+
return { comment: i, offset: e };
|
|
2584
|
+
}
|
|
2585
|
+
const it = "Block collections are not allowed within flow collections", rt = (s) => s && (s.type === "block-map" || s.type === "block-seq");
|
|
2586
|
+
function Dn({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
2587
|
+
const o = n.start.source === "{", l = o ? "flow map" : "flow sequence", a = r?.nodeClass ?? (o ? K : Q), c = new a(t.schema);
|
|
2588
|
+
c.flow = !0;
|
|
2589
|
+
const d = t.atRoot;
|
|
2590
|
+
d && (t.atRoot = !1), t.atKey && (t.atKey = !1);
|
|
2591
|
+
let f = n.offset + n.start.source.length;
|
|
2592
|
+
for (let p = 0; p < n.items.length; ++p) {
|
|
2593
|
+
const y = n.items[p], { start: g, key: k, sep: S, value: O } = y, A = he(g, {
|
|
2594
|
+
flow: l,
|
|
2595
|
+
indicator: "explicit-key-ind",
|
|
2596
|
+
next: k ?? S?.[0],
|
|
2597
|
+
offset: f,
|
|
2598
|
+
onError: i,
|
|
2599
|
+
parentIndent: n.indent,
|
|
2600
|
+
startOnNewline: !1
|
|
2601
|
+
});
|
|
2602
|
+
if (!A.found) {
|
|
2603
|
+
if (!A.anchor && !A.tag && !S && !O) {
|
|
2604
|
+
p === 0 && A.comma ? i(A.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${l}`) : p < n.items.length - 1 && i(A.start, "UNEXPECTED_TOKEN", `Unexpected empty item in ${l}`), A.comment && (c.comment ? c.comment += `
|
|
2605
|
+
` + A.comment : c.comment = A.comment), f = A.end;
|
|
2606
|
+
continue;
|
|
2607
|
+
}
|
|
2608
|
+
!o && t.options.strict && Oe(k) && i(
|
|
2609
|
+
k,
|
|
2610
|
+
// checked by containsNewline()
|
|
2611
|
+
"MULTILINE_IMPLICIT_KEY",
|
|
2612
|
+
"Implicit keys of flow sequence pairs need to be on a single line"
|
|
2613
|
+
);
|
|
2614
|
+
}
|
|
2615
|
+
if (p === 0)
|
|
2616
|
+
A.comma && i(A.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${l}`);
|
|
2617
|
+
else if (A.comma || i(A.start, "MISSING_CHAR", `Missing , between ${l} items`), A.comment) {
|
|
2618
|
+
let E = "";
|
|
2619
|
+
e: for (const w of g)
|
|
2620
|
+
switch (w.type) {
|
|
2621
|
+
case "comma":
|
|
2622
|
+
case "space":
|
|
2623
|
+
break;
|
|
2624
|
+
case "comment":
|
|
2625
|
+
E = w.source.substring(1);
|
|
2626
|
+
break e;
|
|
2627
|
+
default:
|
|
2628
|
+
break e;
|
|
2629
|
+
}
|
|
2630
|
+
if (E) {
|
|
2631
|
+
let w = c.items[c.items.length - 1];
|
|
2632
|
+
T(w) && (w = w.value ?? w.key), w.comment ? w.comment += `
|
|
2633
|
+
` + E : w.comment = E, A.comment = A.comment.substring(E.length + 1);
|
|
2634
|
+
}
|
|
2635
|
+
}
|
|
2636
|
+
if (!o && !S && !A.found) {
|
|
2637
|
+
const E = O ? s(t, O, A, i) : e(t, A.end, S, null, A, i);
|
|
2638
|
+
c.items.push(E), f = E.range[2], rt(O) && i(E.range, "BLOCK_IN_FLOW", it);
|
|
2639
|
+
} else {
|
|
2640
|
+
t.atKey = !0;
|
|
2641
|
+
const E = A.end, w = k ? s(t, k, A, i) : e(t, E, g, null, A, i);
|
|
2642
|
+
rt(k) && i(w.range, "BLOCK_IN_FLOW", it), t.atKey = !1;
|
|
2643
|
+
const C = he(S ?? [], {
|
|
2644
|
+
flow: l,
|
|
2645
|
+
indicator: "map-value-ind",
|
|
2646
|
+
next: O,
|
|
2647
|
+
offset: w.range[2],
|
|
2648
|
+
onError: i,
|
|
2649
|
+
parentIndent: n.indent,
|
|
2650
|
+
startOnNewline: !1
|
|
2651
|
+
});
|
|
2652
|
+
if (C.found) {
|
|
2653
|
+
if (!o && !A.found && t.options.strict) {
|
|
2654
|
+
if (S)
|
|
2655
|
+
for (const _ of S) {
|
|
2656
|
+
if (_ === C.found)
|
|
2657
|
+
break;
|
|
2658
|
+
if (_.type === "newline") {
|
|
2659
|
+
i(_, "MULTILINE_IMPLICIT_KEY", "Implicit keys of flow sequence pairs need to be on a single line");
|
|
2660
|
+
break;
|
|
2661
|
+
}
|
|
2662
|
+
}
|
|
2663
|
+
A.start < C.found.offset - 1024 && i(C.found, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit flow sequence key");
|
|
2664
|
+
}
|
|
2665
|
+
} else O && ("source" in O && O.source?.[0] === ":" ? i(O, "MISSING_CHAR", `Missing space after : in ${l}`) : i(C.start, "MISSING_CHAR", `Missing , or : between ${l} items`));
|
|
2666
|
+
const J = O ? s(t, O, C, i) : C.found ? e(t, C.end, S, null, C, i) : null;
|
|
2667
|
+
J ? rt(O) && i(J.range, "BLOCK_IN_FLOW", it) : C.comment && (w.comment ? w.comment += `
|
|
2668
|
+
` + C.comment : w.comment = C.comment);
|
|
2669
|
+
const se = new v(w, J);
|
|
2670
|
+
if (t.options.keepSourceTokens && (se.srcToken = y), o) {
|
|
2671
|
+
const _ = c;
|
|
2672
|
+
Is(t, _.items, w) && i(E, "DUPLICATE_KEY", "Map keys must be unique"), _.items.push(se);
|
|
2673
|
+
} else {
|
|
2674
|
+
const _ = new K(t.schema);
|
|
2675
|
+
_.flow = !0, _.items.push(se);
|
|
2676
|
+
const Ct = (J ?? w).range;
|
|
2677
|
+
_.range = [w.range[0], Ct[1], Ct[2]], c.items.push(_);
|
|
2678
|
+
}
|
|
2679
|
+
f = J ? J.range[2] : C.end;
|
|
2680
|
+
}
|
|
2681
|
+
}
|
|
2682
|
+
const u = o ? "}" : "]", [m, ...b] = n.end;
|
|
2683
|
+
let h = f;
|
|
2684
|
+
if (m?.source === u)
|
|
2685
|
+
h = m.offset + m.source.length;
|
|
2686
|
+
else {
|
|
2687
|
+
const p = l[0].toUpperCase() + l.substring(1), y = d ? `${p} must end with a ${u}` : `${p} in block collection must be sufficiently indented and end with a ${u}`;
|
|
2688
|
+
i(f, d ? "MISSING_CHAR" : "BAD_INDENT", y), m && m.source.length !== 1 && b.unshift(m);
|
|
2689
|
+
}
|
|
2690
|
+
if (b.length > 0) {
|
|
2691
|
+
const p = Te(b, h, t.options.strict, i);
|
|
2692
|
+
p.comment && (c.comment ? c.comment += `
|
|
2693
|
+
` + p.comment : c.comment = p.comment), c.range = [n.offset, h, p.offset];
|
|
2694
|
+
} else
|
|
2695
|
+
c.range = [n.offset, h, h];
|
|
2696
|
+
return c;
|
|
2697
|
+
}
|
|
2698
|
+
function ot(s, e, t, n, i, r) {
|
|
2699
|
+
const o = t.type === "block-map" ? jn(s, e, t, n, r) : t.type === "block-seq" ? Pn(s, e, t, n, r) : Dn(s, e, t, n, r), l = o.constructor;
|
|
2700
|
+
return i === "!" || i === l.tagName ? (o.tag = l.tagName, o) : (i && (o.tag = i), o);
|
|
2701
|
+
}
|
|
2702
|
+
function qn(s, e, t, n, i) {
|
|
2703
|
+
const r = n.tag, o = r ? e.directives.tagName(r.source, (u) => i(r, "TAG_RESOLVE_FAILED", u)) : null;
|
|
2704
|
+
if (t.type === "block-seq") {
|
|
2705
|
+
const { anchor: u, newlineAfterProp: m } = n, b = u && r ? u.offset > r.offset ? u : r : u ?? r;
|
|
2706
|
+
b && (!m || m.offset < b.offset) && i(b, "MISSING_CHAR", "Missing newline after block sequence props");
|
|
2707
|
+
}
|
|
2708
|
+
const l = t.type === "block-map" ? "map" : t.type === "block-seq" ? "seq" : t.start.source === "{" ? "map" : "seq";
|
|
2709
|
+
if (!r || !o || o === "!" || o === K.tagName && l === "map" || o === Q.tagName && l === "seq")
|
|
2710
|
+
return ot(s, e, t, i, o);
|
|
2711
|
+
let a = e.schema.tags.find((u) => u.tag === o && u.collection === l);
|
|
2712
|
+
if (!a) {
|
|
2713
|
+
const u = e.schema.knownTags[o];
|
|
2714
|
+
if (u?.collection === l)
|
|
2715
|
+
e.schema.tags.push(Object.assign({}, u, { default: !1 })), a = u;
|
|
2716
|
+
else
|
|
2717
|
+
return u ? i(r, "BAD_COLLECTION_TYPE", `${u.tag} used for ${l} collection, but expects ${u.collection ?? "scalar"}`, !0) : i(r, "TAG_RESOLVE_FAILED", `Unresolved tag: ${o}`, !0), ot(s, e, t, i, o);
|
|
2718
|
+
}
|
|
2719
|
+
const c = ot(s, e, t, i, o, a), d = a.resolve?.(c, (u) => i(r, "TAG_RESOLVE_FAILED", u), e.options) ?? c, f = $(d) ? d : new N(d);
|
|
2720
|
+
return f.range = c.range, f.tag = o, a?.format && (f.format = a.format), f;
|
|
2721
|
+
}
|
|
2722
|
+
function Es(s, e, t) {
|
|
2723
|
+
const n = e.offset, i = Fn(e, s.options.strict, t);
|
|
2724
|
+
if (!i)
|
|
2725
|
+
return { value: "", type: null, comment: "", range: [n, n, n] };
|
|
2726
|
+
const r = i.mode === ">" ? N.BLOCK_FOLDED : N.BLOCK_LITERAL, o = e.source ? Rn(e.source) : [];
|
|
2727
|
+
let l = o.length;
|
|
2728
|
+
for (let h = o.length - 1; h >= 0; --h) {
|
|
2729
|
+
const p = o[h][1];
|
|
2730
|
+
if (p === "" || p === "\r")
|
|
2731
|
+
l = h;
|
|
2732
|
+
else
|
|
2733
|
+
break;
|
|
2734
|
+
}
|
|
2735
|
+
if (l === 0) {
|
|
2736
|
+
const h = i.chomp === "+" && o.length > 0 ? `
|
|
2737
|
+
`.repeat(Math.max(1, o.length - 1)) : "";
|
|
2738
|
+
let p = n + i.length;
|
|
2739
|
+
return e.source && (p += e.source.length), { value: h, type: r, comment: i.comment, range: [n, p, p] };
|
|
2740
|
+
}
|
|
2741
|
+
let a = e.indent + i.indent, c = e.offset + i.length, d = 0;
|
|
2742
|
+
for (let h = 0; h < l; ++h) {
|
|
2743
|
+
const [p, y] = o[h];
|
|
2744
|
+
if (y === "" || y === "\r")
|
|
2745
|
+
i.indent === 0 && p.length > a && (a = p.length);
|
|
2746
|
+
else {
|
|
2747
|
+
p.length < a && t(c + p.length, "MISSING_CHAR", "Block scalars with more-indented leading empty lines must use an explicit indentation indicator"), i.indent === 0 && (a = p.length), d = h, a === 0 && !s.atRoot && t(c, "BAD_INDENT", "Block scalar values in collections must be indented");
|
|
2748
|
+
break;
|
|
2749
|
+
}
|
|
2750
|
+
c += p.length + y.length + 1;
|
|
2751
|
+
}
|
|
2752
|
+
for (let h = o.length - 1; h >= l; --h)
|
|
2753
|
+
o[h][0].length > a && (l = h + 1);
|
|
2754
|
+
let f = "", u = "", m = !1;
|
|
2755
|
+
for (let h = 0; h < d; ++h)
|
|
2756
|
+
f += o[h][0].slice(a) + `
|
|
2757
|
+
`;
|
|
2758
|
+
for (let h = d; h < l; ++h) {
|
|
2759
|
+
let [p, y] = o[h];
|
|
2760
|
+
c += p.length + y.length + 1;
|
|
2761
|
+
const g = y[y.length - 1] === "\r";
|
|
2762
|
+
if (g && (y = y.slice(0, -1)), y && p.length < a) {
|
|
2763
|
+
const S = `Block scalar lines must not be less indented than their ${i.indent ? "explicit indentation indicator" : "first line"}`;
|
|
2764
|
+
t(c - y.length - (g ? 2 : 1), "BAD_INDENT", S), p = "";
|
|
2765
|
+
}
|
|
2766
|
+
r === N.BLOCK_LITERAL ? (f += u + p.slice(a) + y, u = `
|
|
2767
|
+
`) : p.length > a || y[0] === " " ? (u === " " ? u = `
|
|
2768
|
+
` : !m && u === `
|
|
2769
|
+
` && (u = `
|
|
2770
|
+
|
|
2771
|
+
`), f += u + p.slice(a) + y, u = `
|
|
2772
|
+
`, m = !0) : y === "" ? u === `
|
|
2773
|
+
` ? f += `
|
|
2774
|
+
` : u = `
|
|
2775
|
+
` : (f += u + y, u = " ", m = !1);
|
|
2776
|
+
}
|
|
2777
|
+
switch (i.chomp) {
|
|
2778
|
+
case "-":
|
|
2779
|
+
break;
|
|
2780
|
+
case "+":
|
|
2781
|
+
for (let h = l; h < o.length; ++h)
|
|
2782
|
+
f += `
|
|
2783
|
+
` + o[h][0].slice(a);
|
|
2784
|
+
f[f.length - 1] !== `
|
|
2785
|
+
` && (f += `
|
|
2786
|
+
`);
|
|
2787
|
+
break;
|
|
2788
|
+
default:
|
|
2789
|
+
f += `
|
|
2790
|
+
`;
|
|
2791
|
+
}
|
|
2792
|
+
const b = n + i.length + e.source.length;
|
|
2793
|
+
return { value: f, type: r, comment: i.comment, range: [n, b, b] };
|
|
2794
|
+
}
|
|
2795
|
+
function Fn({ offset: s, props: e }, t, n) {
|
|
2796
|
+
if (e[0].type !== "block-scalar-header")
|
|
2797
|
+
return n(e[0], "IMPOSSIBLE", "Block scalar header not found"), null;
|
|
2798
|
+
const { source: i } = e[0], r = i[0];
|
|
2799
|
+
let o = 0, l = "", a = -1;
|
|
2800
|
+
for (let u = 1; u < i.length; ++u) {
|
|
2801
|
+
const m = i[u];
|
|
2802
|
+
if (!l && (m === "-" || m === "+"))
|
|
2803
|
+
l = m;
|
|
2804
|
+
else {
|
|
2805
|
+
const b = Number(m);
|
|
2806
|
+
!o && b ? o = b : a === -1 && (a = s + u);
|
|
2807
|
+
}
|
|
2808
|
+
}
|
|
2809
|
+
a !== -1 && n(a, "UNEXPECTED_TOKEN", `Block scalar header includes extra characters: ${i}`);
|
|
2810
|
+
let c = !1, d = "", f = i.length;
|
|
2811
|
+
for (let u = 1; u < e.length; ++u) {
|
|
2812
|
+
const m = e[u];
|
|
2813
|
+
switch (m.type) {
|
|
2814
|
+
case "space":
|
|
2815
|
+
c = !0;
|
|
2816
|
+
// fallthrough
|
|
2817
|
+
case "newline":
|
|
2818
|
+
f += m.source.length;
|
|
2819
|
+
break;
|
|
2820
|
+
case "comment":
|
|
2821
|
+
t && !c && n(m, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters"), f += m.source.length, d = m.source.substring(1);
|
|
2822
|
+
break;
|
|
2823
|
+
case "error":
|
|
2824
|
+
n(m, "UNEXPECTED_TOKEN", m.message), f += m.source.length;
|
|
2825
|
+
break;
|
|
2826
|
+
/* istanbul ignore next should not happen */
|
|
2827
|
+
default: {
|
|
2828
|
+
const b = `Unexpected token in block scalar header: ${m.type}`;
|
|
2829
|
+
n(m, "UNEXPECTED_TOKEN", b);
|
|
2830
|
+
const h = m.source;
|
|
2831
|
+
h && typeof h == "string" && (f += h.length);
|
|
2832
|
+
}
|
|
2833
|
+
}
|
|
2834
|
+
}
|
|
2835
|
+
return { mode: r, indent: o, chomp: l, comment: d, length: f };
|
|
2836
|
+
}
|
|
2837
|
+
function Rn(s) {
|
|
2838
|
+
const e = s.split(/\n( *)/), t = e[0], n = t.match(/^( *)/), r = [n?.[1] ? [n[1], t.slice(n[1].length)] : ["", t]];
|
|
2839
|
+
for (let o = 1; o < e.length; o += 2)
|
|
2840
|
+
r.push([e[o], e[o + 1]]);
|
|
2841
|
+
return r;
|
|
2842
|
+
}
|
|
2843
|
+
function Ts(s, e, t) {
|
|
2844
|
+
const { offset: n, type: i, source: r, end: o } = s;
|
|
2845
|
+
let l, a;
|
|
2846
|
+
const c = (u, m, b) => t(n + u, m, b);
|
|
2847
|
+
switch (i) {
|
|
2848
|
+
case "scalar":
|
|
2849
|
+
l = N.PLAIN, a = Un(r, c);
|
|
2850
|
+
break;
|
|
2851
|
+
case "single-quoted-scalar":
|
|
2852
|
+
l = N.QUOTE_SINGLE, a = Vn(r, c);
|
|
2853
|
+
break;
|
|
2854
|
+
case "double-quoted-scalar":
|
|
2855
|
+
l = N.QUOTE_DOUBLE, a = Yn(r, c);
|
|
2856
|
+
break;
|
|
2857
|
+
/* istanbul ignore next should not happen */
|
|
2858
|
+
default:
|
|
2859
|
+
return t(s, "UNEXPECTED_TOKEN", `Expected a flow scalar value, but found: ${i}`), {
|
|
2860
|
+
value: "",
|
|
2861
|
+
type: null,
|
|
2862
|
+
comment: "",
|
|
2863
|
+
range: [n, n + r.length, n + r.length]
|
|
2864
|
+
};
|
|
2865
|
+
}
|
|
2866
|
+
const d = n + r.length, f = Te(o, d, e, t);
|
|
2867
|
+
return {
|
|
2868
|
+
value: a,
|
|
2869
|
+
type: l,
|
|
2870
|
+
comment: f.comment,
|
|
2871
|
+
range: [n, d, f.offset]
|
|
2872
|
+
};
|
|
2873
|
+
}
|
|
2874
|
+
function Un(s, e) {
|
|
2875
|
+
let t = "";
|
|
2876
|
+
switch (s[0]) {
|
|
2877
|
+
/* istanbul ignore next should not happen */
|
|
2878
|
+
case " ":
|
|
2879
|
+
t = "a tab character";
|
|
2880
|
+
break;
|
|
2881
|
+
case ",":
|
|
2882
|
+
t = "flow indicator character ,";
|
|
2883
|
+
break;
|
|
2884
|
+
case "%":
|
|
2885
|
+
t = "directive indicator character %";
|
|
2886
|
+
break;
|
|
2887
|
+
case "|":
|
|
2888
|
+
case ">": {
|
|
2889
|
+
t = `block scalar indicator ${s[0]}`;
|
|
2890
|
+
break;
|
|
2891
|
+
}
|
|
2892
|
+
case "@":
|
|
2893
|
+
case "`": {
|
|
2894
|
+
t = `reserved character ${s[0]}`;
|
|
2895
|
+
break;
|
|
2896
|
+
}
|
|
2897
|
+
}
|
|
2898
|
+
return t && e(0, "BAD_SCALAR_START", `Plain value cannot start with ${t}`), Ls(s);
|
|
2899
|
+
}
|
|
2900
|
+
function Vn(s, e) {
|
|
2901
|
+
return (s[s.length - 1] !== "'" || s.length === 1) && e(s.length, "MISSING_CHAR", "Missing closing 'quote"), Ls(s.slice(1, -1)).replace(/''/g, "'");
|
|
2902
|
+
}
|
|
2903
|
+
function Ls(s) {
|
|
2904
|
+
let e, t;
|
|
2905
|
+
try {
|
|
2906
|
+
e = new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
2907
|
+
`, "sy"), t = new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
2908
|
+
`, "sy");
|
|
2909
|
+
} catch {
|
|
2910
|
+
e = /(.*?)[ \t]*\r?\n/sy, t = /[ \t]*(.*?)[ \t]*\r?\n/sy;
|
|
2911
|
+
}
|
|
2912
|
+
let n = e.exec(s);
|
|
2913
|
+
if (!n)
|
|
2914
|
+
return s;
|
|
2915
|
+
let i = n[1], r = " ", o = e.lastIndex;
|
|
2916
|
+
for (t.lastIndex = o; n = t.exec(s); )
|
|
2917
|
+
n[1] === "" ? r === `
|
|
2918
|
+
` ? i += r : r = `
|
|
2919
|
+
` : (i += r + n[1], r = " "), o = t.lastIndex;
|
|
2920
|
+
const l = /[ \t]*(.*)/sy;
|
|
2921
|
+
return l.lastIndex = o, n = l.exec(s), i + r + (n?.[1] ?? "");
|
|
2922
|
+
}
|
|
2923
|
+
function Yn(s, e) {
|
|
2924
|
+
let t = "";
|
|
2925
|
+
for (let n = 1; n < s.length - 1; ++n) {
|
|
2926
|
+
const i = s[n];
|
|
2927
|
+
if (!(i === "\r" && s[n + 1] === `
|
|
2928
|
+
`))
|
|
2929
|
+
if (i === `
|
|
2930
|
+
`) {
|
|
2931
|
+
const { fold: r, offset: o } = Jn(s, n);
|
|
2932
|
+
t += r, n = o;
|
|
2933
|
+
} else if (i === "\\") {
|
|
2934
|
+
let r = s[++n];
|
|
2935
|
+
const o = Gn[r];
|
|
2936
|
+
if (o)
|
|
2937
|
+
t += o;
|
|
2938
|
+
else if (r === `
|
|
2939
|
+
`)
|
|
2940
|
+
for (r = s[n + 1]; r === " " || r === " "; )
|
|
2941
|
+
r = s[++n + 1];
|
|
2942
|
+
else if (r === "\r" && s[n + 1] === `
|
|
2943
|
+
`)
|
|
2944
|
+
for (r = s[++n + 1]; r === " " || r === " "; )
|
|
2945
|
+
r = s[++n + 1];
|
|
2946
|
+
else if (r === "x" || r === "u" || r === "U") {
|
|
2947
|
+
const l = { x: 2, u: 4, U: 8 }[r];
|
|
2948
|
+
t += Wn(s, n + 1, l, e), n += l;
|
|
2949
|
+
} else {
|
|
2950
|
+
const l = s.substr(n - 1, 2);
|
|
2951
|
+
e(n - 1, "BAD_DQ_ESCAPE", `Invalid escape sequence ${l}`), t += l;
|
|
2952
|
+
}
|
|
2953
|
+
} else if (i === " " || i === " ") {
|
|
2954
|
+
const r = n;
|
|
2955
|
+
let o = s[n + 1];
|
|
2956
|
+
for (; o === " " || o === " "; )
|
|
2957
|
+
o = s[++n + 1];
|
|
2958
|
+
o !== `
|
|
2959
|
+
` && !(o === "\r" && s[n + 2] === `
|
|
2960
|
+
`) && (t += n > r ? s.slice(r, n + 1) : i);
|
|
2961
|
+
} else
|
|
2962
|
+
t += i;
|
|
2963
|
+
}
|
|
2964
|
+
return (s[s.length - 1] !== '"' || s.length === 1) && e(s.length, "MISSING_CHAR", 'Missing closing "quote'), t;
|
|
2965
|
+
}
|
|
2966
|
+
function Jn(s, e) {
|
|
2967
|
+
let t = "", n = s[e + 1];
|
|
2968
|
+
for (; (n === " " || n === " " || n === `
|
|
2969
|
+
` || n === "\r") && !(n === "\r" && s[e + 2] !== `
|
|
2970
|
+
`); )
|
|
2971
|
+
n === `
|
|
2972
|
+
` && (t += `
|
|
2973
|
+
`), e += 1, n = s[e + 1];
|
|
2974
|
+
return t || (t = " "), { fold: t, offset: e };
|
|
2975
|
+
}
|
|
2976
|
+
const Gn = {
|
|
2977
|
+
0: "\0",
|
|
2978
|
+
// null character
|
|
2979
|
+
a: "\x07",
|
|
2980
|
+
// bell character
|
|
2981
|
+
b: "\b",
|
|
2982
|
+
// backspace
|
|
2983
|
+
e: "\x1B",
|
|
2984
|
+
// escape character
|
|
2985
|
+
f: "\f",
|
|
2986
|
+
// form feed
|
|
2987
|
+
n: `
|
|
2988
|
+
`,
|
|
2989
|
+
// line feed
|
|
2990
|
+
r: "\r",
|
|
2991
|
+
// carriage return
|
|
2992
|
+
t: " ",
|
|
2993
|
+
// horizontal tab
|
|
2994
|
+
v: "\v",
|
|
2995
|
+
// vertical tab
|
|
2996
|
+
N: "
",
|
|
2997
|
+
// Unicode next line
|
|
2998
|
+
_: " ",
|
|
2999
|
+
// Unicode non-breaking space
|
|
3000
|
+
L: "\u2028",
|
|
3001
|
+
// Unicode line separator
|
|
3002
|
+
P: "\u2029",
|
|
3003
|
+
// Unicode paragraph separator
|
|
3004
|
+
" ": " ",
|
|
3005
|
+
'"': '"',
|
|
3006
|
+
"/": "/",
|
|
3007
|
+
"\\": "\\",
|
|
3008
|
+
" ": " "
|
|
3009
|
+
};
|
|
3010
|
+
function Wn(s, e, t, n) {
|
|
3011
|
+
const i = s.substr(e, t), o = i.length === t && /^[0-9a-fA-F]+$/.test(i) ? parseInt(i, 16) : NaN;
|
|
3012
|
+
if (isNaN(o)) {
|
|
3013
|
+
const l = s.substr(e - 2, t + 2);
|
|
3014
|
+
return n(e - 2, "BAD_DQ_ESCAPE", `Invalid escape sequence ${l}`), l;
|
|
3015
|
+
}
|
|
3016
|
+
return String.fromCodePoint(o);
|
|
3017
|
+
}
|
|
3018
|
+
function $s(s, e, t, n) {
|
|
3019
|
+
const { value: i, type: r, comment: o, range: l } = e.type === "block-scalar" ? Es(s, e, n) : Ts(e, s.options.strict, n), a = t ? s.directives.tagName(t.source, (f) => n(t, "TAG_RESOLVE_FAILED", f)) : null;
|
|
3020
|
+
let c;
|
|
3021
|
+
s.options.stringKeys && s.atKey ? c = s.schema[U] : a ? c = Qn(s.schema, i, a, t, n) : e.type === "scalar" ? c = Hn(s, i, e, n) : c = s.schema[U];
|
|
3022
|
+
let d;
|
|
3023
|
+
try {
|
|
3024
|
+
const f = c.resolve(i, (u) => n(t ?? e, "TAG_RESOLVE_FAILED", u), s.options);
|
|
3025
|
+
d = I(f) ? f : new N(f);
|
|
3026
|
+
} catch (f) {
|
|
3027
|
+
const u = f instanceof Error ? f.message : String(f);
|
|
3028
|
+
n(t ?? e, "TAG_RESOLVE_FAILED", u), d = new N(i);
|
|
3029
|
+
}
|
|
3030
|
+
return d.range = l, d.source = i, r && (d.type = r), a && (d.tag = a), c.format && (d.format = c.format), o && (d.comment = o), d;
|
|
3031
|
+
}
|
|
3032
|
+
function Qn(s, e, t, n, i) {
|
|
3033
|
+
if (t === "!")
|
|
3034
|
+
return s[U];
|
|
3035
|
+
const r = [];
|
|
3036
|
+
for (const l of s.tags)
|
|
3037
|
+
if (!l.collection && l.tag === t)
|
|
3038
|
+
if (l.default && l.test)
|
|
3039
|
+
r.push(l);
|
|
3040
|
+
else
|
|
3041
|
+
return l;
|
|
3042
|
+
for (const l of r)
|
|
3043
|
+
if (l.test?.test(e))
|
|
3044
|
+
return l;
|
|
3045
|
+
const o = s.knownTags[t];
|
|
3046
|
+
return o && !o.collection ? (s.tags.push(Object.assign({}, o, { default: !1, test: void 0 })), o) : (i(n, "TAG_RESOLVE_FAILED", `Unresolved tag: ${t}`, t !== "tag:yaml.org,2002:str"), s[U]);
|
|
3047
|
+
}
|
|
3048
|
+
function Hn({ atKey: s, directives: e, schema: t }, n, i, r) {
|
|
3049
|
+
const o = t.tags.find((l) => (l.default === !0 || s && l.default === "key") && l.test?.test(n)) || t[U];
|
|
3050
|
+
if (t.compat) {
|
|
3051
|
+
const l = t.compat.find((a) => a.default && a.test?.test(n)) ?? t[U];
|
|
3052
|
+
if (o.tag !== l.tag) {
|
|
3053
|
+
const a = e.tagString(o.tag), c = e.tagString(l.tag), d = `Value may be parsed as either ${a} or ${c}`;
|
|
3054
|
+
r(i, "TAG_RESOLVE_FAILED", d, !0);
|
|
3055
|
+
}
|
|
3056
|
+
}
|
|
3057
|
+
return o;
|
|
3058
|
+
}
|
|
3059
|
+
function Xn(s, e, t) {
|
|
3060
|
+
if (e) {
|
|
3061
|
+
t ?? (t = e.length);
|
|
3062
|
+
for (let n = t - 1; n >= 0; --n) {
|
|
3063
|
+
let i = e[n];
|
|
3064
|
+
switch (i.type) {
|
|
3065
|
+
case "space":
|
|
3066
|
+
case "comment":
|
|
3067
|
+
case "newline":
|
|
3068
|
+
s -= i.source.length;
|
|
3069
|
+
continue;
|
|
3070
|
+
}
|
|
3071
|
+
for (i = e[++n]; i?.type === "space"; )
|
|
3072
|
+
s += i.source.length, i = e[++n];
|
|
3073
|
+
break;
|
|
3074
|
+
}
|
|
3075
|
+
}
|
|
3076
|
+
return s;
|
|
3077
|
+
}
|
|
3078
|
+
const zn = { composeNode: Cs, composeEmptyNode: Tt };
|
|
3079
|
+
function Cs(s, e, t, n) {
|
|
3080
|
+
const i = s.atKey, { spaceBefore: r, comment: o, anchor: l, tag: a } = t;
|
|
3081
|
+
let c, d = !0;
|
|
3082
|
+
switch (e.type) {
|
|
3083
|
+
case "alias":
|
|
3084
|
+
c = xn(s, e, n), (l || a) && n(e, "ALIAS_PROPS", "An alias node must not specify any properties");
|
|
3085
|
+
break;
|
|
3086
|
+
case "scalar":
|
|
3087
|
+
case "single-quoted-scalar":
|
|
3088
|
+
case "double-quoted-scalar":
|
|
3089
|
+
case "block-scalar":
|
|
3090
|
+
c = $s(s, e, a, n), l && (c.anchor = l.source.substring(1));
|
|
3091
|
+
break;
|
|
3092
|
+
case "block-map":
|
|
3093
|
+
case "block-seq":
|
|
3094
|
+
case "flow-collection":
|
|
3095
|
+
c = qn(zn, s, e, t, n), l && (c.anchor = l.source.substring(1));
|
|
3096
|
+
break;
|
|
3097
|
+
default: {
|
|
3098
|
+
const f = e.type === "error" ? e.message : `Unsupported token (type: ${e.type})`;
|
|
3099
|
+
n(e, "UNEXPECTED_TOKEN", f), c = Tt(s, e.offset, void 0, null, t, n), d = !1;
|
|
3100
|
+
}
|
|
3101
|
+
}
|
|
3102
|
+
return l && c.anchor === "" && n(l, "BAD_ALIAS", "Anchor cannot be an empty string"), i && s.options.stringKeys && (!I(c) || typeof c.value != "string" || c.tag && c.tag !== "tag:yaml.org,2002:str") && n(a ?? e, "NON_STRING_KEY", "With stringKeys, all keys must be strings"), r && (c.spaceBefore = !0), o && (e.type === "scalar" && e.source === "" ? c.comment = o : c.commentBefore = o), s.options.keepSourceTokens && d && (c.srcToken = e), c;
|
|
3103
|
+
}
|
|
3104
|
+
function Tt(s, e, t, n, { spaceBefore: i, comment: r, anchor: o, tag: l, end: a }, c) {
|
|
3105
|
+
const d = {
|
|
3106
|
+
type: "scalar",
|
|
3107
|
+
offset: Xn(e, t, n),
|
|
3108
|
+
indent: -1,
|
|
3109
|
+
source: ""
|
|
3110
|
+
}, f = $s(s, d, l, c);
|
|
3111
|
+
return o && (f.anchor = o.source.substring(1), f.anchor === "" && c(o, "BAD_ALIAS", "Anchor cannot be an empty string")), i && (f.spaceBefore = !0), r && (f.comment = r, f.range[2] = a), f;
|
|
3112
|
+
}
|
|
3113
|
+
function xn({ options: s }, { offset: e, source: t, end: n }, i) {
|
|
3114
|
+
const r = new Ue(t.substring(1));
|
|
3115
|
+
r.source === "" && i(e, "BAD_ALIAS", "Alias cannot be an empty string"), r.source.endsWith(":") && i(e + t.length - 1, "BAD_ALIAS", "Alias ending in : is ambiguous", !0);
|
|
3116
|
+
const o = e + t.length, l = Te(n, o, s.strict, i);
|
|
3117
|
+
return r.range = [e, o, l.offset], l.comment && (r.comment = l.comment), r;
|
|
3118
|
+
}
|
|
3119
|
+
function Zn(s, e, { offset: t, start: n, value: i, end: r }, o) {
|
|
3120
|
+
const l = Object.assign({ _directives: e }, s), a = new be(void 0, l), c = {
|
|
3121
|
+
atKey: !1,
|
|
3122
|
+
atRoot: !0,
|
|
3123
|
+
directives: a.directives,
|
|
3124
|
+
options: a.options,
|
|
3125
|
+
schema: a.schema
|
|
3126
|
+
}, d = he(n, {
|
|
3127
|
+
indicator: "doc-start",
|
|
3128
|
+
next: i ?? r?.[0],
|
|
3129
|
+
offset: t,
|
|
3130
|
+
onError: o,
|
|
3131
|
+
parentIndent: 0,
|
|
3132
|
+
startOnNewline: !0
|
|
3133
|
+
});
|
|
3134
|
+
d.found && (a.directives.docStart = !0, i && (i.type === "block-map" || i.type === "block-seq") && !d.hasNewline && o(d.end, "MISSING_CHAR", "Block collection cannot start on same line with directives-end marker")), a.contents = i ? Cs(c, i, d, o) : Tt(c, d.end, n, null, d, o);
|
|
3135
|
+
const f = a.contents.range[2], u = Te(r, f, !1, o);
|
|
3136
|
+
return u.comment && (a.comment = u.comment), a.range = [t, f, u.offset], a;
|
|
3137
|
+
}
|
|
3138
|
+
function we(s) {
|
|
3139
|
+
if (typeof s == "number")
|
|
3140
|
+
return [s, s + 1];
|
|
3141
|
+
if (Array.isArray(s))
|
|
3142
|
+
return s.length === 2 ? s : [s[0], s[1]];
|
|
3143
|
+
const { offset: e, source: t } = s;
|
|
3144
|
+
return [e, e + (typeof t == "string" ? t.length : 1)];
|
|
3145
|
+
}
|
|
3146
|
+
function Rt(s) {
|
|
3147
|
+
let e = "", t = !1, n = !1;
|
|
3148
|
+
for (let i = 0; i < s.length; ++i) {
|
|
3149
|
+
const r = s[i];
|
|
3150
|
+
switch (r[0]) {
|
|
3151
|
+
case "#":
|
|
3152
|
+
e += (e === "" ? "" : n ? `
|
|
3153
|
+
|
|
3154
|
+
` : `
|
|
3155
|
+
`) + (r.substring(1) || " "), t = !0, n = !1;
|
|
3156
|
+
break;
|
|
3157
|
+
case "%":
|
|
3158
|
+
s[i + 1]?.[0] !== "#" && (i += 1), t = !1;
|
|
3159
|
+
break;
|
|
3160
|
+
default:
|
|
3161
|
+
t || (n = !0), t = !1;
|
|
3162
|
+
}
|
|
3163
|
+
}
|
|
3164
|
+
return { comment: e, afterEmptyLine: n };
|
|
3165
|
+
}
|
|
3166
|
+
class Lt {
|
|
3167
|
+
constructor(e = {}) {
|
|
3168
|
+
this.doc = null, this.atDirectives = !1, this.prelude = [], this.errors = [], this.warnings = [], this.onError = (t, n, i, r) => {
|
|
3169
|
+
const o = we(t);
|
|
3170
|
+
r ? this.warnings.push(new As(o, n, i)) : this.errors.push(new x(o, n, i));
|
|
3171
|
+
}, this.directives = new M({ version: e.version || "1.2" }), this.options = e;
|
|
3172
|
+
}
|
|
3173
|
+
decorate(e, t) {
|
|
3174
|
+
const { comment: n, afterEmptyLine: i } = Rt(this.prelude);
|
|
3175
|
+
if (n) {
|
|
3176
|
+
const r = e.contents;
|
|
3177
|
+
if (t)
|
|
3178
|
+
e.comment = e.comment ? `${e.comment}
|
|
3179
|
+
${n}` : n;
|
|
3180
|
+
else if (i || e.directives.docStart || !r)
|
|
3181
|
+
e.commentBefore = n;
|
|
3182
|
+
else if (L(r) && !r.flow && r.items.length > 0) {
|
|
3183
|
+
let o = r.items[0];
|
|
3184
|
+
T(o) && (o = o.key);
|
|
3185
|
+
const l = o.commentBefore;
|
|
3186
|
+
o.commentBefore = l ? `${n}
|
|
3187
|
+
${l}` : n;
|
|
3188
|
+
} else {
|
|
3189
|
+
const o = r.commentBefore;
|
|
3190
|
+
r.commentBefore = o ? `${n}
|
|
3191
|
+
${o}` : n;
|
|
3192
|
+
}
|
|
3193
|
+
}
|
|
3194
|
+
t ? (Array.prototype.push.apply(e.errors, this.errors), Array.prototype.push.apply(e.warnings, this.warnings)) : (e.errors = this.errors, e.warnings = this.warnings), this.prelude = [], this.errors = [], this.warnings = [];
|
|
3195
|
+
}
|
|
3196
|
+
/**
|
|
3197
|
+
* Current stream status information.
|
|
3198
|
+
*
|
|
3199
|
+
* Mostly useful at the end of input for an empty stream.
|
|
3200
|
+
*/
|
|
3201
|
+
streamInfo() {
|
|
3202
|
+
return {
|
|
3203
|
+
comment: Rt(this.prelude).comment,
|
|
3204
|
+
directives: this.directives,
|
|
3205
|
+
errors: this.errors,
|
|
3206
|
+
warnings: this.warnings
|
|
3207
|
+
};
|
|
3208
|
+
}
|
|
3209
|
+
/**
|
|
3210
|
+
* Compose tokens into documents.
|
|
3211
|
+
*
|
|
3212
|
+
* @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.
|
|
3213
|
+
* @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly.
|
|
3214
|
+
*/
|
|
3215
|
+
*compose(e, t = !1, n = -1) {
|
|
3216
|
+
for (const i of e)
|
|
3217
|
+
yield* this.next(i);
|
|
3218
|
+
yield* this.end(t, n);
|
|
3219
|
+
}
|
|
3220
|
+
/** Advance the composer by one CST token. */
|
|
3221
|
+
*next(e) {
|
|
3222
|
+
switch (e.type) {
|
|
3223
|
+
case "directive":
|
|
3224
|
+
this.directives.add(e.source, (t, n, i) => {
|
|
3225
|
+
const r = we(e);
|
|
3226
|
+
r[0] += t, this.onError(r, "BAD_DIRECTIVE", n, i);
|
|
3227
|
+
}), this.prelude.push(e.source), this.atDirectives = !0;
|
|
3228
|
+
break;
|
|
3229
|
+
case "document": {
|
|
3230
|
+
const t = Zn(this.options, this.directives, e, this.onError);
|
|
3231
|
+
this.atDirectives && !t.directives.docStart && this.onError(e, "MISSING_CHAR", "Missing directives-end/doc-start indicator line"), this.decorate(t, !1), this.doc && (yield this.doc), this.doc = t, this.atDirectives = !1;
|
|
3232
|
+
break;
|
|
3233
|
+
}
|
|
3234
|
+
case "byte-order-mark":
|
|
3235
|
+
case "space":
|
|
3236
|
+
break;
|
|
3237
|
+
case "comment":
|
|
3238
|
+
case "newline":
|
|
3239
|
+
this.prelude.push(e.source);
|
|
3240
|
+
break;
|
|
3241
|
+
case "error": {
|
|
3242
|
+
const t = e.source ? `${e.message}: ${JSON.stringify(e.source)}` : e.message, n = new x(we(e), "UNEXPECTED_TOKEN", t);
|
|
3243
|
+
this.atDirectives || !this.doc ? this.errors.push(n) : this.doc.errors.push(n);
|
|
3244
|
+
break;
|
|
3245
|
+
}
|
|
3246
|
+
case "doc-end": {
|
|
3247
|
+
if (!this.doc) {
|
|
3248
|
+
const n = "Unexpected doc-end without preceding document";
|
|
3249
|
+
this.errors.push(new x(we(e), "UNEXPECTED_TOKEN", n));
|
|
3250
|
+
break;
|
|
3251
|
+
}
|
|
3252
|
+
this.doc.directives.docEnd = !0;
|
|
3253
|
+
const t = Te(e.end, e.offset + e.source.length, this.doc.options.strict, this.onError);
|
|
3254
|
+
if (this.decorate(this.doc, !0), t.comment) {
|
|
3255
|
+
const n = this.doc.comment;
|
|
3256
|
+
this.doc.comment = n ? `${n}
|
|
3257
|
+
${t.comment}` : t.comment;
|
|
3258
|
+
}
|
|
3259
|
+
this.doc.range[2] = t.offset;
|
|
3260
|
+
break;
|
|
3261
|
+
}
|
|
3262
|
+
default:
|
|
3263
|
+
this.errors.push(new x(we(e), "UNEXPECTED_TOKEN", `Unsupported token ${e.type}`));
|
|
3264
|
+
}
|
|
3265
|
+
}
|
|
3266
|
+
/**
|
|
3267
|
+
* Call at end of input to yield any remaining document.
|
|
3268
|
+
*
|
|
3269
|
+
* @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.
|
|
3270
|
+
* @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly.
|
|
3271
|
+
*/
|
|
3272
|
+
*end(e = !1, t = -1) {
|
|
3273
|
+
if (this.doc)
|
|
3274
|
+
this.decorate(this.doc, !0), yield this.doc, this.doc = null;
|
|
3275
|
+
else if (e) {
|
|
3276
|
+
const n = Object.assign({ _directives: this.directives }, this.options), i = new be(void 0, n);
|
|
3277
|
+
this.atDirectives && this.onError(t, "MISSING_CHAR", "Missing directives-end indicator line"), i.range = [0, t, t], this.decorate(i, !1), yield i;
|
|
3278
|
+
}
|
|
3279
|
+
}
|
|
3280
|
+
}
|
|
3281
|
+
function ei(s, e = !0, t) {
|
|
3282
|
+
if (s) {
|
|
3283
|
+
const n = (i, r, o) => {
|
|
3284
|
+
const l = typeof i == "number" ? i : Array.isArray(i) ? i[0] : i.offset;
|
|
3285
|
+
if (t)
|
|
3286
|
+
t(l, r, o);
|
|
3287
|
+
else
|
|
3288
|
+
throw new x([l, l + 1], r, o);
|
|
3289
|
+
};
|
|
3290
|
+
switch (s.type) {
|
|
3291
|
+
case "scalar":
|
|
3292
|
+
case "single-quoted-scalar":
|
|
3293
|
+
case "double-quoted-scalar":
|
|
3294
|
+
return Ts(s, e, n);
|
|
3295
|
+
case "block-scalar":
|
|
3296
|
+
return Es({ options: { strict: e } }, s, n);
|
|
3297
|
+
}
|
|
3298
|
+
}
|
|
3299
|
+
return null;
|
|
3300
|
+
}
|
|
3301
|
+
function ti(s, e) {
|
|
3302
|
+
const { implicitKey: t = !1, indent: n, inFlow: i = !1, offset: r = -1, type: o = "PLAIN" } = e, l = Ie({ type: o, value: s }, {
|
|
3303
|
+
implicitKey: t,
|
|
3304
|
+
indent: n > 0 ? " ".repeat(n) : "",
|
|
3305
|
+
inFlow: i,
|
|
3306
|
+
options: { blockQuote: !0, lineWidth: -1 }
|
|
3307
|
+
}), a = e.end ?? [
|
|
3308
|
+
{ type: "newline", offset: -1, indent: n, source: `
|
|
3309
|
+
` }
|
|
3310
|
+
];
|
|
3311
|
+
switch (l[0]) {
|
|
3312
|
+
case "|":
|
|
3313
|
+
case ">": {
|
|
3314
|
+
const c = l.indexOf(`
|
|
3315
|
+
`), d = l.substring(0, c), f = l.substring(c + 1) + `
|
|
3316
|
+
`, u = [
|
|
3317
|
+
{ type: "block-scalar-header", offset: r, indent: n, source: d }
|
|
3318
|
+
];
|
|
3319
|
+
return _s(u, a) || u.push({ type: "newline", offset: -1, indent: n, source: `
|
|
3320
|
+
` }), { type: "block-scalar", offset: r, indent: n, props: u, source: f };
|
|
3321
|
+
}
|
|
3322
|
+
case '"':
|
|
3323
|
+
return { type: "double-quoted-scalar", offset: r, indent: n, source: l, end: a };
|
|
3324
|
+
case "'":
|
|
3325
|
+
return { type: "single-quoted-scalar", offset: r, indent: n, source: l, end: a };
|
|
3326
|
+
default:
|
|
3327
|
+
return { type: "scalar", offset: r, indent: n, source: l, end: a };
|
|
3328
|
+
}
|
|
3329
|
+
}
|
|
3330
|
+
function si(s, e, t = {}) {
|
|
3331
|
+
let { afterKey: n = !1, implicitKey: i = !1, inFlow: r = !1, type: o } = t, l = "indent" in s ? s.indent : null;
|
|
3332
|
+
if (n && typeof l == "number" && (l += 2), !o)
|
|
3333
|
+
switch (s.type) {
|
|
3334
|
+
case "single-quoted-scalar":
|
|
3335
|
+
o = "QUOTE_SINGLE";
|
|
3336
|
+
break;
|
|
3337
|
+
case "double-quoted-scalar":
|
|
3338
|
+
o = "QUOTE_DOUBLE";
|
|
3339
|
+
break;
|
|
3340
|
+
case "block-scalar": {
|
|
3341
|
+
const c = s.props[0];
|
|
3342
|
+
if (c.type !== "block-scalar-header")
|
|
3343
|
+
throw new Error("Invalid block scalar header");
|
|
3344
|
+
o = c.source[0] === ">" ? "BLOCK_FOLDED" : "BLOCK_LITERAL";
|
|
3345
|
+
break;
|
|
3346
|
+
}
|
|
3347
|
+
default:
|
|
3348
|
+
o = "PLAIN";
|
|
3349
|
+
}
|
|
3350
|
+
const a = Ie({ type: o, value: e }, {
|
|
3351
|
+
implicitKey: i || l === null,
|
|
3352
|
+
indent: l !== null && l > 0 ? " ".repeat(l) : "",
|
|
3353
|
+
inFlow: r,
|
|
3354
|
+
options: { blockQuote: !0, lineWidth: -1 }
|
|
3355
|
+
});
|
|
3356
|
+
switch (a[0]) {
|
|
3357
|
+
case "|":
|
|
3358
|
+
case ">":
|
|
3359
|
+
ni(s, a);
|
|
3360
|
+
break;
|
|
3361
|
+
case '"':
|
|
3362
|
+
lt(s, a, "double-quoted-scalar");
|
|
3363
|
+
break;
|
|
3364
|
+
case "'":
|
|
3365
|
+
lt(s, a, "single-quoted-scalar");
|
|
3366
|
+
break;
|
|
3367
|
+
default:
|
|
3368
|
+
lt(s, a, "scalar");
|
|
3369
|
+
}
|
|
3370
|
+
}
|
|
3371
|
+
function ni(s, e) {
|
|
3372
|
+
const t = e.indexOf(`
|
|
3373
|
+
`), n = e.substring(0, t), i = e.substring(t + 1) + `
|
|
3374
|
+
`;
|
|
3375
|
+
if (s.type === "block-scalar") {
|
|
3376
|
+
const r = s.props[0];
|
|
3377
|
+
if (r.type !== "block-scalar-header")
|
|
3378
|
+
throw new Error("Invalid block scalar header");
|
|
3379
|
+
r.source = n, s.source = i;
|
|
3380
|
+
} else {
|
|
3381
|
+
const { offset: r } = s, o = "indent" in s ? s.indent : -1, l = [
|
|
3382
|
+
{ type: "block-scalar-header", offset: r, indent: o, source: n }
|
|
3383
|
+
];
|
|
3384
|
+
_s(l, "end" in s ? s.end : void 0) || l.push({ type: "newline", offset: -1, indent: o, source: `
|
|
3385
|
+
` });
|
|
3386
|
+
for (const a of Object.keys(s))
|
|
3387
|
+
a !== "type" && a !== "offset" && delete s[a];
|
|
3388
|
+
Object.assign(s, { type: "block-scalar", indent: o, props: l, source: i });
|
|
3389
|
+
}
|
|
3390
|
+
}
|
|
3391
|
+
function _s(s, e) {
|
|
3392
|
+
if (e)
|
|
3393
|
+
for (const t of e)
|
|
3394
|
+
switch (t.type) {
|
|
3395
|
+
case "space":
|
|
3396
|
+
case "comment":
|
|
3397
|
+
s.push(t);
|
|
3398
|
+
break;
|
|
3399
|
+
case "newline":
|
|
3400
|
+
return s.push(t), !0;
|
|
3401
|
+
}
|
|
3402
|
+
return !1;
|
|
3403
|
+
}
|
|
3404
|
+
function lt(s, e, t) {
|
|
3405
|
+
switch (s.type) {
|
|
3406
|
+
case "scalar":
|
|
3407
|
+
case "double-quoted-scalar":
|
|
3408
|
+
case "single-quoted-scalar":
|
|
3409
|
+
s.type = t, s.source = e;
|
|
3410
|
+
break;
|
|
3411
|
+
case "block-scalar": {
|
|
3412
|
+
const n = s.props.slice(1);
|
|
3413
|
+
let i = e.length;
|
|
3414
|
+
s.props[0].type === "block-scalar-header" && (i -= s.props[0].source.length);
|
|
3415
|
+
for (const r of n)
|
|
3416
|
+
r.offset += i;
|
|
3417
|
+
delete s.props, Object.assign(s, { type: t, source: e, end: n });
|
|
3418
|
+
break;
|
|
3419
|
+
}
|
|
3420
|
+
case "block-map":
|
|
3421
|
+
case "block-seq": {
|
|
3422
|
+
const i = { type: "newline", offset: s.offset + e.length, indent: s.indent, source: `
|
|
3423
|
+
` };
|
|
3424
|
+
delete s.items, Object.assign(s, { type: t, source: e, end: [i] });
|
|
3425
|
+
break;
|
|
3426
|
+
}
|
|
3427
|
+
default: {
|
|
3428
|
+
const n = "indent" in s ? s.indent : -1, i = "end" in s && Array.isArray(s.end) ? s.end.filter((r) => r.type === "space" || r.type === "comment" || r.type === "newline") : [];
|
|
3429
|
+
for (const r of Object.keys(s))
|
|
3430
|
+
r !== "type" && r !== "offset" && delete s[r];
|
|
3431
|
+
Object.assign(s, { type: t, indent: n, source: e, end: i });
|
|
3432
|
+
}
|
|
3433
|
+
}
|
|
3434
|
+
}
|
|
3435
|
+
const ii = (s) => "type" in s ? Fe(s) : je(s);
|
|
3436
|
+
function Fe(s) {
|
|
3437
|
+
switch (s.type) {
|
|
3438
|
+
case "block-scalar": {
|
|
3439
|
+
let e = "";
|
|
3440
|
+
for (const t of s.props)
|
|
3441
|
+
e += Fe(t);
|
|
3442
|
+
return e + s.source;
|
|
3443
|
+
}
|
|
3444
|
+
case "block-map":
|
|
3445
|
+
case "block-seq": {
|
|
3446
|
+
let e = "";
|
|
3447
|
+
for (const t of s.items)
|
|
3448
|
+
e += je(t);
|
|
3449
|
+
return e;
|
|
3450
|
+
}
|
|
3451
|
+
case "flow-collection": {
|
|
3452
|
+
let e = s.start.source;
|
|
3453
|
+
for (const t of s.items)
|
|
3454
|
+
e += je(t);
|
|
3455
|
+
for (const t of s.end)
|
|
3456
|
+
e += t.source;
|
|
3457
|
+
return e;
|
|
3458
|
+
}
|
|
3459
|
+
case "document": {
|
|
3460
|
+
let e = je(s);
|
|
3461
|
+
if (s.end)
|
|
3462
|
+
for (const t of s.end)
|
|
3463
|
+
e += t.source;
|
|
3464
|
+
return e;
|
|
3465
|
+
}
|
|
3466
|
+
default: {
|
|
3467
|
+
let e = s.source;
|
|
3468
|
+
if ("end" in s && s.end)
|
|
3469
|
+
for (const t of s.end)
|
|
3470
|
+
e += t.source;
|
|
3471
|
+
return e;
|
|
3472
|
+
}
|
|
3473
|
+
}
|
|
3474
|
+
}
|
|
3475
|
+
function je({ start: s, key: e, sep: t, value: n }) {
|
|
3476
|
+
let i = "";
|
|
3477
|
+
for (const r of s)
|
|
3478
|
+
i += r.source;
|
|
3479
|
+
if (e && (i += Fe(e)), t)
|
|
3480
|
+
for (const r of t)
|
|
3481
|
+
i += r.source;
|
|
3482
|
+
return n && (i += Fe(n)), i;
|
|
3483
|
+
}
|
|
3484
|
+
const pt = /* @__PURE__ */ Symbol("break visit"), ri = /* @__PURE__ */ Symbol("skip children"), vs = /* @__PURE__ */ Symbol("remove item");
|
|
3485
|
+
function Z(s, e) {
|
|
3486
|
+
"type" in s && s.type === "document" && (s = { start: s.start, value: s.value }), Ms(Object.freeze([]), s, e);
|
|
3487
|
+
}
|
|
3488
|
+
Z.BREAK = pt;
|
|
3489
|
+
Z.SKIP = ri;
|
|
3490
|
+
Z.REMOVE = vs;
|
|
3491
|
+
Z.itemAtPath = (s, e) => {
|
|
3492
|
+
let t = s;
|
|
3493
|
+
for (const [n, i] of e) {
|
|
3494
|
+
const r = t?.[n];
|
|
3495
|
+
if (r && "items" in r)
|
|
3496
|
+
t = r.items[i];
|
|
3497
|
+
else
|
|
3498
|
+
return;
|
|
3499
|
+
}
|
|
3500
|
+
return t;
|
|
3501
|
+
};
|
|
3502
|
+
Z.parentCollection = (s, e) => {
|
|
3503
|
+
const t = Z.itemAtPath(s, e.slice(0, -1)), n = e[e.length - 1][0], i = t?.[n];
|
|
3504
|
+
if (i && "items" in i)
|
|
3505
|
+
return i;
|
|
3506
|
+
throw new Error("Parent collection not found");
|
|
3507
|
+
};
|
|
3508
|
+
function Ms(s, e, t) {
|
|
3509
|
+
let n = t(e, s);
|
|
3510
|
+
if (typeof n == "symbol")
|
|
3511
|
+
return n;
|
|
3512
|
+
for (const i of ["key", "value"]) {
|
|
3513
|
+
const r = e[i];
|
|
3514
|
+
if (r && "items" in r) {
|
|
3515
|
+
for (let o = 0; o < r.items.length; ++o) {
|
|
3516
|
+
const l = Ms(Object.freeze(s.concat([[i, o]])), r.items[o], t);
|
|
3517
|
+
if (typeof l == "number")
|
|
3518
|
+
o = l - 1;
|
|
3519
|
+
else {
|
|
3520
|
+
if (l === pt)
|
|
3521
|
+
return pt;
|
|
3522
|
+
l === vs && (r.items.splice(o, 1), o -= 1);
|
|
3523
|
+
}
|
|
3524
|
+
}
|
|
3525
|
+
typeof n == "function" && i === "key" && (n = n(e, s));
|
|
3526
|
+
}
|
|
3527
|
+
}
|
|
3528
|
+
return typeof n == "function" ? n(e, s) : n;
|
|
3529
|
+
}
|
|
3530
|
+
const xe = "\uFEFF", Ze = "", et = "", Ae = "", oi = (s) => !!s && "items" in s, li = (s) => !!s && (s.type === "scalar" || s.type === "single-quoted-scalar" || s.type === "double-quoted-scalar" || s.type === "block-scalar");
|
|
3531
|
+
function ai(s) {
|
|
3532
|
+
switch (s) {
|
|
3533
|
+
case xe:
|
|
3534
|
+
return "<BOM>";
|
|
3535
|
+
case Ze:
|
|
3536
|
+
return "<DOC>";
|
|
3537
|
+
case et:
|
|
3538
|
+
return "<FLOW_END>";
|
|
3539
|
+
case Ae:
|
|
3540
|
+
return "<SCALAR>";
|
|
3541
|
+
default:
|
|
3542
|
+
return JSON.stringify(s);
|
|
3543
|
+
}
|
|
3544
|
+
}
|
|
3545
|
+
function Bs(s) {
|
|
3546
|
+
switch (s) {
|
|
3547
|
+
case xe:
|
|
3548
|
+
return "byte-order-mark";
|
|
3549
|
+
case Ze:
|
|
3550
|
+
return "doc-mode";
|
|
3551
|
+
case et:
|
|
3552
|
+
return "flow-error-end";
|
|
3553
|
+
case Ae:
|
|
3554
|
+
return "scalar";
|
|
3555
|
+
case "---":
|
|
3556
|
+
return "doc-start";
|
|
3557
|
+
case "...":
|
|
3558
|
+
return "doc-end";
|
|
3559
|
+
case "":
|
|
3560
|
+
case `
|
|
3561
|
+
`:
|
|
3562
|
+
case `\r
|
|
3563
|
+
`:
|
|
3564
|
+
return "newline";
|
|
3565
|
+
case "-":
|
|
3566
|
+
return "seq-item-ind";
|
|
3567
|
+
case "?":
|
|
3568
|
+
return "explicit-key-ind";
|
|
3569
|
+
case ":":
|
|
3570
|
+
return "map-value-ind";
|
|
3571
|
+
case "{":
|
|
3572
|
+
return "flow-map-start";
|
|
3573
|
+
case "}":
|
|
3574
|
+
return "flow-map-end";
|
|
3575
|
+
case "[":
|
|
3576
|
+
return "flow-seq-start";
|
|
3577
|
+
case "]":
|
|
3578
|
+
return "flow-seq-end";
|
|
3579
|
+
case ",":
|
|
3580
|
+
return "comma";
|
|
3581
|
+
}
|
|
3582
|
+
switch (s[0]) {
|
|
3583
|
+
case " ":
|
|
3584
|
+
case " ":
|
|
3585
|
+
return "space";
|
|
3586
|
+
case "#":
|
|
3587
|
+
return "comment";
|
|
3588
|
+
case "%":
|
|
3589
|
+
return "directive-line";
|
|
3590
|
+
case "*":
|
|
3591
|
+
return "alias";
|
|
3592
|
+
case "&":
|
|
3593
|
+
return "anchor";
|
|
3594
|
+
case "!":
|
|
3595
|
+
return "tag";
|
|
3596
|
+
case "'":
|
|
3597
|
+
return "single-quoted-scalar";
|
|
3598
|
+
case '"':
|
|
3599
|
+
return "double-quoted-scalar";
|
|
3600
|
+
case "|":
|
|
3601
|
+
case ">":
|
|
3602
|
+
return "block-scalar-header";
|
|
3603
|
+
}
|
|
3604
|
+
return null;
|
|
3605
|
+
}
|
|
3606
|
+
const ci = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3607
|
+
__proto__: null,
|
|
3608
|
+
BOM: xe,
|
|
3609
|
+
DOCUMENT: Ze,
|
|
3610
|
+
FLOW_END: et,
|
|
3611
|
+
SCALAR: Ae,
|
|
3612
|
+
createScalarToken: ti,
|
|
3613
|
+
isCollection: oi,
|
|
3614
|
+
isScalar: li,
|
|
3615
|
+
prettyToken: ai,
|
|
3616
|
+
resolveAsScalar: ei,
|
|
3617
|
+
setScalarValue: si,
|
|
3618
|
+
stringify: ii,
|
|
3619
|
+
tokenType: Bs,
|
|
3620
|
+
visit: Z
|
|
3621
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
3622
|
+
function q(s) {
|
|
3623
|
+
switch (s) {
|
|
3624
|
+
case void 0:
|
|
3625
|
+
case " ":
|
|
3626
|
+
case `
|
|
3627
|
+
`:
|
|
3628
|
+
case "\r":
|
|
3629
|
+
case " ":
|
|
3630
|
+
return !0;
|
|
3631
|
+
default:
|
|
3632
|
+
return !1;
|
|
3633
|
+
}
|
|
3634
|
+
}
|
|
3635
|
+
const Ut = new Set("0123456789ABCDEFabcdef"), fi = new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"), _e = new Set(",[]{}"), ui = new Set(` ,[]{}
|
|
3636
|
+
\r `), at = (s) => !s || ui.has(s);
|
|
3637
|
+
class Ks {
|
|
3638
|
+
constructor() {
|
|
3639
|
+
this.atEnd = !1, this.blockScalarIndent = -1, this.blockScalarKeep = !1, this.buffer = "", this.flowKey = !1, this.flowLevel = 0, this.indentNext = 0, this.indentValue = 0, this.lineEndPos = null, this.next = null, this.pos = 0;
|
|
3640
|
+
}
|
|
3641
|
+
/**
|
|
3642
|
+
* Generate YAML tokens from the `source` string. If `incomplete`,
|
|
3643
|
+
* a part of the last line may be left as a buffer for the next call.
|
|
3644
|
+
*
|
|
3645
|
+
* @returns A generator of lexical tokens
|
|
3646
|
+
*/
|
|
3647
|
+
*lex(e, t = !1) {
|
|
3648
|
+
if (e) {
|
|
3649
|
+
if (typeof e != "string")
|
|
3650
|
+
throw TypeError("source is not a string");
|
|
3651
|
+
this.buffer = this.buffer ? this.buffer + e : e, this.lineEndPos = null;
|
|
3652
|
+
}
|
|
3653
|
+
this.atEnd = !t;
|
|
3654
|
+
let n = this.next ?? "stream";
|
|
3655
|
+
for (; n && (t || this.hasChars(1)); )
|
|
3656
|
+
n = yield* this.parseNext(n);
|
|
3657
|
+
}
|
|
3658
|
+
atLineEnd() {
|
|
3659
|
+
let e = this.pos, t = this.buffer[e];
|
|
3660
|
+
for (; t === " " || t === " "; )
|
|
3661
|
+
t = this.buffer[++e];
|
|
3662
|
+
return !t || t === "#" || t === `
|
|
3663
|
+
` ? !0 : t === "\r" ? this.buffer[e + 1] === `
|
|
3664
|
+
` : !1;
|
|
3665
|
+
}
|
|
3666
|
+
charAt(e) {
|
|
3667
|
+
return this.buffer[this.pos + e];
|
|
3668
|
+
}
|
|
3669
|
+
continueScalar(e) {
|
|
3670
|
+
let t = this.buffer[e];
|
|
3671
|
+
if (this.indentNext > 0) {
|
|
3672
|
+
let n = 0;
|
|
3673
|
+
for (; t === " "; )
|
|
3674
|
+
t = this.buffer[++n + e];
|
|
3675
|
+
if (t === "\r") {
|
|
3676
|
+
const i = this.buffer[n + e + 1];
|
|
3677
|
+
if (i === `
|
|
3678
|
+
` || !i && !this.atEnd)
|
|
3679
|
+
return e + n + 1;
|
|
3680
|
+
}
|
|
3681
|
+
return t === `
|
|
3682
|
+
` || n >= this.indentNext || !t && !this.atEnd ? e + n : -1;
|
|
3683
|
+
}
|
|
3684
|
+
if (t === "-" || t === ".") {
|
|
3685
|
+
const n = this.buffer.substr(e, 3);
|
|
3686
|
+
if ((n === "---" || n === "...") && q(this.buffer[e + 3]))
|
|
3687
|
+
return -1;
|
|
3688
|
+
}
|
|
3689
|
+
return e;
|
|
3690
|
+
}
|
|
3691
|
+
getLine() {
|
|
3692
|
+
let e = this.lineEndPos;
|
|
3693
|
+
return (typeof e != "number" || e !== -1 && e < this.pos) && (e = this.buffer.indexOf(`
|
|
3694
|
+
`, this.pos), this.lineEndPos = e), e === -1 ? this.atEnd ? this.buffer.substring(this.pos) : null : (this.buffer[e - 1] === "\r" && (e -= 1), this.buffer.substring(this.pos, e));
|
|
3695
|
+
}
|
|
3696
|
+
hasChars(e) {
|
|
3697
|
+
return this.pos + e <= this.buffer.length;
|
|
3698
|
+
}
|
|
3699
|
+
setNext(e) {
|
|
3700
|
+
return this.buffer = this.buffer.substring(this.pos), this.pos = 0, this.lineEndPos = null, this.next = e, null;
|
|
3701
|
+
}
|
|
3702
|
+
peek(e) {
|
|
3703
|
+
return this.buffer.substr(this.pos, e);
|
|
3704
|
+
}
|
|
3705
|
+
*parseNext(e) {
|
|
3706
|
+
switch (e) {
|
|
3707
|
+
case "stream":
|
|
3708
|
+
return yield* this.parseStream();
|
|
3709
|
+
case "line-start":
|
|
3710
|
+
return yield* this.parseLineStart();
|
|
3711
|
+
case "block-start":
|
|
3712
|
+
return yield* this.parseBlockStart();
|
|
3713
|
+
case "doc":
|
|
3714
|
+
return yield* this.parseDocument();
|
|
3715
|
+
case "flow":
|
|
3716
|
+
return yield* this.parseFlowCollection();
|
|
3717
|
+
case "quoted-scalar":
|
|
3718
|
+
return yield* this.parseQuotedScalar();
|
|
3719
|
+
case "block-scalar":
|
|
3720
|
+
return yield* this.parseBlockScalar();
|
|
3721
|
+
case "plain-scalar":
|
|
3722
|
+
return yield* this.parsePlainScalar();
|
|
3723
|
+
}
|
|
3724
|
+
}
|
|
3725
|
+
*parseStream() {
|
|
3726
|
+
let e = this.getLine();
|
|
3727
|
+
if (e === null)
|
|
3728
|
+
return this.setNext("stream");
|
|
3729
|
+
if (e[0] === xe && (yield* this.pushCount(1), e = e.substring(1)), e[0] === "%") {
|
|
3730
|
+
let t = e.length, n = e.indexOf("#");
|
|
3731
|
+
for (; n !== -1; ) {
|
|
3732
|
+
const r = e[n - 1];
|
|
3733
|
+
if (r === " " || r === " ") {
|
|
3734
|
+
t = n - 1;
|
|
3735
|
+
break;
|
|
3736
|
+
} else
|
|
3737
|
+
n = e.indexOf("#", n + 1);
|
|
3738
|
+
}
|
|
3739
|
+
for (; ; ) {
|
|
3740
|
+
const r = e[t - 1];
|
|
3741
|
+
if (r === " " || r === " ")
|
|
3742
|
+
t -= 1;
|
|
3743
|
+
else
|
|
3744
|
+
break;
|
|
3745
|
+
}
|
|
3746
|
+
const i = (yield* this.pushCount(t)) + (yield* this.pushSpaces(!0));
|
|
3747
|
+
return yield* this.pushCount(e.length - i), this.pushNewline(), "stream";
|
|
3748
|
+
}
|
|
3749
|
+
if (this.atLineEnd()) {
|
|
3750
|
+
const t = yield* this.pushSpaces(!0);
|
|
3751
|
+
return yield* this.pushCount(e.length - t), yield* this.pushNewline(), "stream";
|
|
3752
|
+
}
|
|
3753
|
+
return yield Ze, yield* this.parseLineStart();
|
|
3754
|
+
}
|
|
3755
|
+
*parseLineStart() {
|
|
3756
|
+
const e = this.charAt(0);
|
|
3757
|
+
if (!e && !this.atEnd)
|
|
3758
|
+
return this.setNext("line-start");
|
|
3759
|
+
if (e === "-" || e === ".") {
|
|
3760
|
+
if (!this.atEnd && !this.hasChars(4))
|
|
3761
|
+
return this.setNext("line-start");
|
|
3762
|
+
const t = this.peek(3);
|
|
3763
|
+
if ((t === "---" || t === "...") && q(this.charAt(3)))
|
|
3764
|
+
return yield* this.pushCount(3), this.indentValue = 0, this.indentNext = 0, t === "---" ? "doc" : "stream";
|
|
3765
|
+
}
|
|
3766
|
+
return this.indentValue = yield* this.pushSpaces(!1), this.indentNext > this.indentValue && !q(this.charAt(1)) && (this.indentNext = this.indentValue), yield* this.parseBlockStart();
|
|
3767
|
+
}
|
|
3768
|
+
*parseBlockStart() {
|
|
3769
|
+
const [e, t] = this.peek(2);
|
|
3770
|
+
if (!t && !this.atEnd)
|
|
3771
|
+
return this.setNext("block-start");
|
|
3772
|
+
if ((e === "-" || e === "?" || e === ":") && q(t)) {
|
|
3773
|
+
const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(!0));
|
|
3774
|
+
return this.indentNext = this.indentValue + 1, this.indentValue += n, yield* this.parseBlockStart();
|
|
3775
|
+
}
|
|
3776
|
+
return "doc";
|
|
3777
|
+
}
|
|
3778
|
+
*parseDocument() {
|
|
3779
|
+
yield* this.pushSpaces(!0);
|
|
3780
|
+
const e = this.getLine();
|
|
3781
|
+
if (e === null)
|
|
3782
|
+
return this.setNext("doc");
|
|
3783
|
+
let t = yield* this.pushIndicators();
|
|
3784
|
+
switch (e[t]) {
|
|
3785
|
+
case "#":
|
|
3786
|
+
yield* this.pushCount(e.length - t);
|
|
3787
|
+
// fallthrough
|
|
3788
|
+
case void 0:
|
|
3789
|
+
return yield* this.pushNewline(), yield* this.parseLineStart();
|
|
3790
|
+
case "{":
|
|
3791
|
+
case "[":
|
|
3792
|
+
return yield* this.pushCount(1), this.flowKey = !1, this.flowLevel = 1, "flow";
|
|
3793
|
+
case "}":
|
|
3794
|
+
case "]":
|
|
3795
|
+
return yield* this.pushCount(1), "doc";
|
|
3796
|
+
case "*":
|
|
3797
|
+
return yield* this.pushUntil(at), "doc";
|
|
3798
|
+
case '"':
|
|
3799
|
+
case "'":
|
|
3800
|
+
return yield* this.parseQuotedScalar();
|
|
3801
|
+
case "|":
|
|
3802
|
+
case ">":
|
|
3803
|
+
return t += yield* this.parseBlockScalarHeader(), t += yield* this.pushSpaces(!0), yield* this.pushCount(e.length - t), yield* this.pushNewline(), yield* this.parseBlockScalar();
|
|
3804
|
+
default:
|
|
3805
|
+
return yield* this.parsePlainScalar();
|
|
3806
|
+
}
|
|
3807
|
+
}
|
|
3808
|
+
*parseFlowCollection() {
|
|
3809
|
+
let e, t, n = -1;
|
|
3810
|
+
do
|
|
3811
|
+
e = yield* this.pushNewline(), e > 0 ? (t = yield* this.pushSpaces(!1), this.indentValue = n = t) : t = 0, t += yield* this.pushSpaces(!0);
|
|
3812
|
+
while (e + t > 0);
|
|
3813
|
+
const i = this.getLine();
|
|
3814
|
+
if (i === null)
|
|
3815
|
+
return this.setNext("flow");
|
|
3816
|
+
if ((n !== -1 && n < this.indentNext && i[0] !== "#" || n === 0 && (i.startsWith("---") || i.startsWith("...")) && q(i[3])) && !(n === this.indentNext - 1 && this.flowLevel === 1 && (i[0] === "]" || i[0] === "}")))
|
|
3817
|
+
return this.flowLevel = 0, yield et, yield* this.parseLineStart();
|
|
3818
|
+
let r = 0;
|
|
3819
|
+
for (; i[r] === ","; )
|
|
3820
|
+
r += yield* this.pushCount(1), r += yield* this.pushSpaces(!0), this.flowKey = !1;
|
|
3821
|
+
switch (r += yield* this.pushIndicators(), i[r]) {
|
|
3822
|
+
case void 0:
|
|
3823
|
+
return "flow";
|
|
3824
|
+
case "#":
|
|
3825
|
+
return yield* this.pushCount(i.length - r), "flow";
|
|
3826
|
+
case "{":
|
|
3827
|
+
case "[":
|
|
3828
|
+
return yield* this.pushCount(1), this.flowKey = !1, this.flowLevel += 1, "flow";
|
|
3829
|
+
case "}":
|
|
3830
|
+
case "]":
|
|
3831
|
+
return yield* this.pushCount(1), this.flowKey = !0, this.flowLevel -= 1, this.flowLevel ? "flow" : "doc";
|
|
3832
|
+
case "*":
|
|
3833
|
+
return yield* this.pushUntil(at), "flow";
|
|
3834
|
+
case '"':
|
|
3835
|
+
case "'":
|
|
3836
|
+
return this.flowKey = !0, yield* this.parseQuotedScalar();
|
|
3837
|
+
case ":": {
|
|
3838
|
+
const o = this.charAt(1);
|
|
3839
|
+
if (this.flowKey || q(o) || o === ",")
|
|
3840
|
+
return this.flowKey = !1, yield* this.pushCount(1), yield* this.pushSpaces(!0), "flow";
|
|
3841
|
+
}
|
|
3842
|
+
// fallthrough
|
|
3843
|
+
default:
|
|
3844
|
+
return this.flowKey = !1, yield* this.parsePlainScalar();
|
|
3845
|
+
}
|
|
3846
|
+
}
|
|
3847
|
+
*parseQuotedScalar() {
|
|
3848
|
+
const e = this.charAt(0);
|
|
3849
|
+
let t = this.buffer.indexOf(e, this.pos + 1);
|
|
3850
|
+
if (e === "'")
|
|
3851
|
+
for (; t !== -1 && this.buffer[t + 1] === "'"; )
|
|
3852
|
+
t = this.buffer.indexOf("'", t + 2);
|
|
3853
|
+
else
|
|
3854
|
+
for (; t !== -1; ) {
|
|
3855
|
+
let r = 0;
|
|
3856
|
+
for (; this.buffer[t - 1 - r] === "\\"; )
|
|
3857
|
+
r += 1;
|
|
3858
|
+
if (r % 2 === 0)
|
|
3859
|
+
break;
|
|
3860
|
+
t = this.buffer.indexOf('"', t + 1);
|
|
3861
|
+
}
|
|
3862
|
+
const n = this.buffer.substring(0, t);
|
|
3863
|
+
let i = n.indexOf(`
|
|
3864
|
+
`, this.pos);
|
|
3865
|
+
if (i !== -1) {
|
|
3866
|
+
for (; i !== -1; ) {
|
|
3867
|
+
const r = this.continueScalar(i + 1);
|
|
3868
|
+
if (r === -1)
|
|
3869
|
+
break;
|
|
3870
|
+
i = n.indexOf(`
|
|
3871
|
+
`, r);
|
|
3872
|
+
}
|
|
3873
|
+
i !== -1 && (t = i - (n[i - 1] === "\r" ? 2 : 1));
|
|
3874
|
+
}
|
|
3875
|
+
if (t === -1) {
|
|
3876
|
+
if (!this.atEnd)
|
|
3877
|
+
return this.setNext("quoted-scalar");
|
|
3878
|
+
t = this.buffer.length;
|
|
3879
|
+
}
|
|
3880
|
+
return yield* this.pushToIndex(t + 1, !1), this.flowLevel ? "flow" : "doc";
|
|
3881
|
+
}
|
|
3882
|
+
*parseBlockScalarHeader() {
|
|
3883
|
+
this.blockScalarIndent = -1, this.blockScalarKeep = !1;
|
|
3884
|
+
let e = this.pos;
|
|
3885
|
+
for (; ; ) {
|
|
3886
|
+
const t = this.buffer[++e];
|
|
3887
|
+
if (t === "+")
|
|
3888
|
+
this.blockScalarKeep = !0;
|
|
3889
|
+
else if (t > "0" && t <= "9")
|
|
3890
|
+
this.blockScalarIndent = Number(t) - 1;
|
|
3891
|
+
else if (t !== "-")
|
|
3892
|
+
break;
|
|
3893
|
+
}
|
|
3894
|
+
return yield* this.pushUntil((t) => q(t) || t === "#");
|
|
3895
|
+
}
|
|
3896
|
+
*parseBlockScalar() {
|
|
3897
|
+
let e = this.pos - 1, t = 0, n;
|
|
3898
|
+
e: for (let r = this.pos; n = this.buffer[r]; ++r)
|
|
3899
|
+
switch (n) {
|
|
3900
|
+
case " ":
|
|
3901
|
+
t += 1;
|
|
3902
|
+
break;
|
|
3903
|
+
case `
|
|
3904
|
+
`:
|
|
3905
|
+
e = r, t = 0;
|
|
3906
|
+
break;
|
|
3907
|
+
case "\r": {
|
|
3908
|
+
const o = this.buffer[r + 1];
|
|
3909
|
+
if (!o && !this.atEnd)
|
|
3910
|
+
return this.setNext("block-scalar");
|
|
3911
|
+
if (o === `
|
|
3912
|
+
`)
|
|
3913
|
+
break;
|
|
3914
|
+
}
|
|
3915
|
+
// fallthrough
|
|
3916
|
+
default:
|
|
3917
|
+
break e;
|
|
3918
|
+
}
|
|
3919
|
+
if (!n && !this.atEnd)
|
|
3920
|
+
return this.setNext("block-scalar");
|
|
3921
|
+
if (t >= this.indentNext) {
|
|
3922
|
+
this.blockScalarIndent === -1 ? this.indentNext = t : this.indentNext = this.blockScalarIndent + (this.indentNext === 0 ? 1 : this.indentNext);
|
|
3923
|
+
do {
|
|
3924
|
+
const r = this.continueScalar(e + 1);
|
|
3925
|
+
if (r === -1)
|
|
3926
|
+
break;
|
|
3927
|
+
e = this.buffer.indexOf(`
|
|
3928
|
+
`, r);
|
|
3929
|
+
} while (e !== -1);
|
|
3930
|
+
if (e === -1) {
|
|
3931
|
+
if (!this.atEnd)
|
|
3932
|
+
return this.setNext("block-scalar");
|
|
3933
|
+
e = this.buffer.length;
|
|
3934
|
+
}
|
|
3935
|
+
}
|
|
3936
|
+
let i = e + 1;
|
|
3937
|
+
for (n = this.buffer[i]; n === " "; )
|
|
3938
|
+
n = this.buffer[++i];
|
|
3939
|
+
if (n === " ") {
|
|
3940
|
+
for (; n === " " || n === " " || n === "\r" || n === `
|
|
3941
|
+
`; )
|
|
3942
|
+
n = this.buffer[++i];
|
|
3943
|
+
e = i - 1;
|
|
3944
|
+
} else if (!this.blockScalarKeep)
|
|
3945
|
+
do {
|
|
3946
|
+
let r = e - 1, o = this.buffer[r];
|
|
3947
|
+
o === "\r" && (o = this.buffer[--r]);
|
|
3948
|
+
const l = r;
|
|
3949
|
+
for (; o === " "; )
|
|
3950
|
+
o = this.buffer[--r];
|
|
3951
|
+
if (o === `
|
|
3952
|
+
` && r >= this.pos && r + 1 + t > l)
|
|
3953
|
+
e = r;
|
|
3954
|
+
else
|
|
3955
|
+
break;
|
|
3956
|
+
} while (!0);
|
|
3957
|
+
return yield Ae, yield* this.pushToIndex(e + 1, !0), yield* this.parseLineStart();
|
|
3958
|
+
}
|
|
3959
|
+
*parsePlainScalar() {
|
|
3960
|
+
const e = this.flowLevel > 0;
|
|
3961
|
+
let t = this.pos - 1, n = this.pos - 1, i;
|
|
3962
|
+
for (; i = this.buffer[++n]; )
|
|
3963
|
+
if (i === ":") {
|
|
3964
|
+
const r = this.buffer[n + 1];
|
|
3965
|
+
if (q(r) || e && _e.has(r))
|
|
3966
|
+
break;
|
|
3967
|
+
t = n;
|
|
3968
|
+
} else if (q(i)) {
|
|
3969
|
+
let r = this.buffer[n + 1];
|
|
3970
|
+
if (i === "\r" && (r === `
|
|
3971
|
+
` ? (n += 1, i = `
|
|
3972
|
+
`, r = this.buffer[n + 1]) : t = n), r === "#" || e && _e.has(r))
|
|
3973
|
+
break;
|
|
3974
|
+
if (i === `
|
|
3975
|
+
`) {
|
|
3976
|
+
const o = this.continueScalar(n + 1);
|
|
3977
|
+
if (o === -1)
|
|
3978
|
+
break;
|
|
3979
|
+
n = Math.max(n, o - 2);
|
|
3980
|
+
}
|
|
3981
|
+
} else {
|
|
3982
|
+
if (e && _e.has(i))
|
|
3983
|
+
break;
|
|
3984
|
+
t = n;
|
|
3985
|
+
}
|
|
3986
|
+
return !i && !this.atEnd ? this.setNext("plain-scalar") : (yield Ae, yield* this.pushToIndex(t + 1, !0), e ? "flow" : "doc");
|
|
3987
|
+
}
|
|
3988
|
+
*pushCount(e) {
|
|
3989
|
+
return e > 0 ? (yield this.buffer.substr(this.pos, e), this.pos += e, e) : 0;
|
|
3990
|
+
}
|
|
3991
|
+
*pushToIndex(e, t) {
|
|
3992
|
+
const n = this.buffer.slice(this.pos, e);
|
|
3993
|
+
return n ? (yield n, this.pos += n.length, n.length) : (t && (yield ""), 0);
|
|
3994
|
+
}
|
|
3995
|
+
*pushIndicators() {
|
|
3996
|
+
switch (this.charAt(0)) {
|
|
3997
|
+
case "!":
|
|
3998
|
+
return (yield* this.pushTag()) + (yield* this.pushSpaces(!0)) + (yield* this.pushIndicators());
|
|
3999
|
+
case "&":
|
|
4000
|
+
return (yield* this.pushUntil(at)) + (yield* this.pushSpaces(!0)) + (yield* this.pushIndicators());
|
|
4001
|
+
case "-":
|
|
4002
|
+
// this is an error
|
|
4003
|
+
case "?":
|
|
4004
|
+
// this is an error outside flow collections
|
|
4005
|
+
case ":": {
|
|
4006
|
+
const e = this.flowLevel > 0, t = this.charAt(1);
|
|
4007
|
+
if (q(t) || e && _e.has(t))
|
|
4008
|
+
return e ? this.flowKey && (this.flowKey = !1) : this.indentNext = this.indentValue + 1, (yield* this.pushCount(1)) + (yield* this.pushSpaces(!0)) + (yield* this.pushIndicators());
|
|
4009
|
+
}
|
|
4010
|
+
}
|
|
4011
|
+
return 0;
|
|
4012
|
+
}
|
|
4013
|
+
*pushTag() {
|
|
4014
|
+
if (this.charAt(1) === "<") {
|
|
4015
|
+
let e = this.pos + 2, t = this.buffer[e];
|
|
4016
|
+
for (; !q(t) && t !== ">"; )
|
|
4017
|
+
t = this.buffer[++e];
|
|
4018
|
+
return yield* this.pushToIndex(t === ">" ? e + 1 : e, !1);
|
|
4019
|
+
} else {
|
|
4020
|
+
let e = this.pos + 1, t = this.buffer[e];
|
|
4021
|
+
for (; t; )
|
|
4022
|
+
if (fi.has(t))
|
|
4023
|
+
t = this.buffer[++e];
|
|
4024
|
+
else if (t === "%" && Ut.has(this.buffer[e + 1]) && Ut.has(this.buffer[e + 2]))
|
|
4025
|
+
t = this.buffer[e += 3];
|
|
4026
|
+
else
|
|
4027
|
+
break;
|
|
4028
|
+
return yield* this.pushToIndex(e, !1);
|
|
4029
|
+
}
|
|
4030
|
+
}
|
|
4031
|
+
*pushNewline() {
|
|
4032
|
+
const e = this.buffer[this.pos];
|
|
4033
|
+
return e === `
|
|
4034
|
+
` ? yield* this.pushCount(1) : e === "\r" && this.charAt(1) === `
|
|
4035
|
+
` ? yield* this.pushCount(2) : 0;
|
|
4036
|
+
}
|
|
4037
|
+
*pushSpaces(e) {
|
|
4038
|
+
let t = this.pos - 1, n;
|
|
4039
|
+
do
|
|
4040
|
+
n = this.buffer[++t];
|
|
4041
|
+
while (n === " " || e && n === " ");
|
|
4042
|
+
const i = t - this.pos;
|
|
4043
|
+
return i > 0 && (yield this.buffer.substr(this.pos, i), this.pos = t), i;
|
|
4044
|
+
}
|
|
4045
|
+
*pushUntil(e) {
|
|
4046
|
+
let t = this.pos, n = this.buffer[t];
|
|
4047
|
+
for (; !e(n); )
|
|
4048
|
+
n = this.buffer[++t];
|
|
4049
|
+
return yield* this.pushToIndex(t, !1);
|
|
4050
|
+
}
|
|
4051
|
+
}
|
|
4052
|
+
class js {
|
|
4053
|
+
constructor() {
|
|
4054
|
+
this.lineStarts = [], this.addNewLine = (e) => this.lineStarts.push(e), this.linePos = (e) => {
|
|
4055
|
+
let t = 0, n = this.lineStarts.length;
|
|
4056
|
+
for (; t < n; ) {
|
|
4057
|
+
const r = t + n >> 1;
|
|
4058
|
+
this.lineStarts[r] < e ? t = r + 1 : n = r;
|
|
4059
|
+
}
|
|
4060
|
+
if (this.lineStarts[t] === e)
|
|
4061
|
+
return { line: t + 1, col: 1 };
|
|
4062
|
+
if (t === 0)
|
|
4063
|
+
return { line: 0, col: e };
|
|
4064
|
+
const i = this.lineStarts[t - 1];
|
|
4065
|
+
return { line: t, col: e - i + 1 };
|
|
4066
|
+
};
|
|
4067
|
+
}
|
|
4068
|
+
}
|
|
4069
|
+
function G(s, e) {
|
|
4070
|
+
for (let t = 0; t < s.length; ++t)
|
|
4071
|
+
if (s[t].type === e)
|
|
4072
|
+
return !0;
|
|
4073
|
+
return !1;
|
|
4074
|
+
}
|
|
4075
|
+
function Vt(s) {
|
|
4076
|
+
for (let e = 0; e < s.length; ++e)
|
|
4077
|
+
switch (s[e].type) {
|
|
4078
|
+
case "space":
|
|
4079
|
+
case "comment":
|
|
4080
|
+
case "newline":
|
|
4081
|
+
break;
|
|
4082
|
+
default:
|
|
4083
|
+
return e;
|
|
4084
|
+
}
|
|
4085
|
+
return -1;
|
|
4086
|
+
}
|
|
4087
|
+
function Ps(s) {
|
|
4088
|
+
switch (s?.type) {
|
|
4089
|
+
case "alias":
|
|
4090
|
+
case "scalar":
|
|
4091
|
+
case "single-quoted-scalar":
|
|
4092
|
+
case "double-quoted-scalar":
|
|
4093
|
+
case "flow-collection":
|
|
4094
|
+
return !0;
|
|
4095
|
+
default:
|
|
4096
|
+
return !1;
|
|
4097
|
+
}
|
|
4098
|
+
}
|
|
4099
|
+
function ve(s) {
|
|
4100
|
+
switch (s.type) {
|
|
4101
|
+
case "document":
|
|
4102
|
+
return s.start;
|
|
4103
|
+
case "block-map": {
|
|
4104
|
+
const e = s.items[s.items.length - 1];
|
|
4105
|
+
return e.sep ?? e.start;
|
|
4106
|
+
}
|
|
4107
|
+
case "block-seq":
|
|
4108
|
+
return s.items[s.items.length - 1].start;
|
|
4109
|
+
/* istanbul ignore next should not happen */
|
|
4110
|
+
default:
|
|
4111
|
+
return [];
|
|
4112
|
+
}
|
|
4113
|
+
}
|
|
4114
|
+
function ie(s) {
|
|
4115
|
+
if (s.length === 0)
|
|
4116
|
+
return [];
|
|
4117
|
+
let e = s.length;
|
|
4118
|
+
e: for (; --e >= 0; )
|
|
4119
|
+
switch (s[e].type) {
|
|
4120
|
+
case "doc-start":
|
|
4121
|
+
case "explicit-key-ind":
|
|
4122
|
+
case "map-value-ind":
|
|
4123
|
+
case "seq-item-ind":
|
|
4124
|
+
case "newline":
|
|
4125
|
+
break e;
|
|
4126
|
+
}
|
|
4127
|
+
for (; s[++e]?.type === "space"; )
|
|
4128
|
+
;
|
|
4129
|
+
return s.splice(e, s.length);
|
|
4130
|
+
}
|
|
4131
|
+
function Yt(s) {
|
|
4132
|
+
if (s.start.type === "flow-seq-start")
|
|
4133
|
+
for (const e of s.items)
|
|
4134
|
+
e.sep && !e.value && !G(e.start, "explicit-key-ind") && !G(e.sep, "map-value-ind") && (e.key && (e.value = e.key), delete e.key, Ps(e.value) ? e.value.end ? Array.prototype.push.apply(e.value.end, e.sep) : e.value.end = e.sep : Array.prototype.push.apply(e.start, e.sep), delete e.sep);
|
|
4135
|
+
}
|
|
4136
|
+
class $t {
|
|
4137
|
+
/**
|
|
4138
|
+
* @param onNewLine - If defined, called separately with the start position of
|
|
4139
|
+
* each new line (in `parse()`, including the start of input).
|
|
4140
|
+
*/
|
|
4141
|
+
constructor(e) {
|
|
4142
|
+
this.atNewLine = !0, this.atScalar = !1, this.indent = 0, this.offset = 0, this.onKeyLine = !1, this.stack = [], this.source = "", this.type = "", this.lexer = new Ks(), this.onNewLine = e;
|
|
4143
|
+
}
|
|
4144
|
+
/**
|
|
4145
|
+
* Parse `source` as a YAML stream.
|
|
4146
|
+
* If `incomplete`, a part of the last line may be left as a buffer for the next call.
|
|
4147
|
+
*
|
|
4148
|
+
* Errors are not thrown, but yielded as `{ type: 'error', message }` tokens.
|
|
4149
|
+
*
|
|
4150
|
+
* @returns A generator of tokens representing each directive, document, and other structure.
|
|
4151
|
+
*/
|
|
4152
|
+
*parse(e, t = !1) {
|
|
4153
|
+
this.onNewLine && this.offset === 0 && this.onNewLine(0);
|
|
4154
|
+
for (const n of this.lexer.lex(e, t))
|
|
4155
|
+
yield* this.next(n);
|
|
4156
|
+
t || (yield* this.end());
|
|
4157
|
+
}
|
|
4158
|
+
/**
|
|
4159
|
+
* Advance the parser by the `source` of one lexical token.
|
|
4160
|
+
*/
|
|
4161
|
+
*next(e) {
|
|
4162
|
+
if (this.source = e, this.atScalar) {
|
|
4163
|
+
this.atScalar = !1, yield* this.step(), this.offset += e.length;
|
|
4164
|
+
return;
|
|
4165
|
+
}
|
|
4166
|
+
const t = Bs(e);
|
|
4167
|
+
if (t)
|
|
4168
|
+
if (t === "scalar")
|
|
4169
|
+
this.atNewLine = !1, this.atScalar = !0, this.type = "scalar";
|
|
4170
|
+
else {
|
|
4171
|
+
switch (this.type = t, yield* this.step(), t) {
|
|
4172
|
+
case "newline":
|
|
4173
|
+
this.atNewLine = !0, this.indent = 0, this.onNewLine && this.onNewLine(this.offset + e.length);
|
|
4174
|
+
break;
|
|
4175
|
+
case "space":
|
|
4176
|
+
this.atNewLine && e[0] === " " && (this.indent += e.length);
|
|
4177
|
+
break;
|
|
4178
|
+
case "explicit-key-ind":
|
|
4179
|
+
case "map-value-ind":
|
|
4180
|
+
case "seq-item-ind":
|
|
4181
|
+
this.atNewLine && (this.indent += e.length);
|
|
4182
|
+
break;
|
|
4183
|
+
case "doc-mode":
|
|
4184
|
+
case "flow-error-end":
|
|
4185
|
+
return;
|
|
4186
|
+
default:
|
|
4187
|
+
this.atNewLine = !1;
|
|
4188
|
+
}
|
|
4189
|
+
this.offset += e.length;
|
|
4190
|
+
}
|
|
4191
|
+
else {
|
|
4192
|
+
const n = `Not a YAML token: ${e}`;
|
|
4193
|
+
yield* this.pop({ type: "error", offset: this.offset, message: n, source: e }), this.offset += e.length;
|
|
4194
|
+
}
|
|
4195
|
+
}
|
|
4196
|
+
/** Call at end of input to push out any remaining constructions */
|
|
4197
|
+
*end() {
|
|
4198
|
+
for (; this.stack.length > 0; )
|
|
4199
|
+
yield* this.pop();
|
|
4200
|
+
}
|
|
4201
|
+
get sourceToken() {
|
|
4202
|
+
return {
|
|
4203
|
+
type: this.type,
|
|
4204
|
+
offset: this.offset,
|
|
4205
|
+
indent: this.indent,
|
|
4206
|
+
source: this.source
|
|
4207
|
+
};
|
|
4208
|
+
}
|
|
4209
|
+
*step() {
|
|
4210
|
+
const e = this.peek(1);
|
|
4211
|
+
if (this.type === "doc-end" && e?.type !== "doc-end") {
|
|
4212
|
+
for (; this.stack.length > 0; )
|
|
4213
|
+
yield* this.pop();
|
|
4214
|
+
this.stack.push({
|
|
4215
|
+
type: "doc-end",
|
|
4216
|
+
offset: this.offset,
|
|
4217
|
+
source: this.source
|
|
4218
|
+
});
|
|
4219
|
+
return;
|
|
4220
|
+
}
|
|
4221
|
+
if (!e)
|
|
4222
|
+
return yield* this.stream();
|
|
4223
|
+
switch (e.type) {
|
|
4224
|
+
case "document":
|
|
4225
|
+
return yield* this.document(e);
|
|
4226
|
+
case "alias":
|
|
4227
|
+
case "scalar":
|
|
4228
|
+
case "single-quoted-scalar":
|
|
4229
|
+
case "double-quoted-scalar":
|
|
4230
|
+
return yield* this.scalar(e);
|
|
4231
|
+
case "block-scalar":
|
|
4232
|
+
return yield* this.blockScalar(e);
|
|
4233
|
+
case "block-map":
|
|
4234
|
+
return yield* this.blockMap(e);
|
|
4235
|
+
case "block-seq":
|
|
4236
|
+
return yield* this.blockSequence(e);
|
|
4237
|
+
case "flow-collection":
|
|
4238
|
+
return yield* this.flowCollection(e);
|
|
4239
|
+
case "doc-end":
|
|
4240
|
+
return yield* this.documentEnd(e);
|
|
4241
|
+
}
|
|
4242
|
+
yield* this.pop();
|
|
4243
|
+
}
|
|
4244
|
+
peek(e) {
|
|
4245
|
+
return this.stack[this.stack.length - e];
|
|
4246
|
+
}
|
|
4247
|
+
*pop(e) {
|
|
4248
|
+
const t = e ?? this.stack.pop();
|
|
4249
|
+
if (!t)
|
|
4250
|
+
yield { type: "error", offset: this.offset, source: "", message: "Tried to pop an empty stack" };
|
|
4251
|
+
else if (this.stack.length === 0)
|
|
4252
|
+
yield t;
|
|
4253
|
+
else {
|
|
4254
|
+
const n = this.peek(1);
|
|
4255
|
+
switch (t.type === "block-scalar" ? t.indent = "indent" in n ? n.indent : 0 : t.type === "flow-collection" && n.type === "document" && (t.indent = 0), t.type === "flow-collection" && Yt(t), n.type) {
|
|
4256
|
+
case "document":
|
|
4257
|
+
n.value = t;
|
|
4258
|
+
break;
|
|
4259
|
+
case "block-scalar":
|
|
4260
|
+
n.props.push(t);
|
|
4261
|
+
break;
|
|
4262
|
+
case "block-map": {
|
|
4263
|
+
const i = n.items[n.items.length - 1];
|
|
4264
|
+
if (i.value) {
|
|
4265
|
+
n.items.push({ start: [], key: t, sep: [] }), this.onKeyLine = !0;
|
|
4266
|
+
return;
|
|
4267
|
+
} else if (i.sep)
|
|
4268
|
+
i.value = t;
|
|
4269
|
+
else {
|
|
4270
|
+
Object.assign(i, { key: t, sep: [] }), this.onKeyLine = !i.explicitKey;
|
|
4271
|
+
return;
|
|
4272
|
+
}
|
|
4273
|
+
break;
|
|
4274
|
+
}
|
|
4275
|
+
case "block-seq": {
|
|
4276
|
+
const i = n.items[n.items.length - 1];
|
|
4277
|
+
i.value ? n.items.push({ start: [], value: t }) : i.value = t;
|
|
4278
|
+
break;
|
|
4279
|
+
}
|
|
4280
|
+
case "flow-collection": {
|
|
4281
|
+
const i = n.items[n.items.length - 1];
|
|
4282
|
+
!i || i.value ? n.items.push({ start: [], key: t, sep: [] }) : i.sep ? i.value = t : Object.assign(i, { key: t, sep: [] });
|
|
4283
|
+
return;
|
|
4284
|
+
}
|
|
4285
|
+
/* istanbul ignore next should not happen */
|
|
4286
|
+
default:
|
|
4287
|
+
yield* this.pop(), yield* this.pop(t);
|
|
4288
|
+
}
|
|
4289
|
+
if ((n.type === "document" || n.type === "block-map" || n.type === "block-seq") && (t.type === "block-map" || t.type === "block-seq")) {
|
|
4290
|
+
const i = t.items[t.items.length - 1];
|
|
4291
|
+
i && !i.sep && !i.value && i.start.length > 0 && Vt(i.start) === -1 && (t.indent === 0 || i.start.every((r) => r.type !== "comment" || r.indent < t.indent)) && (n.type === "document" ? n.end = i.start : n.items.push({ start: i.start }), t.items.splice(-1, 1));
|
|
4292
|
+
}
|
|
4293
|
+
}
|
|
4294
|
+
}
|
|
4295
|
+
*stream() {
|
|
4296
|
+
switch (this.type) {
|
|
4297
|
+
case "directive-line":
|
|
4298
|
+
yield { type: "directive", offset: this.offset, source: this.source };
|
|
4299
|
+
return;
|
|
4300
|
+
case "byte-order-mark":
|
|
4301
|
+
case "space":
|
|
4302
|
+
case "comment":
|
|
4303
|
+
case "newline":
|
|
4304
|
+
yield this.sourceToken;
|
|
4305
|
+
return;
|
|
4306
|
+
case "doc-mode":
|
|
4307
|
+
case "doc-start": {
|
|
4308
|
+
const e = {
|
|
4309
|
+
type: "document",
|
|
4310
|
+
offset: this.offset,
|
|
4311
|
+
start: []
|
|
4312
|
+
};
|
|
4313
|
+
this.type === "doc-start" && e.start.push(this.sourceToken), this.stack.push(e);
|
|
4314
|
+
return;
|
|
4315
|
+
}
|
|
4316
|
+
}
|
|
4317
|
+
yield {
|
|
4318
|
+
type: "error",
|
|
4319
|
+
offset: this.offset,
|
|
4320
|
+
message: `Unexpected ${this.type} token in YAML stream`,
|
|
4321
|
+
source: this.source
|
|
4322
|
+
};
|
|
4323
|
+
}
|
|
4324
|
+
*document(e) {
|
|
4325
|
+
if (e.value)
|
|
4326
|
+
return yield* this.lineEnd(e);
|
|
4327
|
+
switch (this.type) {
|
|
4328
|
+
case "doc-start": {
|
|
4329
|
+
Vt(e.start) !== -1 ? (yield* this.pop(), yield* this.step()) : e.start.push(this.sourceToken);
|
|
4330
|
+
return;
|
|
4331
|
+
}
|
|
4332
|
+
case "anchor":
|
|
4333
|
+
case "tag":
|
|
4334
|
+
case "space":
|
|
4335
|
+
case "comment":
|
|
4336
|
+
case "newline":
|
|
4337
|
+
e.start.push(this.sourceToken);
|
|
4338
|
+
return;
|
|
4339
|
+
}
|
|
4340
|
+
const t = this.startBlockValue(e);
|
|
4341
|
+
t ? this.stack.push(t) : yield {
|
|
4342
|
+
type: "error",
|
|
4343
|
+
offset: this.offset,
|
|
4344
|
+
message: `Unexpected ${this.type} token in YAML document`,
|
|
4345
|
+
source: this.source
|
|
4346
|
+
};
|
|
4347
|
+
}
|
|
4348
|
+
*scalar(e) {
|
|
4349
|
+
if (this.type === "map-value-ind") {
|
|
4350
|
+
const t = ve(this.peek(2)), n = ie(t);
|
|
4351
|
+
let i;
|
|
4352
|
+
e.end ? (i = e.end, i.push(this.sourceToken), delete e.end) : i = [this.sourceToken];
|
|
4353
|
+
const r = {
|
|
4354
|
+
type: "block-map",
|
|
4355
|
+
offset: e.offset,
|
|
4356
|
+
indent: e.indent,
|
|
4357
|
+
items: [{ start: n, key: e, sep: i }]
|
|
4358
|
+
};
|
|
4359
|
+
this.onKeyLine = !0, this.stack[this.stack.length - 1] = r;
|
|
4360
|
+
} else
|
|
4361
|
+
yield* this.lineEnd(e);
|
|
4362
|
+
}
|
|
4363
|
+
*blockScalar(e) {
|
|
4364
|
+
switch (this.type) {
|
|
4365
|
+
case "space":
|
|
4366
|
+
case "comment":
|
|
4367
|
+
case "newline":
|
|
4368
|
+
e.props.push(this.sourceToken);
|
|
4369
|
+
return;
|
|
4370
|
+
case "scalar":
|
|
4371
|
+
if (e.source = this.source, this.atNewLine = !0, this.indent = 0, this.onNewLine) {
|
|
4372
|
+
let t = this.source.indexOf(`
|
|
4373
|
+
`) + 1;
|
|
4374
|
+
for (; t !== 0; )
|
|
4375
|
+
this.onNewLine(this.offset + t), t = this.source.indexOf(`
|
|
4376
|
+
`, t) + 1;
|
|
4377
|
+
}
|
|
4378
|
+
yield* this.pop();
|
|
4379
|
+
break;
|
|
4380
|
+
/* istanbul ignore next should not happen */
|
|
4381
|
+
default:
|
|
4382
|
+
yield* this.pop(), yield* this.step();
|
|
4383
|
+
}
|
|
4384
|
+
}
|
|
4385
|
+
*blockMap(e) {
|
|
4386
|
+
const t = e.items[e.items.length - 1];
|
|
4387
|
+
switch (this.type) {
|
|
4388
|
+
case "newline":
|
|
4389
|
+
if (this.onKeyLine = !1, t.value) {
|
|
4390
|
+
const n = "end" in t.value ? t.value.end : void 0;
|
|
4391
|
+
(Array.isArray(n) ? n[n.length - 1] : void 0)?.type === "comment" ? n?.push(this.sourceToken) : e.items.push({ start: [this.sourceToken] });
|
|
4392
|
+
} else t.sep ? t.sep.push(this.sourceToken) : t.start.push(this.sourceToken);
|
|
4393
|
+
return;
|
|
4394
|
+
case "space":
|
|
4395
|
+
case "comment":
|
|
4396
|
+
if (t.value)
|
|
4397
|
+
e.items.push({ start: [this.sourceToken] });
|
|
4398
|
+
else if (t.sep)
|
|
4399
|
+
t.sep.push(this.sourceToken);
|
|
4400
|
+
else {
|
|
4401
|
+
if (this.atIndentedComment(t.start, e.indent)) {
|
|
4402
|
+
const i = e.items[e.items.length - 2]?.value?.end;
|
|
4403
|
+
if (Array.isArray(i)) {
|
|
4404
|
+
Array.prototype.push.apply(i, t.start), i.push(this.sourceToken), e.items.pop();
|
|
4405
|
+
return;
|
|
4406
|
+
}
|
|
4407
|
+
}
|
|
4408
|
+
t.start.push(this.sourceToken);
|
|
4409
|
+
}
|
|
4410
|
+
return;
|
|
4411
|
+
}
|
|
4412
|
+
if (this.indent >= e.indent) {
|
|
4413
|
+
const n = !this.onKeyLine && this.indent === e.indent, i = n && (t.sep || t.explicitKey) && this.type !== "seq-item-ind";
|
|
4414
|
+
let r = [];
|
|
4415
|
+
if (i && t.sep && !t.value) {
|
|
4416
|
+
const o = [];
|
|
4417
|
+
for (let l = 0; l < t.sep.length; ++l) {
|
|
4418
|
+
const a = t.sep[l];
|
|
4419
|
+
switch (a.type) {
|
|
4420
|
+
case "newline":
|
|
4421
|
+
o.push(l);
|
|
4422
|
+
break;
|
|
4423
|
+
case "space":
|
|
4424
|
+
break;
|
|
4425
|
+
case "comment":
|
|
4426
|
+
a.indent > e.indent && (o.length = 0);
|
|
4427
|
+
break;
|
|
4428
|
+
default:
|
|
4429
|
+
o.length = 0;
|
|
4430
|
+
}
|
|
4431
|
+
}
|
|
4432
|
+
o.length >= 2 && (r = t.sep.splice(o[1]));
|
|
4433
|
+
}
|
|
4434
|
+
switch (this.type) {
|
|
4435
|
+
case "anchor":
|
|
4436
|
+
case "tag":
|
|
4437
|
+
i || t.value ? (r.push(this.sourceToken), e.items.push({ start: r }), this.onKeyLine = !0) : t.sep ? t.sep.push(this.sourceToken) : t.start.push(this.sourceToken);
|
|
4438
|
+
return;
|
|
4439
|
+
case "explicit-key-ind":
|
|
4440
|
+
!t.sep && !t.explicitKey ? (t.start.push(this.sourceToken), t.explicitKey = !0) : i || t.value ? (r.push(this.sourceToken), e.items.push({ start: r, explicitKey: !0 })) : this.stack.push({
|
|
4441
|
+
type: "block-map",
|
|
4442
|
+
offset: this.offset,
|
|
4443
|
+
indent: this.indent,
|
|
4444
|
+
items: [{ start: [this.sourceToken], explicitKey: !0 }]
|
|
4445
|
+
}), this.onKeyLine = !0;
|
|
4446
|
+
return;
|
|
4447
|
+
case "map-value-ind":
|
|
4448
|
+
if (t.explicitKey)
|
|
4449
|
+
if (t.sep)
|
|
4450
|
+
if (t.value)
|
|
4451
|
+
e.items.push({ start: [], key: null, sep: [this.sourceToken] });
|
|
4452
|
+
else if (G(t.sep, "map-value-ind"))
|
|
4453
|
+
this.stack.push({
|
|
4454
|
+
type: "block-map",
|
|
4455
|
+
offset: this.offset,
|
|
4456
|
+
indent: this.indent,
|
|
4457
|
+
items: [{ start: r, key: null, sep: [this.sourceToken] }]
|
|
4458
|
+
});
|
|
4459
|
+
else if (Ps(t.key) && !G(t.sep, "newline")) {
|
|
4460
|
+
const o = ie(t.start), l = t.key, a = t.sep;
|
|
4461
|
+
a.push(this.sourceToken), delete t.key, delete t.sep, this.stack.push({
|
|
4462
|
+
type: "block-map",
|
|
4463
|
+
offset: this.offset,
|
|
4464
|
+
indent: this.indent,
|
|
4465
|
+
items: [{ start: o, key: l, sep: a }]
|
|
4466
|
+
});
|
|
4467
|
+
} else r.length > 0 ? t.sep = t.sep.concat(r, this.sourceToken) : t.sep.push(this.sourceToken);
|
|
4468
|
+
else if (G(t.start, "newline"))
|
|
4469
|
+
Object.assign(t, { key: null, sep: [this.sourceToken] });
|
|
4470
|
+
else {
|
|
4471
|
+
const o = ie(t.start);
|
|
4472
|
+
this.stack.push({
|
|
4473
|
+
type: "block-map",
|
|
4474
|
+
offset: this.offset,
|
|
4475
|
+
indent: this.indent,
|
|
4476
|
+
items: [{ start: o, key: null, sep: [this.sourceToken] }]
|
|
4477
|
+
});
|
|
4478
|
+
}
|
|
4479
|
+
else
|
|
4480
|
+
t.sep ? t.value || i ? e.items.push({ start: r, key: null, sep: [this.sourceToken] }) : G(t.sep, "map-value-ind") ? this.stack.push({
|
|
4481
|
+
type: "block-map",
|
|
4482
|
+
offset: this.offset,
|
|
4483
|
+
indent: this.indent,
|
|
4484
|
+
items: [{ start: [], key: null, sep: [this.sourceToken] }]
|
|
4485
|
+
}) : t.sep.push(this.sourceToken) : Object.assign(t, { key: null, sep: [this.sourceToken] });
|
|
4486
|
+
this.onKeyLine = !0;
|
|
4487
|
+
return;
|
|
4488
|
+
case "alias":
|
|
4489
|
+
case "scalar":
|
|
4490
|
+
case "single-quoted-scalar":
|
|
4491
|
+
case "double-quoted-scalar": {
|
|
4492
|
+
const o = this.flowScalar(this.type);
|
|
4493
|
+
i || t.value ? (e.items.push({ start: r, key: o, sep: [] }), this.onKeyLine = !0) : t.sep ? this.stack.push(o) : (Object.assign(t, { key: o, sep: [] }), this.onKeyLine = !0);
|
|
4494
|
+
return;
|
|
4495
|
+
}
|
|
4496
|
+
default: {
|
|
4497
|
+
const o = this.startBlockValue(e);
|
|
4498
|
+
if (o) {
|
|
4499
|
+
if (o.type === "block-seq") {
|
|
4500
|
+
if (!t.explicitKey && t.sep && !G(t.sep, "newline")) {
|
|
4501
|
+
yield* this.pop({
|
|
4502
|
+
type: "error",
|
|
4503
|
+
offset: this.offset,
|
|
4504
|
+
message: "Unexpected block-seq-ind on same line with key",
|
|
4505
|
+
source: this.source
|
|
4506
|
+
});
|
|
4507
|
+
return;
|
|
4508
|
+
}
|
|
4509
|
+
} else n && e.items.push({ start: r });
|
|
4510
|
+
this.stack.push(o);
|
|
4511
|
+
return;
|
|
4512
|
+
}
|
|
4513
|
+
}
|
|
4514
|
+
}
|
|
4515
|
+
}
|
|
4516
|
+
yield* this.pop(), yield* this.step();
|
|
4517
|
+
}
|
|
4518
|
+
*blockSequence(e) {
|
|
4519
|
+
const t = e.items[e.items.length - 1];
|
|
4520
|
+
switch (this.type) {
|
|
4521
|
+
case "newline":
|
|
4522
|
+
if (t.value) {
|
|
4523
|
+
const n = "end" in t.value ? t.value.end : void 0;
|
|
4524
|
+
(Array.isArray(n) ? n[n.length - 1] : void 0)?.type === "comment" ? n?.push(this.sourceToken) : e.items.push({ start: [this.sourceToken] });
|
|
4525
|
+
} else
|
|
4526
|
+
t.start.push(this.sourceToken);
|
|
4527
|
+
return;
|
|
4528
|
+
case "space":
|
|
4529
|
+
case "comment":
|
|
4530
|
+
if (t.value)
|
|
4531
|
+
e.items.push({ start: [this.sourceToken] });
|
|
4532
|
+
else {
|
|
4533
|
+
if (this.atIndentedComment(t.start, e.indent)) {
|
|
4534
|
+
const i = e.items[e.items.length - 2]?.value?.end;
|
|
4535
|
+
if (Array.isArray(i)) {
|
|
4536
|
+
Array.prototype.push.apply(i, t.start), i.push(this.sourceToken), e.items.pop();
|
|
4537
|
+
return;
|
|
4538
|
+
}
|
|
4539
|
+
}
|
|
4540
|
+
t.start.push(this.sourceToken);
|
|
4541
|
+
}
|
|
4542
|
+
return;
|
|
4543
|
+
case "anchor":
|
|
4544
|
+
case "tag":
|
|
4545
|
+
if (t.value || this.indent <= e.indent)
|
|
4546
|
+
break;
|
|
4547
|
+
t.start.push(this.sourceToken);
|
|
4548
|
+
return;
|
|
4549
|
+
case "seq-item-ind":
|
|
4550
|
+
if (this.indent !== e.indent)
|
|
4551
|
+
break;
|
|
4552
|
+
t.value || G(t.start, "seq-item-ind") ? e.items.push({ start: [this.sourceToken] }) : t.start.push(this.sourceToken);
|
|
4553
|
+
return;
|
|
4554
|
+
}
|
|
4555
|
+
if (this.indent > e.indent) {
|
|
4556
|
+
const n = this.startBlockValue(e);
|
|
4557
|
+
if (n) {
|
|
4558
|
+
this.stack.push(n);
|
|
4559
|
+
return;
|
|
4560
|
+
}
|
|
4561
|
+
}
|
|
4562
|
+
yield* this.pop(), yield* this.step();
|
|
4563
|
+
}
|
|
4564
|
+
*flowCollection(e) {
|
|
4565
|
+
const t = e.items[e.items.length - 1];
|
|
4566
|
+
if (this.type === "flow-error-end") {
|
|
4567
|
+
let n;
|
|
4568
|
+
do
|
|
4569
|
+
yield* this.pop(), n = this.peek(1);
|
|
4570
|
+
while (n?.type === "flow-collection");
|
|
4571
|
+
} else if (e.end.length === 0) {
|
|
4572
|
+
switch (this.type) {
|
|
4573
|
+
case "comma":
|
|
4574
|
+
case "explicit-key-ind":
|
|
4575
|
+
!t || t.sep ? e.items.push({ start: [this.sourceToken] }) : t.start.push(this.sourceToken);
|
|
4576
|
+
return;
|
|
4577
|
+
case "map-value-ind":
|
|
4578
|
+
!t || t.value ? e.items.push({ start: [], key: null, sep: [this.sourceToken] }) : t.sep ? t.sep.push(this.sourceToken) : Object.assign(t, { key: null, sep: [this.sourceToken] });
|
|
4579
|
+
return;
|
|
4580
|
+
case "space":
|
|
4581
|
+
case "comment":
|
|
4582
|
+
case "newline":
|
|
4583
|
+
case "anchor":
|
|
4584
|
+
case "tag":
|
|
4585
|
+
!t || t.value ? e.items.push({ start: [this.sourceToken] }) : t.sep ? t.sep.push(this.sourceToken) : t.start.push(this.sourceToken);
|
|
4586
|
+
return;
|
|
4587
|
+
case "alias":
|
|
4588
|
+
case "scalar":
|
|
4589
|
+
case "single-quoted-scalar":
|
|
4590
|
+
case "double-quoted-scalar": {
|
|
4591
|
+
const i = this.flowScalar(this.type);
|
|
4592
|
+
!t || t.value ? e.items.push({ start: [], key: i, sep: [] }) : t.sep ? this.stack.push(i) : Object.assign(t, { key: i, sep: [] });
|
|
4593
|
+
return;
|
|
4594
|
+
}
|
|
4595
|
+
case "flow-map-end":
|
|
4596
|
+
case "flow-seq-end":
|
|
4597
|
+
e.end.push(this.sourceToken);
|
|
4598
|
+
return;
|
|
4599
|
+
}
|
|
4600
|
+
const n = this.startBlockValue(e);
|
|
4601
|
+
n ? this.stack.push(n) : (yield* this.pop(), yield* this.step());
|
|
4602
|
+
} else {
|
|
4603
|
+
const n = this.peek(2);
|
|
4604
|
+
if (n.type === "block-map" && (this.type === "map-value-ind" && n.indent === e.indent || this.type === "newline" && !n.items[n.items.length - 1].sep))
|
|
4605
|
+
yield* this.pop(), yield* this.step();
|
|
4606
|
+
else if (this.type === "map-value-ind" && n.type !== "flow-collection") {
|
|
4607
|
+
const i = ve(n), r = ie(i);
|
|
4608
|
+
Yt(e);
|
|
4609
|
+
const o = e.end.splice(1, e.end.length);
|
|
4610
|
+
o.push(this.sourceToken);
|
|
4611
|
+
const l = {
|
|
4612
|
+
type: "block-map",
|
|
4613
|
+
offset: e.offset,
|
|
4614
|
+
indent: e.indent,
|
|
4615
|
+
items: [{ start: r, key: e, sep: o }]
|
|
4616
|
+
};
|
|
4617
|
+
this.onKeyLine = !0, this.stack[this.stack.length - 1] = l;
|
|
4618
|
+
} else
|
|
4619
|
+
yield* this.lineEnd(e);
|
|
4620
|
+
}
|
|
4621
|
+
}
|
|
4622
|
+
flowScalar(e) {
|
|
4623
|
+
if (this.onNewLine) {
|
|
4624
|
+
let t = this.source.indexOf(`
|
|
4625
|
+
`) + 1;
|
|
4626
|
+
for (; t !== 0; )
|
|
4627
|
+
this.onNewLine(this.offset + t), t = this.source.indexOf(`
|
|
4628
|
+
`, t) + 1;
|
|
4629
|
+
}
|
|
4630
|
+
return {
|
|
4631
|
+
type: e,
|
|
4632
|
+
offset: this.offset,
|
|
4633
|
+
indent: this.indent,
|
|
4634
|
+
source: this.source
|
|
4635
|
+
};
|
|
4636
|
+
}
|
|
4637
|
+
startBlockValue(e) {
|
|
4638
|
+
switch (this.type) {
|
|
4639
|
+
case "alias":
|
|
4640
|
+
case "scalar":
|
|
4641
|
+
case "single-quoted-scalar":
|
|
4642
|
+
case "double-quoted-scalar":
|
|
4643
|
+
return this.flowScalar(this.type);
|
|
4644
|
+
case "block-scalar-header":
|
|
4645
|
+
return {
|
|
4646
|
+
type: "block-scalar",
|
|
4647
|
+
offset: this.offset,
|
|
4648
|
+
indent: this.indent,
|
|
4649
|
+
props: [this.sourceToken],
|
|
4650
|
+
source: ""
|
|
4651
|
+
};
|
|
4652
|
+
case "flow-map-start":
|
|
4653
|
+
case "flow-seq-start":
|
|
4654
|
+
return {
|
|
4655
|
+
type: "flow-collection",
|
|
4656
|
+
offset: this.offset,
|
|
4657
|
+
indent: this.indent,
|
|
4658
|
+
start: this.sourceToken,
|
|
4659
|
+
items: [],
|
|
4660
|
+
end: []
|
|
4661
|
+
};
|
|
4662
|
+
case "seq-item-ind":
|
|
4663
|
+
return {
|
|
4664
|
+
type: "block-seq",
|
|
4665
|
+
offset: this.offset,
|
|
4666
|
+
indent: this.indent,
|
|
4667
|
+
items: [{ start: [this.sourceToken] }]
|
|
4668
|
+
};
|
|
4669
|
+
case "explicit-key-ind": {
|
|
4670
|
+
this.onKeyLine = !0;
|
|
4671
|
+
const t = ve(e), n = ie(t);
|
|
4672
|
+
return n.push(this.sourceToken), {
|
|
4673
|
+
type: "block-map",
|
|
4674
|
+
offset: this.offset,
|
|
4675
|
+
indent: this.indent,
|
|
4676
|
+
items: [{ start: n, explicitKey: !0 }]
|
|
4677
|
+
};
|
|
4678
|
+
}
|
|
4679
|
+
case "map-value-ind": {
|
|
4680
|
+
this.onKeyLine = !0;
|
|
4681
|
+
const t = ve(e), n = ie(t);
|
|
4682
|
+
return {
|
|
4683
|
+
type: "block-map",
|
|
4684
|
+
offset: this.offset,
|
|
4685
|
+
indent: this.indent,
|
|
4686
|
+
items: [{ start: n, key: null, sep: [this.sourceToken] }]
|
|
4687
|
+
};
|
|
4688
|
+
}
|
|
4689
|
+
}
|
|
4690
|
+
return null;
|
|
4691
|
+
}
|
|
4692
|
+
atIndentedComment(e, t) {
|
|
4693
|
+
return this.type !== "comment" || this.indent <= t ? !1 : e.every((n) => n.type === "newline" || n.type === "space");
|
|
4694
|
+
}
|
|
4695
|
+
*documentEnd(e) {
|
|
4696
|
+
this.type !== "doc-mode" && (e.end ? e.end.push(this.sourceToken) : e.end = [this.sourceToken], this.type === "newline" && (yield* this.pop()));
|
|
4697
|
+
}
|
|
4698
|
+
*lineEnd(e) {
|
|
4699
|
+
switch (this.type) {
|
|
4700
|
+
case "comma":
|
|
4701
|
+
case "doc-start":
|
|
4702
|
+
case "doc-end":
|
|
4703
|
+
case "flow-seq-end":
|
|
4704
|
+
case "flow-map-end":
|
|
4705
|
+
case "map-value-ind":
|
|
4706
|
+
yield* this.pop(), yield* this.step();
|
|
4707
|
+
break;
|
|
4708
|
+
case "newline":
|
|
4709
|
+
this.onKeyLine = !1;
|
|
4710
|
+
default:
|
|
4711
|
+
e.end ? e.end.push(this.sourceToken) : e.end = [this.sourceToken], this.type === "newline" && (yield* this.pop());
|
|
4712
|
+
}
|
|
4713
|
+
}
|
|
4714
|
+
}
|
|
4715
|
+
function Ds(s) {
|
|
4716
|
+
const e = s.prettyErrors !== !1;
|
|
4717
|
+
return { lineCounter: s.lineCounter || e && new js() || null, prettyErrors: e };
|
|
4718
|
+
}
|
|
4719
|
+
function hi(s, e = {}) {
|
|
4720
|
+
const { lineCounter: t, prettyErrors: n } = Ds(e), i = new $t(t?.addNewLine), r = new Lt(e), o = Array.from(r.compose(i.parse(s)));
|
|
4721
|
+
if (n && t)
|
|
4722
|
+
for (const l of o)
|
|
4723
|
+
l.errors.forEach(qe(s, t)), l.warnings.forEach(qe(s, t));
|
|
4724
|
+
return o.length > 0 ? o : Object.assign([], { empty: !0 }, r.streamInfo());
|
|
4725
|
+
}
|
|
4726
|
+
function qs(s, e = {}) {
|
|
4727
|
+
const { lineCounter: t, prettyErrors: n } = Ds(e), i = new $t(t?.addNewLine), r = new Lt(e);
|
|
4728
|
+
let o = null;
|
|
4729
|
+
for (const l of r.compose(i.parse(s), !0, s.length))
|
|
4730
|
+
if (!o)
|
|
4731
|
+
o = l;
|
|
4732
|
+
else if (o.options.logLevel !== "silent") {
|
|
4733
|
+
o.errors.push(new x(l.range.slice(0, 2), "MULTIPLE_DOCS", "Source contains multiple documents; please use YAML.parseAllDocuments()"));
|
|
4734
|
+
break;
|
|
4735
|
+
}
|
|
4736
|
+
return n && t && (o.errors.forEach(qe(s, t)), o.warnings.forEach(qe(s, t))), o;
|
|
4737
|
+
}
|
|
4738
|
+
function di(s, e, t) {
|
|
4739
|
+
let n;
|
|
4740
|
+
typeof e == "function" ? n = e : t === void 0 && e && typeof e == "object" && (t = e);
|
|
4741
|
+
const i = qs(s, t);
|
|
4742
|
+
if (!i)
|
|
4743
|
+
return null;
|
|
4744
|
+
if (i.warnings.forEach((r) => rs(i.options.logLevel, r)), i.errors.length > 0) {
|
|
4745
|
+
if (i.options.logLevel !== "silent")
|
|
4746
|
+
throw i.errors[0];
|
|
4747
|
+
i.errors = [];
|
|
4748
|
+
}
|
|
4749
|
+
return i.toJS(Object.assign({ reviver: n }, t));
|
|
4750
|
+
}
|
|
4751
|
+
function pi(s, e, t) {
|
|
4752
|
+
let n = null;
|
|
4753
|
+
if (typeof e == "function" || Array.isArray(e) ? n = e : t === void 0 && e && (t = e), typeof t == "string" && (t = t.length), typeof t == "number") {
|
|
4754
|
+
const i = Math.round(t);
|
|
4755
|
+
t = i < 1 ? void 0 : i > 8 ? { indent: 8 } : { indent: i };
|
|
4756
|
+
}
|
|
4757
|
+
if (s === void 0) {
|
|
4758
|
+
const { keepUndefined: i } = t ?? e ?? {};
|
|
4759
|
+
if (!i)
|
|
4760
|
+
return;
|
|
4761
|
+
}
|
|
4762
|
+
return ee(s) && !n ? s.toString(t) : new be(s, n, t).toString(t);
|
|
4763
|
+
}
|
|
4764
|
+
const Jt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4765
|
+
__proto__: null,
|
|
4766
|
+
Alias: Ue,
|
|
4767
|
+
CST: ci,
|
|
4768
|
+
Composer: Lt,
|
|
4769
|
+
Document: be,
|
|
4770
|
+
Lexer: Ks,
|
|
4771
|
+
LineCounter: js,
|
|
4772
|
+
Pair: v,
|
|
4773
|
+
Parser: $t,
|
|
4774
|
+
Scalar: N,
|
|
4775
|
+
Schema: ze,
|
|
4776
|
+
YAMLError: Et,
|
|
4777
|
+
YAMLMap: K,
|
|
4778
|
+
YAMLParseError: x,
|
|
4779
|
+
YAMLSeq: Q,
|
|
4780
|
+
YAMLWarning: As,
|
|
4781
|
+
isAlias: H,
|
|
4782
|
+
isCollection: L,
|
|
4783
|
+
isDocument: ee,
|
|
4784
|
+
isMap: pe,
|
|
4785
|
+
isNode: $,
|
|
4786
|
+
isPair: T,
|
|
4787
|
+
isScalar: I,
|
|
4788
|
+
isSeq: me,
|
|
4789
|
+
parse: di,
|
|
4790
|
+
parseAllDocuments: hi,
|
|
4791
|
+
parseDocument: qs,
|
|
4792
|
+
stringify: pi,
|
|
4793
|
+
visit: te,
|
|
4794
|
+
visitAsync: Re
|
|
4795
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
4796
|
+
function wi() {
|
|
4797
|
+
const { adminClient: s } = Rs(), { t: e } = rn(), t = on(), { realm: n } = Us(), { addAlert: i, addError: r } = Vs(), { mode: o, id: l } = Ys(), a = Js({
|
|
4798
|
+
mode: "onChange",
|
|
4799
|
+
defaultValues: {
|
|
4800
|
+
workflowYAML: ""
|
|
4801
|
+
}
|
|
4802
|
+
}), { control: c, handleSubmit: d, setValue: f } = a;
|
|
4803
|
+
Gs(
|
|
4804
|
+
async () => {
|
|
4805
|
+
if (o !== "create")
|
|
4806
|
+
return s.workflows.findOne({
|
|
4807
|
+
id: l,
|
|
4808
|
+
includeId: !1
|
|
4809
|
+
});
|
|
4810
|
+
},
|
|
4811
|
+
(y) => {
|
|
4812
|
+
if (!y)
|
|
4813
|
+
return;
|
|
4814
|
+
const g = { ...y };
|
|
4815
|
+
o === "copy" && (delete g.id, g.name = `${y.name} -- ${e("copy")}`), f("workflowYAML", Jt.stringify(g));
|
|
4816
|
+
},
|
|
4817
|
+
[o, l, f, e]
|
|
4818
|
+
);
|
|
4819
|
+
const u = (y) => {
|
|
4820
|
+
const g = Jt.parse(y);
|
|
4821
|
+
if (!g.name)
|
|
4822
|
+
throw new Error(e("workflowNameRequired"));
|
|
4823
|
+
return g;
|
|
4824
|
+
}, m = async (y) => {
|
|
4825
|
+
try {
|
|
4826
|
+
const g = u(y.workflowYAML);
|
|
4827
|
+
await s.workflows.update({ id: l }, g), i(e("workflowUpdated"), Mt.success);
|
|
4828
|
+
} catch (g) {
|
|
4829
|
+
r("workflowUpdateError", g);
|
|
4830
|
+
}
|
|
4831
|
+
}, b = async (y) => {
|
|
4832
|
+
try {
|
|
4833
|
+
await s.workflows.createAsYaml({
|
|
4834
|
+
realm: n,
|
|
4835
|
+
yaml: y.workflowYAML
|
|
4836
|
+
}), i(e("workflowCreated"), Mt.success), t(vt({ realm: n }));
|
|
4837
|
+
} catch (g) {
|
|
4838
|
+
r("workflowCreateError", g);
|
|
4839
|
+
}
|
|
4840
|
+
}, h = {
|
|
4841
|
+
copy: "copyWorkflow",
|
|
4842
|
+
create: "createWorkflow",
|
|
4843
|
+
update: "updateWorkflow"
|
|
4844
|
+
}, p = {
|
|
4845
|
+
copy: "copyWorkflowDetails",
|
|
4846
|
+
create: "createWorkflowDetails",
|
|
4847
|
+
update: "updateWorkflowDetails"
|
|
4848
|
+
};
|
|
4849
|
+
return /* @__PURE__ */ tt(Fs, { children: [
|
|
4850
|
+
/* @__PURE__ */ j(Ws, { titleKey: h[o], subKey: p[o] }),
|
|
4851
|
+
/* @__PURE__ */ j(Qs, { ...a, children: /* @__PURE__ */ j(Hs, { variant: "light", children: /* @__PURE__ */ tt(
|
|
4852
|
+
Xs,
|
|
4853
|
+
{
|
|
4854
|
+
isHorizontal: !0,
|
|
4855
|
+
onSubmit: d(o === "update" ? m : b),
|
|
4856
|
+
role: "manage-realm",
|
|
4857
|
+
className: "pf-v5-u-mt-lg",
|
|
4858
|
+
fineGrainedAccess: !0,
|
|
4859
|
+
children: [
|
|
4860
|
+
/* @__PURE__ */ j(
|
|
4861
|
+
zs,
|
|
4862
|
+
{
|
|
4863
|
+
label: e("workflowYAML"),
|
|
4864
|
+
labelIcon: /* @__PURE__ */ j(
|
|
4865
|
+
en,
|
|
4866
|
+
{
|
|
4867
|
+
helpText: e("workflowYAMLHelp"),
|
|
4868
|
+
fieldLabelId: "code"
|
|
4869
|
+
}
|
|
4870
|
+
),
|
|
4871
|
+
fieldId: "code",
|
|
4872
|
+
isRequired: !0,
|
|
4873
|
+
children: /* @__PURE__ */ j(
|
|
4874
|
+
xs,
|
|
4875
|
+
{
|
|
4876
|
+
name: "workflowYAML",
|
|
4877
|
+
control: c,
|
|
4878
|
+
render: ({ field: y }) => /* @__PURE__ */ j(
|
|
4879
|
+
Zs,
|
|
4880
|
+
{
|
|
4881
|
+
id: "workflowYAML",
|
|
4882
|
+
"data-testid": "workflowYAML",
|
|
4883
|
+
value: y.value,
|
|
4884
|
+
onChange: y.onChange,
|
|
4885
|
+
language: "yaml",
|
|
4886
|
+
height: 600
|
|
4887
|
+
}
|
|
4888
|
+
)
|
|
4889
|
+
}
|
|
4890
|
+
)
|
|
4891
|
+
}
|
|
4892
|
+
),
|
|
4893
|
+
/* @__PURE__ */ tt(tn, { children: [
|
|
4894
|
+
/* @__PURE__ */ j(
|
|
4895
|
+
sn,
|
|
4896
|
+
{
|
|
4897
|
+
formState: a.formState,
|
|
4898
|
+
"data-testid": "save",
|
|
4899
|
+
allowInvalid: !0,
|
|
4900
|
+
allowNonDirty: !0,
|
|
4901
|
+
isDisabled: o === "create" && !a.formState.isDirty,
|
|
4902
|
+
children: e(o === "update" ? "save" : "create")
|
|
4903
|
+
}
|
|
4904
|
+
),
|
|
4905
|
+
o === "update" && /* @__PURE__ */ j(
|
|
4906
|
+
_t,
|
|
4907
|
+
{
|
|
4908
|
+
"data-testid": "copy",
|
|
4909
|
+
variant: "link",
|
|
4910
|
+
component: (y) => /* @__PURE__ */ j(
|
|
4911
|
+
Bt,
|
|
4912
|
+
{
|
|
4913
|
+
...y,
|
|
4914
|
+
to: nn({ realm: n, mode: "copy", id: l })
|
|
4915
|
+
}
|
|
4916
|
+
),
|
|
4917
|
+
children: e("copy")
|
|
4918
|
+
}
|
|
4919
|
+
),
|
|
4920
|
+
/* @__PURE__ */ j(
|
|
4921
|
+
_t,
|
|
4922
|
+
{
|
|
4923
|
+
"data-testid": "cancel",
|
|
4924
|
+
variant: "link",
|
|
4925
|
+
component: (y) => /* @__PURE__ */ j(Bt, { ...y, to: vt({ realm: n }) }),
|
|
4926
|
+
children: e("cancel")
|
|
4927
|
+
}
|
|
4928
|
+
)
|
|
4929
|
+
] })
|
|
4930
|
+
]
|
|
4931
|
+
}
|
|
4932
|
+
) }) })
|
|
4933
|
+
] });
|
|
4934
|
+
}
|
|
4935
|
+
export {
|
|
4936
|
+
wi as default
|
|
4937
|
+
};
|
|
4938
|
+
//# sourceMappingURL=WorkflowDetailForm-alfgEItU.js.map
|