@nfdi4plants/arctrl 3.0.0 → 3.0.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.
Files changed (35) hide show
  1. package/dist/ts/ts/CWL/Decode.d.ts +15 -11
  2. package/dist/ts/ts/CWL/Decode.d.ts.map +1 -1
  3. package/dist/ts/ts/CWL/Decode.js +73 -23
  4. package/dist/ts/ts/CWL/Encode.d.ts +8 -1
  5. package/dist/ts/ts/CWL/Encode.d.ts.map +1 -1
  6. package/dist/ts/ts/CWL/Encode.js +15 -11
  7. package/dist/ts/ts/CWL/Requirements.d.ts +1 -1
  8. package/dist/ts/ts/CWL/Requirements.js +1 -1
  9. package/dist/ts/ts/CWL/WorkflowSteps.d.ts +1 -1
  10. package/dist/ts/ts/CWL/WorkflowSteps.js +1 -1
  11. package/dist/ts/ts/Conversion/Workflow.js +3 -3
  12. package/dist/ts/ts/Yaml/ValidationPackage.d.ts +1 -1
  13. package/dist/ts/ts/Yaml/ValidationPackage.js +6 -6
  14. package/dist/ts/ts/Yaml/ValidationPackagesConfig.d.ts +1 -1
  15. package/dist/ts/ts/Yaml/ValidationPackagesConfig.js +6 -6
  16. package/dist/ts/ts/Yaml.js +1 -1
  17. package/dist/ts/ts/fable_modules/{YAMLicious.1.0.0-alpha.3 → YAMLicious.1.0.0-alpha.4}/Encode.fs.js +9 -9
  18. package/dist/ts/ts/fable_modules/YAMLicious.1.0.0-alpha.4/Escapes.fs.js +313 -0
  19. package/dist/ts/ts/fable_modules/{YAMLicious.1.0.0-alpha.3 → YAMLicious.1.0.0-alpha.4}/FlowToBlock.fs.js +14 -12
  20. package/dist/ts/ts/fable_modules/YAMLicious.1.0.0-alpha.4/Persil.fs.js +562 -0
  21. package/dist/ts/ts/fable_modules/{YAMLicious.1.0.0-alpha.3 → YAMLicious.1.0.0-alpha.4}/Preprocessing.fs.js +52 -12
  22. package/dist/ts/ts/fable_modules/YAMLicious.1.0.0-alpha.4/Reader.fs.js +1314 -0
  23. package/dist/ts/ts/fable_modules/{YAMLicious.1.0.0-alpha.3 → YAMLicious.1.0.0-alpha.4}/Regex.fs.js +7 -1
  24. package/dist/ts/ts/fable_modules/YAMLicious.1.0.0-alpha.4/RegexActivePatterns.fs.js +313 -0
  25. package/dist/ts/ts/fable_modules/YAMLicious.1.0.0-alpha.4/StringBuffer.fs.js +60 -0
  26. package/dist/ts/ts/fable_modules/YAMLicious.1.0.0-alpha.4/Writer.fs.js +391 -0
  27. package/dist/ts/ts/fable_modules/YAMLicious.1.0.0-alpha.4/YAMLiciousTypes.fs.js +317 -0
  28. package/package.json +1 -1
  29. package/dist/ts/ts/fable_modules/YAMLicious.1.0.0-alpha.3/Persil.fs.js +0 -45
  30. package/dist/ts/ts/fable_modules/YAMLicious.1.0.0-alpha.3/Reader.fs.js +0 -539
  31. package/dist/ts/ts/fable_modules/YAMLicious.1.0.0-alpha.3/RegexActivePatterns.fs.js +0 -216
  32. package/dist/ts/ts/fable_modules/YAMLicious.1.0.0-alpha.3/Writer.fs.js +0 -164
  33. package/dist/ts/ts/fable_modules/YAMLicious.1.0.0-alpha.3/YAMLiciousTypes.fs.js +0 -152
  34. /package/dist/ts/ts/fable_modules/{YAMLicious.1.0.0-alpha.3 → YAMLicious.1.0.0-alpha.4}/Decode.fs.js +0 -0
  35. /package/dist/ts/ts/fable_modules/{YAMLicious.1.0.0-alpha.3 → YAMLicious.1.0.0-alpha.4}/Interop/JsInterop.fs.js +0 -0
