@canopy-iiif/app 0.7.9 → 0.7.10

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.
@@ -1,3 +1,3000 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
+ }) : x)(function(x) {
10
+ if (typeof require !== "undefined") return require.apply(this, arguments);
11
+ throw Error('Dynamic require of "' + x + '" is not supported');
12
+ });
13
+ var __commonJS = (cb, mod) => function __require2() {
14
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
15
+ };
16
+ var __copyProps = (to, from, except, desc) => {
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from))
19
+ if (!__hasOwnProp.call(to, key) && key !== except)
20
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
21
+ }
22
+ return to;
23
+ };
24
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
+ // If the importer is in node compatibility mode or this is not an ESM
26
+ // file that has been converted to a CommonJS file using a Babel-
27
+ // compatible transform (i.e. "__esModule" has not been set), then set
28
+ // "default" to the CommonJS "module.exports" for node compatibility.
29
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
30
+ mod
31
+ ));
32
+
33
+ // node_modules/js-yaml/lib/common.js
34
+ var require_common = __commonJS({
35
+ "node_modules/js-yaml/lib/common.js"(exports, module) {
36
+ "use strict";
37
+ function isNothing(subject) {
38
+ return typeof subject === "undefined" || subject === null;
39
+ }
40
+ function isObject(subject) {
41
+ return typeof subject === "object" && subject !== null;
42
+ }
43
+ function toArray(sequence) {
44
+ if (Array.isArray(sequence)) return sequence;
45
+ else if (isNothing(sequence)) return [];
46
+ return [sequence];
47
+ }
48
+ function extend(target, source) {
49
+ var index, length, key, sourceKeys;
50
+ if (source) {
51
+ sourceKeys = Object.keys(source);
52
+ for (index = 0, length = sourceKeys.length; index < length; index += 1) {
53
+ key = sourceKeys[index];
54
+ target[key] = source[key];
55
+ }
56
+ }
57
+ return target;
58
+ }
59
+ function repeat(string, count) {
60
+ var result = "", cycle;
61
+ for (cycle = 0; cycle < count; cycle += 1) {
62
+ result += string;
63
+ }
64
+ return result;
65
+ }
66
+ function isNegativeZero(number) {
67
+ return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
68
+ }
69
+ module.exports.isNothing = isNothing;
70
+ module.exports.isObject = isObject;
71
+ module.exports.toArray = toArray;
72
+ module.exports.repeat = repeat;
73
+ module.exports.isNegativeZero = isNegativeZero;
74
+ module.exports.extend = extend;
75
+ }
76
+ });
77
+
78
+ // node_modules/js-yaml/lib/exception.js
79
+ var require_exception = __commonJS({
80
+ "node_modules/js-yaml/lib/exception.js"(exports, module) {
81
+ "use strict";
82
+ function formatError(exception, compact) {
83
+ var where = "", message = exception.reason || "(unknown reason)";
84
+ if (!exception.mark) return message;
85
+ if (exception.mark.name) {
86
+ where += 'in "' + exception.mark.name + '" ';
87
+ }
88
+ where += "(" + (exception.mark.line + 1) + ":" + (exception.mark.column + 1) + ")";
89
+ if (!compact && exception.mark.snippet) {
90
+ where += "\n\n" + exception.mark.snippet;
91
+ }
92
+ return message + " " + where;
93
+ }
94
+ function YAMLException(reason, mark) {
95
+ Error.call(this);
96
+ this.name = "YAMLException";
97
+ this.reason = reason;
98
+ this.mark = mark;
99
+ this.message = formatError(this, false);
100
+ if (Error.captureStackTrace) {
101
+ Error.captureStackTrace(this, this.constructor);
102
+ } else {
103
+ this.stack = new Error().stack || "";
104
+ }
105
+ }
106
+ YAMLException.prototype = Object.create(Error.prototype);
107
+ YAMLException.prototype.constructor = YAMLException;
108
+ YAMLException.prototype.toString = function toString(compact) {
109
+ return this.name + ": " + formatError(this, compact);
110
+ };
111
+ module.exports = YAMLException;
112
+ }
113
+ });
114
+
115
+ // node_modules/js-yaml/lib/snippet.js
116
+ var require_snippet = __commonJS({
117
+ "node_modules/js-yaml/lib/snippet.js"(exports, module) {
118
+ "use strict";
119
+ var common = require_common();
120
+ function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
121
+ var head = "";
122
+ var tail = "";
123
+ var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
124
+ if (position - lineStart > maxHalfLength) {
125
+ head = " ... ";
126
+ lineStart = position - maxHalfLength + head.length;
127
+ }
128
+ if (lineEnd - position > maxHalfLength) {
129
+ tail = " ...";
130
+ lineEnd = position + maxHalfLength - tail.length;
131
+ }
132
+ return {
133
+ str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, "\u2192") + tail,
134
+ pos: position - lineStart + head.length
135
+ // relative position
136
+ };
137
+ }
138
+ function padStart(string, max) {
139
+ return common.repeat(" ", max - string.length) + string;
140
+ }
141
+ function makeSnippet(mark, options) {
142
+ options = Object.create(options || null);
143
+ if (!mark.buffer) return null;
144
+ if (!options.maxLength) options.maxLength = 79;
145
+ if (typeof options.indent !== "number") options.indent = 1;
146
+ if (typeof options.linesBefore !== "number") options.linesBefore = 3;
147
+ if (typeof options.linesAfter !== "number") options.linesAfter = 2;
148
+ var re = /\r?\n|\r|\0/g;
149
+ var lineStarts = [0];
150
+ var lineEnds = [];
151
+ var match;
152
+ var foundLineNo = -1;
153
+ while (match = re.exec(mark.buffer)) {
154
+ lineEnds.push(match.index);
155
+ lineStarts.push(match.index + match[0].length);
156
+ if (mark.position <= match.index && foundLineNo < 0) {
157
+ foundLineNo = lineStarts.length - 2;
158
+ }
159
+ }
160
+ if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;
161
+ var result = "", i, line;
162
+ var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
163
+ var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
164
+ for (i = 1; i <= options.linesBefore; i++) {
165
+ if (foundLineNo - i < 0) break;
166
+ line = getLine(
167
+ mark.buffer,
168
+ lineStarts[foundLineNo - i],
169
+ lineEnds[foundLineNo - i],
170
+ mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]),
171
+ maxLineLength
172
+ );
173
+ result = common.repeat(" ", options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + " | " + line.str + "\n" + result;
174
+ }
175
+ line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
176
+ result += common.repeat(" ", options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line.str + "\n";
177
+ result += common.repeat("-", options.indent + lineNoLength + 3 + line.pos) + "^\n";
178
+ for (i = 1; i <= options.linesAfter; i++) {
179
+ if (foundLineNo + i >= lineEnds.length) break;
180
+ line = getLine(
181
+ mark.buffer,
182
+ lineStarts[foundLineNo + i],
183
+ lineEnds[foundLineNo + i],
184
+ mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]),
185
+ maxLineLength
186
+ );
187
+ result += common.repeat(" ", options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + " | " + line.str + "\n";
188
+ }
189
+ return result.replace(/\n$/, "");
190
+ }
191
+ module.exports = makeSnippet;
192
+ }
193
+ });
194
+
195
+ // node_modules/js-yaml/lib/type.js
196
+ var require_type = __commonJS({
197
+ "node_modules/js-yaml/lib/type.js"(exports, module) {
198
+ "use strict";
199
+ var YAMLException = require_exception();
200
+ var TYPE_CONSTRUCTOR_OPTIONS = [
201
+ "kind",
202
+ "multi",
203
+ "resolve",
204
+ "construct",
205
+ "instanceOf",
206
+ "predicate",
207
+ "represent",
208
+ "representName",
209
+ "defaultStyle",
210
+ "styleAliases"
211
+ ];
212
+ var YAML_NODE_KINDS = [
213
+ "scalar",
214
+ "sequence",
215
+ "mapping"
216
+ ];
217
+ function compileStyleAliases(map) {
218
+ var result = {};
219
+ if (map !== null) {
220
+ Object.keys(map).forEach(function(style) {
221
+ map[style].forEach(function(alias) {
222
+ result[String(alias)] = style;
223
+ });
224
+ });
225
+ }
226
+ return result;
227
+ }
228
+ function Type(tag, options) {
229
+ options = options || {};
230
+ Object.keys(options).forEach(function(name) {
231
+ if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
232
+ throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
233
+ }
234
+ });
235
+ this.options = options;
236
+ this.tag = tag;
237
+ this.kind = options["kind"] || null;
238
+ this.resolve = options["resolve"] || function() {
239
+ return true;
240
+ };
241
+ this.construct = options["construct"] || function(data) {
242
+ return data;
243
+ };
244
+ this.instanceOf = options["instanceOf"] || null;
245
+ this.predicate = options["predicate"] || null;
246
+ this.represent = options["represent"] || null;
247
+ this.representName = options["representName"] || null;
248
+ this.defaultStyle = options["defaultStyle"] || null;
249
+ this.multi = options["multi"] || false;
250
+ this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
251
+ if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
252
+ throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
253
+ }
254
+ }
255
+ module.exports = Type;
256
+ }
257
+ });
258
+
259
+ // node_modules/js-yaml/lib/schema.js
260
+ var require_schema = __commonJS({
261
+ "node_modules/js-yaml/lib/schema.js"(exports, module) {
262
+ "use strict";
263
+ var YAMLException = require_exception();
264
+ var Type = require_type();
265
+ function compileList(schema, name) {
266
+ var result = [];
267
+ schema[name].forEach(function(currentType) {
268
+ var newIndex = result.length;
269
+ result.forEach(function(previousType, previousIndex) {
270
+ if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) {
271
+ newIndex = previousIndex;
272
+ }
273
+ });
274
+ result[newIndex] = currentType;
275
+ });
276
+ return result;
277
+ }
278
+ function compileMap() {
279
+ var result = {
280
+ scalar: {},
281
+ sequence: {},
282
+ mapping: {},
283
+ fallback: {},
284
+ multi: {
285
+ scalar: [],
286
+ sequence: [],
287
+ mapping: [],
288
+ fallback: []
289
+ }
290
+ }, index, length;
291
+ function collectType(type) {
292
+ if (type.multi) {
293
+ result.multi[type.kind].push(type);
294
+ result.multi["fallback"].push(type);
295
+ } else {
296
+ result[type.kind][type.tag] = result["fallback"][type.tag] = type;
297
+ }
298
+ }
299
+ for (index = 0, length = arguments.length; index < length; index += 1) {
300
+ arguments[index].forEach(collectType);
301
+ }
302
+ return result;
303
+ }
304
+ function Schema(definition) {
305
+ return this.extend(definition);
306
+ }
307
+ Schema.prototype.extend = function extend(definition) {
308
+ var implicit = [];
309
+ var explicit = [];
310
+ if (definition instanceof Type) {
311
+ explicit.push(definition);
312
+ } else if (Array.isArray(definition)) {
313
+ explicit = explicit.concat(definition);
314
+ } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
315
+ if (definition.implicit) implicit = implicit.concat(definition.implicit);
316
+ if (definition.explicit) explicit = explicit.concat(definition.explicit);
317
+ } else {
318
+ throw new YAMLException("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
319
+ }
320
+ implicit.forEach(function(type) {
321
+ if (!(type instanceof Type)) {
322
+ throw new YAMLException("Specified list of YAML types (or a single Type object) contains a non-Type object.");
323
+ }
324
+ if (type.loadKind && type.loadKind !== "scalar") {
325
+ throw new YAMLException("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
326
+ }
327
+ if (type.multi) {
328
+ throw new YAMLException("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
329
+ }
330
+ });
331
+ explicit.forEach(function(type) {
332
+ if (!(type instanceof Type)) {
333
+ throw new YAMLException("Specified list of YAML types (or a single Type object) contains a non-Type object.");
334
+ }
335
+ });
336
+ var result = Object.create(Schema.prototype);
337
+ result.implicit = (this.implicit || []).concat(implicit);
338
+ result.explicit = (this.explicit || []).concat(explicit);
339
+ result.compiledImplicit = compileList(result, "implicit");
340
+ result.compiledExplicit = compileList(result, "explicit");
341
+ result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
342
+ return result;
343
+ };
344
+ module.exports = Schema;
345
+ }
346
+ });
347
+
348
+ // node_modules/js-yaml/lib/type/str.js
349
+ var require_str = __commonJS({
350
+ "node_modules/js-yaml/lib/type/str.js"(exports, module) {
351
+ "use strict";
352
+ var Type = require_type();
353
+ module.exports = new Type("tag:yaml.org,2002:str", {
354
+ kind: "scalar",
355
+ construct: function(data) {
356
+ return data !== null ? data : "";
357
+ }
358
+ });
359
+ }
360
+ });
361
+
362
+ // node_modules/js-yaml/lib/type/seq.js
363
+ var require_seq = __commonJS({
364
+ "node_modules/js-yaml/lib/type/seq.js"(exports, module) {
365
+ "use strict";
366
+ var Type = require_type();
367
+ module.exports = new Type("tag:yaml.org,2002:seq", {
368
+ kind: "sequence",
369
+ construct: function(data) {
370
+ return data !== null ? data : [];
371
+ }
372
+ });
373
+ }
374
+ });
375
+
376
+ // node_modules/js-yaml/lib/type/map.js
377
+ var require_map = __commonJS({
378
+ "node_modules/js-yaml/lib/type/map.js"(exports, module) {
379
+ "use strict";
380
+ var Type = require_type();
381
+ module.exports = new Type("tag:yaml.org,2002:map", {
382
+ kind: "mapping",
383
+ construct: function(data) {
384
+ return data !== null ? data : {};
385
+ }
386
+ });
387
+ }
388
+ });
389
+
390
+ // node_modules/js-yaml/lib/schema/failsafe.js
391
+ var require_failsafe = __commonJS({
392
+ "node_modules/js-yaml/lib/schema/failsafe.js"(exports, module) {
393
+ "use strict";
394
+ var Schema = require_schema();
395
+ module.exports = new Schema({
396
+ explicit: [
397
+ require_str(),
398
+ require_seq(),
399
+ require_map()
400
+ ]
401
+ });
402
+ }
403
+ });
404
+
405
+ // node_modules/js-yaml/lib/type/null.js
406
+ var require_null = __commonJS({
407
+ "node_modules/js-yaml/lib/type/null.js"(exports, module) {
408
+ "use strict";
409
+ var Type = require_type();
410
+ function resolveYamlNull(data) {
411
+ if (data === null) return true;
412
+ var max = data.length;
413
+ return max === 1 && data === "~" || max === 4 && (data === "null" || data === "Null" || data === "NULL");
414
+ }
415
+ function constructYamlNull() {
416
+ return null;
417
+ }
418
+ function isNull(object) {
419
+ return object === null;
420
+ }
421
+ module.exports = new Type("tag:yaml.org,2002:null", {
422
+ kind: "scalar",
423
+ resolve: resolveYamlNull,
424
+ construct: constructYamlNull,
425
+ predicate: isNull,
426
+ represent: {
427
+ canonical: function() {
428
+ return "~";
429
+ },
430
+ lowercase: function() {
431
+ return "null";
432
+ },
433
+ uppercase: function() {
434
+ return "NULL";
435
+ },
436
+ camelcase: function() {
437
+ return "Null";
438
+ },
439
+ empty: function() {
440
+ return "";
441
+ }
442
+ },
443
+ defaultStyle: "lowercase"
444
+ });
445
+ }
446
+ });
447
+
448
+ // node_modules/js-yaml/lib/type/bool.js
449
+ var require_bool = __commonJS({
450
+ "node_modules/js-yaml/lib/type/bool.js"(exports, module) {
451
+ "use strict";
452
+ var Type = require_type();
453
+ function resolveYamlBoolean(data) {
454
+ if (data === null) return false;
455
+ var max = data.length;
456
+ return max === 4 && (data === "true" || data === "True" || data === "TRUE") || max === 5 && (data === "false" || data === "False" || data === "FALSE");
457
+ }
458
+ function constructYamlBoolean(data) {
459
+ return data === "true" || data === "True" || data === "TRUE";
460
+ }
461
+ function isBoolean(object) {
462
+ return Object.prototype.toString.call(object) === "[object Boolean]";
463
+ }
464
+ module.exports = new Type("tag:yaml.org,2002:bool", {
465
+ kind: "scalar",
466
+ resolve: resolveYamlBoolean,
467
+ construct: constructYamlBoolean,
468
+ predicate: isBoolean,
469
+ represent: {
470
+ lowercase: function(object) {
471
+ return object ? "true" : "false";
472
+ },
473
+ uppercase: function(object) {
474
+ return object ? "TRUE" : "FALSE";
475
+ },
476
+ camelcase: function(object) {
477
+ return object ? "True" : "False";
478
+ }
479
+ },
480
+ defaultStyle: "lowercase"
481
+ });
482
+ }
483
+ });
484
+
485
+ // node_modules/js-yaml/lib/type/int.js
486
+ var require_int = __commonJS({
487
+ "node_modules/js-yaml/lib/type/int.js"(exports, module) {
488
+ "use strict";
489
+ var common = require_common();
490
+ var Type = require_type();
491
+ function isHexCode(c) {
492
+ return 48 <= c && c <= 57 || 65 <= c && c <= 70 || 97 <= c && c <= 102;
493
+ }
494
+ function isOctCode(c) {
495
+ return 48 <= c && c <= 55;
496
+ }
497
+ function isDecCode(c) {
498
+ return 48 <= c && c <= 57;
499
+ }
500
+ function resolveYamlInteger(data) {
501
+ if (data === null) return false;
502
+ var max = data.length, index = 0, hasDigits = false, ch;
503
+ if (!max) return false;
504
+ ch = data[index];
505
+ if (ch === "-" || ch === "+") {
506
+ ch = data[++index];
507
+ }
508
+ if (ch === "0") {
509
+ if (index + 1 === max) return true;
510
+ ch = data[++index];
511
+ if (ch === "b") {
512
+ index++;
513
+ for (; index < max; index++) {
514
+ ch = data[index];
515
+ if (ch === "_") continue;
516
+ if (ch !== "0" && ch !== "1") return false;
517
+ hasDigits = true;
518
+ }
519
+ return hasDigits && ch !== "_";
520
+ }
521
+ if (ch === "x") {
522
+ index++;
523
+ for (; index < max; index++) {
524
+ ch = data[index];
525
+ if (ch === "_") continue;
526
+ if (!isHexCode(data.charCodeAt(index))) return false;
527
+ hasDigits = true;
528
+ }
529
+ return hasDigits && ch !== "_";
530
+ }
531
+ if (ch === "o") {
532
+ index++;
533
+ for (; index < max; index++) {
534
+ ch = data[index];
535
+ if (ch === "_") continue;
536
+ if (!isOctCode(data.charCodeAt(index))) return false;
537
+ hasDigits = true;
538
+ }
539
+ return hasDigits && ch !== "_";
540
+ }
541
+ }
542
+ if (ch === "_") return false;
543
+ for (; index < max; index++) {
544
+ ch = data[index];
545
+ if (ch === "_") continue;
546
+ if (!isDecCode(data.charCodeAt(index))) {
547
+ return false;
548
+ }
549
+ hasDigits = true;
550
+ }
551
+ if (!hasDigits || ch === "_") return false;
552
+ return true;
553
+ }
554
+ function constructYamlInteger(data) {
555
+ var value = data, sign = 1, ch;
556
+ if (value.indexOf("_") !== -1) {
557
+ value = value.replace(/_/g, "");
558
+ }
559
+ ch = value[0];
560
+ if (ch === "-" || ch === "+") {
561
+ if (ch === "-") sign = -1;
562
+ value = value.slice(1);
563
+ ch = value[0];
564
+ }
565
+ if (value === "0") return 0;
566
+ if (ch === "0") {
567
+ if (value[1] === "b") return sign * parseInt(value.slice(2), 2);
568
+ if (value[1] === "x") return sign * parseInt(value.slice(2), 16);
569
+ if (value[1] === "o") return sign * parseInt(value.slice(2), 8);
570
+ }
571
+ return sign * parseInt(value, 10);
572
+ }
573
+ function isInteger(object) {
574
+ return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common.isNegativeZero(object));
575
+ }
576
+ module.exports = new Type("tag:yaml.org,2002:int", {
577
+ kind: "scalar",
578
+ resolve: resolveYamlInteger,
579
+ construct: constructYamlInteger,
580
+ predicate: isInteger,
581
+ represent: {
582
+ binary: function(obj) {
583
+ return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
584
+ },
585
+ octal: function(obj) {
586
+ return obj >= 0 ? "0o" + obj.toString(8) : "-0o" + obj.toString(8).slice(1);
587
+ },
588
+ decimal: function(obj) {
589
+ return obj.toString(10);
590
+ },
591
+ /* eslint-disable max-len */
592
+ hexadecimal: function(obj) {
593
+ return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
594
+ }
595
+ },
596
+ defaultStyle: "decimal",
597
+ styleAliases: {
598
+ binary: [2, "bin"],
599
+ octal: [8, "oct"],
600
+ decimal: [10, "dec"],
601
+ hexadecimal: [16, "hex"]
602
+ }
603
+ });
604
+ }
605
+ });
606
+
607
+ // node_modules/js-yaml/lib/type/float.js
608
+ var require_float = __commonJS({
609
+ "node_modules/js-yaml/lib/type/float.js"(exports, module) {
610
+ "use strict";
611
+ var common = require_common();
612
+ var Type = require_type();
613
+ var YAML_FLOAT_PATTERN = new RegExp(
614
+ // 2.5e4, 2.5 and integers
615
+ "^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"
616
+ );
617
+ function resolveYamlFloat(data) {
618
+ if (data === null) return false;
619
+ if (!YAML_FLOAT_PATTERN.test(data) || // Quick hack to not allow integers end with `_`
620
+ // Probably should update regexp & check speed
621
+ data[data.length - 1] === "_") {
622
+ return false;
623
+ }
624
+ return true;
625
+ }
626
+ function constructYamlFloat(data) {
627
+ var value, sign;
628
+ value = data.replace(/_/g, "").toLowerCase();
629
+ sign = value[0] === "-" ? -1 : 1;
630
+ if ("+-".indexOf(value[0]) >= 0) {
631
+ value = value.slice(1);
632
+ }
633
+ if (value === ".inf") {
634
+ return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
635
+ } else if (value === ".nan") {
636
+ return NaN;
637
+ }
638
+ return sign * parseFloat(value, 10);
639
+ }
640
+ var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
641
+ function representYamlFloat(object, style) {
642
+ var res;
643
+ if (isNaN(object)) {
644
+ switch (style) {
645
+ case "lowercase":
646
+ return ".nan";
647
+ case "uppercase":
648
+ return ".NAN";
649
+ case "camelcase":
650
+ return ".NaN";
651
+ }
652
+ } else if (Number.POSITIVE_INFINITY === object) {
653
+ switch (style) {
654
+ case "lowercase":
655
+ return ".inf";
656
+ case "uppercase":
657
+ return ".INF";
658
+ case "camelcase":
659
+ return ".Inf";
660
+ }
661
+ } else if (Number.NEGATIVE_INFINITY === object) {
662
+ switch (style) {
663
+ case "lowercase":
664
+ return "-.inf";
665
+ case "uppercase":
666
+ return "-.INF";
667
+ case "camelcase":
668
+ return "-.Inf";
669
+ }
670
+ } else if (common.isNegativeZero(object)) {
671
+ return "-0.0";
672
+ }
673
+ res = object.toString(10);
674
+ return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
675
+ }
676
+ function isFloat(object) {
677
+ return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
678
+ }
679
+ module.exports = new Type("tag:yaml.org,2002:float", {
680
+ kind: "scalar",
681
+ resolve: resolveYamlFloat,
682
+ construct: constructYamlFloat,
683
+ predicate: isFloat,
684
+ represent: representYamlFloat,
685
+ defaultStyle: "lowercase"
686
+ });
687
+ }
688
+ });
689
+
690
+ // node_modules/js-yaml/lib/schema/json.js
691
+ var require_json = __commonJS({
692
+ "node_modules/js-yaml/lib/schema/json.js"(exports, module) {
693
+ "use strict";
694
+ module.exports = require_failsafe().extend({
695
+ implicit: [
696
+ require_null(),
697
+ require_bool(),
698
+ require_int(),
699
+ require_float()
700
+ ]
701
+ });
702
+ }
703
+ });
704
+
705
+ // node_modules/js-yaml/lib/schema/core.js
706
+ var require_core = __commonJS({
707
+ "node_modules/js-yaml/lib/schema/core.js"(exports, module) {
708
+ "use strict";
709
+ module.exports = require_json();
710
+ }
711
+ });
712
+
713
+ // node_modules/js-yaml/lib/type/timestamp.js
714
+ var require_timestamp = __commonJS({
715
+ "node_modules/js-yaml/lib/type/timestamp.js"(exports, module) {
716
+ "use strict";
717
+ var Type = require_type();
718
+ var YAML_DATE_REGEXP = new RegExp(
719
+ "^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"
720
+ );
721
+ var YAML_TIMESTAMP_REGEXP = new RegExp(
722
+ "^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$"
723
+ );
724
+ function resolveYamlTimestamp(data) {
725
+ if (data === null) return false;
726
+ if (YAML_DATE_REGEXP.exec(data) !== null) return true;
727
+ if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
728
+ return false;
729
+ }
730
+ function constructYamlTimestamp(data) {
731
+ var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date;
732
+ match = YAML_DATE_REGEXP.exec(data);
733
+ if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
734
+ if (match === null) throw new Error("Date resolve error");
735
+ year = +match[1];
736
+ month = +match[2] - 1;
737
+ day = +match[3];
738
+ if (!match[4]) {
739
+ return new Date(Date.UTC(year, month, day));
740
+ }
741
+ hour = +match[4];
742
+ minute = +match[5];
743
+ second = +match[6];
744
+ if (match[7]) {
745
+ fraction = match[7].slice(0, 3);
746
+ while (fraction.length < 3) {
747
+ fraction += "0";
748
+ }
749
+ fraction = +fraction;
750
+ }
751
+ if (match[9]) {
752
+ tz_hour = +match[10];
753
+ tz_minute = +(match[11] || 0);
754
+ delta = (tz_hour * 60 + tz_minute) * 6e4;
755
+ if (match[9] === "-") delta = -delta;
756
+ }
757
+ date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
758
+ if (delta) date.setTime(date.getTime() - delta);
759
+ return date;
760
+ }
761
+ function representYamlTimestamp(object) {
762
+ return object.toISOString();
763
+ }
764
+ module.exports = new Type("tag:yaml.org,2002:timestamp", {
765
+ kind: "scalar",
766
+ resolve: resolveYamlTimestamp,
767
+ construct: constructYamlTimestamp,
768
+ instanceOf: Date,
769
+ represent: representYamlTimestamp
770
+ });
771
+ }
772
+ });
773
+
774
+ // node_modules/js-yaml/lib/type/merge.js
775
+ var require_merge = __commonJS({
776
+ "node_modules/js-yaml/lib/type/merge.js"(exports, module) {
777
+ "use strict";
778
+ var Type = require_type();
779
+ function resolveYamlMerge(data) {
780
+ return data === "<<" || data === null;
781
+ }
782
+ module.exports = new Type("tag:yaml.org,2002:merge", {
783
+ kind: "scalar",
784
+ resolve: resolveYamlMerge
785
+ });
786
+ }
787
+ });
788
+
789
+ // node_modules/js-yaml/lib/type/binary.js
790
+ var require_binary = __commonJS({
791
+ "node_modules/js-yaml/lib/type/binary.js"(exports, module) {
792
+ "use strict";
793
+ var Type = require_type();
794
+ var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
795
+ function resolveYamlBinary(data) {
796
+ if (data === null) return false;
797
+ var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP;
798
+ for (idx = 0; idx < max; idx++) {
799
+ code = map.indexOf(data.charAt(idx));
800
+ if (code > 64) continue;
801
+ if (code < 0) return false;
802
+ bitlen += 6;
803
+ }
804
+ return bitlen % 8 === 0;
805
+ }
806
+ function constructYamlBinary(data) {
807
+ var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max = input.length, map = BASE64_MAP, bits = 0, result = [];
808
+ for (idx = 0; idx < max; idx++) {
809
+ if (idx % 4 === 0 && idx) {
810
+ result.push(bits >> 16 & 255);
811
+ result.push(bits >> 8 & 255);
812
+ result.push(bits & 255);
813
+ }
814
+ bits = bits << 6 | map.indexOf(input.charAt(idx));
815
+ }
816
+ tailbits = max % 4 * 6;
817
+ if (tailbits === 0) {
818
+ result.push(bits >> 16 & 255);
819
+ result.push(bits >> 8 & 255);
820
+ result.push(bits & 255);
821
+ } else if (tailbits === 18) {
822
+ result.push(bits >> 10 & 255);
823
+ result.push(bits >> 2 & 255);
824
+ } else if (tailbits === 12) {
825
+ result.push(bits >> 4 & 255);
826
+ }
827
+ return new Uint8Array(result);
828
+ }
829
+ function representYamlBinary(object) {
830
+ var result = "", bits = 0, idx, tail, max = object.length, map = BASE64_MAP;
831
+ for (idx = 0; idx < max; idx++) {
832
+ if (idx % 3 === 0 && idx) {
833
+ result += map[bits >> 18 & 63];
834
+ result += map[bits >> 12 & 63];
835
+ result += map[bits >> 6 & 63];
836
+ result += map[bits & 63];
837
+ }
838
+ bits = (bits << 8) + object[idx];
839
+ }
840
+ tail = max % 3;
841
+ if (tail === 0) {
842
+ result += map[bits >> 18 & 63];
843
+ result += map[bits >> 12 & 63];
844
+ result += map[bits >> 6 & 63];
845
+ result += map[bits & 63];
846
+ } else if (tail === 2) {
847
+ result += map[bits >> 10 & 63];
848
+ result += map[bits >> 4 & 63];
849
+ result += map[bits << 2 & 63];
850
+ result += map[64];
851
+ } else if (tail === 1) {
852
+ result += map[bits >> 2 & 63];
853
+ result += map[bits << 4 & 63];
854
+ result += map[64];
855
+ result += map[64];
856
+ }
857
+ return result;
858
+ }
859
+ function isBinary(obj) {
860
+ return Object.prototype.toString.call(obj) === "[object Uint8Array]";
861
+ }
862
+ module.exports = new Type("tag:yaml.org,2002:binary", {
863
+ kind: "scalar",
864
+ resolve: resolveYamlBinary,
865
+ construct: constructYamlBinary,
866
+ predicate: isBinary,
867
+ represent: representYamlBinary
868
+ });
869
+ }
870
+ });
871
+
872
+ // node_modules/js-yaml/lib/type/omap.js
873
+ var require_omap = __commonJS({
874
+ "node_modules/js-yaml/lib/type/omap.js"(exports, module) {
875
+ "use strict";
876
+ var Type = require_type();
877
+ var _hasOwnProperty = Object.prototype.hasOwnProperty;
878
+ var _toString = Object.prototype.toString;
879
+ function resolveYamlOmap(data) {
880
+ if (data === null) return true;
881
+ var objectKeys = [], index, length, pair, pairKey, pairHasKey, object = data;
882
+ for (index = 0, length = object.length; index < length; index += 1) {
883
+ pair = object[index];
884
+ pairHasKey = false;
885
+ if (_toString.call(pair) !== "[object Object]") return false;
886
+ for (pairKey in pair) {
887
+ if (_hasOwnProperty.call(pair, pairKey)) {
888
+ if (!pairHasKey) pairHasKey = true;
889
+ else return false;
890
+ }
891
+ }
892
+ if (!pairHasKey) return false;
893
+ if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
894
+ else return false;
895
+ }
896
+ return true;
897
+ }
898
+ function constructYamlOmap(data) {
899
+ return data !== null ? data : [];
900
+ }
901
+ module.exports = new Type("tag:yaml.org,2002:omap", {
902
+ kind: "sequence",
903
+ resolve: resolveYamlOmap,
904
+ construct: constructYamlOmap
905
+ });
906
+ }
907
+ });
908
+
909
+ // node_modules/js-yaml/lib/type/pairs.js
910
+ var require_pairs = __commonJS({
911
+ "node_modules/js-yaml/lib/type/pairs.js"(exports, module) {
912
+ "use strict";
913
+ var Type = require_type();
914
+ var _toString = Object.prototype.toString;
915
+ function resolveYamlPairs(data) {
916
+ if (data === null) return true;
917
+ var index, length, pair, keys, result, object = data;
918
+ result = new Array(object.length);
919
+ for (index = 0, length = object.length; index < length; index += 1) {
920
+ pair = object[index];
921
+ if (_toString.call(pair) !== "[object Object]") return false;
922
+ keys = Object.keys(pair);
923
+ if (keys.length !== 1) return false;
924
+ result[index] = [keys[0], pair[keys[0]]];
925
+ }
926
+ return true;
927
+ }
928
+ function constructYamlPairs(data) {
929
+ if (data === null) return [];
930
+ var index, length, pair, keys, result, object = data;
931
+ result = new Array(object.length);
932
+ for (index = 0, length = object.length; index < length; index += 1) {
933
+ pair = object[index];
934
+ keys = Object.keys(pair);
935
+ result[index] = [keys[0], pair[keys[0]]];
936
+ }
937
+ return result;
938
+ }
939
+ module.exports = new Type("tag:yaml.org,2002:pairs", {
940
+ kind: "sequence",
941
+ resolve: resolveYamlPairs,
942
+ construct: constructYamlPairs
943
+ });
944
+ }
945
+ });
946
+
947
+ // node_modules/js-yaml/lib/type/set.js
948
+ var require_set = __commonJS({
949
+ "node_modules/js-yaml/lib/type/set.js"(exports, module) {
950
+ "use strict";
951
+ var Type = require_type();
952
+ var _hasOwnProperty = Object.prototype.hasOwnProperty;
953
+ function resolveYamlSet(data) {
954
+ if (data === null) return true;
955
+ var key, object = data;
956
+ for (key in object) {
957
+ if (_hasOwnProperty.call(object, key)) {
958
+ if (object[key] !== null) return false;
959
+ }
960
+ }
961
+ return true;
962
+ }
963
+ function constructYamlSet(data) {
964
+ return data !== null ? data : {};
965
+ }
966
+ module.exports = new Type("tag:yaml.org,2002:set", {
967
+ kind: "mapping",
968
+ resolve: resolveYamlSet,
969
+ construct: constructYamlSet
970
+ });
971
+ }
972
+ });
973
+
974
+ // node_modules/js-yaml/lib/schema/default.js
975
+ var require_default = __commonJS({
976
+ "node_modules/js-yaml/lib/schema/default.js"(exports, module) {
977
+ "use strict";
978
+ module.exports = require_core().extend({
979
+ implicit: [
980
+ require_timestamp(),
981
+ require_merge()
982
+ ],
983
+ explicit: [
984
+ require_binary(),
985
+ require_omap(),
986
+ require_pairs(),
987
+ require_set()
988
+ ]
989
+ });
990
+ }
991
+ });
992
+
993
+ // node_modules/js-yaml/lib/loader.js
994
+ var require_loader = __commonJS({
995
+ "node_modules/js-yaml/lib/loader.js"(exports, module) {
996
+ "use strict";
997
+ var common = require_common();
998
+ var YAMLException = require_exception();
999
+ var makeSnippet = require_snippet();
1000
+ var DEFAULT_SCHEMA = require_default();
1001
+ var _hasOwnProperty = Object.prototype.hasOwnProperty;
1002
+ var CONTEXT_FLOW_IN = 1;
1003
+ var CONTEXT_FLOW_OUT = 2;
1004
+ var CONTEXT_BLOCK_IN = 3;
1005
+ var CONTEXT_BLOCK_OUT = 4;
1006
+ var CHOMPING_CLIP = 1;
1007
+ var CHOMPING_STRIP = 2;
1008
+ var CHOMPING_KEEP = 3;
1009
+ var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
1010
+ var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
1011
+ var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
1012
+ var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
1013
+ var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
1014
+ function _class(obj) {
1015
+ return Object.prototype.toString.call(obj);
1016
+ }
1017
+ function is_EOL(c) {
1018
+ return c === 10 || c === 13;
1019
+ }
1020
+ function is_WHITE_SPACE(c) {
1021
+ return c === 9 || c === 32;
1022
+ }
1023
+ function is_WS_OR_EOL(c) {
1024
+ return c === 9 || c === 32 || c === 10 || c === 13;
1025
+ }
1026
+ function is_FLOW_INDICATOR(c) {
1027
+ return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
1028
+ }
1029
+ function fromHexCode(c) {
1030
+ var lc;
1031
+ if (48 <= c && c <= 57) {
1032
+ return c - 48;
1033
+ }
1034
+ lc = c | 32;
1035
+ if (97 <= lc && lc <= 102) {
1036
+ return lc - 97 + 10;
1037
+ }
1038
+ return -1;
1039
+ }
1040
+ function escapedHexLen(c) {
1041
+ if (c === 120) {
1042
+ return 2;
1043
+ }
1044
+ if (c === 117) {
1045
+ return 4;
1046
+ }
1047
+ if (c === 85) {
1048
+ return 8;
1049
+ }
1050
+ return 0;
1051
+ }
1052
+ function fromDecimalCode(c) {
1053
+ if (48 <= c && c <= 57) {
1054
+ return c - 48;
1055
+ }
1056
+ return -1;
1057
+ }
1058
+ function simpleEscapeSequence(c) {
1059
+ return c === 48 ? "\0" : c === 97 ? "\x07" : c === 98 ? "\b" : c === 116 ? " " : c === 9 ? " " : c === 110 ? "\n" : c === 118 ? "\v" : c === 102 ? "\f" : c === 114 ? "\r" : c === 101 ? "\x1B" : c === 32 ? " " : c === 34 ? '"' : c === 47 ? "/" : c === 92 ? "\\" : c === 78 ? "\x85" : c === 95 ? "\xA0" : c === 76 ? "\u2028" : c === 80 ? "\u2029" : "";
1060
+ }
1061
+ function charFromCodepoint(c) {
1062
+ if (c <= 65535) {
1063
+ return String.fromCharCode(c);
1064
+ }
1065
+ return String.fromCharCode(
1066
+ (c - 65536 >> 10) + 55296,
1067
+ (c - 65536 & 1023) + 56320
1068
+ );
1069
+ }
1070
+ var simpleEscapeCheck = new Array(256);
1071
+ var simpleEscapeMap = new Array(256);
1072
+ for (i = 0; i < 256; i++) {
1073
+ simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
1074
+ simpleEscapeMap[i] = simpleEscapeSequence(i);
1075
+ }
1076
+ var i;
1077
+ function State(input, options) {
1078
+ this.input = input;
1079
+ this.filename = options["filename"] || null;
1080
+ this.schema = options["schema"] || DEFAULT_SCHEMA;
1081
+ this.onWarning = options["onWarning"] || null;
1082
+ this.legacy = options["legacy"] || false;
1083
+ this.json = options["json"] || false;
1084
+ this.listener = options["listener"] || null;
1085
+ this.implicitTypes = this.schema.compiledImplicit;
1086
+ this.typeMap = this.schema.compiledTypeMap;
1087
+ this.length = input.length;
1088
+ this.position = 0;
1089
+ this.line = 0;
1090
+ this.lineStart = 0;
1091
+ this.lineIndent = 0;
1092
+ this.firstTabInLine = -1;
1093
+ this.documents = [];
1094
+ }
1095
+ function generateError(state, message) {
1096
+ var mark = {
1097
+ name: state.filename,
1098
+ buffer: state.input.slice(0, -1),
1099
+ // omit trailing \0
1100
+ position: state.position,
1101
+ line: state.line,
1102
+ column: state.position - state.lineStart
1103
+ };
1104
+ mark.snippet = makeSnippet(mark);
1105
+ return new YAMLException(message, mark);
1106
+ }
1107
+ function throwError(state, message) {
1108
+ throw generateError(state, message);
1109
+ }
1110
+ function throwWarning(state, message) {
1111
+ if (state.onWarning) {
1112
+ state.onWarning.call(null, generateError(state, message));
1113
+ }
1114
+ }
1115
+ var directiveHandlers = {
1116
+ YAML: function handleYamlDirective(state, name, args) {
1117
+ var match, major, minor;
1118
+ if (state.version !== null) {
1119
+ throwError(state, "duplication of %YAML directive");
1120
+ }
1121
+ if (args.length !== 1) {
1122
+ throwError(state, "YAML directive accepts exactly one argument");
1123
+ }
1124
+ match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
1125
+ if (match === null) {
1126
+ throwError(state, "ill-formed argument of the YAML directive");
1127
+ }
1128
+ major = parseInt(match[1], 10);
1129
+ minor = parseInt(match[2], 10);
1130
+ if (major !== 1) {
1131
+ throwError(state, "unacceptable YAML version of the document");
1132
+ }
1133
+ state.version = args[0];
1134
+ state.checkLineBreaks = minor < 2;
1135
+ if (minor !== 1 && minor !== 2) {
1136
+ throwWarning(state, "unsupported YAML version of the document");
1137
+ }
1138
+ },
1139
+ TAG: function handleTagDirective(state, name, args) {
1140
+ var handle, prefix;
1141
+ if (args.length !== 2) {
1142
+ throwError(state, "TAG directive accepts exactly two arguments");
1143
+ }
1144
+ handle = args[0];
1145
+ prefix = args[1];
1146
+ if (!PATTERN_TAG_HANDLE.test(handle)) {
1147
+ throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
1148
+ }
1149
+ if (_hasOwnProperty.call(state.tagMap, handle)) {
1150
+ throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
1151
+ }
1152
+ if (!PATTERN_TAG_URI.test(prefix)) {
1153
+ throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
1154
+ }
1155
+ try {
1156
+ prefix = decodeURIComponent(prefix);
1157
+ } catch (err) {
1158
+ throwError(state, "tag prefix is malformed: " + prefix);
1159
+ }
1160
+ state.tagMap[handle] = prefix;
1161
+ }
1162
+ };
1163
+ function captureSegment(state, start, end, checkJson) {
1164
+ var _position, _length, _character, _result;
1165
+ if (start < end) {
1166
+ _result = state.input.slice(start, end);
1167
+ if (checkJson) {
1168
+ for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
1169
+ _character = _result.charCodeAt(_position);
1170
+ if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
1171
+ throwError(state, "expected valid JSON character");
1172
+ }
1173
+ }
1174
+ } else if (PATTERN_NON_PRINTABLE.test(_result)) {
1175
+ throwError(state, "the stream contains non-printable characters");
1176
+ }
1177
+ state.result += _result;
1178
+ }
1179
+ }
1180
+ function mergeMappings(state, destination, source, overridableKeys) {
1181
+ var sourceKeys, key, index, quantity;
1182
+ if (!common.isObject(source)) {
1183
+ throwError(state, "cannot merge mappings; the provided source object is unacceptable");
1184
+ }
1185
+ sourceKeys = Object.keys(source);
1186
+ for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
1187
+ key = sourceKeys[index];
1188
+ if (!_hasOwnProperty.call(destination, key)) {
1189
+ destination[key] = source[key];
1190
+ overridableKeys[key] = true;
1191
+ }
1192
+ }
1193
+ }
1194
+ function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) {
1195
+ var index, quantity;
1196
+ if (Array.isArray(keyNode)) {
1197
+ keyNode = Array.prototype.slice.call(keyNode);
1198
+ for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
1199
+ if (Array.isArray(keyNode[index])) {
1200
+ throwError(state, "nested arrays are not supported inside keys");
1201
+ }
1202
+ if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") {
1203
+ keyNode[index] = "[object Object]";
1204
+ }
1205
+ }
1206
+ }
1207
+ if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") {
1208
+ keyNode = "[object Object]";
1209
+ }
1210
+ keyNode = String(keyNode);
1211
+ if (_result === null) {
1212
+ _result = {};
1213
+ }
1214
+ if (keyTag === "tag:yaml.org,2002:merge") {
1215
+ if (Array.isArray(valueNode)) {
1216
+ for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
1217
+ mergeMappings(state, _result, valueNode[index], overridableKeys);
1218
+ }
1219
+ } else {
1220
+ mergeMappings(state, _result, valueNode, overridableKeys);
1221
+ }
1222
+ } else {
1223
+ if (!state.json && !_hasOwnProperty.call(overridableKeys, keyNode) && _hasOwnProperty.call(_result, keyNode)) {
1224
+ state.line = startLine || state.line;
1225
+ state.lineStart = startLineStart || state.lineStart;
1226
+ state.position = startPos || state.position;
1227
+ throwError(state, "duplicated mapping key");
1228
+ }
1229
+ if (keyNode === "__proto__") {
1230
+ Object.defineProperty(_result, keyNode, {
1231
+ configurable: true,
1232
+ enumerable: true,
1233
+ writable: true,
1234
+ value: valueNode
1235
+ });
1236
+ } else {
1237
+ _result[keyNode] = valueNode;
1238
+ }
1239
+ delete overridableKeys[keyNode];
1240
+ }
1241
+ return _result;
1242
+ }
1243
+ function readLineBreak(state) {
1244
+ var ch;
1245
+ ch = state.input.charCodeAt(state.position);
1246
+ if (ch === 10) {
1247
+ state.position++;
1248
+ } else if (ch === 13) {
1249
+ state.position++;
1250
+ if (state.input.charCodeAt(state.position) === 10) {
1251
+ state.position++;
1252
+ }
1253
+ } else {
1254
+ throwError(state, "a line break is expected");
1255
+ }
1256
+ state.line += 1;
1257
+ state.lineStart = state.position;
1258
+ state.firstTabInLine = -1;
1259
+ }
1260
+ function skipSeparationSpace(state, allowComments, checkIndent) {
1261
+ var lineBreaks = 0, ch = state.input.charCodeAt(state.position);
1262
+ while (ch !== 0) {
1263
+ while (is_WHITE_SPACE(ch)) {
1264
+ if (ch === 9 && state.firstTabInLine === -1) {
1265
+ state.firstTabInLine = state.position;
1266
+ }
1267
+ ch = state.input.charCodeAt(++state.position);
1268
+ }
1269
+ if (allowComments && ch === 35) {
1270
+ do {
1271
+ ch = state.input.charCodeAt(++state.position);
1272
+ } while (ch !== 10 && ch !== 13 && ch !== 0);
1273
+ }
1274
+ if (is_EOL(ch)) {
1275
+ readLineBreak(state);
1276
+ ch = state.input.charCodeAt(state.position);
1277
+ lineBreaks++;
1278
+ state.lineIndent = 0;
1279
+ while (ch === 32) {
1280
+ state.lineIndent++;
1281
+ ch = state.input.charCodeAt(++state.position);
1282
+ }
1283
+ } else {
1284
+ break;
1285
+ }
1286
+ }
1287
+ if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
1288
+ throwWarning(state, "deficient indentation");
1289
+ }
1290
+ return lineBreaks;
1291
+ }
1292
+ function testDocumentSeparator(state) {
1293
+ var _position = state.position, ch;
1294
+ ch = state.input.charCodeAt(_position);
1295
+ if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
1296
+ _position += 3;
1297
+ ch = state.input.charCodeAt(_position);
1298
+ if (ch === 0 || is_WS_OR_EOL(ch)) {
1299
+ return true;
1300
+ }
1301
+ }
1302
+ return false;
1303
+ }
1304
+ function writeFoldedLines(state, count) {
1305
+ if (count === 1) {
1306
+ state.result += " ";
1307
+ } else if (count > 1) {
1308
+ state.result += common.repeat("\n", count - 1);
1309
+ }
1310
+ }
1311
+ function readPlainScalar(state, nodeIndent, withinFlowCollection) {
1312
+ var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state.kind, _result = state.result, ch;
1313
+ ch = state.input.charCodeAt(state.position);
1314
+ if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96) {
1315
+ return false;
1316
+ }
1317
+ if (ch === 63 || ch === 45) {
1318
+ following = state.input.charCodeAt(state.position + 1);
1319
+ if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
1320
+ return false;
1321
+ }
1322
+ }
1323
+ state.kind = "scalar";
1324
+ state.result = "";
1325
+ captureStart = captureEnd = state.position;
1326
+ hasPendingContent = false;
1327
+ while (ch !== 0) {
1328
+ if (ch === 58) {
1329
+ following = state.input.charCodeAt(state.position + 1);
1330
+ if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
1331
+ break;
1332
+ }
1333
+ } else if (ch === 35) {
1334
+ preceding = state.input.charCodeAt(state.position - 1);
1335
+ if (is_WS_OR_EOL(preceding)) {
1336
+ break;
1337
+ }
1338
+ } else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && is_FLOW_INDICATOR(ch)) {
1339
+ break;
1340
+ } else if (is_EOL(ch)) {
1341
+ _line = state.line;
1342
+ _lineStart = state.lineStart;
1343
+ _lineIndent = state.lineIndent;
1344
+ skipSeparationSpace(state, false, -1);
1345
+ if (state.lineIndent >= nodeIndent) {
1346
+ hasPendingContent = true;
1347
+ ch = state.input.charCodeAt(state.position);
1348
+ continue;
1349
+ } else {
1350
+ state.position = captureEnd;
1351
+ state.line = _line;
1352
+ state.lineStart = _lineStart;
1353
+ state.lineIndent = _lineIndent;
1354
+ break;
1355
+ }
1356
+ }
1357
+ if (hasPendingContent) {
1358
+ captureSegment(state, captureStart, captureEnd, false);
1359
+ writeFoldedLines(state, state.line - _line);
1360
+ captureStart = captureEnd = state.position;
1361
+ hasPendingContent = false;
1362
+ }
1363
+ if (!is_WHITE_SPACE(ch)) {
1364
+ captureEnd = state.position + 1;
1365
+ }
1366
+ ch = state.input.charCodeAt(++state.position);
1367
+ }
1368
+ captureSegment(state, captureStart, captureEnd, false);
1369
+ if (state.result) {
1370
+ return true;
1371
+ }
1372
+ state.kind = _kind;
1373
+ state.result = _result;
1374
+ return false;
1375
+ }
1376
+ function readSingleQuotedScalar(state, nodeIndent) {
1377
+ var ch, captureStart, captureEnd;
1378
+ ch = state.input.charCodeAt(state.position);
1379
+ if (ch !== 39) {
1380
+ return false;
1381
+ }
1382
+ state.kind = "scalar";
1383
+ state.result = "";
1384
+ state.position++;
1385
+ captureStart = captureEnd = state.position;
1386
+ while ((ch = state.input.charCodeAt(state.position)) !== 0) {
1387
+ if (ch === 39) {
1388
+ captureSegment(state, captureStart, state.position, true);
1389
+ ch = state.input.charCodeAt(++state.position);
1390
+ if (ch === 39) {
1391
+ captureStart = state.position;
1392
+ state.position++;
1393
+ captureEnd = state.position;
1394
+ } else {
1395
+ return true;
1396
+ }
1397
+ } else if (is_EOL(ch)) {
1398
+ captureSegment(state, captureStart, captureEnd, true);
1399
+ writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
1400
+ captureStart = captureEnd = state.position;
1401
+ } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
1402
+ throwError(state, "unexpected end of the document within a single quoted scalar");
1403
+ } else {
1404
+ state.position++;
1405
+ captureEnd = state.position;
1406
+ }
1407
+ }
1408
+ throwError(state, "unexpected end of the stream within a single quoted scalar");
1409
+ }
1410
+ function readDoubleQuotedScalar(state, nodeIndent) {
1411
+ var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
1412
+ ch = state.input.charCodeAt(state.position);
1413
+ if (ch !== 34) {
1414
+ return false;
1415
+ }
1416
+ state.kind = "scalar";
1417
+ state.result = "";
1418
+ state.position++;
1419
+ captureStart = captureEnd = state.position;
1420
+ while ((ch = state.input.charCodeAt(state.position)) !== 0) {
1421
+ if (ch === 34) {
1422
+ captureSegment(state, captureStart, state.position, true);
1423
+ state.position++;
1424
+ return true;
1425
+ } else if (ch === 92) {
1426
+ captureSegment(state, captureStart, state.position, true);
1427
+ ch = state.input.charCodeAt(++state.position);
1428
+ if (is_EOL(ch)) {
1429
+ skipSeparationSpace(state, false, nodeIndent);
1430
+ } else if (ch < 256 && simpleEscapeCheck[ch]) {
1431
+ state.result += simpleEscapeMap[ch];
1432
+ state.position++;
1433
+ } else if ((tmp = escapedHexLen(ch)) > 0) {
1434
+ hexLength = tmp;
1435
+ hexResult = 0;
1436
+ for (; hexLength > 0; hexLength--) {
1437
+ ch = state.input.charCodeAt(++state.position);
1438
+ if ((tmp = fromHexCode(ch)) >= 0) {
1439
+ hexResult = (hexResult << 4) + tmp;
1440
+ } else {
1441
+ throwError(state, "expected hexadecimal character");
1442
+ }
1443
+ }
1444
+ state.result += charFromCodepoint(hexResult);
1445
+ state.position++;
1446
+ } else {
1447
+ throwError(state, "unknown escape sequence");
1448
+ }
1449
+ captureStart = captureEnd = state.position;
1450
+ } else if (is_EOL(ch)) {
1451
+ captureSegment(state, captureStart, captureEnd, true);
1452
+ writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
1453
+ captureStart = captureEnd = state.position;
1454
+ } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
1455
+ throwError(state, "unexpected end of the document within a double quoted scalar");
1456
+ } else {
1457
+ state.position++;
1458
+ captureEnd = state.position;
1459
+ }
1460
+ }
1461
+ throwError(state, "unexpected end of the stream within a double quoted scalar");
1462
+ }
1463
+ function readFlowCollection(state, nodeIndent) {
1464
+ var readNext = true, _line, _lineStart, _pos, _tag = state.tag, _result, _anchor = state.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = /* @__PURE__ */ Object.create(null), keyNode, keyTag, valueNode, ch;
1465
+ ch = state.input.charCodeAt(state.position);
1466
+ if (ch === 91) {
1467
+ terminator = 93;
1468
+ isMapping = false;
1469
+ _result = [];
1470
+ } else if (ch === 123) {
1471
+ terminator = 125;
1472
+ isMapping = true;
1473
+ _result = {};
1474
+ } else {
1475
+ return false;
1476
+ }
1477
+ if (state.anchor !== null) {
1478
+ state.anchorMap[state.anchor] = _result;
1479
+ }
1480
+ ch = state.input.charCodeAt(++state.position);
1481
+ while (ch !== 0) {
1482
+ skipSeparationSpace(state, true, nodeIndent);
1483
+ ch = state.input.charCodeAt(state.position);
1484
+ if (ch === terminator) {
1485
+ state.position++;
1486
+ state.tag = _tag;
1487
+ state.anchor = _anchor;
1488
+ state.kind = isMapping ? "mapping" : "sequence";
1489
+ state.result = _result;
1490
+ return true;
1491
+ } else if (!readNext) {
1492
+ throwError(state, "missed comma between flow collection entries");
1493
+ } else if (ch === 44) {
1494
+ throwError(state, "expected the node content, but found ','");
1495
+ }
1496
+ keyTag = keyNode = valueNode = null;
1497
+ isPair = isExplicitPair = false;
1498
+ if (ch === 63) {
1499
+ following = state.input.charCodeAt(state.position + 1);
1500
+ if (is_WS_OR_EOL(following)) {
1501
+ isPair = isExplicitPair = true;
1502
+ state.position++;
1503
+ skipSeparationSpace(state, true, nodeIndent);
1504
+ }
1505
+ }
1506
+ _line = state.line;
1507
+ _lineStart = state.lineStart;
1508
+ _pos = state.position;
1509
+ composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
1510
+ keyTag = state.tag;
1511
+ keyNode = state.result;
1512
+ skipSeparationSpace(state, true, nodeIndent);
1513
+ ch = state.input.charCodeAt(state.position);
1514
+ if ((isExplicitPair || state.line === _line) && ch === 58) {
1515
+ isPair = true;
1516
+ ch = state.input.charCodeAt(++state.position);
1517
+ skipSeparationSpace(state, true, nodeIndent);
1518
+ composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
1519
+ valueNode = state.result;
1520
+ }
1521
+ if (isMapping) {
1522
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
1523
+ } else if (isPair) {
1524
+ _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
1525
+ } else {
1526
+ _result.push(keyNode);
1527
+ }
1528
+ skipSeparationSpace(state, true, nodeIndent);
1529
+ ch = state.input.charCodeAt(state.position);
1530
+ if (ch === 44) {
1531
+ readNext = true;
1532
+ ch = state.input.charCodeAt(++state.position);
1533
+ } else {
1534
+ readNext = false;
1535
+ }
1536
+ }
1537
+ throwError(state, "unexpected end of the stream within a flow collection");
1538
+ }
1539
+ function readBlockScalar(state, nodeIndent) {
1540
+ var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch;
1541
+ ch = state.input.charCodeAt(state.position);
1542
+ if (ch === 124) {
1543
+ folding = false;
1544
+ } else if (ch === 62) {
1545
+ folding = true;
1546
+ } else {
1547
+ return false;
1548
+ }
1549
+ state.kind = "scalar";
1550
+ state.result = "";
1551
+ while (ch !== 0) {
1552
+ ch = state.input.charCodeAt(++state.position);
1553
+ if (ch === 43 || ch === 45) {
1554
+ if (CHOMPING_CLIP === chomping) {
1555
+ chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
1556
+ } else {
1557
+ throwError(state, "repeat of a chomping mode identifier");
1558
+ }
1559
+ } else if ((tmp = fromDecimalCode(ch)) >= 0) {
1560
+ if (tmp === 0) {
1561
+ throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
1562
+ } else if (!detectedIndent) {
1563
+ textIndent = nodeIndent + tmp - 1;
1564
+ detectedIndent = true;
1565
+ } else {
1566
+ throwError(state, "repeat of an indentation width identifier");
1567
+ }
1568
+ } else {
1569
+ break;
1570
+ }
1571
+ }
1572
+ if (is_WHITE_SPACE(ch)) {
1573
+ do {
1574
+ ch = state.input.charCodeAt(++state.position);
1575
+ } while (is_WHITE_SPACE(ch));
1576
+ if (ch === 35) {
1577
+ do {
1578
+ ch = state.input.charCodeAt(++state.position);
1579
+ } while (!is_EOL(ch) && ch !== 0);
1580
+ }
1581
+ }
1582
+ while (ch !== 0) {
1583
+ readLineBreak(state);
1584
+ state.lineIndent = 0;
1585
+ ch = state.input.charCodeAt(state.position);
1586
+ while ((!detectedIndent || state.lineIndent < textIndent) && ch === 32) {
1587
+ state.lineIndent++;
1588
+ ch = state.input.charCodeAt(++state.position);
1589
+ }
1590
+ if (!detectedIndent && state.lineIndent > textIndent) {
1591
+ textIndent = state.lineIndent;
1592
+ }
1593
+ if (is_EOL(ch)) {
1594
+ emptyLines++;
1595
+ continue;
1596
+ }
1597
+ if (state.lineIndent < textIndent) {
1598
+ if (chomping === CHOMPING_KEEP) {
1599
+ state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
1600
+ } else if (chomping === CHOMPING_CLIP) {
1601
+ if (didReadContent) {
1602
+ state.result += "\n";
1603
+ }
1604
+ }
1605
+ break;
1606
+ }
1607
+ if (folding) {
1608
+ if (is_WHITE_SPACE(ch)) {
1609
+ atMoreIndented = true;
1610
+ state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
1611
+ } else if (atMoreIndented) {
1612
+ atMoreIndented = false;
1613
+ state.result += common.repeat("\n", emptyLines + 1);
1614
+ } else if (emptyLines === 0) {
1615
+ if (didReadContent) {
1616
+ state.result += " ";
1617
+ }
1618
+ } else {
1619
+ state.result += common.repeat("\n", emptyLines);
1620
+ }
1621
+ } else {
1622
+ state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
1623
+ }
1624
+ didReadContent = true;
1625
+ detectedIndent = true;
1626
+ emptyLines = 0;
1627
+ captureStart = state.position;
1628
+ while (!is_EOL(ch) && ch !== 0) {
1629
+ ch = state.input.charCodeAt(++state.position);
1630
+ }
1631
+ captureSegment(state, captureStart, state.position, false);
1632
+ }
1633
+ return true;
1634
+ }
1635
+ function readBlockSequence(state, nodeIndent) {
1636
+ var _line, _tag = state.tag, _anchor = state.anchor, _result = [], following, detected = false, ch;
1637
+ if (state.firstTabInLine !== -1) return false;
1638
+ if (state.anchor !== null) {
1639
+ state.anchorMap[state.anchor] = _result;
1640
+ }
1641
+ ch = state.input.charCodeAt(state.position);
1642
+ while (ch !== 0) {
1643
+ if (state.firstTabInLine !== -1) {
1644
+ state.position = state.firstTabInLine;
1645
+ throwError(state, "tab characters must not be used in indentation");
1646
+ }
1647
+ if (ch !== 45) {
1648
+ break;
1649
+ }
1650
+ following = state.input.charCodeAt(state.position + 1);
1651
+ if (!is_WS_OR_EOL(following)) {
1652
+ break;
1653
+ }
1654
+ detected = true;
1655
+ state.position++;
1656
+ if (skipSeparationSpace(state, true, -1)) {
1657
+ if (state.lineIndent <= nodeIndent) {
1658
+ _result.push(null);
1659
+ ch = state.input.charCodeAt(state.position);
1660
+ continue;
1661
+ }
1662
+ }
1663
+ _line = state.line;
1664
+ composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
1665
+ _result.push(state.result);
1666
+ skipSeparationSpace(state, true, -1);
1667
+ ch = state.input.charCodeAt(state.position);
1668
+ if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
1669
+ throwError(state, "bad indentation of a sequence entry");
1670
+ } else if (state.lineIndent < nodeIndent) {
1671
+ break;
1672
+ }
1673
+ }
1674
+ if (detected) {
1675
+ state.tag = _tag;
1676
+ state.anchor = _anchor;
1677
+ state.kind = "sequence";
1678
+ state.result = _result;
1679
+ return true;
1680
+ }
1681
+ return false;
1682
+ }
1683
+ function readBlockMapping(state, nodeIndent, flowIndent) {
1684
+ var following, allowCompact, _line, _keyLine, _keyLineStart, _keyPos, _tag = state.tag, _anchor = state.anchor, _result = {}, overridableKeys = /* @__PURE__ */ Object.create(null), keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch;
1685
+ if (state.firstTabInLine !== -1) return false;
1686
+ if (state.anchor !== null) {
1687
+ state.anchorMap[state.anchor] = _result;
1688
+ }
1689
+ ch = state.input.charCodeAt(state.position);
1690
+ while (ch !== 0) {
1691
+ if (!atExplicitKey && state.firstTabInLine !== -1) {
1692
+ state.position = state.firstTabInLine;
1693
+ throwError(state, "tab characters must not be used in indentation");
1694
+ }
1695
+ following = state.input.charCodeAt(state.position + 1);
1696
+ _line = state.line;
1697
+ if ((ch === 63 || ch === 58) && is_WS_OR_EOL(following)) {
1698
+ if (ch === 63) {
1699
+ if (atExplicitKey) {
1700
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
1701
+ keyTag = keyNode = valueNode = null;
1702
+ }
1703
+ detected = true;
1704
+ atExplicitKey = true;
1705
+ allowCompact = true;
1706
+ } else if (atExplicitKey) {
1707
+ atExplicitKey = false;
1708
+ allowCompact = true;
1709
+ } else {
1710
+ throwError(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
1711
+ }
1712
+ state.position += 1;
1713
+ ch = following;
1714
+ } else {
1715
+ _keyLine = state.line;
1716
+ _keyLineStart = state.lineStart;
1717
+ _keyPos = state.position;
1718
+ if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
1719
+ break;
1720
+ }
1721
+ if (state.line === _line) {
1722
+ ch = state.input.charCodeAt(state.position);
1723
+ while (is_WHITE_SPACE(ch)) {
1724
+ ch = state.input.charCodeAt(++state.position);
1725
+ }
1726
+ if (ch === 58) {
1727
+ ch = state.input.charCodeAt(++state.position);
1728
+ if (!is_WS_OR_EOL(ch)) {
1729
+ throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
1730
+ }
1731
+ if (atExplicitKey) {
1732
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
1733
+ keyTag = keyNode = valueNode = null;
1734
+ }
1735
+ detected = true;
1736
+ atExplicitKey = false;
1737
+ allowCompact = false;
1738
+ keyTag = state.tag;
1739
+ keyNode = state.result;
1740
+ } else if (detected) {
1741
+ throwError(state, "can not read an implicit mapping pair; a colon is missed");
1742
+ } else {
1743
+ state.tag = _tag;
1744
+ state.anchor = _anchor;
1745
+ return true;
1746
+ }
1747
+ } else if (detected) {
1748
+ throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
1749
+ } else {
1750
+ state.tag = _tag;
1751
+ state.anchor = _anchor;
1752
+ return true;
1753
+ }
1754
+ }
1755
+ if (state.line === _line || state.lineIndent > nodeIndent) {
1756
+ if (atExplicitKey) {
1757
+ _keyLine = state.line;
1758
+ _keyLineStart = state.lineStart;
1759
+ _keyPos = state.position;
1760
+ }
1761
+ if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
1762
+ if (atExplicitKey) {
1763
+ keyNode = state.result;
1764
+ } else {
1765
+ valueNode = state.result;
1766
+ }
1767
+ }
1768
+ if (!atExplicitKey) {
1769
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
1770
+ keyTag = keyNode = valueNode = null;
1771
+ }
1772
+ skipSeparationSpace(state, true, -1);
1773
+ ch = state.input.charCodeAt(state.position);
1774
+ }
1775
+ if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
1776
+ throwError(state, "bad indentation of a mapping entry");
1777
+ } else if (state.lineIndent < nodeIndent) {
1778
+ break;
1779
+ }
1780
+ }
1781
+ if (atExplicitKey) {
1782
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
1783
+ }
1784
+ if (detected) {
1785
+ state.tag = _tag;
1786
+ state.anchor = _anchor;
1787
+ state.kind = "mapping";
1788
+ state.result = _result;
1789
+ }
1790
+ return detected;
1791
+ }
1792
+ function readTagProperty(state) {
1793
+ var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch;
1794
+ ch = state.input.charCodeAt(state.position);
1795
+ if (ch !== 33) return false;
1796
+ if (state.tag !== null) {
1797
+ throwError(state, "duplication of a tag property");
1798
+ }
1799
+ ch = state.input.charCodeAt(++state.position);
1800
+ if (ch === 60) {
1801
+ isVerbatim = true;
1802
+ ch = state.input.charCodeAt(++state.position);
1803
+ } else if (ch === 33) {
1804
+ isNamed = true;
1805
+ tagHandle = "!!";
1806
+ ch = state.input.charCodeAt(++state.position);
1807
+ } else {
1808
+ tagHandle = "!";
1809
+ }
1810
+ _position = state.position;
1811
+ if (isVerbatim) {
1812
+ do {
1813
+ ch = state.input.charCodeAt(++state.position);
1814
+ } while (ch !== 0 && ch !== 62);
1815
+ if (state.position < state.length) {
1816
+ tagName = state.input.slice(_position, state.position);
1817
+ ch = state.input.charCodeAt(++state.position);
1818
+ } else {
1819
+ throwError(state, "unexpected end of the stream within a verbatim tag");
1820
+ }
1821
+ } else {
1822
+ while (ch !== 0 && !is_WS_OR_EOL(ch)) {
1823
+ if (ch === 33) {
1824
+ if (!isNamed) {
1825
+ tagHandle = state.input.slice(_position - 1, state.position + 1);
1826
+ if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
1827
+ throwError(state, "named tag handle cannot contain such characters");
1828
+ }
1829
+ isNamed = true;
1830
+ _position = state.position + 1;
1831
+ } else {
1832
+ throwError(state, "tag suffix cannot contain exclamation marks");
1833
+ }
1834
+ }
1835
+ ch = state.input.charCodeAt(++state.position);
1836
+ }
1837
+ tagName = state.input.slice(_position, state.position);
1838
+ if (PATTERN_FLOW_INDICATORS.test(tagName)) {
1839
+ throwError(state, "tag suffix cannot contain flow indicator characters");
1840
+ }
1841
+ }
1842
+ if (tagName && !PATTERN_TAG_URI.test(tagName)) {
1843
+ throwError(state, "tag name cannot contain such characters: " + tagName);
1844
+ }
1845
+ try {
1846
+ tagName = decodeURIComponent(tagName);
1847
+ } catch (err) {
1848
+ throwError(state, "tag name is malformed: " + tagName);
1849
+ }
1850
+ if (isVerbatim) {
1851
+ state.tag = tagName;
1852
+ } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) {
1853
+ state.tag = state.tagMap[tagHandle] + tagName;
1854
+ } else if (tagHandle === "!") {
1855
+ state.tag = "!" + tagName;
1856
+ } else if (tagHandle === "!!") {
1857
+ state.tag = "tag:yaml.org,2002:" + tagName;
1858
+ } else {
1859
+ throwError(state, 'undeclared tag handle "' + tagHandle + '"');
1860
+ }
1861
+ return true;
1862
+ }
1863
+ function readAnchorProperty(state) {
1864
+ var _position, ch;
1865
+ ch = state.input.charCodeAt(state.position);
1866
+ if (ch !== 38) return false;
1867
+ if (state.anchor !== null) {
1868
+ throwError(state, "duplication of an anchor property");
1869
+ }
1870
+ ch = state.input.charCodeAt(++state.position);
1871
+ _position = state.position;
1872
+ while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
1873
+ ch = state.input.charCodeAt(++state.position);
1874
+ }
1875
+ if (state.position === _position) {
1876
+ throwError(state, "name of an anchor node must contain at least one character");
1877
+ }
1878
+ state.anchor = state.input.slice(_position, state.position);
1879
+ return true;
1880
+ }
1881
+ function readAlias(state) {
1882
+ var _position, alias, ch;
1883
+ ch = state.input.charCodeAt(state.position);
1884
+ if (ch !== 42) return false;
1885
+ ch = state.input.charCodeAt(++state.position);
1886
+ _position = state.position;
1887
+ while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
1888
+ ch = state.input.charCodeAt(++state.position);
1889
+ }
1890
+ if (state.position === _position) {
1891
+ throwError(state, "name of an alias node must contain at least one character");
1892
+ }
1893
+ alias = state.input.slice(_position, state.position);
1894
+ if (!_hasOwnProperty.call(state.anchorMap, alias)) {
1895
+ throwError(state, 'unidentified alias "' + alias + '"');
1896
+ }
1897
+ state.result = state.anchorMap[alias];
1898
+ skipSeparationSpace(state, true, -1);
1899
+ return true;
1900
+ }
1901
+ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
1902
+ var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, typeList, type, flowIndent, blockIndent;
1903
+ if (state.listener !== null) {
1904
+ state.listener("open", state);
1905
+ }
1906
+ state.tag = null;
1907
+ state.anchor = null;
1908
+ state.kind = null;
1909
+ state.result = null;
1910
+ allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
1911
+ if (allowToSeek) {
1912
+ if (skipSeparationSpace(state, true, -1)) {
1913
+ atNewLine = true;
1914
+ if (state.lineIndent > parentIndent) {
1915
+ indentStatus = 1;
1916
+ } else if (state.lineIndent === parentIndent) {
1917
+ indentStatus = 0;
1918
+ } else if (state.lineIndent < parentIndent) {
1919
+ indentStatus = -1;
1920
+ }
1921
+ }
1922
+ }
1923
+ if (indentStatus === 1) {
1924
+ while (readTagProperty(state) || readAnchorProperty(state)) {
1925
+ if (skipSeparationSpace(state, true, -1)) {
1926
+ atNewLine = true;
1927
+ allowBlockCollections = allowBlockStyles;
1928
+ if (state.lineIndent > parentIndent) {
1929
+ indentStatus = 1;
1930
+ } else if (state.lineIndent === parentIndent) {
1931
+ indentStatus = 0;
1932
+ } else if (state.lineIndent < parentIndent) {
1933
+ indentStatus = -1;
1934
+ }
1935
+ } else {
1936
+ allowBlockCollections = false;
1937
+ }
1938
+ }
1939
+ }
1940
+ if (allowBlockCollections) {
1941
+ allowBlockCollections = atNewLine || allowCompact;
1942
+ }
1943
+ if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
1944
+ if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
1945
+ flowIndent = parentIndent;
1946
+ } else {
1947
+ flowIndent = parentIndent + 1;
1948
+ }
1949
+ blockIndent = state.position - state.lineStart;
1950
+ if (indentStatus === 1) {
1951
+ if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) {
1952
+ hasContent = true;
1953
+ } else {
1954
+ if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) {
1955
+ hasContent = true;
1956
+ } else if (readAlias(state)) {
1957
+ hasContent = true;
1958
+ if (state.tag !== null || state.anchor !== null) {
1959
+ throwError(state, "alias node should not have any properties");
1960
+ }
1961
+ } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
1962
+ hasContent = true;
1963
+ if (state.tag === null) {
1964
+ state.tag = "?";
1965
+ }
1966
+ }
1967
+ if (state.anchor !== null) {
1968
+ state.anchorMap[state.anchor] = state.result;
1969
+ }
1970
+ }
1971
+ } else if (indentStatus === 0) {
1972
+ hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
1973
+ }
1974
+ }
1975
+ if (state.tag === null) {
1976
+ if (state.anchor !== null) {
1977
+ state.anchorMap[state.anchor] = state.result;
1978
+ }
1979
+ } else if (state.tag === "?") {
1980
+ if (state.result !== null && state.kind !== "scalar") {
1981
+ throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
1982
+ }
1983
+ for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
1984
+ type = state.implicitTypes[typeIndex];
1985
+ if (type.resolve(state.result)) {
1986
+ state.result = type.construct(state.result);
1987
+ state.tag = type.tag;
1988
+ if (state.anchor !== null) {
1989
+ state.anchorMap[state.anchor] = state.result;
1990
+ }
1991
+ break;
1992
+ }
1993
+ }
1994
+ } else if (state.tag !== "!") {
1995
+ if (_hasOwnProperty.call(state.typeMap[state.kind || "fallback"], state.tag)) {
1996
+ type = state.typeMap[state.kind || "fallback"][state.tag];
1997
+ } else {
1998
+ type = null;
1999
+ typeList = state.typeMap.multi[state.kind || "fallback"];
2000
+ for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) {
2001
+ if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
2002
+ type = typeList[typeIndex];
2003
+ break;
2004
+ }
2005
+ }
2006
+ }
2007
+ if (!type) {
2008
+ throwError(state, "unknown tag !<" + state.tag + ">");
2009
+ }
2010
+ if (state.result !== null && type.kind !== state.kind) {
2011
+ throwError(state, "unacceptable node kind for !<" + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
2012
+ }
2013
+ if (!type.resolve(state.result, state.tag)) {
2014
+ throwError(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
2015
+ } else {
2016
+ state.result = type.construct(state.result, state.tag);
2017
+ if (state.anchor !== null) {
2018
+ state.anchorMap[state.anchor] = state.result;
2019
+ }
2020
+ }
2021
+ }
2022
+ if (state.listener !== null) {
2023
+ state.listener("close", state);
2024
+ }
2025
+ return state.tag !== null || state.anchor !== null || hasContent;
2026
+ }
2027
+ function readDocument(state) {
2028
+ var documentStart = state.position, _position, directiveName, directiveArgs, hasDirectives = false, ch;
2029
+ state.version = null;
2030
+ state.checkLineBreaks = state.legacy;
2031
+ state.tagMap = /* @__PURE__ */ Object.create(null);
2032
+ state.anchorMap = /* @__PURE__ */ Object.create(null);
2033
+ while ((ch = state.input.charCodeAt(state.position)) !== 0) {
2034
+ skipSeparationSpace(state, true, -1);
2035
+ ch = state.input.charCodeAt(state.position);
2036
+ if (state.lineIndent > 0 || ch !== 37) {
2037
+ break;
2038
+ }
2039
+ hasDirectives = true;
2040
+ ch = state.input.charCodeAt(++state.position);
2041
+ _position = state.position;
2042
+ while (ch !== 0 && !is_WS_OR_EOL(ch)) {
2043
+ ch = state.input.charCodeAt(++state.position);
2044
+ }
2045
+ directiveName = state.input.slice(_position, state.position);
2046
+ directiveArgs = [];
2047
+ if (directiveName.length < 1) {
2048
+ throwError(state, "directive name must not be less than one character in length");
2049
+ }
2050
+ while (ch !== 0) {
2051
+ while (is_WHITE_SPACE(ch)) {
2052
+ ch = state.input.charCodeAt(++state.position);
2053
+ }
2054
+ if (ch === 35) {
2055
+ do {
2056
+ ch = state.input.charCodeAt(++state.position);
2057
+ } while (ch !== 0 && !is_EOL(ch));
2058
+ break;
2059
+ }
2060
+ if (is_EOL(ch)) break;
2061
+ _position = state.position;
2062
+ while (ch !== 0 && !is_WS_OR_EOL(ch)) {
2063
+ ch = state.input.charCodeAt(++state.position);
2064
+ }
2065
+ directiveArgs.push(state.input.slice(_position, state.position));
2066
+ }
2067
+ if (ch !== 0) readLineBreak(state);
2068
+ if (_hasOwnProperty.call(directiveHandlers, directiveName)) {
2069
+ directiveHandlers[directiveName](state, directiveName, directiveArgs);
2070
+ } else {
2071
+ throwWarning(state, 'unknown document directive "' + directiveName + '"');
2072
+ }
2073
+ }
2074
+ skipSeparationSpace(state, true, -1);
2075
+ if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45) {
2076
+ state.position += 3;
2077
+ skipSeparationSpace(state, true, -1);
2078
+ } else if (hasDirectives) {
2079
+ throwError(state, "directives end mark is expected");
2080
+ }
2081
+ composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
2082
+ skipSeparationSpace(state, true, -1);
2083
+ if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
2084
+ throwWarning(state, "non-ASCII line breaks are interpreted as content");
2085
+ }
2086
+ state.documents.push(state.result);
2087
+ if (state.position === state.lineStart && testDocumentSeparator(state)) {
2088
+ if (state.input.charCodeAt(state.position) === 46) {
2089
+ state.position += 3;
2090
+ skipSeparationSpace(state, true, -1);
2091
+ }
2092
+ return;
2093
+ }
2094
+ if (state.position < state.length - 1) {
2095
+ throwError(state, "end of the stream or a document separator is expected");
2096
+ } else {
2097
+ return;
2098
+ }
2099
+ }
2100
+ function loadDocuments(input, options) {
2101
+ input = String(input);
2102
+ options = options || {};
2103
+ if (input.length !== 0) {
2104
+ if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
2105
+ input += "\n";
2106
+ }
2107
+ if (input.charCodeAt(0) === 65279) {
2108
+ input = input.slice(1);
2109
+ }
2110
+ }
2111
+ var state = new State(input, options);
2112
+ var nullpos = input.indexOf("\0");
2113
+ if (nullpos !== -1) {
2114
+ state.position = nullpos;
2115
+ throwError(state, "null byte is not allowed in input");
2116
+ }
2117
+ state.input += "\0";
2118
+ while (state.input.charCodeAt(state.position) === 32) {
2119
+ state.lineIndent += 1;
2120
+ state.position += 1;
2121
+ }
2122
+ while (state.position < state.length - 1) {
2123
+ readDocument(state);
2124
+ }
2125
+ return state.documents;
2126
+ }
2127
+ function loadAll(input, iterator, options) {
2128
+ if (iterator !== null && typeof iterator === "object" && typeof options === "undefined") {
2129
+ options = iterator;
2130
+ iterator = null;
2131
+ }
2132
+ var documents = loadDocuments(input, options);
2133
+ if (typeof iterator !== "function") {
2134
+ return documents;
2135
+ }
2136
+ for (var index = 0, length = documents.length; index < length; index += 1) {
2137
+ iterator(documents[index]);
2138
+ }
2139
+ }
2140
+ function load(input, options) {
2141
+ var documents = loadDocuments(input, options);
2142
+ if (documents.length === 0) {
2143
+ return void 0;
2144
+ } else if (documents.length === 1) {
2145
+ return documents[0];
2146
+ }
2147
+ throw new YAMLException("expected a single document in the stream, but found more");
2148
+ }
2149
+ module.exports.loadAll = loadAll;
2150
+ module.exports.load = load;
2151
+ }
2152
+ });
2153
+
2154
+ // node_modules/js-yaml/lib/dumper.js
2155
+ var require_dumper = __commonJS({
2156
+ "node_modules/js-yaml/lib/dumper.js"(exports, module) {
2157
+ "use strict";
2158
+ var common = require_common();
2159
+ var YAMLException = require_exception();
2160
+ var DEFAULT_SCHEMA = require_default();
2161
+ var _toString = Object.prototype.toString;
2162
+ var _hasOwnProperty = Object.prototype.hasOwnProperty;
2163
+ var CHAR_BOM = 65279;
2164
+ var CHAR_TAB = 9;
2165
+ var CHAR_LINE_FEED = 10;
2166
+ var CHAR_CARRIAGE_RETURN = 13;
2167
+ var CHAR_SPACE = 32;
2168
+ var CHAR_EXCLAMATION = 33;
2169
+ var CHAR_DOUBLE_QUOTE = 34;
2170
+ var CHAR_SHARP = 35;
2171
+ var CHAR_PERCENT = 37;
2172
+ var CHAR_AMPERSAND = 38;
2173
+ var CHAR_SINGLE_QUOTE = 39;
2174
+ var CHAR_ASTERISK = 42;
2175
+ var CHAR_COMMA = 44;
2176
+ var CHAR_MINUS = 45;
2177
+ var CHAR_COLON = 58;
2178
+ var CHAR_EQUALS = 61;
2179
+ var CHAR_GREATER_THAN = 62;
2180
+ var CHAR_QUESTION = 63;
2181
+ var CHAR_COMMERCIAL_AT = 64;
2182
+ var CHAR_LEFT_SQUARE_BRACKET = 91;
2183
+ var CHAR_RIGHT_SQUARE_BRACKET = 93;
2184
+ var CHAR_GRAVE_ACCENT = 96;
2185
+ var CHAR_LEFT_CURLY_BRACKET = 123;
2186
+ var CHAR_VERTICAL_LINE = 124;
2187
+ var CHAR_RIGHT_CURLY_BRACKET = 125;
2188
+ var ESCAPE_SEQUENCES = {};
2189
+ ESCAPE_SEQUENCES[0] = "\\0";
2190
+ ESCAPE_SEQUENCES[7] = "\\a";
2191
+ ESCAPE_SEQUENCES[8] = "\\b";
2192
+ ESCAPE_SEQUENCES[9] = "\\t";
2193
+ ESCAPE_SEQUENCES[10] = "\\n";
2194
+ ESCAPE_SEQUENCES[11] = "\\v";
2195
+ ESCAPE_SEQUENCES[12] = "\\f";
2196
+ ESCAPE_SEQUENCES[13] = "\\r";
2197
+ ESCAPE_SEQUENCES[27] = "\\e";
2198
+ ESCAPE_SEQUENCES[34] = '\\"';
2199
+ ESCAPE_SEQUENCES[92] = "\\\\";
2200
+ ESCAPE_SEQUENCES[133] = "\\N";
2201
+ ESCAPE_SEQUENCES[160] = "\\_";
2202
+ ESCAPE_SEQUENCES[8232] = "\\L";
2203
+ ESCAPE_SEQUENCES[8233] = "\\P";
2204
+ var DEPRECATED_BOOLEANS_SYNTAX = [
2205
+ "y",
2206
+ "Y",
2207
+ "yes",
2208
+ "Yes",
2209
+ "YES",
2210
+ "on",
2211
+ "On",
2212
+ "ON",
2213
+ "n",
2214
+ "N",
2215
+ "no",
2216
+ "No",
2217
+ "NO",
2218
+ "off",
2219
+ "Off",
2220
+ "OFF"
2221
+ ];
2222
+ var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
2223
+ function compileStyleMap(schema, map) {
2224
+ var result, keys, index, length, tag, style, type;
2225
+ if (map === null) return {};
2226
+ result = {};
2227
+ keys = Object.keys(map);
2228
+ for (index = 0, length = keys.length; index < length; index += 1) {
2229
+ tag = keys[index];
2230
+ style = String(map[tag]);
2231
+ if (tag.slice(0, 2) === "!!") {
2232
+ tag = "tag:yaml.org,2002:" + tag.slice(2);
2233
+ }
2234
+ type = schema.compiledTypeMap["fallback"][tag];
2235
+ if (type && _hasOwnProperty.call(type.styleAliases, style)) {
2236
+ style = type.styleAliases[style];
2237
+ }
2238
+ result[tag] = style;
2239
+ }
2240
+ return result;
2241
+ }
2242
+ function encodeHex(character) {
2243
+ var string, handle, length;
2244
+ string = character.toString(16).toUpperCase();
2245
+ if (character <= 255) {
2246
+ handle = "x";
2247
+ length = 2;
2248
+ } else if (character <= 65535) {
2249
+ handle = "u";
2250
+ length = 4;
2251
+ } else if (character <= 4294967295) {
2252
+ handle = "U";
2253
+ length = 8;
2254
+ } else {
2255
+ throw new YAMLException("code point within a string may not be greater than 0xFFFFFFFF");
2256
+ }
2257
+ return "\\" + handle + common.repeat("0", length - string.length) + string;
2258
+ }
2259
+ var QUOTING_TYPE_SINGLE = 1;
2260
+ var QUOTING_TYPE_DOUBLE = 2;
2261
+ function State(options) {
2262
+ this.schema = options["schema"] || DEFAULT_SCHEMA;
2263
+ this.indent = Math.max(1, options["indent"] || 2);
2264
+ this.noArrayIndent = options["noArrayIndent"] || false;
2265
+ this.skipInvalid = options["skipInvalid"] || false;
2266
+ this.flowLevel = common.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
2267
+ this.styleMap = compileStyleMap(this.schema, options["styles"] || null);
2268
+ this.sortKeys = options["sortKeys"] || false;
2269
+ this.lineWidth = options["lineWidth"] || 80;
2270
+ this.noRefs = options["noRefs"] || false;
2271
+ this.noCompatMode = options["noCompatMode"] || false;
2272
+ this.condenseFlow = options["condenseFlow"] || false;
2273
+ this.quotingType = options["quotingType"] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
2274
+ this.forceQuotes = options["forceQuotes"] || false;
2275
+ this.replacer = typeof options["replacer"] === "function" ? options["replacer"] : null;
2276
+ this.implicitTypes = this.schema.compiledImplicit;
2277
+ this.explicitTypes = this.schema.compiledExplicit;
2278
+ this.tag = null;
2279
+ this.result = "";
2280
+ this.duplicates = [];
2281
+ this.usedDuplicates = null;
2282
+ }
2283
+ function indentString(string, spaces) {
2284
+ var ind = common.repeat(" ", spaces), position = 0, next = -1, result = "", line, length = string.length;
2285
+ while (position < length) {
2286
+ next = string.indexOf("\n", position);
2287
+ if (next === -1) {
2288
+ line = string.slice(position);
2289
+ position = length;
2290
+ } else {
2291
+ line = string.slice(position, next + 1);
2292
+ position = next + 1;
2293
+ }
2294
+ if (line.length && line !== "\n") result += ind;
2295
+ result += line;
2296
+ }
2297
+ return result;
2298
+ }
2299
+ function generateNextLine(state, level) {
2300
+ return "\n" + common.repeat(" ", state.indent * level);
2301
+ }
2302
+ function testImplicitResolving(state, str) {
2303
+ var index, length, type;
2304
+ for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
2305
+ type = state.implicitTypes[index];
2306
+ if (type.resolve(str)) {
2307
+ return true;
2308
+ }
2309
+ }
2310
+ return false;
2311
+ }
2312
+ function isWhitespace(c) {
2313
+ return c === CHAR_SPACE || c === CHAR_TAB;
2314
+ }
2315
+ function isPrintable(c) {
2316
+ return 32 <= c && c <= 126 || 161 <= c && c <= 55295 && c !== 8232 && c !== 8233 || 57344 <= c && c <= 65533 && c !== CHAR_BOM || 65536 <= c && c <= 1114111;
2317
+ }
2318
+ function isNsCharOrWhitespace(c) {
2319
+ return isPrintable(c) && c !== CHAR_BOM && c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED;
2320
+ }
2321
+ function isPlainSafe(c, prev, inblock) {
2322
+ var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c);
2323
+ var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c);
2324
+ return (
2325
+ // ns-plain-safe
2326
+ (inblock ? (
2327
+ // c = flow-in
2328
+ cIsNsCharOrWhitespace
2329
+ ) : cIsNsCharOrWhitespace && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET) && c !== CHAR_SHARP && !(prev === CHAR_COLON && !cIsNsChar) || isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP || prev === CHAR_COLON && cIsNsChar
2330
+ );
2331
+ }
2332
+ function isPlainSafeFirst(c) {
2333
+ return isPrintable(c) && c !== CHAR_BOM && !isWhitespace(c) && c !== CHAR_MINUS && c !== CHAR_QUESTION && c !== CHAR_COLON && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET && c !== CHAR_SHARP && c !== CHAR_AMPERSAND && c !== CHAR_ASTERISK && c !== CHAR_EXCLAMATION && c !== CHAR_VERTICAL_LINE && c !== CHAR_EQUALS && c !== CHAR_GREATER_THAN && c !== CHAR_SINGLE_QUOTE && c !== CHAR_DOUBLE_QUOTE && c !== CHAR_PERCENT && c !== CHAR_COMMERCIAL_AT && c !== CHAR_GRAVE_ACCENT;
2334
+ }
2335
+ function isPlainSafeLast(c) {
2336
+ return !isWhitespace(c) && c !== CHAR_COLON;
2337
+ }
2338
+ function codePointAt(string, pos) {
2339
+ var first = string.charCodeAt(pos), second;
2340
+ if (first >= 55296 && first <= 56319 && pos + 1 < string.length) {
2341
+ second = string.charCodeAt(pos + 1);
2342
+ if (second >= 56320 && second <= 57343) {
2343
+ return (first - 55296) * 1024 + second - 56320 + 65536;
2344
+ }
2345
+ }
2346
+ return first;
2347
+ }
2348
+ function needIndentIndicator(string) {
2349
+ var leadingSpaceRe = /^\n* /;
2350
+ return leadingSpaceRe.test(string);
2351
+ }
2352
+ var STYLE_PLAIN = 1;
2353
+ var STYLE_SINGLE = 2;
2354
+ var STYLE_LITERAL = 3;
2355
+ var STYLE_FOLDED = 4;
2356
+ var STYLE_DOUBLE = 5;
2357
+ function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType, quotingType, forceQuotes, inblock) {
2358
+ var i;
2359
+ var char = 0;
2360
+ var prevChar = null;
2361
+ var hasLineBreak = false;
2362
+ var hasFoldableLine = false;
2363
+ var shouldTrackWidth = lineWidth !== -1;
2364
+ var previousLineBreak = -1;
2365
+ var plain = isPlainSafeFirst(codePointAt(string, 0)) && isPlainSafeLast(codePointAt(string, string.length - 1));
2366
+ if (singleLineOnly || forceQuotes) {
2367
+ for (i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
2368
+ char = codePointAt(string, i);
2369
+ if (!isPrintable(char)) {
2370
+ return STYLE_DOUBLE;
2371
+ }
2372
+ plain = plain && isPlainSafe(char, prevChar, inblock);
2373
+ prevChar = char;
2374
+ }
2375
+ } else {
2376
+ for (i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
2377
+ char = codePointAt(string, i);
2378
+ if (char === CHAR_LINE_FEED) {
2379
+ hasLineBreak = true;
2380
+ if (shouldTrackWidth) {
2381
+ hasFoldableLine = hasFoldableLine || // Foldable line = too long, and not more-indented.
2382
+ i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
2383
+ previousLineBreak = i;
2384
+ }
2385
+ } else if (!isPrintable(char)) {
2386
+ return STYLE_DOUBLE;
2387
+ }
2388
+ plain = plain && isPlainSafe(char, prevChar, inblock);
2389
+ prevChar = char;
2390
+ }
2391
+ hasFoldableLine = hasFoldableLine || shouldTrackWidth && (i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ");
2392
+ }
2393
+ if (!hasLineBreak && !hasFoldableLine) {
2394
+ if (plain && !forceQuotes && !testAmbiguousType(string)) {
2395
+ return STYLE_PLAIN;
2396
+ }
2397
+ return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
2398
+ }
2399
+ if (indentPerLevel > 9 && needIndentIndicator(string)) {
2400
+ return STYLE_DOUBLE;
2401
+ }
2402
+ if (!forceQuotes) {
2403
+ return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
2404
+ }
2405
+ return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
2406
+ }
2407
+ function writeScalar(state, string, level, iskey, inblock) {
2408
+ state.dump = function() {
2409
+ if (string.length === 0) {
2410
+ return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''";
2411
+ }
2412
+ if (!state.noCompatMode) {
2413
+ if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) {
2414
+ return state.quotingType === QUOTING_TYPE_DOUBLE ? '"' + string + '"' : "'" + string + "'";
2415
+ }
2416
+ }
2417
+ var indent = state.indent * Math.max(1, level);
2418
+ var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
2419
+ var singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
2420
+ function testAmbiguity(string2) {
2421
+ return testImplicitResolving(state, string2);
2422
+ }
2423
+ switch (chooseScalarStyle(
2424
+ string,
2425
+ singleLineOnly,
2426
+ state.indent,
2427
+ lineWidth,
2428
+ testAmbiguity,
2429
+ state.quotingType,
2430
+ state.forceQuotes && !iskey,
2431
+ inblock
2432
+ )) {
2433
+ case STYLE_PLAIN:
2434
+ return string;
2435
+ case STYLE_SINGLE:
2436
+ return "'" + string.replace(/'/g, "''") + "'";
2437
+ case STYLE_LITERAL:
2438
+ return "|" + blockHeader(string, state.indent) + dropEndingNewline(indentString(string, indent));
2439
+ case STYLE_FOLDED:
2440
+ return ">" + blockHeader(string, state.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
2441
+ case STYLE_DOUBLE:
2442
+ return '"' + escapeString(string, lineWidth) + '"';
2443
+ default:
2444
+ throw new YAMLException("impossible error: invalid scalar style");
2445
+ }
2446
+ }();
2447
+ }
2448
+ function blockHeader(string, indentPerLevel) {
2449
+ var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : "";
2450
+ var clip = string[string.length - 1] === "\n";
2451
+ var keep = clip && (string[string.length - 2] === "\n" || string === "\n");
2452
+ var chomp = keep ? "+" : clip ? "" : "-";
2453
+ return indentIndicator + chomp + "\n";
2454
+ }
2455
+ function dropEndingNewline(string) {
2456
+ return string[string.length - 1] === "\n" ? string.slice(0, -1) : string;
2457
+ }
2458
+ function foldString(string, width) {
2459
+ var lineRe = /(\n+)([^\n]*)/g;
2460
+ var result = function() {
2461
+ var nextLF = string.indexOf("\n");
2462
+ nextLF = nextLF !== -1 ? nextLF : string.length;
2463
+ lineRe.lastIndex = nextLF;
2464
+ return foldLine(string.slice(0, nextLF), width);
2465
+ }();
2466
+ var prevMoreIndented = string[0] === "\n" || string[0] === " ";
2467
+ var moreIndented;
2468
+ var match;
2469
+ while (match = lineRe.exec(string)) {
2470
+ var prefix = match[1], line = match[2];
2471
+ moreIndented = line[0] === " ";
2472
+ result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width);
2473
+ prevMoreIndented = moreIndented;
2474
+ }
2475
+ return result;
2476
+ }
2477
+ function foldLine(line, width) {
2478
+ if (line === "" || line[0] === " ") return line;
2479
+ var breakRe = / [^ ]/g;
2480
+ var match;
2481
+ var start = 0, end, curr = 0, next = 0;
2482
+ var result = "";
2483
+ while (match = breakRe.exec(line)) {
2484
+ next = match.index;
2485
+ if (next - start > width) {
2486
+ end = curr > start ? curr : next;
2487
+ result += "\n" + line.slice(start, end);
2488
+ start = end + 1;
2489
+ }
2490
+ curr = next;
2491
+ }
2492
+ result += "\n";
2493
+ if (line.length - start > width && curr > start) {
2494
+ result += line.slice(start, curr) + "\n" + line.slice(curr + 1);
2495
+ } else {
2496
+ result += line.slice(start);
2497
+ }
2498
+ return result.slice(1);
2499
+ }
2500
+ function escapeString(string) {
2501
+ var result = "";
2502
+ var char = 0;
2503
+ var escapeSeq;
2504
+ for (var i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
2505
+ char = codePointAt(string, i);
2506
+ escapeSeq = ESCAPE_SEQUENCES[char];
2507
+ if (!escapeSeq && isPrintable(char)) {
2508
+ result += string[i];
2509
+ if (char >= 65536) result += string[i + 1];
2510
+ } else {
2511
+ result += escapeSeq || encodeHex(char);
2512
+ }
2513
+ }
2514
+ return result;
2515
+ }
2516
+ function writeFlowSequence(state, level, object) {
2517
+ var _result = "", _tag = state.tag, index, length, value;
2518
+ for (index = 0, length = object.length; index < length; index += 1) {
2519
+ value = object[index];
2520
+ if (state.replacer) {
2521
+ value = state.replacer.call(object, String(index), value);
2522
+ }
2523
+ if (writeNode(state, level, value, false, false) || typeof value === "undefined" && writeNode(state, level, null, false, false)) {
2524
+ if (_result !== "") _result += "," + (!state.condenseFlow ? " " : "");
2525
+ _result += state.dump;
2526
+ }
2527
+ }
2528
+ state.tag = _tag;
2529
+ state.dump = "[" + _result + "]";
2530
+ }
2531
+ function writeBlockSequence(state, level, object, compact) {
2532
+ var _result = "", _tag = state.tag, index, length, value;
2533
+ for (index = 0, length = object.length; index < length; index += 1) {
2534
+ value = object[index];
2535
+ if (state.replacer) {
2536
+ value = state.replacer.call(object, String(index), value);
2537
+ }
2538
+ if (writeNode(state, level + 1, value, true, true, false, true) || typeof value === "undefined" && writeNode(state, level + 1, null, true, true, false, true)) {
2539
+ if (!compact || _result !== "") {
2540
+ _result += generateNextLine(state, level);
2541
+ }
2542
+ if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
2543
+ _result += "-";
2544
+ } else {
2545
+ _result += "- ";
2546
+ }
2547
+ _result += state.dump;
2548
+ }
2549
+ }
2550
+ state.tag = _tag;
2551
+ state.dump = _result || "[]";
2552
+ }
2553
+ function writeFlowMapping(state, level, object) {
2554
+ var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, pairBuffer;
2555
+ for (index = 0, length = objectKeyList.length; index < length; index += 1) {
2556
+ pairBuffer = "";
2557
+ if (_result !== "") pairBuffer += ", ";
2558
+ if (state.condenseFlow) pairBuffer += '"';
2559
+ objectKey = objectKeyList[index];
2560
+ objectValue = object[objectKey];
2561
+ if (state.replacer) {
2562
+ objectValue = state.replacer.call(object, objectKey, objectValue);
2563
+ }
2564
+ if (!writeNode(state, level, objectKey, false, false)) {
2565
+ continue;
2566
+ }
2567
+ if (state.dump.length > 1024) pairBuffer += "? ";
2568
+ pairBuffer += state.dump + (state.condenseFlow ? '"' : "") + ":" + (state.condenseFlow ? "" : " ");
2569
+ if (!writeNode(state, level, objectValue, false, false)) {
2570
+ continue;
2571
+ }
2572
+ pairBuffer += state.dump;
2573
+ _result += pairBuffer;
2574
+ }
2575
+ state.tag = _tag;
2576
+ state.dump = "{" + _result + "}";
2577
+ }
2578
+ function writeBlockMapping(state, level, object, compact) {
2579
+ var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, explicitPair, pairBuffer;
2580
+ if (state.sortKeys === true) {
2581
+ objectKeyList.sort();
2582
+ } else if (typeof state.sortKeys === "function") {
2583
+ objectKeyList.sort(state.sortKeys);
2584
+ } else if (state.sortKeys) {
2585
+ throw new YAMLException("sortKeys must be a boolean or a function");
2586
+ }
2587
+ for (index = 0, length = objectKeyList.length; index < length; index += 1) {
2588
+ pairBuffer = "";
2589
+ if (!compact || _result !== "") {
2590
+ pairBuffer += generateNextLine(state, level);
2591
+ }
2592
+ objectKey = objectKeyList[index];
2593
+ objectValue = object[objectKey];
2594
+ if (state.replacer) {
2595
+ objectValue = state.replacer.call(object, objectKey, objectValue);
2596
+ }
2597
+ if (!writeNode(state, level + 1, objectKey, true, true, true)) {
2598
+ continue;
2599
+ }
2600
+ explicitPair = state.tag !== null && state.tag !== "?" || state.dump && state.dump.length > 1024;
2601
+ if (explicitPair) {
2602
+ if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
2603
+ pairBuffer += "?";
2604
+ } else {
2605
+ pairBuffer += "? ";
2606
+ }
2607
+ }
2608
+ pairBuffer += state.dump;
2609
+ if (explicitPair) {
2610
+ pairBuffer += generateNextLine(state, level);
2611
+ }
2612
+ if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
2613
+ continue;
2614
+ }
2615
+ if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
2616
+ pairBuffer += ":";
2617
+ } else {
2618
+ pairBuffer += ": ";
2619
+ }
2620
+ pairBuffer += state.dump;
2621
+ _result += pairBuffer;
2622
+ }
2623
+ state.tag = _tag;
2624
+ state.dump = _result || "{}";
2625
+ }
2626
+ function detectType(state, object, explicit) {
2627
+ var _result, typeList, index, length, type, style;
2628
+ typeList = explicit ? state.explicitTypes : state.implicitTypes;
2629
+ for (index = 0, length = typeList.length; index < length; index += 1) {
2630
+ type = typeList[index];
2631
+ if ((type.instanceOf || type.predicate) && (!type.instanceOf || typeof object === "object" && object instanceof type.instanceOf) && (!type.predicate || type.predicate(object))) {
2632
+ if (explicit) {
2633
+ if (type.multi && type.representName) {
2634
+ state.tag = type.representName(object);
2635
+ } else {
2636
+ state.tag = type.tag;
2637
+ }
2638
+ } else {
2639
+ state.tag = "?";
2640
+ }
2641
+ if (type.represent) {
2642
+ style = state.styleMap[type.tag] || type.defaultStyle;
2643
+ if (_toString.call(type.represent) === "[object Function]") {
2644
+ _result = type.represent(object, style);
2645
+ } else if (_hasOwnProperty.call(type.represent, style)) {
2646
+ _result = type.represent[style](object, style);
2647
+ } else {
2648
+ throw new YAMLException("!<" + type.tag + '> tag resolver accepts not "' + style + '" style');
2649
+ }
2650
+ state.dump = _result;
2651
+ }
2652
+ return true;
2653
+ }
2654
+ }
2655
+ return false;
2656
+ }
2657
+ function writeNode(state, level, object, block, compact, iskey, isblockseq) {
2658
+ state.tag = null;
2659
+ state.dump = object;
2660
+ if (!detectType(state, object, false)) {
2661
+ detectType(state, object, true);
2662
+ }
2663
+ var type = _toString.call(state.dump);
2664
+ var inblock = block;
2665
+ var tagStr;
2666
+ if (block) {
2667
+ block = state.flowLevel < 0 || state.flowLevel > level;
2668
+ }
2669
+ var objectOrArray = type === "[object Object]" || type === "[object Array]", duplicateIndex, duplicate;
2670
+ if (objectOrArray) {
2671
+ duplicateIndex = state.duplicates.indexOf(object);
2672
+ duplicate = duplicateIndex !== -1;
2673
+ }
2674
+ if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) {
2675
+ compact = false;
2676
+ }
2677
+ if (duplicate && state.usedDuplicates[duplicateIndex]) {
2678
+ state.dump = "*ref_" + duplicateIndex;
2679
+ } else {
2680
+ if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
2681
+ state.usedDuplicates[duplicateIndex] = true;
2682
+ }
2683
+ if (type === "[object Object]") {
2684
+ if (block && Object.keys(state.dump).length !== 0) {
2685
+ writeBlockMapping(state, level, state.dump, compact);
2686
+ if (duplicate) {
2687
+ state.dump = "&ref_" + duplicateIndex + state.dump;
2688
+ }
2689
+ } else {
2690
+ writeFlowMapping(state, level, state.dump);
2691
+ if (duplicate) {
2692
+ state.dump = "&ref_" + duplicateIndex + " " + state.dump;
2693
+ }
2694
+ }
2695
+ } else if (type === "[object Array]") {
2696
+ if (block && state.dump.length !== 0) {
2697
+ if (state.noArrayIndent && !isblockseq && level > 0) {
2698
+ writeBlockSequence(state, level - 1, state.dump, compact);
2699
+ } else {
2700
+ writeBlockSequence(state, level, state.dump, compact);
2701
+ }
2702
+ if (duplicate) {
2703
+ state.dump = "&ref_" + duplicateIndex + state.dump;
2704
+ }
2705
+ } else {
2706
+ writeFlowSequence(state, level, state.dump);
2707
+ if (duplicate) {
2708
+ state.dump = "&ref_" + duplicateIndex + " " + state.dump;
2709
+ }
2710
+ }
2711
+ } else if (type === "[object String]") {
2712
+ if (state.tag !== "?") {
2713
+ writeScalar(state, state.dump, level, iskey, inblock);
2714
+ }
2715
+ } else if (type === "[object Undefined]") {
2716
+ return false;
2717
+ } else {
2718
+ if (state.skipInvalid) return false;
2719
+ throw new YAMLException("unacceptable kind of an object to dump " + type);
2720
+ }
2721
+ if (state.tag !== null && state.tag !== "?") {
2722
+ tagStr = encodeURI(
2723
+ state.tag[0] === "!" ? state.tag.slice(1) : state.tag
2724
+ ).replace(/!/g, "%21");
2725
+ if (state.tag[0] === "!") {
2726
+ tagStr = "!" + tagStr;
2727
+ } else if (tagStr.slice(0, 18) === "tag:yaml.org,2002:") {
2728
+ tagStr = "!!" + tagStr.slice(18);
2729
+ } else {
2730
+ tagStr = "!<" + tagStr + ">";
2731
+ }
2732
+ state.dump = tagStr + " " + state.dump;
2733
+ }
2734
+ }
2735
+ return true;
2736
+ }
2737
+ function getDuplicateReferences(object, state) {
2738
+ var objects = [], duplicatesIndexes = [], index, length;
2739
+ inspectNode(object, objects, duplicatesIndexes);
2740
+ for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
2741
+ state.duplicates.push(objects[duplicatesIndexes[index]]);
2742
+ }
2743
+ state.usedDuplicates = new Array(length);
2744
+ }
2745
+ function inspectNode(object, objects, duplicatesIndexes) {
2746
+ var objectKeyList, index, length;
2747
+ if (object !== null && typeof object === "object") {
2748
+ index = objects.indexOf(object);
2749
+ if (index !== -1) {
2750
+ if (duplicatesIndexes.indexOf(index) === -1) {
2751
+ duplicatesIndexes.push(index);
2752
+ }
2753
+ } else {
2754
+ objects.push(object);
2755
+ if (Array.isArray(object)) {
2756
+ for (index = 0, length = object.length; index < length; index += 1) {
2757
+ inspectNode(object[index], objects, duplicatesIndexes);
2758
+ }
2759
+ } else {
2760
+ objectKeyList = Object.keys(object);
2761
+ for (index = 0, length = objectKeyList.length; index < length; index += 1) {
2762
+ inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
2763
+ }
2764
+ }
2765
+ }
2766
+ }
2767
+ }
2768
+ function dump(input, options) {
2769
+ options = options || {};
2770
+ var state = new State(options);
2771
+ if (!state.noRefs) getDuplicateReferences(input, state);
2772
+ var value = input;
2773
+ if (state.replacer) {
2774
+ value = state.replacer.call({ "": value }, "", value);
2775
+ }
2776
+ if (writeNode(state, 0, value, true, true)) return state.dump + "\n";
2777
+ return "";
2778
+ }
2779
+ module.exports.dump = dump;
2780
+ }
2781
+ });
2782
+
2783
+ // node_modules/js-yaml/index.js
2784
+ var require_js_yaml = __commonJS({
2785
+ "node_modules/js-yaml/index.js"(exports, module) {
2786
+ "use strict";
2787
+ var loader = require_loader();
2788
+ var dumper = require_dumper();
2789
+ function renamed(from, to) {
2790
+ return function() {
2791
+ throw new Error("Function yaml." + from + " is removed in js-yaml 4. Use yaml." + to + " instead, which is now safe by default.");
2792
+ };
2793
+ }
2794
+ module.exports.Type = require_type();
2795
+ module.exports.Schema = require_schema();
2796
+ module.exports.FAILSAFE_SCHEMA = require_failsafe();
2797
+ module.exports.JSON_SCHEMA = require_json();
2798
+ module.exports.CORE_SCHEMA = require_core();
2799
+ module.exports.DEFAULT_SCHEMA = require_default();
2800
+ module.exports.load = loader.load;
2801
+ module.exports.loadAll = loader.loadAll;
2802
+ module.exports.dump = dumper.dump;
2803
+ module.exports.YAMLException = require_exception();
2804
+ module.exports.types = {
2805
+ binary: require_binary(),
2806
+ float: require_float(),
2807
+ map: require_map(),
2808
+ null: require_null(),
2809
+ pairs: require_pairs(),
2810
+ set: require_set(),
2811
+ timestamp: require_timestamp(),
2812
+ bool: require_bool(),
2813
+ int: require_int(),
2814
+ merge: require_merge(),
2815
+ omap: require_omap(),
2816
+ seq: require_seq(),
2817
+ str: require_str()
2818
+ };
2819
+ module.exports.safeLoad = renamed("safeLoad", "load");
2820
+ module.exports.safeLoadAll = renamed("safeLoadAll", "loadAll");
2821
+ module.exports.safeDump = renamed("safeDump", "dump");
2822
+ }
2823
+ });
2824
+
2825
+ // lib/components/featured.js
2826
+ var require_featured = __commonJS({
2827
+ "lib/components/featured.js"(exports, module) {
2828
+ var fs = __require("fs");
2829
+ var path = __require("path");
2830
+ var yaml = require_js_yaml();
2831
+ function firstLabelString(label) {
2832
+ if (!label) return "Untitled";
2833
+ if (typeof label === "string") return label;
2834
+ try {
2835
+ const keys = Object.keys(label || {});
2836
+ if (!keys.length) return "Untitled";
2837
+ const arr = label[keys[0]];
2838
+ if (Array.isArray(arr) && arr.length) return String(arr[0]);
2839
+ } catch (_) {
2840
+ }
2841
+ return "Untitled";
2842
+ }
2843
+ function normalizeIiifId(raw) {
2844
+ try {
2845
+ const s = String(raw || "");
2846
+ if (!/^https?:\/\//i.test(s)) return s;
2847
+ const u = new URL(s);
2848
+ const entries = Array.from(u.searchParams.entries()).sort(
2849
+ (a, b) => a[0].localeCompare(b[0]) || a[1].localeCompare(b[1])
2850
+ );
2851
+ u.search = "";
2852
+ for (const [k, v] of entries) u.searchParams.append(k, v);
2853
+ return u.toString();
2854
+ } catch (_) {
2855
+ return String(raw || "");
2856
+ }
2857
+ }
2858
+ function equalIiifId(a, b) {
2859
+ try {
2860
+ const an = normalizeIiifId(a);
2861
+ const bn = normalizeIiifId(b);
2862
+ if (an === bn) return true;
2863
+ const ua = new URL(an);
2864
+ const ub = new URL(bn);
2865
+ return ua.origin === ub.origin && ua.pathname === ub.pathname;
2866
+ } catch (_) {
2867
+ return String(a || "") === String(b || "");
2868
+ }
2869
+ }
2870
+ function readYaml(p) {
2871
+ try {
2872
+ if (!fs.existsSync(p)) return null;
2873
+ const raw = fs.readFileSync(p, "utf8");
2874
+ return yaml.load(raw) || null;
2875
+ } catch (_) {
2876
+ return null;
2877
+ }
2878
+ }
2879
+ function readJson(p) {
2880
+ try {
2881
+ if (!fs.existsSync(p)) return null;
2882
+ const raw = fs.readFileSync(p, "utf8");
2883
+ return JSON.parse(raw);
2884
+ } catch (_) {
2885
+ return null;
2886
+ }
2887
+ }
2888
+ function findSlugByIdFromDiskSync(nid) {
2889
+ try {
2890
+ const dir = path.resolve(".cache/iiif/manifests");
2891
+ if (!fs.existsSync(dir)) return null;
2892
+ const names = fs.readdirSync(dir);
2893
+ for (const name of names) {
2894
+ if (!name || !name.toLowerCase().endsWith(".json")) continue;
2895
+ const fp = path.join(dir, name);
2896
+ try {
2897
+ const obj = readJson(fp);
2898
+ const mid = normalizeIiifId(String(obj && (obj.id || obj["@id"]) || ""));
2899
+ if (mid && equalIiifId(mid, nid)) return name.replace(/\.json$/i, "");
2900
+ } catch (_) {
2901
+ }
2902
+ }
2903
+ } catch (_) {
2904
+ }
2905
+ return null;
2906
+ }
2907
+ function readFeaturedFromCacheSync() {
2908
+ try {
2909
+ const debug = !!process.env.CANOPY_DEBUG_FEATURED;
2910
+ const cfg = readYaml(path.resolve("canopy.yml")) || {};
2911
+ const featured = Array.isArray(cfg && cfg.featured) ? cfg.featured : [];
2912
+ if (!featured.length) return [];
2913
+ const idx = readJson(path.resolve(".cache/iiif/index.json")) || {};
2914
+ const byId = Array.isArray(idx && idx.byId) ? idx.byId : [];
2915
+ const out = [];
2916
+ for (const id of featured) {
2917
+ const nid = normalizeIiifId(id);
2918
+ if (debug) {
2919
+ try {
2920
+ console.log("[featured] id:", id);
2921
+ } catch (_) {
2922
+ }
2923
+ }
2924
+ const entry = byId.find((e) => e && e.type === "Manifest" && equalIiifId(e.id, nid));
2925
+ const slug = entry && entry.slug ? String(entry.slug) : findSlugByIdFromDiskSync(nid);
2926
+ if (debug) {
2927
+ try {
2928
+ console.log("[featured] - slug:", slug || "(none)");
2929
+ } catch (_) {
2930
+ }
2931
+ }
2932
+ if (!slug) continue;
2933
+ const m = readJson(path.resolve(".cache/iiif/manifests", slug + ".json"));
2934
+ if (!m) continue;
2935
+ const rec = {
2936
+ title: firstLabelString(m && m.label),
2937
+ href: path.join("works", slug + ".html").split(path.sep).join("/"),
2938
+ type: "work"
2939
+ };
2940
+ if (entry && entry.thumbnail) rec.thumbnail = String(entry.thumbnail);
2941
+ if (entry && typeof entry.thumbnailWidth === "number") rec.thumbnailWidth = entry.thumbnailWidth;
2942
+ if (entry && typeof entry.thumbnailHeight === "number") rec.thumbnailHeight = entry.thumbnailHeight;
2943
+ if (!rec.thumbnail) {
2944
+ try {
2945
+ const t = m && m.thumbnail;
2946
+ if (Array.isArray(t) && t.length) {
2947
+ const first = t[0] || {};
2948
+ const tid = first.id || first["@id"] || first.url || "";
2949
+ if (tid) rec.thumbnail = String(tid);
2950
+ if (typeof first.width === "number") rec.thumbnailWidth = first.width;
2951
+ if (typeof first.height === "number") rec.thumbnailHeight = first.height;
2952
+ } else if (t && typeof t === "object") {
2953
+ const tid = t.id || t["@id"] || t.url || "";
2954
+ if (tid) rec.thumbnail = String(tid);
2955
+ if (typeof t.width === "number") rec.thumbnailWidth = t.width;
2956
+ if (typeof t.height === "number") rec.thumbnailHeight = t.height;
2957
+ }
2958
+ } catch (_) {
2959
+ }
2960
+ }
2961
+ out.push(rec);
2962
+ }
2963
+ if (debug) {
2964
+ try {
2965
+ console.log("[featured] total:", out.length);
2966
+ } catch (_) {
2967
+ }
2968
+ }
2969
+ return out;
2970
+ } catch (_) {
2971
+ return [];
2972
+ }
2973
+ }
2974
+ module.exports = {
2975
+ firstLabelString,
2976
+ normalizeIiifId,
2977
+ equalIiifId,
2978
+ readYaml,
2979
+ readJson,
2980
+ findSlugByIdFromDiskSync,
2981
+ readFeaturedFromCacheSync
2982
+ };
2983
+ }
2984
+ });
2985
+
2986
+ // ui/src/iiif/hero-utils.js
2987
+ var require_hero_utils = __commonJS({
2988
+ "ui/src/iiif/hero-utils.js"(exports, module) {
2989
+ function computeHeroHeightStyle2(height) {
2990
+ const h = typeof height === "number" ? `${height}px` : String(height || "").trim();
2991
+ const val = h || "360px";
2992
+ return { width: "100%", height: val };
2993
+ }
2994
+ module.exports = { computeHeroHeightStyle: computeHeroHeightStyle2 };
2995
+ }
2996
+ });
2997
+
1
2998
  // ui/src/Fallback.jsx
2
2999
  import React from "react";
3
3000
  function Fallback({ name, ...props }) {
@@ -136,8 +3133,79 @@ function MdxRelatedItems(props) {
136
3133
  return /* @__PURE__ */ React5.createElement("div", { "data-canopy-related-items": "1", className: "not-prose" }, /* @__PURE__ */ React5.createElement("script", { type: "application/json", dangerouslySetInnerHTML: { __html: json } }));
137
3134
  }
138
3135
 
139
- // ui/src/search/MdxSearchForm.jsx
3136
+ // ui/src/iiif/Hero.jsx
3137
+ var import_featured = __toESM(require_featured());
3138
+ var import_hero_utils = __toESM(require_hero_utils());
140
3139
  import React6 from "react";
3140
+ function Hero({
3141
+ height = 360,
3142
+ item,
3143
+ index,
3144
+ random,
3145
+ className = "",
3146
+ style = {},
3147
+ ...rest
3148
+ }) {
3149
+ let resolved = item;
3150
+ if (!resolved) {
3151
+ const list = import_featured.default && import_featured.default.readFeaturedFromCacheSync ? import_featured.default.readFeaturedFromCacheSync() : [];
3152
+ let idx = 0;
3153
+ if (typeof index === "number") {
3154
+ idx = Math.max(0, Math.min(list.length - 1, Math.floor(index)));
3155
+ } else if (random === true || random === "true") {
3156
+ idx = Math.floor(Math.random() * Math.max(1, list.length));
3157
+ }
3158
+ resolved = list[idx] || list[0] || null;
3159
+ }
3160
+ const hStyle = (0, import_hero_utils.computeHeroHeightStyle)(height);
3161
+ const title = resolved && resolved.title || "";
3162
+ const href = resolved && resolved.href || "#";
3163
+ const thumbnail = resolved && resolved.thumbnail || "";
3164
+ const baseStyles = {
3165
+ position: "relative",
3166
+ ...hStyle,
3167
+ overflow: "hidden",
3168
+ backgroundColor: "var(--color-gray-muted)"
3169
+ };
3170
+ const imgStyles = {
3171
+ position: "absolute",
3172
+ inset: 0,
3173
+ width: "100%",
3174
+ height: "100%",
3175
+ objectFit: "cover",
3176
+ objectPosition: "center",
3177
+ filter: "none"
3178
+ };
3179
+ return /* @__PURE__ */ React6.createElement(
3180
+ "figure",
3181
+ {
3182
+ className: ["canopy-hero", className].filter(Boolean).join(" "),
3183
+ style: { ...baseStyles, ...style },
3184
+ ...(() => {
3185
+ const r = { ...rest };
3186
+ try {
3187
+ delete r.random;
3188
+ delete r.index;
3189
+ } catch (_) {
3190
+ }
3191
+ return r;
3192
+ })()
3193
+ },
3194
+ thumbnail ? /* @__PURE__ */ React6.createElement("img", { src: thumbnail, alt: "", "aria-hidden": "true", style: imgStyles }) : null,
3195
+ /* @__PURE__ */ React6.createElement("h3", null, /* @__PURE__ */ React6.createElement(
3196
+ "a",
3197
+ {
3198
+ href,
3199
+ style: { color: "inherit", textDecoration: "none" },
3200
+ className: "canopy-hero-link"
3201
+ },
3202
+ title
3203
+ ))
3204
+ );
3205
+ }
3206
+
3207
+ // ui/src/search/MdxSearchForm.jsx
3208
+ import React7 from "react";
141
3209
  function MdxSearchForm(props) {
142
3210
  let json = "{}";
143
3211
  try {
@@ -145,11 +3213,11 @@ function MdxSearchForm(props) {
145
3213
  } catch (_) {
146
3214
  json = "{}";
147
3215
  }
148
- return /* @__PURE__ */ React6.createElement("div", { "data-canopy-search-form": "1" }, /* @__PURE__ */ React6.createElement("script", { type: "application/json", dangerouslySetInnerHTML: { __html: json } }));
3216
+ return /* @__PURE__ */ React7.createElement("div", { "data-canopy-search-form": "1" }, /* @__PURE__ */ React7.createElement("script", { type: "application/json", dangerouslySetInnerHTML: { __html: json } }));
149
3217
  }
150
3218
 
151
3219
  // ui/src/search/MdxSearchResults.jsx
152
- import React7 from "react";
3220
+ import React8 from "react";
153
3221
  function MdxSearchResults(props) {
154
3222
  let json = "{}";
155
3223
  try {
@@ -157,11 +3225,11 @@ function MdxSearchResults(props) {
157
3225
  } catch (_) {
158
3226
  json = "{}";
159
3227
  }
160
- return /* @__PURE__ */ React7.createElement("div", { "data-canopy-search-results": "1" }, /* @__PURE__ */ React7.createElement("script", { type: "application/json", dangerouslySetInnerHTML: { __html: json } }));
3228
+ return /* @__PURE__ */ React8.createElement("div", { "data-canopy-search-results": "1" }, /* @__PURE__ */ React8.createElement("script", { type: "application/json", dangerouslySetInnerHTML: { __html: json } }));
161
3229
  }
162
3230
 
163
3231
  // ui/src/search/SearchSummary.jsx
164
- import React8 from "react";
3232
+ import React9 from "react";
165
3233
  function SearchSummary(props) {
166
3234
  let json = "{}";
167
3235
  try {
@@ -169,11 +3237,11 @@ function SearchSummary(props) {
169
3237
  } catch (_) {
170
3238
  json = "{}";
171
3239
  }
172
- return /* @__PURE__ */ React8.createElement("div", { "data-canopy-search-summary": "1" }, /* @__PURE__ */ React8.createElement("script", { type: "application/json", dangerouslySetInnerHTML: { __html: json } }));
3240
+ return /* @__PURE__ */ React9.createElement("div", { "data-canopy-search-summary": "1" }, /* @__PURE__ */ React9.createElement("script", { type: "application/json", dangerouslySetInnerHTML: { __html: json } }));
173
3241
  }
174
3242
 
175
3243
  // ui/src/search/SearchTotal.jsx
176
- import React9 from "react";
3244
+ import React10 from "react";
177
3245
  function SearchTotal(props) {
178
3246
  let json = "{}";
179
3247
  try {
@@ -181,11 +3249,23 @@ function SearchTotal(props) {
181
3249
  } catch (_) {
182
3250
  json = "{}";
183
3251
  }
184
- return /* @__PURE__ */ React9.createElement("div", { "data-canopy-search-total": "1" }, /* @__PURE__ */ React9.createElement("script", { type: "application/json", dangerouslySetInnerHTML: { __html: json } }));
3252
+ return /* @__PURE__ */ React10.createElement("div", { "data-canopy-search-total": "1" }, /* @__PURE__ */ React10.createElement("script", { type: "application/json", dangerouslySetInnerHTML: { __html: json } }));
3253
+ }
3254
+
3255
+ // ui/src/search/MdxSearchTabs.jsx
3256
+ import React11 from "react";
3257
+ function MdxSearchTabs(props) {
3258
+ let json = "{}";
3259
+ try {
3260
+ json = JSON.stringify(props || {});
3261
+ } catch (_) {
3262
+ json = "{}";
3263
+ }
3264
+ return /* @__PURE__ */ React11.createElement("div", { "data-canopy-search-tabs": "1" }, /* @__PURE__ */ React11.createElement("script", { type: "application/json", dangerouslySetInnerHTML: { __html: json } }));
185
3265
  }
186
3266
 
187
3267
  // ui/src/command/MdxCommandPalette.jsx
188
- import React10 from "react";
3268
+ import React12 from "react";
189
3269
  function MdxCommandPalette(props = {}) {
190
3270
  const {
191
3271
  placeholder = "Search\u2026",
@@ -193,29 +3273,37 @@ function MdxCommandPalette(props = {}) {
193
3273
  maxResults = 8,
194
3274
  groupOrder = ["work", "page"],
195
3275
  button = true,
196
- buttonLabel = "Search"
3276
+ // kept for backward compat; ignored by teaser form
3277
+ buttonLabel = "Search",
3278
+ label,
3279
+ searchPath = "/search"
197
3280
  } = props || {};
198
- const data = { placeholder, hotkey, maxResults, groupOrder };
199
- return /* @__PURE__ */ React10.createElement("div", { "data-canopy-command": true }, button && /* @__PURE__ */ React10.createElement(
200
- "button",
3281
+ const text = typeof label === "string" && label.trim() ? label.trim() : buttonLabel;
3282
+ const data = { placeholder, hotkey, maxResults, groupOrder, label: text, searchPath };
3283
+ return /* @__PURE__ */ React12.createElement("div", { "data-canopy-command": true, className: "flex-1 min-w-0" }, /* @__PURE__ */ React12.createElement("div", { className: "relative w-full" }, /* @__PURE__ */ React12.createElement("style", null, `.relative[data-canopy-panel-auto='1']:focus-within [data-canopy-command-panel]{display:block}`), /* @__PURE__ */ React12.createElement("form", { action: searchPath, method: "get", role: "search", className: "group flex items-center gap-2 px-2 py-1.5 rounded-lg border border-slate-300 bg-white/95 backdrop-blur text-slate-700 shadow-sm hover:shadow transition w-full focus-within:ring-2 focus-within:ring-brand-500" }, /* @__PURE__ */ React12.createElement("svg", { "aria-hidden": true, viewBox: "0 0 20 20", fill: "none", className: "w-4 h-4 text-slate-500" }, /* @__PURE__ */ React12.createElement("path", { stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", d: "m19 19-4-4m-2.5-6.5a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0Z" })), /* @__PURE__ */ React12.createElement(
3284
+ "input",
201
3285
  {
202
- type: "button",
203
- "data-canopy-command-trigger": true,
204
- className: "inline-flex items-center gap-1 px-2 py-1 rounded border border-slate-300 text-slate-700 hover:bg-slate-50",
205
- "aria-label": "Open search"
206
- },
207
- /* @__PURE__ */ React10.createElement("span", { "aria-hidden": true }, "\u2318K"),
208
- /* @__PURE__ */ React10.createElement("span", { className: "sr-only" }, buttonLabel)
209
- ), /* @__PURE__ */ React10.createElement("script", { type: "application/json", dangerouslySetInnerHTML: { __html: JSON.stringify(data) } }));
3286
+ type: "search",
3287
+ name: "q",
3288
+ inputMode: "search",
3289
+ "data-canopy-command-input": true,
3290
+ placeholder,
3291
+ className: "flex-1 bg-transparent outline-none placeholder:text-slate-400 py-0.5 min-w-0",
3292
+ "aria-label": "Search"
3293
+ }
3294
+ ), /* @__PURE__ */ React12.createElement("button", { type: "submit", "data-canopy-command-link": true, className: "inline-flex items-center gap-1 px-2 py-1 rounded-md border border-slate-200 bg-slate-50 hover:bg-slate-100 text-slate-700" }, /* @__PURE__ */ React12.createElement("span", null, text))), /* @__PURE__ */ React12.createElement("div", { "data-canopy-command-panel": true, style: { display: "none", position: "absolute", left: 0, right: 0, top: "calc(100% + 4px)", background: "#fff", border: "1px solid #e5e7eb", borderRadius: 8, boxShadow: "0 10px 25px rgba(0,0,0,0.12)", zIndex: 1e3, overflow: "auto", maxHeight: "60vh" } }, /* @__PURE__ */ React12.createElement("div", { id: "cplist" }))), /* @__PURE__ */ React12.createElement("script", { type: "application/json", dangerouslySetInnerHTML: { __html: JSON.stringify(data) } }));
210
3295
  }
211
3296
  export {
212
3297
  MdxCommandPalette as CommandPalette,
213
3298
  Fallback,
214
3299
  HelloWorld,
3300
+ Hero,
215
3301
  MdxRelatedItems as RelatedItems,
216
3302
  MdxSearchForm as SearchForm,
3303
+ MdxCommandPalette as SearchPanel,
217
3304
  MdxSearchResults as SearchResults,
218
3305
  SearchSummary,
3306
+ MdxSearchTabs as SearchTabs,
219
3307
  SearchTotal,
220
3308
  Slider,
221
3309
  Viewer