oh-my-opencode 2.9.1 → 2.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/README.ja.md +10 -0
  2. package/README.ko.md +10 -0
  3. package/README.md +46 -0
  4. package/README.zh-cn.md +10 -0
  5. package/dist/agents/utils.d.ts +7 -1
  6. package/dist/cli/doctor/checks/gh.d.ts +13 -0
  7. package/dist/cli/doctor/checks/gh.test.d.ts +1 -0
  8. package/dist/cli/doctor/checks/index.d.ts +1 -0
  9. package/dist/cli/doctor/constants.d.ts +1 -0
  10. package/dist/cli/index.js +3192 -360
  11. package/dist/config/schema.d.ts +174 -165
  12. package/dist/features/builtin-skills/types.d.ts +2 -0
  13. package/dist/features/claude-code-command-loader/types.d.ts +19 -0
  14. package/dist/features/claude-code-mcp-loader/loader.d.ts +1 -0
  15. package/dist/features/claude-code-mcp-loader/loader.test.d.ts +1 -0
  16. package/dist/features/opencode-skill-loader/loader.test.d.ts +1 -0
  17. package/dist/features/opencode-skill-loader/types.d.ts +3 -0
  18. package/dist/features/skill-mcp-manager/index.d.ts +2 -0
  19. package/dist/features/skill-mcp-manager/manager.d.ts +21 -0
  20. package/dist/features/skill-mcp-manager/manager.test.d.ts +1 -0
  21. package/dist/features/skill-mcp-manager/types.d.ts +11 -0
  22. package/dist/google-auth.js +3 -3
  23. package/dist/hooks/anthropic-context-window-limit-recovery/storage.test.d.ts +1 -0
  24. package/dist/hooks/auto-slash-command/constants.d.ts +5 -0
  25. package/dist/hooks/auto-slash-command/detector.d.ts +9 -0
  26. package/dist/hooks/auto-slash-command/detector.test.d.ts +1 -0
  27. package/dist/hooks/auto-slash-command/executor.d.ts +7 -0
  28. package/dist/hooks/auto-slash-command/index.d.ts +8 -0
  29. package/dist/hooks/auto-slash-command/index.test.d.ts +1 -0
  30. package/dist/hooks/auto-slash-command/types.d.ts +27 -0
  31. package/dist/hooks/auto-update-checker/constants.d.ts +4 -0
  32. package/dist/hooks/index.d.ts +1 -0
  33. package/dist/hooks/keyword-detector/detector.d.ts +5 -0
  34. package/dist/hooks/keyword-detector/index.d.ts +2 -1
  35. package/dist/hooks/rules-injector/constants.d.ts +2 -0
  36. package/dist/hooks/rules-injector/finder.d.ts +1 -13
  37. package/dist/hooks/rules-injector/finder.test.d.ts +1 -0
  38. package/dist/hooks/rules-injector/parser.test.d.ts +1 -0
  39. package/dist/hooks/rules-injector/types.d.ts +13 -0
  40. package/dist/index.js +30596 -17457
  41. package/dist/plugin-config.d.ts +4 -0
  42. package/dist/plugin-handlers/config-handler.d.ts +10 -0
  43. package/dist/plugin-handlers/index.d.ts +1 -0
  44. package/dist/plugin-state.d.ts +6 -0
  45. package/dist/shared/frontmatter.d.ts +2 -2
  46. package/dist/shared/frontmatter.test.d.ts +1 -0
  47. package/dist/tools/index.d.ts +1 -0
  48. package/dist/tools/skill/tools.test.d.ts +1 -0
  49. package/dist/tools/skill/types.d.ts +5 -0
  50. package/dist/tools/skill-mcp/constants.d.ts +2 -0
  51. package/dist/tools/skill-mcp/index.d.ts +3 -0
  52. package/dist/tools/skill-mcp/tools.d.ts +11 -0
  53. package/dist/tools/skill-mcp/tools.test.d.ts +1 -0
  54. package/dist/tools/skill-mcp/types.d.ts +8 -0
  55. package/package.json +4 -1