@@ -0,0 +1,1314 @@
1
+ import { unescapeDoubleQuoted } from './Escapes.fs.js';
2
+ import { BlockScalarStyle_Folded, BlockScalarStyle_Literal, ChompingMode_Clip, ChompingMode_Strip, ChompingMode_Keep, PreprocessorElement_Line, YAMLElement_Object, ScalarStyle_DoubleQuoted, ScalarStyle_SingleQuoted, YAMLElement_Value, YAMLContent_create_Z1C3A29C9, ScalarStyle_Block, YAMLElement_Comment, YAMLElement_Mapping, YAMLElement_Sequence, YAMLElement_Nil, YAMLElement_Alias } from './YAMLiciousTypes.fs.js';
3
+ import { match, create, replace } from '../../../node_modules/@fable-org/fable-library-js/RegExp.js';
4
+ import { parse } from '../../../node_modules/@fable-org/fable-library-js/Int32.js';
5
+ import { value, map as map$1, unwrap } from '../../../node_modules/@fable-org/fable-library-js/Option.js';
6
+ import { getItemFromDict } from '../../../node_modules/@fable-org/fable-library-js/MapUtil.js';
7
+ import { equals, comparePrimitives } from '../../../node_modules/@fable-org/fable-library-js/Util.js';
8
+ import { isNullOrWhiteSpace, trimEnd, substring, join, toFail, printf, trimStart, split, replace as replace$1 } from '../../../node_modules/@fable-org/fable-library-js/String.js';
9
+ import { length, takeWhile, toList, delay, append, singleton, skipWhile, map as map$2, collect as collect$1 } from '../../../node_modules/@fable-org/fable-library-js/Seq.js';
10
+ import { min } from '../../../node_modules/@fable-org/fable-library-js/Double.js';
11
+ import { toArray, map, filter, min as min$1, isEmpty, head, tail, empty, singleton as singleton$1, cons, collect, reverse, append as append$1, ofArrayWithTail, exists, forAll, ofArray } from '../../../node_modules/@fable-org/fable-library-js/List.js';
12
+ import { StringBuffer_$ctor, StringBuffer__Append_244C7CD6, StringBuffer__Append_Z721C83C5 } from './StringBuffer.fs.js';
13
+ import { item, tryHead } from '../../../node_modules/@fable-org/fable-library-js/Array.js';
14
+ import { toString } from '../../../node_modules/@fable-org/fable-library-js/Types.js';
15
+ import { $007CSequenceMinusOpener$007C_$007C, $007CYamlComment$007C_$007C, $007CAliasNode$007C_$007C, $007CDocumentEnd$007C_$007C, $007CSchemaNamespace$007C_$007C, $007CInlineSequence$007C_$007C, $007CSequenceSquareOpener$007C_$007C, $007CSequenceSquareCloser$007C_$007C, $007CInlineJSON$007C_$007C, $007CJSONKeyOpener$007C_$007C, $007CJSONCloser$007C_$007C, $007CExplicitKey$007C_$007C, $007CKey$007C_$007C, $007CKeyValue$007C_$007C, $007CYamlValue$007C_$007C, $007CExplicitValue$007C_$007C } from './RegexActivePatterns.fs.js';
16
+ import { defaultContext, transformElements, TransformContext } from './FlowToBlock.fs.js';
17
+ import { VerbatimTagPattern, AnchorPattern } from './Regex.fs.js';
18
+ import { tryFind } from '../../../node_modules/@fable-org/fable-library-js/Map.js';
19
+ import { read as read$1, isDocumentStart, isDocumentEnd } from './Preprocessing.fs.js';
20
+
21
+ function restoreScalarPlaceholderValue(entry) {
22
+ if (entry.Kind.tag === /* DoubleQuotedString */
23
+ 1) {
24
+ return unescapeDoubleQuoted(entry.Value);
25
+ } else {
26
+ return entry.Value;
27
+ }
28
+ }
29
+ function restoreBlockScalarPlaceholderValue(entry) {
30
+ if (entry.Kind.tag === /* DoubleQuotedString */
31
+ 1) {
32
+ return '"' + entry.Value + '"';
33
+ } else {
34
+ return "'" + entry.Value + "'";
35
+ }
36
+ }
37
+ function tryParseExactPlaceholderIndex(v) {
38
+ const m = match(create(`^${"<s f=(?<index>\\d+)\\/>"}$`), v.trim());
39
+ if (m != null) {
40
+ return parse(m.groups && m.groups.index || "", 511, false, 32);
41
+ } else {
42
+ return void 0;
43
+ }
44
+ }
45
+ function restoreStringReplace(stringDict, v) {
46
+ return replace(v, "<s f=(?<index>\\d+)\\/>", (m) => restoreScalarPlaceholderValue(getItemFromDict(stringDict, parse(m.groups && m.groups.index || "", 511, false, 32))));
47
+ }
48
+ function parseBlockScalarHeader(header) {
49
+ let c;
50
+ const h = header.trim();
51
+ if (isNullOrWhiteSpace(h)) {
52
+ return void 0;
53
+ } else {
54
+ let styleOpt;
55
+ const matchValue = h[0];
56
+ styleOpt = matchValue === ">" ? BlockScalarStyle_Folded() : matchValue === "|" ? BlockScalarStyle_Literal() : void 0;
57
+ if (styleOpt != null) {
58
+ const style = value(styleOpt);
59
+ let indent = void 0;
60
+ let chomp = ChompingMode_Clip();
61
+ let isValid = true;
62
+ for (let i = 1; i <= h.length - 1; i++) {
63
+ const matchValue_1 = h[i];
64
+ if (c = matchValue_1, c >= "1" && c <= "9") {
65
+ if (indent != null) {
66
+ isValid = false;
67
+ } else {
68
+ indent = parse(matchValue_1, 511, false, 32);
69
+ }
70
+ } else {
71
+ switch (matchValue_1) {
72
+ case "+": {
73
+ if (!equals(chomp, ChompingMode_Clip())) {
74
+ isValid = false;
75
+ } else {
76
+ chomp = ChompingMode_Keep();
77
+ }
78
+ break;
79
+ }
80
+ case "-": {
81
+ if (!equals(chomp, ChompingMode_Clip())) {
82
+ isValid = false;
83
+ } else {
84
+ chomp = ChompingMode_Strip();
85
+ }
86
+ break;
87
+ }
88
+ default:
89
+ isValid = false;
90
+ }
91
+ }
92
+ }
93
+ if (isValid) {
94
+ return [style, indent, chomp];
95
+ } else {
96
+ return void 0;
97
+ }
98
+ } else {
99
+ return void 0;
100
+ }
101
+ }
102
+ }
103
+ function applyChomping(chomp, content) {
104
+ switch (chomp.tag) {
105
+ case /* Keep */
106
+ 2:
107
+ return content;
108
+ case /* Clip */
109
+ 1: {
110
+ const trimmed = trimEnd(content, "\r", "\n");
111
+ if (content.length > trimmed.length) {
112
+ return trimmed + "\n";
113
+ } else {
114
+ return trimmed;
115
+ }
116
+ }
117
+ default:
118
+ return trimEnd(content, "\r", "\n");
119
+ }
120
+ }
121
+ function countLeadingSpaces(line) {
122
+ return length(takeWhile((c) => c === " ", line.split("")));
123
+ }
124
+ function splitTrailingCommentPlaceholder(s) {
125
+ const m = match(create(`^(?<header>.*?)\\s*(?:${"<c f=(?<comment>\\d+)\\/>"})\\s*$`), s);
126
+ if (m != null) {
127
+ const header = trimEnd(m.groups && m.groups.header || "");
128
+ const commentGroup = m.groups && m.groups.comment;
129
+ return [header, commentGroup != null && (commentGroup || "") !== "" ? parse(commentGroup || "", 511, false, 32) : void 0];
130
+ } else {
131
+ return [trimEnd(s), void 0];
132
+ }
133
+ }
134
+ function stripBlockIndent(indent, line) {
135
+ if (line.trim() === "") {
136
+ return "";
137
+ } else {
138
+ return substring(line, min(indent, countLeadingSpaces(line)));
139
+ }
140
+ }
141
+ function foldLines(lines) {
142
+ const isMoreIndented = (line) => {
143
+ if (line.startsWith(" ")) {
144
+ return true;
145
+ } else {
146
+ return line.startsWith(" ");
147
+ }
148
+ };
149
+ const arr = toArray(lines);
150
+ const sb = StringBuffer_$ctor();
151
+ for (let i = 0; i <= arr.length - 1; i++) {
152
+ const line_1 = item(i, arr);
153
+ if (line_1.trim() === "") {
154
+ StringBuffer__Append_244C7CD6(sb, "\n");
155
+ } else {
156
+ StringBuffer__Append_Z721C83C5(sb, line_1);
157
+ if (i < arr.length - 1) {
158
+ const next = item(i + 1, arr);
159
+ if (next.trim() === "") {
160
+ StringBuffer__Append_244C7CD6(sb, "\n");
161
+ } else if (isMoreIndented(line_1) ? true : isMoreIndented(next)) {
162
+ StringBuffer__Append_244C7CD6(sb, "\n");
163
+ } else {
164
+ StringBuffer__Append_244C7CD6(sb, " ");
165
+ }
166
+ }
167
+ }
168
+ }
169
+ return toString(sb);
170
+ }
171
+ function deindentBlockLines(headerIndent, explicitIndent, lines) {
172
+ let contentIndent;
173
+ if (explicitIndent == null) {
174
+ const _arg = map(countLeadingSpaces, filter((l) => l.trim() !== "", lines));
175
+ contentIndent = isEmpty(_arg) ? headerIndent : min$1(_arg, {
176
+ Compare: comparePrimitives
177
+ });
178
+ } else {
179
+ contentIndent = headerIndent + value(explicitIndent);
180
+ }
181
+ return map((line_1) => stripBlockIndent(contentIndent, line_1), lines);
182
+ }
183
+ function buildBlockScalarContent(style, chomp, headerIndent, explicitIndent, lines) {
184
+ let folded;
185
+ const deindentedLines = deindentBlockLines(headerIndent, explicitIndent, lines);
186
+ return applyChomping(chomp, style.tag === /* Folded */
187
+ 1 ? (folded = foldLines(deindentedLines), folded.endsWith("\n") ? folded : folded + "\n") : isEmpty(deindentedLines) ? "" : join("\n", deindentedLines) + "\n");
188
+ }
189
+ function restoreCommentReplace(commentDict, commentId) {
190
+ return map$1((id) => getItemFromDict(commentDict, id), commentId);
191
+ }
192
+ function collectSequenceElements(eles) {
193
+ let matchResult, rest, v, yamlAstList;
194
+ if (!isEmpty(eles)) {
195
+ const activePatternResult = $007CSequenceMinusOpener$007C_$007C(head(eles));
196
+ if (activePatternResult != null) {
197
+ if (!isEmpty(tail(eles))) {
198
+ if (head(tail(eles)).tag === /* Intendation */
199
+ 1) {
200
+ matchResult = 0;
201
+ rest = tail(tail(eles));
202
+ v = value(activePatternResult);
203
+ yamlAstList = head(tail(eles)).fields[0];
204
+ } else {
205
+ matchResult = 1;
206
+ }
207
+ } else {
208
+ matchResult = 1;
209
+ }
210
+ } else {
211
+ matchResult = 1;
212
+ }
213
+ } else {
214
+ matchResult = 1;
215
+ }
216
+ switch (matchResult) {
217
+ case 0:
218
+ return toList(delay(() => append(v.Value != null ? singleton(cons(PreprocessorElement_Line(value(v.Value)), yamlAstList)) : singleton(yamlAstList), delay(() => collectSequenceElements(rest)))));
219
+ default:
220
+ if (isEmpty(eles)) {
221
+ return empty();
222
+ } else {
223
+ const activePatternResult_1 = $007CSequenceMinusOpener$007C_$007C(head(eles));
224
+ if (activePatternResult_1 != null) {
225
+ const v_1 = value(activePatternResult_1);
226
+ return toList(delay(() => append(v_1.Value != null ? singleton(singleton$1(PreprocessorElement_Line(value(v_1.Value)))) : singleton(empty()), delay(() => collectSequenceElements(tail(eles))))));
227
+ } else if ($007CYamlComment$007C_$007C(head(eles)) != null) {
228
+ return toList(delay(() => append(singleton(singleton$1(head(eles))), delay(() => collectSequenceElements(tail(eles))))));
229
+ } else {
230
+ return toFail(printf("Unknown pattern for sequence elements: %A"))(eles);
231
+ }
232
+ }
233
+ }
234
+ }
235
+ function isSequenceElement(e) {
236
+ let matchResult;
237
+ if (e.tag === /* Intendation */
238
+ 1) {
239
+ matchResult = 0;
240
+ } else if ($007CSequenceMinusOpener$007C_$007C(e) != null) {
241
+ matchResult = 0;
242
+ } else if ($007CYamlComment$007C_$007C(e) != null) {
243
+ matchResult = 0;
244
+ } else {
245
+ matchResult = 1;
246
+ }
247
+ switch (matchResult) {
248
+ case 0:
249
+ return true;
250
+ default:
251
+ return false;
252
+ }
253
+ }
254
+ function tokenize(yamlList, stringDict, commentDict, handles) {
255
+ const ctx = defaultContext(stringDict);
256
+ const restoreInlinePlaceholders = (line) => replace(replace(line, "<s f=(?<index>\\d+)\\/>", (m) => restoreBlockScalarPlaceholderValue(getItemFromDict(stringDict, parse(m.groups && m.groups.index || "", 511, false, 32)))), "<c f=(?<comment>\\d+)\\/>", (m_1) => "#" + getItemFromDict(commentDict, parse(m_1.groups && m_1.groups.comment || "", 511, false, 32)));
257
+ const flattenBlockScalarWithDepth = (depth, eles) => collect((_arg) => {
258
+ switch (_arg.tag) {
259
+ case /* Line */
260
+ 2: {
261
+ const s = _arg.fields[0];
262
+ return singleton$1((s === "" ? "" : Array(depth * 2 + 1).join(" ")) + restoreInlinePlaceholders(s));
263
+ }
264
+ case /* Intendation */
265
+ 1:
266
+ return flattenBlockScalarWithDepth(depth + 1, _arg.fields[0]);
267
+ default:
268
+ return empty();
269
+ }
270
+ }, eles);
271
+ const flattenBlockScalar = (eles_1) => flattenBlockScalarWithDepth(0, eles_1);
272
+ const flattenBlockScalarContentWithDepth = (depth_1, eles_2) => collect((_arg_1) => {
273
+ switch (_arg_1.tag) {
274
+ case /* Line */
275
+ 2: {
276
+ const s_1 = _arg_1.fields[0];
277
+ return singleton$1((s_1 === "" ? "" : Array((depth_1 + 1) * 2 + 1).join(" ")) + restoreInlinePlaceholders(s_1));
278
+ }
279
+ case /* Intendation */
280
+ 1:
281
+ return flattenBlockScalarContentWithDepth(depth_1 + 1, _arg_1.fields[0]);
282
+ default:
283
+ return empty();
284
+ }
285
+ }, eles_2);
286
+ const extractProperties = (handles_2, v) => {
287
+ let shorthand, m_2, handle, suffix, matchValue_2;
288
+ let current = v.trim();
289
+ let tag = void 0;
290
+ let anchor = void 0;
291
+ let changed = true;
292
+ while (changed) {
293
+ changed = false;
294
+ const mTag = match(create(VerbatimTagPattern), current);
295
+ if (mTag != null) {
296
+ tag = mTag.groups && mTag.groups.tag || "";
297
+ current = substring(current, mTag[0].length).trim();
298
+ changed = true;
299
+ } else {
300
+ const mShort = match(/^(!\S*)/gu, current);
301
+ if (mShort != null) {
302
+ const raw_1 = mShort[1] || "";
303
+ tag = (shorthand = raw_1, shorthand === "!" ? "!" : (m_2 = match(/^(![\w-]+!|!!|!)(.*)/gu, shorthand), m_2 != null ? (handle = m_2[1] || "", suffix = m_2[2] || "", matchValue_2 = tryFind(handle, handles_2), matchValue_2 == null ? shorthand : value(matchValue_2) + suffix) : shorthand));
304
+ current = substring(current, mShort[0].length).trim();
305
+ changed = true;
306
+ }
307
+ }
308
+ const mAnchor = match(create(AnchorPattern), current);
309
+ if (mAnchor != null && current.startsWith("&")) {
310
+ anchor = mAnchor.groups && mAnchor.groups.anchor || "";
311
+ current = substring(current, mAnchor[0].length).trim();
312
+ changed = true;
313
+ }
314
+ }
315
+ return {
316
+ Anchor: unwrap(anchor),
317
+ Tag: unwrap(tag),
318
+ Value: current
319
+ };
320
+ };
321
+ const isBlockScalarHeaderCandidate = (rawHeader) => {
322
+ const props = extractProperties(handles, splitTrailingCommentPlaceholder(rawHeader)[0]);
323
+ if (props.Value.startsWith("|")) {
324
+ return true;
325
+ } else {
326
+ return props.Value.startsWith(">");
327
+ }
328
+ };
329
+ const tryReadBlockScalar = (rawHeader_1, headerIndent, baseCommentId, block) => {
330
+ const patternInput_1 = splitTrailingCommentPlaceholder(rawHeader_1);
331
+ const props_1 = extractProperties(handles, patternInput_1[0]);
332
+ const commentId = baseCommentId == null ? patternInput_1[1] : baseCommentId;
333
+ const matchValue_3 = parseBlockScalarHeader(props_1.Value);
334
+ if (matchValue_3 == null) {
335
+ return void 0;
336
+ } else {
337
+ const style_1 = value(matchValue_3)[0];
338
+ const indent = value(matchValue_3)[1];
339
+ const chomp = value(matchValue_3)[2];
340
+ const value_4 = buildBlockScalarContent(style_1, chomp, headerIndent, indent, flattenBlockScalarContentWithDepth(0, block));
341
+ return {
342
+ Chomp: chomp,
343
+ Comment: unwrap(restoreCommentReplace(commentDict, commentId)),
344
+ Indent: unwrap(indent),
345
+ Props: props_1,
346
+ Style: style_1,
347
+ Value: value_4
348
+ };
349
+ }
350
+ };
351
+ const loopRead = (handles_3_mut, restlist_mut, acc_mut) => {
352
+ let c2_2, c1_2, c1_1, c2_1, s_3, s_4, v_25, block_3, block_1, v_10, v_8, yamlAstList_1, v_2;
353
+ loopRead:
354
+ while (true) {
355
+ const handles_3 = handles_3_mut, restlist = restlist_mut, acc = acc_mut;
356
+ let matchResult, alias, rest;
357
+ if (!isEmpty(restlist)) {
358
+ const activePatternResult = $007CAliasNode$007C_$007C(head(restlist));
359
+ if (activePatternResult != null) {
360
+ matchResult = 0;
361
+ alias = value(activePatternResult);
362
+ rest = tail(restlist);
363
+ } else if ($007CDocumentEnd$007C_$007C(head(restlist)) != null) {
364
+ matchResult = 1;
365
+ } else {
366
+ matchResult = 2;
367
+ }
368
+ } else {
369
+ matchResult = 2;
370
+ }
371
+ switch (matchResult) {
372
+ case 0: {
373
+ handles_3_mut = handles_3;
374
+ restlist_mut = rest;
375
+ acc_mut = cons(YAMLElement_Alias(alias), acc);
376
+ continue loopRead;
377
+ }
378
+ case 1:
379
+ return YAMLElement_Object(reverse(acc));
380
+ default: {
381
+ let matchResult_1, rest0, v_1, yamlAstList;
382
+ if (!isEmpty(restlist)) {
383
+ const activePatternResult_2 = $007CSchemaNamespace$007C_$007C(head(restlist));
384
+ if (activePatternResult_2 != null) {
385
+ if (!isEmpty(tail(restlist))) {
386
+ if (head(tail(restlist)).tag === /* Intendation */
387
+ 1) {
388
+ matchResult_1 = 0;
389
+ rest0 = tail(tail(restlist));
390
+ v_1 = value(activePatternResult_2);
391
+ yamlAstList = head(tail(restlist)).fields[0];
392
+ } else {
393
+ matchResult_1 = 1;
394
+ }
395
+ } else {
396
+ matchResult_1 = 1;
397
+ }
398
+ } else {
399
+ matchResult_1 = 1;
400
+ }
401
+ } else {
402
+ matchResult_1 = 1;
403
+ }
404
+ switch (matchResult_1) {
405
+ case 0: {
406
+ const sequenceElements = collectSequenceElements(toList(takeWhile(isSequenceElement, rest0)));
407
+ handles_3_mut = handles_3;
408
+ restlist_mut = toList(skipWhile(isSequenceElement, rest0));
409
+ acc_mut = cons(YAMLElement_Sequence(toList(delay(() => append(singleton(loopRead(handles_3, cons(PreprocessorElement_Line(v_1.Key), yamlAstList), empty())), delay(() => map$2((i) => loopRead(handles_3, i, empty()), sequenceElements)))))), acc);
410
+ continue loopRead;
411
+ }
412
+ default: {
413
+ let matchResult_2, rest0_2, v_3, rest0_3, v_4, yamlAstList_2;
414
+ if (!isEmpty(restlist)) {
415
+ const activePatternResult_3 = $007CSchemaNamespace$007C_$007C(head(restlist));
416
+ if (activePatternResult_3 != null) {
417
+ matchResult_2 = 0;
418
+ rest0_2 = tail(restlist);
419
+ v_3 = value(activePatternResult_3);
420
+ } else {
421
+ const activePatternResult_4 = $007CSequenceMinusOpener$007C_$007C(head(restlist));
422
+ if (activePatternResult_4 != null) {
423
+ if (!isEmpty(tail(restlist))) {
424
+ if (head(tail(restlist)).tag === /* Intendation */
425
+ 1) {
426
+ if (yamlAstList_1 = head(tail(restlist)).fields[0], v_2 = value(activePatternResult_4), v_2.Value != null && isBlockScalarHeaderCandidate(value(v_2.Value))) {
427
+ matchResult_2 = 1;
428
+ rest0_3 = tail(tail(restlist));
429
+ v_4 = value(activePatternResult_4);
430
+ yamlAstList_2 = head(tail(restlist)).fields[0];
431
+ } else {
432
+ matchResult_2 = 2;
433
+ }
434
+ } else {
435
+ matchResult_2 = 2;
436
+ }
437
+ } else {
438
+ matchResult_2 = 2;
439
+ }
440
+ } else {
441
+ matchResult_2 = 2;
442
+ }
443
+ }
444
+ } else {
445
+ matchResult_2 = 2;
446
+ }
447
+ switch (matchResult_2) {
448
+ case 0: {
449
+ const sequenceElements_1 = collectSequenceElements(toList(takeWhile(isSequenceElement, rest0_2)));
450
+ handles_3_mut = handles_3;
451
+ restlist_mut = toList(skipWhile(isSequenceElement, rest0_2));
452
+ acc_mut = cons(YAMLElement_Sequence(toList(delay(() => append(singleton(loopRead(handles_3, singleton$1(PreprocessorElement_Line(v_3.Key)), empty())), delay(() => map$2((i_1) => loopRead(handles_3, i_1, empty()), sequenceElements_1)))))), acc);
453
+ continue loopRead;
454
+ }
455
+ case 1: {
456
+ const matchValue_4 = tryReadBlockScalar(value(v_4.Value), v_4.Indent, void 0, yamlAstList_2);
457
+ if (matchValue_4 == null) {
458
+ const arg = value(v_4.Value);
459
+ return toFail(printf("Invalid sequence block scalar header: %s"))(arg);
460
+ } else {
461
+ const blockScalar = value(matchValue_4);
462
+ const sequenceElements_2 = collectSequenceElements(toList(takeWhile(isSequenceElement, rest0_3)));
463
+ const rest_3 = toList(skipWhile(isSequenceElement, rest0_3));
464
+ const firstItem = YAMLElement_Object(singleton$1(YAMLElement_Value(YAMLContent_create_Z1C3A29C9(blockScalar.Value, unwrap(blockScalar.Comment), unwrap(blockScalar.Props.Anchor), unwrap(blockScalar.Props.Tag), ScalarStyle_Block(blockScalar.Style, blockScalar.Chomp, blockScalar.Indent)))));
465
+ handles_3_mut = handles_3;
466
+ restlist_mut = rest_3;
467
+ acc_mut = cons(YAMLElement_Sequence(toList(delay(() => append(singleton(firstItem), delay(() => map$2((i_2) => loopRead(handles_3, i_2, empty()), sequenceElements_2)))))), acc);
468
+ continue loopRead;
469
+ }
470
+ }
471
+ default: {
472
+ let matchResult_3, rest0_4, v_5, yamlAstList_3;
473
+ if (!isEmpty(restlist)) {
474
+ const activePatternResult_5 = $007CSequenceMinusOpener$007C_$007C(head(restlist));
475
+ if (activePatternResult_5 != null) {
476
+ if (!isEmpty(tail(restlist))) {
477
+ if (head(tail(restlist)).tag === /* Intendation */
478
+ 1) {
479
+ matchResult_3 = 0;
480
+ rest0_4 = tail(tail(restlist));
481
+ v_5 = value(activePatternResult_5);
482
+ yamlAstList_3 = head(tail(restlist)).fields[0];
483
+ } else {
484
+ matchResult_3 = 1;
485
+ }
486
+ } else {
487
+ matchResult_3 = 1;
488
+ }
489
+ } else {
490
+ matchResult_3 = 1;
491
+ }
492
+ } else {
493
+ matchResult_3 = 1;
494
+ }
495
+ switch (matchResult_3) {
496
+ case 0: {
497
+ const objectList_1 = v_5.Value != null ? cons(PreprocessorElement_Line(value(v_5.Value)), yamlAstList_3) : yamlAstList_3;
498
+ const sequenceElements_3 = collectSequenceElements(toList(takeWhile(isSequenceElement, rest0_4)));
499
+ handles_3_mut = handles_3;
500
+ restlist_mut = toList(skipWhile(isSequenceElement, rest0_4));
501
+ acc_mut = cons(YAMLElement_Sequence(toList(delay(() => append(singleton(loopRead(handles_3, objectList_1, empty())), delay(() => map$2((i_3) => loopRead(handles_3, i_3, empty()), sequenceElements_3)))))), acc);
502
+ continue loopRead;
503
+ }
504
+ default: {
505
+ let matchResult_4, rest0_5, v_6, rest_6, v_7, closer, iList, opener, rest_7;
506
+ if (!isEmpty(restlist)) {
507
+ const activePatternResult_6 = $007CSequenceMinusOpener$007C_$007C(head(restlist));
508
+ if (activePatternResult_6 != null) {
509
+ matchResult_4 = 0;
510
+ rest0_5 = tail(restlist);
511
+ v_6 = value(activePatternResult_6);
512
+ } else {
513
+ const activePatternResult_7 = $007CInlineSequence$007C_$007C(head(restlist));
514
+ if (activePatternResult_7 != null) {
515
+ matchResult_4 = 1;
516
+ rest_6 = tail(restlist);
517
+ v_7 = value(activePatternResult_7);
518
+ } else {
519
+ const activePatternResult_8 = $007CSequenceSquareOpener$007C_$007C(head(restlist));
520
+ if (activePatternResult_8 != null) {
521
+ if (!isEmpty(tail(restlist))) {
522
+ if (head(tail(restlist)).tag === /* Intendation */
523
+ 1) {
524
+ if (!isEmpty(tail(tail(restlist)))) {
525
+ const activePatternResult_9 = $007CSequenceSquareCloser$007C_$007C(head(tail(tail(restlist))));
526
+ if (activePatternResult_9 != null) {
527
+ matchResult_4 = 2;
528
+ closer = value(activePatternResult_9);
529
+ iList = head(tail(restlist)).fields[0];
530
+ opener = value(activePatternResult_8);
531
+ rest_7 = tail(tail(tail(restlist)));
532
+ } else {
533
+ matchResult_4 = 3;
534
+ }
535
+ } else {
536
+ matchResult_4 = 3;
537
+ }
538
+ } else {
539
+ matchResult_4 = 3;
540
+ }
541
+ } else {
542
+ matchResult_4 = 3;
543
+ }
544
+ } else {
545
+ matchResult_4 = 3;
546
+ }
547
+ }
548
+ }
549
+ } else {
550
+ matchResult_4 = 3;
551
+ }
552
+ switch (matchResult_4) {
553
+ case 0: {
554
+ const sequenceElements_4 = collectSequenceElements(toList(takeWhile(isSequenceElement, rest0_5)));
555
+ const rest_5 = toList(skipWhile(isSequenceElement, rest0_5));
556
+ const objectList_2 = v_6.Value != null ? singleton$1(PreprocessorElement_Line(value(v_6.Value))) : empty();
557
+ handles_3_mut = handles_3;
558
+ restlist_mut = rest_5;
559
+ acc_mut = cons(YAMLElement_Sequence(toList(delay(() => append(singleton(loopRead(handles_3, objectList_2, empty())), delay(() => map$2((i_4) => loopRead(handles_3, i_4, empty()), sequenceElements_4)))))), acc);
560
+ continue loopRead;
561
+ }
562
+ case 1: {
563
+ const c = restoreCommentReplace(commentDict, v_7.Comment);
564
+ const split$1 = split(v_7.Value, [","], void 0, 1);
565
+ const current_6 = YAMLElement_Sequence(toList(delay(() => map$2((value_5) => loopRead(handles_3, singleton$1(PreprocessorElement_Line(value_5.trim())), empty()), split$1))));
566
+ handles_3_mut = handles_3;
567
+ restlist_mut = rest_6;
568
+ acc_mut = c != null ? ofArrayWithTail([current_6, YAMLElement_Comment(value(c))], acc) : cons(current_6, acc);
569
+ continue loopRead;
570
+ }
571
+ case 2: {
572
+ const c1 = restoreCommentReplace(commentDict, opener.Comment);
573
+ const c2 = restoreCommentReplace(commentDict, closer.Comment);
574
+ const current_7 = YAMLElement_Sequence(toList(delay(() => collect$1((i_5) => singleton(loopRead(handles_3, singleton$1(i_5.tag === /* Line */
575
+ 2 ? PreprocessorElement_Line(trimEnd(i_5.fields[0], ",")) : toFail(printf("Unexpected element in MultiLineSquareBrackets: %A"))(i_5)), empty())), iList))));
576
+ handles_3_mut = handles_3;
577
+ restlist_mut = rest_7;
578
+ acc_mut = c1 == null ? c2 == null ? cons(current_7, acc) : (c2_2 = value(c2), ofArrayWithTail([YAMLElement_Comment(c2_2), current_7], acc)) : c2 == null ? (c1_2 = value(c1), ofArrayWithTail([current_7, YAMLElement_Comment(c1_2)], acc)) : (c1_1 = value(c1), c2_1 = value(c2), ofArrayWithTail([YAMLElement_Comment(c2_1), current_7, YAMLElement_Comment(c1_1)], acc));
579
+ continue loopRead;
580
+ }
581
+ default: {
582
+ let matchResult_5, rest_9, v_9;
583
+ if (!isEmpty(restlist)) {
584
+ const activePatternResult_10 = $007CInlineJSON$007C_$007C(head(restlist));
585
+ if (activePatternResult_10 != null) {
586
+ if (v_8 = value(activePatternResult_10), v_8.Value.trim() === "") {
587
+ matchResult_5 = 0;
588
+ rest_9 = tail(restlist);
589
+ v_9 = value(activePatternResult_10);
590
+ } else {
591
+ matchResult_5 = 1;
592
+ }
593
+ } else {
594
+ matchResult_5 = 1;
595
+ }
596
+ } else {
597
+ matchResult_5 = 1;
598
+ }
599
+ switch (matchResult_5) {
600
+ case 0: {
601
+ const c_1 = restoreCommentReplace(commentDict, v_9.Comment);
602
+ const current_8 = empty();
603
+ handles_3_mut = handles_3;
604
+ restlist_mut = rest_9;
605
+ acc_mut = c_1 != null ? append$1(current_8, cons(YAMLElement_Comment(value(c_1)), acc)) : append$1(current_8, acc);
606
+ continue loopRead;
607
+ }
608
+ default: {
609
+ let matchResult_6, opener_1;
610
+ if (!isEmpty(restlist)) {
611
+ const activePatternResult_11 = $007CJSONKeyOpener$007C_$007C(head(restlist));
612
+ if (activePatternResult_11 != null) {
613
+ if (!isEmpty(tail(restlist))) {
614
+ if (head(tail(restlist)).tag === /* Intendation */
615
+ 1) {
616
+ if (!isEmpty(tail(tail(restlist)))) {
617
+ if ($007CJSONCloser$007C_$007C(head(tail(tail(restlist)))) != null) {
618
+ matchResult_6 = 0;
619
+ opener_1 = value(activePatternResult_11);
620
+ } else {
621
+ matchResult_6 = 1;
622
+ }
623
+ } else {
624
+ matchResult_6 = 1;
625
+ }
626
+ } else {
627
+ matchResult_6 = 1;
628
+ }
629
+ } else {
630
+ matchResult_6 = 1;
631
+ }
632
+ } else {
633
+ matchResult_6 = 1;
634
+ }
635
+ } else {
636
+ matchResult_6 = 1;
637
+ }
638
+ switch (matchResult_6) {
639
+ case 0:
640
+ return toFail(printf("Untransformed flow-style object detected. This is a bug in FlowToBlock transformation. Pattern: %A"))(opener_1);
641
+ default: {
642
+ let matchResult_7, v_11;
643
+ if (!isEmpty(restlist)) {
644
+ const activePatternResult_13 = $007CInlineJSON$007C_$007C(head(restlist));
645
+ if (activePatternResult_13 != null) {
646
+ if (v_10 = value(activePatternResult_13), v_10.Value.trim() !== "") {
647
+ matchResult_7 = 0;
648
+ v_11 = value(activePatternResult_13);
649
+ } else {
650
+ matchResult_7 = 1;
651
+ }
652
+ } else {
653
+ matchResult_7 = 1;
654
+ }
655
+ } else {
656
+ matchResult_7 = 1;
657
+ }
658
+ switch (matchResult_7) {
659
+ case 0:
660
+ return toFail(printf("Untransformed non-empty flow-style object detected: {%s}. This is a bug in FlowToBlock transformation."))(v_11.Value);
661
+ default: {
662
+ let matchResult_8, k, rest_10, rest_11, v_16, yamlAstList_4;
663
+ if (!isEmpty(restlist)) {
664
+ const activePatternResult_14 = $007CExplicitKey$007C_$007C(head(restlist));
665
+ if (activePatternResult_14 != null) {
666
+ matchResult_8 = 0;
667
+ k = value(activePatternResult_14);
668
+ rest_10 = tail(restlist);
669
+ } else {
670
+ const activePatternResult_15 = $007CKey$007C_$007C(head(restlist));
671
+ if (activePatternResult_15 != null) {
672
+ if (!isEmpty(tail(restlist))) {
673
+ if (head(tail(restlist)).tag === /* Intendation */
674
+ 1) {
675
+ matchResult_8 = 1;
676
+ rest_11 = tail(tail(restlist));
677
+ v_16 = value(activePatternResult_15);
678
+ yamlAstList_4 = head(tail(restlist)).fields[0];
679
+ } else {
680
+ matchResult_8 = 2;
681
+ }
682
+ } else {
683
+ matchResult_8 = 2;
684
+ }
685
+ } else {
686
+ matchResult_8 = 2;
687
+ }
688
+ }
689
+ } else {
690
+ matchResult_8 = 2;
691
+ }
692
+ switch (matchResult_8) {
693
+ case 0: {
694
+ const parseValue = (vStr) => {
695
+ let matchValue_6;
696
+ return loopRead(handles_3, transformElements(new TransformContext(0, ctx.IndentStep, ctx.StringDict), (matchValue_6 = read$1(vStr).AST, matchValue_6.tag === /* Level */
697
+ 0 ? matchValue_6.fields[0] : empty())), empty());
698
+ };
699
+ let matchResult_9, iList_1, keyBody, tail$1, v_12;
700
+ if (!isEmpty(rest_10)) {
701
+ if (head(rest_10).tag === /* Intendation */
702
+ 1) {
703
+ if (!isEmpty(tail(rest_10))) {
704
+ const activePatternResult_16 = $007CExplicitValue$007C_$007C(head(tail(rest_10)));
705
+ if (activePatternResult_16 != null) {
706
+ if (!isEmpty(tail(tail(rest_10)))) {
707
+ if (head(tail(tail(rest_10))).tag === /* Intendation */
708
+ 1) {
709
+ matchResult_9 = 0;
710
+ iList_1 = head(tail(tail(rest_10))).fields[0];
711
+ keyBody = head(rest_10).fields[0];
712
+ tail$1 = tail(tail(tail(rest_10)));
713
+ v_12 = value(activePatternResult_16);
714
+ } else {
715
+ matchResult_9 = 1;
716
+ }
717
+ } else {
718
+ matchResult_9 = 1;
719
+ }
720
+ } else {
721
+ matchResult_9 = 1;
722
+ }
723
+ } else {
724
+ matchResult_9 = 1;
725
+ }
726
+ } else {
727
+ matchResult_9 = 1;
728
+ }
729
+ } else {
730
+ matchResult_9 = 1;
731
+ }
732
+ switch (matchResult_9) {
733
+ case 0: {
734
+ const simplifiedKey = join("\n", flattenBlockScalar(keyBody));
735
+ const kp = extractProperties(handles_3, k == null ? simplifiedKey : (s_3 = value(k), s_3 + (s_3 !== "" ? "\n" : "") + simplifiedKey));
736
+ const separator = (trimStart(v_12).startsWith("[") ? true : trimStart(v_12).startsWith("{")) ? " " : "\n";
737
+ const valueElement = parseValue(v_12 + separator + join(separator, flattenBlockScalar(iList_1)));
738
+ handles_3_mut = handles_3;
739
+ restlist_mut = tail$1;
740
+ acc_mut = cons(YAMLElement_Mapping(YAMLContent_create_Z1C3A29C9(kp.Value, void 0, unwrap(kp.Anchor), unwrap(kp.Tag)), valueElement), acc);
741
+ continue loopRead;
742
+ }
743
+ default: {
744
+ let matchResult_10, keyBody_1, tail_1, v_13, iList_2, tail_2, v_14;
745
+ if (!isEmpty(rest_10)) {
746
+ if (head(rest_10).tag === /* Intendation */
747
+ 1) {
748
+ if (!isEmpty(tail(rest_10))) {
749
+ const activePatternResult_17 = $007CExplicitValue$007C_$007C(head(tail(rest_10)));
750
+ if (activePatternResult_17 != null) {
751
+ matchResult_10 = 0;
752
+ keyBody_1 = head(rest_10).fields[0];
753
+ tail_1 = tail(tail(rest_10));
754
+ v_13 = value(activePatternResult_17);
755
+ } else if (head(tail(rest_10)).tag === /* Intendation */
756
+ 1) {
757
+ const activePatternResult_18 = $007CExplicitValue$007C_$007C(head(rest_10));
758
+ if (activePatternResult_18 != null) {
759
+ matchResult_10 = 1;
760
+ iList_2 = head(tail(rest_10)).fields[0];
761
+ tail_2 = tail(tail(rest_10));
762
+ v_14 = value(activePatternResult_18);
763
+ } else {
764
+ matchResult_10 = 2;
765
+ }
766
+ } else {
767
+ matchResult_10 = 2;
768
+ }
769
+ } else {
770
+ matchResult_10 = 2;
771
+ }
772
+ } else {
773
+ const activePatternResult_19 = $007CExplicitValue$007C_$007C(head(rest_10));
774
+ if (activePatternResult_19 != null) {
775
+ if (!isEmpty(tail(rest_10))) {
776
+ if (head(tail(rest_10)).tag === /* Intendation */
777
+ 1) {
778
+ matchResult_10 = 1;
779
+ iList_2 = head(tail(rest_10)).fields[0];
780
+ tail_2 = tail(tail(rest_10));
781
+ v_14 = value(activePatternResult_19);
782
+ } else {
783
+ matchResult_10 = 2;
784
+ }
785
+ } else {
786
+ matchResult_10 = 2;
787
+ }
788
+ } else {
789
+ matchResult_10 = 2;
790
+ }
791
+ }
792
+ } else {
793
+ matchResult_10 = 2;
794
+ }
795
+ switch (matchResult_10) {
796
+ case 0: {
797
+ const simplifiedKey_1 = join("\n", flattenBlockScalar(keyBody_1));
798
+ const kp_1 = extractProperties(handles_3, k == null ? simplifiedKey_1 : (s_4 = value(k), s_4 + (s_4 !== "" ? "\n" : "") + simplifiedKey_1));
799
+ const valueElement_1 = parseValue(v_13);
800
+ handles_3_mut = handles_3;
801
+ restlist_mut = tail_1;
802
+ acc_mut = cons(YAMLElement_Mapping(YAMLContent_create_Z1C3A29C9(kp_1.Value, void 0, unwrap(kp_1.Anchor), unwrap(kp_1.Tag)), valueElement_1), acc);
803
+ continue loopRead;
804
+ }
805
+ case 1: {
806
+ const kp_2 = k == null ? {
807
+ Value: ""
808
+ } : extractProperties(handles_3, value(k));
809
+ const valueElement_2 = parseValue(v_14 + "\n" + join("\n", flattenBlockScalar(iList_2)));
810
+ handles_3_mut = handles_3;
811
+ restlist_mut = tail_2;
812
+ acc_mut = cons(YAMLElement_Mapping(YAMLContent_create_Z1C3A29C9(kp_2.Value, void 0, unwrap(kp_2.Anchor), unwrap(kp_2.Tag)), valueElement_2), acc);
813
+ continue loopRead;
814
+ }
815
+ default: {
816
+ let matchResult_11, tail_3, v_15;
817
+ if (!isEmpty(rest_10)) {
818
+ const activePatternResult_20 = $007CExplicitValue$007C_$007C(head(rest_10));
819
+ if (activePatternResult_20 != null) {
820
+ matchResult_11 = 0;
821
+ tail_3 = tail(rest_10);
822
+ v_15 = value(activePatternResult_20);
823
+ } else {
824
+ matchResult_11 = 1;
825
+ }
826
+ } else {
827
+ matchResult_11 = 1;
828
+ }
829
+ switch (matchResult_11) {
830
+ case 0: {
831
+ const kp_3 = k == null ? {
832
+ Value: ""
833
+ } : extractProperties(handles_3, value(k));
834
+ const valueElement_3 = parseValue(v_15);
835
+ handles_3_mut = handles_3;
836
+ restlist_mut = tail_3;
837
+ acc_mut = cons(YAMLElement_Mapping(YAMLContent_create_Z1C3A29C9(kp_3.Value, void 0, unwrap(kp_3.Anchor), unwrap(kp_3.Tag)), valueElement_3), acc);
838
+ continue loopRead;
839
+ }
840
+ default: {
841
+ const kp_4 = k == null ? {
842
+ Value: ""
843
+ } : extractProperties(handles_3, value(k));
844
+ handles_3_mut = handles_3;
845
+ restlist_mut = rest_10;
846
+ acc_mut = cons(YAMLElement_Mapping(YAMLContent_create_Z1C3A29C9(kp_4.Value, void 0, unwrap(kp_4.Anchor), unwrap(kp_4.Tag)), YAMLElement_Nil()), acc);
847
+ continue loopRead;
848
+ }
849
+ }
850
+ }
851
+ }
852
+ }
853
+ }
854
+ }
855
+ case 1: {
856
+ const c_2 = restoreCommentReplace(commentDict, v_16.Comment);
857
+ const props_2 = extractProperties(handles_3, v_16.Key);
858
+ handles_3_mut = handles_3;
859
+ restlist_mut = rest_11;
860
+ acc_mut = cons(YAMLElement_Mapping(YAMLContent_create_Z1C3A29C9(props_2.Value, unwrap(c_2), unwrap(props_2.Anchor), unwrap(props_2.Tag)), loopRead(handles_3, yamlAstList_4, empty())), acc);
861
+ continue loopRead;
862
+ }
863
+ default: {
864
+ let matchResult_12, rest0_6, v_17, w, yamlAstList_5;
865
+ if (!isEmpty(restlist)) {
866
+ const activePatternResult_21 = $007CKey$007C_$007C(head(restlist));
867
+ if (activePatternResult_21 != null) {
868
+ if (!isEmpty(tail(restlist))) {
869
+ const activePatternResult_22 = $007CSequenceMinusOpener$007C_$007C(head(tail(restlist)));
870
+ if (activePatternResult_22 != null) {
871
+ if (!isEmpty(tail(tail(restlist)))) {
872
+ if (head(tail(tail(restlist))).tag === /* Intendation */
873
+ 1) {
874
+ matchResult_12 = 0;
875
+ rest0_6 = tail(tail(tail(restlist)));
876
+ v_17 = value(activePatternResult_21);
877
+ w = value(activePatternResult_22);
878
+ yamlAstList_5 = head(tail(tail(restlist))).fields[0];
879
+ } else {
880
+ matchResult_12 = 1;
881
+ }
882
+ } else {
883
+ matchResult_12 = 1;
884
+ }
885
+ } else {
886
+ matchResult_12 = 1;
887
+ }
888
+ } else {
889
+ matchResult_12 = 1;
890
+ }
891
+ } else {
892
+ matchResult_12 = 1;
893
+ }
894
+ } else {
895
+ matchResult_12 = 1;
896
+ }
897
+ switch (matchResult_12) {
898
+ case 0: {
899
+ const c_3 = restoreCommentReplace(commentDict, v_17.Comment);
900
+ const props_3 = extractProperties(handles_3, v_17.Key);
901
+ const objectList_3 = w.Value != null ? cons(PreprocessorElement_Line(value(w.Value)), yamlAstList_5) : yamlAstList_5;
902
+ const sequenceElements_5 = collectSequenceElements(toList(takeWhile(isSequenceElement, rest0_6)));
903
+ const rest_12 = toList(skipWhile(isSequenceElement, rest0_6));
904
+ const seq = YAMLElement_Sequence(toList(delay(() => append(singleton(loopRead(handles_3, objectList_3, empty())), delay(() => map$2((i_6) => loopRead(handles_3, i_6, empty()), sequenceElements_5))))));
905
+ handles_3_mut = handles_3;
906
+ restlist_mut = rest_12;
907
+ acc_mut = cons(YAMLElement_Mapping(YAMLContent_create_Z1C3A29C9(props_3.Value, unwrap(c_3), unwrap(props_3.Anchor), unwrap(props_3.Tag)), YAMLElement_Object(singleton$1(seq))), acc);
908
+ continue loopRead;
909
+ }
910
+ default: {
911
+ let matchResult_13, rest0_7, v_18, w_1;
912
+ if (!isEmpty(restlist)) {
913
+ const activePatternResult_23 = $007CKey$007C_$007C(head(restlist));
914
+ if (activePatternResult_23 != null) {
915
+ if (!isEmpty(tail(restlist))) {
916
+ const activePatternResult_24 = $007CSequenceMinusOpener$007C_$007C(head(tail(restlist)));
917
+ if (activePatternResult_24 != null) {
918
+ matchResult_13 = 0;
919
+ rest0_7 = tail(tail(restlist));
920
+ v_18 = value(activePatternResult_23);
921
+ w_1 = value(activePatternResult_24);
922
+ } else {
923
+ matchResult_13 = 1;
924
+ }
925
+ } else {
926
+ matchResult_13 = 1;
927
+ }
928
+ } else {
929
+ matchResult_13 = 1;
930
+ }
931
+ } else {
932
+ matchResult_13 = 1;
933
+ }
934
+ switch (matchResult_13) {
935
+ case 0: {
936
+ const c_4 = restoreCommentReplace(commentDict, v_18.Comment);
937
+ const props_4 = extractProperties(handles_3, v_18.Key);
938
+ const sequenceElements_6 = collectSequenceElements(toList(takeWhile(isSequenceElement, rest0_7)));
939
+ const rest_13 = toList(skipWhile(isSequenceElement, rest0_7));
940
+ const seq_1 = YAMLElement_Sequence(toList(delay(() => append(singleton(loopRead(handles_3, singleton$1(PreprocessorElement_Line(value(w_1.Value))), empty())), delay(() => map$2((i_7) => loopRead(handles_3, i_7, empty()), sequenceElements_6))))));
941
+ handles_3_mut = handles_3;
942
+ restlist_mut = rest_13;
943
+ acc_mut = cons(YAMLElement_Mapping(YAMLContent_create_Z1C3A29C9(props_4.Value, unwrap(c_4), unwrap(props_4.Anchor), unwrap(props_4.Tag)), YAMLElement_Object(singleton$1(seq_1))), acc);
944
+ continue loopRead;
945
+ }
946
+ default: {
947
+ let matchResult_14, block_2, rest_15, v_20;
948
+ if (!isEmpty(restlist)) {
949
+ const activePatternResult_25 = $007CKeyValue$007C_$007C(head(restlist));
950
+ if (activePatternResult_25 != null) {
951
+ if (!isEmpty(tail(restlist))) {
952
+ if (head(tail(restlist)).tag === /* Intendation */
953
+ 1) {
954
+ if (block_1 = head(tail(restlist)).fields[0], isBlockScalarHeaderCandidate(value(activePatternResult_25).Value)) {
955
+ matchResult_14 = 0;
956
+ block_2 = head(tail(restlist)).fields[0];
957
+ rest_15 = tail(tail(restlist));
958
+ v_20 = value(activePatternResult_25);
959
+ } else {
960
+ matchResult_14 = 1;
961
+ }
962
+ } else {
963
+ matchResult_14 = 1;
964
+ }
965
+ } else {
966
+ matchResult_14 = 1;
967
+ }
968
+ } else {
969
+ matchResult_14 = 1;
970
+ }
971
+ } else {
972
+ matchResult_14 = 1;
973
+ }
974
+ switch (matchResult_14) {
975
+ case 0: {
976
+ const matchValue_7 = tryReadBlockScalar(v_20.Value, v_20.Indent, void 0, block_2);
977
+ if (matchValue_7 == null) {
978
+ return toFail(printf("Invalid block scalar header: %s"))(v_20.Value);
979
+ } else {
980
+ const blockScalar_1 = value(matchValue_7);
981
+ const keyProps = extractProperties(handles_3, v_20.Key);
982
+ handles_3_mut = handles_3;
983
+ restlist_mut = rest_15;
984
+ acc_mut = cons(YAMLElement_Mapping(YAMLContent_create_Z1C3A29C9(keyProps.Value, void 0, unwrap(keyProps.Anchor), unwrap(keyProps.Tag)), YAMLElement_Value(YAMLContent_create_Z1C3A29C9(blockScalar_1.Value, unwrap(blockScalar_1.Comment), unwrap(blockScalar_1.Props.Anchor), unwrap(blockScalar_1.Props.Tag), ScalarStyle_Block(blockScalar_1.Style, blockScalar_1.Chomp, blockScalar_1.Indent)))), acc);
985
+ continue loopRead;
986
+ }
987
+ }
988
+ default: {
989
+ let matchResult_15, rest_17, v_22, rest_18, v_23, block_4, rest_19, v_24;
990
+ if (!isEmpty(restlist)) {
991
+ const activePatternResult_26 = $007CKeyValue$007C_$007C(head(restlist));
992
+ if (activePatternResult_26 != null) {
993
+ matchResult_15 = 0;
994
+ rest_17 = tail(restlist);
995
+ v_22 = value(activePatternResult_26);
996
+ } else {
997
+ const activePatternResult_27 = $007CYamlComment$007C_$007C(head(restlist));
998
+ if (activePatternResult_27 != null) {
999
+ matchResult_15 = 1;
1000
+ rest_18 = tail(restlist);
1001
+ v_23 = value(activePatternResult_27);
1002
+ } else {
1003
+ const activePatternResult_28 = $007CYamlValue$007C_$007C(head(restlist));
1004
+ if (activePatternResult_28 != null) {
1005
+ if (!isEmpty(tail(restlist))) {
1006
+ if (head(tail(restlist)).tag === /* Intendation */
1007
+ 1) {
1008
+ if (block_3 = head(tail(restlist)).fields[0], isBlockScalarHeaderCandidate(value(activePatternResult_28).Value)) {
1009
+ matchResult_15 = 2;
1010
+ block_4 = head(tail(restlist)).fields[0];
1011
+ rest_19 = tail(tail(restlist));
1012
+ v_24 = value(activePatternResult_28);
1013
+ } else {
1014
+ matchResult_15 = 3;
1015
+ }
1016
+ } else {
1017
+ matchResult_15 = 3;
1018
+ }
1019
+ } else {
1020
+ matchResult_15 = 3;
1021
+ }
1022
+ } else {
1023
+ matchResult_15 = 3;
1024
+ }
1025
+ }
1026
+ }
1027
+ } else {
1028
+ matchResult_15 = 3;
1029
+ }
1030
+ switch (matchResult_15) {
1031
+ case 0: {
1032
+ const props_5 = extractProperties(handles_3, v_22.Key);
1033
+ handles_3_mut = handles_3;
1034
+ restlist_mut = rest_17;
1035
+ acc_mut = cons(YAMLElement_Mapping(YAMLContent_create_Z1C3A29C9(props_5.Value, void 0, unwrap(props_5.Anchor), unwrap(props_5.Tag)), loopRead(handles_3, singleton$1(PreprocessorElement_Line(v_22.Value)), empty())), acc);
1036
+ continue loopRead;
1037
+ }
1038
+ case 1: {
1039
+ handles_3_mut = handles_3;
1040
+ restlist_mut = rest_18;
1041
+ acc_mut = cons(YAMLElement_Comment(getItemFromDict(commentDict, v_23.Comment)), acc);
1042
+ continue loopRead;
1043
+ }
1044
+ case 2: {
1045
+ const matchValue_8 = tryReadBlockScalar(v_24.Value, v_24.Indent, v_24.Comment, block_4);
1046
+ if (matchValue_8 == null) {
1047
+ return toFail(printf("Invalid block scalar header: %s"))(v_24.Value);
1048
+ } else {
1049
+ const blockScalar_2 = value(matchValue_8);
1050
+ handles_3_mut = handles_3;
1051
+ restlist_mut = rest_19;
1052
+ acc_mut = cons(YAMLElement_Value(YAMLContent_create_Z1C3A29C9(blockScalar_2.Value, unwrap(blockScalar_2.Comment), unwrap(blockScalar_2.Props.Anchor), unwrap(blockScalar_2.Props.Tag), ScalarStyle_Block(blockScalar_2.Style, blockScalar_2.Chomp, blockScalar_2.Indent))), acc);
1053
+ continue loopRead;
1054
+ }
1055
+ }
1056
+ default: {
1057
+ let matchResult_16, rest_21, v_26;
1058
+ if (!isEmpty(restlist)) {
1059
+ const activePatternResult_29 = $007CYamlValue$007C_$007C(head(restlist));
1060
+ if (activePatternResult_29 != null) {
1061
+ if (v_25 = value(activePatternResult_29), v_25.Value === "" && v_25.Comment == null) {
1062
+ matchResult_16 = 0;
1063
+ rest_21 = tail(restlist);
1064
+ v_26 = value(activePatternResult_29);
1065
+ } else {
1066
+ matchResult_16 = 1;
1067
+ }
1068
+ } else {
1069
+ matchResult_16 = 1;
1070
+ }
1071
+ } else {
1072
+ matchResult_16 = 1;
1073
+ }
1074
+ switch (matchResult_16) {
1075
+ case 0: {
1076
+ handles_3_mut = handles_3;
1077
+ restlist_mut = rest_21;
1078
+ acc_mut = acc;
1079
+ continue loopRead;
1080
+ }
1081
+ default:
1082
+ if (isEmpty(restlist)) {
1083
+ return YAMLElement_Object(reverse(acc));
1084
+ } else {
1085
+ const activePatternResult_30 = $007CYamlValue$007C_$007C(head(restlist));
1086
+ if (activePatternResult_30 != null) {
1087
+ const v_27 = value(activePatternResult_30);
1088
+ const c_6 = restoreCommentReplace(commentDict, v_27.Comment);
1089
+ const props_6 = extractProperties(handles_3, v_27.Value);
1090
+ let patternInput_2;
1091
+ const raw = props_6.Value;
1092
+ const matchValue = tryParseExactPlaceholderIndex(raw);
1093
+ if (matchValue == null) {
1094
+ patternInput_2 = [restoreStringReplace(stringDict, raw), void 0];
1095
+ } else {
1096
+ const entry = getItemFromDict(stringDict, value(matchValue));
1097
+ patternInput_2 = [restoreScalarPlaceholderValue(entry), entry.Kind.tag === /* DoubleQuotedString */
1098
+ 1 ? ScalarStyle_DoubleQuoted() : ScalarStyle_SingleQuoted()];
1099
+ }
1100
+ handles_3_mut = handles_3;
1101
+ restlist_mut = tail(restlist);
1102
+ acc_mut = cons(YAMLElement_Value(YAMLContent_create_Z1C3A29C9(patternInput_2[0], unwrap(c_6), unwrap(props_6.Anchor), unwrap(props_6.Tag), unwrap(patternInput_2[1]))), acc);
1103
+ continue loopRead;
1104
+ } else {
1105
+ return toFail(printf("Unknown pattern: %A"))(restlist);
1106
+ }
1107
+ }
1108
+ }
1109
+ }
1110
+ }
1111
+ }
1112
+ }
1113
+ }
1114
+ }
1115
+ }
1116
+ }
1117
+ }
1118
+ }
1119
+ }
1120
+ }
1121
+ }
1122
+ }
1123
+ }
1124
+ }
1125
+ }
1126
+ }
1127
+ }
1128
+ }
1129
+ }
1130
+ }
1131
+ }
1132
+ }
1133
+ }
1134
+ }
1135
+ break;
1136
+ }
1137
+ };
1138
+ return loopRead(handles, transformElements(ctx, yamlList), empty());
1139
+ }
1140
+ function read(yaml) {
1141
+ const ast = read$1(yaml);
1142
+ const matchValue = ast.AST;
1143
+ if (matchValue.tag === /* Level */
1144
+ 0) {
1145
+ return tokenize(matchValue.fields[0], ast.StringMap, ast.CommentMap, ast.TagHandles);
1146
+ } else {
1147
+ throw new Error("Not a root!");
1148
+ }
1149
+ }
1150
+ function isStreamDocumentMarker(markerCheck, line) {
1151
+ if (countLeadingSpaces(line) === 0) {
1152
+ return markerCheck(line);
1153
+ } else {
1154
+ return false;
1155
+ }
1156
+ }
1157
+ function tryInlineContentAfterStartMarker(line) {
1158
+ const trimmed = trimStart(line);
1159
+ if (!trimmed.startsWith("---")) {
1160
+ return void 0;
1161
+ } else {
1162
+ const rest = trimStart(substring(trimmed, 3));
1163
+ if (isNullOrWhiteSpace(rest) ? true : rest.startsWith("#")) {
1164
+ return void 0;
1165
+ } else {
1166
+ return rest;
1167
+ }
1168
+ }
1169
+ }
1170
+ function isDirectivePreludeLine(line) {
1171
+ const t = trimStart(line);
1172
+ if (t === "" ? true : t.startsWith("%")) {
1173
+ return true;
1174
+ } else {
1175
+ return t.startsWith("#");
1176
+ }
1177
+ }
1178
+ function isDirectivePreludeOnly(lines) {
1179
+ if (exists((line) => trimStart(line).startsWith("%"), lines)) {
1180
+ return forAll(isDirectivePreludeLine, lines);
1181
+ } else {
1182
+ return false;
1183
+ }
1184
+ }
1185
+ function tryDetectBlockScalarHeaderIndent(line) {
1186
+ let loop, idx_3;
1187
+ const trimmed = trimStart(line);
1188
+ const afterDash = trimmed.startsWith("- ") ? trimStart(substring(trimmed, 2)) : trimmed;
1189
+ const headerToken = tryHead(split((loop = (current_mut) => {
1190
+ loop:
1191
+ while (true) {
1192
+ const current = current_mut;
1193
+ const c = trimStart(current);
1194
+ if (c.startsWith("&")) {
1195
+ const idx = c.indexOf(" ") | 0;
1196
+ if (idx < 0) {
1197
+ return "";
1198
+ } else {
1199
+ current_mut = substring(c, idx + 1);
1200
+ continue loop;
1201
+ }
1202
+ } else if (c.startsWith("!<")) {
1203
+ const idx_1 = c.indexOf(">") | 0;
1204
+ if (idx_1 < 0) {
1205
+ return c;
1206
+ } else {
1207
+ current_mut = substring(c, idx_1 + 1);
1208
+ continue loop;
1209
+ }
1210
+ } else if (c.startsWith("!") && !c.startsWith("|") && !c.startsWith(">")) {
1211
+ const idx_2 = c.indexOf(" ") | 0;
1212
+ if (idx_2 < 0) {
1213
+ return "";
1214
+ } else {
1215
+ current_mut = substring(c, idx_2 + 1);
1216
+ continue loop;
1217
+ }
1218
+ } else {
1219
+ return c;
1220
+ }
1221
+ break;
1222
+ }
1223
+ }, loop((idx_3 = afterDash.indexOf(":") | 0, idx_3 >= 0 ? trimStart(substring(afterDash, idx_3 + 1)) : afterDash))), [" ", " "], void 0, 1));
1224
+ let matchResult, token_1;
1225
+ if (headerToken != null) {
1226
+ if (parseBlockScalarHeader(value(headerToken)) != null) {
1227
+ matchResult = 0;
1228
+ token_1 = value(headerToken);
1229
+ } else {
1230
+ matchResult = 1;
1231
+ }
1232
+ } else {
1233
+ matchResult = 1;
1234
+ }
1235
+ switch (matchResult) {
1236
+ case 0:
1237
+ return countLeadingSpaces(line);
1238
+ default:
1239
+ return void 0;
1240
+ }
1241
+ }
1242
+ function readDocuments(yaml) {
1243
+ const appendCurrentDocument = (currentDoc, docs) => {
1244
+ if (isEmpty(currentDoc)) {
1245
+ return docs;
1246
+ } else {
1247
+ return cons(reverse(currentDoc), docs);
1248
+ }
1249
+ };
1250
+ const splitDocuments = (remaining_mut, currentDoc_1_mut, docs_1_mut, blockHeaderIndent_mut) => {
1251
+ let matchValue;
1252
+ splitDocuments:
1253
+ while (true) {
1254
+ const remaining = remaining_mut, currentDoc_1 = currentDoc_1_mut, docs_1 = docs_1_mut, blockHeaderIndent = blockHeaderIndent_mut;
1255
+ if (!isEmpty(remaining)) {
1256
+ const rest = tail(remaining);
1257
+ const line = head(remaining);
1258
+ if (blockHeaderIndent == null) {
1259
+ if (isStreamDocumentMarker(isDocumentStart, line)) {
1260
+ const inlineContent = tryInlineContentAfterStartMarker(line);
1261
+ if (isEmpty(currentDoc_1) ? true : isDirectivePreludeOnly(currentDoc_1)) {
1262
+ const preludeDirectives = filter((l) => trimStart(l).startsWith("%"), currentDoc_1);
1263
+ remaining_mut = rest;
1264
+ currentDoc_1_mut = inlineContent == null ? preludeDirectives : cons(value(inlineContent), preludeDirectives);
1265
+ docs_1_mut = docs_1;
1266
+ blockHeaderIndent_mut = void 0;
1267
+ continue splitDocuments;
1268
+ } else {
1269
+ const docs$0027 = appendCurrentDocument(currentDoc_1, docs_1);
1270
+ remaining_mut = rest;
1271
+ currentDoc_1_mut = inlineContent == null ? empty() : singleton$1(value(inlineContent));
1272
+ docs_1_mut = docs$0027;
1273
+ blockHeaderIndent_mut = void 0;
1274
+ continue splitDocuments;
1275
+ }
1276
+ } else if (isStreamDocumentMarker(isDocumentEnd, line)) {
1277
+ remaining_mut = rest;
1278
+ currentDoc_1_mut = empty();
1279
+ docs_1_mut = appendCurrentDocument(currentDoc_1, docs_1);
1280
+ blockHeaderIndent_mut = void 0;
1281
+ continue splitDocuments;
1282
+ } else {
1283
+ remaining_mut = rest;
1284
+ currentDoc_1_mut = cons(line, currentDoc_1);
1285
+ docs_1_mut = docs_1;
1286
+ blockHeaderIndent_mut = (matchValue = tryDetectBlockScalarHeaderIndent(line), matchValue == null ? void 0 : value(matchValue));
1287
+ continue splitDocuments;
1288
+ }
1289
+ } else {
1290
+ const headerIndent = value(blockHeaderIndent) | 0;
1291
+ if (line.trim() === "" ? true : countLeadingSpaces(line) > headerIndent) {
1292
+ remaining_mut = rest;
1293
+ currentDoc_1_mut = cons(line, currentDoc_1);
1294
+ docs_1_mut = docs_1;
1295
+ blockHeaderIndent_mut = blockHeaderIndent;
1296
+ continue splitDocuments;
1297
+ } else {
1298
+ remaining_mut = remaining;
1299
+ currentDoc_1_mut = currentDoc_1;
1300
+ docs_1_mut = docs_1;
1301
+ blockHeaderIndent_mut = void 0;
1302
+ continue splitDocuments;
1303
+ }
1304
+ }
1305
+ } else {
1306
+ return reverse(appendCurrentDocument(currentDoc_1, docs_1));
1307
+ }
1308
+ break;
1309
+ }
1310
+ };
1311
+ return map((docLines) => read(join("\n", docLines)), filter((doc) => exists((l_1) => l_1.trim() !== "", doc), splitDocuments(ofArray(split(replace$1(replace$1(yaml, "\r\n", "\n"), "\r", "\n"), ["\n"], void 0, 0)), empty(), empty(), void 0)));
1312
+ }
1313
+
1314
+ export { collectSequenceElements, isSequenceElement, read, readDocuments };