@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/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { readFileSync, mkdirSync, writeFileSync, rmSync } from 'fs';
3
- import { join, dirname, basename, extname, resolve } from 'path';
3
+ import { join as join$1, dirname, basename, extname, resolve } from 'path';
4
4
  import { parseArgs } from 'util';
5
5
  import { createRequire } from 'module';
6
6
  import { readFile } from 'fs/promises';
@@ -264,7 +264,11 @@ var TYPE = {
264
264
  stepTitle: text(15, 700),
265
265
  stepBody: text(13.5, 500),
266
266
  stepNo: text(13, 700, "mono"),
267
- button: text(14, 700)
267
+ button: text(14, 700),
268
+ /** 枝分かれの図 (#3164) の、丸の中の commit の名札と、丸の外に添える hash と一言 */
269
+ gitId: text(11, 700),
270
+ gitHash: text(10.5, 600, "mono"),
271
+ gitNote: text(10.5, 650)
268
272
  };
269
273
  var LOOK = {
270
274
  /** 部品どうしの最小の隙間 */
@@ -308,6 +312,41 @@ var LOOK = {
308
312
  done: { r: 6.5, inset: 13 },
309
313
  pastLabel: 0.85
310
314
  },
315
+ /**
316
+ * 枝分かれの図 (#3164)。見本帳の試作 (`scenes/git.js`) の寸法を写す。
317
+ * commit は列ごとに `pitch` ずつ右へ並べ、一番上でない帯の commit は列の半分だけ右へずらす。`x0` は最初の列の真ん中の x の下限、
318
+ * `textGap` は隣の列の hash と一言の間に空ける最小の隙間。`r` は丸の半径、`orphan` はどの札からも辿れなくなった commit の点線の丸の半径。
319
+ * `topLine` と `line` は帯の上端から丸を並べる線まで (一番上の帯と、それより下の帯)、`topBelow` と `below` は線から帯の下端まで。
320
+ * `bare` は線の名前を下に置かない帯の、線から帯の下端まで。
321
+ * hash と一言は一番上の帯では丸の上に、ほかの帯では丸の下に置き、`above` と `under` は丸の真ん中から丸に近い行の基準線まで、`lineStep` は行の間。
322
+ * 札は丸の上に段を重ねて置き、`tagTop` と `tag` は丸の真ん中から 1 段目の札の真ん中まで (一番上の帯と、ほかの帯)、`row` は札の段の間。
323
+ * 札の段が 2 段より多い commit がある帯は、多い段の分だけ線を下げる。
324
+ * `turn` は枝へ分かれる線と枝から入る線が曲がり終えて横へ進むまでの長さ、`samples` は曲がりを区切る点の数、`boxGap` は commit の並びと箱の間。
325
+ * `labelUnder` はほかの帯で、丸の真ん中から線の名前の札の上端まで。`colors` は帯の色を上から配る順
326
+ */
327
+ git: {
328
+ x0: 120,
329
+ pitch: 90,
330
+ textGap: 12,
331
+ r: 12,
332
+ orphan: 13.5,
333
+ topLine: 120,
334
+ line: 90,
335
+ topBelow: 30,
336
+ below: 82,
337
+ bare: 62,
338
+ above: 18,
339
+ under: 27,
340
+ lineStep: 13,
341
+ tagTop: 58,
342
+ tag: 30,
343
+ row: 22,
344
+ turn: 60,
345
+ samples: 12,
346
+ boxGap: 24,
347
+ labelUnder: 50,
348
+ colors: ["blue", "violet", "green", "amber", "rose"]
349
+ },
311
350
  /** `bend` は線の曲がりを丸める半径 (#3171) */
312
351
  edge: { inset: 3, arrow: 6, arrowHalf: 3.5, parallel: 5, ghostDash: 5, flowDash: 9, bend: 12 },
313
352
  /** `touch` は線の名前と、同じ時刻に見えている段の番号の丸の間に空ける最小の隙間 (#3175) */
@@ -326,7 +365,7 @@ var LOOK = {
326
365
  * `trail` は状態遷移図の帯の最後の、通った状態の点 (#3171)。`r` は点の半径、`step` は点の中心どうしの間、`now` は変わった値の欄の名前の横の点の半径と、名前からの離れ
327
366
  */
328
367
  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 } },
329
- stroke: { 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 },
368
+ stroke: { git: 2.25, gitOrphan: 1.5, 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 },
330
369
  shadow: { near: 0.8, far: 4, nearY: 1, farY: 3 },
331
370
  mini: { w: 168, pad: 8, title: 14, inset: 12, radius: 10 },
332
371
  /**
@@ -941,7 +980,7 @@ function arrange(diagram, groups, slots, rooms) {
941
980
  const headerW = Math.max(0, ...headers.map((h) => h ? h.w + R.inset * 2 : 0));
942
981
  const colLeft = [];
943
982
  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]);
944
- const center = (c) => colLeft[c] + colW[c] / 2;
983
+ const center2 = (c) => colLeft[c] + colW[c] / 2;
945
984
  const looped = new Set(edges.filter(({ edge: edge2 }) => edge2.from === edge2.to).map(({ edge: edge2 }) => edge2.from));
946
985
  const loopRows = new Set([...looped].flatMap((id) => {
947
986
  const slot = slots.get(id);
@@ -961,7 +1000,7 @@ function arrange(diagram, groups, slots, rooms) {
961
1000
  const slot = slots.get(id);
962
1001
  const source = diagram.boxes.find((b) => b.id === id);
963
1002
  const w = widths.get(id) ?? B.minW;
964
- const cx = center(slot.col);
1003
+ const cx = center2(slot.col);
965
1004
  const y = top + rowTop[slot.row];
966
1005
  boxes.push({
967
1006
  id,
@@ -1185,6 +1224,524 @@ function grow(layout, groups, slots, rooms) {
1185
1224
  return grown;
1186
1225
  }
1187
1226
 
1227
+ // src/words.ts
1228
+ var keys = (table) => Object.keys(table);
1229
+ var KINDS = keys({ sequence: true, architecture: true, state: true, git: true });
1230
+ var STATE_ENDS = ["start", "finish"];
1231
+ var HEADS = ["group", "end", "box", "strip", "step", "say", "code", "act", "note", "set", "branch", "commit"];
1232
+ var AS = "as";
1233
+ var ON = "on";
1234
+ var COPY = "copy";
1235
+ var MERGE = "merge";
1236
+ var FROM = "from";
1237
+ var HEAD = "HEAD";
1238
+ var ATTRS = {
1239
+ diagram: ["view"],
1240
+ group: ["note", "color", "icon"],
1241
+ box: ["note", "color", "icon"],
1242
+ edge: ["carry", "tag", "side"],
1243
+ set: ["tag"],
1244
+ branch: ["note"],
1245
+ commit: ["hash", "note"]
1246
+ };
1247
+ var CARRIES = keys({ coin: true, none: true });
1248
+ var VIEWS = keys({ fixed: true, follow: true });
1249
+ var SIDES = keys({ above: true, below: true, left: true, right: true });
1250
+ var OLD_HEADS = {
1251
+ \u6642\u7CFB\u5217\u56F3: "sequence",
1252
+ \u69CB\u6210\u56F3: "architecture",
1253
+ \u533A\u753B: "group",
1254
+ \u898B\u305B\u65B9: "view",
1255
+ region: "group",
1256
+ view: "view"
1257
+ };
1258
+
1259
+ // src/layout/git.ts
1260
+ var isGitLayout = (layout) => layout.kind === "git";
1261
+ function walk(diagram) {
1262
+ const branches = (diagram.git?.branches ?? []).map((b) => b.id);
1263
+ const lane = (id) => {
1264
+ if (!branches.includes(id)) branches.push(id);
1265
+ };
1266
+ for (const step of diagram.steps) for (const e of step.events) if (e.type === "commit" || e.type === "branch") lane(e.branch);
1267
+ const tips = new Map(branches.map((b) => [b, null]));
1268
+ let headAt = null;
1269
+ let attached = null;
1270
+ const made = [];
1271
+ const byId = /* @__PURE__ */ new Map();
1272
+ const links = [];
1273
+ const moves = [];
1274
+ const tags = [];
1275
+ const rows = /* @__PURE__ */ new Map();
1276
+ const most = /* @__PURE__ */ new Map();
1277
+ const shown = /* @__PURE__ */ new Map();
1278
+ const names = [...branches, HEAD];
1279
+ const at2 = new Map(names.map((n) => [n, []]));
1280
+ const heads = [];
1281
+ const visible2 = (ref) => ref === HEAD ? attached === null ? headAt : null : tips.get(ref) ?? null;
1282
+ const freeRow = (commit2) => {
1283
+ const list2 = rows.get(commit2) ?? [];
1284
+ const free = list2.indexOf(null);
1285
+ return free < 0 ? list2.length : free;
1286
+ };
1287
+ const settle = (step, event, change, lineFor) => {
1288
+ const before = new Map(names.map((n) => [n, visible2(n)]));
1289
+ const headBefore = headAt;
1290
+ change();
1291
+ const changed = names.filter((n) => before.get(n) !== visible2(n));
1292
+ const leaving = changed.map((ref) => {
1293
+ const slot = shown.get(ref);
1294
+ if (slot) {
1295
+ rows.get(slot.commit)[slot.row] = null;
1296
+ shown.delete(ref);
1297
+ }
1298
+ return { ref, slot };
1299
+ });
1300
+ for (const { ref, slot } of leaving) {
1301
+ const from = slot ?? (ref === HEAD && headBefore !== null ? { commit: headBefore, row: freeRow(headBefore) } : void 0);
1302
+ const target = visible2(ref);
1303
+ let to;
1304
+ if (target !== null) {
1305
+ to = { commit: target, row: freeRow(target) };
1306
+ const list2 = rows.get(target) ?? [];
1307
+ list2[to.row] = ref;
1308
+ rows.set(target, list2);
1309
+ most.set(target, Math.max(most.get(target) ?? 0, list2.filter((r) => r !== null).length));
1310
+ shown.set(ref, to);
1311
+ }
1312
+ moves.push({ ref, step, event, ...from ? { from } : {}, ...to ? { to } : {}, line: ref === lineFor });
1313
+ }
1314
+ };
1315
+ const prune = (step, event) => {
1316
+ const reach = /* @__PURE__ */ new Set();
1317
+ const stack = [...tips.values(), headAt].filter((c) => c !== null);
1318
+ while (stack.length > 0) {
1319
+ const id = stack.pop();
1320
+ if (reach.has(id)) continue;
1321
+ reach.add(id);
1322
+ stack.push(...byId.get(id)?.parents ?? []);
1323
+ }
1324
+ for (const c of made) if (!reach.has(c.id) && c.orphan === void 0) c.orphan = { step, event };
1325
+ };
1326
+ diagram.steps.forEach((step, s) => {
1327
+ step.events.forEach((e, k) => {
1328
+ if (e.type === "commit") commit(e, s, k);
1329
+ else if (e.type === "branch") {
1330
+ if (!byId.has(e.from)) return;
1331
+ if (laneOf(e.from) !== e.branch) links.push({ kind: "branch", from: e.from, to: e.branch, step: s, event: k });
1332
+ settle(s, k, () => {
1333
+ tips.set(e.branch, e.from);
1334
+ attached = e.branch;
1335
+ headAt = e.from;
1336
+ });
1337
+ } else if (e.type === "edge") {
1338
+ const ref = e.from;
1339
+ if (ref !== HEAD && !tips.has(ref) || !byId.has(e.to)) return;
1340
+ settle(
1341
+ s,
1342
+ k,
1343
+ () => {
1344
+ if (ref === HEAD) {
1345
+ attached = null;
1346
+ headAt = e.to;
1347
+ return;
1348
+ }
1349
+ tips.set(ref, e.to);
1350
+ if (attached === ref) headAt = e.to;
1351
+ else if (attached === null && headAt === e.to) attached = ref;
1352
+ },
1353
+ ref
1354
+ );
1355
+ } else return;
1356
+ prune(s, k);
1357
+ });
1358
+ for (const n of names) at2.get(n)?.push(n === HEAD ? headAt : tips.get(n) ?? null);
1359
+ heads.push(attached);
1360
+ for (const n of names) {
1361
+ const slot = shown.get(n);
1362
+ if (slot) tags.push({ ref: n, step: s, slot });
1363
+ }
1364
+ });
1365
+ function laneOf(id) {
1366
+ return byId.get(id)?.branch;
1367
+ }
1368
+ function commit(e, s, k) {
1369
+ if (byId.has(e.id)) return;
1370
+ const copy = e.copy !== void 0 && byId.has(e.copy) ? e.copy : void 0;
1371
+ const base = copy !== void 0 && attached === null && headAt !== null ? headAt : tips.get(e.branch) ?? null;
1372
+ const joined = e.merge !== void 0 && e.merge !== e.branch ? tips.get(e.merge) ?? void 0 : void 0;
1373
+ const parents = [...new Set([base, joined].filter((c2) => c2 !== null && c2 !== void 0))];
1374
+ const c = {
1375
+ id: e.id,
1376
+ branch: e.branch,
1377
+ parents,
1378
+ ...joined !== void 0 && joined !== base ? { joined } : {},
1379
+ ...copy !== void 0 ? { copy } : {},
1380
+ ...e.hash !== void 0 ? { hash: e.hash } : {},
1381
+ ...e.note !== void 0 ? { note: e.note } : {},
1382
+ step: s,
1383
+ event: k
1384
+ };
1385
+ made.push(c);
1386
+ byId.set(c.id, c);
1387
+ for (const p of parents) links.push({ kind: "parent", from: p, to: c.id, step: s, event: k });
1388
+ if (copy !== void 0) links.push({ kind: "copy", from: copy, to: c.id, step: s, event: k });
1389
+ const first = attached === null && headAt === null;
1390
+ settle(s, k, () => {
1391
+ if (copy === void 0) {
1392
+ tips.set(e.branch, c.id);
1393
+ if (attached === e.branch) headAt = c.id;
1394
+ } else if (attached === null) headAt = c.id;
1395
+ if (first) {
1396
+ attached = e.branch;
1397
+ headAt = c.id;
1398
+ }
1399
+ });
1400
+ }
1401
+ const refs = names.map((name) => ({ name, at: at2.get(name) ?? [], ...name === HEAD ? { attached: heads } : {} }));
1402
+ return { branches, made, links, moves, refs, tags, rows: most };
1403
+ }
1404
+ function cubic(p0, c1, c2, p3) {
1405
+ const n = LOOK.git.samples;
1406
+ return Array.from({ length: n }, (_, k) => {
1407
+ const t = (k + 1) / n;
1408
+ const u = 1 - t;
1409
+ const at2 = (i) => u * u * u * p0[i] + 3 * u * u * t * c1[i] + 3 * u * t * t * c2[i] + t * t * t * p3[i];
1410
+ return [at2(0), at2(1)];
1411
+ });
1412
+ }
1413
+ function elbow(from, to) {
1414
+ if (Math.abs(from[1] - to[1]) < 0.5) return [from, to];
1415
+ return from[1] > to[1] ? [from, [from[0], to[1]], to] : [from, [to[0], from[1]], to];
1416
+ }
1417
+ function fork(p, tx, ty) {
1418
+ const sign = ty > p.cy ? 1 : -1;
1419
+ const p0 = [p.cx, p.cy + sign * p.r];
1420
+ const turn = Math.max(0, Math.min(LOOK.git.turn, tx - p.cx));
1421
+ const p3 = [p.cx + turn, ty];
1422
+ const curve = cubic(p0, [p0[0], p0[1] + (ty - p0[1]) * 0.7], [p.cx + turn * 0.2, ty], p3);
1423
+ return [p0, ...curve, ...tx > p3[0] ? [[tx, ty]] : []];
1424
+ }
1425
+ function join(p, c) {
1426
+ const sign = c.cy < p.cy ? 1 : -1;
1427
+ const p0 = [p.cx + p.r, p.cy];
1428
+ const p3 = [c.cx, c.cy + sign * c.r];
1429
+ const turn = Math.max(0, Math.min(LOOK.git.turn, c.cx - p0[0]));
1430
+ const h = [c.cx - turn, p.cy];
1431
+ const curve = cubic(h, [c.cx - turn * 0.2, p.cy], [c.cx, p3[1] + (p.cy - p3[1]) * 0.7], p3);
1432
+ return [p0, ...h[0] > p0[0] ? [h] : [], ...curve];
1433
+ }
1434
+ function copyLine(p, c) {
1435
+ if (Math.abs(p.cy - c.cy) < 0.5) {
1436
+ const top = p.cy - p.r;
1437
+ const lift = LOOK.git.turn * 0.7;
1438
+ return [[p.cx, top], ...cubic([p.cx, top], [p.cx, top - lift], [c.cx, top - lift], [c.cx, top])];
1439
+ }
1440
+ const sign = c.cy < p.cy ? -1 : 1;
1441
+ const p0 = [p.cx, p.cy + sign * p.r];
1442
+ const p3 = [c.cx, c.cy - sign * c.r];
1443
+ const mid = (p3[1] - p0[1]) * 0.5;
1444
+ return [p0, ...cubic(p0, [p0[0], p0[1] + mid], [p3[0], p3[1] - mid], p3)];
1445
+ }
1446
+ function layoutGit(diagram) {
1447
+ const { margin, gap, box: B, region: R, git: G, carrier: C } = LOOK;
1448
+ const walked = walk(diagram);
1449
+ const notes = new Map((diagram.git?.branches ?? []).map((b) => [b.id, b.note]));
1450
+ const laneIndex = new Map(walked.branches.map((id, i) => [id, i]));
1451
+ const colorOf2 = (branch) => G.colors[(laneIndex.get(branch) ?? 0) % G.colors.length];
1452
+ const col = /* @__PURE__ */ new Map();
1453
+ const laneLast = /* @__PURE__ */ new Map();
1454
+ for (const c of walked.made) {
1455
+ const k = Math.max(0, ...c.parents.map((p) => (col.get(p) ?? -1) + 1), (laneLast.get(c.branch) ?? -1) + 1);
1456
+ col.set(c.id, k);
1457
+ laneLast.set(c.branch, k);
1458
+ }
1459
+ const linesOf = (c) => [
1460
+ ...c.hash !== void 0 ? [{ text: c.hash, style: TYPE.gitHash }] : [],
1461
+ ...c.note !== void 0 ? [{ text: c.note, style: TYPE.gitNote }] : []
1462
+ ];
1463
+ const textW = (c) => Math.max(0, ...linesOf(c).map((line) => textWidth(line.text, line.style)));
1464
+ const tagW = (ref) => textWidth(ref, hasWide(ref) ? TYPE.carrierJa : TYPE.carrier) + C.tagPadX * 2;
1465
+ const refWidth = Math.max(0, ...walked.refs.map((r) => tagW(r.name)));
1466
+ const pitch = Math.max(G.pitch, ...walked.made.map((c) => textW(c) + G.textGap), refWidth + G.textGap);
1467
+ const headers = walked.branches.map((id) => ({ w: Math.max(R.icon, textWidth(id, TYPE.regionName), textWidth(notes.get(id) ?? "", TYPE.regionNote)) }));
1468
+ const headerRight = margin + R.inset + Math.max(0, ...headers.map((h) => h.w));
1469
+ 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);
1470
+ const x0 = Math.max(G.x0, headerRight + gap + firstHalf);
1471
+ const named = new Set(
1472
+ walked.moves.flatMap((mv) => {
1473
+ const source = diagram.steps[mv.step]?.events[mv.event];
1474
+ return mv.line && mv.to && source?.type === "edge" && source.label !== void 0 ? [walked.made.find((c) => c.id === mv.to?.commit)?.branch ?? ""] : [];
1475
+ })
1476
+ );
1477
+ const extraRows = (branch) => Math.max(0, ...walked.made.filter((c) => c.branch === branch).map((c) => (walked.rows.get(c.id) ?? 0) - 2)) * G.row;
1478
+ const topText = walked.made.some((c) => laneIndex.get(c.branch) === 0 && linesOf(c).length > 0);
1479
+ const lanes = [];
1480
+ let y = margin;
1481
+ walked.branches.forEach((id, i) => {
1482
+ const top = i === 0;
1483
+ const tagBase = top && topText ? G.tagTop : G.tag;
1484
+ const line = y + (top ? G.topLine - (G.tagTop - tagBase) : G.line) + extraRows(id);
1485
+ const h = line - y + (top ? G.topBelow : named.has(id) ? G.below : G.bare);
1486
+ lanes.push({ id, x: margin, y, w: 0, h, line, color: colorOf2(id), tagBase });
1487
+ y += h + R.gap;
1488
+ });
1489
+ const lanesBottom = y - R.gap;
1490
+ const laneOf = new Map(lanes.map((l) => [l.id, l]));
1491
+ const commits = walked.made.map((c) => {
1492
+ const lane = laneOf.get(c.branch);
1493
+ const isTop = laneIndex.get(c.branch) === 0;
1494
+ const cx = x0 + pitch * (col.get(c.id) ?? 0) + (isTop ? 0 : pitch / 2);
1495
+ const cy = lane.line;
1496
+ const lines = linesOf(c);
1497
+ const baselines = lines.map((_, k) => isTop ? cy - G.above - (lines.length - 1 - k) * G.lineStep : cy + G.under + k * G.lineStep);
1498
+ const boxes2 = lines.map((line, k) => textBox(line.text, cx, baselines[k], line.style, "middle"));
1499
+ const text2 = boxes2.length === 0 ? void 0 : { ...union(boxes2), lines: lines.map((line) => line.text), baselines };
1500
+ const color = c.copy !== void 0 ? colorOf2(walked.made.find((m) => m.id === c.copy)?.branch ?? c.branch) : colorOf2(c.branch);
1501
+ return {
1502
+ id: c.id,
1503
+ branch: c.branch,
1504
+ color,
1505
+ cx,
1506
+ cy,
1507
+ r: G.r,
1508
+ step: c.step,
1509
+ event: c.event,
1510
+ parents: c.parents,
1511
+ ...c.copy !== void 0 ? { copy: c.copy } : {},
1512
+ ...c.hash !== void 0 ? { hash: c.hash } : {},
1513
+ ...c.note !== void 0 ? { note: c.note } : {},
1514
+ ...text2 ? { text: text2 } : {},
1515
+ ...c.orphan ? { orphan: c.orphan.step, orphanEvent: c.orphan.event } : {}
1516
+ };
1517
+ });
1518
+ const placed = new Map(commits.map((c) => [c.id, c]));
1519
+ const links = walked.links.flatMap((l) => {
1520
+ const from = placed.get(l.from);
1521
+ if (!from) return [];
1522
+ if (l.kind === "branch") {
1523
+ if (!walked.made.some((c) => c.branch === l.to)) return [];
1524
+ const lane = laneOf.get(l.to);
1525
+ return [{ ...l, points: fork(from, from.cx + G.turn, lane.line), color: colorOf2(l.to) }];
1526
+ }
1527
+ const to = placed.get(l.to);
1528
+ const made = walked.made.find((m) => m.id === l.to);
1529
+ let points;
1530
+ if (l.kind === "copy") points = copyLine(from, to);
1531
+ else if (Math.abs(from.cy - to.cy) < 0.5) points = [[from.cx + from.r, from.cy], [to.cx - to.r, to.cy]];
1532
+ else if (made?.joined === l.from) points = join(from, to);
1533
+ else points = fork(from, to.cx - to.r, to.cy);
1534
+ return [{ ...l, points, color: to.color }];
1535
+ });
1536
+ const tagRect = (ref, slot) => {
1537
+ const c = placed.get(slot.commit);
1538
+ const base = laneOf.get(c.branch)?.tagBase ?? G.tag;
1539
+ const w = tagW(ref);
1540
+ return { x: c.cx - w / 2, y: c.cy - base - slot.row * G.row - C.tagH / 2, w, h: C.tagH };
1541
+ };
1542
+ const center2 = (r) => [r.x + r.w / 2, r.y + r.h / 2];
1543
+ const moves = walked.moves.map((m) => {
1544
+ const from = m.from ? tagRect(m.ref, m.from) : void 0;
1545
+ const to = m.to ? tagRect(m.ref, m.to) : void 0;
1546
+ const source = diagram.steps[m.step]?.events[m.event];
1547
+ const carried = m.line && source?.type === "edge" && source.carry.kind !== "none" && !(source.carry.kind === "tag" && source.carry.text === source.from);
1548
+ return {
1549
+ ref: m.ref,
1550
+ step: m.step,
1551
+ event: m.event,
1552
+ ...from ? { from } : {},
1553
+ ...to ? { to } : {},
1554
+ ...m.to ? { target: m.to.commit } : {},
1555
+ ...carried ? { carried: true } : {},
1556
+ ...m.line && from && to ? { line: elbow(center2(from), center2(to)) } : {},
1557
+ color: "slate"
1558
+ };
1559
+ });
1560
+ const tags = walked.tags.map((t) => ({ ...tagRect(t.ref, t.slot), ref: t.ref, step: t.step }));
1561
+ const colors = boxColors(diagram);
1562
+ const right = Math.max(
1563
+ x0,
1564
+ ...commits.flatMap((c) => [c.cx + c.r, ...c.text ? [c.text.x + c.text.w] : []]),
1565
+ ...tags.map((t) => t.x + t.w),
1566
+ ...moves.flatMap((m) => [m.from, m.to].flatMap((r) => r ? [r.x + r.w] : []))
1567
+ );
1568
+ const boxX = right + G.boxGap;
1569
+ const firstCy = (lanes[1] ?? lanes[0])?.line ?? margin + B.h / 2;
1570
+ const boxes = diagram.boxes.map((b, i) => {
1571
+ const w = boxWidth(diagram, b.id, true);
1572
+ const cy = firstCy + i * (B.h + gap);
1573
+ return {
1574
+ id: b.id,
1575
+ name: b.name,
1576
+ ...b.sub !== void 0 ? { sub: b.sub } : {},
1577
+ ...b.icon !== void 0 ? { icon: b.icon } : {},
1578
+ color: colors.get(b.id) ?? "slate",
1579
+ x: boxX,
1580
+ y: cy - B.h / 2,
1581
+ w,
1582
+ h: B.h,
1583
+ cx: boxX + w / 2,
1584
+ cy
1585
+ };
1586
+ });
1587
+ const regions = lanes.map((lane, i) => {
1588
+ const note = notes.get(lane.id);
1589
+ return {
1590
+ id: lane.id,
1591
+ lines: [lane.id],
1592
+ ...note !== void 0 ? { note } : {},
1593
+ icon: "branch",
1594
+ color: lane.color,
1595
+ x: lane.x,
1596
+ y: lane.y,
1597
+ w: 0,
1598
+ h: lane.h,
1599
+ 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 }
1600
+ };
1601
+ });
1602
+ const layout = {
1603
+ kind: "git",
1604
+ width: 0,
1605
+ height: 0,
1606
+ regions,
1607
+ boxes,
1608
+ lifelines: [],
1609
+ edges: [],
1610
+ labels: [],
1611
+ actions: [],
1612
+ badges: [],
1613
+ paths: [],
1614
+ ends: [],
1615
+ lanes,
1616
+ commits,
1617
+ links,
1618
+ tags,
1619
+ refs: walked.refs,
1620
+ moves
1621
+ };
1622
+ layout.badges = badgesOf(diagram, layout);
1623
+ layout.labels = labelsOf(diagram, layout);
1624
+ const contentRight = Math.max(right, ...boxes.map((b) => b.x + b.w), ...layout.labels.map((l) => l.x + l.w)) + R.pad;
1625
+ const width = Math.max(contentRight + margin, stripNeed(diagram) + margin * 2);
1626
+ for (const region of regions) region.w = width - margin * 2;
1627
+ for (const lane of lanes) lane.w = width - margin * 2;
1628
+ const bottom = Math.max(lanesBottom, ...boxes.map((b) => b.y + b.h), ...layout.labels.map((l) => l.y + l.h));
1629
+ const strip2 = layoutStrip(diagram, margin, bottom + gap, width - margin * 2);
1630
+ layout.width = width;
1631
+ layout.height = (strip2 ? strip2.y + strip2.h : bottom) + margin;
1632
+ if (strip2) layout.strip = strip2;
1633
+ layout.badges = badgesOf(diagram, layout);
1634
+ return layout;
1635
+ }
1636
+ function union(rects) {
1637
+ const x = Math.min(...rects.map((r) => r.x));
1638
+ const y = Math.min(...rects.map((r) => r.y));
1639
+ 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 };
1640
+ }
1641
+ function firstMark(layout, step) {
1642
+ const marks = [
1643
+ ...layout.links.filter((l) => l.step === step && l.kind !== "copy").map((l) => ({ event: l.event, points: l.points, color: l.color })),
1644
+ ...layout.moves.flatMap((m) => {
1645
+ const target = layout.commits.find((c) => c.id === m.target);
1646
+ return m.step === step && m.line && target ? [{ event: m.event, target, color: target.color }] : [];
1647
+ })
1648
+ ].sort((a, b) => a.event - b.event);
1649
+ return marks[0];
1650
+ }
1651
+ function besideCommit(c, taken, avoid) {
1652
+ const { r, inset } = LOOK.badge;
1653
+ const d = c.r + inset + r;
1654
+ const apart = r * 2 + inset;
1655
+ const spots = [
1656
+ [c.cx + d, c.cy],
1657
+ [c.cx, c.cy + d],
1658
+ [c.cx - d, c.cy],
1659
+ [c.cx, c.cy - d]
1660
+ ];
1661
+ 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));
1662
+ }
1663
+ function clearOnPath(points, taken, avoid) {
1664
+ const { r, inset, along: start, short } = LOOK.badge;
1665
+ const length = pathLength(points);
1666
+ const first = length < short ? Math.min(r + 1, length / 2) : start;
1667
+ const apart = r * 2 + inset;
1668
+ for (let d = first; d <= length; d += 1) {
1669
+ const p = along(points, d);
1670
+ const rect = badgeRect(p);
1671
+ 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;
1672
+ }
1673
+ return void 0;
1674
+ }
1675
+ function badgesOf(diagram, layout) {
1676
+ const { inset } = LOOK.badge;
1677
+ const taken = [];
1678
+ const all = [...layout.links.map((l) => l.points), ...layout.moves.flatMap((m) => m.line ? [m.line] : [])];
1679
+ const out = [];
1680
+ const avoid = [
1681
+ ...layout.tags,
1682
+ ...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] : []])
1683
+ ];
1684
+ diagram.steps.forEach((step, s) => {
1685
+ const mark = firstMark(layout, s);
1686
+ const near = mark?.target ? besideCommit(mark.target, taken, avoid) : void 0;
1687
+ if (mark && (mark.points || near)) {
1688
+ const points = mark.points;
1689
+ const point = near ?? (points ? clearOnPath(points, taken, avoid) ?? badgeOnPath(points, taken, all.filter((p) => p !== points)) : [0, 0]);
1690
+ taken.push(point);
1691
+ out.push({ step: s, x: point[0], y: point[1], color: mark.color });
1692
+ return;
1693
+ }
1694
+ const box = step.events.flatMap((e) => e.type === "swap" || e.type === "action" ? [e.box] : []).map((id) => layout.boxes.find((b) => b.id === id))[0];
1695
+ if (box) {
1696
+ out.push({ step: s, x: box.x, y: box.y, color: box.color });
1697
+ return;
1698
+ }
1699
+ if (layout.strip && step.events.some((e) => e.type === "strip")) {
1700
+ out.push({ step: s, x: layout.strip.x + inset, y: layout.strip.y + inset, color: "slate" });
1701
+ return;
1702
+ }
1703
+ const tip = layout.commits.find((c) => c.id === layout.refs[0]?.at[s]);
1704
+ const spot = tip ? besideCommit(tip, taken, avoid) : void 0;
1705
+ if (tip && spot) {
1706
+ taken.push(spot);
1707
+ out.push({ step: s, x: spot[0], y: spot[1], color: tip.color });
1708
+ return;
1709
+ }
1710
+ const before = out[out.length - 1];
1711
+ const lane = layout.lanes[0];
1712
+ 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" });
1713
+ });
1714
+ return replaceSameSpot(out);
1715
+ }
1716
+ function labelsOf(diagram, layout) {
1717
+ const G = LOOK.git;
1718
+ const labels = [];
1719
+ const circles = layout.commits.map((c) => ({ x: c.cx - c.r, y: c.cy - c.r, w: c.r * 2, h: c.r * 2 }));
1720
+ const texts = layout.commits.flatMap((c) => c.text ? [c.text] : []);
1721
+ const headers = layout.regions.map((r) => r.header);
1722
+ for (const move of layout.moves) {
1723
+ const source = diagram.steps[move.step]?.events[move.event];
1724
+ if (source?.type !== "edge" || source.label === void 0 || !move.line) continue;
1725
+ const target = layout.commits.find((c) => c.id === source.to);
1726
+ if (!target) continue;
1727
+ const top = layout.lanes[0]?.id === target.branch;
1728
+ const w = textWidth(source.label, hasWide(source.label) ? TYPE.labelJa : TYPE.label) + LOOK.label.padX * 2;
1729
+ const [mx] = move.line.reduce((sum, p) => [sum[0] + p[0] / move.line.length, 0], [0, 0]);
1730
+ 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));
1731
+ const side2 = source.labelSide ?? (top ? "above" : "below");
1732
+ 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 };
1733
+ const seen = layout.badges.filter((b) => b.step <= move.step).map((b) => badgeRect([b.x, b.y]));
1734
+ const tags = layout.tags.filter((t) => t.step === move.step);
1735
+ labels.push(
1736
+ placeLabel(
1737
+ { step: move.step, event: move.event, text: source.label, points: move.line, color: move.color, side: side2, ...base ? { base } : {} },
1738
+ { hard: [...circles, ...layout.boxes], soft: [...texts, ...tags, ...headers, ...labels.filter((l) => l.step === move.step)], touch: seen }
1739
+ )
1740
+ );
1741
+ }
1742
+ return labels;
1743
+ }
1744
+
1188
1745
  // src/layout/sequence.ts