package/dist/cli/index.js CHANGED
@@ -2657,7 +2657,7 @@ var require_napi = __commonJS((exports, module) => {
2657
2657
  var require_package = __commonJS((exports, module) => {
2658
2658
  module.exports = {
2659
2659
  name: "oh-my-opencode",
2660
- version: "2.9.0",
2660
+ version: "2.10.0",
2661
2661
  description: "OpenCode plugin - custom agents (oracle, librarian) and enhanced features",
2662
2662
  main: "dist/index.js",
2663
2663
  types: "dist/index.d.ts",
@@ -2711,11 +2711,13 @@ var require_package = __commonJS((exports, module) => {
2711
2711
  "@ast-grep/napi": "^0.40.0",
2712
2712
  "@clack/prompts": "^0.11.0",
2713
2713
  "@code-yeongyu/comment-checker": "^0.6.1",
2714
+ "@modelcontextprotocol/sdk": "^1.25.1",
2714
2715
  "@openauthjs/openauth": "^0.4.3",
2715
2716
  "@opencode-ai/plugin": "^1.0.162",
2716
2717
  "@opencode-ai/sdk": "^1.0.162",
2717
2718
  commander: "^14.0.2",
2718
2719
  hono: "^4.10.4",
2720
+ "js-yaml": "^4.1.1",
2719
2721
  "jsonc-parser": "^3.3.1",
2720
2722
  picocolors: "^1.1.1",
2721
2723
  picomatch: "^4.0.2",
@@ -2723,6 +2725,7 @@ var require_package = __commonJS((exports, module) => {
2723
2725
  zod: "^4.1.8"
2724
2726
  },
2725
2727
  devDependencies: {
2728
+ "@types/js-yaml": "^4.0.9",
2726
2729
  "@types/picomatch": "^3.0.2",
2727
2730
  "bun-types": "latest",
2728
2731
  typescript: "^5.7.3"
@@ -3338,6 +3341,2653 @@ var import_picocolors2 = __toESM(require_picocolors(), 1);
3338
3341
  import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync2, writeFileSync, statSync } from "fs";
3339
3342
  import { homedir } from "os";
3340
3343
  import { join as join2 } from "path";
3344
+
3345
+ // node_modules/js-yaml/dist/js-yaml.mjs
3346
+ /*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */
3347
+ function isNothing(subject) {
3348
+ return typeof subject === "undefined" || subject === null;
3349
+ }
3350
+ function isObject(subject) {
3351
+ return typeof subject === "object" && subject !== null;
3352
+ }
3353
+ function toArray(sequence) {
3354
+ if (Array.isArray(sequence))
3355
+ return sequence;
3356
+ else if (isNothing(sequence))
3357
+ return [];
3358
+ return [sequence];
3359
+ }
3360
+ function extend(target, source) {
3361
+ var index, length, key, sourceKeys;
3362
+ if (source) {
3363
+ sourceKeys = Object.keys(source);
3364
+ for (index = 0, length = sourceKeys.length;index < length; index += 1) {
3365
+ key = sourceKeys[index];
3366
+ target[key] = source[key];
3367
+ }
3368
+ }
3369
+ return target;
3370
+ }
3371
+ function repeat(string, count) {
3372
+ var result = "", cycle;
3373
+ for (cycle = 0;cycle < count; cycle += 1) {
3374
+ result += string;
3375
+ }
3376
+ return result;
3377
+ }
3378
+ function isNegativeZero(number) {
3379
+ return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
3380
+ }
3381
+ var isNothing_1 = isNothing;
3382
+ var isObject_1 = isObject;
3383
+ var toArray_1 = toArray;
3384
+ var repeat_1 = repeat;
3385
+ var isNegativeZero_1 = isNegativeZero;
3386
+ var extend_1 = extend;
3387
+ var common = {
3388
+ isNothing: isNothing_1,
3389
+ isObject: isObject_1,
3390
+ toArray: toArray_1,
3391
+ repeat: repeat_1,
3392
+ isNegativeZero: isNegativeZero_1,
3393
+ extend: extend_1
3394
+ };
3395
+ function formatError(exception, compact) {
3396
+ var where = "", message = exception.reason || "(unknown reason)";
3397
+ if (!exception.mark)
3398
+ return message;
3399
+ if (exception.mark.name) {
3400
+ where += 'in "' + exception.mark.name + '" ';
3401
+ }
3402
+ where += "(" + (exception.mark.line + 1) + ":" + (exception.mark.column + 1) + ")";
3403
+ if (!compact && exception.mark.snippet) {
3404
+ where += `
3405
+
3406
+ ` + exception.mark.snippet;
3407
+ }
3408
+ return message + " " + where;
3409
+ }
3410
+ function YAMLException$1(reason, mark) {
3411
+ Error.call(this);
3412
+ this.name = "YAMLException";
3413
+ this.reason = reason;
3414
+ this.mark = mark;
3415
+ this.message = formatError(this, false);
3416
+ if (Error.captureStackTrace) {
3417
+ Error.captureStackTrace(this, this.constructor);
3418
+ } else {
3419
+ this.stack = new Error().stack || "";
3420
+ }
3421
+ }
3422
+ YAMLException$1.prototype = Object.create(Error.prototype);
3423
+ YAMLException$1.prototype.constructor = YAMLException$1;
3424
+ YAMLException$1.prototype.toString = function toString(compact) {
3425
+ return this.name + ": " + formatError(this, compact);
3426
+ };
3427
+ var exception = YAMLException$1;
3428
+ function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
3429
+ var head = "";
3430
+ var tail = "";
3431
+ var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
3432
+ if (position - lineStart > maxHalfLength) {
3433
+ head = " ... ";
3434
+ lineStart = position - maxHalfLength + head.length;
3435
+ }
3436
+ if (lineEnd - position > maxHalfLength) {
3437
+ tail = " ...";
3438
+ lineEnd = position + maxHalfLength - tail.length;
3439
+ }
3440
+ return {
3441
+ str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, "\u2192") + tail,
3442
+ pos: position - lineStart + head.length
3443
+ };
3444
+ }
3445
+ function padStart(string, max) {
3446
+ return common.repeat(" ", max - string.length) + string;
3447
+ }
3448
+ function makeSnippet(mark, options) {
3449
+ options = Object.create(options || null);
3450
+ if (!mark.buffer)
3451
+ return null;
3452
+ if (!options.maxLength)
3453
+ options.maxLength = 79;
3454
+ if (typeof options.indent !== "number")
3455
+ options.indent = 1;
3456
+ if (typeof options.linesBefore !== "number")
3457
+ options.linesBefore = 3;
3458
+ if (typeof options.linesAfter !== "number")
3459
+ options.linesAfter = 2;
3460
+ var re = /\r?\n|\r|\0/g;
3461
+ var lineStarts = [0];
3462
+ var lineEnds = [];
3463
+ var match;
3464
+ var foundLineNo = -1;
3465
+ while (match = re.exec(mark.buffer)) {
3466
+ lineEnds.push(match.index);
3467
+ lineStarts.push(match.index + match[0].length);
3468
+ if (mark.position <= match.index && foundLineNo < 0) {
3469
+ foundLineNo = lineStarts.length - 2;
3470
+ }
3471
+ }
3472
+ if (foundLineNo < 0)
3473
+ foundLineNo = lineStarts.length - 1;
3474
+ var result = "", i, line;
3475
+ var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
3476
+ var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
3477
+ for (i = 1;i <= options.linesBefore; i++) {
3478
+ if (foundLineNo - i < 0)
3479
+ break;
3480
+ line = getLine(mark.buffer, lineStarts[foundLineNo - i], lineEnds[foundLineNo - i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]), maxLineLength);
3481
+ result = common.repeat(" ", options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + " | " + line.str + `
3482
+ ` + result;
3483
+ }
3484
+ line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
3485
+ result += common.repeat(" ", options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line.str + `
3486
+ `;
3487
+ result += common.repeat("-", options.indent + lineNoLength + 3 + line.pos) + "^" + `
3488
+ `;
3489
+ for (i = 1;i <= options.linesAfter; i++) {
3490
+ if (foundLineNo + i >= lineEnds.length)
3491
+ break;
3492
+ line = getLine(mark.buffer, lineStarts[foundLineNo + i], lineEnds[foundLineNo + i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]), maxLineLength);
3493
+ result += common.repeat(" ", options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + " | " + line.str + `
3494
+ `;
3495
+ }
3496
+ return result.replace(/\n$/, "");
3497
+ }
3498
+ var snippet = makeSnippet;
3499
+ var TYPE_CONSTRUCTOR_OPTIONS = [
3500
+ "kind",
3501
+ "multi",
3502
+ "resolve",
3503
+ "construct",
3504
+ "instanceOf",
3505
+ "predicate",
3506
+ "represent",
3507
+ "representName",
3508
+ "defaultStyle",
3509
+ "styleAliases"
3510
+ ];
3511
+ var YAML_NODE_KINDS = [
3512
+ "scalar",
3513
+ "sequence",
3514
+ "mapping"
3515
+ ];
3516
+ function compileStyleAliases(map) {
3517
+ var result = {};
3518
+ if (map !== null) {
3519
+ Object.keys(map).forEach(function(style) {
3520
+ map[style].forEach(function(alias) {
3521
+ result[String(alias)] = style;
3522
+ });
3523
+ });
3524
+ }
3525
+ return result;
3526
+ }
3527
+ function Type$1(tag, options) {
3528
+ options = options || {};
3529
+ Object.keys(options).forEach(function(name) {
3530
+ if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
3531
+ throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
3532
+ }
3533
+ });
3534
+ this.options = options;
3535
+ this.tag = tag;
3536
+ this.kind = options["kind"] || null;
3537
+ this.resolve = options["resolve"] || function() {
3538
+ return true;
3539
+ };
3540
+ this.construct = options["construct"] || function(data) {
3541
+ return data;
3542
+ };
3543
+ this.instanceOf = options["instanceOf"] || null;
3544
+ this.predicate = options["predicate"] || null;
3545
+ this.represent = options["represent"] || null;
3546
+ this.representName = options["representName"] || null;
3547
+ this.defaultStyle = options["defaultStyle"] || null;
3548
+ this.multi = options["multi"] || false;
3549
+ this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
3550
+ if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
3551
+ throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
3552
+ }
3553
+ }
3554
+ var type = Type$1;
3555
+ function compileList(schema, name) {
3556
+ var result = [];
3557
+ schema[name].forEach(function(currentType) {
3558
+ var newIndex = result.length;
3559
+ result.forEach(function(previousType, previousIndex) {
3560
+ if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) {
3561
+ newIndex = previousIndex;
3562
+ }
3563
+ });
3564
+ result[newIndex] = currentType;
3565
+ });
3566
+ return result;
3567
+ }
3568
+ function compileMap() {
3569
+ var result = {
3570
+ scalar: {},
3571
+ sequence: {},
3572
+ mapping: {},
3573
+ fallback: {},
3574
+ multi: {
3575
+ scalar: [],
3576
+ sequence: [],
3577
+ mapping: [],
3578
+ fallback: []
3579
+ }
3580
+ }, index, length;
3581
+ function collectType(type2) {
3582
+ if (type2.multi) {
3583
+ result.multi[type2.kind].push(type2);
3584
+ result.multi["fallback"].push(type2);
3585
+ } else {
3586
+ result[type2.kind][type2.tag] = result["fallback"][type2.tag] = type2;
3587
+ }
3588
+ }
3589
+ for (index = 0, length = arguments.length;index < length; index += 1) {
3590
+ arguments[index].forEach(collectType);
3591
+ }
3592
+ return result;
3593
+ }
3594
+ function Schema$1(definition) {
3595
+ return this.extend(definition);
3596
+ }
3597
+ Schema$1.prototype.extend = function extend2(definition) {
3598
+ var implicit = [];
3599
+ var explicit = [];
3600
+ if (definition instanceof type) {
3601
+ explicit.push(definition);
3602
+ } else if (Array.isArray(definition)) {
3603
+ explicit = explicit.concat(definition);
3604
+ } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
3605
+ if (definition.implicit)
3606
+ implicit = implicit.concat(definition.implicit);
3607
+ if (definition.explicit)
3608
+ explicit = explicit.concat(definition.explicit);
3609
+ } else {
3610
+ throw new exception("Schema.extend argument should be a Type, [ Type ], " + "or a schema definition ({ implicit: [...], explicit: [...] })");
3611
+ }
3612
+ implicit.forEach(function(type$1) {
3613
+ if (!(type$1 instanceof type)) {
3614
+ throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
3615
+ }
3616
+ if (type$1.loadKind && type$1.loadKind !== "scalar") {
3617
+ throw new exception("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
3618
+ }
3619
+ if (type$1.multi) {
3620
+ throw new exception("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
3621
+ }
3622
+ });
3623
+ explicit.forEach(function(type$1) {
3624
+ if (!(type$1 instanceof type)) {
3625
+ throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
3626
+ }
3627
+ });
3628
+ var result = Object.create(Schema$1.prototype);
3629
+ result.implicit = (this.implicit || []).concat(implicit);
3630
+ result.explicit = (this.explicit || []).concat(explicit);
3631
+ result.compiledImplicit = compileList(result, "implicit");
3632
+ result.compiledExplicit = compileList(result, "explicit");
3633
+ result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
3634
+ return result;
3635
+ };
3636
+ var schema = Schema$1;
3637
+ var str = new type("tag:yaml.org,2002:str", {
3638
+ kind: "scalar",
3639
+ construct: function(data) {
3640
+ return data !== null ? data : "";
3641
+ }
3642
+ });
3643
+ var seq = new type("tag:yaml.org,2002:seq", {
3644
+ kind: "sequence",
3645
+ construct: function(data) {
3646
+ return data !== null ? data : [];
3647
+ }
3648
+ });
3649
+ var map = new type("tag:yaml.org,2002:map", {
3650
+ kind: "mapping",
3651
+ construct: function(data) {
3652
+ return data !== null ? data : {};
3653
+ }
3654
+ });
3655
+ var failsafe = new schema({
3656
+ explicit: [
3657
+ str,
3658
+ seq,
3659
+ map
3660
+ ]
3661
+ });
3662
+ function resolveYamlNull(data) {
3663
+ if (data === null)
3664
+ return true;
3665
+ var max = data.length;
3666
+ return max === 1 && data === "~" || max === 4 && (data === "null" || data === "Null" || data === "NULL");
3667
+ }
3668
+ function constructYamlNull() {
3669
+ return null;
3670
+ }
3671
+ function isNull(object) {
3672
+ return object === null;
3673
+ }
3674
+ var _null = new type("tag:yaml.org,2002:null", {
3675
+ kind: "scalar",
3676
+ resolve: resolveYamlNull,
3677
+ construct: constructYamlNull,
3678
+ predicate: isNull,
3679
+ represent: {
3680
+ canonical: function() {
3681
+ return "~";
3682
+ },
3683
+ lowercase: function() {
3684
+ return "null";
3685
+ },
3686
+ uppercase: function() {
3687
+ return "NULL";
3688
+ },
3689
+ camelcase: function() {
3690
+ return "Null";
3691
+ },
3692
+ empty: function() {
3693
+ return "";
3694
+ }
3695
+ },
3696
+ defaultStyle: "lowercase"
3697
+ });
3698
+ function resolveYamlBoolean(data) {
3699
+ if (data === null)
3700
+ return false;
3701
+ var max = data.length;
3702
+ return max === 4 && (data === "true" || data === "True" || data === "TRUE") || max === 5 && (data === "false" || data === "False" || data === "FALSE");
3703
+ }
3704
+ function constructYamlBoolean(data) {
3705
+ return data === "true" || data === "True" || data === "TRUE";
3706
+ }
3707
+ function isBoolean(object) {
3708
+ return Object.prototype.toString.call(object) === "[object Boolean]";
3709
+ }
3710
+ var bool = new type("tag:yaml.org,2002:bool", {
3711
+ kind: "scalar",
3712
+ resolve: resolveYamlBoolean,
3713
+ construct: constructYamlBoolean,
3714
+ predicate: isBoolean,
3715
+ represent: {
3716
+ lowercase: function(object) {
3717
+ return object ? "true" : "false";
3718
+ },
3719
+ uppercase: function(object) {
3720
+ return object ? "TRUE" : "FALSE";
3721
+ },
3722
+ camelcase: function(object) {
3723
+ return object ? "True" : "False";
3724
+ }
3725
+ },
3726
+ defaultStyle: "lowercase"
3727
+ });
3728
+ function isHexCode(c) {
3729
+ return 48 <= c && c <= 57 || 65 <= c && c <= 70 || 97 <= c && c <= 102;
3730
+ }
3731
+ function isOctCode(c) {
3732
+ return 48 <= c && c <= 55;
3733
+ }
3734
+ function isDecCode(c) {
3735
+ return 48 <= c && c <= 57;
3736
+ }
3737
+ function resolveYamlInteger(data) {
3738
+ if (data === null)
3739
+ return false;
3740
+ var max = data.length, index = 0, hasDigits = false, ch;
3741
+ if (!max)
3742
+ return false;
3743
+ ch = data[index];
3744
+ if (ch === "-" || ch === "+") {
3745
+ ch = data[++index];
3746
+ }
3747
+ if (ch === "0") {
3748
+ if (index + 1 === max)
3749
+ return true;
3750
+ ch = data[++index];
3751
+ if (ch === "b") {
3752
+ index++;
3753
+ for (;index < max; index++) {
3754
+ ch = data[index];
3755
+ if (ch === "_")
3756
+ continue;
3757
+ if (ch !== "0" && ch !== "1")
3758
+ return false;
3759
+ hasDigits = true;
3760
+ }
3761
+ return hasDigits && ch !== "_";
3762
+ }
3763
+ if (ch === "x") {
3764
+ index++;
3765
+ for (;index < max; index++) {
3766
+ ch = data[index];
3767
+ if (ch === "_")
3768
+ continue;
3769
+ if (!isHexCode(data.charCodeAt(index)))
3770
+ return false;
3771
+ hasDigits = true;
3772
+ }
3773
+ return hasDigits && ch !== "_";
3774
+ }
3775
+ if (ch === "o") {
3776
+ index++;
3777
+ for (;index < max; index++) {
3778
+ ch = data[index];
3779
+ if (ch === "_")
3780
+ continue;
3781
+ if (!isOctCode(data.charCodeAt(index)))
3782
+ return false;
3783
+ hasDigits = true;
3784
+ }
3785
+ return hasDigits && ch !== "_";
3786
+ }
3787
+ }
3788
+ if (ch === "_")
3789
+ return false;
3790
+ for (;index < max; index++) {
3791
+ ch = data[index];
3792
+ if (ch === "_")
3793
+ continue;
3794
+ if (!isDecCode(data.charCodeAt(index))) {
3795
+ return false;
3796
+ }
3797
+ hasDigits = true;
3798
+ }
3799
+ if (!hasDigits || ch === "_")
3800
+ return false;
3801
+ return true;
3802
+ }
3803
+ function constructYamlInteger(data) {
3804
+ var value = data, sign = 1, ch;
3805
+ if (value.indexOf("_") !== -1) {
3806
+ value = value.replace(/_/g, "");
3807
+ }
3808
+ ch = value[0];
3809
+ if (ch === "-" || ch === "+") {
3810
+ if (ch === "-")
3811
+ sign = -1;
3812
+ value = value.slice(1);
3813
+ ch = value[0];
3814
+ }
3815
+ if (value === "0")
3816
+ return 0;
3817
+ if (ch === "0") {
3818
+ if (value[1] === "b")
3819
+ return sign * parseInt(value.slice(2), 2);
3820
+ if (value[1] === "x")
3821
+ return sign * parseInt(value.slice(2), 16);
3822
+ if (value[1] === "o")
3823
+ return sign * parseInt(value.slice(2), 8);
3824
+ }
3825
+ return sign * parseInt(value, 10);
3826
+ }
3827
+ function isInteger(object) {
3828
+ return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common.isNegativeZero(object));
3829
+ }
3830
+ var int = new type("tag:yaml.org,2002:int", {
3831
+ kind: "scalar",
3832
+ resolve: resolveYamlInteger,
3833
+ construct: constructYamlInteger,
3834
+ predicate: isInteger,
3835
+ represent: {
3836
+ binary: function(obj) {
3837
+ return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
3838
+ },
3839
+ octal: function(obj) {
3840
+ return obj >= 0 ? "0o" + obj.toString(8) : "-0o" + obj.toString(8).slice(1);
3841
+ },
3842
+ decimal: function(obj) {
3843
+ return obj.toString(10);
3844
+ },
3845
+ hexadecimal: function(obj) {
3846
+ return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
3847
+ }
3848
+ },
3849
+ defaultStyle: "decimal",
3850
+ styleAliases: {
3851
+ binary: [2, "bin"],
3852
+ octal: [8, "oct"],
3853
+ decimal: [10, "dec"],
3854
+ hexadecimal: [16, "hex"]
3855
+ }
3856
+ });
3857
+ var YAML_FLOAT_PATTERN = new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?" + "|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?" + "|[-+]?\\.(?:inf|Inf|INF)" + "|\\.(?:nan|NaN|NAN))$");
3858
+ function resolveYamlFloat(data) {
3859
+ if (data === null)
3860
+ return false;
3861
+ if (!YAML_FLOAT_PATTERN.test(data) || data[data.length - 1] === "_") {
3862
+ return false;
3863
+ }
3864
+ return true;
3865
+ }
3866
+ function constructYamlFloat(data) {
3867
+ var value, sign;
3868
+ value = data.replace(/_/g, "").toLowerCase();
3869
+ sign = value[0] === "-" ? -1 : 1;
3870
+ if ("+-".indexOf(value[0]) >= 0) {
3871
+ value = value.slice(1);
3872
+ }
3873
+ if (value === ".inf") {
3874
+ return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
3875
+ } else if (value === ".nan") {
3876
+ return NaN;
3877
+ }
3878
+ return sign * parseFloat(value, 10);
3879
+ }
3880
+ var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
3881
+ function representYamlFloat(object, style) {
3882
+ var res;
3883
+ if (isNaN(object)) {
3884
+ switch (style) {
3885
+ case "lowercase":
3886
+ return ".nan";
3887
+ case "uppercase":
3888
+ return ".NAN";
3889
+ case "camelcase":
3890
+ return ".NaN";
3891
+ }
3892
+ } else if (Number.POSITIVE_INFINITY === object) {
3893
+ switch (style) {
3894
+ case "lowercase":
3895
+ return ".inf";
3896
+ case "uppercase":
3897
+ return ".INF";
3898
+ case "camelcase":
3899
+ return ".Inf";
3900
+ }
3901
+ } else if (Number.NEGATIVE_INFINITY === object) {
3902
+ switch (style) {
3903
+ case "lowercase":
3904
+ return "-.inf";
3905
+ case "uppercase":
3906
+ return "-.INF";
3907
+ case "camelcase":
3908
+ return "-.Inf";
3909
+ }
3910
+ } else if (common.isNegativeZero(object)) {
3911
+ return "-0.0";
3912
+ }
3913
+ res = object.toString(10);
3914
+ return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
3915
+ }
3916
+ function isFloat(object) {
3917
+ return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
3918
+ }
3919
+ var float = new type("tag:yaml.org,2002:float", {
3920
+ kind: "scalar",
3921
+ resolve: resolveYamlFloat,
3922
+ construct: constructYamlFloat,
3923
+ predicate: isFloat,
3924
+ represent: representYamlFloat,
3925
+ defaultStyle: "lowercase"
3926
+ });
3927
+ var json = failsafe.extend({
3928
+ implicit: [
3929
+ _null,
3930
+ bool,
3931
+ int,
3932
+ float
3933
+ ]
3934
+ });
3935
+ var core = json;
3936
+ var YAML_DATE_REGEXP = new RegExp("^([0-9][0-9][0-9][0-9])" + "-([0-9][0-9])" + "-([0-9][0-9])$");
3937
+ var YAML_TIMESTAMP_REGEXP = new RegExp("^([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]))?))?$");
3938
+ function resolveYamlTimestamp(data) {
3939
+ if (data === null)
3940
+ return false;
3941
+ if (YAML_DATE_REGEXP.exec(data) !== null)
3942
+ return true;
3943
+ if (YAML_TIMESTAMP_REGEXP.exec(data) !== null)
3944
+ return true;
3945
+ return false;
3946
+ }
3947
+ function constructYamlTimestamp(data) {
3948
+ var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date;
3949
+ match = YAML_DATE_REGEXP.exec(data);
3950
+ if (match === null)
3951
+ match = YAML_TIMESTAMP_REGEXP.exec(data);
3952
+ if (match === null)
3953
+ throw new Error("Date resolve error");
3954
+ year = +match[1];
3955
+ month = +match[2] - 1;
3956
+ day = +match[3];
3957
+ if (!match[4]) {
3958
+ return new Date(Date.UTC(year, month, day));
3959
+ }
3960
+ hour = +match[4];
3961
+ minute = +match[5];
3962
+ second = +match[6];
3963
+ if (match[7]) {
3964
+ fraction = match[7].slice(0, 3);
3965
+ while (fraction.length < 3) {
3966
+ fraction += "0";
3967
+ }
3968
+ fraction = +fraction;
3969
+ }
3970
+ if (match[9]) {
3971
+ tz_hour = +match[10];
3972
+ tz_minute = +(match[11] || 0);
3973
+ delta = (tz_hour * 60 + tz_minute) * 60000;
3974
+ if (match[9] === "-")
3975
+ delta = -delta;
3976
+ }
3977
+ date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
3978
+ if (delta)
3979
+ date.setTime(date.getTime() - delta);
3980
+ return date;
3981
+ }
3982
+ function representYamlTimestamp(object) {
3983
+ return object.toISOString();
3984
+ }
3985
+ var timestamp = new type("tag:yaml.org,2002:timestamp", {
3986
+ kind: "scalar",
3987
+ resolve: resolveYamlTimestamp,
3988
+ construct: constructYamlTimestamp,
3989
+ instanceOf: Date,
3990
+ represent: representYamlTimestamp
3991
+ });
3992
+ function resolveYamlMerge(data) {
3993
+ return data === "<<" || data === null;
3994
+ }
3995
+ var merge = new type("tag:yaml.org,2002:merge", {
3996
+ kind: "scalar",
3997
+ resolve: resolveYamlMerge
3998
+ });
3999
+ var BASE64_MAP = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
4000
+ \r`;
4001
+ function resolveYamlBinary(data) {
4002
+ if (data === null)
4003
+ return false;
4004
+ var code, idx, bitlen = 0, max = data.length, map2 = BASE64_MAP;
4005
+ for (idx = 0;idx < max; idx++) {
4006
+ code = map2.indexOf(data.charAt(idx));
4007
+ if (code > 64)
4008
+ continue;
4009
+ if (code < 0)
4010
+ return false;
4011
+ bitlen += 6;
4012
+ }
4013
+ return bitlen % 8 === 0;
4014
+ }
4015
+ function constructYamlBinary(data) {
4016
+ var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max = input.length, map2 = BASE64_MAP, bits = 0, result = [];
4017
+ for (idx = 0;idx < max; idx++) {
4018
+ if (idx % 4 === 0 && idx) {
4019
+ result.push(bits >> 16 & 255);
4020
+ result.push(bits >> 8 & 255);
4021
+ result.push(bits & 255);
4022
+ }
4023
+ bits = bits << 6 | map2.indexOf(input.charAt(idx));
4024
+ }
4025
+ tailbits = max % 4 * 6;
4026
+ if (tailbits === 0) {
4027
+ result.push(bits >> 16 & 255);
4028
+ result.push(bits >> 8 & 255);
4029
+ result.push(bits & 255);
4030
+ } else if (tailbits === 18) {
4031
+ result.push(bits >> 10 & 255);
4032
+ result.push(bits >> 2 & 255);
4033
+ } else if (tailbits === 12) {
4034
+ result.push(bits >> 4 & 255);
4035
+ }
4036
+ return new Uint8Array(result);
4037
+ }
4038
+ function representYamlBinary(object) {
4039
+ var result = "", bits = 0, idx, tail, max = object.length, map2 = BASE64_MAP;
4040
+ for (idx = 0;idx < max; idx++) {
4041
+ if (idx % 3 === 0 && idx) {
4042
+ result += map2[bits >> 18 & 63];
4043
+ result += map2[bits >> 12 & 63];
4044
+ result += map2[bits >> 6 & 63];
4045
+ result += map2[bits & 63];
4046
+ }
4047
+ bits = (bits << 8) + object[idx];
4048
+ }
4049
+ tail = max % 3;
4050
+ if (tail === 0) {
4051
+ result += map2[bits >> 18 & 63];
4052
+ result += map2[bits >> 12 & 63];
4053
+ result += map2[bits >> 6 & 63];
4054
+ result += map2[bits & 63];
4055
+ } else if (tail === 2) {
4056
+ result += map2[bits >> 10 & 63];
4057
+ result += map2[bits >> 4 & 63];
4058
+ result += map2[bits << 2 & 63];
4059
+ result += map2[64];
4060
+ } else if (tail === 1) {
4061
+ result += map2[bits >> 2 & 63];
4062
+ result += map2[bits << 4 & 63];
4063
+ result += map2[64];
4064
+ result += map2[64];
4065
+ }
4066
+ return result;
4067
+ }
4068
+ function isBinary(obj) {
4069
+ return Object.prototype.toString.call(obj) === "[object Uint8Array]";
4070
+ }
4071
+ var binary = new type("tag:yaml.org,2002:binary", {
4072
+ kind: "scalar",
4073
+ resolve: resolveYamlBinary,
4074
+ construct: constructYamlBinary,
4075
+ predicate: isBinary,
4076
+ represent: representYamlBinary
4077
+ });
4078
+ var _hasOwnProperty$3 = Object.prototype.hasOwnProperty;
4079
+ var _toString$2 = Object.prototype.toString;
4080
+ function resolveYamlOmap(data) {
4081
+ if (data === null)
4082
+ return true;
4083
+ var objectKeys = [], index, length, pair, pairKey, pairHasKey, object = data;
4084
+ for (index = 0, length = object.length;index < length; index += 1) {
4085
+ pair = object[index];
4086
+ pairHasKey = false;
4087
+ if (_toString$2.call(pair) !== "[object Object]")
4088
+ return false;
4089
+ for (pairKey in pair) {
4090
+ if (_hasOwnProperty$3.call(pair, pairKey)) {
4091
+ if (!pairHasKey)
4092
+ pairHasKey = true;
4093
+ else
4094
+ return false;
4095
+ }
4096
+ }
4097
+ if (!pairHasKey)
4098
+ return false;
4099
+ if (objectKeys.indexOf(pairKey) === -1)
4100
+ objectKeys.push(pairKey);
4101
+ else
4102
+ return false;
4103
+ }
4104
+ return true;
4105
+ }
4106
+ function constructYamlOmap(data) {
4107
+ return data !== null ? data : [];
4108
+ }
4109
+ var omap = new type("tag:yaml.org,2002:omap", {
4110
+ kind: "sequence",
4111
+ resolve: resolveYamlOmap,
4112
+ construct: constructYamlOmap
4113
+ });
4114
+ var _toString$1 = Object.prototype.toString;
4115
+ function resolveYamlPairs(data) {
4116
+ if (data === null)
4117
+ return true;
4118
+ var index, length, pair, keys, result, object = data;
4119
+ result = new Array(object.length);
4120
+ for (index = 0, length = object.length;index < length; index += 1) {
4121
+ pair = object[index];
4122
+ if (_toString$1.call(pair) !== "[object Object]")
4123
+ return false;
4124
+ keys = Object.keys(pair);
4125
+ if (keys.length !== 1)
4126
+ return false;
4127
+ result[index] = [keys[0], pair[keys[0]]];
4128
+ }
4129
+ return true;
4130
+ }
4131
+ function constructYamlPairs(data) {
4132
+ if (data === null)
4133
+ return [];
4134
+ var index, length, pair, keys, result, object = data;
4135
+ result = new Array(object.length);
4136
+ for (index = 0, length = object.length;index < length; index += 1) {
4137
+ pair = object[index];
4138
+ keys = Object.keys(pair);
4139
+ result[index] = [keys[0], pair[keys[0]]];
4140
+ }
4141
+ return result;
4142
+ }
4143
+ var pairs = new type("tag:yaml.org,2002:pairs", {
4144
+ kind: "sequence",
4145
+ resolve: resolveYamlPairs,
4146
+ construct: constructYamlPairs
4147
+ });
4148
+ var _hasOwnProperty$2 = Object.prototype.hasOwnProperty;
4149
+ function resolveYamlSet(data) {
4150
+ if (data === null)
4151
+ return true;
4152
+ var key, object = data;
4153
+ for (key in object) {
4154
+ if (_hasOwnProperty$2.call(object, key)) {
4155
+ if (object[key] !== null)
4156
+ return false;
4157
+ }
4158
+ }
4159
+ return true;
4160
+ }
4161
+ function constructYamlSet(data) {
4162
+ return data !== null ? data : {};
4163
+ }
4164
+ var set = new type("tag:yaml.org,2002:set", {
4165
+ kind: "mapping",
4166
+ resolve: resolveYamlSet,
4167
+ construct: constructYamlSet
4168
+ });
4169
+ var _default = core.extend({
4170
+ implicit: [
4171
+ timestamp,
4172
+ merge
4173
+ ],
4174
+ explicit: [
4175
+ binary,
4176
+ omap,
4177
+ pairs,
4178
+ set
4179
+ ]
4180
+ });
4181
+ var _hasOwnProperty$1 = Object.prototype.hasOwnProperty;
4182
+ var CONTEXT_FLOW_IN = 1;
4183
+ var CONTEXT_FLOW_OUT = 2;
4184
+ var CONTEXT_BLOCK_IN = 3;
4185
+ var CONTEXT_BLOCK_OUT = 4;
4186
+ var CHOMPING_CLIP = 1;
4187
+ var CHOMPING_STRIP = 2;
4188
+ var CHOMPING_KEEP = 3;
4189
+ var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
4190
+ var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
4191
+ var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
4192
+ var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
4193
+ var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
4194
+ function _class(obj) {
4195
+ return Object.prototype.toString.call(obj);
4196
+ }
4197
+ function is_EOL(c) {
4198
+ return c === 10 || c === 13;
4199
+ }
4200
+ function is_WHITE_SPACE(c) {
4201
+ return c === 9 || c === 32;
4202
+ }
4203
+ function is_WS_OR_EOL(c) {
4204
+ return c === 9 || c === 32 || c === 10 || c === 13;
4205
+ }
4206
+ function is_FLOW_INDICATOR(c) {
4207
+ return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
4208
+ }
4209
+ function fromHexCode(c) {
4210
+ var lc;
4211
+ if (48 <= c && c <= 57) {
4212
+ return c - 48;
4213
+ }
4214
+ lc = c | 32;
4215
+ if (97 <= lc && lc <= 102) {
4216
+ return lc - 97 + 10;
4217
+ }
4218
+ return -1;
4219
+ }
4220
+ function escapedHexLen(c) {
4221
+ if (c === 120) {
4222
+ return 2;
4223
+ }
4224
+ if (c === 117) {
4225
+ return 4;
4226
+ }
4227
+ if (c === 85) {
4228
+ return 8;
4229
+ }
4230
+ return 0;
4231
+ }
4232
+ function fromDecimalCode(c) {
4233
+ if (48 <= c && c <= 57) {
4234
+ return c - 48;
4235
+ }
4236
+ return -1;
4237
+ }
4238
+ function simpleEscapeSequence(c) {
4239
+ return c === 48 ? "\x00" : c === 97 ? "\x07" : c === 98 ? "\b" : c === 116 ? "\t" : c === 9 ? "\t" : c === 110 ? `
4240
+ ` : 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" : "";
4241
+ }
4242
+ function charFromCodepoint(c) {
4243
+ if (c <= 65535) {
4244
+ return String.fromCharCode(c);
4245
+ }
4246
+ return String.fromCharCode((c - 65536 >> 10) + 55296, (c - 65536 & 1023) + 56320);
4247
+ }
4248
+ function setProperty(object, key, value) {
4249
+ if (key === "__proto__") {
4250
+ Object.defineProperty(object, key, {
4251
+ configurable: true,
4252
+ enumerable: true,
4253
+ writable: true,
4254
+ value
4255
+ });
4256
+ } else {
4257
+ object[key] = value;
4258
+ }
4259
+ }
4260
+ var simpleEscapeCheck = new Array(256);
4261
+ var simpleEscapeMap = new Array(256);
4262
+ for (i = 0;i < 256; i++) {
4263
+ simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
4264
+ simpleEscapeMap[i] = simpleEscapeSequence(i);
4265
+ }
4266
+ var i;
4267
+ function State$1(input, options) {
4268
+ this.input = input;
4269
+ this.filename = options["filename"] || null;
4270
+ this.schema = options["schema"] || _default;
4271
+ this.onWarning = options["onWarning"] || null;
4272
+ this.legacy = options["legacy"] || false;
4273
+ this.json = options["json"] || false;
4274
+ this.listener = options["listener"] || null;
4275
+ this.implicitTypes = this.schema.compiledImplicit;
4276
+ this.typeMap = this.schema.compiledTypeMap;
4277
+ this.length = input.length;
4278
+ this.position = 0;
4279
+ this.line = 0;
4280
+ this.lineStart = 0;
4281
+ this.lineIndent = 0;
4282
+ this.firstTabInLine = -1;
4283
+ this.documents = [];
4284
+ }
4285
+ function generateError(state, message) {
4286
+ var mark = {
4287
+ name: state.filename,
4288
+ buffer: state.input.slice(0, -1),
4289
+ position: state.position,
4290
+ line: state.line,
4291
+ column: state.position - state.lineStart
4292
+ };
4293
+ mark.snippet = snippet(mark);
4294
+ return new exception(message, mark);
4295
+ }
4296
+ function throwError(state, message) {
4297
+ throw generateError(state, message);
4298
+ }
4299
+ function throwWarning(state, message) {
4300
+ if (state.onWarning) {
4301
+ state.onWarning.call(null, generateError(state, message));
4302
+ }
4303
+ }
4304
+ var directiveHandlers = {
4305
+ YAML: function handleYamlDirective(state, name, args) {
4306
+ var match, major, minor;
4307
+ if (state.version !== null) {
4308
+ throwError(state, "duplication of %YAML directive");
4309
+ }
4310
+ if (args.length !== 1) {
4311
+ throwError(state, "YAML directive accepts exactly one argument");
4312
+ }
4313
+ match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
4314
+ if (match === null) {
4315
+ throwError(state, "ill-formed argument of the YAML directive");
4316
+ }
4317
+ major = parseInt(match[1], 10);
4318
+ minor = parseInt(match[2], 10);
4319
+ if (major !== 1) {
4320
+ throwError(state, "unacceptable YAML version of the document");
4321
+ }
4322
+ state.version = args[0];
4323
+ state.checkLineBreaks = minor < 2;
4324
+ if (minor !== 1 && minor !== 2) {
4325
+ throwWarning(state, "unsupported YAML version of the document");
4326
+ }
4327
+ },
4328
+ TAG: function handleTagDirective(state, name, args) {
4329
+ var handle, prefix;
4330
+ if (args.length !== 2) {
4331
+ throwError(state, "TAG directive accepts exactly two arguments");
4332
+ }
4333
+ handle = args[0];
4334
+ prefix = args[1];
4335
+ if (!PATTERN_TAG_HANDLE.test(handle)) {
4336
+ throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
4337
+ }
4338
+ if (_hasOwnProperty$1.call(state.tagMap, handle)) {
4339
+ throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
4340
+ }
4341
+ if (!PATTERN_TAG_URI.test(prefix)) {
4342
+ throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
4343
+ }
4344
+ try {
4345
+ prefix = decodeURIComponent(prefix);
4346
+ } catch (err) {
4347
+ throwError(state, "tag prefix is malformed: " + prefix);
4348
+ }
4349
+ state.tagMap[handle] = prefix;
4350
+ }
4351
+ };
4352
+ function captureSegment(state, start, end, checkJson) {
4353
+ var _position, _length, _character, _result;
4354
+ if (start < end) {
4355
+ _result = state.input.slice(start, end);
4356
+ if (checkJson) {
4357
+ for (_position = 0, _length = _result.length;_position < _length; _position += 1) {
4358
+ _character = _result.charCodeAt(_position);
4359
+ if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
4360
+ throwError(state, "expected valid JSON character");
4361
+ }
4362
+ }
4363
+ } else if (PATTERN_NON_PRINTABLE.test(_result)) {
4364
+ throwError(state, "the stream contains non-printable characters");
4365
+ }
4366
+ state.result += _result;
4367
+ }
4368
+ }
4369
+ function mergeMappings(state, destination, source, overridableKeys) {
4370
+ var sourceKeys, key, index, quantity;
4371
+ if (!common.isObject(source)) {
4372
+ throwError(state, "cannot merge mappings; the provided source object is unacceptable");
4373
+ }
4374
+ sourceKeys = Object.keys(source);
4375
+ for (index = 0, quantity = sourceKeys.length;index < quantity; index += 1) {
4376
+ key = sourceKeys[index];
4377
+ if (!_hasOwnProperty$1.call(destination, key)) {
4378
+ setProperty(destination, key, source[key]);
4379
+ overridableKeys[key] = true;
4380
+ }
4381
+ }
4382
+ }
4383
+ function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) {
4384
+ var index, quantity;
4385
+ if (Array.isArray(keyNode)) {
4386
+ keyNode = Array.prototype.slice.call(keyNode);
4387
+ for (index = 0, quantity = keyNode.length;index < quantity; index += 1) {
4388
+ if (Array.isArray(keyNode[index])) {
4389
+ throwError(state, "nested arrays are not supported inside keys");
4390
+ }
4391
+ if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") {
4392
+ keyNode[index] = "[object Object]";
4393
+ }
4394
+ }
4395
+ }
4396
+ if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") {
4397
+ keyNode = "[object Object]";
4398
+ }
4399
+ keyNode = String(keyNode);
4400
+ if (_result === null) {
4401
+ _result = {};
4402
+ }
4403
+ if (keyTag === "tag:yaml.org,2002:merge") {
4404
+ if (Array.isArray(valueNode)) {
4405
+ for (index = 0, quantity = valueNode.length;index < quantity; index += 1) {
4406
+ mergeMappings(state, _result, valueNode[index], overridableKeys);
4407
+ }
4408
+ } else {
4409
+ mergeMappings(state, _result, valueNode, overridableKeys);
4410
+ }
4411
+ } else {
4412
+ if (!state.json && !_hasOwnProperty$1.call(overridableKeys, keyNode) && _hasOwnProperty$1.call(_result, keyNode)) {
4413
+ state.line = startLine || state.line;
4414
+ state.lineStart = startLineStart || state.lineStart;
4415
+ state.position = startPos || state.position;
4416
+ throwError(state, "duplicated mapping key");
4417
+ }
4418
+ setProperty(_result, keyNode, valueNode);
4419
+ delete overridableKeys[keyNode];
4420
+ }
4421
+ return _result;
4422
+ }
4423
+ function readLineBreak(state) {
4424
+ var ch;
4425
+ ch = state.input.charCodeAt(state.position);
4426
+ if (ch === 10) {
4427
+ state.position++;
4428
+ } else if (ch === 13) {
4429
+ state.position++;
4430
+ if (state.input.charCodeAt(state.position) === 10) {
4431
+ state.position++;
4432
+ }
4433
+ } else {
4434
+ throwError(state, "a line break is expected");
4435
+ }
4436
+ state.line += 1;
4437
+ state.lineStart = state.position;
4438
+ state.firstTabInLine = -1;
4439
+ }
4440
+ function skipSeparationSpace(state, allowComments, checkIndent) {
4441
+ var lineBreaks = 0, ch = state.input.charCodeAt(state.position);
4442
+ while (ch !== 0) {
4443
+ while (is_WHITE_SPACE(ch)) {
4444
+ if (ch === 9 && state.firstTabInLine === -1) {
4445
+ state.firstTabInLine = state.position;
4446
+ }
4447
+ ch = state.input.charCodeAt(++state.position);
4448
+ }
4449
+ if (allowComments && ch === 35) {
4450
+ do {
4451
+ ch = state.input.charCodeAt(++state.position);
4452
+ } while (ch !== 10 && ch !== 13 && ch !== 0);
4453
+ }
4454
+ if (is_EOL(ch)) {
4455
+ readLineBreak(state);
4456
+ ch = state.input.charCodeAt(state.position);
4457
+ lineBreaks++;
4458
+ state.lineIndent = 0;
4459
+ while (ch === 32) {
4460
+ state.lineIndent++;
4461
+ ch = state.input.charCodeAt(++state.position);
4462
+ }
4463
+ } else {
4464
+ break;
4465
+ }
4466
+ }
4467
+ if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
4468
+ throwWarning(state, "deficient indentation");
4469
+ }
4470
+ return lineBreaks;
4471
+ }
4472
+ function testDocumentSeparator(state) {
4473
+ var _position = state.position, ch;
4474
+ ch = state.input.charCodeAt(_position);
4475
+ if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
4476
+ _position += 3;
4477
+ ch = state.input.charCodeAt(_position);
4478
+ if (ch === 0 || is_WS_OR_EOL(ch)) {
4479
+ return true;
4480
+ }
4481
+ }
4482
+ return false;
4483
+ }
4484
+ function writeFoldedLines(state, count) {
4485
+ if (count === 1) {
4486
+ state.result += " ";
4487
+ } else if (count > 1) {
4488
+ state.result += common.repeat(`
4489
+ `, count - 1);
4490
+ }
4491
+ }
4492
+ function readPlainScalar(state, nodeIndent, withinFlowCollection) {
4493
+ var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state.kind, _result = state.result, ch;
4494
+ ch = state.input.charCodeAt(state.position);
4495
+ 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) {
4496
+ return false;
4497
+ }
4498
+ if (ch === 63 || ch === 45) {
4499
+ following = state.input.charCodeAt(state.position + 1);
4500
+ if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
4501
+ return false;
4502
+ }
4503
+ }
4504
+ state.kind = "scalar";
4505
+ state.result = "";
4506
+ captureStart = captureEnd = state.position;
4507
+ hasPendingContent = false;
4508
+ while (ch !== 0) {
4509
+ if (ch === 58) {
4510
+ following = state.input.charCodeAt(state.position + 1);
4511
+ if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
4512
+ break;
4513
+ }
4514
+ } else if (ch === 35) {
4515
+ preceding = state.input.charCodeAt(state.position - 1);
4516
+ if (is_WS_OR_EOL(preceding)) {
4517
+ break;
4518
+ }
4519
+ } else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && is_FLOW_INDICATOR(ch)) {
4520
+ break;
4521
+ } else if (is_EOL(ch)) {
4522
+ _line = state.line;
4523
+ _lineStart = state.lineStart;
4524
+ _lineIndent = state.lineIndent;
4525
+ skipSeparationSpace(state, false, -1);
4526
+ if (state.lineIndent >= nodeIndent) {
4527
+ hasPendingContent = true;
4528
+ ch = state.input.charCodeAt(state.position);
4529
+ continue;
4530
+ } else {
4531
+ state.position = captureEnd;
4532
+ state.line = _line;
4533
+ state.lineStart = _lineStart;
4534
+ state.lineIndent = _lineIndent;
4535
+ break;
4536
+ }
4537
+ }
4538
+ if (hasPendingContent) {
4539
+ captureSegment(state, captureStart, captureEnd, false);
4540
+ writeFoldedLines(state, state.line - _line);
4541
+ captureStart = captureEnd = state.position;
4542
+ hasPendingContent = false;
4543
+ }
4544
+ if (!is_WHITE_SPACE(ch)) {
4545
+ captureEnd = state.position + 1;
4546
+ }
4547
+ ch = state.input.charCodeAt(++state.position);
4548
+ }
4549
+ captureSegment(state, captureStart, captureEnd, false);
4550
+ if (state.result) {
4551
+ return true;
4552
+ }
4553
+ state.kind = _kind;
4554
+ state.result = _result;
4555
+ return false;
4556
+ }
4557
+ function readSingleQuotedScalar(state, nodeIndent) {
4558
+ var ch, captureStart, captureEnd;
4559
+ ch = state.input.charCodeAt(state.position);
4560
+ if (ch !== 39) {
4561
+ return false;
4562
+ }
4563
+ state.kind = "scalar";
4564
+ state.result = "";
4565
+ state.position++;
4566
+ captureStart = captureEnd = state.position;
4567
+ while ((ch = state.input.charCodeAt(state.position)) !== 0) {
4568
+ if (ch === 39) {
4569
+ captureSegment(state, captureStart, state.position, true);
4570
+ ch = state.input.charCodeAt(++state.position);
4571
+ if (ch === 39) {
4572
+ captureStart = state.position;
4573
+ state.position++;
4574
+ captureEnd = state.position;
4575
+ } else {
4576
+ return true;
4577
+ }
4578
+ } else if (is_EOL(ch)) {
4579
+ captureSegment(state, captureStart, captureEnd, true);
4580
+ writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
4581
+ captureStart = captureEnd = state.position;
4582
+ } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
4583
+ throwError(state, "unexpected end of the document within a single quoted scalar");
4584
+ } else {
4585
+ state.position++;
4586
+ captureEnd = state.position;
4587
+ }
4588
+ }
4589
+ throwError(state, "unexpected end of the stream within a single quoted scalar");
4590
+ }
4591
+ function readDoubleQuotedScalar(state, nodeIndent) {
4592
+ var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
4593
+ ch = state.input.charCodeAt(state.position);
4594
+ if (ch !== 34) {
4595
+ return false;
4596
+ }
4597
+ state.kind = "scalar";
4598
+ state.result = "";
4599
+ state.position++;
4600
+ captureStart = captureEnd = state.position;
4601
+ while ((ch = state.input.charCodeAt(state.position)) !== 0) {
4602
+ if (ch === 34) {
4603
+ captureSegment(state, captureStart, state.position, true);
4604
+ state.position++;
4605
+ return true;
4606
+ } else if (ch === 92) {
4607
+ captureSegment(state, captureStart, state.position, true);
4608
+ ch = state.input.charCodeAt(++state.position);
4609
+ if (is_EOL(ch)) {
4610
+ skipSeparationSpace(state, false, nodeIndent);
4611
+ } else if (ch < 256 && simpleEscapeCheck[ch]) {
4612
+ state.result += simpleEscapeMap[ch];
4613
+ state.position++;
4614
+ } else if ((tmp = escapedHexLen(ch)) > 0) {
4615
+ hexLength = tmp;
4616
+ hexResult = 0;
4617
+ for (;hexLength > 0; hexLength--) {
4618
+ ch = state.input.charCodeAt(++state.position);
4619
+ if ((tmp = fromHexCode(ch)) >= 0) {
4620
+ hexResult = (hexResult << 4) + tmp;
4621
+ } else {
4622
+ throwError(state, "expected hexadecimal character");
4623
+ }
4624
+ }
4625
+ state.result += charFromCodepoint(hexResult);
4626
+ state.position++;
4627
+ } else {
4628
+ throwError(state, "unknown escape sequence");
4629
+ }
4630
+ captureStart = captureEnd = state.position;
4631
+ } else if (is_EOL(ch)) {
4632
+ captureSegment(state, captureStart, captureEnd, true);
4633
+ writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
4634
+ captureStart = captureEnd = state.position;
4635
+ } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
4636
+ throwError(state, "unexpected end of the document within a double quoted scalar");
4637
+ } else {
4638
+ state.position++;
4639
+ captureEnd = state.position;
4640
+ }
4641
+ }
4642
+ throwError(state, "unexpected end of the stream within a double quoted scalar");
4643
+ }
4644
+ function readFlowCollection(state, nodeIndent) {
4645
+ var readNext = true, _line, _lineStart, _pos, _tag = state.tag, _result, _anchor = state.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = Object.create(null), keyNode, keyTag, valueNode, ch;
4646
+ ch = state.input.charCodeAt(state.position);
4647
+ if (ch === 91) {
4648
+ terminator = 93;
4649
+ isMapping = false;
4650
+ _result = [];
4651
+ } else if (ch === 123) {
4652
+ terminator = 125;
4653
+ isMapping = true;
4654
+ _result = {};
4655
+ } else {
4656
+ return false;
4657
+ }
4658
+ if (state.anchor !== null) {
4659
+ state.anchorMap[state.anchor] = _result;
4660
+ }
4661
+ ch = state.input.charCodeAt(++state.position);
4662
+ while (ch !== 0) {
4663
+ skipSeparationSpace(state, true, nodeIndent);
4664
+ ch = state.input.charCodeAt(state.position);
4665
+ if (ch === terminator) {
4666
+ state.position++;
4667
+ state.tag = _tag;
4668
+ state.anchor = _anchor;
4669
+ state.kind = isMapping ? "mapping" : "sequence";
4670
+ state.result = _result;
4671
+ return true;
4672
+ } else if (!readNext) {
4673
+ throwError(state, "missed comma between flow collection entries");
4674
+ } else if (ch === 44) {
4675
+ throwError(state, "expected the node content, but found ','");
4676
+ }
4677
+ keyTag = keyNode = valueNode = null;
4678
+ isPair = isExplicitPair = false;
4679
+ if (ch === 63) {
4680
+ following = state.input.charCodeAt(state.position + 1);
4681
+ if (is_WS_OR_EOL(following)) {
4682
+ isPair = isExplicitPair = true;
4683
+ state.position++;
4684
+ skipSeparationSpace(state, true, nodeIndent);
4685
+ }
4686
+ }
4687
+ _line = state.line;
4688
+ _lineStart = state.lineStart;
4689
+ _pos = state.position;
4690
+ composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
4691
+ keyTag = state.tag;
4692
+ keyNode = state.result;
4693
+ skipSeparationSpace(state, true, nodeIndent);
4694
+ ch = state.input.charCodeAt(state.position);
4695
+ if ((isExplicitPair || state.line === _line) && ch === 58) {
4696
+ isPair = true;
4697
+ ch = state.input.charCodeAt(++state.position);
4698
+ skipSeparationSpace(state, true, nodeIndent);
4699
+ composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
4700
+ valueNode = state.result;
4701
+ }
4702
+ if (isMapping) {
4703
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
4704
+ } else if (isPair) {
4705
+ _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
4706
+ } else {
4707
+ _result.push(keyNode);
4708
+ }
4709
+ skipSeparationSpace(state, true, nodeIndent);
4710
+ ch = state.input.charCodeAt(state.position);
4711
+ if (ch === 44) {
4712
+ readNext = true;
4713
+ ch = state.input.charCodeAt(++state.position);
4714
+ } else {
4715
+ readNext = false;
4716
+ }
4717
+ }
4718
+ throwError(state, "unexpected end of the stream within a flow collection");
4719
+ }
4720
+ function readBlockScalar(state, nodeIndent) {
4721
+ var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch;
4722
+ ch = state.input.charCodeAt(state.position);
4723
+ if (ch === 124) {
4724
+ folding = false;
4725
+ } else if (ch === 62) {
4726
+ folding = true;
4727
+ } else {
4728
+ return false;
4729
+ }
4730
+ state.kind = "scalar";
4731
+ state.result = "";
4732
+ while (ch !== 0) {
4733
+ ch = state.input.charCodeAt(++state.position);
4734
+ if (ch === 43 || ch === 45) {
4735
+ if (CHOMPING_CLIP === chomping) {
4736
+ chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
4737
+ } else {
4738
+ throwError(state, "repeat of a chomping mode identifier");
4739
+ }
4740
+ } else if ((tmp = fromDecimalCode(ch)) >= 0) {
4741
+ if (tmp === 0) {
4742
+ throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
4743
+ } else if (!detectedIndent) {
4744
+ textIndent = nodeIndent + tmp - 1;
4745
+ detectedIndent = true;
4746
+ } else {
4747
+ throwError(state, "repeat of an indentation width identifier");
4748
+ }
4749
+ } else {
4750
+ break;
4751
+ }
4752
+ }
4753
+ if (is_WHITE_SPACE(ch)) {
4754
+ do {
4755
+ ch = state.input.charCodeAt(++state.position);
4756
+ } while (is_WHITE_SPACE(ch));
4757
+ if (ch === 35) {
4758
+ do {
4759
+ ch = state.input.charCodeAt(++state.position);
4760
+ } while (!is_EOL(ch) && ch !== 0);
4761
+ }
4762
+ }
4763
+ while (ch !== 0) {
4764
+ readLineBreak(state);
4765
+ state.lineIndent = 0;
4766
+ ch = state.input.charCodeAt(state.position);
4767
+ while ((!detectedIndent || state.lineIndent < textIndent) && ch === 32) {
4768
+ state.lineIndent++;
4769
+ ch = state.input.charCodeAt(++state.position);
4770
+ }
4771
+ if (!detectedIndent && state.lineIndent > textIndent) {
4772
+ textIndent = state.lineIndent;
4773
+ }
4774
+ if (is_EOL(ch)) {
4775
+ emptyLines++;
4776
+ continue;
4777
+ }
4778
+ if (state.lineIndent < textIndent) {
4779
+ if (chomping === CHOMPING_KEEP) {
4780
+ state.result += common.repeat(`
4781
+ `, didReadContent ? 1 + emptyLines : emptyLines);
4782
+ } else if (chomping === CHOMPING_CLIP) {
4783
+ if (didReadContent) {
4784
+ state.result += `
4785
+ `;
4786
+ }
4787
+ }
4788
+ break;
4789
+ }
4790
+ if (folding) {
4791
+ if (is_WHITE_SPACE(ch)) {
4792
+ atMoreIndented = true;
4793
+ state.result += common.repeat(`
4794
+ `, didReadContent ? 1 + emptyLines : emptyLines);
4795
+ } else if (atMoreIndented) {
4796
+ atMoreIndented = false;
4797
+ state.result += common.repeat(`
4798
+ `, emptyLines + 1);
4799
+ } else if (emptyLines === 0) {
4800
+ if (didReadContent) {
4801
+ state.result += " ";
4802
+ }
4803
+ } else {
4804
+ state.result += common.repeat(`
4805
+ `, emptyLines);
4806
+ }
4807
+ } else {
4808
+ state.result += common.repeat(`
4809
+ `, didReadContent ? 1 + emptyLines : emptyLines);
4810
+ }
4811
+ didReadContent = true;
4812
+ detectedIndent = true;
4813
+ emptyLines = 0;
4814
+ captureStart = state.position;
4815
+ while (!is_EOL(ch) && ch !== 0) {
4816
+ ch = state.input.charCodeAt(++state.position);
4817
+ }
4818
+ captureSegment(state, captureStart, state.position, false);
4819
+ }
4820
+ return true;
4821
+ }
4822
+ function readBlockSequence(state, nodeIndent) {
4823
+ var _line, _tag = state.tag, _anchor = state.anchor, _result = [], following, detected = false, ch;
4824
+ if (state.firstTabInLine !== -1)
4825
+ return false;
4826
+ if (state.anchor !== null) {
4827
+ state.anchorMap[state.anchor] = _result;
4828
+ }
4829
+ ch = state.input.charCodeAt(state.position);
4830
+ while (ch !== 0) {
4831
+ if (state.firstTabInLine !== -1) {
4832
+ state.position = state.firstTabInLine;
4833
+ throwError(state, "tab characters must not be used in indentation");
4834
+ }
4835
+ if (ch !== 45) {
4836
+ break;
4837
+ }
4838
+ following = state.input.charCodeAt(state.position + 1);
4839
+ if (!is_WS_OR_EOL(following)) {
4840
+ break;
4841
+ }
4842
+ detected = true;
4843
+ state.position++;
4844
+ if (skipSeparationSpace(state, true, -1)) {
4845
+ if (state.lineIndent <= nodeIndent) {
4846
+ _result.push(null);
4847
+ ch = state.input.charCodeAt(state.position);
4848
+ continue;
4849
+ }
4850
+ }
4851
+ _line = state.line;
4852
+ composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
4853
+ _result.push(state.result);
4854
+ skipSeparationSpace(state, true, -1);
4855
+ ch = state.input.charCodeAt(state.position);
4856
+ if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
4857
+ throwError(state, "bad indentation of a sequence entry");
4858
+ } else if (state.lineIndent < nodeIndent) {
4859
+ break;
4860
+ }
4861
+ }
4862
+ if (detected) {
4863
+ state.tag = _tag;
4864
+ state.anchor = _anchor;
4865
+ state.kind = "sequence";
4866
+ state.result = _result;
4867
+ return true;
4868
+ }
4869
+ return false;
4870
+ }
4871
+ function readBlockMapping(state, nodeIndent, flowIndent) {
4872
+ var following, allowCompact, _line, _keyLine, _keyLineStart, _keyPos, _tag = state.tag, _anchor = state.anchor, _result = {}, overridableKeys = Object.create(null), keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch;
4873
+ if (state.firstTabInLine !== -1)
4874
+ return false;
4875
+ if (state.anchor !== null) {
4876
+ state.anchorMap[state.anchor] = _result;
4877
+ }
4878
+ ch = state.input.charCodeAt(state.position);
4879
+ while (ch !== 0) {
4880
+ if (!atExplicitKey && state.firstTabInLine !== -1) {
4881
+ state.position = state.firstTabInLine;
4882
+ throwError(state, "tab characters must not be used in indentation");
4883
+ }
4884
+ following = state.input.charCodeAt(state.position + 1);
4885
+ _line = state.line;
4886
+ if ((ch === 63 || ch === 58) && is_WS_OR_EOL(following)) {
4887
+ if (ch === 63) {
4888
+ if (atExplicitKey) {
4889
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
4890
+ keyTag = keyNode = valueNode = null;
4891
+ }
4892
+ detected = true;
4893
+ atExplicitKey = true;
4894
+ allowCompact = true;
4895
+ } else if (atExplicitKey) {
4896
+ atExplicitKey = false;
4897
+ allowCompact = true;
4898
+ } else {
4899
+ throwError(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
4900
+ }
4901
+ state.position += 1;
4902
+ ch = following;
4903
+ } else {
4904
+ _keyLine = state.line;
4905
+ _keyLineStart = state.lineStart;
4906
+ _keyPos = state.position;
4907
+ if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
4908
+ break;
4909
+ }
4910
+ if (state.line === _line) {
4911
+ ch = state.input.charCodeAt(state.position);
4912
+ while (is_WHITE_SPACE(ch)) {
4913
+ ch = state.input.charCodeAt(++state.position);
4914
+ }
4915
+ if (ch === 58) {
4916
+ ch = state.input.charCodeAt(++state.position);
4917
+ if (!is_WS_OR_EOL(ch)) {
4918
+ throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
4919
+ }
4920
+ if (atExplicitKey) {
4921
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
4922
+ keyTag = keyNode = valueNode = null;
4923
+ }
4924
+ detected = true;
4925
+ atExplicitKey = false;
4926
+ allowCompact = false;
4927
+ keyTag = state.tag;
4928
+ keyNode = state.result;
4929
+ } else if (detected) {
4930
+ throwError(state, "can not read an implicit mapping pair; a colon is missed");
4931
+ } else {
4932
+ state.tag = _tag;
4933
+ state.anchor = _anchor;
4934
+ return true;
4935
+ }
4936
+ } else if (detected) {
4937
+ throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
4938
+ } else {
4939
+ state.tag = _tag;
4940
+ state.anchor = _anchor;
4941
+ return true;
4942
+ }
4943
+ }
4944
+ if (state.line === _line || state.lineIndent > nodeIndent) {
4945
+ if (atExplicitKey) {
4946
+ _keyLine = state.line;
4947
+ _keyLineStart = state.lineStart;
4948
+ _keyPos = state.position;
4949
+ }
4950
+ if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
4951
+ if (atExplicitKey) {
4952
+ keyNode = state.result;
4953
+ } else {
4954
+ valueNode = state.result;
4955
+ }
4956
+ }
4957
+ if (!atExplicitKey) {
4958
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
4959
+ keyTag = keyNode = valueNode = null;
4960
+ }
4961
+ skipSeparationSpace(state, true, -1);
4962
+ ch = state.input.charCodeAt(state.position);
4963
+ }
4964
+ if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
4965
+ throwError(state, "bad indentation of a mapping entry");
4966
+ } else if (state.lineIndent < nodeIndent) {
4967
+ break;
4968
+ }
4969
+ }
4970
+ if (atExplicitKey) {
4971
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
4972
+ }
4973
+ if (detected) {
4974
+ state.tag = _tag;
4975
+ state.anchor = _anchor;
4976
+ state.kind = "mapping";
4977
+ state.result = _result;
4978
+ }
4979
+ return detected;
4980
+ }
4981
+ function readTagProperty(state) {
4982
+ var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch;
4983
+ ch = state.input.charCodeAt(state.position);
4984
+ if (ch !== 33)
4985
+ return false;
4986
+ if (state.tag !== null) {
4987
+ throwError(state, "duplication of a tag property");
4988
+ }
4989
+ ch = state.input.charCodeAt(++state.position);
4990
+ if (ch === 60) {
4991
+ isVerbatim = true;
4992
+ ch = state.input.charCodeAt(++state.position);
4993
+ } else if (ch === 33) {
4994
+ isNamed = true;
4995
+ tagHandle = "!!";
4996
+ ch = state.input.charCodeAt(++state.position);
4997
+ } else {
4998
+ tagHandle = "!";
4999
+ }
5000
+ _position = state.position;
5001
+ if (isVerbatim) {
5002
+ do {
5003
+ ch = state.input.charCodeAt(++state.position);
5004
+ } while (ch !== 0 && ch !== 62);
5005
+ if (state.position < state.length) {
5006
+ tagName = state.input.slice(_position, state.position);
5007
+ ch = state.input.charCodeAt(++state.position);
5008
+ } else {
5009
+ throwError(state, "unexpected end of the stream within a verbatim tag");
5010
+ }
5011
+ } else {
5012
+ while (ch !== 0 && !is_WS_OR_EOL(ch)) {
5013
+ if (ch === 33) {
5014
+ if (!isNamed) {
5015
+ tagHandle = state.input.slice(_position - 1, state.position + 1);
5016
+ if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
5017
+ throwError(state, "named tag handle cannot contain such characters");
5018
+ }
5019
+ isNamed = true;
5020
+ _position = state.position + 1;
5021
+ } else {
5022
+ throwError(state, "tag suffix cannot contain exclamation marks");
5023
+ }
5024
+ }
5025
+ ch = state.input.charCodeAt(++state.position);
5026
+ }
5027
+ tagName = state.input.slice(_position, state.position);
5028
+ if (PATTERN_FLOW_INDICATORS.test(tagName)) {
5029
+ throwError(state, "tag suffix cannot contain flow indicator characters");
5030
+ }
5031
+ }
5032
+ if (tagName && !PATTERN_TAG_URI.test(tagName)) {
5033
+ throwError(state, "tag name cannot contain such characters: " + tagName);
5034
+ }
5035
+ try {
5036
+ tagName = decodeURIComponent(tagName);
5037
+ } catch (err) {
5038
+ throwError(state, "tag name is malformed: " + tagName);
5039
+ }
5040
+ if (isVerbatim) {
5041
+ state.tag = tagName;
5042
+ } else if (_hasOwnProperty$1.call(state.tagMap, tagHandle)) {
5043
+ state.tag = state.tagMap[tagHandle] + tagName;
5044
+ } else if (tagHandle === "!") {
5045
+ state.tag = "!" + tagName;
5046
+ } else if (tagHandle === "!!") {
5047
+ state.tag = "tag:yaml.org,2002:" + tagName;
5048
+ } else {
5049
+ throwError(state, 'undeclared tag handle "' + tagHandle + '"');
5050
+ }
5051
+ return true;
5052
+ }
5053
+ function readAnchorProperty(state) {
5054
+ var _position, ch;
5055
+ ch = state.input.charCodeAt(state.position);
5056
+ if (ch !== 38)
5057
+ return false;
5058
+ if (state.anchor !== null) {
5059
+ throwError(state, "duplication of an anchor property");
5060
+ }
5061
+ ch = state.input.charCodeAt(++state.position);
5062
+ _position = state.position;
5063
+ while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
5064
+ ch = state.input.charCodeAt(++state.position);
5065
+ }
5066
+ if (state.position === _position) {
5067
+ throwError(state, "name of an anchor node must contain at least one character");
5068
+ }
5069
+ state.anchor = state.input.slice(_position, state.position);
5070
+ return true;
5071
+ }
5072
+ function readAlias(state) {
5073
+ var _position, alias, ch;
5074
+ ch = state.input.charCodeAt(state.position);
5075
+ if (ch !== 42)
5076
+ return false;
5077
+ ch = state.input.charCodeAt(++state.position);
5078
+ _position = state.position;
5079
+ while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
5080
+ ch = state.input.charCodeAt(++state.position);
5081
+ }
5082
+ if (state.position === _position) {
5083
+ throwError(state, "name of an alias node must contain at least one character");
5084
+ }
5085
+ alias = state.input.slice(_position, state.position);
5086
+ if (!_hasOwnProperty$1.call(state.anchorMap, alias)) {
5087
+ throwError(state, 'unidentified alias "' + alias + '"');
5088
+ }
5089
+ state.result = state.anchorMap[alias];
5090
+ skipSeparationSpace(state, true, -1);
5091
+ return true;
5092
+ }
5093
+ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
5094
+ var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, typeList, type2, flowIndent, blockIndent;
5095
+ if (state.listener !== null) {
5096
+ state.listener("open", state);
5097
+ }
5098
+ state.tag = null;
5099
+ state.anchor = null;
5100
+ state.kind = null;
5101
+ state.result = null;
5102
+ allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
5103
+ if (allowToSeek) {
5104
+ if (skipSeparationSpace(state, true, -1)) {
5105
+ atNewLine = true;
5106
+ if (state.lineIndent > parentIndent) {
5107
+ indentStatus = 1;
5108
+ } else if (state.lineIndent === parentIndent) {
5109
+ indentStatus = 0;
5110
+ } else if (state.lineIndent < parentIndent) {
5111
+ indentStatus = -1;
5112
+ }
5113
+ }
5114
+ }
5115
+ if (indentStatus === 1) {
5116
+ while (readTagProperty(state) || readAnchorProperty(state)) {
5117
+ if (skipSeparationSpace(state, true, -1)) {
5118
+ atNewLine = true;
5119
+ allowBlockCollections = allowBlockStyles;
5120
+ if (state.lineIndent > parentIndent) {
5121
+ indentStatus = 1;
5122
+ } else if (state.lineIndent === parentIndent) {
5123
+ indentStatus = 0;
5124
+ } else if (state.lineIndent < parentIndent) {
5125
+ indentStatus = -1;
5126
+ }
5127
+ } else {
5128
+ allowBlockCollections = false;
5129
+ }
5130
+ }
5131
+ }
5132
+ if (allowBlockCollections) {
5133
+ allowBlockCollections = atNewLine || allowCompact;
5134
+ }
5135
+ if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
5136
+ if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
5137
+ flowIndent = parentIndent;
5138
+ } else {
5139
+ flowIndent = parentIndent + 1;
5140
+ }
5141
+ blockIndent = state.position - state.lineStart;
5142
+ if (indentStatus === 1) {
5143
+ if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) {
5144
+ hasContent = true;
5145
+ } else {
5146
+ if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) {
5147
+ hasContent = true;
5148
+ } else if (readAlias(state)) {
5149
+ hasContent = true;
5150
+ if (state.tag !== null || state.anchor !== null) {
5151
+ throwError(state, "alias node should not have any properties");
5152
+ }
5153
+ } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
5154
+ hasContent = true;
5155
+ if (state.tag === null) {
5156
+ state.tag = "?";
5157
+ }
5158
+ }
5159
+ if (state.anchor !== null) {
5160
+ state.anchorMap[state.anchor] = state.result;
5161
+ }
5162
+ }
5163
+ } else if (indentStatus === 0) {
5164
+ hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
5165
+ }
5166
+ }
5167
+ if (state.tag === null) {
5168
+ if (state.anchor !== null) {
5169
+ state.anchorMap[state.anchor] = state.result;
5170
+ }
5171
+ } else if (state.tag === "?") {
5172
+ if (state.result !== null && state.kind !== "scalar") {
5173
+ throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
5174
+ }
5175
+ for (typeIndex = 0, typeQuantity = state.implicitTypes.length;typeIndex < typeQuantity; typeIndex += 1) {
5176
+ type2 = state.implicitTypes[typeIndex];
5177
+ if (type2.resolve(state.result)) {
5178
+ state.result = type2.construct(state.result);
5179
+ state.tag = type2.tag;
5180
+ if (state.anchor !== null) {
5181
+ state.anchorMap[state.anchor] = state.result;
5182
+ }
5183
+ break;
5184
+ }
5185
+ }
5186
+ } else if (state.tag !== "!") {
5187
+ if (_hasOwnProperty$1.call(state.typeMap[state.kind || "fallback"], state.tag)) {
5188
+ type2 = state.typeMap[state.kind || "fallback"][state.tag];
5189
+ } else {
5190
+ type2 = null;
5191
+ typeList = state.typeMap.multi[state.kind || "fallback"];
5192
+ for (typeIndex = 0, typeQuantity = typeList.length;typeIndex < typeQuantity; typeIndex += 1) {
5193
+ if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
5194
+ type2 = typeList[typeIndex];
5195
+ break;
5196
+ }
5197
+ }
5198
+ }
5199
+ if (!type2) {
5200
+ throwError(state, "unknown tag !<" + state.tag + ">");
5201
+ }
5202
+ if (state.result !== null && type2.kind !== state.kind) {
5203
+ throwError(state, "unacceptable node kind for !<" + state.tag + '> tag; it should be "' + type2.kind + '", not "' + state.kind + '"');
5204
+ }
5205
+ if (!type2.resolve(state.result, state.tag)) {
5206
+ throwError(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
5207
+ } else {
5208
+ state.result = type2.construct(state.result, state.tag);
5209
+ if (state.anchor !== null) {
5210
+ state.anchorMap[state.anchor] = state.result;
5211
+ }
5212
+ }
5213
+ }
5214
+ if (state.listener !== null) {
5215
+ state.listener("close", state);
5216
+ }
5217
+ return state.tag !== null || state.anchor !== null || hasContent;
5218
+ }
5219
+ function readDocument(state) {
5220
+ var documentStart = state.position, _position, directiveName, directiveArgs, hasDirectives = false, ch;
5221
+ state.version = null;
5222
+ state.checkLineBreaks = state.legacy;
5223
+ state.tagMap = Object.create(null);
5224
+ state.anchorMap = Object.create(null);
5225
+ while ((ch = state.input.charCodeAt(state.position)) !== 0) {
5226
+ skipSeparationSpace(state, true, -1);
5227
+ ch = state.input.charCodeAt(state.position);
5228
+ if (state.lineIndent > 0 || ch !== 37) {
5229
+ break;
5230
+ }
5231
+ hasDirectives = true;
5232
+ ch = state.input.charCodeAt(++state.position);
5233
+ _position = state.position;
5234
+ while (ch !== 0 && !is_WS_OR_EOL(ch)) {
5235
+ ch = state.input.charCodeAt(++state.position);
5236
+ }
5237
+ directiveName = state.input.slice(_position, state.position);
5238
+ directiveArgs = [];
5239
+ if (directiveName.length < 1) {
5240
+ throwError(state, "directive name must not be less than one character in length");
5241
+ }
5242
+ while (ch !== 0) {
5243
+ while (is_WHITE_SPACE(ch)) {
5244
+ ch = state.input.charCodeAt(++state.position);
5245
+ }
5246
+ if (ch === 35) {
5247
+ do {
5248
+ ch = state.input.charCodeAt(++state.position);
5249
+ } while (ch !== 0 && !is_EOL(ch));
5250
+ break;
5251
+ }
5252
+ if (is_EOL(ch))
5253
+ break;
5254
+ _position = state.position;
5255
+ while (ch !== 0 && !is_WS_OR_EOL(ch)) {
5256
+ ch = state.input.charCodeAt(++state.position);
5257
+ }
5258
+ directiveArgs.push(state.input.slice(_position, state.position));
5259
+ }
5260
+ if (ch !== 0)
5261
+ readLineBreak(state);
5262
+ if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) {
5263
+ directiveHandlers[directiveName](state, directiveName, directiveArgs);
5264
+ } else {
5265
+ throwWarning(state, 'unknown document directive "' + directiveName + '"');
5266
+ }
5267
+ }
5268
+ skipSeparationSpace(state, true, -1);
5269
+ if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45) {
5270
+ state.position += 3;
5271
+ skipSeparationSpace(state, true, -1);
5272
+ } else if (hasDirectives) {
5273
+ throwError(state, "directives end mark is expected");
5274
+ }
5275
+ composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
5276
+ skipSeparationSpace(state, true, -1);
5277
+ if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
5278
+ throwWarning(state, "non-ASCII line breaks are interpreted as content");
5279
+ }
5280
+ state.documents.push(state.result);
5281
+ if (state.position === state.lineStart && testDocumentSeparator(state)) {
5282
+ if (state.input.charCodeAt(state.position) === 46) {
5283
+ state.position += 3;
5284
+ skipSeparationSpace(state, true, -1);
5285
+ }
5286
+ return;
5287
+ }
5288
+ if (state.position < state.length - 1) {
5289
+ throwError(state, "end of the stream or a document separator is expected");
5290
+ } else {
5291
+ return;
5292
+ }
5293
+ }
5294
+ function loadDocuments(input, options) {
5295
+ input = String(input);
5296
+ options = options || {};
5297
+ if (input.length !== 0) {
5298
+ if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
5299
+ input += `
5300
+ `;
5301
+ }
5302
+ if (input.charCodeAt(0) === 65279) {
5303
+ input = input.slice(1);
5304
+ }
5305
+ }
5306
+ var state = new State$1(input, options);
5307
+ var nullpos = input.indexOf("\x00");
5308
+ if (nullpos !== -1) {
5309
+ state.position = nullpos;
5310
+ throwError(state, "null byte is not allowed in input");
5311
+ }
5312
+ state.input += "\x00";
5313
+ while (state.input.charCodeAt(state.position) === 32) {
5314
+ state.lineIndent += 1;
5315
+ state.position += 1;
5316
+ }
5317
+ while (state.position < state.length - 1) {
5318
+ readDocument(state);
5319
+ }
5320
+ return state.documents;
5321
+ }
5322
+ function loadAll$1(input, iterator, options) {
5323
+ if (iterator !== null && typeof iterator === "object" && typeof options === "undefined") {
5324
+ options = iterator;
5325
+ iterator = null;
5326
+ }
5327
+ var documents = loadDocuments(input, options);
5328
+ if (typeof iterator !== "function") {
5329
+ return documents;
5330
+ }
5331
+ for (var index = 0, length = documents.length;index < length; index += 1) {
5332
+ iterator(documents[index]);
5333
+ }
5334
+ }
5335
+ function load$1(input, options) {
5336
+ var documents = loadDocuments(input, options);
5337
+ if (documents.length === 0) {
5338
+ return;
5339
+ } else if (documents.length === 1) {
5340
+ return documents[0];
5341
+ }
5342
+ throw new exception("expected a single document in the stream, but found more");
5343
+ }
5344
+ var loadAll_1 = loadAll$1;
5345
+ var load_1 = load$1;
5346
+ var loader = {
5347
+ loadAll: loadAll_1,
5348
+ load: load_1
5349
+ };
5350
+ var _toString = Object.prototype.toString;
5351
+ var _hasOwnProperty = Object.prototype.hasOwnProperty;
5352
+ var CHAR_BOM = 65279;
5353
+ var CHAR_TAB = 9;
5354
+ var CHAR_LINE_FEED = 10;
5355
+ var CHAR_CARRIAGE_RETURN = 13;
5356
+ var CHAR_SPACE = 32;
5357
+ var CHAR_EXCLAMATION = 33;
5358
+ var CHAR_DOUBLE_QUOTE = 34;
5359
+ var CHAR_SHARP = 35;
5360
+ var CHAR_PERCENT = 37;
5361
+ var CHAR_AMPERSAND = 38;
5362
+ var CHAR_SINGLE_QUOTE = 39;
5363
+ var CHAR_ASTERISK = 42;
5364
+ var CHAR_COMMA = 44;
5365
+ var CHAR_MINUS = 45;
5366
+ var CHAR_COLON = 58;
5367
+ var CHAR_EQUALS = 61;
5368
+ var CHAR_GREATER_THAN = 62;
5369
+ var CHAR_QUESTION = 63;
5370
+ var CHAR_COMMERCIAL_AT = 64;
5371
+ var CHAR_LEFT_SQUARE_BRACKET = 91;
5372
+ var CHAR_RIGHT_SQUARE_BRACKET = 93;
5373
+ var CHAR_GRAVE_ACCENT = 96;
5374
+ var CHAR_LEFT_CURLY_BRACKET = 123;
5375
+ var CHAR_VERTICAL_LINE = 124;
5376
+ var CHAR_RIGHT_CURLY_BRACKET = 125;
5377
+ var ESCAPE_SEQUENCES = {};
5378
+ ESCAPE_SEQUENCES[0] = "\\0";
5379
+ ESCAPE_SEQUENCES[7] = "\\a";
5380
+ ESCAPE_SEQUENCES[8] = "\\b";
5381
+ ESCAPE_SEQUENCES[9] = "\\t";
5382
+ ESCAPE_SEQUENCES[10] = "\\n";
5383
+ ESCAPE_SEQUENCES[11] = "\\v";
5384
+ ESCAPE_SEQUENCES[12] = "\\f";
5385
+ ESCAPE_SEQUENCES[13] = "\\r";
5386
+ ESCAPE_SEQUENCES[27] = "\\e";
5387
+ ESCAPE_SEQUENCES[34] = "\\\"";
5388
+ ESCAPE_SEQUENCES[92] = "\\\\";
5389
+ ESCAPE_SEQUENCES[133] = "\\N";
5390
+ ESCAPE_SEQUENCES[160] = "\\_";
5391
+ ESCAPE_SEQUENCES[8232] = "\\L";
5392
+ ESCAPE_SEQUENCES[8233] = "\\P";
5393
+ var DEPRECATED_BOOLEANS_SYNTAX = [
5394
+ "y",
5395
+ "Y",
5396
+ "yes",
5397
+ "Yes",
5398
+ "YES",
5399
+ "on",
5400
+ "On",
5401
+ "ON",
5402
+ "n",
5403
+ "N",
5404
+ "no",
5405
+ "No",
5406
+ "NO",
5407
+ "off",
5408
+ "Off",
5409
+ "OFF"
5410
+ ];
5411
+ var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
5412
+ function compileStyleMap(schema2, map2) {
5413
+ var result, keys, index, length, tag, style, type2;
5414
+ if (map2 === null)
5415
+ return {};
5416
+ result = {};
5417
+ keys = Object.keys(map2);
5418
+ for (index = 0, length = keys.length;index < length; index += 1) {
5419
+ tag = keys[index];
5420
+ style = String(map2[tag]);
5421
+ if (tag.slice(0, 2) === "!!") {
5422
+ tag = "tag:yaml.org,2002:" + tag.slice(2);
5423
+ }
5424
+ type2 = schema2.compiledTypeMap["fallback"][tag];
5425
+ if (type2 && _hasOwnProperty.call(type2.styleAliases, style)) {
5426
+ style = type2.styleAliases[style];
5427
+ }
5428
+ result[tag] = style;
5429
+ }
5430
+ return result;
5431
+ }
5432
+ function encodeHex(character) {
5433
+ var string, handle, length;
5434
+ string = character.toString(16).toUpperCase();
5435
+ if (character <= 255) {
5436
+ handle = "x";
5437
+ length = 2;
5438
+ } else if (character <= 65535) {
5439
+ handle = "u";
5440
+ length = 4;
5441
+ } else if (character <= 4294967295) {
5442
+ handle = "U";
5443
+ length = 8;
5444
+ } else {
5445
+ throw new exception("code point within a string may not be greater than 0xFFFFFFFF");
5446
+ }
5447
+ return "\\" + handle + common.repeat("0", length - string.length) + string;
5448
+ }
5449
+ var QUOTING_TYPE_SINGLE = 1;
5450
+ var QUOTING_TYPE_DOUBLE = 2;
5451
+ function State(options) {
5452
+ this.schema = options["schema"] || _default;
5453
+ this.indent = Math.max(1, options["indent"] || 2);
5454
+ this.noArrayIndent = options["noArrayIndent"] || false;
5455
+ this.skipInvalid = options["skipInvalid"] || false;
5456
+ this.flowLevel = common.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
5457
+ this.styleMap = compileStyleMap(this.schema, options["styles"] || null);
5458
+ this.sortKeys = options["sortKeys"] || false;
5459
+ this.lineWidth = options["lineWidth"] || 80;
5460
+ this.noRefs = options["noRefs"] || false;
5461
+ this.noCompatMode = options["noCompatMode"] || false;
5462
+ this.condenseFlow = options["condenseFlow"] || false;
5463
+ this.quotingType = options["quotingType"] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
5464
+ this.forceQuotes = options["forceQuotes"] || false;
5465
+ this.replacer = typeof options["replacer"] === "function" ? options["replacer"] : null;
5466
+ this.implicitTypes = this.schema.compiledImplicit;
5467
+ this.explicitTypes = this.schema.compiledExplicit;
5468
+ this.tag = null;
5469
+ this.result = "";
5470
+ this.duplicates = [];
5471
+ this.usedDuplicates = null;
5472
+ }
5473
+ function indentString(string, spaces) {
5474
+ var ind = common.repeat(" ", spaces), position = 0, next = -1, result = "", line, length = string.length;
5475
+ while (position < length) {
5476
+ next = string.indexOf(`
5477
+ `, position);
5478
+ if (next === -1) {
5479
+ line = string.slice(position);
5480
+ position = length;
5481
+ } else {
5482
+ line = string.slice(position, next + 1);
5483
+ position = next + 1;
5484
+ }
5485
+ if (line.length && line !== `
5486
+ `)
5487
+ result += ind;
5488
+ result += line;
5489
+ }
5490
+ return result;
5491
+ }
5492
+ function generateNextLine(state, level) {
5493
+ return `
5494
+ ` + common.repeat(" ", state.indent * level);
5495
+ }
5496
+ function testImplicitResolving(state, str2) {
5497
+ var index, length, type2;
5498
+ for (index = 0, length = state.implicitTypes.length;index < length; index += 1) {
5499
+ type2 = state.implicitTypes[index];
5500
+ if (type2.resolve(str2)) {
5501
+ return true;
5502
+ }
5503
+ }
5504
+ return false;
5505
+ }
5506
+ function isWhitespace(c) {
5507
+ return c === CHAR_SPACE || c === CHAR_TAB;
5508
+ }
5509
+ function isPrintable(c) {
5510
+ return 32 <= c && c <= 126 || 161 <= c && c <= 55295 && c !== 8232 && c !== 8233 || 57344 <= c && c <= 65533 && c !== CHAR_BOM || 65536 <= c && c <= 1114111;
5511
+ }
5512
+ function isNsCharOrWhitespace(c) {
5513
+ return isPrintable(c) && c !== CHAR_BOM && c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED;
5514
+ }
5515
+ function isPlainSafe(c, prev, inblock) {
5516
+ var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c);
5517
+ var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c);
5518
+ return (inblock ? cIsNsCharOrWhitespace : 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;
5519
+ }
5520
+ function isPlainSafeFirst(c) {
5521
+ 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;
5522
+ }
5523
+ function isPlainSafeLast(c) {
5524
+ return !isWhitespace(c) && c !== CHAR_COLON;
5525
+ }
5526
+ function codePointAt(string, pos) {
5527
+ var first = string.charCodeAt(pos), second;
5528
+ if (first >= 55296 && first <= 56319 && pos + 1 < string.length) {
5529
+ second = string.charCodeAt(pos + 1);
5530
+ if (second >= 56320 && second <= 57343) {
5531
+ return (first - 55296) * 1024 + second - 56320 + 65536;
5532
+ }
5533
+ }
5534
+ return first;
5535
+ }
5536
+ function needIndentIndicator(string) {
5537
+ var leadingSpaceRe = /^\n* /;
5538
+ return leadingSpaceRe.test(string);
5539
+ }
5540
+ var STYLE_PLAIN = 1;
5541
+ var STYLE_SINGLE = 2;
5542
+ var STYLE_LITERAL = 3;
5543
+ var STYLE_FOLDED = 4;
5544
+ var STYLE_DOUBLE = 5;
5545
+ function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType, quotingType, forceQuotes, inblock) {
5546
+ var i2;
5547
+ var char = 0;
5548
+ var prevChar = null;
5549
+ var hasLineBreak = false;
5550
+ var hasFoldableLine = false;
5551
+ var shouldTrackWidth = lineWidth !== -1;
5552
+ var previousLineBreak = -1;
5553
+ var plain = isPlainSafeFirst(codePointAt(string, 0)) && isPlainSafeLast(codePointAt(string, string.length - 1));
5554
+ if (singleLineOnly || forceQuotes) {
5555
+ for (i2 = 0;i2 < string.length; char >= 65536 ? i2 += 2 : i2++) {
5556
+ char = codePointAt(string, i2);
5557
+ if (!isPrintable(char)) {
5558
+ return STYLE_DOUBLE;
5559
+ }
5560
+ plain = plain && isPlainSafe(char, prevChar, inblock);
5561
+ prevChar = char;
5562
+ }
5563
+ } else {
5564
+ for (i2 = 0;i2 < string.length; char >= 65536 ? i2 += 2 : i2++) {
5565
+ char = codePointAt(string, i2);
5566
+ if (char === CHAR_LINE_FEED) {
5567
+ hasLineBreak = true;
5568
+ if (shouldTrackWidth) {
5569
+ hasFoldableLine = hasFoldableLine || i2 - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
5570
+ previousLineBreak = i2;
5571
+ }
5572
+ } else if (!isPrintable(char)) {
5573
+ return STYLE_DOUBLE;
5574
+ }
5575
+ plain = plain && isPlainSafe(char, prevChar, inblock);
5576
+ prevChar = char;
5577
+ }
5578
+ hasFoldableLine = hasFoldableLine || shouldTrackWidth && (i2 - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ");
5579
+ }
5580
+ if (!hasLineBreak && !hasFoldableLine) {
5581
+ if (plain && !forceQuotes && !testAmbiguousType(string)) {
5582
+ return STYLE_PLAIN;
5583
+ }
5584
+ return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
5585
+ }
5586
+ if (indentPerLevel > 9 && needIndentIndicator(string)) {
5587
+ return STYLE_DOUBLE;
5588
+ }
5589
+ if (!forceQuotes) {
5590
+ return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
5591
+ }
5592
+ return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
5593
+ }
5594
+ function writeScalar(state, string, level, iskey, inblock) {
5595
+ state.dump = function() {
5596
+ if (string.length === 0) {
5597
+ return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''";
5598
+ }
5599
+ if (!state.noCompatMode) {
5600
+ if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) {
5601
+ return state.quotingType === QUOTING_TYPE_DOUBLE ? '"' + string + '"' : "'" + string + "'";
5602
+ }
5603
+ }
5604
+ var indent = state.indent * Math.max(1, level);
5605
+ var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
5606
+ var singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
5607
+ function testAmbiguity(string2) {
5608
+ return testImplicitResolving(state, string2);
5609
+ }
5610
+ switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) {
5611
+ case STYLE_PLAIN:
5612
+ return string;
5613
+ case STYLE_SINGLE:
5614
+ return "'" + string.replace(/'/g, "''") + "'";
5615
+ case STYLE_LITERAL:
5616
+ return "|" + blockHeader(string, state.indent) + dropEndingNewline(indentString(string, indent));
5617
+ case STYLE_FOLDED:
5618
+ return ">" + blockHeader(string, state.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
5619
+ case STYLE_DOUBLE:
5620
+ return '"' + escapeString(string) + '"';
5621
+ default:
5622
+ throw new exception("impossible error: invalid scalar style");
5623
+ }
5624
+ }();
5625
+ }
5626
+ function blockHeader(string, indentPerLevel) {
5627
+ var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : "";
5628
+ var clip = string[string.length - 1] === `
5629
+ `;
5630
+ var keep = clip && (string[string.length - 2] === `
5631
+ ` || string === `
5632
+ `);
5633
+ var chomp = keep ? "+" : clip ? "" : "-";
5634
+ return indentIndicator + chomp + `
5635
+ `;
5636
+ }
5637
+ function dropEndingNewline(string) {
5638
+ return string[string.length - 1] === `
5639
+ ` ? string.slice(0, -1) : string;
5640
+ }
5641
+ function foldString(string, width) {
5642
+ var lineRe = /(\n+)([^\n]*)/g;
5643
+ var result = function() {
5644
+ var nextLF = string.indexOf(`
5645
+ `);
5646
+ nextLF = nextLF !== -1 ? nextLF : string.length;
5647
+ lineRe.lastIndex = nextLF;
5648
+ return foldLine(string.slice(0, nextLF), width);
5649
+ }();
5650
+ var prevMoreIndented = string[0] === `
5651
+ ` || string[0] === " ";
5652
+ var moreIndented;
5653
+ var match;
5654
+ while (match = lineRe.exec(string)) {
5655
+ var prefix = match[1], line = match[2];
5656
+ moreIndented = line[0] === " ";
5657
+ result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? `
5658
+ ` : "") + foldLine(line, width);
5659
+ prevMoreIndented = moreIndented;
5660
+ }
5661
+ return result;
5662
+ }
5663
+ function foldLine(line, width) {
5664
+ if (line === "" || line[0] === " ")
5665
+ return line;
5666
+ var breakRe = / [^ ]/g;
5667
+ var match;
5668
+ var start = 0, end, curr = 0, next = 0;
5669
+ var result = "";
5670
+ while (match = breakRe.exec(line)) {
5671
+ next = match.index;
5672
+ if (next - start > width) {
5673
+ end = curr > start ? curr : next;
5674
+ result += `
5675
+ ` + line.slice(start, end);
5676
+ start = end + 1;
5677
+ }
5678
+ curr = next;
5679
+ }
5680
+ result += `
5681
+ `;
5682
+ if (line.length - start > width && curr > start) {
5683
+ result += line.slice(start, curr) + `
5684
+ ` + line.slice(curr + 1);
5685
+ } else {
5686
+ result += line.slice(start);
5687
+ }
5688
+ return result.slice(1);
5689
+ }
5690
+ function escapeString(string) {
5691
+ var result = "";
5692
+ var char = 0;
5693
+ var escapeSeq;
5694
+ for (var i2 = 0;i2 < string.length; char >= 65536 ? i2 += 2 : i2++) {
5695
+ char = codePointAt(string, i2);
5696
+ escapeSeq = ESCAPE_SEQUENCES[char];
5697
+ if (!escapeSeq && isPrintable(char)) {
5698
+ result += string[i2];
5699
+ if (char >= 65536)
5700
+ result += string[i2 + 1];
5701
+ } else {
5702
+ result += escapeSeq || encodeHex(char);
5703
+ }
5704
+ }
5705
+ return result;
5706
+ }
5707
+ function writeFlowSequence(state, level, object) {
5708
+ var _result = "", _tag = state.tag, index, length, value;
5709
+ for (index = 0, length = object.length;index < length; index += 1) {
5710
+ value = object[index];
5711
+ if (state.replacer) {
5712
+ value = state.replacer.call(object, String(index), value);
5713
+ }
5714
+ if (writeNode(state, level, value, false, false) || typeof value === "undefined" && writeNode(state, level, null, false, false)) {
5715
+ if (_result !== "")
5716
+ _result += "," + (!state.condenseFlow ? " " : "");
5717
+ _result += state.dump;
5718
+ }
5719
+ }
5720
+ state.tag = _tag;
5721
+ state.dump = "[" + _result + "]";
5722
+ }
5723
+ function writeBlockSequence(state, level, object, compact) {
5724
+ var _result = "", _tag = state.tag, index, length, value;
5725
+ for (index = 0, length = object.length;index < length; index += 1) {
5726
+ value = object[index];
5727
+ if (state.replacer) {
5728
+ value = state.replacer.call(object, String(index), value);
5729
+ }
5730
+ if (writeNode(state, level + 1, value, true, true, false, true) || typeof value === "undefined" && writeNode(state, level + 1, null, true, true, false, true)) {
5731
+ if (!compact || _result !== "") {
5732
+ _result += generateNextLine(state, level);
5733
+ }
5734
+ if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
5735
+ _result += "-";
5736
+ } else {
5737
+ _result += "- ";
5738
+ }
5739
+ _result += state.dump;
5740
+ }
5741
+ }
5742
+ state.tag = _tag;
5743
+ state.dump = _result || "[]";
5744
+ }
5745
+ function writeFlowMapping(state, level, object) {
5746
+ var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, pairBuffer;
5747
+ for (index = 0, length = objectKeyList.length;index < length; index += 1) {
5748
+ pairBuffer = "";
5749
+ if (_result !== "")
5750
+ pairBuffer += ", ";
5751
+ if (state.condenseFlow)
5752
+ pairBuffer += '"';
5753
+ objectKey = objectKeyList[index];
5754
+ objectValue = object[objectKey];
5755
+ if (state.replacer) {
5756
+ objectValue = state.replacer.call(object, objectKey, objectValue);
5757
+ }
5758
+ if (!writeNode(state, level, objectKey, false, false)) {
5759
+ continue;
5760
+ }
5761
+ if (state.dump.length > 1024)
5762
+ pairBuffer += "? ";
5763
+ pairBuffer += state.dump + (state.condenseFlow ? '"' : "") + ":" + (state.condenseFlow ? "" : " ");
5764
+ if (!writeNode(state, level, objectValue, false, false)) {
5765
+ continue;
5766
+ }
5767
+ pairBuffer += state.dump;
5768
+ _result += pairBuffer;
5769
+ }
5770
+ state.tag = _tag;
5771
+ state.dump = "{" + _result + "}";
5772
+ }
5773
+ function writeBlockMapping(state, level, object, compact) {
5774
+ var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, explicitPair, pairBuffer;
5775
+ if (state.sortKeys === true) {
5776
+ objectKeyList.sort();
5777
+ } else if (typeof state.sortKeys === "function") {
5778
+ objectKeyList.sort(state.sortKeys);
5779
+ } else if (state.sortKeys) {
5780
+ throw new exception("sortKeys must be a boolean or a function");
5781
+ }
5782
+ for (index = 0, length = objectKeyList.length;index < length; index += 1) {
5783
+ pairBuffer = "";
5784
+ if (!compact || _result !== "") {
5785
+ pairBuffer += generateNextLine(state, level);
5786
+ }
5787
+ objectKey = objectKeyList[index];
5788
+ objectValue = object[objectKey];
5789
+ if (state.replacer) {
5790
+ objectValue = state.replacer.call(object, objectKey, objectValue);
5791
+ }
5792
+ if (!writeNode(state, level + 1, objectKey, true, true, true)) {
5793
+ continue;
5794
+ }
5795
+ explicitPair = state.tag !== null && state.tag !== "?" || state.dump && state.dump.length > 1024;
5796
+ if (explicitPair) {
5797
+ if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
5798
+ pairBuffer += "?";
5799
+ } else {
5800
+ pairBuffer += "? ";
5801
+ }
5802
+ }
5803
+ pairBuffer += state.dump;
5804
+ if (explicitPair) {
5805
+ pairBuffer += generateNextLine(state, level);
5806
+ }
5807
+ if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
5808
+ continue;
5809
+ }
5810
+ if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
5811
+ pairBuffer += ":";
5812
+ } else {
5813
+ pairBuffer += ": ";
5814
+ }
5815
+ pairBuffer += state.dump;
5816
+ _result += pairBuffer;
5817
+ }
5818
+ state.tag = _tag;
5819
+ state.dump = _result || "{}";
5820
+ }
5821
+ function detectType(state, object, explicit) {
5822
+ var _result, typeList, index, length, type2, style;
5823
+ typeList = explicit ? state.explicitTypes : state.implicitTypes;
5824
+ for (index = 0, length = typeList.length;index < length; index += 1) {
5825
+ type2 = typeList[index];
5826
+ if ((type2.instanceOf || type2.predicate) && (!type2.instanceOf || typeof object === "object" && object instanceof type2.instanceOf) && (!type2.predicate || type2.predicate(object))) {
5827
+ if (explicit) {
5828
+ if (type2.multi && type2.representName) {
5829
+ state.tag = type2.representName(object);
5830
+ } else {
5831
+ state.tag = type2.tag;
5832
+ }
5833
+ } else {
5834
+ state.tag = "?";
5835
+ }
5836
+ if (type2.represent) {
5837
+ style = state.styleMap[type2.tag] || type2.defaultStyle;
5838
+ if (_toString.call(type2.represent) === "[object Function]") {
5839
+ _result = type2.represent(object, style);
5840
+ } else if (_hasOwnProperty.call(type2.represent, style)) {
5841
+ _result = type2.represent[style](object, style);
5842
+ } else {
5843
+ throw new exception("!<" + type2.tag + '> tag resolver accepts not "' + style + '" style');
5844
+ }
5845
+ state.dump = _result;
5846
+ }
5847
+ return true;
5848
+ }
5849
+ }
5850
+ return false;
5851
+ }
5852
+ function writeNode(state, level, object, block, compact, iskey, isblockseq) {
5853
+ state.tag = null;
5854
+ state.dump = object;
5855
+ if (!detectType(state, object, false)) {
5856
+ detectType(state, object, true);
5857
+ }
5858
+ var type2 = _toString.call(state.dump);
5859
+ var inblock = block;
5860
+ var tagStr;
5861
+ if (block) {
5862
+ block = state.flowLevel < 0 || state.flowLevel > level;
5863
+ }
5864
+ var objectOrArray = type2 === "[object Object]" || type2 === "[object Array]", duplicateIndex, duplicate;
5865
+ if (objectOrArray) {
5866
+ duplicateIndex = state.duplicates.indexOf(object);
5867
+ duplicate = duplicateIndex !== -1;
5868
+ }
5869
+ if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) {
5870
+ compact = false;
5871
+ }
5872
+ if (duplicate && state.usedDuplicates[duplicateIndex]) {
5873
+ state.dump = "*ref_" + duplicateIndex;
5874
+ } else {
5875
+ if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
5876
+ state.usedDuplicates[duplicateIndex] = true;
5877
+ }
5878
+ if (type2 === "[object Object]") {
5879
+ if (block && Object.keys(state.dump).length !== 0) {
5880
+ writeBlockMapping(state, level, state.dump, compact);
5881
+ if (duplicate) {
5882
+ state.dump = "&ref_" + duplicateIndex + state.dump;
5883
+ }
5884
+ } else {
5885
+ writeFlowMapping(state, level, state.dump);
5886
+ if (duplicate) {
5887
+ state.dump = "&ref_" + duplicateIndex + " " + state.dump;
5888
+ }
5889
+ }
5890
+ } else if (type2 === "[object Array]") {
5891
+ if (block && state.dump.length !== 0) {
5892
+ if (state.noArrayIndent && !isblockseq && level > 0) {
5893
+ writeBlockSequence(state, level - 1, state.dump, compact);
5894
+ } else {
5895
+ writeBlockSequence(state, level, state.dump, compact);
5896
+ }
5897
+ if (duplicate) {
5898
+ state.dump = "&ref_" + duplicateIndex + state.dump;
5899
+ }
5900
+ } else {
5901
+ writeFlowSequence(state, level, state.dump);
5902
+ if (duplicate) {
5903
+ state.dump = "&ref_" + duplicateIndex + " " + state.dump;
5904
+ }
5905
+ }
5906
+ } else if (type2 === "[object String]") {
5907
+ if (state.tag !== "?") {
5908
+ writeScalar(state, state.dump, level, iskey, inblock);
5909
+ }
5910
+ } else if (type2 === "[object Undefined]") {
5911
+ return false;
5912
+ } else {
5913
+ if (state.skipInvalid)
5914
+ return false;
5915
+ throw new exception("unacceptable kind of an object to dump " + type2);
5916
+ }
5917
+ if (state.tag !== null && state.tag !== "?") {
5918
+ tagStr = encodeURI(state.tag[0] === "!" ? state.tag.slice(1) : state.tag).replace(/!/g, "%21");
5919
+ if (state.tag[0] === "!") {
5920
+ tagStr = "!" + tagStr;
5921
+ } else if (tagStr.slice(0, 18) === "tag:yaml.org,2002:") {
5922
+ tagStr = "!!" + tagStr.slice(18);
5923
+ } else {
5924
+ tagStr = "!<" + tagStr + ">";
5925
+ }
5926
+ state.dump = tagStr + " " + state.dump;
5927
+ }
5928
+ }
5929
+ return true;
5930
+ }
5931
+ function getDuplicateReferences(object, state) {
5932
+ var objects = [], duplicatesIndexes = [], index, length;
5933
+ inspectNode(object, objects, duplicatesIndexes);
5934
+ for (index = 0, length = duplicatesIndexes.length;index < length; index += 1) {
5935
+ state.duplicates.push(objects[duplicatesIndexes[index]]);
5936
+ }
5937
+ state.usedDuplicates = new Array(length);
5938
+ }
5939
+ function inspectNode(object, objects, duplicatesIndexes) {
5940
+ var objectKeyList, index, length;
5941
+ if (object !== null && typeof object === "object") {
5942
+ index = objects.indexOf(object);
5943
+ if (index !== -1) {
5944
+ if (duplicatesIndexes.indexOf(index) === -1) {
5945
+ duplicatesIndexes.push(index);
5946
+ }
5947
+ } else {
5948
+ objects.push(object);
5949
+ if (Array.isArray(object)) {
5950
+ for (index = 0, length = object.length;index < length; index += 1) {
5951
+ inspectNode(object[index], objects, duplicatesIndexes);
5952
+ }
5953
+ } else {
5954
+ objectKeyList = Object.keys(object);
5955
+ for (index = 0, length = objectKeyList.length;index < length; index += 1) {
5956
+ inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
5957
+ }
5958
+ }
5959
+ }
5960
+ }
5961
+ }
5962
+ function dump$1(input, options) {
5963
+ options = options || {};
5964
+ var state = new State(options);
5965
+ if (!state.noRefs)
5966
+ getDuplicateReferences(input, state);
5967
+ var value = input;
5968
+ if (state.replacer) {
5969
+ value = state.replacer.call({ "": value }, "", value);
5970
+ }
5971
+ if (writeNode(state, 0, value, true, true))
5972
+ return state.dump + `
5973
+ `;
5974
+ return "";
5975
+ }
5976
+ var dump_1 = dump$1;
5977
+ var dumper = {
5978
+ dump: dump_1
5979
+ };
5980
+ function renamed(from, to) {
5981
+ return function() {
5982
+ throw new Error("Function yaml." + from + " is removed in js-yaml 4. " + "Use yaml." + to + " instead, which is now safe by default.");
5983
+ };
5984
+ }
5985
+ var load = loader.load;
5986
+ var loadAll = loader.loadAll;
5987
+ var dump = dumper.dump;
5988
+ var safeLoad = renamed("safeLoad", "load");
5989
+ var safeLoadAll = renamed("safeLoadAll", "loadAll");
5990
+ var safeDump = renamed("safeDump", "dump");
3341
5991
  // src/shared/command-executor.ts
3342
5992
  import { exec } from "child_process";
3343
5993
  import { promisify } from "util";
@@ -3349,8 +5999,8 @@ import * as path from "path";
3349
5999
  var logFile = path.join(os.tmpdir(), "oh-my-opencode.log");
3350
6000
  function log(message, data) {
3351
6001
  try {
3352
- const timestamp = new Date().toISOString();
3353
- const logEntry = `[${timestamp}] ${message} ${data ? JSON.stringify(data) : ""}
6002
+ const timestamp2 = new Date().toISOString();
6003
+ const logEntry = `[${timestamp2}] ${message} ${data ? JSON.stringify(data) : ""}
3354
6004
  `;
3355
6005
  fs.appendFileSync(logFile, logEntry);
3356
6006
  } catch {}
@@ -4461,16 +7111,16 @@ function writeOmoConfig(installConfig) {
4461
7111
  }
4462
7112
  }
4463
7113
  async function findOpenCodeBinaryWithVersion() {
4464
- for (const binary of OPENCODE_BINARIES) {
7114
+ for (const binary2 of OPENCODE_BINARIES) {
4465
7115
  try {
4466
- const proc = Bun.spawn([binary, "--version"], {
7116
+ const proc = Bun.spawn([binary2, "--version"], {
4467
7117
  stdout: "pipe",
4468
7118
  stderr: "pipe"
4469
7119
  });
4470
7120
  const output = await new Response(proc.stdout).text();
4471
7121
  await proc.exited;
4472
7122
  if (proc.exitCode === 0) {
4473
- return { binary, version: output.trim() };
7123
+ return { binary: binary2, version: output.trim() };
4474
7124
  }
4475
7125
  } catch {
4476
7126
  continue;
@@ -5015,6 +7665,12 @@ async function runNonTuiInstall(args) {
5015
7665
  console.log(`${SYMBOLS.star} ${import_picocolors2.default.bold(import_picocolors2.default.green(isUpdate ? "Configuration updated!" : "Installation complete!"))}`);
5016
7666
  console.log(` Run ${import_picocolors2.default.cyan("opencode")} to start!`);
5017
7667
  console.log();
7668
+ printBox(`${import_picocolors2.default.bold("Pro Tip:")} Include ${import_picocolors2.default.cyan("ultrawork")} (or ${import_picocolors2.default.cyan("ulw")}) in your prompt.
7669
+ ` + `All features work like magic\u2014parallel agents, background tasks,
7670
+ ` + `deep exploration, and relentless execution until completion.`, "\uD83E\uDE84 The Magic Word");
7671
+ console.log(`${SYMBOLS.star} ${import_picocolors2.default.yellow("If you found this helpful, consider starring the repo!")}`);
7672
+ console.log(` ${import_picocolors2.default.dim("gh repo star code-yeongyu/oh-my-opencode")}`);
7673
+ console.log();
5018
7674
  console.log(import_picocolors2.default.dim("oMoMoMoMo... Enjoy!"));
5019
7675
  console.log();
5020
7676
  return 0;
@@ -5116,6 +7772,11 @@ async function install(args) {
5116
7772
  }
5117
7773
  M2.success(import_picocolors2.default.bold(isUpdate ? "Configuration updated!" : "Installation complete!"));
5118
7774
  M2.message(`Run ${import_picocolors2.default.cyan("opencode")} to start!`);
7775
+ Me(`Include ${import_picocolors2.default.cyan("ultrawork")} (or ${import_picocolors2.default.cyan("ulw")}) in your prompt.
7776
+ ` + `All features work like magic\u2014parallel agents, background tasks,
7777
+ ` + `deep exploration, and relentless execution until completion.`, "\uD83E\uDE84 The Magic Word");
7778
+ M2.message(`${import_picocolors2.default.yellow("\u2605")} If you found this helpful, consider starring the repo!`);
7779
+ M2.message(` ${import_picocolors2.default.dim("gh repo star code-yeongyu/oh-my-opencode")}`);
5119
7780
  Se(import_picocolors2.default.green("oMoMoMoMo... Enjoy!"));
5120
7781
  return 0;
5121
7782
  }
@@ -5480,7 +8141,7 @@ var getParseAs = (contentType) => {
5480
8141
  if (cleanContent === "multipart/form-data") {
5481
8142
  return "formData";
5482
8143
  }
5483
- if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) {
8144
+ if (["application/", "audio/", "image/", "video/"].some((type2) => cleanContent.startsWith(type2))) {
5484
8145
  return "blob";
5485
8146
  }
5486
8147
  if (cleanContent.startsWith("text/")) {
@@ -6915,13 +9576,14 @@ All tasks completed.`));
6915
9576
  }
6916
9577
  }
6917
9578
  // src/hooks/auto-update-checker/checker.ts
6918
- import * as fs2 from "fs";
9579
+ import * as fs3 from "fs";
6919
9580
  import * as path3 from "path";
6920
9581
  import { fileURLToPath } from "url";
6921
9582
 
6922
9583
  // src/hooks/auto-update-checker/constants.ts
6923
9584
  import * as path2 from "path";
6924
9585
  import * as os2 from "os";
9586
+ import * as fs2 from "fs";
6925
9587
  var PACKAGE_NAME = "oh-my-opencode";
6926
9588
  var NPM_REGISTRY_URL = `https://registry.npmjs.org/-/package/${PACKAGE_NAME}/dist-tags`;
6927
9589
  var NPM_FETCH_TIMEOUT = 5000;
@@ -6936,35 +9598,64 @@ var VERSION_FILE = path2.join(CACHE_DIR, "version");
6936
9598
  var INSTALLED_PACKAGE_JSON = path2.join(CACHE_DIR, "node_modules", PACKAGE_NAME, "package.json");
6937
9599
  function getUserConfigDir() {
6938
9600
  if (process.platform === "win32") {
6939
- return process.env.APPDATA ?? path2.join(os2.homedir(), "AppData", "Roaming");
9601
+ const crossPlatformDir = path2.join(os2.homedir(), ".config");
9602
+ const appdataDir = process.env.APPDATA ?? path2.join(os2.homedir(), "AppData", "Roaming");
9603
+ const crossPlatformConfig = path2.join(crossPlatformDir, "opencode", "opencode.json");
9604
+ const crossPlatformConfigJsonc = path2.join(crossPlatformDir, "opencode", "opencode.jsonc");
9605
+ if (fs2.existsSync(crossPlatformConfig) || fs2.existsSync(crossPlatformConfigJsonc)) {
9606
+ return crossPlatformDir;
9607
+ }
9608
+ return appdataDir;
6940
9609
  }
6941
9610
  return process.env.XDG_CONFIG_HOME ?? path2.join(os2.homedir(), ".config");
6942
9611
  }
9612
+ function getWindowsAppdataDir() {
9613
+ if (process.platform !== "win32")
9614
+ return null;
9615
+ return process.env.APPDATA ?? path2.join(os2.homedir(), "AppData", "Roaming");
9616
+ }
6943
9617
  var USER_CONFIG_DIR = getUserConfigDir();
6944
9618
  var USER_OPENCODE_CONFIG = path2.join(USER_CONFIG_DIR, "opencode", "opencode.json");
6945
9619
  var USER_OPENCODE_CONFIG_JSONC = path2.join(USER_CONFIG_DIR, "opencode", "opencode.jsonc");
6946
9620
 
6947
9621
  // src/hooks/auto-update-checker/checker.ts
9622
+ import * as os3 from "os";
6948
9623
  function isLocalDevMode(directory) {
6949
9624
  return getLocalDevPath(directory) !== null;
6950
9625
  }
6951
- function stripJsonComments(json) {
6952
- return json.replace(/\\"|"(?:\\"|[^"])*"|(\/\/.*|\/\*[\s\S]*?\*\/)/g, (m2, g2) => g2 ? "" : m2).replace(/,(\s*[}\]])/g, "$1");
9626
+ function stripJsonComments(json2) {
9627
+ return json2.replace(/\\"|"(?:\\"|[^"])*"|(\/\/.*|\/\*[\s\S]*?\*\/)/g, (m2, g2) => g2 ? "" : m2).replace(/,(\s*[}\]])/g, "$1");
6953
9628
  }
6954
9629
  function getConfigPaths(directory) {
6955
- return [
9630
+ const paths = [
6956
9631
  path3.join(directory, ".opencode", "opencode.json"),
6957
9632
  path3.join(directory, ".opencode", "opencode.jsonc"),
6958
9633
  USER_OPENCODE_CONFIG,
6959
9634
  USER_OPENCODE_CONFIG_JSONC
6960
9635
  ];
9636
+ if (process.platform === "win32") {
9637
+ const crossPlatformDir = path3.join(os3.homedir(), ".config");
9638
+ const appdataDir = getWindowsAppdataDir();
9639
+ if (appdataDir) {
9640
+ const alternateDir = USER_CONFIG_DIR === crossPlatformDir ? appdataDir : crossPlatformDir;
9641
+ const alternateConfig = path3.join(alternateDir, "opencode", "opencode.json");
9642
+ const alternateConfigJsonc = path3.join(alternateDir, "opencode", "opencode.jsonc");
9643
+ if (!paths.includes(alternateConfig)) {
9644
+ paths.push(alternateConfig);
9645
+ }
9646
+ if (!paths.includes(alternateConfigJsonc)) {
9647
+ paths.push(alternateConfigJsonc);
9648
+ }
9649
+ }
9650
+ }
9651
+ return paths;
6961
9652
  }
6962
9653
  function getLocalDevPath(directory) {
6963
9654
  for (const configPath of getConfigPaths(directory)) {
6964
9655
  try {
6965
- if (!fs2.existsSync(configPath))
9656
+ if (!fs3.existsSync(configPath))
6966
9657
  continue;
6967
- const content = fs2.readFileSync(configPath, "utf-8");
9658
+ const content = fs3.readFileSync(configPath, "utf-8");
6968
9659
  const config = JSON.parse(stripJsonComments(content));
6969
9660
  const plugins = config.plugin ?? [];
6970
9661
  for (const entry of plugins) {
@@ -6984,13 +9675,13 @@ function getLocalDevPath(directory) {
6984
9675
  }
6985
9676
  function findPackageJsonUp(startPath) {
6986
9677
  try {
6987
- const stat = fs2.statSync(startPath);
9678
+ const stat = fs3.statSync(startPath);
6988
9679
  let dir = stat.isDirectory() ? startPath : path3.dirname(startPath);
6989
- for (let i = 0;i < 10; i++) {
9680
+ for (let i2 = 0;i2 < 10; i2++) {
6990
9681
  const pkgPath = path3.join(dir, "package.json");
6991
- if (fs2.existsSync(pkgPath)) {
9682
+ if (fs3.existsSync(pkgPath)) {
6992
9683
  try {
6993
- const content = fs2.readFileSync(pkgPath, "utf-8");
9684
+ const content = fs3.readFileSync(pkgPath, "utf-8");
6994
9685
  const pkg = JSON.parse(content);
6995
9686
  if (pkg.name === PACKAGE_NAME)
6996
9687
  return pkgPath;
@@ -7007,9 +9698,9 @@ function findPackageJsonUp(startPath) {
7007
9698
  function findPluginEntry(directory) {
7008
9699
  for (const configPath of getConfigPaths(directory)) {
7009
9700
  try {
7010
- if (!fs2.existsSync(configPath))
9701
+ if (!fs3.existsSync(configPath))
7011
9702
  continue;
7012
- const content = fs2.readFileSync(configPath, "utf-8");
9703
+ const content = fs3.readFileSync(configPath, "utf-8");
7013
9704
  const config = JSON.parse(stripJsonComments(content));
7014
9705
  const plugins = config.plugin ?? [];
7015
9706
  for (const entry of plugins) {
@@ -7030,8 +9721,8 @@ function findPluginEntry(directory) {
7030
9721
  }
7031
9722
  function getCachedVersion() {
7032
9723
  try {
7033
- if (fs2.existsSync(INSTALLED_PACKAGE_JSON)) {
7034
- const content = fs2.readFileSync(INSTALLED_PACKAGE_JSON, "utf-8");
9724
+ if (fs3.existsSync(INSTALLED_PACKAGE_JSON)) {
9725
+ const content = fs3.readFileSync(INSTALLED_PACKAGE_JSON, "utf-8");
7035
9726
  const pkg = JSON.parse(content);
7036
9727
  if (pkg.version)
7037
9728
  return pkg.version;
@@ -7041,7 +9732,7 @@ function getCachedVersion() {
7041
9732
  const currentDir = path3.dirname(fileURLToPath(import.meta.url));
7042
9733
  const pkgPath = findPackageJsonUp(currentDir);
7043
9734
  if (pkgPath) {
7044
- const content = fs2.readFileSync(pkgPath, "utf-8");
9735
+ const content = fs3.readFileSync(pkgPath, "utf-8");
7045
9736
  const pkg = JSON.parse(content);
7046
9737
  if (pkg.version)
7047
9738
  return pkg.version;
@@ -7242,6 +9933,7 @@ var CHECK_IDS = {
7242
9933
  DEP_AST_GREP_CLI: "dep-ast-grep-cli",
7243
9934
  DEP_AST_GREP_NAPI: "dep-ast-grep-napi",
7244
9935
  DEP_COMMENT_CHECKER: "dep-comment-checker",
9936
+ GH_CLI: "gh-cli",
7245
9937
  LSP_SERVERS: "lsp-servers",
7246
9938
  MCP_BUILTIN: "mcp-builtin",
7247
9939
  MCP_USER: "mcp-user",
@@ -7257,6 +9949,7 @@ var CHECK_NAMES = {
7257
9949
  [CHECK_IDS.DEP_AST_GREP_CLI]: "AST-Grep CLI",
7258
9950
  [CHECK_IDS.DEP_AST_GREP_NAPI]: "AST-Grep NAPI",
7259
9951
  [CHECK_IDS.DEP_COMMENT_CHECKER]: "Comment Checker",
9952
+ [CHECK_IDS.GH_CLI]: "GitHub CLI",
7260
9953
  [CHECK_IDS.LSP_SERVERS]: "LSP Servers",
7261
9954
  [CHECK_IDS.MCP_BUILTIN]: "Built-in MCP Servers",
7262
9955
  [CHECK_IDS.MCP_USER]: "User MCP Configuration",
@@ -7280,13 +9973,13 @@ var OPENCODE_BINARIES2 = ["opencode", "opencode-desktop"];
7280
9973
 
7281
9974
  // src/cli/doctor/checks/opencode.ts
7282
9975
  async function findOpenCodeBinary() {
7283
- for (const binary of OPENCODE_BINARIES2) {
9976
+ for (const binary2 of OPENCODE_BINARIES2) {
7284
9977
  try {
7285
- const proc = Bun.spawn(["which", binary], { stdout: "pipe", stderr: "pipe" });
9978
+ const proc = Bun.spawn(["which", binary2], { stdout: "pipe", stderr: "pipe" });
7286
9979
  const output = await new Response(proc.stdout).text();
7287
9980
  await proc.exited;
7288
9981
  if (proc.exitCode === 0) {
7289
- return { binary, path: output.trim() };
9982
+ return { binary: binary2, path: output.trim() };
7290
9983
  }
7291
9984
  } catch {
7292
9985
  continue;
@@ -7294,9 +9987,9 @@ async function findOpenCodeBinary() {
7294
9987
  }
7295
9988
  return null;
7296
9989
  }
7297
- async function getOpenCodeVersion2(binary) {
9990
+ async function getOpenCodeVersion2(binary2) {
7298
9991
  try {
7299
- const proc = Bun.spawn([binary, "--version"], { stdout: "pipe", stderr: "pipe" });
9992
+ const proc = Bun.spawn([binary2, "--version"], { stdout: "pipe", stderr: "pipe" });
7300
9993
  const output = await new Response(proc.stdout).text();
7301
9994
  await proc.exited;
7302
9995
  if (proc.exitCode === 0) {
@@ -7314,9 +10007,9 @@ function compareVersions(current, minimum) {
7314
10007
  };
7315
10008
  const curr = parseVersion(current);
7316
10009
  const min = parseVersion(minimum);
7317
- for (let i = 0;i < Math.max(curr.length, min.length); i++) {
7318
- const c = curr[i] ?? 0;
7319
- const m2 = min[i] ?? 0;
10010
+ for (let i2 = 0;i2 < Math.max(curr.length, min.length); i2++) {
10011
+ const c = curr[i2] ?? 0;
10012
+ const m2 = min[i2] ?? 0;
7320
10013
  if (c > m2)
7321
10014
  return true;
7322
10015
  if (c < m2)
@@ -7385,17 +10078,17 @@ function getOpenCodeCheckDefinition() {
7385
10078
  }
7386
10079
 
7387
10080
  // src/cli/doctor/checks/plugin.ts
7388
- import { existsSync as existsSync4, readFileSync as readFileSync4 } from "fs";
7389
- import { homedir as homedir3 } from "os";
10081
+ import { existsSync as existsSync5, readFileSync as readFileSync4 } from "fs";
10082
+ import { homedir as homedir4 } from "os";
7390
10083
  import { join as join5 } from "path";
7391
- var OPENCODE_CONFIG_DIR2 = join5(homedir3(), ".config", "opencode");
10084
+ var OPENCODE_CONFIG_DIR2 = join5(homedir4(), ".config", "opencode");
7392
10085
  var OPENCODE_JSON2 = join5(OPENCODE_CONFIG_DIR2, "opencode.json");
7393
10086
  var OPENCODE_JSONC2 = join5(OPENCODE_CONFIG_DIR2, "opencode.jsonc");
7394
10087
  function detectConfigPath() {
7395
- if (existsSync4(OPENCODE_JSONC2)) {
10088
+ if (existsSync5(OPENCODE_JSONC2)) {
7396
10089
  return { path: OPENCODE_JSONC2, format: "jsonc" };
7397
10090
  }
7398
- if (existsSync4(OPENCODE_JSON2)) {
10091
+ if (existsSync5(OPENCODE_JSON2)) {
7399
10092
  return { path: OPENCODE_JSON2, format: "json" };
7400
10093
  }
7401
10094
  return null;
@@ -7495,8 +10188,8 @@ function getPluginCheckDefinition() {
7495
10188
  }
7496
10189
 
7497
10190
  // src/cli/doctor/checks/config.ts
7498
- import { existsSync as existsSync5, readFileSync as readFileSync5 } from "fs";
7499
- import { homedir as homedir4 } from "os";
10191
+ import { existsSync as existsSync6, readFileSync as readFileSync5 } from "fs";
10192
+ import { homedir as homedir5 } from "os";
7500
10193
  import { join as join6 } from "path";
7501
10194
 
7502
10195
  // node_modules/zod/v4/classic/external.js
@@ -7535,7 +10228,7 @@ __export(exports_external, {
7535
10228
  startsWith: () => _startsWith,
7536
10229
  size: () => _size,
7537
10230
  setErrorMap: () => setErrorMap,
7538
- set: () => set,
10231
+ set: () => set2,
7539
10232
  safeParseAsync: () => safeParseAsync2,
7540
10233
  safeParse: () => safeParse2,
7541
10234
  safeEncodeAsync: () => safeEncodeAsync2,
@@ -7564,7 +10257,7 @@ __export(exports_external, {
7564
10257
  number: () => number2,
7565
10258
  nullish: () => nullish2,
7566
10259
  nullable: () => nullable,
7567
- null: () => _null3,
10260
+ null: () => _null4,
7568
10261
  normalize: () => _normalize,
7569
10262
  nonpositive: () => _nonpositive,
7570
10263
  nonoptional: () => nonoptional,
@@ -7580,7 +10273,7 @@ __export(exports_external, {
7580
10273
  mime: () => _mime,
7581
10274
  maxSize: () => _maxSize,
7582
10275
  maxLength: () => _maxLength,
7583
- map: () => map,
10276
+ map: () => map2,
7584
10277
  lte: () => _lte,
7585
10278
  lt: () => _lt,
7586
10279
  lowercase: () => _lowercase,
@@ -7592,14 +10285,14 @@ __export(exports_external, {
7592
10285
  ksuid: () => ksuid2,
7593
10286
  keyof: () => keyof,
7594
10287
  jwt: () => jwt,
7595
- json: () => json,
10288
+ json: () => json2,
7596
10289
  iso: () => exports_iso,
7597
10290
  ipv6: () => ipv62,
7598
10291
  ipv4: () => ipv42,
7599
10292
  intersection: () => intersection,
7600
10293
  int64: () => int64,
7601
10294
  int32: () => int32,
7602
- int: () => int,
10295
+ int: () => int2,
7603
10296
  instanceof: () => _instanceof,
7604
10297
  includes: () => _includes,
7605
10298
  httpUrl: () => httpUrl,
@@ -7612,7 +10305,7 @@ __export(exports_external, {
7612
10305
  globalRegistry: () => globalRegistry,
7613
10306
  getErrorMap: () => getErrorMap,
7614
10307
  function: () => _function,
7615
- formatError: () => formatError,
10308
+ formatError: () => formatError2,
7616
10309
  float64: () => float64,
7617
10310
  float32: () => float32,
7618
10311
  flattenError: () => flattenError,
@@ -7647,7 +10340,7 @@ __export(exports_external, {
7647
10340
  array: () => array,
7648
10341
  any: () => any,
7649
10342
  _function: () => _function,
7650
- _default: () => _default2,
10343
+ _default: () => _default3,
7651
10344
  _ZodString: () => _ZodString,
7652
10345
  ZodXID: () => ZodXID,
7653
10346
  ZodVoid: () => ZodVoid,
@@ -7754,7 +10447,7 @@ __export(exports_core2, {
7754
10447
  isValidBase64: () => isValidBase64,
7755
10448
  globalRegistry: () => globalRegistry,
7756
10449
  globalConfig: () => globalConfig,
7757
- formatError: () => formatError,
10450
+ formatError: () => formatError2,
7758
10451
  flattenError: () => flattenError,
7759
10452
  encodeAsync: () => encodeAsync,
7760
10453
  encode: () => encode,
@@ -7811,7 +10504,7 @@ __export(exports_core2, {
7811
10504
  _optional: () => _optional,
7812
10505
  _number: () => _number,
7813
10506
  _nullable: () => _nullable,
7814
- _null: () => _null2,
10507
+ _null: () => _null3,
7815
10508
  _normalize: () => _normalize,
7816
10509
  _nonpositive: () => _nonpositive,
7817
10510
  _nonoptional: () => _nonoptional,
@@ -7863,7 +10556,7 @@ __export(exports_core2, {
7863
10556
  _email: () => _email,
7864
10557
  _e164: () => _e164,
7865
10558
  _discriminatedUnion: () => _discriminatedUnion,
7866
- _default: () => _default,
10559
+ _default: () => _default2,
7867
10560
  _decodeAsync: () => _decodeAsync,
7868
10561
  _decode: () => _decode,
7869
10562
  _date: () => _date,
@@ -8085,12 +10778,12 @@ __export(exports_util, {
8085
10778
  nullish: () => nullish,
8086
10779
  normalizeParams: () => normalizeParams,
8087
10780
  mergeDefs: () => mergeDefs,
8088
- merge: () => merge,
10781
+ merge: () => merge2,
8089
10782
  jsonStringifyReplacer: () => jsonStringifyReplacer,
8090
10783
  joinValues: () => joinValues,
8091
10784
  issue: () => issue,
8092
10785
  isPlainObject: () => isPlainObject2,
8093
- isObject: () => isObject,
10786
+ isObject: () => isObject2,
8094
10787
  hexToUint8Array: () => hexToUint8Array,
8095
10788
  getSizableOrigin: () => getSizableOrigin,
8096
10789
  getParsedType: () => getParsedType,
@@ -8099,7 +10792,7 @@ __export(exports_util, {
8099
10792
  getElementAtPath: () => getElementAtPath,
8100
10793
  floatSafeRemainder: () => floatSafeRemainder,
8101
10794
  finalizeIssue: () => finalizeIssue,
8102
- extend: () => extend,
10795
+ extend: () => extend3,
8103
10796
  escapeRegex: () => escapeRegex,
8104
10797
  esc: () => esc,
8105
10798
  defineLazy: () => defineLazy,
@@ -8149,10 +10842,10 @@ function jsonStringifyReplacer(_3, value) {
8149
10842
  return value;
8150
10843
  }
8151
10844
  function cached(getter) {
8152
- const set = false;
10845
+ const set2 = false;
8153
10846
  return {
8154
10847
  get value() {
8155
- if (!set) {
10848
+ if (!set2) {
8156
10849
  const value = getter();
8157
10850
  Object.defineProperty(this, "value", { value });
8158
10851
  return value;
@@ -8225,8 +10918,8 @@ function mergeDefs(...defs) {
8225
10918
  }
8226
10919
  return Object.defineProperties({}, mergedDescriptors);
8227
10920
  }
8228
- function cloneDef(schema) {
8229
- return mergeDefs(schema._zod.def);
10921
+ function cloneDef(schema2) {
10922
+ return mergeDefs(schema2._zod.def);
8230
10923
  }
8231
10924
  function getElementAtPath(obj, path4) {
8232
10925
  if (!path4)
@@ -8238,25 +10931,25 @@ function promiseAllObject(promisesObj) {
8238
10931
  const promises = keys.map((key) => promisesObj[key]);
8239
10932
  return Promise.all(promises).then((results) => {
8240
10933
  const resolvedObj = {};
8241
- for (let i = 0;i < keys.length; i++) {
8242
- resolvedObj[keys[i]] = results[i];
10934
+ for (let i2 = 0;i2 < keys.length; i2++) {
10935
+ resolvedObj[keys[i2]] = results[i2];
8243
10936
  }
8244
10937
  return resolvedObj;
8245
10938
  });
8246
10939
  }
8247
10940
  function randomString(length = 10) {
8248
10941
  const chars = "abcdefghijklmnopqrstuvwxyz";
8249
- let str = "";
8250
- for (let i = 0;i < length; i++) {
8251
- str += chars[Math.floor(Math.random() * chars.length)];
10942
+ let str2 = "";
10943
+ for (let i2 = 0;i2 < length; i2++) {
10944
+ str2 += chars[Math.floor(Math.random() * chars.length)];
8252
10945
  }
8253
- return str;
10946
+ return str2;
8254
10947
  }
8255
- function esc(str) {
8256
- return JSON.stringify(str);
10948
+ function esc(str2) {
10949
+ return JSON.stringify(str2);
8257
10950
  }
8258
10951
  var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
8259
- function isObject(data) {
10952
+ function isObject2(data) {
8260
10953
  return typeof data === "object" && data !== null && !Array.isArray(data);
8261
10954
  }
8262
10955
  var allowsEval = cached(() => {
@@ -8272,13 +10965,13 @@ var allowsEval = cached(() => {
8272
10965
  }
8273
10966
  });
8274
10967
  function isPlainObject2(o2) {
8275
- if (isObject(o2) === false)
10968
+ if (isObject2(o2) === false)
8276
10969
  return false;
8277
10970
  const ctor = o2.constructor;
8278
10971
  if (ctor === undefined)
8279
10972
  return true;
8280
10973
  const prot = ctor.prototype;
8281
- if (isObject(prot) === false)
10974
+ if (isObject2(prot) === false)
8282
10975
  return false;
8283
10976
  if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) {
8284
10977
  return false;
@@ -8347,8 +11040,8 @@ var getParsedType = (data) => {
8347
11040
  };
8348
11041
  var propertyKeyTypes = new Set(["string", "number", "symbol"]);
8349
11042
  var primitiveTypes = new Set(["string", "number", "bigint", "boolean", "symbol", "undefined"]);
8350
- function escapeRegex(str) {
8351
- return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
11043
+ function escapeRegex(str2) {
11044
+ return str2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
8352
11045
  }
8353
11046
  function clone(inst, def, params) {
8354
11047
  const cl = new inst._zod.constr(def ?? inst._zod.def);
@@ -8428,9 +11121,9 @@ var BIGINT_FORMAT_RANGES = {
8428
11121
  int64: [/* @__PURE__ */ BigInt("-9223372036854775808"), /* @__PURE__ */ BigInt("9223372036854775807")],
8429
11122
  uint64: [/* @__PURE__ */ BigInt(0), /* @__PURE__ */ BigInt("18446744073709551615")]
8430
11123
  };
8431
- function pick(schema, mask) {
8432
- const currDef = schema._zod.def;
8433
- const def = mergeDefs(schema._zod.def, {
11124
+ function pick(schema2, mask) {
11125
+ const currDef = schema2._zod.def;
11126
+ const def = mergeDefs(schema2._zod.def, {
8434
11127
  get shape() {
8435
11128
  const newShape = {};
8436
11129
  for (const key in mask) {
@@ -8446,13 +11139,13 @@ function pick(schema, mask) {
8446
11139
  },
8447
11140
  checks: []
8448
11141
  });
8449
- return clone(schema, def);
11142
+ return clone(schema2, def);
8450
11143
  }
8451
- function omit(schema, mask) {
8452
- const currDef = schema._zod.def;
8453
- const def = mergeDefs(schema._zod.def, {
11144
+ function omit(schema2, mask) {
11145
+ const currDef = schema2._zod.def;
11146
+ const def = mergeDefs(schema2._zod.def, {
8454
11147
  get shape() {
8455
- const newShape = { ...schema._zod.def.shape };
11148
+ const newShape = { ...schema2._zod.def.shape };
8456
11149
  for (const key in mask) {
8457
11150
  if (!(key in currDef.shape)) {
8458
11151
  throw new Error(`Unrecognized key: "${key}"`);
@@ -8466,43 +11159,43 @@ function omit(schema, mask) {
8466
11159
  },
8467
11160
  checks: []
8468
11161
  });
8469
- return clone(schema, def);
11162
+ return clone(schema2, def);
8470
11163
  }
8471
- function extend(schema, shape) {
11164
+ function extend3(schema2, shape) {
8472
11165
  if (!isPlainObject2(shape)) {
8473
11166
  throw new Error("Invalid input to extend: expected a plain object");
8474
11167
  }
8475
- const checks = schema._zod.def.checks;
11168
+ const checks = schema2._zod.def.checks;
8476
11169
  const hasChecks = checks && checks.length > 0;
8477
11170
  if (hasChecks) {
8478
11171
  throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");
8479
11172
  }
8480
- const def = mergeDefs(schema._zod.def, {
11173
+ const def = mergeDefs(schema2._zod.def, {
8481
11174
  get shape() {
8482
- const _shape = { ...schema._zod.def.shape, ...shape };
11175
+ const _shape = { ...schema2._zod.def.shape, ...shape };
8483
11176
  assignProp(this, "shape", _shape);
8484
11177
  return _shape;
8485
11178
  },
8486
11179
  checks: []
8487
11180
  });
8488
- return clone(schema, def);
11181
+ return clone(schema2, def);
8489
11182
  }
8490
- function safeExtend(schema, shape) {
11183
+ function safeExtend(schema2, shape) {
8491
11184
  if (!isPlainObject2(shape)) {
8492
11185
  throw new Error("Invalid input to safeExtend: expected a plain object");
8493
11186
  }
8494
11187
  const def = {
8495
- ...schema._zod.def,
11188
+ ...schema2._zod.def,
8496
11189
  get shape() {
8497
- const _shape = { ...schema._zod.def.shape, ...shape };
11190
+ const _shape = { ...schema2._zod.def.shape, ...shape };
8498
11191
  assignProp(this, "shape", _shape);
8499
11192
  return _shape;
8500
11193
  },
8501
- checks: schema._zod.def.checks
11194
+ checks: schema2._zod.def.checks
8502
11195
  };
8503
- return clone(schema, def);
11196
+ return clone(schema2, def);
8504
11197
  }
8505
- function merge(a, b3) {
11198
+ function merge2(a, b3) {
8506
11199
  const def = mergeDefs(a._zod.def, {
8507
11200
  get shape() {
8508
11201
  const _shape = { ...a._zod.def.shape, ...b3._zod.def.shape };
@@ -8516,10 +11209,10 @@ function merge(a, b3) {
8516
11209
  });
8517
11210
  return clone(a, def);
8518
11211
  }
8519
- function partial(Class, schema, mask) {
8520
- const def = mergeDefs(schema._zod.def, {
11212
+ function partial(Class, schema2, mask) {
11213
+ const def = mergeDefs(schema2._zod.def, {
8521
11214
  get shape() {
8522
- const oldShape = schema._zod.def.shape;
11215
+ const oldShape = schema2._zod.def.shape;
8523
11216
  const shape = { ...oldShape };
8524
11217
  if (mask) {
8525
11218
  for (const key in mask) {
@@ -8546,12 +11239,12 @@ function partial(Class, schema, mask) {
8546
11239
  },
8547
11240
  checks: []
8548
11241
  });
8549
- return clone(schema, def);
11242
+ return clone(schema2, def);
8550
11243
  }
8551
- function required(Class, schema, mask) {
8552
- const def = mergeDefs(schema._zod.def, {
11244
+ function required(Class, schema2, mask) {
11245
+ const def = mergeDefs(schema2._zod.def, {
8553
11246
  get shape() {
8554
- const oldShape = schema._zod.def.shape;
11247
+ const oldShape = schema2._zod.def.shape;
8555
11248
  const shape = { ...oldShape };
8556
11249
  if (mask) {
8557
11250
  for (const key in mask) {
@@ -8578,13 +11271,13 @@ function required(Class, schema, mask) {
8578
11271
  },
8579
11272
  checks: []
8580
11273
  });
8581
- return clone(schema, def);
11274
+ return clone(schema2, def);
8582
11275
  }
8583
11276
  function aborted(x2, startIndex = 0) {
8584
11277
  if (x2.aborted === true)
8585
11278
  return true;
8586
- for (let i = startIndex;i < x2.issues.length; i++) {
8587
- if (x2.issues[i]?.continue !== true) {
11279
+ for (let i2 = startIndex;i2 < x2.issues.length; i2++) {
11280
+ if (x2.issues[i2]?.continue !== true) {
8588
11281
  return true;
8589
11282
  }
8590
11283
  }
@@ -8650,15 +11343,15 @@ function cleanEnum(obj) {
8650
11343
  function base64ToUint8Array(base64) {
8651
11344
  const binaryString = atob(base64);
8652
11345
  const bytes = new Uint8Array(binaryString.length);
8653
- for (let i = 0;i < binaryString.length; i++) {
8654
- bytes[i] = binaryString.charCodeAt(i);
11346
+ for (let i2 = 0;i2 < binaryString.length; i2++) {
11347
+ bytes[i2] = binaryString.charCodeAt(i2);
8655
11348
  }
8656
11349
  return bytes;
8657
11350
  }
8658
11351
  function uint8ArrayToBase64(bytes) {
8659
11352
  let binaryString = "";
8660
- for (let i = 0;i < bytes.length; i++) {
8661
- binaryString += String.fromCharCode(bytes[i]);
11353
+ for (let i2 = 0;i2 < bytes.length; i2++) {
11354
+ binaryString += String.fromCharCode(bytes[i2]);
8662
11355
  }
8663
11356
  return btoa(binaryString);
8664
11357
  }
@@ -8676,8 +11369,8 @@ function hexToUint8Array(hex) {
8676
11369
  throw new Error("Invalid hex string length");
8677
11370
  }
8678
11371
  const bytes = new Uint8Array(cleanHex.length / 2);
8679
- for (let i = 0;i < cleanHex.length; i += 2) {
8680
- bytes[i / 2] = Number.parseInt(cleanHex.slice(i, i + 2), 16);
11372
+ for (let i2 = 0;i2 < cleanHex.length; i2 += 2) {
11373
+ bytes[i2 / 2] = Number.parseInt(cleanHex.slice(i2, i2 + 2), 16);
8681
11374
  }
8682
11375
  return bytes;
8683
11376
  }
@@ -8721,7 +11414,7 @@ function flattenError(error, mapper = (issue2) => issue2.message) {
8721
11414
  }
8722
11415
  return { formErrors, fieldErrors };
8723
11416
  }
8724
- function formatError(error, _mapper) {
11417
+ function formatError2(error, _mapper) {
8725
11418
  const mapper = _mapper || function(issue2) {
8726
11419
  return issue2.message;
8727
11420
  };
@@ -8738,10 +11431,10 @@ function formatError(error, _mapper) {
8738
11431
  fieldErrors._errors.push(mapper(issue2));
8739
11432
  } else {
8740
11433
  let curr = fieldErrors;
8741
- let i = 0;
8742
- while (i < issue2.path.length) {
8743
- const el = issue2.path[i];
8744
- const terminal = i === issue2.path.length - 1;
11434
+ let i2 = 0;
11435
+ while (i2 < issue2.path.length) {
11436
+ const el = issue2.path[i2];
11437
+ const terminal = i2 === issue2.path.length - 1;
8745
11438
  if (!terminal) {
8746
11439
  curr[el] = curr[el] || { _errors: [] };
8747
11440
  } else {
@@ -8749,7 +11442,7 @@ function formatError(error, _mapper) {
8749
11442
  curr[el]._errors.push(mapper(issue2));
8750
11443
  }
8751
11444
  curr = curr[el];
8752
- i++;
11445
+ i2++;
8753
11446
  }
8754
11447
  }
8755
11448
  }
@@ -8778,10 +11471,10 @@ function treeifyError(error, _mapper) {
8778
11471
  continue;
8779
11472
  }
8780
11473
  let curr = result;
8781
- let i = 0;
8782
- while (i < fullpath.length) {
8783
- const el = fullpath[i];
8784
- const terminal = i === fullpath.length - 1;
11474
+ let i2 = 0;
11475
+ while (i2 < fullpath.length) {
11476
+ const el = fullpath[i2];
11477
+ const terminal = i2 === fullpath.length - 1;
8785
11478
  if (typeof el === "string") {
8786
11479
  curr.properties ?? (curr.properties = {});
8787
11480
  (_a = curr.properties)[el] ?? (_a[el] = { errors: [] });
@@ -8794,7 +11487,7 @@ function treeifyError(error, _mapper) {
8794
11487
  if (terminal) {
8795
11488
  curr.errors.push(mapper(issue2));
8796
11489
  }
8797
- i++;
11490
+ i2++;
8798
11491
  }
8799
11492
  }
8800
11493
  }
@@ -8833,9 +11526,9 @@ function prettifyError(error) {
8833
11526
  }
8834
11527
 
8835
11528
  // node_modules/zod/v4/core/parse.js
8836
- var _parse = (_Err) => (schema, value, _ctx, _params) => {
11529
+ var _parse = (_Err) => (schema2, value, _ctx, _params) => {
8837
11530
  const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
8838
- const result = schema._zod.run({ value, issues: [] }, ctx);
11531
+ const result = schema2._zod.run({ value, issues: [] }, ctx);
8839
11532
  if (result instanceof Promise) {
8840
11533
  throw new $ZodAsyncError;
8841
11534
  }
@@ -8847,9 +11540,9 @@ var _parse = (_Err) => (schema, value, _ctx, _params) => {
8847
11540
  return result.value;
8848
11541
  };
8849
11542
  var parse3 = /* @__PURE__ */ _parse($ZodRealError);
8850
- var _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
11543
+ var _parseAsync = (_Err) => async (schema2, value, _ctx, params) => {
8851
11544
  const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
8852
- let result = schema._zod.run({ value, issues: [] }, ctx);
11545
+ let result = schema2._zod.run({ value, issues: [] }, ctx);
8853
11546
  if (result instanceof Promise)
8854
11547
  result = await result;
8855
11548
  if (result.issues.length) {
@@ -8860,9 +11553,9 @@ var _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
8860
11553
  return result.value;
8861
11554
  };
8862
11555
  var parseAsync = /* @__PURE__ */ _parseAsync($ZodRealError);
8863
- var _safeParse = (_Err) => (schema, value, _ctx) => {
11556
+ var _safeParse = (_Err) => (schema2, value, _ctx) => {
8864
11557
  const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
8865
- const result = schema._zod.run({ value, issues: [] }, ctx);
11558
+ const result = schema2._zod.run({ value, issues: [] }, ctx);
8866
11559
  if (result instanceof Promise) {
8867
11560
  throw new $ZodAsyncError;
8868
11561
  }
@@ -8872,9 +11565,9 @@ var _safeParse = (_Err) => (schema, value, _ctx) => {
8872
11565
  } : { success: true, data: result.value };
8873
11566
  };
8874
11567
  var safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
8875
- var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
11568
+ var _safeParseAsync = (_Err) => async (schema2, value, _ctx) => {
8876
11569
  const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
8877
- let result = schema._zod.run({ value, issues: [] }, ctx);
11570
+ let result = schema2._zod.run({ value, issues: [] }, ctx);
8878
11571
  if (result instanceof Promise)
8879
11572
  result = await result;
8880
11573
  return result.issues.length ? {
@@ -8883,40 +11576,40 @@ var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
8883
11576
  } : { success: true, data: result.value };
8884
11577
  };
8885
11578
  var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
8886
- var _encode = (_Err) => (schema, value, _ctx) => {
11579
+ var _encode = (_Err) => (schema2, value, _ctx) => {
8887
11580
  const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
8888
- return _parse(_Err)(schema, value, ctx);
11581
+ return _parse(_Err)(schema2, value, ctx);
8889
11582
  };
8890
11583
  var encode = /* @__PURE__ */ _encode($ZodRealError);
8891
- var _decode = (_Err) => (schema, value, _ctx) => {
8892
- return _parse(_Err)(schema, value, _ctx);
11584
+ var _decode = (_Err) => (schema2, value, _ctx) => {
11585
+ return _parse(_Err)(schema2, value, _ctx);
8893
11586
  };
8894
11587
  var decode = /* @__PURE__ */ _decode($ZodRealError);
8895
- var _encodeAsync = (_Err) => async (schema, value, _ctx) => {
11588
+ var _encodeAsync = (_Err) => async (schema2, value, _ctx) => {
8896
11589
  const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
8897
- return _parseAsync(_Err)(schema, value, ctx);
11590
+ return _parseAsync(_Err)(schema2, value, ctx);
8898
11591
  };
8899
11592
  var encodeAsync = /* @__PURE__ */ _encodeAsync($ZodRealError);
8900
- var _decodeAsync = (_Err) => async (schema, value, _ctx) => {
8901
- return _parseAsync(_Err)(schema, value, _ctx);
11593
+ var _decodeAsync = (_Err) => async (schema2, value, _ctx) => {
11594
+ return _parseAsync(_Err)(schema2, value, _ctx);
8902
11595
  };
8903
11596
  var decodeAsync = /* @__PURE__ */ _decodeAsync($ZodRealError);
8904
- var _safeEncode = (_Err) => (schema, value, _ctx) => {
11597
+ var _safeEncode = (_Err) => (schema2, value, _ctx) => {
8905
11598
  const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
8906
- return _safeParse(_Err)(schema, value, ctx);
11599
+ return _safeParse(_Err)(schema2, value, ctx);
8907
11600
  };
8908
11601
  var safeEncode = /* @__PURE__ */ _safeEncode($ZodRealError);
8909
- var _safeDecode = (_Err) => (schema, value, _ctx) => {
8910
- return _safeParse(_Err)(schema, value, _ctx);
11602
+ var _safeDecode = (_Err) => (schema2, value, _ctx) => {
11603
+ return _safeParse(_Err)(schema2, value, _ctx);
8911
11604
  };
8912
11605
  var safeDecode = /* @__PURE__ */ _safeDecode($ZodRealError);
8913
- var _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
11606
+ var _safeEncodeAsync = (_Err) => async (schema2, value, _ctx) => {
8914
11607
  const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
8915
- return _safeParseAsync(_Err)(schema, value, ctx);
11608
+ return _safeParseAsync(_Err)(schema2, value, ctx);
8916
11609
  };
8917
11610
  var safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync($ZodRealError);
8918
- var _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
8919
- return _safeParseAsync(_Err)(schema, value, _ctx);
11611
+ var _safeDecodeAsync = (_Err) => async (schema2, value, _ctx) => {
11612
+ return _safeParseAsync(_Err)(schema2, value, _ctx);
8920
11613
  };
8921
11614
  var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
8922
11615
  // node_modules/zod/v4/core/regexes.js
@@ -8947,7 +11640,7 @@ __export(exports_regexes, {
8947
11640
  sha1_base64: () => sha1_base64,
8948
11641
  rfc5322Email: () => rfc5322Email,
8949
11642
  number: () => number,
8950
- null: () => _null,
11643
+ null: () => _null2,
8951
11644
  nanoid: () => nanoid,
8952
11645
  md5_hex: () => md5_hex,
8953
11646
  md5_base64url: () => md5_base64url,
@@ -9044,7 +11737,7 @@ var bigint = /^-?\d+n?$/;
9044
11737
  var integer = /^-?\d+$/;
9045
11738
  var number = /^-?\d+(?:\.\d+)?/;
9046
11739
  var boolean = /^(?:true|false)$/i;
9047
- var _null = /^null$/i;
11740
+ var _null2 = /^null$/i;
9048
11741
  var _undefined = /^undefined$/i;
9049
11742
  var lowercase = /^[^A-Z]*$/;
9050
11743
  var uppercase = /^[^a-z]*$/;
@@ -10187,7 +12880,7 @@ var $ZodUndefined = /* @__PURE__ */ $constructor("$ZodUndefined", (inst, def) =>
10187
12880
  });
10188
12881
  var $ZodNull = /* @__PURE__ */ $constructor("$ZodNull", (inst, def) => {
10189
12882
  $ZodType.init(inst, def);
10190
- inst._zod.pattern = _null;
12883
+ inst._zod.pattern = _null2;
10191
12884
  inst._zod.values = new Set([null]);
10192
12885
  inst._zod.parse = (payload, _ctx) => {
10193
12886
  const input = payload.value;
@@ -10281,16 +12974,16 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
10281
12974
  }
10282
12975
  payload.value = Array(input.length);
10283
12976
  const proms = [];
10284
- for (let i = 0;i < input.length; i++) {
10285
- const item = input[i];
12977
+ for (let i2 = 0;i2 < input.length; i2++) {
12978
+ const item = input[i2];
10286
12979
  const result = def.element._zod.run({
10287
12980
  value: item,
10288
12981
  issues: []
10289
12982
  }, ctx);
10290
12983
  if (result instanceof Promise) {
10291
- proms.push(result.then((result2) => handleArrayResult(result2, payload, i)));
12984
+ proms.push(result.then((result2) => handleArrayResult(result2, payload, i2)));
10292
12985
  } else {
10293
- handleArrayResult(result, payload, i);
12986
+ handleArrayResult(result, payload, i2);
10294
12987
  }
10295
12988
  }
10296
12989
  if (proms.length) {
@@ -10376,13 +13069,13 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
10376
13069
  }
10377
13070
  return propValues;
10378
13071
  });
10379
- const isObject2 = isObject;
13072
+ const isObject3 = isObject2;
10380
13073
  const catchall = def.catchall;
10381
13074
  let value;
10382
13075
  inst._zod.parse = (payload, ctx) => {
10383
13076
  value ?? (value = _normalized.value);
10384
13077
  const input = payload.value;
10385
- if (!isObject2(input)) {
13078
+ if (!isObject3(input)) {
10386
13079
  payload.issues.push({
10387
13080
  expected: "object",
10388
13081
  code: "invalid_type",
@@ -10456,7 +13149,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
10456
13149
  return (payload, ctx) => fn(shape, payload, ctx);
10457
13150
  };
10458
13151
  let fastpass;
10459
- const isObject2 = isObject;
13152
+ const isObject3 = isObject2;
10460
13153
  const jit = !globalConfig.jitless;
10461
13154
  const allowsEval2 = allowsEval;
10462
13155
  const fastEnabled = jit && allowsEval2.value;
@@ -10465,7 +13158,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
10465
13158
  inst._zod.parse = (payload, ctx) => {
10466
13159
  value ?? (value = _normalized.value);
10467
13160
  const input = payload.value;
10468
- if (!isObject2(input)) {
13161
+ if (!isObject3(input)) {
10469
13162
  payload.issues.push({
10470
13163
  expected: "object",
10471
13164
  code: "invalid_type",
@@ -10572,23 +13265,23 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
10572
13265
  });
10573
13266
  const disc = cached(() => {
10574
13267
  const opts = def.options;
10575
- const map = new Map;
13268
+ const map2 = new Map;
10576
13269
  for (const o2 of opts) {
10577
13270
  const values = o2._zod.propValues?.[def.discriminator];
10578
13271
  if (!values || values.size === 0)
10579
13272
  throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o2)}"`);
10580
13273
  for (const v of values) {
10581
- if (map.has(v)) {
13274
+ if (map2.has(v)) {
10582
13275
  throw new Error(`Duplicate discriminator value "${String(v)}"`);
10583
13276
  }
10584
- map.set(v, o2);
13277
+ map2.set(v, o2);
10585
13278
  }
10586
13279
  }
10587
- return map;
13280
+ return map2;
10588
13281
  });
10589
13282
  inst._zod.parse = (payload, ctx) => {
10590
13283
  const input = payload.value;
10591
- if (!isObject(input)) {
13284
+ if (!isObject2(input)) {
10592
13285
  payload.issues.push({
10593
13286
  code: "invalid_type",
10594
13287
  expected: "object",
@@ -10721,35 +13414,35 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
10721
13414
  return payload;
10722
13415
  }
10723
13416
  }
10724
- let i = -1;
13417
+ let i2 = -1;
10725
13418
  for (const item of items) {
10726
- i++;
10727
- if (i >= input.length) {
10728
- if (i >= optStart)
13419
+ i2++;
13420
+ if (i2 >= input.length) {
13421
+ if (i2 >= optStart)
10729
13422
  continue;
10730
13423
  }
10731
13424
  const result = item._zod.run({
10732
- value: input[i],
13425
+ value: input[i2],
10733
13426
  issues: []
10734
13427
  }, ctx);
10735
13428
  if (result instanceof Promise) {
10736
- proms.push(result.then((result2) => handleTupleResult(result2, payload, i)));
13429
+ proms.push(result.then((result2) => handleTupleResult(result2, payload, i2)));
10737
13430
  } else {
10738
- handleTupleResult(result, payload, i);
13431
+ handleTupleResult(result, payload, i2);
10739
13432
  }
10740
13433
  }
10741
13434
  if (def.rest) {
10742
13435
  const rest = input.slice(items.length);
10743
13436
  for (const el of rest) {
10744
- i++;
13437
+ i2++;
10745
13438
  const result = def.rest._zod.run({
10746
13439
  value: el,
10747
13440
  issues: []
10748
13441
  }, ctx);
10749
13442
  if (result instanceof Promise) {
10750
- proms.push(result.then((result2) => handleTupleResult(result2, payload, i)));
13443
+ proms.push(result.then((result2) => handleTupleResult(result2, payload, i2)));
10751
13444
  } else {
10752
- handleTupleResult(result, payload, i);
13445
+ handleTupleResult(result, payload, i2);
10753
13446
  }
10754
13447
  }
10755
13448
  }
@@ -12198,8 +14891,8 @@ var error6 = () => {
12198
14891
  function getSizing(origin) {
12199
14892
  return Sizable[origin] ?? null;
12200
14893
  }
12201
- function getTypeName(type) {
12202
- return TypeNames[type] ?? type;
14894
+ function getTypeName(type2) {
14895
+ return TypeNames[type2] ?? type2;
12203
14896
  }
12204
14897
  const parsedType = (data) => {
12205
14898
  const t = typeof data;
@@ -12695,8 +15388,8 @@ var error10 = () => {
12695
15388
  function getSizing(origin) {
12696
15389
  return Sizable[origin] ?? null;
12697
15390
  }
12698
- function getTypeName(type) {
12699
- return TypeNames[type] ?? type;
15391
+ function getTypeName(type2) {
15392
+ return TypeNames[type2] ?? type2;
12700
15393
  }
12701
15394
  const parsedType3 = (data) => {
12702
15395
  const t = typeof data;
@@ -16972,14 +19665,14 @@ class $ZodRegistry {
16972
19665
  this._map = new WeakMap;
16973
19666
  this._idmap = new Map;
16974
19667
  }
16975
- add(schema, ..._meta) {
19668
+ add(schema2, ..._meta) {
16976
19669
  const meta = _meta[0];
16977
- this._map.set(schema, meta);
19670
+ this._map.set(schema2, meta);
16978
19671
  if (meta && typeof meta === "object" && "id" in meta) {
16979
19672
  if (this._idmap.has(meta.id)) {
16980
19673
  throw new Error(`ID ${meta.id} already exists in the registry`);
16981
19674
  }
16982
- this._idmap.set(meta.id, schema);
19675
+ this._idmap.set(meta.id, schema2);
16983
19676
  }
16984
19677
  return this;
16985
19678
  }
@@ -16988,26 +19681,26 @@ class $ZodRegistry {
16988
19681
  this._idmap = new Map;
16989
19682
  return this;
16990
19683
  }
16991
- remove(schema) {
16992
- const meta = this._map.get(schema);
19684
+ remove(schema2) {
19685
+ const meta = this._map.get(schema2);
16993
19686
  if (meta && typeof meta === "object" && "id" in meta) {
16994
19687
  this._idmap.delete(meta.id);
16995
19688
  }
16996
- this._map.delete(schema);
19689
+ this._map.delete(schema2);
16997
19690
  return this;
16998
19691
  }
16999
- get(schema) {
17000
- const p2 = schema._zod.parent;
19692
+ get(schema2) {
19693
+ const p2 = schema2._zod.parent;
17001
19694
  if (p2) {
17002
19695
  const pm = { ...this.get(p2) ?? {} };
17003
19696
  delete pm.id;
17004
- const f = { ...pm, ...this._map.get(schema) };
19697
+ const f = { ...pm, ...this._map.get(schema2) };
17005
19698
  return Object.keys(f).length ? f : undefined;
17006
19699
  }
17007
- return this._map.get(schema);
19700
+ return this._map.get(schema2);
17008
19701
  }
17009
- has(schema) {
17010
- return this._map.has(schema);
19702
+ has(schema2) {
19703
+ return this._map.has(schema2);
17011
19704
  }
17012
19705
  }
17013
19706
  function registry() {
@@ -17388,7 +20081,7 @@ function _undefined2(Class2, params) {
17388
20081
  ...normalizeParams(params)
17389
20082
  });
17390
20083
  }
17391
- function _null2(Class2, params) {
20084
+ function _null3(Class2, params) {
17392
20085
  return new Class2({
17393
20086
  type: "null",
17394
20087
  ...normalizeParams(params)
@@ -17575,11 +20268,11 @@ function _endsWith(suffix, params) {
17575
20268
  suffix
17576
20269
  });
17577
20270
  }
17578
- function _property(property, schema, params) {
20271
+ function _property(property, schema2, params) {
17579
20272
  return new $ZodCheckProperty({
17580
20273
  check: "property",
17581
20274
  property,
17582
- schema,
20275
+ schema: schema2,
17583
20276
  ...normalizeParams(params)
17584
20277
  });
17585
20278
  }
@@ -17717,7 +20410,7 @@ function _nullable(Class2, innerType) {
17717
20410
  innerType
17718
20411
  });
17719
20412
  }
17720
- function _default(Class2, innerType, defaultValue) {
20413
+ function _default2(Class2, innerType, defaultValue) {
17721
20414
  return new Class2({
17722
20415
  type: "default",
17723
20416
  innerType,
@@ -17781,22 +20474,22 @@ function _promise(Class2, innerType) {
17781
20474
  function _custom(Class2, fn, _params) {
17782
20475
  const norm = normalizeParams(_params);
17783
20476
  norm.abort ?? (norm.abort = true);
17784
- const schema = new Class2({
20477
+ const schema2 = new Class2({
17785
20478
  type: "custom",
17786
20479
  check: "custom",
17787
20480
  fn,
17788
20481
  ...norm
17789
20482
  });
17790
- return schema;
20483
+ return schema2;
17791
20484
  }
17792
20485
  function _refine(Class2, fn, _params) {
17793
- const schema = new Class2({
20486
+ const schema2 = new Class2({
17794
20487
  type: "custom",
17795
20488
  check: "custom",
17796
20489
  fn,
17797
20490
  ...normalizeParams(_params)
17798
20491
  });
17799
- return schema;
20492
+ return schema2;
17800
20493
  }
17801
20494
  function _superRefine(fn) {
17802
20495
  const ch = _check((payload) => {
@@ -17903,9 +20596,9 @@ class JSONSchemaGenerator {
17903
20596
  this.io = params?.io ?? "output";
17904
20597
  this.seen = new Map;
17905
20598
  }
17906
- process(schema, _params = { path: [], schemaPath: [] }) {
20599
+ process(schema2, _params = { path: [], schemaPath: [] }) {
17907
20600
  var _a;
17908
- const def = schema._zod.def;
20601
+ const def = schema2._zod.def;
17909
20602
  const formatMap = {
17910
20603
  guid: "uuid",
17911
20604
  url: "uri",
@@ -17913,27 +20606,27 @@ class JSONSchemaGenerator {
17913
20606
  json_string: "json-string",
17914
20607
  regex: ""
17915
20608
  };
17916
- const seen = this.seen.get(schema);
20609
+ const seen = this.seen.get(schema2);
17917
20610
  if (seen) {
17918
20611
  seen.count++;
17919
- const isCycle = _params.schemaPath.includes(schema);
20612
+ const isCycle = _params.schemaPath.includes(schema2);
17920
20613
  if (isCycle) {
17921
20614
  seen.cycle = _params.path;
17922
20615
  }
17923
20616
  return seen.schema;
17924
20617
  }
17925
20618
  const result = { schema: {}, count: 1, cycle: undefined, path: _params.path };
17926
- this.seen.set(schema, result);
17927
- const overrideSchema = schema._zod.toJSONSchema?.();
20619
+ this.seen.set(schema2, result);
20620
+ const overrideSchema = schema2._zod.toJSONSchema?.();
17928
20621
  if (overrideSchema) {
17929
20622
  result.schema = overrideSchema;
17930
20623
  } else {
17931
20624
  const params = {
17932
20625
  ..._params,
17933
- schemaPath: [..._params.schemaPath, schema],
20626
+ schemaPath: [..._params.schemaPath, schema2],
17934
20627
  path: _params.path
17935
20628
  };
17936
- const parent = schema._zod.parent;
20629
+ const parent = schema2._zod.parent;
17937
20630
  if (parent) {
17938
20631
  result.ref = parent;
17939
20632
  this.process(parent, params);
@@ -17942,24 +20635,24 @@ class JSONSchemaGenerator {
17942
20635
  const _json = result.schema;
17943
20636
  switch (def.type) {
17944
20637
  case "string": {
17945
- const json = _json;
17946
- json.type = "string";
17947
- const { minimum, maximum, format: format2, patterns, contentEncoding } = schema._zod.bag;
20638
+ const json2 = _json;
20639
+ json2.type = "string";
20640
+ const { minimum, maximum, format: format2, patterns, contentEncoding } = schema2._zod.bag;
17948
20641
  if (typeof minimum === "number")
17949
- json.minLength = minimum;
20642
+ json2.minLength = minimum;
17950
20643
  if (typeof maximum === "number")
17951
- json.maxLength = maximum;
20644
+ json2.maxLength = maximum;
17952
20645
  if (format2) {
17953
- json.format = formatMap[format2] ?? format2;
17954
- if (json.format === "")
17955
- delete json.format;
20646
+ json2.format = formatMap[format2] ?? format2;
20647
+ if (json2.format === "")
20648
+ delete json2.format;
17956
20649
  }
17957
20650
  if (contentEncoding)
17958
- json.contentEncoding = contentEncoding;
20651
+ json2.contentEncoding = contentEncoding;
17959
20652
  if (patterns && patterns.size > 0) {
17960
20653
  const regexes = [...patterns];
17961
20654
  if (regexes.length === 1)
17962
- json.pattern = regexes[0].source;
20655
+ json2.pattern = regexes[0].source;
17963
20656
  else if (regexes.length > 1) {
17964
20657
  result.schema.allOf = [
17965
20658
  ...regexes.map((regex) => ({
@@ -17972,53 +20665,53 @@ class JSONSchemaGenerator {
17972
20665
  break;
17973
20666
  }
17974
20667
  case "number": {
17975
- const json = _json;
17976
- const { minimum, maximum, format: format2, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
20668
+ const json2 = _json;
20669
+ const { minimum, maximum, format: format2, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema2._zod.bag;
17977
20670
  if (typeof format2 === "string" && format2.includes("int"))
17978
- json.type = "integer";
20671
+ json2.type = "integer";
17979
20672
  else
17980
- json.type = "number";
20673
+ json2.type = "number";
17981
20674
  if (typeof exclusiveMinimum === "number") {
17982
20675
  if (this.target === "draft-4" || this.target === "openapi-3.0") {
17983
- json.minimum = exclusiveMinimum;
17984
- json.exclusiveMinimum = true;
20676
+ json2.minimum = exclusiveMinimum;
20677
+ json2.exclusiveMinimum = true;
17985
20678
  } else {
17986
- json.exclusiveMinimum = exclusiveMinimum;
20679
+ json2.exclusiveMinimum = exclusiveMinimum;
17987
20680
  }
17988
20681
  }
17989
20682
  if (typeof minimum === "number") {
17990
- json.minimum = minimum;
20683
+ json2.minimum = minimum;
17991
20684
  if (typeof exclusiveMinimum === "number" && this.target !== "draft-4") {
17992
20685
  if (exclusiveMinimum >= minimum)
17993
- delete json.minimum;
20686
+ delete json2.minimum;
17994
20687
  else
17995
- delete json.exclusiveMinimum;
20688
+ delete json2.exclusiveMinimum;
17996
20689
  }
17997
20690
  }
17998
20691
  if (typeof exclusiveMaximum === "number") {
17999
20692
  if (this.target === "draft-4" || this.target === "openapi-3.0") {
18000
- json.maximum = exclusiveMaximum;
18001
- json.exclusiveMaximum = true;
20693
+ json2.maximum = exclusiveMaximum;
20694
+ json2.exclusiveMaximum = true;
18002
20695
  } else {
18003
- json.exclusiveMaximum = exclusiveMaximum;
20696
+ json2.exclusiveMaximum = exclusiveMaximum;
18004
20697
  }
18005
20698
  }
18006
20699
  if (typeof maximum === "number") {
18007
- json.maximum = maximum;
20700
+ json2.maximum = maximum;
18008
20701
  if (typeof exclusiveMaximum === "number" && this.target !== "draft-4") {
18009
20702
  if (exclusiveMaximum <= maximum)
18010
- delete json.maximum;
20703
+ delete json2.maximum;
18011
20704
  else
18012
- delete json.exclusiveMaximum;
20705
+ delete json2.exclusiveMaximum;
18013
20706
  }
18014
20707
  }
18015
20708
  if (typeof multipleOf === "number")
18016
- json.multipleOf = multipleOf;
20709
+ json2.multipleOf = multipleOf;
18017
20710
  break;
18018
20711
  }
18019
20712
  case "boolean": {
18020
- const json = _json;
18021
- json.type = "boolean";
20713
+ const json2 = _json;
20714
+ json2.type = "boolean";
18022
20715
  break;
18023
20716
  }
18024
20717
  case "bigint": {
@@ -18071,23 +20764,23 @@ class JSONSchemaGenerator {
18071
20764
  break;
18072
20765
  }
18073
20766
  case "array": {
18074
- const json = _json;
18075
- const { minimum, maximum } = schema._zod.bag;
20767
+ const json2 = _json;
20768
+ const { minimum, maximum } = schema2._zod.bag;
18076
20769
  if (typeof minimum === "number")
18077
- json.minItems = minimum;
20770
+ json2.minItems = minimum;
18078
20771
  if (typeof maximum === "number")
18079
- json.maxItems = maximum;
18080
- json.type = "array";
18081
- json.items = this.process(def.element, { ...params, path: [...params.path, "items"] });
20772
+ json2.maxItems = maximum;
20773
+ json2.type = "array";
20774
+ json2.items = this.process(def.element, { ...params, path: [...params.path, "items"] });
18082
20775
  break;
18083
20776
  }
18084
20777
  case "object": {
18085
- const json = _json;
18086
- json.type = "object";
18087
- json.properties = {};
20778
+ const json2 = _json;
20779
+ json2.type = "object";
20780
+ json2.properties = {};
18088
20781
  const shape = def.shape;
18089
20782
  for (const key in shape) {
18090
- json.properties[key] = this.process(shape[key], {
20783
+ json2.properties[key] = this.process(shape[key], {
18091
20784
  ...params,
18092
20785
  path: [...params.path, "properties", key]
18093
20786
  });
@@ -18102,15 +20795,15 @@ class JSONSchemaGenerator {
18102
20795
  }
18103
20796
  }));
18104
20797
  if (requiredKeys.size > 0) {
18105
- json.required = Array.from(requiredKeys);
20798
+ json2.required = Array.from(requiredKeys);
18106
20799
  }
18107
20800
  if (def.catchall?._zod.def.type === "never") {
18108
- json.additionalProperties = false;
20801
+ json2.additionalProperties = false;
18109
20802
  } else if (!def.catchall) {
18110
20803
  if (this.io === "output")
18111
- json.additionalProperties = false;
20804
+ json2.additionalProperties = false;
18112
20805
  } else if (def.catchall) {
18113
- json.additionalProperties = this.process(def.catchall, {
20806
+ json2.additionalProperties = this.process(def.catchall, {
18114
20807
  ...params,
18115
20808
  path: [...params.path, "additionalProperties"]
18116
20809
  });
@@ -18118,16 +20811,16 @@ class JSONSchemaGenerator {
18118
20811
  break;
18119
20812
  }
18120
20813
  case "union": {
18121
- const json = _json;
18122
- const options = def.options.map((x2, i) => this.process(x2, {
20814
+ const json2 = _json;
20815
+ const options = def.options.map((x2, i2) => this.process(x2, {
18123
20816
  ...params,
18124
- path: [...params.path, "anyOf", i]
20817
+ path: [...params.path, "anyOf", i2]
18125
20818
  }));
18126
- json.anyOf = options;
20819
+ json2.anyOf = options;
18127
20820
  break;
18128
20821
  }
18129
20822
  case "intersection": {
18130
- const json = _json;
20823
+ const json2 = _json;
18131
20824
  const a = this.process(def.left, {
18132
20825
  ...params,
18133
20826
  path: [...params.path, "allOf", 0]
@@ -18141,61 +20834,61 @@ class JSONSchemaGenerator {
18141
20834
  ...isSimpleIntersection(a) ? a.allOf : [a],
18142
20835
  ...isSimpleIntersection(b3) ? b3.allOf : [b3]
18143
20836
  ];
18144
- json.allOf = allOf;
20837
+ json2.allOf = allOf;
18145
20838
  break;
18146
20839
  }
18147
20840
  case "tuple": {
18148
- const json = _json;
18149
- json.type = "array";
20841
+ const json2 = _json;
20842
+ json2.type = "array";
18150
20843
  const prefixPath = this.target === "draft-2020-12" ? "prefixItems" : "items";
18151
20844
  const restPath = this.target === "draft-2020-12" ? "items" : this.target === "openapi-3.0" ? "items" : "additionalItems";
18152
- const prefixItems = def.items.map((x2, i) => this.process(x2, {
20845
+ const prefixItems = def.items.map((x2, i2) => this.process(x2, {
18153
20846
  ...params,
18154
- path: [...params.path, prefixPath, i]
20847
+ path: [...params.path, prefixPath, i2]
18155
20848
  }));
18156
20849
  const rest = def.rest ? this.process(def.rest, {
18157
20850
  ...params,
18158
20851
  path: [...params.path, restPath, ...this.target === "openapi-3.0" ? [def.items.length] : []]
18159
20852
  }) : null;
18160
20853
  if (this.target === "draft-2020-12") {
18161
- json.prefixItems = prefixItems;
20854
+ json2.prefixItems = prefixItems;
18162
20855
  if (rest) {
18163
- json.items = rest;
20856
+ json2.items = rest;
18164
20857
  }
18165
20858
  } else if (this.target === "openapi-3.0") {
18166
- json.items = {
20859
+ json2.items = {
18167
20860
  anyOf: prefixItems
18168
20861
  };
18169
20862
  if (rest) {
18170
- json.items.anyOf.push(rest);
20863
+ json2.items.anyOf.push(rest);
18171
20864
  }
18172
- json.minItems = prefixItems.length;
20865
+ json2.minItems = prefixItems.length;
18173
20866
  if (!rest) {
18174
- json.maxItems = prefixItems.length;
20867
+ json2.maxItems = prefixItems.length;
18175
20868
  }
18176
20869
  } else {
18177
- json.items = prefixItems;
20870
+ json2.items = prefixItems;
18178
20871
  if (rest) {
18179
- json.additionalItems = rest;
20872
+ json2.additionalItems = rest;
18180
20873
  }
18181
20874
  }
18182
- const { minimum, maximum } = schema._zod.bag;
20875
+ const { minimum, maximum } = schema2._zod.bag;
18183
20876
  if (typeof minimum === "number")
18184
- json.minItems = minimum;
20877
+ json2.minItems = minimum;
18185
20878
  if (typeof maximum === "number")
18186
- json.maxItems = maximum;
20879
+ json2.maxItems = maximum;
18187
20880
  break;
18188
20881
  }
18189
20882
  case "record": {
18190
- const json = _json;
18191
- json.type = "object";
20883
+ const json2 = _json;
20884
+ json2.type = "object";
18192
20885
  if (this.target === "draft-7" || this.target === "draft-2020-12") {
18193
- json.propertyNames = this.process(def.keyType, {
20886
+ json2.propertyNames = this.process(def.keyType, {
18194
20887
  ...params,
18195
20888
  path: [...params.path, "propertyNames"]
18196
20889
  });
18197
20890
  }
18198
- json.additionalProperties = this.process(def.valueType, {
20891
+ json2.additionalProperties = this.process(def.valueType, {
18199
20892
  ...params,
18200
20893
  path: [...params.path, "additionalProperties"]
18201
20894
  });
@@ -18214,17 +20907,17 @@ class JSONSchemaGenerator {
18214
20907
  break;
18215
20908
  }
18216
20909
  case "enum": {
18217
- const json = _json;
20910
+ const json2 = _json;
18218
20911
  const values = getEnumValues(def.entries);
18219
20912
  if (values.every((v) => typeof v === "number"))
18220
- json.type = "number";
20913
+ json2.type = "number";
18221
20914
  if (values.every((v) => typeof v === "string"))
18222
- json.type = "string";
18223
- json.enum = values;
20915
+ json2.type = "string";
20916
+ json2.enum = values;
18224
20917
  break;
18225
20918
  }
18226
20919
  case "literal": {
18227
- const json = _json;
20920
+ const json2 = _json;
18228
20921
  const vals = [];
18229
20922
  for (const val of def.values) {
18230
20923
  if (val === undefined) {
@@ -18243,33 +20936,33 @@ class JSONSchemaGenerator {
18243
20936
  }
18244
20937
  if (vals.length === 0) {} else if (vals.length === 1) {
18245
20938
  const val = vals[0];
18246
- json.type = val === null ? "null" : typeof val;
20939
+ json2.type = val === null ? "null" : typeof val;
18247
20940
  if (this.target === "draft-4" || this.target === "openapi-3.0") {
18248
- json.enum = [val];
20941
+ json2.enum = [val];
18249
20942
  } else {
18250
- json.const = val;
20943
+ json2.const = val;
18251
20944
  }
18252
20945
  } else {
18253
20946
  if (vals.every((v) => typeof v === "number"))
18254
- json.type = "number";
20947
+ json2.type = "number";
18255
20948
  if (vals.every((v) => typeof v === "string"))
18256
- json.type = "string";
20949
+ json2.type = "string";
18257
20950
  if (vals.every((v) => typeof v === "boolean"))
18258
- json.type = "string";
20951
+ json2.type = "string";
18259
20952
  if (vals.every((v) => v === null))
18260
- json.type = "null";
18261
- json.enum = vals;
20953
+ json2.type = "null";
20954
+ json2.enum = vals;
18262
20955
  }
18263
20956
  break;
18264
20957
  }
18265
20958
  case "file": {
18266
- const json = _json;
20959
+ const json2 = _json;
18267
20960
  const file = {
18268
20961
  type: "string",
18269
20962
  format: "binary",
18270
20963
  contentEncoding: "binary"
18271
20964
  };
18272
- const { minimum, maximum, mime } = schema._zod.bag;
20965
+ const { minimum, maximum, mime } = schema2._zod.bag;
18273
20966
  if (minimum !== undefined)
18274
20967
  file.minLength = minimum;
18275
20968
  if (maximum !== undefined)
@@ -18277,15 +20970,15 @@ class JSONSchemaGenerator {
18277
20970
  if (mime) {
18278
20971
  if (mime.length === 1) {
18279
20972
  file.contentMediaType = mime[0];
18280
- Object.assign(json, file);
20973
+ Object.assign(json2, file);
18281
20974
  } else {
18282
- json.anyOf = mime.map((m2) => {
20975
+ json2.anyOf = mime.map((m2) => {
18283
20976
  const mFile = { ...file, contentMediaType: m2 };
18284
20977
  return mFile;
18285
20978
  });
18286
20979
  }
18287
20980
  } else {
18288
- Object.assign(json, file);
20981
+ Object.assign(json2, file);
18289
20982
  }
18290
20983
  break;
18291
20984
  }
@@ -18311,8 +21004,8 @@ class JSONSchemaGenerator {
18311
21004
  break;
18312
21005
  }
18313
21006
  case "success": {
18314
- const json = _json;
18315
- json.type = "boolean";
21007
+ const json2 = _json;
21008
+ json2.type = "boolean";
18316
21009
  break;
18317
21010
  }
18318
21011
  case "default": {
@@ -18347,12 +21040,12 @@ class JSONSchemaGenerator {
18347
21040
  break;
18348
21041
  }
18349
21042
  case "template_literal": {
18350
- const json = _json;
18351
- const pattern = schema._zod.pattern;
21043
+ const json2 = _json;
21044
+ const pattern = schema2._zod.pattern;
18352
21045
  if (!pattern)
18353
21046
  throw new Error("Pattern not found in template literal");
18354
- json.type = "string";
18355
- json.pattern = pattern.source;
21047
+ json2.type = "string";
21048
+ json2.pattern = pattern.source;
18356
21049
  break;
18357
21050
  }
18358
21051
  case "pipe": {
@@ -18378,7 +21071,7 @@ class JSONSchemaGenerator {
18378
21071
  break;
18379
21072
  }
18380
21073
  case "lazy": {
18381
- const innerType = schema._zod.innerType;
21074
+ const innerType = schema2._zod.innerType;
18382
21075
  this.process(innerType, params);
18383
21076
  result.ref = innerType;
18384
21077
  break;
@@ -18399,26 +21092,26 @@ class JSONSchemaGenerator {
18399
21092
  }
18400
21093
  }
18401
21094
  }
18402
- const meta = this.metadataRegistry.get(schema);
21095
+ const meta = this.metadataRegistry.get(schema2);
18403
21096
  if (meta)
18404
21097
  Object.assign(result.schema, meta);
18405
- if (this.io === "input" && isTransforming(schema)) {
21098
+ if (this.io === "input" && isTransforming(schema2)) {
18406
21099
  delete result.schema.examples;
18407
21100
  delete result.schema.default;
18408
21101
  }
18409
21102
  if (this.io === "input" && result.schema._prefault)
18410
21103
  (_a = result.schema).default ?? (_a.default = result.schema._prefault);
18411
21104
  delete result.schema._prefault;
18412
- const _result = this.seen.get(schema);
21105
+ const _result = this.seen.get(schema2);
18413
21106
  return _result.schema;
18414
21107
  }
18415
- emit(schema, _params) {
21108
+ emit(schema2, _params) {
18416
21109
  const params = {
18417
21110
  cycles: _params?.cycles ?? "ref",
18418
21111
  reused: _params?.reused ?? "inline",
18419
21112
  external: _params?.external ?? undefined
18420
21113
  };
18421
- const root = this.seen.get(schema);
21114
+ const root = this.seen.get(schema2);
18422
21115
  if (!root)
18423
21116
  throw new Error("Unprocessed schema. This is a bug in Zod.");
18424
21117
  const makeURI = (entry) => {
@@ -18450,11 +21143,11 @@ class JSONSchemaGenerator {
18450
21143
  seen.def = { ...seen.schema };
18451
21144
  if (defId)
18452
21145
  seen.defId = defId;
18453
- const schema2 = seen.schema;
18454
- for (const key in schema2) {
18455
- delete schema2[key];
21146
+ const schema3 = seen.schema;
21147
+ for (const key in schema3) {
21148
+ delete schema3[key];
18456
21149
  }
18457
- schema2.$ref = ref;
21150
+ schema3.$ref = ref;
18458
21151
  };
18459
21152
  if (params.cycles === "throw") {
18460
21153
  for (const entry of this.seen.entries()) {
@@ -18466,13 +21159,13 @@ class JSONSchemaGenerator {
18466
21159
  }
18467
21160
  for (const entry of this.seen.entries()) {
18468
21161
  const seen = entry[1];
18469
- if (schema === entry[0]) {
21162
+ if (schema2 === entry[0]) {
18470
21163
  extractToDef(entry);
18471
21164
  continue;
18472
21165
  }
18473
21166
  if (params.external) {
18474
21167
  const ext = params.external.registry.get(entry[0])?.id;
18475
- if (schema !== entry[0] && ext) {
21168
+ if (schema2 !== entry[0] && ext) {
18476
21169
  extractToDef(entry);
18477
21170
  continue;
18478
21171
  }
@@ -18495,8 +21188,8 @@ class JSONSchemaGenerator {
18495
21188
  }
18496
21189
  const flattenRef = (zodSchema, params2) => {
18497
21190
  const seen = this.seen.get(zodSchema);
18498
- const schema2 = seen.def ?? seen.schema;
18499
- const _cached = { ...schema2 };
21191
+ const schema3 = seen.def ?? seen.schema;
21192
+ const _cached = { ...schema3 };
18500
21193
  if (seen.ref === null) {
18501
21194
  return;
18502
21195
  }
@@ -18506,17 +21199,17 @@ class JSONSchemaGenerator {
18506
21199
  flattenRef(ref, params2);
18507
21200
  const refSchema = this.seen.get(ref).schema;
18508
21201
  if (refSchema.$ref && (params2.target === "draft-7" || params2.target === "draft-4" || params2.target === "openapi-3.0")) {
18509
- schema2.allOf = schema2.allOf ?? [];
18510
- schema2.allOf.push(refSchema);
21202
+ schema3.allOf = schema3.allOf ?? [];
21203
+ schema3.allOf.push(refSchema);
18511
21204
  } else {
18512
- Object.assign(schema2, refSchema);
18513
- Object.assign(schema2, _cached);
21205
+ Object.assign(schema3, refSchema);
21206
+ Object.assign(schema3, _cached);
18514
21207
  }
18515
21208
  }
18516
21209
  if (!seen.isParent)
18517
21210
  this.override({
18518
21211
  zodSchema,
18519
- jsonSchema: schema2,
21212
+ jsonSchema: schema3,
18520
21213
  path: seen.path ?? []
18521
21214
  });
18522
21215
  };
@@ -18534,7 +21227,7 @@ class JSONSchemaGenerator {
18534
21227
  console.warn(`Invalid target: ${this.target}`);
18535
21228
  }
18536
21229
  if (params.external?.uri) {
18537
- const id = params.external.registry.get(schema)?.id;
21230
+ const id = params.external.registry.get(schema2)?.id;
18538
21231
  if (!id)
18539
21232
  throw new Error("Schema is missing an `id` property");
18540
21233
  result.$id = params.external.uri(id);
@@ -18568,8 +21261,8 @@ function toJSONSchema(input, _params) {
18568
21261
  const gen2 = new JSONSchemaGenerator(_params);
18569
21262
  const defs = {};
18570
21263
  for (const entry of input._idmap.entries()) {
18571
- const [_3, schema] = entry;
18572
- gen2.process(schema);
21264
+ const [_3, schema2] = entry;
21265
+ gen2.process(schema2);
18573
21266
  }
18574
21267
  const schemas = {};
18575
21268
  const external = {
@@ -18578,8 +21271,8 @@ function toJSONSchema(input, _params) {
18578
21271
  defs
18579
21272
  };
18580
21273
  for (const entry of input._idmap.entries()) {
18581
- const [key, schema] = entry;
18582
- schemas[key] = gen2.emit(schema, {
21274
+ const [key, schema2] = entry;
21275
+ schemas[key] = gen2.emit(schema2, {
18583
21276
  ..._params,
18584
21277
  external
18585
21278
  });
@@ -18601,8 +21294,8 @@ function isTransforming(_schema, _ctx) {
18601
21294
  if (ctx.seen.has(_schema))
18602
21295
  return false;
18603
21296
  ctx.seen.add(_schema);
18604
- const schema = _schema;
18605
- const def = schema._zod.def;
21297
+ const schema2 = _schema;
21298
+ const def = schema2._zod.def;
18606
21299
  switch (def.type) {
18607
21300
  case "string":
18608
21301
  case "number":
@@ -18745,7 +21438,7 @@ var initializer2 = (inst, issues) => {
18745
21438
  inst.name = "ZodError";
18746
21439
  Object.defineProperties(inst, {
18747
21440
  format: {
18748
- value: (mapper) => formatError(inst, mapper)
21441
+ value: (mapper) => formatError2(inst, mapper)
18749
21442
  },
18750
21443
  flatten: {
18751
21444
  value: (mapper) => flattenError(inst, mapper)
@@ -18833,7 +21526,7 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
18833
21526
  inst.or = (arg) => union([inst, arg]);
18834
21527
  inst.and = (arg) => intersection(inst, arg);
18835
21528
  inst.transform = (tx) => pipe(inst, transform(tx));
18836
- inst.default = (def2) => _default2(inst, def2);
21529
+ inst.default = (def2) => _default3(inst, def2);
18837
21530
  inst.prefault = (def2) => prefault(inst, def2);
18838
21531
  inst.catch = (params) => _catch2(inst, params);
18839
21532
  inst.pipe = (target) => pipe(inst, target);
@@ -19100,8 +21793,8 @@ var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
19100
21793
  inst.lt = (value, params) => inst.check(_lt(value, params));
19101
21794
  inst.lte = (value, params) => inst.check(_lte(value, params));
19102
21795
  inst.max = (value, params) => inst.check(_lte(value, params));
19103
- inst.int = (params) => inst.check(int(params));
19104
- inst.safe = (params) => inst.check(int(params));
21796
+ inst.int = (params) => inst.check(int2(params));
21797
+ inst.safe = (params) => inst.check(int2(params));
19105
21798
  inst.positive = (params) => inst.check(_gt(0, params));
19106
21799
  inst.nonnegative = (params) => inst.check(_gte(0, params));
19107
21800
  inst.negative = (params) => inst.check(_lt(0, params));
@@ -19123,7 +21816,7 @@ var ZodNumberFormat = /* @__PURE__ */ $constructor("ZodNumberFormat", (inst, def
19123
21816
  $ZodNumberFormat.init(inst, def);
19124
21817
  ZodNumber.init(inst, def);
19125
21818
  });
19126
- function int(params) {
21819
+ function int2(params) {
19127
21820
  return _int(ZodNumberFormat, params);
19128
21821
  }
19129
21822
  function float32(params) {
@@ -19197,8 +21890,8 @@ var ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
19197
21890
  $ZodNull.init(inst, def);
19198
21891
  ZodType.init(inst, def);
19199
21892
  });
19200
- function _null3(params) {
19201
- return _null2(ZodNull, params);
21893
+ function _null4(params) {
21894
+ return _null3(ZodNull, params);
19202
21895
  }
19203
21896
  var ZodAny = /* @__PURE__ */ $constructor("ZodAny", (inst, def) => {
19204
21897
  $ZodAny.init(inst, def);
@@ -19253,8 +21946,8 @@ var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
19253
21946
  function array(element, params) {
19254
21947
  return _array(ZodArray, element, params);
19255
21948
  }
19256
- function keyof(schema) {
19257
- const shape = schema._zod.def.shape;
21949
+ function keyof(schema2) {
21950
+ const shape = schema2._zod.def.shape;
19258
21951
  return _enum2(Object.keys(shape));
19259
21952
  }
19260
21953
  var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
@@ -19396,7 +22089,7 @@ var ZodMap = /* @__PURE__ */ $constructor("ZodMap", (inst, def) => {
19396
22089
  inst.keyType = def.keyType;
19397
22090
  inst.valueType = def.valueType;
19398
22091
  });
19399
- function map(keyType, valueType, params) {
22092
+ function map2(keyType, valueType, params) {
19400
22093
  return new ZodMap({
19401
22094
  type: "map",
19402
22095
  keyType,
@@ -19412,7 +22105,7 @@ var ZodSet = /* @__PURE__ */ $constructor("ZodSet", (inst, def) => {
19412
22105
  inst.max = (...args) => inst.check(_maxSize(...args));
19413
22106
  inst.size = (...args) => inst.check(_size(...args));
19414
22107
  });
19415
- function set(valueType, params) {
22108
+ function set2(valueType, params) {
19416
22109
  return new ZodSet({
19417
22110
  type: "set",
19418
22111
  valueType,
@@ -19569,7 +22262,7 @@ var ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
19569
22262
  inst.unwrap = () => inst._zod.def.innerType;
19570
22263
  inst.removeDefault = inst.unwrap;
19571
22264
  });
19572
- function _default2(innerType, defaultValue) {
22265
+ function _default3(innerType, defaultValue) {
19573
22266
  return new ZodDefault({
19574
22267
  type: "default",
19575
22268
  innerType,
@@ -19754,14 +22447,14 @@ var stringbool = (...args) => _stringbool({
19754
22447
  Boolean: ZodBoolean,
19755
22448
  String: ZodString
19756
22449
  }, ...args);
19757
- function json(params) {
22450
+ function json2(params) {
19758
22451
  const jsonSchema = lazy(() => {
19759
- return union([string2(params), number2(), boolean2(), _null3(), array(jsonSchema), record(string2(), jsonSchema)]);
22452
+ return union([string2(params), number2(), boolean2(), _null4(), array(jsonSchema), record(string2(), jsonSchema)]);
19760
22453
  });
19761
22454
  return jsonSchema;
19762
22455
  }
19763
- function preprocess(fn, schema) {
19764
- return pipe(transform(fn), schema);
22456
+ function preprocess(fn, schema2) {
22457
+ return pipe(transform(fn), schema2);
19765
22458
  }
19766
22459
  // node_modules/zod/v4/classic/compat.js
19767
22460
  var ZodIssueCode = {
@@ -19777,9 +22470,9 @@ var ZodIssueCode = {
19777
22470
  invalid_value: "invalid_value",
19778
22471
  custom: "custom"
19779
22472
  };
19780
- function setErrorMap(map2) {
22473
+ function setErrorMap(map3) {
19781
22474
  config({
19782
- customError: map2
22475
+ customError: map3
19783
22476
  });
19784
22477
  }
19785
22478
  function getErrorMap() {
@@ -19839,6 +22532,9 @@ var BuiltinAgentNameSchema = exports_external.enum([
19839
22532
  "document-writer",
19840
22533
  "multimodal-looker"
19841
22534
  ]);
22535
+ var BuiltinSkillNameSchema = exports_external.enum([
22536
+ "playwright"
22537
+ ]);
19842
22538
  var OverridableAgentNameSchema = exports_external.enum([
19843
22539
  "build",
19844
22540
  "plan",
@@ -19878,7 +22574,8 @@ var HookNameSchema = exports_external.enum([
19878
22574
  "ralph-loop",
19879
22575
  "preemptive-compaction",
19880
22576
  "compaction-context-injector",
19881
- "claude-code-hooks"
22577
+ "claude-code-hooks",
22578
+ "auto-slash-command"
19882
22579
  ]);
19883
22580
  var BuiltinCommandNameSchema = exports_external.enum([
19884
22581
  "init-deep"
@@ -20010,6 +22707,7 @@ var OhMyOpenCodeConfigSchema = exports_external.object({
20010
22707
  $schema: exports_external.string().optional(),
20011
22708
  disabled_mcps: exports_external.array(McpNameSchema).optional(),
20012
22709
  disabled_agents: exports_external.array(BuiltinAgentNameSchema).optional(),
22710
+ disabled_skills: exports_external.array(BuiltinSkillNameSchema).optional(),
20013
22711
  disabled_hooks: exports_external.array(HookNameSchema).optional(),
20014
22712
  disabled_commands: exports_external.array(BuiltinCommandNameSchema).optional(),
20015
22713
  agents: AgentOverridesSchema.optional(),
@@ -20023,7 +22721,7 @@ var OhMyOpenCodeConfigSchema = exports_external.object({
20023
22721
  ralph_loop: RalphLoopConfigSchema.optional()
20024
22722
  });
20025
22723
  // src/cli/doctor/checks/config.ts
20026
- var USER_CONFIG_DIR2 = join6(homedir4(), ".config", "opencode");
22724
+ var USER_CONFIG_DIR2 = join6(homedir5(), ".config", "opencode");
20027
22725
  var USER_CONFIG_BASE = join6(USER_CONFIG_DIR2, `${PACKAGE_NAME2}`);
20028
22726
  var PROJECT_CONFIG_BASE = join6(process.cwd(), ".opencode", PACKAGE_NAME2);
20029
22727
  function findConfigPath() {
@@ -20043,7 +22741,7 @@ function validateConfig(configPath) {
20043
22741
  const rawConfig = parseJsonc(content);
20044
22742
  const result = OhMyOpenCodeConfigSchema.safeParse(rawConfig);
20045
22743
  if (!result.success) {
20046
- const errors3 = result.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`);
22744
+ const errors3 = result.error.issues.map((i2) => `${i2.path.join(".")}: ${i2.message}`);
20047
22745
  return { valid: false, errors: errors3 };
20048
22746
  }
20049
22747
  return { valid: true, errors: [] };
@@ -20065,7 +22763,7 @@ function getConfigInfo() {
20065
22763
  errors: []
20066
22764
  };
20067
22765
  }
20068
- if (!existsSync5(configPath.path)) {
22766
+ if (!existsSync6(configPath.path)) {
20069
22767
  return {
20070
22768
  exists: false,
20071
22769
  path: configPath.path,
@@ -20122,10 +22820,10 @@ function getConfigCheckDefinition() {
20122
22820
  }
20123
22821
 
20124
22822
  // src/cli/doctor/checks/auth.ts
20125
- import { existsSync as existsSync6, readFileSync as readFileSync6 } from "fs";
20126
- import { homedir as homedir5 } from "os";
22823
+ import { existsSync as existsSync7, readFileSync as readFileSync6 } from "fs";
22824
+ import { homedir as homedir6 } from "os";
20127
22825
  import { join as join7 } from "path";
20128
- var OPENCODE_CONFIG_DIR3 = join7(homedir5(), ".config", "opencode");
22826
+ var OPENCODE_CONFIG_DIR3 = join7(homedir6(), ".config", "opencode");
20129
22827
  var OPENCODE_JSON3 = join7(OPENCODE_CONFIG_DIR3, "opencode.json");
20130
22828
  var OPENCODE_JSONC3 = join7(OPENCODE_CONFIG_DIR3, "opencode.jsonc");
20131
22829
  var AUTH_PLUGINS = {
@@ -20134,8 +22832,8 @@ var AUTH_PLUGINS = {
20134
22832
  google: { plugin: "opencode-antigravity-auth", name: "Google (Gemini)" }
20135
22833
  };
20136
22834
  function getOpenCodeConfig() {
20137
- const configPath = existsSync6(OPENCODE_JSONC3) ? OPENCODE_JSONC3 : OPENCODE_JSON3;
20138
- if (!existsSync6(configPath))
22835
+ const configPath = existsSync7(OPENCODE_JSONC3) ? OPENCODE_JSONC3 : OPENCODE_JSON3;
22836
+ if (!existsSync7(configPath))
20139
22837
  return null;
20140
22838
  try {
20141
22839
  const content = readFileSync6(configPath, "utf-8");
@@ -20221,9 +22919,9 @@ function getAuthCheckDefinitions() {
20221
22919
  }
20222
22920
 
20223
22921
  // src/cli/doctor/checks/dependencies.ts
20224
- async function checkBinaryExists(binary) {
22922
+ async function checkBinaryExists(binary2) {
20225
22923
  try {
20226
- const proc = Bun.spawn(["which", binary], { stdout: "pipe", stderr: "pipe" });
22924
+ const proc = Bun.spawn(["which", binary2], { stdout: "pipe", stderr: "pipe" });
20227
22925
  const output = await new Response(proc.stdout).text();
20228
22926
  await proc.exited;
20229
22927
  if (proc.exitCode === 0) {
@@ -20232,9 +22930,9 @@ async function checkBinaryExists(binary) {
20232
22930
  } catch {}
20233
22931
  return { exists: false, path: null };
20234
22932
  }
20235
- async function getBinaryVersion(binary) {
22933
+ async function getBinaryVersion(binary2) {
20236
22934
  try {
20237
- const proc = Bun.spawn([binary, "--version"], { stdout: "pipe", stderr: "pipe" });
22935
+ const proc = Bun.spawn([binary2, "--version"], { stdout: "pipe", stderr: "pipe" });
20238
22936
  const output = await new Response(proc.stdout).text();
20239
22937
  await proc.exited;
20240
22938
  if (proc.exitCode === 0) {
@@ -20247,8 +22945,8 @@ async function getBinaryVersion(binary) {
20247
22945
  async function checkAstGrepCli() {
20248
22946
  const binaryCheck = await checkBinaryExists("sg");
20249
22947
  const altBinaryCheck = !binaryCheck.exists ? await checkBinaryExists("ast-grep") : null;
20250
- const binary = binaryCheck.exists ? binaryCheck : altBinaryCheck;
20251
- if (!binary || !binary.exists) {
22948
+ const binary2 = binaryCheck.exists ? binaryCheck : altBinaryCheck;
22949
+ if (!binary2 || !binary2.exists) {
20252
22950
  return {
20253
22951
  name: "AST-Grep CLI",
20254
22952
  required: false,
@@ -20258,13 +22956,13 @@ async function checkAstGrepCli() {
20258
22956
  installHint: "Install: npm install -g @ast-grep/cli"
20259
22957
  };
20260
22958
  }
20261
- const version2 = await getBinaryVersion(binary.path);
22959
+ const version2 = await getBinaryVersion(binary2.path);
20262
22960
  return {
20263
22961
  name: "AST-Grep CLI",
20264
22962
  required: false,
20265
22963
  installed: true,
20266
22964
  version: version2,
20267
- path: binary.path
22965
+ path: binary2.path
20268
22966
  };
20269
22967
  }
20270
22968
  function checkAstGrepNapi() {
@@ -20363,6 +23061,139 @@ function getDependencyCheckDefinitions() {
20363
23061
  ];
20364
23062
  }
20365
23063
 
23064
+ // src/cli/doctor/checks/gh.ts
23065
+ async function checkBinaryExists2(binary2) {
23066
+ try {
23067
+ const proc = Bun.spawn(["which", binary2], { stdout: "pipe", stderr: "pipe" });
23068
+ const output = await new Response(proc.stdout).text();
23069
+ await proc.exited;
23070
+ if (proc.exitCode === 0) {
23071
+ return { exists: true, path: output.trim() };
23072
+ }
23073
+ } catch {}
23074
+ return { exists: false, path: null };
23075
+ }
23076
+ async function getGhVersion() {
23077
+ try {
23078
+ const proc = Bun.spawn(["gh", "--version"], { stdout: "pipe", stderr: "pipe" });
23079
+ const output = await new Response(proc.stdout).text();
23080
+ await proc.exited;
23081
+ if (proc.exitCode === 0) {
23082
+ const match = output.match(/gh version (\S+)/);
23083
+ return match?.[1] ?? output.trim().split(`
23084
+ `)[0];
23085
+ }
23086
+ } catch {}
23087
+ return null;
23088
+ }
23089
+ async function getGhAuthStatus() {
23090
+ try {
23091
+ const proc = Bun.spawn(["gh", "auth", "status"], {
23092
+ stdout: "pipe",
23093
+ stderr: "pipe",
23094
+ env: { ...process.env, GH_NO_UPDATE_NOTIFIER: "1" }
23095
+ });
23096
+ const stdout = await new Response(proc.stdout).text();
23097
+ const stderr = await new Response(proc.stderr).text();
23098
+ await proc.exited;
23099
+ const output = stderr || stdout;
23100
+ if (proc.exitCode === 0) {
23101
+ const usernameMatch = output.match(/Logged in to github\.com account (\S+)/);
23102
+ const username = usernameMatch?.[1]?.replace(/[()]/g, "") ?? null;
23103
+ const scopesMatch = output.match(/Token scopes?:\s*(.+)/i);
23104
+ const scopes = scopesMatch?.[1] ? scopesMatch[1].split(/,\s*/).map((s) => s.replace(/['"]/g, "").trim()).filter(Boolean) : [];
23105
+ return { authenticated: true, username, scopes, error: null };
23106
+ }
23107
+ const errorMatch = output.match(/error[:\s]+(.+)/i);
23108
+ return {
23109
+ authenticated: false,
23110
+ username: null,
23111
+ scopes: [],
23112
+ error: errorMatch?.[1]?.trim() ?? "Not authenticated"
23113
+ };
23114
+ } catch (err) {
23115
+ return {
23116
+ authenticated: false,
23117
+ username: null,
23118
+ scopes: [],
23119
+ error: err instanceof Error ? err.message : "Failed to check auth status"
23120
+ };
23121
+ }
23122
+ }
23123
+ async function getGhCliInfo() {
23124
+ const binaryCheck = await checkBinaryExists2("gh");
23125
+ if (!binaryCheck.exists) {
23126
+ return {
23127
+ installed: false,
23128
+ version: null,
23129
+ path: null,
23130
+ authenticated: false,
23131
+ username: null,
23132
+ scopes: [],
23133
+ error: null
23134
+ };
23135
+ }
23136
+ const [version2, authStatus] = await Promise.all([getGhVersion(), getGhAuthStatus()]);
23137
+ return {
23138
+ installed: true,
23139
+ version: version2,
23140
+ path: binaryCheck.path,
23141
+ authenticated: authStatus.authenticated,
23142
+ username: authStatus.username,
23143
+ scopes: authStatus.scopes,
23144
+ error: authStatus.error
23145
+ };
23146
+ }
23147
+ async function checkGhCli() {
23148
+ const info = await getGhCliInfo();
23149
+ const name = CHECK_NAMES[CHECK_IDS.GH_CLI];
23150
+ if (!info.installed) {
23151
+ return {
23152
+ name,
23153
+ status: "warn",
23154
+ message: "Not installed (optional)",
23155
+ details: [
23156
+ "GitHub CLI is used by librarian agent and scripts",
23157
+ "Install: https://cli.github.com/"
23158
+ ]
23159
+ };
23160
+ }
23161
+ if (!info.authenticated) {
23162
+ return {
23163
+ name,
23164
+ status: "warn",
23165
+ message: `${info.version ?? "installed"} - not authenticated`,
23166
+ details: [
23167
+ info.path ? `Path: ${info.path}` : null,
23168
+ "Authenticate: gh auth login",
23169
+ info.error ? `Error: ${info.error}` : null
23170
+ ].filter((d3) => d3 !== null)
23171
+ };
23172
+ }
23173
+ const details = [];
23174
+ if (info.path)
23175
+ details.push(`Path: ${info.path}`);
23176
+ if (info.username)
23177
+ details.push(`Account: ${info.username}`);
23178
+ if (info.scopes.length > 0)
23179
+ details.push(`Scopes: ${info.scopes.join(", ")}`);
23180
+ return {
23181
+ name,
23182
+ status: "pass",
23183
+ message: `${info.version ?? "installed"} - authenticated as ${info.username ?? "unknown"}`,
23184
+ details: details.length > 0 ? details : undefined
23185
+ };
23186
+ }
23187
+ function getGhCliCheckDefinition() {
23188
+ return {
23189
+ id: CHECK_IDS.GH_CLI,
23190
+ name: CHECK_NAMES[CHECK_IDS.GH_CLI],
23191
+ category: "tools",
23192
+ check: checkGhCli,
23193
+ critical: false
23194
+ };
23195
+ }
23196
+
20366
23197
  // src/cli/doctor/checks/lsp.ts
20367
23198
  var DEFAULT_LSP_SERVERS = [
20368
23199
  { id: "typescript-language-server", binary: "typescript-language-server", extensions: [".ts", ".tsx", ".js", ".jsx"] },
@@ -20370,9 +23201,9 @@ var DEFAULT_LSP_SERVERS = [
20370
23201
  { id: "rust-analyzer", binary: "rust-analyzer", extensions: [".rs"] },
20371
23202
  { id: "gopls", binary: "gopls", extensions: [".go"] }
20372
23203
  ];
20373
- async function checkBinaryExists2(binary) {
23204
+ async function checkBinaryExists3(binary2) {
20374
23205
  try {
20375
- const proc = Bun.spawn(["which", binary], { stdout: "pipe", stderr: "pipe" });
23206
+ const proc = Bun.spawn(["which", binary2], { stdout: "pipe", stderr: "pipe" });
20376
23207
  await proc.exited;
20377
23208
  return proc.exitCode === 0;
20378
23209
  } catch {
@@ -20382,7 +23213,7 @@ async function checkBinaryExists2(binary) {
20382
23213
  async function getLspServersInfo() {
20383
23214
  const servers = [];
20384
23215
  for (const server2 of DEFAULT_LSP_SERVERS) {
20385
- const installed = await checkBinaryExists2(server2.binary);
23216
+ const installed = await checkBinaryExists3(server2.binary);
20386
23217
  servers.push({
20387
23218
  id: server2.id,
20388
23219
  installed,
@@ -20434,19 +23265,19 @@ function getLspCheckDefinition() {
20434
23265
  }
20435
23266
 
20436
23267
  // src/cli/doctor/checks/mcp.ts
20437
- import { existsSync as existsSync7, readFileSync as readFileSync7 } from "fs";
20438
- import { homedir as homedir6 } from "os";
23268
+ import { existsSync as existsSync8, readFileSync as readFileSync7 } from "fs";
23269
+ import { homedir as homedir7 } from "os";
20439
23270
  import { join as join8 } from "path";
20440
23271
  var BUILTIN_MCP_SERVERS = ["context7", "websearch_exa", "grep_app"];
20441
23272
  var MCP_CONFIG_PATHS = [
20442
- join8(homedir6(), ".claude", ".mcp.json"),
23273
+ join8(homedir7(), ".claude", ".mcp.json"),
20443
23274
  join8(process.cwd(), ".mcp.json"),
20444
23275
  join8(process.cwd(), ".claude", ".mcp.json")
20445
23276
  ];
20446
23277
  function loadUserMcpConfig() {
20447
23278
  const servers = {};
20448
23279
  for (const configPath of MCP_CONFIG_PATHS) {
20449
- if (!existsSync7(configPath))
23280
+ if (!existsSync8(configPath))
20450
23281
  continue;
20451
23282
  try {
20452
23283
  const content = readFileSync7(configPath, "utf-8");
@@ -20546,9 +23377,9 @@ function compareVersions2(current, latest) {
20546
23377
  };
20547
23378
  const curr = parseVersion(current);
20548
23379
  const lat = parseVersion(latest);
20549
- for (let i = 0;i < Math.max(curr.length, lat.length); i++) {
20550
- const c = curr[i] ?? 0;
20551
- const l2 = lat[i] ?? 0;
23380
+ for (let i2 = 0;i2 < Math.max(curr.length, lat.length); i2++) {
23381
+ const c = curr[i2] ?? 0;
23382
+ const l2 = lat[i2] ?? 0;
20552
23383
  if (c < l2)
20553
23384
  return false;
20554
23385
  if (c > l2)
@@ -20655,6 +23486,7 @@ function getAllCheckDefinitions() {
20655
23486
  getConfigCheckDefinition(),
20656
23487
  ...getAuthCheckDefinitions(),
20657
23488
  ...getDependencyCheckDefinitions(),
23489
+ getGhCliCheckDefinition(),
20658
23490
  getLspCheckDefinition(),
20659
23491
  ...getMcpCheckDefinitions(),
20660
23492
  getVersionCheckDefinition()