@cardenelabs/dragon 0.39.0 → 0.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -54,6 +54,8 @@ var ja = {
54
54
  const: (value2) => `${value2} \u306B\u3059\u308B`,
55
55
  not: (allowed) => allowed ? `${allowed.field} \u306E\u6B04\u306F kind \u304C ${allowed.kind} \u306E\u6642\u3060\u3051\u66F8\u3051\u308B` : "\u3053\u306E\u6B04\u306E\u7D44\u307F\u5408\u308F\u305B\u306F\u66F8\u3051\u306A\u3044",
56
56
  reserved: (names) => `${names.join(" \u3068 ")} \u306F\u72B6\u614B\u9077\u79FB\u56F3\u306E\u59CB\u307E\u308A\u3068\u7D42\u308F\u308A\u306E\u5370\u306E\u540D\u524D\u3067\u3001\u7BB1\u306E\u540D\u672D\u306B\u4F7F\u3048\u306A\u3044`,
57
+ kindOnly: (types, kind) => `${types.join(" \u3068 ")} \u306E\u51FA\u6765\u4E8B\u306F kind \u304C ${kind} \u306E\u6642\u3060\u3051\u66F8\u3051\u308B`,
58
+ hex: (min, max) => `0 \u304B\u3089 9 \u3068 a \u304B\u3089 f \u306E\u5B57\u3067 ${min} \u304B\u3089 ${max} \u5B57\u306B\u3059\u308B`,
57
59
  anyOf: (fields) => fields.length > 0 ? `${fields.join(" \u304B ")} \u306E${fields.length === 2 ? "\u3069\u3061\u3089\u304B" : "\u3069\u308C\u304B"}\u306E\u6B04\u304C\u8981\u308B` : "\u66F8\u3051\u308B\u5F62\u306E\u3069\u308C\u306B\u3082\u5408\u308F\u306A\u3044",
58
60
  oneOf: "\u66F8\u3051\u308B\u5F62\u306E\u3069\u308C\u304B 1 \u3064\u3060\u3051\u306B\u5408\u308F\u305B\u308B",
59
61
  discriminator: (tag, values) => `${tag} \u306F ${values.join(" / ")} \u306E\u3069\u308C\u304B\u306B\u3059\u308B`,
@@ -71,6 +73,8 @@ var en = {
71
73
  const: (value2) => `Use ${value2}`,
72
74
  not: (allowed) => allowed ? `The ${allowed.field} field is allowed only when kind is ${allowed.kind}` : "This combination of fields is not allowed",
73
75
  reserved: (names) => `${names.join(" and ")} name the start and end marks of a state diagram and cannot be box ids`,
76
+ kindOnly: (types, kind) => `${types.join(" and ")} events are allowed only when kind is ${kind}`,
77
+ hex: (min, max) => `Use ${min} to ${max} characters of 0-9 and a-f`,
74
78
  anyOf: (fields) => fields.length > 0 ? `Write one of the ${fields.join(" or ")} fields` : "Does not match any of the allowed shapes",
75
79
  oneOf: "Match exactly one of the allowed shapes",
76
80
  discriminator: (tag, values) => `${tag} is one of ${values.join(" / ")}`,
@@ -85,10 +89,10 @@ function ucs2length(str) {
85
89
  return length;
86
90
  }
87
91
  var validate_diagram_default = validate10;
88
- var schema11 = { "properties": { "version": { "description": "\u5F62\u5F0F\u306E\u7248", "type": "integer", "minimum": 1 }, "kind": { "description": "\u56F3\u306E\u7A2E\u985E", "enum": ["sequence", "architecture", "state"] }, "title": { "$ref": "#/definitions/text" }, "view": { "description": "\u898B\u305B\u65B9\u3002\u66F8\u304B\u306A\u3051\u308C\u3070\u5B57\u306E\u5927\u304D\u3055\u3067\u9078\u3076\u3002fixed \u306F\u5168\u4F53\u3092\u6B62\u3081\u3066\u4E2D\u3060\u3051\u52D5\u304B\u3057\u3001follow \u306F\u5BC4\u3063\u3066\u52D5\u304B\u3057\u5168\u4F53\u56F3\u3067\u4ECA\u3069\u3053\u304B\u3092\u793A\u3059", "enum": ["fixed", "follow"] }, "regions": { "type": "array", "items": { "$ref": "#/definitions/region" } }, "boxes": { "type": "array", "minItems": 1, "items": { "$ref": "#/definitions/box" } }, "strip": { "$ref": "#/definitions/strip" }, "steps": { "type": "array", "minItems": 1, "items": { "$ref": "#/definitions/step" } }, "sequence": { "$ref": "#/definitions/sequence" }, "state": { "$ref": "#/definitions/state" } }};
92
+ var schema11 = { "properties": { "version": { "description": "\u5F62\u5F0F\u306E\u7248", "type": "integer", "minimum": 1 }, "kind": { "description": "\u56F3\u306E\u7A2E\u985E", "enum": ["sequence", "architecture", "state", "git"] }, "title": { "$ref": "#/definitions/text" }, "view": { "description": "\u898B\u305B\u65B9\u3002\u66F8\u304B\u306A\u3051\u308C\u3070\u5B57\u306E\u5927\u304D\u3055\u3067\u9078\u3076\u3002fixed \u306F\u5168\u4F53\u3092\u6B62\u3081\u3066\u4E2D\u3060\u3051\u52D5\u304B\u3057\u3001follow \u306F\u5BC4\u3063\u3066\u52D5\u304B\u3057\u5168\u4F53\u56F3\u3067\u4ECA\u3069\u3053\u304B\u3092\u793A\u3059", "enum": ["fixed", "follow"] }, "regions": { "type": "array", "items": { "$ref": "#/definitions/region" } }, "boxes": { "type": "array", "items": { "$ref": "#/definitions/box" } }, "strip": { "$ref": "#/definitions/strip" }, "steps": { "type": "array", "minItems": 1, "items": { "$ref": "#/definitions/step" } }, "sequence": { "$ref": "#/definitions/sequence" }, "state": { "$ref": "#/definitions/state" }, "git": { "$ref": "#/definitions/git" } }};
89
93
  var func2 = Object.prototype.hasOwnProperty;
90
94
  var func3 = ucs2length;
91
- var schema17 = { "enum": ["blue", "amber", "green", "violet", "rose", "slate", "coin"] };
95
+ var schema28 = { "enum": ["blue", "amber", "green", "violet", "rose", "slate", "coin"] };
92
96
  var pattern0 = new RegExp("^[^\\s\\[\\]\u300C\u300D=:]+$", "u");
93
97
  function validate11(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
94
98
  let vErrors = null;
@@ -192,7 +196,7 @@ function validate11(data, { instancePath = "", parentData, parentDataProperty, r
192
196
  if (data.color !== void 0) {
193
197
  let data3 = data.color;
194
198
  if (!(data3 === "blue" || data3 === "amber" || data3 === "green" || data3 === "violet" || data3 === "rose" || data3 === "slate" || data3 === "coin")) {
195
- const err9 = { instancePath: instancePath + "/color", schemaPath: "#/definitions/color/enum", keyword: "enum", params: { allowedValues: schema17.enum }, message: "must be equal to one of the allowed values" };
199
+ const err9 = { instancePath: instancePath + "/color", schemaPath: "#/definitions/color/enum", keyword: "enum", params: { allowedValues: schema28.enum }, message: "must be equal to one of the allowed values" };
196
200
  if (vErrors === null) {
197
201
  vErrors = [err9];
198
202
  } else {
@@ -337,7 +341,7 @@ function validate13(data, { instancePath = "", parentData, parentDataProperty, r
337
341
  if (data.color !== void 0) {
338
342
  let data3 = data.color;
339
343
  if (!(data3 === "blue" || data3 === "amber" || data3 === "green" || data3 === "violet" || data3 === "rose" || data3 === "slate" || data3 === "coin")) {
340
- const err9 = { instancePath: instancePath + "/color", schemaPath: "#/definitions/color/enum", keyword: "enum", params: { allowedValues: schema17.enum }, message: "must be equal to one of the allowed values" };
344
+ const err9 = { instancePath: instancePath + "/color", schemaPath: "#/definitions/color/enum", keyword: "enum", params: { allowedValues: schema28.enum }, message: "must be equal to one of the allowed values" };
341
345
  if (vErrors === null) {
342
346
  vErrors = [err9];
343
347
  } else {
@@ -514,8 +518,9 @@ function validate15(data, { instancePath = "", parentData, parentDataProperty, r
514
518
  validate15.errors = vErrors;
515
519
  return errors === 0;
516
520
  }
517
- var schema33 = { "oneOf": [{ "description": "\u7DDA\u3002\u904B\u3076\u7269\u3092\u8F09\u305B\u3066\u9001\u308B\u5074\u304B\u3089\u53D7\u3051\u308B\u5074\u3078\u8D70\u308B", "type": "object", "additionalProperties": false, "required": ["type", "from", "to", "carry"], "properties": { "type": { "const": "edge" }, "from": { "$ref": "#/definitions/id" }, "to": { "$ref": "#/definitions/id" }, "label": { "$ref": "#/definitions/text" }, "carry": { "$ref": "#/definitions/carry" }, "labelSide": { "description": "\u7DDA\u306E\u540D\u524D\u3092\u7F6E\u304F\u5074 (\u5BC4\u305B\u306E\u6307\u793A)", "enum": ["above", "below", "left", "right"] } } }, { "description": "\u7BB1\u306E\u4E2D\u306E\u51E6\u7406", "type": "object", "additionalProperties": false, "required": ["type", "box", "label"], "properties": { "type": { "const": "action" }, "box": { "$ref": "#/definitions/id" }, "label": { "$ref": "#/definitions/text" } } }, { "description": "\u7BB1\u306E\u4E0B\u306E\u5C0F\u3055\u306A\u5B57\u306E\u66F8\u304D\u63DB\u3048", "type": "object", "additionalProperties": false, "required": ["type", "box", "text"], "properties": { "type": { "const": "swap" }, "box": { "$ref": "#/definitions/id" }, "text": { "$ref": "#/definitions/text" } } }, { "description": "\u4E2D\u8EAB\u306E\u5E2F\u306E\u6B04\u306E\u5024\u3068\u672D", "type": "object", "additionalProperties": false, "required": ["type", "field"], "anyOf": [{ "required": ["value"] }, { "required": ["tag"] }], "properties": { "type": { "const": "strip" }, "field": { "$ref": "#/definitions/text" }, "value": { "$ref": "#/definitions/text" }, "tag": { "$ref": "#/definitions/text" } } }] };
518
- var schema37 = { "properties": { "kind": { "enum": ["envelope", "tag", "coin", "none"] }}};
521
+ var schema44 = { "oneOf": [{ "description": "\u7DDA\u3002\u904B\u3076\u7269\u3092\u8F09\u305B\u3066\u9001\u308B\u5074\u304B\u3089\u53D7\u3051\u308B\u5074\u3078\u8D70\u308B", "type": "object", "additionalProperties": false, "required": ["type", "from", "to", "carry"], "properties": { "type": { "const": "edge" }, "from": { "$ref": "#/definitions/id" }, "to": { "$ref": "#/definitions/id" }, "label": { "$ref": "#/definitions/text" }, "carry": { "$ref": "#/definitions/carry" }, "labelSide": { "description": "\u7DDA\u306E\u540D\u524D\u3092\u7F6E\u304F\u5074 (\u5BC4\u305B\u306E\u6307\u793A)", "enum": ["above", "below", "left", "right"] } } }, { "description": "\u7BB1\u306E\u4E2D\u306E\u51E6\u7406", "type": "object", "additionalProperties": false, "required": ["type", "box", "label"], "properties": { "type": { "const": "action" }, "box": { "$ref": "#/definitions/id" }, "label": { "$ref": "#/definitions/text" } } }, { "description": "\u7BB1\u306E\u4E0B\u306E\u5C0F\u3055\u306A\u5B57\u306E\u66F8\u304D\u63DB\u3048", "type": "object", "additionalProperties": false, "required": ["type", "box", "text"], "properties": { "type": { "const": "swap" }, "box": { "$ref": "#/definitions/id" }, "text": { "$ref": "#/definitions/text" } } }, { "description": "commit \u3092\u7A4D\u3080\u3002\u679D\u5206\u304B\u308C\u306E\u56F3\u3060\u3051\u304C\u66F8\u3051\u308B\u3002\u7A4D\u3093\u3060\u679D\u306E\u672D\u3068\u3001\u305D\u306E\u679D\u3092\u6307\u3059 HEAD \u304C\u9032\u3080\u3002\u5F53\u3066\u76F4\u3057 (copy) \u306F\u679D\u306E\u672D\u3092\u52D5\u304B\u3055\u305A\u3001merge commit (merge) \u306F\u53D6\u308A\u8FBC\u3080\u679D\u306E\u5148\u7AEF\u3082\u89AA\u306B\u6301\u3064", "type": "object", "additionalProperties": false, "required": ["type", "id", "branch"], "properties": { "type": { "const": "commit" }, "id": { "$ref": "#/definitions/id" }, "branch": { "$ref": "#/definitions/id" }, "copy": { "$ref": "#/definitions/id" }, "merge": { "$ref": "#/definitions/id" }, "hash": { "$ref": "#/definitions/hash" }, "note": { "$ref": "#/definitions/text" } } }, { "description": "\u679D\u3092\u5207\u308B\u3002\u679D\u5206\u304B\u308C\u306E\u56F3\u3060\u3051\u304C\u66F8\u3051\u308B\u3002\u679D\u306E\u672D\u3092 from \u306E commit \u3078\u7F6E\u304D\u3001HEAD \u3092\u305D\u306E\u679D\u3078\u79FB\u3059", "type": "object", "additionalProperties": false, "required": ["type", "branch", "from"], "properties": { "type": { "const": "branch" }, "branch": { "$ref": "#/definitions/id" }, "from": { "$ref": "#/definitions/id" } } }, { "description": "\u4E2D\u8EAB\u306E\u5E2F\u306E\u6B04\u306E\u5024\u3068\u672D", "type": "object", "additionalProperties": false, "required": ["type", "field"], "anyOf": [{ "required": ["value"] }, { "required": ["tag"] }], "properties": { "type": { "const": "strip" }, "field": { "$ref": "#/definitions/text" }, "value": { "$ref": "#/definitions/text" }, "tag": { "$ref": "#/definitions/text" } } }] };
522
+ var pattern11 = new RegExp("^[0-9a-f]{4,40}$", "u");
523
+ var schema48 = { "properties": { "kind": { "enum": ["envelope", "tag", "coin", "none"] }}};
519
524
  function validate19(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
520
525
  let vErrors = null;
521
526
  let errors = 0;
@@ -642,7 +647,7 @@ function validate19(data, { instancePath = "", parentData, parentDataProperty, r
642
647
  if (data.kind !== void 0) {
643
648
  let data1 = data.kind;
644
649
  if (!(data1 === "envelope" || data1 === "tag" || data1 === "coin" || data1 === "none")) {
645
- const err8 = { instancePath: instancePath + "/kind", schemaPath: "#/properties/kind/enum", keyword: "enum", params: { allowedValues: schema37.properties.kind.enum }, message: "must be equal to one of the allowed values" };
650
+ const err8 = { instancePath: instancePath + "/kind", schemaPath: "#/properties/kind/enum", keyword: "enum", params: { allowedValues: schema48.properties.kind.enum }, message: "must be equal to one of the allowed values" };
646
651
  if (vErrors === null) {
647
652
  vErrors = [err8];
648
653
  } else {
@@ -835,7 +840,7 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
835
840
  if (data.labelSide !== void 0) {
836
841
  let data5 = data.labelSide;
837
842
  if (!(data5 === "above" || data5 === "below" || data5 === "left" || data5 === "right")) {
838
- const err13 = { instancePath: instancePath + "/labelSide", schemaPath: "#/oneOf/0/properties/labelSide/enum", keyword: "enum", params: { allowedValues: schema33.oneOf[0].properties.labelSide.enum }, message: "must be equal to one of the allowed values" };
843
+ const err13 = { instancePath: instancePath + "/labelSide", schemaPath: "#/oneOf/0/properties/labelSide/enum", keyword: "enum", params: { allowedValues: schema44.oneOf[0].properties.labelSide.enum }, message: "must be equal to one of the allowed values" };
839
844
  if (vErrors === null) {
840
845
  vErrors = [err13];
841
846
  } else {
@@ -1061,13 +1066,10 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
1061
1066
  }
1062
1067
  errors++;
1063
1068
  }
1064
- } else if (tag0 === "strip") {
1065
- const _errs39 = errors;
1066
- let valid15 = false;
1067
- const _errs40 = errors;
1069
+ } else if (tag0 === "commit") {
1068
1070
  if (data && typeof data == "object" && !Array.isArray(data)) {
1069
- if (data.value === void 0) {
1070
- const err35 = { instancePath, schemaPath: "#/oneOf/3/anyOf/0/required", keyword: "required", params: { missingProperty: "value" }, message: "must have required property 'value'" };
1071
+ if (data.type === void 0) {
1072
+ const err35 = { instancePath, schemaPath: "#/oneOf/3/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
1071
1073
  if (vErrors === null) {
1072
1074
  vErrors = [err35];
1073
1075
  } else {
@@ -1075,38 +1077,337 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
1075
1077
  }
1076
1078
  errors++;
1077
1079
  }
1080
+ if (data.id === void 0) {
1081
+ const err36 = { instancePath, schemaPath: "#/oneOf/3/required", keyword: "required", params: { missingProperty: "id" }, message: "must have required property 'id'" };
1082
+ if (vErrors === null) {
1083
+ vErrors = [err36];
1084
+ } else {
1085
+ vErrors.push(err36);
1086
+ }
1087
+ errors++;
1088
+ }
1089
+ if (data.branch === void 0) {
1090
+ const err37 = { instancePath, schemaPath: "#/oneOf/3/required", keyword: "required", params: { missingProperty: "branch" }, message: "must have required property 'branch'" };
1091
+ if (vErrors === null) {
1092
+ vErrors = [err37];
1093
+ } else {
1094
+ vErrors.push(err37);
1095
+ }
1096
+ errors++;
1097
+ }
1098
+ for (const key3 in data) {
1099
+ if (!(key3 === "type" || key3 === "id" || key3 === "branch" || key3 === "copy" || key3 === "merge" || key3 === "hash" || key3 === "note")) {
1100
+ const err38 = { instancePath, schemaPath: "#/oneOf/3/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key3 }, message: "must NOT have additional properties" };
1101
+ if (vErrors === null) {
1102
+ vErrors = [err38];
1103
+ } else {
1104
+ vErrors.push(err38);
1105
+ }
1106
+ errors++;
1107
+ }
1108
+ }
1109
+ if (data.type !== void 0) {
1110
+ if ("commit" !== data.type) {
1111
+ const err39 = { instancePath: instancePath + "/type", schemaPath: "#/oneOf/3/properties/type/const", keyword: "const", params: { allowedValue: "commit" }, message: "must be equal to constant" };
1112
+ if (vErrors === null) {
1113
+ vErrors = [err39];
1114
+ } else {
1115
+ vErrors.push(err39);
1116
+ }
1117
+ errors++;
1118
+ }
1119
+ }
1120
+ if (data.id !== void 0) {
1121
+ let data13 = data.id;
1122
+ if (typeof data13 === "string") {
1123
+ if (!pattern0.test(data13)) {
1124
+ const err40 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
1125
+ if (vErrors === null) {
1126
+ vErrors = [err40];
1127
+ } else {
1128
+ vErrors.push(err40);
1129
+ }
1130
+ errors++;
1131
+ }
1132
+ } else {
1133
+ const err41 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1134
+ if (vErrors === null) {
1135
+ vErrors = [err41];
1136
+ } else {
1137
+ vErrors.push(err41);
1138
+ }
1139
+ errors++;
1140
+ }
1141
+ }
1142
+ if (data.branch !== void 0) {
1143
+ let data14 = data.branch;
1144
+ if (typeof data14 === "string") {
1145
+ if (!pattern0.test(data14)) {
1146
+ const err42 = { instancePath: instancePath + "/branch", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
1147
+ if (vErrors === null) {
1148
+ vErrors = [err42];
1149
+ } else {
1150
+ vErrors.push(err42);
1151
+ }
1152
+ errors++;
1153
+ }
1154
+ } else {
1155
+ const err43 = { instancePath: instancePath + "/branch", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1156
+ if (vErrors === null) {
1157
+ vErrors = [err43];
1158
+ } else {
1159
+ vErrors.push(err43);
1160
+ }
1161
+ errors++;
1162
+ }
1163
+ }
1164
+ if (data.copy !== void 0) {
1165
+ let data15 = data.copy;
1166
+ if (typeof data15 === "string") {
1167
+ if (!pattern0.test(data15)) {
1168
+ const err44 = { instancePath: instancePath + "/copy", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
1169
+ if (vErrors === null) {
1170
+ vErrors = [err44];
1171
+ } else {
1172
+ vErrors.push(err44);
1173
+ }
1174
+ errors++;
1175
+ }
1176
+ } else {
1177
+ const err45 = { instancePath: instancePath + "/copy", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1178
+ if (vErrors === null) {
1179
+ vErrors = [err45];
1180
+ } else {
1181
+ vErrors.push(err45);
1182
+ }
1183
+ errors++;
1184
+ }
1185
+ }
1186
+ if (data.merge !== void 0) {
1187
+ let data16 = data.merge;
1188
+ if (typeof data16 === "string") {
1189
+ if (!pattern0.test(data16)) {
1190
+ const err46 = { instancePath: instancePath + "/merge", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
1191
+ if (vErrors === null) {
1192
+ vErrors = [err46];
1193
+ } else {
1194
+ vErrors.push(err46);
1195
+ }
1196
+ errors++;
1197
+ }
1198
+ } else {
1199
+ const err47 = { instancePath: instancePath + "/merge", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1200
+ if (vErrors === null) {
1201
+ vErrors = [err47];
1202
+ } else {
1203
+ vErrors.push(err47);
1204
+ }
1205
+ errors++;
1206
+ }
1207
+ }
1208
+ if (data.hash !== void 0) {
1209
+ let data17 = data.hash;
1210
+ if (typeof data17 === "string") {
1211
+ if (!pattern11.test(data17)) {
1212
+ const err48 = { instancePath: instancePath + "/hash", schemaPath: "#/definitions/hash/pattern", keyword: "pattern", params: { pattern: "^[0-9a-f]{4,40}$" }, message: 'must match pattern "^[0-9a-f]{4,40}$"' };
1213
+ if (vErrors === null) {
1214
+ vErrors = [err48];
1215
+ } else {
1216
+ vErrors.push(err48);
1217
+ }
1218
+ errors++;
1219
+ }
1220
+ } else {
1221
+ const err49 = { instancePath: instancePath + "/hash", schemaPath: "#/definitions/hash/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1222
+ if (vErrors === null) {
1223
+ vErrors = [err49];
1224
+ } else {
1225
+ vErrors.push(err49);
1226
+ }
1227
+ errors++;
1228
+ }
1229
+ }
1230
+ if (data.note !== void 0) {
1231
+ let data18 = data.note;
1232
+ if (typeof data18 === "string") {
1233
+ if (func3(data18) < 1) {
1234
+ const err50 = { instancePath: instancePath + "/note", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
1235
+ if (vErrors === null) {
1236
+ vErrors = [err50];
1237
+ } else {
1238
+ vErrors.push(err50);
1239
+ }
1240
+ errors++;
1241
+ }
1242
+ } else {
1243
+ const err51 = { instancePath: instancePath + "/note", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1244
+ if (vErrors === null) {
1245
+ vErrors = [err51];
1246
+ } else {
1247
+ vErrors.push(err51);
1248
+ }
1249
+ errors++;
1250
+ }
1251
+ }
1252
+ } else {
1253
+ const err52 = { instancePath, schemaPath: "#/oneOf/3/type", keyword: "type", params: { type: "object" }, message: "must be object" };
1254
+ if (vErrors === null) {
1255
+ vErrors = [err52];
1256
+ } else {
1257
+ vErrors.push(err52);
1258
+ }
1259
+ errors++;
1260
+ }
1261
+ } else if (tag0 === "branch") {
1262
+ if (data && typeof data == "object" && !Array.isArray(data)) {
1263
+ if (data.type === void 0) {
1264
+ const err53 = { instancePath, schemaPath: "#/oneOf/4/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
1265
+ if (vErrors === null) {
1266
+ vErrors = [err53];
1267
+ } else {
1268
+ vErrors.push(err53);
1269
+ }
1270
+ errors++;
1271
+ }
1272
+ if (data.branch === void 0) {
1273
+ const err54 = { instancePath, schemaPath: "#/oneOf/4/required", keyword: "required", params: { missingProperty: "branch" }, message: "must have required property 'branch'" };
1274
+ if (vErrors === null) {
1275
+ vErrors = [err54];
1276
+ } else {
1277
+ vErrors.push(err54);
1278
+ }
1279
+ errors++;
1280
+ }
1281
+ if (data.from === void 0) {
1282
+ const err55 = { instancePath, schemaPath: "#/oneOf/4/required", keyword: "required", params: { missingProperty: "from" }, message: "must have required property 'from'" };
1283
+ if (vErrors === null) {
1284
+ vErrors = [err55];
1285
+ } else {
1286
+ vErrors.push(err55);
1287
+ }
1288
+ errors++;
1289
+ }
1290
+ for (const key4 in data) {
1291
+ if (!(key4 === "type" || key4 === "branch" || key4 === "from")) {
1292
+ const err56 = { instancePath, schemaPath: "#/oneOf/4/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key4 }, message: "must NOT have additional properties" };
1293
+ if (vErrors === null) {
1294
+ vErrors = [err56];
1295
+ } else {
1296
+ vErrors.push(err56);
1297
+ }
1298
+ errors++;
1299
+ }
1300
+ }
1301
+ if (data.type !== void 0) {
1302
+ if ("branch" !== data.type) {
1303
+ const err57 = { instancePath: instancePath + "/type", schemaPath: "#/oneOf/4/properties/type/const", keyword: "const", params: { allowedValue: "branch" }, message: "must be equal to constant" };
1304
+ if (vErrors === null) {
1305
+ vErrors = [err57];
1306
+ } else {
1307
+ vErrors.push(err57);
1308
+ }
1309
+ errors++;
1310
+ }
1311
+ }
1312
+ if (data.branch !== void 0) {
1313
+ let data20 = data.branch;
1314
+ if (typeof data20 === "string") {
1315
+ if (!pattern0.test(data20)) {
1316
+ const err58 = { instancePath: instancePath + "/branch", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
1317
+ if (vErrors === null) {
1318
+ vErrors = [err58];
1319
+ } else {
1320
+ vErrors.push(err58);
1321
+ }
1322
+ errors++;
1323
+ }
1324
+ } else {
1325
+ const err59 = { instancePath: instancePath + "/branch", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1326
+ if (vErrors === null) {
1327
+ vErrors = [err59];
1328
+ } else {
1329
+ vErrors.push(err59);
1330
+ }
1331
+ errors++;
1332
+ }
1333
+ }
1334
+ if (data.from !== void 0) {
1335
+ let data21 = data.from;
1336
+ if (typeof data21 === "string") {
1337
+ if (!pattern0.test(data21)) {
1338
+ const err60 = { instancePath: instancePath + "/from", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
1339
+ if (vErrors === null) {
1340
+ vErrors = [err60];
1341
+ } else {
1342
+ vErrors.push(err60);
1343
+ }
1344
+ errors++;
1345
+ }
1346
+ } else {
1347
+ const err61 = { instancePath: instancePath + "/from", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1348
+ if (vErrors === null) {
1349
+ vErrors = [err61];
1350
+ } else {
1351
+ vErrors.push(err61);
1352
+ }
1353
+ errors++;
1354
+ }
1355
+ }
1356
+ } else {
1357
+ const err62 = { instancePath, schemaPath: "#/oneOf/4/type", keyword: "type", params: { type: "object" }, message: "must be object" };
1358
+ if (vErrors === null) {
1359
+ vErrors = [err62];
1360
+ } else {
1361
+ vErrors.push(err62);
1362
+ }
1363
+ errors++;
1078
1364
  }
1079
- var _valid0 = _errs40 === errors;
1080
- valid15 = valid15 || _valid0;
1081
- if (!valid15) {
1082
- const _errs41 = errors;
1365
+ } else if (tag0 === "strip") {
1366
+ const _errs71 = errors;
1367
+ let valid27 = false;
1368
+ const _errs72 = errors;
1369
+ if (data && typeof data == "object" && !Array.isArray(data)) {
1370
+ if (data.value === void 0) {
1371
+ const err63 = { instancePath, schemaPath: "#/oneOf/5/anyOf/0/required", keyword: "required", params: { missingProperty: "value" }, message: "must have required property 'value'" };
1372
+ if (vErrors === null) {
1373
+ vErrors = [err63];
1374
+ } else {
1375
+ vErrors.push(err63);
1376
+ }
1377
+ errors++;
1378
+ }
1379
+ }
1380
+ var _valid0 = _errs72 === errors;
1381
+ valid27 = valid27 || _valid0;
1382
+ if (!valid27) {
1383
+ const _errs73 = errors;
1083
1384
  if (data && typeof data == "object" && !Array.isArray(data)) {
1084
1385
  if (data.tag === void 0) {
1085
- const err36 = { instancePath, schemaPath: "#/oneOf/3/anyOf/1/required", keyword: "required", params: { missingProperty: "tag" }, message: "must have required property 'tag'" };
1386
+ const err64 = { instancePath, schemaPath: "#/oneOf/5/anyOf/1/required", keyword: "required", params: { missingProperty: "tag" }, message: "must have required property 'tag'" };
1086
1387
  if (vErrors === null) {
1087
- vErrors = [err36];
1388
+ vErrors = [err64];
1088
1389
  } else {
1089
- vErrors.push(err36);
1390
+ vErrors.push(err64);
1090
1391
  }
1091
1392
  errors++;
1092
1393
  }
1093
1394
  }
1094
- var _valid0 = _errs41 === errors;
1095
- valid15 = valid15 || _valid0;
1395
+ var _valid0 = _errs73 === errors;
1396
+ valid27 = valid27 || _valid0;
1096
1397
  }
1097
- if (!valid15) {
1098
- const err37 = { instancePath, schemaPath: "#/oneOf/3/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
1398
+ if (!valid27) {
1399
+ const err65 = { instancePath, schemaPath: "#/oneOf/5/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
1099
1400
  if (vErrors === null) {
1100
- vErrors = [err37];
1401
+ vErrors = [err65];
1101
1402
  } else {
1102
- vErrors.push(err37);
1403
+ vErrors.push(err65);
1103
1404
  }
1104
1405
  errors++;
1105
1406
  } else {
1106
- errors = _errs39;
1407
+ errors = _errs71;
1107
1408
  if (vErrors !== null) {
1108
- if (_errs39) {
1109
- vErrors.length = _errs39;
1409
+ if (_errs71) {
1410
+ vErrors.length = _errs71;
1110
1411
  } else {
1111
1412
  vErrors = null;
1112
1413
  }
@@ -1114,144 +1415,144 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
1114
1415
  }
1115
1416
  if (data && typeof data == "object" && !Array.isArray(data)) {
1116
1417
  if (data.type === void 0) {
1117
- const err38 = { instancePath, schemaPath: "#/oneOf/3/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
1418
+ const err66 = { instancePath, schemaPath: "#/oneOf/5/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
1118
1419
  if (vErrors === null) {
1119
- vErrors = [err38];
1420
+ vErrors = [err66];
1120
1421
  } else {
1121
- vErrors.push(err38);
1422
+ vErrors.push(err66);
1122
1423
  }
1123
1424
  errors++;
1124
1425
  }
1125
1426
  if (data.field === void 0) {
1126
- const err39 = { instancePath, schemaPath: "#/oneOf/3/required", keyword: "required", params: { missingProperty: "field" }, message: "must have required property 'field'" };
1427
+ const err67 = { instancePath, schemaPath: "#/oneOf/5/required", keyword: "required", params: { missingProperty: "field" }, message: "must have required property 'field'" };
1127
1428
  if (vErrors === null) {
1128
- vErrors = [err39];
1429
+ vErrors = [err67];
1129
1430
  } else {
1130
- vErrors.push(err39);
1431
+ vErrors.push(err67);
1131
1432
  }
1132
1433
  errors++;
1133
1434
  }
1134
- for (const key3 in data) {
1135
- if (!(key3 === "type" || key3 === "field" || key3 === "value" || key3 === "tag")) {
1136
- const err40 = { instancePath, schemaPath: "#/oneOf/3/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key3 }, message: "must NOT have additional properties" };
1435
+ for (const key5 in data) {
1436
+ if (!(key5 === "type" || key5 === "field" || key5 === "value" || key5 === "tag")) {
1437
+ const err68 = { instancePath, schemaPath: "#/oneOf/5/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key5 }, message: "must NOT have additional properties" };
1137
1438
  if (vErrors === null) {
1138
- vErrors = [err40];
1439
+ vErrors = [err68];
1139
1440
  } else {
1140
- vErrors.push(err40);
1441
+ vErrors.push(err68);
1141
1442
  }
1142
1443
  errors++;
1143
1444
  }
1144
1445
  }
1145
1446
  if (data.type !== void 0) {
1146
1447
  if ("strip" !== data.type) {
1147
- const err41 = { instancePath: instancePath + "/type", schemaPath: "#/oneOf/3/properties/type/const", keyword: "const", params: { allowedValue: "strip" }, message: "must be equal to constant" };
1448
+ const err69 = { instancePath: instancePath + "/type", schemaPath: "#/oneOf/5/properties/type/const", keyword: "const", params: { allowedValue: "strip" }, message: "must be equal to constant" };
1148
1449
  if (vErrors === null) {
1149
- vErrors = [err41];
1450
+ vErrors = [err69];
1150
1451
  } else {
1151
- vErrors.push(err41);
1452
+ vErrors.push(err69);
1152
1453
  }
1153
1454
  errors++;
1154
1455
  }
1155
1456
  }
1156
1457
  if (data.field !== void 0) {
1157
- let data13 = data.field;
1158
- if (typeof data13 === "string") {
1159
- if (func3(data13) < 1) {
1160
- const err42 = { instancePath: instancePath + "/field", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
1458
+ let data23 = data.field;
1459
+ if (typeof data23 === "string") {
1460
+ if (func3(data23) < 1) {
1461
+ const err70 = { instancePath: instancePath + "/field", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
1161
1462
  if (vErrors === null) {
1162
- vErrors = [err42];
1463
+ vErrors = [err70];
1163
1464
  } else {
1164
- vErrors.push(err42);
1465
+ vErrors.push(err70);
1165
1466
  }
1166
1467
  errors++;
1167
1468
  }
1168
1469
  } else {
1169
- const err43 = { instancePath: instancePath + "/field", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1470
+ const err71 = { instancePath: instancePath + "/field", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1170
1471
  if (vErrors === null) {
1171
- vErrors = [err43];
1472
+ vErrors = [err71];
1172
1473
  } else {
1173
- vErrors.push(err43);
1474
+ vErrors.push(err71);
1174
1475
  }
1175
1476
  errors++;
1176
1477
  }
1177
1478
  }
1178
1479
  if (data.value !== void 0) {
1179
- let data14 = data.value;
1180
- if (typeof data14 === "string") {
1181
- if (func3(data14) < 1) {
1182
- const err44 = { instancePath: instancePath + "/value", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
1480
+ let data24 = data.value;
1481
+ if (typeof data24 === "string") {
1482
+ if (func3(data24) < 1) {
1483
+ const err72 = { instancePath: instancePath + "/value", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
1183
1484
  if (vErrors === null) {
1184
- vErrors = [err44];
1485
+ vErrors = [err72];
1185
1486
  } else {
1186
- vErrors.push(err44);
1487
+ vErrors.push(err72);
1187
1488
  }
1188
1489
  errors++;
1189
1490
  }
1190
1491
  } else {
1191
- const err45 = { instancePath: instancePath + "/value", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1492
+ const err73 = { instancePath: instancePath + "/value", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1192
1493
  if (vErrors === null) {
1193
- vErrors = [err45];
1494
+ vErrors = [err73];
1194
1495
  } else {
1195
- vErrors.push(err45);
1496
+ vErrors.push(err73);
1196
1497
  }
1197
1498
  errors++;
1198
1499
  }
1199
1500
  }
1200
1501
  if (data.tag !== void 0) {
1201
- let data15 = data.tag;
1202
- if (typeof data15 === "string") {
1203
- if (func3(data15) < 1) {
1204
- const err46 = { instancePath: instancePath + "/tag", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
1502
+ let data25 = data.tag;
1503
+ if (typeof data25 === "string") {
1504
+ if (func3(data25) < 1) {
1505
+ const err74 = { instancePath: instancePath + "/tag", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
1205
1506
  if (vErrors === null) {
1206
- vErrors = [err46];
1507
+ vErrors = [err74];
1207
1508
  } else {
1208
- vErrors.push(err46);
1509
+ vErrors.push(err74);
1209
1510
  }
1210
1511
  errors++;
1211
1512
  }
1212
1513
  } else {
1213
- const err47 = { instancePath: instancePath + "/tag", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1514
+ const err75 = { instancePath: instancePath + "/tag", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1214
1515
  if (vErrors === null) {
1215
- vErrors = [err47];
1516
+ vErrors = [err75];
1216
1517
  } else {
1217
- vErrors.push(err47);
1518
+ vErrors.push(err75);
1218
1519
  }
1219
1520
  errors++;
1220
1521
  }
1221
1522
  }
1222
1523
  } else {
1223
- const err48 = { instancePath, schemaPath: "#/oneOf/3/type", keyword: "type", params: { type: "object" }, message: "must be object" };
1524
+ const err76 = { instancePath, schemaPath: "#/oneOf/5/type", keyword: "type", params: { type: "object" }, message: "must be object" };
1224
1525
  if (vErrors === null) {
1225
- vErrors = [err48];
1526
+ vErrors = [err76];
1226
1527
  } else {
1227
- vErrors.push(err48);
1528
+ vErrors.push(err76);
1228
1529
  }
1229
1530
  errors++;
1230
1531
  }
1231
1532
  } else {
1232
- const err49 = { instancePath, schemaPath: "#/discriminator", keyword: "discriminator", params: { error: "mapping", tag: "type", tagValue: tag0 }, message: 'value of tag "type" must be in oneOf' };
1533
+ const err77 = { instancePath, schemaPath: "#/discriminator", keyword: "discriminator", params: { error: "mapping", tag: "type", tagValue: tag0 }, message: 'value of tag "type" must be in oneOf' };
1233
1534
  if (vErrors === null) {
1234
- vErrors = [err49];
1535
+ vErrors = [err77];
1235
1536
  } else {
1236
- vErrors.push(err49);
1537
+ vErrors.push(err77);
1237
1538
  }
1238
1539
  errors++;
1239
1540
  }
1240
1541
  } else {
1241
- const err50 = { instancePath, schemaPath: "#/discriminator", keyword: "discriminator", params: { error: "tag", tag: "type", tagValue: tag0 }, message: 'tag "type" must be string' };
1542
+ const err78 = { instancePath, schemaPath: "#/discriminator", keyword: "discriminator", params: { error: "tag", tag: "type", tagValue: tag0 }, message: 'tag "type" must be string' };
1242
1543
  if (vErrors === null) {
1243
- vErrors = [err50];
1544
+ vErrors = [err78];
1244
1545
  } else {
1245
- vErrors.push(err50);
1546
+ vErrors.push(err78);
1246
1547
  }
1247
1548
  errors++;
1248
1549
  }
1249
1550
  } else {
1250
- const err51 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
1551
+ const err79 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
1251
1552
  if (vErrors === null) {
1252
- vErrors = [err51];
1553
+ vErrors = [err79];
1253
1554
  } else {
1254
- vErrors.push(err51);
1555
+ vErrors.push(err79);
1255
1556
  }
1256
1557
  errors++;
1257
1558
  }
@@ -1655,6 +1956,151 @@ function validate25(data, { instancePath = "", parentData, parentDataProperty, r
1655
1956
  validate25.errors = vErrors;
1656
1957
  return errors === 0;
1657
1958
  }
1959
+ function validate30(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
1960
+ let vErrors = null;
1961
+ let errors = 0;
1962
+ if (data && typeof data == "object" && !Array.isArray(data)) {
1963
+ if (data.id === void 0) {
1964
+ const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "id" }, message: "must have required property 'id'" };
1965
+ if (vErrors === null) {
1966
+ vErrors = [err0];
1967
+ } else {
1968
+ vErrors.push(err0);
1969
+ }
1970
+ errors++;
1971
+ }
1972
+ for (const key0 in data) {
1973
+ if (!(key0 === "id" || key0 === "note")) {
1974
+ const err1 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
1975
+ if (vErrors === null) {
1976
+ vErrors = [err1];
1977
+ } else {
1978
+ vErrors.push(err1);
1979
+ }
1980
+ errors++;
1981
+ }
1982
+ }
1983
+ if (data.id !== void 0) {
1984
+ let data0 = data.id;
1985
+ if (typeof data0 === "string") {
1986
+ if (!pattern0.test(data0)) {
1987
+ const err2 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
1988
+ if (vErrors === null) {
1989
+ vErrors = [err2];
1990
+ } else {
1991
+ vErrors.push(err2);
1992
+ }
1993
+ errors++;
1994
+ }
1995
+ } else {
1996
+ const err3 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
1997
+ if (vErrors === null) {
1998
+ vErrors = [err3];
1999
+ } else {
2000
+ vErrors.push(err3);
2001
+ }
2002
+ errors++;
2003
+ }
2004
+ }
2005
+ if (data.note !== void 0) {
2006
+ let data1 = data.note;
2007
+ if (typeof data1 === "string") {
2008
+ if (func3(data1) < 1) {
2009
+ const err4 = { instancePath: instancePath + "/note", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
2010
+ if (vErrors === null) {
2011
+ vErrors = [err4];
2012
+ } else {
2013
+ vErrors.push(err4);
2014
+ }
2015
+ errors++;
2016
+ }
2017
+ } else {
2018
+ const err5 = { instancePath: instancePath + "/note", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
2019
+ if (vErrors === null) {
2020
+ vErrors = [err5];
2021
+ } else {
2022
+ vErrors.push(err5);
2023
+ }
2024
+ errors++;
2025
+ }
2026
+ }
2027
+ } else {
2028
+ const err6 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2029
+ if (vErrors === null) {
2030
+ vErrors = [err6];
2031
+ } else {
2032
+ vErrors.push(err6);
2033
+ }
2034
+ errors++;
2035
+ }
2036
+ validate30.errors = vErrors;
2037
+ return errors === 0;
2038
+ }
2039
+ function validate29(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
2040
+ let vErrors = null;
2041
+ let errors = 0;
2042
+ if (data && typeof data == "object" && !Array.isArray(data)) {
2043
+ if (data.branches === void 0) {
2044
+ const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "branches" }, message: "must have required property 'branches'" };
2045
+ if (vErrors === null) {
2046
+ vErrors = [err0];
2047
+ } else {
2048
+ vErrors.push(err0);
2049
+ }
2050
+ errors++;
2051
+ }
2052
+ for (const key0 in data) {
2053
+ if (!(key0 === "branches")) {
2054
+ const err1 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
2055
+ if (vErrors === null) {
2056
+ vErrors = [err1];
2057
+ } else {
2058
+ vErrors.push(err1);
2059
+ }
2060
+ errors++;
2061
+ }
2062
+ }
2063
+ if (data.branches !== void 0) {
2064
+ let data0 = data.branches;
2065
+ if (Array.isArray(data0)) {
2066
+ if (data0.length < 1) {
2067
+ const err2 = { instancePath: instancePath + "/branches", schemaPath: "#/properties/branches/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
2068
+ if (vErrors === null) {
2069
+ vErrors = [err2];
2070
+ } else {
2071
+ vErrors.push(err2);
2072
+ }
2073
+ errors++;
2074
+ }
2075
+ const len0 = data0.length;
2076
+ for (let i0 = 0; i0 < len0; i0++) {
2077
+ if (!validate30(data0[i0], { instancePath: instancePath + "/branches/" + i0, parentData: data0, parentDataProperty: i0, rootData })) {
2078
+ vErrors = vErrors === null ? validate30.errors : vErrors.concat(validate30.errors);
2079
+ errors = vErrors.length;
2080
+ }
2081
+ }
2082
+ } else {
2083
+ const err3 = { instancePath: instancePath + "/branches", schemaPath: "#/properties/branches/type", keyword: "type", params: { type: "array" }, message: "must be array" };
2084
+ if (vErrors === null) {
2085
+ vErrors = [err3];
2086
+ } else {
2087
+ vErrors.push(err3);
2088
+ }
2089
+ errors++;
2090
+ }
2091
+ }
2092
+ } else {
2093
+ const err4 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2094
+ if (vErrors === null) {
2095
+ vErrors = [err4];
2096
+ } else {
2097
+ vErrors.push(err4);
2098
+ }
2099
+ errors++;
2100
+ }
2101
+ validate29.errors = vErrors;
2102
+ return errors === 0;
2103
+ }
1658
2104
  function validate10(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
1659
2105
  let vErrors = null;
1660
2106
  let errors = 0;
@@ -1696,11 +2142,9 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
1696
2142
  let ifClause0;
1697
2143
  if (_valid0) {
1698
2144
  const _errs4 = errors;
1699
- const _errs5 = errors;
1700
- const _errs6 = errors;
1701
2145
  if (data && typeof data == "object" && !Array.isArray(data)) {
1702
- if (data.state === void 0 && ("state")) {
1703
- const err2 = {};
2146
+ if (data.sequence === void 0) {
2147
+ const err2 = { instancePath, schemaPath: "#/then/required", keyword: "required", params: { missingProperty: "sequence" }, message: "must have required property 'sequence'" };
1704
2148
  if (vErrors === null) {
1705
2149
  vErrors = [err2];
1706
2150
  } else {
@@ -1708,147 +2152,181 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
1708
2152
  }
1709
2153
  errors++;
1710
2154
  }
1711
- }
1712
- var valid2 = _errs6 === errors;
1713
- if (valid2) {
1714
- const err3 = { instancePath, schemaPath: "#/then/not", keyword: "not", params: {}, message: "must NOT be valid" };
1715
- if (vErrors === null) {
1716
- vErrors = [err3];
1717
- } else {
1718
- vErrors.push(err3);
2155
+ if (data.boxes !== void 0) {
2156
+ let data1 = data.boxes;
2157
+ if (Array.isArray(data1)) {
2158
+ if (data1.length < 1) {
2159
+ const err3 = { instancePath: instancePath + "/boxes", schemaPath: "#/then/properties/boxes/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
2160
+ if (vErrors === null) {
2161
+ vErrors = [err3];
2162
+ } else {
2163
+ vErrors.push(err3);
2164
+ }
2165
+ errors++;
2166
+ }
2167
+ }
1719
2168
  }
1720
- errors++;
1721
- } else {
1722
- errors = _errs5;
1723
- if (vErrors !== null) {
1724
- if (_errs5) {
1725
- vErrors.length = _errs5;
1726
- } else {
1727
- vErrors = null;
2169
+ if (data.steps !== void 0) {
2170
+ let data2 = data.steps;
2171
+ if (Array.isArray(data2)) {
2172
+ const len0 = data2.length;
2173
+ for (let i0 = 0; i0 < len0; i0++) {
2174
+ let data3 = data2[i0];
2175
+ if (data3 && typeof data3 == "object" && !Array.isArray(data3)) {
2176
+ if (data3.events !== void 0) {
2177
+ let data4 = data3.events;
2178
+ if (Array.isArray(data4)) {
2179
+ const len1 = data4.length;
2180
+ for (let i1 = 0; i1 < len1; i1++) {
2181
+ let data5 = data4[i1];
2182
+ if (data5 && typeof data5 == "object" && !Array.isArray(data5)) {
2183
+ if (data5.type !== void 0) {
2184
+ let data6 = data5.type;
2185
+ const _errs12 = errors;
2186
+ const _errs13 = errors;
2187
+ if (!(data6 === "commit" || data6 === "branch")) {
2188
+ const err4 = {};
2189
+ if (vErrors === null) {
2190
+ vErrors = [err4];
2191
+ } else {
2192
+ vErrors.push(err4);
2193
+ }
2194
+ errors++;
2195
+ }
2196
+ var valid10 = _errs13 === errors;
2197
+ if (valid10) {
2198
+ const err5 = { instancePath: instancePath + "/steps/" + i0 + "/events/" + i1 + "/type", schemaPath: "#/definitions/plainSteps/items/properties/events/items/properties/type/not", keyword: "not", params: {}, message: "must NOT be valid" };
2199
+ if (vErrors === null) {
2200
+ vErrors = [err5];
2201
+ } else {
2202
+ vErrors.push(err5);
2203
+ }
2204
+ errors++;
2205
+ } else {
2206
+ errors = _errs12;
2207
+ if (vErrors !== null) {
2208
+ if (_errs12) {
2209
+ vErrors.length = _errs12;
2210
+ } else {
2211
+ vErrors = null;
2212
+ }
2213
+ }
2214
+ }
2215
+ }
2216
+ }
2217
+ }
2218
+ }
2219
+ }
2220
+ }
2221
+ }
1728
2222
  }
1729
2223
  }
1730
- }
1731
- if (data && typeof data == "object" && !Array.isArray(data)) {
1732
- if (data.sequence === void 0) {
1733
- const err4 = { instancePath, schemaPath: "#/then/required", keyword: "required", params: { missingProperty: "sequence" }, message: "must have required property 'sequence'" };
2224
+ if (data.state !== void 0) {
2225
+ const err6 = { instancePath: instancePath + "/state", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
1734
2226
  if (vErrors === null) {
1735
- vErrors = [err4];
2227
+ vErrors = [err6];
1736
2228
  } else {
1737
- vErrors.push(err4);
2229
+ vErrors.push(err6);
1738
2230
  }
1739
2231
  errors++;
1740
2232
  }
1741
- }
1742
- var _valid0 = _errs4 === errors;
1743
- valid0 = _valid0;
1744
- ifClause0 = "then";
1745
- } else {
1746
- const _errs7 = errors;
1747
- const _errs8 = errors;
1748
- const _errs9 = errors;
1749
- if (data && typeof data == "object" && !Array.isArray(data)) {
1750
- if (data.sequence === void 0 && ("sequence")) {
1751
- const err5 = {};
2233
+ if (data.git !== void 0) {
2234
+ const err7 = { instancePath: instancePath + "/git", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
1752
2235
  if (vErrors === null) {
1753
- vErrors = [err5];
2236
+ vErrors = [err7];
1754
2237
  } else {
1755
- vErrors.push(err5);
2238
+ vErrors.push(err7);
1756
2239
  }
1757
2240
  errors++;
1758
2241
  }
1759
2242
  }
1760
- var valid3 = _errs9 === errors;
1761
- if (valid3) {
1762
- const err6 = { instancePath, schemaPath: "#/else/not", keyword: "not", params: {}, message: "must NOT be valid" };
1763
- if (vErrors === null) {
1764
- vErrors = [err6];
1765
- } else {
1766
- vErrors.push(err6);
1767
- }
1768
- errors++;
1769
- } else {
1770
- errors = _errs8;
1771
- if (vErrors !== null) {
1772
- if (_errs8) {
1773
- vErrors.length = _errs8;
1774
- } else {
1775
- vErrors = null;
1776
- }
1777
- }
1778
- }
1779
- const _errs10 = errors;
1780
- let valid4 = true;
1781
- const _errs11 = errors;
2243
+ var _valid0 = _errs4 === errors;
2244
+ valid0 = _valid0;
2245
+ ifClause0 = "then";
2246
+ } else {
2247
+ const _errs20 = errors;
2248
+ const _errs21 = errors;
2249
+ let valid13 = true;
2250
+ const _errs22 = errors;
1782
2251
  if (data && typeof data == "object" && !Array.isArray(data)) {
1783
2252
  if (data.kind === void 0 && ("kind")) {
1784
- const err7 = {};
2253
+ const err8 = {};
1785
2254
  if (vErrors === null) {
1786
- vErrors = [err7];
2255
+ vErrors = [err8];
1787
2256
  } else {
1788
- vErrors.push(err7);
2257
+ vErrors.push(err8);
1789
2258
  }
1790
2259
  errors++;
1791
2260
  } else {
1792
2261
  if (data.kind !== void 0) {
1793
2262
  if ("state" !== data.kind) {
1794
- const err8 = {};
2263
+ const err9 = {};
1795
2264
  if (vErrors === null) {
1796
- vErrors = [err8];
2265
+ vErrors = [err9];
1797
2266
  } else {
1798
- vErrors.push(err8);
2267
+ vErrors.push(err9);
1799
2268
  }
1800
2269
  errors++;
1801
2270
  }
1802
2271
  }
1803
2272
  }
1804
2273
  }
1805
- var _valid1 = _errs11 === errors;
1806
- errors = _errs10;
2274
+ var _valid1 = _errs22 === errors;
2275
+ errors = _errs21;
1807
2276
  if (vErrors !== null) {
1808
- if (_errs10) {
1809
- vErrors.length = _errs10;
2277
+ if (_errs21) {
2278
+ vErrors.length = _errs21;
1810
2279
  } else {
1811
2280
  vErrors = null;
1812
2281
  }
1813
2282
  }
1814
2283
  let ifClause1;
1815
2284
  if (_valid1) {
1816
- const _errs13 = errors;
2285
+ const _errs24 = errors;
1817
2286
  if (data && typeof data == "object" && !Array.isArray(data)) {
1818
2287
  if (data.boxes !== void 0) {
1819
- let data2 = data.boxes;
1820
- if (Array.isArray(data2)) {
1821
- const len0 = data2.length;
1822
- for (let i0 = 0; i0 < len0; i0++) {
1823
- let data3 = data2[i0];
1824
- if (data3 && typeof data3 == "object" && !Array.isArray(data3)) {
1825
- if (data3.id !== void 0) {
1826
- let data4 = data3.id;
1827
- const _errs17 = errors;
1828
- const _errs18 = errors;
1829
- if (!(data4 === "start" || data4 === "finish")) {
1830
- const err9 = {};
2288
+ let data10 = data.boxes;
2289
+ if (Array.isArray(data10)) {
2290
+ if (data10.length < 1) {
2291
+ const err10 = { instancePath: instancePath + "/boxes", schemaPath: "#/else/then/properties/boxes/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
2292
+ if (vErrors === null) {
2293
+ vErrors = [err10];
2294
+ } else {
2295
+ vErrors.push(err10);
2296
+ }
2297
+ errors++;
2298
+ }
2299
+ const len2 = data10.length;
2300
+ for (let i2 = 0; i2 < len2; i2++) {
2301
+ let data11 = data10[i2];
2302
+ if (data11 && typeof data11 == "object" && !Array.isArray(data11)) {
2303
+ if (data11.id !== void 0) {
2304
+ let data12 = data11.id;
2305
+ const _errs28 = errors;
2306
+ const _errs29 = errors;
2307
+ if (!(data12 === "start" || data12 === "finish")) {
2308
+ const err11 = {};
1831
2309
  if (vErrors === null) {
1832
- vErrors = [err9];
2310
+ vErrors = [err11];
1833
2311
  } else {
1834
- vErrors.push(err9);
2312
+ vErrors.push(err11);
1835
2313
  }
1836
2314
  errors++;
1837
2315
  }
1838
- var valid10 = _errs18 === errors;
1839
- if (valid10) {
1840
- const err10 = { instancePath: instancePath + "/boxes/" + i0 + "/id", schemaPath: "#/else/then/properties/boxes/items/properties/id/not", keyword: "not", params: {}, message: "must NOT be valid" };
2316
+ var valid19 = _errs29 === errors;
2317
+ if (valid19) {
2318
+ const err12 = { instancePath: instancePath + "/boxes/" + i2 + "/id", schemaPath: "#/else/then/properties/boxes/items/properties/id/not", keyword: "not", params: {}, message: "must NOT be valid" };
1841
2319
  if (vErrors === null) {
1842
- vErrors = [err10];
2320
+ vErrors = [err12];
1843
2321
  } else {
1844
- vErrors.push(err10);
2322
+ vErrors.push(err12);
1845
2323
  }
1846
2324
  errors++;
1847
2325
  } else {
1848
- errors = _errs17;
2326
+ errors = _errs28;
1849
2327
  if (vErrors !== null) {
1850
- if (_errs17) {
1851
- vErrors.length = _errs17;
2328
+ if (_errs28) {
2329
+ vErrors.length = _errs28;
1852
2330
  } else {
1853
2331
  vErrors = null;
1854
2332
  }
@@ -1859,241 +2337,449 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
1859
2337
  }
1860
2338
  }
1861
2339
  }
2340
+ if (data.steps !== void 0) {
2341
+ let data13 = data.steps;
2342
+ if (Array.isArray(data13)) {
2343
+ const len3 = data13.length;
2344
+ for (let i3 = 0; i3 < len3; i3++) {
2345
+ let data14 = data13[i3];
2346
+ if (data14 && typeof data14 == "object" && !Array.isArray(data14)) {
2347
+ if (data14.events !== void 0) {
2348
+ let data15 = data14.events;
2349
+ if (Array.isArray(data15)) {
2350
+ const len4 = data15.length;
2351
+ for (let i4 = 0; i4 < len4; i4++) {
2352
+ let data16 = data15[i4];
2353
+ if (data16 && typeof data16 == "object" && !Array.isArray(data16)) {
2354
+ if (data16.type !== void 0) {
2355
+ let data17 = data16.type;
2356
+ const _errs36 = errors;
2357
+ const _errs37 = errors;
2358
+ if (!(data17 === "commit" || data17 === "branch")) {
2359
+ const err13 = {};
2360
+ if (vErrors === null) {
2361
+ vErrors = [err13];
2362
+ } else {
2363
+ vErrors.push(err13);
2364
+ }
2365
+ errors++;
2366
+ }
2367
+ var valid27 = _errs37 === errors;
2368
+ if (valid27) {
2369
+ const err14 = { instancePath: instancePath + "/steps/" + i3 + "/events/" + i4 + "/type", schemaPath: "#/definitions/plainSteps/items/properties/events/items/properties/type/not", keyword: "not", params: {}, message: "must NOT be valid" };
2370
+ if (vErrors === null) {
2371
+ vErrors = [err14];
2372
+ } else {
2373
+ vErrors.push(err14);
2374
+ }
2375
+ errors++;
2376
+ } else {
2377
+ errors = _errs36;
2378
+ if (vErrors !== null) {
2379
+ if (_errs36) {
2380
+ vErrors.length = _errs36;
2381
+ } else {
2382
+ vErrors = null;
2383
+ }
2384
+ }
2385
+ }
2386
+ }
2387
+ }
2388
+ }
2389
+ }
2390
+ }
2391
+ }
2392
+ }
2393
+ }
2394
+ }
2395
+ if (data.git !== void 0) {
2396
+ const err15 = { instancePath: instancePath + "/git", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
2397
+ if (vErrors === null) {
2398
+ vErrors = [err15];
2399
+ } else {
2400
+ vErrors.push(err15);
2401
+ }
2402
+ errors++;
2403
+ }
1862
2404
  }
1863
- var _valid1 = _errs13 === errors;
1864
- valid4 = _valid1;
2405
+ var _valid1 = _errs24 === errors;
2406
+ valid13 = _valid1;
1865
2407
  ifClause1 = "then";
1866
2408
  } else {
1867
- const _errs19 = errors;
1868
- const _errs20 = errors;
1869
- const _errs21 = errors;
2409
+ const _errs41 = errors;
2410
+ const _errs42 = errors;
2411
+ let valid29 = true;
2412
+ const _errs43 = errors;
1870
2413
  if (data && typeof data == "object" && !Array.isArray(data)) {
1871
- if (data.state === void 0 && ("state")) {
1872
- const err11 = {};
2414
+ if (data.kind === void 0 && ("kind")) {
2415
+ const err16 = {};
1873
2416
  if (vErrors === null) {
1874
- vErrors = [err11];
2417
+ vErrors = [err16];
1875
2418
  } else {
1876
- vErrors.push(err11);
2419
+ vErrors.push(err16);
1877
2420
  }
1878
2421
  errors++;
2422
+ } else {
2423
+ if (data.kind !== void 0) {
2424
+ if ("git" !== data.kind) {
2425
+ const err17 = {};
2426
+ if (vErrors === null) {
2427
+ vErrors = [err17];
2428
+ } else {
2429
+ vErrors.push(err17);
2430
+ }
2431
+ errors++;
2432
+ }
2433
+ }
1879
2434
  }
1880
2435
  }
1881
- var valid11 = _errs21 === errors;
1882
- if (valid11) {
1883
- const err12 = { instancePath, schemaPath: "#/else/else/not", keyword: "not", params: {}, message: "must NOT be valid" };
1884
- if (vErrors === null) {
1885
- vErrors = [err12];
2436
+ var _valid2 = _errs43 === errors;
2437
+ errors = _errs42;
2438
+ if (vErrors !== null) {
2439
+ if (_errs42) {
2440
+ vErrors.length = _errs42;
1886
2441
  } else {
1887
- vErrors.push(err12);
2442
+ vErrors = null;
1888
2443
  }
1889
- errors++;
2444
+ }
2445
+ let ifClause2;
2446
+ if (_valid2) {
2447
+ const _errs45 = errors;
2448
+ if (data && typeof data == "object" && !Array.isArray(data)) {
2449
+ if (data.git === void 0) {
2450
+ const err18 = { instancePath, schemaPath: "#/else/else/then/required", keyword: "required", params: { missingProperty: "git" }, message: "must have required property 'git'" };
2451
+ if (vErrors === null) {
2452
+ vErrors = [err18];
2453
+ } else {
2454
+ vErrors.push(err18);
2455
+ }
2456
+ errors++;
2457
+ }
2458
+ if (data.state !== void 0) {
2459
+ const err19 = { instancePath: instancePath + "/state", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
2460
+ if (vErrors === null) {
2461
+ vErrors = [err19];
2462
+ } else {
2463
+ vErrors.push(err19);
2464
+ }
2465
+ errors++;
2466
+ }
2467
+ if (data.regions !== void 0) {
2468
+ const err20 = { instancePath: instancePath + "/regions", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
2469
+ if (vErrors === null) {
2470
+ vErrors = [err20];
2471
+ } else {
2472
+ vErrors.push(err20);
2473
+ }
2474
+ errors++;
2475
+ }
2476
+ }
2477
+ var _valid2 = _errs45 === errors;
2478
+ valid29 = _valid2;
2479
+ ifClause2 = "then";
1890
2480
  } else {
1891
- errors = _errs20;
1892
- if (vErrors !== null) {
1893
- if (_errs20) {
1894
- vErrors.length = _errs20;
1895
- } else {
1896
- vErrors = null;
2481
+ const _errs52 = errors;
2482
+ if (data && typeof data == "object" && !Array.isArray(data)) {
2483
+ if (data.boxes !== void 0) {
2484
+ let data22 = data.boxes;
2485
+ if (Array.isArray(data22)) {
2486
+ if (data22.length < 1) {
2487
+ const err21 = { instancePath: instancePath + "/boxes", schemaPath: "#/else/else/else/properties/boxes/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
2488
+ if (vErrors === null) {
2489
+ vErrors = [err21];
2490
+ } else {
2491
+ vErrors.push(err21);
2492
+ }
2493
+ errors++;
2494
+ }
2495
+ }
2496
+ }
2497
+ if (data.steps !== void 0) {
2498
+ let data23 = data.steps;
2499
+ if (Array.isArray(data23)) {
2500
+ const len5 = data23.length;
2501
+ for (let i5 = 0; i5 < len5; i5++) {
2502
+ let data24 = data23[i5];
2503
+ if (data24 && typeof data24 == "object" && !Array.isArray(data24)) {
2504
+ if (data24.events !== void 0) {
2505
+ let data25 = data24.events;
2506
+ if (Array.isArray(data25)) {
2507
+ const len6 = data25.length;
2508
+ for (let i6 = 0; i6 < len6; i6++) {
2509
+ let data26 = data25[i6];
2510
+ if (data26 && typeof data26 == "object" && !Array.isArray(data26)) {
2511
+ if (data26.type !== void 0) {
2512
+ let data27 = data26.type;
2513
+ const _errs60 = errors;
2514
+ const _errs61 = errors;
2515
+ if (!(data27 === "commit" || data27 === "branch")) {
2516
+ const err22 = {};
2517
+ if (vErrors === null) {
2518
+ vErrors = [err22];
2519
+ } else {
2520
+ vErrors.push(err22);
2521
+ }
2522
+ errors++;
2523
+ }
2524
+ var valid42 = _errs61 === errors;
2525
+ if (valid42) {
2526
+ const err23 = { instancePath: instancePath + "/steps/" + i5 + "/events/" + i6 + "/type", schemaPath: "#/definitions/plainSteps/items/properties/events/items/properties/type/not", keyword: "not", params: {}, message: "must NOT be valid" };
2527
+ if (vErrors === null) {
2528
+ vErrors = [err23];
2529
+ } else {
2530
+ vErrors.push(err23);
2531
+ }
2532
+ errors++;
2533
+ } else {
2534
+ errors = _errs60;
2535
+ if (vErrors !== null) {
2536
+ if (_errs60) {
2537
+ vErrors.length = _errs60;
2538
+ } else {
2539
+ vErrors = null;
2540
+ }
2541
+ }
2542
+ }
2543
+ }
2544
+ }
2545
+ }
2546
+ }
2547
+ }
2548
+ }
2549
+ }
2550
+ }
2551
+ }
2552
+ if (data.state !== void 0) {
2553
+ const err24 = { instancePath: instancePath + "/state", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
2554
+ if (vErrors === null) {
2555
+ vErrors = [err24];
2556
+ } else {
2557
+ vErrors.push(err24);
2558
+ }
2559
+ errors++;
2560
+ }
2561
+ if (data.git !== void 0) {
2562
+ const err25 = { instancePath: instancePath + "/git", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
2563
+ if (vErrors === null) {
2564
+ vErrors = [err25];
2565
+ } else {
2566
+ vErrors.push(err25);
2567
+ }
2568
+ errors++;
1897
2569
  }
1898
2570
  }
2571
+ var _valid2 = _errs52 === errors;
2572
+ valid29 = _valid2;
2573
+ ifClause2 = "else";
2574
+ }
2575
+ if (!valid29) {
2576
+ const err26 = { instancePath, schemaPath: "#/else/else/if", keyword: "if", params: { failingKeyword: ifClause2 }, message: 'must match "' + ifClause2 + '" schema' };
2577
+ if (vErrors === null) {
2578
+ vErrors = [err26];
2579
+ } else {
2580
+ vErrors.push(err26);
2581
+ }
2582
+ errors++;
1899
2583
  }
1900
- var _valid1 = _errs19 === errors;
1901
- valid4 = _valid1;
2584
+ var _valid1 = _errs41 === errors;
2585
+ valid13 = _valid1;
1902
2586
  ifClause1 = "else";
1903
2587
  }
1904
- if (!valid4) {
1905
- const err13 = { instancePath, schemaPath: "#/else/if", keyword: "if", params: { failingKeyword: ifClause1 }, message: 'must match "' + ifClause1 + '" schema' };
2588
+ if (!valid13) {
2589
+ const err27 = { instancePath, schemaPath: "#/else/if", keyword: "if", params: { failingKeyword: ifClause1 }, message: 'must match "' + ifClause1 + '" schema' };
1906
2590
  if (vErrors === null) {
1907
- vErrors = [err13];
2591
+ vErrors = [err27];
1908
2592
  } else {
1909
- vErrors.push(err13);
2593
+ vErrors.push(err27);
1910
2594
  }
1911
2595
  errors++;
1912
2596
  }
1913
- var _valid0 = _errs7 === errors;
2597
+ if (data && typeof data == "object" && !Array.isArray(data)) {
2598
+ if (data.sequence !== void 0) {
2599
+ const err28 = { instancePath: instancePath + "/sequence", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
2600
+ if (vErrors === null) {
2601
+ vErrors = [err28];
2602
+ } else {
2603
+ vErrors.push(err28);
2604
+ }
2605
+ errors++;
2606
+ }
2607
+ }
2608
+ var _valid0 = _errs20 === errors;
1914
2609
  valid0 = _valid0;
1915
2610
  ifClause0 = "else";
1916
2611
  }
1917
2612
  if (!valid0) {
1918
- const err14 = { instancePath, schemaPath: "#/if", keyword: "if", params: { failingKeyword: ifClause0 }, message: 'must match "' + ifClause0 + '" schema' };
2613
+ const err29 = { instancePath, schemaPath: "#/if", keyword: "if", params: { failingKeyword: ifClause0 }, message: 'must match "' + ifClause0 + '" schema' };
1919
2614
  if (vErrors === null) {
1920
- vErrors = [err14];
2615
+ vErrors = [err29];
1921
2616
  } else {
1922
- vErrors.push(err14);
2617
+ vErrors.push(err29);
1923
2618
  }
1924
2619
  errors++;
1925
2620
  }
1926
2621
  if (data && typeof data == "object" && !Array.isArray(data)) {
1927
2622
  if (data.version === void 0) {
1928
- const err15 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "version" }, message: "must have required property 'version'" };
2623
+ const err30 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "version" }, message: "must have required property 'version'" };
1929
2624
  if (vErrors === null) {
1930
- vErrors = [err15];
2625
+ vErrors = [err30];
1931
2626
  } else {
1932
- vErrors.push(err15);
2627
+ vErrors.push(err30);
1933
2628
  }
1934
2629
  errors++;
1935
2630
  }
1936
2631
  if (data.kind === void 0) {
1937
- const err16 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "kind" }, message: "must have required property 'kind'" };
2632
+ const err31 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "kind" }, message: "must have required property 'kind'" };
1938
2633
  if (vErrors === null) {
1939
- vErrors = [err16];
2634
+ vErrors = [err31];
1940
2635
  } else {
1941
- vErrors.push(err16);
2636
+ vErrors.push(err31);
1942
2637
  }
1943
2638
  errors++;
1944
2639
  }
1945
2640
  if (data.title === void 0) {
1946
- const err17 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "title" }, message: "must have required property 'title'" };
2641
+ const err32 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "title" }, message: "must have required property 'title'" };
1947
2642
  if (vErrors === null) {
1948
- vErrors = [err17];
2643
+ vErrors = [err32];
1949
2644
  } else {
1950
- vErrors.push(err17);
2645
+ vErrors.push(err32);
1951
2646
  }
1952
2647
  errors++;
1953
2648
  }
1954
2649
  if (data.boxes === void 0) {
1955
- const err18 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "boxes" }, message: "must have required property 'boxes'" };
2650
+ const err33 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "boxes" }, message: "must have required property 'boxes'" };
1956
2651
  if (vErrors === null) {
1957
- vErrors = [err18];
2652
+ vErrors = [err33];
1958
2653
  } else {
1959
- vErrors.push(err18);
2654
+ vErrors.push(err33);
1960
2655
  }
1961
2656
  errors++;
1962
2657
  }
1963
2658
  if (data.steps === void 0) {
1964
- const err19 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "steps" }, message: "must have required property 'steps'" };
2659
+ const err34 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "steps" }, message: "must have required property 'steps'" };
1965
2660
  if (vErrors === null) {
1966
- vErrors = [err19];
2661
+ vErrors = [err34];
1967
2662
  } else {
1968
- vErrors.push(err19);
2663
+ vErrors.push(err34);
1969
2664
  }
1970
2665
  errors++;
1971
2666
  }
1972
2667
  for (const key0 in data) {
1973
2668
  if (!func2.call(schema11.properties, key0)) {
1974
- const err20 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
2669
+ const err35 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
1975
2670
  if (vErrors === null) {
1976
- vErrors = [err20];
2671
+ vErrors = [err35];
1977
2672
  } else {
1978
- vErrors.push(err20);
2673
+ vErrors.push(err35);
1979
2674
  }
1980
2675
  errors++;
1981
2676
  }
1982
2677
  }
1983
2678
  if (data.version !== void 0) {
1984
- let data5 = data.version;
1985
- if (!(typeof data5 == "number" && (!(data5 % 1) && !isNaN(data5)) && isFinite(data5))) {
1986
- const err21 = { instancePath: instancePath + "/version", schemaPath: "#/properties/version/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
2679
+ let data31 = data.version;
2680
+ if (!(typeof data31 == "number" && (!(data31 % 1) && !isNaN(data31)) && isFinite(data31))) {
2681
+ const err36 = { instancePath: instancePath + "/version", schemaPath: "#/properties/version/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
1987
2682
  if (vErrors === null) {
1988
- vErrors = [err21];
2683
+ vErrors = [err36];
1989
2684
  } else {
1990
- vErrors.push(err21);
2685
+ vErrors.push(err36);
1991
2686
  }
1992
2687
  errors++;
1993
2688
  }
1994
- if (typeof data5 == "number" && isFinite(data5)) {
1995
- if (data5 < 1 || isNaN(data5)) {
1996
- const err22 = { instancePath: instancePath + "/version", schemaPath: "#/properties/version/minimum", keyword: "minimum", params: { comparison: ">=", limit: 1 }, message: "must be >= 1" };
2689
+ if (typeof data31 == "number" && isFinite(data31)) {
2690
+ if (data31 < 1 || isNaN(data31)) {
2691
+ const err37 = { instancePath: instancePath + "/version", schemaPath: "#/properties/version/minimum", keyword: "minimum", params: { comparison: ">=", limit: 1 }, message: "must be >= 1" };
1997
2692
  if (vErrors === null) {
1998
- vErrors = [err22];
2693
+ vErrors = [err37];
1999
2694
  } else {
2000
- vErrors.push(err22);
2695
+ vErrors.push(err37);
2001
2696
  }
2002
2697
  errors++;
2003
2698
  }
2004
2699
  }
2005
2700
  }
2006
2701
  if (data.kind !== void 0) {
2007
- let data6 = data.kind;
2008
- if (!(data6 === "sequence" || data6 === "architecture" || data6 === "state")) {
2009
- const err23 = { instancePath: instancePath + "/kind", schemaPath: "#/properties/kind/enum", keyword: "enum", params: { allowedValues: schema11.properties.kind.enum }, message: "must be equal to one of the allowed values" };
2702
+ let data32 = data.kind;
2703
+ if (!(data32 === "sequence" || data32 === "architecture" || data32 === "state" || data32 === "git")) {
2704
+ const err38 = { instancePath: instancePath + "/kind", schemaPath: "#/properties/kind/enum", keyword: "enum", params: { allowedValues: schema11.properties.kind.enum }, message: "must be equal to one of the allowed values" };
2010
2705
  if (vErrors === null) {
2011
- vErrors = [err23];
2706
+ vErrors = [err38];
2012
2707
  } else {
2013
- vErrors.push(err23);
2708
+ vErrors.push(err38);
2014
2709
  }
2015
2710
  errors++;
2016
2711
  }
2017
2712
  }
2018
2713
  if (data.title !== void 0) {
2019
- let data7 = data.title;
2020
- if (typeof data7 === "string") {
2021
- if (func3(data7) < 1) {
2022
- const err24 = { instancePath: instancePath + "/title", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
2714
+ let data33 = data.title;
2715
+ if (typeof data33 === "string") {
2716
+ if (func3(data33) < 1) {
2717
+ const err39 = { instancePath: instancePath + "/title", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
2023
2718
  if (vErrors === null) {
2024
- vErrors = [err24];
2719
+ vErrors = [err39];
2025
2720
  } else {
2026
- vErrors.push(err24);
2721
+ vErrors.push(err39);
2027
2722
  }
2028
2723
  errors++;
2029
2724
  }
2030
2725
  } else {
2031
- const err25 = { instancePath: instancePath + "/title", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
2726
+ const err40 = { instancePath: instancePath + "/title", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
2032
2727
  if (vErrors === null) {
2033
- vErrors = [err25];
2728
+ vErrors = [err40];
2034
2729
  } else {
2035
- vErrors.push(err25);
2730
+ vErrors.push(err40);
2036
2731
  }
2037
2732
  errors++;
2038
2733
  }
2039
2734
  }
2040
2735
  if (data.view !== void 0) {
2041
- let data8 = data.view;
2042
- if (!(data8 === "fixed" || data8 === "follow")) {
2043
- const err26 = { instancePath: instancePath + "/view", schemaPath: "#/properties/view/enum", keyword: "enum", params: { allowedValues: schema11.properties.view.enum }, message: "must be equal to one of the allowed values" };
2736
+ let data34 = data.view;
2737
+ if (!(data34 === "fixed" || data34 === "follow")) {
2738
+ const err41 = { instancePath: instancePath + "/view", schemaPath: "#/properties/view/enum", keyword: "enum", params: { allowedValues: schema11.properties.view.enum }, message: "must be equal to one of the allowed values" };
2044
2739
  if (vErrors === null) {
2045
- vErrors = [err26];
2740
+ vErrors = [err41];
2046
2741
  } else {
2047
- vErrors.push(err26);
2742
+ vErrors.push(err41);
2048
2743
  }
2049
2744
  errors++;
2050
2745
  }
2051
2746
  }
2052
2747
  if (data.regions !== void 0) {
2053
- let data9 = data.regions;
2054
- if (Array.isArray(data9)) {
2055
- const len1 = data9.length;
2056
- for (let i1 = 0; i1 < len1; i1++) {
2057
- if (!validate11(data9[i1], { instancePath: instancePath + "/regions/" + i1, parentData: data9, parentDataProperty: i1, rootData })) {
2748
+ let data35 = data.regions;
2749
+ if (Array.isArray(data35)) {
2750
+ const len7 = data35.length;
2751
+ for (let i7 = 0; i7 < len7; i7++) {
2752
+ if (!validate11(data35[i7], { instancePath: instancePath + "/regions/" + i7, parentData: data35, parentDataProperty: i7, rootData })) {
2058
2753
  vErrors = vErrors === null ? validate11.errors : vErrors.concat(validate11.errors);
2059
2754
  errors = vErrors.length;
2060
2755
  }
2061
2756
  }
2062
2757
  } else {
2063
- const err27 = { instancePath: instancePath + "/regions", schemaPath: "#/properties/regions/type", keyword: "type", params: { type: "array" }, message: "must be array" };
2758
+ const err42 = { instancePath: instancePath + "/regions", schemaPath: "#/properties/regions/type", keyword: "type", params: { type: "array" }, message: "must be array" };
2064
2759
  if (vErrors === null) {
2065
- vErrors = [err27];
2760
+ vErrors = [err42];
2066
2761
  } else {
2067
- vErrors.push(err27);
2762
+ vErrors.push(err42);
2068
2763
  }
2069
2764
  errors++;
2070
2765
  }
2071
2766
  }
2072
2767
  if (data.boxes !== void 0) {
2073
- let data11 = data.boxes;
2074
- if (Array.isArray(data11)) {
2075
- if (data11.length < 1) {
2076
- const err28 = { instancePath: instancePath + "/boxes", schemaPath: "#/properties/boxes/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
2077
- if (vErrors === null) {
2078
- vErrors = [err28];
2079
- } else {
2080
- vErrors.push(err28);
2081
- }
2082
- errors++;
2083
- }
2084
- const len2 = data11.length;
2085
- for (let i2 = 0; i2 < len2; i2++) {
2086
- if (!validate13(data11[i2], { instancePath: instancePath + "/boxes/" + i2, parentData: data11, parentDataProperty: i2, rootData })) {
2768
+ let data37 = data.boxes;
2769
+ if (Array.isArray(data37)) {
2770
+ const len8 = data37.length;
2771
+ for (let i8 = 0; i8 < len8; i8++) {
2772
+ if (!validate13(data37[i8], { instancePath: instancePath + "/boxes/" + i8, parentData: data37, parentDataProperty: i8, rootData })) {
2087
2773
  vErrors = vErrors === null ? validate13.errors : vErrors.concat(validate13.errors);
2088
2774
  errors = vErrors.length;
2089
2775
  }
2090
2776
  }
2091
2777
  } else {
2092
- const err29 = { instancePath: instancePath + "/boxes", schemaPath: "#/properties/boxes/type", keyword: "type", params: { type: "array" }, message: "must be array" };
2778
+ const err43 = { instancePath: instancePath + "/boxes", schemaPath: "#/properties/boxes/type", keyword: "type", params: { type: "array" }, message: "must be array" };
2093
2779
  if (vErrors === null) {
2094
- vErrors = [err29];
2780
+ vErrors = [err43];
2095
2781
  } else {
2096
- vErrors.push(err29);
2782
+ vErrors.push(err43);
2097
2783
  }
2098
2784
  errors++;
2099
2785
  }
@@ -2105,30 +2791,30 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
2105
2791
  }
2106
2792
  }
2107
2793
  if (data.steps !== void 0) {
2108
- let data14 = data.steps;
2109
- if (Array.isArray(data14)) {
2110
- if (data14.length < 1) {
2111
- const err30 = { instancePath: instancePath + "/steps", schemaPath: "#/properties/steps/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
2794
+ let data40 = data.steps;
2795
+ if (Array.isArray(data40)) {
2796
+ if (data40.length < 1) {
2797
+ const err44 = { instancePath: instancePath + "/steps", schemaPath: "#/properties/steps/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
2112
2798
  if (vErrors === null) {
2113
- vErrors = [err30];
2799
+ vErrors = [err44];
2114
2800
  } else {
2115
- vErrors.push(err30);
2801
+ vErrors.push(err44);
2116
2802
  }
2117
2803
  errors++;
2118
2804
  }
2119
- const len3 = data14.length;
2120
- for (let i3 = 0; i3 < len3; i3++) {
2121
- if (!validate17(data14[i3], { instancePath: instancePath + "/steps/" + i3, parentData: data14, parentDataProperty: i3, rootData })) {
2805
+ const len9 = data40.length;
2806
+ for (let i9 = 0; i9 < len9; i9++) {
2807
+ if (!validate17(data40[i9], { instancePath: instancePath + "/steps/" + i9, parentData: data40, parentDataProperty: i9, rootData })) {
2122
2808
  vErrors = vErrors === null ? validate17.errors : vErrors.concat(validate17.errors);
2123
2809
  errors = vErrors.length;
2124
2810
  }
2125
2811
  }
2126
2812
  } else {
2127
- const err31 = { instancePath: instancePath + "/steps", schemaPath: "#/properties/steps/type", keyword: "type", params: { type: "array" }, message: "must be array" };
2813
+ const err45 = { instancePath: instancePath + "/steps", schemaPath: "#/properties/steps/type", keyword: "type", params: { type: "array" }, message: "must be array" };
2128
2814
  if (vErrors === null) {
2129
- vErrors = [err31];
2815
+ vErrors = [err45];
2130
2816
  } else {
2131
- vErrors.push(err31);
2817
+ vErrors.push(err45);
2132
2818
  }
2133
2819
  errors++;
2134
2820
  }
@@ -2145,12 +2831,18 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
2145
2831
  errors = vErrors.length;
2146
2832
  }
2147
2833
  }
2834
+ if (data.git !== void 0) {
2835
+ if (!validate29(data.git, { instancePath: instancePath + "/git", parentData: data, parentDataProperty: "git", rootData })) {
2836
+ vErrors = vErrors === null ? validate29.errors : vErrors.concat(validate29.errors);
2837
+ errors = vErrors.length;
2838
+ }
2839
+ }
2148
2840
  } else {
2149
- const err32 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2841
+ const err46 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2150
2842
  if (vErrors === null) {
2151
- vErrors = [err32];
2843
+ vErrors = [err46];
2152
2844
  } else {
2153
- vErrors.push(err32);
2845
+ vErrors.push(err46);
2154
2846
  }
2155
2847
  errors++;
2156
2848
  }
@@ -2160,16 +2852,23 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
2160
2852
 
2161
2853
  // src/words.ts
2162
2854
  var keys = (table) => Object.keys(table);
2163
- var KINDS = keys({ sequence: true, architecture: true, state: true });
2855
+ var KINDS = keys({ sequence: true, architecture: true, state: true, git: true });
2164
2856
  var STATE_ENDS = ["start", "finish"];
2165
- var HEADS = ["group", "end", "box", "strip", "step", "say", "code", "act", "note", "set"];
2857
+ var HEADS = ["group", "end", "box", "strip", "step", "say", "code", "act", "note", "set", "branch", "commit"];
2166
2858
  var AS = "as";
2859
+ var ON = "on";
2860
+ var COPY = "copy";
2861
+ var MERGE = "merge";
2862
+ var FROM = "from";
2863
+ var HEAD = "HEAD";
2167
2864
  var ATTRS = {
2168
2865
  diagram: ["view"],
2169
2866
  group: ["note", "color", "icon"],
2170
2867
  box: ["note", "color", "icon"],
2171
2868
  edge: ["carry", "tag", "side"],
2172
- set: ["tag"]
2869
+ set: ["tag"],
2870
+ branch: ["note"],
2871
+ commit: ["hash", "note"]
2173
2872
  };
2174
2873
  var CARRIES = keys({ coin: true, none: true });
2175
2874
  var VIEWS = keys({ fixed: true, follow: true });
@@ -2185,17 +2884,17 @@ var OLD_HEADS = {
2185
2884
 
2186
2885
  // src/schema.ts
2187
2886
  var COLORS = ["blue", "amber", "green", "violet", "rose", "slate", "coin"];
2188
- var EVENT_TYPES = ["edge", "action", "swap", "strip"];
2189
- var ROOT_NOT_ALLOWED = {
2190
- "#/else/not": { field: "sequence", kind: "sequence" },
2191
- "#/then/not": { field: "state", kind: "state" },
2192
- "#/else/else/not": { field: "state", kind: "state" }
2193
- };
2887
+ var EVENT_TYPES = ["edge", "action", "swap", "strip", "commit", "branch"];
2888
+ var ABSENT = "#/definitions/absent/not";
2889
+ var ABSENT_KINDS = { regions: "sequence / architecture / state" };
2194
2890
  var NOT_ALLOWED = {
2195
2891
  carry: { field: "text", kind: "tag" }
2196
2892
  };
2197
2893
  var RESERVED_ID = /\/boxes\/items\/properties\/id\/not$/u;
2894
+ var GIT_EVENT = /\/events\/items\/properties\/type\/not$/u;
2895
+ var GIT_EVENTS = ["commit", "branch"];
2198
2896
  var escape = (key2) => key2.replaceAll("~", "~0").replaceAll("/", "~1");
2897
+ var HEX = /^\^\[0-9a-f\]\{(\d+),(\d+)\}\$$/u;
2199
2898
  function forbiddenOf(pattern) {
2200
2899
  const inside = /^\^\[\^(.+)\]\+\$$/u.exec(pattern)?.[1];
2201
2900
  if (inside === void 0) return void 0;
@@ -2219,7 +2918,10 @@ function toFieldError(error, errors, m) {
2219
2918
  }
2220
2919
  case "not": {
2221
2920
  if (RESERVED_ID.test(error.schemaPath)) return { pointer: at, message: m.reserved(STATE_ENDS) };
2222
- const allowed = at === "" ? ROOT_NOT_ALLOWED[error.schemaPath] : NOT_ALLOWED[at.slice(at.lastIndexOf("/") + 1)];
2921
+ if (GIT_EVENT.test(error.schemaPath)) return { pointer: at, message: m.kindOnly(GIT_EVENTS, "git") };
2922
+ const last = at.slice(at.lastIndexOf("/") + 1);
2923
+ if (error.schemaPath === ABSENT) return { pointer: at, message: m.not({ field: last, kind: ABSENT_KINDS[last] ?? last }) };
2924
+ const allowed = NOT_ALLOWED[last];
2223
2925
  return { pointer: allowed ? `${at}/${allowed.field}` : at, message: m.not(allowed) };
2224
2926
  }
2225
2927
  case "anyOf": {
@@ -2237,8 +2939,10 @@ function toFieldError(error, errors, m) {
2237
2939
  return { pointer: at, message: m.type(String(params.type)) };
2238
2940
  case "minLength":
2239
2941
  return { pointer: at, message: m.minLength(Number(params.limit)) };
2240
- case "pattern":
2241
- return { pointer: at, message: m.pattern(forbiddenOf(String(params.pattern))) };
2942
+ case "pattern": {
2943
+ const hex = HEX.exec(String(params.pattern));
2944
+ return { pointer: at, message: hex ? m.hex(Number(hex[1]), Number(hex[2])) : m.pattern(forbiddenOf(String(params.pattern))) };
2945
+ }
2242
2946
  case "minItems":
2243
2947
  return { pointer: at, message: m.minItems(Number(params.limit)) };
2244
2948
  case "minimum":
@@ -2295,8 +2999,8 @@ var ja2 = () => {
2295
2999
  sayTwice: "1 \u3064\u306E\u6BB5\u306B say \u306F 1 \u3064\u307E\u3067\u3002\u9577\u3044\u672C\u6587\u306F say \u306E\u4E0B\u306B\u5B57\u4E0B\u3052\u3057\u3066\u7D9A\u3051\u308B",
2296
3000
  codeTwice: "1 \u3064\u306E\u6BB5\u306B code \u306F 1 \u884C\u307E\u3067",
2297
3001
  emptyCode: "code \u306E\u5F8C\u308D\u306B\u547D\u4EE4\u3092\u66F8\u304F",
2298
- declarationInStep: "group \u3068 box \u3068 strip \u306F\u6700\u521D\u306E step \u3088\u308A\u524D\u306B\u66F8\u304F",
2299
- stepLineBeforeStep: "\u7DDA\u3068 say \u3068 code \u3068 act \u3068 note \u3068 set \u306F step \u306E\u4E0B\u306B\u66F8\u304F",
3002
+ declarationInStep: "group \u3068 box \u3068 strip \u3068 branch \u306F\u6700\u521D\u306E step \u3088\u308A\u524D\u306B\u66F8\u304F",
3003
+ stepLineBeforeStep: "\u7DDA\u3068 say \u3068 code \u3068 act \u3068 note \u3068 set \u3068 commit \u3068\u679D\u3092\u5207\u308B\u884C\u306F step \u306E\u4E0B\u306B\u66F8\u304F",
2300
3004
  nestedGroup: "group \u306E\u4E2D\u306B group \u306F\u66F8\u3051\u306A\u3044\u3002\u5148\u306B end \u3067\u9589\u3058\u308B",
2301
3005
  strayEnd: "end \u306E\u524D\u306B\u3001\u9589\u3058\u308B group \u304C\u7121\u3044",
2302
3006
  endTakesNothing: "end \u306E\u5F8C\u308D\u306B\u306F\u4F55\u3082\u66F8\u304B\u306A\u3044",
@@ -2328,7 +3032,20 @@ var ja2 = () => {
2328
3032
  reservedId: (id) => `${id} \u306F\u72B6\u614B\u9077\u79FB\u56F3\u306E\u59CB\u307E\u308A\u3068\u7D42\u308F\u308A\u306E\u5370\u306E\u540D\u524D\u3067\u3001\u7BB1\u306E\u540D\u672D\u306B\u4F7F\u3048\u306A\u3044`,
2329
3033
  intoStart: "start \u3078\u5165\u308B\u7DDA\u306F\u66F8\u3051\u306A\u3044\u3002start \u306F\u59CB\u307E\u308A\u306E\u5370\u3067\u3001\u7DDA\u306F start \u304B\u3089\u51FA\u308B",
2330
3034
  outOfFinish: "finish \u304B\u3089\u51FA\u308B\u7DDA\u306F\u66F8\u3051\u306A\u3044\u3002finish \u306F\u7D42\u308F\u308A\u306E\u5370\u3067\u3001\u7DDA\u306F finish \u3078\u5165\u308B",
2331
- pathNoAttrs: "\u6700\u521D\u306E step \u3088\u308A\u524D\u306E\u7DDA\u306F\u4ECA\u56DE\u306F\u901A\u3089\u306A\u3044\u9053\u306A\u306E\u3067\u3001\u5C5E\u6027 (carry \u3068 tag \u3068 side) \u3092\u66F8\u3051\u306A\u3044"
3035
+ pathNoAttrs: "\u6700\u521D\u306E step \u3088\u308A\u524D\u306E\u7DDA\u306F\u4ECA\u56DE\u306F\u901A\u3089\u306A\u3044\u9053\u306A\u306E\u3067\u3001\u5C5E\u6027 (carry \u3068 tag \u3068 side) \u3092\u66F8\u3051\u306A\u3044",
3036
+ gitOnly: (word) => `${word} \u306E\u884C\u306F git (\u679D\u5206\u304B\u308C\u306E\u56F3) \u3067\u3060\u3051\u66F8\u3051\u308B`,
3037
+ gitNoGroup: "git (\u679D\u5206\u304B\u308C\u306E\u56F3) \u306B\u306F group \u3092\u66F8\u3051\u306A\u3044\u3002\u679D\u306F branch \u306E\u884C\u3067\u5BA3\u8A00\u3059\u308B",
3038
+ noBranches: "branch \u306E\u884C\u3067\u679D\u3092 1 \u3064\u4EE5\u4E0A\u5BA3\u8A00\u3059\u308B",
3039
+ branchShape: "branch \u306F branch <\u540D\u672D> [note: <\u6DFB\u3048\u66F8\u304D>] \u306E\u5F62\u3067\u66F8\u304F",
3040
+ commitShape: "commit \u306F commit <\u540D\u672D> on <\u679D> [hash: <hash>, note: <\u4E00\u8A00>] \u306E\u5F62\u3067\u66F8\u304F\u3002\u5F53\u3066\u76F4\u3057\u306F copy <commit> \u3092\u3001\u53D6\u308A\u8FBC\u307F\u306F merge <\u679D> \u3092 on <\u679D> \u306E\u5F8C\u308D\u306B\u66F8\u304F",
3041
+ fromShape: "\u679D\u3092\u5207\u308B\u884C\u306F <\u679D> from <commit> \u306E\u5F62\u3067\u66F8\u304F",
3042
+ undeclaredBranch: (id) => `${id} \u3068\u3044\u3046\u679D\u306F\u5BA3\u8A00\u3057\u3066\u3044\u306A\u3044`,
3043
+ undeclaredRef: (id) => `${id} \u3068\u3044\u3046\u679D\u306F\u5BA3\u8A00\u3057\u3066\u3044\u306A\u3044\u3002\u672D\u3092\u52D5\u304B\u3059\u7DDA\u306F\u679D\u306E\u540D\u672D\u304B HEAD \u304B\u3089\u5F15\u304F`,
3044
+ noCommit: (id) => `${id} \u3068\u3044\u3046 commit \u306F\u307E\u3060\u7A4D\u3093\u3067\u3044\u306A\u3044`,
3045
+ emptyBranch: (id) => `${id} \u306E\u679D\u306F\u307E\u3060\u3069\u306E commit \u3082\u6307\u3057\u3066\u3044\u306A\u3044\u306E\u3067\u53D6\u308A\u8FBC\u3081\u306A\u3044`,
3046
+ mergeSelf: (id) => `${id} \u306F\u7A4D\u3080\u679D\u306A\u306E\u3067\u3001\u53D6\u308A\u8FBC\u3080\u679D\u306B\u3067\u304D\u306A\u3044`,
3047
+ headReserved: (name2) => `${name2} \u306F\u679D\u5206\u304B\u308C\u306E\u56F3\u3067\u4ECA\u3044\u308B\u5834\u6240\u306E\u672D\u306E\u540D\u524D\u3067\u3001\u540D\u672D\u306B\u4F7F\u3048\u306A\u3044`,
3048
+ badHash: "hash \u306F 0 \u304B\u3089 9 \u3068 a \u304B\u3089 f \u306E\u5B57\u3067 4 \u304B\u3089 40 \u5B57\u306B\u3059\u308B"
2332
3049
  };
2333
3050
  };
2334
3051
  var en2 = () => {
@@ -2364,8 +3081,8 @@ var en2 = () => {
2364
3081
  sayTwice: "A step takes one say. Continue a long body on indented lines below it",
2365
3082
  codeTwice: "A step takes at most one code line",
2366
3083
  emptyCode: "Write the command after code",
2367
- declarationInStep: "Write group, box and strip before the first step",
2368
- stepLineBeforeStep: "Write lines, say, code, act, note and set under a step",
3084
+ declarationInStep: "Write group, box, strip and branch before the first step",
3085
+ stepLineBeforeStep: "Write lines, say, code, act, note, set, commit and branch cuts under a step",
2369
3086
  nestedGroup: "A group cannot hold another group. Close it with end first",
2370
3087
  strayEnd: "There is no group for this end to close",
2371
3088
  endTakesNothing: "Write nothing after end",
@@ -2397,7 +3114,20 @@ var en2 = () => {
2397
3114
  reservedId: (id) => `${id} names the start or end mark of a state diagram and cannot be a box id`,
2398
3115
  intoStart: "A line cannot go into start. start is the start mark, and lines leave it",
2399
3116
  outOfFinish: "A line cannot leave finish. finish is the end mark, and lines go into it",
2400
- pathNoAttrs: "A line before the first step is a path not taken, so it takes no attributes (carry, tag, side)"
3117
+ pathNoAttrs: "A line before the first step is a path not taken, so it takes no attributes (carry, tag, side)",
3118
+ gitOnly: (word) => `${word} lines can be written only in git diagrams`,
3119
+ gitNoGroup: "A git diagram takes no group. Declare branches with branch lines",
3120
+ noBranches: "Declare at least one branch with a branch line",
3121
+ branchShape: "Write a branch as branch <id> [note: <note>]",
3122
+ commitShape: "Write a commit as commit <id> on <branch> [hash: <hash>, note: <note>]. For a replayed commit add copy <commit>, and for a merge commit add merge <branch>, after on <branch>",
3123
+ fromShape: "Write a branch cut as <branch> from <commit>",
3124
+ undeclaredBranch: (id) => `No branch named ${id} is declared`,
3125
+ undeclaredRef: (id) => `No branch named ${id} is declared. A line that moves a ref starts from a branch id or HEAD`,
3126
+ noCommit: (id) => `No commit named ${id} has been made yet`,
3127
+ emptyBranch: (id) => `Branch ${id} does not point at any commit yet, so it cannot be merged`,
3128
+ mergeSelf: (id) => `${id} is the branch being committed to, so it cannot be the branch merged in`,
3129
+ headReserved: (name2) => `${name2} names where you are in a git diagram and cannot be an id`,
3130
+ badHash: "Write a hash as 4 to 40 characters of 0-9 and a-f"
2401
3131
  };
2402
3132
  };
2403
3133
  var MESSAGES = { ja: ja2(), en: en2() };
@@ -2454,6 +3184,9 @@ var NotationError = class extends Error {
2454
3184
  var fail = (source, index, message) => new NotationError(source.line, columnOf(source, index), message);
2455
3185
  var ID = /^[^\s[\]「」=:]+$/u;
2456
3186
  var EDGE = /^([^\s:[\]]+?)\s*->\s*([^\s:[\]]+)/du;
3187
+ var COMMIT = new RegExp(`^commit\\s+([^\\s[]+)(?:\\s+${ON}\\s+([^\\s[]+))?(?:\\s+${COPY}\\s+([^\\s[]+))?(?:\\s+${MERGE}\\s+([^\\s[]+))?`, "du");
3188
+ var CUT = new RegExp(`^([^\\s[]+)\\s+${FROM}(?:\\s+([^\\s[]+))?\\s*$`, "du");
3189
+ var HASH = /^[0-9a-f]{4,40}$/u;
2457
3190
  var isOneOf = (list2, word) => list2.includes(word);
2458
3191
  function skipSpaces(text2, at) {
2459
3192
  let i = at;
@@ -2602,6 +3335,10 @@ function parseLines(lines, m) {
2602
3335
  if (shown2 && !isOneOf(VIEWS, shown2.value)) throw fail(head, shown2.at, m.badView);
2603
3336
  const view = shown2?.value;
2604
3337
  const isState = kind === "state";
3338
+ const isGit = kind === "git";
3339
+ const branches = [];
3340
+ const commits = /* @__PURE__ */ new Set();
3341
+ const tips = /* @__PURE__ */ new Map();
2605
3342
  const regions = [];
2606
3343
  const boxes = [];
2607
3344
  const paths = [];
@@ -2618,13 +3355,27 @@ function parseLines(lines, m) {
2618
3355
  if (!boxes.some((box) => box.id === id)) throw fail(source, at, m.undeclaredBox(id));
2619
3356
  return id;
2620
3357
  };
3358
+ const branchAt = (source, id, at) => {
3359
+ if (!tips.has(id)) throw fail(source, at, m.undeclaredBranch(id));
3360
+ return id;
3361
+ };
3362
+ const commitAt = (source, id, at) => {
3363
+ if (!commits.has(id)) throw fail(source, at, m.noCommit(id));
3364
+ return id;
3365
+ };
2621
3366
  const endAt = (source, id, at, side2) => {
3367
+ if (isGit) {
3368
+ if (side2 === "to") return commitAt(source, id, at);
3369
+ if (id !== HEAD && !tips.has(id)) throw fail(source, at, m.undeclaredRef(id));
3370
+ return id;
3371
+ }
2622
3372
  if (!isState || !isOneOf(STATE_ENDS, id)) return boxAt(source, id, at);
2623
3373
  if (id === "start" !== (side2 === "from")) throw fail(source, at, id === "start" ? m.intoStart : m.outOfFinish);
2624
3374
  return id;
2625
3375
  };
2626
3376
  const notReserved = (source, id, at) => {
2627
3377
  if (isState && isOneOf(STATE_ENDS, id)) throw fail(source, at, m.reservedId(id));
3378
+ if (isGit && id === HEAD) throw fail(source, at, m.headReserved(id));
2628
3379
  };
2629
3380
  const inStep = (source) => {
2630
3381
  if (!building) throw fail(source, 0, m.stepLineBeforeStep);
@@ -2654,7 +3405,13 @@ function parseLines(lines, m) {
2654
3405
  else inStep(source).events.push(readEdge(source, edge2));
2655
3406
  continue;
2656
3407
  }
2657
- const word = text2.split(/\s/u)[0] ?? "";
3408
+ const [word = "", second] = text2.split(/\s+/u);
3409
+ if (isGit && tips.has(word) && second === FROM) {
3410
+ const step = inStep(source);
3411
+ step.events.push(readCut(source));
3412
+ continue;
3413
+ }
3414
+ if (!isGit && (word === "branch" || word === "commit")) throw fail(source, 0, m.gitOnly(word));
2658
3415
  if (!isOneOf(HEADS, word)) {
2659
3416
  const old = oldForm(text2, building !== void 0);
2660
3417
  throw fail(source, 0, old ? m.oldForm(old.word, old.shape) : m.unknownHead(word));
@@ -2708,11 +3465,20 @@ function parseLines(lines, m) {
2708
3465
  case "set":
2709
3466
  inStep(source).events.push(readSet(source));
2710
3467
  break;
3468
+ case "branch":
3469
+ readBranch(source);
3470
+ break;
3471
+ case "commit": {
3472
+ const step = inStep(source);
3473
+ step.events.push(readCommit(source));
3474
+ break;
3475
+ }
2711
3476
  }
2712
3477
  }
2713
3478
  if (group) throw fail(group.source, 0, m.unclosedGroup(group.id));
2714
3479
  finish();
2715
- if (boxes.length === 0) throw fail(head, 0, m.noBoxes);
3480
+ if (isGit && branches.length === 0) throw fail(head, 0, m.noBranches);
3481
+ if (boxes.length === 0 && !isGit) throw fail(head, 0, m.noBoxes);
2716
3482
  if (steps.length === 0) throw fail(head, 0, m.noSteps);
2717
3483
  return {
2718
3484
  version: FORMAT_VERSION,
@@ -2724,10 +3490,12 @@ function parseLines(lines, m) {
2724
3490
  ...strip2 ? { strip: strip2 } : {},
2725
3491
  steps,
2726
3492
  ...kind === "sequence" ? { sequence: { lifelines: boxes.map((box) => box.id) } } : {},
2727
- ...paths.length > 0 ? { state: { paths } } : {}
3493
+ ...paths.length > 0 ? { state: { paths } } : {},
3494
+ ...isGit ? { git: { branches } } : {}
2728
3495
  };
2729
3496
  function readGroup(source) {
2730
3497
  beforeSteps(source);
3498
+ if (isGit) throw fail(source, 0, m.gitNoGroup);
2731
3499
  if (group) throw fail(source, 0, m.nestedGroup);
2732
3500
  const declared = readDeclared(source, "group", ATTRS.group, m);
2733
3501
  if (regions.some((region) => region.id === declared.id)) {
@@ -2753,6 +3521,62 @@ function parseLines(lines, m) {
2753
3521
  ...group ? { region: group.id } : {}
2754
3522
  });
2755
3523
  }
3524
+ function readBranch(source) {
3525
+ beforeSteps(source);
3526
+ const declared = readDeclared(source, "branch", ATTRS.branch, m);
3527
+ if (declared.name !== void 0) throw fail(source, 0, m.branchShape);
3528
+ notReserved(source, declared.id, declared.idAt);
3529
+ declare(source, declared.id, declared.idAt);
3530
+ const note = declared.attrs.get("note")?.value;
3531
+ branches.push({ id: declared.id, ...note !== void 0 ? { note } : {} });
3532
+ tips.set(declared.id, null);
3533
+ }
3534
+ function readCommit(source) {
3535
+ const text2 = source.text;
3536
+ const found = COMMIT.exec(text2);
3537
+ const at = (k) => found?.indices?.[k]?.[0] ?? 0;
3538
+ const id = found?.[1];
3539
+ const on = found?.[2];
3540
+ if (!found || id === void 0 || on === void 0) throw fail(source, 0, m.commitShape);
3541
+ const rest2 = skipSpaces(text2, found[0].length);
3542
+ if (rest2 < text2.length && text2[rest2] !== "[") throw fail(source, rest2, m.commitShape);
3543
+ if (!ID.test(id)) throw fail(source, at(1), m.badId(id));
3544
+ notReserved(source, id, at(1));
3545
+ declare(source, id, at(1));
3546
+ const branch = branchAt(source, on, at(2));
3547
+ const copy = found[3] === void 0 ? void 0 : commitAt(source, found[3], at(3));
3548
+ const merge = found[4] === void 0 ? void 0 : mergedAt(source, found[4], at(4), branch);
3549
+ const attrs2 = rest2 < text2.length ? readAttrs(source, rest2, ATTRS.commit, m) : /* @__PURE__ */ new Map();
3550
+ const hash = attrs2.get("hash");
3551
+ if (hash && !HASH.test(hash.value)) throw fail(source, hash.at, m.badHash);
3552
+ const note = attrs2.get("note")?.value;
3553
+ commits.add(id);
3554
+ if (copy === void 0) tips.set(branch, id);
3555
+ return {
3556
+ type: "commit",
3557
+ id,
3558
+ branch,
3559
+ ...copy !== void 0 ? { copy } : {},
3560
+ ...merge !== void 0 ? { merge } : {},
3561
+ ...hash ? { hash: hash.value } : {},
3562
+ ...note !== void 0 ? { note } : {}
3563
+ };
3564
+ }
3565
+ function mergedAt(source, id, at, into) {
3566
+ branchAt(source, id, at);
3567
+ if (id === into) throw fail(source, at, m.mergeSelf(id));
3568
+ if (tips.get(id) === null) throw fail(source, at, m.emptyBranch(id));
3569
+ return id;
3570
+ }
3571
+ function readCut(source) {
3572
+ const found = CUT.exec(source.text);
3573
+ const branch = found?.[1];
3574
+ const from = found?.[2];
3575
+ if (!found || branch === void 0 || from === void 0) throw fail(source, 0, m.fromShape);
3576
+ commitAt(source, from, found.indices?.[2]?.[0] ?? 0);
3577
+ tips.set(branch, from);
3578
+ return { type: "branch", branch, from };
3579
+ }
2756
3580
  function readStrip(source) {
2757
3581
  beforeSteps(source);
2758
3582
  if (strip2) throw fail(source, 0, m.stripTwice);
@@ -2826,9 +3650,10 @@ function parseLines(lines, m) {
2826
3650
  if (carried && !isOneOf(CARRIES, carried.value)) throw fail(source, carried.at, m.badCarry);
2827
3651
  const side2 = attrs2.get("side");
2828
3652
  if (side2 && !isOneOf(SIDES, side2.value)) throw fail(source, side2.at, m.badSide);
2829
- let carry = { kind: "envelope" };
3653
+ let carry = isGit ? { kind: "tag", text: from } : { kind: "envelope" };
2830
3654
  if (tag) carry = { kind: "tag", text: tag.value };
2831
3655
  else if (carried) carry = carried.value === "coin" ? { kind: "coin" } : { kind: "none" };
3656
+ if (isGit && from !== HEAD) tips.set(from, to);
2832
3657
  return {
2833
3658
  type: "edge",
2834
3659
  from,
@@ -2904,10 +3729,11 @@ var declareBox = (b) => `box ${b.id}${shown(b.id, b.name)}${attrs([
2904
3729
  ["icon", b.icon]
2905
3730
  ])}`;
2906
3731
  var line = (from, to, label2) => `${from} -> ${to}${label2 === void 0 ? "" : `: ${name(label2)}`}`;
2907
- function event(e) {
3732
+ function event(e, git) {
2908
3733
  switch (e.type) {
2909
3734
  case "edge": {
2910
- const carry = e.carry.kind === "tag" ? [["tag", e.carry.text]] : e.carry.kind === "envelope" ? [] : [["carry", e.carry.kind]];
3735
+ const plain = git ? e.carry.kind === "tag" && e.carry.text === e.from : e.carry.kind === "envelope";
3736
+ const carry = plain ? [] : e.carry.kind === "tag" ? [["tag", e.carry.text]] : [["carry", e.carry.kind]];
2911
3737
  return `${line(e.from, e.to, e.label)}${attrs([...carry, ["side", e.labelSide]])}`;
2912
3738
  }
2913
3739
  case "action":
@@ -2916,6 +3742,13 @@ function event(e) {
2916
3742
  return `note ${e.box}: ${e.text}`;
2917
3743
  case "strip":
2918
3744
  return `set ${key(e.field)}${e.value === void 0 ? "" : `: ${name(e.value)}`}${attrs([["tag", e.tag]])}`;
3745
+ case "commit":
3746
+ return `commit ${e.id} ${ON} ${e.branch}${e.copy === void 0 ? "" : ` ${COPY} ${e.copy}`}${e.merge === void 0 ? "" : ` ${MERGE} ${e.merge}`}${attrs([
3747
+ ["hash", e.hash],
3748
+ ["note", e.note]
3749
+ ])}`;
3750
+ case "branch":
3751
+ return `${e.branch} ${FROM} ${e.from}`;
2919
3752
  }
2920
3753
  }
2921
3754
  function declarations(diagram) {
@@ -2951,14 +3784,15 @@ end`);
2951
3784
  return blocks;
2952
3785
  }
2953
3786
  function printNotation(diagram) {
2954
- const blocks = [`${diagram.kind} ${name(diagram.title)}${attrs([["view", diagram.view]])}`, ...declarations(diagram)];
3787
+ const branches = (diagram.git?.branches ?? []).map((b) => `branch ${b.id}${attrs([["note", b.note]])}`);
3788
+ const blocks = [`${diagram.kind} ${name(diagram.title)}${attrs([["view", diagram.view]])}`, ...branches.length > 0 ? [branches.join("\n")] : [], ...declarations(diagram)];
2955
3789
  if (diagram.strip) blocks.push(`strip ${key(diagram.strip.title)}: ${diagram.strip.fields.map(field).join(", ")}`);
2956
3790
  if (diagram.state) blocks.push(diagram.state.paths.map((p) => line(p.from, p.to, p.label)).join("\n"));
2957
3791
  for (const step of diagram.steps) {
2958
3792
  const body = step.body.split("\n");
2959
3793
  const say = body.length === 1 ? [` say ${step.body}`] : [" say", ...body.map((line2) => line2 === "" ? "" : ` ${line2}`)];
2960
3794
  blocks.push(
2961
- [`step ${step.title}`, ...say, ...step.code === void 0 ? [] : [` code ${step.code}`], ...step.events.map((e) => ` ${event(e)}`)].join("\n")
3795
+ [`step ${step.title}`, ...say, ...step.code === void 0 ? [] : [` code ${step.code}`], ...step.events.map((e) => ` ${event(e, diagram.kind === "git")}`)].join("\n")
2962
3796
  );
2963
3797
  }
2964
3798
  return `${blocks.join("\n\n")}
@@ -3224,7 +4058,11 @@ var TYPE = {
3224
4058
  stepTitle: text(15, 700),
3225
4059
  stepBody: text(13.5, 500),
3226
4060
  stepNo: text(13, 700, "mono"),
3227
- button: text(14, 700)
4061
+ button: text(14, 700),
4062
+ /** 枝分かれの図 (#3164) の、丸の中の commit の名札と、丸の外に添える hash と一言 */
4063
+ gitId: text(11, 700),
4064
+ gitHash: text(10.5, 600, "mono"),
4065
+ gitNote: text(10.5, 650)
3228
4066
  };
3229
4067
  var LOOK = {
3230
4068
  /** 部品どうしの最小の隙間 */
@@ -3268,6 +4106,41 @@ var LOOK = {
3268
4106
  done: { r: 6.5, inset: 13 },
3269
4107
  pastLabel: 0.85
3270
4108
  },
4109
+ /**
4110
+ * 枝分かれの図 (#3164)。見本帳の試作 (`scenes/git.js`) の寸法を写す。
4111
+ * commit は列ごとに `pitch` ずつ右へ並べ、一番上でない帯の commit は列の半分だけ右へずらす。`x0` は最初の列の真ん中の x の下限、
4112
+ * `textGap` は隣の列の hash と一言の間に空ける最小の隙間。`r` は丸の半径、`orphan` はどの札からも辿れなくなった commit の点線の丸の半径。
4113
+ * `topLine` と `line` は帯の上端から丸を並べる線まで (一番上の帯と、それより下の帯)、`topBelow` と `below` は線から帯の下端まで。
4114
+ * `bare` は線の名前を下に置かない帯の、線から帯の下端まで。
4115
+ * hash と一言は一番上の帯では丸の上に、ほかの帯では丸の下に置き、`above` と `under` は丸の真ん中から丸に近い行の基準線まで、`lineStep` は行の間。
4116
+ * 札は丸の上に段を重ねて置き、`tagTop` と `tag` は丸の真ん中から 1 段目の札の真ん中まで (一番上の帯と、ほかの帯)、`row` は札の段の間。
4117
+ * 札の段が 2 段より多い commit がある帯は、多い段の分だけ線を下げる。
4118
+ * `turn` は枝へ分かれる線と枝から入る線が曲がり終えて横へ進むまでの長さ、`samples` は曲がりを区切る点の数、`boxGap` は commit の並びと箱の間。
4119
+ * `labelUnder` はほかの帯で、丸の真ん中から線の名前の札の上端まで。`colors` は帯の色を上から配る順
4120
+ */
4121
+ git: {
4122
+ x0: 120,
4123
+ pitch: 90,
4124
+ textGap: 12,
4125
+ r: 12,
4126
+ orphan: 13.5,
4127
+ topLine: 120,
4128
+ line: 90,
4129
+ topBelow: 30,
4130
+ below: 82,
4131
+ bare: 62,
4132
+ above: 18,
4133
+ under: 27,
4134
+ lineStep: 13,
4135
+ tagTop: 58,
4136
+ tag: 30,
4137
+ row: 22,
4138
+ turn: 60,
4139
+ samples: 12,
4140
+ boxGap: 24,
4141
+ labelUnder: 50,
4142
+ colors: ["blue", "violet", "green", "amber", "rose"]
4143
+ },
3271
4144
  /** `bend` は線の曲がりを丸める半径 (#3171) */
3272
4145
  edge: { inset: 3, arrow: 6, arrowHalf: 3.5, parallel: 5, ghostDash: 5, flowDash: 9, bend: 12 },
3273
4146
  /** `touch` は線の名前と、同じ時刻に見えている段の番号の丸の間に空ける最小の隙間 (#3175) */
@@ -3288,7 +4161,7 @@ var LOOK = {
3288
4161
  * `trail` は状態遷移図の帯の最後の、通った状態の点 (#3171)。`r` は点の半径、`step` は点の中心どうしの間、`now` は変わった値の欄の名前の横の点の半径と、名前からの離れ
3289
4162
  */
3290
4163
  strip: { h: 72, line: 44, pad: 12, icon: 24, titleX: 44, fieldGap: 22, sepInset: 14, tagGap: 6, tagH: 15, tagPadX: 7, nameY: 22, valueY: 43, trail: { r: 5.4, step: 16 }, now: { r: 3, gap: 7 } },
3291
- stroke: { mark: 1.6, slot: 1.2, hair: 1, edge: 1.7, edgeOn: 2.25, arrow: 1.5, flow: 1.3, halo: 7, on: 1.75, glyph: 2, lifeline: 1.2, envelope: 1.5, badgeRing: 1.5, path: 1.6, end: 1.6, done: 1.2, trail: 1.2 },
4164
+ stroke: { git: 2.25, gitOrphan: 1.5, mark: 1.6, slot: 1.2, hair: 1, edge: 1.7, edgeOn: 2.25, arrow: 1.5, flow: 1.3, halo: 7, on: 1.75, glyph: 2, lifeline: 1.2, envelope: 1.5, badgeRing: 1.5, path: 1.6, end: 1.6, done: 1.2, trail: 1.2 },
3292
4165
  shadow: { near: 0.8, far: 4, nearY: 1, farY: 3 },
3293
4166
  mini: { w: 168, pad: 8, title: 14, inset: 12, radius: 10 },
3294
4167
  /**
@@ -3910,7 +4783,7 @@ function arrange(diagram, groups, slots, rooms) {
3910
4783
  const headerW = Math.max(0, ...headers.map((h) => h ? h.w + R.inset * 2 : 0));
3911
4784
  const colLeft = [];
3912
4785
  for (let c = 0; c < columnCount; c++) colLeft.push(c === 0 ? margin + (headerW > 0 ? headerW : R.pad) : colLeft[c - 1] + colW[c - 1] + between[c - 1]);
3913
- const center = (c) => colLeft[c] + colW[c] / 2;
4786
+ const center2 = (c) => colLeft[c] + colW[c] / 2;
3914
4787
  const looped = new Set(edges.filter(({ edge: edge2 }) => edge2.from === edge2.to).map(({ edge: edge2 }) => edge2.from));
3915
4788
  const loopRows = new Set([...looped].flatMap((id) => {
3916
4789
  const slot = slots.get(id);
@@ -3930,7 +4803,7 @@ function arrange(diagram, groups, slots, rooms) {
3930
4803
  const slot = slots.get(id);
3931
4804
  const source = diagram.boxes.find((b) => b.id === id);
3932
4805
  const w = widths.get(id) ?? B.minW;
3933
- const cx = center(slot.col);
4806
+ const cx = center2(slot.col);
3934
4807
  const y = top + rowTop[slot.row];
3935
4808
  boxes.push({
3936
4809
  id,
@@ -4154,6 +5027,492 @@ function grow(layout, groups, slots, rooms) {
4154
5027
  return grown;
4155
5028
  }
4156
5029
 
5030
+ // src/layout/git.ts
5031
+ var isGitLayout = (layout) => layout.kind === "git";
5032
+ function walk(diagram) {
5033
+ const branches = (diagram.git?.branches ?? []).map((b) => b.id);
5034
+ const lane = (id) => {
5035
+ if (!branches.includes(id)) branches.push(id);
5036
+ };
5037
+ for (const step of diagram.steps) for (const e of step.events) if (e.type === "commit" || e.type === "branch") lane(e.branch);
5038
+ const tips = new Map(branches.map((b) => [b, null]));
5039
+ let headAt = null;
5040
+ let attached = null;
5041
+ const made = [];
5042
+ const byId = /* @__PURE__ */ new Map();
5043
+ const links = [];
5044
+ const moves = [];
5045
+ const tags = [];
5046
+ const rows = /* @__PURE__ */ new Map();
5047
+ const most = /* @__PURE__ */ new Map();
5048
+ const shown2 = /* @__PURE__ */ new Map();
5049
+ const names = [...branches, HEAD];
5050
+ const at = new Map(names.map((n) => [n, []]));
5051
+ const heads = [];
5052
+ const visible2 = (ref) => ref === HEAD ? attached === null ? headAt : null : tips.get(ref) ?? null;
5053
+ const freeRow = (commit2) => {
5054
+ const list2 = rows.get(commit2) ?? [];
5055
+ const free = list2.indexOf(null);
5056
+ return free < 0 ? list2.length : free;
5057
+ };
5058
+ const settle = (step, event2, change, lineFor) => {
5059
+ const before = new Map(names.map((n) => [n, visible2(n)]));
5060
+ const headBefore = headAt;
5061
+ change();
5062
+ const changed = names.filter((n) => before.get(n) !== visible2(n));
5063
+ const leaving = changed.map((ref) => {
5064
+ const slot = shown2.get(ref);
5065
+ if (slot) {
5066
+ rows.get(slot.commit)[slot.row] = null;
5067
+ shown2.delete(ref);
5068
+ }
5069
+ return { ref, slot };
5070
+ });
5071
+ for (const { ref, slot } of leaving) {
5072
+ const from = slot ?? (ref === HEAD && headBefore !== null ? { commit: headBefore, row: freeRow(headBefore) } : void 0);
5073
+ const target = visible2(ref);
5074
+ let to;
5075
+ if (target !== null) {
5076
+ to = { commit: target, row: freeRow(target) };
5077
+ const list2 = rows.get(target) ?? [];
5078
+ list2[to.row] = ref;
5079
+ rows.set(target, list2);
5080
+ most.set(target, Math.max(most.get(target) ?? 0, list2.filter((r) => r !== null).length));
5081
+ shown2.set(ref, to);
5082
+ }
5083
+ moves.push({ ref, step, event: event2, ...from ? { from } : {}, ...to ? { to } : {}, line: ref === lineFor });
5084
+ }
5085
+ };
5086
+ const prune = (step, event2) => {
5087
+ const reach = /* @__PURE__ */ new Set();
5088
+ const stack = [...tips.values(), headAt].filter((c) => c !== null);
5089
+ while (stack.length > 0) {
5090
+ const id = stack.pop();
5091
+ if (reach.has(id)) continue;
5092
+ reach.add(id);
5093
+ stack.push(...byId.get(id)?.parents ?? []);
5094
+ }
5095
+ for (const c of made) if (!reach.has(c.id) && c.orphan === void 0) c.orphan = { step, event: event2 };
5096
+ };
5097
+ diagram.steps.forEach((step, s) => {
5098
+ step.events.forEach((e, k) => {
5099
+ if (e.type === "commit") commit(e, s, k);
5100
+ else if (e.type === "branch") {
5101
+ if (!byId.has(e.from)) return;
5102
+ if (laneOf(e.from) !== e.branch) links.push({ kind: "branch", from: e.from, to: e.branch, step: s, event: k });
5103
+ settle(s, k, () => {
5104
+ tips.set(e.branch, e.from);
5105
+ attached = e.branch;
5106
+ headAt = e.from;
5107
+ });
5108
+ } else if (e.type === "edge") {
5109
+ const ref = e.from;
5110
+ if (ref !== HEAD && !tips.has(ref) || !byId.has(e.to)) return;
5111
+ settle(
5112
+ s,
5113
+ k,
5114
+ () => {
5115
+ if (ref === HEAD) {
5116
+ attached = null;
5117
+ headAt = e.to;
5118
+ return;
5119
+ }
5120
+ tips.set(ref, e.to);
5121
+ if (attached === ref) headAt = e.to;
5122
+ else if (attached === null && headAt === e.to) attached = ref;
5123
+ },
5124
+ ref
5125
+ );
5126
+ } else return;
5127
+ prune(s, k);
5128
+ });
5129
+ for (const n of names) at.get(n)?.push(n === HEAD ? headAt : tips.get(n) ?? null);
5130
+ heads.push(attached);
5131
+ for (const n of names) {
5132
+ const slot = shown2.get(n);
5133
+ if (slot) tags.push({ ref: n, step: s, slot });
5134
+ }
5135
+ });
5136
+ function laneOf(id) {
5137
+ return byId.get(id)?.branch;
5138
+ }
5139
+ function commit(e, s, k) {
5140
+ if (byId.has(e.id)) return;
5141
+ const copy = e.copy !== void 0 && byId.has(e.copy) ? e.copy : void 0;
5142
+ const base = copy !== void 0 && attached === null && headAt !== null ? headAt : tips.get(e.branch) ?? null;
5143
+ const joined = e.merge !== void 0 && e.merge !== e.branch ? tips.get(e.merge) ?? void 0 : void 0;
5144
+ const parents = [...new Set([base, joined].filter((c2) => c2 !== null && c2 !== void 0))];
5145
+ const c = {
5146
+ id: e.id,
5147
+ branch: e.branch,
5148
+ parents,
5149
+ ...joined !== void 0 && joined !== base ? { joined } : {},
5150
+ ...copy !== void 0 ? { copy } : {},
5151
+ ...e.hash !== void 0 ? { hash: e.hash } : {},
5152
+ ...e.note !== void 0 ? { note: e.note } : {},
5153
+ step: s,
5154
+ event: k
5155
+ };
5156
+ made.push(c);
5157
+ byId.set(c.id, c);
5158
+ for (const p of parents) links.push({ kind: "parent", from: p, to: c.id, step: s, event: k });
5159
+ if (copy !== void 0) links.push({ kind: "copy", from: copy, to: c.id, step: s, event: k });
5160
+ const first = attached === null && headAt === null;
5161
+ settle(s, k, () => {
5162
+ if (copy === void 0) {
5163
+ tips.set(e.branch, c.id);
5164
+ if (attached === e.branch) headAt = c.id;
5165
+ } else if (attached === null) headAt = c.id;
5166
+ if (first) {
5167
+ attached = e.branch;
5168
+ headAt = c.id;
5169
+ }
5170
+ });
5171
+ }
5172
+ const refs = names.map((name2) => ({ name: name2, at: at.get(name2) ?? [], ...name2 === HEAD ? { attached: heads } : {} }));
5173
+ return { branches, made, links, moves, refs, tags, rows: most };
5174
+ }
5175
+ function cubic(p0, c1, c2, p3) {
5176
+ const n = LOOK.git.samples;
5177
+ return Array.from({ length: n }, (_, k) => {
5178
+ const t = (k + 1) / n;
5179
+ const u = 1 - t;
5180
+ const at = (i) => u * u * u * p0[i] + 3 * u * u * t * c1[i] + 3 * u * t * t * c2[i] + t * t * t * p3[i];
5181
+ return [at(0), at(1)];
5182
+ });
5183
+ }
5184
+ function elbow(from, to) {
5185
+ if (Math.abs(from[1] - to[1]) < 0.5) return [from, to];
5186
+ return from[1] > to[1] ? [from, [from[0], to[1]], to] : [from, [to[0], from[1]], to];
5187
+ }
5188
+ function fork(p, tx, ty) {
5189
+ const sign = ty > p.cy ? 1 : -1;
5190
+ const p0 = [p.cx, p.cy + sign * p.r];
5191
+ const turn = Math.max(0, Math.min(LOOK.git.turn, tx - p.cx));
5192
+ const p3 = [p.cx + turn, ty];
5193
+ const curve = cubic(p0, [p0[0], p0[1] + (ty - p0[1]) * 0.7], [p.cx + turn * 0.2, ty], p3);
5194
+ return [p0, ...curve, ...tx > p3[0] ? [[tx, ty]] : []];
5195
+ }
5196
+ function join(p, c) {
5197
+ const sign = c.cy < p.cy ? 1 : -1;
5198
+ const p0 = [p.cx + p.r, p.cy];
5199
+ const p3 = [c.cx, c.cy + sign * c.r];
5200
+ const turn = Math.max(0, Math.min(LOOK.git.turn, c.cx - p0[0]));
5201
+ const h = [c.cx - turn, p.cy];
5202
+ const curve = cubic(h, [c.cx - turn * 0.2, p.cy], [c.cx, p3[1] + (p.cy - p3[1]) * 0.7], p3);
5203
+ return [p0, ...h[0] > p0[0] ? [h] : [], ...curve];
5204
+ }
5205
+ function copyLine(p, c) {
5206
+ if (Math.abs(p.cy - c.cy) < 0.5) {
5207
+ const top = p.cy - p.r;
5208
+ const lift = LOOK.git.turn * 0.7;
5209
+ return [[p.cx, top], ...cubic([p.cx, top], [p.cx, top - lift], [c.cx, top - lift], [c.cx, top])];
5210
+ }
5211
+ const sign = c.cy < p.cy ? -1 : 1;
5212
+ const p0 = [p.cx, p.cy + sign * p.r];
5213
+ const p3 = [c.cx, c.cy - sign * c.r];
5214
+ const mid = (p3[1] - p0[1]) * 0.5;
5215
+ return [p0, ...cubic(p0, [p0[0], p0[1] + mid], [p3[0], p3[1] - mid], p3)];
5216
+ }
5217
+ function layoutGit(diagram) {
5218
+ const { margin, gap, box: B, region: R, git: G, carrier: C } = LOOK;
5219
+ const walked = walk(diagram);
5220
+ const notes = new Map((diagram.git?.branches ?? []).map((b) => [b.id, b.note]));
5221
+ const laneIndex = new Map(walked.branches.map((id, i) => [id, i]));
5222
+ const colorOf2 = (branch) => G.colors[(laneIndex.get(branch) ?? 0) % G.colors.length];
5223
+ const col = /* @__PURE__ */ new Map();
5224
+ const laneLast = /* @__PURE__ */ new Map();
5225
+ for (const c of walked.made) {
5226
+ const k = Math.max(0, ...c.parents.map((p) => (col.get(p) ?? -1) + 1), (laneLast.get(c.branch) ?? -1) + 1);
5227
+ col.set(c.id, k);
5228
+ laneLast.set(c.branch, k);
5229
+ }
5230
+ const linesOf = (c) => [
5231
+ ...c.hash !== void 0 ? [{ text: c.hash, style: TYPE.gitHash }] : [],
5232
+ ...c.note !== void 0 ? [{ text: c.note, style: TYPE.gitNote }] : []
5233
+ ];
5234
+ const textW = (c) => Math.max(0, ...linesOf(c).map((line2) => textWidth(line2.text, line2.style)));
5235
+ const tagW = (ref) => textWidth(ref, hasWide(ref) ? TYPE.carrierJa : TYPE.carrier) + C.tagPadX * 2;
5236
+ const refWidth = Math.max(0, ...walked.refs.map((r) => tagW(r.name)));
5237
+ const pitch = Math.max(G.pitch, ...walked.made.map((c) => textW(c) + G.textGap), refWidth + G.textGap);
5238
+ const headers = walked.branches.map((id) => ({ w: Math.max(R.icon, textWidth(id, TYPE.regionName), textWidth(notes.get(id) ?? "", TYPE.regionNote)) }));
5239
+ const headerRight = margin + R.inset + Math.max(0, ...headers.map((h) => h.w));
5240
+ const firstHalf = Math.max(G.r, ...walked.made.filter((c) => col.get(c.id) === 0 && laneIndex.get(c.branch) === 0).map((c) => textW(c) / 2), refWidth / 2);
5241
+ const x0 = Math.max(G.x0, headerRight + gap + firstHalf);
5242
+ const named = new Set(
5243
+ walked.moves.flatMap((mv) => {
5244
+ const source = diagram.steps[mv.step]?.events[mv.event];
5245
+ return mv.line && mv.to && source?.type === "edge" && source.label !== void 0 ? [walked.made.find((c) => c.id === mv.to?.commit)?.branch ?? ""] : [];
5246
+ })
5247
+ );
5248
+ const extraRows = (branch) => Math.max(0, ...walked.made.filter((c) => c.branch === branch).map((c) => (walked.rows.get(c.id) ?? 0) - 2)) * G.row;
5249
+ const topText = walked.made.some((c) => laneIndex.get(c.branch) === 0 && linesOf(c).length > 0);
5250
+ const lanes = [];
5251
+ let y = margin;
5252
+ walked.branches.forEach((id, i) => {
5253
+ const top = i === 0;
5254
+ const tagBase = top && topText ? G.tagTop : G.tag;
5255
+ const line2 = y + (top ? G.topLine - (G.tagTop - tagBase) : G.line) + extraRows(id);
5256
+ const h = line2 - y + (top ? G.topBelow : named.has(id) ? G.below : G.bare);
5257
+ lanes.push({ id, x: margin, y, w: 0, h, line: line2, color: colorOf2(id), tagBase });
5258
+ y += h + R.gap;
5259
+ });
5260
+ const lanesBottom = y - R.gap;
5261
+ const laneOf = new Map(lanes.map((l) => [l.id, l]));
5262
+ const commits = walked.made.map((c) => {
5263
+ const lane = laneOf.get(c.branch);
5264
+ const isTop = laneIndex.get(c.branch) === 0;
5265
+ const cx = x0 + pitch * (col.get(c.id) ?? 0) + (isTop ? 0 : pitch / 2);
5266
+ const cy = lane.line;
5267
+ const lines = linesOf(c);
5268
+ const baselines = lines.map((_, k) => isTop ? cy - G.above - (lines.length - 1 - k) * G.lineStep : cy + G.under + k * G.lineStep);
5269
+ const boxes2 = lines.map((line2, k) => textBox(line2.text, cx, baselines[k], line2.style, "middle"));
5270
+ const text2 = boxes2.length === 0 ? void 0 : { ...union(boxes2), lines: lines.map((line2) => line2.text), baselines };
5271
+ const color = c.copy !== void 0 ? colorOf2(walked.made.find((m) => m.id === c.copy)?.branch ?? c.branch) : colorOf2(c.branch);
5272
+ return {
5273
+ id: c.id,
5274
+ branch: c.branch,
5275
+ color,
5276
+ cx,
5277
+ cy,
5278
+ r: G.r,
5279
+ step: c.step,
5280
+ event: c.event,
5281
+ parents: c.parents,
5282
+ ...c.copy !== void 0 ? { copy: c.copy } : {},
5283
+ ...c.hash !== void 0 ? { hash: c.hash } : {},
5284
+ ...c.note !== void 0 ? { note: c.note } : {},
5285
+ ...text2 ? { text: text2 } : {},
5286
+ ...c.orphan ? { orphan: c.orphan.step, orphanEvent: c.orphan.event } : {}
5287
+ };
5288
+ });
5289
+ const placed = new Map(commits.map((c) => [c.id, c]));
5290
+ const links = walked.links.flatMap((l) => {
5291
+ const from = placed.get(l.from);
5292
+ if (!from) return [];
5293
+ if (l.kind === "branch") {
5294
+ if (!walked.made.some((c) => c.branch === l.to)) return [];
5295
+ const lane = laneOf.get(l.to);
5296
+ return [{ ...l, points: fork(from, from.cx + G.turn, lane.line), color: colorOf2(l.to) }];
5297
+ }
5298
+ const to = placed.get(l.to);
5299
+ const made = walked.made.find((m) => m.id === l.to);
5300
+ let points;
5301
+ if (l.kind === "copy") points = copyLine(from, to);
5302
+ else if (Math.abs(from.cy - to.cy) < 0.5) points = [[from.cx + from.r, from.cy], [to.cx - to.r, to.cy]];
5303
+ else if (made?.joined === l.from) points = join(from, to);
5304
+ else points = fork(from, to.cx - to.r, to.cy);
5305
+ return [{ ...l, points, color: to.color }];
5306
+ });
5307
+ const tagRect = (ref, slot) => {
5308
+ const c = placed.get(slot.commit);
5309
+ const base = laneOf.get(c.branch)?.tagBase ?? G.tag;
5310
+ const w = tagW(ref);
5311
+ return { x: c.cx - w / 2, y: c.cy - base - slot.row * G.row - C.tagH / 2, w, h: C.tagH };
5312
+ };
5313
+ const center2 = (r) => [r.x + r.w / 2, r.y + r.h / 2];
5314
+ const moves = walked.moves.map((m) => {
5315
+ const from = m.from ? tagRect(m.ref, m.from) : void 0;
5316
+ const to = m.to ? tagRect(m.ref, m.to) : void 0;
5317
+ const source = diagram.steps[m.step]?.events[m.event];
5318
+ const carried = m.line && source?.type === "edge" && source.carry.kind !== "none" && !(source.carry.kind === "tag" && source.carry.text === source.from);
5319
+ return {
5320
+ ref: m.ref,
5321
+ step: m.step,
5322
+ event: m.event,
5323
+ ...from ? { from } : {},
5324
+ ...to ? { to } : {},
5325
+ ...m.to ? { target: m.to.commit } : {},
5326
+ ...carried ? { carried: true } : {},
5327
+ ...m.line && from && to ? { line: elbow(center2(from), center2(to)) } : {},
5328
+ color: "slate"
5329
+ };
5330
+ });
5331
+ const tags = walked.tags.map((t) => ({ ...tagRect(t.ref, t.slot), ref: t.ref, step: t.step }));
5332
+ const colors = boxColors(diagram);
5333
+ const right = Math.max(
5334
+ x0,
5335
+ ...commits.flatMap((c) => [c.cx + c.r, ...c.text ? [c.text.x + c.text.w] : []]),
5336
+ ...tags.map((t) => t.x + t.w),
5337
+ ...moves.flatMap((m) => [m.from, m.to].flatMap((r) => r ? [r.x + r.w] : []))
5338
+ );
5339
+ const boxX = right + G.boxGap;
5340
+ const firstCy = (lanes[1] ?? lanes[0])?.line ?? margin + B.h / 2;
5341
+ const boxes = diagram.boxes.map((b, i) => {
5342
+ const w = boxWidth(diagram, b.id, true);
5343
+ const cy = firstCy + i * (B.h + gap);
5344
+ return {
5345
+ id: b.id,
5346
+ name: b.name,
5347
+ ...b.sub !== void 0 ? { sub: b.sub } : {},
5348
+ ...b.icon !== void 0 ? { icon: b.icon } : {},
5349
+ color: colors.get(b.id) ?? "slate",
5350
+ x: boxX,
5351
+ y: cy - B.h / 2,
5352
+ w,
5353
+ h: B.h,
5354
+ cx: boxX + w / 2,
5355
+ cy
5356
+ };
5357
+ });
5358
+ const regions = lanes.map((lane, i) => {
5359
+ const note = notes.get(lane.id);
5360
+ return {
5361
+ id: lane.id,
5362
+ lines: [lane.id],
5363
+ ...note !== void 0 ? { note } : {},
5364
+ icon: "branch",
5365
+ color: lane.color,
5366
+ x: lane.x,
5367
+ y: lane.y,
5368
+ w: 0,
5369
+ h: lane.h,
5370
+ header: { x: lane.x + R.inset, y: lane.y + R.inset, w: headers[i]?.w ?? 0, h: R.nameY - R.inset + (note !== void 0 ? R.line : 0) + gap / 2 }
5371
+ };
5372
+ });
5373
+ const layout = {
5374
+ kind: "git",
5375
+ width: 0,
5376
+ height: 0,
5377
+ regions,
5378
+ boxes,
5379
+ lifelines: [],
5380
+ edges: [],
5381
+ labels: [],
5382
+ actions: [],
5383
+ badges: [],
5384
+ paths: [],
5385
+ ends: [],
5386
+ lanes,
5387
+ commits,
5388
+ links,
5389
+ tags,
5390
+ refs: walked.refs,
5391
+ moves
5392
+ };
5393
+ layout.badges = badgesOf(diagram, layout);
5394
+ layout.labels = labelsOf(diagram, layout);
5395
+ const contentRight = Math.max(right, ...boxes.map((b) => b.x + b.w), ...layout.labels.map((l) => l.x + l.w)) + R.pad;
5396
+ const width = Math.max(contentRight + margin, stripNeed(diagram) + margin * 2);
5397
+ for (const region of regions) region.w = width - margin * 2;
5398
+ for (const lane of lanes) lane.w = width - margin * 2;
5399
+ const bottom = Math.max(lanesBottom, ...boxes.map((b) => b.y + b.h), ...layout.labels.map((l) => l.y + l.h));
5400
+ const strip2 = layoutStrip(diagram, margin, bottom + gap, width - margin * 2);
5401
+ layout.width = width;
5402
+ layout.height = (strip2 ? strip2.y + strip2.h : bottom) + margin;
5403
+ if (strip2) layout.strip = strip2;
5404
+ layout.badges = badgesOf(diagram, layout);
5405
+ return layout;
5406
+ }
5407
+ function union(rects) {
5408
+ const x = Math.min(...rects.map((r) => r.x));
5409
+ const y = Math.min(...rects.map((r) => r.y));
5410
+ return { x, y, w: Math.max(...rects.map((r) => r.x + r.w)) - x, h: Math.max(...rects.map((r) => r.y + r.h)) - y };
5411
+ }
5412
+ function firstMark(layout, step) {
5413
+ const marks = [
5414
+ ...layout.links.filter((l) => l.step === step && l.kind !== "copy").map((l) => ({ event: l.event, points: l.points, color: l.color })),
5415
+ ...layout.moves.flatMap((m) => {
5416
+ const target = layout.commits.find((c) => c.id === m.target);
5417
+ return m.step === step && m.line && target ? [{ event: m.event, target, color: target.color }] : [];
5418
+ })
5419
+ ].sort((a, b) => a.event - b.event);
5420
+ return marks[0];
5421
+ }
5422
+ function besideCommit(c, taken, avoid) {
5423
+ const { r, inset } = LOOK.badge;
5424
+ const d = c.r + inset + r;
5425
+ const apart = r * 2 + inset;
5426
+ const spots = [
5427
+ [c.cx + d, c.cy],
5428
+ [c.cx, c.cy + d],
5429
+ [c.cx - d, c.cy],
5430
+ [c.cx, c.cy - d]
5431
+ ];
5432
+ return spots.find((p) => taken.every(([x, y]) => Math.hypot(p[0] - x, p[1] - y) >= apart) && avoid.every((a) => gapBetween(badgeRect(p), a) >= LOOK.label.touch));
5433
+ }
5434
+ function clearOnPath(points, taken, avoid) {
5435
+ const { r, inset, along: start, short } = LOOK.badge;
5436
+ const length = pathLength(points);
5437
+ const first = length < short ? Math.min(r + 1, length / 2) : start;
5438
+ const apart = r * 2 + inset;
5439
+ for (let d = first; d <= length; d += 1) {
5440
+ const p = along(points, d);
5441
+ const rect = badgeRect(p);
5442
+ if (taken.every(([x, y]) => Math.hypot(p[0] - x, p[1] - y) >= apart) && avoid.every((a) => gapBetween(rect, a) >= LOOK.label.touch)) return p;
5443
+ }
5444
+ return void 0;
5445
+ }
5446
+ function badgesOf(diagram, layout) {
5447
+ const { inset } = LOOK.badge;
5448
+ const taken = [];
5449
+ const all = [...layout.links.map((l) => l.points), ...layout.moves.flatMap((m) => m.line ? [m.line] : [])];
5450
+ const out = [];
5451
+ const avoid = [
5452
+ ...layout.tags,
5453
+ ...layout.commits.flatMap((c) => [{ x: c.cx - c.r, y: c.cy - c.r, w: c.r * 2, h: c.r * 2 }, ...c.text ? [c.text] : []])
5454
+ ];
5455
+ diagram.steps.forEach((step, s) => {
5456
+ const mark = firstMark(layout, s);
5457
+ const near = mark?.target ? besideCommit(mark.target, taken, avoid) : void 0;
5458
+ if (mark && (mark.points || near)) {
5459
+ const points = mark.points;
5460
+ const point = near ?? (points ? clearOnPath(points, taken, avoid) ?? badgeOnPath(points, taken, all.filter((p) => p !== points)) : [0, 0]);
5461
+ taken.push(point);
5462
+ out.push({ step: s, x: point[0], y: point[1], color: mark.color });
5463
+ return;
5464
+ }
5465
+ const box = step.events.flatMap((e) => e.type === "swap" || e.type === "action" ? [e.box] : []).map((id) => layout.boxes.find((b) => b.id === id))[0];
5466
+ if (box) {
5467
+ out.push({ step: s, x: box.x, y: box.y, color: box.color });
5468
+ return;
5469
+ }
5470
+ if (layout.strip && step.events.some((e) => e.type === "strip")) {
5471
+ out.push({ step: s, x: layout.strip.x + inset, y: layout.strip.y + inset, color: "slate" });
5472
+ return;
5473
+ }
5474
+ const tip = layout.commits.find((c) => c.id === layout.refs[0]?.at[s]);
5475
+ const spot = tip ? besideCommit(tip, taken, avoid) : void 0;
5476
+ if (tip && spot) {
5477
+ taken.push(spot);
5478
+ out.push({ step: s, x: spot[0], y: spot[1], color: tip.color });
5479
+ return;
5480
+ }
5481
+ const before = out[out.length - 1];
5482
+ const lane = layout.lanes[0];
5483
+ out.push(before ? { ...before, step: s } : { step: s, x: (lane?.x ?? 0) + (lane?.w ?? 0) - inset - LOOK.badge.r, y: (lane?.y ?? 0) + inset + LOOK.badge.r, color: lane?.color ?? "slate" });
5484
+ });
5485
+ return replaceSameSpot(out);
5486
+ }
5487
+ function labelsOf(diagram, layout) {
5488
+ const G = LOOK.git;
5489
+ const labels = [];
5490
+ const circles = layout.commits.map((c) => ({ x: c.cx - c.r, y: c.cy - c.r, w: c.r * 2, h: c.r * 2 }));
5491
+ const texts = layout.commits.flatMap((c) => c.text ? [c.text] : []);
5492
+ const headers = layout.regions.map((r) => r.header);
5493
+ for (const move of layout.moves) {
5494
+ const source = diagram.steps[move.step]?.events[move.event];
5495
+ if (source?.type !== "edge" || source.label === void 0 || !move.line) continue;
5496
+ const target = layout.commits.find((c) => c.id === source.to);
5497
+ if (!target) continue;
5498
+ const top = layout.lanes[0]?.id === target.branch;
5499
+ const w = textWidth(source.label, hasWide(source.label) ? TYPE.labelJa : TYPE.label) + LOOK.label.padX * 2;
5500
+ const [mx] = move.line.reduce((sum, p) => [sum[0] + p[0] / move.line.length, 0], [0, 0]);
5501
+ const rows = Math.max(0, ...layout.tags.filter((t) => t.step === move.step && Math.abs(t.x + t.w / 2 - target.cx) < 0.5).map((t) => target.cy - t.y));
5502
+ const side2 = source.labelSide ?? (top ? "above" : "below");
5503
+ const base = source.labelSide !== void 0 ? void 0 : top ? { x: mx - w / 2, y: target.cy - Math.max(rows, (layout.lanes[0]?.tagBase ?? G.tag) + LOOK.carrier.tagH / 2) - LOOK.label.soft - LOOK.label.h } : { x: mx - w / 2, y: target.cy + G.labelUnder };
5504
+ const seen = layout.badges.filter((b) => b.step <= move.step).map((b) => badgeRect([b.x, b.y]));
5505
+ const tags = layout.tags.filter((t) => t.step === move.step);
5506
+ labels.push(
5507
+ placeLabel(
5508
+ { step: move.step, event: move.event, text: source.label, points: move.line, color: move.color, side: side2, ...base ? { base } : {} },
5509
+ { hard: [...circles, ...layout.boxes], soft: [...texts, ...tags, ...headers, ...labels.filter((l) => l.step === move.step)], touch: seen }
5510
+ )
5511
+ );
5512
+ }
5513
+ return labels;
5514
+ }
5515
+
4157
5516
  // src/layout/sequence.ts
4158
5517
  function layoutSequence(diagram) {
4159
5518
  const { box: B, sequence: Q, label: L, margin, gap } = LOOK;
@@ -4362,7 +5721,7 @@ function layoutState(diagram, lang) {
4362
5721
  }
4363
5722
  const colLeft = [];
4364
5723
  for (let c = 0; c < columnCount; c++) colLeft.push(c === 0 ? margin : colLeft[c - 1] + colW[c - 1] + between[c - 1]);
4365
- const center = (c) => colLeft[c] + colW[c] / 2;
5724
+ const center2 = (c) => colLeft[c] + colW[c] / 2;
4366
5725
  const isGhost = (id) => ghosts.includes(id);
4367
5726
  const enteringFrom = new Set(notTaken.filter((p) => isGhost(p.to) && !isGhost(p.from) && !isEnd(p.from)).map((p) => p.from));
4368
5727
  const notes = [words.sideNote, ...enteringFrom.size > 0 ? [words.sideFrom(enteringFrom.size)] : []];
@@ -4392,7 +5751,7 @@ function layoutState(diagram, lang) {
4392
5751
  };
4393
5752
  const boxes = walked.map((id) => {
4394
5753
  const s = slot.get(id);
4395
- return boxOf(id, center(s.col), rowY(s.row), false);
5754
+ return boxOf(id, center2(s.col), rowY(s.row), false);
4396
5755
  });
4397
5756
  for (const box of boxes) placeSlot(box, carriedIn.get(box.id), doneSide);
4398
5757
  const byId = new Map(boxes.map((b) => [b.id, b]));
@@ -4612,7 +5971,15 @@ function plan(step) {
4612
5971
  let arrived;
4613
5972
  let changes = 0;
4614
5973
  step.events.forEach((event2, e) => {
4615
- if (event2.type === "edge") {
5974
+ if (event2.type === "commit" || event2.type === "branch") {
5975
+ const a = cursor;
5976
+ const b = a + MOTION.draw;
5977
+ out.edges.push({ event: e, a, b, carries: false, coin: false, named: false });
5978
+ cursor = a + MOTION.stagger;
5979
+ arrived = b;
5980
+ changes = 0;
5981
+ out.busy = Math.max(out.busy, b);
5982
+ } else if (event2.type === "edge") {
4616
5983
  const carries = event2.carry.kind !== "none";
4617
5984
  const a = cursor;
4618
5985
  const b = a + (carries ? MOTION.drawCarry : MOTION.draw);
@@ -4657,7 +6024,9 @@ function buildTimeline(diagram) {
4657
6024
  for (const edge2 of p.edges) {
4658
6025
  const a = span.start + edge2.a;
4659
6026
  edges.push({ step: s, event: edge2.event, start: a, drawn: span.start + edge2.b, end: span.end });
4660
- if (edge2.carries) departures.push({ step: s, event: edge2.event, who: edge2.coin ? "coin" : "main", a, b: span.start + edge2.b });
6027
+ const event2 = diagram.steps[s]?.events[edge2.event];
6028
+ const own = diagram.kind === "git" && event2?.type === "edge" && event2.carry.kind === "tag" && event2.carry.text === event2.from;
6029
+ if (edge2.carries && !own) departures.push({ step: s, event: edge2.event, who: edge2.coin ? "coin" : "main", a, b: span.start + edge2.b });
4661
6030
  if (edge2.named) named.push({ step: s, event: edge2.event, start: a + MOTION.labelDelay, end: span.end });
4662
6031
  }
4663
6032
  named.forEach((label2, k) => {
@@ -5149,6 +6518,123 @@ function strip(s, changes, ctx, now = false, arrivals = /* @__PURE__ */ new Map(
5149
6518
  return parts.join("");
5150
6519
  }
5151
6520
 
6521
+ // src/render/git.ts
6522
+ var r12 = (v) => Math.round(v * 100) / 100;
6523
+ var center = (r) => [r.x + r.w / 2, r.y + r.h / 2];
6524
+ function tagShape(text2, sh) {
6525
+ const C = LOOK.carrier;
6526
+ const ja3 = hasWide(text2);
6527
+ const w = textWidth(text2, ja3 ? TYPE.carrierJa : TYPE.carrier) + C.tagPadX * 2;
6528
+ return `<rect class="dg-car" x="${r12(-w / 2)}" y="${ -18 / 2}" width="${r12(w)}" height="${C.tagH}" rx="${C.tagH / 2}" ${sh}/><text class="dg-car-t${ja3 ? " dg-car-tj" : ""}" y="${LOOK.baseline.carrier}" text-anchor="middle">${esc(text2)}</text>`;
6529
+ }
6530
+ function drawGit(layout, diagram, timeline, ctx) {
6531
+ const { m } = ctx;
6532
+ const G = LOOK.git;
6533
+ const timeOf = (step, event2) => timeline.edges.find((t) => t.step === step && t.event === event2);
6534
+ const links = layout.links.map((l) => {
6535
+ const time = timeOf(l.step, l.event);
6536
+ if (!time) return "";
6537
+ ctx.traces.push({ from: l.from, to: l.to, points: l.points, shown: [[time.start, Number.POSITIVE_INFINITY]] });
6538
+ const d = pathOf(l.points);
6539
+ if (l.kind === "copy") return `<g style="${cs(l.color)}"><path class="dg-git-cp dg-a" d="${d}" style="${m.vis(time.start, m.last)}"/></g>`;
6540
+ const kf = m.kf([
6541
+ [0, { opacity: 0, "stroke-dashoffset": 1 }],
6542
+ [time.start, { opacity: 0, "stroke-dashoffset": 1 }, EASE.inOut],
6543
+ [time.start + 0.05, { opacity: 1 }],
6544
+ [time.drawn, { "stroke-dashoffset": 0 }],
6545
+ [m.last, { opacity: 1, "stroke-dashoffset": 0 }, EASE.inOut],
6546
+ [m.total, { opacity: 0, "stroke-dashoffset": 0 }]
6547
+ ]);
6548
+ return `<g style="${cs(l.color)}"><path class="dg-git-l dg-a" pathLength="1" d="${d}" style="${kf}"/></g>`;
6549
+ }).join("");
6550
+ const commits = layout.commits.map((c) => {
6551
+ const at = timeOf(c.step, c.event)?.drawn ?? 0;
6552
+ const ring = { x: c.cx - c.r, y: c.cy - c.r, w: c.r * 2, h: c.r * 2 };
6553
+ ctx.ink.push({ text: c.id, rect: ring, shown: [[at, Number.POSITIVE_INFINITY]], boxed: true });
6554
+ const lines2 = (c.text?.lines ?? []).map((line2, k) => {
6555
+ const hash = k === 0 && c.hash !== void 0;
6556
+ const baseline = c.text?.baselines[k] ?? c.cy;
6557
+ return write(ctx.ink, hash ? "dg-git-h" : "dg-git-n", c.cx, baseline, line2, hash ? TYPE.gitHash : TYPE.gitNote, [[at, Number.POSITIVE_INFINITY]], "middle");
6558
+ }).join("");
6559
+ const id = `<text class="dg-git-id" x="${r12(c.cx)}" y="${r12(c.cy + LOOK.baseline.badge)}" text-anchor="middle">${esc(c.id)}</text>`;
6560
+ const node = `<g class="dg-popc dg-a" style="${m.pop(at)}"><circle class="dg-git-c" cx="${r12(c.cx)}" cy="${r12(c.cy)}" r="${c.r}" ${ctx.sh}/>${id}</g>`;
6561
+ const text2 = lines2 === "" ? "" : `<g class="dg-a" style="${m.vis(at)}">${lines2}</g>`;
6562
+ const orphanAt = c.orphan === void 0 ? void 0 : timeOf(c.orphan, c.orphanEvent ?? 0)?.drawn;
6563
+ const orphan = orphanAt === void 0 ? "" : `<g class="dg-a" data-orphan="${esc(c.id)}" style="${m.vis(orphanAt, m.last, { f: 0.5 })}"><circle class="dg-git-old" cx="${r12(c.cx)}" cy="${r12(c.cy)}" r="${G.orphan}"/><text class="dg-git-oldl" x="${r12(c.cx)}" y="${r12(c.cy + LOOK.baseline.badge)}" text-anchor="middle">${esc(c.id)}</text></g>`;
6564
+ return `<g data-commit="${esc(c.id)}" style="${cs(c.color)}">${node}${text2}${orphan}</g>`;
6565
+ }).join("");
6566
+ const lines = layout.moves.flatMap((mv) => {
6567
+ const time = timeOf(mv.step, mv.event);
6568
+ if (!mv.line || !time) return [];
6569
+ const end = timeline.steps[mv.step].end;
6570
+ ctx.traces.push({ from: mv.ref, to: mv.target ?? mv.ref, points: mv.line, shown: [[time.start, end + 0.4]] });
6571
+ const kf = m.kf([
6572
+ [0, { opacity: 0, "stroke-dashoffset": 1 }],
6573
+ [time.start, { opacity: 0, "stroke-dashoffset": 1 }, EASE.inOut],
6574
+ [time.start + 0.05, { opacity: 1 }],
6575
+ [time.drawn, { "stroke-dashoffset": 0 }],
6576
+ [end, { opacity: 1 }, EASE.inOut],
6577
+ [end + 0.4, { opacity: 0 }],
6578
+ [m.total, { opacity: 0, "stroke-dashoffset": 0 }]
6579
+ ]);
6580
+ return [`<g style="${cs(mv.color)}"><path class="dg-e-on dg-a" pathLength="1" d="${pathOf(mv.line)}" style="${kf}"/></g>`];
6581
+ }).join("");
6582
+ const carried = timeline.carriers.flatMap((t) => {
6583
+ const mv = layout.moves.find((x) => x.step === t.step && x.event === t.event && x.line);
6584
+ const source = diagram.steps[t.step]?.events[t.event];
6585
+ if (!mv?.line || source?.type !== "edge") return [];
6586
+ const edge2 = { step: t.step, event: t.event, from: mv.ref, to: mv.target ?? mv.ref, points: mv.line, color: mv.color, carry: source.carry };
6587
+ return [carrier(edge2, { ...t, start: t.depart, end: t.arrive + MOTION.fade }, ctx)];
6588
+ }).join("");
6589
+ const refs = [...new Set(layout.moves.map((mv) => mv.ref))];
6590
+ const tags = refs.map((ref) => tagMotion(ref, layout.moves.filter((mv) => mv.ref === ref), timeOf, ctx)).join("") + carried;
6591
+ return { links, lines, commits, tags };
6592
+ }
6593
+ function tagMotion(ref, list2, timeOf, ctx) {
6594
+ const { m } = ctx;
6595
+ const points = [];
6596
+ const fades = [[0, { opacity: 0 }]];
6597
+ let on = false;
6598
+ let rest;
6599
+ const leave = (t) => {
6600
+ if (rest) ctx.ink.push({ text: ref, rect: rest.rect, shown: [[rest.since, t]], boxed: true });
6601
+ rest = void 0;
6602
+ };
6603
+ for (const mv of list2) {
6604
+ const time = timeOf(mv.step, mv.event);
6605
+ if (!time) continue;
6606
+ const { start: a, drawn: b } = time;
6607
+ const from = mv.from ? center(mv.from) : void 0;
6608
+ const to = mv.to ? center(mv.to) : void 0;
6609
+ leave(a);
6610
+ if (mv.carried && from && to && on) {
6611
+ points.push([a + MOTION.fade, from[0], from[1]], [b - MOTION.fade, to[0], to[1]]);
6612
+ fades.push([a, { opacity: 1 }, EASE.inOut], [a + MOTION.fade, { opacity: 0 }], [b - MOTION.fade, { opacity: 0 }, EASE.out], [b, { opacity: 1 }]);
6613
+ rest = { rect: mv.to, since: b };
6614
+ continue;
6615
+ }
6616
+ if (from) points.push([a, from[0], from[1]]);
6617
+ if (to) points.push([b, to[0], to[1]]);
6618
+ if (to && !on) {
6619
+ const show = from ? a : b - MOTION.fade;
6620
+ fades.push([show, { opacity: 0 }, EASE.out], [show + MOTION.fade, { opacity: 1 }]);
6621
+ on = true;
6622
+ } else if (!to && on) {
6623
+ fades.push([b, { opacity: 1 }, EASE.inOut], [b + MOTION.untilFade, { opacity: 0 }]);
6624
+ on = false;
6625
+ }
6626
+ if (mv.to) rest = { rect: mv.to, since: b };
6627
+ }
6628
+ leave(Number.POSITIVE_INFINITY);
6629
+ if (points.length === 0) return "";
6630
+ const first = points[0];
6631
+ const last = points[points.length - 1];
6632
+ if (on) fades.push([m.last, { opacity: 1 }, EASE.inOut], [m.total, { opacity: 0 }]);
6633
+ else fades.push([m.total, { opacity: 0 }]);
6634
+ const style = m.move([[0, first[1], first[2]], ...points, [m.total, last[1], last[2]]], fades);
6635
+ return `<g class="dg-a" data-ref="${esc(ref)}" style="${style}">${tagShape(ref, ctx.sh)}</g>`;
6636
+ }
6637
+
5152
6638
  // src/render/motion.ts
5153
6639
  var r2 = (v) => Math.round(v * 100) / 100;
5154
6640
  var Motion = class {
@@ -5319,6 +6805,14 @@ var PART_CSS = [
5319
6805
  `.dg-mark{${font(TYPE.regionNote)};fill:var(--mute)}`,
5320
6806
  `.dg-done{fill:var(--ink);stroke:var(--surf);stroke-width:${S.done}}`,
5321
6807
  `.dg-done-ck{fill:none;stroke:var(--surf);stroke-width:${S.glyph};stroke-linecap:round;stroke-linejoin:round}`,
6808
+ `.dg-git-l{fill:none;stroke:var(--c);stroke-width:${S.git};stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:1 2}`,
6809
+ `.dg-git-cp{fill:none;stroke:var(--c);stroke-width:${S.gitOrphan};stroke-linecap:round;stroke-dasharray:3 3;stroke-opacity:.7}`,
6810
+ `.dg-git-c{fill:var(--surf);stroke:var(--c);stroke-width:${S.git}}`,
6811
+ `.dg-git-id{${font(TYPE.gitId)};fill:var(--ct)}`,
6812
+ `.dg-git-h{${font(TYPE.gitHash)};fill:var(--mute)}`,
6813
+ `.dg-git-n{${font(TYPE.gitNote)};fill:var(--ink2)}`,
6814
+ `.dg-git-old{fill:var(--surf);stroke:var(--c);stroke-width:${S.gitOrphan};stroke-dasharray:3 3;stroke-opacity:.6}`,
6815
+ `.dg-git-oldl{${font(TYPE.gitId)};fill:var(--ct);opacity:.55}`,
5322
6816
  ".dg-vp-bg{fill:var(--bg)}",
5323
6817
  ".dg-vp-frame{fill:none;stroke:var(--hair)}",
5324
6818
  ".dg-hd-bg{fill:var(--bg)}",
@@ -5425,6 +6919,13 @@ function drawSvg(diagram, layout, timeline, palette, theme, follow, ink = [], tr
5425
6919
  const arrivals = new Map((timeline.states ?? []).flatMap((s) => s.lit[0] ? [[s.box, s.lit[0].start]] : []));
5426
6920
  if (layout.strip) L.band.push(strip(layout.strip, fieldChanges(diagram, timeline, layout), ctx, isState, arrivals));
5427
6921
  for (const line2 of layout.lifelines) L.base.push(lifeline(line2.x, line2.y1, line2.y2));
6922
+ if (isGitLayout(layout)) {
6923
+ const git = drawGit(layout, diagram, timeline, ctx);
6924
+ L.base.push(git.links);
6925
+ L.lit.push(git.lines);
6926
+ L.node.push(git.commits);
6927
+ L.top.push(git.tags);
6928
+ }
5428
6929
  for (const e of layout.edges) {
5429
6930
  const time = timeline.edges.find((t) => t.step === e.step && t.event === e.event);
5430
6931
  if (!time) continue;
@@ -5463,14 +6964,14 @@ function drawSvg(diagram, layout, timeline, palette, theme, follow, ink = [], tr
5463
6964
  const css = `.dg-${id}{${FONT_VARS};--T:${timeline.total}s;${paletteVars(palette, theme)}}${PART_CSS}${m.frames.join("")}`;
5464
6965
  return `<svg xmlns="http://www.w3.org/2000/svg" class="dg dg-${id}" viewBox="0 0 ${Math.ceil(view.w)} ${Math.ceil(view.h)}" width="${Math.ceil(view.w)}" height="${Math.ceil(view.h)}" role="img" aria-label="${esc(diagram.title)}" data-dragon="figure" data-view="${follow ? "follow" : "fixed"}"><style>${css}</style><defs>${shadow}</defs>${view.body}</svg>`;
5465
6966
  }
5466
- function union(rects) {
6967
+ function union2(rects) {
5467
6968
  const x = Math.min(...rects.map((r) => r.x));
5468
6969
  const y = Math.min(...rects.map((r) => r.y));
5469
6970
  return { x, y, w: Math.max(...rects.map((r) => r.x + r.w)) - x, h: Math.max(...rects.map((r) => r.y + r.h)) - y };
5470
6971
  }
5471
6972
  function focusOf(layout, diagram, step) {
5472
6973
  const rects = focusParts(layout, diagram, step);
5473
- return rects.length === 0 ? void 0 : union(rects);
6974
+ return rects.length === 0 ? void 0 : union2(rects);
5474
6975
  }
5475
6976
  function badgeFocus(badge2, parts, vw, vh) {
5476
6977
  const room = LOOK.badge.r + LOOK.follow.badgeRoom;
@@ -5478,7 +6979,7 @@ function badgeFocus(badge2, parts, vw, vh) {
5478
6979
  const away = (p) => Math.hypot(Math.max(0, p.x - bx, bx - p.x - p.w), Math.max(0, p.y - by, by - p.y - p.h));
5479
6980
  let held = { x: bx - room, y: by - room, w: room * 2, h: room * 2 };
5480
6981
  for (const p of [...parts].sort((a, b) => away(a) - away(b))) {
5481
- const next = union([held, p]);
6982
+ const next = union2([held, p]);
5482
6983
  if (next.w <= vw && next.h <= vh) held = next;
5483
6984
  }
5484
6985
  return held;
@@ -5576,7 +7077,7 @@ function renderDiagram(input, options = {}) {
5576
7077
  const read = readDiagram(input, { lang });
5577
7078
  if (!read.ok) throw new Error(FIGURE_TEXT[lang].cannotDraw(read.errors.map((e) => `${e.pointer} ${e.message}`).join(" / ")));
5578
7079
  const diagram = read.diagram;
5579
- const layout = diagram.kind === "sequence" ? layoutSequence(diagram) : diagram.kind === "state" ? layoutState(diagram, lang) : layoutArchitecture(diagram);
7080
+ const layout = diagram.kind === "sequence" ? layoutSequence(diagram) : diagram.kind === "state" ? layoutState(diagram, lang) : diagram.kind === "git" ? layoutGit(diagram) : layoutArchitecture(diagram);
5580
7081
  return renderLayout(diagram, layout, buildTimeline(diagram), options);
5581
7082
  }
5582
7083
  function renderLayout(diagram, layout, timeline, options = {}) {