@cardenelabs/dragon 0.41.1 → 0.42.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +74 -1
  2. package/dist/cli.cjs +4094 -961
  3. package/dist/cli.cjs.map +1 -1
  4. package/dist/cli.js +4094 -961
  5. package/dist/cli.js.map +1 -1
  6. package/dist/export.cjs +3681 -939
  7. package/dist/export.cjs.map +1 -1
  8. package/dist/export.d.cts +1 -1
  9. package/dist/export.d.ts +1 -1
  10. package/dist/export.js +3681 -939
  11. package/dist/export.js.map +1 -1
  12. package/dist/index.cjs +4016 -815
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +159 -3
  15. package/dist/index.d.ts +159 -3
  16. package/dist/index.js +4016 -815
  17. package/dist/index.js.map +1 -1
  18. package/dist/{ink-B_7OXxtb.d.cts → ink-B8EZL7JV.d.cts} +95 -3
  19. package/dist/{ink-B_7OXxtb.d.ts → ink-B8EZL7JV.d.ts} +95 -3
  20. package/dist/node.cjs +2461 -726
  21. package/dist/node.cjs.map +1 -1
  22. package/dist/node.js +2461 -726
  23. package/dist/node.js.map +1 -1
  24. package/dist/player.global.js +2 -2
  25. package/package.json +1 -1
  26. package/src/field-messages.ts +12 -0
  27. package/src/figure-text.ts +26 -0
  28. package/src/index.ts +11 -1
  29. package/src/layout/scene.ts +23 -2
  30. package/src/layout/time.ts +680 -0
  31. package/src/look/values.ts +142 -2
  32. package/src/messages.ts +108 -5
  33. package/src/parser.ts +427 -6
  34. package/src/player.ts +48 -10
  35. package/src/printer.ts +63 -12
  36. package/src/render/icons.ts +2 -0
  37. package/src/render/parts.ts +29 -9
  38. package/src/render/svg.ts +129 -21
  39. package/src/render/time.ts +291 -0
  40. package/src/schema.ts +109 -10
  41. package/src/schemas/diagram.schema.json +224 -12
  42. package/src/schemas/validate-diagram.js +1 -1
  43. package/src/timeline.ts +147 -10
  44. package/src/words.ts +39 -6
@@ -1,2 +1,2 @@
1
- "use strict";var DragonPlayer=(()=>{var en=Object.defineProperty;var xs=Object.getOwnPropertyDescriptor;var ws=Object.getOwnPropertyNames;var vs=Object.prototype.hasOwnProperty;var $s=(e,n)=>{for(var a in n)en(e,a,{get:n[a],enumerable:!0})},ks=(e,n,a,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of ws(n))!vs.call(e,i)&&i!==a&&en(e,i,{get:()=>n[i],enumerable:!(o=xs(n,i))||o.enumerable});return e};var Ps=e=>ks(en({},"__esModule",{value:!0}),e);var Br={};$s(Br,{mountDiagram:()=>ys});var tn=e=>/[0-9A-Za-z]$/u.test(e)?`${e} `:e,Ss=e=>e.charAt(0).toUpperCase()+e.slice(1),ot={ja:{cannotDraw:e=>`\u56F3\u3092\u63CF\u3051\u306A\u3044: ${e}`,overview:"\u5168\u4F53\u56F3",prev:"\u524D\u306E\u6BB5",pause:"\u6B62\u3081\u308B",play:"\u52D5\u304B\u3059",next:"\u6B21\u306E\u6BB5",steps:e=>`${e} \u306E\u6BB5`,side:"\u8107\u9053",sideNote:"\u4ECA\u56DE\u306F\u901A\u3089\u306A\u3044",sideFrom:e=>`${e} \u3064\u306E\u72B6\u614B\u304B\u3089\u5165\u308C\u308B`,trail:"\u901A\u3063\u305F\u72B6\u614B",start:"\u59CB\u307E\u308A",end:"\u7D42\u308F\u308A",badgeName:e=>`\u6BB5\u306E\u756A\u53F7 ${e}`,quoted:e=>`\u300C${e}\u300D`,iconOf:e=>`\u300C${e} \u306E\u7D75\u67C4\u300D`,coin:"\u300C\u786C\u8CA8\u300D",envelope:"\u300C\u5C01\u7B52\u300D",textsOverlap:(e,n)=>`${tn(e)}\u3068${tn(n)}\u304C\u91CD\u306A\u308B`,lineCrosses:(e,n,a)=>`\u7DDA ${e} \u2192 ${n} \u304C${tn(a)}\u3092\u6A2A\u5207\u308B`},en:{cannotDraw:e=>`Cannot draw the diagram: ${e}`,overview:"Overview",prev:"Previous step",pause:"Pause",play:"Play",next:"Next step",steps:e=>`Steps of ${e}`,side:"Side path",sideNote:"Not taken this time",sideFrom:e=>`Enterable from ${e} ${e===1?"state":"states"}`,trail:"States passed",start:"Start",end:"End",badgeName:e=>`step number ${e}`,quoted:e=>`"${e}"`,iconOf:e=>`the icon of "${e}"`,coin:"the coin",envelope:"the envelope",textsOverlap:(e,n)=>Ss(`${e} and ${n} overlap`),lineCrosses:(e,n,a)=>`The line ${e} \u2192 ${n} crosses ${a}`}};var bn={clear:{name:"\u6F84\u3093\u3060\u8272",note:"\u767D\u3044\u5730\u306B\u3001\u4E2D\u304F\u3089\u3044\u306E\u660E\u308B\u3055\u306E\u9BAE\u3084\u304B\u306A 6 \u8272\u3002\u4ECA\u306E\u898B\u672C\u5E33\u306E\u8272",light:{page:"#f3f4f7",bg:"#ffffff",surf:"#ffffff",sunk:"#f5f6f8",ink:"#12141a",ink2:"#3f4451",mute:"#6b7180",hair:"#12141a1c",line:"#12141a40",sh:"#101828","on-c":"#ffffff","c-blue":"#467deb","t-blue":"#2e62ce","c-amber":"#d28008","t-amber":"#975b04","c-green":"#0ea886","t-green":"#07775e","c-violet":"#6c3bb2","t-violet":"#6c3bb2","c-rose":"#ba3e40","t-rose":"#b83c3f","c-slate":"#5d6677","t-slate":"#5d6677",coin:"#e9b114",coint:"#856300",coinin:"#a8740c",tint:"5%",edge:"20%",shA:".05",shB:".08",carry:"#65686f"},dark:{page:"#08090c",bg:"#0d0e12",surf:"#17191f",sunk:"#121419",ink:"#eceef3",ink2:"#c4c8d2",mute:"#9198a6",hair:"#eceef31f",line:"#eceef340",sh:"#000000","on-c":"#0d0e12","c-blue":"#7e7ef6","t-blue":"#989cfd","c-amber":"#c78135","t-amber":"#dd954b","c-green":"#20ac7a","t-green":"#35b986","c-violet":"#695b9f","t-violet":"#a79ae3","c-rose":"#bc434b","t-rose":"#fd7d81","c-slate":"#9ba3b2","t-slate":"#9da5b4",coin:"#f0c040",coint:"#f0c040",coinin:"#9a6a0c",tint:"6%",edge:"19%",shA:".45",shB:".35"}},paper:{name:"\u7D19\u3068\u58A8",note:"\u751F\u6210\u308A\u306E\u7D19\u306E\u5730\u306B\u3001\u85CD / \u9EC4\u571F / \u82D4 / \u8461\u8404 / \u6731 / \u920D\u306E\u304F\u3059\u3093\u3060 6 \u8272",light:{page:"#ece7dd",bg:"#f9f6f0",surf:"#fffcf6",sunk:"#f2ede4",ink:"#221e18",ink2:"#4b453b",mute:"#7b7366",hair:"#221e181f",line:"#221e1847",sh:"#3a2a10","on-c":"#fffcf6","c-blue":"#487dd5","t-blue":"#2d60b5","c-amber":"#c38405","t-amber":"#885a01","c-green":"#57a271","t-green":"#237143","c-violet":"#904698","t-violet":"#904698","c-rose":"#a9513e","t-rose":"#9f4836","c-slate":"#6a645a","t-slate":"#696359",coin:"#d4a52a",coint:"#7d5e05",coinin:"#9a7016",tint:"6%",edge:"22%",shA:".06",shB:".07",carry:"#68635c"},dark:{page:"#0e0d0b",bg:"#15130f",surf:"#1e1b17",sunk:"#191612",ink:"#ede6d8",ink2:"#cbc2b1",mute:"#9c9283",hair:"#ede6d81f",line:"#ede6d842",sh:"#000000","on-c":"#15130f","c-blue":"#5785d5","t-blue":"#76a6f9","c-amber":"#be8802","t-amber":"#d59e2f","c-green":"#52aa71","t-green":"#61b87e","c-violet":"#90529b","t-violet":"#d08edb","c-rose":"#bb4e3d","t-rose":"#f98672","c-slate":"#a9a295","t-slate":"#aca598",coin:"#dcb24e",coint:"#dcb24e",coinin:"#8a6a14",tint:"6%",edge:"19%",shA:".45",shB:".35"}},night:{name:"\u591C\u306E\u8A08\u5668",note:"\u9752\u307F\u306E\u9ED2\u306E\u5730\u306B\u3001\u5149\u308B\u6C34\u8272 / \u7425\u73C0 / \u82E5\u7DD1 / \u83EB / \u6843 \u306E 6 \u8272\u3002\u660E\u308B\u3044\u5074\u306F\u9752\u7070\u306E\u5730",light:{page:"#e9eef5",bg:"#f6f9fc",surf:"#ffffff",sunk:"#eef3f8",ink:"#0b1424",ink2:"#34425a",mute:"#64748b",hair:"#0b14241c",line:"#0b142440",sh:"#0b1424","on-c":"#ffffff","c-blue":"#0385cd","t-blue":"#086aa3","c-amber":"#ba8e0f","t-amber":"#7f5f04","c-green":"#0a8857","t-green":"#027449","c-violet":"#5839ba","t-violet":"#5839ba","c-rose":"#dd4a94","t-rose":"#b82375","c-slate":"#64748b","t-slate":"#56667c",coin:"#eab308",coint:"#7e6005",coinin:"#a16207",tint:"5%",edge:"22%",shA:".06",shB:".09",carry:"#596579"},dark:{page:"#060a12",bg:"#0a101c",surf:"#111a2a",sunk:"#0d1522",ink:"#e6edf7",ink2:"#b8c4d6",mute:"#8090a8",hair:"#e6edf71c",line:"#9fb3d145",sh:"#000000","on-c":"#0a101c","c-blue":"#3884b6","t-blue":"#62ace1","c-amber":"#be8533","t-amber":"#d59b4b","c-green":"#3ba774","t-green":"#4fb884","c-violet":"#7d4ecd","t-violet":"#b494fd","c-rose":"#bc3a74","t-rose":"#ff77ad","c-slate":"#96a3b5","t-slate":"#99a6b8",coin:"#facc15",coint:"#facc15",coinin:"#a16207",tint:"6%",edge:"19%",shA:".5",shB:".4"}}};var yt={sans:"Noto Sans JP Variable",mono:"JetBrains Mono Variable"},Os={0:590,1:590,2:590,3:590,4:590,5:590,6:590,7:590,8:590,9:590," ":228,"!":371,'"':575,"#":590,$:590,"%":963,"&":740,"'":325,"(":378,")":378,"*":507,"+":590,",":325,"-":371,".":325,"/":390,":":325,";":325,"<":590,"=":590,">":590,"?":514,"@":1007,A:642,B:682,C:657,D:715,E:616,F:586,G:718,H:758,I:330,J:568,K:686,L:579,M:854,N:750,O:771,P:668,Q:771,R:682,S:624,T:626,U:748,V:619,W:915,X:627,Y:581,Z:614,"[":378,"\\":390,"]":378,"^":590,_:568,"`":626,a:591,b:644,c:528,d:645,e:581,f:372,g:598,h:640,i:305,j:306,k:605,l:315,m:964,n:641,o:626,p:645,q:645,r:437,s:495,t:421,u:638,v:576,w:863,x:562,y:575,z:512,"{":378,"|":297,"}":378,"~":590,"\u2026":1e3,"\u2212":590,"\xD7":1e3,"\u2192":1e3,"\u2190":1e3,"\u2191":1e3,"\u2193":1e3,"\u2013":545,"\u2014":908,"\u2018":325,"\u2019":325,"\u201C":575,"\u201D":575,"\xB0":404,"\xB1":1e3,"\xB7":593,"\u2022":379},Es=600,Ts=11904,Pt=1e3;function xn(e,n){return(e.codePointAt(0)??0)>=Ts?Pt:n==="mono"?Es:Os[e]??Pt}var Ls="paper",nn=Object.fromEntries(Object.entries(bn).map(([e,n])=>[e,{id:e,...n}]));function St(e){return(e!==void 0&&Object.hasOwn(nn,e)?nn[e]:void 0)??nn[Ls]}function Mt(e,n){return Object.entries(e[n]).map(([a,o])=>`--${a}:${o}`).join(";")}var Ot=`--sans:"${yt.sans}";--mono:"${yt.mono}"`,bt=["blue","amber","green","violet","rose"],ge=(e,n,a="sans")=>({size:e,weight:n,family:a}),E={boxName:ge(13,650),boxSub:ge(11,500),boxSubStrong:ge(11,700),regionName:ge(12.5,700),regionNote:ge(11,500),label:ge(11,600,"mono"),labelJa:ge(11,650),action:ge(11,650),badge:ge(10.5,700,"mono"),carrier:ge(10.5,700,"mono"),carrierJa:ge(10.5,700),stripTitle:ge(12.5,700),fieldName:ge(10.5,600),fieldValue:ge(12,600,"mono"),fieldValueJa:ge(12,600),tag:ge(10.5,700),miniTitle:ge(10.5,700),stepTitle:ge(15,700),stepBody:ge(13.5,500),stepNo:ge(13,700,"mono"),button:ge(14,700),gitId:ge(11,700),gitHash:ge(10.5,600,"mono"),gitNote:ge(10.5,650)},g={gap:10,margin:14,box:{h:72,minW:92,padX:12,radius:12,icon:24,iconRadius:7,iconY:-16,iconScale:.74,nameY:12,subY:27},region:{pad:18,gap:10,radius:14,inset:14,icon:24,iconRadius:7,iconScale:.68,nameY:58,line:16,minH:108},architecture:{columns:4,columnGap:56,maxColumnGap:160,rowGap:44,labelRoom:16},sequence:{columnGap:40,labelRoom:16,labelOffset:16,firstRow:10,rowGap:6,stepGap:6,minPitch:32,tail:10,selfW:34,selfH:18},state:{columns:4,columnGap:64,rowGap:108,labelRoom:16,start:7,end:{r:9,inner:5},drop:56,below:64,beside:38,text:16,loop:{w:24,h:34,samples:12,badgeAt:.6},side:{pad:16,gap:76,lane:30,entry:28},ghost:{h:52,pad:12,gap:10,nameY:-2,subY:14},done:{r:6.5,inset:13},pastLabel:.85},git:{x0:120,pitch:90,textGap:12,r:12,orphan:13.5,topLine:120,line:90,topBelow:30,below:82,bare:62,above:18,under:27,lineStep:13,tagTop:58,tag:30,row:22,turn:60,samples:12,boxGap:24,labelUnder:50,colors:["blue","violet","green","amber","rose"]},edge:{inset:3,arrow:6,arrowHalf:3.5,parallel:5,ghostDash:5,flowDash:9,bend:12},label:{h:20,padX:9,radius:10,offset:22,side:14,search:4,searchMax:400,soft:6,touch:2},action:{h:22,padX:10,radius:11},badge:{r:9.5,ring:9,inset:4,along:14,short:44},carrier:{envW:24,envH:17,coinR:6.5,coinIn:3.8,tagH:18,tagPadX:8,samples:16},slot:{gap:6,pad:3,spread:4,h:24,radius:7,clear:2,lifeline:5,mark:4},mark:{pad:3,radius:5,dash:4,gap:3},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}},stroke:{git:2.25,gitOrphan:1.5,mark:1.6,slot:1.2,hair:1,edge:1.7,edgeOn:2.25,arrow:1.5,flow:1.3,halo:7,on:1.75,glyph:2,lifeline:1.2,envelope:1.5,badgeRing:1.5,path:1.6,end:1.6,done:1.2,trail:1.2},shadow:{near:.8,far:4,nearY:1,farY:3},mini:{w:168,pad:8,title:14,inset:12,radius:10},follow:{aspect:.75,minH:320,fitMinH:160,ease:.6,narrow:440,badgeRoom:8,headRoom:10,head:{pad:8,h:40,nameY:17,subY:31}},mix:{slot:45,icon:14,regionIcon:16,regionIconEdge:34,cap:12,capEdge:42,badgePast:14,badgePastEdge:70,mini:62,miniBand:16,miniBandEdge:36,view:6,side:4,sideEdge:36,ghostEdge:60,path:55,past:72},baseline:{label:3.8,badge:3.5,carrier:3.7,stripTitle:4.5,tag:3.6,action:3.8,mark:4},rise:5,popFrom:.4,player:{gap:10,radius:12,button:36,touch:44,hidden:1,focus:2,narrow:440}},ee={intro:1.4,outro:4.6,tail:.6,stepBase:1.2,perChar:.025,stepMin:2.2,stepMax:5,dwell:1.2,edgeAt:.1,stagger:.5,draw:.55,drawCarry:.9,action:.9,change:.12,minShow:.8,labelDelay:.15,fade:.3,popFade:.4,untilFade:.2,still:.45,done:.3},wn=10.5,de={inOut:"cubic-bezier(.65,0,.35,1)",out:"cubic-bezier(.22,1,.36,1)",pop:"cubic-bezier(.34,1.56,.64,1)"};var Re=e=>[...e].some(n=>(n.codePointAt(0)??0)>=11904);function Ns(e,n){return n==="mono"&&Re(e)?"sans":n}function se(e,n){let a=Ns(e,n.family),o=0;for(let i of e)o+=xn(i,a);return o*n.size/Pt}function ze(e,n,a,o,i="start"){let t=se(e,o);return{x:i==="middle"?n-t/2:n,y:a-o.size*.8,w:t,h:o.size}}function ct(e){return e.steps.flatMap((n,a)=>n.events.flatMap((o,i)=>o.type==="edge"?[{step:a,event:i,edge:o}]:[]))}function Ue(e){let n=rn(e),a=new Map;return e.boxes.forEach((o,i)=>{let t=o.region===void 0?void 0:n.get(o.region);a.set(o.id,o.color??t??bt[i%bt.length])}),a}function rn(e){let n=new Map;return(e.regions??[]).forEach((a,o)=>n.set(a.id,a.color??bt[o%bt.length])),n}var lt=(e,n)=>e.carry.kind==="coin"?"coin":n.get(e.from)??"slate";function Je(e,n,a){let o=e.boxes.find(t=>t.id===n);if(!o)return g.box.minW;let i=[se(o.name,E.boxName),se(o.sub??"",E.boxSub)];for(let t of e.steps)for(let s of t.events)s.type==="swap"&&s.box===n&&i.push(se(s.text,E.boxSubStrong)),a&&s.type==="action"&&s.box===n&&i.push(se(s.label,E.boxSubStrong));return Math.max(g.box.minW,Math.max(...i)+g.box.padX*2)}function Ze(e){let n=g.carrier;return e.kind==="tag"?[(se(e.text,Re(e.text)?E.carrierJa:E.carrier)+n.tagPadX*2)/2,n.tagH/2]:e.kind==="coin"?[n.coinR,n.coinR]:[n.envW/2,n.envH/2]}var vn=e=>e.main+e.coin+(e.main>0&&e.coin>0?g.slot.spread:0);function Et(e){let n=new Map,a=new Set(e.boxes.map(o=>o.id));for(let o of e.steps)for(let i of o.events){if(i.type!=="edge"||i.carry.kind==="none")continue;let t=i.carry.kind==="coin"?"coin":"main",s=Ze(i.carry)[0]*2;for(let r of[i.from,i.to]){if(!a.has(r))continue;let c=n.get(r)??{main:0,coin:0};c[t]=Math.max(c[t],s),n.set(r,c)}}return n}function Tt(e,n,a){return e?(n?g.box.icon+g.slot.gap:0)+vn(e)+g.slot.pad*2+g.box.padX+a:0}function Lt(e,n,a=g.box.padX){if(!n)return;let o=g.box,i=g.slot,t=vn(n)+i.pad*2,s=e.icon?o.icon+i.gap:0,r=Math.max(e.x+o.padX,Math.min(e.cx-(s+t)/2,e.x+e.w-a-(s+t)));e.icon&&(e.iconX=r+o.icon/2),e.slot={x:r+s,y:e.cy+o.iconY-i.h/2,w:t,h:i.h}}function Nt(e,n,a){let o=g.slot,i=(t,s)=>{let r=n.get(t),c=a.get(t);if(!r?.slot||!c)return;let l=r.slot.x+o.pad,p=r.slot.y+r.slot.h/2;return c.main>0&&c.coin>0?s.kind==="coin"?[l+c.main+o.spread+c.coin/2,p]:[l+c.main/2,p]:[r.slot.x+r.slot.w/2,p]};for(let t of e){if(t.carry.kind==="none")continue;let s=i(t.to,t.carry),r=i(t.from,t.carry);s&&(t.settle=s),r&&(t.wait=r)}}function at(e,n){let a=Math.max(n.x-(e.x+e.w),e.x-(n.x+n.w)),o=Math.max(n.y-(e.y+e.h),e.y-(n.y+n.h));return Math.max(a,o)}function qt(e,n,a=0){let o=n.x+a,i=n.y+a,t=n.x+n.w-a,s=n.y+n.h-a;if(t<=o||s<=i)return!1;for(let r=1;r<e.length;r++){let[c,l]=e[r-1],[p,v]=e[r],w=p-c,d=v-l,b=0,T=1,x=($,m)=>{if($===0)return m>0;let y=m/$;return $<0?b=Math.max(b,y):T=Math.min(T,y),b<T};if(x(-w,c-o)&&x(w,t-c)&&x(-d,l-i)&&x(d,s-l))return!0}return!1}function qs(e){let n={a:e[0],b:e[1]??e[0],length:-1};for(let a=1;a<e.length;a++){let o=e[a-1],i=e[a],t=Math.hypot(i[0]-o[0],i[1]-o[1]);t>n.length&&(n={a:o,b:i,length:t})}return{a:n.a,b:n.b,vertical:Math.abs(n.b[0]-n.a[0])<Math.abs(n.b[1]-n.a[1])}}function He(e,n){let a=n;for(let o=1;o<e.length;o++){let i=e[o-1],t=e[o],s=Math.hypot(t[0]-i[0],t[1]-i[1]);if(a<=s&&s>0)return[i[0]+(t[0]-i[0])*a/s,i[1]+(t[1]-i[1])*a/s];a-=s}return e[e.length-1]}function pt(e){let n=0;for(let a=1;a<e.length;a++){let o=e[a-1],i=e[a];n+=Math.hypot(i[0]-o[0],i[1]-o[1])}return n}function At(e){let{w:n,h:a,samples:o}=g.state.loop,i=e.y+e.h,t=[e.cx+n/2,i],s=[e.cx+n*3/4,i+a*4/3],r=[e.cx-n*3/4,i+a*4/3],c=[e.cx-n/2,i+g.edge.inset];return Array.from({length:o+1},(l,p)=>{let v=p/o,w=1-v,d=b=>w*w*w*t[b]+3*w*w*v*s[b]+3*w*v*v*r[b]+v*v*v*c[b];return[d(0),d(1)]})}function Rt(e){let n=Math.max(...e.map(([i])=>i)),a=e[0][1],o=Math.max(...e.map(([,i])=>i));return[n+g.badge.r+g.badge.inset,a+(o-a)*g.state.loop.badgeAt]}function jt(e,n){return{x:(e[0]?.[0]??0)-g.state.loop.w/2-n/2,y:Math.max(...e.map(([,a])=>a))+g.label.soft}}var on=g.state.loop.h+g.label.soft*2+g.label.h;function it(e,n=[],a=[]){let o=pt(e),i=o<g.badge.short?Math.min(g.badge.r+1,o/2):g.badge.along,t=g.badge.r*2+g.badge.inset;for(let s=i;s<=o;s+=1){let r=He(e,s);if(n.every(([c,l])=>Math.hypot(r[0]-c,r[1]-l)>=t))return r}return As(e,i,n,a)??He(e,i)}function As(e,n,a,o){let i=pt(e),[t,s]=He(e,n),[r,c]=He(e,Math.max(0,n-1)),[l,p]=He(e,Math.min(i,n+1)),v=Math.hypot(l-r,p-c);if(v===0)return;let[w,d]=[-(p-c)/v,(l-r)/v],b=g.badge.r*2;for(let T of[g.edge.arrowHalf,0])for(let x=1;x<=b+g.badge.inset;x++)for(let $ of[1,-1]){let m=[t+w*x*$,s+d*x*$];if(a.every(([O,_])=>Math.max(Math.abs(m[0]-O),Math.abs(m[1]-_))>=b+1)&&o.every(O=>!qt(O,_e(m),-T)))return m}}var xt=e=>e.points.map(([n,a])=>`${Math.round(n*10)},${Math.round(a*10)}`).join(" ");function Ye(e,n,a=(o,i,t)=>it(o.points,i,t)){let o=new Map,i=[],t=new Map;for(let s=0;s<n;s++){let r=e.find(w=>w.step===s&&w.points.length>0);if(!r)continue;let c=xt(r),l=t.get(c);if(l){o.set(s,{point:l,edge:r});continue}let p=e.filter(w=>w.points.length>1&&xt(w)!==c).map(w=>w.points),v=a(r,i,p);i.push(v),t.set(c,v),o.set(s,{point:v,edge:r})}return o}function Qe(e){let n=(a,o)=>Math.hypot(a.x-o.x,a.y-o.y)<=.5;return e.map(a=>{let o=e.filter(i=>i.step>a.step&&n(i,a)).sort((i,t)=>i.step-t.step)[0];return o?{...a,until:o.step}:a})}var _e=([e,n])=>({x:e-g.badge.r,y:n-g.badge.r,w:g.badge.r*2,h:g.badge.r*2}),Ct=e=>[e.x+g.state.text,e.y+g.baseline.mark],Be=e=>Re(e)?E.labelJa:E.label,Rs={above:"below",below:"above",left:"right",right:"left"};function Ke(e,n){let a=se(e.text,Be(e.text))+g.label.padX*2,o=g.label.h,i=qs(e.points),t=(i.a[0]+i.b[0])/2,s=(i.a[1]+i.b[1])/2,r=e.side??(i.vertical?"right":"above"),{side:c}=g.label,l=e.offset??g.label.offset,p=x=>x==="above"?{x:t-a/2,y:s-l-o/2,w:a,h:o}:x==="below"?{x:t-a/2,y:s+l-o/2,w:a,h:o}:x==="left"?{x:t-c-a,y:s-o/2,w:a,h:o}:{x:t+c,y:s-o/2,w:a,h:o},v=e.base?{...e.base,w:a,h:o}:p(r),w=e.flip?[r,Rs[r]]:[r],d=x=>n.hard.every($=>at(x,$)>=g.gap)&&n.soft.every($=>at(x,$)>=g.label.soft)&&(n.touch??[]).every($=>at(x,$)>=g.label.touch)&&(n.lines??[]).every($=>!qt($,x,-g.label.touch)),{search:b,searchMax:T}=g.label;for(let x=0;x<=T;x+=b)for(let $ of w){let m=$===r?v:p($),y=$==="above"?[0,-1]:$==="below"?[0,1]:$==="left"?[-1,0]:[1,0],O=[Math.abs(y[1]),Math.abs(y[0])],_=e.slide??($==="above"||$==="below"?a:o*4);for(let Y=0;Y<=_;Y+=b)for(let J of Y===0?[1]:[1,-1]){let L={x:m.x+y[0]*x+O[0]*Y*J,y:m.y+y[1]*x+O[1]*Y*J,w:a,h:o};if(d(L))return{...L,step:e.step,event:e.event,text:e.text,family:Be(e.text).family,color:e.color}}}return{...v,step:e.step,event:e.event,text:e.text,family:Be(e.text).family,color:e.color}}function $n(e,n){let a=0,o=0;for(let t of e.steps)for(let s of t.events)s.type!=="strip"||s.field!==n||(s.value!==void 0&&(a=Math.max(a,se(s.value,Re(s.value)?E.fieldValueJa:E.fieldValue))),s.tag!==void 0&&(o=Math.max(o,se(s.tag,E.tag)+g.strip.tagPadX*2)));let i=a+(o>0?(a>0?g.strip.tagGap:0)+o:0);return Math.max(se(n,E.fieldName),i)}var sn=e=>Math.max(se(e.title,E.fieldName),e.states.length*g.strip.trail.step);function et(e,n){if(!e.strip)return 0;let{titleX:a,fieldGap:o,pad:i}=g.strip,t=a+se(e.strip.title,E.stripTitle)+o,s=[...e.strip.fields.map(r=>$n(e,r)),...n?[sn(n)]:[]];return t+s.reduce((r,c)=>r+c+o,0)-o+i}function tt(e,n,a,o,i){if(!e.strip)return;let{titleX:t,fieldGap:s,pad:r,line:c,h:l}=g.strip,p=t+se(e.strip.title,E.stripTitle)+s,v=[],w=p,d=0,b=x=>{w>p&&w+x>o-r&&(w=p,d++);let $={x:n+w,y:a+d*c};return w+=x+s,$};for(let x of e.strip.fields){let $=$n(e,x);v.push({name:x,...b($),w:$})}let T=i?{...i,...b(sn(i)),w:sn(i)}:void 0;return{x:n,y:a,w:o,h:l+d*c,title:e.strip.title,fields:v,...T?{trail:T}:{}}}function dt(e,n,a){let o=i=>{i.x+=n,i.y+=a};for(let i of e.boxes)o(i),i.cx+=n,i.cy+=a,i.slot&&o(i.slot),i.iconX!==void 0&&(i.iconX+=n);for(let i of e.regions)i.y+=a,o(i.header);for(let i of e.lifelines)i.x+=n,i.y1+=a,i.y2+=a;for(let i of e.edges)i.points=i.points.map(([t,s])=>[t+n,s+a]),i.settle&&(i.settle=[i.settle[0]+n,i.settle[1]+a]),i.wait&&(i.wait=[i.wait[0]+n,i.wait[1]+a]);for(let i of e.labels)o(i);for(let i of e.paths)i.points=i.points.map(([t,s])=>[t+n,s+a]),i.label&&o(i.label);for(let i of e.ends)i.x+=n,i.y+=a;e.side&&o(e.side);for(let i of e.actions)o(i);for(let i of e.badges)i.x+=n,i.y+=a;if(e.strip){e.strip.y+=a;for(let i of e.strip.fields)i.x+=n,i.y+=a;e.strip.trail&&(e.strip.trail.x+=n,e.strip.trail.y+=a)}}function ft(e,n,a){let{inset:o}=g.badge;for(let t of e){let s=t.type==="swap"||t.type==="action"?t.box:void 0,r=a.boxes.find(c=>c.id===s);if(r)return{step:n,x:r.x,y:r.y,color:r.color}}if(a.strip&&e.some(t=>t.type==="strip"))return{step:n,x:a.strip.x+o,y:a.strip.y+o,color:"slate"};let i=a.boxes[0];return{step:n,x:i.x,y:i.y,color:i.color}}function Pn(e){let n=js(e),a=Cs(e,n),o=n.map(()=>({top:0,bottom:0})),i=kn(e,n,a,o);for(let t=0;t<3&&Bs(i,n,a,o);t++)i=kn(e,n,a,o);return i}function js(e){let n=e.regions??[],a=new Set(n.map(t=>t.id)),o=n.map(t=>({region:t,members:e.boxes.filter(s=>s.region===t.id).map(s=>s.id)})),i=e.boxes.filter(t=>t.region===void 0||!a.has(t.region)).map(t=>t.id);return i.length>0&&o.push({members:i}),o}var Sn=e=>e==="left"||e==="right";function Cs(e,n){let a=g.architecture.columns,o=ct(e).map(s=>s.edge),i=new Map;n.forEach((s,r)=>{let c=new Set(s.members),l=new Set,p=($,m)=>$>=0&&$<a&&!l.has(`${$},${m}`),v=($,m)=>{let y=Math.min(a-1,Math.max(0,$));for(let O=m;;O++)for(let _=0;_<a;_++)for(let Y of[y+_,y-_])if(p(Y,O))return[Y,O]},w=($,m,y)=>{i.set($,{group:r,col:m,row:y}),l.add(`${m},${y}`)},d=1,b=$=>{for(let m of o){let y=m.from===$?m.to:m.to===$?m.from:void 0;if(y===void 0||!c.has(y)||i.has(y))continue;let O=i.get($),[_,Y]=Sn(m.labelSide)?v(O.col,O.row+1):p(O.col+d,O.row)?[O.col+d,O.row]:v(O.col+d,O.row);w(y,_,Y),b(y)}},T=$=>{for(let m=0;m<o.length;m++){let y=o[m],O=y?.from===$?y.to:y?.to===$?y.from:void 0,_=O===void 0?void 0:i.get(O);if(_&&_.group<r)return{order:m,col:_.col}}},x=0;for(;;){let $=s.members.filter(J=>!i.has(J));if($.length===0)break;let m=$.map(J=>({id:J,anchor:T(J)})).filter(J=>J.anchor!==void 0);m.sort((J,L)=>(J.anchor?.order??0)-(L.anchor?.order??0));let y=m[0]??{id:$[0],anchor:void 0},O=y.anchor?.col??0;x===0&&(d=O>=(a-1)/2?-1:1);let[_,Y]=p(O,0)?[O,0]:v(O,0);w(y.id,_,Y),b(y.id),x++}});let t=[...new Set([...i.values()].map(s=>s.col))].sort((s,r)=>s-r);for(let s of i.values())s.col=t.indexOf(s.col);return i}function Ds(e){let n=[...e.matchAll(/ /g)].map(o=>o.index);if(n.length===0)return[e];let a=n.reduce((o,i)=>Math.abs(i-e.length/2)<Math.abs(o-e.length/2)?i:o);return[e.slice(0,a),e.slice(a+1)]}function Is(e){let{icon:n,nameY:a,line:o,inset:i}=g.region,t=Ds(e.name),s=Math.max(n,...t.map(c=>se(c,E.regionName)),se(e.note??"",E.regionNote)),r=a-i+(t.length-1)*o+(e.note?o:0)+g.gap/2;return{w:s,h:r,lines:t}}function kn(e,n,a,o){let{box:i,region:t,architecture:s,margin:r,gap:c}=g,l=Ue(e),p=rn(e),v=ct(e),w=Math.max(1,...[...a.values()].map(h=>h.col+1)),d=Et(e),b=new Map(e.boxes.map(h=>[h.id,Math.max(Je(e,h.id,!0),Tt(d.get(h.id),h.icon!==void 0,i.padX))])),T=Array.from({length:w},(h,j)=>Math.max(i.minW,...[...a].filter(([,N])=>N.col===j).map(([N])=>b.get(N)??i.minW))),x=Array.from({length:Math.max(0,w-1)},()=>s.columnGap);for(let{edge:h}of v){let j=a.get(h.from),N=a.get(h.to);if(!j||!N||h.label===void 0||j.group!==N.group||j.row!==N.row||Math.abs(j.col-N.col)!==1||Sn(h.labelSide))continue;let M=se(h.label,Be(h.label))+g.label.padX*2+s.labelRoom*2,G=Math.min(j.col,N.col);M<=s.maxColumnGap&&(x[G]=Math.max(x[G]??0,M))}let $=n.map(h=>h.region?Is(h.region):void 0),m=Math.max(0,...$.map(h=>h?h.w+t.inset*2:0)),y=[];for(let h=0;h<w;h++)y.push(h===0?r+(m>0?m:t.pad):y[h-1]+T[h-1]+x[h-1]);let O=h=>y[h]+T[h]/2,_=new Set(v.filter(({edge:h})=>h.from===h.to).map(({edge:h})=>h.from)),Y=new Set([..._].flatMap(h=>{let j=a.get(h);return j?[`${j.group}:${j.row}`]:[]})),J=(h,j)=>Y.has(`${h}:${j}`)?on:0,L=[],C=[],q=r;n.forEach((h,j)=>{let N=Math.max(1,...h.members.map(we=>(a.get(we)?.row??0)+1)),M=o[j],G=q+t.pad+M.top,z=[0];for(let we=1;we<N;we++)z.push(z[we-1]+i.h+s.rowGap+J(j,we-1));for(let we of h.members){let Ce=a.get(we),Ie=e.boxes.find(Ge=>Ge.id===we),Ee=b.get(we)??i.minW,Ae=O(Ce.col),Fe=G+z[Ce.row];L.push({id:we,name:Ie?.name??we,...Ie?.sub!==void 0?{sub:Ie.sub}:{},...Ie?.icon!==void 0?{icon:Ie.icon}:{},color:l.get(we)??"slate",x:Ae-Ee/2,y:Fe,w:Ee,h:i.h,cx:Ae,cy:Fe+i.h/2})}let U=G+z[N-1]+i.h+J(j,N-1),Oe=$[j],qe=Math.max(U+t.pad+M.bottom-q,Oe?Oe.h+t.inset*2:0,h.region?t.minH:0);C.push({group:j,y:q,h:qe,rows:N}),q+=qe+t.gap});let Q=q-t.gap;for(let h of L)Lt(h,d.get(h.id));let k=new Map(L.map(h=>[h.id,h])),K=h=>C[a.get(h)?.group??0],X=(h,j,N)=>{for(let M=1;M<h.length;M++){let[G,z]=h[M-1],[U,Oe]=h[M];if(Math.min(G,U)<=j.x+j.w+N&&Math.max(G,U)>=j.x-N&&Math.min(z,Oe)<=j.y+j.h+N&&Math.max(z,Oe)>=j.y-N)return!0}return!1},Z=[..._].flatMap(h=>{let j=k.get(h);return j?[{x:j.x,y:j.y+j.h,w:j.w,h:on}]:[]}),S=h=>Z.some(j=>X(h,j,0)),D=(h,j,N)=>L.some(M=>M.id!==j&&M.id!==N&&X(h,M,g.label.search))||S(h),I=h=>{let j=k.get(h),N=K(h),M=a.get(h),G=j.y+j.h+(M?J(M.group,M.row):0);return(M?.row??0)<N.rows-1?G+s.rowGap/2:Math.min(G+t.pad/2,N.y+N.h-g.edge.inset)},F=h=>{let j=k.get(h),N=K(h);return(a.get(h)?.row??0)>0?j.y-s.rowGap/2:Math.max(j.y-t.pad/2,N.y+g.edge.inset)},V=g.edge.inset,ne=(h,j)=>j?y[h]+T[h]+(x[h]??s.columnGap)/2:y[h]-(x[h-1]??s.columnGap)/2,oe=(h,j)=>{let N=k.get(h),M=k.get(j);if(h===j)return At(N);let G=a.get(h),z=a.get(j);if(G.group===z.group&&G.row===z.row){let Ee=M.cx>N.cx,Ae=[[Ee?N.x+N.w:N.x,N.cy],[Ee?M.x-V:M.x+M.w+V,M.cy]];if(!D(Ae,h,j))return Ae;let Fe=I(h),Ge=[[N.cx,N.y+N.h],[N.cx,Fe],[M.cx,Fe],[M.cx,M.y+M.h+V]];if(!S(Ge))return Ge;let ut=F(h),ht=[[N.cx,N.y],[N.cx,ut],[M.cx,ut],[M.cx,M.y-V]];return S(ht)?Ge:ht}let U=M.cy>N.cy,Oe=[N.cx,U?N.y+N.h:N.y],qe=[M.cx,U?M.y-V:M.y+M.h+V];if(G.col===z.col){let Ee=[Oe,qe];if(!D(Ee,h,j))return Ee;let Ae=ne(G.col,!0);return[[N.x+N.w,N.cy],[Ae,N.cy],[Ae,M.cy],[M.x+M.w+V,M.cy]]}let we=M.cx>N.cx,Ce=U?I(h):F(h),Ie=[[Oe,[N.cx,M.cy],[we?M.x-V:M.x+M.w+V,M.cy]],[[we?N.x+N.w:N.x,N.cy],[M.cx,N.cy],qe],[Oe,[N.cx,Ce],[M.cx,Ce],qe]];if(_.has(h)||_.has(j)){let Ee=ne(G.col,we),Ae=ne(z.col,!we),Fe=[[we?N.x+N.w:N.x,N.cy],[Ee,N.cy]],Ge=[we?M.x-V:M.x+M.w+V,M.cy];Ie.push([...Fe,[Ee,M.cy],Ge],[...Fe,[Ee,Ce],[M.cx,Ce],qe],[Oe,[N.cx,Ce],[Ae,Ce],[Ae,M.cy],Ge],[...Fe,[Ee,Ce],[Ae,Ce],[Ae,M.cy],Ge])}return Ie.find(Ee=>!D(Ee,h,j))??Ie[2]},ce=v.map(({step:h,event:j,edge:N})=>({step:h,event:j,from:N.from,to:N.to,points:oe(N.from,N.to),color:lt(N,l),carry:N.carry}));Nt(ce,k,d);let be=new Map;for(let h of ce){if(h.points.length!==2||!ce.some(U=>U.from===h.to&&U.to===h.from&&U.points.length===2))continue;let[N,M]=h.points,G=Math.abs(M[1]-N[1])<Math.abs(M[0]-N[0]),z=(h.from<h.to?1:-1)*g.edge.parallel;h.points=h.points.map(([U,Oe])=>G?[U,Oe+z]:[U+z,Oe]),be.set(h,G?z>0?"below":"above":z>0?"right":"left")}let le=[];n.forEach((h,j)=>{let N=C[j],M=$[j];!h.region||!M||le.push({id:h.region.id,lines:M.lines,...h.region.note!==void 0?{note:h.region.note}:{},...h.region.icon!==void 0?{icon:h.region.icon}:{},color:p.get(h.region.id)??"slate",x:r,y:N.y,w:0,h:N.h,header:{x:r+t.inset,y:N.y+t.inset,w:M.w,h:M.h}})});let pe=(h,j,N)=>h.from===h.to?Rt(h.points):it(h.points,j,N),ue=Ye(ce,e.steps.length,pe),Se=[];for(let h of ce){let j=e.steps[h.step]?.events[h.event];if(j?.type!=="edge"||j.label===void 0)continue;let N=[...ue].filter(([U])=>U<=h.step).map(([,U])=>_e(U.point)),M=[...le.map(U=>U.header),...Se.filter(U=>U.step===h.step)],G=j.labelSide??be.get(h),z=h.from===h.to?{side:"below",base:jt(h.points,se(j.label,Be(j.label))+g.label.padX*2)}:void 0;Se.push(Ke({step:h.step,event:h.event,text:j.label,points:h.points,color:h.color,...z??(G?{side:G}:{flip:!0})},{hard:L,soft:M,touch:N}))}let xe={kind:"architecture",width:0,height:0,regions:le,boxes:L,lifelines:[],edges:ce,labels:Se,actions:[],badges:[],paths:[],ends:[]},ke=Se.length>0?Math.max(0,r+g.label.soft-Math.min(...Se.map(h=>h.x))):0;ke>0&&dt(xe,ke,0);let u=Math.max(...L.map(h=>h.x+h.w+t.pad),...Se.map(h=>h.x+h.w+g.label.soft),...ce.flatMap(h=>h.points.map(j=>j[0]+t.pad))),B=Math.max(u+r,et(e)+r*2);for(let h of le)h.w=B-r*2;let H=Math.max(Q,...Se.map(h=>h.y+h.h)),W=tt(e,r,H+c,B-r*2);xe.width=B,xe.height=(W?W.y+W.h:H)+r,W&&(xe.strip=W);let ie=Ye(ce,e.steps.length,pe);return xe.badges=Qe(e.steps.map((h,j)=>{let N=ie.get(j);return N?{step:j,x:N.point[0],y:N.point[1],color:N.edge.color}:ft(h.events,j,xe)})),xe}function Bs(e,n,a,o){let i=!1,t=g.label.soft;for(let s of e.labels){let r=e.edges.find(b=>b.step===s.step&&b.event===s.event),c=r&&a.get(r.from),l=r&&a.get(r.to);if(!c||!l||c.group!==l.group||!n[c.group]?.region)continue;let p=e.regions.find(b=>b.id===n[c.group]?.region?.id),v=o[c.group];if(!p||!v)continue;let w=p.y+t-s.y,d=s.y+s.h-(p.y+p.h-t);w>0&&(v.top+=w,i=!0),d>0&&(v.bottom+=d,i=!0)}return i}var Dt=e=>Object.keys(e),no=Dt({sequence:!0,architecture:!0,state:!0,git:!0}),mt=["start","finish"];var nt="HEAD";var so=Dt({coin:!0,none:!0}),ro=Dt({fixed:!0,follow:!0}),oo=Dt({above:!0,below:!0,left:!0,right:!0});var Tn=e=>e.kind==="git";function Fs(e){let n=(e.git?.branches??[]).map(L=>L.id),a=L=>{n.includes(L)||n.push(L)};for(let L of e.steps)for(let C of L.events)(C.type==="commit"||C.type==="branch")&&a(C.branch);let o=new Map(n.map(L=>[L,null])),i=null,t=null,s=[],r=new Map,c=[],l=[],p=[],v=new Map,w=new Map,d=new Map,b=[...n,nt],T=new Map(b.map(L=>[L,[]])),x=[],$=L=>L===nt?t===null?i:null:o.get(L)??null,m=L=>{let C=v.get(L)??[],q=C.indexOf(null);return q<0?C.length:q},y=(L,C,q,Q)=>{let k=new Map(b.map(S=>[S,$(S)])),K=i;q();let Z=b.filter(S=>k.get(S)!==$(S)).map(S=>{let D=d.get(S);return D&&(v.get(D.commit)[D.row]=null,d.delete(S)),{ref:S,slot:D}});for(let{ref:S,slot:D}of Z){let I=D??(S===nt&&K!==null?{commit:K,row:m(K)}:void 0),F=$(S),V;if(F!==null){V={commit:F,row:m(F)};let ne=v.get(F)??[];ne[V.row]=S,v.set(F,ne),w.set(F,Math.max(w.get(F)??0,ne.filter(oe=>oe!==null).length)),d.set(S,V)}l.push({ref:S,step:L,event:C,...I?{from:I}:{},...V?{to:V}:{},line:S===Q})}},O=(L,C)=>{let q=new Set,Q=[...o.values(),i].filter(k=>k!==null);for(;Q.length>0;){let k=Q.pop();q.has(k)||(q.add(k),Q.push(...r.get(k)?.parents??[]))}for(let k of s)!q.has(k.id)&&k.orphan===void 0&&(k.orphan={step:L,event:C})};e.steps.forEach((L,C)=>{L.events.forEach((q,Q)=>{if(q.type==="commit")Y(q,C,Q);else if(q.type==="branch"){if(!r.has(q.from))return;_(q.from)!==q.branch&&c.push({kind:"branch",from:q.from,to:q.branch,step:C,event:Q}),y(C,Q,()=>{o.set(q.branch,q.from),t=q.branch,i=q.from})}else if(q.type==="edge"){let k=q.from;if(k!==nt&&!o.has(k)||!r.has(q.to))return;y(C,Q,()=>{if(k===nt){t=null,i=q.to;return}o.set(k,q.to),t===k?i=q.to:t===null&&i===q.to&&(t=k)},k)}else return;O(C,Q)});for(let q of b)T.get(q)?.push(q===nt?i:o.get(q)??null);x.push(t);for(let q of b){let Q=d.get(q);Q&&p.push({ref:q,step:C,slot:Q})}});function _(L){return r.get(L)?.branch}function Y(L,C,q){if(r.has(L.id))return;let Q=L.copy!==void 0&&r.has(L.copy)?L.copy:void 0,k=Q!==void 0&&t===null&&i!==null?i:o.get(L.branch)??null,K=L.merge!==void 0&&L.merge!==L.branch?o.get(L.merge)??void 0:void 0,X=[...new Set([k,K].filter(D=>D!=null))],Z={id:L.id,branch:L.branch,parents:X,...K!==void 0&&K!==k?{joined:K}:{},...Q!==void 0?{copy:Q}:{},...L.hash!==void 0?{hash:L.hash}:{},...L.note!==void 0?{note:L.note}:{},step:C,event:q};s.push(Z),r.set(Z.id,Z);for(let D of X)c.push({kind:"parent",from:D,to:Z.id,step:C,event:q});Q!==void 0&&c.push({kind:"copy",from:Q,to:Z.id,step:C,event:q});let S=t===null&&i===null;y(C,q,()=>{Q===void 0?(o.set(L.branch,Z.id),t===L.branch&&(i=Z.id)):t===null&&(i=Z.id),S&&(t=L.branch,i=Z.id)})}let J=b.map(L=>({name:L,at:T.get(L)??[],...L===nt?{attached:x}:{}}));return{branches:n,made:s,links:c,moves:l,refs:J,tags:p,rows:w}}function It(e,n,a,o){let i=g.git.samples;return Array.from({length:i},(t,s)=>{let r=(s+1)/i,c=1-r,l=p=>c*c*c*e[p]+3*c*c*r*n[p]+3*c*r*r*a[p]+r*r*r*o[p];return[l(0),l(1)]})}function Gs(e,n){return Math.abs(e[1]-n[1])<.5?[e,n]:e[1]>n[1]?[e,[e[0],n[1]],n]:[e,[n[0],e[1]],n]}function Mn(e,n,a){let o=a>e.cy?1:-1,i=[e.cx,e.cy+o*e.r],t=Math.max(0,Math.min(g.git.turn,n-e.cx)),s=[e.cx+t,a],r=It(i,[i[0],i[1]+(a-i[1])*.7],[e.cx+t*.2,a],s);return[i,...r,...n>s[0]?[[n,a]]:[]]}function _s(e,n){let a=n.cy<e.cy?1:-1,o=[e.cx+e.r,e.cy],i=[n.cx,n.cy+a*n.r],t=Math.max(0,Math.min(g.git.turn,n.cx-o[0])),s=[n.cx-t,e.cy],r=It(s,[n.cx-t*.2,e.cy],[n.cx,i[1]+(e.cy-i[1])*.7],i);return[o,...s[0]>o[0]?[s]:[],...r]}function Ws(e,n){if(Math.abs(e.cy-n.cy)<.5){let s=e.cy-e.r,r=g.git.turn*.7;return[[e.cx,s],...It([e.cx,s],[e.cx,s-r],[n.cx,s-r],[n.cx,s])]}let a=n.cy<e.cy?-1:1,o=[e.cx,e.cy+a*e.r],i=[n.cx,n.cy-a*n.r],t=(i[1]-o[1])*.5;return[o,...It(o,[o[0],o[1]+t],[i[0],i[1]-t],i)]}function Ln(e){let{margin:n,gap:a,box:o,region:i,git:t,carrier:s}=g,r=Fs(e),c=new Map((e.git?.branches??[]).map(u=>[u.id,u.note])),l=new Map(r.branches.map((u,B)=>[u,B])),p=u=>t.colors[(l.get(u)??0)%t.colors.length],v=new Map,w=new Map;for(let u of r.made){let B=Math.max(0,...u.parents.map(H=>(v.get(H)??-1)+1),(w.get(u.branch)??-1)+1);v.set(u.id,B),w.set(u.branch,B)}let d=u=>[...u.hash!==void 0?[{text:u.hash,style:E.gitHash}]:[],...u.note!==void 0?[{text:u.note,style:E.gitNote}]:[]],b=u=>Math.max(0,...d(u).map(B=>se(B.text,B.style))),T=u=>se(u,Re(u)?E.carrierJa:E.carrier)+s.tagPadX*2,x=Math.max(0,...r.refs.map(u=>T(u.name))),$=Math.max(t.pitch,...r.made.map(u=>b(u)+t.textGap),x+t.textGap),m=r.branches.map(u=>({w:Math.max(i.icon,se(u,E.regionName),se(c.get(u)??"",E.regionNote))})),y=n+i.inset+Math.max(0,...m.map(u=>u.w)),O=Math.max(t.r,...r.made.filter(u=>v.get(u.id)===0&&l.get(u.branch)===0).map(u=>b(u)/2),x/2),_=Math.max(t.x0,y+a+O),Y=new Set(r.moves.flatMap(u=>{let B=e.steps[u.step]?.events[u.event];return u.line&&u.to&&B?.type==="edge"&&B.label!==void 0?[r.made.find(H=>H.id===u.to?.commit)?.branch??""]:[]})),J=u=>Math.max(0,...r.made.filter(B=>B.branch===u).map(B=>(r.rows.get(B.id)??0)-2))*t.row,L=r.made.some(u=>l.get(u.branch)===0&&d(u).length>0),C=[],q=n;r.branches.forEach((u,B)=>{let H=B===0,W=H&&L?t.tagTop:t.tag,ie=q+(H?t.topLine-(t.tagTop-W):t.line)+J(u),h=ie-q+(H?t.topBelow:Y.has(u)?t.below:t.bare);C.push({id:u,x:n,y:q,w:0,h,line:ie,color:p(u),tagBase:W}),q+=h+i.gap});let Q=q-i.gap,k=new Map(C.map(u=>[u.id,u])),K=r.made.map(u=>{let B=k.get(u.branch),H=l.get(u.branch)===0,W=_+$*(v.get(u.id)??0)+(H?0:$/2),ie=B.line,h=d(u),j=h.map((z,U)=>H?ie-t.above-(h.length-1-U)*t.lineStep:ie+t.under+U*t.lineStep),N=h.map((z,U)=>ze(z.text,W,j[U],z.style,"middle")),M=N.length===0?void 0:{...Vs(N),lines:h.map(z=>z.text),baselines:j},G=u.copy!==void 0?p(r.made.find(z=>z.id===u.copy)?.branch??u.branch):p(u.branch);return{id:u.id,branch:u.branch,color:G,cx:W,cy:ie,r:t.r,step:u.step,event:u.event,parents:u.parents,...u.copy!==void 0?{copy:u.copy}:{},...u.hash!==void 0?{hash:u.hash}:{},...u.note!==void 0?{note:u.note}:{},...M?{text:M}:{},...u.orphan?{orphan:u.orphan.step,orphanEvent:u.orphan.event}:{}}}),X=new Map(K.map(u=>[u.id,u])),Z=r.links.flatMap(u=>{let B=X.get(u.from);if(!B)return[];if(u.kind==="branch"){if(!r.made.some(j=>j.branch===u.to))return[];let h=k.get(u.to);return[{...u,points:Mn(B,B.cx+t.turn,h.line),color:p(u.to)}]}let H=X.get(u.to),W=r.made.find(h=>h.id===u.to),ie;return u.kind==="copy"?ie=Ws(B,H):Math.abs(B.cy-H.cy)<.5?ie=[[B.cx+B.r,B.cy],[H.cx-H.r,H.cy]]:W?.joined===u.from?ie=_s(B,H):ie=Mn(B,H.cx-H.r,H.cy),[{...u,points:ie,color:H.color}]}),S=(u,B)=>{let H=X.get(B.commit),W=k.get(H.branch)?.tagBase??t.tag,ie=T(u);return{x:H.cx-ie/2,y:H.cy-W-B.row*t.row-s.tagH/2,w:ie,h:s.tagH}},D=u=>[u.x+u.w/2,u.y+u.h/2],I=r.moves.map(u=>{let B=u.from?S(u.ref,u.from):void 0,H=u.to?S(u.ref,u.to):void 0,W=e.steps[u.step]?.events[u.event],ie=u.line&&W?.type==="edge"&&W.carry.kind!=="none"&&!(W.carry.kind==="tag"&&W.carry.text===W.from);return{ref:u.ref,step:u.step,event:u.event,...B?{from:B}:{},...H?{to:H}:{},...u.to?{target:u.to.commit}:{},...ie?{carried:!0}:{},...u.line&&B&&H?{line:Gs(D(B),D(H))}:{},color:"slate"}}),F=r.tags.map(u=>({...S(u.ref,u.slot),ref:u.ref,step:u.step})),V=Ue(e),ne=Math.max(_,...K.flatMap(u=>[u.cx+u.r,...u.text?[u.text.x+u.text.w]:[]]),...F.map(u=>u.x+u.w),...I.flatMap(u=>[u.from,u.to].flatMap(B=>B?[B.x+B.w]:[]))),oe=ne+t.boxGap,ce=(C[1]??C[0])?.line??n+o.h/2,be=e.boxes.map((u,B)=>{let H=Je(e,u.id,!0),W=ce+B*(o.h+a);return{id:u.id,name:u.name,...u.sub!==void 0?{sub:u.sub}:{},...u.icon!==void 0?{icon:u.icon}:{},color:V.get(u.id)??"slate",x:oe,y:W-o.h/2,w:H,h:o.h,cx:oe+H/2,cy:W}}),le=C.map((u,B)=>{let H=c.get(u.id);return{id:u.id,lines:[u.id],...H!==void 0?{note:H}:{},icon:"branch",color:u.color,x:u.x,y:u.y,w:0,h:u.h,header:{x:u.x+i.inset,y:u.y+i.inset,w:m[B]?.w??0,h:i.nameY-i.inset+(H!==void 0?i.line:0)+a/2}}}),pe={kind:"git",width:0,height:0,regions:le,boxes:be,lifelines:[],edges:[],labels:[],actions:[],badges:[],paths:[],ends:[],lanes:C,commits:K,links:Z,tags:F,refs:r.refs,moves:I};pe.badges=En(e,pe),pe.labels=Ks(e,pe);let ue=Math.max(ne,...be.map(u=>u.x+u.w),...pe.labels.map(u=>u.x+u.w))+i.pad,Se=Math.max(ue+n,et(e)+n*2);for(let u of le)u.w=Se-n*2;for(let u of C)u.w=Se-n*2;let xe=Math.max(Q,...be.map(u=>u.y+u.h),...pe.labels.map(u=>u.y+u.h)),ke=tt(e,n,xe+a,Se-n*2);return pe.width=Se,pe.height=(ke?ke.y+ke.h:xe)+n,ke&&(pe.strip=ke),pe.badges=En(e,pe),pe}function Vs(e){let n=Math.min(...e.map(o=>o.x)),a=Math.min(...e.map(o=>o.y));return{x:n,y:a,w:Math.max(...e.map(o=>o.x+o.w))-n,h:Math.max(...e.map(o=>o.y+o.h))-a}}function Hs(e,n){return[...e.links.filter(o=>o.step===n&&o.kind!=="copy").map(o=>({event:o.event,points:o.points,color:o.color})),...e.moves.flatMap(o=>{let i=e.commits.find(t=>t.id===o.target);return o.step===n&&o.line&&i?[{event:o.event,target:i,color:i.color}]:[]})].sort((o,i)=>o.event-i.event)[0]}function On(e,n,a){let{r:o,inset:i}=g.badge,t=e.r+i+o,s=o*2+i;return[[e.cx+t,e.cy],[e.cx,e.cy+t],[e.cx-t,e.cy],[e.cx,e.cy-t]].find(c=>n.every(([l,p])=>Math.hypot(c[0]-l,c[1]-p)>=s)&&a.every(l=>at(_e(c),l)>=g.label.touch))}function Ys(e,n,a){let{r:o,inset:i,along:t,short:s}=g.badge,r=pt(e),c=r<s?Math.min(o+1,r/2):t,l=o*2+i;for(let p=c;p<=r;p+=1){let v=He(e,p),w=_e(v);if(n.every(([d,b])=>Math.hypot(v[0]-d,v[1]-b)>=l)&&a.every(d=>at(w,d)>=g.label.touch))return v}}function En(e,n){let{inset:a}=g.badge,o=[],i=[...n.links.map(r=>r.points),...n.moves.flatMap(r=>r.line?[r.line]:[])],t=[],s=[...n.tags,...n.commits.flatMap(r=>[{x:r.cx-r.r,y:r.cy-r.r,w:r.r*2,h:r.r*2},...r.text?[r.text]:[]])];return e.steps.forEach((r,c)=>{let l=Hs(n,c),p=l?.target?On(l.target,o,s):void 0;if(l&&(l.points||p)){let x=l.points,$=p??(x?Ys(x,o,s)??it(x,o,i.filter(m=>m!==x)):[0,0]);o.push($),t.push({step:c,x:$[0],y:$[1],color:l.color});return}let v=r.events.flatMap(x=>x.type==="swap"||x.type==="action"?[x.box]:[]).map(x=>n.boxes.find($=>$.id===x))[0];if(v){t.push({step:c,x:v.x,y:v.y,color:v.color});return}if(n.strip&&r.events.some(x=>x.type==="strip")){t.push({step:c,x:n.strip.x+a,y:n.strip.y+a,color:"slate"});return}let w=n.commits.find(x=>x.id===n.refs[0]?.at[c]),d=w?On(w,o,s):void 0;if(w&&d){o.push(d),t.push({step:c,x:d[0],y:d[1],color:w.color});return}let b=t[t.length-1],T=n.lanes[0];t.push(b?{...b,step:c}:{step:c,x:(T?.x??0)+(T?.w??0)-a-g.badge.r,y:(T?.y??0)+a+g.badge.r,color:T?.color??"slate"})}),Qe(t)}function Ks(e,n){let a=g.git,o=[],i=n.commits.map(r=>({x:r.cx-r.r,y:r.cy-r.r,w:r.r*2,h:r.r*2})),t=n.commits.flatMap(r=>r.text?[r.text]:[]),s=n.regions.map(r=>r.header);for(let r of n.moves){let c=e.steps[r.step]?.events[r.event];if(c?.type!=="edge"||c.label===void 0||!r.line)continue;let l=n.commits.find(m=>m.id===c.to);if(!l)continue;let p=n.lanes[0]?.id===l.branch,v=se(c.label,Re(c.label)?E.labelJa:E.label)+g.label.padX*2,[w]=r.line.reduce((m,y)=>[m[0]+y[0]/r.line.length,0],[0,0]),d=Math.max(0,...n.tags.filter(m=>m.step===r.step&&Math.abs(m.x+m.w/2-l.cx)<.5).map(m=>l.cy-m.y)),b=c.labelSide??(p?"above":"below"),T=c.labelSide!==void 0?void 0:p?{x:w-v/2,y:l.cy-Math.max(d,(n.lanes[0]?.tagBase??a.tag)+g.carrier.tagH/2)-g.label.soft-g.label.h}:{x:w-v/2,y:l.cy+a.labelUnder},x=n.badges.filter(m=>m.step<=r.step).map(m=>_e([m.x,m.y])),$=n.tags.filter(m=>m.step===r.step);o.push(Ke({step:r.step,event:r.event,text:c.label,points:r.line,color:r.color,side:b,...T?{base:T}:{}},{hard:[...i,...n.boxes],soft:[...t,...$,...s,...o.filter(m=>m.step===r.step)],touch:x}))}return o}function Nn(e){let{box:n,sequence:a,label:o,margin:i,gap:t}=g,s=Ue(e),r=e.sequence?.lifelines??[],c=[...r,...e.boxes.map(S=>S.id).filter(S=>!r.includes(S))],l=new Map(c.map((S,D)=>[S,D])),p=c.map(S=>Je(e,S,!1)),v=p.slice(1).map((S,D)=>p[D]/2+S/2+a.columnGap),w=[];for(let S of e.steps)for(let D of S.events){if(D.type!=="edge"||D.label===void 0)continue;let I=l.get(D.from)??0,F=l.get(D.to)??0,V=se(D.label,Be(D.label))+o.padX*2;I===F?I<v.length&&w.push({from:I,to:I+1,need:a.selfW+o.side+V+a.labelRoom}):w.push({from:Math.min(I,F),to:Math.max(I,F),need:V+a.labelRoom*2})}w.sort((S,D)=>S.to-S.from-(D.to-D.from));for(let{from:S,to:D,need:I}of w){let F=0;for(let ne=S;ne<D;ne++)F+=v[ne]??0;if(F>=I)continue;let V=(I-F)/(D-S);for(let ne=S;ne<D;ne++)v[ne]=(v[ne]??0)+V}let d=[];c.forEach((S,D)=>d.push(D===0?i+p[0]/2:d[D-1]+v[D-1]));let b=c.map((S,D)=>{let I=e.boxes.find(ne=>ne.id===S),F=p[D],V=d[D];return{id:S,name:I?.name??S,...I?.sub!==void 0?{sub:I.sub}:{},...I?.icon!==void 0?{icon:I.icon}:{},color:s.get(S)??"slate",x:V-F/2,y:i,w:F,h:n.h,cx:V,cy:i+n.h/2}}),T=i+n.h,x=[],$=[],m=[],y=T+a.firstRow,O=0,_=!0;e.steps.forEach((S,D)=>{S.events.forEach((I,F)=>{if(I.type!=="edge"&&I.type!=="action")return;let V,ne;if(I.type==="edge"){let oe=I.labelSide??"above",ce=I.from===I.to,be=I.label!==void 0;V=be&&oe==="above"?a.labelOffset+o.h/2:t,ne=ce?a.selfH+t:be&&oe==="below"?a.labelOffset+o.h/2:t}else V=g.action.h/2,ne=g.action.h/2;if(y=_?y+V:y+Math.max(a.minPitch,O+a.rowGap+V)+(F===0&&D>0?a.stepGap:0),_=!1,O=ne,I.type==="edge"){let oe=d[l.get(I.from)??0],ce=d[l.get(I.to)??0],be=Math.sign(ce-oe)||1,le=oe===ce?[[oe,y],[oe+a.selfW,y],[oe+a.selfW,y+a.selfH],[oe+g.edge.inset,y+a.selfH]]:[[oe,y],[ce-be*g.edge.inset,y]],pe=lt(I,s),ue={};if(I.carry.kind!=="none"){let Se=g.slot.lifeline+Ze(I.carry)[0],[xe,ke]=le,[u,B]=le.slice(-2),H=Math.sign(ke[0]-xe[0])||1,W=Math.sign(B[0]-u[0])||-1;ue.wait=[oe-H*Se,xe[1]],ue.settle=[ce+W*Se,B[1]]}x.push({step:D,event:F,from:I.from,to:I.to,points:le,color:pe,carry:I.carry,...ue}),I.label!==void 0&&m.push({step:D,event:F,text:I.label,points:le,color:pe,...I.labelSide?{side:I.labelSide}:oe===ce?{side:"right"}:{},offset:a.labelOffset})}else{let oe=d[l.get(I.box)??0],ce=se(I.label,E.action)+g.action.padX*2;$.push({step:D,event:F,box:I.box,text:I.label,color:s.get(I.box)??"slate",x:oe+g.badge.r+4,y:y-g.action.h/2,w:ce,h:g.action.h})}})});let Y=(_?T:y+O)+a.tail,J=c.map((S,D)=>({id:S,x:d[D],y1:T,y2:Y})),L=Ye(x,e.steps.length),C=[];for(let S of m){let D=[...L].filter(([F])=>F<=S.step).map(([,F])=>_e(F.point)),I=[...C.filter(F=>F.step===S.step),...$];C.push(Ke(S,{hard:b,soft:I,touch:D}))}let q={kind:"sequence",width:0,height:0,regions:[],boxes:b,lifelines:J,edges:x,labels:C,actions:$,badges:[],paths:[],ends:[]},Q=[...b.map(S=>S.x),...C.map(S=>S.x),...$.map(S=>S.x)],k=Math.max(0,i-Math.min(...Q));k>0&&dt(q,k,0);let K=[...b.map(S=>S.x+S.w),...C.map(S=>S.x+S.w),...$.map(S=>S.x+S.w),...x.flatMap(S=>S.points.map(D=>D[0]))],X=Math.max(Math.max(...K)+i,et(e)+i*2),Z=tt(e,i,Y+t,X-i*2);return q.width=X,q.height=(Z?Z.y+Z.h:Y)+i,Z&&(q.strip=Z),q.badges=Xs(e,q),q}function Xs(e,n){let a=Ye(n.edges,e.steps.length),o=e.steps.map((i,t)=>{let s=a.get(t);if(s)return{step:t,x:s.point[0],y:s.point[1],color:s.edge.color};let r=n.actions.find(l=>l.step===t),c=r&&n.lifelines.find(l=>l.id===r.box);return r&&c?{step:t,x:c.x,y:r.y+r.h/2,color:r.color}:ft(i.events,t,n)});return Qe(o)}var qn=e=>mt.includes(e);function zs(e){let n=[],a=o=>{!qn(o)&&!n.includes(o)&&n.push(o)};for(let{edge:o}of ct(e))a(o.from),a(o.to);return n}var Us=(e,n)=>e.from===n.from&&e.to===n.to;function An(e,n){let{box:a,state:o,margin:i,gap:t}=g,s=g.edge.inset,r=ot[n],c=Ue(e),l=ct(e),p=zs(e),v=e.boxes.map(f=>f.id).filter(f=>!p.includes(f)),w=(e.state?.paths??[]).filter(f=>!l.some(({edge:P})=>Us(P,f))),d=[...l.map(({edge:f})=>f),...w],b=o.ghost,T=f=>{let P=e.boxes.find(A=>A.id===f);return b.pad*2+a.icon+b.gap+Math.max(se(P?.name??f,E.boxName),se(P?.sub??"",E.boxSub))},x=Et(e),$=Math.max(a.padX,o.done.inset+o.done.r+g.slot.clear),m=new Map(e.boxes.map(f=>[f.id,v.includes(f.id)?T(f.id):Math.max(Je(e,f.id,!0),Tt(x.get(f.id),f.icon!==void 0,$))])),y=Math.max(1,Math.min(o.columns,p.length)),O=Math.max(1,Math.ceil(p.length/o.columns)),_=new Map(p.map((f,P)=>{let A=Math.floor(P/o.columns),re=P%o.columns;return[f,{row:A,col:A%2===0?re:y-1-re}]})),Y=Array.from({length:y},(f,P)=>Math.max(a.minW,...p.filter(A=>_.get(A)?.col===P).map(A=>m.get(A)??a.minW))),J=Array.from({length:Math.max(0,y-1)},()=>o.columnGap);for(let f of d){let P=_.get(f.from),A=_.get(f.to);if(!P||!A||f.label===void 0||P.row!==A.row||Math.abs(P.col-A.col)!==1)continue;let re=Math.min(P.col,A.col);J[re]=Math.max(J[re]??0,se(f.label,Be(f.label))+g.label.padX*2+o.labelRoom*2)}let L=[];for(let f=0;f<y;f++)L.push(f===0?i:L[f-1]+Y[f-1]+J[f-1]);let C=f=>L[f]+Y[f]/2,q=f=>v.includes(f),Q=new Set(w.filter(f=>q(f.to)&&!q(f.from)&&!qn(f.from)).map(f=>f.from)),k=[r.sideNote,...Q.size>0?[r.sideFrom(Q.size)]:[]],K=Math.max(se(r.side,E.regionName),...k.map(f=>se(f,E.regionNote))),X=o.side.pad*2+Math.max(b.h,E.regionName.size+g.region.line*k.length+o.side.pad/4),Z=d.some(f=>f.from==="start"),S=i+(v.length>0?X+o.side.gap:Z?o.start+o.drop:0),D=f=>S+f*(a.h+o.rowGap),I=(f,P,A,re)=>{let te=e.boxes.find(he=>he.id===f),ae=m.get(f)??a.minW,De=re?b.h:a.h;return{id:f,name:te?.name??f,...te?.sub!==void 0?{sub:te.sub}:{},...te?.icon!==void 0?{icon:te.icon}:{},color:c.get(f)??"slate",x:P-ae/2,y:A,w:ae,h:De,cx:P,cy:A+De/2,...re?{ghost:!0}:{}}},F=p.map(f=>{let P=_.get(f);return I(f,C(P.col),D(P.row),!1)});for(let f of F)Lt(f,x.get(f.id),$);let V=new Map(F.map(f=>[f.id,f])),ne=f=>F.some(P=>P!==f&&Math.abs(P.cx-f.cx)<.5&&P.y>f.y),oe=[],ce=F[0],be=Math.max(...F.map(f=>f.x+f.w)),le,pe=i+X+o.side.lane;if(v.length>0){let f=he=>w.filter(Ne=>Ne.to===he).flatMap(Ne=>V.get(Ne.from)??[]),P=v.flatMap(f),A=Math.max(i,Math.min(...P.length>0?P.map(he=>he.x):[i+o.side.pad])-o.side.pad),re=A+o.side.pad+K+t*2,te=v.map(he=>{let Ne=f(he);return{id:he,cx:Ne.length>0?Ne.reduce((Xe,rt)=>Xe+rt.cx,0)/Ne.length:re}});te.sort((he,Ne)=>he.cx-Ne.cx);let ae=A;for(let{id:he,cx:Ne}of te){let Xe=m.get(he)??a.minW,rt=Math.max(Ne-Xe/2,re),Ve=I(he,rt+Xe/2,i+(X-b.h)/2,!0);F.push(Ve),V.set(he,Ve);let gn=w.some(yn=>yn.from===he&&yn.to==="finish");gn&&oe.push({kind:"finish",x:Ve.x+Ve.w+o.beside,y:Ve.cy,r:o.end.r,ghost:!0,text:"",box:he}),ae=gn?Ve.x+Ve.w+o.beside+o.end.r:Ve.x+Ve.w,re=ae+t*2}let De=Math.max(ae+o.side.pad,be);le={x:A,y:i,w:De-A,h:X,title:r.side,notes:k}}if(ce&&Z){let f=ce.cx+o.start+o.text+se(r.start,E.regionNote)+t,P=le&&f<le.x?le.y+o.side.pad+o.start:ce.y-o.drop;oe.unshift({kind:"start",x:ce.cx,y:P,r:o.start,ghost:!1,text:r.start})}for(let f of F.filter(P=>!P.ghost&&d.some(A=>A.from===P.id&&A.to==="finish")))oe.push(ne(f)?{kind:"finish",x:f.x+f.w+o.beside,y:f.cy,r:o.end.r,ghost:!1,text:r.end,box:f.id}:{kind:"finish",x:f.cx,y:f.y+f.h+o.below,r:o.end.r,ghost:!1,text:r.end,box:f.id});let ue=(f,P)=>{let A=_.get(f.id),re=_.get(P.id);if(!A||!re)return[[f.cx,f.y+f.h],[P.cx,P.y-s]];if(A.row===re.row&&Math.abs(A.col-re.col)===1)return P.cx>f.cx?[[f.x+f.w,f.cy],[P.x-s,P.cy]]:[[f.x,f.cy],[P.x+P.w+s,P.cy]];if(A.row===re.row){let ae=f.y+f.h+o.rowGap/4;return[[f.cx,f.y+f.h],[f.cx,ae],[P.cx,ae],[P.cx,P.y+P.h+s]]}if(re.row>A.row){if(Math.abs(f.cx-P.cx)<.5)return[[f.cx,f.y+f.h],[P.cx,P.y-s]];let ae=f.y+f.h+o.rowGap/2;return[[f.cx,f.y+f.h],[f.cx,ae],[P.cx,ae],[P.cx,P.y-s]]}if(Math.abs(f.cx-P.cx)<.5)return[[f.cx,f.y],[P.cx,P.y+P.h+s]];let te=P.y+P.h+o.rowGap/2;return[[f.cx,f.y],[f.cx,te],[P.cx,te],[P.cx,P.y+P.h+s]]},Se=(f,P)=>{let A=w.filter(te=>te.to===P.id).flatMap(te=>V.get(te.from)??[]).sort((te,ae)=>te.cx-ae.cx),re=A.findIndex(te=>te.id===f);return A.length<=1?Math.min(Math.max(A[0]?.cx??P.cx,P.x+o.side.entry),P.x+P.w-o.side.entry):P.x+o.side.entry+(P.w-o.side.entry*2)*Math.max(0,re)/(A.length-1)},xe=f=>Z&&f===ce?f.cx+o.side.entry:f.cx,ke=f=>oe.find(P=>P.kind==="finish"&&P.box===f),u=(f,P)=>{if(f==="start"){let te=oe.find(De=>De.kind==="start"),ae=V.get(P);return!te||!ae?[]:[[te.x,te.y+te.r],[ae.cx,ae.y-s]]}let A=V.get(f);if(!A)return[];if(P==="finish"){let te=ke(f);return te?Math.abs(te.x-A.cx)<.5?[[A.cx,A.y+A.h],[A.cx,te.y-te.r-s]]:[[A.x+A.w,A.cy],[te.x-te.r-s,A.cy]]:[]}let re=V.get(P);if(!re)return[];if(f===P)return At(A);if(re.ghost&&!A.ghost){let te=xe(A),ae=Se(f,re);return Math.abs(te-ae)<.5?[[te,A.y],[ae,re.y+re.h+s]]:[[te,A.y],[te,pe],[ae,pe],[ae,re.y+re.h+s]]}return A.ghost&&re.ghost?[[A.x+A.w,A.cy],[re.x-s,re.cy]]:A.ghost?[[A.cx,A.y+A.h],[A.cx,pe],[re.cx,pe],[re.cx,re.y-s]]:ue(A,re)},B=f=>{let P=f.to==="finish"?ke(f.from):void 0;if(!P)return;let A=V.get(f.from);return A&&Math.abs(P.x-A.cx)<.5?[P.x-P.r-t-Ze(f.carry)[0],P.y]:[P.x,P.y+P.r+t+g.carrier.tagH/2]},H=f=>{let P=f.from==="start"?oe.find(A=>A.kind==="start"):void 0;return P?[P.x-P.r-g.slot.mark-Ze(f.carry)[0],P.y]:void 0},W=l.map(({step:f,event:P,edge:A})=>{let re=B(A),te=A.carry.kind==="none"?void 0:H(A);return{step:f,event:P,from:A.from,to:A.to,points:u(A.from,A.to),color:Js(A,c),carry:A.carry,...re?{settle:re}:{},...te?{wait:te}:{}}});Nt(W,V,x);let ie=new Map;for(let f of W){if(f.points.length!==2||!W.some(ae=>ae.from===f.to&&ae.to===f.from&&ae.points.length===2))continue;let[P,A]=f.points,re=Math.abs(A[1]-P[1])<Math.abs(A[0]-P[0]),te=(f.from<f.to?1:-1)*g.edge.parallel;f.points=f.points.map(([ae,De])=>re?[ae,De+te]:[ae+te,De]),ie.set(f,re?te>0?"below":"above":te>0?"right":"left")}let h=w.map(f=>({from:f.from,to:f.to,points:u(f.from,f.to)})),j=(f,P,A)=>f.from===f.to?Rt(f.points):it(f.points,P,A),N=[],M=oe.flatMap(f=>f.text===""?[]:[ze(f.text,...Ct(f),E.regionNote)]),G=[...Ye(W,e.steps.length,j).values()].map(f=>_e(f.point)),z=[...le?[{x:le.x,y:le.y,w:o.side.pad+K,h:le.h}]:[],...M],U=f=>[...W.map(P=>P.points),...h.map(P=>P.points)].filter(P=>P!==f);for(let f of W){let P=e.steps[f.step]?.events[f.event];if(P?.type!=="edge"||P.label===void 0)continue;let A=f.from===f.to,re=xt(f),te=N.filter(Xe=>Xe.text===P.label&&W.some(rt=>rt.step===Xe.step&&rt.event===Xe.event&&xt(rt)===re)),ae=te[te.length-1];if(ae){ae.until=f.step,N.push({x:ae.x,y:ae.y,w:ae.w,h:ae.h,step:f.step,event:f.event,text:ae.text,family:ae.family,color:f.color});continue}let De=se(P.label,Be(P.label))+g.label.padX*2,he=A?{side:"below",base:jt(f.points,De)}:{},Ne=P.labelSide??(f.to==="finish"?"left":ie.get(f));N.push(Ke({step:f.step,event:f.event,text:P.label,points:f.points,color:f.color,...Ne?{side:Ne}:A?{}:{flip:!0},...he},{hard:F,soft:[...z,...N],touch:G,lines:U(f.points)}))}let Oe=[];w.forEach((f,P)=>{let A=h[P];if(f.label===void 0||A.points.length===0)return;let re=Be(f.label),te=V.get(f.to)?.ghost===!0&&V.get(f.from)?.ghost!==!0,ae=A.points[0][0],De=te?{side:"below",base:{x:ae+g.label.soft,y:pe+g.label.soft},slide:Math.max(...A.points.map(([Ne])=>Math.abs(Ne-ae)))}:{},he=Ke({step:-1,event:P,text:f.label,points:A.points,color:"slate",...De},{hard:F,soft:[...z,...N,...Oe],touch:G,lines:U(A.points)});Oe.push(he),A.label={x:he.x,y:he.y,w:he.w,h:he.h,text:f.label,family:re.family}});let qe={kind:"state",width:0,height:0,regions:[],boxes:F,lifelines:[],edges:W,labels:N,actions:[],badges:[],paths:h,ends:oe,...le?{side:le}:{}},we=[...F.map(f=>f.x),...N.map(f=>f.x),...h.flatMap(f=>f.label?[f.label.x]:[])],Ce=[...N.map(f=>f.y),...h.flatMap(f=>f.label?[f.label.y]:[])],Ie=Math.max(0,i-Math.min(...we)),Ee=Ce.length>0?Math.max(0,i-Math.min(...Ce)):0;(Ie>0||Ee>0)&&dt(qe,Ie,Ee);let Ae=f=>f.x+(f.text===""?f.r:o.text+se(f.text,E.regionNote)),Fe=[...F.map(f=>f.x+f.w),...N.map(f=>f.x+f.w),...oe.map(Ae),...W.flatMap(f=>f.points.map(P=>P[0])),...h.flatMap(f=>[...f.points.map(P=>P[0]),...f.label?[f.label.x+f.label.w]:[]]),...le?[le.x+le.w]:[]],Ge=[...F.map(f=>f.y+f.h),...N.map(f=>f.y+f.h),...oe.map(f=>f.y+f.r),...W.flatMap(f=>f.points.map(P=>P[1]))],ut={title:r.trail,states:p.map(f=>({box:f,color:c.get(f)??"slate"}))},ht=Math.max(Math.max(...Fe)+i,et(e,ut)+i*2),hn=Math.max(...Ge,D(O-1)+a.h),gt=tt(e,i,hn+t,ht-i*2,ut);qe.width=ht,qe.height=(gt?gt.y+gt.h:hn)+i,gt&&(qe.strip=gt);let bs=Ye(W,e.steps.length,j);return qe.badges=Qe(e.steps.map((f,P)=>{let A=bs.get(P);return A?{step:P,x:A.point[0],y:A.point[1],color:A.edge.color}:ft(f.events,P,qe)})),qe}function Js(e,n){return e.carry.kind==="coin"?lt(e,n):n.get(e.to==="finish"?e.from:e.to)??"slate"}var Zs={string:"\u6587\u5B57\u5217\u306B\u3059\u308B",integer:"\u6574\u6570\u306B\u3059\u308B",number:"\u6570\u306B\u3059\u308B",object:"\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306B\u3059\u308B",array:"\u914D\u5217\u306B\u3059\u308B",boolean:"true \u304B false \u306B\u3059\u308B",null:"null \u306B\u3059\u308B"},Qs={string:"Use a string",integer:"Use an integer",number:"Use a number",object:"Use an object",array:"Use an array",boolean:"Use true or false",null:"Use null"},Rn=(e,n)=>`${e} ${n}${e===1?"":"s"}`,er={additionalProperties:e=>`${e} \u3068\u3044\u3046\u6B04\u306F\u66F8\u3051\u306A\u3044`,required:e=>`${e} \u306E\u6B04\u304C\u8981\u308B`,enum:e=>`${e.join(" / ")} \u306E\u3069\u308C\u304B\u306B\u3059\u308B`,type:e=>Zs[e]??`${e} \u306B\u3059\u308B`,minLength:e=>`${e} \u5B57\u4EE5\u4E0A\u66F8\u304F`,pattern:e=>e?`${e.space?"\u7A7A\u767D\u3068 ":""}${e.chars.join(" ")} \u306F\u4F7F\u3048\u306A\u3044`:"\u4F7F\u3048\u306A\u3044\u5B57\u304C\u5165\u3063\u3066\u3044\u308B",minItems:e=>`${e} \u3064\u4EE5\u4E0A\u66F8\u304F`,minimum:e=>`${e} \u4EE5\u4E0A\u306B\u3059\u308B`,const:e=>`${e} \u306B\u3059\u308B`,not:e=>e?`${e.field} \u306E\u6B04\u306F kind \u304C ${e.kind} \u306E\u6642\u3060\u3051\u66F8\u3051\u308B`:"\u3053\u306E\u6B04\u306E\u7D44\u307F\u5408\u308F\u305B\u306F\u66F8\u3051\u306A\u3044",reserved:e=>`${e.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`,kindOnly:(e,n)=>`${e.join(" \u3068 ")} \u306E\u51FA\u6765\u4E8B\u306F kind \u304C ${n} \u306E\u6642\u3060\u3051\u66F8\u3051\u308B`,hex:(e,n)=>`0 \u304B\u3089 9 \u3068 a \u304B\u3089 f \u306E\u5B57\u3067 ${e} \u304B\u3089 ${n} \u5B57\u306B\u3059\u308B`,anyOf:e=>e.length>0?`${e.join(" \u304B ")} \u306E${e.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",oneOf:"\u66F8\u3051\u308B\u5F62\u306E\u3069\u308C\u304B 1 \u3064\u3060\u3051\u306B\u5408\u308F\u305B\u308B",discriminator:(e,n)=>`${e} \u306F ${n.join(" / ")} \u306E\u3069\u308C\u304B\u306B\u3059\u308B`,newer:(e,n)=>`\u7248 ${e} \u306E\u56F3\u306F\u3001\u3053\u306E\u9053\u5177 (\u7248 ${n}) \u3088\u308A\u65B0\u3057\u3044\u306E\u3067\u8AAD\u3081\u306A\u3044\u3002\u9053\u5177\u3092\u65B0\u3057\u304F\u3059\u308B`},tr={additionalProperties:e=>`The ${e} field is not allowed`,required:e=>`The ${e} field is required`,enum:e=>`Use one of ${e.join(" / ")}`,type:e=>Qs[e]??`Use ${e}`,minLength:e=>`Write at least ${Rn(e,"character")}`,pattern:e=>e?`Cannot contain ${e.space?"spaces or ":""}${e.chars.join(" ")}`:"Contains characters that are not allowed",minItems:e=>`Write at least ${Rn(e,"item")}`,minimum:e=>`Use ${e} or greater`,const:e=>`Use ${e}`,not:e=>e?`The ${e.field} field is allowed only when kind is ${e.kind}`:"This combination of fields is not allowed",reserved:e=>`${e.join(" and ")} name the start and end marks of a state diagram and cannot be box ids`,kindOnly:(e,n)=>`${e.join(" and ")} events are allowed only when kind is ${n}`,hex:(e,n)=>`Use ${e} to ${n} characters of 0-9 and a-f`,anyOf:e=>e.length>0?`Write one of the ${e.join(" or ")} fields`:"Does not match any of the allowed shapes",oneOf:"Match exactly one of the allowed shapes",discriminator:(e,n)=>`${e} is one of ${n.join(" / ")}`,newer:(e,n)=>`Version ${e} diagrams are newer than this tool (version ${n}) and cannot be read. Update the tool`},Bt={ja:er,en:tr};function nr(e){let n=0;for(let a of e)n++;return n}var cn=Cn,an={title:"dragon \u306E\u56F3\u306E\u539F\u672C",description:"\u533A\u753B\u3001\u7BB1\u3001\u7DDA\u3001\u904B\u3076\u7269\u3001\u6BB5\u3001\u4E2D\u8EAB\u306E\u5E2F\u306E 6 \u90E8\u54C1\u3092\u5171\u901A\u306E\u9AA8\u7D44\u307F\u306B\u7F6E\u304D\u3001\u56F3\u306E\u7A2E\u985E\u3060\u3051\u306E\u7269\u306F\u7A2E\u985E\u306E\u6B04\u306B\u7F6E\u304F\u3002\u5EA7\u6A19\u306F\u6301\u305F\u306A\u3044\u3002\u7BB1\u306F\u679D\u5206\u304B\u308C\u306E\u56F3\u3060\u3051\u304C\u6301\u305F\u306A\u304F\u3066\u3088\u3044\u3002",type:"object",additionalProperties:!1,required:["version","kind","title","boxes","steps"],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"}},if:{required:["kind"],properties:{kind:{const:"sequence"}}},then:{required:["sequence"],properties:{boxes:{minItems:1},steps:{$ref:"#/definitions/plainSteps"},state:{$ref:"#/definitions/absent"},git:{$ref:"#/definitions/absent"}}},else:{properties:{sequence:{$ref:"#/definitions/absent"}},if:{required:["kind"],properties:{kind:{const:"state"}}},then:{properties:{boxes:{minItems:1,items:{properties:{id:{description:"\u59CB\u307E\u308A\u3068\u7D42\u308F\u308A\u306E\u5370\u306E\u540D\u524D\u306F\u7BB1\u306E\u540D\u672D\u306B\u4F7F\u3048\u306A\u3044",not:{enum:["start","finish"]}}}}},steps:{$ref:"#/definitions/plainSteps"},git:{$ref:"#/definitions/absent"}}},else:{if:{required:["kind"],properties:{kind:{const:"git"}}},then:{required:["git"],properties:{state:{$ref:"#/definitions/absent"},regions:{$ref:"#/definitions/absent"}}},else:{properties:{boxes:{minItems:1},steps:{$ref:"#/definitions/plainSteps"},state:{$ref:"#/definitions/absent"},git:{$ref:"#/definitions/absent"}}}}},definitions:{text:{type:"string",minLength:1},absent:{description:"\u3053\u306E\u56F3\u306E\u7A2E\u985E\u3067\u306F\u66F8\u3051\u306A\u3044\u6B04",not:{}},plainSteps:{description:"\u679D\u5206\u304B\u308C\u306E\u56F3\u3067\u306A\u3044\u56F3\u306E\u6BB5\u3002\u679D\u5206\u304B\u308C\u306E\u56F3\u3060\u3051\u306E\u51FA\u6765\u4E8B (commit \u3068 branch) \u3092\u66F8\u3051\u306A\u3044",items:{properties:{events:{items:{properties:{type:{not:{enum:["commit","branch"]}}}}}}}},id:{type:"string",pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},color:{enum:["blue","amber","green","violet","rose","slate","coin"]},region:{type:"object",additionalProperties:!1,required:["id","name"],properties:{id:{$ref:"#/definitions/id"},name:{$ref:"#/definitions/text"},note:{$ref:"#/definitions/text"},color:{$ref:"#/definitions/color"},icon:{$ref:"#/definitions/text"}}},box:{type:"object",additionalProperties:!1,required:["id","name"],properties:{id:{$ref:"#/definitions/id"},name:{$ref:"#/definitions/text"},sub:{$ref:"#/definitions/text"},color:{$ref:"#/definitions/color"},icon:{$ref:"#/definitions/text"},region:{$ref:"#/definitions/id"}}},strip:{type:"object",additionalProperties:!1,required:["title","fields"],properties:{title:{$ref:"#/definitions/text"},fields:{type:"array",minItems:1,items:{$ref:"#/definitions/text"}}}},step:{type:"object",additionalProperties:!1,required:["title","body","events"],properties:{title:{$ref:"#/definitions/text"},body:{$ref:"#/definitions/text"},code:{$ref:"#/definitions/text"},events:{type:"array",items:{$ref:"#/definitions/event"}}}},event:{description:"\u6BB5\u306E\u4E2D\u3067\u8D77\u304D\u308B\u3053\u3068\u3002\u8D77\u304D\u308B\u9806\u306B\u4E26\u3079\u308B",type:"object",required:["type"],discriminator:{propertyName:"type"},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:!1,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:!1,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:!1,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:!1,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:!1,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:!1,required:["type","field"],anyOf:[{required:["value"]},{required:["tag"]}],properties:{type:{const:"strip"},field:{$ref:"#/definitions/text"},value:{$ref:"#/definitions/text"},tag:{$ref:"#/definitions/text"}}}]},carry:{description:"\u7DDA\u306E\u4E0A\u3092\u8D70\u308B\u7269\u3002\u5C01\u7B52 (\u30E1\u30C3\u30BB\u30FC\u30B8\u3084\u8981\u6C42)\u3001\u672D (\u540D\u524D\u306E\u3042\u308B\u5024)\u3001\u786C\u8CA8 (\u4FA1\u5024)\u3001\u7121\u3057",type:"object",additionalProperties:!1,required:["kind"],properties:{kind:{enum:["envelope","tag","coin","none"]},text:{$ref:"#/definitions/text"}},if:{required:["kind"],properties:{kind:{const:"tag"}}},then:{required:["text"]},else:{not:{required:["text"]}}},sequence:{description:"\u6642\u7CFB\u5217\u56F3\u306E\u7A2E\u985E\u306E\u6B04\u3002\u751F\u5B58\u7DDA\u3092\u5DE6\u304B\u3089\u4E26\u3079\u308B\u9806",type:"object",additionalProperties:!1,required:["lifelines"],properties:{lifelines:{type:"array",minItems:1,items:{$ref:"#/definitions/id"}}}},state:{description:"\u72B6\u614B\u9077\u79FB\u56F3\u306E\u7A2E\u985E\u306E\u6B04\u3002\u6700\u521D\u306E\u6BB5\u3088\u308A\u524D\u306B\u66F8\u3044\u305F\u3001\u79FB\u308C\u308B\u304C\u6BB5\u3067\u901A\u308B\u3068\u306F\u9650\u3089\u306A\u3044\u7DDA",type:"object",additionalProperties:!1,required:["paths"],properties:{paths:{type:"array",minItems:1,items:{$ref:"#/definitions/path"}}}},git:{description:"\u679D\u5206\u304B\u308C\u306E\u56F3\u306E\u7A2E\u985E\u306E\u6B04\u3002\u679D\u3092\u4E0A\u304B\u3089\u5E2F\u306B\u4E26\u3079\u308B\u9806",type:"object",additionalProperties:!1,required:["branches"],properties:{branches:{type:"array",minItems:1,items:{$ref:"#/definitions/branch"}}}},branch:{description:"\u679D\u3002\u5E2F\u306E\u5DE6\u306B\u540D\u672D\u3068\u6DFB\u3048\u66F8\u304D\u3092\u7F6E\u304F",type:"object",additionalProperties:!1,required:["id"],properties:{id:{$ref:"#/definitions/id"},note:{$ref:"#/definitions/text"}}},hash:{description:"commit \u306E hash\u300216 \u9032\u306E\u5B57\u3067 4 \u304B\u3089 40 \u5B57",type:"string",pattern:"^[0-9a-f]{4,40}$"},path:{description:"\u79FB\u308C\u308B\u9053\u3002\u9001\u308B\u5074\u306B\u59CB\u307E\u308A\u306E\u5370 start\u3001\u53D7\u3051\u308B\u5074\u306B\u7D42\u308F\u308A\u306E\u5370 finish \u3092\u66F8\u3051\u308B\u3002\u3069\u306E\u6BB5\u306B\u3082\u51FA\u306A\u3044\u9053\u306F\u70B9\u7DDA\u3067\u63CF\u304D\u3001\u904B\u3076\u7269\u3092\u8D70\u3089\u305B\u306A\u3044",type:"object",additionalProperties:!1,required:["from","to"],properties:{from:{$ref:"#/definitions/id"},to:{$ref:"#/definitions/id"},label:{$ref:"#/definitions/text"}}}}};var sr=Object.prototype.hasOwnProperty,ve=nr;var jn={enum:["blue","amber","green","violet","rose","slate","coin"]},Te=new RegExp("^[^\\s\\[\\]\u300C\u300D=:]+$","u");function Ft(e,{instancePath:n="",parentData:a,parentDataProperty:o,rootData:i=e}={}){let t=null,s=0;if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.id===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'"};t===null?t=[r]:t.push(r),s++}if(e.name===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"name"},message:"must have required property 'name'"};t===null?t=[r]:t.push(r),s++}for(let r in e)if(!(r==="id"||r==="name"||r==="note"||r==="color"||r==="icon")){let c={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:r},message:"must NOT have additional properties"};t===null?t=[c]:t.push(c),s++}if(e.id!==void 0){let r=e.id;if(typeof r=="string"){if(!Te.test(r)){let c={instancePath:n+"/id",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};t===null?t=[c]:t.push(c),s++}}else{let c={instancePath:n+"/id",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[c]:t.push(c),s++}}if(e.name!==void 0){let r=e.name;if(typeof r=="string"){if(ve(r)<1){let c={instancePath:n+"/name",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[c]:t.push(c),s++}}else{let c={instancePath:n+"/name",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[c]:t.push(c),s++}}if(e.note!==void 0){let r=e.note;if(typeof r=="string"){if(ve(r)<1){let c={instancePath:n+"/note",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[c]:t.push(c),s++}}else{let c={instancePath:n+"/note",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[c]:t.push(c),s++}}if(e.color!==void 0){let r=e.color;if(!(r==="blue"||r==="amber"||r==="green"||r==="violet"||r==="rose"||r==="slate"||r==="coin")){let c={instancePath:n+"/color",schemaPath:"#/definitions/color/enum",keyword:"enum",params:{allowedValues:jn.enum},message:"must be equal to one of the allowed values"};t===null?t=[c]:t.push(c),s++}}if(e.icon!==void 0){let r=e.icon;if(typeof r=="string"){if(ve(r)<1){let c={instancePath:n+"/icon",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[c]:t.push(c),s++}}else{let c={instancePath:n+"/icon",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[c]:t.push(c),s++}}}else{let r={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[r]:t.push(r),s++}return Ft.errors=t,s===0}function Gt(e,{instancePath:n="",parentData:a,parentDataProperty:o,rootData:i=e}={}){let t=null,s=0;if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.id===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'"};t===null?t=[r]:t.push(r),s++}if(e.name===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"name"},message:"must have required property 'name'"};t===null?t=[r]:t.push(r),s++}for(let r in e)if(!(r==="id"||r==="name"||r==="sub"||r==="color"||r==="icon"||r==="region")){let c={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:r},message:"must NOT have additional properties"};t===null?t=[c]:t.push(c),s++}if(e.id!==void 0){let r=e.id;if(typeof r=="string"){if(!Te.test(r)){let c={instancePath:n+"/id",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};t===null?t=[c]:t.push(c),s++}}else{let c={instancePath:n+"/id",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[c]:t.push(c),s++}}if(e.name!==void 0){let r=e.name;if(typeof r=="string"){if(ve(r)<1){let c={instancePath:n+"/name",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[c]:t.push(c),s++}}else{let c={instancePath:n+"/name",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[c]:t.push(c),s++}}if(e.sub!==void 0){let r=e.sub;if(typeof r=="string"){if(ve(r)<1){let c={instancePath:n+"/sub",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[c]:t.push(c),s++}}else{let c={instancePath:n+"/sub",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[c]:t.push(c),s++}}if(e.color!==void 0){let r=e.color;if(!(r==="blue"||r==="amber"||r==="green"||r==="violet"||r==="rose"||r==="slate"||r==="coin")){let c={instancePath:n+"/color",schemaPath:"#/definitions/color/enum",keyword:"enum",params:{allowedValues:jn.enum},message:"must be equal to one of the allowed values"};t===null?t=[c]:t.push(c),s++}}if(e.icon!==void 0){let r=e.icon;if(typeof r=="string"){if(ve(r)<1){let c={instancePath:n+"/icon",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[c]:t.push(c),s++}}else{let c={instancePath:n+"/icon",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[c]:t.push(c),s++}}if(e.region!==void 0){let r=e.region;if(typeof r=="string"){if(!Te.test(r)){let c={instancePath:n+"/region",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};t===null?t=[c]:t.push(c),s++}}else{let c={instancePath:n+"/region",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[c]:t.push(c),s++}}}else{let r={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[r]:t.push(r),s++}return Gt.errors=t,s===0}function _t(e,{instancePath:n="",parentData:a,parentDataProperty:o,rootData:i=e}={}){let t=null,s=0;if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.title===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"title"},message:"must have required property 'title'"};t===null?t=[r]:t.push(r),s++}if(e.fields===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"fields"},message:"must have required property 'fields'"};t===null?t=[r]:t.push(r),s++}for(let r in e)if(!(r==="title"||r==="fields")){let c={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:r},message:"must NOT have additional properties"};t===null?t=[c]:t.push(c),s++}if(e.title!==void 0){let r=e.title;if(typeof r=="string"){if(ve(r)<1){let c={instancePath:n+"/title",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[c]:t.push(c),s++}}else{let c={instancePath:n+"/title",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[c]:t.push(c),s++}}if(e.fields!==void 0){let r=e.fields;if(Array.isArray(r)){if(r.length<1){let l={instancePath:n+"/fields",schemaPath:"#/properties/fields/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};t===null?t=[l]:t.push(l),s++}let c=r.length;for(let l=0;l<c;l++){let p=r[l];if(typeof p=="string"){if(ve(p)<1){let v={instancePath:n+"/fields/"+l,schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[v]:t.push(v),s++}}else{let v={instancePath:n+"/fields/"+l,schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[v]:t.push(v),s++}}}else{let c={instancePath:n+"/fields",schemaPath:"#/properties/fields/type",keyword:"type",params:{type:"array"},message:"must be array"};t===null?t=[c]:t.push(c),s++}}}else{let r={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[r]:t.push(r),s++}return _t.errors=t,s===0}var rr={description:"\u6BB5\u306E\u4E2D\u3067\u8D77\u304D\u308B\u3053\u3068\u3002\u8D77\u304D\u308B\u9806\u306B\u4E26\u3079\u308B",type:"object",required:["type"],discriminator:{propertyName:"type"},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:!1,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:!1,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:!1,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:!1,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:!1,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:!1,required:["type","field"],anyOf:[{required:["value"]},{required:["tag"]}],properties:{type:{const:"strip"},field:{$ref:"#/definitions/text"},value:{$ref:"#/definitions/text"},tag:{$ref:"#/definitions/text"}}}]};var or=new RegExp("^[0-9a-f]{4,40}$","u"),ir={description:"\u7DDA\u306E\u4E0A\u3092\u8D70\u308B\u7269\u3002\u5C01\u7B52 (\u30E1\u30C3\u30BB\u30FC\u30B8\u3084\u8981\u6C42)\u3001\u672D (\u540D\u524D\u306E\u3042\u308B\u5024)\u3001\u786C\u8CA8 (\u4FA1\u5024)\u3001\u7121\u3057",type:"object",additionalProperties:!1,required:["kind"],properties:{kind:{enum:["envelope","tag","coin","none"]},text:{$ref:"#/definitions/text"}},if:{required:["kind"],properties:{kind:{const:"tag"}}},then:{required:["text"]},else:{not:{required:["text"]}}};function Wt(e,{instancePath:n="",parentData:a,parentDataProperty:o,rootData:i=e}={}){let t=null,s=0,r=s,c=!0,l=s;if(e&&typeof e=="object"&&!Array.isArray(e)){let d;if(e.kind===void 0&&(d="kind")){let b={};t===null?t=[b]:t.push(b),s++}else if(e.kind!==void 0&&e.kind!=="tag"){let b={};t===null?t=[b]:t.push(b),s++}}var p=l===s;s=r,t!==null&&(r?t.length=r:t=null);let v;if(p){let d=s;if(e&&typeof e=="object"&&!Array.isArray(e)&&e.text===void 0){let T={instancePath:n,schemaPath:"#/then/required",keyword:"required",params:{missingProperty:"text"},message:"must have required property 'text'"};t===null?t=[T]:t.push(T),s++}var p=d===s;c=p,v="then"}else{let d=s,b=s,T=s;if(e&&typeof e=="object"&&!Array.isArray(e)){let $;if(e.text===void 0&&($="text")){let m={};t===null?t=[m]:t.push(m),s++}}var w=T===s;if(w){let $={instancePath:n,schemaPath:"#/else/not",keyword:"not",params:{},message:"must NOT be valid"};t===null?t=[$]:t.push($),s++}else s=b,t!==null&&(b?t.length=b:t=null);var p=d===s;c=p,v="else"}if(!c){let d={instancePath:n,schemaPath:"#/if",keyword:"if",params:{failingKeyword:v},message:'must match "'+v+'" schema'};t===null?t=[d]:t.push(d),s++}if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.kind===void 0){let d={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"kind"},message:"must have required property 'kind'"};t===null?t=[d]:t.push(d),s++}for(let d in e)if(!(d==="kind"||d==="text")){let b={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:d},message:"must NOT have additional properties"};t===null?t=[b]:t.push(b),s++}if(e.kind!==void 0){let d=e.kind;if(!(d==="envelope"||d==="tag"||d==="coin"||d==="none")){let b={instancePath:n+"/kind",schemaPath:"#/properties/kind/enum",keyword:"enum",params:{allowedValues:ir.properties.kind.enum},message:"must be equal to one of the allowed values"};t===null?t=[b]:t.push(b),s++}}if(e.text!==void 0){let d=e.text;if(typeof d=="string"){if(ve(d)<1){let b={instancePath:n+"/text",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[b]:t.push(b),s++}}else{let b={instancePath:n+"/text",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[b]:t.push(b),s++}}}else{let d={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[d]:t.push(d),s++}return Wt.errors=t,s===0}function Vt(e,{instancePath:n="",parentData:a,parentDataProperty:o,rootData:i=e}={}){let t=null,s=0;if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.type===void 0){let l={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};t===null?t=[l]:t.push(l),s++}let c=e.type;if(typeof c=="string")if(c==="edge")if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.type===void 0){let l={instancePath:n,schemaPath:"#/oneOf/0/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};t===null?t=[l]:t.push(l),s++}if(e.from===void 0){let l={instancePath:n,schemaPath:"#/oneOf/0/required",keyword:"required",params:{missingProperty:"from"},message:"must have required property 'from'"};t===null?t=[l]:t.push(l),s++}if(e.to===void 0){let l={instancePath:n,schemaPath:"#/oneOf/0/required",keyword:"required",params:{missingProperty:"to"},message:"must have required property 'to'"};t===null?t=[l]:t.push(l),s++}if(e.carry===void 0){let l={instancePath:n,schemaPath:"#/oneOf/0/required",keyword:"required",params:{missingProperty:"carry"},message:"must have required property 'carry'"};t===null?t=[l]:t.push(l),s++}for(let l in e)if(!(l==="type"||l==="from"||l==="to"||l==="label"||l==="carry"||l==="labelSide")){let p={instancePath:n,schemaPath:"#/oneOf/0/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:l},message:"must NOT have additional properties"};t===null?t=[p]:t.push(p),s++}if(e.type!==void 0&&e.type!=="edge"){let l={instancePath:n+"/type",schemaPath:"#/oneOf/0/properties/type/const",keyword:"const",params:{allowedValue:"edge"},message:"must be equal to constant"};t===null?t=[l]:t.push(l),s++}if(e.from!==void 0){let l=e.from;if(typeof l=="string"){if(!Te.test(l)){let p={instancePath:n+"/from",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};t===null?t=[p]:t.push(p),s++}}else{let p={instancePath:n+"/from",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[p]:t.push(p),s++}}if(e.to!==void 0){let l=e.to;if(typeof l=="string"){if(!Te.test(l)){let p={instancePath:n+"/to",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};t===null?t=[p]:t.push(p),s++}}else{let p={instancePath:n+"/to",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[p]:t.push(p),s++}}if(e.label!==void 0){let l=e.label;if(typeof l=="string"){if(ve(l)<1){let p={instancePath:n+"/label",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[p]:t.push(p),s++}}else{let p={instancePath:n+"/label",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[p]:t.push(p),s++}}if(e.carry!==void 0&&(Wt(e.carry,{instancePath:n+"/carry",parentData:e,parentDataProperty:"carry",rootData:i})||(t=t===null?Wt.errors:t.concat(Wt.errors),s=t.length)),e.labelSide!==void 0){let l=e.labelSide;if(!(l==="above"||l==="below"||l==="left"||l==="right")){let p={instancePath:n+"/labelSide",schemaPath:"#/oneOf/0/properties/labelSide/enum",keyword:"enum",params:{allowedValues:rr.oneOf[0].properties.labelSide.enum},message:"must be equal to one of the allowed values"};t===null?t=[p]:t.push(p),s++}}}else{let l={instancePath:n,schemaPath:"#/oneOf/0/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[l]:t.push(l),s++}else if(c==="action")if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.type===void 0){let l={instancePath:n,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};t===null?t=[l]:t.push(l),s++}if(e.box===void 0){let l={instancePath:n,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty:"box"},message:"must have required property 'box'"};t===null?t=[l]:t.push(l),s++}if(e.label===void 0){let l={instancePath:n,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty:"label"},message:"must have required property 'label'"};t===null?t=[l]:t.push(l),s++}for(let l in e)if(!(l==="type"||l==="box"||l==="label")){let p={instancePath:n,schemaPath:"#/oneOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:l},message:"must NOT have additional properties"};t===null?t=[p]:t.push(p),s++}if(e.type!==void 0&&e.type!=="action"){let l={instancePath:n+"/type",schemaPath:"#/oneOf/1/properties/type/const",keyword:"const",params:{allowedValue:"action"},message:"must be equal to constant"};t===null?t=[l]:t.push(l),s++}if(e.box!==void 0){let l=e.box;if(typeof l=="string"){if(!Te.test(l)){let p={instancePath:n+"/box",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};t===null?t=[p]:t.push(p),s++}}else{let p={instancePath:n+"/box",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[p]:t.push(p),s++}}if(e.label!==void 0){let l=e.label;if(typeof l=="string"){if(ve(l)<1){let p={instancePath:n+"/label",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[p]:t.push(p),s++}}else{let p={instancePath:n+"/label",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[p]:t.push(p),s++}}}else{let l={instancePath:n,schemaPath:"#/oneOf/1/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[l]:t.push(l),s++}else if(c==="swap")if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.type===void 0){let l={instancePath:n,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};t===null?t=[l]:t.push(l),s++}if(e.box===void 0){let l={instancePath:n,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty:"box"},message:"must have required property 'box'"};t===null?t=[l]:t.push(l),s++}if(e.text===void 0){let l={instancePath:n,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty:"text"},message:"must have required property 'text'"};t===null?t=[l]:t.push(l),s++}for(let l in e)if(!(l==="type"||l==="box"||l==="text")){let p={instancePath:n,schemaPath:"#/oneOf/2/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:l},message:"must NOT have additional properties"};t===null?t=[p]:t.push(p),s++}if(e.type!==void 0&&e.type!=="swap"){let l={instancePath:n+"/type",schemaPath:"#/oneOf/2/properties/type/const",keyword:"const",params:{allowedValue:"swap"},message:"must be equal to constant"};t===null?t=[l]:t.push(l),s++}if(e.box!==void 0){let l=e.box;if(typeof l=="string"){if(!Te.test(l)){let p={instancePath:n+"/box",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};t===null?t=[p]:t.push(p),s++}}else{let p={instancePath:n+"/box",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[p]:t.push(p),s++}}if(e.text!==void 0){let l=e.text;if(typeof l=="string"){if(ve(l)<1){let p={instancePath:n+"/text",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[p]:t.push(p),s++}}else{let p={instancePath:n+"/text",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[p]:t.push(p),s++}}}else{let l={instancePath:n,schemaPath:"#/oneOf/2/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[l]:t.push(l),s++}else if(c==="commit")if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.type===void 0){let l={instancePath:n,schemaPath:"#/oneOf/3/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};t===null?t=[l]:t.push(l),s++}if(e.id===void 0){let l={instancePath:n,schemaPath:"#/oneOf/3/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'"};t===null?t=[l]:t.push(l),s++}if(e.branch===void 0){let l={instancePath:n,schemaPath:"#/oneOf/3/required",keyword:"required",params:{missingProperty:"branch"},message:"must have required property 'branch'"};t===null?t=[l]:t.push(l),s++}for(let l in e)if(!(l==="type"||l==="id"||l==="branch"||l==="copy"||l==="merge"||l==="hash"||l==="note")){let p={instancePath:n,schemaPath:"#/oneOf/3/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:l},message:"must NOT have additional properties"};t===null?t=[p]:t.push(p),s++}if(e.type!==void 0&&e.type!=="commit"){let l={instancePath:n+"/type",schemaPath:"#/oneOf/3/properties/type/const",keyword:"const",params:{allowedValue:"commit"},message:"must be equal to constant"};t===null?t=[l]:t.push(l),s++}if(e.id!==void 0){let l=e.id;if(typeof l=="string"){if(!Te.test(l)){let p={instancePath:n+"/id",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};t===null?t=[p]:t.push(p),s++}}else{let p={instancePath:n+"/id",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[p]:t.push(p),s++}}if(e.branch!==void 0){let l=e.branch;if(typeof l=="string"){if(!Te.test(l)){let p={instancePath:n+"/branch",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};t===null?t=[p]:t.push(p),s++}}else{let p={instancePath:n+"/branch",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[p]:t.push(p),s++}}if(e.copy!==void 0){let l=e.copy;if(typeof l=="string"){if(!Te.test(l)){let p={instancePath:n+"/copy",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};t===null?t=[p]:t.push(p),s++}}else{let p={instancePath:n+"/copy",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[p]:t.push(p),s++}}if(e.merge!==void 0){let l=e.merge;if(typeof l=="string"){if(!Te.test(l)){let p={instancePath:n+"/merge",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};t===null?t=[p]:t.push(p),s++}}else{let p={instancePath:n+"/merge",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[p]:t.push(p),s++}}if(e.hash!==void 0){let l=e.hash;if(typeof l=="string"){if(!or.test(l)){let p={instancePath:n+"/hash",schemaPath:"#/definitions/hash/pattern",keyword:"pattern",params:{pattern:"^[0-9a-f]{4,40}$"},message:'must match pattern "^[0-9a-f]{4,40}$"'};t===null?t=[p]:t.push(p),s++}}else{let p={instancePath:n+"/hash",schemaPath:"#/definitions/hash/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[p]:t.push(p),s++}}if(e.note!==void 0){let l=e.note;if(typeof l=="string"){if(ve(l)<1){let p={instancePath:n+"/note",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[p]:t.push(p),s++}}else{let p={instancePath:n+"/note",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[p]:t.push(p),s++}}}else{let l={instancePath:n,schemaPath:"#/oneOf/3/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[l]:t.push(l),s++}else if(c==="branch")if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.type===void 0){let l={instancePath:n,schemaPath:"#/oneOf/4/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};t===null?t=[l]:t.push(l),s++}if(e.branch===void 0){let l={instancePath:n,schemaPath:"#/oneOf/4/required",keyword:"required",params:{missingProperty:"branch"},message:"must have required property 'branch'"};t===null?t=[l]:t.push(l),s++}if(e.from===void 0){let l={instancePath:n,schemaPath:"#/oneOf/4/required",keyword:"required",params:{missingProperty:"from"},message:"must have required property 'from'"};t===null?t=[l]:t.push(l),s++}for(let l in e)if(!(l==="type"||l==="branch"||l==="from")){let p={instancePath:n,schemaPath:"#/oneOf/4/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:l},message:"must NOT have additional properties"};t===null?t=[p]:t.push(p),s++}if(e.type!==void 0&&e.type!=="branch"){let l={instancePath:n+"/type",schemaPath:"#/oneOf/4/properties/type/const",keyword:"const",params:{allowedValue:"branch"},message:"must be equal to constant"};t===null?t=[l]:t.push(l),s++}if(e.branch!==void 0){let l=e.branch;if(typeof l=="string"){if(!Te.test(l)){let p={instancePath:n+"/branch",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};t===null?t=[p]:t.push(p),s++}}else{let p={instancePath:n+"/branch",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[p]:t.push(p),s++}}if(e.from!==void 0){let l=e.from;if(typeof l=="string"){if(!Te.test(l)){let p={instancePath:n+"/from",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};t===null?t=[p]:t.push(p),s++}}else{let p={instancePath:n+"/from",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[p]:t.push(p),s++}}}else{let l={instancePath:n,schemaPath:"#/oneOf/4/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[l]:t.push(l),s++}else if(c==="strip"){let l=s,p=!1,v=s;if(e&&typeof e=="object"&&!Array.isArray(e)&&e.value===void 0){let w={instancePath:n,schemaPath:"#/oneOf/5/anyOf/0/required",keyword:"required",params:{missingProperty:"value"},message:"must have required property 'value'"};t===null?t=[w]:t.push(w),s++}var r=v===s;if(p=p||r,!p){let w=s;if(e&&typeof e=="object"&&!Array.isArray(e)&&e.tag===void 0){let b={instancePath:n,schemaPath:"#/oneOf/5/anyOf/1/required",keyword:"required",params:{missingProperty:"tag"},message:"must have required property 'tag'"};t===null?t=[b]:t.push(b),s++}var r=w===s;p=p||r}if(p)s=l,t!==null&&(l?t.length=l:t=null);else{let w={instancePath:n,schemaPath:"#/oneOf/5/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};t===null?t=[w]:t.push(w),s++}if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.type===void 0){let w={instancePath:n,schemaPath:"#/oneOf/5/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};t===null?t=[w]:t.push(w),s++}if(e.field===void 0){let w={instancePath:n,schemaPath:"#/oneOf/5/required",keyword:"required",params:{missingProperty:"field"},message:"must have required property 'field'"};t===null?t=[w]:t.push(w),s++}for(let w in e)if(!(w==="type"||w==="field"||w==="value"||w==="tag")){let d={instancePath:n,schemaPath:"#/oneOf/5/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:w},message:"must NOT have additional properties"};t===null?t=[d]:t.push(d),s++}if(e.type!==void 0&&e.type!=="strip"){let w={instancePath:n+"/type",schemaPath:"#/oneOf/5/properties/type/const",keyword:"const",params:{allowedValue:"strip"},message:"must be equal to constant"};t===null?t=[w]:t.push(w),s++}if(e.field!==void 0){let w=e.field;if(typeof w=="string"){if(ve(w)<1){let d={instancePath:n+"/field",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[d]:t.push(d),s++}}else{let d={instancePath:n+"/field",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[d]:t.push(d),s++}}if(e.value!==void 0){let w=e.value;if(typeof w=="string"){if(ve(w)<1){let d={instancePath:n+"/value",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[d]:t.push(d),s++}}else{let d={instancePath:n+"/value",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[d]:t.push(d),s++}}if(e.tag!==void 0){let w=e.tag;if(typeof w=="string"){if(ve(w)<1){let d={instancePath:n+"/tag",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[d]:t.push(d),s++}}else{let d={instancePath:n+"/tag",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[d]:t.push(d),s++}}}else{let w={instancePath:n,schemaPath:"#/oneOf/5/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[w]:t.push(w),s++}}else{let l={instancePath:n,schemaPath:"#/discriminator",keyword:"discriminator",params:{error:"mapping",tag:"type",tagValue:c},message:'value of tag "type" must be in oneOf'};t===null?t=[l]:t.push(l),s++}else{let l={instancePath:n,schemaPath:"#/discriminator",keyword:"discriminator",params:{error:"tag",tag:"type",tagValue:c},message:'tag "type" must be string'};t===null?t=[l]:t.push(l),s++}}else{let c={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[c]:t.push(c),s++}return Vt.errors=t,s===0}function Ht(e,{instancePath:n="",parentData:a,parentDataProperty:o,rootData:i=e}={}){let t=null,s=0;if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.title===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"title"},message:"must have required property 'title'"};t===null?t=[r]:t.push(r),s++}if(e.body===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"body"},message:"must have required property 'body'"};t===null?t=[r]:t.push(r),s++}if(e.events===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"events"},message:"must have required property 'events'"};t===null?t=[r]:t.push(r),s++}for(let r in e)if(!(r==="title"||r==="body"||r==="code"||r==="events")){let c={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:r},message:"must NOT have additional properties"};t===null?t=[c]:t.push(c),s++}if(e.title!==void 0){let r=e.title;if(typeof r=="string"){if(ve(r)<1){let c={instancePath:n+"/title",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[c]:t.push(c),s++}}else{let c={instancePath:n+"/title",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[c]:t.push(c),s++}}if(e.body!==void 0){let r=e.body;if(typeof r=="string"){if(ve(r)<1){let c={instancePath:n+"/body",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[c]:t.push(c),s++}}else{let c={instancePath:n+"/body",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[c]:t.push(c),s++}}if(e.code!==void 0){let r=e.code;if(typeof r=="string"){if(ve(r)<1){let c={instancePath:n+"/code",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[c]:t.push(c),s++}}else{let c={instancePath:n+"/code",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[c]:t.push(c),s++}}if(e.events!==void 0){let r=e.events;if(Array.isArray(r)){let c=r.length;for(let l=0;l<c;l++)Vt(r[l],{instancePath:n+"/events/"+l,parentData:r,parentDataProperty:l,rootData:i})||(t=t===null?Vt.errors:t.concat(Vt.errors),s=t.length)}else{let c={instancePath:n+"/events",schemaPath:"#/properties/events/type",keyword:"type",params:{type:"array"},message:"must be array"};t===null?t=[c]:t.push(c),s++}}}else{let r={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[r]:t.push(r),s++}return Ht.errors=t,s===0}function Yt(e,{instancePath:n="",parentData:a,parentDataProperty:o,rootData:i=e}={}){let t=null,s=0;if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.lifelines===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"lifelines"},message:"must have required property 'lifelines'"};t===null?t=[r]:t.push(r),s++}for(let r in e)if(r!=="lifelines"){let c={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:r},message:"must NOT have additional properties"};t===null?t=[c]:t.push(c),s++}if(e.lifelines!==void 0){let r=e.lifelines;if(Array.isArray(r)){if(r.length<1){let l={instancePath:n+"/lifelines",schemaPath:"#/properties/lifelines/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};t===null?t=[l]:t.push(l),s++}let c=r.length;for(let l=0;l<c;l++){let p=r[l];if(typeof p=="string"){if(!Te.test(p)){let v={instancePath:n+"/lifelines/"+l,schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};t===null?t=[v]:t.push(v),s++}}else{let v={instancePath:n+"/lifelines/"+l,schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[v]:t.push(v),s++}}}else{let c={instancePath:n+"/lifelines",schemaPath:"#/properties/lifelines/type",keyword:"type",params:{type:"array"},message:"must be array"};t===null?t=[c]:t.push(c),s++}}}else{let r={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[r]:t.push(r),s++}return Yt.errors=t,s===0}function Kt(e,{instancePath:n="",parentData:a,parentDataProperty:o,rootData:i=e}={}){let t=null,s=0;if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.from===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"from"},message:"must have required property 'from'"};t===null?t=[r]:t.push(r),s++}if(e.to===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"to"},message:"must have required property 'to'"};t===null?t=[r]:t.push(r),s++}for(let r in e)if(!(r==="from"||r==="to"||r==="label")){let c={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:r},message:"must NOT have additional properties"};t===null?t=[c]:t.push(c),s++}if(e.from!==void 0){let r=e.from;if(typeof r=="string"){if(!Te.test(r)){let c={instancePath:n+"/from",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};t===null?t=[c]:t.push(c),s++}}else{let c={instancePath:n+"/from",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[c]:t.push(c),s++}}if(e.to!==void 0){let r=e.to;if(typeof r=="string"){if(!Te.test(r)){let c={instancePath:n+"/to",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};t===null?t=[c]:t.push(c),s++}}else{let c={instancePath:n+"/to",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[c]:t.push(c),s++}}if(e.label!==void 0){let r=e.label;if(typeof r=="string"){if(ve(r)<1){let c={instancePath:n+"/label",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[c]:t.push(c),s++}}else{let c={instancePath:n+"/label",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[c]:t.push(c),s++}}}else{let r={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[r]:t.push(r),s++}return Kt.errors=t,s===0}function Xt(e,{instancePath:n="",parentData:a,parentDataProperty:o,rootData:i=e}={}){let t=null,s=0;if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.paths===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"paths"},message:"must have required property 'paths'"};t===null?t=[r]:t.push(r),s++}for(let r in e)if(r!=="paths"){let c={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:r},message:"must NOT have additional properties"};t===null?t=[c]:t.push(c),s++}if(e.paths!==void 0){let r=e.paths;if(Array.isArray(r)){if(r.length<1){let l={instancePath:n+"/paths",schemaPath:"#/properties/paths/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};t===null?t=[l]:t.push(l),s++}let c=r.length;for(let l=0;l<c;l++)Kt(r[l],{instancePath:n+"/paths/"+l,parentData:r,parentDataProperty:l,rootData:i})||(t=t===null?Kt.errors:t.concat(Kt.errors),s=t.length)}else{let c={instancePath:n+"/paths",schemaPath:"#/properties/paths/type",keyword:"type",params:{type:"array"},message:"must be array"};t===null?t=[c]:t.push(c),s++}}}else{let r={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[r]:t.push(r),s++}return Xt.errors=t,s===0}function zt(e,{instancePath:n="",parentData:a,parentDataProperty:o,rootData:i=e}={}){let t=null,s=0;if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.id===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'"};t===null?t=[r]:t.push(r),s++}for(let r in e)if(!(r==="id"||r==="note")){let c={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:r},message:"must NOT have additional properties"};t===null?t=[c]:t.push(c),s++}if(e.id!==void 0){let r=e.id;if(typeof r=="string"){if(!Te.test(r)){let c={instancePath:n+"/id",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};t===null?t=[c]:t.push(c),s++}}else{let c={instancePath:n+"/id",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[c]:t.push(c),s++}}if(e.note!==void 0){let r=e.note;if(typeof r=="string"){if(ve(r)<1){let c={instancePath:n+"/note",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[c]:t.push(c),s++}}else{let c={instancePath:n+"/note",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[c]:t.push(c),s++}}}else{let r={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[r]:t.push(r),s++}return zt.errors=t,s===0}function Ut(e,{instancePath:n="",parentData:a,parentDataProperty:o,rootData:i=e}={}){let t=null,s=0;if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.branches===void 0){let r={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"branches"},message:"must have required property 'branches'"};t===null?t=[r]:t.push(r),s++}for(let r in e)if(r!=="branches"){let c={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:r},message:"must NOT have additional properties"};t===null?t=[c]:t.push(c),s++}if(e.branches!==void 0){let r=e.branches;if(Array.isArray(r)){if(r.length<1){let l={instancePath:n+"/branches",schemaPath:"#/properties/branches/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};t===null?t=[l]:t.push(l),s++}let c=r.length;for(let l=0;l<c;l++)zt(r[l],{instancePath:n+"/branches/"+l,parentData:r,parentDataProperty:l,rootData:i})||(t=t===null?zt.errors:t.concat(zt.errors),s=t.length)}else{let c={instancePath:n+"/branches",schemaPath:"#/properties/branches/type",keyword:"type",params:{type:"array"},message:"must be array"};t===null?t=[c]:t.push(c),s++}}}else{let r={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[r]:t.push(r),s++}return Ut.errors=t,s===0}function Cn(e,{instancePath:n="",parentData:a,parentDataProperty:o,rootData:i=e}={}){let t=null,s=0,r=s,c=!0,l=s;if(e&&typeof e=="object"&&!Array.isArray(e)){let m;if(e.kind===void 0&&(m="kind")){let y={};t===null?t=[y]:t.push(y),s++}else if(e.kind!==void 0&&e.kind!=="sequence"){let y={};t===null?t=[y]:t.push(y),s++}}var p=l===s;s=r,t!==null&&(r?t.length=r:t=null);let v;if(p){let m=s;if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.sequence===void 0){let O={instancePath:n,schemaPath:"#/then/required",keyword:"required",params:{missingProperty:"sequence"},message:"must have required property 'sequence'"};t===null?t=[O]:t.push(O),s++}if(e.boxes!==void 0){let O=e.boxes;if(Array.isArray(O)&&O.length<1){let _={instancePath:n+"/boxes",schemaPath:"#/then/properties/boxes/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};t===null?t=[_]:t.push(_),s++}}if(e.steps!==void 0){let O=e.steps;if(Array.isArray(O)){let _=O.length;for(let Y=0;Y<_;Y++){let J=O[Y];if(J&&typeof J=="object"&&!Array.isArray(J)&&J.events!==void 0){let L=J.events;if(Array.isArray(L)){let C=L.length;for(let q=0;q<C;q++){let Q=L[q];if(Q&&typeof Q=="object"&&!Array.isArray(Q)&&Q.type!==void 0){let k=Q.type,K=s,X=s;if(!(k==="commit"||k==="branch")){let Z={};t===null?t=[Z]:t.push(Z),s++}var w=X===s;if(w){let Z={instancePath:n+"/steps/"+Y+"/events/"+q+"/type",schemaPath:"#/definitions/plainSteps/items/properties/events/items/properties/type/not",keyword:"not",params:{},message:"must NOT be valid"};t===null?t=[Z]:t.push(Z),s++}else s=K,t!==null&&(K?t.length=K:t=null)}}}}}}}if(e.state!==void 0){let O={instancePath:n+"/state",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};t===null?t=[O]:t.push(O),s++}if(e.git!==void 0){let O={instancePath:n+"/git",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};t===null?t=[O]:t.push(O),s++}}var p=m===s;c=p,v="then"}else{let m=s,y=s,O=!0,_=s;if(e&&typeof e=="object"&&!Array.isArray(e)){let L;if(e.kind===void 0&&(L="kind")){let C={};t===null?t=[C]:t.push(C),s++}else if(e.kind!==void 0&&e.kind!=="state"){let C={};t===null?t=[C]:t.push(C),s++}}var d=_===s;s=y,t!==null&&(y?t.length=y:t=null);let Y;if(d){let L=s;if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.boxes!==void 0){let q=e.boxes;if(Array.isArray(q)){if(q.length<1){let k={instancePath:n+"/boxes",schemaPath:"#/else/then/properties/boxes/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};t===null?t=[k]:t.push(k),s++}let Q=q.length;for(let k=0;k<Q;k++){let K=q[k];if(K&&typeof K=="object"&&!Array.isArray(K)&&K.id!==void 0){let X=K.id,Z=s,S=s;if(!(X==="start"||X==="finish")){let D={};t===null?t=[D]:t.push(D),s++}var b=S===s;if(b){let D={instancePath:n+"/boxes/"+k+"/id",schemaPath:"#/else/then/properties/boxes/items/properties/id/not",keyword:"not",params:{},message:"must NOT be valid"};t===null?t=[D]:t.push(D),s++}else s=Z,t!==null&&(Z?t.length=Z:t=null)}}}}if(e.steps!==void 0){let q=e.steps;if(Array.isArray(q)){let Q=q.length;for(let k=0;k<Q;k++){let K=q[k];if(K&&typeof K=="object"&&!Array.isArray(K)&&K.events!==void 0){let X=K.events;if(Array.isArray(X)){let Z=X.length;for(let S=0;S<Z;S++){let D=X[S];if(D&&typeof D=="object"&&!Array.isArray(D)&&D.type!==void 0){let I=D.type,F=s,V=s;if(!(I==="commit"||I==="branch")){let ne={};t===null?t=[ne]:t.push(ne),s++}var T=V===s;if(T){let ne={instancePath:n+"/steps/"+k+"/events/"+S+"/type",schemaPath:"#/definitions/plainSteps/items/properties/events/items/properties/type/not",keyword:"not",params:{},message:"must NOT be valid"};t===null?t=[ne]:t.push(ne),s++}else s=F,t!==null&&(F?t.length=F:t=null)}}}}}}}if(e.git!==void 0){let q={instancePath:n+"/git",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};t===null?t=[q]:t.push(q),s++}}var d=L===s;O=d,Y="then"}else{let L=s,C=s,q=!0,Q=s;if(e&&typeof e=="object"&&!Array.isArray(e)){let X;if(e.kind===void 0&&(X="kind")){let Z={};t===null?t=[Z]:t.push(Z),s++}else if(e.kind!==void 0&&e.kind!=="git"){let Z={};t===null?t=[Z]:t.push(Z),s++}}var x=Q===s;s=C,t!==null&&(C?t.length=C:t=null);let k;if(x){let X=s;if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.git===void 0){let S={instancePath:n,schemaPath:"#/else/else/then/required",keyword:"required",params:{missingProperty:"git"},message:"must have required property 'git'"};t===null?t=[S]:t.push(S),s++}if(e.state!==void 0){let S={instancePath:n+"/state",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};t===null?t=[S]:t.push(S),s++}if(e.regions!==void 0){let S={instancePath:n+"/regions",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};t===null?t=[S]:t.push(S),s++}}var x=X===s;q=x,k="then"}else{let X=s;if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.boxes!==void 0){let S=e.boxes;if(Array.isArray(S)&&S.length<1){let D={instancePath:n+"/boxes",schemaPath:"#/else/else/else/properties/boxes/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};t===null?t=[D]:t.push(D),s++}}if(e.steps!==void 0){let S=e.steps;if(Array.isArray(S)){let D=S.length;for(let I=0;I<D;I++){let F=S[I];if(F&&typeof F=="object"&&!Array.isArray(F)&&F.events!==void 0){let V=F.events;if(Array.isArray(V)){let ne=V.length;for(let oe=0;oe<ne;oe++){let ce=V[oe];if(ce&&typeof ce=="object"&&!Array.isArray(ce)&&ce.type!==void 0){let be=ce.type,le=s,pe=s;if(!(be==="commit"||be==="branch")){let ue={};t===null?t=[ue]:t.push(ue),s++}var $=pe===s;if($){let ue={instancePath:n+"/steps/"+I+"/events/"+oe+"/type",schemaPath:"#/definitions/plainSteps/items/properties/events/items/properties/type/not",keyword:"not",params:{},message:"must NOT be valid"};t===null?t=[ue]:t.push(ue),s++}else s=le,t!==null&&(le?t.length=le:t=null)}}}}}}}if(e.state!==void 0){let S={instancePath:n+"/state",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};t===null?t=[S]:t.push(S),s++}if(e.git!==void 0){let S={instancePath:n+"/git",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};t===null?t=[S]:t.push(S),s++}}var x=X===s;q=x,k="else"}if(!q){let X={instancePath:n,schemaPath:"#/else/else/if",keyword:"if",params:{failingKeyword:k},message:'must match "'+k+'" schema'};t===null?t=[X]:t.push(X),s++}var d=L===s;O=d,Y="else"}if(!O){let L={instancePath:n,schemaPath:"#/else/if",keyword:"if",params:{failingKeyword:Y},message:'must match "'+Y+'" schema'};t===null?t=[L]:t.push(L),s++}if(e&&typeof e=="object"&&!Array.isArray(e)&&e.sequence!==void 0){let L={instancePath:n+"/sequence",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};t===null?t=[L]:t.push(L),s++}var p=m===s;c=p,v="else"}if(!c){let m={instancePath:n,schemaPath:"#/if",keyword:"if",params:{failingKeyword:v},message:'must match "'+v+'" schema'};t===null?t=[m]:t.push(m),s++}if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.version===void 0){let m={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"version"},message:"must have required property 'version'"};t===null?t=[m]:t.push(m),s++}if(e.kind===void 0){let m={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"kind"},message:"must have required property 'kind'"};t===null?t=[m]:t.push(m),s++}if(e.title===void 0){let m={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"title"},message:"must have required property 'title'"};t===null?t=[m]:t.push(m),s++}if(e.boxes===void 0){let m={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"boxes"},message:"must have required property 'boxes'"};t===null?t=[m]:t.push(m),s++}if(e.steps===void 0){let m={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"steps"},message:"must have required property 'steps'"};t===null?t=[m]:t.push(m),s++}for(let m in e)if(!sr.call(an.properties,m)){let y={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:m},message:"must NOT have additional properties"};t===null?t=[y]:t.push(y),s++}if(e.version!==void 0){let m=e.version;if(!(typeof m=="number"&&!(m%1)&&!isNaN(m)&&isFinite(m))){let y={instancePath:n+"/version",schemaPath:"#/properties/version/type",keyword:"type",params:{type:"integer"},message:"must be integer"};t===null?t=[y]:t.push(y),s++}if(typeof m=="number"&&isFinite(m)&&(m<1||isNaN(m))){let y={instancePath:n+"/version",schemaPath:"#/properties/version/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1"};t===null?t=[y]:t.push(y),s++}}if(e.kind!==void 0){let m=e.kind;if(!(m==="sequence"||m==="architecture"||m==="state"||m==="git")){let y={instancePath:n+"/kind",schemaPath:"#/properties/kind/enum",keyword:"enum",params:{allowedValues:an.properties.kind.enum},message:"must be equal to one of the allowed values"};t===null?t=[y]:t.push(y),s++}}if(e.title!==void 0){let m=e.title;if(typeof m=="string"){if(ve(m)<1){let y={instancePath:n+"/title",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[y]:t.push(y),s++}}else{let y={instancePath:n+"/title",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[y]:t.push(y),s++}}if(e.view!==void 0){let m=e.view;if(!(m==="fixed"||m==="follow")){let y={instancePath:n+"/view",schemaPath:"#/properties/view/enum",keyword:"enum",params:{allowedValues:an.properties.view.enum},message:"must be equal to one of the allowed values"};t===null?t=[y]:t.push(y),s++}}if(e.regions!==void 0){let m=e.regions;if(Array.isArray(m)){let y=m.length;for(let O=0;O<y;O++)Ft(m[O],{instancePath:n+"/regions/"+O,parentData:m,parentDataProperty:O,rootData:i})||(t=t===null?Ft.errors:t.concat(Ft.errors),s=t.length)}else{let y={instancePath:n+"/regions",schemaPath:"#/properties/regions/type",keyword:"type",params:{type:"array"},message:"must be array"};t===null?t=[y]:t.push(y),s++}}if(e.boxes!==void 0){let m=e.boxes;if(Array.isArray(m)){let y=m.length;for(let O=0;O<y;O++)Gt(m[O],{instancePath:n+"/boxes/"+O,parentData:m,parentDataProperty:O,rootData:i})||(t=t===null?Gt.errors:t.concat(Gt.errors),s=t.length)}else{let y={instancePath:n+"/boxes",schemaPath:"#/properties/boxes/type",keyword:"type",params:{type:"array"},message:"must be array"};t===null?t=[y]:t.push(y),s++}}if(e.strip!==void 0&&(_t(e.strip,{instancePath:n+"/strip",parentData:e,parentDataProperty:"strip",rootData:i})||(t=t===null?_t.errors:t.concat(_t.errors),s=t.length)),e.steps!==void 0){let m=e.steps;if(Array.isArray(m)){if(m.length<1){let O={instancePath:n+"/steps",schemaPath:"#/properties/steps/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};t===null?t=[O]:t.push(O),s++}let y=m.length;for(let O=0;O<y;O++)Ht(m[O],{instancePath:n+"/steps/"+O,parentData:m,parentDataProperty:O,rootData:i})||(t=t===null?Ht.errors:t.concat(Ht.errors),s=t.length)}else{let y={instancePath:n+"/steps",schemaPath:"#/properties/steps/type",keyword:"type",params:{type:"array"},message:"must be array"};t===null?t=[y]:t.push(y),s++}}e.sequence!==void 0&&(Yt(e.sequence,{instancePath:n+"/sequence",parentData:e,parentDataProperty:"sequence",rootData:i})||(t=t===null?Yt.errors:t.concat(Yt.errors),s=t.length)),e.state!==void 0&&(Xt(e.state,{instancePath:n+"/state",parentData:e,parentDataProperty:"state",rootData:i})||(t=t===null?Xt.errors:t.concat(Xt.errors),s=t.length)),e.git!==void 0&&(Ut(e.git,{instancePath:n+"/git",parentData:e,parentDataProperty:"git",rootData:i})||(t=t===null?Ut.errors:t.concat(Ut.errors),s=t.length))}else{let m={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[m]:t.push(m),s++}return Cn.errors=t,s===0}var ar=["edge","action","swap","strip","commit","branch"],cr="#/definitions/absent/not",lr={regions:"sequence / architecture / state"},pr={carry:{field:"text",kind:"tag"}},dr=/\/boxes\/items\/properties\/id\/not$/u,fr=/\/events\/items\/properties\/type\/not$/u,mr=["commit","branch"],ln=e=>e.replaceAll("~","~0").replaceAll("/","~1"),ur=/^\^\[0-9a-f\]\{(\d+),(\d+)\}\$$/u;function hr(e){let n=/^\^\[\^(.+)\]\+\$$/u.exec(e)?.[1];if(n===void 0)return;let a=n.match(/\\.|[^\\]/gu)??[];return{space:a.includes("\\s"),chars:a.filter(o=>o!=="\\s").map(o=>o.replace(/^\\/u,""))}}var Dn=(e,n)=>n.filter(a=>a!==e&&a.schemaPath.startsWith(`${e.schemaPath}/`)&&(a.instancePath===e.instancePath||a.instancePath.startsWith(`${e.instancePath}/`)));function gr(e,n,a){let o=e.params,i=e.instancePath;switch(e.keyword){case"additionalProperties":{let t=String(o.additionalProperty);return{pointer:`${i}/${ln(t)}`,message:a.additionalProperties(t)}}case"required":{let t=String(o.missingProperty);return{pointer:`${i}/${ln(t)}`,message:a.required(t)}}case"not":{if(dr.test(e.schemaPath))return{pointer:i,message:a.reserved(mt)};if(fr.test(e.schemaPath))return{pointer:i,message:a.kindOnly(mr,"git")};let t=i.slice(i.lastIndexOf("/")+1);if(e.schemaPath===cr)return{pointer:i,message:a.not({field:t,kind:lr[t]??t})};let s=pr[t];return{pointer:s?`${i}/${s.field}`:i,message:a.not(s)}}case"anyOf":{let t=Dn(e,n),s=t.every(r=>r.keyword==="required")?t.map(r=>String(r.params.missingProperty)):[];return{pointer:i,message:a.anyOf(s)}}case"discriminator":{let t=String(o.tag);return{pointer:`${i}/${ln(t)}`,message:a.discriminator(t,ar)}}case"enum":return{pointer:i,message:a.enum(o.allowedValues.map(String))};case"type":return{pointer:i,message:a.type(String(o.type))};case"minLength":return{pointer:i,message:a.minLength(Number(o.limit))};case"pattern":{let t=ur.exec(String(o.pattern));return{pointer:i,message:t?a.hex(Number(t[1]),Number(t[2])):a.pattern(hr(String(o.pattern)))}}case"minItems":return{pointer:i,message:a.minItems(Number(o.limit))};case"minimum":return{pointer:i,message:a.minimum(Number(o.limit))};case"const":return{pointer:i,message:a.const(String(o.allowedValue))};case"oneOf":return{pointer:i,message:a.oneOf};default:return{pointer:i,message:e.message??e.keyword}}}function In(e,n={}){if(cn(e))return{ok:!0};let a=cn.errors??[],o=new Set(a.filter(s=>s.keyword==="anyOf").flatMap(s=>Dn(s,a))),i=Bt[n.lang??"ja"];return{ok:!1,errors:a.filter(s=>s.keyword!=="if"&&!o.has(s)).map(s=>gr(s,a,i))}}var Bn=1;function yr(e){if(typeof e!="object"||e===null)return;let n=e.version;return typeof n=="number"&&n>Bn?n:void 0}var br=(e,n)=>({pointer:"/version",message:Bt[n].newer(e,Bn)});function Fn(e,n={}){let a=yr(e);if(a!==void 0)return{ok:!1,errors:[br(a,n.lang??"ja")]};let o=In(e,n);return o.ok?{ok:!0,diagram:e,warnings:[]}:o}function xr(e){let n={edges:[],events:[],busy:0},a=ee.edgeAt,o,i=0;return e.events.forEach((t,s)=>{if(t.type==="commit"||t.type==="branch"){let r=a,c=r+ee.draw;n.edges.push({event:s,a:r,b:c,carries:!1,coin:!1,named:!1}),a=r+ee.stagger,o=c,i=0,n.busy=Math.max(n.busy,c)}else if(t.type==="edge"){let r=t.carry.kind!=="none",c=a,l=c+(r?ee.drawCarry:ee.draw);n.edges.push({event:s,a:c,b:l,carries:r,coin:t.carry.kind==="coin",named:t.label!==void 0}),a=c+ee.stagger,o=l,i=0,n.busy=Math.max(n.busy,l)}else if(t.type==="action")n.events.push({event:s,at:a}),n.busy=Math.max(n.busy,a+ee.action),a+=ee.action,i=0;else{let r=(o??a)+ee.change*i++;n.events.push({event:s,at:r}),n.busy=Math.max(n.busy,r)}}),n}function Gn(e){let n=e.steps.map(xr),a=[],o=ee.intro;e.steps.forEach((T,x)=>{let $=Math.min(ee.stepMax,Math.max(ee.stepMin,ee.stepBase+[...T.body].length*ee.perChar)),m=Math.max($,(n[x]?.busy??0)+ee.dwell);a.push({start:o,end:o+m}),o+=m});let t=Math.ceil(o+ee.outro),s=t-ee.tail,r=[],c=[],l=[],p=[];n.forEach((T,x)=>{let $=a[x],m=[];for(let y of T.edges){let O=$.start+y.a;r.push({step:x,event:y.event,start:O,drawn:$.start+y.b,end:$.end});let _=e.steps[x]?.events[y.event],Y=e.kind==="git"&&_?.type==="edge"&&_.carry.kind==="tag"&&_.carry.text===_.from;y.carries&&!Y&&p.push({step:x,event:y.event,who:y.coin?"coin":"main",a:O,b:$.start+y.b}),y.named&&m.push({step:x,event:y.event,start:O+ee.labelDelay,end:$.end})}if(m.forEach((y,O)=>{let _=m[O+2];_&&(y.end=Math.min(y.end,_.start))}),e.kind==="state")for(let y of m)y.after={start:y.end,end:s};c.push(...m);for(let y of T.events)l.push({step:x,event:y.event,at:$.start+y.at})});let v=a[0]?.start??0,w=p.some(T=>T.who==="main"),d=[];for(let T of["main","coin"]){let x=p.filter($=>$.who===T);x.forEach(($,m)=>{let y=x[m+1],O=m===0&&(T==="main"||!w);d.push({step:$.step,event:$.event,who:T,depart:$.a,arrive:$.b,start:O?Math.min(v,$.a):$.a,end:y?Math.max(y.a,$.b):s})})}d.sort((T,x)=>T.depart-x.depart);let b=e.kind==="state"?vr(e,r,s):void 0;return{total:t,last:s,steps:a,edges:r,carriers:d,labels:c,badges:a.map((T,x)=>({step:x,appears:T.start})),events:l,stills:a.map(T=>T.end-ee.still),...b?{states:b}:{}}}var wr=e=>mt.includes(e);function vr(e,n,a){let o=new Map,i=s=>{let r=o.get(s)??{box:s,lit:[]};return o.set(s,r),r},t;for(let s of n){let r=e.steps[s.step]?.events[s.event];if(!(r?.type!=="edge"||r.from===r.to)){if(t){let c=i(t.box);c.lit.push({start:t.since,end:s.start}),t.box===r.from&&c.done===void 0&&(c.done=s.start+ee.done),t=void 0}wr(r.to)||(t={box:r.to,since:s.drawn})}}return t&&i(t.box).lit.push({start:t.since,end:a}),[...o.values()]}var wt={app:"M -9 -7 h18 a2 2 0 0 1 2 2 v10 a2 2 0 0 1 -2 2 h-18 a2 2 0 0 1 -2 -2 v-10 a2 2 0 0 1 2 -2 z M -11 -2 h22",router:"M -9 -4 h16 M 3 -8 l4 4 l-4 4 M 9 5 h-16 M -3 1 l-4 4 l4 4",on:"M -7 7 L 7 -7 M -1 -7 h8 v8",off:"M -7 -7 L 7 7 M 7 -1 v8 h-8",pool:"M -9 -5 a9 3.5 0 1 0 18 0 a9 3.5 0 1 0 -18 0 M -9 -5 v10 a9 3.5 0 0 0 18 0 v-10 M -9 0 a9 3.5 0 0 0 18 0",db:"M -9 -5 a9 3.5 0 1 0 18 0 a9 3.5 0 1 0 -18 0 M -9 -5 v10 a9 3.5 0 0 0 18 0 v-10 M -9 0 a9 3.5 0 0 0 18 0",exe:"M -5 -8 L 7 0 L -5 8 Z",idx:"M -9 -7 h18 M -9 -2 h18 M -9 3 h18 M -9 8 h11",sign:"M -9 4 c 3 -9 5 -9 6 0 s 3 7 6 -2 s 3 -6 6 0",env:"M -8 -5.5 h16 v11 h-16 z M -8 -5.5 l8 6 l8 -6",lock:"M -5.5 -1 h11 v8 h-11 z M -3.5 -1 v-3 a3.5 3.5 0 0 1 7 0 v3",check:"M -5 0 l3.5 3.5 l6.5 -7",x:"M -5 -5 l10 10 M 5 -5 l-10 10",chain:"M -1.5 4.5 l-2 2 a3.5 3.5 0 0 1 -5 -5 l3 -3 a3.5 3.5 0 0 1 5 0 M 1.5 -4.5 l2 -2 a3.5 3.5 0 0 1 5 5 l-3 3 a3.5 3.5 0 0 1 -5 0 M -2.5 2.5 l5 -5",net:"M -1.3 -4.6 L -5.8 3 M 1.3 -4.6 L 5.8 3 M -4.3 5.5 H 4.3 M -2.2 -7 a 2.2 2.2 0 1 0 4.4 0 a 2.2 2.2 0 1 0 -4.4 0 M -9.2 5.5 a 2.2 2.2 0 1 0 4.4 0 a 2.2 2.2 0 1 0 -4.4 0 M 4.8 5.5 a 2.2 2.2 0 1 0 4.4 0 a 2.2 2.2 0 1 0 -4.4 0",user:"M -4 -4.5 a4 4 0 1 0 8 0 a4 4 0 1 0 -8 0 M -8 9 c0 -5 3.6 -7.5 8 -7.5 s8 2.5 8 7.5",server:"M -9 -8 h18 v7 h-18 z M -9 1 h18 v7 h-18 z M -5 -4.5 h0.01 M -5 4.5 h0.01",key:"M -9 0 a3.5 3.5 0 1 0 7 0 a3.5 3.5 0 1 0 -7 0 M -2 0 h10 M 5 0 v3.5 M 8 0 v2.5",shield:"M 0 -9 l8 3 v5 c0 5 -3.5 8 -8 10 c-4.5 -2 -8 -5 -8 -10 v-5 z",globe:"M -9 0 a9 9 0 1 0 18 0 a9 9 0 1 0 -18 0 M -9 0 h18 M 0 -9 c-4.5 4 -4.5 14 0 18 M 0 -9 c4.5 4 4.5 14 0 18",bolt:"M 2 -9 L -5 1 h5 l-2 8 l7 -10 h-5 z",doc:"M -6 -9 h8 l5 5 v13 h-13 z M 2 -9 v5 h5 M -3 1 h7 M -3 5 h5",box:"M -9 -4.5 l9 -4.5 l9 4.5 v9 l-9 4.5 l-9 -4.5 z M -9 -4.5 l9 4.5 l9 -4.5 M 0 0 v9",truck:"M -10 -6 h11 v10 h-11 z M 1 -2 h5 l3.5 3.5 v2.5 h-8.5 M -7.5 6.5 a1.8 1.8 0 1 0 3.6 0 a1.8 1.8 0 1 0 -3.6 0 M 3 6.5 a1.8 1.8 0 1 0 3.6 0 a1.8 1.8 0 1 0 -3.6 0",card:"M -9 -6.5 h18 a2 2 0 0 1 2 2 v9 a2 2 0 0 1 -2 2 h-18 a2 2 0 0 1 -2 -2 v-9 a2 2 0 0 1 2 -2 z M -11 -2 h22 M -7 3 h5",cart:"M -10 -8 h3 l3 11 h11 l2.5 -8 h-15.5 M -4.5 7.5 a1.5 1.5 0 1 0 3 0 a1.5 1.5 0 1 0 -3 0 M 5 7.5 a1.5 1.5 0 1 0 3 0 a1.5 1.5 0 1 0 -3 0",clock:"M -9 0 a9 9 0 1 0 18 0 a9 9 0 1 0 -18 0 M 0 -5 v5 l3.5 2.5",branch:"M -4 -4.5 v9 M 5 0.5 c0 4 -9 3 -9 6.5 M -6.2 -7 a2.2 2.2 0 1 0 4.4 0 a2.2 2.2 0 1 0 -4.4 0 M -6.2 7 a2.2 2.2 0 1 0 4.4 0 a2.2 2.2 0 1 0 -4.4 0 M 2.8 -2 a2.2 2.2 0 1 0 4.4 0 a2.2 2.2 0 1 0 -4.4 0",cloud:"M -7 6 h13 a4.5 4.5 0 0 0 0.5 -9 a6 6 0 0 0 -11.5 -1 a4.5 4.5 0 0 0 -2 10 z",refresh:"M 7 -3 a7.5 7.5 0 1 0 0.5 5 M 7.5 -8 v5 h-5",undo:"M -7 -2 h10 a5 5 0 0 1 0 10 h-6 M -3 -6 l-4 4 l4 4",yen:"M -6 -8 l6 7 l6 -7 M 0 -1 v9 M -5 1.5 h10 M -5 5 h10",layers:"M 0 -8 l9 4.5 l-9 4.5 l-9 -4.5 z M -9 2.5 l9 4.5 l9 -4.5",code:"M -4 -6 l-5 6 l5 6 M 4 -6 l5 6 l-5 6",paint:"M -8 8 c 0 -3 2 -5 4.5 -5 l 9 -9 l 3.5 3.5 l -9 9 c 0 2.5 -2 4.5 -5 4.5 z",block:"M -9 -7 h18 a2 2 0 0 1 2 2 v10 a2 2 0 0 1 -2 2 h-18 a2 2 0 0 1 -2 -2 v-10 a2 2 0 0 1 2 -2 z M -11 -2.5 h22 M -6 2.5 h8"};var st=[[0,Number.POSITIVE_INFINITY]],pn=.5,_n=(e,n)=>e.shown.some(([a,o])=>a<=n&&n<o),dn=e=>({text:e.text,rect:{x:e.rect.x,y:e.rect.y,w:e.rect.w,h:e.rect.h},badge:e.badge===!0,...e.part?{part:e.part}:{}});function Wn(e,n,a=[]){let o=[];return n.forEach((i,t)=>{let s=e.filter(c=>_n(c,i));s.forEach((c,l)=>{for(let p of s.slice(l+1)){let v=Math.min(c.rect.x+c.rect.w,p.rect.x+p.rect.w)-Math.max(c.rect.x,p.rect.x),w=Math.min(c.rect.y+c.rect.h,p.rect.y+p.rect.h)-Math.max(c.rect.y,p.rect.y);v>pn&&w>pn&&o.push({kind:"texts",step:t,texts:[c.text,p.text],spots:[dn(c),dn(p)]})}});let r=a.filter(c=>_n(c,i));for(let c of s)if(!c.boxed)for(let l of r)qt(l.points,c.rect,pn)&&o.push({kind:"line",step:t,text:c.text,line:{from:l.from,to:l.to},spots:[dn(c)]})}),o}var Pe=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),R=e=>Math.round(e*100)/100,ye=e=>e==="coin"?"--c:var(--coin);--ct:var(--coint)":`--c:var(--c-${e});--ct:var(--t-${e})`;function vt(e,n,a,o,i="dg-gl"){let t=e===void 0?void 0:wt[e];return t?`<path class="${i}" transform="translate(${R(n)} ${R(a)}) scale(${o})" d="${t}"/>`:""}function $t(e){let n=e.filter((t,s)=>s===0||t[0]!==e[s-1][0]||t[1]!==e[s-1][1]),[a,o]=n[0],i=`M ${R(a)} ${R(o)}`;for(let t=1;t<n.length-1;t++){let[s,r]=n[t-1],[c,l]=n[t],[p,v]=n[t+1],w=Math.hypot(c-s,l-r),d=Math.hypot(p-c,v-l),b=Math.min(g.edge.bend,w/2,d/2);i+=` L ${R(c-(c-s)/w*b)} ${R(l-(l-r)/w*b)} Q ${R(c)} ${R(l)} ${R(c+(p-c)/d*b)} ${R(l+(v-l)/d*b)}`}if(n.length>1){let[t,s]=n[n.length-1];i+=` L ${R(t)} ${R(s)}`}return i}function Vn(e){let[n,a]=e[e.length-1],[o,i]=e[e.length-2],t=Math.hypot(n-o,a-i)||1,s=(n-o)/t,r=(a-i)/t,{arrow:c,arrowHalf:l}=g.edge;return`M ${R(n-s*c-r*l)} ${R(a-r*c+s*l)} L ${R(n)} ${R(a)} L ${R(n-s*c+r*l)} ${R(a-r*c-s*l)}`}function je(e,n,a,o,i,t,s=st,r){return e?.push({text:i,rect:ze(i,a,o,t,r),shown:s}),`<text class="${n}" x="${R(a)}" y="${R(o)}"${r?` text-anchor="${r}"`:""}>${Pe(i)}</text>`}function Hn(e,n){let a=[[0,{opacity:0}]];for(let[o,i]of n)a.push([o,{opacity:0},de.out],[o+ee.fade,{opacity:1}],[i-.1,{opacity:1},de.inOut],[i+.25,{opacity:0}]);return a.push([e.total,{opacity:0}]),e.kf(a)}function Yn(e,n){let a=[];for(let o=0;o<n.length;){let i=o;for(;i+1<n.length&&n[i+1]===n[i]+1;)i++;a.push([e.t.steps[n[o]].start,e.t.steps[n[i]].end]),o=i+1}return Hn(e.m,a)}function Kn(e,n){let{radius:a,icon:o,iconRadius:i,iconScale:t,nameY:s,line:r}=g.region,{x:c,y:l}=e.header,p=e.lines.map((d,b)=>je(n,"dg-bz",c,e.y+s+b*r,d,E.regionName)).join(""),v=e.note?je(n,"dg-bx",c,e.y+s+e.lines.length*r+1,e.note,E.regionNote):"",w=e.icon&&wt[e.icon]?`<rect class="dg-bi" x="${R(c)}" y="${R(l)}" width="${o}" height="${o}" rx="${i}"/>${vt(e.icon,c+o/2,l+o/2,t)}`:"";return`<g style="${ye(e.color)}"><rect class="dg-band" x="${R(e.x+.5)}" y="${R(e.y+.5)}" width="${R(e.w-1)}" height="${R(e.h-1)}" rx="${a}"/>${w}${p}${v}</g>`}function Xn(e,n,a,o,i){let t=[[0,e.sub??"","dg-ss"],...a];return t.map(([s,r,c],l)=>{let p=t[l+1]?.[0],v=l===0?p===void 0?"":n.until(p-ee.untilFade):p===void 0?n.rise(s):n.rise(s,p-ee.untilFade);if(r==="")return"";let w=[[l===0?0:s,p===void 0?Number.POSITIVE_INFINITY:p-ee.untilFade]];return`<g${v?` class="dg-a" style="${v}"`:""}>${je(i,c,e.cx,o,r,c==="dg-ss"?E.boxSub:E.boxSubStrong,w,"middle")}</g>`}).join("")}function zn(e,n,a,o,i){let t=(s,r="")=>`<rect class="${s}" x="${R(e.x)}" y="${R(o)}" width="${R(e.w)}" height="${i}" rx="${g.box.radius}"${r}/>`;return`${a?`<g class="dg-a" style="${a}">${t("dg-halo")}</g>`:""}${t("dg-st",` ${n.sh}`)}${a?`<g class="dg-a" style="${a}">${t("dg-on")}</g>`:""}`}function Un(e,n,a,o,i){let{icon:t,iconRadius:s,iconScale:r,iconY:c,nameY:l,subY:p}=g.box,v=Xn(e,n.m,o,e.cy+p,n.ink),w=i?i.length>0?Hn(n.m,i.map(x=>[x.start,x.end])):void 0:a.length>0?Yn(n,a):void 0,d=e.iconX??e.cx,b=e.slot?`<rect class="dg-slot" x="${R(e.slot.x)}" y="${R(e.slot.y)}" width="${R(e.slot.w)}" height="${R(e.slot.h)}" rx="${g.slot.radius}"/>`:"",T="";if(e.icon&&wt[e.icon]){let x={x:d-t/2,y:e.cy+c-t/2,w:t,h:t};n.ink.push({text:`${e.name} \u306E\u7D75\u67C4`,rect:x,shown:st,boxed:!0,part:{kind:"icon",box:e.name}}),T=`<rect class="dg-ic" x="${R(x.x)}" y="${R(x.y)}" width="${t}" height="${t}" rx="${s}"/>${vt(e.icon,d,e.cy+c,r)}`}return`<g style="${ye(e.color)}">${zn(e,n,w,e.y,e.h)}${b}${T}${je(n.ink,"dg-sn",e.cx,e.cy+l,e.name,E.boxName,st,"middle")}${v}</g>`}function Jn(e,n,a,o){let{pad:i,h:t,nameY:s,subY:r}=g.follow.head,c=Xn(e,n.m,o,i+r),l=a.length>0?Yn(n,a):void 0;return`<g style="${ye(e.color)}">${zn(e,n,l,i,t)}<text class="dg-sn" x="${R(e.cx)}" y="${R(i+s)}" text-anchor="middle">${Pe(e.name)}</text>${c}</g>`}function Zn(e,n){let{icon:a,iconRadius:o,iconScale:i,radius:t}=g.box,s=g.state.ghost,r=e.x+s.pad+a/2,c=e.x+s.pad+a+s.gap,l=e.icon&&wt[e.icon]?`<rect class="dg-ic" x="${R(r-a/2)}" y="${R(e.cy-a/2)}" width="${a}" height="${a}" rx="${o}"/>${vt(e.icon,r,e.cy,i)}`:"",p=e.sub?s.nameY:g.baseline.mark,v=e.sub?je(n,"dg-ss",c,e.cy+s.subY,e.sub,E.boxSub,st,"start"):"";return`<g data-ghost="${Pe(e.id)}" style="${ye(e.color)}"><rect class="dg-ghost" x="${R(e.x)}" y="${R(e.y)}" width="${R(e.w)}" height="${e.h}" rx="${t}"/>${l}${je(n,"dg-sn",c,e.cy+p,e.name,E.boxName,st,"start")}${v}</g>`}function Qn(e,n,a){let{r:o,inset:i}=g.state.done,t=e.x+e.w-i,s=e.y+i;return`<g class="dg-popc dg-a" data-done="${Pe(e.id)}" style="${ye(e.color)};${a.m.pop(n)}"><circle class="dg-done" cx="${R(t)}" cy="${R(s)}" r="${o}"/>${vt("check",t,s,.5,"dg-done-ck")}</g>`}function es(e,n,a,o){o.push({from:e.from,to:e.to,points:e.points,shown:st});let i=e.label?.family==="sans",t=e.label?je(a,`dg-path-t${i?" dg-path-tj":""}`,e.label.x+g.label.padX,e.label.y+e.label.h/2+g.baseline.label,e.label.text,i?E.labelJa:E.label):"";return`<g data-path="${Pe(`${e.from}->${e.to}`)}" style="${ye(n)}"><path class="dg-path" d="${$t(e.points)}"/><path class="dg-path-h" d="${Vn(e.points)}"/>${t}</g>`}function ts(e,n,a){let{pad:o}=g.state.side,i=e.y+o+E.regionName.size,t=e.notes.map((s,r)=>je(a,"dg-side-n",e.x+o,i+g.region.line*(r+1),s,E.regionNote)).join("");return`<g style="${ye(n)}"><rect class="dg-side" x="${R(e.x+.5)}" y="${R(e.y+.5)}" width="${R(e.w-1)}" height="${R(e.h-1)}" rx="${g.region.radius}"/>${je(a,"dg-side-t",e.x+o,i,e.title,E.regionName)}${t}</g>`}function ns(e,n,a){let{end:o}=g.state,i=Ct(e),t=e.text===""?"":je(a,"dg-mark",i[0],i[1],e.text,E.regionNote),s=R(e.x),r=R(e.y);return e.kind==="start"?`<g data-end="start"><circle class="dg-start" cx="${s}" cy="${r}" r="${e.r}"/>${t}</g>`:e.ghost?`<g data-end="finish" style="${ye(n)}"><circle class="dg-end-x" cx="${s}" cy="${r}" r="${e.r}"/><circle class="dg-end-xi" cx="${s}" cy="${r}" r="${o.inner}"/>${t}</g>`:`<g data-end="finish"><circle class="dg-end" cx="${s}" cy="${r}" r="${e.r}"/><circle class="dg-end-in" cx="${s}" cy="${r}" r="${o.inner}"/>${t}</g>`}function ss(e,n,a){return`<line class="dg-ll" x1="${R(e)}" y1="${R(n)}" x2="${R(e)}" y2="${R(a)}"/>`}function rs(e,n,a,o=!1){let{m:i}=a;a.traces.push({from:e.from,to:e.to,points:e.points,shown:st});let t=$t(e.points),s=Vn(e.points),{start:r,drawn:c,end:l}=n,p=o?[[l,{opacity:1},de.inOut],[l+.4,{opacity:0}],[i.total,{opacity:0}]]:[[l,{opacity:1},de.inOut],[l+.4,{opacity:.45}],[a.end+.3,{opacity:.45},de.inOut],[a.end+1,{opacity:.95}],[i.last,{opacity:.95},de.inOut],[i.total,{opacity:0}]],v=i.kf([[0,{opacity:0,"stroke-dashoffset":1}],[r,{opacity:0,"stroke-dashoffset":1},de.inOut],[r+.05,{opacity:1}],[c,{"stroke-dashoffset":0}],[i.last,{"stroke-dashoffset":0}],[i.total,{"stroke-dashoffset":1}],...p]),w=i.kf([[0,{opacity:0}],[c-.05,{opacity:0}],[c,{opacity:1}],...p]),d=-(l-c)*26,b=i.kf([[0,{opacity:0,"stroke-dashoffset":0}],[c,{opacity:0,"stroke-dashoffset":0}],[c+.25,{opacity:.9}],[l-.1,{opacity:.9},de.inOut],[l+.2,{opacity:0,"stroke-dashoffset":d}],[i.total,{opacity:0,"stroke-dashoffset":d}]]),T=o?i.kf([[0,{opacity:0}],[l,{opacity:0},de.inOut],[l+.4,{opacity:1}],[i.last,{opacity:1},de.inOut],[i.total,{opacity:0}]]):"";return{base:`<path class="dg-e" d="${t}"/><path class="dg-eh" d="${s}"/>${o?`<path class="dg-e-past dg-a" d="${t}" style="${T}"/><path class="dg-eh-past dg-a" d="${s}" style="${T}"/>`:""}`,lit:`<g style="${ye(e.color)}"><path class="dg-e-on dg-a" pathLength="1" d="${t}" style="${v}"/><path class="dg-eh-on dg-a" d="${s}" style="${w}"/><path class="dg-flow dg-a" d="${t}" style="${b}"/></g>`}}function os(e,n,a){let o=e.family==="sans"?" dg-capj":"",{radius:i}=g.label;a.ink.push({text:e.text,rect:e,shown:[[n.start,n.end]],boxed:!0}),n.after&&a.ink.push({text:e.text,rect:ze(e.text,e.x+e.w/2,e.y+e.h/2+g.baseline.label,e.family==="sans"?E.labelJa:E.label,"middle"),shown:[[n.after.start,n.after.end]]});let t=R(e.x+e.w/2),s=R(e.y+e.h/2+g.baseline.label);return`${n.after?`<g class="dg-cap-past${e.family==="sans"?" dg-cap-pastj":""} dg-a" style="${a.m.vis(n.after.start,n.after.end)}"><text x="${t}" y="${s}" text-anchor="middle">${Pe(e.text)}</text></g>`:""}<g class="dg-cap${o} dg-a" style="${ye(e.color)};${a.m.rise(n.start,n.end,!0)}"><rect x="${R(e.x)}" y="${R(e.y)}" width="${R(e.w)}" height="${e.h}" rx="${i}"/><text x="${t}" y="${s}" text-anchor="middle">${Pe(e.text)}</text></g>`}function is(e,n,a,o){return o.ink.push({text:e.text,rect:e,shown:[[n,a]],boxed:!0}),`<g class="dg-act dg-a" style="${ye(e.color)};${o.m.rise(n,a,!0)}"><rect x="${R(e.x)}" y="${R(e.y)}" width="${R(e.w)}" height="${e.h}" rx="${g.action.radius}"/><text x="${R(e.x+e.w/2)}" y="${R(e.y+e.h/2+g.baseline.action)}" text-anchor="middle">${Pe(e.text)}</text></g>`}function $r(e,n){let a=g.carrier;if(e.carry.kind==="coin")return`<circle class="dg-coin" r="${a.coinR}"/><circle class="dg-coin-in" r="${a.coinIn}"/>`;if(e.carry.kind==="tag"){let o=e.carry.text,i=Re(o),t=se(o,i?E.carrierJa:E.carrier)+a.tagPadX*2;return`<rect class="dg-car" x="${R(-t/2)}" y="${-a.tagH/2}" width="${R(t)}" height="${a.tagH}" rx="${a.tagH/2}" ${n}/><text class="dg-car-t${i?" dg-car-tj":""}" y="${g.baseline.carrier}" text-anchor="middle">${Pe(o)}</text>`}return`<rect class="dg-env" x="${-a.envW/2}" y="${-a.envH/2}" width="${a.envW}" height="${a.envH}" rx="3" ${n}/><path class="dg-env-in" d="M -8 -4.5 L 0 1.5 L 8 -4.5"/>`}var kr=e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2;function Jt(e,n,a){let{m:o}=a,i=g.carrier.samples,t=e.wait?[e.wait,...e.points]:e.points,s=pt(t),{depart:r,arrive:c,start:l,end:p}=n,v=[];for(let Y=0;Y<=i;Y++){let[J,L]=He(t,kr(Y/i)*s);v.push([r+(c-r)*Y/i,J,L])}let w=v[0],d=v[v.length-1],b=e.settle??[d[1],d[2]],T=[[0,w[1],w[2]],...v];e.settle&&T.push([Math.min(c+.3,Math.max(p,c+.01)),b[0],b[1]]),T.push([p,b[0],b[1]],[o.total,b[0],b[1]]);let[x,$]=Ze(e.carry),m=e.carry.kind==="tag"?e.carry.text:e.carry.kind==="coin"?"\u786C\u8CA8":"\u5C01\u7B52",y=e.carry.kind==="tag"?{}:{part:{kind:e.carry.kind==="coin"?"coin":"envelope"}},O=Y=>({x:Y[0]-x,y:Y[1]-$,w:x*2,h:$*2});r>l&&a.ink.push({text:m,rect:O([w[1],w[2]]),shown:[[l,r]],boxed:!0,...y}),a.ink.push({text:m,rect:O(b),shown:[[c,p]],boxed:!0,...y});let _=p<o.last?.05:.18;return`<g class="dg-a" style="${o.move(T,o.blink(l+.02,p,_))}">${$r(e,a.sh)}</g>`}function as(e,n,a=!1){let{m:o}=n,i=n.t.steps[e.step],t=i.start,s=i.end,{r,ring:c}=g.badge,l={visibility:"visible"},p={visibility:"hidden"},v=e.until===void 0?void 0:n.t.steps[e.until].start,w=v!==void 0&&v<=s+1e-6,d=o.kf([[0,{opacity:0,transform:"scale(.5)",...p}],[t,{opacity:0,transform:"scale(.5)",...p},de.pop],[t+.35,{opacity:1,transform:"scale(1)",...l}],[s,{opacity:1,transform:"scale(1)",...l},de.inOut],[s+(w?ee.untilFade:.4),{opacity:0,transform:"scale(1)",...p}],[o.total,{opacity:0,transform:"scale(.5)",...p}]]),b=v??o.last,T=w?o.kf([[0,{opacity:0,...p}],[o.total,{opacity:0,...p}]]):o.kf([[0,{opacity:0,...p}],[s,{opacity:0,...p},de.inOut],[s+.4,{opacity:1,...l}],[b,{opacity:1,...l},de.inOut],...v===void 0?[]:[[v+ee.untilFade,{opacity:0,...p}]],[o.total,{opacity:0,...p}]]),x=o.kf([[0,{opacity:0,transform:"scale(1)"}],[t+.05,{opacity:0,transform:"scale(1)"}],[t+.1,{opacity:.7,transform:"scale(1)"},de.out],[t+.9,{opacity:0,transform:"scale(2.3)"}],[o.total,{opacity:0,transform:"scale(1)"}]]),$=R(e.x),m=R(e.y),y=R(e.y+g.baseline.badge),O=e.step+1;return n.ink.push({text:String(O),rect:{x:e.x-r,y:e.y-r,w:r*2,h:r*2},shown:[[t,b]],boxed:!0,badge:!0}),`<g class="dg-bd" data-step="${e.step}" style="${ye(e.color)}"><circle class="dg-bdr dg-popc dg-a" cx="${$}" cy="${m}" r="${c}" style="${x}"/><g class="dg-a" style="${T}"><circle class="${a?"dg-bdp-g":"dg-bdp"}" cx="${$}" cy="${m}" r="${c}"/><text class="${a?"dg-bdpt-g":"dg-bdpt"}" x="${$}" y="${y}" text-anchor="middle">${O}</text></g><g class="dg-popc dg-a" style="${d}"><circle class="dg-bdf" cx="${$}" cy="${m}" r="${r}"/><text class="dg-bdft" x="${$}" y="${y}" text-anchor="middle">${O}</text></g></g>`}function cs(e,n,a,o=!1,i=new Map){let{m:t,sh:s}=a,r=g.strip,c=e.y+r.h/2,l=[`<rect class="dg-strip" x="${R(e.x+.5)}" y="${R(e.y+.5)}" width="${R(e.w-1)}" height="${R(e.h-1)}" rx="${g.region.radius}" ${s}/>`,`<g style="${ye("slate")}"><rect class="dg-bi" x="${R(e.x+r.pad)}" y="${R(c-r.icon/2)}" width="${r.icon}" height="${r.icon}" rx="${g.box.iconRadius}"/>${vt("env",e.x+r.pad+r.icon/2,c,.78)}</g>`,je(a.ink,"dg-sh",e.x+r.titleX,c+g.baseline.stripTitle,e.title,E.stripTitle)];if(e.fields.forEach((p,v)=>{let w=e.fields[v-1];if(w&&w.y===p.y){let x=p.x-r.fieldGap/2;l.push(`<line class="dg-sep" x1="${R(x)}" y1="${R(p.y+r.sepInset)}" x2="${R(x)}" y2="${R(p.y+r.h-r.sepInset)}"/>`)}l.push(je(a.ink,"dg-fl",p.x,p.y+r.nameY,p.name,E.fieldName));let d=n.get(p.name)??[],b=d.filter(x=>x.value!==void 0),T=d.filter(x=>x.tag!==void 0);b.forEach((x,$)=>{let m=b[$+1]?.at,y=x.value,O=Re(y)?"dg-fvj":"dg-fv";a.ink.push({text:y,rect:ze(y,p.x,p.y+r.valueY,Re(y)?E.fieldValueJa:E.fieldValue),shown:[[x.at,m===void 0?Number.POSITIVE_INFINITY:m-ee.untilFade]]});let _=C=>`<text class="${C}" x="${R(p.x)}" y="${R(p.y+r.valueY)}">${Pe(y)}</text>`,Y=_(O);if(!o){let C=m===void 0?t.rise(x.at):t.rise(x.at,m-ee.untilFade);l.push(`<g class="dg-a" style="${C}">${Y}</g>`);return}let J=Math.min(x.until,m??x.until),L=`<circle class="dg-fl-now" cx="${R(p.x+se(p.name,E.fieldName)+r.now.gap)}" cy="${R(p.y+r.nameY-E.fieldName.size/3)}" r="${r.now.r}"/>`;l.push(`<g class="dg-fv-now dg-a" data-step="${x.step}" style="${ye(x.color)};${t.rise(x.at,J-ee.untilFade)}">${_(`${O} dg-fv-c`)}${L}</g>`),(m===void 0||m>J)&&l.push(`<g class="dg-a" style="${t.vis(J-ee.untilFade,m===void 0?t.last:m-ee.untilFade)}">${Y}</g>`)}),T.forEach((x,$)=>{let m=T[$+1]?.at,y=x.tag,O=[...b].reverse().find(L=>L.at<=x.at+1e-9)?.value,_=p.x+(O?se(O,Re(O)?E.fieldValueJa:E.fieldValue)+r.tagGap:0),Y=se(y,E.tag)+r.tagPadX*2,J=p.y+r.valueY-r.tagH/2-g.baseline.tag;a.ink.push({text:y,rect:{x:_,y:J,w:Y,h:r.tagH},shown:[[x.at,m===void 0?Number.POSITIVE_INFINITY:m-ee.untilFade]],boxed:!0}),l.push(`<g class="dg-tg dg-popc dg-a" style="${ye(x.color)};${m===void 0?t.pop(x.at):t.pop(x.at,m-ee.untilFade)}"><rect x="${R(_)}" y="${R(J)}" width="${R(Y)}" height="${r.tagH}" rx="${r.tagH/2}"/><text x="${R(_+Y/2)}" y="${R(J+r.tagH/2+g.baseline.tag)}" text-anchor="middle">${Pe(y)}</text></g>`)})}),e.trail){let p=e.trail,v=e.fields[e.fields.length-1];if(v&&v.y===p.y){let d=p.x-r.fieldGap/2;l.push(`<line class="dg-sep" x1="${R(d)}" y1="${R(p.y+r.sepInset)}" x2="${R(d)}" y2="${R(p.y+r.h-r.sepInset)}"/>`)}l.push(je(a.ink,"dg-fl",p.x,p.y+r.nameY,p.title,E.fieldName));let w=p.y+r.valueY-E.fieldValue.size/3;p.states.forEach((d,b)=>{let T=R(p.x+r.trail.r+b*r.trail.step),x=i.get(d.box),$=x===void 0?"":`<circle class="dg-tr-fill dg-a" cx="${T}" cy="${R(w)}" r="${r.trail.r}" style="${t.pop(x)}"/>`;l.push(`<g data-trail="${Pe(d.box)}" style="${ye(d.color)}"><circle class="dg-tr-ring" cx="${T}" cy="${R(w)}" r="${r.trail.r}"/>${$}</g>`)})}return l.join("")}var We=e=>Math.round(e*100)/100,ls=e=>[e.x+e.w/2,e.y+e.h/2];function Pr(e,n){let a=g.carrier,o=Re(e),i=se(e,o?E.carrierJa:E.carrier)+a.tagPadX*2;return`<rect class="dg-car" x="${We(-i/2)}" y="${-a.tagH/2}" width="${We(i)}" height="${a.tagH}" rx="${a.tagH/2}" ${n}/><text class="dg-car-t${o?" dg-car-tj":""}" y="${g.baseline.carrier}" text-anchor="middle">${Pe(e)}</text>`}function ps(e,n,a,o){let{m:i}=o,t=g.git,s=(d,b)=>a.edges.find(T=>T.step===d&&T.event===b),r=e.links.map(d=>{let b=s(d.step,d.event);if(!b)return"";o.traces.push({from:d.from,to:d.to,points:d.points,shown:[[b.start,Number.POSITIVE_INFINITY]]});let T=$t(d.points);if(d.kind==="copy")return`<g style="${ye(d.color)}"><path class="dg-git-cp dg-a" d="${T}" style="${i.vis(b.start,i.last)}"/></g>`;let x=i.kf([[0,{opacity:0,"stroke-dashoffset":1}],[b.start,{opacity:0,"stroke-dashoffset":1},de.inOut],[b.start+.05,{opacity:1}],[b.drawn,{"stroke-dashoffset":0}],[i.last,{opacity:1,"stroke-dashoffset":0},de.inOut],[i.total,{opacity:0,"stroke-dashoffset":0}]]);return`<g style="${ye(d.color)}"><path class="dg-git-l dg-a" pathLength="1" d="${T}" style="${x}"/></g>`}).join(""),c=e.commits.map(d=>{let b=s(d.step,d.event)?.drawn??0,T={x:d.cx-d.r,y:d.cy-d.r,w:d.r*2,h:d.r*2};o.ink.push({text:d.id,rect:T,shown:[[b,Number.POSITIVE_INFINITY]],boxed:!0});let x=(d.text?.lines??[]).map((Y,J)=>{let L=J===0&&d.hash!==void 0,C=d.text?.baselines[J]??d.cy;return je(o.ink,L?"dg-git-h":"dg-git-n",d.cx,C,Y,L?E.gitHash:E.gitNote,[[b,Number.POSITIVE_INFINITY]],"middle")}).join(""),$=`<text class="dg-git-id" x="${We(d.cx)}" y="${We(d.cy+g.baseline.badge)}" text-anchor="middle">${Pe(d.id)}</text>`,m=`<g class="dg-popc dg-a" style="${i.pop(b)}"><circle class="dg-git-c" cx="${We(d.cx)}" cy="${We(d.cy)}" r="${d.r}" ${o.sh}/>${$}</g>`,y=x===""?"":`<g class="dg-a" style="${i.vis(b)}">${x}</g>`,O=d.orphan===void 0?void 0:s(d.orphan,d.orphanEvent??0)?.drawn,_=O===void 0?"":`<g class="dg-a" data-orphan="${Pe(d.id)}" style="${i.vis(O,i.last,{f:.5})}"><circle class="dg-git-old" cx="${We(d.cx)}" cy="${We(d.cy)}" r="${t.orphan}"/><text class="dg-git-oldl" x="${We(d.cx)}" y="${We(d.cy+g.baseline.badge)}" text-anchor="middle">${Pe(d.id)}</text></g>`;return`<g data-commit="${Pe(d.id)}" style="${ye(d.color)}">${m}${y}${_}</g>`}).join(""),l=e.moves.flatMap(d=>{let b=s(d.step,d.event);if(!d.line||!b)return[];let T=a.steps[d.step].end;o.traces.push({from:d.ref,to:d.target??d.ref,points:d.line,shown:[[b.start,T+.4]]});let x=i.kf([[0,{opacity:0,"stroke-dashoffset":1}],[b.start,{opacity:0,"stroke-dashoffset":1},de.inOut],[b.start+.05,{opacity:1}],[b.drawn,{"stroke-dashoffset":0}],[T,{opacity:1},de.inOut],[T+.4,{opacity:0}],[i.total,{opacity:0,"stroke-dashoffset":0}]]);return[`<g style="${ye(d.color)}"><path class="dg-e-on dg-a" pathLength="1" d="${$t(d.line)}" style="${x}"/></g>`]}).join(""),p=a.carriers.flatMap(d=>{let b=e.moves.find($=>$.step===d.step&&$.event===d.event&&$.line),T=n.steps[d.step]?.events[d.event];if(!b?.line||T?.type!=="edge")return[];let x={step:d.step,event:d.event,from:b.ref,to:b.target??b.ref,points:b.line,color:b.color,carry:T.carry};return[Jt(x,{...d,start:d.depart,end:d.arrive+ee.fade},o)]}).join(""),w=[...new Set(e.moves.map(d=>d.ref))].map(d=>Sr(d,e.moves.filter(b=>b.ref===d),s,o)).join("")+p;return{links:r,lines:l,commits:c,tags:w}}function Sr(e,n,a,o){let{m:i}=o,t=[],s=[[0,{opacity:0}]],r=!1,c,l=d=>{c&&o.ink.push({text:e,rect:c.rect,shown:[[c.since,d]],boxed:!0}),c=void 0};for(let d of n){let b=a(d.step,d.event);if(!b)continue;let{start:T,drawn:x}=b,$=d.from?ls(d.from):void 0,m=d.to?ls(d.to):void 0;if(l(T),d.carried&&$&&m&&r){t.push([T+ee.fade,$[0],$[1]],[x-ee.fade,m[0],m[1]]),s.push([T,{opacity:1},de.inOut],[T+ee.fade,{opacity:0}],[x-ee.fade,{opacity:0},de.out],[x,{opacity:1}]),c={rect:d.to,since:x};continue}if($&&t.push([T,$[0],$[1]]),m&&t.push([x,m[0],m[1]]),m&&!r){let y=$?T:x-ee.fade;s.push([y,{opacity:0},de.out],[y+ee.fade,{opacity:1}]),r=!0}else!m&&r&&(s.push([x,{opacity:1},de.inOut],[x+ee.untilFade,{opacity:0}]),r=!1);d.to&&(c={rect:d.to,since:x})}if(l(Number.POSITIVE_INFINITY),t.length===0)return"";let p=t[0],v=t[t.length-1];r?s.push([i.last,{opacity:1},de.inOut],[i.total,{opacity:0}]):s.push([i.total,{opacity:0}]);let w=i.move([[0,p[1],p[2]],...t,[i.total,v[1],v[2]]],s);return`<g class="dg-a" data-ref="${Pe(e)}" style="${w}">${Pr(e,o.sh)}</g>`}var ds=e=>Math.round(e*100)/100,Zt=class{constructor(n,a,o){this.prefix=n;this.total=a;this.last=o}prefix;total;last;frames=[];count=0;pct(n){return+(Math.min(Math.max(n,0),this.total)/this.total*100).toFixed(3)}kf(n){let a=`${this.prefix}-${this.count++}`,o=new Map;for(let[t,s,r]of[...n].sort((c,l)=>c[0]-l[0])){let c=this.pct(t),l=o.get(c)??{props:{}};Object.assign(l.props,s),r&&(l.ease=r),o.set(c,l)}let i=[...o].map(([t,{props:s,ease:r}])=>{let c=Object.entries(s).map(([l,p])=>`${l}:${p}`);return r&&c.push(`animation-timing-function:${r}`),`${t}%{${c.join(";")}}`}).join("");return this.frames.push(`@keyframes ${a}{${i}}`),`animation-name:${a}`}vis(n,a=this.last,o={}){let i=o.f??ee.fade,t=o.on??{},s=o.off??{},r=o.within?Math.max(n+i,a-i):a;return this.kf([[0,{opacity:0,...s}],[n,{opacity:0,...s},o.ein??de.out],[n+i,{opacity:1,...t}],[r,{opacity:1,...t},de.inOut],[Math.min(r+i,this.total),{opacity:0,...s}],[this.total,{opacity:0,...s}]])}rise(n,a=this.last,o=!1){return this.vis(n,a,{on:{transform:"translateY(0)"},off:{transform:`translateY(${g.rise}px)`},within:o})}pop(n,a=this.last){return this.vis(n,a,{f:ee.popFade,ein:de.pop,on:{transform:"scale(1)"},off:{transform:`scale(${g.popFrom})`}})}until(n){let a=ee.untilFade;return this.kf([[0,{opacity:1}],[n,{opacity:1},de.inOut],[n+a,{opacity:0}],[this.last,{opacity:0}],[this.total,{opacity:1}]])}move(n,a=[]){return this.kf(n.map(([o,i,t,s=1,r])=>[o,{transform:`translate(${ds(i)}px,${ds(t)}px) scale(${s})`},r]).concat(a))}blink(n,a,o){return[[0,{opacity:0}],[n-.01,{opacity:0}],[n,{opacity:1}],[a,{opacity:1}],[a+o,{opacity:0}],[this.total,{opacity:0}]]}};var fe=e=>`font:${e.weight} ${e.size}px var(--${e.family})`,Le=(e,n="var(--surf)")=>`color-mix(in srgb,var(--c) ${e}%,${n})`,me=g.stroke,Me=g.mix,fn=`color-mix(in srgb,var(--mute) ${Me.past}%,var(--bg))`,Mr=[".dg{display:block;width:100%;height:auto;overflow:visible}",".dg .dg-a{animation-duration:var(--T);animation-timing-function:linear;animation-iteration-count:infinite;animation-fill-mode:both;animation-delay:calc(var(--at,0) * -1s);animation-play-state:var(--play,running)}",".dg .dg-popc{transform-box:fill-box;transform-origin:center}",".dg-bg{fill:var(--bg)}",".dg-band{fill:color-mix(in srgb,var(--c) var(--tint),var(--bg));stroke:color-mix(in srgb,var(--c) var(--edge),transparent)}",`.dg-bi{fill:${Le(Me.regionIcon)};stroke:${Le(Me.regionIconEdge,"transparent")}}`,`.dg-bz{${fe(E.regionName)};fill:var(--ct)}`,`.dg-bx{${fe(E.regionNote)};fill:var(--mute)}`,".dg-st{fill:var(--surf);stroke:var(--hair)}",`.dg-halo{fill:none;stroke:var(--c);stroke-width:${me.halo};stroke-opacity:.16}`,`.dg-on{fill:none;stroke:var(--c);stroke-width:${me.on}}`,`.dg-ic{fill:${Le(Me.icon)}}`,`.dg-slot{fill:none;stroke:${Le(Me.slot,"transparent")};stroke-width:${me.slot};stroke-dasharray:3 3}`,`.dg-gl{fill:none;stroke:var(--c);stroke-width:${me.glyph};stroke-linecap:round;stroke-linejoin:round}`,`.dg-sn{${fe(E.boxName)};fill:var(--ink)}`,`.dg-ss{${fe(E.boxSub)};fill:var(--mute)}`,`.dg-ss-ok{${fe(E.boxSubStrong)};fill:var(--ct)}`,`.dg-ss-act{${fe(E.boxSubStrong)};fill:var(--ink)}`,`.dg-ll{stroke:var(--line);stroke-width:${me.lifeline};stroke-dasharray:3 4}`,`.dg-e{fill:none;stroke:var(--line);stroke-width:${me.edge};stroke-linecap:round;stroke-dasharray:0 ${g.edge.ghostDash}}`,`.dg-eh{fill:none;stroke:var(--line);stroke-width:${me.arrow};stroke-linecap:round;stroke-linejoin:round}`,`.dg-e-on{fill:none;stroke:var(--c);stroke-width:${me.edgeOn};stroke-linecap:round;stroke-dasharray:1 2}`,`.dg-eh-on{fill:none;stroke:var(--c);stroke-width:${me.edgeOn};stroke-linecap:round;stroke-linejoin:round}`,`.dg-flow{fill:none;stroke:var(--surf);stroke-width:${me.flow};stroke-linecap:round;stroke-dasharray:1.5 ${g.edge.flowDash}}`,`.dg-e-past{fill:none;stroke:${fn};stroke-width:${me.edge};stroke-linecap:round}`,`.dg-eh-past{fill:none;stroke:${fn};stroke-width:${me.arrow};stroke-linecap:round;stroke-linejoin:round}`,".dg-bd{cursor:pointer}",".dg-bdf{fill:var(--c)}",`.dg-bdft{${fe(E.badge)};fill:var(--on-c)}`,`.dg-bdr{fill:none;stroke:var(--c);stroke-width:${me.badgeRing};pointer-events:none}`,`.dg-bdp{fill:${Le(Me.badgePast)};stroke:${Le(Me.badgePastEdge,"transparent")};stroke-width:${me.hair}}`,`.dg-bdpt{${fe(E.badge)};fill:var(--ct)}`,`.dg-bdp-g{fill:var(--surf);stroke:${fn};stroke-width:${me.hair}}`,`.dg-bdpt-g{${fe(E.badge)};fill:var(--mute)}`,`.dg-cap rect,.dg-act rect{fill:${Le(Me.cap)};stroke:${Le(Me.capEdge,"transparent")}}`,`.dg-cap text{${fe(E.label)};fill:var(--ct)}`,`.dg-capj text{${fe(E.labelJa)}}`,`.dg-cap-past text{${fe(E.label)};fill:var(--mute);fill-opacity:${g.state.pastLabel}}`,`.dg-cap-pastj text{${fe(E.labelJa)}}`,`.dg-act text{${fe(E.action)};fill:var(--ct)}`,".dg-car{fill:var(--carry,var(--ink))}",`.dg-car-t{${fe(E.carrier)};fill:var(--bg)}`,`.dg-car-tj{${fe(E.carrierJa)}}`,`.dg-env{fill:var(--carry,var(--ink));stroke:var(--surf);stroke-width:${me.envelope}}`,`.dg-env-in{fill:none;stroke:var(--surf);stroke-width:${me.flow};stroke-linejoin:round;stroke-linecap:round}`,".dg-coin{fill:var(--coin);stroke:var(--surf);stroke-width:1.2}",".dg-coin-in{fill:none;stroke:var(--coinin);stroke-width:1.1}",".dg-strip{fill:var(--surf);stroke:var(--hair)}",`.dg-sep{stroke:var(--hair);stroke-width:${me.hair}}`,`.dg-sh{${fe(E.stripTitle)};fill:var(--ink)}`,`.dg-fl{${fe(E.fieldName)};fill:var(--mute)}`,`.dg-fv{${fe(E.fieldValue)};fill:var(--ink)}`,`.dg-fvj{${fe(E.fieldValueJa)};fill:var(--ink)}`,".dg-fv-c{fill:var(--ct)}",".dg-fl-now{fill:var(--c)}",`.dg-tr-ring{fill:none;stroke:var(--line);stroke-width:${me.trail}}`,".dg-tr-fill{fill:var(--c)}",".dg-tg rect{fill:var(--c)}",`.dg-tg text{${fe(E.tag)};fill:var(--on-c)}`,`.dg-side{fill:color-mix(in srgb,var(--c) ${Me.side}%,var(--bg));stroke:${Le(Me.sideEdge,"transparent")};stroke-dasharray:4 4}`,`.dg-side-t{${fe(E.regionName)};fill:var(--ct)}`,`.dg-side-n{${fe(E.regionNote)};fill:var(--mute)}`,`.dg-ghost{fill:var(--surf);stroke:${Le(Me.ghostEdge,"transparent")};stroke-dasharray:4 3}`,`.dg-path{fill:none;stroke:${Le(Me.path,"transparent")};stroke-width:${me.path};stroke-linecap:round;stroke-dasharray:0 ${g.edge.ghostDash}}`,`.dg-path-h{fill:none;stroke:${Le(Me.path,"transparent")};stroke-width:${me.arrow};stroke-linecap:round;stroke-linejoin:round}`,`.dg-path-t{${fe(E.label)};fill:var(--ct)}`,`.dg-path-tj{${fe(E.labelJa)}}`,".dg-start{fill:var(--ink)}",`.dg-end{fill:var(--bg);stroke:var(--ink);stroke-width:${me.end}}`,".dg-end-in{fill:var(--ink)}",`.dg-end-x{fill:var(--bg);stroke:${Le(Me.path,"transparent")};stroke-width:${me.arrow};stroke-dasharray:2 2.5}`,`.dg-end-xi{fill:${Le(Me.path,"transparent")}}`,`.dg-mark{${fe(E.regionNote)};fill:var(--mute)}`,`.dg-done{fill:var(--ink);stroke:var(--surf);stroke-width:${me.done}}`,`.dg-done-ck{fill:none;stroke:var(--surf);stroke-width:${me.glyph};stroke-linecap:round;stroke-linejoin:round}`,`.dg-git-l{fill:none;stroke:var(--c);stroke-width:${me.git};stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:1 2}`,`.dg-git-cp{fill:none;stroke:var(--c);stroke-width:${me.gitOrphan};stroke-linecap:round;stroke-dasharray:3 3;stroke-opacity:.7}`,`.dg-git-c{fill:var(--surf);stroke:var(--c);stroke-width:${me.git}}`,`.dg-git-id{${fe(E.gitId)};fill:var(--ct)}`,`.dg-git-h{${fe(E.gitHash)};fill:var(--mute)}`,`.dg-git-n{${fe(E.gitNote)};fill:var(--ink2)}`,`.dg-git-old{fill:var(--surf);stroke:var(--c);stroke-width:${me.gitOrphan};stroke-dasharray:3 3;stroke-opacity:.6}`,`.dg-git-oldl{${fe(E.gitId)};fill:var(--ct);opacity:.55}`,".dg-vp-bg{fill:var(--bg)}",".dg-vp-frame{fill:none;stroke:var(--hair)}",".dg-hd-bg{fill:var(--bg)}",".dg-mm-bg{fill:var(--surf);stroke:var(--hair)}",`.dg-mm-t{${fe(E.miniTitle)};fill:var(--mute)}`,".dg-mm-world{fill:var(--sunk);stroke:var(--hair)}",`.dg-mm-band{fill:${Le(Me.miniBand)};stroke:${Le(Me.miniBandEdge,"transparent")};stroke-width:.6}`,`.dg-mm-card{fill:${Le(Me.mini)}}`,`.dg-mm-vp{fill:color-mix(in srgb,var(--ink) ${Me.view}%,transparent);stroke:var(--ink);stroke-width:${me.badgeRing};vector-effect:non-scaling-stroke}`].join("");function Or(e){let n=2166136261;for(let a=0;a<e.length;a++)n^=e.charCodeAt(a),n=Math.imul(n,16777619);return(n>>>0).toString(36)}function Er(e){let n=new Map,a=(o,i)=>{n.set(o,(n.get(o)??new Set).add(i))};return e.steps.forEach((o,i)=>{for(let t of o.events)t.type==="edge"?(a(t.from,i),a(t.to,i)):(t.type==="action"||t.type==="swap")&&a(t.box,i)}),new Map([...n].map(([o,i])=>[o,[...i].sort((t,s)=>t-s)]))}function Tr(e,n,a){let o=[],i=0;for(let s of n.events){let r=e.steps[s.step]?.events[s.event];r?.type==="swap"&&o.push({t:s.at,order:i++,box:r.box,set:r.text}),a&&r?.type==="action"&&(o.push({t:s.at,order:i++,box:r.box,act:r.label}),o.push({t:n.steps[s.step].end,order:i++,box:r.box,act:null}))}o.sort((s,r)=>s.t-r.t||s.order-r.order);let t=new Map;for(let s of e.boxes){let r=[s.sub??"","dg-ss"],c,l=r.join("|"),p=[];for(let w of o.filter(d=>d.box===s.id)){w.set!==void 0&&(r=[w.set,"dg-ss-ok"],c=void 0),w.act!==void 0&&(c=w.act??void 0);let d=c!==void 0?[c,"dg-ss-act"]:r;d.join("|")!==l&&(l=d.join("|"),p.push([w.t,d[0],d[1]]))}let v=p.filter((w,d)=>{let b=p[d+1];return b===void 0||b[0]-w[0]>=ee.minShow});t.set(s.id,v)}return t}function Lr(e,n,a){let o=new Map;for(let i of n.events){let t=e.steps[i.step]?.events[i.event];if(t?.type!=="strip")continue;let s=a.badges[i.step]?.color??"slate",r=o.get(t.field)??[],c=n.steps[i.step].end;r.push({at:i.at,color:s,step:i.step,until:c,...t.value!==void 0?{value:t.value}:{},...t.tag!==void 0?{tag:t.tag}:{}}),o.set(t.field,r)}return o}function Nr(e,n,a){if(e.until===void 0||!n.after)return n;let o=a[e.until].start,{after:i,...t}=n;return o>i.start?{...t,after:{start:i.start,end:Math.min(i.end,o)}}:t}function mn(e,n,a,o,i,t,s=[],r=[]){let c=Or(`${JSON.stringify(e)}|${o.id}|${i}|${t?`${t.width}|${t.lang}`:""}`),l=new Zt(`dg${c}`,a.total,a.last),p={m:l,t:a,sh:`filter="url(#dg-sh-${c})"`,end:a.steps[a.steps.length-1].end,ink:s,traces:r},v=Er(e),w=Tr(e,a,n.kind!=="sequence"),d={band:[],base:[],lit:[],node:[],badge:[],top:[]};for(let k of n.regions)d.band.push(Kn(k,s));let b=n.boxes.find(k=>k.ghost)?.color??"slate";n.side&&d.band.push(ts(n.side,b,s));let T=(k,K)=>n.boxes.find(X=>X.id===k&&(K===void 0||X.ghost===K))?.color;for(let k of n.paths)d.base.push(es(k,T(k.to,!0)??T(k.from)??b,s,r));for(let k of n.ends)d.node.push(ns(k,b,s));let x=n.kind==="state",$=new Map((a.states??[]).flatMap(k=>k.lit[0]?[[k.box,k.lit[0].start]]:[]));n.strip&&d.band.push(cs(n.strip,Lr(e,a,n),p,x,$));for(let k of n.lifelines)d.base.push(ss(k.x,k.y1,k.y2));if(Tn(n)){let k=ps(n,e,a,p);d.base.push(k.links),d.lit.push(k.lines),d.node.push(k.commits),d.top.push(k.tags)}for(let k of n.edges){let K=a.edges.find(Z=>Z.step===k.step&&Z.event===k.event);if(!K)continue;let X=rs(k,K,p,x);d.base.push(X.base),d.lit.push(X.lit)}let m=new Map((a.states??[]).map(k=>[k.box,k]));for(let k of n.boxes){if(k.ghost){d.node.push(Zn(k,s));continue}let K=m.get(k.id);d.node.push(Un(k,p,v.get(k.id)??[],w.get(k.id)??[],x?K?.lit??[]:void 0)),K?.done!==void 0&&d.node.push(Qn(k,K.done,p))}for(let k of n.badges)d.badge.push(as(k,p,x));for(let k of n.labels){let K=a.labels.find(X=>X.step===k.step&&X.event===k.event);K&&d.top.push(os(k,Nr(k,K,a.steps),p))}for(let k of n.actions){let K=a.events.find(X=>X.step===k.step&&X.event===k.event);K&&d.top.push(is(k,K.at,a.steps[k.step].end,p))}for(let k of a.carriers){let K=n.edges.find(X=>X.step===k.step&&X.event===k.event);K&&d.top.push(Jt(K,k,p))}let y=Object.values(d).map(k=>k.join("")).join(""),{near:O,far:_,nearY:Y,farY:J}=g.shadow,L=`<filter id="dg-sh-${c}" x="-20%" y="-30%" width="140%" height="180%"><feDropShadow dx="0" dy="${Y}" stdDeviation="${O}" style="flood-color:var(--sh);flood-opacity:var(--shA)"/><feDropShadow dx="0" dy="${J}" stdDeviation="${_}" style="flood-color:var(--sh);flood-opacity:var(--shB)"/></filter>`,C=t&&n.kind==="sequence"?n.boxes.map(k=>Jn(k,p,v.get(k.id)??[],w.get(k.id)??[])).join(""):"",q=t?Rr(n,a,e,l,c,y,t,C):{body:`<rect class="dg-bg" width="${n.width}" height="${n.height}" rx="${g.region.radius}"/>${y}`,w:n.width,h:n.height},Q=`.dg-${c}{${Ot};--T:${a.total}s;${Mt(o,i)}}${Mr}${l.frames.join("")}`;return`<svg xmlns="http://www.w3.org/2000/svg" class="dg dg-${c}" viewBox="0 0 ${Math.ceil(q.w)} ${Math.ceil(q.h)}" width="${Math.ceil(q.w)}" height="${Math.ceil(q.h)}" role="img" aria-label="${Pe(e.title)}" data-dragon="figure" data-view="${t?"follow":"fixed"}"><style>${Q}</style><defs>${L}</defs>${q.body}</svg>`}function fs(e){let n=Math.min(...e.map(o=>o.x)),a=Math.min(...e.map(o=>o.y));return{x:n,y:a,w:Math.max(...e.map(o=>o.x+o.w))-n,h:Math.max(...e.map(o=>o.y+o.h))-a}}function qr(e,n,a){let o=ms(e,n,a);return o.length===0?void 0:fs(o)}function Ar(e,n,a,o){let i=g.badge.r+g.follow.badgeRoom,{x:t,y:s}=e,r=l=>Math.hypot(Math.max(0,l.x-t,t-l.x-l.w),Math.max(0,l.y-s,s-l.y-l.h)),c={x:t-i,y:s-i,w:i*2,h:i*2};for(let l of[...n].sort((p,v)=>r(p)-r(v))){let p=fs([c,l]);p.w<=a&&p.h<=o&&(c=p)}return c}function ms(e,n,a){let o=[];for(let i of e.edges.filter(t=>t.step===a)){let t=i.points.map(r=>r[0]),s=i.points.map(r=>r[1]);o.push({x:Math.min(...t),y:Math.min(...s),w:Math.max(...t)-Math.min(...t),h:Math.max(...s)-Math.min(...s)})}o.push(...e.labels.filter(i=>i.step===a),...e.actions.filter(i=>i.step===a));for(let i of n.steps[a]?.events??[]){let t=i.type==="edge"?[i.from,i.to]:i.type==="action"||i.type==="swap"?[i.box]:[];for(let s of t){let r=e.boxes.find(c=>c.id===s);r&&(e.kind==="architecture"||i.type==="swap")&&o.push(r)}}return o}function Rr(e,n,a,o,i,t,s,r){let c=g.follow,l=g.mini,p=Math.max(1,s.width),v=Math.min(e.width,p),w=ot[s.lang].overview,d=B=>{let H=Math.min(l.w,v*.4,B*.4/e.height*e.width),W=H/e.width,ie=e.height*W,h=Math.max(H,Math.ceil(se(w,E.miniTitle)));return{vh:B,mw:H,k:W,mh:ie,bw:h,bgW:h+l.pad*2,bgH:ie+l.pad*2+l.title,beside:ie>H}},b=d(Math.min(e.height,Math.max(c.minH,v*c.aspect))),T=b.beside&&p<c.narrow,x=s.height===void 0?Number.POSITIVE_INFINITY:b.beside?s.height:s.height-b.bgH-l.inset,{vh:$,mw:m,k:y,mh:O,bw:_,bgW:Y,bgH:J,beside:L}=x<b.vh?d(Math.max(c.fitMinH,x)):{...b,vh:Number.isFinite(x)?Math.min(e.height,x):b.vh},C=L&&!T?Math.min(e.width,p-Y-l.inset):v,q=B=>Math.min(e.width-C/2,Math.max(C/2,B)),Q=r===""?0:Math.max(...e.boxes.map(B=>B.y+B.h))+c.headRoom,k=r===""?0:c.head.pad*2+c.head.h,K=$-k,X=B=>Math.min(e.height-K/2,Math.max(Q+K/2,B)),Z=g.badge.r,S=[e.width/2,e.height/2],I=n.steps.map((B,H)=>{let W=qr(e,a,H);S=W?[W.x+W.w/2,W.y+W.h/2]:S;let ie=[q(S[0]),X(S[1])],h=e.badges.find(N=>N.step===H);if(!h||Math.abs(h.x-ie[0])<=C/2-Z&&Math.abs(h.y-ie[1])<=K/2-Z)return ie;let j=Ar(h,ms(e,a,H),C,K);return S=[j.x+j.w/2,j.y+j.h/2],[q(S[0]),X(S[1])]}).map(([B,H])=>[B,H-k/2]),F=I[0],V=[[0,F[0],F[1]],[n.steps[0].start,F[0],F[1]]];I.forEach((B,H)=>{if(H===0)return;let W=I[H-1],ie=n.steps[H].start;V.push([ie,W[0],W[1],1,de.inOut],[ie+c.ease,B[0],B[1]])});let ne=I[I.length-1];V.push([n.last,ne[0],ne[1],1,de.inOut],[n.total,F[0],F[1]]);let oe=o.move(V.map(([B,H,W,ie,h])=>[B,C/2-H,$/2-W,ie,h])),ce=L?C+l.inset:C-Y-l.inset,be=L?0:$+l.inset,le=ce+l.pad,pe=le+(_-m)/2,ue=be+l.pad+l.title,xe=T?{clip:"",body:""}:(()=>{let B=[...e.regions.map(W=>`<rect class="dg-mm-band" style="${ye(W.color)}" x="${pe+W.x*y}" y="${ue+W.y*y}" width="${W.w*y}" height="${W.h*y}" rx="3"/>`),...e.boxes.map(W=>`<rect class="dg-mm-card" style="${ye(W.color)}" x="${pe+W.x*y}" y="${ue+W.y*y}" width="${W.w*y}" height="${W.h*y}" rx="1.5"/>`)].join(""),H=o.move(V.map(([W,ie,h,,j])=>[W,pe+(ie-C/2)*y,ue+(h-$/2)*y,1,j]));return{clip:`<clipPath id="dg-mm-${i}"><rect x="${pe}" y="${ue}" width="${m}" height="${O}" rx="4"/></clipPath>`,body:`<rect class="dg-mm-bg" x="${ce}" y="${be}" width="${Y}" height="${J}" rx="${l.radius}"/><text class="dg-mm-t" x="${le}" y="${ue-l.pad+2}">${w}</text><g clip-path="url(#dg-mm-${i})"><rect class="dg-mm-world" x="${pe}" y="${ue}" width="${m}" height="${O}"/>${B}<rect class="dg-mm-vp dg-a"${k===0?"":` y="${k*y}"`} width="${C*y}" height="${($-k)*y}" rx="2" style="${H}"/></g>`}})(),ke=k===0?"":`<g class="dg-hd"><rect class="dg-hd-bg" width="${C}" height="${k}"/><line class="dg-sep" x1="0" y1="${k}" x2="${C}" y2="${k}"/><g class="dg-a" style="${o.move(V.map(([B,H,,W,ie])=>[B,C/2-H,0,W,ie]))}">${r}</g></g>`;return{body:`<defs><clipPath id="dg-vp-${i}"><rect width="${C}" height="${$}" rx="${g.region.radius}"/></clipPath>${xe.clip}</defs><g clip-path="url(#dg-vp-${i})"><rect class="dg-vp-bg" width="${C}" height="${$}"/><g class="dg-a" style="${oe}">${t}</g>${ke}</g><rect class="dg-vp-frame" x="0.5" y="0.5" width="${C-1}" height="${$-1}" rx="${g.region.radius}"/>${xe.body}`,w:L&&!T?C+l.inset+Y:v,h:L?$:be+J}}function us(e,n={}){let a=n.lang??"ja",o=Fn(e,{lang:a});if(!o.ok)throw new Error(ot[a].cannotDraw(o.errors.map(s=>`${s.pointer} ${s.message}`).join(" / ")));let i=o.diagram,t=i.kind==="sequence"?Nn(i):i.kind==="state"?An(i,a):i.kind==="git"?Ln(i):Pn(i);return jr(i,t,Gn(i),n)}function jr(e,n,a,o={}){let i=St(o.palette),t=o.theme==="dark"?"dark":"light",s=[],r=[];return{svg:mn(e,n,a,i,t,void 0,s,r),palette:i.id,theme:t,...e.view?{view:e.view}:{},fonts:{...yt},layout:n,timeline:a,diagram:e,overlaps:Wn(s,a.stills,r)}}function un(e,n,a){let o=Math.max(0,n)/e.layout.width,t=(a===void 0?o:Math.min(o,Math.max(0,a)/e.layout.height))*E.boxName.size;return e.view?{mode:e.view,textPx:t}:{mode:t>=wn?"fixed":"follow",textPx:t}}var Qt=e=>`font:${e.weight} ${e.size}px var(--${e.family})`,$e=e=>`${e}px`;function Cr(){let e=g.player,n=$e(e.hidden);return[`.dg-player{display:flex;flex-direction:column;gap:${$e(e.gap)};color:var(--ink)}`,`.dg-player .dg-frame{border-radius:${$e(e.radius)};overflow:hidden}`,".dg-bar{container:dg-bar/inline-size}",`.dg-row{display:flex;align-items:flex-start;gap:${$e(e.gap)}}`,`.dg-btns{display:flex;gap:${$e(e.gap/2)};flex:none}`,`.dg-btn{width:${$e(e.button)};height:${$e(e.button)};border-radius:${$e(e.radius)};border:${$e(g.stroke.hair)} solid var(--hair);background:var(--surf);color:var(--ink);${Qt(E.button)};cursor:pointer}`,`.dg-btn:focus-visible{outline:${$e(e.focus)} solid var(--c-blue);outline-offset:${$e(e.focus)}}`,`.dg-say{display:flex;gap:${$e(e.gap)};min-width:0}`,`.dg-no{${Qt(E.stepNo)};color:var(--mute);padding-top:${$e(e.focus)}}`,".dg-txt{display:grid;grid-template-columns:minmax(0,1fr);min-width:0}",".dg-txt>*{grid-area:1/1}",".dg-room{visibility:hidden}",`.dg-tt{${Qt(E.stepTitle)};margin:0}`,`.dg-tb{${Qt(E.stepBody)};color:var(--ink2);margin:0;white-space:pre-line}`,`.dg-sr{position:absolute;width:${n};height:${n};margin:-${n};padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}`,`@container dg-bar (width < ${$e(e.narrow)}){.dg-row{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:start;gap:0 ${$e(e.gap)}}.dg-say,.dg-txt,.dg-txt>*{display:contents}.dg-btns{grid-area:1/1;margin-bottom:${$e(e.gap/2)}}.dg-btn{width:${$e(e.touch)};height:${$e(e.touch)}}.dg-no{grid-area:1/2;display:flex;align-items:center;min-height:${$e(e.touch)};padding-top:0}.dg-tt{grid-area:2/1/3/3}.dg-tb{grid-area:3/1/4/3}}`,`@media (pointer: coarse){.dg-btn{width:${$e(e.touch)};height:${$e(e.touch)}}}`,`.dg-spot{fill:none;stroke:var(--t-amber);stroke-width:${$e(g.stroke.mark)};stroke-dasharray:${g.mark.dash} ${g.mark.gap};pointer-events:none}`].join("")}function Dr(e){if(e.getElementById("dragon-player-css"))return;let n=e.createElement("style");n.id="dragon-player-css",n.textContent=Cr(),e.head.appendChild(n)}var kt={prev:"\u2039",pause:"\u275A\u275A",play:"\u25B6",next:"\u203A"},hs="http://www.w3.org/2000/svg",gs=e=>String(e).padStart(2,"0"),Ir=(e,n)=>`${gs(e+1)}/${gs(n)}`;function ys(e,n,a={}){let o=e.ownerDocument,i=o.defaultView,t=!!i?.matchMedia?.("(prefers-reduced-motion: reduce)").matches,s=us(n,a),r=a.lang??"ja",c=ot[r],l=St(s.palette),{timeline:p}=s,v=s.diagram.steps,w=v.length;Dr(o);let d=o.createElement("div");d.className="dg-player",d.dataset.dragon="player",d.setAttribute("style",`${Ot};${Mt(l,s.theme)}`);let b=o.createElement("div");b.className="dg-frame";let T=(M,G,z)=>{let U=o.createElement("button");return U.type="button",U.className="dg-btn",U.dataset.dragon=M,U.setAttribute("aria-label",G),U.textContent=z,U},x=T("prev",c.prev,kt.prev),$=T("toggle",c.pause,kt.pause),m=T("next",c.next,kt.next),y=o.createElement("div");y.className="dg-btns",y.setAttribute("lang",r),y.append(x,$,m);let O=o.createElement("div");O.className="dg-say",O.setAttribute("aria-hidden","true");let _=o.createElement("div");_.className="dg-no",_.dataset.dragon="step-no";let Y=o.createElement("div");Y.className="dg-txt";let J=o.createElement("p");J.className="dg-tt",J.dataset.dragon="step-title";let L=o.createElement("p");L.className="dg-tb",L.dataset.dragon="step-body";let C=o.createElement("div");C.append(J,L),Y.append(C);for(let M of v){let G=o.createElement("div");G.className="dg-room",G.dataset.dragon="caption-room";let z=o.createElement("p");z.className="dg-tt",z.textContent=M.title;let U=o.createElement("p");U.className="dg-tb",U.textContent=M.body,G.append(z,U),Y.append(G)}O.append(_,Y);for(let M of[_,J,L])M.setAttribute("aria-hidden","true");let q=o.createElement("div");q.className="dg-row",q.append(y,O);let Q=o.createElement("div");Q.className="dg-bar",Q.append(q);let k=o.createElement("ol");k.className="dg-sr",k.dataset.dragon="steps",k.setAttribute("aria-label",c.steps(s.diagram.title));for(let M of v){let G=o.createElement("li"),z=o.createElement("strong");z.textContent=M.title,G.append(z);for(let U of M.body.split(`
2
- `)){let Oe=o.createElement("p");Oe.textContent=U,G.append(Oe)}k.append(G)}d.append(b,Q,k),e.append(d);let K=()=>b.clientWidth||e.clientWidth||s.layout.width,X=()=>{if(!a.fitHeight||!i)return;let M=i.getComputedStyle(b),G=b.clientHeight-(Number.parseFloat(M.paddingTop)||0)-(Number.parseFloat(M.paddingBottom)||0);return G>0?G:void 0},Z=un(s,K(),X()).mode,S=K(),D=X(),I=null,F=0,V=!t,ne=t?p.stills[0]??0:0,oe=Date.now(),ce=[],be=()=>{if(!I)return;for(let z of I.querySelectorAll(".dg-spots"))z.remove();if(ce.length===0)return;let M=g.mark,G=o.createElementNS(hs,"g");G.setAttribute("class","dg-spots");for(let z of ce){let U=o.createElementNS(hs,"rect");U.setAttribute("class","dg-spot"),U.setAttribute("x",String(z.x-M.pad)),U.setAttribute("y",String(z.y-M.pad)),U.setAttribute("width",String(z.w+M.pad*2)),U.setAttribute("height",String(z.h+M.pad*2)),U.setAttribute("rx",String(M.radius)),G.append(U)}(I.querySelector('g[clip-path^="url(#dg-vp-"] > g.dg-a')??I).append(G)},le=M=>{let G;if(M!==void 0){let z=o.createElement("div");z.innerHTML=M,G=z.querySelector("svg")}else G=I?I.cloneNode(!0):null;G&&(G.setAttribute("aria-hidden","true"),G.removeAttribute("role"),G.removeAttribute("aria-label"),G.style.setProperty("--at",String(ne)),G.style.setProperty("--play",V?"running":"paused"),G.dataset.motion=V?"play":"still",I?I.replaceWith(G):b.append(G),I=G,oe=Date.now(),be())},pe=()=>Z==="follow"?mn(s.diagram,s.layout,p,l,s.theme,{width:S,...D===void 0?{}:{height:D},lang:r}):s.svg,ue=()=>V?(ne+(Date.now()-oe)/1e3)%p.total:ne,Se=M=>{let G=0;return p.steps.forEach((z,U)=>{z.start<=M&&(G=U)}),G},xe=()=>{let M=v[F];_.textContent=Ir(F,w),J.textContent=M?.title??"",L.textContent=M?.body??"",$.setAttribute("aria-label",V?c.pause:c.play),$.textContent=V?kt.pause:kt.play,a.onStep?.(F)},ke=(M,G)=>{ne=M,V=G,le(),xe()},u=M=>{F=Math.min(w-1,Math.max(0,M));let G=p.steps[F];ke(V?G.start:p.stills[F]??G.start,V)};le(pe()),xe();let B=i?.setInterval(()=>{if(!V)return;let M=Se(ue());M!==F&&(F=M,xe())},120),H=()=>u(F-1),W=()=>u(F+1),ie=()=>V?ke(ue(),!1):ke(ne,!0),h=M=>{let G=M.target?.closest?.("[data-step]"),z=G?Number(G.getAttribute("data-step")):Number.NaN;Number.isInteger(z)&&u(z)};x.addEventListener("click",H),m.addEventListener("click",W),$.addEventListener("click",ie),b.addEventListener("click",h);let j=i?.ResizeObserver,N=j?new j(()=>{let M=K(),G=X(),z=un(s,M,G).mode;if(z===Z&&(Z==="fixed"||M===S&&G===D))return;let U=ue();Z=z,S=M,D=G,ne=U,le(pe())}):void 0;return N?.observe(b),{get step(){return F},get playing(){return V},next:W,prev:H,play:()=>{V||ke(ne,!0)},pause:()=>{V&&ke(ue(),!1)},goTo:M=>{V=!1,u(M)},mark:M=>{ce=M,be()},destroy:()=>{B!==void 0&&i?.clearInterval(B),N?.disconnect(),x.removeEventListener("click",H),m.removeEventListener("click",W),$.removeEventListener("click",ie),b.removeEventListener("click",h),d.remove()}}}return Ps(Br);})();
1
+ "use strict";var DragonPlayer=(()=>{var wn=Object.defineProperty;var es=Object.getOwnPropertyDescriptor;var ts=Object.getOwnPropertyNames;var ns=Object.prototype.hasOwnProperty;var rs=(t,n)=>{for(var a in n)wn(t,a,{get:n[a],enumerable:!0})},ss=(t,n,a,c)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of ts(n))!ns.call(t,l)&&l!==a&&wn(t,l,{get:()=>n[l],enumerable:!(c=es(n,l))||c.enumerable});return t};var is=t=>ss(wn({},"__esModule",{value:!0}),t);var Ci={};rs(Ci,{mountDiagram:()=>Zr});var $n=t=>/[0-9A-Za-z]$/u.test(t)?`${t} `:t,os=t=>t.charAt(0).toUpperCase()+t.slice(1),ze={ja:{cannotDraw:t=>`\u56F3\u3092\u63CF\u3051\u306A\u3044: ${t}`,unknownColor:t=>`colors \u306E ${t} \u306F\u8272\u5473\u306B\u7121\u3044\u8272\u306E\u540D\u524D`,unreadableColor:t=>`colors \u306E ${t} \u306E\u5024\u3092\u8272\u3068\u3057\u3066\u8AAD\u3081\u306A\u3044`,overview:"\u5168\u4F53\u56F3",prev:"\u524D\u306E\u6BB5",pause:"\u6B62\u3081\u308B",play:"\u52D5\u304B\u3059",next:"\u6B21\u306E\u6BB5",steps:t=>`${t} \u306E\u6BB5`,side:"\u8107\u9053",sideNote:"\u4ECA\u56DE\u306F\u901A\u3089\u306A\u3044",sideFrom:t=>`${t} \u3064\u306E\u72B6\u614B\u304B\u3089\u5165\u308C\u308B`,trail:"\u901A\u3063\u305F\u72B6\u614B",start:"\u59CB\u307E\u308A",end:"\u7D42\u308F\u308A",badgeName:t=>`\u6BB5\u306E\u756A\u53F7 ${t}`,quoted:t=>`\u300C${t}\u300D`,iconOf:t=>`\u300C${t} \u306E\u7D75\u67C4\u300D`,coin:"\u300C\u786C\u8CA8\u300D",envelope:"\u300C\u5C01\u7B52\u300D",textsOverlap:(t,n)=>`${$n(t)}\u3068${$n(n)}\u304C\u91CD\u306A\u308B`,lineCrosses:(t,n,a)=>`\u7DDA ${t} \u2192 ${n} \u304C${$n(a)}\u3092\u6A2A\u5207\u308B`,timeUnits:{ms:"\u30DF\u30EA\u79D2",s:"\u79D2",min:"\u5206",h:"\u6642\u9593",d:"\u65E5"},zoom:"\u62E1\u5927",range:(t,n)=>`${t}\u301C${n}`,headJoin:" \u30FB ",empty:"\u7A7A\u304D"},en:{cannotDraw:t=>`Cannot draw the diagram: ${t}`,unknownColor:t=>`colors.${t} is not a color name of the palette`,unreadableColor:t=>`colors.${t} cannot be read as a color`,overview:"Overview",prev:"Previous step",pause:"Pause",play:"Play",next:"Next step",steps:t=>`Steps of ${t}`,side:"Side path",sideNote:"Not taken this time",sideFrom:t=>`Enterable from ${t} ${t===1?"state":"states"}`,trail:"States passed",start:"Start",end:"End",badgeName:t=>`step number ${t}`,quoted:t=>`"${t}"`,iconOf:t=>`the icon of "${t}"`,coin:"the coin",envelope:"the envelope",textsOverlap:(t,n)=>os(`${t} and ${n} overlap`),lineCrosses:(t,n,a)=>`The line ${t} \u2192 ${n} crosses ${a}`,timeUnits:{ms:"ms",s:"s",min:"min",h:"h",d:"d"},zoom:"Zoom",range:(t,n)=>`${t}\u2013${n}`,headJoin:" \xB7 ",empty:"Empty"}};var Gn={clear:{name:"\u6F84\u3093\u3060\u8272",note:"\u767D\u3044\u5730\u306B\u3001\u4E2D\u304F\u3089\u3044\u306E\u660E\u308B\u3055\u306E\u9BAE\u3084\u304B\u306A 6 \u8272\u3002\u4ECA\u306E\u898B\u672C\u5E33\u306E\u8272",light:{page:"#f3f4f7",bg:"#ffffff",surf:"#ffffff",sunk:"#f5f6f8",ink:"#12141a",ink2:"#3f4451",mute:"#6b7180",hair:"#12141a1c",line:"#12141a40",sh:"#101828","on-c":"#ffffff","c-blue":"#467deb","t-blue":"#2e62ce","c-amber":"#d28008","t-amber":"#975b04","c-green":"#0ea886","t-green":"#07775e","c-violet":"#6c3bb2","t-violet":"#6c3bb2","c-rose":"#ba3e40","t-rose":"#b83c3f","c-slate":"#5d6677","t-slate":"#5d6677",coin:"#e9b114",coint:"#856300",coinin:"#a8740c",tint:"5%",edge:"20%",shA:".05",shB:".08",carry:"#65686f"},dark:{page:"#08090c",bg:"#0d0e12",surf:"#17191f",sunk:"#121419",ink:"#eceef3",ink2:"#c4c8d2",mute:"#9198a6",hair:"#eceef31f",line:"#eceef340",sh:"#000000","on-c":"#0d0e12","c-blue":"#7e7ef6","t-blue":"#989cfd","c-amber":"#c78135","t-amber":"#dd954b","c-green":"#20ac7a","t-green":"#35b986","c-violet":"#695b9f","t-violet":"#a79ae3","c-rose":"#bc434b","t-rose":"#fd7d81","c-slate":"#9ba3b2","t-slate":"#9da5b4",coin:"#f0c040",coint:"#f0c040",coinin:"#9a6a0c",tint:"6%",edge:"19%",shA:".45",shB:".35"}},paper:{name:"\u7D19\u3068\u58A8",note:"\u751F\u6210\u308A\u306E\u7D19\u306E\u5730\u306B\u3001\u85CD / \u9EC4\u571F / \u82D4 / \u8461\u8404 / \u6731 / \u920D\u306E\u304F\u3059\u3093\u3060 6 \u8272",light:{page:"#ece7dd",bg:"#f9f6f0",surf:"#fffcf6",sunk:"#f2ede4",ink:"#221e18",ink2:"#4b453b",mute:"#7b7366",hair:"#221e181f",line:"#221e1847",sh:"#3a2a10","on-c":"#fffcf6","c-blue":"#487dd5","t-blue":"#2d60b5","c-amber":"#c38405","t-amber":"#885a01","c-green":"#57a271","t-green":"#237143","c-violet":"#904698","t-violet":"#904698","c-rose":"#a9513e","t-rose":"#9f4836","c-slate":"#6a645a","t-slate":"#696359",coin:"#d4a52a",coint:"#7d5e05",coinin:"#9a7016",tint:"6%",edge:"22%",shA:".06",shB:".07",carry:"#68635c"},dark:{page:"#0e0d0b",bg:"#15130f",surf:"#1e1b17",sunk:"#191612",ink:"#ede6d8",ink2:"#cbc2b1",mute:"#9c9283",hair:"#ede6d81f",line:"#ede6d842",sh:"#000000","on-c":"#15130f","c-blue":"#5785d5","t-blue":"#76a6f9","c-amber":"#be8802","t-amber":"#d59e2f","c-green":"#52aa71","t-green":"#61b87e","c-violet":"#90529b","t-violet":"#d08edb","c-rose":"#bb4e3d","t-rose":"#f98672","c-slate":"#a9a295","t-slate":"#aca598",coin:"#dcb24e",coint:"#dcb24e",coinin:"#8a6a14",tint:"6%",edge:"19%",shA:".45",shB:".35"}},night:{name:"\u591C\u306E\u8A08\u5668",note:"\u9752\u307F\u306E\u9ED2\u306E\u5730\u306B\u3001\u5149\u308B\u6C34\u8272 / \u7425\u73C0 / \u82E5\u7DD1 / \u83EB / \u6843 \u306E 6 \u8272\u3002\u660E\u308B\u3044\u5074\u306F\u9752\u7070\u306E\u5730",light:{page:"#e9eef5",bg:"#f6f9fc",surf:"#ffffff",sunk:"#eef3f8",ink:"#0b1424",ink2:"#34425a",mute:"#64748b",hair:"#0b14241c",line:"#0b142440",sh:"#0b1424","on-c":"#ffffff","c-blue":"#0385cd","t-blue":"#086aa3","c-amber":"#ba8e0f","t-amber":"#7f5f04","c-green":"#0a8857","t-green":"#027449","c-violet":"#5839ba","t-violet":"#5839ba","c-rose":"#dd4a94","t-rose":"#b82375","c-slate":"#64748b","t-slate":"#56667c",coin:"#eab308",coint:"#7e6005",coinin:"#a16207",tint:"5%",edge:"22%",shA:".06",shB:".09",carry:"#596579"},dark:{page:"#060a12",bg:"#0a101c",surf:"#111a2a",sunk:"#0d1522",ink:"#e6edf7",ink2:"#b8c4d6",mute:"#8090a8",hair:"#e6edf71c",line:"#9fb3d145",sh:"#000000","on-c":"#0a101c","c-blue":"#3884b6","t-blue":"#62ace1","c-amber":"#be8533","t-amber":"#d59b4b","c-green":"#3ba774","t-green":"#4fb884","c-violet":"#7d4ecd","t-violet":"#b494fd","c-rose":"#bc3a74","t-rose":"#ff77ad","c-slate":"#96a3b5","t-slate":"#99a6b8",coin:"#facc15",coint:"#facc15",coinin:"#a16207",tint:"6%",edge:"19%",shA:".5",shB:".4"}}};var Et={sans:"Noto Sans JP Variable",mono:"JetBrains Mono Variable"},ls={0:590,1:590,2:590,3:590,4:590,5:590,6:590,7:590,8:590,9:590," ":228,"!":371,'"':575,"#":590,$:590,"%":963,"&":740,"'":325,"(":378,")":378,"*":507,"+":590,",":325,"-":371,".":325,"/":390,":":325,";":325,"<":590,"=":590,">":590,"?":514,"@":1007,A:642,B:682,C:657,D:715,E:616,F:586,G:718,H:758,I:330,J:568,K:686,L:579,M:854,N:750,O:771,P:668,Q:771,R:682,S:624,T:626,U:748,V:619,W:915,X:627,Y:581,Z:614,"[":378,"\\":390,"]":378,"^":590,_:568,"`":626,a:591,b:644,c:528,d:645,e:581,f:372,g:598,h:640,i:305,j:306,k:605,l:315,m:964,n:641,o:626,p:645,q:645,r:437,s:495,t:421,u:638,v:576,w:863,x:562,y:575,z:512,"{":378,"|":297,"}":378,"~":590,"\u2026":1e3,"\u2212":590,"\xD7":1e3,"\u2192":1e3,"\u2190":1e3,"\u2191":1e3,"\u2193":1e3,"\u2013":545,"\u2014":908,"\u2018":325,"\u2019":325,"\u201C":575,"\u201D":575,"\xB0":404,"\xB1":1e3,"\xB7":593,"\u2022":379},cs=600,ps=11904,jt=1e3;function _n(t,n){return(t.codePointAt(0)??0)>=ps?jt:n==="mono"?cs:ls[t]??jt}var ms="paper",kn=Object.fromEntries(Object.entries(Gn).map(([t,n])=>[t,{id:t,...n}]));function Yn(t){return(t!==void 0&&Object.hasOwn(kn,t)?kn[t]:void 0)??kn[ms]}var ds=["page","bg","surf","sunk","ink","ink2","mute","hair","line","sh","on-c","c-blue","t-blue","c-amber","t-amber","c-green","t-green","c-violet","t-violet","c-rose","t-rose","c-slate","t-slate","coin","coint","coinin","tint","edge","shA","shB","carry"],fs=new Set(ds),Vn=t=>fs.has(t);function Wn(t){if(typeof t!="string"||!/^[\w\s#%.,()/+-]+$/u.test(t)||/url\(/iu.test(t))return!1;let n=0;for(let a of t)if(n+=a==="("?1:a===")"?-1:0,n<0)return!1;return n===0}function Dt(t,n){return Object.entries(t[n]).map(([a,c])=>`--${a}:${c}`).join(";")}var Ct=`--sans:"${Et.sans}";--mono:"${Et.mono}"`,ct=["blue","amber","green","violet","rose"],$e=(t,n,a="sans")=>({size:t,weight:n,family:a}),O={boxName:$e(13,650),boxSub:$e(11,500),boxSubStrong:$e(11,700),regionName:$e(12.5,700),regionNote:$e(11,500),label:$e(11,600,"mono"),labelJa:$e(11,650),action:$e(11,650),badge:$e(10.5,700,"mono"),carrier:$e(10.5,700,"mono"),carrierJa:$e(10.5,700),stripTitle:$e(12.5,700),fieldName:$e(10.5,600),fieldValue:$e(12,600,"mono"),fieldValueJa:$e(12,600),tag:$e(10.5,700),miniTitle:$e(10.5,700),stepTitle:$e(15,700),stepBody:$e(13.5,500),stepNo:$e(13,700,"mono"),button:$e(14,700),gitId:$e(11,700),gitHash:$e(10.5,600,"mono"),gitNote:$e(10.5,650),timeHead:$e(11,650,"mono"),timeRow:$e(11,600),timeTick:$e(10.5,600,"mono"),timePeriod:$e(11.5,650),timeRange:$e(10.5,500,"mono"),pointName:$e(11,700,"mono"),pointState:$e(11.5,700),spanText:$e(11,650),emptyText:$e(11,700),meterLine:$e(10.5,700,"mono")},w={gap:10,margin:14,box:{h:72,minW:92,padX:12,radius:12,icon:24,iconRadius:7,iconY:-16,iconScale:.74,nameY:12,subY:27},region:{pad:18,gap:10,radius:14,inset:14,icon:24,iconRadius:7,iconScale:.68,nameY:58,line:16,minH:108},architecture:{columns:4,columnGap:56,maxColumnGap:160,rowGap:44,labelRoom:16},sequence:{columnGap:40,labelRoom:16,labelOffset:16,firstRow:10,rowGap:6,stepGap:6,minPitch:32,tail:10,selfW:34,selfH:18},state:{columns:4,columnGap:64,rowGap:108,labelRoom:16,start:7,end:{r:9,inner:5},drop:56,below:64,beside:38,text:16,loop:{w:24,h:34,samples:12,badgeAt:.6},side:{pad:16,gap:76,lane:30,entry:28},ghost:{h:52,pad:12,gap:10,nameY:-2,subY:14},done:{r:6.5,inset:13},pastLabel:.85},git:{x0:120,pitch:90,textGap:12,r:12,orphan:13.5,topLine:120,line:90,topBelow:30,below:82,bare:62,above:18,under:27,lineStep:13,tagTop:58,tag:30,row:22,turn:60,samples:12,boxGap:24,labelUnder:50,colors:["blue","violet","green","amber","rose"]},time:{width:728,axisX:118,right:16,gutterGap:12,head:22,boxTop:34,boxGap:36,zoomBottom:14,sep:12,zoomGap:12,rowsTop:24,row:20,rowGap:6,markRatio:.5,markMin:1.5,markMax:18,markRadius:1.5,shade:8,frame:2.5,emptyR:1.7,point:{drop:40,r:9,text:15,nameY:-2,stateY:12,link:10,end:6,room:30,plain:12,glyph:.62},bracket:{gap:12,tick:6,text:16,lane:34},box:{pad:6,tagX:12,tagH:16,tagPadX:7},axisGap:18,major:12,minor:6,minorPx:40,tickY:18,rangeY:14,nameGap:8,ticks:6,bottom:12,needle:{over:8,head:6,dot:3.5},meter:{w:150,h:6,y:36,mark:5,textY:59,color:"amber"}},edge:{inset:3,arrow:6,arrowHalf:3.5,parallel:5,ghostDash:5,flowDash:9,bend:12},label:{h:20,padX:9,radius:10,offset:22,side:14,search:4,searchMax:400,soft:6,touch:2},action:{h:22,padX:10,radius:11},badge:{r:9.5,ring:9,inset:4,along:14,short:44},carrier:{envW:24,envH:17,coinR:6.5,coinIn:3.8,tagH:18,tagPadX:8,samples:16},slot:{gap:6,pad:3,spread:4,h:24,radius:7,clear:2,lifeline:5,mark:4},mark:{pad:3,radius:5,dash:4,gap:3},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}},stroke:{git:2.25,gitOrphan:1.5,mark:1.6,slot:1.2,hair:1,edge:1.7,edgeOn:2.25,arrow:1.5,flow:1.3,halo:7,on:1.75,glyph:2,lifeline:1.2,envelope:1.5,badgeRing:1.5,path:1.6,end:1.6,done:1.2,trail:1.2,timeSlot:.6,timeFrame:1.25,timeAxis:1,timeSpan:1.5,timeDrop:1.4,timePoint:1.75,timeFlag:1.8,timeNeedle:1.25,timeMeter:1.25},shadow:{near:.8,far:4,nearY:1,farY:3},mini:{w:168,pad:8,title:14,inset:12,radius:10},follow:{aspect:.75,minH:320,fitMinH:160,ease:.6,narrow:440,badgeRoom:8,headRoom:10,head:{pad:8,h:40,nameY:17,subY:31}},mix:{slot:45,icon:14,regionIcon:16,regionIconEdge:34,cap:12,capEdge:42,badgePast:14,badgePastEdge:70,mini:62,miniBand:16,miniBandEdge:36,view:6,side:4,sideEdge:36,ghostEdge:60,path:55,past:72,timeShade:3.5,timeSpan:6,timeEmpty:8,timeGuide:50},baseline:{label:3.8,badge:3.5,carrier:3.7,stripTitle:4.5,tag:3.6,action:3.8,mark:4},rise:5,popFrom:.4,player:{gap:10,radius:12,button:36,touch:44,hidden:1,focus:2,narrow:440}},oe={intro:1.4,outro:4.6,tail:.6,stepBase:1.2,perChar:.025,stepMin:2.2,stepMax:5,dwell:1.2,edgeAt:.1,stagger:.5,draw:.55,drawCarry:.9,action:.9,change:.12,minShow:.8,labelDelay:.15,fade:.3,popFade:.4,untilFade:.2,still:.45,done:.3,time:{axis:11.5,unitMin:.12,unitMax:.4,wait:.15,after:.15,reset:.05}},Hn=10.5,be={inOut:"cubic-bezier(.65,0,.35,1)",out:"cubic-bezier(.22,1,.36,1)",pop:"cubic-bezier(.34,1.56,.64,1)"};var De=t=>[...t].some(n=>(n.codePointAt(0)??0)>=11904);function us(t,n){return n==="mono"&&De(t)?"sans":n}function le(t,n){let a=us(t,n.family),c=0;for(let l of t)c+=_n(l,a);return c*n.size/jt}function _e(t,n,a,c,l="start"){let e=le(t,c);return{x:l==="middle"?n-e/2:n,y:a-c.size*.8,w:e,h:c.size}}function xt(t){return t.steps.flatMap((n,a)=>n.events.flatMap((c,l)=>c.type==="edge"?[{step:a,event:l,edge:c}]:[]))}function Xe(t){let n=Pn(t),a=new Map;return t.boxes.forEach((c,l)=>{let e=c.region===void 0?void 0:n.get(c.region);a.set(c.id,c.color??e??ct[l%ct.length])}),a}function Pn(t){let n=new Map;return(t.regions??[]).forEach((a,c)=>n.set(a.id,a.color??ct[c%ct.length])),n}var pt=(t,n)=>t.carry.kind==="coin"?"coin":n.get(t.from)??"slate";function Ue(t,n,a){let c=t.boxes.find(e=>e.id===n);if(!c)return w.box.minW;let l=[le(c.name,O.boxName),le(c.sub??"",O.boxSub)];for(let e of t.steps)for(let r of e.events)r.type==="swap"&&r.box===n&&l.push(le(r.text,O.boxSubStrong)),a&&r.type==="action"&&r.box===n&&l.push(le(r.label,O.boxSubStrong));return Math.max(w.box.minW,Math.max(...l)+w.box.padX*2)}function mt(t){let n=w.carrier;return t.kind==="tag"?[(le(t.text,De(t.text)?O.carrierJa:O.carrier)+n.tagPadX*2)/2,n.tagH/2]:t.kind==="coin"?[n.coinR,n.coinR]:[n.envW/2,n.envH/2]}var zn=t=>t.main+t.coin+(t.main>0&&t.coin>0?w.slot.spread:0);function wt(t){let n=new Map,a=new Set(t.boxes.map(c=>c.id));for(let c of t.steps)for(let l of c.events){if(l.type!=="edge"||l.carry.kind==="none")continue;let e=l.carry.kind==="coin"?"coin":"main",r=mt(l.carry)[0]*2;for(let s of[l.from,l.to]){if(!a.has(s))continue;let i=n.get(s)??{main:0,coin:0};i[e]=Math.max(i[e],r),n.set(s,i)}}return n}function $t(t,n,a){return t?(n?w.box.icon+w.slot.gap:0)+zn(t)+w.slot.pad*2+w.box.padX+a:0}function kt(t,n,a=w.box.padX){if(!n)return;let c=w.box,l=w.slot,e=zn(n)+l.pad*2,r=t.icon?c.icon+l.gap:0,s=Math.max(t.x+c.padX,Math.min(t.cx-(r+e)/2,t.x+t.w-a-(r+e)));t.icon&&(t.iconX=s+c.icon/2),t.slot={x:s+r,y:t.cy+c.iconY-l.h/2,w:e,h:l.h}}function gt(t,n,a){let c=w.slot,l=(e,r)=>{let s=n.get(e),i=a.get(e);if(!s?.slot||!i)return;let o=s.slot.x+c.pad,p=s.slot.y+s.slot.h/2;return i.main>0&&i.coin>0?r.kind==="coin"?[o+i.main+c.spread+i.coin/2,p]:[o+i.main/2,p]:[s.slot.x+s.slot.w/2,p]};for(let e of t){if(e.carry.kind==="none")continue;let r=l(e.to,e.carry),s=l(e.from,e.carry);r&&(e.settle=r),s&&(e.wait=s)}}function bt(t,n){let a=Math.max(n.x-(t.x+t.w),t.x-(n.x+n.w)),c=Math.max(n.y-(t.y+t.h),t.y-(n.y+n.h));return Math.max(a,c)}function It(t,n,a=0){let c=n.x+a,l=n.y+a,e=n.x+n.w-a,r=n.y+n.h-a;if(e<=c||r<=l)return!1;for(let s=1;s<t.length;s++){let[i,o]=t[s-1],[p,f]=t[s],b=p-i,m=f-o,d=0,$=1,S=(u,h)=>{if(u===0)return h>0;let P=h/u;return u<0?d=Math.max(d,P):$=Math.min($,P),d<$};if(S(-b,i-c)&&S(b,e-i)&&S(-m,o-l)&&S(m,r-o))return!0}return!1}function hs(t){let n={a:t[0],b:t[1]??t[0],length:-1};for(let a=1;a<t.length;a++){let c=t[a-1],l=t[a],e=Math.hypot(l[0]-c[0],l[1]-c[1]);e>n.length&&(n={a:c,b:l,length:e})}return{a:n.a,b:n.b,vertical:Math.abs(n.b[0]-n.a[0])<Math.abs(n.b[1]-n.a[1])}}function st(t,n){let a=n;for(let c=1;c<t.length;c++){let l=t[c-1],e=t[c],r=Math.hypot(e[0]-l[0],e[1]-l[1]);if(a<=r&&r>0)return[l[0]+(e[0]-l[0])*a/r,l[1]+(e[1]-l[1])*a/r];a-=r}return t[t.length-1]}function vt(t){let n=0;for(let a=1;a<t.length;a++){let c=t[a-1],l=t[a];n+=Math.hypot(l[0]-c[0],l[1]-c[1])}return n}function Ft(t){let{w:n,h:a,samples:c}=w.state.loop,l=t.y+t.h,e=[t.cx+n/2,l],r=[t.cx+n*3/4,l+a*4/3],s=[t.cx-n*3/4,l+a*4/3],i=[t.cx-n/2,l+w.edge.inset];return Array.from({length:c+1},(o,p)=>{let f=p/c,b=1-f,m=d=>b*b*b*e[d]+3*b*b*f*r[d]+3*b*f*f*s[d]+f*f*f*i[d];return[m(0),m(1)]})}function Bt(t){let n=Math.max(...t.map(([l])=>l)),a=t[0][1],c=Math.max(...t.map(([,l])=>l));return[n+w.badge.r+w.badge.inset,a+(c-a)*w.state.loop.badgeAt]}function Gt(t,n){return{x:(t[0]?.[0]??0)-w.state.loop.w/2-n/2,y:Math.max(...t.map(([,a])=>a))+w.label.soft}}var Sn=w.state.loop.h+w.label.soft*2+w.label.h;function it(t,n=[],a=[]){let c=vt(t),l=c<w.badge.short?Math.min(w.badge.r+1,c/2):w.badge.along,e=w.badge.r*2+w.badge.inset;for(let r=l;r<=c;r+=1){let s=st(t,r);if(n.every(([i,o])=>Math.hypot(s[0]-i,s[1]-o)>=e))return s}return gs(t,l,n,a)??st(t,l)}function gs(t,n,a,c){let l=vt(t),[e,r]=st(t,n),[s,i]=st(t,Math.max(0,n-1)),[o,p]=st(t,Math.min(l,n+1)),f=Math.hypot(o-s,p-i);if(f===0)return;let[b,m]=[-(p-i)/f,(o-s)/f],d=w.badge.r*2;for(let $ of[w.edge.arrowHalf,0])for(let S=1;S<=d+w.badge.inset;S++)for(let u of[1,-1]){let h=[e+b*S*u,r+m*S*u];if(a.every(([I,G])=>Math.max(Math.abs(h[0]-I),Math.abs(h[1]-G))>=d+1)&&c.every(I=>!It(I,Ye(h),-$)))return h}}var qt=t=>t.points.map(([n,a])=>`${Math.round(n*10)},${Math.round(a*10)}`).join(" ");function ot(t,n,a=(c,l,e)=>it(c.points,l,e)){let c=new Map,l=[],e=new Map;for(let r=0;r<n;r++){let s=t.find(b=>b.step===r&&b.points.length>0);if(!s)continue;let i=qt(s),o=e.get(i);if(o){c.set(r,{point:o,edge:s});continue}let p=t.filter(b=>b.points.length>1&&qt(b)!==i).map(b=>b.points),f=a(s,l,p);l.push(f),e.set(i,f),c.set(r,{point:f,edge:s})}return c}function Je(t){let n=(a,c)=>Math.hypot(a.x-c.x,a.y-c.y)<=.5;return t.map(a=>{let c=t.filter(l=>l.step>a.step&&n(l,a)).sort((l,e)=>l.step-e.step)[0];return c?{...a,until:c.step}:a})}var Ye=([t,n])=>({x:t-w.badge.r,y:n-w.badge.r,w:w.badge.r*2,h:w.badge.r*2}),_t=t=>[t.x+w.state.text,t.y+w.baseline.mark],He=t=>De(t)?O.labelJa:O.label,ys={above:"below",below:"above",left:"right",right:"left"};function Ke(t,n){let a=le(t.text,He(t.text))+w.label.padX*2,c=w.label.h,l=hs(t.points),e=(l.a[0]+l.b[0])/2,r=(l.a[1]+l.b[1])/2,s=t.side??(l.vertical?"right":"above"),{side:i}=w.label,o=t.offset??w.label.offset,p=S=>S==="above"?{x:e-a/2,y:r-o-c/2,w:a,h:c}:S==="below"?{x:e-a/2,y:r+o-c/2,w:a,h:c}:S==="left"?{x:e-i-a,y:r-c/2,w:a,h:c}:{x:e+i,y:r-c/2,w:a,h:c},f=t.base?{...t.base,w:a,h:c}:p(s),b=t.flip?[s,ys[s]]:[s],m=S=>n.hard.every(u=>bt(S,u)>=w.gap)&&n.soft.every(u=>bt(S,u)>=w.label.soft)&&(n.touch??[]).every(u=>bt(S,u)>=w.label.touch)&&(n.lines??[]).every(u=>!It(u,S,-w.label.touch)),{search:d,searchMax:$}=w.label;for(let S=0;S<=$;S+=d)for(let u of b){let h=u===s?f:p(u),P=u==="above"?[0,-1]:u==="below"?[0,1]:u==="left"?[-1,0]:[1,0],I=[Math.abs(P[1]),Math.abs(P[0])],G=t.slide??(u==="above"||u==="below"?a:c*4);for(let ne=0;ne<=G;ne+=d)for(let U of ne===0?[1]:[1,-1]){let j={x:h.x+P[0]*S+I[0]*ne*U,y:h.y+P[1]*S+I[1]*ne*U,w:a,h:c};if(m(j))return{...j,step:t.step,event:t.event,text:t.text,family:He(t.text).family,color:t.color}}}return{...f,step:t.step,event:t.event,text:t.text,family:He(t.text).family,color:t.color}}function Mn(t){let n=/^([0-9]+(?:\.[0-9]+)?)%$/u.exec(t.trim());if(n)return Math.min(1,Math.max(0,Number(n[1])/100));let a=/^([0-9]+)\/([0-9]+)$/u.exec(t.trim());if(a&&Number(a[2])>0)return Math.min(1,Math.max(0,Number(a[1])/Number(a[2])))}var Kn=(t,n)=>t.strip?.meters?.find(a=>a.field===n);function Xn(t,n){if(Kn(t,n))return Math.max(le(n,O.fieldName),w.time.meter.w);let a=0,c=0;for(let e of t.steps)for(let r of e.events)r.type!=="strip"||r.field!==n||(r.value!==void 0&&(a=Math.max(a,le(r.value,De(r.value)?O.fieldValueJa:O.fieldValue))),r.tag!==void 0&&(c=Math.max(c,le(r.tag,O.tag)+w.strip.tagPadX*2)));let l=a+(c>0?(a>0?w.strip.tagGap:0)+c:0);return Math.max(le(n,O.fieldName),l)}var vn=t=>Math.max(le(t.title,O.fieldName),t.states.length*w.strip.trail.step);function Ze(t,n){if(!t.strip)return 0;let{titleX:a,fieldGap:c,pad:l}=w.strip,e=a+le(t.strip.title,O.stripTitle)+c,r=[...t.strip.fields.map(s=>Xn(t,s)),...n?[vn(n)]:[]];return e+r.reduce((s,i)=>s+i+c,0)-c+l}function Qe(t,n,a,c,l){if(!t.strip)return;let{titleX:e,fieldGap:r,pad:s,line:i,h:o}=w.strip,p=e+le(t.strip.title,O.stripTitle)+r,f=[],b=p,m=0,d=S=>{b>p&&b+S>c-s&&(b=p,m++);let u={x:n+b,y:a+m*i};return b+=S+r,u};for(let S of t.strip.fields){let u=Xn(t,S),h=d(u),P=Kn(t,S),I=P?Mn(P.line):void 0;f.push({name:S,...h,w:u,...P&&I!==void 0?{meter:{line:I,text:P.line,x:h.x,w:w.time.meter.w}}:{}})}let $=l?{...l,...d(vn(l)),w:vn(l)}:void 0;return{x:n,y:a,w:c,h:o+m*i,title:t.strip.title,fields:f,...$?{trail:$}:{}}}function Pt(t,n,a){let c=l=>{l.x+=n,l.y+=a};for(let l of t.boxes)c(l),l.cx+=n,l.cy+=a,l.slot&&c(l.slot),l.iconX!==void 0&&(l.iconX+=n);for(let l of t.regions)l.y+=a,c(l.header);for(let l of t.lifelines)l.x+=n,l.y1+=a,l.y2+=a;for(let l of t.edges)l.points=l.points.map(([e,r])=>[e+n,r+a]),l.settle&&(l.settle=[l.settle[0]+n,l.settle[1]+a]),l.wait&&(l.wait=[l.wait[0]+n,l.wait[1]+a]);for(let l of t.labels)c(l);for(let l of t.paths)l.points=l.points.map(([e,r])=>[e+n,r+a]),l.label&&c(l.label);for(let l of t.ends)l.x+=n,l.y+=a;t.side&&c(t.side);for(let l of t.actions)c(l);for(let l of t.badges)l.x+=n,l.y+=a;if(t.strip){t.strip.y+=a;for(let l of t.strip.fields)l.x+=n,l.y+=a,l.meter&&(l.meter.x+=n);t.strip.trail&&(t.strip.trail.x+=n,t.strip.trail.y+=a)}}function St(t,n,a){let{inset:c}=w.badge;for(let e of t){let r=e.type==="swap"||e.type==="action"?e.box:void 0,s=a.boxes.find(i=>i.id===r);if(s)return{step:n,x:s.x,y:s.y,color:s.color}}if(a.strip&&t.some(e=>e.type==="strip"))return{step:n,x:a.strip.x+c,y:a.strip.y+c,color:"slate"};let l=a.boxes[0];return{step:n,x:l.x,y:l.y,color:l.color}}function Jn(t){let n=bs(t),a=xs(t,n),c=n.map(()=>({top:0,bottom:0})),l=Un(t,n,a,c);for(let e=0;e<3&&ks(l,n,a,c);e++)l=Un(t,n,a,c);return l}function bs(t){let n=t.regions??[],a=new Set(n.map(e=>e.id)),c=n.map(e=>({region:e,members:t.boxes.filter(r=>r.region===e.id).map(r=>r.id)})),l=t.boxes.filter(e=>e.region===void 0||!a.has(e.region)).map(e=>e.id);return l.length>0&&c.push({members:l}),c}var Zn=t=>t==="left"||t==="right";function xs(t,n){let a=w.architecture.columns,c=xt(t).map(r=>r.edge),l=new Map;n.forEach((r,s)=>{let i=new Set(r.members),o=new Set,p=(u,h)=>u>=0&&u<a&&!o.has(`${u},${h}`),f=(u,h)=>{let P=Math.min(a-1,Math.max(0,u));for(let I=h;;I++)for(let G=0;G<a;G++)for(let ne of[P+G,P-G])if(p(ne,I))return[ne,I]},b=(u,h,P)=>{l.set(u,{group:s,col:h,row:P}),o.add(`${h},${P}`)},m=1,d=u=>{for(let h of c){let P=h.from===u?h.to:h.to===u?h.from:void 0;if(P===void 0||!i.has(P)||l.has(P))continue;let I=l.get(u),[G,ne]=Zn(h.labelSide)?f(I.col,I.row+1):p(I.col+m,I.row)?[I.col+m,I.row]:f(I.col+m,I.row);b(P,G,ne),d(P)}},$=u=>{for(let h=0;h<c.length;h++){let P=c[h],I=P?.from===u?P.to:P?.to===u?P.from:void 0,G=I===void 0?void 0:l.get(I);if(G&&G.group<s)return{order:h,col:G.col}}},S=0;for(;;){let u=r.members.filter(U=>!l.has(U));if(u.length===0)break;let h=u.map(U=>({id:U,anchor:$(U)})).filter(U=>U.anchor!==void 0);h.sort((U,j)=>(U.anchor?.order??0)-(j.anchor?.order??0));let P=h[0]??{id:u[0],anchor:void 0},I=P.anchor?.col??0;S===0&&(m=I>=(a-1)/2?-1:1);let[G,ne]=p(I,0)?[I,0]:f(I,0);b(P.id,G,ne),d(P.id),S++}});let e=[...new Set([...l.values()].map(r=>r.col))].sort((r,s)=>r-s);for(let r of l.values())r.col=e.indexOf(r.col);return l}function ws(t){let n=[...t.matchAll(/ /g)].map(c=>c.index);if(n.length===0)return[t];let a=n.reduce((c,l)=>Math.abs(l-t.length/2)<Math.abs(c-t.length/2)?l:c);return[t.slice(0,a),t.slice(a+1)]}function $s(t){let{icon:n,nameY:a,line:c,inset:l}=w.region,e=ws(t.name),r=Math.max(n,...e.map(i=>le(i,O.regionName)),le(t.note??"",O.regionNote)),s=a-l+(e.length-1)*c+(t.note?c:0)+w.gap/2;return{w:r,h:s,lines:e}}function Un(t,n,a,c){let{box:l,region:e,architecture:r,margin:s,gap:i}=w,o=Xe(t),p=Pn(t),f=xt(t),b=Math.max(1,...[...a.values()].map(y=>y.col+1)),m=wt(t),d=new Map(t.boxes.map(y=>[y.id,Math.max(Ue(t,y.id,!0),$t(m.get(y.id),y.icon!==void 0,l.padX))])),$=Array.from({length:b},(y,L)=>Math.max(l.minW,...[...a].filter(([,M])=>M.col===L).map(([M])=>d.get(M)??l.minW))),S=Array.from({length:Math.max(0,b-1)},()=>r.columnGap);for(let{edge:y}of f){let L=a.get(y.from),M=a.get(y.to);if(!L||!M||y.label===void 0||L.group!==M.group||L.row!==M.row||Math.abs(L.col-M.col)!==1||Zn(y.labelSide))continue;let F=le(y.label,He(y.label))+w.label.padX*2+r.labelRoom*2,te=Math.min(L.col,M.col);F<=r.maxColumnGap&&(S[te]=Math.max(S[te]??0,F))}let u=n.map(y=>y.region?$s(y.region):void 0),h=Math.max(0,...u.map(y=>y?y.w+e.inset*2:0)),P=[];for(let y=0;y<b;y++)P.push(y===0?s+(h>0?h:e.pad):P[y-1]+$[y-1]+S[y-1]);let I=y=>P[y]+$[y]/2,G=new Set(f.filter(({edge:y})=>y.from===y.to).map(({edge:y})=>y.from)),ne=new Set([...G].flatMap(y=>{let L=a.get(y);return L?[`${L.group}:${L.row}`]:[]})),U=(y,L)=>ne.has(`${y}:${L}`)?Sn:0,j=[],A=[],C=s;n.forEach((y,L)=>{let M=Math.max(1,...y.members.map(xe=>(a.get(xe)?.row??0)+1)),F=c[L],te=C+e.pad+F.top,B=[0];for(let xe=1;xe<M;xe++)B.push(B[xe-1]+l.h+r.rowGap+U(L,xe-1));for(let xe of y.members){let qe=a.get(xe),Ae=t.boxes.find(Be=>Be.id===xe),Se=d.get(xe)??l.minW,je=I(qe.col),Fe=te+B[qe.row];j.push({id:xe,name:Ae?.name??xe,...Ae?.sub!==void 0?{sub:Ae.sub}:{},...Ae?.icon!==void 0?{icon:Ae.icon}:{},color:o.get(xe)??"slate",x:je-Se/2,y:Fe,w:Se,h:l.h,cx:je,cy:Fe+l.h/2})}let _=te+B[M-1]+l.h+U(L,M-1),Z=u[L],ae=Math.max(_+e.pad+F.bottom-C,Z?Z.h+e.inset*2:0,y.region?e.minH:0);A.push({group:L,y:C,h:ae,rows:M}),C+=ae+e.gap});let K=C-e.gap;for(let y of j)kt(y,m.get(y.id));let X=new Map(j.map(y=>[y.id,y])),Q=y=>A[a.get(y)?.group??0],ie=(y,L,M)=>{for(let F=1;F<y.length;F++){let[te,B]=y[F-1],[_,Z]=y[F];if(Math.min(te,_)<=L.x+L.w+M&&Math.max(te,_)>=L.x-M&&Math.min(B,Z)<=L.y+L.h+M&&Math.max(B,Z)>=L.y-M)return!0}return!1},re=[...G].flatMap(y=>{let L=X.get(y);return L?[{x:L.x,y:L.y+L.h,w:L.w,h:Sn}]:[]}),D=y=>re.some(L=>ie(y,L,0)),x=(y,L,M)=>j.some(F=>F.id!==L&&F.id!==M&&ie(y,F,w.label.search))||D(y),N=y=>{let L=X.get(y),M=Q(y),F=a.get(y),te=L.y+L.h+(F?U(F.group,F.row):0);return(F?.row??0)<M.rows-1?te+r.rowGap/2:Math.min(te+e.pad/2,M.y+M.h-w.edge.inset)},E=y=>{let L=X.get(y),M=Q(y);return(a.get(y)?.row??0)>0?L.y-r.rowGap/2:Math.max(L.y-e.pad/2,M.y+w.edge.inset)},v=w.edge.inset,q=(y,L)=>L?P[y]+$[y]+(S[y]??r.columnGap)/2:P[y]-(S[y-1]??r.columnGap)/2,z=(y,L)=>{let M=X.get(y),F=X.get(L);if(y===L)return Ft(M);let te=a.get(y),B=a.get(L);if(te.group===B.group&&te.row===B.row){let Se=F.cx>M.cx,je=[[Se?M.x+M.w:M.x,M.cy],[Se?F.x-v:F.x+F.w+v,F.cy]];if(!x(je,y,L))return je;let Fe=N(y),Be=[[M.cx,M.y+M.h],[M.cx,Fe],[F.cx,Fe],[F.cx,F.y+F.h+v]];if(!D(Be))return Be;let at=E(y),nt=[[M.cx,M.y],[M.cx,at],[F.cx,at],[F.cx,F.y-v]];return D(nt)?Be:nt}let _=F.cy>M.cy,Z=[M.cx,_?M.y+M.h:M.y],ae=[F.cx,_?F.y-v:F.y+F.h+v];if(te.col===B.col){let Se=[Z,ae];if(!x(Se,y,L))return Se;let je=q(te.col,!0);return[[M.x+M.w,M.cy],[je,M.cy],[je,F.cy],[F.x+F.w+v,F.cy]]}let xe=F.cx>M.cx,qe=_?N(y):E(y),Ae=[[Z,[M.cx,F.cy],[xe?F.x-v:F.x+F.w+v,F.cy]],[[xe?M.x+M.w:M.x,M.cy],[F.cx,M.cy],ae],[Z,[M.cx,qe],[F.cx,qe],ae]];if(G.has(y)||G.has(L)){let Se=q(te.col,xe),je=q(B.col,!xe),Fe=[[xe?M.x+M.w:M.x,M.cy],[Se,M.cy]],Be=[xe?F.x-v:F.x+F.w+v,F.cy];Ae.push([...Fe,[Se,F.cy],Be],[...Fe,[Se,qe],[F.cx,qe],ae],[Z,[M.cx,qe],[je,qe],[je,F.cy],Be],[...Fe,[Se,qe],[je,qe],[je,F.cy],Be])}return Ae.find(Se=>!x(Se,y,L))??Ae[2]},ee=f.map(({step:y,event:L,edge:M})=>({step:y,event:L,from:M.from,to:M.to,points:z(M.from,M.to),color:pt(M,o),carry:M.carry}));gt(ee,X,m);let de=new Map;for(let y of ee){if(y.points.length!==2||!ee.some(_=>_.from===y.to&&_.to===y.from&&_.points.length===2))continue;let[M,F]=y.points,te=Math.abs(F[1]-M[1])<Math.abs(F[0]-M[0]),B=(y.from<y.to?1:-1)*w.edge.parallel;y.points=y.points.map(([_,Z])=>te?[_,Z+B]:[_+B,Z]),de.set(y,te?B>0?"below":"above":B>0?"right":"left")}let ce=[];n.forEach((y,L)=>{let M=A[L],F=u[L];!y.region||!F||ce.push({id:y.region.id,lines:F.lines,...y.region.note!==void 0?{note:y.region.note}:{},...y.region.icon!==void 0?{icon:y.region.icon}:{},color:p.get(y.region.id)??"slate",x:s,y:M.y,w:0,h:M.h,header:{x:s+e.inset,y:M.y+e.inset,w:F.w,h:F.h}})});let pe=(y,L,M)=>y.from===y.to?Bt(y.points):it(y.points,L,M),ve=ot(ee,t.steps.length,pe),we=[];for(let y of ee){let L=t.steps[y.step]?.events[y.event];if(L?.type!=="edge"||L.label===void 0)continue;let M=[...ve].filter(([_])=>_<=y.step).map(([,_])=>Ye(_.point)),F=[...ce.map(_=>_.header),...we.filter(_=>_.step===y.step)],te=L.labelSide??de.get(y),B=y.from===y.to?{side:"below",base:Gt(y.points,le(L.label,He(L.label))+w.label.padX*2)}:void 0;we.push(Ke({step:y.step,event:y.event,text:L.label,points:y.points,color:y.color,...B??(te?{side:te}:{flip:!0})},{hard:j,soft:F,touch:M}))}let ye={kind:"architecture",width:0,height:0,regions:ce,boxes:j,lifelines:[],edges:ee,labels:we,actions:[],badges:[],paths:[],ends:[]},Pe=we.length>0?Math.max(0,s+w.label.soft-Math.min(...we.map(y=>y.x))):0;Pe>0&&Pt(ye,Pe,0);let k=Math.max(...j.map(y=>y.x+y.w+e.pad),...we.map(y=>y.x+y.w+w.label.soft),...ee.flatMap(y=>y.points.map(L=>L[0]+e.pad))),V=Math.max(k+s,Ze(t)+s*2);for(let y of ce)y.w=V-s*2;let J=Math.max(K,...we.map(y=>y.y+y.h)),T=Qe(t,s,J+i,V-s*2);ye.width=V,ye.height=(T?T.y+T.h:J)+s,T&&(ye.strip=T);let H=ot(ee,t.steps.length,pe);return ye.badges=Je(t.steps.map((y,L)=>{let M=H.get(L);return M?{step:L,x:M.point[0],y:M.point[1],color:M.edge.color}:St(y.events,L,ye)})),ye}function ks(t,n,a,c){let l=!1,e=w.label.soft;for(let r of t.labels){let s=t.edges.find(d=>d.step===r.step&&d.event===r.event),i=s&&a.get(s.from),o=s&&a.get(s.to);if(!i||!o||i.group!==o.group||!n[i.group]?.region)continue;let p=t.regions.find(d=>d.id===n[i.group]?.region?.id),f=c[i.group];if(!p||!f)continue;let b=p.y+e-r.y,m=r.y+r.h-(p.y+p.h-e);b>0&&(f.top+=b,l=!0),m>0&&(f.bottom+=m,l=!0)}return l}var Yt=t=>Object.keys(t),eo=Yt({sequence:!0,architecture:!0,state:!0,git:!0,time:!0}),Mt=["start","finish"],vs=["scale","period","row","point","zoom","mark","span"];var to=["group","end","box","strip","step","say","code","source","act","note","set","branch","commit",...vs];var dt="HEAD";var no=Yt({coin:!0,none:!0}),ro=Yt({fixed:!0,follow:!0}),so=Yt({above:!0,below:!0,left:!0,right:!0});var nr=t=>t.kind==="git";function Ps(t){let n=(t.git?.branches??[]).map(j=>j.id),a=j=>{n.includes(j)||n.push(j)};for(let j of t.steps)for(let A of j.events)(A.type==="commit"||A.type==="branch")&&a(A.branch);let c=new Map(n.map(j=>[j,null])),l=null,e=null,r=[],s=new Map,i=[],o=[],p=[],f=new Map,b=new Map,m=new Map,d=[...n,dt],$=new Map(d.map(j=>[j,[]])),S=[],u=j=>j===dt?e===null?l:null:c.get(j)??null,h=j=>{let A=f.get(j)??[],C=A.indexOf(null);return C<0?A.length:C},P=(j,A,C,K)=>{let X=new Map(d.map(D=>[D,u(D)])),Q=l;C();let re=d.filter(D=>X.get(D)!==u(D)).map(D=>{let x=m.get(D);return x&&(f.get(x.commit)[x.row]=null,m.delete(D)),{ref:D,slot:x}});for(let{ref:D,slot:x}of re){let N=x??(D===dt&&Q!==null?{commit:Q,row:h(Q)}:void 0),E=u(D),v;if(E!==null){v={commit:E,row:h(E)};let q=f.get(E)??[];q[v.row]=D,f.set(E,q),b.set(E,Math.max(b.get(E)??0,q.filter(z=>z!==null).length)),m.set(D,v)}o.push({ref:D,step:j,event:A,...N?{from:N}:{},...v?{to:v}:{},line:D===K})}},I=(j,A)=>{let C=new Set,K=[...c.values(),l].filter(X=>X!==null);for(;K.length>0;){let X=K.pop();C.has(X)||(C.add(X),K.push(...s.get(X)?.parents??[]))}for(let X of r)!C.has(X.id)&&X.orphan===void 0&&(X.orphan={step:j,event:A})};t.steps.forEach((j,A)=>{j.events.forEach((C,K)=>{if(C.type==="commit")ne(C,A,K);else if(C.type==="branch"){if(!s.has(C.from))return;G(C.from)!==C.branch&&i.push({kind:"branch",from:C.from,to:C.branch,step:A,event:K}),P(A,K,()=>{c.set(C.branch,C.from),e=C.branch,l=C.from})}else if(C.type==="edge"){let X=C.from;if(X!==dt&&!c.has(X)||!s.has(C.to))return;P(A,K,()=>{if(X===dt){e=null,l=C.to;return}c.set(X,C.to),e===X?l=C.to:e===null&&l===C.to&&(e=X)},X)}else return;I(A,K)});for(let C of d)$.get(C)?.push(C===dt?l:c.get(C)??null);S.push(e);for(let C of d){let K=m.get(C);K&&p.push({ref:C,step:A,slot:K})}});function G(j){return s.get(j)?.branch}function ne(j,A,C){if(s.has(j.id))return;let K=j.copy!==void 0&&s.has(j.copy)?j.copy:void 0,X=K!==void 0&&e===null&&l!==null?l:c.get(j.branch)??null,Q=j.merge!==void 0&&j.merge!==j.branch?c.get(j.merge)??void 0:void 0,ie=[...new Set([X,Q].filter(x=>x!=null))],re={id:j.id,branch:j.branch,parents:ie,...Q!==void 0&&Q!==X?{joined:Q}:{},...K!==void 0?{copy:K}:{},...j.hash!==void 0?{hash:j.hash}:{},...j.note!==void 0?{note:j.note}:{},step:A,event:C};r.push(re),s.set(re.id,re);for(let x of ie)i.push({kind:"parent",from:x,to:re.id,step:A,event:C});K!==void 0&&i.push({kind:"copy",from:K,to:re.id,step:A,event:C});let D=e===null&&l===null;P(A,C,()=>{K===void 0?(c.set(j.branch,re.id),e===j.branch&&(l=re.id)):e===null&&(l=re.id),D&&(e=j.branch,l=re.id)})}let U=d.map(j=>({name:j,at:$.get(j)??[],...j===dt?{attached:S}:{}}));return{branches:n,made:r,links:i,moves:o,refs:U,tags:p,rows:b}}function Vt(t,n,a,c){let l=w.git.samples;return Array.from({length:l},(e,r)=>{let s=(r+1)/l,i=1-s,o=p=>i*i*i*t[p]+3*i*i*s*n[p]+3*i*s*s*a[p]+s*s*s*c[p];return[o(0),o(1)]})}function Ss(t,n){return Math.abs(t[1]-n[1])<.5?[t,n]:t[1]>n[1]?[t,[t[0],n[1]],n]:[t,[n[0],t[1]],n]}function Qn(t,n,a){let c=a>t.cy?1:-1,l=[t.cx,t.cy+c*t.r],e=Math.max(0,Math.min(w.git.turn,n-t.cx)),r=[t.cx+e,a],s=Vt(l,[l[0],l[1]+(a-l[1])*.7],[t.cx+e*.2,a],r);return[l,...s,...n>r[0]?[[n,a]]:[]]}function Ms(t,n){let a=n.cy<t.cy?1:-1,c=[t.cx+t.r,t.cy],l=[n.cx,n.cy+a*n.r],e=Math.max(0,Math.min(w.git.turn,n.cx-c[0])),r=[n.cx-e,t.cy],s=Vt(r,[n.cx-e*.2,t.cy],[n.cx,l[1]+(t.cy-l[1])*.7],l);return[c,...r[0]>c[0]?[r]:[],...s]}function Ts(t,n){if(Math.abs(t.cy-n.cy)<.5){let r=t.cy-t.r,s=w.git.turn*.7;return[[t.cx,r],...Vt([t.cx,r],[t.cx,r-s],[n.cx,r-s],[n.cx,r])]}let a=n.cy<t.cy?-1:1,c=[t.cx,t.cy+a*t.r],l=[n.cx,n.cy-a*n.r],e=(l[1]-c[1])*.5;return[c,...Vt(c,[c[0],c[1]+e],[l[0],l[1]-e],l)]}function rr(t){let{margin:n,gap:a,box:c,region:l,git:e,carrier:r}=w,s=Ps(t),i=new Map((t.git?.branches??[]).map(k=>[k.id,k.note])),o=new Map(s.branches.map((k,V)=>[k,V])),p=k=>e.colors[(o.get(k)??0)%e.colors.length],f=new Map,b=new Map;for(let k of s.made){let V=Math.max(0,...k.parents.map(J=>(f.get(J)??-1)+1),(b.get(k.branch)??-1)+1);f.set(k.id,V),b.set(k.branch,V)}let m=k=>[...k.hash!==void 0?[{text:k.hash,style:O.gitHash}]:[],...k.note!==void 0?[{text:k.note,style:O.gitNote}]:[]],d=k=>Math.max(0,...m(k).map(V=>le(V.text,V.style))),$=k=>le(k,De(k)?O.carrierJa:O.carrier)+r.tagPadX*2,S=Math.max(0,...s.refs.map(k=>$(k.name))),u=Math.max(e.pitch,...s.made.map(k=>d(k)+e.textGap),S+e.textGap),h=s.branches.map(k=>({w:Math.max(l.icon,le(k,O.regionName),le(i.get(k)??"",O.regionNote))})),P=n+l.inset+Math.max(0,...h.map(k=>k.w)),I=Math.max(e.r,...s.made.filter(k=>f.get(k.id)===0&&o.get(k.branch)===0).map(k=>d(k)/2),S/2),G=Math.max(e.x0,P+a+I),ne=new Set(s.moves.flatMap(k=>{let V=t.steps[k.step]?.events[k.event];return k.line&&k.to&&V?.type==="edge"&&V.label!==void 0?[s.made.find(J=>J.id===k.to?.commit)?.branch??""]:[]})),U=k=>Math.max(0,...s.made.filter(V=>V.branch===k).map(V=>(s.rows.get(V.id)??0)-2))*e.row,j=s.made.some(k=>o.get(k.branch)===0&&m(k).length>0),A=[],C=n;s.branches.forEach((k,V)=>{let J=V===0,T=J&&j?e.tagTop:e.tag,H=C+(J?e.topLine-(e.tagTop-T):e.line)+U(k),y=H-C+(J?e.topBelow:ne.has(k)?e.below:e.bare);A.push({id:k,x:n,y:C,w:0,h:y,line:H,color:p(k),tagBase:T}),C+=y+l.gap});let K=C-l.gap,X=new Map(A.map(k=>[k.id,k])),Q=s.made.map(k=>{let V=X.get(k.branch),J=o.get(k.branch)===0,T=G+u*(f.get(k.id)??0)+(J?0:u/2),H=V.line,y=m(k),L=y.map((B,_)=>J?H-e.above-(y.length-1-_)*e.lineStep:H+e.under+_*e.lineStep),M=y.map((B,_)=>_e(B.text,T,L[_],B.style,"middle")),F=M.length===0?void 0:{...Os(M),lines:y.map(B=>B.text),baselines:L},te=k.copy!==void 0?p(s.made.find(B=>B.id===k.copy)?.branch??k.branch):p(k.branch);return{id:k.id,branch:k.branch,color:te,cx:T,cy:H,r:e.r,step:k.step,event:k.event,parents:k.parents,...k.copy!==void 0?{copy:k.copy}:{},...k.hash!==void 0?{hash:k.hash}:{},...k.note!==void 0?{note:k.note}:{},...F?{text:F}:{},...k.orphan?{orphan:k.orphan.step,orphanEvent:k.orphan.event}:{}}}),ie=new Map(Q.map(k=>[k.id,k])),re=s.links.flatMap(k=>{let V=ie.get(k.from);if(!V)return[];if(k.kind==="branch"){if(!s.made.some(L=>L.branch===k.to))return[];let y=X.get(k.to);return[{...k,points:Qn(V,V.cx+e.turn,y.line),color:p(k.to)}]}let J=ie.get(k.to),T=s.made.find(y=>y.id===k.to),H;return k.kind==="copy"?H=Ts(V,J):Math.abs(V.cy-J.cy)<.5?H=[[V.cx+V.r,V.cy],[J.cx-J.r,J.cy]]:T?.joined===k.from?H=Ms(V,J):H=Qn(V,J.cx-J.r,J.cy),[{...k,points:H,color:J.color}]}),D=(k,V)=>{let J=ie.get(V.commit),T=X.get(J.branch)?.tagBase??e.tag,H=$(k);return{x:J.cx-H/2,y:J.cy-T-V.row*e.row-r.tagH/2,w:H,h:r.tagH}},x=k=>[k.x+k.w/2,k.y+k.h/2],N=s.moves.map(k=>{let V=k.from?D(k.ref,k.from):void 0,J=k.to?D(k.ref,k.to):void 0,T=t.steps[k.step]?.events[k.event],H=k.line&&T?.type==="edge"&&T.carry.kind!=="none"&&!(T.carry.kind==="tag"&&T.carry.text===T.from);return{ref:k.ref,step:k.step,event:k.event,...V?{from:V}:{},...J?{to:J}:{},...k.to?{target:k.to.commit}:{},...H?{carried:!0}:{},...k.line&&V&&J?{line:Ss(x(V),x(J))}:{},color:"slate"}}),E=s.tags.map(k=>({...D(k.ref,k.slot),ref:k.ref,step:k.step})),v=Xe(t),q=Math.max(G,...Q.flatMap(k=>[k.cx+k.r,...k.text?[k.text.x+k.text.w]:[]]),...E.map(k=>k.x+k.w),...N.flatMap(k=>[k.from,k.to].flatMap(V=>V?[V.x+V.w]:[]))),z=q+e.boxGap,ee=(A[1]??A[0])?.line??n+c.h/2,de=t.boxes.map((k,V)=>{let J=Ue(t,k.id,!0),T=ee+V*(c.h+a);return{id:k.id,name:k.name,...k.sub!==void 0?{sub:k.sub}:{},...k.icon!==void 0?{icon:k.icon}:{},color:v.get(k.id)??"slate",x:z,y:T-c.h/2,w:J,h:c.h,cx:z+J/2,cy:T}}),ce=A.map((k,V)=>{let J=i.get(k.id);return{id:k.id,lines:[k.id],...J!==void 0?{note:J}:{},icon:"branch",color:k.color,x:k.x,y:k.y,w:0,h:k.h,header:{x:k.x+l.inset,y:k.y+l.inset,w:h[V]?.w??0,h:l.nameY-l.inset+(J!==void 0?l.line:0)+a/2}}}),pe={kind:"git",width:0,height:0,regions:ce,boxes:de,lifelines:[],edges:[],labels:[],actions:[],badges:[],paths:[],ends:[],lanes:A,commits:Q,links:re,tags:E,refs:s.refs,moves:N};pe.badges=tr(t,pe),pe.labels=qs(t,pe);let ve=Math.max(q,...de.map(k=>k.x+k.w),...pe.labels.map(k=>k.x+k.w))+l.pad,we=Math.max(ve+n,Ze(t)+n*2);for(let k of ce)k.w=we-n*2;for(let k of A)k.w=we-n*2;let ye=Math.max(K,...de.map(k=>k.y+k.h),...pe.labels.map(k=>k.y+k.h)),Pe=Qe(t,n,ye+a,we-n*2);return pe.width=we,pe.height=(Pe?Pe.y+Pe.h:ye)+n,Pe&&(pe.strip=Pe),pe.badges=tr(t,pe),pe}function Os(t){let n=Math.min(...t.map(c=>c.x)),a=Math.min(...t.map(c=>c.y));return{x:n,y:a,w:Math.max(...t.map(c=>c.x+c.w))-n,h:Math.max(...t.map(c=>c.y+c.h))-a}}function Ns(t,n){return[...t.links.filter(c=>c.step===n&&c.kind!=="copy").map(c=>({event:c.event,points:c.points,color:c.color})),...t.moves.flatMap(c=>{let l=t.commits.find(e=>e.id===c.target);return c.step===n&&c.line&&l?[{event:c.event,target:l,color:l.color}]:[]})].sort((c,l)=>c.event-l.event)[0]}function er(t,n,a){let{r:c,inset:l}=w.badge,e=t.r+l+c,r=c*2+l;return[[t.cx+e,t.cy],[t.cx,t.cy+e],[t.cx-e,t.cy],[t.cx,t.cy-e]].find(i=>n.every(([o,p])=>Math.hypot(i[0]-o,i[1]-p)>=r)&&a.every(o=>bt(Ye(i),o)>=w.label.touch))}function Es(t,n,a){let{r:c,inset:l,along:e,short:r}=w.badge,s=vt(t),i=s<r?Math.min(c+1,s/2):e,o=c*2+l;for(let p=i;p<=s;p+=1){let f=st(t,p),b=Ye(f);if(n.every(([m,d])=>Math.hypot(f[0]-m,f[1]-d)>=o)&&a.every(m=>bt(b,m)>=w.label.touch))return f}}function tr(t,n){let{inset:a}=w.badge,c=[],l=[...n.links.map(s=>s.points),...n.moves.flatMap(s=>s.line?[s.line]:[])],e=[],r=[...n.tags,...n.commits.flatMap(s=>[{x:s.cx-s.r,y:s.cy-s.r,w:s.r*2,h:s.r*2},...s.text?[s.text]:[]])];return t.steps.forEach((s,i)=>{let o=Ns(n,i),p=o?.target?er(o.target,c,r):void 0;if(o&&(o.points||p)){let S=o.points,u=p??(S?Es(S,c,r)??it(S,c,l.filter(h=>h!==S)):[0,0]);c.push(u),e.push({step:i,x:u[0],y:u[1],color:o.color});return}let f=s.events.flatMap(S=>S.type==="swap"||S.type==="action"?[S.box]:[]).map(S=>n.boxes.find(u=>u.id===S))[0];if(f){e.push({step:i,x:f.x,y:f.y,color:f.color});return}if(n.strip&&s.events.some(S=>S.type==="strip")){e.push({step:i,x:n.strip.x+a,y:n.strip.y+a,color:"slate"});return}let b=n.commits.find(S=>S.id===n.refs[0]?.at[i]),m=b?er(b,c,r):void 0;if(b&&m){c.push(m),e.push({step:i,x:m[0],y:m[1],color:b.color});return}let d=e[e.length-1],$=n.lanes[0];e.push(d?{...d,step:i}:{step:i,x:($?.x??0)+($?.w??0)-a-w.badge.r,y:($?.y??0)+a+w.badge.r,color:$?.color??"slate"})}),Je(e)}function qs(t,n){let a=w.git,c=[],l=n.commits.map(s=>({x:s.cx-s.r,y:s.cy-s.r,w:s.r*2,h:s.r*2})),e=n.commits.flatMap(s=>s.text?[s.text]:[]),r=n.regions.map(s=>s.header);for(let s of n.moves){let i=t.steps[s.step]?.events[s.event];if(i?.type!=="edge"||i.label===void 0||!s.line)continue;let o=n.commits.find(h=>h.id===i.to);if(!o)continue;let p=n.lanes[0]?.id===o.branch,f=le(i.label,De(i.label)?O.labelJa:O.label)+w.label.padX*2,[b]=s.line.reduce((h,P)=>[h[0]+P[0]/s.line.length,0],[0,0]),m=Math.max(0,...n.tags.filter(h=>h.step===s.step&&Math.abs(h.x+h.w/2-o.cx)<.5).map(h=>o.cy-h.y)),d=i.labelSide??(p?"above":"below"),$=i.labelSide!==void 0?void 0:p?{x:b-f/2,y:o.cy-Math.max(m,(n.lanes[0]?.tagBase??a.tag)+w.carrier.tagH/2)-w.label.soft-w.label.h}:{x:b-f/2,y:o.cy+a.labelUnder},S=n.badges.filter(h=>h.step<=s.step).map(h=>Ye([h.x,h.y])),u=n.tags.filter(h=>h.step===s.step);c.push(Ke({step:s.step,event:s.event,text:i.label,points:s.line,color:s.color,side:d,...$?{base:$}:{}},{hard:[...l,...n.boxes],soft:[...e,...u,...r,...c.filter(h=>h.step===s.step)],touch:S}))}return c}function sr(t){let{box:n,sequence:a,label:c,margin:l,gap:e}=w,r=Xe(t),s=t.sequence?.lifelines??[],i=[...s,...t.boxes.map(D=>D.id).filter(D=>!s.includes(D))],o=new Map(i.map((D,x)=>[D,x])),p=i.map(D=>Ue(t,D,!1)),f=p.slice(1).map((D,x)=>p[x]/2+D/2+a.columnGap),b=[];for(let D of t.steps)for(let x of D.events){if(x.type!=="edge"||x.label===void 0)continue;let N=o.get(x.from)??0,E=o.get(x.to)??0,v=le(x.label,He(x.label))+c.padX*2;N===E?N<f.length&&b.push({from:N,to:N+1,need:a.selfW+c.side+v+a.labelRoom}):b.push({from:Math.min(N,E),to:Math.max(N,E),need:v+a.labelRoom*2})}b.sort((D,x)=>D.to-D.from-(x.to-x.from));for(let{from:D,to:x,need:N}of b){let E=0;for(let q=D;q<x;q++)E+=f[q]??0;if(E>=N)continue;let v=(N-E)/(x-D);for(let q=D;q<x;q++)f[q]=(f[q]??0)+v}let m=[];i.forEach((D,x)=>m.push(x===0?l+p[0]/2:m[x-1]+f[x-1]));let d=i.map((D,x)=>{let N=t.boxes.find(q=>q.id===D),E=p[x],v=m[x];return{id:D,name:N?.name??D,...N?.sub!==void 0?{sub:N.sub}:{},...N?.icon!==void 0?{icon:N.icon}:{},color:r.get(D)??"slate",x:v-E/2,y:l,w:E,h:n.h,cx:v,cy:l+n.h/2}}),$=l+n.h,S=[],u=[],h=[],P=$+a.firstRow,I=0,G=!0;t.steps.forEach((D,x)=>{D.events.forEach((N,E)=>{if(N.type!=="edge"&&N.type!=="action")return;let v,q;if(N.type==="edge"){let z=N.labelSide??"above",ee=N.from===N.to,de=N.label!==void 0;v=de&&z==="above"?a.labelOffset+c.h/2:e,q=ee?a.selfH+e:de&&z==="below"?a.labelOffset+c.h/2:e}else v=w.action.h/2,q=w.action.h/2;if(P=G?P+v:P+Math.max(a.minPitch,I+a.rowGap+v)+(E===0&&x>0?a.stepGap:0),G=!1,I=q,N.type==="edge"){let z=m[o.get(N.from)??0],ee=m[o.get(N.to)??0],de=Math.sign(ee-z)||1,ce=z===ee?[[z,P],[z+a.selfW,P],[z+a.selfW,P+a.selfH],[z+w.edge.inset,P+a.selfH]]:[[z,P],[ee-de*w.edge.inset,P]],pe=pt(N,r),ve={};if(N.carry.kind!=="none"){let we=w.slot.lifeline+mt(N.carry)[0],[ye,Pe]=ce,[k,V]=ce.slice(-2),J=Math.sign(Pe[0]-ye[0])||1,T=Math.sign(V[0]-k[0])||-1;ve.wait=[z-J*we,ye[1]],ve.settle=[ee+T*we,V[1]]}S.push({step:x,event:E,from:N.from,to:N.to,points:ce,color:pe,carry:N.carry,...ve}),N.label!==void 0&&h.push({step:x,event:E,text:N.label,points:ce,color:pe,...N.labelSide?{side:N.labelSide}:z===ee?{side:"right"}:{},offset:a.labelOffset})}else{let z=m[o.get(N.box)??0],ee=le(N.label,O.action)+w.action.padX*2;u.push({step:x,event:E,box:N.box,text:N.label,color:r.get(N.box)??"slate",x:z+w.badge.r+4,y:P-w.action.h/2,w:ee,h:w.action.h})}})});let ne=(G?$:P+I)+a.tail,U=i.map((D,x)=>({id:D,x:m[x],y1:$,y2:ne})),j=ot(S,t.steps.length),A=[];for(let D of h){let x=[...j].filter(([E])=>E<=D.step).map(([,E])=>Ye(E.point)),N=[...A.filter(E=>E.step===D.step),...u];A.push(Ke(D,{hard:d,soft:N,touch:x}))}let C={kind:"sequence",width:0,height:0,regions:[],boxes:d,lifelines:U,edges:S,labels:A,actions:u,badges:[],paths:[],ends:[]},K=[...d.map(D=>D.x),...A.map(D=>D.x),...u.map(D=>D.x)],X=Math.max(0,l-Math.min(...K));X>0&&Pt(C,X,0);let Q=[...d.map(D=>D.x+D.w),...A.map(D=>D.x+D.w),...u.map(D=>D.x+D.w),...S.flatMap(D=>D.points.map(x=>x[0]))],ie=Math.max(Math.max(...Q)+l,Ze(t)+l*2),re=Qe(t,l,ne+e,ie-l*2);return C.width=ie,C.height=(re?re.y+re.h:ne)+l,re&&(C.strip=re),C.badges=Ls(t,C),C}function Ls(t,n){let a=ot(n.edges,t.steps.length),c=t.steps.map((l,e)=>{let r=a.get(e);if(r)return{step:e,x:r.point[0],y:r.point[1],color:r.edge.color};let s=n.actions.find(o=>o.step===e),i=s&&n.lifelines.find(o=>o.id===s.box);return s&&i?{step:e,x:i.x,y:s.y+s.h/2,color:s.color}:St(l.events,e,n)});return Je(c)}var ir=t=>Mt.includes(t);function Rs(t){let n=[],a=c=>{!ir(c)&&!n.includes(c)&&n.push(c)};for(let{edge:c}of xt(t))a(c.from),a(c.to);return n}var As=(t,n)=>t.from===n.from&&t.to===n.to;function or(t,n){let{box:a,state:c,margin:l,gap:e}=w,r=w.edge.inset,s=ze[n],i=Xe(t),o=xt(t),p=Rs(t),f=t.boxes.map(g=>g.id).filter(g=>!p.includes(g)),b=(t.state?.paths??[]).filter(g=>!o.some(({edge:R})=>As(R,g))),m=[...o.map(({edge:g})=>g),...b],d=c.ghost,$=g=>{let R=t.boxes.find(Y=>Y.id===g);return d.pad*2+a.icon+d.gap+Math.max(le(R?.name??g,O.boxName),le(R?.sub??"",O.boxSub))},S=wt(t),u=Math.max(a.padX,c.done.inset+c.done.r+w.slot.clear),h=new Map(t.boxes.map(g=>[g.id,f.includes(g.id)?$(g.id):Math.max(Ue(t,g.id,!0),$t(S.get(g.id),g.icon!==void 0,u))])),P=Math.max(1,Math.min(c.columns,p.length)),I=Math.max(1,Math.ceil(p.length/c.columns)),G=new Map(p.map((g,R)=>{let Y=Math.floor(R/c.columns),fe=R%c.columns;return[g,{row:Y,col:Y%2===0?fe:P-1-fe}]})),ne=Array.from({length:P},(g,R)=>Math.max(a.minW,...p.filter(Y=>G.get(Y)?.col===R).map(Y=>h.get(Y)??a.minW))),U=Array.from({length:Math.max(0,P-1)},()=>c.columnGap);for(let g of m){let R=G.get(g.from),Y=G.get(g.to);if(!R||!Y||g.label===void 0||R.row!==Y.row||Math.abs(R.col-Y.col)!==1)continue;let fe=Math.min(R.col,Y.col);U[fe]=Math.max(U[fe]??0,le(g.label,He(g.label))+w.label.padX*2+c.labelRoom*2)}let j=[];for(let g=0;g<P;g++)j.push(g===0?l:j[g-1]+ne[g-1]+U[g-1]);let A=g=>j[g]+ne[g]/2,C=g=>f.includes(g),K=new Set(b.filter(g=>C(g.to)&&!C(g.from)&&!ir(g.from)).map(g=>g.from)),X=[s.sideNote,...K.size>0?[s.sideFrom(K.size)]:[]],Q=Math.max(le(s.side,O.regionName),...X.map(g=>le(g,O.regionNote))),ie=c.side.pad*2+Math.max(d.h,O.regionName.size+w.region.line*X.length+c.side.pad/4),re=m.some(g=>g.from==="start"),D=l+(f.length>0?ie+c.side.gap:re?c.start+c.drop:0),x=g=>D+g*(a.h+c.rowGap),N=(g,R,Y,fe)=>{let me=t.boxes.find(Ne=>Ne.id===g),ge=h.get(g)??a.minW,Ge=fe?d.h:a.h;return{id:g,name:me?.name??g,...me?.sub!==void 0?{sub:me.sub}:{},...me?.icon!==void 0?{icon:me.icon}:{},color:i.get(g)??"slate",x:R-ge/2,y:Y,w:ge,h:Ge,cx:R,cy:Y+Ge/2,...fe?{ghost:!0}:{}}},E=p.map(g=>{let R=G.get(g);return N(g,A(R.col),x(R.row),!1)});for(let g of E)kt(g,S.get(g.id),u);let v=new Map(E.map(g=>[g.id,g])),q=g=>E.some(R=>R!==g&&Math.abs(R.cx-g.cx)<.5&&R.y>g.y),z=[],ee=E[0],de=Math.max(...E.map(g=>g.x+g.w)),ce,pe=l+ie+c.side.lane;if(f.length>0){let g=Ne=>b.filter(Ie=>Ie.to===Ne).flatMap(Ie=>v.get(Ie.from)??[]),R=f.flatMap(g),Y=Math.max(l,Math.min(...R.length>0?R.map(Ne=>Ne.x):[l+c.side.pad])-c.side.pad),fe=Y+c.side.pad+Q+e*2,me=f.map(Ne=>{let Ie=g(Ne);return{id:Ne,cx:Ie.length>0?Ie.reduce((lt,ht)=>lt+ht.cx,0)/Ie.length:fe}});me.sort((Ne,Ie)=>Ne.cx-Ie.cx);let ge=Y;for(let{id:Ne,cx:Ie}of me){let lt=h.get(Ne)??a.minW,ht=Math.max(Ie-lt/2,fe),rt=N(Ne,ht+lt/2,l+(ie-d.h)/2,!0);E.push(rt),v.set(Ne,rt);let Fn=b.some(Bn=>Bn.from===Ne&&Bn.to==="finish");Fn&&z.push({kind:"finish",x:rt.x+rt.w+c.beside,y:rt.cy,r:c.end.r,ghost:!0,text:"",box:Ne}),ge=Fn?rt.x+rt.w+c.beside+c.end.r:rt.x+rt.w,fe=ge+e*2}let Ge=Math.max(ge+c.side.pad,de);ce={x:Y,y:l,w:Ge-Y,h:ie,title:s.side,notes:X}}if(ee&&re){let g=ee.cx+c.start+c.text+le(s.start,O.regionNote)+e,R=ce&&g<ce.x?ce.y+c.side.pad+c.start:ee.y-c.drop;z.unshift({kind:"start",x:ee.cx,y:R,r:c.start,ghost:!1,text:s.start})}for(let g of E.filter(R=>!R.ghost&&m.some(Y=>Y.from===R.id&&Y.to==="finish")))z.push(q(g)?{kind:"finish",x:g.x+g.w+c.beside,y:g.cy,r:c.end.r,ghost:!1,text:s.end,box:g.id}:{kind:"finish",x:g.cx,y:g.y+g.h+c.below,r:c.end.r,ghost:!1,text:s.end,box:g.id});let ve=(g,R)=>{let Y=G.get(g.id),fe=G.get(R.id);if(!Y||!fe)return[[g.cx,g.y+g.h],[R.cx,R.y-r]];if(Y.row===fe.row&&Math.abs(Y.col-fe.col)===1)return R.cx>g.cx?[[g.x+g.w,g.cy],[R.x-r,R.cy]]:[[g.x,g.cy],[R.x+R.w+r,R.cy]];if(Y.row===fe.row){let ge=g.y+g.h+c.rowGap/4;return[[g.cx,g.y+g.h],[g.cx,ge],[R.cx,ge],[R.cx,R.y+R.h+r]]}if(fe.row>Y.row){if(Math.abs(g.cx-R.cx)<.5)return[[g.cx,g.y+g.h],[R.cx,R.y-r]];let ge=g.y+g.h+c.rowGap/2;return[[g.cx,g.y+g.h],[g.cx,ge],[R.cx,ge],[R.cx,R.y-r]]}if(Math.abs(g.cx-R.cx)<.5)return[[g.cx,g.y],[R.cx,R.y+R.h+r]];let me=R.y+R.h+c.rowGap/2;return[[g.cx,g.y],[g.cx,me],[R.cx,me],[R.cx,R.y+R.h+r]]},we=(g,R)=>{let Y=b.filter(me=>me.to===R.id).flatMap(me=>v.get(me.from)??[]).sort((me,ge)=>me.cx-ge.cx),fe=Y.findIndex(me=>me.id===g);return Y.length<=1?Math.min(Math.max(Y[0]?.cx??R.cx,R.x+c.side.entry),R.x+R.w-c.side.entry):R.x+c.side.entry+(R.w-c.side.entry*2)*Math.max(0,fe)/(Y.length-1)},ye=g=>re&&g===ee?g.cx+c.side.entry:g.cx,Pe=g=>z.find(R=>R.kind==="finish"&&R.box===g),k=(g,R)=>{if(g==="start"){let me=z.find(Ge=>Ge.kind==="start"),ge=v.get(R);return!me||!ge?[]:[[me.x,me.y+me.r],[ge.cx,ge.y-r]]}let Y=v.get(g);if(!Y)return[];if(R==="finish"){let me=Pe(g);return me?Math.abs(me.x-Y.cx)<.5?[[Y.cx,Y.y+Y.h],[Y.cx,me.y-me.r-r]]:[[Y.x+Y.w,Y.cy],[me.x-me.r-r,Y.cy]]:[]}let fe=v.get(R);if(!fe)return[];if(g===R)return Ft(Y);if(fe.ghost&&!Y.ghost){let me=ye(Y),ge=we(g,fe);return Math.abs(me-ge)<.5?[[me,Y.y],[ge,fe.y+fe.h+r]]:[[me,Y.y],[me,pe],[ge,pe],[ge,fe.y+fe.h+r]]}return Y.ghost&&fe.ghost?[[Y.x+Y.w,Y.cy],[fe.x-r,fe.cy]]:Y.ghost?[[Y.cx,Y.y+Y.h],[Y.cx,pe],[fe.cx,pe],[fe.cx,fe.y-r]]:ve(Y,fe)},V=g=>{let R=g.to==="finish"?Pe(g.from):void 0;if(!R)return;let Y=v.get(g.from);return Y&&Math.abs(R.x-Y.cx)<.5?[R.x-R.r-e-mt(g.carry)[0],R.y]:[R.x,R.y+R.r+e+w.carrier.tagH/2]},J=g=>{let R=g.from==="start"?z.find(Y=>Y.kind==="start"):void 0;return R?[R.x-R.r-w.slot.mark-mt(g.carry)[0],R.y]:void 0},T=o.map(({step:g,event:R,edge:Y})=>{let fe=V(Y),me=Y.carry.kind==="none"?void 0:J(Y);return{step:g,event:R,from:Y.from,to:Y.to,points:k(Y.from,Y.to),color:js(Y,i),carry:Y.carry,...fe?{settle:fe}:{},...me?{wait:me}:{}}});gt(T,v,S);let H=new Map;for(let g of T){if(g.points.length!==2||!T.some(ge=>ge.from===g.to&&ge.to===g.from&&ge.points.length===2))continue;let[R,Y]=g.points,fe=Math.abs(Y[1]-R[1])<Math.abs(Y[0]-R[0]),me=(g.from<g.to?1:-1)*w.edge.parallel;g.points=g.points.map(([ge,Ge])=>fe?[ge,Ge+me]:[ge+me,Ge]),H.set(g,fe?me>0?"below":"above":me>0?"right":"left")}let y=b.map(g=>({from:g.from,to:g.to,points:k(g.from,g.to)})),L=(g,R,Y)=>g.from===g.to?Bt(g.points):it(g.points,R,Y),M=[],F=z.flatMap(g=>g.text===""?[]:[_e(g.text,..._t(g),O.regionNote)]),te=[...ot(T,t.steps.length,L).values()].map(g=>Ye(g.point)),B=[...ce?[{x:ce.x,y:ce.y,w:c.side.pad+Q,h:ce.h}]:[],...F],_=g=>[...T.map(R=>R.points),...y.map(R=>R.points)].filter(R=>R!==g);for(let g of T){let R=t.steps[g.step]?.events[g.event];if(R?.type!=="edge"||R.label===void 0)continue;let Y=g.from===g.to,fe=qt(g),me=M.filter(lt=>lt.text===R.label&&T.some(ht=>ht.step===lt.step&&ht.event===lt.event&&qt(ht)===fe)),ge=me[me.length-1];if(ge){ge.until=g.step,M.push({x:ge.x,y:ge.y,w:ge.w,h:ge.h,step:g.step,event:g.event,text:ge.text,family:ge.family,color:g.color});continue}let Ge=le(R.label,He(R.label))+w.label.padX*2,Ne=Y?{side:"below",base:Gt(g.points,Ge)}:{},Ie=R.labelSide??(g.to==="finish"?"left":H.get(g));M.push(Ke({step:g.step,event:g.event,text:R.label,points:g.points,color:g.color,...Ie?{side:Ie}:Y?{}:{flip:!0},...Ne},{hard:E,soft:[...B,...M],touch:te,lines:_(g.points)}))}let Z=[];b.forEach((g,R)=>{let Y=y[R];if(g.label===void 0||Y.points.length===0)return;let fe=He(g.label),me=v.get(g.to)?.ghost===!0&&v.get(g.from)?.ghost!==!0,ge=Y.points[0][0],Ge=me?{side:"below",base:{x:ge+w.label.soft,y:pe+w.label.soft},slide:Math.max(...Y.points.map(([Ie])=>Math.abs(Ie-ge)))}:{},Ne=Ke({step:-1,event:R,text:g.label,points:Y.points,color:"slate",...Ge},{hard:E,soft:[...B,...M,...Z],touch:te,lines:_(Y.points)});Z.push(Ne),Y.label={x:Ne.x,y:Ne.y,w:Ne.w,h:Ne.h,text:g.label,family:fe.family}});let ae={kind:"state",width:0,height:0,regions:[],boxes:E,lifelines:[],edges:T,labels:M,actions:[],badges:[],paths:y,ends:z,...ce?{side:ce}:{}},xe=[...E.map(g=>g.x),...M.map(g=>g.x),...y.flatMap(g=>g.label?[g.label.x]:[])],qe=[...M.map(g=>g.y),...y.flatMap(g=>g.label?[g.label.y]:[])],Ae=Math.max(0,l-Math.min(...xe)),Se=qe.length>0?Math.max(0,l-Math.min(...qe)):0;(Ae>0||Se>0)&&Pt(ae,Ae,Se);let je=g=>g.x+(g.text===""?g.r:c.text+le(g.text,O.regionNote)),Fe=[...E.map(g=>g.x+g.w),...M.map(g=>g.x+g.w),...z.map(je),...T.flatMap(g=>g.points.map(R=>R[0])),...y.flatMap(g=>[...g.points.map(R=>R[0]),...g.label?[g.label.x+g.label.w]:[]]),...ce?[ce.x+ce.w]:[]],Be=[...E.map(g=>g.y+g.h),...M.map(g=>g.y+g.h),...z.map(g=>g.y+g.r),...T.flatMap(g=>g.points.map(R=>R[1]))],at={title:s.trail,states:p.map(g=>({box:g,color:i.get(g)??"slate"}))},nt=Math.max(Math.max(...Fe)+l,Ze(t,at)+l*2),Ot=Math.max(...Be,x(I-1)+a.h),Nt=Qe(t,l,Ot+e,nt-l*2,at);ae.width=nt,ae.height=(Nt?Nt.y+Nt.h:Ot)+l,Nt&&(ae.strip=Nt);let Qr=ot(T,t.steps.length,L);return ae.badges=Je(t.steps.map((g,R)=>{let Y=Qr.get(R);return Y?{step:R,x:Y.point[0],y:Y.point[1],color:Y.edge.color}:St(g.events,R,ae)})),ae}function js(t,n){return t.carry.kind==="coin"?pt(t,n):n.get(t.to==="finish"?t.from:t.to)??"slate"}var Tn=t=>t.kind==="time",Wt={d:86400,h:3600,min:60,s:1,ms:.001},Ds=Object.keys(Wt);function Cs(t){let n=/^([0-9]+(?:\.[0-9]+)?)(ms|s|min|h|d)$/u.exec(t);if(!n)return{seconds:1,unit:"s"};let a=n[2];return{seconds:Number(n[1])*Wt[a],unit:a}}var ar=(t,n)=>Ds.find(a=>t/Wt[a]>=2-1e-9)??n,lr=(t,n,a)=>`${Number((t/Wt[n]).toFixed(2))} ${ze[a].timeUnits[n]}`;function Is(t,n,a){let c=1;if(n)c=n*Math.max(1,Math.ceil(t/n/8));else for(let r=1;;r*=10){let s=[r,r*2,r*5].find(i=>t/i<=w.time.ticks);if(s!==void 0){c=s;break}}let l=[];for(let r=0;r<=t;r+=c)l.push(r);let e=l[l.length-1];return e!==t&&(t-e)*a>=w.time.minorPx&&l.push(t),{at:l,step:c}}function Fs(t,n,a,c){let l=Array.from({length:n-1},(r,s)=>s+1).find(r=>n%r===0&&r*a>=w.time.minorPx);if(l===void 0)return[];let e=[];for(let r=l;r<t;r+=l)c.includes(r)||e.push(r);return e}function cr(t){let n=0;return t.steps.map(a=>{let c=n;for(let l of a.events)l.type==="now"&&(n=Math.max(n,l.to+1));return[c,n]})}function mr(t,n="ja"){let a=w.time,{margin:c,gap:l}=w,e=w.region,r=ze[n],s=t.time??{scale:{unit:"",length:"1s",count:1},rows:[]},{scale:i}=s,o=Math.max(1,i.count),p=Cs(i.length),f=Math.max(a.width,Ze(t)+c*2),b=Math.max(0,...s.rows.map(T=>le(T.name,O.timeRow))),m=Math.max(a.axisX,c+e.inset+b+a.gutterGap),d=f-a.right-m,$=d/o,S=Xe(t),u=wt(t),h=[],P=[],I=[],G=[],ne=new Map(s.rows.map(T=>[T.id,T])),U,j=c;if(s.zoom){let{from:T,to:H}=s.zoom,y=H-T+1,L=d/y,M=c,F=ar(H*p.seconds,p.unit),te=[];for(let Z=0;Z<y;Z++){let ae=T+Z,xe=m+Z*L,qe=t.boxes.map((Se,je)=>{let Fe=u.get(Se.id),Be=Math.max(Ue(t,Se.id,!1),$t(Fe,Se.icon!==void 0,w.box.padX)),at=M+a.boxTop+je*(w.box.h+a.boxGap),nt=ne.get(Se.id),Ot={id:Se.id,name:Se.name,...Se.sub!==void 0?{sub:Se.sub}:{},...Se.icon!==void 0?{icon:Se.icon}:{},color:S.get(Se.id)??"slate",x:xe+L/2-Be/2,y:at,w:Be,h:w.box.h,cx:xe+L/2,cy:at+w.box.h/2,...nt?{row:nt.id}:{},...nt?.empty?.includes(ae)?{empty:!0}:{}};return kt(Ot,Fe),Ot});P.push(...qe);let Ae=`${i.unit} ${(i.from??0)+ae}${r.headJoin}${lr(ae*p.seconds,F,n)}`;te.push({unit:ae,head:Ae,boxes:qe,x:xe,y:M,w:L,h:0})}let _=Math.max(M+a.boxTop,...P.map(Z=>Z.y+Z.h))+a.zoomBottom;for(let Z of te)Z.h=_-M;h.push({id:"zoom",lines:[r.zoom],note:`${y} ${i.unit}`,icon:"clock",color:"blue",x:c,y:M,w:f-c*2,h:_-M,header:{x:c+e.inset,y:M+e.inset,w:Math.max(e.icon,le(r.zoom,O.regionName)),h:e.nameY-e.inset+e.line}}),U={from:T,to:H,frame:{x:0,y:0,w:0,h:0},guides:[],columns:te,empty:r.empty,headY:M+a.head},j=_+a.zoomGap}let A=j+a.rowsTop,C=s.rows.map((T,H)=>({id:T.id,name:T.name,color:T.color??S.get(T.id)??ct[H%ct.length],x:m,y:A+H*(a.row+a.rowGap),w:d,h:a.row})),K=C.length>0?Math.max(...C.map(T=>T.y+T.h)):A,X=Math.min(a.markMax,Math.max(a.markMin,$*a.markRatio)),Q=C.flatMap((T,H)=>Array.from({length:o},(y,L)=>({row:T.id,unit:L,empty:s.rows[H]?.empty?.includes(L)===!0,color:T.color,colors:[],x:m+(L+.5)*$-X/2,y:T.y,w:X,h:T.h})));if(t.steps.forEach((T,H)=>T.events.forEach((y,L)=>{if(y.type==="mark")for(let M of Q)M.row===y.row&&M.unit>=y.from&&M.unit<=y.to&&!M.empty&&M.colors.push({step:H,event:L,color:y.color})})),U){let T={x:m+U.from*$-a.frame,y:A-a.frame,w:(U.to-U.from+1)*$+a.frame*2,h:K-A+a.frame*2},H=Math.max(...U.columns.map(y=>y.y+y.h));U.frame=T,U.guides=[[[T.x,T.y],[m,H]],[[T.x+T.w,T.y],[m+d,H]]]}let ie=K+a.point.drop,re=(s.points??[]).map(T=>{let H=[];t.steps.forEach((B,_)=>B.events.forEach((Z,ae)=>{Z.type==="swap"&&Z.box===T.id&&H.push({step:_,event:ae,text:Z.text,...Z.color?{color:Z.color}:{}})}));let y=m+(T.at+.5)*$,L=y+a.point.text,M=Math.max(le(T.id,O.pointName),...H.map(B=>le(B.text,O.pointState))),F=ie+a.point.nameY-O.pointName.size*.8,te=ie+a.point.stateY+O.pointState.size*.2;return{id:T.id,unit:T.at,cx:y,cy:ie,r:a.point.r,text:{x:L,y:F,w:M,h:te-F},changes:H}}),D=new Map(re.map(T=>[T.id,T])),x=(T,H)=>D.get(T)?.changes.filter(L=>L.step<=H&&L.color).at(-1)?.color;t.steps.forEach((T,H)=>T.events.forEach((y,L)=>{if(y.type!=="edge")return;if(y.at===void 0){let te=D.get(y.from),B=D.get(y.to);if(!te||!B||te===B)return;let _=B.cx>te.cx,Z=_?Math.max(te.cx+te.r,te.text.x+te.text.w+a.point.link):te.cx-te.r-a.point.end,ae=_?B.cx-B.r-a.point.end:Math.min(B.cx-B.r,B.text.x+B.text.w+a.point.link),xe={step:H,event:L,from:y.from,to:y.to,points:[[Z,te.cy],[ae,B.cy]],color:y.carry.kind==="coin"?"coin":x(y.to,H)??"slate",carry:y.carry};y.carry.kind!=="none"&&(xe.settle=[ae-(_?1:-1)*(w.carrier.coinR+w.edge.arrow),B.cy]),I.push(xe);return}let M=Bs(y,U);if(!M)return;let F={step:H,event:L,from:y.from,to:y.to,points:M.points,color:pt(y,S),carry:y.carry};Gs(F,M.from,M.to,u),I.push(F),G.push({step:H,event:L,from:M.from,to:M.to,column:y.at,into:y.into??y.at})}));let N={kind:"time",width:f,height:0,regions:h,boxes:P,lifelines:[],edges:I,labels:[],actions:[],badges:[],paths:[],ends:[],axis:{x:m,w:d,unit:$,count:o,line:0},rows:C,marks:Q,ticks:[],minor:[],periods:[],points:re,...U?{zoom:U}:{},spans:[],wires:G,needle:{y1:A-a.needle.over,y2:K+a.needle.over}},E=K,v=t.steps.some(T=>T.events.some(H=>H.type==="edge"&&H.at===void 0&&H.label!==void 0)),{r:q,inset:z}=w.badge,ee=re.length>0?ie+a.point.r+(v?a.point.room:a.point.plain):E+(q+z)*2,de=[],ce=t.steps.flatMap((T,H)=>T.events.flatMap((y,L)=>y.type==="span"?[{s:H,e:L,event:y}]:[]));for(let{s:T,e:H,event:y}of ce){let L=y.shape==="box"?"box":"bracket",M=ce.find(Z=>Z.s>T&&(Z.event.shape==="box"?"box":"bracket")===L&&Z.event.from<=y.to&&y.from<=Z.event.to),F=y.color??"slate",te=m+y.from*$,B=m+(y.to+1)*$,_={step:T,event:H,kind:L,from:y.from,to:y.to,text:y.text,color:F,...M?{until:M.s}:{}};if(L==="box"){let Z=a.box,ae={x:te-Z.pad,y:A-Z.pad,w:B-te+Z.pad*2,h:K-A+Z.pad*2},xe=le(y.text,O.tag)+Z.tagPadX*2,qe={x:ae.x+Z.tagX,y:ae.y-Z.tagH/2,w:xe,h:Z.tagH};de.push({..._,...ae,textRect:qe,textY:ae.y+w.baseline.tag})}else de.push({..._,x:te,y:0,w:B-te,h:a.bracket.tick,textRect:{x:0,y:0,w:0,h:0},textY:0})}N.spans=de,N.badges=pr(t,N,cr(t)),N.labels=Ys(t,N),ee=Math.max(ee,...N.labels.map(T=>T.y+T.h+w.label.soft));let pe=[];for(let T of de.filter(H=>H.kind==="bracket")){let H=le(T.text,O.spanText),y=Math.min(m+d-H/2,Math.max(m+H/2,T.x+T.w/2)),L={x:Math.min(T.x,y-H/2),w:Math.max(T.x+T.w,y+H/2)-Math.min(T.x,y-H/2)},M=te=>{let B=te.until===void 0||te.until>T.step,_=Math.min(te.x,te.textRect.x),Z=Math.max(te.x+te.w,te.textRect.x+te.textRect.w)-_;return B&&L.x<_+Z&&_<L.x+L.w},F=pe.findIndex(te=>!te.some(M));F<0&&(pe.push([]),F=pe.length-1),pe[F].push(T),T.y=ee+a.bracket.gap+F*a.bracket.lane,T.textY=T.y+a.bracket.tick+a.bracket.text,T.textRect=_e(T.text,y,T.textY,O.spanText,"middle")}pe.length>0&&(ee=Math.max(...de.filter(T=>T.kind==="bracket").map(T=>T.textRect.y+T.textRect.h)));let ve=ee+a.axisGap;N.axis.line=ve;let we=Is(o,s.period?.length,$),ye=ve+a.tickY,Pe=ar(o*p.seconds,p.unit);N.ticks=we.at.map(T=>{let H=lr(T*p.seconds,Pe,n),y=le(H,O.timeTick),L=m+T*$,M=T===0?L:T===o?L-y:Math.min(m+d-y,Math.max(m,L-y/2));return{at:T,x:L,text:H,left:M,y:ye}}),N.minor=Fs(o,we.step,$,we.at);let k=ye+O.timeTick.size*.2;if(s.period){let T=s.period,H=[];for(let M=0,F=0;F<o;M++,F+=T.length){let te=Math.min(o,F+T.length)-1,B=`${T.name} ${(T.from??0)+M}`,_=(i.from??0)+F,Z=`${i.unit} ${r.range(String(_),String((i.from??0)+te))}`;H.push({index:M,from:F,to:te,name:B,range:Z,x:m+F*$,y:ve,w:(te-F+1)*$,h:0,nameY:ye,rangeY:ye+a.rangeY})}let y=N.ticks.map(M=>_e(M.text,M.left,M.y,O.timeTick)),L=H.some(M=>{let F=_e(M.name,M.x+M.w/2,M.nameY,O.timePeriod,"middle");return y.some(te=>F.x<te.x+te.w+a.nameGap&&te.x<F.x+F.w+a.nameGap)});for(let M of H)L&&(M.nameY=ye+a.rangeY+2,M.rangeY=M.nameY+a.rangeY),M.h=M.rangeY+O.timeRange.size*.2-ve;N.periods=H,k=Math.max(k,...H.map(M=>M.rangeY+O.timeRange.size*.2))}let V=k+a.bottom;h.push({id:"axis",lines:[],color:"slate",x:c,y:j,w:f-c*2,h:V-j,header:{x:c+e.inset,y:j+e.inset,w:0,h:0}});let J=Qe(t,c,V+l,f-c*2);return J&&(N.strip=J),N.height=(J?J.y+J.h:V)+c,N.badges=pr(t,N,cr(t)),N}function Bs(t,n){if(!n||t.at===void 0)return;let a=t.into??t.at,c=n.columns.find(m=>m.unit===t.at),l=n.columns.find(m=>m.unit===a),e=c?.boxes.find(m=>m.id===t.from),r=l?.boxes.find(m=>m.id===t.to);if(!c||!l||!e||!r||e===r)return;let s=c.boxes.indexOf(e),i=l.boxes.indexOf(r),o=i>s;if(c===l){if(Math.abs(i-s)===1)return{from:e,to:r,points:[[e.cx,o?e.y+e.h+1:e.y-1],[r.cx,o?r.y-1:r.y+r.h+1]]};let m=Math.min(c.x+c.w-w.gap,Math.max(e.x+e.w,r.x+r.w)+w.gap);return{from:e,to:r,points:[[e.x+e.w+1,e.cy],[m,e.cy],[m,r.cy],[r.x+r.w+1,r.cy]]}}let p=l.x>c.x;if(s===i)return{from:e,to:r,points:[[p?e.x+e.w+1:e.x-1,e.cy],[p?r.x-1:r.x+r.w+1,r.cy]]};let f=e.cx+(p?1:-1)*e.w/4,b=r.cx-(p?1:-1)*r.w/4;return{from:e,to:r,points:[[f,o?e.y+e.h+1:e.y-1],[b,o?r.y-1:r.y+r.h+1]]}}function Gs(t,n,a,c){let l={...t};gt([l],new Map([[t.to,a]]),c);let e={...t};gt([e],new Map([[t.from,n]]),c),l.settle&&(t.settle=l.settle),e.wait&&(t.wait=e.wait)}function pr(t,n,a){let{r:c,inset:l}=w.badge,{axis:e}=n,r=[],s=[],i=Math.min(...n.rows.map(f=>f.y),n.needle.y1+w.time.needle.over),o=Math.max(...n.rows.map(f=>f.y+f.h),i),p=n.points[0]?(o+n.points[0].cy-n.points[0].r)/2:o+c+l;return t.steps.forEach((f,b)=>{let m=(h,P)=>{r.push(h),s.push({step:b,x:h[0],y:h[1],color:P})},d=n.edges.filter(h=>h.step===b).sort((h,P)=>h.event-P.event)[0];if(d){let h=d.carry.kind!=="none"&&!d.wait?[d.points[0]]:[],P=n.edges.filter(I=>I!==d).map(I=>I.points);m(it(d.points,[...r,...h],P),d.color);return}let[$,S]=a[b]??[0,0];if(S>$){let h=e.x+($+S)/2*e.unit,P=n.points.find(I=>Math.abs(I.cx-h)<c+l);P&&(h=P.cx+c+l*2),m([h,p],"slate");return}for(let h of f.events){let P=_s(h,b,n);if(P){m(P.at,P.color);return}}if(n.strip&&f.events.some(h=>h.type==="strip")){s.push({step:b,x:n.strip.x+l,y:n.strip.y+l,color:"slate"});return}let u=s[s.length-1];s.push(u?{...u,step:b}:{step:b,x:e.x-c-l,y:i,color:"slate"})}),Je(s)}function _s(t,n,a){let{r:c,inset:l}=w.badge;if(t.type==="span"){let e=a.spans.find(r=>r.step===n&&r.from===t.from&&r.to===t.to&&r.text===t.text);return e?e.kind==="box"?{at:[e.x,e.y],color:e.color}:{at:[e.x-c-l,e.y+e.h/2],color:e.color}:void 0}if(t.type==="swap"){let e=a.points.find(r=>r.id===t.box);if(e)return{at:[e.cx-e.r-l-c,e.cy],color:t.color??"slate"}}if(t.type==="mark"){let e=a.rows.find(s=>s.id===t.row),r=Math.min(...a.rows.map(s=>s.y));if(e)return{at:[a.axis.x+(t.from+t.to+1)/2*a.axis.unit,r-c-l],color:t.color}}}function Ys(t,n){let a=[],c=n.points.map(r=>({x:r.cx-r.r,y:r.cy-r.r,w:r.r*2,h:r.r*2})),l=n.points.map(r=>r.text),e=(n.zoom?.columns??[]).map(r=>_e(r.head,r.x+r.w/2,n.zoom?.headY??0,O.timeHead,"middle"));for(let r of n.edges){let s=t.steps[r.step]?.events[r.event];if(s?.type!=="edge"||s.label===void 0)continue;let i=n.badges.filter(p=>p.step<=r.step).map(p=>Ye([p.x,p.y])),o=s.labelSide??(s.at===void 0?"below":void 0);a.push(Ke({step:r.step,event:r.event,text:s.label,points:r.points,color:r.color,...o?{side:o}:{},flip:s.at!==void 0},{hard:[...c,...n.boxes],soft:[...l,...e,...a.filter(p=>p.step===r.step)],touch:i}))}return a}var Vs={string:"\u6587\u5B57\u5217\u306B\u3059\u308B",integer:"\u6574\u6570\u306B\u3059\u308B",number:"\u6570\u306B\u3059\u308B",object:"\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306B\u3059\u308B",array:"\u914D\u5217\u306B\u3059\u308B",boolean:"true \u304B false \u306B\u3059\u308B",null:"null \u306B\u3059\u308B"},Ws={string:"Use a string",integer:"Use an integer",number:"Use a number",object:"Use an object",array:"Use an array",boolean:"Use true or false",null:"Use null"},dr=(t,n)=>`${t} ${n}${t===1?"":"s"}`,Hs={additionalProperties:t=>`${t} \u3068\u3044\u3046\u6B04\u306F\u66F8\u3051\u306A\u3044`,required:t=>`${t} \u306E\u6B04\u304C\u8981\u308B`,enum:t=>`${t.join(" / ")} \u306E\u3069\u308C\u304B\u306B\u3059\u308B`,type:t=>Vs[t]??`${t} \u306B\u3059\u308B`,minLength:t=>`${t} \u5B57\u4EE5\u4E0A\u66F8\u304F`,pattern:t=>t?`${t.space?"\u7A7A\u767D\u3068 ":""}${t.chars.join(" ")} \u306F\u4F7F\u3048\u306A\u3044`:"\u4F7F\u3048\u306A\u3044\u5B57\u304C\u5165\u3063\u3066\u3044\u308B",minItems:t=>`${t} \u3064\u4EE5\u4E0A\u66F8\u304F`,minimum:t=>`${t} \u4EE5\u4E0A\u306B\u3059\u308B`,const:t=>`${t} \u306B\u3059\u308B`,not:t=>t?`${t.field} \u306E\u6B04\u306F kind \u304C ${t.kind} \u306E\u6642\u3060\u3051\u66F8\u3051\u308B`:"\u3053\u306E\u6B04\u306E\u7D44\u307F\u5408\u308F\u305B\u306F\u66F8\u3051\u306A\u3044",reserved:t=>`${t.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`,kindOnly:(t,n)=>`${t.join(" \u3068 ")} \u306E\u51FA\u6765\u4E8B\u306F kind \u304C ${n} \u306E\u6642\u3060\u3051\u66F8\u3051\u308B`,hex:(t,n)=>`0 \u304B\u3089 9 \u3068 a \u304B\u3089 f \u306E\u5B57\u3067 ${t} \u304B\u3089 ${n} \u5B57\u306B\u3059\u308B`,duration:t=>`\u6570\u3068\u5358\u4F4D (${t.join(" / ")}) \u306E\u7D44\u3067\u66F8\u304F (12s \u306A\u3069)`,ratio:"\u5206\u6570 (2/3) \u304B\u767E\u5206\u7387 (97%) \u3067\u66F8\u304F",url:"/ \u3067\u59CB\u307E\u308B path \u304B\u3001http:// \u304B https:// \u3067\u59CB\u307E\u308B URL \u306B\u3059\u308B",anyOf:t=>t.length>0?`${t.join(" \u304B ")} \u306E${t.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",oneOf:"\u66F8\u3051\u308B\u5F62\u306E\u3069\u308C\u304B 1 \u3064\u3060\u3051\u306B\u5408\u308F\u305B\u308B",discriminator:(t,n)=>`${t} \u306F ${n.join(" / ")} \u306E\u3069\u308C\u304B\u306B\u3059\u308B`,newer:(t,n)=>`\u7248 ${t} \u306E\u56F3\u306F\u3001\u3053\u306E\u9053\u5177 (\u7248 ${n}) \u3088\u308A\u65B0\u3057\u3044\u306E\u3067\u8AAD\u3081\u306A\u3044\u3002\u9053\u5177\u3092\u65B0\u3057\u304F\u3059\u308B`},zs={additionalProperties:t=>`The ${t} field is not allowed`,required:t=>`The ${t} field is required`,enum:t=>`Use one of ${t.join(" / ")}`,type:t=>Ws[t]??`Use ${t}`,minLength:t=>`Write at least ${dr(t,"character")}`,pattern:t=>t?`Cannot contain ${t.space?"spaces or ":""}${t.chars.join(" ")}`:"Contains characters that are not allowed",minItems:t=>`Write at least ${dr(t,"item")}`,minimum:t=>`Use ${t} or greater`,const:t=>`Use ${t}`,not:t=>t?`The ${t.field} field is allowed only when kind is ${t.kind}`:"This combination of fields is not allowed",reserved:t=>`${t.join(" and ")} name the start and end marks of a state diagram and cannot be box ids`,kindOnly:(t,n)=>`${t.join(" and ")} events are allowed only when kind is ${n}`,hex:(t,n)=>`Use ${t} to ${n} characters of 0-9 and a-f`,duration:t=>`Write a number and a unit (${t.join(" / ")}), such as 12s`,ratio:"Write a fraction (2/3) or a percentage (97%)",url:"Use a path that starts with / or a URL that starts with http:// or https://",anyOf:t=>t.length>0?`Write one of the ${t.join(" or ")} fields`:"Does not match any of the allowed shapes",oneOf:"Match exactly one of the allowed shapes",discriminator:(t,n)=>`${t} is one of ${n.join(" / ")}`,newer:(t,n)=>`Version ${t} diagrams are newer than this tool (version ${n}) and cannot be read. Update the tool`},Ht={ja:Hs,en:zs};function Ks(t){let n=0;for(let a of t)n++;return n}var Nn=hr,On={title:"dragon \u306E\u56F3\u306E\u539F\u672C",description:"\u533A\u753B\u3001\u7BB1\u3001\u7DDA\u3001\u904B\u3076\u7269\u3001\u6BB5\u3001\u4E2D\u8EAB\u306E\u5E2F\u306E 6 \u90E8\u54C1\u3092\u5171\u901A\u306E\u9AA8\u7D44\u307F\u306B\u7F6E\u304D\u3001\u56F3\u306E\u7A2E\u985E\u3060\u3051\u306E\u7269\u306F\u7A2E\u985E\u306E\u6B04\u306B\u7F6E\u304F\u3002\u5EA7\u6A19\u306F\u6301\u305F\u306A\u3044\u3002\u7BB1\u306F\u679D\u5206\u304B\u308C\u306E\u56F3\u3068\u6642\u9593\u8EF8\u306E\u56F3\u3060\u3051\u304C\u6301\u305F\u306A\u304F\u3066\u3088\u3044\u3002",type:"object",additionalProperties:!1,required:["version","kind","title","boxes","steps"],properties:{version:{description:"\u5F62\u5F0F\u306E\u7248",type:"integer",minimum:1},kind:{description:"\u56F3\u306E\u7A2E\u985E",enum:["sequence","architecture","state","git","time"]},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"},time:{$ref:"#/definitions/time"}},if:{required:["kind"],properties:{kind:{const:"sequence"}}},then:{required:["sequence"],properties:{boxes:{minItems:1},steps:{$ref:"#/definitions/plainSteps"},strip:{$ref:"#/definitions/plainStrip"},state:{$ref:"#/definitions/absent"},git:{$ref:"#/definitions/absent"},time:{$ref:"#/definitions/absent"}}},else:{properties:{sequence:{$ref:"#/definitions/absent"}},if:{required:["kind"],properties:{kind:{const:"state"}}},then:{properties:{boxes:{minItems:1,items:{properties:{id:{description:"\u59CB\u307E\u308A\u3068\u7D42\u308F\u308A\u306E\u5370\u306E\u540D\u524D\u306F\u7BB1\u306E\u540D\u672D\u306B\u4F7F\u3048\u306A\u3044",not:{enum:["start","finish"]}}}}},steps:{$ref:"#/definitions/plainSteps"},strip:{$ref:"#/definitions/plainStrip"},git:{$ref:"#/definitions/absent"},time:{$ref:"#/definitions/absent"}}},else:{if:{required:["kind"],properties:{kind:{const:"git"}}},then:{required:["git"],properties:{steps:{$ref:"#/definitions/gitSteps"},strip:{$ref:"#/definitions/plainStrip"},state:{$ref:"#/definitions/absent"},regions:{$ref:"#/definitions/absent"},time:{$ref:"#/definitions/absent"}}},else:{if:{required:["kind"],properties:{kind:{const:"time"}}},then:{required:["time"],properties:{steps:{$ref:"#/definitions/timeSteps"},state:{$ref:"#/definitions/absent"},git:{$ref:"#/definitions/absent"},regions:{$ref:"#/definitions/absent"}}},else:{properties:{boxes:{minItems:1},steps:{$ref:"#/definitions/plainSteps"},strip:{$ref:"#/definitions/plainStrip"},state:{$ref:"#/definitions/absent"},git:{$ref:"#/definitions/absent"},time:{$ref:"#/definitions/absent"}}}}}},definitions:{text:{type:"string",minLength:1},absent:{description:"\u3053\u306E\u56F3\u306E\u7A2E\u985E\u3067\u306F\u66F8\u3051\u306A\u3044\u6B04",not:{}},plainSteps:{description:"\u679D\u5206\u304B\u308C\u306E\u56F3\u3067\u3082\u6642\u9593\u8EF8\u306E\u56F3\u3067\u3082\u306A\u3044\u56F3\u306E\u6BB5\u3002\u679D\u5206\u304B\u308C\u306E\u56F3\u3060\u3051\u306E\u51FA\u6765\u4E8B (commit \u3068 branch) \u3068\u3001\u6642\u9593\u8EF8\u306E\u56F3\u3060\u3051\u306E\u51FA\u6765\u4E8B (now \u3068 mark \u3068 span) \u3068\u6B04 (at \u3068 into \u3068 color) \u3092\u66F8\u3051\u306A\u3044",items:{properties:{events:{items:{not:{$ref:"#/definitions/timeEvent"},properties:{type:{not:{enum:["commit","branch"]}},at:{$ref:"#/definitions/absent"},into:{$ref:"#/definitions/absent"},color:{$ref:"#/definitions/absent"}}}}}}},gitSteps:{description:"\u679D\u5206\u304B\u308C\u306E\u56F3\u306E\u6BB5\u3002\u6642\u9593\u8EF8\u306E\u56F3\u3060\u3051\u306E\u51FA\u6765\u4E8B (now \u3068 mark \u3068 span) \u3068\u6B04 (at \u3068 into \u3068 color) \u3092\u66F8\u3051\u306A\u3044",items:{properties:{events:{items:{not:{$ref:"#/definitions/timeEvent"},properties:{at:{$ref:"#/definitions/absent"},into:{$ref:"#/definitions/absent"},color:{$ref:"#/definitions/absent"}}}}}}},timeSteps:{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u6BB5\u3002\u679D\u5206\u304B\u308C\u306E\u56F3\u3060\u3051\u306E\u51FA\u6765\u4E8B (commit \u3068 branch) \u3092\u66F8\u3051\u306A\u3044",items:{properties:{events:{items:{properties:{type:{not:{enum:["commit","branch"]}}}}}}}},timeEvent:{description:"\u6642\u9593\u8EF8\u306E\u56F3\u3060\u3051\u304C\u66F8\u3051\u308B\u51FA\u6765\u4E8B",required:["type"],properties:{type:{enum:["now","mark","span"]}}},plainStrip:{description:"\u6642\u9593\u8EF8\u306E\u56F3\u3067\u306A\u3044\u56F3\u306E\u4E2D\u8EAB\u306E\u5E2F\u3002\u7269\u5DEE\u3057\u3092\u66F8\u3051\u306A\u3044",properties:{meters:{$ref:"#/definitions/absent"}}},id:{type:"string",pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},color:{enum:["blue","amber","green","violet","rose","slate","coin"]},region:{type:"object",additionalProperties:!1,required:["id","name"],properties:{id:{$ref:"#/definitions/id"},name:{$ref:"#/definitions/text"},note:{$ref:"#/definitions/text"},color:{$ref:"#/definitions/color"},icon:{$ref:"#/definitions/text"}}},box:{type:"object",additionalProperties:!1,required:["id","name"],properties:{id:{$ref:"#/definitions/id"},name:{$ref:"#/definitions/text"},sub:{$ref:"#/definitions/text"},color:{$ref:"#/definitions/color"},icon:{$ref:"#/definitions/text"},region:{$ref:"#/definitions/id"},link:{description:"\u98DB\u3073\u5148\u3002\u63CF\u3044\u305F\u56F3\u3067\u306F\u3053\u306E\u7BB1\u304C\u3053\u3053\u3078\u306E link \u306B\u306A\u308B",$ref:"#/definitions/url"}}},strip:{type:"object",additionalProperties:!1,required:["title","fields"],properties:{title:{$ref:"#/definitions/text"},fields:{type:"array",minItems:1,items:{$ref:"#/definitions/text"}},meters:{description:"\u7269\u5DEE\u3057\u306B\u3059\u308B\u6B04\u3002\u6642\u9593\u8EF8\u306E\u56F3\u3060\u3051\u304C\u66F8\u3051\u308B",type:"array",minItems:1,items:{$ref:"#/definitions/meter"}}}},meter:{description:"\u7269\u5DEE\u3057\u306E\u6B04\u3002line \u306E\u5272\u5408\u306E\u6240\u306B\u7DDA\u3092\u5F15\u304D\u3001set \u306E\u5024\u307E\u3067\u91DD\u3068\u4E00\u7DD2\u306B\u6E80\u3061\u308B",type:"object",additionalProperties:!1,required:["field","line"],properties:{field:{$ref:"#/definitions/text"},line:{$ref:"#/definitions/ratio"}}},ratio:{description:"\u5272\u5408\u3002\u5206\u6570 (2/3) \u304B\u767E\u5206\u7387 (97%)",type:"string",pattern:"^([0-9]+/[0-9]+|[0-9]+(\\.[0-9]+)?%)$"},step:{type:"object",additionalProperties:!1,required:["title","body","events"],properties:{title:{$ref:"#/definitions/text"},body:{$ref:"#/definitions/text"},code:{$ref:"#/definitions/text"},sources:{description:"\u6BB5\u306E\u51FA\u5178\u3002\u8AAD\u307F\u4E0A\u3052\u306E\u6BB5\u306E\u4E00\u89A7\u306B\u3001\u540D\u524D\u3092 URL \u3078\u306E link \u306B\u3057\u3066\u66F8\u3044\u305F\u9806\u306B\u51FA\u3059",type:"array",minItems:1,items:{$ref:"#/definitions/source"}},events:{type:"array",items:{$ref:"#/definitions/event"}}}},source:{type:"object",additionalProperties:!1,required:["name","url"],properties:{name:{$ref:"#/definitions/text"},url:{$ref:"#/definitions/url"}}},url:{description:"\u9801\u3092\u79FB\u308B\u5F62\u3002/ \u3067\u59CB\u307E\u308B path \u304B\u3001http:// \u304B https:// \u3067\u59CB\u307E\u308B URL",type:"string",pattern:"^(/|https?://)"},event:{description:"\u6BB5\u306E\u4E2D\u3067\u8D77\u304D\u308B\u3053\u3068\u3002\u8D77\u304D\u308B\u9806\u306B\u4E26\u3079\u308B",type:"object",required:["type"],discriminator:{propertyName:"type"},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:!1,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"]},at:{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u62E1\u5927\u306E\u5E2F\u3067\u3001\u7DDA\u3092\u5F15\u304F\u5217\u306E\u76EE\u76DB\u308A",$ref:"#/definitions/unit"},into:{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u62E1\u5927\u306E\u5E2F\u3067\u3001\u53D7\u3051\u308B\u7BB1\u3092\u9078\u3076\u5217\u306E\u76EE\u76DB\u308A\u3002\u66F8\u304B\u306A\u3051\u308C\u3070 at \u306E\u5217",$ref:"#/definitions/unit"}}},{description:"\u7BB1\u306E\u4E2D\u306E\u51E6\u7406",type:"object",additionalProperties:!1,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:!1,required:["type","box","text"],properties:{type:{const:"swap"},box:{$ref:"#/definitions/id"},text:{$ref:"#/definitions/text"},color:{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u7BC0\u76EE\u306E\u4E38\u306E\u8272",$ref:"#/definitions/color"}}},{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:!1,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:!1,required:["type","branch","from"],properties:{type:{const:"branch"},branch:{$ref:"#/definitions/id"},from:{$ref:"#/definitions/id"}}},{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u4ECA\u306E\u6642\u523B\u306E\u91DD\u3092\u3001to \u306E\u76EE\u76DB\u308A\u306E\u7D42\u308F\u308A\u307E\u3067\u9032\u3081\u308B",type:"object",additionalProperties:!1,required:["type","to"],properties:{type:{const:"now"},to:{$ref:"#/definitions/unit"}}},{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u5370\u306E\u5217 row \u306E\u3001from \u304B\u3089 to \u306E\u76EE\u76DB\u308A\u306E\u5370\u306E\u8272\u3092\u5909\u3048\u308B",type:"object",additionalProperties:!1,required:["type","row","from","to","color"],properties:{type:{const:"mark"},row:{$ref:"#/definitions/id"},from:{$ref:"#/definitions/unit"},to:{$ref:"#/definitions/unit"},color:{$ref:"#/definitions/color"}}},{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E from \u304B\u3089 to \u306E\u76EE\u76DB\u308A\u306B\u3001\u62EC\u5F27\u3068\u5B57\u3092\u51FA\u3059\u3002shape \u304C box \u306A\u3089\u5370\u306E\u5217\u3092\u56F2\u307F\u3001\u5B57\u3092\u7E01\u306E\u672D\u306B\u3059\u308B",type:"object",additionalProperties:!1,required:["type","from","to","text"],properties:{type:{const:"span"},from:{$ref:"#/definitions/unit"},to:{$ref:"#/definitions/unit"},text:{$ref:"#/definitions/text"},shape:{enum:["box"]},color:{$ref:"#/definitions/color"}}},{description:"\u4E2D\u8EAB\u306E\u5E2F\u306E\u6B04\u306E\u5024\u3068\u672D",type:"object",additionalProperties:!1,required:["type","field"],anyOf:[{required:["value"]},{required:["tag"]}],properties:{type:{const:"strip"},field:{$ref:"#/definitions/text"},value:{$ref:"#/definitions/text"},tag:{$ref:"#/definitions/text"}}}]},carry:{description:"\u7DDA\u306E\u4E0A\u3092\u8D70\u308B\u7269\u3002\u5C01\u7B52 (\u30E1\u30C3\u30BB\u30FC\u30B8\u3084\u8981\u6C42)\u3001\u672D (\u540D\u524D\u306E\u3042\u308B\u5024)\u3001\u786C\u8CA8 (\u4FA1\u5024)\u3001\u7121\u3057",type:"object",additionalProperties:!1,required:["kind"],properties:{kind:{enum:["envelope","tag","coin","none"]},text:{$ref:"#/definitions/text"}},if:{required:["kind"],properties:{kind:{const:"tag"}}},then:{required:["text"]},else:{not:{required:["text"]}}},sequence:{description:"\u6642\u7CFB\u5217\u56F3\u306E\u7A2E\u985E\u306E\u6B04\u3002\u751F\u5B58\u7DDA\u3092\u5DE6\u304B\u3089\u4E26\u3079\u308B\u9806",type:"object",additionalProperties:!1,required:["lifelines"],properties:{lifelines:{type:"array",minItems:1,items:{$ref:"#/definitions/id"}}}},state:{description:"\u72B6\u614B\u9077\u79FB\u56F3\u306E\u7A2E\u985E\u306E\u6B04\u3002\u6700\u521D\u306E\u6BB5\u3088\u308A\u524D\u306B\u66F8\u3044\u305F\u3001\u79FB\u308C\u308B\u304C\u6BB5\u3067\u901A\u308B\u3068\u306F\u9650\u3089\u306A\u3044\u7DDA",type:"object",additionalProperties:!1,required:["paths"],properties:{paths:{type:"array",minItems:1,items:{$ref:"#/definitions/path"}}}},git:{description:"\u679D\u5206\u304B\u308C\u306E\u56F3\u306E\u7A2E\u985E\u306E\u6B04\u3002\u679D\u3092\u4E0A\u304B\u3089\u5E2F\u306B\u4E26\u3079\u308B\u9806",type:"object",additionalProperties:!1,required:["branches"],properties:{branches:{type:"array",minItems:1,items:{$ref:"#/definitions/branch"}}}},branch:{description:"\u679D\u3002\u5E2F\u306E\u5DE6\u306B\u540D\u672D\u3068\u6DFB\u3048\u66F8\u304D\u3092\u7F6E\u304F",type:"object",additionalProperties:!1,required:["id"],properties:{id:{$ref:"#/definitions/id"},note:{$ref:"#/definitions/text"}}},hash:{description:"commit \u306E hash\u300216 \u9032\u306E\u5B57\u3067 4 \u304B\u3089 40 \u5B57",type:"string",pattern:"^[0-9a-f]{4,40}$"},time:{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u7A2E\u985E\u306E\u6B04\u3002\u76EE\u76DB\u308A\u3001\u533A\u5207\u308A\u3001\u5370\u306E\u5217\u3001\u7BC0\u76EE\u3001\u62E1\u5927\u306E\u7BC4\u56F2",type:"object",additionalProperties:!1,required:["scale","rows"],properties:{scale:{$ref:"#/definitions/scale"},period:{$ref:"#/definitions/period"},rows:{type:"array",minItems:1,items:{$ref:"#/definitions/row"}},points:{type:"array",items:{$ref:"#/definitions/point"}},zoom:{$ref:"#/definitions/zoom"}}},scale:{description:"\u76EE\u76DB\u308A\u3002unit \u306E\u540D\u524D\u306E\u76EE\u76DB\u308A\u3092 length \u306E\u9577\u3055\u3067 count \u500B\u4E26\u3079\u3001\u6700\u521D\u306E\u76EE\u76DB\u308A\u306E\u756A\u53F7\u3092 from \u306B\u3059\u308B",type:"object",additionalProperties:!1,required:["unit","length","count"],properties:{unit:{$ref:"#/definitions/text"},length:{$ref:"#/definitions/duration"},count:{type:"integer",minimum:1},from:{type:"integer",minimum:0}}},duration:{description:"\u9577\u3055\u3002\u6570\u3068\u5358\u4F4D (ms\u3001s\u3001min\u3001h\u3001d) \u306E\u7D44",type:"string",pattern:"^[0-9]+(\\.[0-9]+)?(ms|s|min|h|d)$"},unit:{description:"\u76EE\u76DB\u308A\u306E\u4F4D\u7F6E\u30020 \u304B\u3089\u6570\u3048\u308B",type:"integer",minimum:0},period:{description:"\u533A\u5207\u308A\u3002\u76EE\u76DB\u308A length \u500B\u3054\u3068\u306B name \u306E\u533A\u5207\u308A\u3092\u7F6E\u304D\u3001\u6700\u521D\u306E\u533A\u5207\u308A\u306E\u756A\u53F7\u3092 from \u306B\u3059\u308B",type:"object",additionalProperties:!1,required:["name","length"],properties:{name:{$ref:"#/definitions/text"},length:{type:"integer",minimum:1},from:{type:"integer",minimum:0}}},row:{description:"\u5370\u306E\u5217\u3002\u76EE\u76DB\u308A\u3054\u3068\u306B\u5370\u3092 1 \u3064\u7F6E\u304D\u3001empty \u306E\u76EE\u76DB\u308A\u306F\u7A7A\u304D\u306E\u5370\u306B\u3059\u308B",type:"object",additionalProperties:!1,required:["id","name"],properties:{id:{$ref:"#/definitions/id"},name:{$ref:"#/definitions/text"},color:{$ref:"#/definitions/color"},empty:{type:"array",items:{$ref:"#/definitions/unit"}}}},point:{description:"\u7BC0\u76EE\u3002at \u306E\u76EE\u76DB\u308A\u306E\u5370\u306E\u4E0B\u306B\u65D7\u306E\u4E38\u3068\u540D\u672D\u3092\u7F6E\u304F",type:"object",additionalProperties:!1,required:["id","at"],properties:{id:{$ref:"#/definitions/id"},at:{$ref:"#/definitions/unit"}}},zoom:{description:"\u62E1\u5927\u306E\u7BC4\u56F2\u3002from \u304B\u3089 to \u306E\u76EE\u76DB\u308A\u3054\u3068\u306B\u62E1\u5927\u306E\u5E2F\u306B\u5217\u3092\u4F5C\u308B",type:"object",additionalProperties:!1,required:["from","to"],properties:{from:{$ref:"#/definitions/unit"},to:{$ref:"#/definitions/unit"}}},path:{description:"\u79FB\u308C\u308B\u9053\u3002\u9001\u308B\u5074\u306B\u59CB\u307E\u308A\u306E\u5370 start\u3001\u53D7\u3051\u308B\u5074\u306B\u7D42\u308F\u308A\u306E\u5370 finish \u3092\u66F8\u3051\u308B\u3002\u3069\u306E\u6BB5\u306B\u3082\u51FA\u306A\u3044\u9053\u306F\u70B9\u7DDA\u3067\u63CF\u304D\u3001\u904B\u3076\u7269\u3092\u8D70\u3089\u305B\u306A\u3044",type:"object",additionalProperties:!1,required:["from","to"],properties:{from:{$ref:"#/definitions/id"},to:{$ref:"#/definitions/id"},label:{$ref:"#/definitions/text"}}}}};function et(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(Array.isArray(t)){let o=t.length;for(let p=0;p<o;p++){let f=t[p];if(f&&typeof f=="object"&&!Array.isArray(f)&&f.events!==void 0){let b=f.events;if(Array.isArray(b)){let m=b.length;for(let d=0;d<m;d++){let $=b[d],S=r,u=r;if($&&typeof $=="object"&&!Array.isArray($)){let h;if($.type===void 0&&(h="type")){let P={};e===null?e=[P]:e.push(P),r++}else if($.type!==void 0){let P=$.type;if(!(P==="now"||P==="mark"||P==="span")){let I={};e===null?e=[I]:e.push(I),r++}}}var s=u===r;if(s){let h={instancePath:n+"/"+p+"/events/"+d,schemaPath:"#/items/properties/events/items/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[h]:e.push(h),r++}else r=S,e!==null&&(S?e.length=S:e=null);if($&&typeof $=="object"&&!Array.isArray($)){if($.type!==void 0){let h=$.type,P=r,I=r;if(!(h==="commit"||h==="branch")){let G={};e===null?e=[G]:e.push(G),r++}var i=I===r;if(i){let G={instancePath:n+"/"+p+"/events/"+d+"/type",schemaPath:"#/items/properties/events/items/properties/type/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[G]:e.push(G),r++}else r=P,e!==null&&(P?e.length=P:e=null)}if($.at!==void 0){let h={instancePath:n+"/"+p+"/events/"+d+"/at",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[h]:e.push(h),r++}if($.into!==void 0){let h={instancePath:n+"/"+p+"/events/"+d+"/into",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[h]:e.push(h),r++}if($.color!==void 0){let h={instancePath:n+"/"+p+"/events/"+d+"/color",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[h]:e.push(h),r++}}}}}}}return et.errors=e,r===0}function Ve(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)&&t.meters!==void 0){let s={instancePath:n+"/meters",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[s]:e.push(s),r++}return Ve.errors=e,r===0}function zt(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(Array.isArray(t)){let i=t.length;for(let o=0;o<i;o++){let p=t[o];if(p&&typeof p=="object"&&!Array.isArray(p)&&p.events!==void 0){let f=p.events;if(Array.isArray(f)){let b=f.length;for(let m=0;m<b;m++){let d=f[m],$=r,S=r;if(d&&typeof d=="object"&&!Array.isArray(d)){let u;if(d.type===void 0&&(u="type")){let h={};e===null?e=[h]:e.push(h),r++}else if(d.type!==void 0){let h=d.type;if(!(h==="now"||h==="mark"||h==="span")){let P={};e===null?e=[P]:e.push(P),r++}}}var s=S===r;if(s){let u={instancePath:n+"/"+o+"/events/"+m,schemaPath:"#/items/properties/events/items/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[u]:e.push(u),r++}else r=$,e!==null&&($?e.length=$:e=null);if(d&&typeof d=="object"&&!Array.isArray(d)){if(d.at!==void 0){let u={instancePath:n+"/"+o+"/events/"+m+"/at",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[u]:e.push(u),r++}if(d.into!==void 0){let u={instancePath:n+"/"+o+"/events/"+m+"/into",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[u]:e.push(u),r++}if(d.color!==void 0){let u={instancePath:n+"/"+o+"/events/"+m+"/color",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[u]:e.push(u),r++}}}}}}}return zt.errors=e,r===0}var Tt={enum:["blue","amber","green","violet","rose","slate","coin"]},Re=new RegExp("^[^\\s\\[\\]\u300C\u300D=:]+$","u"),Me=Ks;function Kt(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'"};e===null?e=[s]:e.push(s),r++}if(t.name===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"name"},message:"must have required property 'name'"};e===null?e=[s]:e.push(s),r++}for(let s in t)if(!(s==="id"||s==="name"||s==="note"||s==="color"||s==="icon")){let i={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};e===null?e=[i]:e.push(i),r++}if(t.id!==void 0){let s=t.id;if(typeof s=="string"){if(!Re.test(s)){let i={instancePath:n+"/id",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/id",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.name!==void 0){let s=t.name;if(typeof s=="string"){if(Me(s)<1){let i={instancePath:n+"/name",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/name",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.note!==void 0){let s=t.note;if(typeof s=="string"){if(Me(s)<1){let i={instancePath:n+"/note",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/note",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.color!==void 0){let s=t.color;if(!(s==="blue"||s==="amber"||s==="green"||s==="violet"||s==="rose"||s==="slate"||s==="coin")){let i={instancePath:n+"/color",schemaPath:"#/definitions/color/enum",keyword:"enum",params:{allowedValues:Tt.enum},message:"must be equal to one of the allowed values"};e===null?e=[i]:e.push(i),r++}}if(t.icon!==void 0){let s=t.icon;if(typeof s=="string"){if(Me(s)<1){let i={instancePath:n+"/icon",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/icon",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[s]:e.push(s),r++}return Kt.errors=e,r===0}var ur=new RegExp("^(/|https?://)","u");function Xt(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'"};e===null?e=[s]:e.push(s),r++}if(t.name===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"name"},message:"must have required property 'name'"};e===null?e=[s]:e.push(s),r++}for(let s in t)if(!(s==="id"||s==="name"||s==="sub"||s==="color"||s==="icon"||s==="region"||s==="link")){let i={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};e===null?e=[i]:e.push(i),r++}if(t.id!==void 0){let s=t.id;if(typeof s=="string"){if(!Re.test(s)){let i={instancePath:n+"/id",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/id",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.name!==void 0){let s=t.name;if(typeof s=="string"){if(Me(s)<1){let i={instancePath:n+"/name",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/name",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.sub!==void 0){let s=t.sub;if(typeof s=="string"){if(Me(s)<1){let i={instancePath:n+"/sub",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/sub",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.color!==void 0){let s=t.color;if(!(s==="blue"||s==="amber"||s==="green"||s==="violet"||s==="rose"||s==="slate"||s==="coin")){let i={instancePath:n+"/color",schemaPath:"#/definitions/color/enum",keyword:"enum",params:{allowedValues:Tt.enum},message:"must be equal to one of the allowed values"};e===null?e=[i]:e.push(i),r++}}if(t.icon!==void 0){let s=t.icon;if(typeof s=="string"){if(Me(s)<1){let i={instancePath:n+"/icon",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/icon",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.region!==void 0){let s=t.region;if(typeof s=="string"){if(!Re.test(s)){let i={instancePath:n+"/region",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/region",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.link!==void 0){let s=t.link;if(typeof s=="string"){if(!ur.test(s)){let i={instancePath:n+"/link",schemaPath:"#/definitions/url/pattern",keyword:"pattern",params:{pattern:"^(/|https?://)"},message:'must match pattern "^(/|https?://)"'};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/link",schemaPath:"#/definitions/url/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[s]:e.push(s),r++}return Xt.errors=e,r===0}var Xs=new RegExp("^([0-9]+/[0-9]+|[0-9]+(\\.[0-9]+)?%)$","u");function Ut(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.field===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"field"},message:"must have required property 'field'"};e===null?e=[s]:e.push(s),r++}if(t.line===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"line"},message:"must have required property 'line'"};e===null?e=[s]:e.push(s),r++}for(let s in t)if(!(s==="field"||s==="line")){let i={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};e===null?e=[i]:e.push(i),r++}if(t.field!==void 0){let s=t.field;if(typeof s=="string"){if(Me(s)<1){let i={instancePath:n+"/field",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/field",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.line!==void 0){let s=t.line;if(typeof s=="string"){if(!Xs.test(s)){let i={instancePath:n+"/line",schemaPath:"#/definitions/ratio/pattern",keyword:"pattern",params:{pattern:"^([0-9]+/[0-9]+|[0-9]+(\\.[0-9]+)?%)$"},message:'must match pattern "^([0-9]+/[0-9]+|[0-9]+(\\.[0-9]+)?%)$"'};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/line",schemaPath:"#/definitions/ratio/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[s]:e.push(s),r++}return Ut.errors=e,r===0}function Jt(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.title===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"title"},message:"must have required property 'title'"};e===null?e=[s]:e.push(s),r++}if(t.fields===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"fields"},message:"must have required property 'fields'"};e===null?e=[s]:e.push(s),r++}for(let s in t)if(!(s==="title"||s==="fields"||s==="meters")){let i={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};e===null?e=[i]:e.push(i),r++}if(t.title!==void 0){let s=t.title;if(typeof s=="string"){if(Me(s)<1){let i={instancePath:n+"/title",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/title",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.fields!==void 0){let s=t.fields;if(Array.isArray(s)){if(s.length<1){let o={instancePath:n+"/fields",schemaPath:"#/properties/fields/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};e===null?e=[o]:e.push(o),r++}let i=s.length;for(let o=0;o<i;o++){let p=s[o];if(typeof p=="string"){if(Me(p)<1){let f={instancePath:n+"/fields/"+o,schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[f]:e.push(f),r++}}else{let f={instancePath:n+"/fields/"+o,schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[f]:e.push(f),r++}}}else{let i={instancePath:n+"/fields",schemaPath:"#/properties/fields/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[i]:e.push(i),r++}}if(t.meters!==void 0){let s=t.meters;if(Array.isArray(s)){if(s.length<1){let o={instancePath:n+"/meters",schemaPath:"#/properties/meters/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};e===null?e=[o]:e.push(o),r++}let i=s.length;for(let o=0;o<i;o++)Ut(s[o],{instancePath:n+"/meters/"+o,parentData:s,parentDataProperty:o,rootData:l})||(e=e===null?Ut.errors:e.concat(Ut.errors),r=e.length)}else{let i={instancePath:n+"/meters",schemaPath:"#/properties/meters/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[i]:e.push(i),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[s]:e.push(s),r++}return Jt.errors=e,r===0}function Zt(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.name===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"name"},message:"must have required property 'name'"};e===null?e=[s]:e.push(s),r++}if(t.url===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"url"},message:"must have required property 'url'"};e===null?e=[s]:e.push(s),r++}for(let s in t)if(!(s==="name"||s==="url")){let i={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};e===null?e=[i]:e.push(i),r++}if(t.name!==void 0){let s=t.name;if(typeof s=="string"){if(Me(s)<1){let i={instancePath:n+"/name",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/name",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.url!==void 0){let s=t.url;if(typeof s=="string"){if(!ur.test(s)){let i={instancePath:n+"/url",schemaPath:"#/definitions/url/pattern",keyword:"pattern",params:{pattern:"^(/|https?://)"},message:'must match pattern "^(/|https?://)"'};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/url",schemaPath:"#/definitions/url/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[s]:e.push(s),r++}return Zt.errors=e,r===0}var fr={description:"\u6BB5\u306E\u4E2D\u3067\u8D77\u304D\u308B\u3053\u3068\u3002\u8D77\u304D\u308B\u9806\u306B\u4E26\u3079\u308B",type:"object",required:["type"],discriminator:{propertyName:"type"},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:!1,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"]},at:{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u62E1\u5927\u306E\u5E2F\u3067\u3001\u7DDA\u3092\u5F15\u304F\u5217\u306E\u76EE\u76DB\u308A",$ref:"#/definitions/unit"},into:{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u62E1\u5927\u306E\u5E2F\u3067\u3001\u53D7\u3051\u308B\u7BB1\u3092\u9078\u3076\u5217\u306E\u76EE\u76DB\u308A\u3002\u66F8\u304B\u306A\u3051\u308C\u3070 at \u306E\u5217",$ref:"#/definitions/unit"}}},{description:"\u7BB1\u306E\u4E2D\u306E\u51E6\u7406",type:"object",additionalProperties:!1,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:!1,required:["type","box","text"],properties:{type:{const:"swap"},box:{$ref:"#/definitions/id"},text:{$ref:"#/definitions/text"},color:{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u7BC0\u76EE\u306E\u4E38\u306E\u8272",$ref:"#/definitions/color"}}},{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:!1,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:!1,required:["type","branch","from"],properties:{type:{const:"branch"},branch:{$ref:"#/definitions/id"},from:{$ref:"#/definitions/id"}}},{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u4ECA\u306E\u6642\u523B\u306E\u91DD\u3092\u3001to \u306E\u76EE\u76DB\u308A\u306E\u7D42\u308F\u308A\u307E\u3067\u9032\u3081\u308B",type:"object",additionalProperties:!1,required:["type","to"],properties:{type:{const:"now"},to:{$ref:"#/definitions/unit"}}},{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E\u5370\u306E\u5217 row \u306E\u3001from \u304B\u3089 to \u306E\u76EE\u76DB\u308A\u306E\u5370\u306E\u8272\u3092\u5909\u3048\u308B",type:"object",additionalProperties:!1,required:["type","row","from","to","color"],properties:{type:{const:"mark"},row:{$ref:"#/definitions/id"},from:{$ref:"#/definitions/unit"},to:{$ref:"#/definitions/unit"},color:{$ref:"#/definitions/color"}}},{description:"\u6642\u9593\u8EF8\u306E\u56F3\u306E from \u304B\u3089 to \u306E\u76EE\u76DB\u308A\u306B\u3001\u62EC\u5F27\u3068\u5B57\u3092\u51FA\u3059\u3002shape \u304C box \u306A\u3089\u5370\u306E\u5217\u3092\u56F2\u307F\u3001\u5B57\u3092\u7E01\u306E\u672D\u306B\u3059\u308B",type:"object",additionalProperties:!1,required:["type","from","to","text"],properties:{type:{const:"span"},from:{$ref:"#/definitions/unit"},to:{$ref:"#/definitions/unit"},text:{$ref:"#/definitions/text"},shape:{enum:["box"]},color:{$ref:"#/definitions/color"}}},{description:"\u4E2D\u8EAB\u306E\u5E2F\u306E\u6B04\u306E\u5024\u3068\u672D",type:"object",additionalProperties:!1,required:["type","field"],anyOf:[{required:["value"]},{required:["tag"]}],properties:{type:{const:"strip"},field:{$ref:"#/definitions/text"},value:{$ref:"#/definitions/text"},tag:{$ref:"#/definitions/text"}}}]};var Us=new RegExp("^[0-9a-f]{4,40}$","u"),Js={description:"\u7DDA\u306E\u4E0A\u3092\u8D70\u308B\u7269\u3002\u5C01\u7B52 (\u30E1\u30C3\u30BB\u30FC\u30B8\u3084\u8981\u6C42)\u3001\u672D (\u540D\u524D\u306E\u3042\u308B\u5024)\u3001\u786C\u8CA8 (\u4FA1\u5024)\u3001\u7121\u3057",type:"object",additionalProperties:!1,required:["kind"],properties:{kind:{enum:["envelope","tag","coin","none"]},text:{$ref:"#/definitions/text"}},if:{required:["kind"],properties:{kind:{const:"tag"}}},then:{required:["text"]},else:{not:{required:["text"]}}};function Qt(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0,s=r,i=!0,o=r;if(t&&typeof t=="object"&&!Array.isArray(t)){let m;if(t.kind===void 0&&(m="kind")){let d={};e===null?e=[d]:e.push(d),r++}else if(t.kind!==void 0&&t.kind!=="tag"){let d={};e===null?e=[d]:e.push(d),r++}}var p=o===r;r=s,e!==null&&(s?e.length=s:e=null);let f;if(p){let m=r;if(t&&typeof t=="object"&&!Array.isArray(t)&&t.text===void 0){let $={instancePath:n,schemaPath:"#/then/required",keyword:"required",params:{missingProperty:"text"},message:"must have required property 'text'"};e===null?e=[$]:e.push($),r++}var p=m===r;i=p,f="then"}else{let m=r,d=r,$=r;if(t&&typeof t=="object"&&!Array.isArray(t)){let u;if(t.text===void 0&&(u="text")){let h={};e===null?e=[h]:e.push(h),r++}}var b=$===r;if(b){let u={instancePath:n,schemaPath:"#/else/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[u]:e.push(u),r++}else r=d,e!==null&&(d?e.length=d:e=null);var p=m===r;i=p,f="else"}if(!i){let m={instancePath:n,schemaPath:"#/if",keyword:"if",params:{failingKeyword:f},message:'must match "'+f+'" schema'};e===null?e=[m]:e.push(m),r++}if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.kind===void 0){let m={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"kind"},message:"must have required property 'kind'"};e===null?e=[m]:e.push(m),r++}for(let m in t)if(!(m==="kind"||m==="text")){let d={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:m},message:"must NOT have additional properties"};e===null?e=[d]:e.push(d),r++}if(t.kind!==void 0){let m=t.kind;if(!(m==="envelope"||m==="tag"||m==="coin"||m==="none")){let d={instancePath:n+"/kind",schemaPath:"#/properties/kind/enum",keyword:"enum",params:{allowedValues:Js.properties.kind.enum},message:"must be equal to one of the allowed values"};e===null?e=[d]:e.push(d),r++}}if(t.text!==void 0){let m=t.text;if(typeof m=="string"){if(Me(m)<1){let d={instancePath:n+"/text",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[d]:e.push(d),r++}}else{let d={instancePath:n+"/text",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[d]:e.push(d),r++}}}else{let m={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[m]:e.push(m),r++}return Qt.errors=e,r===0}function en(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.type===void 0){let o={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};e===null?e=[o]:e.push(o),r++}let i=t.type;if(typeof i=="string")if(i==="edge")if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.type===void 0){let o={instancePath:n,schemaPath:"#/oneOf/0/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};e===null?e=[o]:e.push(o),r++}if(t.from===void 0){let o={instancePath:n,schemaPath:"#/oneOf/0/required",keyword:"required",params:{missingProperty:"from"},message:"must have required property 'from'"};e===null?e=[o]:e.push(o),r++}if(t.to===void 0){let o={instancePath:n,schemaPath:"#/oneOf/0/required",keyword:"required",params:{missingProperty:"to"},message:"must have required property 'to'"};e===null?e=[o]:e.push(o),r++}if(t.carry===void 0){let o={instancePath:n,schemaPath:"#/oneOf/0/required",keyword:"required",params:{missingProperty:"carry"},message:"must have required property 'carry'"};e===null?e=[o]:e.push(o),r++}for(let o in t)if(!(o==="type"||o==="from"||o==="to"||o==="label"||o==="carry"||o==="labelSide"||o==="at"||o==="into")){let p={instancePath:n,schemaPath:"#/oneOf/0/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:o},message:"must NOT have additional properties"};e===null?e=[p]:e.push(p),r++}if(t.type!==void 0&&t.type!=="edge"){let o={instancePath:n+"/type",schemaPath:"#/oneOf/0/properties/type/const",keyword:"const",params:{allowedValue:"edge"},message:"must be equal to constant"};e===null?e=[o]:e.push(o),r++}if(t.from!==void 0){let o=t.from;if(typeof o=="string"){if(!Re.test(o)){let p={instancePath:n+"/from",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),r++}}else{let p={instancePath:n+"/from",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),r++}}if(t.to!==void 0){let o=t.to;if(typeof o=="string"){if(!Re.test(o)){let p={instancePath:n+"/to",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),r++}}else{let p={instancePath:n+"/to",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),r++}}if(t.label!==void 0){let o=t.label;if(typeof o=="string"){if(Me(o)<1){let p={instancePath:n+"/label",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[p]:e.push(p),r++}}else{let p={instancePath:n+"/label",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),r++}}if(t.carry!==void 0&&(Qt(t.carry,{instancePath:n+"/carry",parentData:t,parentDataProperty:"carry",rootData:l})||(e=e===null?Qt.errors:e.concat(Qt.errors),r=e.length)),t.labelSide!==void 0){let o=t.labelSide;if(!(o==="above"||o==="below"||o==="left"||o==="right")){let p={instancePath:n+"/labelSide",schemaPath:"#/oneOf/0/properties/labelSide/enum",keyword:"enum",params:{allowedValues:fr.oneOf[0].properties.labelSide.enum},message:"must be equal to one of the allowed values"};e===null?e=[p]:e.push(p),r++}}if(t.at!==void 0){let o=t.at;if(!(typeof o=="number"&&!(o%1)&&!isNaN(o)&&isFinite(o))){let p={instancePath:n+"/at",schemaPath:"#/definitions/unit/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[p]:e.push(p),r++}if(typeof o=="number"&&isFinite(o)&&(o<0||isNaN(o))){let p={instancePath:n+"/at",schemaPath:"#/definitions/unit/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[p]:e.push(p),r++}}if(t.into!==void 0){let o=t.into;if(!(typeof o=="number"&&!(o%1)&&!isNaN(o)&&isFinite(o))){let p={instancePath:n+"/into",schemaPath:"#/definitions/unit/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[p]:e.push(p),r++}if(typeof o=="number"&&isFinite(o)&&(o<0||isNaN(o))){let p={instancePath:n+"/into",schemaPath:"#/definitions/unit/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[p]:e.push(p),r++}}}else{let o={instancePath:n,schemaPath:"#/oneOf/0/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[o]:e.push(o),r++}else if(i==="action")if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.type===void 0){let o={instancePath:n,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};e===null?e=[o]:e.push(o),r++}if(t.box===void 0){let o={instancePath:n,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty:"box"},message:"must have required property 'box'"};e===null?e=[o]:e.push(o),r++}if(t.label===void 0){let o={instancePath:n,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty:"label"},message:"must have required property 'label'"};e===null?e=[o]:e.push(o),r++}for(let o in t)if(!(o==="type"||o==="box"||o==="label")){let p={instancePath:n,schemaPath:"#/oneOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:o},message:"must NOT have additional properties"};e===null?e=[p]:e.push(p),r++}if(t.type!==void 0&&t.type!=="action"){let o={instancePath:n+"/type",schemaPath:"#/oneOf/1/properties/type/const",keyword:"const",params:{allowedValue:"action"},message:"must be equal to constant"};e===null?e=[o]:e.push(o),r++}if(t.box!==void 0){let o=t.box;if(typeof o=="string"){if(!Re.test(o)){let p={instancePath:n+"/box",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),r++}}else{let p={instancePath:n+"/box",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),r++}}if(t.label!==void 0){let o=t.label;if(typeof o=="string"){if(Me(o)<1){let p={instancePath:n+"/label",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[p]:e.push(p),r++}}else{let p={instancePath:n+"/label",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),r++}}}else{let o={instancePath:n,schemaPath:"#/oneOf/1/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[o]:e.push(o),r++}else if(i==="swap")if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.type===void 0){let o={instancePath:n,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};e===null?e=[o]:e.push(o),r++}if(t.box===void 0){let o={instancePath:n,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty:"box"},message:"must have required property 'box'"};e===null?e=[o]:e.push(o),r++}if(t.text===void 0){let o={instancePath:n,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty:"text"},message:"must have required property 'text'"};e===null?e=[o]:e.push(o),r++}for(let o in t)if(!(o==="type"||o==="box"||o==="text"||o==="color")){let p={instancePath:n,schemaPath:"#/oneOf/2/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:o},message:"must NOT have additional properties"};e===null?e=[p]:e.push(p),r++}if(t.type!==void 0&&t.type!=="swap"){let o={instancePath:n+"/type",schemaPath:"#/oneOf/2/properties/type/const",keyword:"const",params:{allowedValue:"swap"},message:"must be equal to constant"};e===null?e=[o]:e.push(o),r++}if(t.box!==void 0){let o=t.box;if(typeof o=="string"){if(!Re.test(o)){let p={instancePath:n+"/box",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),r++}}else{let p={instancePath:n+"/box",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),r++}}if(t.text!==void 0){let o=t.text;if(typeof o=="string"){if(Me(o)<1){let p={instancePath:n+"/text",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[p]:e.push(p),r++}}else{let p={instancePath:n+"/text",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),r++}}if(t.color!==void 0){let o=t.color;if(!(o==="blue"||o==="amber"||o==="green"||o==="violet"||o==="rose"||o==="slate"||o==="coin")){let p={instancePath:n+"/color",schemaPath:"#/definitions/color/enum",keyword:"enum",params:{allowedValues:Tt.enum},message:"must be equal to one of the allowed values"};e===null?e=[p]:e.push(p),r++}}}else{let o={instancePath:n,schemaPath:"#/oneOf/2/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[o]:e.push(o),r++}else if(i==="commit")if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.type===void 0){let o={instancePath:n,schemaPath:"#/oneOf/3/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};e===null?e=[o]:e.push(o),r++}if(t.id===void 0){let o={instancePath:n,schemaPath:"#/oneOf/3/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'"};e===null?e=[o]:e.push(o),r++}if(t.branch===void 0){let o={instancePath:n,schemaPath:"#/oneOf/3/required",keyword:"required",params:{missingProperty:"branch"},message:"must have required property 'branch'"};e===null?e=[o]:e.push(o),r++}for(let o in t)if(!(o==="type"||o==="id"||o==="branch"||o==="copy"||o==="merge"||o==="hash"||o==="note")){let p={instancePath:n,schemaPath:"#/oneOf/3/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:o},message:"must NOT have additional properties"};e===null?e=[p]:e.push(p),r++}if(t.type!==void 0&&t.type!=="commit"){let o={instancePath:n+"/type",schemaPath:"#/oneOf/3/properties/type/const",keyword:"const",params:{allowedValue:"commit"},message:"must be equal to constant"};e===null?e=[o]:e.push(o),r++}if(t.id!==void 0){let o=t.id;if(typeof o=="string"){if(!Re.test(o)){let p={instancePath:n+"/id",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),r++}}else{let p={instancePath:n+"/id",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),r++}}if(t.branch!==void 0){let o=t.branch;if(typeof o=="string"){if(!Re.test(o)){let p={instancePath:n+"/branch",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),r++}}else{let p={instancePath:n+"/branch",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),r++}}if(t.copy!==void 0){let o=t.copy;if(typeof o=="string"){if(!Re.test(o)){let p={instancePath:n+"/copy",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),r++}}else{let p={instancePath:n+"/copy",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),r++}}if(t.merge!==void 0){let o=t.merge;if(typeof o=="string"){if(!Re.test(o)){let p={instancePath:n+"/merge",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),r++}}else{let p={instancePath:n+"/merge",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),r++}}if(t.hash!==void 0){let o=t.hash;if(typeof o=="string"){if(!Us.test(o)){let p={instancePath:n+"/hash",schemaPath:"#/definitions/hash/pattern",keyword:"pattern",params:{pattern:"^[0-9a-f]{4,40}$"},message:'must match pattern "^[0-9a-f]{4,40}$"'};e===null?e=[p]:e.push(p),r++}}else{let p={instancePath:n+"/hash",schemaPath:"#/definitions/hash/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),r++}}if(t.note!==void 0){let o=t.note;if(typeof o=="string"){if(Me(o)<1){let p={instancePath:n+"/note",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[p]:e.push(p),r++}}else{let p={instancePath:n+"/note",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),r++}}}else{let o={instancePath:n,schemaPath:"#/oneOf/3/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[o]:e.push(o),r++}else if(i==="branch")if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.type===void 0){let o={instancePath:n,schemaPath:"#/oneOf/4/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};e===null?e=[o]:e.push(o),r++}if(t.branch===void 0){let o={instancePath:n,schemaPath:"#/oneOf/4/required",keyword:"required",params:{missingProperty:"branch"},message:"must have required property 'branch'"};e===null?e=[o]:e.push(o),r++}if(t.from===void 0){let o={instancePath:n,schemaPath:"#/oneOf/4/required",keyword:"required",params:{missingProperty:"from"},message:"must have required property 'from'"};e===null?e=[o]:e.push(o),r++}for(let o in t)if(!(o==="type"||o==="branch"||o==="from")){let p={instancePath:n,schemaPath:"#/oneOf/4/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:o},message:"must NOT have additional properties"};e===null?e=[p]:e.push(p),r++}if(t.type!==void 0&&t.type!=="branch"){let o={instancePath:n+"/type",schemaPath:"#/oneOf/4/properties/type/const",keyword:"const",params:{allowedValue:"branch"},message:"must be equal to constant"};e===null?e=[o]:e.push(o),r++}if(t.branch!==void 0){let o=t.branch;if(typeof o=="string"){if(!Re.test(o)){let p={instancePath:n+"/branch",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),r++}}else{let p={instancePath:n+"/branch",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),r++}}if(t.from!==void 0){let o=t.from;if(typeof o=="string"){if(!Re.test(o)){let p={instancePath:n+"/from",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),r++}}else{let p={instancePath:n+"/from",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),r++}}}else{let o={instancePath:n,schemaPath:"#/oneOf/4/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[o]:e.push(o),r++}else if(i==="now")if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.type===void 0){let o={instancePath:n,schemaPath:"#/oneOf/5/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};e===null?e=[o]:e.push(o),r++}if(t.to===void 0){let o={instancePath:n,schemaPath:"#/oneOf/5/required",keyword:"required",params:{missingProperty:"to"},message:"must have required property 'to'"};e===null?e=[o]:e.push(o),r++}for(let o in t)if(!(o==="type"||o==="to")){let p={instancePath:n,schemaPath:"#/oneOf/5/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:o},message:"must NOT have additional properties"};e===null?e=[p]:e.push(p),r++}if(t.type!==void 0&&t.type!=="now"){let o={instancePath:n+"/type",schemaPath:"#/oneOf/5/properties/type/const",keyword:"const",params:{allowedValue:"now"},message:"must be equal to constant"};e===null?e=[o]:e.push(o),r++}if(t.to!==void 0){let o=t.to;if(!(typeof o=="number"&&!(o%1)&&!isNaN(o)&&isFinite(o))){let p={instancePath:n+"/to",schemaPath:"#/definitions/unit/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[p]:e.push(p),r++}if(typeof o=="number"&&isFinite(o)&&(o<0||isNaN(o))){let p={instancePath:n+"/to",schemaPath:"#/definitions/unit/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[p]:e.push(p),r++}}}else{let o={instancePath:n,schemaPath:"#/oneOf/5/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[o]:e.push(o),r++}else if(i==="mark")if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.type===void 0){let o={instancePath:n,schemaPath:"#/oneOf/6/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};e===null?e=[o]:e.push(o),r++}if(t.row===void 0){let o={instancePath:n,schemaPath:"#/oneOf/6/required",keyword:"required",params:{missingProperty:"row"},message:"must have required property 'row'"};e===null?e=[o]:e.push(o),r++}if(t.from===void 0){let o={instancePath:n,schemaPath:"#/oneOf/6/required",keyword:"required",params:{missingProperty:"from"},message:"must have required property 'from'"};e===null?e=[o]:e.push(o),r++}if(t.to===void 0){let o={instancePath:n,schemaPath:"#/oneOf/6/required",keyword:"required",params:{missingProperty:"to"},message:"must have required property 'to'"};e===null?e=[o]:e.push(o),r++}if(t.color===void 0){let o={instancePath:n,schemaPath:"#/oneOf/6/required",keyword:"required",params:{missingProperty:"color"},message:"must have required property 'color'"};e===null?e=[o]:e.push(o),r++}for(let o in t)if(!(o==="type"||o==="row"||o==="from"||o==="to"||o==="color")){let p={instancePath:n,schemaPath:"#/oneOf/6/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:o},message:"must NOT have additional properties"};e===null?e=[p]:e.push(p),r++}if(t.type!==void 0&&t.type!=="mark"){let o={instancePath:n+"/type",schemaPath:"#/oneOf/6/properties/type/const",keyword:"const",params:{allowedValue:"mark"},message:"must be equal to constant"};e===null?e=[o]:e.push(o),r++}if(t.row!==void 0){let o=t.row;if(typeof o=="string"){if(!Re.test(o)){let p={instancePath:n+"/row",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[p]:e.push(p),r++}}else{let p={instancePath:n+"/row",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),r++}}if(t.from!==void 0){let o=t.from;if(!(typeof o=="number"&&!(o%1)&&!isNaN(o)&&isFinite(o))){let p={instancePath:n+"/from",schemaPath:"#/definitions/unit/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[p]:e.push(p),r++}if(typeof o=="number"&&isFinite(o)&&(o<0||isNaN(o))){let p={instancePath:n+"/from",schemaPath:"#/definitions/unit/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[p]:e.push(p),r++}}if(t.to!==void 0){let o=t.to;if(!(typeof o=="number"&&!(o%1)&&!isNaN(o)&&isFinite(o))){let p={instancePath:n+"/to",schemaPath:"#/definitions/unit/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[p]:e.push(p),r++}if(typeof o=="number"&&isFinite(o)&&(o<0||isNaN(o))){let p={instancePath:n+"/to",schemaPath:"#/definitions/unit/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[p]:e.push(p),r++}}if(t.color!==void 0){let o=t.color;if(!(o==="blue"||o==="amber"||o==="green"||o==="violet"||o==="rose"||o==="slate"||o==="coin")){let p={instancePath:n+"/color",schemaPath:"#/definitions/color/enum",keyword:"enum",params:{allowedValues:Tt.enum},message:"must be equal to one of the allowed values"};e===null?e=[p]:e.push(p),r++}}}else{let o={instancePath:n,schemaPath:"#/oneOf/6/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[o]:e.push(o),r++}else if(i==="span")if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.type===void 0){let o={instancePath:n,schemaPath:"#/oneOf/7/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};e===null?e=[o]:e.push(o),r++}if(t.from===void 0){let o={instancePath:n,schemaPath:"#/oneOf/7/required",keyword:"required",params:{missingProperty:"from"},message:"must have required property 'from'"};e===null?e=[o]:e.push(o),r++}if(t.to===void 0){let o={instancePath:n,schemaPath:"#/oneOf/7/required",keyword:"required",params:{missingProperty:"to"},message:"must have required property 'to'"};e===null?e=[o]:e.push(o),r++}if(t.text===void 0){let o={instancePath:n,schemaPath:"#/oneOf/7/required",keyword:"required",params:{missingProperty:"text"},message:"must have required property 'text'"};e===null?e=[o]:e.push(o),r++}for(let o in t)if(!(o==="type"||o==="from"||o==="to"||o==="text"||o==="shape"||o==="color")){let p={instancePath:n,schemaPath:"#/oneOf/7/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:o},message:"must NOT have additional properties"};e===null?e=[p]:e.push(p),r++}if(t.type!==void 0&&t.type!=="span"){let o={instancePath:n+"/type",schemaPath:"#/oneOf/7/properties/type/const",keyword:"const",params:{allowedValue:"span"},message:"must be equal to constant"};e===null?e=[o]:e.push(o),r++}if(t.from!==void 0){let o=t.from;if(!(typeof o=="number"&&!(o%1)&&!isNaN(o)&&isFinite(o))){let p={instancePath:n+"/from",schemaPath:"#/definitions/unit/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[p]:e.push(p),r++}if(typeof o=="number"&&isFinite(o)&&(o<0||isNaN(o))){let p={instancePath:n+"/from",schemaPath:"#/definitions/unit/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[p]:e.push(p),r++}}if(t.to!==void 0){let o=t.to;if(!(typeof o=="number"&&!(o%1)&&!isNaN(o)&&isFinite(o))){let p={instancePath:n+"/to",schemaPath:"#/definitions/unit/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[p]:e.push(p),r++}if(typeof o=="number"&&isFinite(o)&&(o<0||isNaN(o))){let p={instancePath:n+"/to",schemaPath:"#/definitions/unit/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[p]:e.push(p),r++}}if(t.text!==void 0){let o=t.text;if(typeof o=="string"){if(Me(o)<1){let p={instancePath:n+"/text",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[p]:e.push(p),r++}}else{let p={instancePath:n+"/text",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[p]:e.push(p),r++}}if(t.shape!==void 0&&t.shape!=="box"){let o={instancePath:n+"/shape",schemaPath:"#/oneOf/7/properties/shape/enum",keyword:"enum",params:{allowedValues:fr.oneOf[7].properties.shape.enum},message:"must be equal to one of the allowed values"};e===null?e=[o]:e.push(o),r++}if(t.color!==void 0){let o=t.color;if(!(o==="blue"||o==="amber"||o==="green"||o==="violet"||o==="rose"||o==="slate"||o==="coin")){let p={instancePath:n+"/color",schemaPath:"#/definitions/color/enum",keyword:"enum",params:{allowedValues:Tt.enum},message:"must be equal to one of the allowed values"};e===null?e=[p]:e.push(p),r++}}}else{let o={instancePath:n,schemaPath:"#/oneOf/7/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[o]:e.push(o),r++}else if(i==="strip"){let o=r,p=!1,f=r;if(t&&typeof t=="object"&&!Array.isArray(t)&&t.value===void 0){let b={instancePath:n,schemaPath:"#/oneOf/8/anyOf/0/required",keyword:"required",params:{missingProperty:"value"},message:"must have required property 'value'"};e===null?e=[b]:e.push(b),r++}var s=f===r;if(p=p||s,!p){let b=r;if(t&&typeof t=="object"&&!Array.isArray(t)&&t.tag===void 0){let d={instancePath:n,schemaPath:"#/oneOf/8/anyOf/1/required",keyword:"required",params:{missingProperty:"tag"},message:"must have required property 'tag'"};e===null?e=[d]:e.push(d),r++}var s=b===r;p=p||s}if(p)r=o,e!==null&&(o?e.length=o:e=null);else{let b={instancePath:n,schemaPath:"#/oneOf/8/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};e===null?e=[b]:e.push(b),r++}if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.type===void 0){let b={instancePath:n,schemaPath:"#/oneOf/8/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};e===null?e=[b]:e.push(b),r++}if(t.field===void 0){let b={instancePath:n,schemaPath:"#/oneOf/8/required",keyword:"required",params:{missingProperty:"field"},message:"must have required property 'field'"};e===null?e=[b]:e.push(b),r++}for(let b in t)if(!(b==="type"||b==="field"||b==="value"||b==="tag")){let m={instancePath:n,schemaPath:"#/oneOf/8/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:b},message:"must NOT have additional properties"};e===null?e=[m]:e.push(m),r++}if(t.type!==void 0&&t.type!=="strip"){let b={instancePath:n+"/type",schemaPath:"#/oneOf/8/properties/type/const",keyword:"const",params:{allowedValue:"strip"},message:"must be equal to constant"};e===null?e=[b]:e.push(b),r++}if(t.field!==void 0){let b=t.field;if(typeof b=="string"){if(Me(b)<1){let m={instancePath:n+"/field",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[m]:e.push(m),r++}}else{let m={instancePath:n+"/field",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[m]:e.push(m),r++}}if(t.value!==void 0){let b=t.value;if(typeof b=="string"){if(Me(b)<1){let m={instancePath:n+"/value",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[m]:e.push(m),r++}}else{let m={instancePath:n+"/value",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[m]:e.push(m),r++}}if(t.tag!==void 0){let b=t.tag;if(typeof b=="string"){if(Me(b)<1){let m={instancePath:n+"/tag",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[m]:e.push(m),r++}}else{let m={instancePath:n+"/tag",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[m]:e.push(m),r++}}}else{let b={instancePath:n,schemaPath:"#/oneOf/8/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[b]:e.push(b),r++}}else{let o={instancePath:n,schemaPath:"#/discriminator",keyword:"discriminator",params:{error:"mapping",tag:"type",tagValue:i},message:'value of tag "type" must be in oneOf'};e===null?e=[o]:e.push(o),r++}else{let o={instancePath:n,schemaPath:"#/discriminator",keyword:"discriminator",params:{error:"tag",tag:"type",tagValue:i},message:'tag "type" must be string'};e===null?e=[o]:e.push(o),r++}}else{let i={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[i]:e.push(i),r++}return en.errors=e,r===0}function tn(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.title===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"title"},message:"must have required property 'title'"};e===null?e=[s]:e.push(s),r++}if(t.body===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"body"},message:"must have required property 'body'"};e===null?e=[s]:e.push(s),r++}if(t.events===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"events"},message:"must have required property 'events'"};e===null?e=[s]:e.push(s),r++}for(let s in t)if(!(s==="title"||s==="body"||s==="code"||s==="sources"||s==="events")){let i={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};e===null?e=[i]:e.push(i),r++}if(t.title!==void 0){let s=t.title;if(typeof s=="string"){if(Me(s)<1){let i={instancePath:n+"/title",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/title",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.body!==void 0){let s=t.body;if(typeof s=="string"){if(Me(s)<1){let i={instancePath:n+"/body",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/body",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.code!==void 0){let s=t.code;if(typeof s=="string"){if(Me(s)<1){let i={instancePath:n+"/code",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/code",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.sources!==void 0){let s=t.sources;if(Array.isArray(s)){if(s.length<1){let o={instancePath:n+"/sources",schemaPath:"#/properties/sources/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};e===null?e=[o]:e.push(o),r++}let i=s.length;for(let o=0;o<i;o++)Zt(s[o],{instancePath:n+"/sources/"+o,parentData:s,parentDataProperty:o,rootData:l})||(e=e===null?Zt.errors:e.concat(Zt.errors),r=e.length)}else{let i={instancePath:n+"/sources",schemaPath:"#/properties/sources/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[i]:e.push(i),r++}}if(t.events!==void 0){let s=t.events;if(Array.isArray(s)){let i=s.length;for(let o=0;o<i;o++)en(s[o],{instancePath:n+"/events/"+o,parentData:s,parentDataProperty:o,rootData:l})||(e=e===null?en.errors:e.concat(en.errors),r=e.length)}else{let i={instancePath:n+"/events",schemaPath:"#/properties/events/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[i]:e.push(i),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[s]:e.push(s),r++}return tn.errors=e,r===0}function nn(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.lifelines===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"lifelines"},message:"must have required property 'lifelines'"};e===null?e=[s]:e.push(s),r++}for(let s in t)if(s!=="lifelines"){let i={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};e===null?e=[i]:e.push(i),r++}if(t.lifelines!==void 0){let s=t.lifelines;if(Array.isArray(s)){if(s.length<1){let o={instancePath:n+"/lifelines",schemaPath:"#/properties/lifelines/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};e===null?e=[o]:e.push(o),r++}let i=s.length;for(let o=0;o<i;o++){let p=s[o];if(typeof p=="string"){if(!Re.test(p)){let f={instancePath:n+"/lifelines/"+o,schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[f]:e.push(f),r++}}else{let f={instancePath:n+"/lifelines/"+o,schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[f]:e.push(f),r++}}}else{let i={instancePath:n+"/lifelines",schemaPath:"#/properties/lifelines/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[i]:e.push(i),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[s]:e.push(s),r++}return nn.errors=e,r===0}function rn(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.from===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"from"},message:"must have required property 'from'"};e===null?e=[s]:e.push(s),r++}if(t.to===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"to"},message:"must have required property 'to'"};e===null?e=[s]:e.push(s),r++}for(let s in t)if(!(s==="from"||s==="to"||s==="label")){let i={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};e===null?e=[i]:e.push(i),r++}if(t.from!==void 0){let s=t.from;if(typeof s=="string"){if(!Re.test(s)){let i={instancePath:n+"/from",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/from",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.to!==void 0){let s=t.to;if(typeof s=="string"){if(!Re.test(s)){let i={instancePath:n+"/to",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/to",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.label!==void 0){let s=t.label;if(typeof s=="string"){if(Me(s)<1){let i={instancePath:n+"/label",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/label",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[s]:e.push(s),r++}return rn.errors=e,r===0}function sn(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.paths===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"paths"},message:"must have required property 'paths'"};e===null?e=[s]:e.push(s),r++}for(let s in t)if(s!=="paths"){let i={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};e===null?e=[i]:e.push(i),r++}if(t.paths!==void 0){let s=t.paths;if(Array.isArray(s)){if(s.length<1){let o={instancePath:n+"/paths",schemaPath:"#/properties/paths/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};e===null?e=[o]:e.push(o),r++}let i=s.length;for(let o=0;o<i;o++)rn(s[o],{instancePath:n+"/paths/"+o,parentData:s,parentDataProperty:o,rootData:l})||(e=e===null?rn.errors:e.concat(rn.errors),r=e.length)}else{let i={instancePath:n+"/paths",schemaPath:"#/properties/paths/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[i]:e.push(i),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[s]:e.push(s),r++}return sn.errors=e,r===0}function on(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'"};e===null?e=[s]:e.push(s),r++}for(let s in t)if(!(s==="id"||s==="note")){let i={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};e===null?e=[i]:e.push(i),r++}if(t.id!==void 0){let s=t.id;if(typeof s=="string"){if(!Re.test(s)){let i={instancePath:n+"/id",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/id",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.note!==void 0){let s=t.note;if(typeof s=="string"){if(Me(s)<1){let i={instancePath:n+"/note",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/note",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[s]:e.push(s),r++}return on.errors=e,r===0}function an(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.branches===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"branches"},message:"must have required property 'branches'"};e===null?e=[s]:e.push(s),r++}for(let s in t)if(s!=="branches"){let i={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};e===null?e=[i]:e.push(i),r++}if(t.branches!==void 0){let s=t.branches;if(Array.isArray(s)){if(s.length<1){let o={instancePath:n+"/branches",schemaPath:"#/properties/branches/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};e===null?e=[o]:e.push(o),r++}let i=s.length;for(let o=0;o<i;o++)on(s[o],{instancePath:n+"/branches/"+o,parentData:s,parentDataProperty:o,rootData:l})||(e=e===null?on.errors:e.concat(on.errors),r=e.length)}else{let i={instancePath:n+"/branches",schemaPath:"#/properties/branches/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[i]:e.push(i),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[s]:e.push(s),r++}return an.errors=e,r===0}var Zs=new RegExp("^[0-9]+(\\.[0-9]+)?(ms|s|min|h|d)$","u");function ln(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.unit===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"unit"},message:"must have required property 'unit'"};e===null?e=[s]:e.push(s),r++}if(t.length===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"length"},message:"must have required property 'length'"};e===null?e=[s]:e.push(s),r++}if(t.count===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"count"},message:"must have required property 'count'"};e===null?e=[s]:e.push(s),r++}for(let s in t)if(!(s==="unit"||s==="length"||s==="count"||s==="from")){let i={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};e===null?e=[i]:e.push(i),r++}if(t.unit!==void 0){let s=t.unit;if(typeof s=="string"){if(Me(s)<1){let i={instancePath:n+"/unit",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/unit",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.length!==void 0){let s=t.length;if(typeof s=="string"){if(!Zs.test(s)){let i={instancePath:n+"/length",schemaPath:"#/definitions/duration/pattern",keyword:"pattern",params:{pattern:"^[0-9]+(\\.[0-9]+)?(ms|s|min|h|d)$"},message:'must match pattern "^[0-9]+(\\.[0-9]+)?(ms|s|min|h|d)$"'};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/length",schemaPath:"#/definitions/duration/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.count!==void 0){let s=t.count;if(!(typeof s=="number"&&!(s%1)&&!isNaN(s)&&isFinite(s))){let i={instancePath:n+"/count",schemaPath:"#/properties/count/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[i]:e.push(i),r++}if(typeof s=="number"&&isFinite(s)&&(s<1||isNaN(s))){let i={instancePath:n+"/count",schemaPath:"#/properties/count/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1"};e===null?e=[i]:e.push(i),r++}}if(t.from!==void 0){let s=t.from;if(!(typeof s=="number"&&!(s%1)&&!isNaN(s)&&isFinite(s))){let i={instancePath:n+"/from",schemaPath:"#/properties/from/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[i]:e.push(i),r++}if(typeof s=="number"&&isFinite(s)&&(s<0||isNaN(s))){let i={instancePath:n+"/from",schemaPath:"#/properties/from/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[i]:e.push(i),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[s]:e.push(s),r++}return ln.errors=e,r===0}function cn(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.name===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"name"},message:"must have required property 'name'"};e===null?e=[s]:e.push(s),r++}if(t.length===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"length"},message:"must have required property 'length'"};e===null?e=[s]:e.push(s),r++}for(let s in t)if(!(s==="name"||s==="length"||s==="from")){let i={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};e===null?e=[i]:e.push(i),r++}if(t.name!==void 0){let s=t.name;if(typeof s=="string"){if(Me(s)<1){let i={instancePath:n+"/name",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/name",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.length!==void 0){let s=t.length;if(!(typeof s=="number"&&!(s%1)&&!isNaN(s)&&isFinite(s))){let i={instancePath:n+"/length",schemaPath:"#/properties/length/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[i]:e.push(i),r++}if(typeof s=="number"&&isFinite(s)&&(s<1||isNaN(s))){let i={instancePath:n+"/length",schemaPath:"#/properties/length/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1"};e===null?e=[i]:e.push(i),r++}}if(t.from!==void 0){let s=t.from;if(!(typeof s=="number"&&!(s%1)&&!isNaN(s)&&isFinite(s))){let i={instancePath:n+"/from",schemaPath:"#/properties/from/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[i]:e.push(i),r++}if(typeof s=="number"&&isFinite(s)&&(s<0||isNaN(s))){let i={instancePath:n+"/from",schemaPath:"#/properties/from/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[i]:e.push(i),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[s]:e.push(s),r++}return cn.errors=e,r===0}function pn(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'"};e===null?e=[s]:e.push(s),r++}if(t.name===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"name"},message:"must have required property 'name'"};e===null?e=[s]:e.push(s),r++}for(let s in t)if(!(s==="id"||s==="name"||s==="color"||s==="empty")){let i={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};e===null?e=[i]:e.push(i),r++}if(t.id!==void 0){let s=t.id;if(typeof s=="string"){if(!Re.test(s)){let i={instancePath:n+"/id",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/id",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.name!==void 0){let s=t.name;if(typeof s=="string"){if(Me(s)<1){let i={instancePath:n+"/name",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/name",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.color!==void 0){let s=t.color;if(!(s==="blue"||s==="amber"||s==="green"||s==="violet"||s==="rose"||s==="slate"||s==="coin")){let i={instancePath:n+"/color",schemaPath:"#/definitions/color/enum",keyword:"enum",params:{allowedValues:Tt.enum},message:"must be equal to one of the allowed values"};e===null?e=[i]:e.push(i),r++}}if(t.empty!==void 0){let s=t.empty;if(Array.isArray(s)){let i=s.length;for(let o=0;o<i;o++){let p=s[o];if(!(typeof p=="number"&&!(p%1)&&!isNaN(p)&&isFinite(p))){let f={instancePath:n+"/empty/"+o,schemaPath:"#/definitions/unit/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[f]:e.push(f),r++}if(typeof p=="number"&&isFinite(p)&&(p<0||isNaN(p))){let f={instancePath:n+"/empty/"+o,schemaPath:"#/definitions/unit/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[f]:e.push(f),r++}}}else{let i={instancePath:n+"/empty",schemaPath:"#/properties/empty/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[i]:e.push(i),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[s]:e.push(s),r++}return pn.errors=e,r===0}function mn(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'"};e===null?e=[s]:e.push(s),r++}if(t.at===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"at"},message:"must have required property 'at'"};e===null?e=[s]:e.push(s),r++}for(let s in t)if(!(s==="id"||s==="at")){let i={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};e===null?e=[i]:e.push(i),r++}if(t.id!==void 0){let s=t.id;if(typeof s=="string"){if(!Re.test(s)){let i={instancePath:n+"/id",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};e===null?e=[i]:e.push(i),r++}}else{let i={instancePath:n+"/id",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[i]:e.push(i),r++}}if(t.at!==void 0){let s=t.at;if(!(typeof s=="number"&&!(s%1)&&!isNaN(s)&&isFinite(s))){let i={instancePath:n+"/at",schemaPath:"#/definitions/unit/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[i]:e.push(i),r++}if(typeof s=="number"&&isFinite(s)&&(s<0||isNaN(s))){let i={instancePath:n+"/at",schemaPath:"#/definitions/unit/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[i]:e.push(i),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[s]:e.push(s),r++}return mn.errors=e,r===0}function dn(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.from===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"from"},message:"must have required property 'from'"};e===null?e=[s]:e.push(s),r++}if(t.to===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"to"},message:"must have required property 'to'"};e===null?e=[s]:e.push(s),r++}for(let s in t)if(!(s==="from"||s==="to")){let i={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};e===null?e=[i]:e.push(i),r++}if(t.from!==void 0){let s=t.from;if(!(typeof s=="number"&&!(s%1)&&!isNaN(s)&&isFinite(s))){let i={instancePath:n+"/from",schemaPath:"#/definitions/unit/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[i]:e.push(i),r++}if(typeof s=="number"&&isFinite(s)&&(s<0||isNaN(s))){let i={instancePath:n+"/from",schemaPath:"#/definitions/unit/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[i]:e.push(i),r++}}if(t.to!==void 0){let s=t.to;if(!(typeof s=="number"&&!(s%1)&&!isNaN(s)&&isFinite(s))){let i={instancePath:n+"/to",schemaPath:"#/definitions/unit/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[i]:e.push(i),r++}if(typeof s=="number"&&isFinite(s)&&(s<0||isNaN(s))){let i={instancePath:n+"/to",schemaPath:"#/definitions/unit/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"};e===null?e=[i]:e.push(i),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[s]:e.push(s),r++}return dn.errors=e,r===0}function fn(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.scale===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"scale"},message:"must have required property 'scale'"};e===null?e=[s]:e.push(s),r++}if(t.rows===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"rows"},message:"must have required property 'rows'"};e===null?e=[s]:e.push(s),r++}for(let s in t)if(!(s==="scale"||s==="period"||s==="rows"||s==="points"||s==="zoom")){let i={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};e===null?e=[i]:e.push(i),r++}if(t.scale!==void 0&&(ln(t.scale,{instancePath:n+"/scale",parentData:t,parentDataProperty:"scale",rootData:l})||(e=e===null?ln.errors:e.concat(ln.errors),r=e.length)),t.period!==void 0&&(cn(t.period,{instancePath:n+"/period",parentData:t,parentDataProperty:"period",rootData:l})||(e=e===null?cn.errors:e.concat(cn.errors),r=e.length)),t.rows!==void 0){let s=t.rows;if(Array.isArray(s)){if(s.length<1){let o={instancePath:n+"/rows",schemaPath:"#/properties/rows/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};e===null?e=[o]:e.push(o),r++}let i=s.length;for(let o=0;o<i;o++)pn(s[o],{instancePath:n+"/rows/"+o,parentData:s,parentDataProperty:o,rootData:l})||(e=e===null?pn.errors:e.concat(pn.errors),r=e.length)}else{let i={instancePath:n+"/rows",schemaPath:"#/properties/rows/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[i]:e.push(i),r++}}if(t.points!==void 0){let s=t.points;if(Array.isArray(s)){let i=s.length;for(let o=0;o<i;o++)mn(s[o],{instancePath:n+"/points/"+o,parentData:s,parentDataProperty:o,rootData:l})||(e=e===null?mn.errors:e.concat(mn.errors),r=e.length)}else{let i={instancePath:n+"/points",schemaPath:"#/properties/points/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[i]:e.push(i),r++}}t.zoom!==void 0&&(dn(t.zoom,{instancePath:n+"/zoom",parentData:t,parentDataProperty:"zoom",rootData:l})||(e=e===null?dn.errors:e.concat(dn.errors),r=e.length))}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[s]:e.push(s),r++}return fn.errors=e,r===0}var Qs=Object.prototype.hasOwnProperty;function hr(t,{instancePath:n="",parentData:a,parentDataProperty:c,rootData:l=t}={}){let e=null,r=0,s=r,i=!0,o=r;if(t&&typeof t=="object"&&!Array.isArray(t)){let u;if(t.kind===void 0&&(u="kind")){let h={};e===null?e=[h]:e.push(h),r++}else if(t.kind!==void 0&&t.kind!=="sequence"){let h={};e===null?e=[h]:e.push(h),r++}}var p=o===r;r=s,e!==null&&(s?e.length=s:e=null);let f;if(p){let u=r;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.sequence===void 0){let P={instancePath:n,schemaPath:"#/then/required",keyword:"required",params:{missingProperty:"sequence"},message:"must have required property 'sequence'"};e===null?e=[P]:e.push(P),r++}if(t.boxes!==void 0){let P=t.boxes;if(Array.isArray(P)&&P.length<1){let I={instancePath:n+"/boxes",schemaPath:"#/then/properties/boxes/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};e===null?e=[I]:e.push(I),r++}}if(t.steps!==void 0&&(et(t.steps,{instancePath:n+"/steps",parentData:t,parentDataProperty:"steps",rootData:l})||(e=e===null?et.errors:e.concat(et.errors),r=e.length)),t.strip!==void 0&&(Ve(t.strip,{instancePath:n+"/strip",parentData:t,parentDataProperty:"strip",rootData:l})||(e=e===null?Ve.errors:e.concat(Ve.errors),r=e.length)),t.state!==void 0){let P={instancePath:n+"/state",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[P]:e.push(P),r++}if(t.git!==void 0){let P={instancePath:n+"/git",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[P]:e.push(P),r++}if(t.time!==void 0){let P={instancePath:n+"/time",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[P]:e.push(P),r++}}var p=u===r;i=p,f="then"}else{let u=r,h=r,P=!0,I=r;if(t&&typeof t=="object"&&!Array.isArray(t)){let U;if(t.kind===void 0&&(U="kind")){let j={};e===null?e=[j]:e.push(j),r++}else if(t.kind!==void 0&&t.kind!=="state"){let j={};e===null?e=[j]:e.push(j),r++}}var b=I===r;r=h,e!==null&&(h?e.length=h:e=null);let G;if(b){let U=r;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.boxes!==void 0){let A=t.boxes;if(Array.isArray(A)){if(A.length<1){let K={instancePath:n+"/boxes",schemaPath:"#/else/then/properties/boxes/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};e===null?e=[K]:e.push(K),r++}let C=A.length;for(let K=0;K<C;K++){let X=A[K];if(X&&typeof X=="object"&&!Array.isArray(X)&&X.id!==void 0){let Q=X.id,ie=r,re=r;if(!(Q==="start"||Q==="finish")){let D={};e===null?e=[D]:e.push(D),r++}var m=re===r;if(m){let D={instancePath:n+"/boxes/"+K+"/id",schemaPath:"#/else/then/properties/boxes/items/properties/id/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[D]:e.push(D),r++}else r=ie,e!==null&&(ie?e.length=ie:e=null)}}}}if(t.steps!==void 0&&(et(t.steps,{instancePath:n+"/steps",parentData:t,parentDataProperty:"steps",rootData:l})||(e=e===null?et.errors:e.concat(et.errors),r=e.length)),t.strip!==void 0&&(Ve(t.strip,{instancePath:n+"/strip",parentData:t,parentDataProperty:"strip",rootData:l})||(e=e===null?Ve.errors:e.concat(Ve.errors),r=e.length)),t.git!==void 0){let A={instancePath:n+"/git",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[A]:e.push(A),r++}if(t.time!==void 0){let A={instancePath:n+"/time",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[A]:e.push(A),r++}}var b=U===r;P=b,G="then"}else{let U=r,j=r,A=!0,C=r;if(t&&typeof t=="object"&&!Array.isArray(t)){let Q;if(t.kind===void 0&&(Q="kind")){let ie={};e===null?e=[ie]:e.push(ie),r++}else if(t.kind!==void 0&&t.kind!=="git"){let ie={};e===null?e=[ie]:e.push(ie),r++}}var d=C===r;r=j,e!==null&&(j?e.length=j:e=null);let K;if(d){let Q=r;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.git===void 0){let re={instancePath:n,schemaPath:"#/else/else/then/required",keyword:"required",params:{missingProperty:"git"},message:"must have required property 'git'"};e===null?e=[re]:e.push(re),r++}if(t.steps!==void 0&&(zt(t.steps,{instancePath:n+"/steps",parentData:t,parentDataProperty:"steps",rootData:l})||(e=e===null?zt.errors:e.concat(zt.errors),r=e.length)),t.strip!==void 0&&(Ve(t.strip,{instancePath:n+"/strip",parentData:t,parentDataProperty:"strip",rootData:l})||(e=e===null?Ve.errors:e.concat(Ve.errors),r=e.length)),t.state!==void 0){let re={instancePath:n+"/state",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[re]:e.push(re),r++}if(t.regions!==void 0){let re={instancePath:n+"/regions",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[re]:e.push(re),r++}if(t.time!==void 0){let re={instancePath:n+"/time",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[re]:e.push(re),r++}}var d=Q===r;A=d,K="then"}else{let Q=r,ie=r,re=!0,D=r;if(t&&typeof t=="object"&&!Array.isArray(t)){let E;if(t.kind===void 0&&(E="kind")){let v={};e===null?e=[v]:e.push(v),r++}else if(t.kind!==void 0&&t.kind!=="time"){let v={};e===null?e=[v]:e.push(v),r++}}var $=D===r;r=ie,e!==null&&(ie?e.length=ie:e=null);let x;if($){let E=r;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.time===void 0){let q={instancePath:n,schemaPath:"#/else/else/else/then/required",keyword:"required",params:{missingProperty:"time"},message:"must have required property 'time'"};e===null?e=[q]:e.push(q),r++}if(t.steps!==void 0){let q=t.steps;if(Array.isArray(q)){let z=q.length;for(let ee=0;ee<z;ee++){let de=q[ee];if(de&&typeof de=="object"&&!Array.isArray(de)&&de.events!==void 0){let ce=de.events;if(Array.isArray(ce)){let pe=ce.length;for(let ve=0;ve<pe;ve++){let we=ce[ve];if(we&&typeof we=="object"&&!Array.isArray(we)&&we.type!==void 0){let ye=we.type,Pe=r,k=r;if(!(ye==="commit"||ye==="branch")){let V={};e===null?e=[V]:e.push(V),r++}var S=k===r;if(S){let V={instancePath:n+"/steps/"+ee+"/events/"+ve+"/type",schemaPath:"#/definitions/timeSteps/items/properties/events/items/properties/type/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[V]:e.push(V),r++}else r=Pe,e!==null&&(Pe?e.length=Pe:e=null)}}}}}}}if(t.state!==void 0){let q={instancePath:n+"/state",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[q]:e.push(q),r++}if(t.git!==void 0){let q={instancePath:n+"/git",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[q]:e.push(q),r++}if(t.regions!==void 0){let q={instancePath:n+"/regions",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[q]:e.push(q),r++}}var $=E===r;re=$,x="then"}else{let E=r;if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.boxes!==void 0){let q=t.boxes;if(Array.isArray(q)&&q.length<1){let z={instancePath:n+"/boxes",schemaPath:"#/else/else/else/else/properties/boxes/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};e===null?e=[z]:e.push(z),r++}}if(t.steps!==void 0&&(et(t.steps,{instancePath:n+"/steps",parentData:t,parentDataProperty:"steps",rootData:l})||(e=e===null?et.errors:e.concat(et.errors),r=e.length)),t.strip!==void 0&&(Ve(t.strip,{instancePath:n+"/strip",parentData:t,parentDataProperty:"strip",rootData:l})||(e=e===null?Ve.errors:e.concat(Ve.errors),r=e.length)),t.state!==void 0){let q={instancePath:n+"/state",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[q]:e.push(q),r++}if(t.git!==void 0){let q={instancePath:n+"/git",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[q]:e.push(q),r++}if(t.time!==void 0){let q={instancePath:n+"/time",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[q]:e.push(q),r++}}var $=E===r;re=$,x="else"}if(!re){let E={instancePath:n,schemaPath:"#/else/else/else/if",keyword:"if",params:{failingKeyword:x},message:'must match "'+x+'" schema'};e===null?e=[E]:e.push(E),r++}var d=Q===r;A=d,K="else"}if(!A){let Q={instancePath:n,schemaPath:"#/else/else/if",keyword:"if",params:{failingKeyword:K},message:'must match "'+K+'" schema'};e===null?e=[Q]:e.push(Q),r++}var b=U===r;P=b,G="else"}if(!P){let U={instancePath:n,schemaPath:"#/else/if",keyword:"if",params:{failingKeyword:G},message:'must match "'+G+'" schema'};e===null?e=[U]:e.push(U),r++}if(t&&typeof t=="object"&&!Array.isArray(t)&&t.sequence!==void 0){let U={instancePath:n+"/sequence",schemaPath:"#/definitions/absent/not",keyword:"not",params:{},message:"must NOT be valid"};e===null?e=[U]:e.push(U),r++}var p=u===r;i=p,f="else"}if(!i){let u={instancePath:n,schemaPath:"#/if",keyword:"if",params:{failingKeyword:f},message:'must match "'+f+'" schema'};e===null?e=[u]:e.push(u),r++}if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.version===void 0){let u={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"version"},message:"must have required property 'version'"};e===null?e=[u]:e.push(u),r++}if(t.kind===void 0){let u={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"kind"},message:"must have required property 'kind'"};e===null?e=[u]:e.push(u),r++}if(t.title===void 0){let u={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"title"},message:"must have required property 'title'"};e===null?e=[u]:e.push(u),r++}if(t.boxes===void 0){let u={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"boxes"},message:"must have required property 'boxes'"};e===null?e=[u]:e.push(u),r++}if(t.steps===void 0){let u={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"steps"},message:"must have required property 'steps'"};e===null?e=[u]:e.push(u),r++}for(let u in t)if(!Qs.call(On.properties,u)){let h={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:u},message:"must NOT have additional properties"};e===null?e=[h]:e.push(h),r++}if(t.version!==void 0){let u=t.version;if(!(typeof u=="number"&&!(u%1)&&!isNaN(u)&&isFinite(u))){let h={instancePath:n+"/version",schemaPath:"#/properties/version/type",keyword:"type",params:{type:"integer"},message:"must be integer"};e===null?e=[h]:e.push(h),r++}if(typeof u=="number"&&isFinite(u)&&(u<1||isNaN(u))){let h={instancePath:n+"/version",schemaPath:"#/properties/version/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1"};e===null?e=[h]:e.push(h),r++}}if(t.kind!==void 0){let u=t.kind;if(!(u==="sequence"||u==="architecture"||u==="state"||u==="git"||u==="time")){let h={instancePath:n+"/kind",schemaPath:"#/properties/kind/enum",keyword:"enum",params:{allowedValues:On.properties.kind.enum},message:"must be equal to one of the allowed values"};e===null?e=[h]:e.push(h),r++}}if(t.title!==void 0){let u=t.title;if(typeof u=="string"){if(Me(u)<1){let h={instancePath:n+"/title",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};e===null?e=[h]:e.push(h),r++}}else{let h={instancePath:n+"/title",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};e===null?e=[h]:e.push(h),r++}}if(t.view!==void 0){let u=t.view;if(!(u==="fixed"||u==="follow")){let h={instancePath:n+"/view",schemaPath:"#/properties/view/enum",keyword:"enum",params:{allowedValues:On.properties.view.enum},message:"must be equal to one of the allowed values"};e===null?e=[h]:e.push(h),r++}}if(t.regions!==void 0){let u=t.regions;if(Array.isArray(u)){let h=u.length;for(let P=0;P<h;P++)Kt(u[P],{instancePath:n+"/regions/"+P,parentData:u,parentDataProperty:P,rootData:l})||(e=e===null?Kt.errors:e.concat(Kt.errors),r=e.length)}else{let h={instancePath:n+"/regions",schemaPath:"#/properties/regions/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[h]:e.push(h),r++}}if(t.boxes!==void 0){let u=t.boxes;if(Array.isArray(u)){let h=u.length;for(let P=0;P<h;P++)Xt(u[P],{instancePath:n+"/boxes/"+P,parentData:u,parentDataProperty:P,rootData:l})||(e=e===null?Xt.errors:e.concat(Xt.errors),r=e.length)}else{let h={instancePath:n+"/boxes",schemaPath:"#/properties/boxes/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[h]:e.push(h),r++}}if(t.strip!==void 0&&(Jt(t.strip,{instancePath:n+"/strip",parentData:t,parentDataProperty:"strip",rootData:l})||(e=e===null?Jt.errors:e.concat(Jt.errors),r=e.length)),t.steps!==void 0){let u=t.steps;if(Array.isArray(u)){if(u.length<1){let P={instancePath:n+"/steps",schemaPath:"#/properties/steps/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};e===null?e=[P]:e.push(P),r++}let h=u.length;for(let P=0;P<h;P++)tn(u[P],{instancePath:n+"/steps/"+P,parentData:u,parentDataProperty:P,rootData:l})||(e=e===null?tn.errors:e.concat(tn.errors),r=e.length)}else{let h={instancePath:n+"/steps",schemaPath:"#/properties/steps/type",keyword:"type",params:{type:"array"},message:"must be array"};e===null?e=[h]:e.push(h),r++}}t.sequence!==void 0&&(nn(t.sequence,{instancePath:n+"/sequence",parentData:t,parentDataProperty:"sequence",rootData:l})||(e=e===null?nn.errors:e.concat(nn.errors),r=e.length)),t.state!==void 0&&(sn(t.state,{instancePath:n+"/state",parentData:t,parentDataProperty:"state",rootData:l})||(e=e===null?sn.errors:e.concat(sn.errors),r=e.length)),t.git!==void 0&&(an(t.git,{instancePath:n+"/git",parentData:t,parentDataProperty:"git",rootData:l})||(e=e===null?an.errors:e.concat(an.errors),r=e.length)),t.time!==void 0&&(fn(t.time,{instancePath:n+"/time",parentData:t,parentDataProperty:"time",rootData:l})||(e=e===null?fn.errors:e.concat(fn.errors),r=e.length))}else{let u={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};e===null?e=[u]:e.push(u),r++}return hr.errors=e,r===0}var ei=["edge","action","swap","strip","commit","branch","now","mark","span"],ti="#/definitions/absent/not",ni={regions:"sequence / architecture / state",at:"time",into:"time",color:"time",meters:"time"},ri={carry:{field:"text",kind:"tag"}},si=/\/boxes\/items\/properties\/id\/not$/u,ii=/\/events\/items\/properties\/type\/not$/u,oi=["commit","branch"],ai=/\/events\/items\/not$/u,li=["now","mark","span"],ci=/^\^\[0-9\]\+\(\\\.\[0-9\]\+\)\?\(([a-z|]+)\)\$$/u,pi=/%\)\$$/u,En=t=>t.replaceAll("~","~0").replaceAll("/","~1"),mi="#/definitions/url/pattern",di=/^\^\[0-9a-f\]\{(\d+),(\d+)\}\$$/u;function fi(t){let n=/^\^\[\^(.+)\]\+\$$/u.exec(t)?.[1];if(n===void 0)return;let a=n.match(/\\.|[^\\]/gu)??[];return{space:a.includes("\\s"),chars:a.filter(c=>c!=="\\s").map(c=>c.replace(/^\\/u,""))}}var gr=(t,n)=>n.filter(a=>a!==t&&a.schemaPath.startsWith(`${t.schemaPath}/`)&&(a.instancePath===t.instancePath||a.instancePath.startsWith(`${t.instancePath}/`)));function ui(t,n,a){let c=t.params,l=t.instancePath;switch(t.keyword){case"additionalProperties":{let e=String(c.additionalProperty);return{pointer:`${l}/${En(e)}`,message:a.additionalProperties(e)}}case"required":{let e=String(c.missingProperty);return{pointer:`${l}/${En(e)}`,message:a.required(e)}}case"not":{if(si.test(t.schemaPath))return{pointer:l,message:a.reserved(Mt)};if(ii.test(t.schemaPath))return{pointer:l,message:a.kindOnly(oi,"git")};if(ai.test(t.schemaPath))return{pointer:`${l}/type`,message:a.kindOnly(li,"time")};let e=l.slice(l.lastIndexOf("/")+1);if(t.schemaPath===ti)return{pointer:l,message:a.not({field:e,kind:ni[e]??e})};let r=ri[e];return{pointer:r?`${l}/${r.field}`:l,message:a.not(r)}}case"anyOf":{let e=gr(t,n),r=e.every(s=>s.keyword==="required")?e.map(s=>String(s.params.missingProperty)):[];return{pointer:l,message:a.anyOf(r)}}case"discriminator":{let e=String(c.tag);return{pointer:`${l}/${En(e)}`,message:a.discriminator(e,ei)}}case"enum":return{pointer:l,message:a.enum(c.allowedValues.map(String))};case"type":return{pointer:l,message:a.type(String(c.type))};case"minLength":return{pointer:l,message:a.minLength(Number(c.limit))};case"pattern":{if(t.schemaPath===mi)return{pointer:l,message:a.url};let e=String(c.pattern),r=di.exec(e);if(r)return{pointer:l,message:a.hex(Number(r[1]),Number(r[2]))};let s=ci.exec(e);return s?{pointer:l,message:a.duration((s[1]??"").split("|"))}:pi.test(e)?{pointer:l,message:a.ratio}:{pointer:l,message:a.pattern(fi(e))}}case"minItems":return{pointer:l,message:a.minItems(Number(c.limit))};case"minimum":return{pointer:l,message:a.minimum(Number(c.limit))};case"const":return{pointer:l,message:a.const(String(c.allowedValue))};case"oneOf":return{pointer:l,message:a.oneOf};default:return{pointer:l,message:t.message??t.keyword}}}function yr(t,n={}){if(Nn(t))return{ok:!0};let a=Nn.errors??[],c=new Set(a.filter(r=>r.keyword==="anyOf").flatMap(r=>gr(r,a))),l=Ht[n.lang??"ja"];return{ok:!1,errors:a.filter(r=>r.keyword!=="if"&&!c.has(r)).map(r=>ui(r,a,l))}}var br=1;function hi(t){if(typeof t!="object"||t===null)return;let n=t.version;return typeof n=="number"&&n>br?n:void 0}var gi=(t,n)=>({pointer:"/version",message:Ht[n].newer(t,br)});function xr(t,n={}){let a=hi(t);if(a!==void 0)return{ok:!1,errors:[gi(a,n.lang??"ja")]};let c=yr(t,n);return c.ok?{ok:!0,diagram:t,warnings:[]}:c}function wr(t,n){let a={edges:[],events:[],busy:0},c=oe.edgeAt,l,e=0,r=Number.NEGATIVE_INFINITY,s=(b,m,d)=>{let $=m.carry.kind!=="none",S=d+($?oe.drawCarry:oe.draw);return a.edges.push({event:b,a:d,b:S,carries:$,coin:m.carry.kind==="coin",named:m.label!==void 0}),a.busy=Math.max(a.busy,S),S},i=n?t.events.flatMap((b,m)=>b.type==="now"?[{e:m,to:b.to}]:[]):[],o=n?.from??0,p=Math.max(o,...i.map(b=>b.to+1)),f=b=>b.type==="edge"&&b.at!==void 0&&b.at>=o&&b.at<p;return t.events.forEach((b,m)=>{if(n&&m===i[0]?.e){let d=Math.max(c,r+oe.change),$=[[d,o]],S=[];for(let u=o;u<p;u++){let h=d,P=t.events.flatMap((ne,U)=>f(ne)&&ne.at===u?[{k:U,ev:ne}]:[]),I=P.reduce((ne,U,j)=>Math.max(ne,s(U.k,U.ev,h+oe.stagger*j)),h),G=Math.max(h+n.speed,P.length>0?I+oe.time.wait:h);G-n.speed>h+1e-9&&$.push([G-n.speed,u]),$.push([G,u+1]),S.push({unit:u,at:G}),d=G}a.sweep={keys:$,passed:S},a.busy=Math.max(a.busy,d),c=d+oe.time.after,l=d,e=0;return}if(!(b.type==="now"||n&&f(b)))if(b.type==="commit"||b.type==="branch"){let d=c,$=d+oe.draw;a.edges.push({event:m,a:d,b:$,carries:!1,coin:!1,named:!1}),c=d+oe.stagger,l=$,e=0,a.busy=Math.max(a.busy,$)}else if(b.type==="edge"){let d=c;l=s(m,b,d),c=d+oe.stagger,e=0}else if(b.type==="action")a.events.push({event:m,at:c}),a.busy=Math.max(a.busy,c+oe.action),c+=oe.action,e=0;else{let d=(l??c)+oe.change*e++;a.events.push({event:m,at:d}),a.busy=Math.max(a.busy,d),r=Math.max(r,d)}}),a.edges.sort((b,m)=>b.a-m.a),a}function $r(t,n=!1){let a=t.kind==="time"?t.time:void 0,c=oe.time,l=a?Math.min(c.unitMax,Math.max(c.unitMin,c.axis/Math.max(1,a.scale.count))):0,e=0,r=t.steps.map(A=>{if(!a)return wr(A);let C=wr(A,{from:e,speed:l});return e=C.sweep?.keys[C.sweep.keys.length-1]?.[1]??e,C}),s=[],i=oe.intro;t.steps.forEach((A,C)=>{let K=Math.min(oe.stepMax,Math.max(oe.stepMin,oe.stepBase+[...A.body].length*oe.perChar)),X=Math.max(K,(r[C]?.busy??0)+oe.dwell);s.push({start:i,end:i+X}),i+=X});let p=Math.ceil(i+oe.outro),f=p-oe.tail,b=s[s.length-1],m=n&&b?{start:b.start+(r[r.length-1]?.busy??0),end:f}:void 0,d=m?.start??f,$=[],S=[],u=[],h=[];r.forEach((A,C)=>{let K=s[C],X=[];for(let Q of A.edges){let ie=K.start+Q.a;$.push({step:C,event:Q.event,start:ie,drawn:K.start+Q.b,end:K.end});let re=t.steps[C]?.events[Q.event],D=t.kind==="git"&&re?.type==="edge"&&re.carry.kind==="tag"&&re.carry.text===re.from;Q.carries&&!D&&h.push({step:C,event:Q.event,who:Q.coin?"coin":"main",a:ie,b:K.start+Q.b}),Q.named&&X.push({step:C,event:Q.event,start:ie+oe.labelDelay,end:K.end})}X.forEach((Q,ie)=>{let re=X[ie+2];re&&(Q.end=Math.min(Q.end,re.start))});for(let Q of X)m&&Q.end>m.start?Q.end=m.end:(t.kind==="state"&&Q.end<d&&(Q.after={start:Q.end,end:d}),m&&(Q.again=m));S.push(...X);for(let Q of A.events)u.push({step:C,event:Q.event,at:K.start+Q.at})});let P=s[0]?.start??0,I=h.some(A=>A.who==="main"),G=[];for(let A of["main","coin"]){let C=h.filter(K=>K.who===A);C.forEach((K,X)=>{let Q=C[X+1],ie=X===0&&(A==="main"||!I);G.push({step:K.step,event:K.event,who:A,depart:K.a,arrive:K.b,start:ie?Math.min(P,K.a):K.a,end:Q?Math.max(Q.a,K.b):f})})}G.sort((A,C)=>A.depart-C.depart);let ne=t.kind==="state"?xi(t,$,f):void 0,U=[[0,0]],j=[];return r.forEach((A,C)=>{let K=s[C].start;for(let[X,Q]of A.sweep?.keys??[])U.push([K+X,Q]);for(let X of A.sweep?.passed??[])j.push({unit:X.unit,passed:K+X.at})}),U.push([p,e]),{total:p,last:f,steps:s,edges:$,carriers:G,labels:S,badges:s.map((A,C)=>({step:C,appears:A.start})),events:u,stills:s.map(A=>A.end-oe.still),...m?{whole:m}:{},...ne?{states:ne}:{},...a?{needle:U,units:j,meters:yi(t,r,s)}:{}}}function yi(t,n,a){let c=t.time?.period?.length;return(t.strip?.meters??[]).map(({field:l})=>{let e=[[0,0]],r=0;return n.forEach((s,i)=>{let o=a[i].start,p=(t.steps[i]?.events??[]).flatMap(($,S)=>{let u=$.type==="strip"&&$.field===l&&$.value!==void 0?Mn($.value):void 0;return u===void 0?[]:[{e:S,ratio:u}]}),f=p[p.length-1];if(!f)return;let b=s.sweep?.keys??[],m=b[0],d=b[b.length-1];if(m&&d&&d[1]>m[1]){let[$,S]=[m[1],d[1]],u=r,h=$,P=c?Math.floor((S-1e-9)/c)*c:0;if(P>0&&P>=$){let I=o+(b.find(([,ne])=>ne===P)?.[0]??m[0]),G=e[e.length-1][0];e.push([Math.max(G,I-oe.time.reset),r],[I,0]),u=0,h=P}for(let[I,G]of b)G>=h&&e.push([o+I,u+(f.ratio-u)*(G-h)/(S-h)])}else{let $=o+(s.events.find(S=>S.event===f.e)?.at??0);e.push([$,r],[$+oe.fade,f.ratio])}r=f.ratio}),{field:l,keys:e}})}var bi=t=>Mt.includes(t);function xi(t,n,a){let c=new Map,l=r=>{let s=c.get(r)??{box:r,lit:[]};return c.set(r,s),s},e;for(let r of n){let s=t.steps[r.step]?.events[r.event];if(!(s?.type!=="edge"||s.from===s.to)){if(e){let i=l(e.box);i.lit.push({start:e.since,end:r.start}),e.box===s.from&&i.done===void 0&&(i.done=r.start+oe.done),e=void 0}bi(s.to)||(e={box:s.to,since:r.drawn})}}return e&&l(e.box).lit.push({start:e.since,end:a}),[...c.values()]}var Lt={app:"M -9 -7 h18 a2 2 0 0 1 2 2 v10 a2 2 0 0 1 -2 2 h-18 a2 2 0 0 1 -2 -2 v-10 a2 2 0 0 1 2 -2 z M -11 -2 h22",router:"M -9 -4 h16 M 3 -8 l4 4 l-4 4 M 9 5 h-16 M -3 1 l-4 4 l4 4",on:"M -7 7 L 7 -7 M -1 -7 h8 v8",off:"M -7 -7 L 7 7 M 7 -1 v8 h-8",pool:"M -9 -5 a9 3.5 0 1 0 18 0 a9 3.5 0 1 0 -18 0 M -9 -5 v10 a9 3.5 0 0 0 18 0 v-10 M -9 0 a9 3.5 0 0 0 18 0",db:"M -9 -5 a9 3.5 0 1 0 18 0 a9 3.5 0 1 0 -18 0 M -9 -5 v10 a9 3.5 0 0 0 18 0 v-10 M -9 0 a9 3.5 0 0 0 18 0",exe:"M -5 -8 L 7 0 L -5 8 Z",idx:"M -9 -7 h18 M -9 -2 h18 M -9 3 h18 M -9 8 h11",sign:"M -9 4 c 3 -9 5 -9 6 0 s 3 7 6 -2 s 3 -6 6 0",env:"M -8 -5.5 h16 v11 h-16 z M -8 -5.5 l8 6 l8 -6",lock:"M -5.5 -1 h11 v8 h-11 z M -3.5 -1 v-3 a3.5 3.5 0 0 1 7 0 v3",check:"M -5 0 l3.5 3.5 l6.5 -7",flag:"M -4 8 V -8 M -4 -7 H 6 L 3.5 -3.5 L 6 0 H -4",x:"M -5 -5 l10 10 M 5 -5 l-10 10",chain:"M -1.5 4.5 l-2 2 a3.5 3.5 0 0 1 -5 -5 l3 -3 a3.5 3.5 0 0 1 5 0 M 1.5 -4.5 l2 -2 a3.5 3.5 0 0 1 5 5 l-3 3 a3.5 3.5 0 0 1 -5 0 M -2.5 2.5 l5 -5",net:"M -1.3 -4.6 L -5.8 3 M 1.3 -4.6 L 5.8 3 M -4.3 5.5 H 4.3 M -2.2 -7 a 2.2 2.2 0 1 0 4.4 0 a 2.2 2.2 0 1 0 -4.4 0 M -9.2 5.5 a 2.2 2.2 0 1 0 4.4 0 a 2.2 2.2 0 1 0 -4.4 0 M 4.8 5.5 a 2.2 2.2 0 1 0 4.4 0 a 2.2 2.2 0 1 0 -4.4 0",user:"M -4 -4.5 a4 4 0 1 0 8 0 a4 4 0 1 0 -8 0 M -8 9 c0 -5 3.6 -7.5 8 -7.5 s8 2.5 8 7.5",server:"M -9 -8 h18 v7 h-18 z M -9 1 h18 v7 h-18 z M -5 -4.5 h0.01 M -5 4.5 h0.01",key:"M -9 0 a3.5 3.5 0 1 0 7 0 a3.5 3.5 0 1 0 -7 0 M -2 0 h10 M 5 0 v3.5 M 8 0 v2.5",shield:"M 0 -9 l8 3 v5 c0 5 -3.5 8 -8 10 c-4.5 -2 -8 -5 -8 -10 v-5 z",globe:"M -9 0 a9 9 0 1 0 18 0 a9 9 0 1 0 -18 0 M -9 0 h18 M 0 -9 c-4.5 4 -4.5 14 0 18 M 0 -9 c4.5 4 4.5 14 0 18",bolt:"M 2 -9 L -5 1 h5 l-2 8 l7 -10 h-5 z",doc:"M -6 -9 h8 l5 5 v13 h-13 z M 2 -9 v5 h5 M -3 1 h7 M -3 5 h5",box:"M -9 -4.5 l9 -4.5 l9 4.5 v9 l-9 4.5 l-9 -4.5 z M -9 -4.5 l9 4.5 l9 -4.5 M 0 0 v9",truck:"M -10 -6 h11 v10 h-11 z M 1 -2 h5 l3.5 3.5 v2.5 h-8.5 M -7.5 6.5 a1.8 1.8 0 1 0 3.6 0 a1.8 1.8 0 1 0 -3.6 0 M 3 6.5 a1.8 1.8 0 1 0 3.6 0 a1.8 1.8 0 1 0 -3.6 0",card:"M -9 -6.5 h18 a2 2 0 0 1 2 2 v9 a2 2 0 0 1 -2 2 h-18 a2 2 0 0 1 -2 -2 v-9 a2 2 0 0 1 2 -2 z M -11 -2 h22 M -7 3 h5",cart:"M -10 -8 h3 l3 11 h11 l2.5 -8 h-15.5 M -4.5 7.5 a1.5 1.5 0 1 0 3 0 a1.5 1.5 0 1 0 -3 0 M 5 7.5 a1.5 1.5 0 1 0 3 0 a1.5 1.5 0 1 0 -3 0",clock:"M -9 0 a9 9 0 1 0 18 0 a9 9 0 1 0 -18 0 M 0 -5 v5 l3.5 2.5",branch:"M -4 -4.5 v9 M 5 0.5 c0 4 -9 3 -9 6.5 M -6.2 -7 a2.2 2.2 0 1 0 4.4 0 a2.2 2.2 0 1 0 -4.4 0 M -6.2 7 a2.2 2.2 0 1 0 4.4 0 a2.2 2.2 0 1 0 -4.4 0 M 2.8 -2 a2.2 2.2 0 1 0 4.4 0 a2.2 2.2 0 1 0 -4.4 0",cloud:"M -7 6 h13 a4.5 4.5 0 0 0 0.5 -9 a6 6 0 0 0 -11.5 -1 a4.5 4.5 0 0 0 -2 10 z",refresh:"M 7 -3 a7.5 7.5 0 1 0 0.5 5 M 7.5 -8 v5 h-5",undo:"M -7 -2 h10 a5 5 0 0 1 0 10 h-6 M -3 -6 l-4 4 l4 4",yen:"M -6 -8 l6 7 l6 -7 M 0 -1 v9 M -5 1.5 h10 M -5 5 h10",layers:"M 0 -8 l9 4.5 l-9 4.5 l-9 -4.5 z M -9 2.5 l9 4.5 l9 -4.5",code:"M -4 -6 l-5 6 l5 6 M 4 -6 l5 6 l-5 6",paint:"M -8 8 c 0 -3 2 -5 4.5 -5 l 9 -9 l 3.5 3.5 l -9 9 c 0 2.5 -2 4.5 -5 4.5 z",block:"M -9 -7 h18 a2 2 0 0 1 2 2 v10 a2 2 0 0 1 -2 2 h-18 a2 2 0 0 1 -2 -2 v-10 a2 2 0 0 1 2 -2 z M -11 -2.5 h22 M -6 2.5 h8"};var We=[[0,Number.POSITIVE_INFINITY]],qn=.5,kr=(t,n)=>t.shown.some(([a,c])=>a<=n&&n<c),Ln=t=>({text:t.text,rect:{x:t.rect.x,y:t.rect.y,w:t.rect.w,h:t.rect.h},badge:t.badge===!0,...t.part?{part:t.part}:{}});function vr(t,n,a=[]){let c=[];return n.forEach((l,e)=>{let r=t.filter(i=>kr(i,l));r.forEach((i,o)=>{for(let p of r.slice(o+1)){let f=Math.min(i.rect.x+i.rect.w,p.rect.x+p.rect.w)-Math.max(i.rect.x,p.rect.x),b=Math.min(i.rect.y+i.rect.h,p.rect.y+p.rect.h)-Math.max(i.rect.y,p.rect.y);f>qn&&b>qn&&c.push({kind:"texts",step:e,texts:[i.text,p.text],spots:[Ln(i),Ln(p)]})}});let s=a.filter(i=>kr(i,l));for(let i of r)if(!i.boxed)for(let o of s)It(o.points,i.rect,qn)&&c.push({kind:"line",step:e,text:i.text,line:{from:o.from,to:o.to},spots:[Ln(i)]})}),c}var Te=t=>t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),un=(t,n)=>t===void 0?n:`<a href="${Te(t)}">${n}</a>`,W=t=>Math.round(t*100)/100,ke=t=>t==="coin"?"--c:var(--coin);--ct:var(--coint)":`--c:var(--c-${t});--ct:var(--t-${t})`;function ft(t,n,a,c,l="dg-gl"){let e=t===void 0?void 0:Lt[t];return e?`<path class="${l}" transform="translate(${W(n)} ${W(a)}) scale(${c})" d="${e}"/>`:""}function ut(t){let n=t.filter((e,r)=>r===0||e[0]!==t[r-1][0]||e[1]!==t[r-1][1]),[a,c]=n[0],l=`M ${W(a)} ${W(c)}`;for(let e=1;e<n.length-1;e++){let[r,s]=n[e-1],[i,o]=n[e],[p,f]=n[e+1],b=Math.hypot(i-r,o-s),m=Math.hypot(p-i,f-o),d=Math.min(w.edge.bend,b/2,m/2);l+=` L ${W(i-(i-r)/b*d)} ${W(o-(o-s)/b*d)} Q ${W(i)} ${W(o)} ${W(i+(p-i)/m*d)} ${W(o+(f-o)/m*d)}`}if(n.length>1){let[e,r]=n[n.length-1];l+=` L ${W(e)} ${W(r)}`}return l}function hn(t){let[n,a]=t[t.length-1],[c,l]=t[t.length-2],e=Math.hypot(n-c,a-l)||1,r=(n-c)/e,s=(a-l)/e,{arrow:i,arrowHalf:o}=w.edge;return`M ${W(n-r*i-s*o)} ${W(a-s*i+r*o)} L ${W(n)} ${W(a)} L ${W(n-r*i+s*o)} ${W(a-s*i-r*o)}`}function Oe(t,n,a,c,l,e,r=We,s){return t?.push({text:l,rect:_e(l,a,c,e,s),shown:r}),`<text class="${n}" x="${W(a)}" y="${W(c)}"${s?` text-anchor="${s}"`:""}>${Te(l)}</text>`}function Pr(t,n){let a=[[0,{opacity:0}]];for(let[c,l]of n)a.push([c,{opacity:0},be.out],[c+oe.fade,{opacity:1}],[l-.1,{opacity:1},be.inOut],[l+.25,{opacity:0}]);return a.push([t.total,{opacity:0}]),t.kf(a)}function Sr(t,n){let a=[];for(let c=0;c<n.length;){let l=c;for(;l+1<n.length&&n[l+1]===n[l]+1;)l++;a.push([t.t.steps[n[c]].start,t.t.steps[n[l]].end]),c=l+1}return Pr(t.m,a)}function Mr(t,n){let{radius:a,icon:c,iconRadius:l,iconScale:e,nameY:r,line:s}=w.region,{x:i,y:o}=t.header,p=t.lines.map((m,d)=>Oe(n,"dg-bz",i,t.y+r+d*s,m,O.regionName)).join(""),f=t.note?Oe(n,"dg-bx",i,t.y+r+t.lines.length*s+1,t.note,O.regionNote):"",b=t.icon&&Lt[t.icon]?`<rect class="dg-bi" x="${W(i)}" y="${W(o)}" width="${c}" height="${c}" rx="${l}"/>${ft(t.icon,i+c/2,o+c/2,e)}`:"";return`<g style="${ke(t.color)}"><rect class="dg-band" x="${W(t.x+.5)}" y="${W(t.y+.5)}" width="${W(t.w-1)}" height="${W(t.h-1)}" rx="${a}"/>${b}${p}${f}</g>`}function Tr(t,n,a,c,l){let e=[[0,t.sub??"","dg-ss"],...a];return e.map(([r,s,i],o)=>{let p=e[o+1]?.[0],f=o===0?p===void 0?"":n.until(p-oe.untilFade):p===void 0?n.rise(r):n.rise(r,p-oe.untilFade);if(s==="")return"";let b=[[o===0?0:r,p===void 0?Number.POSITIVE_INFINITY:p-oe.untilFade]];return`<g${f?` class="dg-a" style="${f}"`:""}>${Oe(l,i,t.cx,c,s,i==="dg-ss"?O.boxSub:O.boxSubStrong,b,"middle")}</g>`}).join("")}function Or(t,n,a,c,l){let e=(r,s="")=>`<rect class="${r}" x="${W(t.x)}" y="${W(c)}" width="${W(t.w)}" height="${l}" rx="${w.box.radius}"${s}/>`;return`${a?`<g class="dg-a" style="${a}">${e("dg-halo")}</g>`:""}${e("dg-st",` ${n.sh}`)}${a?`<g class="dg-a" style="${a}">${e("dg-on")}</g>`:""}`}function gn(t,n,a,c,l){let{icon:e,iconRadius:r,iconScale:s,iconY:i,nameY:o,subY:p}=w.box,f=Tr(t,n.m,c,t.cy+p,n.ink),b=l?l.length>0?Pr(n.m,l.map(S=>[S.start,S.end])):void 0:a.length>0?Sr(n,a):void 0,m=t.iconX??t.cx,d=t.slot?`<rect class="dg-slot" x="${W(t.slot.x)}" y="${W(t.slot.y)}" width="${W(t.slot.w)}" height="${W(t.slot.h)}" rx="${w.slot.radius}"/>`:"",$="";if(t.icon&&Lt[t.icon]){let S={x:m-e/2,y:t.cy+i-e/2,w:e,h:e};n.ink.push({text:`${t.name} \u306E\u7D75\u67C4`,rect:S,shown:We,boxed:!0,part:{kind:"icon",box:t.name}}),$=`<rect class="dg-ic" x="${W(S.x)}" y="${W(S.y)}" width="${e}" height="${e}" rx="${r}"/>${ft(t.icon,m,t.cy+i,s)}`}return`<g style="${ke(t.color)}">${Or(t,n,b,t.y,t.h)}${d}${$}${Oe(n.ink,"dg-sn",t.cx,t.cy+o,t.name,O.boxName,We,"middle")}${f}</g>`}function Nr(t,n,a,c){let{pad:l,h:e,nameY:r,subY:s}=w.follow.head,i=Tr(t,n.m,c,l+s),o=a.length>0?Sr(n,a):void 0;return`<g style="${ke(t.color)}">${Or(t,n,o,l,e)}<text class="dg-sn" x="${W(t.cx)}" y="${W(l+r)}" text-anchor="middle">${Te(t.name)}</text>${i}</g>`}function Er(t,n){let{icon:a,iconRadius:c,iconScale:l,radius:e}=w.box,r=w.state.ghost,s=t.x+r.pad+a/2,i=t.x+r.pad+a+r.gap,o=t.icon&&Lt[t.icon]?`<rect class="dg-ic" x="${W(s-a/2)}" y="${W(t.cy-a/2)}" width="${a}" height="${a}" rx="${c}"/>${ft(t.icon,s,t.cy,l)}`:"",p=t.sub?r.nameY:w.baseline.mark,f=t.sub?Oe(n,"dg-ss",i,t.cy+r.subY,t.sub,O.boxSub,We,"start"):"";return`<g data-ghost="${Te(t.id)}" style="${ke(t.color)}"><rect class="dg-ghost" x="${W(t.x)}" y="${W(t.y)}" width="${W(t.w)}" height="${t.h}" rx="${e}"/>${o}${Oe(n,"dg-sn",i,t.cy+p,t.name,O.boxName,We,"start")}${f}</g>`}function qr(t,n,a){let{r:c,inset:l}=w.state.done,e=t.x+t.w-l,r=t.y+l;return`<g class="dg-popc dg-a" data-done="${Te(t.id)}" style="${ke(t.color)};${a.m.pop(n)}"><circle class="dg-done" cx="${W(e)}" cy="${W(r)}" r="${c}"/>${ft("check",e,r,.5,"dg-done-ck")}</g>`}function Lr(t,n,a,c){c.push({from:t.from,to:t.to,points:t.points,shown:We});let l=t.label?.family==="sans",e=t.label?Oe(a,`dg-path-t${l?" dg-path-tj":""}`,t.label.x+w.label.padX,t.label.y+t.label.h/2+w.baseline.label,t.label.text,l?O.labelJa:O.label):"";return`<g data-path="${Te(`${t.from}->${t.to}`)}" style="${ke(n)}"><path class="dg-path" d="${ut(t.points)}"/><path class="dg-path-h" d="${hn(t.points)}"/>${e}</g>`}function Rr(t,n,a){let{pad:c}=w.state.side,l=t.y+c+O.regionName.size,e=t.notes.map((r,s)=>Oe(a,"dg-side-n",t.x+c,l+w.region.line*(s+1),r,O.regionNote)).join("");return`<g style="${ke(n)}"><rect class="dg-side" x="${W(t.x+.5)}" y="${W(t.y+.5)}" width="${W(t.w-1)}" height="${W(t.h-1)}" rx="${w.region.radius}"/>${Oe(a,"dg-side-t",t.x+c,l,t.title,O.regionName)}${e}</g>`}function Ar(t,n,a){let{end:c}=w.state,l=_t(t),e=t.text===""?"":Oe(a,"dg-mark",l[0],l[1],t.text,O.regionNote),r=W(t.x),s=W(t.y);return t.kind==="start"?`<g data-end="start"><circle class="dg-start" cx="${r}" cy="${s}" r="${t.r}"/>${e}</g>`:t.ghost?`<g data-end="finish" style="${ke(n)}"><circle class="dg-end-x" cx="${r}" cy="${s}" r="${t.r}"/><circle class="dg-end-xi" cx="${r}" cy="${s}" r="${c.inner}"/>${e}</g>`:`<g data-end="finish"><circle class="dg-end" cx="${r}" cy="${s}" r="${t.r}"/><circle class="dg-end-in" cx="${r}" cy="${s}" r="${c.inner}"/>${e}</g>`}function jr(t,n,a){return`<line class="dg-ll" x1="${W(t)}" y1="${W(n)}" x2="${W(t)}" y2="${W(a)}"/>`}function Dr(t,n,a,c=!1){let{m:l}=a;a.traces.push({from:t.from,to:t.to,points:t.points,shown:We});let e=ut(t.points),r=hn(t.points),{start:s,drawn:i,end:o}=n,p=c?[[o,{opacity:1},be.inOut],[o+.4,{opacity:0}],[l.total,{opacity:0}]]:[[o,{opacity:1},be.inOut],[o+.4,{opacity:.45}],[a.end+.3,{opacity:.45},be.inOut],[a.end+1,{opacity:.95}],[l.last,{opacity:.95},be.inOut],[l.total,{opacity:0}]],f=l.kf([[0,{opacity:0,"stroke-dashoffset":1}],[s,{opacity:0,"stroke-dashoffset":1},be.inOut],[s+.05,{opacity:1}],[i,{"stroke-dashoffset":0}],[l.last,{"stroke-dashoffset":0}],[l.total,{"stroke-dashoffset":1}],...p]),b=l.kf([[0,{opacity:0}],[i-.05,{opacity:0}],[i,{opacity:1}],...p]),m=-(o-i)*26,d=l.kf([[0,{opacity:0,"stroke-dashoffset":0}],[i,{opacity:0,"stroke-dashoffset":0}],[i+.25,{opacity:.9}],[o-.1,{opacity:.9},be.inOut],[o+.2,{opacity:0,"stroke-dashoffset":m}],[l.total,{opacity:0,"stroke-dashoffset":m}]]),$=c?l.kf([[0,{opacity:0}],[o,{opacity:0},be.inOut],[o+.4,{opacity:1}],[l.last,{opacity:1},be.inOut],[l.total,{opacity:0}]]):"";return{base:`<path class="dg-e" d="${e}"/><path class="dg-eh" d="${r}"/>${c?`<path class="dg-e-past dg-a" d="${e}" style="${$}"/><path class="dg-eh-past dg-a" d="${r}" style="${$}"/>`:""}`,lit:`<g style="${ke(t.color)}"><path class="dg-e-on dg-a" pathLength="1" d="${e}" style="${f}"/><path class="dg-eh-on dg-a" d="${r}" style="${b}"/><path class="dg-flow dg-a" d="${e}" style="${d}"/></g>`}}function Cr(t,n,a){let c=t.family==="sans"?" dg-capj":"",{radius:l}=w.label,e=n.again?[[n.start,n.end],[n.again.start,n.again.end]]:[[n.start,n.end]];a.ink.push({text:t.text,rect:t,shown:e,boxed:!0}),n.after&&a.ink.push({text:t.text,rect:_e(t.text,t.x+t.w/2,t.y+t.h/2+w.baseline.label,t.family==="sans"?O.labelJa:O.label,"middle"),shown:[[n.after.start,n.after.end]]});let r=W(t.x+t.w/2),s=W(t.y+t.h/2+w.baseline.label),i=n.after?`<g class="dg-cap-past${t.family==="sans"?" dg-cap-pastj":""} dg-a" style="${a.m.vis(n.after.start,n.after.end)}"><text x="${r}" y="${s}" text-anchor="middle">${Te(t.text)}</text></g>`:"",o=e.map(([p,f])=>`<g class="dg-cap${c} dg-a" style="${ke(t.color)};${a.m.rise(p,f,!0)}"><rect x="${W(t.x)}" y="${W(t.y)}" width="${W(t.w)}" height="${t.h}" rx="${l}"/><text x="${r}" y="${s}" text-anchor="middle">${Te(t.text)}</text></g>`);return`${i}${o.join("")}`}function Rn(t,n,a,c,l){let e=l?[[n,a],[l.start,l.end]]:[[n,a]];return c.ink.push({text:t.text,rect:t,shown:e,boxed:!0}),e.map(([r,s])=>`<g class="dg-act dg-a" style="${ke(t.color)};${c.m.rise(r,s,!0)}"><rect x="${W(t.x)}" y="${W(t.y)}" width="${W(t.w)}" height="${t.h}" rx="${w.action.radius}"/><text x="${W(t.x+t.w/2)}" y="${W(t.y+t.h/2+w.baseline.action)}" text-anchor="middle">${Te(t.text)}</text></g>`).join("")}function wi(t,n){let a=w.carrier;if(t.carry.kind==="coin")return`<circle class="dg-coin" r="${a.coinR}"/><circle class="dg-coin-in" r="${a.coinIn}"/>`;if(t.carry.kind==="tag"){let c=t.carry.text,l=De(c),e=le(c,l?O.carrierJa:O.carrier)+a.tagPadX*2;return`<rect class="dg-car" x="${W(-e/2)}" y="${-a.tagH/2}" width="${W(e)}" height="${a.tagH}" rx="${a.tagH/2}" ${n}/><text class="dg-car-t${l?" dg-car-tj":""}" y="${w.baseline.carrier}" text-anchor="middle">${Te(c)}</text>`}return`<rect class="dg-env" x="${-a.envW/2}" y="${-a.envH/2}" width="${a.envW}" height="${a.envH}" rx="3" ${n}/><path class="dg-env-in" d="M -8 -4.5 L 0 1.5 L 8 -4.5"/>`}var $i=t=>t<.5?4*t*t*t:1-(-2*t+2)**3/2;function yn(t,n,a){let{m:c}=a,l=w.carrier.samples,e=t.wait?[t.wait,...t.points]:t.points,r=vt(e),{depart:s,arrive:i,start:o,end:p}=n,f=[];for(let ne=0;ne<=l;ne++){let[U,j]=st(e,$i(ne/l)*r);f.push([s+(i-s)*ne/l,U,j])}let b=f[0],m=f[f.length-1],d=t.settle??[m[1],m[2]],$=[[0,b[1],b[2]],...f];t.settle&&$.push([Math.min(i+.3,Math.max(p,i+.01)),d[0],d[1]]),$.push([p,d[0],d[1]],[c.total,d[0],d[1]]);let[S,u]=mt(t.carry),h=t.carry.kind==="tag"?t.carry.text:t.carry.kind==="coin"?"\u786C\u8CA8":"\u5C01\u7B52",P=t.carry.kind==="tag"?{}:{part:{kind:t.carry.kind==="coin"?"coin":"envelope"}},I=ne=>({x:ne[0]-S,y:ne[1]-u,w:S*2,h:u*2});s>o&&a.ink.push({text:h,rect:I([b[1],b[2]]),shown:[[o,s]],boxed:!0,...P}),a.ink.push({text:h,rect:I(d),shown:[[i,p]],boxed:!0,...P});let G=p<c.last?.05:.18;return`<g class="dg-a" style="${c.move($,c.blink(o+.02,p,G))}">${wi(t,a.sh)}</g>`}function Ir(t,n,a=!1){let{m:c}=n,l=n.t.steps[t.step],e=l.start,r=l.end,{r:s,ring:i}=w.badge,o={visibility:"visible"},p={visibility:"hidden"},f=t.until===void 0?void 0:n.t.steps[t.until].start,b=f!==void 0&&f<=r+1e-6,m=c.kf([[0,{opacity:0,transform:"scale(.5)",...p}],[e,{opacity:0,transform:"scale(.5)",...p},be.pop],[e+.35,{opacity:1,transform:"scale(1)",...o}],[r,{opacity:1,transform:"scale(1)",...o},be.inOut],[r+(b?oe.untilFade:.4),{opacity:0,transform:"scale(1)",...p}],[c.total,{opacity:0,transform:"scale(.5)",...p}]]),d=f??c.last,$=b?c.kf([[0,{opacity:0,...p}],[c.total,{opacity:0,...p}]]):c.kf([[0,{opacity:0,...p}],[r,{opacity:0,...p},be.inOut],[r+.4,{opacity:1,...o}],[d,{opacity:1,...o},be.inOut],...f===void 0?[]:[[f+oe.untilFade,{opacity:0,...p}]],[c.total,{opacity:0,...p}]]),S=c.kf([[0,{opacity:0,transform:"scale(1)"}],[e+.05,{opacity:0,transform:"scale(1)"}],[e+.1,{opacity:.7,transform:"scale(1)"},be.out],[e+.9,{opacity:0,transform:"scale(2.3)"}],[c.total,{opacity:0,transform:"scale(1)"}]]),u=W(t.x),h=W(t.y),P=W(t.y+w.baseline.badge),I=t.step+1;return n.ink.push({text:String(I),rect:{x:t.x-s,y:t.y-s,w:s*2,h:s*2},shown:[[e,d]],boxed:!0,badge:!0}),`<g class="dg-bd" data-step="${t.step}" style="${ke(t.color)}"><circle class="dg-bdr dg-popc dg-a" cx="${u}" cy="${h}" r="${i}" style="${S}"/><g class="dg-a" style="${$}"><circle class="${a?"dg-bdp-g":"dg-bdp"}" cx="${u}" cy="${h}" r="${i}"/><text class="${a?"dg-bdpt-g":"dg-bdpt"}" x="${u}" y="${P}" text-anchor="middle">${I}</text></g><g class="dg-popc dg-a" style="${m}"><circle class="dg-bdf" cx="${u}" cy="${h}" r="${s}"/><text class="dg-bdft" x="${u}" y="${P}" text-anchor="middle">${I}</text></g></g>`}function Fr(t,n,a,c=!1,l=new Map,e){let{m:r,sh:s}=a,i=w.strip,o=t.y+i.h/2,p=[`<rect class="dg-strip" x="${W(t.x+.5)}" y="${W(t.y+.5)}" width="${W(t.w-1)}" height="${W(t.h-1)}" rx="${w.region.radius}" ${s}/>`,`<g style="${ke("slate")}"><rect class="dg-bi" x="${W(t.x+i.pad)}" y="${W(o-i.icon/2)}" width="${i.icon}" height="${i.icon}" rx="${w.box.iconRadius}"/>${ft("env",t.x+i.pad+i.icon/2,o,.78)}</g>`,Oe(a.ink,"dg-sh",t.x+i.titleX,o+w.baseline.stripTitle,t.title,O.stripTitle)];if(t.fields.forEach((f,b)=>{let m=t.fields[b-1];if(m&&m.y===f.y){let h=f.x-i.fieldGap/2;p.push(`<line class="dg-sep" x1="${W(h)}" y1="${W(f.y+i.sepInset)}" x2="${W(h)}" y2="${W(f.y+i.h-i.sepInset)}"/>`)}p.push(Oe(a.ink,"dg-fl",f.x,f.y+i.nameY,f.name,O.fieldName));let d=e?.(f);if(d!==void 0){p.push(d);return}let $=n.get(f.name)??[],S=$.filter(h=>h.value!==void 0),u=$.filter(h=>h.tag!==void 0);S.forEach((h,P)=>{let I=S[P+1]?.at,G=h.value,ne=De(G)?"dg-fvj":"dg-fv";a.ink.push({text:G,rect:_e(G,f.x,f.y+i.valueY,De(G)?O.fieldValueJa:O.fieldValue),shown:[[h.at,I===void 0?Number.POSITIVE_INFINITY:I-oe.untilFade]]});let U=K=>`<text class="${K}" x="${W(f.x)}" y="${W(f.y+i.valueY)}">${Te(G)}</text>`,j=U(ne);if(!c){let K=I===void 0?r.rise(h.at):r.rise(h.at,I-oe.untilFade);p.push(`<g class="dg-a" style="${K}">${j}</g>`);return}let A=Math.min(h.until,I??h.until),C=`<circle class="dg-fl-now" cx="${W(f.x+le(f.name,O.fieldName)+i.now.gap)}" cy="${W(f.y+i.nameY-O.fieldName.size/3)}" r="${i.now.r}"/>`;p.push(`<g class="dg-fv-now dg-a" data-step="${h.step}" style="${ke(h.color)};${r.rise(h.at,A-oe.untilFade)}">${U(`${ne} dg-fv-c`)}${C}</g>`),(I===void 0||I>A)&&p.push(`<g class="dg-a" style="${r.vis(A-oe.untilFade,I===void 0?r.last:I-oe.untilFade)}">${j}</g>`)}),u.forEach((h,P)=>{let I=u[P+1]?.at,G=h.tag,ne=[...S].reverse().find(C=>C.at<=h.at+1e-9)?.value,U=f.x+(ne?le(ne,De(ne)?O.fieldValueJa:O.fieldValue)+i.tagGap:0),j=le(G,O.tag)+i.tagPadX*2,A=f.y+i.valueY-i.tagH/2-w.baseline.tag;a.ink.push({text:G,rect:{x:U,y:A,w:j,h:i.tagH},shown:[[h.at,I===void 0?Number.POSITIVE_INFINITY:I-oe.untilFade]],boxed:!0}),p.push(`<g class="dg-tg dg-popc dg-a" style="${ke(h.color)};${I===void 0?r.pop(h.at):r.pop(h.at,I-oe.untilFade)}"><rect x="${W(U)}" y="${W(A)}" width="${W(j)}" height="${i.tagH}" rx="${i.tagH/2}"/><text x="${W(U+j/2)}" y="${W(A+i.tagH/2+w.baseline.tag)}" text-anchor="middle">${Te(G)}</text></g>`)})}),t.trail){let f=t.trail,b=t.fields[t.fields.length-1];if(b&&b.y===f.y){let d=f.x-i.fieldGap/2;p.push(`<line class="dg-sep" x1="${W(d)}" y1="${W(f.y+i.sepInset)}" x2="${W(d)}" y2="${W(f.y+i.h-i.sepInset)}"/>`)}p.push(Oe(a.ink,"dg-fl",f.x,f.y+i.nameY,f.title,O.fieldName));let m=f.y+i.valueY-O.fieldValue.size/3;f.states.forEach((d,$)=>{let S=W(f.x+i.trail.r+$*i.trail.step),u=l.get(d.box),h=u===void 0?"":`<circle class="dg-tr-fill dg-a" cx="${S}" cy="${W(m)}" r="${i.trail.r}" style="${r.pop(u)}"/>`;p.push(`<g data-trail="${Te(d.box)}" style="${ke(d.color)}"><circle class="dg-tr-ring" cx="${S}" cy="${W(m)}" r="${i.trail.r}"/>${h}</g>`)})}return p.join("")}var tt=t=>Math.round(t*100)/100,Br=t=>[t.x+t.w/2,t.y+t.h/2];function ki(t,n){let a=w.carrier,c=De(t),l=le(t,c?O.carrierJa:O.carrier)+a.tagPadX*2;return`<rect class="dg-car" x="${tt(-l/2)}" y="${-a.tagH/2}" width="${tt(l)}" height="${a.tagH}" rx="${a.tagH/2}" ${n}/><text class="dg-car-t${c?" dg-car-tj":""}" y="${w.baseline.carrier}" text-anchor="middle">${Te(t)}</text>`}function Gr(t,n,a,c){let{m:l}=c,e=w.git,r=(m,d)=>a.edges.find($=>$.step===m&&$.event===d),s=t.links.map(m=>{let d=r(m.step,m.event);if(!d)return"";c.traces.push({from:m.from,to:m.to,points:m.points,shown:[[d.start,Number.POSITIVE_INFINITY]]});let $=ut(m.points);if(m.kind==="copy")return`<g style="${ke(m.color)}"><path class="dg-git-cp dg-a" d="${$}" style="${l.vis(d.start,l.last)}"/></g>`;let S=l.kf([[0,{opacity:0,"stroke-dashoffset":1}],[d.start,{opacity:0,"stroke-dashoffset":1},be.inOut],[d.start+.05,{opacity:1}],[d.drawn,{"stroke-dashoffset":0}],[l.last,{opacity:1,"stroke-dashoffset":0},be.inOut],[l.total,{opacity:0,"stroke-dashoffset":0}]]);return`<g style="${ke(m.color)}"><path class="dg-git-l dg-a" pathLength="1" d="${$}" style="${S}"/></g>`}).join(""),i=t.commits.map(m=>{let d=r(m.step,m.event)?.drawn??0,$={x:m.cx-m.r,y:m.cy-m.r,w:m.r*2,h:m.r*2};c.ink.push({text:m.id,rect:$,shown:[[d,Number.POSITIVE_INFINITY]],boxed:!0});let S=(m.text?.lines??[]).map((ne,U)=>{let j=U===0&&m.hash!==void 0,A=m.text?.baselines[U]??m.cy;return Oe(c.ink,j?"dg-git-h":"dg-git-n",m.cx,A,ne,j?O.gitHash:O.gitNote,[[d,Number.POSITIVE_INFINITY]],"middle")}).join(""),u=`<text class="dg-git-id" x="${tt(m.cx)}" y="${tt(m.cy+w.baseline.badge)}" text-anchor="middle">${Te(m.id)}</text>`,h=`<g class="dg-popc dg-a" style="${l.pop(d)}"><circle class="dg-git-c" cx="${tt(m.cx)}" cy="${tt(m.cy)}" r="${m.r}" ${c.sh}/>${u}</g>`,P=S===""?"":`<g class="dg-a" style="${l.vis(d)}">${S}</g>`,I=m.orphan===void 0?void 0:r(m.orphan,m.orphanEvent??0)?.drawn,G=I===void 0?"":`<g class="dg-a" data-orphan="${Te(m.id)}" style="${l.vis(I,l.last,{f:.5})}"><circle class="dg-git-old" cx="${tt(m.cx)}" cy="${tt(m.cy)}" r="${e.orphan}"/><text class="dg-git-oldl" x="${tt(m.cx)}" y="${tt(m.cy+w.baseline.badge)}" text-anchor="middle">${Te(m.id)}</text></g>`;return`<g data-commit="${Te(m.id)}" style="${ke(m.color)}">${h}${P}${G}</g>`}).join(""),o=t.moves.flatMap(m=>{let d=r(m.step,m.event);if(!m.line||!d)return[];let $=a.steps[m.step].end;c.traces.push({from:m.ref,to:m.target??m.ref,points:m.line,shown:[[d.start,$+.4]]});let S=l.kf([[0,{opacity:0,"stroke-dashoffset":1}],[d.start,{opacity:0,"stroke-dashoffset":1},be.inOut],[d.start+.05,{opacity:1}],[d.drawn,{"stroke-dashoffset":0}],[$,{opacity:1},be.inOut],[$+.4,{opacity:0}],[l.total,{opacity:0,"stroke-dashoffset":0}]]);return[`<g style="${ke(m.color)}"><path class="dg-e-on dg-a" pathLength="1" d="${ut(m.line)}" style="${S}"/></g>`]}).join(""),p=a.carriers.flatMap(m=>{let d=t.moves.find(u=>u.step===m.step&&u.event===m.event&&u.line),$=n.steps[m.step]?.events[m.event];if(!d?.line||$?.type!=="edge")return[];let S={step:m.step,event:m.event,from:d.ref,to:d.target??d.ref,points:d.line,color:d.color,carry:$.carry};return[yn(S,{...m,start:m.depart,end:m.arrive+oe.fade},c)]}).join(""),b=[...new Set(t.moves.map(m=>m.ref))].map(m=>vi(m,t.moves.filter(d=>d.ref===m),r,c)).join("")+p;return{links:s,lines:o,commits:i,tags:b}}function vi(t,n,a,c){let{m:l}=c,e=[],r=[[0,{opacity:0}]],s=!1,i,o=m=>{i&&c.ink.push({text:t,rect:i.rect,shown:[[i.since,m]],boxed:!0}),i=void 0};for(let m of n){let d=a(m.step,m.event);if(!d)continue;let{start:$,drawn:S}=d,u=m.from?Br(m.from):void 0,h=m.to?Br(m.to):void 0;if(o($),m.carried&&u&&h&&s){e.push([$+oe.fade,u[0],u[1]],[S-oe.fade,h[0],h[1]]),r.push([$,{opacity:1},be.inOut],[$+oe.fade,{opacity:0}],[S-oe.fade,{opacity:0},be.out],[S,{opacity:1}]),i={rect:m.to,since:S};continue}if(u&&e.push([$,u[0],u[1]]),h&&e.push([S,h[0],h[1]]),h&&!s){let P=u?$:S-oe.fade;r.push([P,{opacity:0},be.out],[P+oe.fade,{opacity:1}]),s=!0}else!h&&s&&(r.push([S,{opacity:1},be.inOut],[S+oe.untilFade,{opacity:0}]),s=!1);m.to&&(i={rect:m.to,since:S})}if(o(Number.POSITIVE_INFINITY),e.length===0)return"";let p=e[0],f=e[e.length-1];s?r.push([l.last,{opacity:1},be.inOut],[l.total,{opacity:0}]):r.push([l.total,{opacity:0}]);let b=l.move([[0,p[1],p[2]],...e,[l.total,f[1],f[2]]],r);return`<g class="dg-a" data-ref="${Te(t)}" style="${b}">${ki(t,c.sh)}</g>`}var se=t=>Math.round(t*100)/100,yt=(t,n)=>De(n)?`${t} ${t}j`:t,Rt=t=>({...t,family:"sans"});function _r(t){let n=[];for(let a of t){let c=n[n.length-2],l=n[n.length-1];if(c&&l){let e=l[0]===c[0]?Number.NaN:(l[1]-c[1])/(l[0]-c[0]),r=a[0]===l[0]?Number.NaN:(a[1]-l[1])/(a[0]-l[0]);Number.isFinite(e)&&Number.isFinite(r)&&Math.abs(e-r)<1e-9?n[n.length-1]=a:n.push(a)}else n.push(a)}return n}function Yr(t,n){let a=t[0];if(!a)return 0;if(n<=a[0])return a[1];for(let c=1;c<t.length;c++){let[l,e]=t[c],[r,s]=t[c-1];if(n<=l)return l===r?e:s+(e-s)*(n-r)/(l-r)}return t[t.length-1][1]}function Vr(t,n,a,c,l){let{m:e,ink:r}=c,s=w.time,{axis:i}=t,o=new Map((a.units??[]).map(x=>[x.unit,x.passed])),p=(x,N)=>a.events.find(E=>E.step===x&&E.event===N)?.at,f=(x,N)=>a.edges.find(E=>E.step===x&&E.event===N)?.drawn,b=[],m=[],d=[],$=[],S=Math.min(...t.rows.map(x=>x.y)),u=Math.max(...t.rows.map(x=>x.y+x.h)),h=new Map;for(let x of t.wires){let N=f(x.step,x.event);N!==void 0&&h.set(x.to,Math.min(h.get(x.to)??Number.POSITIVE_INFINITY,N))}let P=(x,N)=>{let E=t.zoom?.columns.find(q=>q.unit===N)?.boxes.find(q=>q.id===x),v=[o.get(N),E?h.get(E):void 0].filter(q=>q!==void 0);return v.length>0?Math.min(...v):void 0};for(let x of t.periods)x.index%2===1&&b.push(`<rect class="dg-tm-ep" x="${se(x.x)}" y="${se(S-s.shade)}" width="${se(x.w)}" height="${se(u-S+s.shade*2)}" rx="4"/>`);if(t.zoom){let x=t.zoom;x.columns.forEach((N,E)=>{E>0&&b.push(`<line class="dg-tm-sep" x1="${se(N.x)}" y1="${se(N.y+s.sep)}" x2="${se(N.x)}" y2="${se(N.y+N.h-s.sep)}"/>`),b.push(Oe(r,yt("dg-tm-hd",N.head),N.x+N.w/2,x.headY,N.head,O.timeHead,We,"middle"));for(let v of N.boxes)d.push(I(v,N.unit))})}function I(x,N){let E=[...new Set(t.wires.filter(ee=>ee.from===x||ee.to===x).map(ee=>ee.step))].sort((ee,de)=>ee-de),v=ee=>`<rect class="${ee}" x="${se(x.x)}" y="${se(x.y)}" width="${se(x.w)}" height="${x.h}" rx="${w.box.radius}"/>`;if(x.empty){let ee=o.get(N),de=t.zoom?.empty??"",ce=ee===void 0?"":`<g class="dg-a" style="${e.vis(ee)}">${v("dg-tm-ex")}${Oe(r,"dg-tm-ext",x.cx,x.cy+w.baseline.mark,de,O.emptyText,[[ee,Number.POSITIVE_INFINITY]],"middle")}</g>`;return`<g data-empty="${Te(x.id)}">${v("dg-tm-ph")}${ce}</g>`}let q=un(n.boxes.find(ee=>ee.id===x.id)?.link,gn(x,c,E,l.get(x.id)??[]));if(!x.row)return q;let z=P(x.row,N);return z===void 0?v("dg-tm-ph"):`<g class="dg-a" style="${e.until(z)}">${v("dg-tm-ph")}</g><g class="dg-popc dg-a" style="${e.pop(z)}">${q}</g>`}for(let x of t.rows){let N=[];for(let E of t.marks.filter(v=>v.row===x.id)){let v=(z,ee="")=>`<rect class="${z}" x="${se(E.x)}" y="${se(E.y)}" width="${se(E.w)}" height="${se(E.h)}" rx="${s.markRadius}"${ee}/>`;if(N.push(v("dg-tm-slot")),E.empty){let z=o.get(E.unit);z!==void 0&&N.push(`<circle class="dg-tm-x dg-a" cx="${se(E.x+E.w/2)}" cy="${se(E.y+E.h/2)}" r="${s.emptyR}" style="${e.vis(z,e.last,{f:.2})}"/>`);continue}let q=P(x.id,E.unit);q!==void 0&&N.push(v("dg-tm-m dg-a",` style="${e.vis(q,e.last,{f:.2})}"`)),E.colors.forEach((z,ee)=>{let de=p(z.step,z.event);if(de===void 0)return;let ce=E.colors[ee+1],pe=ce?p(ce.step,ce.event):void 0;N.push(`<g style="${ke(z.color)}">${v("dg-tm-m dg-a",` style="${e.vis(de,pe??e.last,{f:.35})}"`)}</g>`)})}b.push(`<g data-row="${Te(x.id)}" style="${ke(x.color)}">${N.join("")}</g>`),b.push(Oe(r,"dg-tm-rn",w.margin+w.region.inset,x.y+x.h/2+w.baseline.mark,x.name,O.timeRow))}if(t.zoom){let x=t.zoom,N=t.spans.filter(q=>q.kind==="box"&&q.from<=x.to&&x.from<=q.to).map(q=>p(q.step,q.event)).filter(q=>q!==void 0).sort((q,z)=>q-z)[0],E=x.guides.map(q=>`<path class="dg-tm-gd" d="${ut(q)}"/>`).join(""),v=`<rect class="dg-tm-fr" x="${se(x.frame.x)}" y="${se(x.frame.y)}" width="${se(x.frame.w)}" height="${se(x.frame.h)}" rx="4"/>${E}`;b.push(N===void 0?v:`<g class="dg-a" style="${e.until(N)}">${v}</g>`)}let G=x=>se(i.x+x*i.unit),ne=t.ticks.map(x=>`M ${G(x.at)} ${se(i.line-s.major/2)} V ${se(i.line+s.major/2)}`),U=t.minor.map(x=>`M ${G(x)} ${se(i.line-s.minor/2)} V ${se(i.line+s.minor/2)}`);b.push(`<path class="dg-tm-ax" d="M ${G(0)} ${se(i.line)} H ${G(i.count)} ${[...ne,...U].join(" ")}"/>`);for(let x of t.ticks)b.push(Oe(r,yt("dg-tm-tk",x.text),x.left,x.y,x.text,O.timeTick));for(let x of t.periods)b.push(Oe(r,yt("dg-tm-en",x.name),x.x+x.w/2,x.nameY,x.name,O.timePeriod,We,"middle")),b.push(Oe(r,yt("dg-tm-er",x.range),x.x+x.w/2,x.rangeY,x.range,O.timeRange,We,"middle"));for(let x of t.spans){let N=p(x.step,x.event);if(N===void 0)continue;let E=x.until===void 0?void 0:a.steps[x.until].start,v=[[N,E??Number.POSITIVE_INFINITY]],q=E===void 0?e.vis(N):e.vis(N,E,{within:!0});if(x.kind==="bracket"){let[ee,de,ce,pe]=[se(x.x+1),se(x.x+x.w-1),se(x.y),se(x.y+x.h)],ve=Oe(r,yt("dg-tm-bt",x.text),x.textRect.x+x.textRect.w/2,x.textY,x.text,O.spanText,v,"middle");b.push(`<g class="dg-a" data-span="${x.step}" style="${ke(x.color)};${q}"><path class="dg-tm-br" d="M ${ee} ${ce} L ${ee} ${pe} L ${de} ${pe} L ${de} ${ce}"/>${ve}</g>`);continue}b.push(`<g class="dg-a" data-span="${x.step}" style="${ke(x.color)};${q}"><rect class="dg-tm-bx" x="${se(x.x)}" y="${se(x.y)}" width="${se(x.w)}" height="${se(x.h)}" rx="6"/></g>`);let z=x.textRect;r.push({text:x.text,rect:z,shown:v,boxed:!0}),$.push(`<g class="dg-tg dg-popc dg-a" style="${ke(x.color)};${E===void 0?e.pop(N):e.pop(N,E)}"><rect x="${se(z.x)}" y="${se(z.y)}" width="${se(z.w)}" height="${z.h}" rx="${z.h/2}"/><text x="${se(z.x+z.w/2)}" y="${se(x.textY)}" text-anchor="middle">${Te(x.text)}</text></g>`)}let j=s.point;for(let x of t.points){let{cx:N,cy:E,r:v}=x,q=x.changes.map(ye=>p(ye.step,ye.event)??Number.POSITIVE_INFINITY),z=q[0];b.push(`<path class="dg-tm-con" d="M ${se(N)} ${se(u+3)} L ${se(N)} ${se(E-v-2)}"/>`);let ee=x.text.x,de=Oe(r,yt("dg-tm-pn",x.id),ee,E+j.nameY,x.id,O.pointName),ce=de.replace(/class="([^"]*)"/u,'class="$1 dg-tm-pn-g"'),pe=z===void 0||!Number.isFinite(z)?ce:`<g class="dg-a" style="${e.until(z)}">${ce}</g><g class="dg-a" style="${e.vis(z)}">${de}</g>`,ve=x.changes.map((ye,Pe)=>{let k=q[Pe];if(!Number.isFinite(k))return"";let V=q[Pe+1],J=V!==void 0&&Number.isFinite(V)?V-oe.untilFade:void 0,T=Oe(r,yt("dg-tm-ps",ye.text),ee,E+j.stateY,ye.text,O.pointState,[[k,J??Number.POSITIVE_INFINITY]]);return`<g class="dg-a" style="${ke(ye.color??"slate")};${J===void 0?e.rise(k):e.rise(k,J)}">${T}</g>`}).join(""),we=x.changes.map((ye,Pe)=>{let k=q[Pe];return!ye.color||!Number.isFinite(k)?"":`<g class="dg-popc dg-a" style="${ke(ye.color)};${e.pop(k)}"><circle class="dg-tm-pc" cx="${se(N)}" cy="${se(E)}" r="${v+.5}"/>${ft("flag",N,E,j.glyph,"dg-tm-pcg")}</g>`}).join("");d.push(`<g data-point="${Te(x.id)}"><circle class="dg-tm-pg" cx="${se(N)}" cy="${se(E)}" r="${v}"/>${ft("flag",N,E,j.glyph,"dg-tm-pgl")}${we}${pe}${ve}</g>`)}let A=new Set(t.wires.map(x=>`${x.step}/${x.event}`));for(let x of t.edges){if(A.has(`${x.step}/${x.event}`))continue;let N=a.edges.find(q=>q.step===x.step&&q.event===x.event);if(!N)continue;c.traces.push({from:x.from,to:x.to,points:x.points,shown:[[N.start,Number.POSITIVE_INFINITY]]});let E=e.kf([[0,{opacity:0,"stroke-dashoffset":1}],[N.start,{opacity:0,"stroke-dashoffset":1},be.inOut],[N.start+.05,{opacity:1}],[N.drawn,{"stroke-dashoffset":0}],[e.last,{opacity:1,"stroke-dashoffset":0},be.inOut],[e.total,{opacity:0,"stroke-dashoffset":0}]]),v=e.kf([[0,{opacity:0}],[N.drawn-.05,{opacity:0}],[N.drawn,{opacity:1}],[e.last,{opacity:1},be.inOut],[e.total,{opacity:0}]]);m.push(`<g data-link="${Te(`${x.from}->${x.to}`)}" style="${ke(x.color)}"><path class="dg-tm-ln dg-a" pathLength="1" d="${ut(x.points)}" style="${E}"/><path class="dg-eh-on dg-a" d="${hn(x.points)}" style="${v}"/></g>`)}let C=a.needle??[],K=_r(C.filter(([x])=>x<e.total)),X=K[K.length-1]?.[1]??0,Q=[...K.map(([x,N])=>[x,i.x+N*i.unit,0]),[e.last,i.x+X*i.unit,0],[e.total,i.x,0]],{y1:ie,y2:re}=t.needle,D=s.needle;return $.push(`<g class="dg-a" data-needle="" style="${e.move(Q)}"><line class="dg-tm-nd" x1="0" y1="${se(ie)}" x2="0" y2="${se(re)}"/><path class="dg-tm-nh" d="M ${-D.head*.75} ${se(ie-D.head)} L ${D.head*.75} ${se(ie-D.head)} L 0 ${se(ie)} Z"/><circle class="dg-tm-nh" cy="${se(i.line)}" r="${D.dot}"/></g>`),{base:b.join(""),lit:m.join(""),node:d.join(""),top:$.join("")}}function Wr(t,n,a){let{m:c}=a,l=w.time.meter,{x:e,w:r,line:s,text:i}=t.meter,o=t.y+l.y,p=c.kf([..._r(n).map(([b,m])=>[b,{transform:`scaleX(${se(m*1e3)/1e3})`}]),[c.last,{transform:`scaleX(${se(Yr(n,c.last)*1e3)/1e3})`},be.inOut],[c.total,{transform:"scaleX(0)"}]]),f=e+r*s;return`<rect class="dg-tm-mt" x="${se(e)}" y="${se(o)}" width="${se(r)}" height="${l.h}" rx="${l.h/2}"/><rect class="dg-tm-mf dg-a" x="${se(e)}" y="${se(o)}" width="${se(r)}" height="${l.h}" rx="${l.h/2}" style="${ke(l.color)};${p}"/><line class="dg-tm-mk" x1="${se(f)}" y1="${se(o-l.mark)}" x2="${se(f)}" y2="${se(o+l.h+l.mark)}"/>`+Oe(a.ink,"dg-tm-ml",f,t.y+l.textY,i,O.meterLine,We,"middle")}function Hr(t,n,a,c,l,e){let r=n.steps[a],s=Yr(n.needle??[],r.end-oe.still),i=t.axis.x+s*t.axis.unit,o=Math.min(...t.rows.map($=>$.y)),p=Math.max(...t.rows.map($=>$.y+$.h)),f={x:i-1,y:o,w:2,h:p-o},b=t.badges.find($=>$.step===a),m=$=>Math.hypot(Math.max(0,$.x-i,i-$.x-$.w),Math.max(0,$.y-o,o-$.y-$.h)),d=[...b?[{x:b.x-w.badge.r,y:b.y-w.badge.r,w:w.badge.r*2,h:w.badge.r*2}]:[],...[...c].sort(($,S)=>m($)-m(S))];for(let $ of d){let S=Math.min(f.x,$.x),u=Math.min(f.y,$.y),h={x:S,y:u,w:Math.max(f.x+f.w,$.x+$.w)-S,h:Math.max(f.y+f.h,$.y+$.h)-u};h.w<=l&&h.h<=e&&(f=h)}return f}var zr=t=>Math.round(t*100)/100,bn=class{constructor(n,a,c){this.prefix=n;this.total=a;this.last=c}prefix;total;last;frames=[];count=0;pct(n){return+(Math.min(Math.max(n,0),this.total)/this.total*100).toFixed(3)}kf(n){let a=`${this.prefix}-${this.count++}`,c=new Map;for(let[e,r,s]of[...n].sort((i,o)=>i[0]-o[0])){let i=this.pct(e),o=c.get(i)??{props:{}};Object.assign(o.props,r),s&&(o.ease=s),c.set(i,o)}let l=[...c].map(([e,{props:r,ease:s}])=>{let i=Object.entries(r).map(([o,p])=>`${o}:${p}`);return s&&i.push(`animation-timing-function:${s}`),`${e}%{${i.join(";")}}`}).join("");return this.frames.push(`@keyframes ${a}{${l}}`),`animation-name:${a}`}vis(n,a=this.last,c={}){let l=c.f??oe.fade,e=c.on??{},r=c.off??{},s=c.within?Math.max(n+l,a-l):a;return this.kf([[0,{opacity:0,...r}],[n,{opacity:0,...r},c.ein??be.out],[n+l,{opacity:1,...e}],[s,{opacity:1,...e},be.inOut],[Math.min(s+l,this.total),{opacity:0,...r}],[this.total,{opacity:0,...r}]])}rise(n,a=this.last,c=!1){return this.vis(n,a,{on:{transform:"translateY(0)"},off:{transform:`translateY(${w.rise}px)`},within:c})}pop(n,a=this.last){return this.vis(n,a,{f:oe.popFade,ein:be.pop,on:{transform:"scale(1)"},off:{transform:`scale(${w.popFrom})`}})}until(n){let a=oe.untilFade;return this.kf([[0,{opacity:1}],[n,{opacity:1},be.inOut],[n+a,{opacity:0}],[this.last,{opacity:0}],[this.total,{opacity:1}]])}move(n,a=[]){return this.kf(n.map(([c,l,e,r=1,s])=>[c,{transform:`translate(${zr(l)}px,${zr(e)}px) scale(${r})`},s]).concat(a))}blink(n,a,c){return[[0,{opacity:0}],[n-.01,{opacity:0}],[n,{opacity:1}],[a,{opacity:1}],[a+c,{opacity:0}],[this.total,{opacity:0}]]}};var ue=t=>`font:${t.weight} ${t.size}px var(--${t.family})`,Ce=(t,n="var(--surf)")=>`color-mix(in srgb,var(--c) ${t}%,${n})`,he=w.stroke,Ee=w.mix,An=`color-mix(in srgb,var(--mute) ${Ee.past}%,var(--bg))`,Pi=[".dg{display:block;width:100%;height:auto;overflow:visible}",".dg .dg-a{animation-duration:var(--T);animation-timing-function:linear;animation-iteration-count:infinite;animation-fill-mode:both;animation-delay:calc(var(--at,0) * -1s);animation-play-state:var(--play,running)}",".dg .dg-popc{transform-box:fill-box;transform-origin:center}",".dg-bg{fill:var(--bg)}",".dg-band{fill:color-mix(in srgb,var(--c) var(--tint),var(--bg));stroke:color-mix(in srgb,var(--c) var(--edge),transparent)}",`.dg-bi{fill:${Ce(Ee.regionIcon)};stroke:${Ce(Ee.regionIconEdge,"transparent")}}`,`.dg-bz{${ue(O.regionName)};fill:var(--ct)}`,`.dg-bx{${ue(O.regionNote)};fill:var(--mute)}`,".dg-st{fill:var(--surf);stroke:var(--hair)}",`.dg-halo{fill:none;stroke:var(--c);stroke-width:${he.halo};stroke-opacity:.16}`,`.dg-on{fill:none;stroke:var(--c);stroke-width:${he.on}}`,`.dg-ic{fill:${Ce(Ee.icon)}}`,`.dg-slot{fill:none;stroke:${Ce(Ee.slot,"transparent")};stroke-width:${he.slot};stroke-dasharray:3 3}`,`.dg-gl{fill:none;stroke:var(--c);stroke-width:${he.glyph};stroke-linecap:round;stroke-linejoin:round}`,`.dg-sn{${ue(O.boxName)};fill:var(--ink)}`,`.dg-ss{${ue(O.boxSub)};fill:var(--mute)}`,`.dg-ss-ok{${ue(O.boxSubStrong)};fill:var(--ct)}`,`.dg-ss-act{${ue(O.boxSubStrong)};fill:var(--ink)}`,`.dg-ll{stroke:var(--line);stroke-width:${he.lifeline};stroke-dasharray:3 4}`,`.dg-e{fill:none;stroke:var(--line);stroke-width:${he.edge};stroke-linecap:round;stroke-dasharray:0 ${w.edge.ghostDash}}`,`.dg-eh{fill:none;stroke:var(--line);stroke-width:${he.arrow};stroke-linecap:round;stroke-linejoin:round}`,`.dg-e-on{fill:none;stroke:var(--c);stroke-width:${he.edgeOn};stroke-linecap:round;stroke-dasharray:1 2}`,`.dg-eh-on{fill:none;stroke:var(--c);stroke-width:${he.edgeOn};stroke-linecap:round;stroke-linejoin:round}`,`.dg-flow{fill:none;stroke:var(--surf);stroke-width:${he.flow};stroke-linecap:round;stroke-dasharray:1.5 ${w.edge.flowDash}}`,`.dg-e-past{fill:none;stroke:${An};stroke-width:${he.edge};stroke-linecap:round}`,`.dg-eh-past{fill:none;stroke:${An};stroke-width:${he.arrow};stroke-linecap:round;stroke-linejoin:round}`,".dg-bd{cursor:pointer}",".dg-bdf{fill:var(--c)}",`.dg-bdft{${ue(O.badge)};fill:var(--on-c)}`,`.dg-bdr{fill:none;stroke:var(--c);stroke-width:${he.badgeRing};pointer-events:none}`,`.dg-bdp{fill:${Ce(Ee.badgePast)};stroke:${Ce(Ee.badgePastEdge,"transparent")};stroke-width:${he.hair}}`,`.dg-bdpt{${ue(O.badge)};fill:var(--ct)}`,`.dg-bdp-g{fill:var(--surf);stroke:${An};stroke-width:${he.hair}}`,`.dg-bdpt-g{${ue(O.badge)};fill:var(--mute)}`,`.dg-cap rect,.dg-act rect{fill:${Ce(Ee.cap)};stroke:${Ce(Ee.capEdge,"transparent")}}`,`.dg-cap text{${ue(O.label)};fill:var(--ct)}`,`.dg-capj text{${ue(O.labelJa)}}`,`.dg-cap-past text{${ue(O.label)};fill:var(--mute);fill-opacity:${w.state.pastLabel}}`,`.dg-cap-pastj text{${ue(O.labelJa)}}`,`.dg-act text{${ue(O.action)};fill:var(--ct)}`,".dg-car{fill:var(--carry,var(--ink))}",`.dg-car-t{${ue(O.carrier)};fill:var(--bg)}`,`.dg-car-tj{${ue(O.carrierJa)}}`,`.dg-env{fill:var(--carry,var(--ink));stroke:var(--surf);stroke-width:${he.envelope}}`,`.dg-env-in{fill:none;stroke:var(--surf);stroke-width:${he.flow};stroke-linejoin:round;stroke-linecap:round}`,".dg-coin{fill:var(--coin);stroke:var(--surf);stroke-width:1.2}",".dg-coin-in{fill:none;stroke:var(--coinin);stroke-width:1.1}",".dg-strip{fill:var(--surf);stroke:var(--hair)}",`.dg-sep{stroke:var(--hair);stroke-width:${he.hair}}`,`.dg-sh{${ue(O.stripTitle)};fill:var(--ink)}`,`.dg-fl{${ue(O.fieldName)};fill:var(--mute)}`,`.dg-fv{${ue(O.fieldValue)};fill:var(--ink)}`,`.dg-fvj{${ue(O.fieldValueJa)};fill:var(--ink)}`,".dg-fv-c{fill:var(--ct)}",".dg-fl-now{fill:var(--c)}",`.dg-tr-ring{fill:none;stroke:var(--line);stroke-width:${he.trail}}`,".dg-tr-fill{fill:var(--c)}",".dg-tg rect{fill:var(--c)}",`.dg-tg text{${ue(O.tag)};fill:var(--on-c)}`,`.dg-side{fill:color-mix(in srgb,var(--c) ${Ee.side}%,var(--bg));stroke:${Ce(Ee.sideEdge,"transparent")};stroke-dasharray:4 4}`,`.dg-side-t{${ue(O.regionName)};fill:var(--ct)}`,`.dg-side-n{${ue(O.regionNote)};fill:var(--mute)}`,`.dg-ghost{fill:var(--surf);stroke:${Ce(Ee.ghostEdge,"transparent")};stroke-dasharray:4 3}`,`.dg-path{fill:none;stroke:${Ce(Ee.path,"transparent")};stroke-width:${he.path};stroke-linecap:round;stroke-dasharray:0 ${w.edge.ghostDash}}`,`.dg-path-h{fill:none;stroke:${Ce(Ee.path,"transparent")};stroke-width:${he.arrow};stroke-linecap:round;stroke-linejoin:round}`,`.dg-path-t{${ue(O.label)};fill:var(--ct)}`,`.dg-path-tj{${ue(O.labelJa)}}`,".dg-start{fill:var(--ink)}",`.dg-end{fill:var(--bg);stroke:var(--ink);stroke-width:${he.end}}`,".dg-end-in{fill:var(--ink)}",`.dg-end-x{fill:var(--bg);stroke:${Ce(Ee.path,"transparent")};stroke-width:${he.arrow};stroke-dasharray:2 2.5}`,`.dg-end-xi{fill:${Ce(Ee.path,"transparent")}}`,`.dg-mark{${ue(O.regionNote)};fill:var(--mute)}`,`.dg-done{fill:var(--ink);stroke:var(--surf);stroke-width:${he.done}}`,`.dg-done-ck{fill:none;stroke:var(--surf);stroke-width:${he.glyph};stroke-linecap:round;stroke-linejoin:round}`,`.dg-git-l{fill:none;stroke:var(--c);stroke-width:${he.git};stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:1 2}`,`.dg-git-cp{fill:none;stroke:var(--c);stroke-width:${he.gitOrphan};stroke-linecap:round;stroke-dasharray:3 3;stroke-opacity:.7}`,`.dg-git-c{fill:var(--surf);stroke:var(--c);stroke-width:${he.git}}`,`.dg-git-id{${ue(O.gitId)};fill:var(--ct)}`,`.dg-git-h{${ue(O.gitHash)};fill:var(--mute)}`,`.dg-git-n{${ue(O.gitNote)};fill:var(--ink2)}`,`.dg-git-old{fill:var(--surf);stroke:var(--c);stroke-width:${he.gitOrphan};stroke-dasharray:3 3;stroke-opacity:.6}`,`.dg-git-oldl{${ue(O.gitId)};fill:var(--ct);opacity:.55}`,`.dg-tm-ep{fill:color-mix(in srgb,var(--ink) ${Ee.timeShade}%,transparent)}`,`.dg-tm-sep{stroke:var(--hair);stroke-width:${he.hair};stroke-dasharray:2 4}`,`.dg-tm-hd{${ue(O.timeHead)};fill:var(--ink)}`,`.dg-tm-hdj{${ue(Rt(O.timeHead))}}`,`.dg-tm-slot{fill:none;stroke:var(--line);stroke-width:${he.timeSlot};opacity:.55}`,".dg-tm-m{fill:var(--c)}",".dg-tm-x{fill:var(--c-slate)}",`.dg-tm-fr{fill:none;stroke:var(--c-blue);stroke-width:${he.timeFrame};stroke-dasharray:3 2}`,`.dg-tm-gd{fill:none;stroke:color-mix(in srgb,var(--c-blue) ${Ee.timeGuide}%,transparent);stroke-width:${he.hair};stroke-dasharray:2 3}`,`.dg-tm-ax{fill:none;stroke:var(--line);stroke-width:${he.timeAxis}}`,`.dg-tm-tk{${ue(O.timeTick)};fill:var(--mute)}`,`.dg-tm-tkj{${ue(Rt(O.timeTick))}}`,`.dg-tm-en{${ue(O.timePeriod)};fill:var(--ink2)}`,`.dg-tm-er{${ue(O.timeRange)};fill:var(--mute)}`,`.dg-tm-erj{${ue(Rt(O.timeRange))}}`,`.dg-tm-rn{${ue(O.timeRow)};fill:var(--ink2)}`,`.dg-tm-br{fill:none;stroke:var(--c);stroke-width:${he.timeSpan};stroke-linecap:round;stroke-linejoin:round}`,`.dg-tm-bt{${ue(O.spanText)};fill:var(--ct)}`,`.dg-tm-bx{fill:color-mix(in srgb,var(--c) ${Ee.timeSpan}%,transparent);stroke:var(--c);stroke-width:${he.timeSpan};stroke-dasharray:4 3}`,`.dg-tm-con{fill:none;stroke:var(--line);stroke-width:${he.timeDrop};stroke-linecap:round;stroke-dasharray:0 3.5}`,".dg-tm-pg{fill:var(--surf);stroke:var(--line);stroke-dasharray:2 2.5}",`.dg-tm-pgl{fill:none;stroke:var(--mute);stroke-width:${he.timeFlag};stroke-linecap:round;stroke-linejoin:round}`,`.dg-tm-pc{fill:var(--surf);stroke:var(--c);stroke-width:${he.timePoint}}`,`.dg-tm-pcg{fill:none;stroke:var(--c);stroke-width:${he.timeFlag};stroke-linecap:round;stroke-linejoin:round}`,`.dg-tm-pn{${ue(O.pointName)};fill:var(--ink)}`,`.dg-tm-pnj{${ue(Rt(O.pointName))}}`,".dg-tm-pn-g{fill:var(--mute)}",`.dg-tm-ps{${ue(O.pointState)};fill:var(--ct)}`,`.dg-tm-ln{fill:none;stroke:var(--c);stroke-width:${he.edgeOn};stroke-linecap:round;stroke-dasharray:1 2}`,`.dg-tm-nd{stroke:var(--ink);stroke-width:${he.timeNeedle};opacity:.55}`,".dg-tm-nh{fill:var(--ink)}",".dg-tm-ph{fill:none;stroke:var(--line);stroke-dasharray:3 3}",`.dg-tm-ex{fill:color-mix(in srgb,var(--c-slate) ${Ee.timeEmpty}%,var(--surf));stroke:var(--c-slate);stroke-width:${he.timeFrame};stroke-dasharray:3 3}`,`.dg-tm-ext{${ue(O.emptyText)};fill:var(--t-slate)}`,".dg-tm-mt{fill:var(--hair)}",".dg-tm-mf{fill:var(--c);transform-box:fill-box;transform-origin:0 50%}",`.dg-tm-mk{stroke:var(--ink2);stroke-width:${he.timeMeter}}`,`.dg-tm-ml{${ue(O.meterLine)};fill:var(--ink2)}`,".dg-vp-bg{fill:var(--bg)}",".dg-vp-frame{fill:none;stroke:var(--hair)}",".dg-hd-bg{fill:var(--bg)}",".dg-mm-bg{fill:var(--surf);stroke:var(--hair)}",`.dg-mm-t{${ue(O.miniTitle)};fill:var(--mute)}`,".dg-mm-world{fill:var(--sunk);stroke:var(--hair)}",`.dg-mm-band{fill:${Ce(Ee.miniBand)};stroke:${Ce(Ee.miniBandEdge,"transparent")};stroke-width:.6}`,`.dg-mm-card{fill:${Ce(Ee.mini)}}`,`.dg-mm-vp{fill:color-mix(in srgb,var(--ink) ${Ee.view}%,transparent);stroke:var(--ink);stroke-width:${he.badgeRing};vector-effect:non-scaling-stroke}`].join("");function Si(t){let n=2166136261;for(let a=0;a<t.length;a++)n^=t.charCodeAt(a),n=Math.imul(n,16777619);return(n>>>0).toString(36)}function Mi(t){let n=new Map,a=(c,l)=>{n.set(c,(n.get(c)??new Set).add(l))};return t.steps.forEach((c,l)=>{for(let e of c.events)e.type==="edge"?(a(e.from,l),a(e.to,l)):(e.type==="action"||e.type==="swap")&&a(e.box,l)}),new Map([...n].map(([c,l])=>[c,[...l].sort((e,r)=>e-r)]))}function Ti(t,n,a){let c=[],{whole:l}=n,e=0;for(let s of n.events){let i=t.steps[s.step]?.events[s.event];if(i?.type==="swap"&&c.push({t:s.at,order:e++,box:i.box,set:i.text}),a&&i?.type==="action"){c.push({t:s.at,order:e++,box:i.box,act:i.label});let o=n.steps[s.step].end;(!l||o<=l.start)&&c.push({t:o,order:e++,box:i.box,act:null})}}c.sort((s,i)=>s.t-i.t||s.order-i.order);let r=new Map;for(let s of t.boxes){let i=[s.sub??"","dg-ss"],o,p=i.join("|"),f=[],b=c.filter($=>$.box===s.id),m=[...b].reverse().find($=>$.set!==void 0||typeof $.act=="string");l&&typeof m?.act=="string"&&b.push({t:l.start,order:e++,box:s.id,act:m.act});for(let $ of b){$.set!==void 0&&(i=[$.set,"dg-ss-ok"],o=void 0),$.act!==void 0&&(o=$.act??void 0);let S=o!==void 0?[o,"dg-ss-act"]:i;S.join("|")!==p&&(p=S.join("|"),f.push([$.t,S[0],S[1]]))}let d=f.filter(($,S)=>{let u=f[S+1];return u===void 0||u[0]-$[0]>=oe.minShow});r.set(s.id,d)}return r}function Oi(t,n,a){let c=new Map;for(let l of n.events){let e=t.steps[l.step]?.events[l.event];if(e?.type!=="strip")continue;let r=a.badges[l.step]?.color??"slate",s=c.get(e.field)??[],i=n.steps[l.step].end;s.push({at:l.at,color:r,step:l.step,until:i,...e.value!==void 0?{value:e.value}:{},...e.tag!==void 0?{tag:e.tag}:{}}),c.set(e.field,s)}return c}function Ni(t,n,a){if(t.until===void 0)return n;let{after:c,again:l,...e}=n;if(!c)return e;let r=a[t.until].start;return r>c.start?{...e,after:{start:c.start,end:Math.min(c.end,r)}}:e}function Dn(t,n,a,c,l,e,r=[],s=[]){let i=Dt(c,l),o=Si(`${JSON.stringify(t)}|${i}|${e?`${e.width}|${e.lang}`:""}`),p=new bn(`dg${o}`,a.total,a.last),f={m:p,t:a,sh:`filter="url(#dg-sh-${o})"`,end:a.steps[a.steps.length-1].end,ink:r,traces:s},b=Mi(t),m=Ti(t,a,n.kind!=="sequence"),d={band:[],base:[],lit:[],node:[],badge:[],top:[]};for(let v of n.regions)d.band.push(Mr(v,r));let $=n.boxes.find(v=>v.ghost)?.color??"slate";n.side&&d.band.push(Rr(n.side,$,r));let S=(v,q)=>n.boxes.find(z=>z.id===v&&(q===void 0||z.ghost===q))?.color;for(let v of n.paths)d.base.push(Lr(v,S(v.to,!0)??S(v.from)??$,r,s));for(let v of n.ends)d.node.push(Ar(v,$,r));let u=n.kind==="state",h=new Map((a.states??[]).flatMap(v=>v.lit[0]?[[v.box,v.lit[0].start]]:[])),P=new Map((a.meters??[]).map(v=>[v.field,v.keys])),I=v=>v.meter?Wr({...v,meter:v.meter},P.get(v.name)??[[0,0]],f):void 0;n.strip&&d.band.push(Fr(n.strip,Oi(t,a,n),f,u,h,I));for(let v of n.lifelines)d.base.push(jr(v.x,v.y1,v.y2));if(nr(n)){let v=Gr(n,t,a,f);d.base.push(v.links),d.lit.push(v.lines),d.node.push(v.commits),d.top.push(v.tags)}let G=Tn(n)?n:void 0;if(G){let v=Vr(G,t,a,f,m);d.base.push(v.base),d.lit.push(v.lit),d.node.push(v.node),d.top.push(v.top)}let ne=new Set((G?.wires??[]).map(v=>`${v.step}/${v.event}`));for(let v of n.edges){let q=a.edges.find(ee=>ee.step===v.step&&ee.event===v.event);if(!q||G&&!ne.has(`${v.step}/${v.event}`))continue;let z=Dr(v,q,f,u);d.base.push(z.base),d.lit.push(z.lit)}let U=new Map((a.states??[]).map(v=>[v.box,v])),j=new Map(t.boxes.flatMap(v=>v.link===void 0?[]:[[v.id,v.link]])),A=(v,q)=>un(j.get(v),q);for(let v of G?[]:n.boxes){if(v.ghost){d.node.push(A(v.id,Er(v,r)));continue}let q=U.get(v.id);d.node.push(A(v.id,gn(v,f,b.get(v.id)??[],m.get(v.id)??[],u?q?.lit??[]:void 0))),q?.done!==void 0&&d.node.push(qr(v,q.done,f))}for(let v of n.badges)d.badge.push(Ir(v,f,u));for(let v of n.labels){let q=a.labels.find(z=>z.step===v.step&&z.event===v.event);q&&d.top.push(Cr(v,Ni(v,q,a.steps),f))}let{whole:C}=a;for(let v of n.actions){let q=a.events.find(ee=>ee.step===v.step&&ee.event===v.event);if(!q)continue;let z=a.steps[v.step].end;d.top.push(C&&z>C.start?Rn(v,q.at,C.end,f):Rn(v,q.at,z,f,C))}for(let v of a.carriers){let q=n.edges.find(z=>z.step===v.step&&z.event===v.event);q&&d.top.push(yn(q,v,f))}let K=Object.values(d).map(v=>v.join("")).join(""),{near:X,far:Q,nearY:ie,farY:re}=w.shadow,D=`<filter id="dg-sh-${o}" x="-20%" y="-30%" width="140%" height="180%"><feDropShadow dx="0" dy="${ie}" stdDeviation="${X}" style="flood-color:var(--sh);flood-opacity:var(--shA)"/><feDropShadow dx="0" dy="${re}" stdDeviation="${Q}" style="flood-color:var(--sh);flood-opacity:var(--shB)"/></filter>`,x=e&&n.kind==="sequence"?n.boxes.map(v=>A(v.id,Nr(v,f,b.get(v.id)??[],m.get(v.id)??[]))).join(""):"",N=e?Li(n,a,t,p,o,K,e,x):{body:`<rect class="dg-bg" width="${n.width}" height="${n.height}" rx="${w.region.radius}"/>${K}`,w:n.width,h:n.height},E=`.dg-${o}{${Ct};--T:${a.total}s;${i}}${Pi}${p.frames.join("")}`;return`<svg xmlns="http://www.w3.org/2000/svg" class="dg dg-${o}" viewBox="0 0 ${Math.ceil(N.w)} ${Math.ceil(N.h)}" width="${Math.ceil(N.w)}" height="${Math.ceil(N.h)}" role="img" aria-label="${Te(t.title)}" data-dragon="figure" data-view="${e?"follow":"fixed"}"><style>${E}</style><defs>${D}</defs>${N.body}</svg>`}function Kr(t){let n=Math.min(...t.map(c=>c.x)),a=Math.min(...t.map(c=>c.y));return{x:n,y:a,w:Math.max(...t.map(c=>c.x+c.w))-n,h:Math.max(...t.map(c=>c.y+c.h))-a}}function Ei(t,n,a){let c=jn(t,n,a);return c.length===0?void 0:Kr(c)}function qi(t,n,a,c){let l=w.badge.r+w.follow.badgeRoom,{x:e,y:r}=t,s=o=>Math.hypot(Math.max(0,o.x-e,e-o.x-o.w),Math.max(0,o.y-r,r-o.y-o.h)),i={x:e-l,y:r-l,w:l*2,h:l*2};for(let o of[...n].sort((p,f)=>s(p)-s(f))){let p=Kr([i,o]);p.w<=a&&p.h<=c&&(i=p)}return i}function jn(t,n,a){let c=[];for(let l of t.edges.filter(e=>e.step===a)){let e=l.points.map(s=>s[0]),r=l.points.map(s=>s[1]);c.push({x:Math.min(...e),y:Math.min(...r),w:Math.max(...e)-Math.min(...e),h:Math.max(...r)-Math.min(...r)})}c.push(...t.labels.filter(l=>l.step===a),...t.actions.filter(l=>l.step===a));for(let l of n.steps[a]?.events??[]){let e=l.type==="edge"?[l.from,l.to]:l.type==="action"||l.type==="swap"?[l.box]:[];for(let r of e){let s=t.boxes.find(i=>i.id===r);s&&(t.kind==="architecture"||l.type==="swap")&&c.push(s)}}return c}function Li(t,n,a,c,l,e,r,s){let i=w.follow,o=w.mini,p=Math.max(1,r.width),f=Math.min(t.width,p),b=ze[r.lang].overview,m=V=>{let J=Math.min(o.w,f*.4,V*.4/t.height*t.width),T=J/t.width,H=t.height*T,y=Math.max(J,Math.ceil(le(b,O.miniTitle)));return{vh:V,mw:J,k:T,mh:H,bw:y,bgW:y+o.pad*2,bgH:H+o.pad*2+o.title,beside:H>J}},d=m(Math.min(t.height,Math.max(i.minH,f*i.aspect))),$=d.beside&&p<i.narrow,S=r.height===void 0?Number.POSITIVE_INFINITY:d.beside?r.height:r.height-d.bgH-o.inset,{vh:u,mw:h,k:P,mh:I,bw:G,bgW:ne,bgH:U,beside:j}=S<d.vh?m(Math.max(i.fitMinH,S)):{...d,vh:Number.isFinite(S)?Math.min(t.height,S):d.vh},A=j&&!$?Math.min(t.width,p-ne-o.inset):f,C=V=>Math.min(t.width-A/2,Math.max(A/2,V)),K=s===""?0:Math.max(...t.boxes.map(V=>V.y+V.h))+i.headRoom,X=s===""?0:i.head.pad*2+i.head.h,Q=u-X,ie=V=>Math.min(t.height-Q/2,Math.max(K+Q/2,V)),re=w.badge.r,D=[t.width/2,t.height/2],N=n.steps.map((V,J)=>{if(Tn(t)){let M=Hr(t,n,J,jn(t,a,J),A,Q);return D=[M.x+M.w/2,M.y+M.h/2],[C(D[0]),ie(D[1])]}let T=Ei(t,a,J);D=T?[T.x+T.w/2,T.y+T.h/2]:D;let H=[C(D[0]),ie(D[1])],y=t.badges.find(M=>M.step===J);if(!y||Math.abs(y.x-H[0])<=A/2-re&&Math.abs(y.y-H[1])<=Q/2-re)return H;let L=qi(y,jn(t,a,J),A,Q);return D=[L.x+L.w/2,L.y+L.h/2],[C(D[0]),ie(D[1])]}).map(([V,J])=>[V,J-X/2]),E=N[0],v=[[0,E[0],E[1]],[n.steps[0].start,E[0],E[1]]];N.forEach((V,J)=>{if(J===0)return;let T=N[J-1],H=n.steps[J].start;v.push([H,T[0],T[1],1,be.inOut],[H+i.ease,V[0],V[1]])});let q=N[N.length-1];v.push([n.last,q[0],q[1],1,be.inOut],[n.total,E[0],E[1]]);let z=c.move(v.map(([V,J,T,H,y])=>[V,A/2-J,u/2-T,H,y])),ee=j?A+o.inset:A-ne-o.inset,de=j?0:u+o.inset,ce=ee+o.pad,pe=ce+(G-h)/2,ve=de+o.pad+o.title,ye=$?{clip:"",body:""}:(()=>{let V=[...t.regions.map(T=>`<rect class="dg-mm-band" style="${ke(T.color)}" x="${pe+T.x*P}" y="${ve+T.y*P}" width="${T.w*P}" height="${T.h*P}" rx="3"/>`),...t.boxes.map(T=>`<rect class="dg-mm-card" style="${ke(T.color)}" x="${pe+T.x*P}" y="${ve+T.y*P}" width="${T.w*P}" height="${T.h*P}" rx="1.5"/>`)].join(""),J=c.move(v.map(([T,H,y,,L])=>[T,pe+(H-A/2)*P,ve+(y-u/2)*P,1,L]));return{clip:`<clipPath id="dg-mm-${l}"><rect x="${pe}" y="${ve}" width="${h}" height="${I}" rx="4"/></clipPath>`,body:`<rect class="dg-mm-bg" x="${ee}" y="${de}" width="${ne}" height="${U}" rx="${o.radius}"/><text class="dg-mm-t" x="${ce}" y="${ve-o.pad+2}">${b}</text><g clip-path="url(#dg-mm-${l})"><rect class="dg-mm-world" x="${pe}" y="${ve}" width="${h}" height="${I}"/>${V}<rect class="dg-mm-vp dg-a"${X===0?"":` y="${X*P}"`} width="${A*P}" height="${(u-X)*P}" rx="2" style="${J}"/></g>`}})(),Pe=X===0?"":`<g class="dg-hd"><rect class="dg-hd-bg" width="${A}" height="${X}"/><line class="dg-sep" x1="0" y1="${X}" x2="${A}" y2="${X}"/><g class="dg-a" style="${c.move(v.map(([V,J,,T,H])=>[V,A/2-J,0,T,H]))}">${s}</g></g>`;return{body:`<defs><clipPath id="dg-vp-${l}"><rect width="${A}" height="${u}" rx="${w.region.radius}"/></clipPath>${ye.clip}</defs><g clip-path="url(#dg-vp-${l})"><rect class="dg-vp-bg" width="${A}" height="${u}"/><g class="dg-a" style="${z}">${e}</g>${Pe}</g><rect class="dg-vp-frame" x="0.5" y="0.5" width="${A-1}" height="${u-1}" rx="${w.region.radius}"/>${ye.body}`,w:j&&!$?A+o.inset+ne:f,h:j?u:de+U}}function Cn(t,n){let a=Yn(t.palette);if(!t.colors)return a;let c=ze[t.lang??"ja"],l=Object.entries(t.colors).flatMap(([e,r])=>Vn(e)?Wn(r)?[]:[c.unreadableColor(e)]:[c.unknownColor(e)]);if(l.length>0)throw new Error(c.cannotDraw(l.join(" / ")));return{...a,[n]:{...a[n],...t.colors}}}function Xr(t,n={}){let a=n.lang??"ja",c=xr(t,{lang:a});if(!c.ok)throw new Error(ze[a].cannotDraw(c.errors.map(r=>`${r.pointer} ${r.message}`).join(" / ")));let l=c.diagram,e=l.kind==="sequence"?sr(l):l.kind==="state"?or(l,a):l.kind==="git"?rr(l):l.kind==="time"?mr(l,a):Jn(l);return Ri(l,e,$r(l,n.still===!0),n)}function Ri(t,n,a,c={}){let l=c.theme==="dark"?"dark":"light",e=Cn(c,l),r=[],s=[];return{svg:Dn(t,n,a,e,l,void 0,r,s),palette:e.id,theme:l,...t.view?{view:t.view}:{},fonts:{...Et},layout:n,timeline:a,diagram:t,overlaps:vr(r,a.stills,s)}}function In(t,n,a){let c=Math.max(0,n)/t.layout.width,e=(a===void 0?c:Math.min(c,Math.max(0,a)/t.layout.height))*O.boxName.size;return t.view?{mode:t.view,textPx:e}:{mode:e>=Hn?"fixed":"follow",textPx:e}}var xn=t=>`font:${t.weight} ${t.size}px var(--${t.family})`,Le=t=>`${t}px`;function Ai(){let t=w.player,n=Le(t.hidden);return[`.dg-player{display:flex;flex-direction:column;gap:${Le(t.gap)};color:var(--ink)}`,`.dg-player .dg-frame{border-radius:${Le(t.radius)};overflow:hidden}`,".dg-bar{container:dg-bar/inline-size}",`.dg-row{display:flex;align-items:flex-start;gap:${Le(t.gap)}}`,`.dg-btns{display:flex;gap:${Le(t.gap/2)};flex:none}`,`.dg-btn{width:${Le(t.button)};height:${Le(t.button)};border-radius:${Le(t.radius)};border:${Le(w.stroke.hair)} solid var(--hair);background:var(--surf);color:var(--ink);${xn(O.button)};cursor:pointer}`,`.dg-btn:focus-visible{outline:${Le(t.focus)} solid var(--c-blue);outline-offset:${Le(t.focus)}}`,`.dg-say{display:flex;gap:${Le(t.gap)};min-width:0}`,`.dg-no{${xn(O.stepNo)};color:var(--mute);padding-top:${Le(t.focus)}}`,".dg-txt{display:grid;grid-template-columns:minmax(0,1fr);min-width:0}",".dg-txt>*{grid-area:1/1}",".dg-room{visibility:hidden}",`.dg-tt{${xn(O.stepTitle)};margin:0}`,`.dg-tb{${xn(O.stepBody)};color:var(--ink2);margin:0;white-space:pre-line}`,`.dg-sr{position:absolute;width:${n};height:${n};margin:-${n};padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}`,`@container dg-bar (width < ${Le(t.narrow)}){.dg-row{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:start;gap:0 ${Le(t.gap)}}.dg-say,.dg-txt,.dg-txt>*{display:contents}.dg-btns{grid-area:1/1;margin-bottom:${Le(t.gap/2)}}.dg-btn{width:${Le(t.touch)};height:${Le(t.touch)}}.dg-no{grid-area:1/2;display:flex;align-items:center;min-height:${Le(t.touch)};padding-top:0}.dg-tt{grid-area:2/1/3/3}.dg-tb{grid-area:3/1/4/3}}`,`@media (pointer: coarse){.dg-btn{width:${Le(t.touch)};height:${Le(t.touch)}}}`,`.dg-spot{fill:none;stroke:var(--t-amber);stroke-width:${Le(w.stroke.mark)};stroke-dasharray:${w.mark.dash} ${w.mark.gap};pointer-events:none}`].join("")}function ji(t){if(t.getElementById("dragon-player-css"))return;let n=t.createElement("style");n.id="dragon-player-css",n.textContent=Ai(),t.head.appendChild(n)}var At={prev:"\u2039",pause:"\u275A\u275A",play:"\u25B6",next:"\u203A"},Ur="http://www.w3.org/2000/svg",Jr=t=>String(t).padStart(2,"0"),Di=(t,n)=>`${Jr(t+1)}/${Jr(n)}`;function Zr(t,n,a={}){let c=t.ownerDocument,l=c.defaultView,e=!!l?.matchMedia?.("(prefers-reduced-motion: reduce)").matches,r=Xr(n,a),s=a.lang??"ja",i=ze[s],o=Cn(a,r.theme),{timeline:p}=r,f=r.diagram.steps,b=f.length;ji(c);let m=c.createElement("div");m.className="dg-player",m.dataset.dragon="player",m.setAttribute("style",`${Ct};${Dt(o,r.theme)}`);let d=c.createElement("div");d.className="dg-frame";let $=(B,_,Z)=>{let ae=c.createElement("button");return ae.type="button",ae.className="dg-btn",ae.dataset.dragon=B,ae.setAttribute("aria-label",_),ae.textContent=Z,ae},S=$("prev",i.prev,At.prev),u=$("toggle",i.pause,At.pause),h=$("next",i.next,At.next),P=c.createElement("div");P.className="dg-btns",P.setAttribute("lang",s),P.append(S,u,h);let I=c.createElement("div");I.className="dg-say",I.setAttribute("aria-hidden","true");let G=c.createElement("div");G.className="dg-no",G.dataset.dragon="step-no";let ne=c.createElement("div");ne.className="dg-txt";let U=c.createElement("p");U.className="dg-tt",U.dataset.dragon="step-title";let j=c.createElement("p");j.className="dg-tb",j.dataset.dragon="step-body";let A=c.createElement("div");A.append(U,j),ne.append(A);for(let B of f){let _=c.createElement("div");_.className="dg-room",_.dataset.dragon="caption-room";let Z=c.createElement("p");Z.className="dg-tt",Z.textContent=B.title;let ae=c.createElement("p");ae.className="dg-tb",ae.textContent=B.body,_.append(Z,ae),ne.append(_)}I.append(G,ne);for(let B of[G,U,j])B.setAttribute("aria-hidden","true");let C=c.createElement("div");C.className="dg-row",C.append(P,I);let K=c.createElement("div");K.className="dg-bar",K.append(C);let X=c.createElement("ol");X.className="dg-sr",X.dataset.dragon="steps",X.setAttribute("aria-label",i.steps(r.diagram.title));for(let B of f){let _=c.createElement("li"),Z=c.createElement("strong");Z.textContent=B.title,_.append(Z);for(let ae of B.body.split(`
2
+ `)){let xe=c.createElement("p");xe.textContent=ae,_.append(xe)}if(B.sources){let ae=c.createElement("ul");for(let xe of B.sources){let qe=c.createElement("a");qe.href=xe.url,qe.textContent=xe.name;let Ae=c.createElement("li");Ae.append(qe),ae.append(Ae)}_.append(ae)}X.append(_)}m.append(d,K,X),t.append(m);let Q=()=>d.clientWidth||t.clientWidth||r.layout.width,ie=()=>{if(!a.fitHeight||!l)return;let B=l.getComputedStyle(d),_=d.clientHeight-(Number.parseFloat(B.paddingTop)||0)-(Number.parseFloat(B.paddingBottom)||0);return _>0?_:void 0},re=In(r,Q(),ie()).mode,D=Q(),x=ie(),N=null,E=a.pausedAt===void 0?0:Math.min(b-1,Math.max(0,a.pausedAt)),v=!e&&a.pausedAt===void 0,q=v?0:p.stills[E]??0,z=p.stills[b-1]??0,ee=Date.now(),de=[],ce=()=>{if(!N)return;for(let Z of N.querySelectorAll(".dg-spots"))Z.remove();if(de.length===0)return;let B=w.mark,_=c.createElementNS(Ur,"g");_.setAttribute("class","dg-spots");for(let Z of de){let ae=c.createElementNS(Ur,"rect");ae.setAttribute("class","dg-spot"),ae.setAttribute("x",String(Z.x-B.pad)),ae.setAttribute("y",String(Z.y-B.pad)),ae.setAttribute("width",String(Z.w+B.pad*2)),ae.setAttribute("height",String(Z.h+B.pad*2)),ae.setAttribute("rx",String(B.radius)),_.append(ae)}(N.querySelector('g[clip-path^="url(#dg-vp-"] > g.dg-a')??N).append(_)},pe=B=>{let _;if(B!==void 0){let Z=c.createElement("div");Z.innerHTML=B,_=Z.querySelector("svg")}else _=N?N.cloneNode(!0):null;_&&(_.setAttribute("aria-hidden","true"),_.removeAttribute("role"),_.removeAttribute("aria-label"),_.style.setProperty("--at",String(q)),_.style.setProperty("--play",v?"running":"paused"),_.dataset.motion=v?"play":"still",N?N.replaceWith(_):d.append(_),N=_,ee=Date.now(),ce())},ve=()=>re==="follow"?Dn(r.diagram,r.layout,p,o,r.theme,{width:D,...x===void 0?{}:{height:x},lang:s}):r.svg,we=()=>v?(q+(Date.now()-ee)/1e3)%p.total:q,ye=B=>{let _=0;return p.steps.forEach((Z,ae)=>{Z.start<=B&&(_=ae)}),_},Pe=()=>{let B=f[E];G.textContent=Di(E,b),U.textContent=B?.title??"",j.textContent=B?.body??"",u.setAttribute("aria-label",v?i.pause:i.play),u.textContent=v?At.pause:At.play,a.onStep?.(E)},k=(B,_)=>{q=B,v=_,pe(),Pe()},V=B=>{E=Math.min(b-1,Math.max(0,B));let _=p.steps[E];k(v?_.start:p.stills[E]??_.start,v)},J=()=>{a.playOnce&&q>=z&&(E=0,q=0),k(q,!0)};pe(ve()),Pe();let T=l?.setInterval(()=>{if(!v)return;if(a.playOnce&&q+(Date.now()-ee)/1e3>=z){E=b-1,k(z,!1);return}let B=ye(we());B!==E&&(E=B,Pe())},120),H=()=>V(E-1),y=()=>V(E+1),L=()=>v?k(we(),!1):J(),M=B=>{let _=B.target?.closest?.("[data-step]"),Z=_?Number(_.getAttribute("data-step")):Number.NaN;Number.isInteger(Z)&&V(Z)};S.addEventListener("click",H),h.addEventListener("click",y),u.addEventListener("click",L),d.addEventListener("click",M);let F=l?.ResizeObserver,te=F?new F(()=>{let B=Q(),_=ie(),Z=In(r,B,_).mode;if(Z===re&&(re==="fixed"||B===D&&_===x))return;let ae=we();re=Z,D=B,x=_,q=ae,pe(ve())}):void 0;return te?.observe(d),{get step(){return E},get playing(){return v},next:y,prev:H,play:()=>{v||J()},pause:()=>{v&&k(we(),!1)},goTo:B=>{v=!1,V(B)},mark:B=>{de=B,ce()},destroy:()=>{T!==void 0&&l?.clearInterval(T),te?.disconnect(),S.removeEventListener("click",H),h.removeEventListener("click",y),u.removeEventListener("click",L),d.removeEventListener("click",M),m.remove()}}}return is(Ci);})();