@cardenelabs/dragon 0.39.0 → 0.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +39 -1
  2. package/dist/cli.cjs +1921 -429
  3. package/dist/cli.cjs.map +1 -1
  4. package/dist/cli.js +1926 -434
  5. package/dist/cli.js.map +1 -1
  6. package/dist/export.cjs +1718 -353
  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 +1723 -358
  11. package/dist/export.js.map +1 -1
  12. package/dist/index.cjs +1835 -342
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +5 -15
  15. package/dist/index.d.ts +5 -15
  16. package/dist/index.js +1836 -342
  17. package/dist/index.js.map +1 -1
  18. package/dist/{ink-Cg-v6XSG.d.cts → ink-B_7OXxtb.d.cts} +27 -2
  19. package/dist/{ink-Cg-v6XSG.d.ts → ink-B_7OXxtb.d.ts} +27 -2
  20. package/dist/node.cjs +2946 -0
  21. package/dist/node.cjs.map +1 -0
  22. package/dist/node.d.cts +9 -0
  23. package/dist/node.d.ts +9 -0
  24. package/dist/node.js +2944 -0
  25. package/dist/node.js.map +1 -0
  26. package/dist/player.global.js +2 -2
  27. package/package.json +11 -1
  28. package/src/field-messages.ts +8 -0
  29. package/src/index.ts +5 -2
  30. package/src/layout/git.ts +728 -0
  31. package/src/look/values.ts +40 -1
  32. package/src/messages.ts +47 -4
  33. package/src/node.ts +23 -0
  34. package/src/parser.ts +142 -7
  35. package/src/printer.ts +16 -4
  36. package/src/render/git.ts +161 -0
  37. package/src/render/parts.ts +1 -1
  38. package/src/render/svg.ts +26 -1
  39. package/src/schema.ts +47 -13
  40. package/src/schemas/diagram.schema.json +75 -8
  41. package/src/schemas/validate-diagram.js +1 -1
  42. package/src/timeline.ts +18 -3
  43. package/src/version.ts +1 -20
  44. package/src/words.ts +19 -3
