@cardenelabs/dragon 0.37.0 → 0.40.0

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