1189
1746
  function layoutSequence(diagram) {
1190
1747
  const { box: B, sequence: Q, label: L, margin, gap } = LOOK;
@@ -1339,31 +1896,6 @@ function badges(diagram, layout) {
1339
1896
  return replaceSameSpot(placed);
1340
1897
  }
1341
1898
 
1342
- // src/words.ts
1343
- var keys = (table) => Object.keys(table);
1344
- var KINDS = keys({ sequence: true, architecture: true, state: true });
1345
- var STATE_ENDS = ["start", "finish"];
1346
- var HEADS = ["group", "end", "box", "strip", "step", "say", "code", "act", "note", "set"];
1347
- var AS = "as";
1348
- var ATTRS = {
1349
- diagram: ["view"],
1350
- group: ["note", "color", "icon"],
1351
- box: ["note", "color", "icon"],
1352
- edge: ["carry", "tag", "side"],
1353
- set: ["tag"]
1354
- };
1355
- var CARRIES = keys({ coin: true, none: true });
1356
- var VIEWS = keys({ fixed: true, follow: true });
1357
- var SIDES = keys({ above: true, below: true, left: true, right: true });
1358
- var OLD_HEADS = {
1359
- \u6642\u7CFB\u5217\u56F3: "sequence",
1360
- \u69CB\u6210\u56F3: "architecture",
1361
- \u533A\u753B: "group",
1362
- \u898B\u305B\u65B9: "view",
1363
- region: "group",
1364
- view: "view"
1365
- };
1366
-
1367
1899
  // src/layout/state.ts
1368
1900
  var isEnd = (id) => STATE_ENDS.includes(id);
1369
1901
  function visitOrder(diagram) {
@@ -1418,7 +1950,7 @@ function layoutState(diagram, lang) {
1418
1950
  }
1419
1951
  const colLeft = [];
1420
1952
  for (let c = 0; c < columnCount; c++) colLeft.push(c === 0 ? margin : colLeft[c - 1] + colW[c - 1] + between[c - 1]);
1421
- const center = (c) => colLeft[c] + colW[c] / 2;
1953
+ const center2 = (c) => colLeft[c] + colW[c] / 2;
1422
1954
  const isGhost = (id) => ghosts.includes(id);
1423
1955
  const enteringFrom = new Set(notTaken.filter((p) => isGhost(p.to) && !isGhost(p.from) && !isEnd(p.from)).map((p) => p.from));
1424
1956
  const notes = [words.sideNote, ...enteringFrom.size > 0 ? [words.sideFrom(enteringFrom.size)] : []];
@@ -1448,7 +1980,7 @@ function layoutState(diagram, lang) {
1448
1980
  };
1449
1981
  const boxes = walked.map((id) => {
1450
1982
  const s = slot.get(id);
1451
- return boxOf(id, center(s.col), rowY(s.row), false);
1983
+ return boxOf(id, center2(s.col), rowY(s.row), false);
1452
1984
  });
1453
1985
  for (const box of boxes) placeSlot(box, carriedIn.get(box.id), doneSide);
1454
1986
  const byId = new Map(boxes.map((b) => [b.id, b]));
@@ -1693,6 +2225,8 @@ var ja = {
1693
2225
  const: (value) => `${value} \u306B\u3059\u308B`,
1694
2226
  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",
1695
2227
  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`,
2228
+ kindOnly: (types, kind) => `${types.join(" \u3068 ")} \u306E\u51FA\u6765\u4E8B\u306F kind \u304C ${kind} \u306E\u6642\u3060\u3051\u66F8\u3051\u308B`,
2229
+ hex: (min, max) => `0 \u304B\u3089 9 \u3068 a \u304B\u3089 f \u306E\u5B57\u3067 ${min} \u304B\u3089 ${max} \u5B57\u306B\u3059\u308B`,
1696
2230
  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",
1697
2231
  oneOf: "\u66F8\u3051\u308B\u5F62\u306E\u3069\u308C\u304B 1 \u3064\u3060\u3051\u306B\u5408\u308F\u305B\u308B",
1698
2232
  discriminator: (tag, values) => `${tag} \u306F ${values.join(" / ")} \u306E\u3069\u308C\u304B\u306B\u3059\u308B`,
@@ -1710,6 +2244,8 @@ var en = {
1710
2244
  const: (value) => `Use ${value}`,
1711
2245
  not: (allowed) => allowed ? `The ${allowed.field} field is allowed only when kind is ${allowed.kind}` : "This combination of fields is not allowed",
1712
2246
  reserved: (names) => `${names.join(" and ")} name the start and end marks of a state diagram and cannot be box ids`,
2247
+ kindOnly: (types, kind) => `${types.join(" and ")} events are allowed only when kind is ${kind}`,
2248
+ hex: (min, max) => `Use ${min} to ${max} characters of 0-9 and a-f`,
1713
2249
  anyOf: (fields) => fields.length > 0 ? `Write one of the ${fields.join(" or ")} fields` : "Does not match any of the allowed shapes",
1714
2250
  oneOf: "Match exactly one of the allowed shapes",
1715
2251
  discriminator: (tag, values) => `${tag} is one of ${values.join(" / ")}`,
@@ -1724,10 +2260,10 @@ function ucs2length(str) {
1724
2260
  return length;
1725
2261
  }
1726
2262
  var validate_diagram_default = validate10;
1727
- 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" } }};
2263
+ 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" } }};
1728
2264
  var func2 = Object.prototype.hasOwnProperty;
1729
2265
  var func3 = ucs2length;
1730
- var schema17 = { "enum": ["blue", "amber", "green", "violet", "rose", "slate", "coin"] };
2266
+ var schema28 = { "enum": ["blue", "amber", "green", "violet", "rose", "slate", "coin"] };
1731
2267
  var pattern0 = new RegExp("^[^\\s\\[\\]\u300C\u300D=:]+$", "u");
1732
2268
  function validate11(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
1733
2269
  let vErrors = null;
@@ -1831,7 +2367,7 @@ function validate11(data, { instancePath = "", parentData, parentDataProperty, r
1831
2367
  if (data.color !== void 0) {
1832
2368
  let data3 = data.color;
1833
2369
  if (!(data3 === "blue" || data3 === "amber" || data3 === "green" || data3 === "violet" || data3 === "rose" || data3 === "slate" || data3 === "coin")) {
1834
- 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" };
2370
+ 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" };
1835
2371
  if (vErrors === null) {
1836
2372
  vErrors = [err9];
1837
2373
  } else {
@@ -1976,7 +2512,7 @@ function validate13(data, { instancePath = "", parentData, parentDataProperty, r
1976
2512
  if (data.color !== void 0) {
1977
2513
  let data3 = data.color;
1978
2514
  if (!(data3 === "blue" || data3 === "amber" || data3 === "green" || data3 === "violet" || data3 === "rose" || data3 === "slate" || data3 === "coin")) {
1979
- 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" };
2515
+ 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" };
1980
2516
  if (vErrors === null) {
1981
2517
  vErrors = [err9];
1982
2518
  } else {
@@ -2153,8 +2689,9 @@ function validate15(data, { instancePath = "", parentData, parentDataProperty, r
2153
2689
  validate15.errors = vErrors;
2154
2690
  return errors === 0;
2155
2691
  }
2156
- 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" } } }] };
2157
- var schema37 = { "properties": { "kind": { "enum": ["envelope", "tag", "coin", "none"] }}};
2692
+ 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" } } }] };
2693
+ var pattern11 = new RegExp("^[0-9a-f]{4,40}$", "u");
2694
+ var schema48 = { "properties": { "kind": { "enum": ["envelope", "tag", "coin", "none"] }}};
2158
2695
  function validate19(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
2159
2696
  let vErrors = null;
2160
2697
  let errors = 0;
@@ -2281,7 +2818,7 @@ function validate19(data, { instancePath = "", parentData, parentDataProperty, r
2281
2818
  if (data.kind !== void 0) {
2282
2819
  let data1 = data.kind;
2283
2820
  if (!(data1 === "envelope" || data1 === "tag" || data1 === "coin" || data1 === "none")) {
2284
- 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" };
2821
+ 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" };
2285
2822
  if (vErrors === null) {
2286
2823
  vErrors = [err8];
2287
2824
  } else {
@@ -2474,7 +3011,7 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
2474
3011
  if (data.labelSide !== void 0) {
2475
3012
  let data5 = data.labelSide;
2476
3013
  if (!(data5 === "above" || data5 === "below" || data5 === "left" || data5 === "right")) {
2477
- 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" };
3014
+ 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" };
2478
3015
  if (vErrors === null) {
2479
3016
  vErrors = [err13];
2480
3017
  } else {
@@ -2700,13 +3237,10 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
2700
3237
  }
2701
3238
  errors++;
2702
3239
  }
2703
- } else if (tag0 === "strip") {
2704
- const _errs39 = errors;
2705
- let valid15 = false;
2706
- const _errs40 = errors;
3240
+ } else if (tag0 === "commit") {
2707
3241
  if (data && typeof data == "object" && !Array.isArray(data)) {
2708
- if (data.value === void 0) {
2709
- const err35 = { instancePath, schemaPath: "#/oneOf/3/anyOf/0/required", keyword: "required", params: { missingProperty: "value" }, message: "must have required property 'value'" };
3242
+ if (data.type === void 0) {
3243
+ const err35 = { instancePath, schemaPath: "#/oneOf/3/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
2710
3244
  if (vErrors === null) {
2711
3245
  vErrors = [err35];
2712
3246
  } else {
@@ -2714,76 +3248,60 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
2714
3248
  }
2715
3249
  errors++;
2716
3250
  }
2717
- }
2718
- var _valid0 = _errs40 === errors;
2719
- valid15 = valid15 || _valid0;
2720
- if (!valid15) {
2721
- const _errs41 = errors;
2722
- if (data && typeof data == "object" && !Array.isArray(data)) {
2723
- if (data.tag === void 0) {
2724
- const err36 = { instancePath, schemaPath: "#/oneOf/3/anyOf/1/required", keyword: "required", params: { missingProperty: "tag" }, message: "must have required property 'tag'" };
2725
- if (vErrors === null) {
2726
- vErrors = [err36];
2727
- } else {
2728
- vErrors.push(err36);
2729
- }
2730
- errors++;
2731
- }
2732
- }
2733
- var _valid0 = _errs41 === errors;
2734
- valid15 = valid15 || _valid0;
2735
- }
2736
- if (!valid15) {
2737
- const err37 = { instancePath, schemaPath: "#/oneOf/3/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
2738
- if (vErrors === null) {
2739
- vErrors = [err37];
2740
- } else {
2741
- vErrors.push(err37);
2742
- }
2743
- errors++;
2744
- } else {
2745
- errors = _errs39;
2746
- if (vErrors !== null) {
2747
- if (_errs39) {
2748
- vErrors.length = _errs39;
2749
- } else {
2750
- vErrors = null;
2751
- }
2752
- }
2753
- }
2754
- if (data && typeof data == "object" && !Array.isArray(data)) {
2755
- if (data.type === void 0) {
2756
- const err38 = { instancePath, schemaPath: "#/oneOf/3/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
3251
+ if (data.id === void 0) {
3252
+ const err36 = { instancePath, schemaPath: "#/oneOf/3/required", keyword: "required", params: { missingProperty: "id" }, message: "must have required property 'id'" };
2757
3253
  if (vErrors === null) {
2758
- vErrors = [err38];
3254
+ vErrors = [err36];
2759
3255
  } else {
2760
- vErrors.push(err38);
3256
+ vErrors.push(err36);
2761
3257
  }
2762
3258
  errors++;
2763
3259
  }
2764
- if (data.field === void 0) {
2765
- const err39 = { instancePath, schemaPath: "#/oneOf/3/required", keyword: "required", params: { missingProperty: "field" }, message: "must have required property 'field'" };
3260
+ if (data.branch === void 0) {
3261
+ const err37 = { instancePath, schemaPath: "#/oneOf/3/required", keyword: "required", params: { missingProperty: "branch" }, message: "must have required property 'branch'" };
2766
3262
  if (vErrors === null) {
2767
- vErrors = [err39];
3263
+ vErrors = [err37];
2768
3264
  } else {
2769
- vErrors.push(err39);
3265
+ vErrors.push(err37);
2770
3266
  }
2771
3267
  errors++;
2772
3268
  }
2773
3269
  for (const key3 in data) {
2774
- if (!(key3 === "type" || key3 === "field" || key3 === "value" || key3 === "tag")) {
2775
- const err40 = { instancePath, schemaPath: "#/oneOf/3/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key3 }, message: "must NOT have additional properties" };
3270
+ if (!(key3 === "type" || key3 === "id" || key3 === "branch" || key3 === "copy" || key3 === "merge" || key3 === "hash" || key3 === "note")) {
3271
+ const err38 = { instancePath, schemaPath: "#/oneOf/3/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key3 }, message: "must NOT have additional properties" };
2776
3272
  if (vErrors === null) {
2777
- vErrors = [err40];
3273
+ vErrors = [err38];
2778
3274
  } else {
2779
- vErrors.push(err40);
3275
+ vErrors.push(err38);
2780
3276
  }
2781
3277
  errors++;
2782
3278
  }
2783
3279
  }
2784
3280
  if (data.type !== void 0) {
2785
- if ("strip" !== data.type) {
2786
- const err41 = { instancePath: instancePath + "/type", schemaPath: "#/oneOf/3/properties/type/const", keyword: "const", params: { allowedValue: "strip" }, message: "must be equal to constant" };
3281
+ if ("commit" !== data.type) {
3282
+ const err39 = { instancePath: instancePath + "/type", schemaPath: "#/oneOf/3/properties/type/const", keyword: "const", params: { allowedValue: "commit" }, message: "must be equal to constant" };
3283
+ if (vErrors === null) {
3284
+ vErrors = [err39];
3285
+ } else {
3286
+ vErrors.push(err39);
3287
+ }
3288
+ errors++;
3289
+ }
3290
+ }
3291
+ if (data.id !== void 0) {
3292
+ let data13 = data.id;
3293
+ if (typeof data13 === "string") {
3294
+ if (!pattern0.test(data13)) {
3295
+ const err40 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
3296
+ if (vErrors === null) {
3297
+ vErrors = [err40];
3298
+ } else {
3299
+ vErrors.push(err40);
3300
+ }
3301
+ errors++;
3302
+ }
3303
+ } else {
3304
+ const err41 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
2787
3305
  if (vErrors === null) {
2788
3306
  vErrors = [err41];
2789
3307
  } else {
@@ -2792,11 +3310,11 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
2792
3310
  errors++;
2793
3311
  }
2794
3312
  }
2795
- if (data.field !== void 0) {
2796
- let data13 = data.field;
2797
- if (typeof data13 === "string") {
2798
- if (func3(data13) < 1) {
2799
- const err42 = { instancePath: instancePath + "/field", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
3313
+ if (data.branch !== void 0) {
3314
+ let data14 = data.branch;
3315
+ if (typeof data14 === "string") {
3316
+ if (!pattern0.test(data14)) {
3317
+ const err42 = { instancePath: instancePath + "/branch", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
2800
3318
  if (vErrors === null) {
2801
3319
  vErrors = [err42];
2802
3320
  } else {
@@ -2805,7 +3323,7 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
2805
3323
  errors++;
2806
3324
  }
2807
3325
  } else {
2808
- const err43 = { instancePath: instancePath + "/field", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
3326
+ const err43 = { instancePath: instancePath + "/branch", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
2809
3327
  if (vErrors === null) {
2810
3328
  vErrors = [err43];
2811
3329
  } else {
@@ -2814,11 +3332,11 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
2814
3332
  errors++;
2815
3333
  }
2816
3334
  }
2817
- if (data.value !== void 0) {
2818
- let data14 = data.value;
2819
- if (typeof data14 === "string") {
2820
- if (func3(data14) < 1) {
2821
- const err44 = { instancePath: instancePath + "/value", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
3335
+ if (data.copy !== void 0) {
3336
+ let data15 = data.copy;
3337
+ if (typeof data15 === "string") {
3338
+ if (!pattern0.test(data15)) {
3339
+ const err44 = { instancePath: instancePath + "/copy", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
2822
3340
  if (vErrors === null) {
2823
3341
  vErrors = [err44];
2824
3342
  } else {
@@ -2827,7 +3345,7 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
2827
3345
  errors++;
2828
3346
  }
2829
3347
  } else {
2830
- const err45 = { instancePath: instancePath + "/value", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
3348
+ const err45 = { instancePath: instancePath + "/copy", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
2831
3349
  if (vErrors === null) {
2832
3350
  vErrors = [err45];
2833
3351
  } else {
@@ -2836,11 +3354,11 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
2836
3354
  errors++;
2837
3355
  }
2838
3356
  }
2839
- if (data.tag !== void 0) {
2840
- let data15 = data.tag;
2841
- if (typeof data15 === "string") {
2842
- if (func3(data15) < 1) {
2843
- const err46 = { instancePath: instancePath + "/tag", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
3357
+ if (data.merge !== void 0) {
3358
+ let data16 = data.merge;
3359
+ if (typeof data16 === "string") {
3360
+ if (!pattern0.test(data16)) {
3361
+ const err46 = { instancePath: instancePath + "/merge", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
2844
3362
  if (vErrors === null) {
2845
3363
  vErrors = [err46];
2846
3364
  } else {
@@ -2849,7 +3367,7 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
2849
3367
  errors++;
2850
3368
  }
2851
3369
  } else {
2852
- const err47 = { instancePath: instancePath + "/tag", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
3370
+ const err47 = { instancePath: instancePath + "/merge", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
2853
3371
  if (vErrors === null) {
2854
3372
  vErrors = [err47];
2855
3373
  } else {
@@ -2858,68 +3376,383 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
2858
3376
  errors++;
2859
3377
  }
2860
3378
  }
3379
+ if (data.hash !== void 0) {
3380
+ let data17 = data.hash;
3381
+ if (typeof data17 === "string") {
3382
+ if (!pattern11.test(data17)) {
3383
+ 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}$"' };
3384
+ if (vErrors === null) {
3385
+ vErrors = [err48];
3386
+ } else {
3387
+ vErrors.push(err48);
3388
+ }
3389
+ errors++;
3390
+ }
3391
+ } else {
3392
+ const err49 = { instancePath: instancePath + "/hash", schemaPath: "#/definitions/hash/type", keyword: "type", params: { type: "string" }, message: "must be string" };
3393
+ if (vErrors === null) {
3394
+ vErrors = [err49];
3395
+ } else {
3396
+ vErrors.push(err49);
3397
+ }
3398
+ errors++;
3399
+ }
3400
+ }
3401
+ if (data.note !== void 0) {
3402
+ let data18 = data.note;
3403
+ if (typeof data18 === "string") {
3404
+ if (func3(data18) < 1) {
3405
+ const err50 = { instancePath: instancePath + "/note", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
3406
+ if (vErrors === null) {
3407
+ vErrors = [err50];
3408
+ } else {
3409
+ vErrors.push(err50);
3410
+ }
3411
+ errors++;
3412
+ }
3413
+ } else {
3414
+ const err51 = { instancePath: instancePath + "/note", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
3415
+ if (vErrors === null) {
3416
+ vErrors = [err51];
3417
+ } else {
3418
+ vErrors.push(err51);
3419
+ }
3420
+ errors++;
3421
+ }
3422
+ }
2861
3423
  } else {
2862
- const err48 = { instancePath, schemaPath: "#/oneOf/3/type", keyword: "type", params: { type: "object" }, message: "must be object" };
3424
+ const err52 = { instancePath, schemaPath: "#/oneOf/3/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2863
3425
  if (vErrors === null) {
2864
- vErrors = [err48];
3426
+ vErrors = [err52];
2865
3427
  } else {
2866
- vErrors.push(err48);
3428
+ vErrors.push(err52);
2867
3429
  }
2868
3430
  errors++;
2869
3431
  }
2870
- } else {
2871
- const err49 = { instancePath, schemaPath: "#/discriminator", keyword: "discriminator", params: { error: "mapping", tag: "type", tagValue: tag0 }, message: 'value of tag "type" must be in oneOf' };
2872
- if (vErrors === null) {
2873
- vErrors = [err49];
2874
- } else {
2875
- vErrors.push(err49);
2876
- }
2877
- errors++;
2878
- }
2879
- } else {
2880
- const err50 = { instancePath, schemaPath: "#/discriminator", keyword: "discriminator", params: { error: "tag", tag: "type", tagValue: tag0 }, message: 'tag "type" must be string' };
2881
- if (vErrors === null) {
2882
- vErrors = [err50];
2883
- } else {
2884
- vErrors.push(err50);
2885
- }
2886
- errors++;
2887
- }
2888
- } else {
2889
- const err51 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
2890
- if (vErrors === null) {
2891
- vErrors = [err51];
2892
- } else {
2893
- vErrors.push(err51);
2894
- }
2895
- errors++;
2896
- }
2897
- validate18.errors = vErrors;
2898
- return errors === 0;
2899
- }
2900
- function validate17(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
2901
- let vErrors = null;
2902
- let errors = 0;
2903
- if (data && typeof data == "object" && !Array.isArray(data)) {
2904
- if (data.title === void 0) {
2905
- const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "title" }, message: "must have required property 'title'" };
2906
- if (vErrors === null) {
2907
- vErrors = [err0];
2908
- } else {
2909
- vErrors.push(err0);
2910
- }
2911
- errors++;
2912
- }
2913
- if (data.body === void 0) {
2914
- const err1 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "body" }, message: "must have required property 'body'" };
2915
- if (vErrors === null) {
2916
- vErrors = [err1];
2917
- } else {
2918
- vErrors.push(err1);
2919
- }
2920
- errors++;
2921
- }
2922
- if (data.events === void 0) {
3432
+ } else if (tag0 === "branch") {
3433
+ if (data && typeof data == "object" && !Array.isArray(data)) {
3434
+ if (data.type === void 0) {
3435
+ const err53 = { instancePath, schemaPath: "#/oneOf/4/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
3436
+ if (vErrors === null) {
3437
+ vErrors = [err53];
3438
+ } else {
3439
+ vErrors.push(err53);
3440
+ }
3441
+ errors++;
3442
+ }
3443
+ if (data.branch === void 0) {
3444
+ const err54 = { instancePath, schemaPath: "#/oneOf/4/required", keyword: "required", params: { missingProperty: "branch" }, message: "must have required property 'branch'" };
3445
+ if (vErrors === null) {
3446
+ vErrors = [err54];
3447
+ } else {
3448
+ vErrors.push(err54);
3449
+ }
3450
+ errors++;
3451
+ }
3452
+ if (data.from === void 0) {
3453
+ const err55 = { instancePath, schemaPath: "#/oneOf/4/required", keyword: "required", params: { missingProperty: "from" }, message: "must have required property 'from'" };
3454
+ if (vErrors === null) {
3455
+ vErrors = [err55];
3456
+ } else {
3457
+ vErrors.push(err55);
3458
+ }
3459
+ errors++;
3460
+ }
3461
+ for (const key4 in data) {
3462
+ if (!(key4 === "type" || key4 === "branch" || key4 === "from")) {
3463
+ const err56 = { instancePath, schemaPath: "#/oneOf/4/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key4 }, message: "must NOT have additional properties" };
3464
+ if (vErrors === null) {
3465
+ vErrors = [err56];
3466
+ } else {
3467
+ vErrors.push(err56);
3468
+ }
3469
+ errors++;
3470
+ }
3471
+ }
3472
+ if (data.type !== void 0) {
3473
+ if ("branch" !== data.type) {
3474
+ const err57 = { instancePath: instancePath + "/type", schemaPath: "#/oneOf/4/properties/type/const", keyword: "const", params: { allowedValue: "branch" }, message: "must be equal to constant" };
3475
+ if (vErrors === null) {
3476
+ vErrors = [err57];
3477
+ } else {
3478
+ vErrors.push(err57);
3479
+ }
3480
+ errors++;
3481
+ }
3482
+ }
3483
+ if (data.branch !== void 0) {
3484
+ let data20 = data.branch;
3485
+ if (typeof data20 === "string") {
3486
+ if (!pattern0.test(data20)) {
3487
+ const err58 = { instancePath: instancePath + "/branch", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
3488
+ if (vErrors === null) {
3489
+ vErrors = [err58];
3490
+ } else {
3491
+ vErrors.push(err58);
3492
+ }
3493
+ errors++;
3494
+ }
3495
+ } else {
3496
+ const err59 = { instancePath: instancePath + "/branch", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
3497
+ if (vErrors === null) {
3498
+ vErrors = [err59];
3499
+ } else {
3500
+ vErrors.push(err59);
3501
+ }
3502
+ errors++;
3503
+ }
3504
+ }
3505
+ if (data.from !== void 0) {
3506
+ let data21 = data.from;
3507
+ if (typeof data21 === "string") {
3508
+ if (!pattern0.test(data21)) {
3509
+ const err60 = { instancePath: instancePath + "/from", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
3510
+ if (vErrors === null) {
3511
+ vErrors = [err60];
3512
+ } else {
3513
+ vErrors.push(err60);
3514
+ }
3515
+ errors++;
3516
+ }
3517
+ } else {
3518
+ const err61 = { instancePath: instancePath + "/from", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
3519
+ if (vErrors === null) {
3520
+ vErrors = [err61];
3521
+ } else {
3522
+ vErrors.push(err61);
3523
+ }
3524
+ errors++;
3525
+ }
3526
+ }
3527
+ } else {
3528
+ const err62 = { instancePath, schemaPath: "#/oneOf/4/type", keyword: "type", params: { type: "object" }, message: "must be object" };
3529
+ if (vErrors === null) {
3530
+ vErrors = [err62];
3531
+ } else {
3532
+ vErrors.push(err62);
3533
+ }
3534
+ errors++;
3535
+ }
3536
+ } else if (tag0 === "strip") {
3537
+ const _errs71 = errors;
3538
+ let valid27 = false;
3539
+ const _errs72 = errors;
3540
+ if (data && typeof data == "object" && !Array.isArray(data)) {
3541
+ if (data.value === void 0) {
3542
+ const err63 = { instancePath, schemaPath: "#/oneOf/5/anyOf/0/required", keyword: "required", params: { missingProperty: "value" }, message: "must have required property 'value'" };
3543
+ if (vErrors === null) {
3544
+ vErrors = [err63];
3545
+ } else {
3546
+ vErrors.push(err63);
3547
+ }
3548
+ errors++;
3549
+ }
3550
+ }
3551
+ var _valid0 = _errs72 === errors;
3552
+ valid27 = valid27 || _valid0;
3553
+ if (!valid27) {
3554
+ const _errs73 = errors;
3555
+ if (data && typeof data == "object" && !Array.isArray(data)) {
3556
+ if (data.tag === void 0) {
3557
+ const err64 = { instancePath, schemaPath: "#/oneOf/5/anyOf/1/required", keyword: "required", params: { missingProperty: "tag" }, message: "must have required property 'tag'" };
3558
+ if (vErrors === null) {
3559
+ vErrors = [err64];
3560
+ } else {
3561
+ vErrors.push(err64);
3562
+ }
3563
+ errors++;
3564
+ }
3565
+ }
3566
+ var _valid0 = _errs73 === errors;
3567
+ valid27 = valid27 || _valid0;
3568
+ }
3569
+ if (!valid27) {
3570
+ const err65 = { instancePath, schemaPath: "#/oneOf/5/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
3571
+ if (vErrors === null) {
3572
+ vErrors = [err65];
3573
+ } else {
3574
+ vErrors.push(err65);
3575
+ }
3576
+ errors++;
3577
+ } else {
3578
+ errors = _errs71;
3579
+ if (vErrors !== null) {
3580
+ if (_errs71) {
3581
+ vErrors.length = _errs71;
3582
+ } else {
3583
+ vErrors = null;
3584
+ }
3585
+ }
3586
+ }
3587
+ if (data && typeof data == "object" && !Array.isArray(data)) {
3588
+ if (data.type === void 0) {
3589
+ const err66 = { instancePath, schemaPath: "#/oneOf/5/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
3590
+ if (vErrors === null) {
3591
+ vErrors = [err66];
3592
+ } else {
3593
+ vErrors.push(err66);
3594
+ }
3595
+ errors++;
3596
+ }
3597
+ if (data.field === void 0) {
3598
+ const err67 = { instancePath, schemaPath: "#/oneOf/5/required", keyword: "required", params: { missingProperty: "field" }, message: "must have required property 'field'" };
3599
+ if (vErrors === null) {
3600
+ vErrors = [err67];
3601
+ } else {
3602
+ vErrors.push(err67);
3603
+ }
3604
+ errors++;
3605
+ }
3606
+ for (const key5 in data) {
3607
+ if (!(key5 === "type" || key5 === "field" || key5 === "value" || key5 === "tag")) {
3608
+ const err68 = { instancePath, schemaPath: "#/oneOf/5/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key5 }, message: "must NOT have additional properties" };
3609
+ if (vErrors === null) {
3610
+ vErrors = [err68];
3611
+ } else {
3612
+ vErrors.push(err68);
3613
+ }
3614
+ errors++;
3615
+ }
3616
+ }
3617
+ if (data.type !== void 0) {
3618
+ if ("strip" !== data.type) {
3619
+ const err69 = { instancePath: instancePath + "/type", schemaPath: "#/oneOf/5/properties/type/const", keyword: "const", params: { allowedValue: "strip" }, message: "must be equal to constant" };
3620
+ if (vErrors === null) {
3621
+ vErrors = [err69];
3622
+ } else {
3623
+ vErrors.push(err69);
3624
+ }
3625
+ errors++;
3626
+ }
3627
+ }
3628
+ if (data.field !== void 0) {
3629
+ let data23 = data.field;
3630
+ if (typeof data23 === "string") {
3631
+ if (func3(data23) < 1) {
3632
+ const err70 = { instancePath: instancePath + "/field", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
3633
+ if (vErrors === null) {
3634
+ vErrors = [err70];
3635
+ } else {
3636
+ vErrors.push(err70);
3637
+ }
3638
+ errors++;
3639
+ }
3640
+ } else {
3641
+ const err71 = { instancePath: instancePath + "/field", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
3642
+ if (vErrors === null) {
3643
+ vErrors = [err71];
3644
+ } else {
3645
+ vErrors.push(err71);
3646
+ }
3647
+ errors++;
3648
+ }
3649
+ }
3650
+ if (data.value !== void 0) {
3651
+ let data24 = data.value;
3652
+ if (typeof data24 === "string") {
3653
+ if (func3(data24) < 1) {
3654
+ const err72 = { instancePath: instancePath + "/value", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
3655
+ if (vErrors === null) {
3656
+ vErrors = [err72];
3657
+ } else {
3658
+ vErrors.push(err72);
3659
+ }
3660
+ errors++;
3661
+ }
3662
+ } else {
3663
+ const err73 = { instancePath: instancePath + "/value", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
3664
+ if (vErrors === null) {
3665
+ vErrors = [err73];
3666
+ } else {
3667
+ vErrors.push(err73);
3668
+ }
3669
+ errors++;
3670
+ }
3671
+ }
3672
+ if (data.tag !== void 0) {
3673
+ let data25 = data.tag;
3674
+ if (typeof data25 === "string") {
3675
+ if (func3(data25) < 1) {
3676
+ const err74 = { instancePath: instancePath + "/tag", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
3677
+ if (vErrors === null) {
3678
+ vErrors = [err74];
3679
+ } else {
3680
+ vErrors.push(err74);
3681
+ }
3682
+ errors++;
3683
+ }
3684
+ } else {
3685
+ const err75 = { instancePath: instancePath + "/tag", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
3686
+ if (vErrors === null) {
3687
+ vErrors = [err75];
3688
+ } else {
3689
+ vErrors.push(err75);
3690
+ }
3691
+ errors++;
3692
+ }
3693
+ }
3694
+ } else {
3695
+ const err76 = { instancePath, schemaPath: "#/oneOf/5/type", keyword: "type", params: { type: "object" }, message: "must be object" };
3696
+ if (vErrors === null) {
3697
+ vErrors = [err76];
3698
+ } else {
3699
+ vErrors.push(err76);
3700
+ }
3701
+ errors++;
3702
+ }
3703
+ } else {
3704
+ const err77 = { instancePath, schemaPath: "#/discriminator", keyword: "discriminator", params: { error: "mapping", tag: "type", tagValue: tag0 }, message: 'value of tag "type" must be in oneOf' };
3705
+ if (vErrors === null) {
3706
+ vErrors = [err77];
3707
+ } else {
3708
+ vErrors.push(err77);
3709
+ }
3710
+ errors++;
3711
+ }
3712
+ } else {
3713
+ const err78 = { instancePath, schemaPath: "#/discriminator", keyword: "discriminator", params: { error: "tag", tag: "type", tagValue: tag0 }, message: 'tag "type" must be string' };
3714
+ if (vErrors === null) {
3715
+ vErrors = [err78];
3716
+ } else {
3717
+ vErrors.push(err78);
3718
+ }
3719
+ errors++;
3720
+ }
3721
+ } else {
3722
+ const err79 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
3723
+ if (vErrors === null) {
3724
+ vErrors = [err79];
3725
+ } else {
3726
+ vErrors.push(err79);
3727
+ }
3728
+ errors++;
3729
+ }
3730
+ validate18.errors = vErrors;
3731
+ return errors === 0;
3732
+ }
3733
+ function validate17(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
3734
+ let vErrors = null;
3735
+ let errors = 0;
3736
+ if (data && typeof data == "object" && !Array.isArray(data)) {
3737
+ if (data.title === void 0) {
3738
+ const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "title" }, message: "must have required property 'title'" };
3739
+ if (vErrors === null) {
3740
+ vErrors = [err0];
3741
+ } else {
3742
+ vErrors.push(err0);
3743
+ }
3744
+ errors++;
3745
+ }
3746
+ if (data.body === void 0) {
3747
+ const err1 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "body" }, message: "must have required property 'body'" };
3748
+ if (vErrors === null) {
3749
+ vErrors = [err1];
3750
+ } else {
3751
+ vErrors.push(err1);
3752
+ }
3753
+ errors++;
3754
+ }
3755
+ if (data.events === void 0) {
2923
3756
  const err2 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "events" }, message: "must have required property 'events'" };
2924
3757
  if (vErrors === null) {
2925
3758
  vErrors = [err2];
@@ -3201,40 +4034,185 @@ function validate26(data, { instancePath = "", parentData, parentDataProperty, r
3201
4034
  if (func3(data2) < 1) {
3202
4035
  const err7 = { instancePath: instancePath + "/label", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
3203
4036
  if (vErrors === null) {
3204
- vErrors = [err7];
4037
+ vErrors = [err7];
4038
+ } else {
4039
+ vErrors.push(err7);
4040
+ }
4041
+ errors++;
4042
+ }
4043
+ } else {
4044
+ const err8 = { instancePath: instancePath + "/label", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
4045
+ if (vErrors === null) {
4046
+ vErrors = [err8];
4047
+ } else {
4048
+ vErrors.push(err8);
4049
+ }
4050
+ errors++;
4051
+ }
4052
+ }
4053
+ } else {
4054
+ const err9 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
4055
+ if (vErrors === null) {
4056
+ vErrors = [err9];
4057
+ } else {
4058
+ vErrors.push(err9);
4059
+ }
4060
+ errors++;
4061
+ }
4062
+ validate26.errors = vErrors;
4063
+ return errors === 0;
4064
+ }
4065
+ function validate25(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
4066
+ let vErrors = null;
4067
+ let errors = 0;
4068
+ if (data && typeof data == "object" && !Array.isArray(data)) {
4069
+ if (data.paths === void 0) {
4070
+ const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "paths" }, message: "must have required property 'paths'" };
4071
+ if (vErrors === null) {
4072
+ vErrors = [err0];
4073
+ } else {
4074
+ vErrors.push(err0);
4075
+ }
4076
+ errors++;
4077
+ }
4078
+ for (const key0 in data) {
4079
+ if (!(key0 === "paths")) {
4080
+ const err1 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
4081
+ if (vErrors === null) {
4082
+ vErrors = [err1];
4083
+ } else {
4084
+ vErrors.push(err1);
4085
+ }
4086
+ errors++;
4087
+ }
4088
+ }
4089
+ if (data.paths !== void 0) {
4090
+ let data0 = data.paths;
4091
+ if (Array.isArray(data0)) {
4092
+ if (data0.length < 1) {
4093
+ const err2 = { instancePath: instancePath + "/paths", schemaPath: "#/properties/paths/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
4094
+ if (vErrors === null) {
4095
+ vErrors = [err2];
4096
+ } else {
4097
+ vErrors.push(err2);
4098
+ }
4099
+ errors++;
4100
+ }
4101
+ const len0 = data0.length;
4102
+ for (let i0 = 0; i0 < len0; i0++) {
4103
+ if (!validate26(data0[i0], { instancePath: instancePath + "/paths/" + i0, parentData: data0, parentDataProperty: i0, rootData })) {
4104
+ vErrors = vErrors === null ? validate26.errors : vErrors.concat(validate26.errors);
4105
+ errors = vErrors.length;
4106
+ }
4107
+ }
4108
+ } else {
4109
+ const err3 = { instancePath: instancePath + "/paths", schemaPath: "#/properties/paths/type", keyword: "type", params: { type: "array" }, message: "must be array" };
4110
+ if (vErrors === null) {
4111
+ vErrors = [err3];
4112
+ } else {
4113
+ vErrors.push(err3);
4114
+ }
4115
+ errors++;
4116
+ }
4117
+ }
4118
+ } else {
4119
+ const err4 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
4120
+ if (vErrors === null) {
4121
+ vErrors = [err4];
4122
+ } else {
4123
+ vErrors.push(err4);
4124
+ }
4125
+ errors++;
4126
+ }
4127
+ validate25.errors = vErrors;
4128
+ return errors === 0;
4129
+ }
4130
+ function validate30(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
4131
+ let vErrors = null;
4132
+ let errors = 0;
4133
+ if (data && typeof data == "object" && !Array.isArray(data)) {
4134
+ if (data.id === void 0) {
4135
+ const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "id" }, message: "must have required property 'id'" };
4136
+ if (vErrors === null) {
4137
+ vErrors = [err0];
4138
+ } else {
4139
+ vErrors.push(err0);
4140
+ }
4141
+ errors++;
4142
+ }
4143
+ for (const key0 in data) {
4144
+ if (!(key0 === "id" || key0 === "note")) {
4145
+ const err1 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
4146
+ if (vErrors === null) {
4147
+ vErrors = [err1];
4148
+ } else {
4149
+ vErrors.push(err1);
4150
+ }
4151
+ errors++;
4152
+ }
4153
+ }
4154
+ if (data.id !== void 0) {
4155
+ let data0 = data.id;
4156
+ if (typeof data0 === "string") {
4157
+ if (!pattern0.test(data0)) {
4158
+ const err2 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
4159
+ if (vErrors === null) {
4160
+ vErrors = [err2];
4161
+ } else {
4162
+ vErrors.push(err2);
4163
+ }
4164
+ errors++;
4165
+ }
4166
+ } else {
4167
+ const err3 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
4168
+ if (vErrors === null) {
4169
+ vErrors = [err3];
4170
+ } else {
4171
+ vErrors.push(err3);
4172
+ }
4173
+ errors++;
4174
+ }
4175
+ }
4176
+ if (data.note !== void 0) {
4177
+ let data1 = data.note;
4178
+ if (typeof data1 === "string") {
4179
+ if (func3(data1) < 1) {
4180
+ const err4 = { instancePath: instancePath + "/note", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
4181
+ if (vErrors === null) {
4182
+ vErrors = [err4];
3205
4183
  } else {
3206
- vErrors.push(err7);
4184
+ vErrors.push(err4);
3207
4185
  }
3208
4186
  errors++;
3209
4187
  }
3210
4188
  } else {
3211
- const err8 = { instancePath: instancePath + "/label", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
4189
+ const err5 = { instancePath: instancePath + "/note", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
3212
4190
  if (vErrors === null) {
3213
- vErrors = [err8];
4191
+ vErrors = [err5];
3214
4192
  } else {
3215
- vErrors.push(err8);
4193
+ vErrors.push(err5);
3216
4194
  }
3217
4195
  errors++;
3218
4196
  }
3219
4197
  }
3220
4198
  } else {
3221
- const err9 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
4199
+ const err6 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
3222
4200
  if (vErrors === null) {
3223
- vErrors = [err9];
4201
+ vErrors = [err6];
3224
4202
  } else {
3225
- vErrors.push(err9);
4203
+ vErrors.push(err6);
3226
4204
  }
3227
4205
  errors++;
3228
4206
  }
3229
- validate26.errors = vErrors;
4207
+ validate30.errors = vErrors;
3230
4208
  return errors === 0;
3231
4209
  }
3232
- function validate25(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
4210
+ function validate29(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
3233
4211
  let vErrors = null;
3234
4212
  let errors = 0;
3235
4213
  if (data && typeof data == "object" && !Array.isArray(data)) {
3236
- if (data.paths === void 0) {
3237
- const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "paths" }, message: "must have required property 'paths'" };
4214
+ if (data.branches === void 0) {
4215
+ const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "branches" }, message: "must have required property 'branches'" };
3238
4216
  if (vErrors === null) {
3239
4217
  vErrors = [err0];
3240
4218
  } else {
@@ -3243,7 +4221,7 @@ function validate25(data, { instancePath = "", parentData, parentDataProperty, r
3243
4221
  errors++;
3244
4222
  }
3245
4223
  for (const key0 in data) {
3246
- if (!(key0 === "paths")) {
4224
+ if (!(key0 === "branches")) {
3247
4225
  const err1 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
3248
4226
  if (vErrors === null) {
3249
4227
  vErrors = [err1];
@@ -3253,11 +4231,11 @@ function validate25(data, { instancePath = "", parentData, parentDataProperty, r
3253
4231
  errors++;
3254
4232
  }
3255
4233
  }
3256
- if (data.paths !== void 0) {
3257
- let data0 = data.paths;
4234
+ if (data.branches !== void 0) {
4235
+ let data0 = data.branches;
3258
4236
  if (Array.isArray(data0)) {
3259
4237
  if (data0.length < 1) {
3260
- const err2 = { instancePath: instancePath + "/paths", schemaPath: "#/properties/paths/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
4238
+ const err2 = { instancePath: instancePath + "/branches", schemaPath: "#/properties/branches/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
3261
4239
  if (vErrors === null) {
3262
4240
  vErrors = [err2];
3263
4241
  } else {
@@ -3267,13 +4245,13 @@ function validate25(data, { instancePath = "", parentData, parentDataProperty, r
3267
4245
  }
3268
4246
  const len0 = data0.length;
3269
4247
  for (let i0 = 0; i0 < len0; i0++) {
3270
- if (!validate26(data0[i0], { instancePath: instancePath + "/paths/" + i0, parentData: data0, parentDataProperty: i0, rootData })) {
3271
- vErrors = vErrors === null ? validate26.errors : vErrors.concat(validate26.errors);
4248
+ if (!validate30(data0[i0], { instancePath: instancePath + "/branches/" + i0, parentData: data0, parentDataProperty: i0, rootData })) {
4249
+ vErrors = vErrors === null ? validate30.errors : vErrors.concat(validate30.errors);
3272
4250
  errors = vErrors.length;
3273
4251
  }
3274
4252
  }
3275
4253
  } else {
3276
- const err3 = { instancePath: instancePath + "/paths", schemaPath: "#/properties/paths/type", keyword: "type", params: { type: "array" }, message: "must be array" };
4254
+ const err3 = { instancePath: instancePath + "/branches", schemaPath: "#/properties/branches/type", keyword: "type", params: { type: "array" }, message: "must be array" };
3277
4255
  if (vErrors === null) {
3278
4256
  vErrors = [err3];
3279
4257
  } else {
@@ -3291,7 +4269,7 @@ function validate25(data, { instancePath = "", parentData, parentDataProperty, r
3291
4269
  }
3292
4270
  errors++;
3293
4271
  }
3294
- validate25.errors = vErrors;
4272
+ validate29.errors = vErrors;
3295
4273
  return errors === 0;
3296
4274
  }
3297
4275
  function validate10(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
@@ -3335,11 +4313,9 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
3335
4313
  let ifClause0;
3336
4314
  if (_valid0) {
3337
4315
  const _errs4 = errors;
3338
- const _errs5 = errors;
3339
- const _errs6 = errors;
3340
4316
  if (data && typeof data == "object" && !Array.isArray(data)) {
3341
- if (data.state === void 0 && ("state")) {
3342
- const err2 = {};
4317
+ if (data.sequence === void 0) {
4318
+ const err2 = { instancePath, schemaPath: "#/then/required", keyword: "required", params: { missingProperty: "sequence" }, message: "must have required property 'sequence'" };
3343
4319
  if (vErrors === null) {
3344
4320
  vErrors = [err2];
3345
4321
  } else {
@@ -3347,147 +4323,181 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
3347
4323
  }
3348
4324
  errors++;
3349
4325
  }
3350
- }
3351
- var valid2 = _errs6 === errors;
3352
- if (valid2) {
3353
- const err3 = { instancePath, schemaPath: "#/then/not", keyword: "not", params: {}, message: "must NOT be valid" };
3354
- if (vErrors === null) {
3355
- vErrors = [err3];
3356
- } else {
3357
- vErrors.push(err3);
4326
+ if (data.boxes !== void 0) {
4327
+ let data1 = data.boxes;
4328
+ if (Array.isArray(data1)) {
4329
+ if (data1.length < 1) {
4330
+ const err3 = { instancePath: instancePath + "/boxes", schemaPath: "#/then/properties/boxes/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
4331
+ if (vErrors === null) {
4332
+ vErrors = [err3];
4333
+ } else {
4334
+ vErrors.push(err3);
4335
+ }
4336
+ errors++;
4337
+ }
4338
+ }
3358
4339
  }
3359
- errors++;
3360
- } else {
3361
- errors = _errs5;
3362
- if (vErrors !== null) {
3363
- if (_errs5) {
3364
- vErrors.length = _errs5;
3365
- } else {
3366
- vErrors = null;
4340
+ if (data.steps !== void 0) {
4341
+ let data2 = data.steps;
4342
+ if (Array.isArray(data2)) {
4343
+ const len0 = data2.length;
4344
+ for (let i0 = 0; i0 < len0; i0++) {
4345
+ let data3 = data2[i0];
4346
+ if (data3 && typeof data3 == "object" && !Array.isArray(data3)) {
4347
+ if (data3.events !== void 0) {
4348
+ let data4 = data3.events;
4349
+ if (Array.isArray(data4)) {
4350
+ const len1 = data4.length;
4351
+ for (let i1 = 0; i1 < len1; i1++) {
4352
+ let data5 = data4[i1];
4353
+ if (data5 && typeof data5 == "object" && !Array.isArray(data5)) {
4354
+ if (data5.type !== void 0) {
4355
+ let data6 = data5.type;
4356
+ const _errs12 = errors;
4357
+ const _errs13 = errors;
4358
+ if (!(data6 === "commit" || data6 === "branch")) {
4359
+ const err4 = {};
4360
+ if (vErrors === null) {
4361
+ vErrors = [err4];
4362
+ } else {
4363
+ vErrors.push(err4);
4364
+ }
4365
+ errors++;
4366
+ }
4367
+ var valid10 = _errs13 === errors;
4368
+ if (valid10) {
4369
+ 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" };
4370
+ if (vErrors === null) {
4371
+ vErrors = [err5];
4372
+ } else {
4373
+ vErrors.push(err5);
4374
+ }
4375
+ errors++;
4376
+ } else {
4377
+ errors = _errs12;
4378
+ if (vErrors !== null) {
4379
+ if (_errs12) {
4380
+ vErrors.length = _errs12;
4381
+ } else {
4382
+ vErrors = null;
4383
+ }
4384
+ }
4385
+ }
4386
+ }
4387
+ }
4388
+ }
4389
+ }
4390
+ }
4391
+ }
4392
+ }
3367
4393
  }
3368
4394
  }
3369
- }
3370
- if (data && typeof data == "object" && !Array.isArray(data)) {
3371
- if (data.sequence === void 0) {
3372
- const err4 = { instancePath, schemaPath: "#/then/required", keyword: "required", params: { missingProperty: "sequence" }, message: "must have required property 'sequence'" };
4395
+ if (data.state !== void 0) {
4396
+ const err6 = { instancePath: instancePath + "/state", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
3373
4397
  if (vErrors === null) {
3374
- vErrors = [err4];
4398
+ vErrors = [err6];
3375
4399
  } else {
3376
- vErrors.push(err4);
4400
+ vErrors.push(err6);
3377
4401
  }
3378
4402
  errors++;
3379
4403
  }
3380
- }
3381
- var _valid0 = _errs4 === errors;
3382
- valid0 = _valid0;
3383
- ifClause0 = "then";
3384
- } else {
3385
- const _errs7 = errors;
3386
- const _errs8 = errors;
3387
- const _errs9 = errors;
3388
- if (data && typeof data == "object" && !Array.isArray(data)) {
3389
- if (data.sequence === void 0 && ("sequence")) {
3390
- const err5 = {};
4404
+ if (data.git !== void 0) {
4405
+ const err7 = { instancePath: instancePath + "/git", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
3391
4406
  if (vErrors === null) {
3392
- vErrors = [err5];
4407
+ vErrors = [err7];
3393
4408
  } else {
3394
- vErrors.push(err5);
4409
+ vErrors.push(err7);
3395
4410
  }
3396
4411
  errors++;
3397
4412
  }
3398
4413
  }
3399
- var valid3 = _errs9 === errors;
3400
- if (valid3) {
3401
- const err6 = { instancePath, schemaPath: "#/else/not", keyword: "not", params: {}, message: "must NOT be valid" };
3402
- if (vErrors === null) {
3403
- vErrors = [err6];
3404
- } else {
3405
- vErrors.push(err6);
3406
- }
3407
- errors++;
3408
- } else {
3409
- errors = _errs8;
3410
- if (vErrors !== null) {
3411
- if (_errs8) {
3412
- vErrors.length = _errs8;
3413
- } else {
3414
- vErrors = null;
3415
- }
3416
- }
3417
- }
3418
- const _errs10 = errors;
3419
- let valid4 = true;
3420
- const _errs11 = errors;
4414
+ var _valid0 = _errs4 === errors;
4415
+ valid0 = _valid0;
4416
+ ifClause0 = "then";
4417
+ } else {
4418
+ const _errs20 = errors;
4419
+ const _errs21 = errors;
4420
+ let valid13 = true;
4421
+ const _errs22 = errors;
3421
4422
  if (data && typeof data == "object" && !Array.isArray(data)) {
3422
4423
  if (data.kind === void 0 && ("kind")) {
3423
- const err7 = {};
4424
+ const err8 = {};
3424
4425
  if (vErrors === null) {
3425
- vErrors = [err7];
4426
+ vErrors = [err8];
3426
4427
  } else {
3427
- vErrors.push(err7);
4428
+ vErrors.push(err8);
3428
4429
  }
3429
4430
  errors++;
3430
4431
  } else {
3431
4432
  if (data.kind !== void 0) {
3432
4433
  if ("state" !== data.kind) {
3433
- const err8 = {};
4434
+ const err9 = {};
3434
4435
  if (vErrors === null) {
3435
- vErrors = [err8];
4436
+ vErrors = [err9];
3436
4437
  } else {
3437
- vErrors.push(err8);
4438
+ vErrors.push(err9);
3438
4439
  }
3439
4440
  errors++;
3440
4441
  }
3441
4442
  }
3442
4443
  }
3443
4444
  }
3444
- var _valid1 = _errs11 === errors;
3445
- errors = _errs10;
4445
+ var _valid1 = _errs22 === errors;
4446
+ errors = _errs21;
3446
4447
  if (vErrors !== null) {
3447
- if (_errs10) {
3448
- vErrors.length = _errs10;
4448
+ if (_errs21) {
4449
+ vErrors.length = _errs21;
3449
4450
  } else {
3450
4451
  vErrors = null;
3451
4452
  }
3452
4453
  }
3453
4454
  let ifClause1;
3454
4455
  if (_valid1) {
3455
- const _errs13 = errors;
4456
+ const _errs24 = errors;
3456
4457
  if (data && typeof data == "object" && !Array.isArray(data)) {
3457
4458
  if (data.boxes !== void 0) {
3458
- let data2 = data.boxes;
3459
- if (Array.isArray(data2)) {
3460
- const len0 = data2.length;
3461
- for (let i0 = 0; i0 < len0; i0++) {
3462
- let data3 = data2[i0];
3463
- if (data3 && typeof data3 == "object" && !Array.isArray(data3)) {
3464
- if (data3.id !== void 0) {
3465
- let data4 = data3.id;
3466
- const _errs17 = errors;
3467
- const _errs18 = errors;
3468
- if (!(data4 === "start" || data4 === "finish")) {
3469
- const err9 = {};
4459
+ let data10 = data.boxes;
4460
+ if (Array.isArray(data10)) {
4461
+ if (data10.length < 1) {
4462
+ const err10 = { instancePath: instancePath + "/boxes", schemaPath: "#/else/then/properties/boxes/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
4463
+ if (vErrors === null) {
4464
+ vErrors = [err10];
4465
+ } else {
4466
+ vErrors.push(err10);
4467
+ }
4468
+ errors++;
4469
+ }
4470
+ const len2 = data10.length;
4471
+ for (let i2 = 0; i2 < len2; i2++) {
4472
+ let data11 = data10[i2];
4473
+ if (data11 && typeof data11 == "object" && !Array.isArray(data11)) {
4474
+ if (data11.id !== void 0) {
4475
+ let data12 = data11.id;
4476
+ const _errs28 = errors;
4477
+ const _errs29 = errors;
4478
+ if (!(data12 === "start" || data12 === "finish")) {
4479
+ const err11 = {};
3470
4480
  if (vErrors === null) {
3471
- vErrors = [err9];
4481
+ vErrors = [err11];
3472
4482
  } else {
3473
- vErrors.push(err9);
4483
+ vErrors.push(err11);
3474
4484
  }
3475
4485
  errors++;
3476
4486
  }
3477
- var valid10 = _errs18 === errors;
3478
- if (valid10) {
3479
- const err10 = { instancePath: instancePath + "/boxes/" + i0 + "/id", schemaPath: "#/else/then/properties/boxes/items/properties/id/not", keyword: "not", params: {}, message: "must NOT be valid" };
4487
+ var valid19 = _errs29 === errors;
4488
+ if (valid19) {
4489
+ const err12 = { instancePath: instancePath + "/boxes/" + i2 + "/id", schemaPath: "#/else/then/properties/boxes/items/properties/id/not", keyword: "not", params: {}, message: "must NOT be valid" };
3480
4490
  if (vErrors === null) {
3481
- vErrors = [err10];
4491
+ vErrors = [err12];
3482
4492
  } else {
3483
- vErrors.push(err10);
4493
+ vErrors.push(err12);
3484
4494
  }
3485
4495
  errors++;
3486
4496
  } else {
3487
- errors = _errs17;
4497
+ errors = _errs28;
3488
4498
  if (vErrors !== null) {
3489
- if (_errs17) {
3490
- vErrors.length = _errs17;
4499
+ if (_errs28) {
4500
+ vErrors.length = _errs28;
3491
4501
  } else {
3492
4502
  vErrors = null;
3493
4503
  }
@@ -3498,241 +4508,449 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
3498
4508
  }
3499
4509
  }
3500
4510
  }
4511
+ if (data.steps !== void 0) {
4512
+ let data13 = data.steps;
4513
+ if (Array.isArray(data13)) {
4514
+ const len3 = data13.length;
4515
+ for (let i3 = 0; i3 < len3; i3++) {
4516
+ let data14 = data13[i3];
4517
+ if (data14 && typeof data14 == "object" && !Array.isArray(data14)) {
4518
+ if (data14.events !== void 0) {
4519
+ let data15 = data14.events;
4520
+ if (Array.isArray(data15)) {
4521
+ const len4 = data15.length;
4522
+ for (let i4 = 0; i4 < len4; i4++) {
4523
+ let data16 = data15[i4];
4524
+ if (data16 && typeof data16 == "object" && !Array.isArray(data16)) {
4525
+ if (data16.type !== void 0) {
4526
+ let data17 = data16.type;
4527
+ const _errs36 = errors;
4528
+ const _errs37 = errors;
4529
+ if (!(data17 === "commit" || data17 === "branch")) {
4530
+ const err13 = {};
4531
+ if (vErrors === null) {
4532
+ vErrors = [err13];
4533
+ } else {
4534
+ vErrors.push(err13);
4535
+ }
4536
+ errors++;
4537
+ }
4538
+ var valid27 = _errs37 === errors;
4539
+ if (valid27) {
4540
+ 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" };
4541
+ if (vErrors === null) {
4542
+ vErrors = [err14];
4543
+ } else {
4544
+ vErrors.push(err14);
4545
+ }
4546
+ errors++;
4547
+ } else {
4548
+ errors = _errs36;
4549
+ if (vErrors !== null) {
4550
+ if (_errs36) {
4551
+ vErrors.length = _errs36;
4552
+ } else {
4553
+ vErrors = null;
4554
+ }
4555
+ }
4556
+ }
4557
+ }
4558
+ }
4559
+ }
4560
+ }
4561
+ }
4562
+ }
4563
+ }
4564
+ }
4565
+ }
4566
+ if (data.git !== void 0) {
4567
+ const err15 = { instancePath: instancePath + "/git", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
4568
+ if (vErrors === null) {
4569
+ vErrors = [err15];
4570
+ } else {
4571
+ vErrors.push(err15);
4572
+ }
4573
+ errors++;
4574
+ }
3501
4575
  }
3502
- var _valid1 = _errs13 === errors;
3503
- valid4 = _valid1;
4576
+ var _valid1 = _errs24 === errors;
4577
+ valid13 = _valid1;
3504
4578
  ifClause1 = "then";
3505
4579
  } else {
3506
- const _errs19 = errors;
3507
- const _errs20 = errors;
3508
- const _errs21 = errors;
4580
+ const _errs41 = errors;
4581
+ const _errs42 = errors;
4582
+ let valid29 = true;
4583
+ const _errs43 = errors;
3509
4584
  if (data && typeof data == "object" && !Array.isArray(data)) {
3510
- if (data.state === void 0 && ("state")) {
3511
- const err11 = {};
4585
+ if (data.kind === void 0 && ("kind")) {
4586
+ const err16 = {};
3512
4587
  if (vErrors === null) {
3513
- vErrors = [err11];
4588
+ vErrors = [err16];
3514
4589
  } else {
3515
- vErrors.push(err11);
4590
+ vErrors.push(err16);
3516
4591
  }
3517
4592
  errors++;
4593
+ } else {
4594
+ if (data.kind !== void 0) {
4595
+ if ("git" !== data.kind) {
4596
+ const err17 = {};
4597
+ if (vErrors === null) {
4598
+ vErrors = [err17];
4599
+ } else {
4600
+ vErrors.push(err17);
4601
+ }
4602
+ errors++;
4603
+ }
4604
+ }
3518
4605
  }
3519
4606
  }
3520
- var valid11 = _errs21 === errors;
3521
- if (valid11) {
3522
- const err12 = { instancePath, schemaPath: "#/else/else/not", keyword: "not", params: {}, message: "must NOT be valid" };
3523
- if (vErrors === null) {
3524
- vErrors = [err12];
4607
+ var _valid2 = _errs43 === errors;
4608
+ errors = _errs42;
4609
+ if (vErrors !== null) {
4610
+ if (_errs42) {
4611
+ vErrors.length = _errs42;
3525
4612
  } else {
3526
- vErrors.push(err12);
4613
+ vErrors = null;
3527
4614
  }
3528
- errors++;
4615
+ }
4616
+ let ifClause2;
4617
+ if (_valid2) {
4618
+ const _errs45 = errors;
4619
+ if (data && typeof data == "object" && !Array.isArray(data)) {
4620
+ if (data.git === void 0) {
4621
+ const err18 = { instancePath, schemaPath: "#/else/else/then/required", keyword: "required", params: { missingProperty: "git" }, message: "must have required property 'git'" };
4622
+ if (vErrors === null) {
4623
+ vErrors = [err18];
4624
+ } else {
4625
+ vErrors.push(err18);
4626
+ }
4627
+ errors++;
4628
+ }
4629
+ if (data.state !== void 0) {
4630
+ const err19 = { instancePath: instancePath + "/state", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
4631
+ if (vErrors === null) {
4632
+ vErrors = [err19];
4633
+ } else {
4634
+ vErrors.push(err19);
4635
+ }
4636
+ errors++;
4637
+ }
4638
+ if (data.regions !== void 0) {
4639
+ const err20 = { instancePath: instancePath + "/regions", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
4640
+ if (vErrors === null) {
4641
+ vErrors = [err20];
4642
+ } else {
4643
+ vErrors.push(err20);
4644
+ }
4645
+ errors++;
4646
+ }
4647
+ }
4648
+ var _valid2 = _errs45 === errors;
4649
+ valid29 = _valid2;
4650
+ ifClause2 = "then";
3529
4651
  } else {
3530
- errors = _errs20;
3531
- if (vErrors !== null) {
3532
- if (_errs20) {
3533
- vErrors.length = _errs20;
3534
- } else {
3535
- vErrors = null;
4652
+ const _errs52 = errors;
4653
+ if (data && typeof data == "object" && !Array.isArray(data)) {
4654
+ if (data.boxes !== void 0) {
4655
+ let data22 = data.boxes;
4656
+ if (Array.isArray(data22)) {
4657
+ if (data22.length < 1) {
4658
+ 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" };
4659
+ if (vErrors === null) {
4660
+ vErrors = [err21];
4661
+ } else {
4662
+ vErrors.push(err21);
4663
+ }
4664
+ errors++;
4665
+ }
4666
+ }
4667
+ }
4668
+ if (data.steps !== void 0) {
4669
+ let data23 = data.steps;
4670
+ if (Array.isArray(data23)) {
4671
+ const len5 = data23.length;
4672
+ for (let i5 = 0; i5 < len5; i5++) {
4673
+ let data24 = data23[i5];
4674
+ if (data24 && typeof data24 == "object" && !Array.isArray(data24)) {
4675
+ if (data24.events !== void 0) {
4676
+ let data25 = data24.events;
4677
+ if (Array.isArray(data25)) {
4678
+ const len6 = data25.length;
4679
+ for (let i6 = 0; i6 < len6; i6++) {
4680
+ let data26 = data25[i6];
4681
+ if (data26 && typeof data26 == "object" && !Array.isArray(data26)) {
4682
+ if (data26.type !== void 0) {
4683
+ let data27 = data26.type;
4684
+ const _errs60 = errors;
4685
+ const _errs61 = errors;
4686
+ if (!(data27 === "commit" || data27 === "branch")) {
4687
+ const err22 = {};
4688
+ if (vErrors === null) {
4689
+ vErrors = [err22];
4690
+ } else {
4691
+ vErrors.push(err22);
4692
+ }
4693
+ errors++;
4694
+ }
4695
+ var valid42 = _errs61 === errors;
4696
+ if (valid42) {
4697
+ 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" };
4698
+ if (vErrors === null) {
4699
+ vErrors = [err23];
4700
+ } else {
4701
+ vErrors.push(err23);
4702
+ }
4703
+ errors++;
4704
+ } else {
4705
+ errors = _errs60;
4706
+ if (vErrors !== null) {
4707
+ if (_errs60) {
4708
+ vErrors.length = _errs60;
4709
+ } else {
4710
+ vErrors = null;
4711
+ }
4712
+ }
4713
+ }
4714
+ }
4715
+ }
4716
+ }
4717
+ }
4718
+ }
4719
+ }
4720
+ }
4721
+ }
4722
+ }
4723
+ if (data.state !== void 0) {
4724
+ const err24 = { instancePath: instancePath + "/state", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
4725
+ if (vErrors === null) {
4726
+ vErrors = [err24];
4727
+ } else {
4728
+ vErrors.push(err24);
4729
+ }
4730
+ errors++;
3536
4731
  }
4732
+ if (data.git !== void 0) {
4733
+ const err25 = { instancePath: instancePath + "/git", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
4734
+ if (vErrors === null) {
4735
+ vErrors = [err25];
4736
+ } else {
4737
+ vErrors.push(err25);
4738
+ }
4739
+ errors++;
4740
+ }
4741
+ }
4742
+ var _valid2 = _errs52 === errors;
4743
+ valid29 = _valid2;
4744
+ ifClause2 = "else";
4745
+ }
4746
+ if (!valid29) {
4747
+ const err26 = { instancePath, schemaPath: "#/else/else/if", keyword: "if", params: { failingKeyword: ifClause2 }, message: 'must match "' + ifClause2 + '" schema' };
4748
+ if (vErrors === null) {
4749
+ vErrors = [err26];
4750
+ } else {
4751
+ vErrors.push(err26);
3537
4752
  }
4753
+ errors++;
3538
4754
  }
3539
- var _valid1 = _errs19 === errors;
3540
- valid4 = _valid1;
4755
+ var _valid1 = _errs41 === errors;
4756
+ valid13 = _valid1;
3541
4757
  ifClause1 = "else";
3542
4758
  }
3543
- if (!valid4) {
3544
- const err13 = { instancePath, schemaPath: "#/else/if", keyword: "if", params: { failingKeyword: ifClause1 }, message: 'must match "' + ifClause1 + '" schema' };
4759
+ if (!valid13) {
4760
+ const err27 = { instancePath, schemaPath: "#/else/if", keyword: "if", params: { failingKeyword: ifClause1 }, message: 'must match "' + ifClause1 + '" schema' };
3545
4761
  if (vErrors === null) {
3546
- vErrors = [err13];
4762
+ vErrors = [err27];
3547
4763
  } else {
3548
- vErrors.push(err13);
4764
+ vErrors.push(err27);
3549
4765
  }
3550
4766
  errors++;
3551
4767
  }
3552
- var _valid0 = _errs7 === errors;
4768
+ if (data && typeof data == "object" && !Array.isArray(data)) {
4769
+ if (data.sequence !== void 0) {
4770
+ const err28 = { instancePath: instancePath + "/sequence", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
4771
+ if (vErrors === null) {
4772
+ vErrors = [err28];
4773
+ } else {
4774
+ vErrors.push(err28);
4775
+ }
4776
+ errors++;
4777
+ }
4778
+ }
4779
+ var _valid0 = _errs20 === errors;
3553
4780
  valid0 = _valid0;
3554
4781
  ifClause0 = "else";
3555
4782
  }
3556
4783
  if (!valid0) {
3557
- const err14 = { instancePath, schemaPath: "#/if", keyword: "if", params: { failingKeyword: ifClause0 }, message: 'must match "' + ifClause0 + '" schema' };
4784
+ const err29 = { instancePath, schemaPath: "#/if", keyword: "if", params: { failingKeyword: ifClause0 }, message: 'must match "' + ifClause0 + '" schema' };
3558
4785
  if (vErrors === null) {
3559
- vErrors = [err14];
4786
+ vErrors = [err29];
3560
4787
  } else {
3561
- vErrors.push(err14);
4788
+ vErrors.push(err29);
3562
4789
  }
3563
4790
  errors++;
3564
4791
  }
3565
4792
  if (data && typeof data == "object" && !Array.isArray(data)) {
3566
4793
  if (data.version === void 0) {
3567
- const err15 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "version" }, message: "must have required property 'version'" };
4794
+ const err30 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "version" }, message: "must have required property 'version'" };
3568
4795
  if (vErrors === null) {
3569
- vErrors = [err15];
4796
+ vErrors = [err30];
3570
4797
  } else {
3571
- vErrors.push(err15);
4798
+ vErrors.push(err30);
3572
4799
  }
3573
4800
  errors++;
3574
4801
  }
3575
4802
  if (data.kind === void 0) {
3576
- const err16 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "kind" }, message: "must have required property 'kind'" };
4803
+ const err31 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "kind" }, message: "must have required property 'kind'" };
3577
4804
  if (vErrors === null) {
3578
- vErrors = [err16];
4805
+ vErrors = [err31];
3579
4806
  } else {
3580
- vErrors.push(err16);
4807
+ vErrors.push(err31);
3581
4808
  }
3582
4809
  errors++;
3583
4810
  }
3584
4811
  if (data.title === void 0) {
3585
- const err17 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "title" }, message: "must have required property 'title'" };
4812
+ const err32 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "title" }, message: "must have required property 'title'" };
3586
4813
  if (vErrors === null) {
3587
- vErrors = [err17];
4814
+ vErrors = [err32];
3588
4815
  } else {
3589
- vErrors.push(err17);
4816
+ vErrors.push(err32);
3590
4817
  }
3591
4818
  errors++;
3592
4819
  }
3593
4820
  if (data.boxes === void 0) {
3594
- const err18 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "boxes" }, message: "must have required property 'boxes'" };
4821
+ const err33 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "boxes" }, message: "must have required property 'boxes'" };
3595
4822
  if (vErrors === null) {
3596
- vErrors = [err18];
4823
+ vErrors = [err33];
3597
4824
  } else {
3598
- vErrors.push(err18);
4825
+ vErrors.push(err33);
3599
4826
  }
3600
4827
  errors++;
3601
4828
  }
3602
4829
  if (data.steps === void 0) {
3603
- const err19 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "steps" }, message: "must have required property 'steps'" };
4830
+ const err34 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "steps" }, message: "must have required property 'steps'" };
3604
4831
  if (vErrors === null) {
3605
- vErrors = [err19];
4832
+ vErrors = [err34];
3606
4833
  } else {
3607
- vErrors.push(err19);
4834
+ vErrors.push(err34);
3608
4835
  }
3609
4836
  errors++;
3610
4837
  }
3611
4838
  for (const key0 in data) {
3612
4839
  if (!func2.call(schema11.properties, key0)) {
3613
- const err20 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
4840
+ const err35 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
3614
4841
  if (vErrors === null) {
3615
- vErrors = [err20];
4842
+ vErrors = [err35];
3616
4843
  } else {
3617
- vErrors.push(err20);
4844
+ vErrors.push(err35);
3618
4845
  }
3619
4846
  errors++;
3620
4847
  }
3621
4848
  }
3622
4849
  if (data.version !== void 0) {
3623
- let data5 = data.version;
3624
- if (!(typeof data5 == "number" && (!(data5 % 1) && !isNaN(data5)) && isFinite(data5))) {
3625
- const err21 = { instancePath: instancePath + "/version", schemaPath: "#/properties/version/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
4850
+ let data31 = data.version;
4851
+ if (!(typeof data31 == "number" && (!(data31 % 1) && !isNaN(data31)) && isFinite(data31))) {
4852
+ const err36 = { instancePath: instancePath + "/version", schemaPath: "#/properties/version/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
3626
4853
  if (vErrors === null) {
3627
- vErrors = [err21];
4854
+ vErrors = [err36];
3628
4855
  } else {
3629
- vErrors.push(err21);
4856
+ vErrors.push(err36);
3630
4857
  }
3631
4858
  errors++;
3632
4859
  }
3633
- if (typeof data5 == "number" && isFinite(data5)) {
3634
- if (data5 < 1 || isNaN(data5)) {
3635
- const err22 = { instancePath: instancePath + "/version", schemaPath: "#/properties/version/minimum", keyword: "minimum", params: { comparison: ">=", limit: 1 }, message: "must be >= 1" };
4860
+ if (typeof data31 == "number" && isFinite(data31)) {
4861
+ if (data31 < 1 || isNaN(data31)) {
4862
+ const err37 = { instancePath: instancePath + "/version", schemaPath: "#/properties/version/minimum", keyword: "minimum", params: { comparison: ">=", limit: 1 }, message: "must be >= 1" };
3636
4863
  if (vErrors === null) {
3637
- vErrors = [err22];
4864
+ vErrors = [err37];
3638
4865
  } else {
3639
- vErrors.push(err22);
4866
+ vErrors.push(err37);
3640
4867
  }
3641
4868
  errors++;
3642
4869
  }
3643
4870
  }
3644
4871
  }
3645
4872
  if (data.kind !== void 0) {
3646
- let data6 = data.kind;
3647
- if (!(data6 === "sequence" || data6 === "architecture" || data6 === "state")) {
3648
- 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" };
4873
+ let data32 = data.kind;
4874
+ if (!(data32 === "sequence" || data32 === "architecture" || data32 === "state" || data32 === "git")) {
4875
+ 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" };
3649
4876
  if (vErrors === null) {
3650
- vErrors = [err23];
4877
+ vErrors = [err38];
3651
4878
  } else {
3652
- vErrors.push(err23);
4879
+ vErrors.push(err38);
3653
4880
  }
3654
4881
  errors++;
3655
4882
  }
3656
4883
  }
3657
4884
  if (data.title !== void 0) {
3658
- let data7 = data.title;
3659
- if (typeof data7 === "string") {
3660
- if (func3(data7) < 1) {
3661
- const err24 = { instancePath: instancePath + "/title", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
4885
+ let data33 = data.title;
4886
+ if (typeof data33 === "string") {
4887
+ if (func3(data33) < 1) {
4888
+ const err39 = { instancePath: instancePath + "/title", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
3662
4889
  if (vErrors === null) {
3663
- vErrors = [err24];
4890
+ vErrors = [err39];
3664
4891
  } else {
3665
- vErrors.push(err24);
4892
+ vErrors.push(err39);
3666
4893
  }
3667
4894
  errors++;
3668
4895
  }
3669
4896
  } else {
3670
- const err25 = { instancePath: instancePath + "/title", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
4897
+ const err40 = { instancePath: instancePath + "/title", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
3671
4898
  if (vErrors === null) {
3672
- vErrors = [err25];
4899
+ vErrors = [err40];
3673
4900
  } else {
3674
- vErrors.push(err25);
4901
+ vErrors.push(err40);
3675
4902
  }
3676
4903
  errors++;
3677
4904
  }
3678
4905
  }
3679
4906
  if (data.view !== void 0) {
3680
- let data8 = data.view;
3681
- if (!(data8 === "fixed" || data8 === "follow")) {
3682
- 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" };
4907
+ let data34 = data.view;
4908
+ if (!(data34 === "fixed" || data34 === "follow")) {
4909
+ 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" };
3683
4910
  if (vErrors === null) {
3684
- vErrors = [err26];
4911
+ vErrors = [err41];
3685
4912
  } else {
3686
- vErrors.push(err26);
4913
+ vErrors.push(err41);
3687
4914
  }
3688
4915
  errors++;
3689
4916
  }
3690
4917
  }
3691
4918
  if (data.regions !== void 0) {
3692
- let data9 = data.regions;
3693
- if (Array.isArray(data9)) {
3694
- const len1 = data9.length;
3695
- for (let i1 = 0; i1 < len1; i1++) {
3696
- if (!validate11(data9[i1], { instancePath: instancePath + "/regions/" + i1, parentData: data9, parentDataProperty: i1, rootData })) {
4919
+ let data35 = data.regions;
4920
+ if (Array.isArray(data35)) {
4921
+ const len7 = data35.length;
4922
+ for (let i7 = 0; i7 < len7; i7++) {
4923
+ if (!validate11(data35[i7], { instancePath: instancePath + "/regions/" + i7, parentData: data35, parentDataProperty: i7, rootData })) {
3697
4924
  vErrors = vErrors === null ? validate11.errors : vErrors.concat(validate11.errors);
3698
4925
  errors = vErrors.length;
3699
4926
  }
3700
4927
  }
3701
4928
  } else {
3702
- const err27 = { instancePath: instancePath + "/regions", schemaPath: "#/properties/regions/type", keyword: "type", params: { type: "array" }, message: "must be array" };
4929
+ const err42 = { instancePath: instancePath + "/regions", schemaPath: "#/properties/regions/type", keyword: "type", params: { type: "array" }, message: "must be array" };
3703
4930
  if (vErrors === null) {
3704
- vErrors = [err27];
4931
+ vErrors = [err42];
3705
4932
  } else {
3706
- vErrors.push(err27);
4933
+ vErrors.push(err42);
3707
4934
  }
3708
4935
  errors++;
3709
4936
  }
3710
4937
  }
3711
4938
  if (data.boxes !== void 0) {
3712
- let data11 = data.boxes;
3713
- if (Array.isArray(data11)) {
3714
- if (data11.length < 1) {
3715
- const err28 = { instancePath: instancePath + "/boxes", schemaPath: "#/properties/boxes/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
3716
- if (vErrors === null) {
3717
- vErrors = [err28];
3718
- } else {
3719
- vErrors.push(err28);
3720
- }
3721
- errors++;
3722
- }
3723
- const len2 = data11.length;
3724
- for (let i2 = 0; i2 < len2; i2++) {
3725
- if (!validate13(data11[i2], { instancePath: instancePath + "/boxes/" + i2, parentData: data11, parentDataProperty: i2, rootData })) {
4939
+ let data37 = data.boxes;
4940
+ if (Array.isArray(data37)) {
4941
+ const len8 = data37.length;
4942
+ for (let i8 = 0; i8 < len8; i8++) {
4943
+ if (!validate13(data37[i8], { instancePath: instancePath + "/boxes/" + i8, parentData: data37, parentDataProperty: i8, rootData })) {
3726
4944
  vErrors = vErrors === null ? validate13.errors : vErrors.concat(validate13.errors);
3727
4945
  errors = vErrors.length;
3728
4946
  }
3729
4947
  }
3730
4948
  } else {
3731
- const err29 = { instancePath: instancePath + "/boxes", schemaPath: "#/properties/boxes/type", keyword: "type", params: { type: "array" }, message: "must be array" };
4949
+ const err43 = { instancePath: instancePath + "/boxes", schemaPath: "#/properties/boxes/type", keyword: "type", params: { type: "array" }, message: "must be array" };
3732
4950
  if (vErrors === null) {
3733
- vErrors = [err29];
4951
+ vErrors = [err43];
3734
4952
  } else {
3735
- vErrors.push(err29);
4953
+ vErrors.push(err43);
3736
4954
  }
3737
4955
  errors++;
3738
4956
  }
@@ -3744,30 +4962,30 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
3744
4962
  }
3745
4963
  }
3746
4964
  if (data.steps !== void 0) {
3747
- let data14 = data.steps;
3748
- if (Array.isArray(data14)) {
3749
- if (data14.length < 1) {
3750
- const err30 = { instancePath: instancePath + "/steps", schemaPath: "#/properties/steps/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
4965
+ let data40 = data.steps;
4966
+ if (Array.isArray(data40)) {
4967
+ if (data40.length < 1) {
4968
+ const err44 = { instancePath: instancePath + "/steps", schemaPath: "#/properties/steps/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
3751
4969
  if (vErrors === null) {
3752
- vErrors = [err30];
4970
+ vErrors = [err44];
3753
4971
  } else {
3754
- vErrors.push(err30);
4972
+ vErrors.push(err44);
3755
4973
  }
3756
4974
  errors++;
3757
4975
  }
3758
- const len3 = data14.length;
3759
- for (let i3 = 0; i3 < len3; i3++) {
3760
- if (!validate17(data14[i3], { instancePath: instancePath + "/steps/" + i3, parentData: data14, parentDataProperty: i3, rootData })) {
4976
+ const len9 = data40.length;
4977
+ for (let i9 = 0; i9 < len9; i9++) {
4978
+ if (!validate17(data40[i9], { instancePath: instancePath + "/steps/" + i9, parentData: data40, parentDataProperty: i9, rootData })) {
3761
4979
  vErrors = vErrors === null ? validate17.errors : vErrors.concat(validate17.errors);
3762
4980
  errors = vErrors.length;
3763
4981
  }
3764
4982
  }
3765
4983
  } else {
3766
- const err31 = { instancePath: instancePath + "/steps", schemaPath: "#/properties/steps/type", keyword: "type", params: { type: "array" }, message: "must be array" };
4984
+ const err45 = { instancePath: instancePath + "/steps", schemaPath: "#/properties/steps/type", keyword: "type", params: { type: "array" }, message: "must be array" };
3767
4985
  if (vErrors === null) {
3768
- vErrors = [err31];
4986
+ vErrors = [err45];
3769
4987
  } else {
3770
- vErrors.push(err31);
4988
+ vErrors.push(err45);
3771
4989
  }
3772
4990
  errors++;
3773
4991
  }
@@ -3784,12 +5002,18 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
3784
5002
  errors = vErrors.length;
3785
5003
  }
3786
5004
  }
5005
+ if (data.git !== void 0) {
5006
+ if (!validate29(data.git, { instancePath: instancePath + "/git", parentData: data, parentDataProperty: "git", rootData })) {
5007
+ vErrors = vErrors === null ? validate29.errors : vErrors.concat(validate29.errors);
5008
+ errors = vErrors.length;
5009
+ }
5010
+ }
3787
5011
  } else {
3788
- const err32 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
5012
+ const err46 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
3789
5013
  if (vErrors === null) {
3790
- vErrors = [err32];
5014
+ vErrors = [err46];
3791
5015
  } else {
3792
- vErrors.push(err32);
5016
+ vErrors.push(err46);
3793
5017
  }
3794
5018
  errors++;
3795
5019
  }
@@ -3799,17 +5023,17 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
3799
5023
 
3800
5024
  // src/schema.ts
3801
5025
  var COLORS = ["blue", "amber", "green", "violet", "rose", "slate", "coin"];
3802
- var EVENT_TYPES = ["edge", "action", "swap", "strip"];
3803
- var ROOT_NOT_ALLOWED = {
3804
- "#/else/not": { field: "sequence", kind: "sequence" },
3805
- "#/then/not": { field: "state", kind: "state" },
3806
- "#/else/else/not": { field: "state", kind: "state" }
3807
- };
5026
+ var EVENT_TYPES = ["edge", "action", "swap", "strip", "commit", "branch"];
5027
+ var ABSENT = "#/definitions/absent/not";
5028
+ var ABSENT_KINDS = { regions: "sequence / architecture / state" };
3808
5029
  var NOT_ALLOWED = {
3809
5030
  carry: { field: "text", kind: "tag" }
3810
5031
  };
3811
5032
  var RESERVED_ID = /\/boxes\/items\/properties\/id\/not$/u;
5033
+ var GIT_EVENT = /\/events\/items\/properties\/type\/not$/u;
5034
+ var GIT_EVENTS = ["commit", "branch"];
3812
5035
  var escape = (key) => key.replaceAll("~", "~0").replaceAll("/", "~1");
5036
+ var HEX = /^\^\[0-9a-f\]\{(\d+),(\d+)\}\$$/u;
3813
5037
  function forbiddenOf(pattern) {
3814
5038
  const inside = /^\^\[\^(.+)\]\+\$$/u.exec(pattern)?.[1];
3815
5039
  if (inside === void 0) return void 0;
@@ -3833,7 +5057,10 @@ function toFieldError(error, errors, m) {
3833
5057
  }
3834
5058
  case "not": {
3835
5059
  if (RESERVED_ID.test(error.schemaPath)) return { pointer: at2, message: m.reserved(STATE_ENDS) };
3836
- const allowed = at2 === "" ? ROOT_NOT_ALLOWED[error.schemaPath] : NOT_ALLOWED[at2.slice(at2.lastIndexOf("/") + 1)];
5060
+ if (GIT_EVENT.test(error.schemaPath)) return { pointer: at2, message: m.kindOnly(GIT_EVENTS, "git") };
5061
+ const last = at2.slice(at2.lastIndexOf("/") + 1);
5062
+ if (error.schemaPath === ABSENT) return { pointer: at2, message: m.not({ field: last, kind: ABSENT_KINDS[last] ?? last }) };
5063
+ const allowed = NOT_ALLOWED[last];
3837
5064
  return { pointer: allowed ? `${at2}/${allowed.field}` : at2, message: m.not(allowed) };
3838
5065
  }
3839
5066
  case "anyOf": {
@@ -3851,8 +5078,10 @@ function toFieldError(error, errors, m) {
3851
5078
  return { pointer: at2, message: m.type(String(params.type)) };
3852
5079
  case "minLength":
3853
5080
  return { pointer: at2, message: m.minLength(Number(params.limit)) };
3854
- case "pattern":
3855
- return { pointer: at2, message: m.pattern(forbiddenOf(String(params.pattern))) };
5081
+ case "pattern": {
5082
+ const hex2 = HEX.exec(String(params.pattern));
5083
+ return { pointer: at2, message: hex2 ? m.hex(Number(hex2[1]), Number(hex2[2])) : m.pattern(forbiddenOf(String(params.pattern))) };
5084
+ }
3856
5085
  case "minItems":
3857
5086
  return { pointer: at2, message: m.minItems(Number(params.limit)) };
3858
5087
  case "minimum":
@@ -3900,7 +5129,15 @@ function plan(step) {
3900
5129
  let arrived;
3901
5130
  let changes = 0;
3902
5131
  step.events.forEach((event, e) => {
3903
- if (event.type === "edge") {
5132
+ if (event.type === "commit" || event.type === "branch") {
5133
+ const a = cursor;
5134
+ const b = a + MOTION.draw;
5135
+ out.edges.push({ event: e, a, b, carries: false, coin: false, named: false });
5136
+ cursor = a + MOTION.stagger;
5137
+ arrived = b;
5138
+ changes = 0;
5139
+ out.busy = Math.max(out.busy, b);
5140
+ } else if (event.type === "edge") {
3904
5141
  const carries = event.carry.kind !== "none";
3905
5142
  const a = cursor;
3906
5143
  const b = a + (carries ? MOTION.drawCarry : MOTION.draw);
@@ -3945,7 +5182,9 @@ function buildTimeline(diagram) {
3945
5182
  for (const edge2 of p.edges) {
3946
5183
  const a = span.start + edge2.a;
3947
5184
  edges.push({ step: s, event: edge2.event, start: a, drawn: span.start + edge2.b, end: span.end });
3948
- if (edge2.carries) departures.push({ step: s, event: edge2.event, who: edge2.coin ? "coin" : "main", a, b: span.start + edge2.b });
5185
+ const event = diagram.steps[s]?.events[edge2.event];
5186
+ const own = diagram.kind === "git" && event?.type === "edge" && event.carry.kind === "tag" && event.carry.text === event.from;
5187
+ if (edge2.carries && !own) departures.push({ step: s, event: edge2.event, who: edge2.coin ? "coin" : "main", a, b: span.start + edge2.b });
3949
5188
  if (edge2.named) named.push({ step: s, event: edge2.event, start: a + MOTION.labelDelay, end: span.end });
3950
5189
  }
3951
5190
  named.forEach((label2, k) => {
@@ -4432,6 +5671,123 @@ function strip(s, changes, ctx, now = false, arrivals = /* @__PURE__ */ new Map(
4432
5671
  return parts.join("");
4433
5672
  }
4434
5673
 
5674
+ // src/render/git.ts
5675
+ var r12 = (v) => Math.round(v * 100) / 100;
5676
+ var center = (r) => [r.x + r.w / 2, r.y + r.h / 2];
5677
+ function tagShape(text2, sh) {
5678
+ const C = LOOK.carrier;
5679
+ const ja3 = hasWide(text2);
5680
+ const w = textWidth(text2, ja3 ? TYPE.carrierJa : TYPE.carrier) + C.tagPadX * 2;
5681
+ 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>`;
5682
+ }
5683
+ function drawGit(layout, diagram, timeline, ctx) {
5684
+ const { m } = ctx;
5685
+ const G = LOOK.git;
5686
+ const timeOf = (step, event) => timeline.edges.find((t) => t.step === step && t.event === event);
5687
+ const links = layout.links.map((l) => {
5688
+ const time = timeOf(l.step, l.event);
5689
+ if (!time) return "";
5690
+ ctx.traces.push({ from: l.from, to: l.to, points: l.points, shown: [[time.start, Number.POSITIVE_INFINITY]] });
5691
+ const d = pathOf(l.points);
5692
+ 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>`;
5693
+ const kf = m.kf([
5694
+ [0, { opacity: 0, "stroke-dashoffset": 1 }],
5695
+ [time.start, { opacity: 0, "stroke-dashoffset": 1 }, EASE.inOut],
5696
+ [time.start + 0.05, { opacity: 1 }],
5697
+ [time.drawn, { "stroke-dashoffset": 0 }],
5698
+ [m.last, { opacity: 1, "stroke-dashoffset": 0 }, EASE.inOut],
5699
+ [m.total, { opacity: 0, "stroke-dashoffset": 0 }]
5700
+ ]);
5701
+ return `<g style="${cs(l.color)}"><path class="dg-git-l dg-a" pathLength="1" d="${d}" style="${kf}"/></g>`;
5702
+ }).join("");
5703
+ const commits = layout.commits.map((c) => {
5704
+ const at2 = timeOf(c.step, c.event)?.drawn ?? 0;
5705
+ const ring = { x: c.cx - c.r, y: c.cy - c.r, w: c.r * 2, h: c.r * 2 };
5706
+ ctx.ink.push({ text: c.id, rect: ring, shown: [[at2, Number.POSITIVE_INFINITY]], boxed: true });
5707
+ const lines2 = (c.text?.lines ?? []).map((line, k) => {
5708
+ const hash = k === 0 && c.hash !== void 0;
5709
+ const baseline = c.text?.baselines[k] ?? c.cy;
5710
+ return write(ctx.ink, hash ? "dg-git-h" : "dg-git-n", c.cx, baseline, line, hash ? TYPE.gitHash : TYPE.gitNote, [[at2, Number.POSITIVE_INFINITY]], "middle");
5711
+ }).join("");
5712
+ 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>`;
5713
+ const node = `<g class="dg-popc dg-a" style="${m.pop(at2)}"><circle class="dg-git-c" cx="${r12(c.cx)}" cy="${r12(c.cy)}" r="${c.r}" ${ctx.sh}/>${id}</g>`;
5714
+ const text2 = lines2 === "" ? "" : `<g class="dg-a" style="${m.vis(at2)}">${lines2}</g>`;
5715
+ const orphanAt = c.orphan === void 0 ? void 0 : timeOf(c.orphan, c.orphanEvent ?? 0)?.drawn;
5716
+ 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>`;
5717
+ return `<g data-commit="${esc(c.id)}" style="${cs(c.color)}">${node}${text2}${orphan}</g>`;
5718
+ }).join("");
5719
+ const lines = layout.moves.flatMap((mv) => {
5720
+ const time = timeOf(mv.step, mv.event);
5721
+ if (!mv.line || !time) return [];
5722
+ const end = timeline.steps[mv.step].end;
5723
+ ctx.traces.push({ from: mv.ref, to: mv.target ?? mv.ref, points: mv.line, shown: [[time.start, end + 0.4]] });
5724
+ const kf = m.kf([
5725
+ [0, { opacity: 0, "stroke-dashoffset": 1 }],
5726
+ [time.start, { opacity: 0, "stroke-dashoffset": 1 }, EASE.inOut],
5727
+ [time.start + 0.05, { opacity: 1 }],
5728
+ [time.drawn, { "stroke-dashoffset": 0 }],
5729
+ [end, { opacity: 1 }, EASE.inOut],
5730
+ [end + 0.4, { opacity: 0 }],
5731
+ [m.total, { opacity: 0, "stroke-dashoffset": 0 }]
5732
+ ]);
5733
+ return [`<g style="${cs(mv.color)}"><path class="dg-e-on dg-a" pathLength="1" d="${pathOf(mv.line)}" style="${kf}"/></g>`];
5734
+ }).join("");
5735
+ const carried = timeline.carriers.flatMap((t) => {
5736
+ const mv = layout.moves.find((x) => x.step === t.step && x.event === t.event && x.line);
5737
+ const source = diagram.steps[t.step]?.events[t.event];
5738
+ if (!mv?.line || source?.type !== "edge") return [];
5739
+ 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 };
5740
+ return [carrier(edge2, { ...t, start: t.depart, end: t.arrive + MOTION.fade }, ctx)];
5741
+ }).join("");
5742
+ const refs = [...new Set(layout.moves.map((mv) => mv.ref))];
5743
+ const tags = refs.map((ref) => tagMotion(ref, layout.moves.filter((mv) => mv.ref === ref), timeOf, ctx)).join("") + carried;
5744
+ return { links, lines, commits, tags };
5745
+ }
5746
+ function tagMotion(ref, list2, timeOf, ctx) {
5747
+ const { m } = ctx;
5748
+ const points = [];
5749
+ const fades = [[0, { opacity: 0 }]];
5750
+ let on = false;
5751
+ let rest;
5752
+ const leave = (t) => {
5753
+ if (rest) ctx.ink.push({ text: ref, rect: rest.rect, shown: [[rest.since, t]], boxed: true });
5754
+ rest = void 0;
5755
+ };
5756
+ for (const mv of list2) {
5757
+ const time = timeOf(mv.step, mv.event);
5758
+ if (!time) continue;
5759
+ const { start: a, drawn: b } = time;
5760
+ const from = mv.from ? center(mv.from) : void 0;
5761
+ const to = mv.to ? center(mv.to) : void 0;
5762
+ leave(a);
5763
+ if (mv.carried && from && to && on) {
5764
+ points.push([a + MOTION.fade, from[0], from[1]], [b - MOTION.fade, to[0], to[1]]);
5765
+ fades.push([a, { opacity: 1 }, EASE.inOut], [a + MOTION.fade, { opacity: 0 }], [b - MOTION.fade, { opacity: 0 }, EASE.out], [b, { opacity: 1 }]);
5766
+ rest = { rect: mv.to, since: b };
5767
+ continue;
5768
+ }
5769
+ if (from) points.push([a, from[0], from[1]]);
5770
+ if (to) points.push([b, to[0], to[1]]);
5771
+ if (to && !on) {
5772
+ const show = from ? a : b - MOTION.fade;
5773
+ fades.push([show, { opacity: 0 }, EASE.out], [show + MOTION.fade, { opacity: 1 }]);
5774
+ on = true;
5775
+ } else if (!to && on) {
5776
+ fades.push([b, { opacity: 1 }, EASE.inOut], [b + MOTION.untilFade, { opacity: 0 }]);
5777
+ on = false;
5778
+ }
5779
+ if (mv.to) rest = { rect: mv.to, since: b };
5780
+ }
5781
+ leave(Number.POSITIVE_INFINITY);
5782
+ if (points.length === 0) return "";
5783
+ const first = points[0];
5784
+ const last = points[points.length - 1];
5785
+ if (on) fades.push([m.last, { opacity: 1 }, EASE.inOut], [m.total, { opacity: 0 }]);
5786
+ else fades.push([m.total, { opacity: 0 }]);
5787
+ const style = m.move([[0, first[1], first[2]], ...points, [m.total, last[1], last[2]]], fades);
5788
+ return `<g class="dg-a" data-ref="${esc(ref)}" style="${style}">${tagShape(ref, ctx.sh)}</g>`;
5789
+ }
5790
+
4435
5791
  // src/render/motion.ts
4436
5792
  var r2 = (v) => Math.round(v * 100) / 100;
4437
5793
  var Motion = class {
@@ -4602,6 +5958,14 @@ var PART_CSS = [
4602
5958
  `.dg-mark{${font(TYPE.regionNote)};fill:var(--mute)}`,
4603
5959
  `.dg-done{fill:var(--ink);stroke:var(--surf);stroke-width:${S.done}}`,
4604
5960
  `.dg-done-ck{fill:none;stroke:var(--surf);stroke-width:${S.glyph};stroke-linecap:round;stroke-linejoin:round}`,
5961
+ `.dg-git-l{fill:none;stroke:var(--c);stroke-width:${S.git};stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:1 2}`,
5962
+ `.dg-git-cp{fill:none;stroke:var(--c);stroke-width:${S.gitOrphan};stroke-linecap:round;stroke-dasharray:3 3;stroke-opacity:.7}`,
5963
+ `.dg-git-c{fill:var(--surf);stroke:var(--c);stroke-width:${S.git}}`,
5964
+ `.dg-git-id{${font(TYPE.gitId)};fill:var(--ct)}`,
5965
+ `.dg-git-h{${font(TYPE.gitHash)};fill:var(--mute)}`,
5966
+ `.dg-git-n{${font(TYPE.gitNote)};fill:var(--ink2)}`,
5967
+ `.dg-git-old{fill:var(--surf);stroke:var(--c);stroke-width:${S.gitOrphan};stroke-dasharray:3 3;stroke-opacity:.6}`,
5968
+ `.dg-git-oldl{${font(TYPE.gitId)};fill:var(--ct);opacity:.55}`,
4605
5969
  ".dg-vp-bg{fill:var(--bg)}",
4606
5970
  ".dg-vp-frame{fill:none;stroke:var(--hair)}",
4607
5971
  ".dg-hd-bg{fill:var(--bg)}",
@@ -4708,6 +6072,13 @@ function drawSvg(diagram, layout, timeline, palette, theme, follow, ink = [], tr
4708
6072
  const arrivals = new Map((timeline.states ?? []).flatMap((s) => s.lit[0] ? [[s.box, s.lit[0].start]] : []));
4709
6073
  if (layout.strip) L.band.push(strip(layout.strip, fieldChanges(diagram, timeline, layout), ctx, isState, arrivals));
4710
6074
  for (const line of layout.lifelines) L.base.push(lifeline(line.x, line.y1, line.y2));
6075
+ if (isGitLayout(layout)) {
6076
+ const git = drawGit(layout, diagram, timeline, ctx);
6077
+ L.base.push(git.links);
6078
+ L.lit.push(git.lines);
6079
+ L.node.push(git.commits);
6080
+ L.top.push(git.tags);
6081
+ }
4711
6082
  for (const e of layout.edges) {
4712
6083
  const time = timeline.edges.find((t) => t.step === e.step && t.event === e.event);
4713
6084
  if (!time) continue;
@@ -4746,14 +6117,14 @@ function drawSvg(diagram, layout, timeline, palette, theme, follow, ink = [], tr
4746
6117
  const css = `.dg-${id}{${FONT_VARS};--T:${timeline.total}s;${paletteVars(palette, theme)}}${PART_CSS}${m.frames.join("")}`;
4747
6118
  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>`;
4748
6119
  }
4749
- function union(rects) {
6120
+ function union2(rects) {
4750
6121
  const x = Math.min(...rects.map((r) => r.x));
4751
6122
  const y = Math.min(...rects.map((r) => r.y));
4752
6123
  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 };
4753
6124
  }
4754
6125
  function focusOf(layout, diagram, step) {
4755
6126
  const rects = focusParts(layout, diagram, step);
4756
- return rects.length === 0 ? void 0 : union(rects);
6127
+ return rects.length === 0 ? void 0 : union2(rects);
4757
6128
  }
4758
6129
  function badgeFocus(badge2, parts, vw, vh) {
4759
6130
  const room = LOOK.badge.r + LOOK.follow.badgeRoom;
@@ -4761,7 +6132,7 @@ function badgeFocus(badge2, parts, vw, vh) {
4761
6132
  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));
4762
6133
  let held = { x: bx - room, y: by - room, w: room * 2, h: room * 2 };
4763
6134
  for (const p of [...parts].sort((a, b) => away(a) - away(b))) {
4764
- const next = union([held, p]);
6135
+ const next = union2([held, p]);
4765
6136
  if (next.w <= vw && next.h <= vh) held = next;
4766
6137
  }
4767
6138
  return held;
@@ -4859,7 +6230,7 @@ function renderDiagram(input, options = {}) {
4859
6230
  const read2 = readDiagram(input, { lang });
4860
6231
  if (!read2.ok) throw new Error(FIGURE_TEXT[lang].cannotDraw(read2.errors.map((e) => `${e.pointer} ${e.message}`).join(" / ")));
4861
6232
  const diagram = read2.diagram;
4862
- const layout = diagram.kind === "sequence" ? layoutSequence(diagram) : diagram.kind === "state" ? layoutState(diagram, lang) : layoutArchitecture(diagram);
6233
+ const layout = diagram.kind === "sequence" ? layoutSequence(diagram) : diagram.kind === "state" ? layoutState(diagram, lang) : diagram.kind === "git" ? layoutGit(diagram) : layoutArchitecture(diagram);
4863
6234
  return renderLayout(diagram, layout, buildTimeline(diagram), options);
4864
6235
  }
4865
6236
  function renderLayout(diagram, layout, timeline, options = {}) {
@@ -4896,7 +6267,7 @@ var pad = (n) => String(n).padStart(2, "0");
4896
6267
  var stepNo = (step, count) => `${pad(step + 1)}/${pad(count)}`;
4897
6268
  var require_ = createRequire(import.meta.url);
4898
6269
  var SCRIPTS = {
4899
- "/mediabunny.js": join(dirname(require_.resolve("mediabunny")), "mediabunny.min.mjs"),
6270
+ "/mediabunny.js": join$1(dirname(require_.resolve("mediabunny")), "mediabunny.min.mjs"),
4900
6271
  "/gifenc.js": require_.resolve("gifenc/dist/gifenc.esm.js")
4901
6272
  };
4902
6273
  var SCALE = 2;
@@ -5118,7 +6489,7 @@ async function fontFaces(chars) {
5118
6489
  const faces = await Promise.all(
5119
6490
  PACKAGES.flatMap(({ family, name }) => {
5120
6491
  const base = dirname(require_2.resolve(`@fontsource-variable/${name}/unicode.json`));
5121
- const table = JSON.parse(readFileSync(join(base, "unicode.json"), "utf8"));
6492
+ const table = JSON.parse(readFileSync(join$1(base, "unicode.json"), "utf8"));
5122
6493
  return Object.entries(table).map(async ([key, list2]) => {
5123
6494
  const span = ranges(list2);
5124
6495
  const own = chars.filter((char) => {
@@ -5126,7 +6497,7 @@ async function fontFaces(chars) {
5126
6497
  return span.some(([from, to]) => code >= from && code <= to);
5127
6498
  });
5128
6499
  if (!own.length) return "";
5129
- const file = join(base, "files", `${name}-${key.replace(/[[\]]/g, "")}-wght-normal.woff2`);
6500
+ const file = join$1(base, "files", `${name}-${key.replace(/[[\]]/g, "")}-wght-normal.woff2`);
5130
6501
  const woff2 = await subsetFont(await readFile(file), own.join(""), { targetFormat: "woff2", variationAxes: { wght: WEIGHT } });
5131
6502
  const unicode = own.map((char) => hex(char.codePointAt(0) ?? 0)).join(",");
5132
6503
  return `@font-face{font-family:"${family}";font-style:normal;font-display:block;font-weight:${WEIGHT.min} ${WEIGHT.max};src:url(data:font/woff2;base64,${woff2.toString("base64")}) format("woff2");unicode-range:${unicode}}`;
@@ -5218,7 +6589,7 @@ function writeOutputs(outDir, name, outputs) {
5218
6589
  const files = {};
5219
6590
  try {
5220
6591
  for (const [format, data] of outputs) {
5221
- const path2 = join(outDir, `${name}.${format}`);
6592
+ const path2 = join$1(outDir, `${name}.${format}`);
5222
6593
  writeFileSync(path2, data);
5223
6594
  files[format] = path2;
5224
6595
  }
@@ -5264,8 +6635,8 @@ var ja2 = () => {
5264
6635
  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",
5265
6636
  codeTwice: "1 \u3064\u306E\u6BB5\u306B code \u306F 1 \u884C\u307E\u3067",
5266
6637
  emptyCode: "code \u306E\u5F8C\u308D\u306B\u547D\u4EE4\u3092\u66F8\u304F",
5267
- declarationInStep: "group \u3068 box \u3068 strip \u306F\u6700\u521D\u306E step \u3088\u308A\u524D\u306B\u66F8\u304F",
5268
- stepLineBeforeStep: "\u7DDA\u3068 say \u3068 code \u3068 act \u3068 note \u3068 set \u306F step \u306E\u4E0B\u306B\u66F8\u304F",
6638
+ declarationInStep: "group \u3068 box \u3068 strip \u3068 branch \u306F\u6700\u521D\u306E step \u3088\u308A\u524D\u306B\u66F8\u304F",
6639
+ 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",
5269
6640
  nestedGroup: "group \u306E\u4E2D\u306B group \u306F\u66F8\u3051\u306A\u3044\u3002\u5148\u306B end \u3067\u9589\u3058\u308B",
5270
6641
  strayEnd: "end \u306E\u524D\u306B\u3001\u9589\u3058\u308B group \u304C\u7121\u3044",
5271
6642
  endTakesNothing: "end \u306E\u5F8C\u308D\u306B\u306F\u4F55\u3082\u66F8\u304B\u306A\u3044",
@@ -5297,7 +6668,20 @@ var ja2 = () => {
5297
6668
  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`,
5298
6669
  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",
5299
6670
  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",
5300
- 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"
6671
+ 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",
6672
+ gitOnly: (word) => `${word} \u306E\u884C\u306F git (\u679D\u5206\u304B\u308C\u306E\u56F3) \u3067\u3060\u3051\u66F8\u3051\u308B`,
6673
+ 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",
6674
+ noBranches: "branch \u306E\u884C\u3067\u679D\u3092 1 \u3064\u4EE5\u4E0A\u5BA3\u8A00\u3059\u308B",
6675
+ branchShape: "branch \u306F branch <\u540D\u672D> [note: <\u6DFB\u3048\u66F8\u304D>] \u306E\u5F62\u3067\u66F8\u304F",
6676
+ 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",
6677
+ fromShape: "\u679D\u3092\u5207\u308B\u884C\u306F <\u679D> from <commit> \u306E\u5F62\u3067\u66F8\u304F",
6678
+ undeclaredBranch: (id) => `${id} \u3068\u3044\u3046\u679D\u306F\u5BA3\u8A00\u3057\u3066\u3044\u306A\u3044`,
6679
+ 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`,
6680
+ noCommit: (id) => `${id} \u3068\u3044\u3046 commit \u306F\u307E\u3060\u7A4D\u3093\u3067\u3044\u306A\u3044`,
6681
+ 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`,
6682
+ mergeSelf: (id) => `${id} \u306F\u7A4D\u3080\u679D\u306A\u306E\u3067\u3001\u53D6\u308A\u8FBC\u3080\u679D\u306B\u3067\u304D\u306A\u3044`,
6683
+ headReserved: (name) => `${name} \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`,
6684
+ badHash: "hash \u306F 0 \u304B\u3089 9 \u3068 a \u304B\u3089 f \u306E\u5B57\u3067 4 \u304B\u3089 40 \u5B57\u306B\u3059\u308B"
5301
6685
  };
5302
6686
  };
5303
6687
  var en2 = () => {
@@ -5333,8 +6717,8 @@ var en2 = () => {
5333
6717
  sayTwice: "A step takes one say. Continue a long body on indented lines below it",
5334
6718
  codeTwice: "A step takes at most one code line",
5335
6719
  emptyCode: "Write the command after code",
5336
- declarationInStep: "Write group, box and strip before the first step",
5337
- stepLineBeforeStep: "Write lines, say, code, act, note and set under a step",
6720
+ declarationInStep: "Write group, box, strip and branch before the first step",
6721
+ stepLineBeforeStep: "Write lines, say, code, act, note, set, commit and branch cuts under a step",
5338
6722
  nestedGroup: "A group cannot hold another group. Close it with end first",
5339
6723
  strayEnd: "There is no group for this end to close",
5340
6724
  endTakesNothing: "Write nothing after end",
@@ -5366,7 +6750,20 @@ var en2 = () => {
5366
6750
  reservedId: (id) => `${id} names the start or end mark of a state diagram and cannot be a box id`,
5367
6751
  intoStart: "A line cannot go into start. start is the start mark, and lines leave it",
5368
6752
  outOfFinish: "A line cannot leave finish. finish is the end mark, and lines go into it",
5369
- pathNoAttrs: "A line before the first step is a path not taken, so it takes no attributes (carry, tag, side)"
6753
+ pathNoAttrs: "A line before the first step is a path not taken, so it takes no attributes (carry, tag, side)",
6754
+ gitOnly: (word) => `${word} lines can be written only in git diagrams`,
6755
+ gitNoGroup: "A git diagram takes no group. Declare branches with branch lines",
6756
+ noBranches: "Declare at least one branch with a branch line",
6757
+ branchShape: "Write a branch as branch <id> [note: <note>]",
6758
+ 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>",
6759
+ fromShape: "Write a branch cut as <branch> from <commit>",
6760
+ undeclaredBranch: (id) => `No branch named ${id} is declared`,
6761
+ undeclaredRef: (id) => `No branch named ${id} is declared. A line that moves a ref starts from a branch id or HEAD`,
6762
+ noCommit: (id) => `No commit named ${id} has been made yet`,
6763
+ emptyBranch: (id) => `Branch ${id} does not point at any commit yet, so it cannot be merged`,
6764
+ mergeSelf: (id) => `${id} is the branch being committed to, so it cannot be the branch merged in`,
6765
+ headReserved: (name) => `${name} names where you are in a git diagram and cannot be an id`,
6766
+ badHash: "Write a hash as 4 to 40 characters of 0-9 and a-f"
5370
6767
  };
5371
6768
  };
5372
6769
  var MESSAGES = { ja: ja2(), en: en2() };
@@ -5397,6 +6794,9 @@ var NotationError = class extends Error {
5397
6794
  var fail = (source, index, message) => new NotationError(source.line, columnOf(source, index), message);
5398
6795
  var ID = /^[^\s[\]「」=:]+$/u;
5399
6796
  var EDGE = /^([^\s:[\]]+?)\s*->\s*([^\s:[\]]+)/du;
6797
+ var COMMIT = new RegExp(`^commit\\s+([^\\s[]+)(?:\\s+${ON}\\s+([^\\s[]+))?(?:\\s+${COPY}\\s+([^\\s[]+))?(?:\\s+${MERGE}\\s+([^\\s[]+))?`, "du");
6798
+ var CUT = new RegExp(`^([^\\s[]+)\\s+${FROM}(?:\\s+([^\\s[]+))?\\s*$`, "du");
6799
+ var HASH = /^[0-9a-f]{4,40}$/u;
5400
6800
  var isOneOf = (list2, word) => list2.includes(word);
5401
6801
  function skipSpaces(text2, at2) {
5402
6802
  let i = at2;
@@ -5545,6 +6945,10 @@ function parseLines(lines, m) {
5545
6945
  if (shown && !isOneOf(VIEWS, shown.value)) throw fail(head, shown.at, m.badView);
5546
6946
  const view = shown?.value;
5547
6947
  const isState = kind === "state";
6948
+ const isGit = kind === "git";
6949
+ const branches = [];
6950
+ const commits = /* @__PURE__ */ new Set();
6951
+ const tips = /* @__PURE__ */ new Map();
5548
6952
  const regions = [];
5549
6953
  const boxes = [];
5550
6954
  const paths = [];
@@ -5561,13 +6965,27 @@ function parseLines(lines, m) {
5561
6965
  if (!boxes.some((box) => box.id === id)) throw fail(source, at2, m.undeclaredBox(id));
5562
6966
  return id;
5563
6967
  };
6968
+ const branchAt = (source, id, at2) => {
6969
+ if (!tips.has(id)) throw fail(source, at2, m.undeclaredBranch(id));
6970
+ return id;
6971
+ };
6972
+ const commitAt = (source, id, at2) => {
6973
+ if (!commits.has(id)) throw fail(source, at2, m.noCommit(id));
6974
+ return id;
6975
+ };
5564
6976
  const endAt = (source, id, at2, side2) => {
6977
+ if (isGit) {
6978
+ if (side2 === "to") return commitAt(source, id, at2);
6979
+ if (id !== HEAD && !tips.has(id)) throw fail(source, at2, m.undeclaredRef(id));
6980
+ return id;
6981
+ }
5565
6982
  if (!isState || !isOneOf(STATE_ENDS, id)) return boxAt(source, id, at2);
5566
6983
  if (id === "start" !== (side2 === "from")) throw fail(source, at2, id === "start" ? m.intoStart : m.outOfFinish);
5567
6984
  return id;
5568
6985
  };
5569
6986
  const notReserved = (source, id, at2) => {
5570
6987
  if (isState && isOneOf(STATE_ENDS, id)) throw fail(source, at2, m.reservedId(id));
6988
+ if (isGit && id === HEAD) throw fail(source, at2, m.headReserved(id));
5571
6989
  };
5572
6990
  const inStep = (source) => {
5573
6991
  if (!building) throw fail(source, 0, m.stepLineBeforeStep);
@@ -5597,7 +7015,13 @@ function parseLines(lines, m) {
5597
7015
  else inStep(source).events.push(readEdge(source, edge2));
5598
7016
  continue;
5599
7017
  }
5600
- const word = text2.split(/\s/u)[0] ?? "";
7018
+ const [word = "", second] = text2.split(/\s+/u);
7019
+ if (isGit && tips.has(word) && second === FROM) {
7020
+ const step = inStep(source);
7021
+ step.events.push(readCut(source));
7022
+ continue;
7023
+ }
7024
+ if (!isGit && (word === "branch" || word === "commit")) throw fail(source, 0, m.gitOnly(word));
5601
7025
  if (!isOneOf(HEADS, word)) {
5602
7026
  const old = oldForm(text2, building !== void 0);
5603
7027
  throw fail(source, 0, old ? m.oldForm(old.word, old.shape) : m.unknownHead(word));
@@ -5651,11 +7075,20 @@ function parseLines(lines, m) {
5651
7075
  case "set":
5652
7076
  inStep(source).events.push(readSet(source));
5653
7077
  break;
7078
+ case "branch":
7079
+ readBranch(source);
7080
+ break;
7081
+ case "commit": {
7082
+ const step = inStep(source);
7083
+ step.events.push(readCommit(source));
7084
+ break;
7085
+ }
5654
7086
  }
5655
7087
  }
5656
7088
  if (group) throw fail(group.source, 0, m.unclosedGroup(group.id));
5657
7089
  finish();
5658
- if (boxes.length === 0) throw fail(head, 0, m.noBoxes);
7090
+ if (isGit && branches.length === 0) throw fail(head, 0, m.noBranches);
7091
+ if (boxes.length === 0 && !isGit) throw fail(head, 0, m.noBoxes);
5659
7092
  if (steps.length === 0) throw fail(head, 0, m.noSteps);
5660
7093
  return {
5661
7094
  version: FORMAT_VERSION,
@@ -5667,10 +7100,12 @@ function parseLines(lines, m) {
5667
7100
  ...strip2 ? { strip: strip2 } : {},
5668
7101
  steps,
5669
7102
  ...kind === "sequence" ? { sequence: { lifelines: boxes.map((box) => box.id) } } : {},
5670
- ...paths.length > 0 ? { state: { paths } } : {}
7103
+ ...paths.length > 0 ? { state: { paths } } : {},
7104
+ ...isGit ? { git: { branches } } : {}
5671
7105
  };
5672
7106
  function readGroup(source) {
5673
7107
  beforeSteps(source);
7108
+ if (isGit) throw fail(source, 0, m.gitNoGroup);
5674
7109
  if (group) throw fail(source, 0, m.nestedGroup);
5675
7110
  const declared = readDeclared(source, "group", ATTRS.group, m);
5676
7111
  if (regions.some((region) => region.id === declared.id)) {
@@ -5696,6 +7131,62 @@ function parseLines(lines, m) {
5696
7131
  ...group ? { region: group.id } : {}
5697
7132
  });
5698
7133
  }
7134
+ function readBranch(source) {
7135
+ beforeSteps(source);
7136
+ const declared = readDeclared(source, "branch", ATTRS.branch, m);
7137
+ if (declared.name !== void 0) throw fail(source, 0, m.branchShape);
7138
+ notReserved(source, declared.id, declared.idAt);
7139
+ declare(source, declared.id, declared.idAt);
7140
+ const note = declared.attrs.get("note")?.value;
7141
+ branches.push({ id: declared.id, ...note !== void 0 ? { note } : {} });
7142
+ tips.set(declared.id, null);
7143
+ }
7144
+ function readCommit(source) {
7145
+ const text2 = source.text;
7146
+ const found = COMMIT.exec(text2);
7147
+ const at2 = (k) => found?.indices?.[k]?.[0] ?? 0;
7148
+ const id = found?.[1];
7149
+ const on = found?.[2];
7150
+ if (!found || id === void 0 || on === void 0) throw fail(source, 0, m.commitShape);
7151
+ const rest2 = skipSpaces(text2, found[0].length);
7152
+ if (rest2 < text2.length && text2[rest2] !== "[") throw fail(source, rest2, m.commitShape);
7153
+ if (!ID.test(id)) throw fail(source, at2(1), m.badId(id));
7154
+ notReserved(source, id, at2(1));
7155
+ declare(source, id, at2(1));
7156
+ const branch = branchAt(source, on, at2(2));
7157
+ const copy = found[3] === void 0 ? void 0 : commitAt(source, found[3], at2(3));
7158
+ const merge = found[4] === void 0 ? void 0 : mergedAt(source, found[4], at2(4), branch);
7159
+ const attrs = rest2 < text2.length ? readAttrs(source, rest2, ATTRS.commit, m) : /* @__PURE__ */ new Map();
7160
+ const hash = attrs.get("hash");
7161
+ if (hash && !HASH.test(hash.value)) throw fail(source, hash.at, m.badHash);
7162
+ const note = attrs.get("note")?.value;
7163
+ commits.add(id);
7164
+ if (copy === void 0) tips.set(branch, id);
7165
+ return {
7166
+ type: "commit",
7167
+ id,
7168
+ branch,
7169
+ ...copy !== void 0 ? { copy } : {},
7170
+ ...merge !== void 0 ? { merge } : {},
7171
+ ...hash ? { hash: hash.value } : {},
7172
+ ...note !== void 0 ? { note } : {}
7173
+ };
7174
+ }
7175
+ function mergedAt(source, id, at2, into) {
7176
+ branchAt(source, id, at2);
7177
+ if (id === into) throw fail(source, at2, m.mergeSelf(id));
7178
+ if (tips.get(id) === null) throw fail(source, at2, m.emptyBranch(id));
7179
+ return id;
7180
+ }
7181
+ function readCut(source) {
7182
+ const found = CUT.exec(source.text);
7183
+ const branch = found?.[1];
7184
+ const from = found?.[2];
7185
+ if (!found || branch === void 0 || from === void 0) throw fail(source, 0, m.fromShape);
7186
+ commitAt(source, from, found.indices?.[2]?.[0] ?? 0);
7187
+ tips.set(branch, from);
7188
+ return { type: "branch", branch, from };
7189
+ }
5699
7190
  function readStrip(source) {
5700
7191
  beforeSteps(source);
5701
7192
  if (strip2) throw fail(source, 0, m.stripTwice);
@@ -5769,9 +7260,10 @@ function parseLines(lines, m) {
5769
7260
  if (carried && !isOneOf(CARRIES, carried.value)) throw fail(source, carried.at, m.badCarry);
5770
7261
  const side2 = attrs.get("side");
5771
7262
  if (side2 && !isOneOf(SIDES, side2.value)) throw fail(source, side2.at, m.badSide);
5772
- let carry = { kind: "envelope" };
7263
+ let carry = isGit ? { kind: "tag", text: from } : { kind: "envelope" };
5773
7264
  if (tag) carry = { kind: "tag", text: tag.value };
5774
7265
  else if (carried) carry = carried.value === "coin" ? { kind: "coin" } : { kind: "none" };
7266
+ if (isGit && from !== HEAD) tips.set(from, to);
5775
7267
  return {
5776
7268
  type: "edge",
5777
7269
  from,