@@ -1,2 +1,2 @@
1
- "use strict";var DragonPlayer=(()=>{var Ht=Object.defineProperty;var ar=Object.getOwnPropertyDescriptor;var lr=Object.getOwnPropertyNames;var cr=Object.prototype.hasOwnProperty;var pr=(e,n)=>{for(var o in n)Ht(e,o,{get:n[o],enumerable:!0})},dr=(e,n,o,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of lr(n))!cr.call(e,a)&&a!==o&&Ht(e,a,{get:()=>n[a],enumerable:!(i=ar(n,a))||i.enumerable});return e};var fr=e=>dr(Ht({},"__esModule",{value:!0}),e);var fs={};pr(fs,{mountDiagram:()=>or});var Kt=e=>/[0-9A-Za-z]$/u.test(e)?`${e} `:e,mr=e=>e.charAt(0).toUpperCase()+e.slice(1),Xe={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)=>`${Kt(e)}\u3068${Kt(n)}\u304C\u91CD\u306A\u308B`,lineCrosses:(e,n,o)=>`\u7DDA ${e} \u2192 ${n} \u304C${Kt(o)}\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)=>mr(`${e} and ${n} overlap`),lineCrosses:(e,n,o)=>`The line ${e} \u2192 ${n} crosses ${o}`}};var dn={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 ft={sans:"Noto Sans JP Variable",mono:"JetBrains Mono Variable"},gr={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},hr=600,yr=11904,xt=1e3;function fn(e,n){return(e.codePointAt(0)??0)>=yr?xt:n==="mono"?hr:gr[e]??xt}var br="paper",Xt=Object.fromEntries(Object.entries(dn).map(([e,n])=>[e,{id:e,...n}]));function wt(e){return(e!==void 0&&Object.hasOwn(Xt,e)?Xt[e]:void 0)??Xt[br]}function vt(e,n){return Object.entries(e[n]).map(([o,i])=>`--${o}:${i}`).join(";")}var $t=`--sans:"${ft.sans}";--mono:"${ft.mono}"`,mt=["blue","amber","green","violet","rose"],ue=(e,n,o="sans")=>({size:e,weight:n,family:o}),M={boxName:ue(13,650),boxSub:ue(11,500),boxSubStrong:ue(11,700),regionName:ue(12.5,700),regionNote:ue(11,500),label:ue(11,600,"mono"),labelJa:ue(11,650),action:ue(11,650),badge:ue(10.5,700,"mono"),carrier:ue(10.5,700,"mono"),carrierJa:ue(10.5,700),stripTitle:ue(12.5,700),fieldName:ue(10.5,600),fieldValue:ue(12,600,"mono"),fieldValueJa:ue(12,600),tag:ue(10.5,700),miniTitle:ue(10.5,700),stepTitle:ue(15,700),stepBody:ue(13.5,500),stepNo:ue(13,700,"mono"),button:ue(14,700)},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},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:{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}},J={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},mn=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 Be=e=>[...e].some(n=>(n.codePointAt(0)??0)>=11904);function xr(e,n){return n==="mono"&&Be(e)?"sans":n}function Q(e,n){let o=xr(e,n.family),i=0;for(let a of e)i+=fn(a,o);return i*n.size/xt}function Ze(e,n,o,i,a="start"){let t=Q(e,i);return{x:a==="middle"?n-t/2:n,y:o-i.size*.8,w:t,h:i.size}}function Qe(e){return e.steps.flatMap((n,o)=>n.events.flatMap((i,a)=>i.type==="edge"?[{step:o,event:a,edge:i}]:[]))}function et(e){let n=Jt(e),o=new Map;return e.boxes.forEach((i,a)=>{let t=i.region===void 0?void 0:n.get(i.region);o.set(i.id,i.color??t??mt[a%mt.length])}),o}function Jt(e){let n=new Map;return(e.regions??[]).forEach((o,i)=>n.set(o.id,o.color??mt[i%mt.length])),n}var tt=(e,n)=>e.carry.kind==="coin"?"coin":n.get(e.from)??"slate";function nt(e,n,o){let i=e.boxes.find(t=>t.id===n);if(!i)return g.box.minW;let a=[Q(i.name,M.boxName),Q(i.sub??"",M.boxSub)];for(let t of e.steps)for(let r of t.events)r.type==="swap"&&r.box===n&&a.push(Q(r.text,M.boxSubStrong)),o&&r.type==="action"&&r.box===n&&a.push(Q(r.label,M.boxSubStrong));return Math.max(g.box.minW,Math.max(...a)+g.box.padX*2)}function Ye(e){let n=g.carrier;return e.kind==="tag"?[(Q(e.text,Be(e.text)?M.carrierJa:M.carrier)+n.tagPadX*2)/2,n.tagH/2]:e.kind==="coin"?[n.coinR,n.coinR]:[n.envW/2,n.envH/2]}var un=e=>e.main+e.coin+(e.main>0&&e.coin>0?g.slot.spread:0);function kt(e){let n=new Map,o=new Set(e.boxes.map(i=>i.id));for(let i of e.steps)for(let a of i.events){if(a.type!=="edge"||a.carry.kind==="none")continue;let t=a.carry.kind==="coin"?"coin":"main",r=Ye(a.carry)[0]*2;for(let s of[a.from,a.to]){if(!o.has(s))continue;let l=n.get(s)??{main:0,coin:0};l[t]=Math.max(l[t],r),n.set(s,l)}}return n}function Pt(e,n,o){return e?(n?g.box.icon+g.slot.gap:0)+un(e)+g.slot.pad*2+g.box.padX+o:0}function St(e,n,o=g.box.padX){if(!n)return;let i=g.box,a=g.slot,t=un(n)+a.pad*2,r=e.icon?i.icon+a.gap:0,s=Math.max(e.x+i.padX,Math.min(e.cx-(r+t)/2,e.x+e.w-o-(r+t)));e.icon&&(e.iconX=s+i.icon/2),e.slot={x:s+r,y:e.cy+i.iconY-a.h/2,w:t,h:a.h}}function Mt(e,n,o){let i=g.slot,a=(t,r)=>{let s=n.get(t),l=o.get(t);if(!s?.slot||!l)return;let c=s.slot.x+i.pad,d=s.slot.y+s.slot.h/2;return l.main>0&&l.coin>0?r.kind==="coin"?[c+l.main+i.spread+l.coin/2,d]:[c+l.main/2,d]:[s.slot.x+s.slot.w/2,d]};for(let t of e){if(t.carry.kind==="none")continue;let r=a(t.to,t.carry),s=a(t.from,t.carry);r&&(t.settle=r),s&&(t.wait=s)}}function zt(e,n){let o=Math.max(n.x-(e.x+e.w),e.x-(n.x+n.w)),i=Math.max(n.y-(e.y+e.h),e.y-(n.y+n.h));return Math.max(o,i)}function Ot(e,n,o=0){let i=n.x+o,a=n.y+o,t=n.x+n.w-o,r=n.y+n.h-o;if(t<=i||r<=a)return!1;for(let s=1;s<e.length;s++){let[l,c]=e[s-1],[d,v]=e[s],b=d-l,u=v-c,w=0,L=1,$=(f,y)=>{if(f===0)return y>0;let h=y/f;return f<0?w=Math.max(w,h):L=Math.min(L,h),w<L};if($(-b,l-i)&&$(b,t-l)&&$(-u,c-a)&&$(u,r-c))return!0}return!1}function wr(e){let n={a:e[0],b:e[1]??e[0],length:-1};for(let o=1;o<e.length;o++){let i=e[o-1],a=e[o],t=Math.hypot(a[0]-i[0],a[1]-i[1]);t>n.length&&(n={a:i,b:a,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 ze(e,n){let o=n;for(let i=1;i<e.length;i++){let a=e[i-1],t=e[i],r=Math.hypot(t[0]-a[0],t[1]-a[1]);if(o<=r&&r>0)return[a[0]+(t[0]-a[0])*o/r,a[1]+(t[1]-a[1])*o/r];o-=r}return e[e.length-1]}function Et(e){let n=0;for(let o=1;o<e.length;o++){let i=e[o-1],a=e[o];n+=Math.hypot(a[0]-i[0],a[1]-i[1])}return n}function Tt(e){let{w:n,h:o,samples:i}=g.state.loop,a=e.y+e.h,t=[e.cx+n/2,a],r=[e.cx+n*3/4,a+o*4/3],s=[e.cx-n*3/4,a+o*4/3],l=[e.cx-n/2,a+g.edge.inset];return Array.from({length:i+1},(c,d)=>{let v=d/i,b=1-v,u=w=>b*b*b*t[w]+3*b*b*v*r[w]+3*b*v*v*s[w]+v*v*v*l[w];return[u(0),u(1)]})}function Lt(e){let n=Math.max(...e.map(([a])=>a)),o=e[0][1],i=Math.max(...e.map(([,a])=>a));return[n+g.badge.r+g.badge.inset,o+(i-o)*g.state.loop.badgeAt]}function qt(e,n){return{x:(e[0]?.[0]??0)-g.state.loop.w/2-n/2,y:Math.max(...e.map(([,o])=>o))+g.label.soft}}var Zt=g.state.loop.h+g.label.soft*2+g.label.h;function gt(e,n=[],o=[]){let i=Et(e),a=i<g.badge.short?Math.min(g.badge.r+1,i/2):g.badge.along,t=g.badge.r*2+g.badge.inset;for(let r=a;r<=i;r+=1){let s=ze(e,r);if(n.every(([l,c])=>Math.hypot(s[0]-l,s[1]-c)>=t))return s}return vr(e,a,n,o)??ze(e,a)}function vr(e,n,o,i){let a=Et(e),[t,r]=ze(e,n),[s,l]=ze(e,Math.max(0,n-1)),[c,d]=ze(e,Math.min(a,n+1)),v=Math.hypot(c-s,d-l);if(v===0)return;let[b,u]=[-(d-l)/v,(c-s)/v],w=g.badge.r*2;for(let L of[g.edge.arrowHalf,0])for(let $=1;$<=w+g.badge.inset;$++)for(let f of[1,-1]){let y=[t+b*$*f,r+u*$*f];if(o.every(([N,j])=>Math.max(Math.abs(y[0]-N),Math.abs(y[1]-j))>=w+1)&&i.every(N=>!Ot(N,Ue(y),-L)))return y}}var ut=e=>e.points.map(([n,o])=>`${Math.round(n*10)},${Math.round(o*10)}`).join(" ");function We(e,n,o=(i,a,t)=>gt(i.points,a,t)){let i=new Map,a=[],t=new Map;for(let r=0;r<n;r++){let s=e.find(b=>b.step===r&&b.points.length>0);if(!s)continue;let l=ut(s),c=t.get(l);if(c){i.set(r,{point:c,edge:s});continue}let d=e.filter(b=>b.points.length>1&&ut(b)!==l).map(b=>b.points),v=o(s,a,d);a.push(v),t.set(l,v),i.set(r,{point:v,edge:s})}return i}function rt(e){let n=(o,i)=>Math.hypot(o.x-i.x,o.y-i.y)<=.5;return e.map(o=>{let i=e.filter(a=>a.step>o.step&&n(a,o)).sort((a,t)=>a.step-t.step)[0];return i?{...o,until:i.step}:o})}var Ue=([e,n])=>({x:e-g.badge.r,y:n-g.badge.r,w:g.badge.r*2,h:g.badge.r*2}),Nt=e=>[e.x+g.state.text,e.y+g.baseline.mark],De=e=>Be(e)?M.labelJa:M.label,$r={above:"below",below:"above",left:"right",right:"left"};function Je(e,n){let o=Q(e.text,De(e.text))+g.label.padX*2,i=g.label.h,a=wr(e.points),t=(a.a[0]+a.b[0])/2,r=(a.a[1]+a.b[1])/2,s=e.side??(a.vertical?"right":"above"),{side:l}=g.label,c=e.offset??g.label.offset,d=$=>$==="above"?{x:t-o/2,y:r-c-i/2,w:o,h:i}:$==="below"?{x:t-o/2,y:r+c-i/2,w:o,h:i}:$==="left"?{x:t-l-o,y:r-i/2,w:o,h:i}:{x:t+l,y:r-i/2,w:o,h:i},v=e.base?{...e.base,w:o,h:i}:d(s),b=e.flip?[s,$r[s]]:[s],u=$=>n.hard.every(f=>zt($,f)>=g.gap)&&n.soft.every(f=>zt($,f)>=g.label.soft)&&(n.touch??[]).every(f=>zt($,f)>=g.label.touch)&&(n.lines??[]).every(f=>!Ot(f,$,-g.label.touch)),{search:w,searchMax:L}=g.label;for(let $=0;$<=L;$+=w)for(let f of b){let y=f===s?v:d(f),h=f==="above"?[0,-1]:f==="below"?[0,1]:f==="left"?[-1,0]:[1,0],N=[Math.abs(h[1]),Math.abs(h[0])],j=e.slide??(f==="above"||f==="below"?o:i*4);for(let I=0;I<=j;I+=w)for(let Y of I===0?[1]:[1,-1]){let Z={x:y.x+h[0]*$+N[0]*I*Y,y:y.y+h[1]*$+N[1]*I*Y,w:o,h:i};if(u(Z))return{...Z,step:e.step,event:e.event,text:e.text,family:De(e.text).family,color:e.color}}}return{...v,step:e.step,event:e.event,text:e.text,family:De(e.text).family,color:e.color}}function gn(e,n){let o=0,i=0;for(let t of e.steps)for(let r of t.events)r.type!=="strip"||r.field!==n||(r.value!==void 0&&(o=Math.max(o,Q(r.value,Be(r.value)?M.fieldValueJa:M.fieldValue))),r.tag!==void 0&&(i=Math.max(i,Q(r.tag,M.tag)+g.strip.tagPadX*2)));let a=o+(i>0?(o>0?g.strip.tagGap:0)+i:0);return Math.max(Q(n,M.fieldName),a)}var Ut=e=>Math.max(Q(e.title,M.fieldName),e.states.length*g.strip.trail.step);function st(e,n){if(!e.strip)return 0;let{titleX:o,fieldGap:i,pad:a}=g.strip,t=o+Q(e.strip.title,M.stripTitle)+i,r=[...e.strip.fields.map(s=>gn(e,s)),...n?[Ut(n)]:[]];return t+r.reduce((s,l)=>s+l+i,0)-i+a}function ot(e,n,o,i,a){if(!e.strip)return;let{titleX:t,fieldGap:r,pad:s,line:l,h:c}=g.strip,d=t+Q(e.strip.title,M.stripTitle)+r,v=[],b=d,u=0,w=$=>{b>d&&b+$>i-s&&(b=d,u++);let f={x:n+b,y:o+u*l};return b+=$+r,f};for(let $ of e.strip.fields){let f=gn(e,$);v.push({name:$,...w(f),w:f})}let L=a?{...a,...w(Ut(a)),w:Ut(a)}:void 0;return{x:n,y:o,w:i,h:c+u*l,title:e.strip.title,fields:v,...L?{trail:L}:{}}}function it(e,n,o){let i=a=>{a.x+=n,a.y+=o};for(let a of e.boxes)i(a),a.cx+=n,a.cy+=o,a.slot&&i(a.slot),a.iconX!==void 0&&(a.iconX+=n);for(let a of e.regions)a.y+=o,i(a.header);for(let a of e.lifelines)a.x+=n,a.y1+=o,a.y2+=o;for(let a of e.edges)a.points=a.points.map(([t,r])=>[t+n,r+o]),a.settle&&(a.settle=[a.settle[0]+n,a.settle[1]+o]),a.wait&&(a.wait=[a.wait[0]+n,a.wait[1]+o]);for(let a of e.labels)i(a);for(let a of e.paths)a.points=a.points.map(([t,r])=>[t+n,r+o]),a.label&&i(a.label);for(let a of e.ends)a.x+=n,a.y+=o;e.side&&i(e.side);for(let a of e.actions)i(a);for(let a of e.badges)a.x+=n,a.y+=o;if(e.strip){e.strip.y+=o;for(let a of e.strip.fields)a.x+=n,a.y+=o;e.strip.trail&&(e.strip.trail.x+=n,e.strip.trail.y+=o)}}function at(e,n,o){let{inset:i}=g.badge;for(let t of e){let r=t.type==="swap"||t.type==="action"?t.box:void 0,s=o.boxes.find(l=>l.id===r);if(s)return{step:n,x:s.x,y:s.y,color:s.color}}if(o.strip&&e.some(t=>t.type==="strip"))return{step:n,x:o.strip.x+i,y:o.strip.y+i,color:"slate"};let a=o.boxes[0];return{step:n,x:a.x,y:a.y,color:a.color}}function yn(e){let n=kr(e),o=Pr(e,n),i=n.map(()=>({top:0,bottom:0})),a=hn(e,n,o,i);for(let t=0;t<3&&Or(a,n,o,i);t++)a=hn(e,n,o,i);return a}function kr(e){let n=e.regions??[],o=new Set(n.map(t=>t.id)),i=n.map(t=>({region:t,members:e.boxes.filter(r=>r.region===t.id).map(r=>r.id)})),a=e.boxes.filter(t=>t.region===void 0||!o.has(t.region)).map(t=>t.id);return a.length>0&&i.push({members:a}),i}var bn=e=>e==="left"||e==="right";function Pr(e,n){let o=g.architecture.columns,i=Qe(e).map(r=>r.edge),a=new Map;n.forEach((r,s)=>{let l=new Set(r.members),c=new Set,d=(f,y)=>f>=0&&f<o&&!c.has(`${f},${y}`),v=(f,y)=>{let h=Math.min(o-1,Math.max(0,f));for(let N=y;;N++)for(let j=0;j<o;j++)for(let I of[h+j,h-j])if(d(I,N))return[I,N]},b=(f,y,h)=>{a.set(f,{group:s,col:y,row:h}),c.add(`${y},${h}`)},u=1,w=f=>{for(let y of i){let h=y.from===f?y.to:y.to===f?y.from:void 0;if(h===void 0||!l.has(h)||a.has(h))continue;let N=a.get(f),[j,I]=bn(y.labelSide)?v(N.col,N.row+1):d(N.col+u,N.row)?[N.col+u,N.row]:v(N.col+u,N.row);b(h,j,I),w(h)}},L=f=>{for(let y=0;y<i.length;y++){let h=i[y],N=h?.from===f?h.to:h?.to===f?h.from:void 0,j=N===void 0?void 0:a.get(N);if(j&&j.group<s)return{order:y,col:j.col}}},$=0;for(;;){let f=r.members.filter(Y=>!a.has(Y));if(f.length===0)break;let y=f.map(Y=>({id:Y,anchor:L(Y)})).filter(Y=>Y.anchor!==void 0);y.sort((Y,Z)=>(Y.anchor?.order??0)-(Z.anchor?.order??0));let h=y[0]??{id:f[0],anchor:void 0},N=h.anchor?.col??0;$===0&&(u=N>=(o-1)/2?-1:1);let[j,I]=d(N,0)?[N,0]:v(N,0);b(h.id,j,I),w(h.id),$++}});let t=[...new Set([...a.values()].map(r=>r.col))].sort((r,s)=>r-s);for(let r of a.values())r.col=t.indexOf(r.col);return a}function Sr(e){let n=[...e.matchAll(/ /g)].map(i=>i.index);if(n.length===0)return[e];let o=n.reduce((i,a)=>Math.abs(a-e.length/2)<Math.abs(i-e.length/2)?a:i);return[e.slice(0,o),e.slice(o+1)]}function Mr(e){let{icon:n,nameY:o,line:i,inset:a}=g.region,t=Sr(e.name),r=Math.max(n,...t.map(l=>Q(l,M.regionName)),Q(e.note??"",M.regionNote)),s=o-a+(t.length-1)*i+(e.note?i:0)+g.gap/2;return{w:r,h:s,lines:t}}function hn(e,n,o,i){let{box:a,region:t,architecture:r,margin:s,gap:l}=g,c=et(e),d=Jt(e),v=Qe(e),b=Math.max(1,...[...o.values()].map(m=>m.col+1)),u=kt(e),w=new Map(e.boxes.map(m=>[m.id,Math.max(nt(e,m.id,!0),Pt(u.get(m.id),m.icon!==void 0,a.padX))])),L=Array.from({length:b},(m,T)=>Math.max(a.minW,...[...o].filter(([,P])=>P.col===T).map(([P])=>w.get(P)??a.minW))),$=Array.from({length:Math.max(0,b-1)},()=>r.columnGap);for(let{edge:m}of v){let T=o.get(m.from),P=o.get(m.to);if(!T||!P||m.label===void 0||T.group!==P.group||T.row!==P.row||Math.abs(T.col-P.col)!==1||bn(m.labelSide))continue;let k=Q(m.label,De(m.label))+g.label.padX*2+r.labelRoom*2,q=Math.min(T.col,P.col);k<=r.maxColumnGap&&($[q]=Math.max($[q]??0,k))}let f=n.map(m=>m.region?Mr(m.region):void 0),y=Math.max(0,...f.map(m=>m?m.w+t.inset*2:0)),h=[];for(let m=0;m<b;m++)h.push(m===0?s+(y>0?y:t.pad):h[m-1]+L[m-1]+$[m-1]);let N=m=>h[m]+L[m]/2,j=new Set(v.filter(({edge:m})=>m.from===m.to).map(({edge:m})=>m.from)),I=new Set([...j].flatMap(m=>{let T=o.get(m);return T?[`${T.group}:${T.row}`]:[]})),Y=(m,T)=>I.has(`${m}:${T}`)?Zt:0,Z=[],B=[],X=s;n.forEach((m,T)=>{let P=Math.max(1,...m.members.map(fe=>(o.get(fe)?.row??0)+1)),k=i[T],q=X+t.pad+k.top,W=[0];for(let fe=1;fe<P;fe++)W.push(W[fe-1]+a.h+r.rowGap+Y(T,fe-1));for(let fe of m.members){let qe=o.get(fe),Ce=e.boxes.find(Fe=>Fe.id===fe),ke=w.get(fe)??a.minW,Le=N(qe.col),Ie=q+W[qe.row];Z.push({id:fe,name:Ce?.name??fe,...Ce?.sub!==void 0?{sub:Ce.sub}:{},...Ce?.icon!==void 0?{icon:Ce.icon}:{},color:c.get(fe)??"slate",x:Le-ke/2,y:Ie,w:ke,h:a.h,cx:Le,cy:Ie+a.h/2})}let _=q+W[P-1]+a.h+Y(T,P-1),ve=f[T],Te=Math.max(_+t.pad+k.bottom-X,ve?ve.h+t.inset*2:0,m.region?t.minH:0);B.push({group:T,y:X,h:Te,rows:P}),X+=Te+t.gap});let ge=X-t.gap;for(let m of Z)St(m,u.get(m.id));let E=new Map(Z.map(m=>[m.id,m])),H=m=>B[o.get(m)?.group??0],U=(m,T,P)=>{for(let k=1;k<m.length;k++){let[q,W]=m[k-1],[_,ve]=m[k];if(Math.min(q,_)<=T.x+T.w+P&&Math.max(q,_)>=T.x-P&&Math.min(W,ve)<=T.y+T.h+P&&Math.max(W,ve)>=T.y-P)return!0}return!1},le=[...j].flatMap(m=>{let T=E.get(m);return T?[{x:T.x,y:T.y+T.h,w:T.w,h:Zt}]:[]}),R=m=>le.some(T=>U(m,T,0)),V=(m,T,P)=>Z.some(k=>k.id!==T&&k.id!==P&&U(m,k,g.label.search))||R(m),A=m=>{let T=E.get(m),P=H(m),k=o.get(m),q=T.y+T.h+(k?Y(k.group,k.row):0);return(k?.row??0)<P.rows-1?q+r.rowGap/2:Math.min(q+t.pad/2,P.y+P.h-g.edge.inset)},C=m=>{let T=E.get(m),P=H(m);return(o.get(m)?.row??0)>0?T.y-r.rowGap/2:Math.max(T.y-t.pad/2,P.y+g.edge.inset)},D=g.edge.inset,ne=(m,T)=>T?h[m]+L[m]+($[m]??r.columnGap)/2:h[m]-($[m-1]??r.columnGap)/2,te=(m,T)=>{let P=E.get(m),k=E.get(T);if(m===T)return Tt(P);let q=o.get(m),W=o.get(T);if(q.group===W.group&&q.row===W.row){let ke=k.cx>P.cx,Le=[[ke?P.x+P.w:P.x,P.cy],[ke?k.x-D:k.x+k.w+D,k.cy]];if(!V(Le,m,T))return Le;let Ie=A(m),Fe=[[P.cx,P.y+P.h],[P.cx,Ie],[k.cx,Ie],[k.cx,k.y+k.h+D]];if(!R(Fe))return Fe;let ct=C(m),pt=[[P.cx,P.y],[P.cx,ct],[k.cx,ct],[k.cx,k.y-D]];return R(pt)?Fe:pt}let _=k.cy>P.cy,ve=[P.cx,_?P.y+P.h:P.y],Te=[k.cx,_?k.y-D:k.y+k.h+D];if(q.col===W.col){let ke=[ve,Te];if(!V(ke,m,T))return ke;let Le=ne(q.col,!0);return[[P.x+P.w,P.cy],[Le,P.cy],[Le,k.cy],[k.x+k.w+D,k.cy]]}let fe=k.cx>P.cx,qe=_?A(m):C(m),Ce=[[ve,[P.cx,k.cy],[fe?k.x-D:k.x+k.w+D,k.cy]],[[fe?P.x+P.w:P.x,P.cy],[k.cx,P.cy],Te],[ve,[P.cx,qe],[k.cx,qe],Te]];if(j.has(m)||j.has(T)){let ke=ne(q.col,fe),Le=ne(W.col,!fe),Ie=[[fe?P.x+P.w:P.x,P.cy],[ke,P.cy]],Fe=[fe?k.x-D:k.x+k.w+D,k.cy];Ce.push([...Ie,[ke,k.cy],Fe],[...Ie,[ke,qe],[k.cx,qe],Te],[ve,[P.cx,qe],[Le,qe],[Le,k.cy],Fe],[...Ie,[ke,qe],[Le,qe],[Le,k.cy],Fe])}return Ce.find(ke=>!V(ke,m,T))??Ce[2]},re=v.map(({step:m,event:T,edge:P})=>({step:m,event:T,from:P.from,to:P.to,points:te(P.from,P.to),color:tt(P,c),carry:P.carry}));Mt(re,E,u);let Se=new Map;for(let m of re){if(m.points.length!==2||!re.some(_=>_.from===m.to&&_.to===m.from&&_.points.length===2))continue;let[P,k]=m.points,q=Math.abs(k[1]-P[1])<Math.abs(k[0]-P[0]),W=(m.from<m.to?1:-1)*g.edge.parallel;m.points=m.points.map(([_,ve])=>q?[_,ve+W]:[_+W,ve]),Se.set(m,q?W>0?"below":"above":W>0?"right":"left")}let oe=[];n.forEach((m,T)=>{let P=B[T],k=f[T];!m.region||!k||oe.push({id:m.region.id,lines:k.lines,...m.region.note!==void 0?{note:m.region.note}:{},...m.region.icon!==void 0?{icon:m.region.icon}:{},color:d.get(m.region.id)??"slate",x:s,y:P.y,w:0,h:P.h,header:{x:s+t.inset,y:P.y+t.inset,w:k.w,h:k.h}})});let he=(m,T,P)=>m.from===m.to?Lt(m.points):gt(m.points,T,P),xe=We(re,e.steps.length,he),Oe=[];for(let m of re){let T=e.steps[m.step]?.events[m.event];if(T?.type!=="edge"||T.label===void 0)continue;let P=[...xe].filter(([_])=>_<=m.step).map(([,_])=>Ue(_.point)),k=[...oe.map(_=>_.header),...Oe.filter(_=>_.step===m.step)],q=T.labelSide??Se.get(m),W=m.from===m.to?{side:"below",base:qt(m.points,Q(T.label,De(T.label))+g.label.padX*2)}:void 0;Oe.push(Je({step:m.step,event:m.event,text:T.label,points:m.points,color:m.color,...W??(q?{side:q}:{flip:!0})},{hard:Z,soft:k,touch:P}))}let we={kind:"architecture",width:0,height:0,regions:oe,boxes:Z,lifelines:[],edges:re,labels:Oe,actions:[],badges:[],paths:[],ends:[]},Ee=Oe.length>0?Math.max(0,s+g.label.soft-Math.min(...Oe.map(m=>m.x))):0;Ee>0&&it(we,Ee,0);let je=Math.max(...Z.map(m=>m.x+m.w+t.pad),...Oe.map(m=>m.x+m.w+g.label.soft),...re.flatMap(m=>m.points.map(T=>T[0]+t.pad))),ee=Math.max(je+s,st(e)+s*2);for(let m of oe)m.w=ee-s*2;let se=Math.max(ge,...Oe.map(m=>m.y+m.h)),F=ot(e,s,se+l,ee-s*2);we.width=ee,we.height=(F?F.y+F.h:se)+s,F&&(we.strip=F);let ce=We(re,e.steps.length,he);return we.badges=rt(e.steps.map((m,T)=>{let P=ce.get(T);return P?{step:T,x:P.point[0],y:P.point[1],color:P.edge.color}:at(m.events,T,we)})),we}function Or(e,n,o,i){let a=!1,t=g.label.soft;for(let r of e.labels){let s=e.edges.find(w=>w.step===r.step&&w.event===r.event),l=s&&o.get(s.from),c=s&&o.get(s.to);if(!l||!c||l.group!==c.group||!n[l.group]?.region)continue;let d=e.regions.find(w=>w.id===n[l.group]?.region?.id),v=i[l.group];if(!d||!v)continue;let b=d.y+t-r.y,u=r.y+r.h-(d.y+d.h-t);b>0&&(v.top+=b,a=!0),u>0&&(v.bottom+=u,a=!0)}return a}function xn(e){let{box:n,sequence:o,label:i,margin:a,gap:t}=g,r=et(e),s=e.sequence?.lifelines??[],l=[...s,...e.boxes.map(R=>R.id).filter(R=>!s.includes(R))],c=new Map(l.map((R,V)=>[R,V])),d=l.map(R=>nt(e,R,!1)),v=d.slice(1).map((R,V)=>d[V]/2+R/2+o.columnGap),b=[];for(let R of e.steps)for(let V of R.events){if(V.type!=="edge"||V.label===void 0)continue;let A=c.get(V.from)??0,C=c.get(V.to)??0,D=Q(V.label,De(V.label))+i.padX*2;A===C?A<v.length&&b.push({from:A,to:A+1,need:o.selfW+i.side+D+o.labelRoom}):b.push({from:Math.min(A,C),to:Math.max(A,C),need:D+o.labelRoom*2})}b.sort((R,V)=>R.to-R.from-(V.to-V.from));for(let{from:R,to:V,need:A}of b){let C=0;for(let ne=R;ne<V;ne++)C+=v[ne]??0;if(C>=A)continue;let D=(A-C)/(V-R);for(let ne=R;ne<V;ne++)v[ne]=(v[ne]??0)+D}let u=[];l.forEach((R,V)=>u.push(V===0?a+d[0]/2:u[V-1]+v[V-1]));let w=l.map((R,V)=>{let A=e.boxes.find(ne=>ne.id===R),C=d[V],D=u[V];return{id:R,name:A?.name??R,...A?.sub!==void 0?{sub:A.sub}:{},...A?.icon!==void 0?{icon:A.icon}:{},color:r.get(R)??"slate",x:D-C/2,y:a,w:C,h:n.h,cx:D,cy:a+n.h/2}}),L=a+n.h,$=[],f=[],y=[],h=L+o.firstRow,N=0,j=!0;e.steps.forEach((R,V)=>{R.events.forEach((A,C)=>{if(A.type!=="edge"&&A.type!=="action")return;let D,ne;if(A.type==="edge"){let te=A.labelSide??"above",re=A.from===A.to,Se=A.label!==void 0;D=Se&&te==="above"?o.labelOffset+i.h/2:t,ne=re?o.selfH+t:Se&&te==="below"?o.labelOffset+i.h/2:t}else D=g.action.h/2,ne=g.action.h/2;if(h=j?h+D:h+Math.max(o.minPitch,N+o.rowGap+D)+(C===0&&V>0?o.stepGap:0),j=!1,N=ne,A.type==="edge"){let te=u[c.get(A.from)??0],re=u[c.get(A.to)??0],Se=Math.sign(re-te)||1,oe=te===re?[[te,h],[te+o.selfW,h],[te+o.selfW,h+o.selfH],[te+g.edge.inset,h+o.selfH]]:[[te,h],[re-Se*g.edge.inset,h]],he=tt(A,r),xe={};if(A.carry.kind!=="none"){let Oe=g.slot.lifeline+Ye(A.carry)[0],[we,Ee]=oe,[je,ee]=oe.slice(-2),se=Math.sign(Ee[0]-we[0])||1,F=Math.sign(ee[0]-je[0])||-1;xe.wait=[te-se*Oe,we[1]],xe.settle=[re+F*Oe,ee[1]]}$.push({step:V,event:C,from:A.from,to:A.to,points:oe,color:he,carry:A.carry,...xe}),A.label!==void 0&&y.push({step:V,event:C,text:A.label,points:oe,color:he,...A.labelSide?{side:A.labelSide}:te===re?{side:"right"}:{},offset:o.labelOffset})}else{let te=u[c.get(A.box)??0],re=Q(A.label,M.action)+g.action.padX*2;f.push({step:V,event:C,box:A.box,text:A.label,color:r.get(A.box)??"slate",x:te+g.badge.r+4,y:h-g.action.h/2,w:re,h:g.action.h})}})});let I=(j?L:h+N)+o.tail,Y=l.map((R,V)=>({id:R,x:u[V],y1:L,y2:I})),Z=We($,e.steps.length),B=[];for(let R of y){let V=[...Z].filter(([C])=>C<=R.step).map(([,C])=>Ue(C.point)),A=[...B.filter(C=>C.step===R.step),...f];B.push(Je(R,{hard:w,soft:A,touch:V}))}let X={kind:"sequence",width:0,height:0,regions:[],boxes:w,lifelines:Y,edges:$,labels:B,actions:f,badges:[],paths:[],ends:[]},ge=[...w.map(R=>R.x),...B.map(R=>R.x),...f.map(R=>R.x)],E=Math.max(0,a-Math.min(...ge));E>0&&it(X,E,0);let H=[...w.map(R=>R.x+R.w),...B.map(R=>R.x+R.w),...f.map(R=>R.x+R.w),...$.flatMap(R=>R.points.map(V=>V[0]))],U=Math.max(Math.max(...H)+a,st(e)+a*2),le=ot(e,a,I+t,U-a*2);return X.width=U,X.height=(le?le.y+le.h:I)+a,le&&(X.strip=le),X.badges=Er(e,X),X}function Er(e,n){let o=We(n.edges,e.steps.length),i=e.steps.map((a,t)=>{let r=o.get(t);if(r)return{step:t,x:r.point[0],y:r.point[1],color:r.edge.color};let s=n.actions.find(c=>c.step===t),l=s&&n.lifelines.find(c=>c.id===s.box);return s&&l?{step:t,x:l.x,y:s.y+s.h/2,color:s.color}:at(a.events,t,n)});return rt(i)}var Rt=e=>Object.keys(e),Rs=Rt({sequence:!0,architecture:!0,state:!0}),lt=["start","finish"];var As=Rt({coin:!0,none:!0}),js=Rt({fixed:!0,follow:!0}),Cs=Rt({above:!0,below:!0,left:!0,right:!0});var wn=e=>lt.includes(e);function Tr(e){let n=[],o=i=>{!wn(i)&&!n.includes(i)&&n.push(i)};for(let{edge:i}of Qe(e))o(i.from),o(i.to);return n}var Lr=(e,n)=>e.from===n.from&&e.to===n.to;function vn(e,n){let{box:o,state:i,margin:a,gap:t}=g,r=g.edge.inset,s=Xe[n],l=et(e),c=Qe(e),d=Tr(e),v=e.boxes.map(p=>p.id).filter(p=>!d.includes(p)),b=(e.state?.paths??[]).filter(p=>!c.some(({edge:x})=>Lr(x,p))),u=[...c.map(({edge:p})=>p),...b],w=i.ghost,L=p=>{let x=e.boxes.find(S=>S.id===p);return w.pad*2+o.icon+w.gap+Math.max(Q(x?.name??p,M.boxName),Q(x?.sub??"",M.boxSub))},$=kt(e),f=Math.max(o.padX,i.done.inset+i.done.r+g.slot.clear),y=new Map(e.boxes.map(p=>[p.id,v.includes(p.id)?L(p.id):Math.max(nt(e,p.id,!0),Pt($.get(p.id),p.icon!==void 0,f))])),h=Math.max(1,Math.min(i.columns,d.length)),N=Math.max(1,Math.ceil(d.length/i.columns)),j=new Map(d.map((p,x)=>{let S=Math.floor(x/i.columns),K=x%i.columns;return[p,{row:S,col:S%2===0?K:h-1-K}]})),I=Array.from({length:h},(p,x)=>Math.max(o.minW,...d.filter(S=>j.get(S)?.col===x).map(S=>y.get(S)??o.minW))),Y=Array.from({length:Math.max(0,h-1)},()=>i.columnGap);for(let p of u){let x=j.get(p.from),S=j.get(p.to);if(!x||!S||p.label===void 0||x.row!==S.row||Math.abs(x.col-S.col)!==1)continue;let K=Math.min(x.col,S.col);Y[K]=Math.max(Y[K]??0,Q(p.label,De(p.label))+g.label.padX*2+i.labelRoom*2)}let Z=[];for(let p=0;p<h;p++)Z.push(p===0?a:Z[p-1]+I[p-1]+Y[p-1]);let B=p=>Z[p]+I[p]/2,X=p=>v.includes(p),ge=new Set(b.filter(p=>X(p.to)&&!X(p.from)&&!wn(p.from)).map(p=>p.from)),E=[s.sideNote,...ge.size>0?[s.sideFrom(ge.size)]:[]],H=Math.max(Q(s.side,M.regionName),...E.map(p=>Q(p,M.regionNote))),U=i.side.pad*2+Math.max(w.h,M.regionName.size+g.region.line*E.length+i.side.pad/4),le=u.some(p=>p.from==="start"),R=a+(v.length>0?U+i.side.gap:le?i.start+i.drop:0),V=p=>R+p*(o.h+i.rowGap),A=(p,x,S,K)=>{let G=e.boxes.find(pe=>pe.id===p),z=y.get(p)??o.minW,Re=K?w.h:o.h;return{id:p,name:G?.name??p,...G?.sub!==void 0?{sub:G.sub}:{},...G?.icon!==void 0?{icon:G.icon}:{},color:l.get(p)??"slate",x:x-z/2,y:S,w:z,h:Re,cx:x,cy:S+Re/2,...K?{ghost:!0}:{}}},C=d.map(p=>{let x=j.get(p);return A(p,B(x.col),V(x.row),!1)});for(let p of C)St(p,$.get(p.id),f);let D=new Map(C.map(p=>[p.id,p])),ne=p=>C.some(x=>x!==p&&Math.abs(x.cx-p.cx)<.5&&x.y>p.y),te=[],re=C[0],Se=Math.max(...C.map(p=>p.x+p.w)),oe,he=a+U+i.side.lane;if(v.length>0){let p=pe=>b.filter(Me=>Me.to===pe).flatMap(Me=>D.get(Me.from)??[]),x=v.flatMap(p),S=Math.max(a,Math.min(...x.length>0?x.map(pe=>pe.x):[a+i.side.pad])-i.side.pad),K=S+i.side.pad+H+t*2,G=v.map(pe=>{let Me=p(pe);return{id:pe,cx:Me.length>0?Me.reduce((Ge,Ke)=>Ge+Ke.cx,0)/Me.length:K}});G.sort((pe,Me)=>pe.cx-Me.cx);let z=S;for(let{id:pe,cx:Me}of G){let Ge=y.get(pe)??o.minW,Ke=Math.max(Me-Ge/2,K),Ve=A(pe,Ke+Ge/2,a+(U-w.h)/2,!0);C.push(Ve),D.set(pe,Ve);let cn=b.some(pn=>pn.from===pe&&pn.to==="finish");cn&&te.push({kind:"finish",x:Ve.x+Ve.w+i.beside,y:Ve.cy,r:i.end.r,ghost:!0,text:"",box:pe}),z=cn?Ve.x+Ve.w+i.beside+i.end.r:Ve.x+Ve.w,K=z+t*2}let Re=Math.max(z+i.side.pad,Se);oe={x:S,y:a,w:Re-S,h:U,title:s.side,notes:E}}if(re&&le){let p=re.cx+i.start+i.text+Q(s.start,M.regionNote)+t,x=oe&&p<oe.x?oe.y+i.side.pad+i.start:re.y-i.drop;te.unshift({kind:"start",x:re.cx,y:x,r:i.start,ghost:!1,text:s.start})}for(let p of C.filter(x=>!x.ghost&&u.some(S=>S.from===x.id&&S.to==="finish")))te.push(ne(p)?{kind:"finish",x:p.x+p.w+i.beside,y:p.cy,r:i.end.r,ghost:!1,text:s.end,box:p.id}:{kind:"finish",x:p.cx,y:p.y+p.h+i.below,r:i.end.r,ghost:!1,text:s.end,box:p.id});let xe=(p,x)=>{let S=j.get(p.id),K=j.get(x.id);if(!S||!K)return[[p.cx,p.y+p.h],[x.cx,x.y-r]];if(S.row===K.row&&Math.abs(S.col-K.col)===1)return x.cx>p.cx?[[p.x+p.w,p.cy],[x.x-r,x.cy]]:[[p.x,p.cy],[x.x+x.w+r,x.cy]];if(S.row===K.row){let z=p.y+p.h+i.rowGap/4;return[[p.cx,p.y+p.h],[p.cx,z],[x.cx,z],[x.cx,x.y+x.h+r]]}if(K.row>S.row){if(Math.abs(p.cx-x.cx)<.5)return[[p.cx,p.y+p.h],[x.cx,x.y-r]];let z=p.y+p.h+i.rowGap/2;return[[p.cx,p.y+p.h],[p.cx,z],[x.cx,z],[x.cx,x.y-r]]}if(Math.abs(p.cx-x.cx)<.5)return[[p.cx,p.y],[x.cx,x.y+x.h+r]];let G=x.y+x.h+i.rowGap/2;return[[p.cx,p.y],[p.cx,G],[x.cx,G],[x.cx,x.y+x.h+r]]},Oe=(p,x)=>{let S=b.filter(G=>G.to===x.id).flatMap(G=>D.get(G.from)??[]).sort((G,z)=>G.cx-z.cx),K=S.findIndex(G=>G.id===p);return S.length<=1?Math.min(Math.max(S[0]?.cx??x.cx,x.x+i.side.entry),x.x+x.w-i.side.entry):x.x+i.side.entry+(x.w-i.side.entry*2)*Math.max(0,K)/(S.length-1)},we=p=>le&&p===re?p.cx+i.side.entry:p.cx,Ee=p=>te.find(x=>x.kind==="finish"&&x.box===p),je=(p,x)=>{if(p==="start"){let G=te.find(Re=>Re.kind==="start"),z=D.get(x);return!G||!z?[]:[[G.x,G.y+G.r],[z.cx,z.y-r]]}let S=D.get(p);if(!S)return[];if(x==="finish"){let G=Ee(p);return G?Math.abs(G.x-S.cx)<.5?[[S.cx,S.y+S.h],[S.cx,G.y-G.r-r]]:[[S.x+S.w,S.cy],[G.x-G.r-r,S.cy]]:[]}let K=D.get(x);if(!K)return[];if(p===x)return Tt(S);if(K.ghost&&!S.ghost){let G=we(S),z=Oe(p,K);return Math.abs(G-z)<.5?[[G,S.y],[z,K.y+K.h+r]]:[[G,S.y],[G,he],[z,he],[z,K.y+K.h+r]]}return S.ghost&&K.ghost?[[S.x+S.w,S.cy],[K.x-r,K.cy]]:S.ghost?[[S.cx,S.y+S.h],[S.cx,he],[K.cx,he],[K.cx,K.y-r]]:xe(S,K)},ee=p=>{let x=p.to==="finish"?Ee(p.from):void 0;if(!x)return;let S=D.get(p.from);return S&&Math.abs(x.x-S.cx)<.5?[x.x-x.r-t-Ye(p.carry)[0],x.y]:[x.x,x.y+x.r+t+g.carrier.tagH/2]},se=p=>{let x=p.from==="start"?te.find(S=>S.kind==="start"):void 0;return x?[x.x-x.r-g.slot.mark-Ye(p.carry)[0],x.y]:void 0},F=c.map(({step:p,event:x,edge:S})=>{let K=ee(S),G=S.carry.kind==="none"?void 0:se(S);return{step:p,event:x,from:S.from,to:S.to,points:je(S.from,S.to),color:qr(S,l),carry:S.carry,...K?{settle:K}:{},...G?{wait:G}:{}}});Mt(F,D,$);let ce=new Map;for(let p of F){if(p.points.length!==2||!F.some(z=>z.from===p.to&&z.to===p.from&&z.points.length===2))continue;let[x,S]=p.points,K=Math.abs(S[1]-x[1])<Math.abs(S[0]-x[0]),G=(p.from<p.to?1:-1)*g.edge.parallel;p.points=p.points.map(([z,Re])=>K?[z,Re+G]:[z+G,Re]),ce.set(p,K?G>0?"below":"above":G>0?"right":"left")}let m=b.map(p=>({from:p.from,to:p.to,points:je(p.from,p.to)})),T=(p,x,S)=>p.from===p.to?Lt(p.points):gt(p.points,x,S),P=[],k=te.flatMap(p=>p.text===""?[]:[Ze(p.text,...Nt(p),M.regionNote)]),q=[...We(F,e.steps.length,T).values()].map(p=>Ue(p.point)),W=[...oe?[{x:oe.x,y:oe.y,w:i.side.pad+H,h:oe.h}]:[],...k],_=p=>[...F.map(x=>x.points),...m.map(x=>x.points)].filter(x=>x!==p);for(let p of F){let x=e.steps[p.step]?.events[p.event];if(x?.type!=="edge"||x.label===void 0)continue;let S=p.from===p.to,K=ut(p),G=P.filter(Ge=>Ge.text===x.label&&F.some(Ke=>Ke.step===Ge.step&&Ke.event===Ge.event&&ut(Ke)===K)),z=G[G.length-1];if(z){z.until=p.step,P.push({x:z.x,y:z.y,w:z.w,h:z.h,step:p.step,event:p.event,text:z.text,family:z.family,color:p.color});continue}let Re=Q(x.label,De(x.label))+g.label.padX*2,pe=S?{side:"below",base:qt(p.points,Re)}:{},Me=x.labelSide??(p.to==="finish"?"left":ce.get(p));P.push(Je({step:p.step,event:p.event,text:x.label,points:p.points,color:p.color,...Me?{side:Me}:S?{}:{flip:!0},...pe},{hard:C,soft:[...W,...P],touch:q,lines:_(p.points)}))}let ve=[];b.forEach((p,x)=>{let S=m[x];if(p.label===void 0||S.points.length===0)return;let K=De(p.label),G=D.get(p.to)?.ghost===!0&&D.get(p.from)?.ghost!==!0,z=S.points[0][0],Re=G?{side:"below",base:{x:z+g.label.soft,y:he+g.label.soft},slide:Math.max(...S.points.map(([Me])=>Math.abs(Me-z)))}:{},pe=Je({step:-1,event:x,text:p.label,points:S.points,color:"slate",...Re},{hard:C,soft:[...W,...P,...ve],touch:q,lines:_(S.points)});ve.push(pe),S.label={x:pe.x,y:pe.y,w:pe.w,h:pe.h,text:p.label,family:K.family}});let Te={kind:"state",width:0,height:0,regions:[],boxes:C,lifelines:[],edges:F,labels:P,actions:[],badges:[],paths:m,ends:te,...oe?{side:oe}:{}},fe=[...C.map(p=>p.x),...P.map(p=>p.x),...m.flatMap(p=>p.label?[p.label.x]:[])],qe=[...P.map(p=>p.y),...m.flatMap(p=>p.label?[p.label.y]:[])],Ce=Math.max(0,a-Math.min(...fe)),ke=qe.length>0?Math.max(0,a-Math.min(...qe)):0;(Ce>0||ke>0)&&it(Te,Ce,ke);let Le=p=>p.x+(p.text===""?p.r:i.text+Q(p.text,M.regionNote)),Ie=[...C.map(p=>p.x+p.w),...P.map(p=>p.x+p.w),...te.map(Le),...F.flatMap(p=>p.points.map(x=>x[0])),...m.flatMap(p=>[...p.points.map(x=>x[0]),...p.label?[p.label.x+p.label.w]:[]]),...oe?[oe.x+oe.w]:[]],Fe=[...C.map(p=>p.y+p.h),...P.map(p=>p.y+p.h),...te.map(p=>p.y+p.r),...F.flatMap(p=>p.points.map(x=>x[1]))],ct={title:s.trail,states:d.map(p=>({box:p,color:l.get(p)??"slate"}))},pt=Math.max(Math.max(...Ie)+a,st(e,ct)+a*2),ln=Math.max(...Fe,V(N-1)+o.h),dt=ot(e,a,ln+t,pt-a*2,ct);Te.width=pt,Te.height=(dt?dt.y+dt.h:ln)+a,dt&&(Te.strip=dt);let ir=We(F,e.steps.length,T);return Te.badges=rt(e.steps.map((p,x)=>{let S=ir.get(x);return S?{step:x,x:S.point[0],y:S.point[1],color:S.edge.color}:at(p.events,x,Te)})),Te}function qr(e,n){return e.carry.kind==="coin"?tt(e,n):n.get(e.to==="finish"?e.from:e.to)??"slate"}var Nr={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"},Rr={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"},$n=(e,n)=>`${e} ${n}${e===1?"":"s"}`,Ar={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=>Nr[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`,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`},jr={additionalProperties:e=>`The ${e} field is not allowed`,required:e=>`The ${e} field is required`,enum:e=>`Use one of ${e.join(" / ")}`,type:e=>Rr[e]??`Use ${e}`,minLength:e=>`Write at least ${$n(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 ${$n(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`,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`},At={ja:Ar,en:jr};function Cr(e){let n=0;for(let o of e)n++;return n}var en=Pn,Qt={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",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"]},title:{$ref:"#/definitions/text"},view:{description:"\u898B\u305B\u65B9\u3002\u66F8\u304B\u306A\u3051\u308C\u3070\u5B57\u306E\u5927\u304D\u3055\u3067\u9078\u3076\u3002fixed \u306F\u5168\u4F53\u3092\u6B62\u3081\u3066\u4E2D\u3060\u3051\u52D5\u304B\u3057\u3001follow \u306F\u5BC4\u3063\u3066\u52D5\u304B\u3057\u5168\u4F53\u56F3\u3067\u4ECA\u3069\u3053\u304B\u3092\u793A\u3059",enum:["fixed","follow"]},regions:{type:"array",items:{$ref:"#/definitions/region"}},boxes:{type:"array",minItems:1,items:{$ref:"#/definitions/box"}},strip:{$ref:"#/definitions/strip"},steps:{type:"array",minItems:1,items:{$ref:"#/definitions/step"}},sequence:{$ref:"#/definitions/sequence"},state:{$ref:"#/definitions/state"}},if:{required:["kind"],properties:{kind:{const:"sequence"}}},then:{required:["sequence"],not:{required:["state"]}},else:{not:{required:["sequence"]},if:{required:["kind"],properties:{kind:{const:"state"}}},then:{properties:{boxes:{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"]}}}}}}},else:{not:{required:["state"]}}},definitions:{text:{type:"string",minLength:1},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:"\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"}}}},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 Dr=Object.prototype.hasOwnProperty,ye=Cr;var kn={enum:["blue","amber","green","violet","rose","slate","coin"]},_e=new RegExp("^[^\\s\\[\\]\u300C\u300D=:]+$","u");function jt(e,{instancePath:n="",parentData:o,parentDataProperty:i,rootData:a=e}={}){let t=null,r=0;if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.id===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'"};t===null?t=[s]:t.push(s),r++}if(e.name===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"name"},message:"must have required property 'name'"};t===null?t=[s]:t.push(s),r++}for(let s in e)if(!(s==="id"||s==="name"||s==="note"||s==="color"||s==="icon")){let l={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};t===null?t=[l]:t.push(l),r++}if(e.id!==void 0){let s=e.id;if(typeof s=="string"){if(!_e.test(s)){let l={instancePath:n+"/id",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};t===null?t=[l]:t.push(l),r++}}else{let l={instancePath:n+"/id",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[l]:t.push(l),r++}}if(e.name!==void 0){let s=e.name;if(typeof s=="string"){if(ye(s)<1){let l={instancePath:n+"/name",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[l]:t.push(l),r++}}else{let l={instancePath:n+"/name",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[l]:t.push(l),r++}}if(e.note!==void 0){let s=e.note;if(typeof s=="string"){if(ye(s)<1){let l={instancePath:n+"/note",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[l]:t.push(l),r++}}else{let l={instancePath:n+"/note",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[l]:t.push(l),r++}}if(e.color!==void 0){let s=e.color;if(!(s==="blue"||s==="amber"||s==="green"||s==="violet"||s==="rose"||s==="slate"||s==="coin")){let l={instancePath:n+"/color",schemaPath:"#/definitions/color/enum",keyword:"enum",params:{allowedValues:kn.enum},message:"must be equal to one of the allowed values"};t===null?t=[l]:t.push(l),r++}}if(e.icon!==void 0){let s=e.icon;if(typeof s=="string"){if(ye(s)<1){let l={instancePath:n+"/icon",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[l]:t.push(l),r++}}else{let l={instancePath:n+"/icon",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[l]:t.push(l),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[s]:t.push(s),r++}return jt.errors=t,r===0}function Ct(e,{instancePath:n="",parentData:o,parentDataProperty:i,rootData:a=e}={}){let t=null,r=0;if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.id===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'"};t===null?t=[s]:t.push(s),r++}if(e.name===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"name"},message:"must have required property 'name'"};t===null?t=[s]:t.push(s),r++}for(let s in e)if(!(s==="id"||s==="name"||s==="sub"||s==="color"||s==="icon"||s==="region")){let l={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};t===null?t=[l]:t.push(l),r++}if(e.id!==void 0){let s=e.id;if(typeof s=="string"){if(!_e.test(s)){let l={instancePath:n+"/id",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};t===null?t=[l]:t.push(l),r++}}else{let l={instancePath:n+"/id",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[l]:t.push(l),r++}}if(e.name!==void 0){let s=e.name;if(typeof s=="string"){if(ye(s)<1){let l={instancePath:n+"/name",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[l]:t.push(l),r++}}else{let l={instancePath:n+"/name",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[l]:t.push(l),r++}}if(e.sub!==void 0){let s=e.sub;if(typeof s=="string"){if(ye(s)<1){let l={instancePath:n+"/sub",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[l]:t.push(l),r++}}else{let l={instancePath:n+"/sub",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[l]:t.push(l),r++}}if(e.color!==void 0){let s=e.color;if(!(s==="blue"||s==="amber"||s==="green"||s==="violet"||s==="rose"||s==="slate"||s==="coin")){let l={instancePath:n+"/color",schemaPath:"#/definitions/color/enum",keyword:"enum",params:{allowedValues:kn.enum},message:"must be equal to one of the allowed values"};t===null?t=[l]:t.push(l),r++}}if(e.icon!==void 0){let s=e.icon;if(typeof s=="string"){if(ye(s)<1){let l={instancePath:n+"/icon",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[l]:t.push(l),r++}}else{let l={instancePath:n+"/icon",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[l]:t.push(l),r++}}if(e.region!==void 0){let s=e.region;if(typeof s=="string"){if(!_e.test(s)){let l={instancePath:n+"/region",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};t===null?t=[l]:t.push(l),r++}}else{let l={instancePath:n+"/region",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[l]:t.push(l),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[s]:t.push(s),r++}return Ct.errors=t,r===0}function Dt(e,{instancePath:n="",parentData:o,parentDataProperty:i,rootData:a=e}={}){let t=null,r=0;if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.title===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"title"},message:"must have required property 'title'"};t===null?t=[s]:t.push(s),r++}if(e.fields===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"fields"},message:"must have required property 'fields'"};t===null?t=[s]:t.push(s),r++}for(let s in e)if(!(s==="title"||s==="fields")){let l={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};t===null?t=[l]:t.push(l),r++}if(e.title!==void 0){let s=e.title;if(typeof s=="string"){if(ye(s)<1){let l={instancePath:n+"/title",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[l]:t.push(l),r++}}else{let l={instancePath:n+"/title",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[l]:t.push(l),r++}}if(e.fields!==void 0){let s=e.fields;if(Array.isArray(s)){if(s.length<1){let c={instancePath:n+"/fields",schemaPath:"#/properties/fields/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};t===null?t=[c]:t.push(c),r++}let l=s.length;for(let c=0;c<l;c++){let d=s[c];if(typeof d=="string"){if(ye(d)<1){let v={instancePath:n+"/fields/"+c,schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[v]:t.push(v),r++}}else{let v={instancePath:n+"/fields/"+c,schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[v]:t.push(v),r++}}}else{let l={instancePath:n+"/fields",schemaPath:"#/properties/fields/type",keyword:"type",params:{type:"array"},message:"must be array"};t===null?t=[l]:t.push(l),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[s]:t.push(s),r++}return Dt.errors=t,r===0}var Ir={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:"\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"}}}]},Fr={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 It(e,{instancePath:n="",parentData:o,parentDataProperty:i,rootData:a=e}={}){let t=null,r=0,s=r,l=!0,c=r;if(e&&typeof e=="object"&&!Array.isArray(e)){let u;if(e.kind===void 0&&(u="kind")){let w={};t===null?t=[w]:t.push(w),r++}else if(e.kind!==void 0&&e.kind!=="tag"){let w={};t===null?t=[w]:t.push(w),r++}}var d=c===r;r=s,t!==null&&(s?t.length=s:t=null);let v;if(d){let u=r;if(e&&typeof e=="object"&&!Array.isArray(e)&&e.text===void 0){let L={instancePath:n,schemaPath:"#/then/required",keyword:"required",params:{missingProperty:"text"},message:"must have required property 'text'"};t===null?t=[L]:t.push(L),r++}var d=u===r;l=d,v="then"}else{let u=r,w=r,L=r;if(e&&typeof e=="object"&&!Array.isArray(e)){let f;if(e.text===void 0&&(f="text")){let y={};t===null?t=[y]:t.push(y),r++}}var b=L===r;if(b){let f={instancePath:n,schemaPath:"#/else/not",keyword:"not",params:{},message:"must NOT be valid"};t===null?t=[f]:t.push(f),r++}else r=w,t!==null&&(w?t.length=w:t=null);var d=u===r;l=d,v="else"}if(!l){let u={instancePath:n,schemaPath:"#/if",keyword:"if",params:{failingKeyword:v},message:'must match "'+v+'" schema'};t===null?t=[u]:t.push(u),r++}if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.kind===void 0){let u={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"kind"},message:"must have required property 'kind'"};t===null?t=[u]:t.push(u),r++}for(let u in e)if(!(u==="kind"||u==="text")){let w={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:u},message:"must NOT have additional properties"};t===null?t=[w]:t.push(w),r++}if(e.kind!==void 0){let u=e.kind;if(!(u==="envelope"||u==="tag"||u==="coin"||u==="none")){let w={instancePath:n+"/kind",schemaPath:"#/properties/kind/enum",keyword:"enum",params:{allowedValues:Fr.properties.kind.enum},message:"must be equal to one of the allowed values"};t===null?t=[w]:t.push(w),r++}}if(e.text!==void 0){let u=e.text;if(typeof u=="string"){if(ye(u)<1){let w={instancePath:n+"/text",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[w]:t.push(w),r++}}else{let w={instancePath:n+"/text",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[w]:t.push(w),r++}}}else{let u={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[u]:t.push(u),r++}return It.errors=t,r===0}function Ft(e,{instancePath:n="",parentData:o,parentDataProperty:i,rootData:a=e}={}){let t=null,r=0;if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.type===void 0){let c={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};t===null?t=[c]:t.push(c),r++}let l=e.type;if(typeof l=="string")if(l==="edge")if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.type===void 0){let c={instancePath:n,schemaPath:"#/oneOf/0/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};t===null?t=[c]:t.push(c),r++}if(e.from===void 0){let c={instancePath:n,schemaPath:"#/oneOf/0/required",keyword:"required",params:{missingProperty:"from"},message:"must have required property 'from'"};t===null?t=[c]:t.push(c),r++}if(e.to===void 0){let c={instancePath:n,schemaPath:"#/oneOf/0/required",keyword:"required",params:{missingProperty:"to"},message:"must have required property 'to'"};t===null?t=[c]:t.push(c),r++}if(e.carry===void 0){let c={instancePath:n,schemaPath:"#/oneOf/0/required",keyword:"required",params:{missingProperty:"carry"},message:"must have required property 'carry'"};t===null?t=[c]:t.push(c),r++}for(let c in e)if(!(c==="type"||c==="from"||c==="to"||c==="label"||c==="carry"||c==="labelSide")){let d={instancePath:n,schemaPath:"#/oneOf/0/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:c},message:"must NOT have additional properties"};t===null?t=[d]:t.push(d),r++}if(e.type!==void 0&&e.type!=="edge"){let c={instancePath:n+"/type",schemaPath:"#/oneOf/0/properties/type/const",keyword:"const",params:{allowedValue:"edge"},message:"must be equal to constant"};t===null?t=[c]:t.push(c),r++}if(e.from!==void 0){let c=e.from;if(typeof c=="string"){if(!_e.test(c)){let d={instancePath:n+"/from",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};t===null?t=[d]:t.push(d),r++}}else{let d={instancePath:n+"/from",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[d]:t.push(d),r++}}if(e.to!==void 0){let c=e.to;if(typeof c=="string"){if(!_e.test(c)){let d={instancePath:n+"/to",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};t===null?t=[d]:t.push(d),r++}}else{let d={instancePath:n+"/to",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[d]:t.push(d),r++}}if(e.label!==void 0){let c=e.label;if(typeof c=="string"){if(ye(c)<1){let d={instancePath:n+"/label",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[d]:t.push(d),r++}}else{let d={instancePath:n+"/label",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[d]:t.push(d),r++}}if(e.carry!==void 0&&(It(e.carry,{instancePath:n+"/carry",parentData:e,parentDataProperty:"carry",rootData:a})||(t=t===null?It.errors:t.concat(It.errors),r=t.length)),e.labelSide!==void 0){let c=e.labelSide;if(!(c==="above"||c==="below"||c==="left"||c==="right")){let d={instancePath:n+"/labelSide",schemaPath:"#/oneOf/0/properties/labelSide/enum",keyword:"enum",params:{allowedValues:Ir.oneOf[0].properties.labelSide.enum},message:"must be equal to one of the allowed values"};t===null?t=[d]:t.push(d),r++}}}else{let c={instancePath:n,schemaPath:"#/oneOf/0/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[c]:t.push(c),r++}else if(l==="action")if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.type===void 0){let c={instancePath:n,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};t===null?t=[c]:t.push(c),r++}if(e.box===void 0){let c={instancePath:n,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty:"box"},message:"must have required property 'box'"};t===null?t=[c]:t.push(c),r++}if(e.label===void 0){let c={instancePath:n,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty:"label"},message:"must have required property 'label'"};t===null?t=[c]:t.push(c),r++}for(let c in e)if(!(c==="type"||c==="box"||c==="label")){let d={instancePath:n,schemaPath:"#/oneOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:c},message:"must NOT have additional properties"};t===null?t=[d]:t.push(d),r++}if(e.type!==void 0&&e.type!=="action"){let c={instancePath:n+"/type",schemaPath:"#/oneOf/1/properties/type/const",keyword:"const",params:{allowedValue:"action"},message:"must be equal to constant"};t===null?t=[c]:t.push(c),r++}if(e.box!==void 0){let c=e.box;if(typeof c=="string"){if(!_e.test(c)){let d={instancePath:n+"/box",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};t===null?t=[d]:t.push(d),r++}}else{let d={instancePath:n+"/box",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[d]:t.push(d),r++}}if(e.label!==void 0){let c=e.label;if(typeof c=="string"){if(ye(c)<1){let d={instancePath:n+"/label",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[d]:t.push(d),r++}}else{let d={instancePath:n+"/label",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[d]:t.push(d),r++}}}else{let c={instancePath:n,schemaPath:"#/oneOf/1/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[c]:t.push(c),r++}else if(l==="swap")if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.type===void 0){let c={instancePath:n,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};t===null?t=[c]:t.push(c),r++}if(e.box===void 0){let c={instancePath:n,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty:"box"},message:"must have required property 'box'"};t===null?t=[c]:t.push(c),r++}if(e.text===void 0){let c={instancePath:n,schemaPath:"#/oneOf/2/required",keyword:"required",params:{missingProperty:"text"},message:"must have required property 'text'"};t===null?t=[c]:t.push(c),r++}for(let c in e)if(!(c==="type"||c==="box"||c==="text")){let d={instancePath:n,schemaPath:"#/oneOf/2/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:c},message:"must NOT have additional properties"};t===null?t=[d]:t.push(d),r++}if(e.type!==void 0&&e.type!=="swap"){let c={instancePath:n+"/type",schemaPath:"#/oneOf/2/properties/type/const",keyword:"const",params:{allowedValue:"swap"},message:"must be equal to constant"};t===null?t=[c]:t.push(c),r++}if(e.box!==void 0){let c=e.box;if(typeof c=="string"){if(!_e.test(c)){let d={instancePath:n+"/box",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};t===null?t=[d]:t.push(d),r++}}else{let d={instancePath:n+"/box",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[d]:t.push(d),r++}}if(e.text!==void 0){let c=e.text;if(typeof c=="string"){if(ye(c)<1){let d={instancePath:n+"/text",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[d]:t.push(d),r++}}else{let d={instancePath:n+"/text",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[d]:t.push(d),r++}}}else{let c={instancePath:n,schemaPath:"#/oneOf/2/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[c]:t.push(c),r++}else if(l==="strip"){let c=r,d=!1,v=r;if(e&&typeof e=="object"&&!Array.isArray(e)&&e.value===void 0){let b={instancePath:n,schemaPath:"#/oneOf/3/anyOf/0/required",keyword:"required",params:{missingProperty:"value"},message:"must have required property 'value'"};t===null?t=[b]:t.push(b),r++}var s=v===r;if(d=d||s,!d){let b=r;if(e&&typeof e=="object"&&!Array.isArray(e)&&e.tag===void 0){let w={instancePath:n,schemaPath:"#/oneOf/3/anyOf/1/required",keyword:"required",params:{missingProperty:"tag"},message:"must have required property 'tag'"};t===null?t=[w]:t.push(w),r++}var s=b===r;d=d||s}if(d)r=c,t!==null&&(c?t.length=c:t=null);else{let b={instancePath:n,schemaPath:"#/oneOf/3/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};t===null?t=[b]:t.push(b),r++}if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.type===void 0){let b={instancePath:n,schemaPath:"#/oneOf/3/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};t===null?t=[b]:t.push(b),r++}if(e.field===void 0){let b={instancePath:n,schemaPath:"#/oneOf/3/required",keyword:"required",params:{missingProperty:"field"},message:"must have required property 'field'"};t===null?t=[b]:t.push(b),r++}for(let b in e)if(!(b==="type"||b==="field"||b==="value"||b==="tag")){let u={instancePath:n,schemaPath:"#/oneOf/3/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:b},message:"must NOT have additional properties"};t===null?t=[u]:t.push(u),r++}if(e.type!==void 0&&e.type!=="strip"){let b={instancePath:n+"/type",schemaPath:"#/oneOf/3/properties/type/const",keyword:"const",params:{allowedValue:"strip"},message:"must be equal to constant"};t===null?t=[b]:t.push(b),r++}if(e.field!==void 0){let b=e.field;if(typeof b=="string"){if(ye(b)<1){let u={instancePath:n+"/field",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[u]:t.push(u),r++}}else{let u={instancePath:n+"/field",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[u]:t.push(u),r++}}if(e.value!==void 0){let b=e.value;if(typeof b=="string"){if(ye(b)<1){let u={instancePath:n+"/value",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[u]:t.push(u),r++}}else{let u={instancePath:n+"/value",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[u]:t.push(u),r++}}if(e.tag!==void 0){let b=e.tag;if(typeof b=="string"){if(ye(b)<1){let u={instancePath:n+"/tag",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[u]:t.push(u),r++}}else{let u={instancePath:n+"/tag",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[u]:t.push(u),r++}}}else{let b={instancePath:n,schemaPath:"#/oneOf/3/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[b]:t.push(b),r++}}else{let c={instancePath:n,schemaPath:"#/discriminator",keyword:"discriminator",params:{error:"mapping",tag:"type",tagValue:l},message:'value of tag "type" must be in oneOf'};t===null?t=[c]:t.push(c),r++}else{let c={instancePath:n,schemaPath:"#/discriminator",keyword:"discriminator",params:{error:"tag",tag:"type",tagValue:l},message:'tag "type" must be string'};t===null?t=[c]:t.push(c),r++}}else{let l={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[l]:t.push(l),r++}return Ft.errors=t,r===0}function Bt(e,{instancePath:n="",parentData:o,parentDataProperty:i,rootData:a=e}={}){let t=null,r=0;if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.title===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"title"},message:"must have required property 'title'"};t===null?t=[s]:t.push(s),r++}if(e.body===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"body"},message:"must have required property 'body'"};t===null?t=[s]:t.push(s),r++}if(e.events===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"events"},message:"must have required property 'events'"};t===null?t=[s]:t.push(s),r++}for(let s in e)if(!(s==="title"||s==="body"||s==="code"||s==="events")){let l={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};t===null?t=[l]:t.push(l),r++}if(e.title!==void 0){let s=e.title;if(typeof s=="string"){if(ye(s)<1){let l={instancePath:n+"/title",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[l]:t.push(l),r++}}else{let l={instancePath:n+"/title",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[l]:t.push(l),r++}}if(e.body!==void 0){let s=e.body;if(typeof s=="string"){if(ye(s)<1){let l={instancePath:n+"/body",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[l]:t.push(l),r++}}else{let l={instancePath:n+"/body",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[l]:t.push(l),r++}}if(e.code!==void 0){let s=e.code;if(typeof s=="string"){if(ye(s)<1){let l={instancePath:n+"/code",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[l]:t.push(l),r++}}else{let l={instancePath:n+"/code",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[l]:t.push(l),r++}}if(e.events!==void 0){let s=e.events;if(Array.isArray(s)){let l=s.length;for(let c=0;c<l;c++)Ft(s[c],{instancePath:n+"/events/"+c,parentData:s,parentDataProperty:c,rootData:a})||(t=t===null?Ft.errors:t.concat(Ft.errors),r=t.length)}else{let l={instancePath:n+"/events",schemaPath:"#/properties/events/type",keyword:"type",params:{type:"array"},message:"must be array"};t===null?t=[l]:t.push(l),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[s]:t.push(s),r++}return Bt.errors=t,r===0}function _t(e,{instancePath:n="",parentData:o,parentDataProperty:i,rootData:a=e}={}){let t=null,r=0;if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.lifelines===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"lifelines"},message:"must have required property 'lifelines'"};t===null?t=[s]:t.push(s),r++}for(let s in e)if(s!=="lifelines"){let l={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};t===null?t=[l]:t.push(l),r++}if(e.lifelines!==void 0){let s=e.lifelines;if(Array.isArray(s)){if(s.length<1){let c={instancePath:n+"/lifelines",schemaPath:"#/properties/lifelines/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};t===null?t=[c]:t.push(c),r++}let l=s.length;for(let c=0;c<l;c++){let d=s[c];if(typeof d=="string"){if(!_e.test(d)){let v={instancePath:n+"/lifelines/"+c,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),r++}}else{let v={instancePath:n+"/lifelines/"+c,schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[v]:t.push(v),r++}}}else{let l={instancePath:n+"/lifelines",schemaPath:"#/properties/lifelines/type",keyword:"type",params:{type:"array"},message:"must be array"};t===null?t=[l]:t.push(l),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[s]:t.push(s),r++}return _t.errors=t,r===0}function Vt(e,{instancePath:n="",parentData:o,parentDataProperty:i,rootData:a=e}={}){let t=null,r=0;if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.from===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"from"},message:"must have required property 'from'"};t===null?t=[s]:t.push(s),r++}if(e.to===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"to"},message:"must have required property 'to'"};t===null?t=[s]:t.push(s),r++}for(let s in e)if(!(s==="from"||s==="to"||s==="label")){let l={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};t===null?t=[l]:t.push(l),r++}if(e.from!==void 0){let s=e.from;if(typeof s=="string"){if(!_e.test(s)){let l={instancePath:n+"/from",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};t===null?t=[l]:t.push(l),r++}}else{let l={instancePath:n+"/from",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[l]:t.push(l),r++}}if(e.to!==void 0){let s=e.to;if(typeof s=="string"){if(!_e.test(s)){let l={instancePath:n+"/to",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};t===null?t=[l]:t.push(l),r++}}else{let l={instancePath:n+"/to",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[l]:t.push(l),r++}}if(e.label!==void 0){let s=e.label;if(typeof s=="string"){if(ye(s)<1){let l={instancePath:n+"/label",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[l]:t.push(l),r++}}else{let l={instancePath:n+"/label",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[l]:t.push(l),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[s]:t.push(s),r++}return Vt.errors=t,r===0}function Wt(e,{instancePath:n="",parentData:o,parentDataProperty:i,rootData:a=e}={}){let t=null,r=0;if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.paths===void 0){let s={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"paths"},message:"must have required property 'paths'"};t===null?t=[s]:t.push(s),r++}for(let s in e)if(s!=="paths"){let l={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:s},message:"must NOT have additional properties"};t===null?t=[l]:t.push(l),r++}if(e.paths!==void 0){let s=e.paths;if(Array.isArray(s)){if(s.length<1){let c={instancePath:n+"/paths",schemaPath:"#/properties/paths/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};t===null?t=[c]:t.push(c),r++}let l=s.length;for(let c=0;c<l;c++)Vt(s[c],{instancePath:n+"/paths/"+c,parentData:s,parentDataProperty:c,rootData:a})||(t=t===null?Vt.errors:t.concat(Vt.errors),r=t.length)}else{let l={instancePath:n+"/paths",schemaPath:"#/properties/paths/type",keyword:"type",params:{type:"array"},message:"must be array"};t===null?t=[l]:t.push(l),r++}}}else{let s={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[s]:t.push(s),r++}return Wt.errors=t,r===0}function Pn(e,{instancePath:n="",parentData:o,parentDataProperty:i,rootData:a=e}={}){let t=null,r=0,s=r,l=!0,c=r;if(e&&typeof e=="object"&&!Array.isArray(e)){let f;if(e.kind===void 0&&(f="kind")){let y={};t===null?t=[y]:t.push(y),r++}else if(e.kind!==void 0&&e.kind!=="sequence"){let y={};t===null?t=[y]:t.push(y),r++}}var d=c===r;r=s,t!==null&&(s?t.length=s:t=null);let v;if(d){let f=r,y=r,h=r;if(e&&typeof e=="object"&&!Array.isArray(e)){let j;if(e.state===void 0&&(j="state")){let I={};t===null?t=[I]:t.push(I),r++}}var b=h===r;if(b){let j={instancePath:n,schemaPath:"#/then/not",keyword:"not",params:{},message:"must NOT be valid"};t===null?t=[j]:t.push(j),r++}else r=y,t!==null&&(y?t.length=y:t=null);if(e&&typeof e=="object"&&!Array.isArray(e)&&e.sequence===void 0){let j={instancePath:n,schemaPath:"#/then/required",keyword:"required",params:{missingProperty:"sequence"},message:"must have required property 'sequence'"};t===null?t=[j]:t.push(j),r++}var d=f===r;l=d,v="then"}else{let f=r,y=r,h=r;if(e&&typeof e=="object"&&!Array.isArray(e)){let B;if(e.sequence===void 0&&(B="sequence")){let X={};t===null?t=[X]:t.push(X),r++}}var u=h===r;if(u){let B={instancePath:n,schemaPath:"#/else/not",keyword:"not",params:{},message:"must NOT be valid"};t===null?t=[B]:t.push(B),r++}else r=y,t!==null&&(y?t.length=y:t=null);let N=r,j=!0,I=r;if(e&&typeof e=="object"&&!Array.isArray(e)){let B;if(e.kind===void 0&&(B="kind")){let X={};t===null?t=[X]:t.push(X),r++}else if(e.kind!==void 0&&e.kind!=="state"){let X={};t===null?t=[X]:t.push(X),r++}}var w=I===r;r=N,t!==null&&(N?t.length=N:t=null);let Y;if(w){let B=r;if(e&&typeof e=="object"&&!Array.isArray(e)&&e.boxes!==void 0){let ge=e.boxes;if(Array.isArray(ge)){let E=ge.length;for(let H=0;H<E;H++){let U=ge[H];if(U&&typeof U=="object"&&!Array.isArray(U)&&U.id!==void 0){let le=U.id,R=r,V=r;if(!(le==="start"||le==="finish")){let A={};t===null?t=[A]:t.push(A),r++}var L=V===r;if(L){let A={instancePath:n+"/boxes/"+H+"/id",schemaPath:"#/else/then/properties/boxes/items/properties/id/not",keyword:"not",params:{},message:"must NOT be valid"};t===null?t=[A]:t.push(A),r++}else r=R,t!==null&&(R?t.length=R:t=null)}}}}var w=B===r;j=w,Y="then"}else{let B=r,X=r,ge=r;if(e&&typeof e=="object"&&!Array.isArray(e)){let H;if(e.state===void 0&&(H="state")){let U={};t===null?t=[U]:t.push(U),r++}}var $=ge===r;if($){let H={instancePath:n,schemaPath:"#/else/else/not",keyword:"not",params:{},message:"must NOT be valid"};t===null?t=[H]:t.push(H),r++}else r=X,t!==null&&(X?t.length=X:t=null);var w=B===r;j=w,Y="else"}if(!j){let B={instancePath:n,schemaPath:"#/else/if",keyword:"if",params:{failingKeyword:Y},message:'must match "'+Y+'" schema'};t===null?t=[B]:t.push(B),r++}var d=f===r;l=d,v="else"}if(!l){let f={instancePath:n,schemaPath:"#/if",keyword:"if",params:{failingKeyword:v},message:'must match "'+v+'" schema'};t===null?t=[f]:t.push(f),r++}if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.version===void 0){let f={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"version"},message:"must have required property 'version'"};t===null?t=[f]:t.push(f),r++}if(e.kind===void 0){let f={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"kind"},message:"must have required property 'kind'"};t===null?t=[f]:t.push(f),r++}if(e.title===void 0){let f={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"title"},message:"must have required property 'title'"};t===null?t=[f]:t.push(f),r++}if(e.boxes===void 0){let f={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"boxes"},message:"must have required property 'boxes'"};t===null?t=[f]:t.push(f),r++}if(e.steps===void 0){let f={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"steps"},message:"must have required property 'steps'"};t===null?t=[f]:t.push(f),r++}for(let f in e)if(!Dr.call(Qt.properties,f)){let y={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:f},message:"must NOT have additional properties"};t===null?t=[y]:t.push(y),r++}if(e.version!==void 0){let f=e.version;if(!(typeof f=="number"&&!(f%1)&&!isNaN(f)&&isFinite(f))){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),r++}if(typeof f=="number"&&isFinite(f)&&(f<1||isNaN(f))){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),r++}}if(e.kind!==void 0){let f=e.kind;if(!(f==="sequence"||f==="architecture"||f==="state")){let y={instancePath:n+"/kind",schemaPath:"#/properties/kind/enum",keyword:"enum",params:{allowedValues:Qt.properties.kind.enum},message:"must be equal to one of the allowed values"};t===null?t=[y]:t.push(y),r++}}if(e.title!==void 0){let f=e.title;if(typeof f=="string"){if(ye(f)<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),r++}}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),r++}}if(e.view!==void 0){let f=e.view;if(!(f==="fixed"||f==="follow")){let y={instancePath:n+"/view",schemaPath:"#/properties/view/enum",keyword:"enum",params:{allowedValues:Qt.properties.view.enum},message:"must be equal to one of the allowed values"};t===null?t=[y]:t.push(y),r++}}if(e.regions!==void 0){let f=e.regions;if(Array.isArray(f)){let y=f.length;for(let h=0;h<y;h++)jt(f[h],{instancePath:n+"/regions/"+h,parentData:f,parentDataProperty:h,rootData:a})||(t=t===null?jt.errors:t.concat(jt.errors),r=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),r++}}if(e.boxes!==void 0){let f=e.boxes;if(Array.isArray(f)){if(f.length<1){let h={instancePath:n+"/boxes",schemaPath:"#/properties/boxes/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};t===null?t=[h]:t.push(h),r++}let y=f.length;for(let h=0;h<y;h++)Ct(f[h],{instancePath:n+"/boxes/"+h,parentData:f,parentDataProperty:h,rootData:a})||(t=t===null?Ct.errors:t.concat(Ct.errors),r=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),r++}}if(e.strip!==void 0&&(Dt(e.strip,{instancePath:n+"/strip",parentData:e,parentDataProperty:"strip",rootData:a})||(t=t===null?Dt.errors:t.concat(Dt.errors),r=t.length)),e.steps!==void 0){let f=e.steps;if(Array.isArray(f)){if(f.length<1){let h={instancePath:n+"/steps",schemaPath:"#/properties/steps/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};t===null?t=[h]:t.push(h),r++}let y=f.length;for(let h=0;h<y;h++)Bt(f[h],{instancePath:n+"/steps/"+h,parentData:f,parentDataProperty:h,rootData:a})||(t=t===null?Bt.errors:t.concat(Bt.errors),r=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),r++}}e.sequence!==void 0&&(_t(e.sequence,{instancePath:n+"/sequence",parentData:e,parentDataProperty:"sequence",rootData:a})||(t=t===null?_t.errors:t.concat(_t.errors),r=t.length)),e.state!==void 0&&(Wt(e.state,{instancePath:n+"/state",parentData:e,parentDataProperty:"state",rootData:a})||(t=t===null?Wt.errors:t.concat(Wt.errors),r=t.length))}else{let f={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[f]:t.push(f),r++}return Pn.errors=t,r===0}var Br=["edge","action","swap","strip"],_r={"#/else/not":{field:"sequence",kind:"sequence"},"#/then/not":{field:"state",kind:"state"},"#/else/else/not":{field:"state",kind:"state"}},Vr={carry:{field:"text",kind:"tag"}},Wr=/\/boxes\/items\/properties\/id\/not$/u,tn=e=>e.replaceAll("~","~0").replaceAll("/","~1");function Gr(e){let n=/^\^\[\^(.+)\]\+\$$/u.exec(e)?.[1];if(n===void 0)return;let o=n.match(/\\.|[^\\]/gu)??[];return{space:o.includes("\\s"),chars:o.filter(i=>i!=="\\s").map(i=>i.replace(/^\\/u,""))}}var Sn=(e,n)=>n.filter(o=>o!==e&&o.schemaPath.startsWith(`${e.schemaPath}/`)&&(o.instancePath===e.instancePath||o.instancePath.startsWith(`${e.instancePath}/`)));function Yr(e,n,o){let i=e.params,a=e.instancePath;switch(e.keyword){case"additionalProperties":{let t=String(i.additionalProperty);return{pointer:`${a}/${tn(t)}`,message:o.additionalProperties(t)}}case"required":{let t=String(i.missingProperty);return{pointer:`${a}/${tn(t)}`,message:o.required(t)}}case"not":{if(Wr.test(e.schemaPath))return{pointer:a,message:o.reserved(lt)};let t=a===""?_r[e.schemaPath]:Vr[a.slice(a.lastIndexOf("/")+1)];return{pointer:t?`${a}/${t.field}`:a,message:o.not(t)}}case"anyOf":{let t=Sn(e,n),r=t.every(s=>s.keyword==="required")?t.map(s=>String(s.params.missingProperty)):[];return{pointer:a,message:o.anyOf(r)}}case"discriminator":{let t=String(i.tag);return{pointer:`${a}/${tn(t)}`,message:o.discriminator(t,Br)}}case"enum":return{pointer:a,message:o.enum(i.allowedValues.map(String))};case"type":return{pointer:a,message:o.type(String(i.type))};case"minLength":return{pointer:a,message:o.minLength(Number(i.limit))};case"pattern":return{pointer:a,message:o.pattern(Gr(String(i.pattern)))};case"minItems":return{pointer:a,message:o.minItems(Number(i.limit))};case"minimum":return{pointer:a,message:o.minimum(Number(i.limit))};case"const":return{pointer:a,message:o.const(String(i.allowedValue))};case"oneOf":return{pointer:a,message:o.oneOf};default:return{pointer:a,message:e.message??e.keyword}}}function Mn(e,n={}){if(en(e))return{ok:!0};let o=en.errors??[],i=new Set(o.filter(r=>r.keyword==="anyOf").flatMap(r=>Sn(r,o))),a=At[n.lang??"ja"];return{ok:!1,errors:o.filter(r=>r.keyword!=="if"&&!i.has(r)).map(r=>Yr(r,o,a))}}var On=1;function Hr(e){if(typeof e!="object"||e===null)return;let n=e.version;return typeof n=="number"&&n>On?n:void 0}var Kr=(e,n)=>({pointer:"/version",message:At[n].newer(e,On)});function En(e,n={}){let o=Hr(e);if(o!==void 0)return{ok:!1,errors:[Kr(o,n.lang??"ja")]};let i=Mn(e,n);return i.ok?{ok:!0,diagram:e,warnings:[]}:i}function Xr(e){let n={edges:[],events:[],busy:0},o=J.edgeAt,i,a=0;return e.events.forEach((t,r)=>{if(t.type==="edge"){let s=t.carry.kind!=="none",l=o,c=l+(s?J.drawCarry:J.draw);n.edges.push({event:r,a:l,b:c,carries:s,coin:t.carry.kind==="coin",named:t.label!==void 0}),o=l+J.stagger,i=c,a=0,n.busy=Math.max(n.busy,c)}else if(t.type==="action")n.events.push({event:r,at:o}),n.busy=Math.max(n.busy,o+J.action),o+=J.action,a=0;else{let s=(i??o)+J.change*a++;n.events.push({event:r,at:s}),n.busy=Math.max(n.busy,s)}}),n}function Tn(e){let n=e.steps.map(Xr),o=[],i=J.intro;e.steps.forEach((L,$)=>{let f=Math.min(J.stepMax,Math.max(J.stepMin,J.stepBase+[...L.body].length*J.perChar)),y=Math.max(f,(n[$]?.busy??0)+J.dwell);o.push({start:i,end:i+y}),i+=y});let t=Math.ceil(i+J.outro),r=t-J.tail,s=[],l=[],c=[],d=[];n.forEach((L,$)=>{let f=o[$],y=[];for(let h of L.edges){let N=f.start+h.a;s.push({step:$,event:h.event,start:N,drawn:f.start+h.b,end:f.end}),h.carries&&d.push({step:$,event:h.event,who:h.coin?"coin":"main",a:N,b:f.start+h.b}),h.named&&y.push({step:$,event:h.event,start:N+J.labelDelay,end:f.end})}if(y.forEach((h,N)=>{let j=y[N+2];j&&(h.end=Math.min(h.end,j.start))}),e.kind==="state")for(let h of y)h.after={start:h.end,end:r};l.push(...y);for(let h of L.events)c.push({step:$,event:h.event,at:f.start+h.at})});let v=o[0]?.start??0,b=d.some(L=>L.who==="main"),u=[];for(let L of["main","coin"]){let $=d.filter(f=>f.who===L);$.forEach((f,y)=>{let h=$[y+1],N=y===0&&(L==="main"||!b);u.push({step:f.step,event:f.event,who:L,depart:f.a,arrive:f.b,start:N?Math.min(v,f.a):f.a,end:h?Math.max(h.a,f.b):r})})}u.sort((L,$)=>L.depart-$.depart);let w=e.kind==="state"?Ur(e,s,r):void 0;return{total:t,last:r,steps:o,edges:s,carriers:u,labels:l,badges:o.map((L,$)=>({step:$,appears:L.start})),events:c,stills:o.map(L=>L.end-J.still),...w?{states:w}:{}}}var zr=e=>lt.includes(e);function Ur(e,n,o){let i=new Map,a=r=>{let s=i.get(r)??{box:r,lit:[]};return i.set(r,s),s},t;for(let r of n){let s=e.steps[r.step]?.events[r.event];if(!(s?.type!=="edge"||s.from===s.to)){if(t){let l=a(t.box);l.lit.push({start:t.since,end:r.start}),t.box===s.from&&l.done===void 0&&(l.done=r.start+J.done),t=void 0}zr(s.to)||(t={box:s.to,since:r.drawn})}}return t&&a(t.box).lit.push({start:t.since,end:o}),[...i.values()]}var ht={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 He=[[0,Number.POSITIVE_INFINITY]],nn=.5,Ln=(e,n)=>e.shown.some(([o,i])=>o<=n&&n<i),rn=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 qn(e,n,o=[]){let i=[];return n.forEach((a,t)=>{let r=e.filter(l=>Ln(l,a));r.forEach((l,c)=>{for(let d of r.slice(c+1)){let v=Math.min(l.rect.x+l.rect.w,d.rect.x+d.rect.w)-Math.max(l.rect.x,d.rect.x),b=Math.min(l.rect.y+l.rect.h,d.rect.y+d.rect.h)-Math.max(l.rect.y,d.rect.y);v>nn&&b>nn&&i.push({kind:"texts",step:t,texts:[l.text,d.text],spots:[rn(l),rn(d)]})}});let s=o.filter(l=>Ln(l,a));for(let l of r)if(!l.boxed)for(let c of s)Ot(c.points,l.rect,nn)&&i.push({kind:"line",step:t,text:l.text,line:{from:c.from,to:c.to},spots:[rn(l)]})}),i}var Ne=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),O=e=>Math.round(e*100)/100,$e=e=>e==="coin"?"--c:var(--coin);--ct:var(--coint)":`--c:var(--c-${e});--ct:var(--t-${e})`;function yt(e,n,o,i,a="dg-gl"){let t=e===void 0?void 0:ht[e];return t?`<path class="${a}" transform="translate(${O(n)} ${O(o)}) scale(${i})" d="${t}"/>`:""}function Nn(e){let n=e.filter((t,r)=>r===0||t[0]!==e[r-1][0]||t[1]!==e[r-1][1]),[o,i]=n[0],a=`M ${O(o)} ${O(i)}`;for(let t=1;t<n.length-1;t++){let[r,s]=n[t-1],[l,c]=n[t],[d,v]=n[t+1],b=Math.hypot(l-r,c-s),u=Math.hypot(d-l,v-c),w=Math.min(g.edge.bend,b/2,u/2);a+=` L ${O(l-(l-r)/b*w)} ${O(c-(c-s)/b*w)} Q ${O(l)} ${O(c)} ${O(l+(d-l)/u*w)} ${O(c+(v-c)/u*w)}`}if(n.length>1){let[t,r]=n[n.length-1];a+=` L ${O(t)} ${O(r)}`}return a}function Rn(e){let[n,o]=e[e.length-1],[i,a]=e[e.length-2],t=Math.hypot(n-i,o-a)||1,r=(n-i)/t,s=(o-a)/t,{arrow:l,arrowHalf:c}=g.edge;return`M ${O(n-r*l-s*c)} ${O(o-s*l+r*c)} L ${O(n)} ${O(o)} L ${O(n-r*l+s*c)} ${O(o-s*l-r*c)}`}function Ae(e,n,o,i,a,t,r=He,s){return e?.push({text:a,rect:Ze(a,o,i,t,s),shown:r}),`<text class="${n}" x="${O(o)}" y="${O(i)}"${s?` text-anchor="${s}"`:""}>${Ne(a)}</text>`}function An(e,n){let o=[[0,{opacity:0}]];for(let[i,a]of n)o.push([i,{opacity:0},de.out],[i+J.fade,{opacity:1}],[a-.1,{opacity:1},de.inOut],[a+.25,{opacity:0}]);return o.push([e.total,{opacity:0}]),e.kf(o)}function jn(e,n){let o=[];for(let i=0;i<n.length;){let a=i;for(;a+1<n.length&&n[a+1]===n[a]+1;)a++;o.push([e.t.steps[n[i]].start,e.t.steps[n[a]].end]),i=a+1}return An(e.m,o)}function Cn(e,n){let{radius:o,icon:i,iconRadius:a,iconScale:t,nameY:r,line:s}=g.region,{x:l,y:c}=e.header,d=e.lines.map((u,w)=>Ae(n,"dg-bz",l,e.y+r+w*s,u,M.regionName)).join(""),v=e.note?Ae(n,"dg-bx",l,e.y+r+e.lines.length*s+1,e.note,M.regionNote):"",b=e.icon&&ht[e.icon]?`<rect class="dg-bi" x="${O(l)}" y="${O(c)}" width="${i}" height="${i}" rx="${a}"/>${yt(e.icon,l+i/2,c+i/2,t)}`:"";return`<g style="${$e(e.color)}"><rect class="dg-band" x="${O(e.x+.5)}" y="${O(e.y+.5)}" width="${O(e.w-1)}" height="${O(e.h-1)}" rx="${o}"/>${b}${d}${v}</g>`}function Dn(e,n,o,i,a){let t=[[0,e.sub??"","dg-ss"],...o];return t.map(([r,s,l],c)=>{let d=t[c+1]?.[0],v=c===0?d===void 0?"":n.until(d-J.untilFade):d===void 0?n.rise(r):n.rise(r,d-J.untilFade);if(s==="")return"";let b=[[c===0?0:r,d===void 0?Number.POSITIVE_INFINITY:d-J.untilFade]];return`<g${v?` class="dg-a" style="${v}"`:""}>${Ae(a,l,e.cx,i,s,l==="dg-ss"?M.boxSub:M.boxSubStrong,b,"middle")}</g>`}).join("")}function In(e,n,o,i,a){let t=(r,s="")=>`<rect class="${r}" x="${O(e.x)}" y="${O(i)}" width="${O(e.w)}" height="${a}" rx="${g.box.radius}"${s}/>`;return`${o?`<g class="dg-a" style="${o}">${t("dg-halo")}</g>`:""}${t("dg-st",` ${n.sh}`)}${o?`<g class="dg-a" style="${o}">${t("dg-on")}</g>`:""}`}function Fn(e,n,o,i,a){let{icon:t,iconRadius:r,iconScale:s,iconY:l,nameY:c,subY:d}=g.box,v=Dn(e,n.m,i,e.cy+d,n.ink),b=a?a.length>0?An(n.m,a.map($=>[$.start,$.end])):void 0:o.length>0?jn(n,o):void 0,u=e.iconX??e.cx,w=e.slot?`<rect class="dg-slot" x="${O(e.slot.x)}" y="${O(e.slot.y)}" width="${O(e.slot.w)}" height="${O(e.slot.h)}" rx="${g.slot.radius}"/>`:"",L="";if(e.icon&&ht[e.icon]){let $={x:u-t/2,y:e.cy+l-t/2,w:t,h:t};n.ink.push({text:`${e.name} \u306E\u7D75\u67C4`,rect:$,shown:He,boxed:!0,part:{kind:"icon",box:e.name}}),L=`<rect class="dg-ic" x="${O($.x)}" y="${O($.y)}" width="${t}" height="${t}" rx="${r}"/>${yt(e.icon,u,e.cy+l,s)}`}return`<g style="${$e(e.color)}">${In(e,n,b,e.y,e.h)}${w}${L}${Ae(n.ink,"dg-sn",e.cx,e.cy+c,e.name,M.boxName,He,"middle")}${v}</g>`}function Bn(e,n,o,i){let{pad:a,h:t,nameY:r,subY:s}=g.follow.head,l=Dn(e,n.m,i,a+s),c=o.length>0?jn(n,o):void 0;return`<g style="${$e(e.color)}">${In(e,n,c,a,t)}<text class="dg-sn" x="${O(e.cx)}" y="${O(a+r)}" text-anchor="middle">${Ne(e.name)}</text>${l}</g>`}function _n(e,n){let{icon:o,iconRadius:i,iconScale:a,radius:t}=g.box,r=g.state.ghost,s=e.x+r.pad+o/2,l=e.x+r.pad+o+r.gap,c=e.icon&&ht[e.icon]?`<rect class="dg-ic" x="${O(s-o/2)}" y="${O(e.cy-o/2)}" width="${o}" height="${o}" rx="${i}"/>${yt(e.icon,s,e.cy,a)}`:"",d=e.sub?r.nameY:g.baseline.mark,v=e.sub?Ae(n,"dg-ss",l,e.cy+r.subY,e.sub,M.boxSub,He,"start"):"";return`<g data-ghost="${Ne(e.id)}" style="${$e(e.color)}"><rect class="dg-ghost" x="${O(e.x)}" y="${O(e.y)}" width="${O(e.w)}" height="${e.h}" rx="${t}"/>${c}${Ae(n,"dg-sn",l,e.cy+d,e.name,M.boxName,He,"start")}${v}</g>`}function Vn(e,n,o){let{r:i,inset:a}=g.state.done,t=e.x+e.w-a,r=e.y+a;return`<g class="dg-popc dg-a" data-done="${Ne(e.id)}" style="${$e(e.color)};${o.m.pop(n)}"><circle class="dg-done" cx="${O(t)}" cy="${O(r)}" r="${i}"/>${yt("check",t,r,.5,"dg-done-ck")}</g>`}function Wn(e,n,o,i){i.push({from:e.from,to:e.to,points:e.points,shown:He});let a=e.label?.family==="sans",t=e.label?Ae(o,`dg-path-t${a?" dg-path-tj":""}`,e.label.x+g.label.padX,e.label.y+e.label.h/2+g.baseline.label,e.label.text,a?M.labelJa:M.label):"";return`<g data-path="${Ne(`${e.from}->${e.to}`)}" style="${$e(n)}"><path class="dg-path" d="${Nn(e.points)}"/><path class="dg-path-h" d="${Rn(e.points)}"/>${t}</g>`}function Gn(e,n,o){let{pad:i}=g.state.side,a=e.y+i+M.regionName.size,t=e.notes.map((r,s)=>Ae(o,"dg-side-n",e.x+i,a+g.region.line*(s+1),r,M.regionNote)).join("");return`<g style="${$e(n)}"><rect class="dg-side" x="${O(e.x+.5)}" y="${O(e.y+.5)}" width="${O(e.w-1)}" height="${O(e.h-1)}" rx="${g.region.radius}"/>${Ae(o,"dg-side-t",e.x+i,a,e.title,M.regionName)}${t}</g>`}function Yn(e,n,o){let{end:i}=g.state,a=Nt(e),t=e.text===""?"":Ae(o,"dg-mark",a[0],a[1],e.text,M.regionNote),r=O(e.x),s=O(e.y);return e.kind==="start"?`<g data-end="start"><circle class="dg-start" cx="${r}" cy="${s}" r="${e.r}"/>${t}</g>`:e.ghost?`<g data-end="finish" style="${$e(n)}"><circle class="dg-end-x" cx="${r}" cy="${s}" r="${e.r}"/><circle class="dg-end-xi" cx="${r}" cy="${s}" r="${i.inner}"/>${t}</g>`:`<g data-end="finish"><circle class="dg-end" cx="${r}" cy="${s}" r="${e.r}"/><circle class="dg-end-in" cx="${r}" cy="${s}" r="${i.inner}"/>${t}</g>`}function Hn(e,n,o){return`<line class="dg-ll" x1="${O(e)}" y1="${O(n)}" x2="${O(e)}" y2="${O(o)}"/>`}function Kn(e,n,o,i=!1){let{m:a}=o;o.traces.push({from:e.from,to:e.to,points:e.points,shown:He});let t=Nn(e.points),r=Rn(e.points),{start:s,drawn:l,end:c}=n,d=i?[[c,{opacity:1},de.inOut],[c+.4,{opacity:0}],[a.total,{opacity:0}]]:[[c,{opacity:1},de.inOut],[c+.4,{opacity:.45}],[o.end+.3,{opacity:.45},de.inOut],[o.end+1,{opacity:.95}],[a.last,{opacity:.95},de.inOut],[a.total,{opacity:0}]],v=a.kf([[0,{opacity:0,"stroke-dashoffset":1}],[s,{opacity:0,"stroke-dashoffset":1},de.inOut],[s+.05,{opacity:1}],[l,{"stroke-dashoffset":0}],[a.last,{"stroke-dashoffset":0}],[a.total,{"stroke-dashoffset":1}],...d]),b=a.kf([[0,{opacity:0}],[l-.05,{opacity:0}],[l,{opacity:1}],...d]),u=-(c-l)*26,w=a.kf([[0,{opacity:0,"stroke-dashoffset":0}],[l,{opacity:0,"stroke-dashoffset":0}],[l+.25,{opacity:.9}],[c-.1,{opacity:.9},de.inOut],[c+.2,{opacity:0,"stroke-dashoffset":u}],[a.total,{opacity:0,"stroke-dashoffset":u}]]),L=i?a.kf([[0,{opacity:0}],[c,{opacity:0},de.inOut],[c+.4,{opacity:1}],[a.last,{opacity:1},de.inOut],[a.total,{opacity:0}]]):"";return{base:`<path class="dg-e" d="${t}"/><path class="dg-eh" d="${r}"/>${i?`<path class="dg-e-past dg-a" d="${t}" style="${L}"/><path class="dg-eh-past dg-a" d="${r}" style="${L}"/>`:""}`,lit:`<g style="${$e(e.color)}"><path class="dg-e-on dg-a" pathLength="1" d="${t}" style="${v}"/><path class="dg-eh-on dg-a" d="${r}" style="${b}"/><path class="dg-flow dg-a" d="${t}" style="${w}"/></g>`}}function Xn(e,n,o){let i=e.family==="sans"?" dg-capj":"",{radius:a}=g.label;o.ink.push({text:e.text,rect:e,shown:[[n.start,n.end]],boxed:!0}),n.after&&o.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"?M.labelJa:M.label,"middle"),shown:[[n.after.start,n.after.end]]});let t=O(e.x+e.w/2),r=O(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="${o.m.vis(n.after.start,n.after.end)}"><text x="${t}" y="${r}" text-anchor="middle">${Ne(e.text)}</text></g>`:""}<g class="dg-cap${i} dg-a" style="${$e(e.color)};${o.m.rise(n.start,n.end,!0)}"><rect x="${O(e.x)}" y="${O(e.y)}" width="${O(e.w)}" height="${e.h}" rx="${a}"/><text x="${t}" y="${r}" text-anchor="middle">${Ne(e.text)}</text></g>`}function zn(e,n,o,i){return i.ink.push({text:e.text,rect:e,shown:[[n,o]],boxed:!0}),`<g class="dg-act dg-a" style="${$e(e.color)};${i.m.rise(n,o,!0)}"><rect x="${O(e.x)}" y="${O(e.y)}" width="${O(e.w)}" height="${e.h}" rx="${g.action.radius}"/><text x="${O(e.x+e.w/2)}" y="${O(e.y+e.h/2+g.baseline.action)}" text-anchor="middle">${Ne(e.text)}</text></g>`}function Jr(e,n){let o=g.carrier;if(e.carry.kind==="coin")return`<circle class="dg-coin" r="${o.coinR}"/><circle class="dg-coin-in" r="${o.coinIn}"/>`;if(e.carry.kind==="tag"){let i=e.carry.text,a=Be(i),t=Q(i,a?M.carrierJa:M.carrier)+o.tagPadX*2;return`<rect class="dg-car" x="${O(-t/2)}" y="${-o.tagH/2}" width="${O(t)}" height="${o.tagH}" rx="${o.tagH/2}" ${n}/><text class="dg-car-t${a?" dg-car-tj":""}" y="${g.baseline.carrier}" text-anchor="middle">${Ne(i)}</text>`}return`<rect class="dg-env" x="${-o.envW/2}" y="${-o.envH/2}" width="${o.envW}" height="${o.envH}" rx="3" ${n}/><path class="dg-env-in" d="M -8 -4.5 L 0 1.5 L 8 -4.5"/>`}var Zr=e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2;function Un(e,n,o){let{m:i}=o,a=g.carrier.samples,t=e.wait?[e.wait,...e.points]:e.points,r=Et(t),{depart:s,arrive:l,start:c,end:d}=n,v=[];for(let I=0;I<=a;I++){let[Y,Z]=ze(t,Zr(I/a)*r);v.push([s+(l-s)*I/a,Y,Z])}let b=v[0],u=v[v.length-1],w=e.settle??[u[1],u[2]],L=[[0,b[1],b[2]],...v];e.settle&&L.push([Math.min(l+.3,Math.max(d,l+.01)),w[0],w[1]]),L.push([d,w[0],w[1]],[i.total,w[0],w[1]]);let[$,f]=Ye(e.carry),y=e.carry.kind==="tag"?e.carry.text:e.carry.kind==="coin"?"\u786C\u8CA8":"\u5C01\u7B52",h=e.carry.kind==="tag"?{}:{part:{kind:e.carry.kind==="coin"?"coin":"envelope"}},N=I=>({x:I[0]-$,y:I[1]-f,w:$*2,h:f*2});s>c&&o.ink.push({text:y,rect:N([b[1],b[2]]),shown:[[c,s]],boxed:!0,...h}),o.ink.push({text:y,rect:N(w),shown:[[l,d]],boxed:!0,...h});let j=d<i.last?.05:.18;return`<g class="dg-a" style="${i.move(L,i.blink(c+.02,d,j))}">${Jr(e,o.sh)}</g>`}function Jn(e,n,o=!1){let{m:i}=n,a=n.t.steps[e.step],t=a.start,r=a.end,{r:s,ring:l}=g.badge,c={visibility:"visible"},d={visibility:"hidden"},v=e.until===void 0?void 0:n.t.steps[e.until].start,b=v!==void 0&&v<=r+1e-6,u=i.kf([[0,{opacity:0,transform:"scale(.5)",...d}],[t,{opacity:0,transform:"scale(.5)",...d},de.pop],[t+.35,{opacity:1,transform:"scale(1)",...c}],[r,{opacity:1,transform:"scale(1)",...c},de.inOut],[r+(b?J.untilFade:.4),{opacity:0,transform:"scale(1)",...d}],[i.total,{opacity:0,transform:"scale(.5)",...d}]]),w=v??i.last,L=b?i.kf([[0,{opacity:0,...d}],[i.total,{opacity:0,...d}]]):i.kf([[0,{opacity:0,...d}],[r,{opacity:0,...d},de.inOut],[r+.4,{opacity:1,...c}],[w,{opacity:1,...c},de.inOut],...v===void 0?[]:[[v+J.untilFade,{opacity:0,...d}]],[i.total,{opacity:0,...d}]]),$=i.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)"}],[i.total,{opacity:0,transform:"scale(1)"}]]),f=O(e.x),y=O(e.y),h=O(e.y+g.baseline.badge),N=e.step+1;return n.ink.push({text:String(N),rect:{x:e.x-s,y:e.y-s,w:s*2,h:s*2},shown:[[t,w]],boxed:!0,badge:!0}),`<g class="dg-bd" data-step="${e.step}" style="${$e(e.color)}"><circle class="dg-bdr dg-popc dg-a" cx="${f}" cy="${y}" r="${l}" style="${$}"/><g class="dg-a" style="${L}"><circle class="${o?"dg-bdp-g":"dg-bdp"}" cx="${f}" cy="${y}" r="${l}"/><text class="${o?"dg-bdpt-g":"dg-bdpt"}" x="${f}" y="${h}" text-anchor="middle">${N}</text></g><g class="dg-popc dg-a" style="${u}"><circle class="dg-bdf" cx="${f}" cy="${y}" r="${s}"/><text class="dg-bdft" x="${f}" y="${h}" text-anchor="middle">${N}</text></g></g>`}function Zn(e,n,o,i=!1,a=new Map){let{m:t,sh:r}=o,s=g.strip,l=e.y+s.h/2,c=[`<rect class="dg-strip" x="${O(e.x+.5)}" y="${O(e.y+.5)}" width="${O(e.w-1)}" height="${O(e.h-1)}" rx="${g.region.radius}" ${r}/>`,`<g style="${$e("slate")}"><rect class="dg-bi" x="${O(e.x+s.pad)}" y="${O(l-s.icon/2)}" width="${s.icon}" height="${s.icon}" rx="${g.box.iconRadius}"/>${yt("env",e.x+s.pad+s.icon/2,l,.78)}</g>`,Ae(o.ink,"dg-sh",e.x+s.titleX,l+g.baseline.stripTitle,e.title,M.stripTitle)];if(e.fields.forEach((d,v)=>{let b=e.fields[v-1];if(b&&b.y===d.y){let $=d.x-s.fieldGap/2;c.push(`<line class="dg-sep" x1="${O($)}" y1="${O(d.y+s.sepInset)}" x2="${O($)}" y2="${O(d.y+s.h-s.sepInset)}"/>`)}c.push(Ae(o.ink,"dg-fl",d.x,d.y+s.nameY,d.name,M.fieldName));let u=n.get(d.name)??[],w=u.filter($=>$.value!==void 0),L=u.filter($=>$.tag!==void 0);w.forEach(($,f)=>{let y=w[f+1]?.at,h=$.value,N=Be(h)?"dg-fvj":"dg-fv";o.ink.push({text:h,rect:Ze(h,d.x,d.y+s.valueY,Be(h)?M.fieldValueJa:M.fieldValue),shown:[[$.at,y===void 0?Number.POSITIVE_INFINITY:y-J.untilFade]]});let j=B=>`<text class="${B}" x="${O(d.x)}" y="${O(d.y+s.valueY)}">${Ne(h)}</text>`,I=j(N);if(!i){let B=y===void 0?t.rise($.at):t.rise($.at,y-J.untilFade);c.push(`<g class="dg-a" style="${B}">${I}</g>`);return}let Y=Math.min($.until,y??$.until),Z=`<circle class="dg-fl-now" cx="${O(d.x+Q(d.name,M.fieldName)+s.now.gap)}" cy="${O(d.y+s.nameY-M.fieldName.size/3)}" r="${s.now.r}"/>`;c.push(`<g class="dg-fv-now dg-a" data-step="${$.step}" style="${$e($.color)};${t.rise($.at,Y-J.untilFade)}">${j(`${N} dg-fv-c`)}${Z}</g>`),(y===void 0||y>Y)&&c.push(`<g class="dg-a" style="${t.vis(Y-J.untilFade,y===void 0?t.last:y-J.untilFade)}">${I}</g>`)}),L.forEach(($,f)=>{let y=L[f+1]?.at,h=$.tag,N=[...w].reverse().find(Z=>Z.at<=$.at+1e-9)?.value,j=d.x+(N?Q(N,Be(N)?M.fieldValueJa:M.fieldValue)+s.tagGap:0),I=Q(h,M.tag)+s.tagPadX*2,Y=d.y+s.valueY-s.tagH/2-g.baseline.tag;o.ink.push({text:h,rect:{x:j,y:Y,w:I,h:s.tagH},shown:[[$.at,y===void 0?Number.POSITIVE_INFINITY:y-J.untilFade]],boxed:!0}),c.push(`<g class="dg-tg dg-popc dg-a" style="${$e($.color)};${y===void 0?t.pop($.at):t.pop($.at,y-J.untilFade)}"><rect x="${O(j)}" y="${O(Y)}" width="${O(I)}" height="${s.tagH}" rx="${s.tagH/2}"/><text x="${O(j+I/2)}" y="${O(Y+s.tagH/2+g.baseline.tag)}" text-anchor="middle">${Ne(h)}</text></g>`)})}),e.trail){let d=e.trail,v=e.fields[e.fields.length-1];if(v&&v.y===d.y){let u=d.x-s.fieldGap/2;c.push(`<line class="dg-sep" x1="${O(u)}" y1="${O(d.y+s.sepInset)}" x2="${O(u)}" y2="${O(d.y+s.h-s.sepInset)}"/>`)}c.push(Ae(o.ink,"dg-fl",d.x,d.y+s.nameY,d.title,M.fieldName));let b=d.y+s.valueY-M.fieldValue.size/3;d.states.forEach((u,w)=>{let L=O(d.x+s.trail.r+w*s.trail.step),$=a.get(u.box),f=$===void 0?"":`<circle class="dg-tr-fill dg-a" cx="${L}" cy="${O(b)}" r="${s.trail.r}" style="${t.pop($)}"/>`;c.push(`<g data-trail="${Ne(u.box)}" style="${$e(u.color)}"><circle class="dg-tr-ring" cx="${L}" cy="${O(b)}" r="${s.trail.r}"/>${f}</g>`)})}return c.join("")}var Qn=e=>Math.round(e*100)/100,Gt=class{constructor(n,o,i){this.prefix=n;this.total=o;this.last=i}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 o=`${this.prefix}-${this.count++}`,i=new Map;for(let[t,r,s]of[...n].sort((l,c)=>l[0]-c[0])){let l=this.pct(t),c=i.get(l)??{props:{}};Object.assign(c.props,r),s&&(c.ease=s),i.set(l,c)}let a=[...i].map(([t,{props:r,ease:s}])=>{let l=Object.entries(r).map(([c,d])=>`${c}:${d}`);return s&&l.push(`animation-timing-function:${s}`),`${t}%{${l.join(";")}}`}).join("");return this.frames.push(`@keyframes ${o}{${a}}`),`animation-name:${o}`}vis(n,o=this.last,i={}){let a=i.f??J.fade,t=i.on??{},r=i.off??{},s=i.within?Math.max(n+a,o-a):o;return this.kf([[0,{opacity:0,...r}],[n,{opacity:0,...r},i.ein??de.out],[n+a,{opacity:1,...t}],[s,{opacity:1,...t},de.inOut],[Math.min(s+a,this.total),{opacity:0,...r}],[this.total,{opacity:0,...r}]])}rise(n,o=this.last,i=!1){return this.vis(n,o,{on:{transform:"translateY(0)"},off:{transform:`translateY(${g.rise}px)`},within:i})}pop(n,o=this.last){return this.vis(n,o,{f:J.popFade,ein:de.pop,on:{transform:"scale(1)"},off:{transform:`scale(${g.popFrom})`}})}until(n){let o=J.untilFade;return this.kf([[0,{opacity:1}],[n,{opacity:1},de.inOut],[n+o,{opacity:0}],[this.last,{opacity:0}],[this.total,{opacity:1}]])}move(n,o=[]){return this.kf(n.map(([i,a,t,r=1,s])=>[i,{transform:`translate(${Qn(a)}px,${Qn(t)}px) scale(${r})`},s]).concat(o))}blink(n,o,i){return[[0,{opacity:0}],[n-.01,{opacity:0}],[n,{opacity:1}],[o,{opacity:1}],[o+i,{opacity:0}],[this.total,{opacity:0}]]}};var ie=e=>`font:${e.weight} ${e.size}px var(--${e.family})`,Pe=(e,n="var(--surf)")=>`color-mix(in srgb,var(--c) ${e}%,${n})`,ae=g.stroke,be=g.mix,sn=`color-mix(in srgb,var(--mute) ${be.past}%,var(--bg))`,Qr=[".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:${Pe(be.regionIcon)};stroke:${Pe(be.regionIconEdge,"transparent")}}`,`.dg-bz{${ie(M.regionName)};fill:var(--ct)}`,`.dg-bx{${ie(M.regionNote)};fill:var(--mute)}`,".dg-st{fill:var(--surf);stroke:var(--hair)}",`.dg-halo{fill:none;stroke:var(--c);stroke-width:${ae.halo};stroke-opacity:.16}`,`.dg-on{fill:none;stroke:var(--c);stroke-width:${ae.on}}`,`.dg-ic{fill:${Pe(be.icon)}}`,`.dg-slot{fill:none;stroke:${Pe(be.slot,"transparent")};stroke-width:${ae.slot};stroke-dasharray:3 3}`,`.dg-gl{fill:none;stroke:var(--c);stroke-width:${ae.glyph};stroke-linecap:round;stroke-linejoin:round}`,`.dg-sn{${ie(M.boxName)};fill:var(--ink)}`,`.dg-ss{${ie(M.boxSub)};fill:var(--mute)}`,`.dg-ss-ok{${ie(M.boxSubStrong)};fill:var(--ct)}`,`.dg-ss-act{${ie(M.boxSubStrong)};fill:var(--ink)}`,`.dg-ll{stroke:var(--line);stroke-width:${ae.lifeline};stroke-dasharray:3 4}`,`.dg-e{fill:none;stroke:var(--line);stroke-width:${ae.edge};stroke-linecap:round;stroke-dasharray:0 ${g.edge.ghostDash}}`,`.dg-eh{fill:none;stroke:var(--line);stroke-width:${ae.arrow};stroke-linecap:round;stroke-linejoin:round}`,`.dg-e-on{fill:none;stroke:var(--c);stroke-width:${ae.edgeOn};stroke-linecap:round;stroke-dasharray:1 2}`,`.dg-eh-on{fill:none;stroke:var(--c);stroke-width:${ae.edgeOn};stroke-linecap:round;stroke-linejoin:round}`,`.dg-flow{fill:none;stroke:var(--surf);stroke-width:${ae.flow};stroke-linecap:round;stroke-dasharray:1.5 ${g.edge.flowDash}}`,`.dg-e-past{fill:none;stroke:${sn};stroke-width:${ae.edge};stroke-linecap:round}`,`.dg-eh-past{fill:none;stroke:${sn};stroke-width:${ae.arrow};stroke-linecap:round;stroke-linejoin:round}`,".dg-bd{cursor:pointer}",".dg-bdf{fill:var(--c)}",`.dg-bdft{${ie(M.badge)};fill:var(--on-c)}`,`.dg-bdr{fill:none;stroke:var(--c);stroke-width:${ae.badgeRing};pointer-events:none}`,`.dg-bdp{fill:${Pe(be.badgePast)};stroke:${Pe(be.badgePastEdge,"transparent")};stroke-width:${ae.hair}}`,`.dg-bdpt{${ie(M.badge)};fill:var(--ct)}`,`.dg-bdp-g{fill:var(--surf);stroke:${sn};stroke-width:${ae.hair}}`,`.dg-bdpt-g{${ie(M.badge)};fill:var(--mute)}`,`.dg-cap rect,.dg-act rect{fill:${Pe(be.cap)};stroke:${Pe(be.capEdge,"transparent")}}`,`.dg-cap text{${ie(M.label)};fill:var(--ct)}`,`.dg-capj text{${ie(M.labelJa)}}`,`.dg-cap-past text{${ie(M.label)};fill:var(--mute);fill-opacity:${g.state.pastLabel}}`,`.dg-cap-pastj text{${ie(M.labelJa)}}`,`.dg-act text{${ie(M.action)};fill:var(--ct)}`,".dg-car{fill:var(--carry,var(--ink))}",`.dg-car-t{${ie(M.carrier)};fill:var(--bg)}`,`.dg-car-tj{${ie(M.carrierJa)}}`,`.dg-env{fill:var(--carry,var(--ink));stroke:var(--surf);stroke-width:${ae.envelope}}`,`.dg-env-in{fill:none;stroke:var(--surf);stroke-width:${ae.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:${ae.hair}}`,`.dg-sh{${ie(M.stripTitle)};fill:var(--ink)}`,`.dg-fl{${ie(M.fieldName)};fill:var(--mute)}`,`.dg-fv{${ie(M.fieldValue)};fill:var(--ink)}`,`.dg-fvj{${ie(M.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:${ae.trail}}`,".dg-tr-fill{fill:var(--c)}",".dg-tg rect{fill:var(--c)}",`.dg-tg text{${ie(M.tag)};fill:var(--on-c)}`,`.dg-side{fill:color-mix(in srgb,var(--c) ${be.side}%,var(--bg));stroke:${Pe(be.sideEdge,"transparent")};stroke-dasharray:4 4}`,`.dg-side-t{${ie(M.regionName)};fill:var(--ct)}`,`.dg-side-n{${ie(M.regionNote)};fill:var(--mute)}`,`.dg-ghost{fill:var(--surf);stroke:${Pe(be.ghostEdge,"transparent")};stroke-dasharray:4 3}`,`.dg-path{fill:none;stroke:${Pe(be.path,"transparent")};stroke-width:${ae.path};stroke-linecap:round;stroke-dasharray:0 ${g.edge.ghostDash}}`,`.dg-path-h{fill:none;stroke:${Pe(be.path,"transparent")};stroke-width:${ae.arrow};stroke-linecap:round;stroke-linejoin:round}`,`.dg-path-t{${ie(M.label)};fill:var(--ct)}`,`.dg-path-tj{${ie(M.labelJa)}}`,".dg-start{fill:var(--ink)}",`.dg-end{fill:var(--bg);stroke:var(--ink);stroke-width:${ae.end}}`,".dg-end-in{fill:var(--ink)}",`.dg-end-x{fill:var(--bg);stroke:${Pe(be.path,"transparent")};stroke-width:${ae.arrow};stroke-dasharray:2 2.5}`,`.dg-end-xi{fill:${Pe(be.path,"transparent")}}`,`.dg-mark{${ie(M.regionNote)};fill:var(--mute)}`,`.dg-done{fill:var(--ink);stroke:var(--surf);stroke-width:${ae.done}}`,`.dg-done-ck{fill:none;stroke:var(--surf);stroke-width:${ae.glyph};stroke-linecap:round;stroke-linejoin:round}`,".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{${ie(M.miniTitle)};fill:var(--mute)}`,".dg-mm-world{fill:var(--sunk);stroke:var(--hair)}",`.dg-mm-band{fill:${Pe(be.miniBand)};stroke:${Pe(be.miniBandEdge,"transparent")};stroke-width:.6}`,`.dg-mm-card{fill:${Pe(be.mini)}}`,`.dg-mm-vp{fill:color-mix(in srgb,var(--ink) ${be.view}%,transparent);stroke:var(--ink);stroke-width:${ae.badgeRing};vector-effect:non-scaling-stroke}`].join("");function es(e){let n=2166136261;for(let o=0;o<e.length;o++)n^=e.charCodeAt(o),n=Math.imul(n,16777619);return(n>>>0).toString(36)}function ts(e){let n=new Map,o=(i,a)=>{n.set(i,(n.get(i)??new Set).add(a))};return e.steps.forEach((i,a)=>{for(let t of i.events)t.type==="edge"?(o(t.from,a),o(t.to,a)):(t.type==="action"||t.type==="swap")&&o(t.box,a)}),new Map([...n].map(([i,a])=>[i,[...a].sort((t,r)=>t-r)]))}function ns(e,n,o){let i=[],a=0;for(let r of n.events){let s=e.steps[r.step]?.events[r.event];s?.type==="swap"&&i.push({t:r.at,order:a++,box:s.box,set:s.text}),o&&s?.type==="action"&&(i.push({t:r.at,order:a++,box:s.box,act:s.label}),i.push({t:n.steps[r.step].end,order:a++,box:s.box,act:null}))}i.sort((r,s)=>r.t-s.t||r.order-s.order);let t=new Map;for(let r of e.boxes){let s=[r.sub??"","dg-ss"],l,c=s.join("|"),d=[];for(let b of i.filter(u=>u.box===r.id)){b.set!==void 0&&(s=[b.set,"dg-ss-ok"],l=void 0),b.act!==void 0&&(l=b.act??void 0);let u=l!==void 0?[l,"dg-ss-act"]:s;u.join("|")!==c&&(c=u.join("|"),d.push([b.t,u[0],u[1]]))}let v=d.filter((b,u)=>{let w=d[u+1];return w===void 0||w[0]-b[0]>=J.minShow});t.set(r.id,v)}return t}function rs(e,n,o){let i=new Map;for(let a of n.events){let t=e.steps[a.step]?.events[a.event];if(t?.type!=="strip")continue;let r=o.badges[a.step]?.color??"slate",s=i.get(t.field)??[],l=n.steps[a.step].end;s.push({at:a.at,color:r,step:a.step,until:l,...t.value!==void 0?{value:t.value}:{},...t.tag!==void 0?{tag:t.tag}:{}}),i.set(t.field,s)}return i}function ss(e,n,o){if(e.until===void 0||!n.after)return n;let i=o[e.until].start,{after:a,...t}=n;return i>a.start?{...t,after:{start:a.start,end:Math.min(a.end,i)}}:t}function on(e,n,o,i,a,t,r=[],s=[]){let l=es(`${JSON.stringify(e)}|${i.id}|${a}|${t?`${t.width}|${t.lang}`:""}`),c=new Gt(`dg${l}`,o.total,o.last),d={m:c,t:o,sh:`filter="url(#dg-sh-${l})"`,end:o.steps[o.steps.length-1].end,ink:r,traces:s},v=ts(e),b=ns(e,o,n.kind!=="sequence"),u={band:[],base:[],lit:[],node:[],badge:[],top:[]};for(let E of n.regions)u.band.push(Cn(E,r));let w=n.boxes.find(E=>E.ghost)?.color??"slate";n.side&&u.band.push(Gn(n.side,w,r));let L=(E,H)=>n.boxes.find(U=>U.id===E&&(H===void 0||U.ghost===H))?.color;for(let E of n.paths)u.base.push(Wn(E,L(E.to,!0)??L(E.from)??w,r,s));for(let E of n.ends)u.node.push(Yn(E,w,r));let $=n.kind==="state",f=new Map((o.states??[]).flatMap(E=>E.lit[0]?[[E.box,E.lit[0].start]]:[]));n.strip&&u.band.push(Zn(n.strip,rs(e,o,n),d,$,f));for(let E of n.lifelines)u.base.push(Hn(E.x,E.y1,E.y2));for(let E of n.edges){let H=o.edges.find(le=>le.step===E.step&&le.event===E.event);if(!H)continue;let U=Kn(E,H,d,$);u.base.push(U.base),u.lit.push(U.lit)}let y=new Map((o.states??[]).map(E=>[E.box,E]));for(let E of n.boxes){if(E.ghost){u.node.push(_n(E,r));continue}let H=y.get(E.id);u.node.push(Fn(E,d,v.get(E.id)??[],b.get(E.id)??[],$?H?.lit??[]:void 0)),H?.done!==void 0&&u.node.push(Vn(E,H.done,d))}for(let E of n.badges)u.badge.push(Jn(E,d,$));for(let E of n.labels){let H=o.labels.find(U=>U.step===E.step&&U.event===E.event);H&&u.top.push(Xn(E,ss(E,H,o.steps),d))}for(let E of n.actions){let H=o.events.find(U=>U.step===E.step&&U.event===E.event);H&&u.top.push(zn(E,H.at,o.steps[E.step].end,d))}for(let E of o.carriers){let H=n.edges.find(U=>U.step===E.step&&U.event===E.event);H&&u.top.push(Un(H,E,d))}let h=Object.values(u).map(E=>E.join("")).join(""),{near:N,far:j,nearY:I,farY:Y}=g.shadow,Z=`<filter id="dg-sh-${l}" x="-20%" y="-30%" width="140%" height="180%"><feDropShadow dx="0" dy="${I}" stdDeviation="${N}" style="flood-color:var(--sh);flood-opacity:var(--shA)"/><feDropShadow dx="0" dy="${Y}" stdDeviation="${j}" style="flood-color:var(--sh);flood-opacity:var(--shB)"/></filter>`,B=t&&n.kind==="sequence"?n.boxes.map(E=>Bn(E,d,v.get(E.id)??[],b.get(E.id)??[])).join(""):"",X=t?as(n,o,e,c,l,h,t,B):{body:`<rect class="dg-bg" width="${n.width}" height="${n.height}" rx="${g.region.radius}"/>${h}`,w:n.width,h:n.height},ge=`.dg-${l}{${$t};--T:${o.total}s;${vt(i,a)}}${Qr}${c.frames.join("")}`;return`<svg xmlns="http://www.w3.org/2000/svg" class="dg dg-${l}" viewBox="0 0 ${Math.ceil(X.w)} ${Math.ceil(X.h)}" width="${Math.ceil(X.w)}" height="${Math.ceil(X.h)}" role="img" aria-label="${Ne(e.title)}" data-dragon="figure" data-view="${t?"follow":"fixed"}"><style>${ge}</style><defs>${Z}</defs>${X.body}</svg>`}function er(e){let n=Math.min(...e.map(i=>i.x)),o=Math.min(...e.map(i=>i.y));return{x:n,y:o,w:Math.max(...e.map(i=>i.x+i.w))-n,h:Math.max(...e.map(i=>i.y+i.h))-o}}function os(e,n,o){let i=tr(e,n,o);return i.length===0?void 0:er(i)}function is(e,n,o,i){let a=g.badge.r+g.follow.badgeRoom,{x:t,y:r}=e,s=c=>Math.hypot(Math.max(0,c.x-t,t-c.x-c.w),Math.max(0,c.y-r,r-c.y-c.h)),l={x:t-a,y:r-a,w:a*2,h:a*2};for(let c of[...n].sort((d,v)=>s(d)-s(v))){let d=er([l,c]);d.w<=o&&d.h<=i&&(l=d)}return l}function tr(e,n,o){let i=[];for(let a of e.edges.filter(t=>t.step===o)){let t=a.points.map(s=>s[0]),r=a.points.map(s=>s[1]);i.push({x:Math.min(...t),y:Math.min(...r),w:Math.max(...t)-Math.min(...t),h:Math.max(...r)-Math.min(...r)})}i.push(...e.labels.filter(a=>a.step===o),...e.actions.filter(a=>a.step===o));for(let a of n.steps[o]?.events??[]){let t=a.type==="edge"?[a.from,a.to]:a.type==="action"||a.type==="swap"?[a.box]:[];for(let r of t){let s=e.boxes.find(l=>l.id===r);s&&(e.kind==="architecture"||a.type==="swap")&&i.push(s)}}return i}function as(e,n,o,i,a,t,r,s){let l=g.follow,c=g.mini,d=Math.max(1,r.width),v=Math.min(e.width,d),b=Xe[r.lang].overview,u=ee=>{let se=Math.min(c.w,v*.4,ee*.4/e.height*e.width),F=se/e.width,ce=e.height*F,m=Math.max(se,Math.ceil(Q(b,M.miniTitle)));return{vh:ee,mw:se,k:F,mh:ce,bw:m,bgW:m+c.pad*2,bgH:ce+c.pad*2+c.title,beside:ce>se}},w=u(Math.min(e.height,Math.max(l.minH,v*l.aspect))),L=w.beside&&d<l.narrow,$=r.height===void 0?Number.POSITIVE_INFINITY:w.beside?r.height:r.height-w.bgH-c.inset,{vh:f,mw:y,k:h,mh:N,bw:j,bgW:I,bgH:Y,beside:Z}=$<w.vh?u(Math.max(l.fitMinH,$)):{...w,vh:Number.isFinite($)?Math.min(e.height,$):w.vh},B=Z&&!L?Math.min(e.width,d-I-c.inset):v,X=ee=>Math.min(e.width-B/2,Math.max(B/2,ee)),ge=s===""?0:Math.max(...e.boxes.map(ee=>ee.y+ee.h))+l.headRoom,E=s===""?0:l.head.pad*2+l.head.h,H=f-E,U=ee=>Math.min(e.height-H/2,Math.max(ge+H/2,ee)),le=g.badge.r,R=[e.width/2,e.height/2],A=n.steps.map((ee,se)=>{let F=os(e,o,se);R=F?[F.x+F.w/2,F.y+F.h/2]:R;let ce=[X(R[0]),U(R[1])],m=e.badges.find(P=>P.step===se);if(!m||Math.abs(m.x-ce[0])<=B/2-le&&Math.abs(m.y-ce[1])<=H/2-le)return ce;let T=is(m,tr(e,o,se),B,H);return R=[T.x+T.w/2,T.y+T.h/2],[X(R[0]),U(R[1])]}).map(([ee,se])=>[ee,se-E/2]),C=A[0],D=[[0,C[0],C[1]],[n.steps[0].start,C[0],C[1]]];A.forEach((ee,se)=>{if(se===0)return;let F=A[se-1],ce=n.steps[se].start;D.push([ce,F[0],F[1],1,de.inOut],[ce+l.ease,ee[0],ee[1]])});let ne=A[A.length-1];D.push([n.last,ne[0],ne[1],1,de.inOut],[n.total,C[0],C[1]]);let te=i.move(D.map(([ee,se,F,ce,m])=>[ee,B/2-se,f/2-F,ce,m])),re=Z?B+c.inset:B-I-c.inset,Se=Z?0:f+c.inset,oe=re+c.pad,he=oe+(j-y)/2,xe=Se+c.pad+c.title,we=L?{clip:"",body:""}:(()=>{let ee=[...e.regions.map(F=>`<rect class="dg-mm-band" style="${$e(F.color)}" x="${he+F.x*h}" y="${xe+F.y*h}" width="${F.w*h}" height="${F.h*h}" rx="3"/>`),...e.boxes.map(F=>`<rect class="dg-mm-card" style="${$e(F.color)}" x="${he+F.x*h}" y="${xe+F.y*h}" width="${F.w*h}" height="${F.h*h}" rx="1.5"/>`)].join(""),se=i.move(D.map(([F,ce,m,,T])=>[F,he+(ce-B/2)*h,xe+(m-f/2)*h,1,T]));return{clip:`<clipPath id="dg-mm-${a}"><rect x="${he}" y="${xe}" width="${y}" height="${N}" rx="4"/></clipPath>`,body:`<rect class="dg-mm-bg" x="${re}" y="${Se}" width="${I}" height="${Y}" rx="${c.radius}"/><text class="dg-mm-t" x="${oe}" y="${xe-c.pad+2}">${b}</text><g clip-path="url(#dg-mm-${a})"><rect class="dg-mm-world" x="${he}" y="${xe}" width="${y}" height="${N}"/>${ee}<rect class="dg-mm-vp dg-a"${E===0?"":` y="${E*h}"`} width="${B*h}" height="${(f-E)*h}" rx="2" style="${se}"/></g>`}})(),Ee=E===0?"":`<g class="dg-hd"><rect class="dg-hd-bg" width="${B}" height="${E}"/><line class="dg-sep" x1="0" y1="${E}" x2="${B}" y2="${E}"/><g class="dg-a" style="${i.move(D.map(([ee,se,,F,ce])=>[ee,B/2-se,0,F,ce]))}">${s}</g></g>`;return{body:`<defs><clipPath id="dg-vp-${a}"><rect width="${B}" height="${f}" rx="${g.region.radius}"/></clipPath>${we.clip}</defs><g clip-path="url(#dg-vp-${a})"><rect class="dg-vp-bg" width="${B}" height="${f}"/><g class="dg-a" style="${te}">${t}</g>${Ee}</g><rect class="dg-vp-frame" x="0.5" y="0.5" width="${B-1}" height="${f-1}" rx="${g.region.radius}"/>${we.body}`,w:Z&&!L?B+c.inset+I:v,h:Z?f:Se+Y}}function nr(e,n={}){let o=n.lang??"ja",i=En(e,{lang:o});if(!i.ok)throw new Error(Xe[o].cannotDraw(i.errors.map(r=>`${r.pointer} ${r.message}`).join(" / ")));let a=i.diagram,t=a.kind==="sequence"?xn(a):a.kind==="state"?vn(a,o):yn(a);return ls(a,t,Tn(a),n)}function ls(e,n,o,i={}){let a=wt(i.palette),t=i.theme==="dark"?"dark":"light",r=[],s=[];return{svg:on(e,n,o,a,t,void 0,r,s),palette:a.id,theme:t,...e.view?{view:e.view}:{},fonts:{...ft},layout:n,timeline:o,diagram:e,overlaps:qn(r,o.stills,s)}}function an(e,n,o){let i=Math.max(0,n)/e.layout.width,t=(o===void 0?i:Math.min(i,Math.max(0,o)/e.layout.height))*M.boxName.size;return e.view?{mode:e.view,textPx:t}:{mode:t>=mn?"fixed":"follow",textPx:t}}var Yt=e=>`font:${e.weight} ${e.size}px var(--${e.family})`,me=e=>`${e}px`;function cs(){let e=g.player,n=me(e.hidden);return[`.dg-player{display:flex;flex-direction:column;gap:${me(e.gap)};color:var(--ink)}`,`.dg-player .dg-frame{border-radius:${me(e.radius)};overflow:hidden}`,".dg-bar{container:dg-bar/inline-size}",`.dg-row{display:flex;align-items:flex-start;gap:${me(e.gap)}}`,`.dg-btns{display:flex;gap:${me(e.gap/2)};flex:none}`,`.dg-btn{width:${me(e.button)};height:${me(e.button)};border-radius:${me(e.radius)};border:${me(g.stroke.hair)} solid var(--hair);background:var(--surf);color:var(--ink);${Yt(M.button)};cursor:pointer}`,`.dg-btn:focus-visible{outline:${me(e.focus)} solid var(--c-blue);outline-offset:${me(e.focus)}}`,`.dg-say{display:flex;gap:${me(e.gap)};min-width:0}`,`.dg-no{${Yt(M.stepNo)};color:var(--mute);padding-top:${me(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{${Yt(M.stepTitle)};margin:0}`,`.dg-tb{${Yt(M.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 < ${me(e.narrow)}){.dg-row{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:start;gap:0 ${me(e.gap)}}.dg-say,.dg-txt,.dg-txt>*{display:contents}.dg-btns{grid-area:1/1;margin-bottom:${me(e.gap/2)}}.dg-btn{width:${me(e.touch)};height:${me(e.touch)}}.dg-no{grid-area:1/2;display:flex;align-items:center;min-height:${me(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:${me(e.touch)};height:${me(e.touch)}}}`,`.dg-spot{fill:none;stroke:var(--t-amber);stroke-width:${me(g.stroke.mark)};stroke-dasharray:${g.mark.dash} ${g.mark.gap};pointer-events:none}`].join("")}function ps(e){if(e.getElementById("dragon-player-css"))return;let n=e.createElement("style");n.id="dragon-player-css",n.textContent=cs(),e.head.appendChild(n)}var bt={prev:"\u2039",pause:"\u275A\u275A",play:"\u25B6",next:"\u203A"},rr="http://www.w3.org/2000/svg",sr=e=>String(e).padStart(2,"0"),ds=(e,n)=>`${sr(e+1)}/${sr(n)}`;function or(e,n,o={}){let i=e.ownerDocument,a=i.defaultView,t=!!a?.matchMedia?.("(prefers-reduced-motion: reduce)").matches,r=nr(n,o),s=o.lang??"ja",l=Xe[s],c=wt(r.palette),{timeline:d}=r,v=r.diagram.steps,b=v.length;ps(i);let u=i.createElement("div");u.className="dg-player",u.dataset.dragon="player",u.setAttribute("style",`${$t};${vt(c,r.theme)}`);let w=i.createElement("div");w.className="dg-frame";let L=(k,q,W)=>{let _=i.createElement("button");return _.type="button",_.className="dg-btn",_.dataset.dragon=k,_.setAttribute("aria-label",q),_.textContent=W,_},$=L("prev",l.prev,bt.prev),f=L("toggle",l.pause,bt.pause),y=L("next",l.next,bt.next),h=i.createElement("div");h.className="dg-btns",h.setAttribute("lang",s),h.append($,f,y);let N=i.createElement("div");N.className="dg-say",N.setAttribute("aria-hidden","true");let j=i.createElement("div");j.className="dg-no",j.dataset.dragon="step-no";let I=i.createElement("div");I.className="dg-txt";let Y=i.createElement("p");Y.className="dg-tt",Y.dataset.dragon="step-title";let Z=i.createElement("p");Z.className="dg-tb",Z.dataset.dragon="step-body";let B=i.createElement("div");B.append(Y,Z),I.append(B);for(let k of v){let q=i.createElement("div");q.className="dg-room",q.dataset.dragon="caption-room";let W=i.createElement("p");W.className="dg-tt",W.textContent=k.title;let _=i.createElement("p");_.className="dg-tb",_.textContent=k.body,q.append(W,_),I.append(q)}N.append(j,I);for(let k of[j,Y,Z])k.setAttribute("aria-hidden","true");let X=i.createElement("div");X.className="dg-row",X.append(h,N);let ge=i.createElement("div");ge.className="dg-bar",ge.append(X);let E=i.createElement("ol");E.className="dg-sr",E.dataset.dragon="steps",E.setAttribute("aria-label",l.steps(r.diagram.title));for(let k of v){let q=i.createElement("li"),W=i.createElement("strong");W.textContent=k.title,q.append(W);for(let _ of k.body.split(`
2
- `)){let ve=i.createElement("p");ve.textContent=_,q.append(ve)}E.append(q)}u.append(w,ge,E),e.append(u);let H=()=>w.clientWidth||e.clientWidth||r.layout.width,U=()=>{if(!o.fitHeight||!a)return;let k=a.getComputedStyle(w),q=w.clientHeight-(Number.parseFloat(k.paddingTop)||0)-(Number.parseFloat(k.paddingBottom)||0);return q>0?q:void 0},le=an(r,H(),U()).mode,R=H(),V=U(),A=null,C=0,D=!t,ne=t?d.stills[0]??0:0,te=Date.now(),re=[],Se=()=>{if(!A)return;for(let W of A.querySelectorAll(".dg-spots"))W.remove();if(re.length===0)return;let k=g.mark,q=i.createElementNS(rr,"g");q.setAttribute("class","dg-spots");for(let W of re){let _=i.createElementNS(rr,"rect");_.setAttribute("class","dg-spot"),_.setAttribute("x",String(W.x-k.pad)),_.setAttribute("y",String(W.y-k.pad)),_.setAttribute("width",String(W.w+k.pad*2)),_.setAttribute("height",String(W.h+k.pad*2)),_.setAttribute("rx",String(k.radius)),q.append(_)}(A.querySelector('g[clip-path^="url(#dg-vp-"] > g.dg-a')??A).append(q)},oe=k=>{let q;if(k!==void 0){let W=i.createElement("div");W.innerHTML=k,q=W.querySelector("svg")}else q=A?A.cloneNode(!0):null;q&&(q.setAttribute("aria-hidden","true"),q.removeAttribute("role"),q.removeAttribute("aria-label"),q.style.setProperty("--at",String(ne)),q.style.setProperty("--play",D?"running":"paused"),q.dataset.motion=D?"play":"still",A?A.replaceWith(q):w.append(q),A=q,te=Date.now(),Se())},he=()=>le==="follow"?on(r.diagram,r.layout,d,c,r.theme,{width:R,...V===void 0?{}:{height:V},lang:s}):r.svg,xe=()=>D?(ne+(Date.now()-te)/1e3)%d.total:ne,Oe=k=>{let q=0;return d.steps.forEach((W,_)=>{W.start<=k&&(q=_)}),q},we=()=>{let k=v[C];j.textContent=ds(C,b),Y.textContent=k?.title??"",Z.textContent=k?.body??"",f.setAttribute("aria-label",D?l.pause:l.play),f.textContent=D?bt.pause:bt.play,o.onStep?.(C)},Ee=(k,q)=>{ne=k,D=q,oe(),we()},je=k=>{C=Math.min(b-1,Math.max(0,k));let q=d.steps[C];Ee(D?q.start:d.stills[C]??q.start,D)};oe(he()),we();let ee=a?.setInterval(()=>{if(!D)return;let k=Oe(xe());k!==C&&(C=k,we())},120),se=()=>je(C-1),F=()=>je(C+1),ce=()=>D?Ee(xe(),!1):Ee(ne,!0),m=k=>{let q=k.target?.closest?.("[data-step]"),W=q?Number(q.getAttribute("data-step")):Number.NaN;Number.isInteger(W)&&je(W)};$.addEventListener("click",se),y.addEventListener("click",F),f.addEventListener("click",ce),w.addEventListener("click",m);let T=a?.ResizeObserver,P=T?new T(()=>{let k=H(),q=U(),W=an(r,k,q).mode;if(W===le&&(le==="fixed"||k===R&&q===V))return;let _=xe();le=W,R=k,V=q,ne=_,oe(he())}):void 0;return P?.observe(w),{get step(){return C},get playing(){return D},next:F,prev:se,play:()=>{D||Ee(ne,!0)},pause:()=>{D&&Ee(xe(),!1)},goTo:k=>{D=!1,je(k)},mark:k=>{re=k,Se()},destroy:()=>{ee!==void 0&&a?.clearInterval(ee),P?.disconnect(),$.removeEventListener("click",se),y.removeEventListener("click",F),f.removeEventListener("click",ce),w.removeEventListener("click",m),u.remove()}}}return fr(fs);})();
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);})();