@cardenelabs/dragon 0.36.3 → 0.37.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.
@@ -1,2 +1,2 @@
1
- "use strict";var DragonPlayer=(()=>{var Xe=Object.defineProperty;var Gt=Object.getOwnPropertyDescriptor;var Yt=Object.getOwnPropertyNames;var Ht=Object.prototype.hasOwnProperty;var Kt=(e,n)=>{for(var s in n)Xe(e,s,{get:n[s],enumerable:!0})},zt=(e,n,s,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of Yt(n))!Ht.call(e,o)&&o!==s&&Xe(e,o,{get:()=>n[o],enumerable:!(a=Gt(n,o))||a.enumerable});return e};var Xt=e=>zt(Xe({},"__esModule",{value:!0}),e);var Vn={};Kt(Vn,{mountDiagram:()=>Wt});var we={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`},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}`}};var lt={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 $e={sans:"Noto Sans JP Variable",mono:"JetBrains Mono Variable"},Jt={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},Qt=600,Zt=11904,Me=1e3;function ct(e,n){return(e.codePointAt(0)??0)>=Zt?Me:n==="mono"?Qt:Jt[e]??Me}var en="paper",Ue=Object.fromEntries(Object.entries(lt).map(([e,n])=>[e,{id:e,...n}]));function Se(e){return(e!==void 0&&Object.hasOwn(Ue,e)?Ue[e]:void 0)??Ue[en]}function Oe(e,n){return Object.entries(e[n]).map(([s,a])=>`--${s}:${a}`).join(";")}var Ee=`--sans:"${$e.sans}";--mono:"${$e.mono}"`,ke=["blue","amber","green","violet","rose"],Q=(e,n,s="sans")=>({size:e,weight:n,family:s}),L={boxName:Q(13,650),boxSub:Q(11,500),boxSubStrong:Q(11,700),regionName:Q(12.5,700),regionNote:Q(11,500),label:Q(11,600,"mono"),labelJa:Q(11,650),action:Q(11,650),badge:Q(10.5,700,"mono"),carrier:Q(10.5,700,"mono"),carrierJa:Q(10.5,700),stripTitle:Q(12.5,700),fieldName:Q(10.5,600),fieldValue:Q(12,600,"mono"),fieldValueJa:Q(12,600),tag:Q(10.5,700),miniTitle:Q(10.5,700),stepTitle:Q(15,700),stepBody:Q(13.5,500),stepNo:Q(13,700,"mono"),button:Q(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},edge:{inset:3,arrow:6,arrowHalf:3.5,parallel:5,ghostDash:5,flowDash:9},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},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},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},baseline:{label:3.8,badge:3.5,carrier:3.7,stripTitle:4.5,tag:3.6,action:3.8},rise:5,popFrom:.4,player:{gap:10,radius:12,button:36,touch:44,hidden:1,focus:2,narrow:440}},Y={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},pt=10.5,Z={inOut:"cubic-bezier(.65,0,.35,1)",out:"cubic-bezier(.22,1,.36,1)",pop:"cubic-bezier(.34,1.56,.64,1)"};var be=e=>[...e].some(n=>(n.codePointAt(0)??0)>=11904);function tn(e,n){return n==="mono"&&be(e)?"sans":n}function z(e,n){let s=tn(e,n.family),a=0;for(let o of e)a+=ct(o,s);return a*n.size/Me}function Je(e){return e.steps.flatMap((n,s)=>n.events.flatMap((a,o)=>a.type==="edge"?[{step:s,event:o,edge:a}]:[]))}function qe(e){let n=Qe(e),s=new Map;return e.boxes.forEach((a,o)=>{let t=a.region===void 0?void 0:n.get(a.region);s.set(a.id,a.color??t??ke[o%ke.length])}),s}function Qe(e){let n=new Map;return(e.regions??[]).forEach((s,a)=>n.set(s.id,s.color??ke[a%ke.length])),n}var Le=(e,n)=>e.carry.kind==="coin"?"coin":n.get(e.from)??"slate";function Te(e,n,s){let a=e.boxes.find(t=>t.id===n);if(!a)return b.box.minW;let o=[z(a.name,L.boxName),z(a.sub??"",L.boxSub)];for(let t of e.steps)for(let r of t.events)r.type==="swap"&&r.box===n&&o.push(z(r.text,L.boxSubStrong)),s&&r.type==="action"&&r.box===n&&o.push(z(r.label,L.boxSubStrong));return Math.max(b.box.minW,Math.max(...o)+b.box.padX*2)}function dt(e,n){let s=Math.max(n.x-(e.x+e.w),e.x-(n.x+n.w)),a=Math.max(n.y-(e.y+e.h),e.y-(n.y+n.h));return Math.max(s,a)}function nn(e){let n={a:e[0],b:e[1]??e[0],length:-1};for(let s=1;s<e.length;s++){let a=e[s-1],o=e[s],t=Math.hypot(o[0]-a[0],o[1]-a[1]);t>n.length&&(n={a,b:o,length:t})}return{a:n.a,b:n.b,vertical:Math.abs(n.b[0]-n.a[0])<Math.abs(n.b[1]-n.a[1])}}function Ze(e,n){let s=n;for(let a=1;a<e.length;a++){let o=e[a-1],t=e[a],r=Math.hypot(t[0]-o[0],t[1]-o[1]);if(s<=r&&r>0)return[o[0]+(t[0]-o[0])*s/r,o[1]+(t[1]-o[1])*s/r];s-=r}return e[e.length-1]}function et(e){let n=0;for(let s=1;s<e.length;s++){let a=e[s-1],o=e[s];n+=Math.hypot(o[0]-a[0],o[1]-a[1])}return n}function je(e){let n=et(e);return Ze(e,n<b.badge.short?n/2:b.badge.along)}var ve=e=>be(e)?L.labelJa:L.label;function Ne(e,n){let s=z(e.text,ve(e.text))+b.label.padX*2,a=b.label.h,o=nn(e.points),t=(o.a[0]+o.b[0])/2,r=(o.a[1]+o.b[1])/2,i=e.side??(o.vertical?"right":"above"),{offset:l,side:c}=b.label,f=i==="above"?{x:t-s/2,y:r-l-a/2,w:s,h:a}:i==="below"?{x:t-s/2,y:r+l-a/2,w:s,h:a}:i==="left"?{x:t-c-s,y:r-a/2,w:s,h:a}:{x:t+c,y:r-a/2,w:s,h:a},u=i==="above"?[0,-1]:i==="below"?[0,1]:i==="left"?[-1,0]:[1,0],g=[Math.abs(u[1]),Math.abs(u[0])],p=i==="above"||i==="below"?s:a*4,d=h=>n.hard.every(x=>dt(h,x)>=b.gap)&&n.soft.every(x=>dt(h,x)>=b.label.soft),{search:v,searchMax:E}=b.label;for(let h=0;h<=E;h+=v)for(let x=0;x<=p;x+=v)for(let w of x===0?[1]:[1,-1]){let T={x:f.x+u[0]*h+g[0]*x*w,y:f.y+u[1]*h+g[1]*x*w,w:s,h:a};if(d(T))return{...T,step:e.step,event:e.event,text:e.text,family:ve(e.text).family,color:e.color}}return{...f,step:e.step,event:e.event,text:e.text,family:ve(e.text).family,color:e.color}}function ft(e,n){let s=0,a=0;for(let t of e.steps)for(let r of t.events)r.type!=="strip"||r.field!==n||(r.value!==void 0&&(s=Math.max(s,z(r.value,be(r.value)?L.fieldValueJa:L.fieldValue))),r.tag!==void 0&&(a=Math.max(a,z(r.tag,L.tag)+b.strip.tagPadX*2)));let o=s+(a>0?(s>0?b.strip.tagGap:0)+a:0);return Math.max(z(n,L.fieldName),o)}function Ae(e){if(!e.strip)return 0;let{titleX:n,fieldGap:s,pad:a}=b.strip;return n+z(e.strip.title,L.stripTitle)+s+e.strip.fields.reduce((t,r)=>t+ft(e,r)+s,0)-s+a}function Ce(e,n,s,a){if(!e.strip)return;let{titleX:o,fieldGap:t,pad:r,line:i,h:l}=b.strip,c=o+z(e.strip.title,L.stripTitle)+t,f=[],u=c,g=0;for(let p of e.strip.fields){let d=ft(e,p);u>c&&u+d>a-r&&(u=c,g++),f.push({name:p,x:n+u,y:s+g*i,w:d}),u+=d+t}return{x:n,y:s,w:a,h:l+g*i,title:e.strip.title,fields:f}}function Re(e,n,s){let a=o=>{o.x+=n,o.y+=s};for(let o of e.boxes)a(o),o.cx+=n,o.cy+=s;for(let o of e.regions)o.y+=s,a(o.header);for(let o of e.lifelines)o.x+=n,o.y1+=s,o.y2+=s;for(let o of e.edges)o.points=o.points.map(([t,r])=>[t+n,r+s]),o.settle&&(o.settle=[o.settle[0]+n,o.settle[1]+s]);for(let o of e.labels)a(o);for(let o of e.actions)a(o);for(let o of e.badges)o.x+=n,o.y+=s;if(e.strip){e.strip.y+=s;for(let o of e.strip.fields)o.x+=n,o.y+=s}}function De(e,n,s){let{inset:a}=b.badge;for(let t of e){let r=t.type==="swap"||t.type==="action"?t.box:void 0,i=s.boxes.find(l=>l.id===r);if(i)return{step:n,x:i.x+a,y:i.y+a,color:i.color}}if(s.strip&&e.some(t=>t.type==="strip"))return{step:n,x:s.strip.x+a,y:s.strip.y+a,color:"slate"};let o=s.boxes[0];return{step:n,x:o.x+a,y:o.y+a,color:o.color}}function ut(e){let n=rn(e),s=sn(e,n),a=n.map(()=>({top:0,bottom:0})),o=mt(e,n,s,a);for(let t=0;t<3&&ln(o,n,s,a);t++)o=mt(e,n,s,a);return o}function rn(e){let n=e.regions??[],s=new Set(n.map(t=>t.id)),a=n.map(t=>({region:t,members:e.boxes.filter(r=>r.region===t.id).map(r=>r.id)})),o=e.boxes.filter(t=>t.region===void 0||!s.has(t.region)).map(t=>t.id);return o.length>0&&a.push({members:o}),a}var gt=e=>e==="left"||e==="right";function sn(e,n){let s=b.architecture.columns,a=Je(e).map(r=>r.edge),o=new Map;n.forEach((r,i)=>{let l=new Set(r.members),c=new Set,f=(h,x)=>h>=0&&h<s&&!c.has(`${h},${x}`),u=(h,x)=>{let w=Math.min(s-1,Math.max(0,h));for(let T=x;;T++)for(let k=0;k<s;k++)for(let A of[w+k,w-k])if(f(A,T))return[A,T]},g=(h,x,w)=>{o.set(h,{group:i,col:x,row:w}),c.add(`${x},${w}`)},p=1,d=h=>{for(let x of a){let w=x.from===h?x.to:x.to===h?x.from:void 0;if(w===void 0||!l.has(w)||o.has(w))continue;let T=o.get(h),[k,A]=gt(x.labelSide)?u(T.col,T.row+1):f(T.col+p,T.row)?[T.col+p,T.row]:u(T.col+p,T.row);g(w,k,A),d(w)}},v=h=>{for(let x=0;x<a.length;x++){let w=a[x],T=w?.from===h?w.to:w?.to===h?w.from:void 0,k=T===void 0?void 0:o.get(T);if(k&&k.group<i)return{order:x,col:k.col}}},E=0;for(;;){let h=r.members.filter(F=>!o.has(F));if(h.length===0)break;let x=h.map(F=>({id:F,anchor:v(F)})).filter(F=>F.anchor!==void 0);x.sort((F,H)=>(F.anchor?.order??0)-(H.anchor?.order??0));let w=x[0]??{id:h[0],anchor:void 0},T=w.anchor?.col??0;E===0&&(p=T>=(s-1)/2?-1:1);let[k,A]=f(T,0)?[T,0]:u(T,0);g(w.id,k,A),d(w.id),E++}});let t=[...new Set([...o.values()].map(r=>r.col))].sort((r,i)=>r-i);for(let r of o.values())r.col=t.indexOf(r.col);return o}function on(e){let n=[...e.matchAll(/ /g)].map(a=>a.index);if(n.length===0)return[e];let s=n.reduce((a,o)=>Math.abs(o-e.length/2)<Math.abs(a-e.length/2)?o:a);return[e.slice(0,s),e.slice(s+1)]}function an(e){let{icon:n,nameY:s,line:a,inset:o}=b.region,t=on(e.name),r=Math.max(n,...t.map(l=>z(l,L.regionName)),z(e.note??"",L.regionNote)),i=s-o+(t.length-1)*a+(e.note?a:0)+b.gap/2;return{w:r,h:i,lines:t}}function mt(e,n,s,a){let{box:o,region:t,architecture:r,margin:i,gap:l}=b,c=qe(e),f=Qe(e),u=Je(e),g=Math.max(1,...[...s.values()].map(m=>m.col+1)),p=new Map(e.boxes.map(m=>[m.id,Te(e,m.id,!0)])),d=Array.from({length:g},(m,S)=>Math.max(o.minW,...[...s].filter(([,y])=>y.col===S).map(([y])=>p.get(y)??o.minW))),v=Array.from({length:Math.max(0,g-1)},()=>r.columnGap);for(let{edge:m}of u){let S=s.get(m.from),y=s.get(m.to);if(!S||!y||m.label===void 0||S.group!==y.group||S.row!==y.row||Math.abs(S.col-y.col)!==1||gt(m.labelSide))continue;let P=z(m.label,ve(m.label))+b.label.padX*2+r.labelRoom*2,W=Math.min(S.col,y.col);P<=r.maxColumnGap&&(v[W]=Math.max(v[W]??0,P))}let E=n.map(m=>m.region?an(m.region):void 0),h=Math.max(0,...E.map(m=>m?m.w+t.inset*2:0)),x=[];for(let m=0;m<g;m++)x.push(m===0?i+(h>0?h:t.pad):x[m-1]+d[m-1]+v[m-1]);let w=m=>x[m]+d[m]/2,T=[],k=[],A=i;n.forEach((m,S)=>{let y=Math.max(1,...m.members.map(ne=>(s.get(ne)?.row??0)+1)),P=a[S],W=A+t.pad+P.top;for(let ne of m.members){let I=s.get(ne),V=e.boxes.find(j=>j.id===ne),C=p.get(ne)??o.minW,G=w(I.col),U=W+I.row*(o.h+r.rowGap);T.push({id:ne,name:V?.name??ne,...V?.sub!==void 0?{sub:V.sub}:{},...V?.icon!==void 0?{icon:V.icon}:{},color:c.get(ne)??"slate",x:G-C/2,y:U,w:C,h:o.h,cx:G,cy:U+o.h/2})}let J=W+y*o.h+(y-1)*r.rowGap,X=E[S],le=Math.max(J+t.pad+P.bottom-A,X?X.h+t.inset*2:0,m.region?t.minH:0);k.push({group:S,y:A,h:le,rows:y}),A+=le+t.gap});let F=A-t.gap,H=new Map(T.map(m=>[m.id,m])),_=m=>k[s.get(m)?.group??0],me=(m,S,y)=>T.some(P=>{if(P.id===S||P.id===y)return!1;let W=b.label.search;for(let J=1;J<m.length;J++){let[X,le]=m[J-1],[ne,I]=m[J];if(Math.min(X,ne)<=P.x+P.w+W&&Math.max(X,ne)>=P.x-W&&Math.min(le,I)<=P.y+P.h+W&&Math.max(le,I)>=P.y-W)return!0}return!1}),ge=m=>{let S=H.get(m),y=_(m);return(s.get(m)?.row??0)<y.rows-1?S.y+S.h+r.rowGap/2:Math.min(S.y+S.h+t.pad/2,y.y+y.h-b.edge.inset)},re=m=>{let S=H.get(m),y=_(m);return(s.get(m)?.row??0)>0?S.y-r.rowGap/2:Math.max(S.y-t.pad/2,y.y+b.edge.inset)},te=b.edge.inset,de=(m,S)=>{let y=H.get(m),P=H.get(S),W=s.get(m),J=s.get(S);if(W.group===J.group&&W.row===J.row){let G=P.cx>y.cx,U=[[G?y.x+y.w:y.x,y.cy],[G?P.x-te:P.x+P.w+te,P.cy]];if(!me(U,m,S))return U;let j=ge(m);return[[y.cx,y.y+y.h],[y.cx,j],[P.cx,j],[P.cx,P.y+P.h+te]]}let X=P.cy>y.cy,le=[y.cx,X?y.y+y.h:y.y],ne=[P.cx,X?P.y-te:P.y+P.h+te];if(W.col===J.col){let G=[le,ne];if(!me(G,m,S))return G;let U=y.x+y.w+(v[W.col]??r.columnGap)/2;return[[y.x+y.w,y.cy],[U,y.cy],[U,P.cy],[P.x+P.w+te,P.cy]]}let I=P.cx>y.cx,V=X?ge(m):re(m),C=[[le,[y.cx,P.cy],[I?P.x-te:P.x+P.w+te,P.cy]],[[I?y.x+y.w:y.x,y.cy],[P.cx,y.cy],ne],[le,[y.cx,V],[P.cx,V],ne]];return C.find(G=>!me(G,m,S))??C[2]},M=u.map(({step:m,event:S,edge:y})=>{let P=H.get(y.to);return{step:m,event:S,from:y.from,to:y.to,points:de(y.from,y.to),color:Le(y,c),carry:y.carry,settle:[P.cx,P.cy+o.iconY]}});for(let m of M){if(m.points.length!==2||!M.some(X=>X.from===m.to&&X.to===m.from&&X.points.length===2))continue;let[y,P]=m.points,W=Math.abs(P[1]-y[1])<Math.abs(P[0]-y[0]),J=(m.from<m.to?1:-1)*b.edge.parallel;m.points=m.points.map(([X,le])=>W?[X,le+J]:[X+J,le])}let q=[];n.forEach((m,S)=>{let y=k[S],P=E[S];!m.region||!P||q.push({id:m.region.id,lines:P.lines,...m.region.note!==void 0?{note:m.region.note}:{},...m.region.icon!==void 0?{icon:m.region.icon}:{},color:f.get(m.region.id)??"slate",x:i,y:y.y,w:0,h:y.h,header:{x:i+t.inset,y:y.y+t.inset,w:P.w,h:P.h}})});let O=[];for(let m of M){let S=e.steps[m.step]?.events[m.event];if(S?.type!=="edge"||S.label===void 0)continue;let y=[...q.map(P=>P.header),...O.filter(P=>P.step===m.step)];O.push(Ne({step:m.step,event:m.event,text:S.label,points:m.points,color:m.color,...S.labelSide?{side:S.labelSide}:{}},{hard:T,soft:y}))}let D={kind:"architecture",width:0,height:0,regions:q,boxes:T,lifelines:[],edges:M,labels:O,actions:[],badges:[]},B=O.length>0?Math.max(0,i+b.label.soft-Math.min(...O.map(m=>m.x))):0;B>0&&Re(D,B,0);let R=Math.max(...T.map(m=>m.x+m.w+t.pad),...O.map(m=>m.x+m.w+b.label.soft),...M.flatMap(m=>m.points.map(S=>S[0]+t.pad))),K=Math.max(R+i,Ae(e)+i*2);for(let m of q)m.w=K-i*2;let se=Ce(e,i,F+l,K-i*2);return D.width=K,D.height=(se?se.y+se.h:F)+i,se&&(D.strip=se),D.badges=e.steps.map((m,S)=>{let y=M.find(J=>J.step===S);if(!y)return De(m.events,S,D);let[P,W]=je(y.points);return{step:S,x:P,y:W,color:y.color}}),D}function ln(e,n,s,a){let o=!1,t=b.label.soft;for(let r of e.labels){let i=e.edges.find(d=>d.step===r.step&&d.event===r.event),l=i&&s.get(i.from),c=i&&s.get(i.to);if(!l||!c||l.group!==c.group||!n[l.group]?.region)continue;let f=e.regions.find(d=>d.id===n[l.group]?.region?.id),u=a[l.group];if(!f||!u)continue;let g=f.y+t-r.y,p=r.y+r.h-(f.y+f.h-t);g>0&&(u.top+=g,o=!0),p>0&&(u.bottom+=p,o=!0)}return o}function ht(e){let{box:n,sequence:s,label:a,margin:o,gap:t}=b,r=qe(e),i=e.sequence?.lifelines??[],l=[...i,...e.boxes.map(M=>M.id).filter(M=>!i.includes(M))],c=new Map(l.map((M,q)=>[M,q])),f=l.map(M=>Te(e,M,!1)),u=f.slice(1).map((M,q)=>f[q]/2+M/2+s.columnGap),g=[];for(let M of e.steps)for(let q of M.events){if(q.type!=="edge"||q.label===void 0)continue;let O=c.get(q.from)??0,D=c.get(q.to)??0,B=z(q.label,ve(q.label))+a.padX*2;O===D?O<u.length&&g.push({from:O,to:O+1,need:s.selfW+a.side+B+s.labelRoom}):g.push({from:Math.min(O,D),to:Math.max(O,D),need:B+s.labelRoom*2})}g.sort((M,q)=>M.to-M.from-(q.to-q.from));for(let{from:M,to:q,need:O}of g){let D=0;for(let R=M;R<q;R++)D+=u[R]??0;if(D>=O)continue;let B=(O-D)/(q-M);for(let R=M;R<q;R++)u[R]=(u[R]??0)+B}let p=[];l.forEach((M,q)=>p.push(q===0?o+f[0]/2:p[q-1]+u[q-1]));let d=l.map((M,q)=>{let O=e.boxes.find(R=>R.id===M),D=f[q],B=p[q];return{id:M,name:O?.name??M,...O?.sub!==void 0?{sub:O.sub}:{},...O?.icon!==void 0?{icon:O.icon}:{},color:r.get(M)??"slate",x:B-D/2,y:o,w:D,h:n.h,cx:B,cy:o+n.h/2}}),v=o+n.h,E=[],h=[],x=[],w=v+s.firstRow,T=0,k=!0;e.steps.forEach((M,q)=>{M.events.forEach((O,D)=>{if(O.type!=="edge"&&O.type!=="action")return;let B,R;if(O.type==="edge"){let K=O.labelSide??"above",se=O.from===O.to,m=O.label!==void 0;B=m&&K==="above"?a.offset+a.h/2:t,R=se?s.selfH+t:m&&K==="below"?a.offset+a.h/2:t}else B=b.action.h/2,R=b.action.h/2;if(w=k?w+B:w+Math.max(s.minPitch,T+s.rowGap+B)+(D===0&&q>0?s.stepGap:0),k=!1,T=R,O.type==="edge"){let K=p[c.get(O.from)??0],se=p[c.get(O.to)??0],m=Math.sign(se-K)||1,S=K===se?[[K,w],[K+s.selfW,w],[K+s.selfW,w+s.selfH],[K+b.edge.inset,w+s.selfH]]:[[K,w],[se-m*b.edge.inset,w]],y=Le(O,r);E.push({step:q,event:D,from:O.from,to:O.to,points:S,color:y,carry:O.carry}),O.label!==void 0&&x.push({step:q,event:D,text:O.label,points:S,color:y,...O.labelSide?{side:O.labelSide}:K===se?{side:"right"}:{}})}else{let K=p[c.get(O.box)??0],se=z(O.label,L.action)+b.action.padX*2;h.push({step:q,event:D,box:O.box,text:O.label,color:r.get(O.box)??"slate",x:K+b.badge.r+4,y:w-b.action.h/2,w:se,h:b.action.h})}})});let A=(k?v:w+T)+s.tail,F=l.map((M,q)=>({id:M,x:p[q],y1:v,y2:A})),H=[];for(let M of x){let q=[...H.filter(O=>O.step===M.step),...h];H.push(Ne(M,{hard:d,soft:q}))}let _={kind:"sequence",width:0,height:0,regions:[],boxes:d,lifelines:F,edges:E,labels:H,actions:h,badges:[]},me=[...d.map(M=>M.x),...H.map(M=>M.x),...h.map(M=>M.x)],ge=Math.max(0,o-Math.min(...me));ge>0&&Re(_,ge,0);let re=[...d.map(M=>M.x+M.w),...H.map(M=>M.x+M.w),...h.map(M=>M.x+M.w),...E.flatMap(M=>M.points.map(q=>q[0]))],te=Math.max(Math.max(...re)+o,Ae(e)+o*2),de=Ce(e,o,A+t,te-o*2);return _.width=te,_.height=(de?de.y+de.h:A)+o,de&&(_.strip=de),_.badges=cn(e,_),_}function cn(e,n){return e.steps.map((s,a)=>{let o=n.edges.find(i=>i.step===a);if(o){let[i,l]=je(o.points);return{step:a,x:i,y:l,color:o.color}}let t=n.actions.find(i=>i.step===a),r=t&&n.lifelines.find(i=>i.id===t.box);return t&&r?{step:a,x:r.x,y:t.y+t.h/2,color:t.color}:De(s.events,a,n)})}var pn={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"},dn={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"},yt=(e,n)=>`${e} ${n}${e===1?"":"s"}`,fn={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=>pn[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",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`},mn={additionalProperties:e=>`The ${e} field is not allowed`,required:e=>`The ${e} field is required`,enum:e=>`Use one of ${e.join(" / ")}`,type:e=>dn[e]??`Use ${e}`,minLength:e=>`Write at least ${yt(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 ${yt(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",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`},Fe={ja:fn,en:mn};function un(e){let n=0;for(let s of e)n++;return n}var nt=xt,tt={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"]},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"}},if:{required:["kind"],properties:{kind:{const:"sequence"}}},then:{required:["sequence"]},else:{not:{required:["sequence"]}},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"}}}}}};var gn=Object.prototype.hasOwnProperty,oe=un;var bt={enum:["blue","amber","green","violet","rose","slate","coin"]},xe=new RegExp("^[^\\s\\[\\]\u300C\u300D=:]+$","u");function Be(e,{instancePath:n="",parentData:s,parentDataProperty:a,rootData:o=e}={}){let t=null,r=0;if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.id===void 0){let i={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'"};t===null?t=[i]:t.push(i),r++}if(e.name===void 0){let i={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"name"},message:"must have required property 'name'"};t===null?t=[i]:t.push(i),r++}for(let i in e)if(!(i==="id"||i==="name"||i==="note"||i==="color"||i==="icon")){let l={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:i},message:"must NOT have additional properties"};t===null?t=[l]:t.push(l),r++}if(e.id!==void 0){let i=e.id;if(typeof i=="string"){if(!xe.test(i)){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 i=e.name;if(typeof i=="string"){if(oe(i)<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 i=e.note;if(typeof i=="string"){if(oe(i)<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 i=e.color;if(!(i==="blue"||i==="amber"||i==="green"||i==="violet"||i==="rose"||i==="slate"||i==="coin")){let l={instancePath:n+"/color",schemaPath:"#/definitions/color/enum",keyword:"enum",params:{allowedValues:bt.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 i=e.icon;if(typeof i=="string"){if(oe(i)<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 i={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[i]:t.push(i),r++}return Be.errors=t,r===0}function Ie(e,{instancePath:n="",parentData:s,parentDataProperty:a,rootData:o=e}={}){let t=null,r=0;if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.id===void 0){let i={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'"};t===null?t=[i]:t.push(i),r++}if(e.name===void 0){let i={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"name"},message:"must have required property 'name'"};t===null?t=[i]:t.push(i),r++}for(let i in e)if(!(i==="id"||i==="name"||i==="sub"||i==="color"||i==="icon"||i==="region")){let l={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:i},message:"must NOT have additional properties"};t===null?t=[l]:t.push(l),r++}if(e.id!==void 0){let i=e.id;if(typeof i=="string"){if(!xe.test(i)){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 i=e.name;if(typeof i=="string"){if(oe(i)<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 i=e.sub;if(typeof i=="string"){if(oe(i)<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 i=e.color;if(!(i==="blue"||i==="amber"||i==="green"||i==="violet"||i==="rose"||i==="slate"||i==="coin")){let l={instancePath:n+"/color",schemaPath:"#/definitions/color/enum",keyword:"enum",params:{allowedValues:bt.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 i=e.icon;if(typeof i=="string"){if(oe(i)<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 i=e.region;if(typeof i=="string"){if(!xe.test(i)){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 i={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[i]:t.push(i),r++}return Ie.errors=t,r===0}function Ve(e,{instancePath:n="",parentData:s,parentDataProperty:a,rootData:o=e}={}){let t=null,r=0;if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.title===void 0){let i={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"title"},message:"must have required property 'title'"};t===null?t=[i]:t.push(i),r++}if(e.fields===void 0){let i={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"fields"},message:"must have required property 'fields'"};t===null?t=[i]:t.push(i),r++}for(let i in e)if(!(i==="title"||i==="fields")){let l={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:i},message:"must NOT have additional properties"};t===null?t=[l]:t.push(l),r++}if(e.title!==void 0){let i=e.title;if(typeof i=="string"){if(oe(i)<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 i=e.fields;if(Array.isArray(i)){if(i.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=i.length;for(let c=0;c<l;c++){let f=i[c];if(typeof f=="string"){if(oe(f)<1){let u={instancePath:n+"/fields/"+c,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+"/fields/"+c,schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[u]:t.push(u),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 i={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[i]:t.push(i),r++}return Ve.errors=t,r===0}var hn={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"}}}]},yn={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 _e(e,{instancePath:n="",parentData:s,parentDataProperty:a,rootData:o=e}={}){let t=null,r=0,i=r,l=!0,c=r;if(e&&typeof e=="object"&&!Array.isArray(e)){let p;if(e.kind===void 0&&(p="kind")){let d={};t===null?t=[d]:t.push(d),r++}else if(e.kind!==void 0&&e.kind!=="tag"){let d={};t===null?t=[d]:t.push(d),r++}}var f=c===r;r=i,t!==null&&(i?t.length=i:t=null);let u;if(f){let p=r;if(e&&typeof e=="object"&&!Array.isArray(e)&&e.text===void 0){let v={instancePath:n,schemaPath:"#/then/required",keyword:"required",params:{missingProperty:"text"},message:"must have required property 'text'"};t===null?t=[v]:t.push(v),r++}var f=p===r;l=f,u="then"}else{let p=r,d=r,v=r;if(e&&typeof e=="object"&&!Array.isArray(e)){let h;if(e.text===void 0&&(h="text")){let x={};t===null?t=[x]:t.push(x),r++}}var g=v===r;if(g){let h={instancePath:n,schemaPath:"#/else/not",keyword:"not",params:{},message:"must NOT be valid"};t===null?t=[h]:t.push(h),r++}else r=d,t!==null&&(d?t.length=d:t=null);var f=p===r;l=f,u="else"}if(!l){let p={instancePath:n,schemaPath:"#/if",keyword:"if",params:{failingKeyword:u},message:'must match "'+u+'" schema'};t===null?t=[p]:t.push(p),r++}if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.kind===void 0){let p={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"kind"},message:"must have required property 'kind'"};t===null?t=[p]:t.push(p),r++}for(let p in e)if(!(p==="kind"||p==="text")){let d={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:p},message:"must NOT have additional properties"};t===null?t=[d]:t.push(d),r++}if(e.kind!==void 0){let p=e.kind;if(!(p==="envelope"||p==="tag"||p==="coin"||p==="none")){let d={instancePath:n+"/kind",schemaPath:"#/properties/kind/enum",keyword:"enum",params:{allowedValues:yn.properties.kind.enum},message:"must be equal to one of the allowed values"};t===null?t=[d]:t.push(d),r++}}if(e.text!==void 0){let p=e.text;if(typeof p=="string"){if(oe(p)<1){let d={instancePath:n+"/text",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[d]:t.push(d),r++}}else{let d={instancePath:n+"/text",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[d]:t.push(d),r++}}}else{let p={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[p]:t.push(p),r++}return _e.errors=t,r===0}function We(e,{instancePath:n="",parentData:s,parentDataProperty:a,rootData:o=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 f={instancePath:n,schemaPath:"#/oneOf/0/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:c},message:"must NOT have additional properties"};t===null?t=[f]:t.push(f),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(!xe.test(c)){let f={instancePath:n+"/from",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};t===null?t=[f]:t.push(f),r++}}else{let f={instancePath:n+"/from",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[f]:t.push(f),r++}}if(e.to!==void 0){let c=e.to;if(typeof c=="string"){if(!xe.test(c)){let f={instancePath:n+"/to",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};t===null?t=[f]:t.push(f),r++}}else{let f={instancePath:n+"/to",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[f]:t.push(f),r++}}if(e.label!==void 0){let c=e.label;if(typeof c=="string"){if(oe(c)<1){let f={instancePath:n+"/label",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[f]:t.push(f),r++}}else{let f={instancePath:n+"/label",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[f]:t.push(f),r++}}if(e.carry!==void 0&&(_e(e.carry,{instancePath:n+"/carry",parentData:e,parentDataProperty:"carry",rootData:o})||(t=t===null?_e.errors:t.concat(_e.errors),r=t.length)),e.labelSide!==void 0){let c=e.labelSide;if(!(c==="above"||c==="below"||c==="left"||c==="right")){let f={instancePath:n+"/labelSide",schemaPath:"#/oneOf/0/properties/labelSide/enum",keyword:"enum",params:{allowedValues:hn.oneOf[0].properties.labelSide.enum},message:"must be equal to one of the allowed values"};t===null?t=[f]:t.push(f),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 f={instancePath:n,schemaPath:"#/oneOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:c},message:"must NOT have additional properties"};t===null?t=[f]:t.push(f),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(!xe.test(c)){let f={instancePath:n+"/box",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};t===null?t=[f]:t.push(f),r++}}else{let f={instancePath:n+"/box",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[f]:t.push(f),r++}}if(e.label!==void 0){let c=e.label;if(typeof c=="string"){if(oe(c)<1){let f={instancePath:n+"/label",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[f]:t.push(f),r++}}else{let f={instancePath:n+"/label",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[f]:t.push(f),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 f={instancePath:n,schemaPath:"#/oneOf/2/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:c},message:"must NOT have additional properties"};t===null?t=[f]:t.push(f),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(!xe.test(c)){let f={instancePath:n+"/box",schemaPath:"#/definitions/id/pattern",keyword:"pattern",params:{pattern:"^[^\\s\\[\\]\u300C\u300D=:]+$"},message:'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"'};t===null?t=[f]:t.push(f),r++}}else{let f={instancePath:n+"/box",schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[f]:t.push(f),r++}}if(e.text!==void 0){let c=e.text;if(typeof c=="string"){if(oe(c)<1){let f={instancePath:n+"/text",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[f]:t.push(f),r++}}else{let f={instancePath:n+"/text",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[f]:t.push(f),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,f=!1,u=r;if(e&&typeof e=="object"&&!Array.isArray(e)&&e.value===void 0){let g={instancePath:n,schemaPath:"#/oneOf/3/anyOf/0/required",keyword:"required",params:{missingProperty:"value"},message:"must have required property 'value'"};t===null?t=[g]:t.push(g),r++}var i=u===r;if(f=f||i,!f){let g=r;if(e&&typeof e=="object"&&!Array.isArray(e)&&e.tag===void 0){let d={instancePath:n,schemaPath:"#/oneOf/3/anyOf/1/required",keyword:"required",params:{missingProperty:"tag"},message:"must have required property 'tag'"};t===null?t=[d]:t.push(d),r++}var i=g===r;f=f||i}if(f)r=c,t!==null&&(c?t.length=c:t=null);else{let g={instancePath:n,schemaPath:"#/oneOf/3/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};t===null?t=[g]:t.push(g),r++}if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.type===void 0){let g={instancePath:n,schemaPath:"#/oneOf/3/required",keyword:"required",params:{missingProperty:"type"},message:"must have required property 'type'"};t===null?t=[g]:t.push(g),r++}if(e.field===void 0){let g={instancePath:n,schemaPath:"#/oneOf/3/required",keyword:"required",params:{missingProperty:"field"},message:"must have required property 'field'"};t===null?t=[g]:t.push(g),r++}for(let g in e)if(!(g==="type"||g==="field"||g==="value"||g==="tag")){let p={instancePath:n,schemaPath:"#/oneOf/3/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:g},message:"must NOT have additional properties"};t===null?t=[p]:t.push(p),r++}if(e.type!==void 0&&e.type!=="strip"){let g={instancePath:n+"/type",schemaPath:"#/oneOf/3/properties/type/const",keyword:"const",params:{allowedValue:"strip"},message:"must be equal to constant"};t===null?t=[g]:t.push(g),r++}if(e.field!==void 0){let g=e.field;if(typeof g=="string"){if(oe(g)<1){let p={instancePath:n+"/field",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+"/field",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[p]:t.push(p),r++}}if(e.value!==void 0){let g=e.value;if(typeof g=="string"){if(oe(g)<1){let p={instancePath:n+"/value",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+"/value",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[p]:t.push(p),r++}}if(e.tag!==void 0){let g=e.tag;if(typeof g=="string"){if(oe(g)<1){let p={instancePath:n+"/tag",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+"/tag",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[p]:t.push(p),r++}}}else{let g={instancePath:n,schemaPath:"#/oneOf/3/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[g]:t.push(g),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 We.errors=t,r===0}function Ge(e,{instancePath:n="",parentData:s,parentDataProperty:a,rootData:o=e}={}){let t=null,r=0;if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.title===void 0){let i={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"title"},message:"must have required property 'title'"};t===null?t=[i]:t.push(i),r++}if(e.body===void 0){let i={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"body"},message:"must have required property 'body'"};t===null?t=[i]:t.push(i),r++}if(e.events===void 0){let i={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"events"},message:"must have required property 'events'"};t===null?t=[i]:t.push(i),r++}for(let i in e)if(!(i==="title"||i==="body"||i==="code"||i==="events")){let l={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:i},message:"must NOT have additional properties"};t===null?t=[l]:t.push(l),r++}if(e.title!==void 0){let i=e.title;if(typeof i=="string"){if(oe(i)<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 i=e.body;if(typeof i=="string"){if(oe(i)<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 i=e.code;if(typeof i=="string"){if(oe(i)<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 i=e.events;if(Array.isArray(i)){let l=i.length;for(let c=0;c<l;c++)We(i[c],{instancePath:n+"/events/"+c,parentData:i,parentDataProperty:c,rootData:o})||(t=t===null?We.errors:t.concat(We.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 i={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[i]:t.push(i),r++}return Ge.errors=t,r===0}function Ye(e,{instancePath:n="",parentData:s,parentDataProperty:a,rootData:o=e}={}){let t=null,r=0;if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.lifelines===void 0){let i={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"lifelines"},message:"must have required property 'lifelines'"};t===null?t=[i]:t.push(i),r++}for(let i in e)if(i!=="lifelines"){let l={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:i},message:"must NOT have additional properties"};t===null?t=[l]:t.push(l),r++}if(e.lifelines!==void 0){let i=e.lifelines;if(Array.isArray(i)){if(i.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=i.length;for(let c=0;c<l;c++){let f=i[c];if(typeof f=="string"){if(!xe.test(f)){let u={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=[u]:t.push(u),r++}}else{let u={instancePath:n+"/lifelines/"+c,schemaPath:"#/definitions/id/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[u]:t.push(u),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 i={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[i]:t.push(i),r++}return Ye.errors=t,r===0}function xt(e,{instancePath:n="",parentData:s,parentDataProperty:a,rootData:o=e}={}){let t=null,r=0,i=r,l=!0,c=r;if(e&&typeof e=="object"&&!Array.isArray(e)){let p;if(e.kind===void 0&&(p="kind")){let d={};t===null?t=[d]:t.push(d),r++}else if(e.kind!==void 0&&e.kind!=="sequence"){let d={};t===null?t=[d]:t.push(d),r++}}var f=c===r;r=i,t!==null&&(i?t.length=i:t=null);let u;if(f){let p=r;if(e&&typeof e=="object"&&!Array.isArray(e)&&e.sequence===void 0){let v={instancePath:n,schemaPath:"#/then/required",keyword:"required",params:{missingProperty:"sequence"},message:"must have required property 'sequence'"};t===null?t=[v]:t.push(v),r++}var f=p===r;l=f,u="then"}else{let p=r,d=r,v=r;if(e&&typeof e=="object"&&!Array.isArray(e)){let h;if(e.sequence===void 0&&(h="sequence")){let x={};t===null?t=[x]:t.push(x),r++}}var g=v===r;if(g){let h={instancePath:n,schemaPath:"#/else/not",keyword:"not",params:{},message:"must NOT be valid"};t===null?t=[h]:t.push(h),r++}else r=d,t!==null&&(d?t.length=d:t=null);var f=p===r;l=f,u="else"}if(!l){let p={instancePath:n,schemaPath:"#/if",keyword:"if",params:{failingKeyword:u},message:'must match "'+u+'" schema'};t===null?t=[p]:t.push(p),r++}if(e&&typeof e=="object"&&!Array.isArray(e)){if(e.version===void 0){let p={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"version"},message:"must have required property 'version'"};t===null?t=[p]:t.push(p),r++}if(e.kind===void 0){let p={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"kind"},message:"must have required property 'kind'"};t===null?t=[p]:t.push(p),r++}if(e.title===void 0){let p={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"title"},message:"must have required property 'title'"};t===null?t=[p]:t.push(p),r++}if(e.boxes===void 0){let p={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"boxes"},message:"must have required property 'boxes'"};t===null?t=[p]:t.push(p),r++}if(e.steps===void 0){let p={instancePath:n,schemaPath:"#/required",keyword:"required",params:{missingProperty:"steps"},message:"must have required property 'steps'"};t===null?t=[p]:t.push(p),r++}for(let p in e)if(!gn.call(tt.properties,p)){let d={instancePath:n,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:p},message:"must NOT have additional properties"};t===null?t=[d]:t.push(d),r++}if(e.version!==void 0){let p=e.version;if(!(typeof p=="number"&&!(p%1)&&!isNaN(p)&&isFinite(p))){let d={instancePath:n+"/version",schemaPath:"#/properties/version/type",keyword:"type",params:{type:"integer"},message:"must be integer"};t===null?t=[d]:t.push(d),r++}if(typeof p=="number"&&isFinite(p)&&(p<1||isNaN(p))){let d={instancePath:n+"/version",schemaPath:"#/properties/version/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1"};t===null?t=[d]:t.push(d),r++}}if(e.kind!==void 0){let p=e.kind;if(!(p==="sequence"||p==="architecture")){let d={instancePath:n+"/kind",schemaPath:"#/properties/kind/enum",keyword:"enum",params:{allowedValues:tt.properties.kind.enum},message:"must be equal to one of the allowed values"};t===null?t=[d]:t.push(d),r++}}if(e.title!==void 0){let p=e.title;if(typeof p=="string"){if(oe(p)<1){let d={instancePath:n+"/title",schemaPath:"#/definitions/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"};t===null?t=[d]:t.push(d),r++}}else{let d={instancePath:n+"/title",schemaPath:"#/definitions/text/type",keyword:"type",params:{type:"string"},message:"must be string"};t===null?t=[d]:t.push(d),r++}}if(e.view!==void 0){let p=e.view;if(!(p==="fixed"||p==="follow")){let d={instancePath:n+"/view",schemaPath:"#/properties/view/enum",keyword:"enum",params:{allowedValues:tt.properties.view.enum},message:"must be equal to one of the allowed values"};t===null?t=[d]:t.push(d),r++}}if(e.regions!==void 0){let p=e.regions;if(Array.isArray(p)){let d=p.length;for(let v=0;v<d;v++)Be(p[v],{instancePath:n+"/regions/"+v,parentData:p,parentDataProperty:v,rootData:o})||(t=t===null?Be.errors:t.concat(Be.errors),r=t.length)}else{let d={instancePath:n+"/regions",schemaPath:"#/properties/regions/type",keyword:"type",params:{type:"array"},message:"must be array"};t===null?t=[d]:t.push(d),r++}}if(e.boxes!==void 0){let p=e.boxes;if(Array.isArray(p)){if(p.length<1){let v={instancePath:n+"/boxes",schemaPath:"#/properties/boxes/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};t===null?t=[v]:t.push(v),r++}let d=p.length;for(let v=0;v<d;v++)Ie(p[v],{instancePath:n+"/boxes/"+v,parentData:p,parentDataProperty:v,rootData:o})||(t=t===null?Ie.errors:t.concat(Ie.errors),r=t.length)}else{let d={instancePath:n+"/boxes",schemaPath:"#/properties/boxes/type",keyword:"type",params:{type:"array"},message:"must be array"};t===null?t=[d]:t.push(d),r++}}if(e.strip!==void 0&&(Ve(e.strip,{instancePath:n+"/strip",parentData:e,parentDataProperty:"strip",rootData:o})||(t=t===null?Ve.errors:t.concat(Ve.errors),r=t.length)),e.steps!==void 0){let p=e.steps;if(Array.isArray(p)){if(p.length<1){let v={instancePath:n+"/steps",schemaPath:"#/properties/steps/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};t===null?t=[v]:t.push(v),r++}let d=p.length;for(let v=0;v<d;v++)Ge(p[v],{instancePath:n+"/steps/"+v,parentData:p,parentDataProperty:v,rootData:o})||(t=t===null?Ge.errors:t.concat(Ge.errors),r=t.length)}else{let d={instancePath:n+"/steps",schemaPath:"#/properties/steps/type",keyword:"type",params:{type:"array"},message:"must be array"};t===null?t=[d]:t.push(d),r++}}e.sequence!==void 0&&(Ye(e.sequence,{instancePath:n+"/sequence",parentData:e,parentDataProperty:"sequence",rootData:o})||(t=t===null?Ye.errors:t.concat(Ye.errors),r=t.length))}else{let p={instancePath:n,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"};t===null?t=[p]:t.push(p),r++}return xt.errors=t,r===0}var bn=["edge","action","swap","strip"],xn={"":{field:"sequence",kind:"sequence"},carry:{field:"text",kind:"tag"}},rt=e=>e.replaceAll("~","~0").replaceAll("/","~1");function vn(e){let n=/^\^\[\^(.+)\]\+\$$/u.exec(e)?.[1];if(n===void 0)return;let s=n.match(/\\.|[^\\]/gu)??[];return{space:s.includes("\\s"),chars:s.filter(a=>a!=="\\s").map(a=>a.replace(/^\\/u,""))}}var vt=(e,n)=>n.filter(s=>s!==e&&s.schemaPath.startsWith(`${e.schemaPath}/`)&&(s.instancePath===e.instancePath||s.instancePath.startsWith(`${e.instancePath}/`)));function wn(e,n,s){let a=e.params,o=e.instancePath;switch(e.keyword){case"additionalProperties":{let t=String(a.additionalProperty);return{pointer:`${o}/${rt(t)}`,message:s.additionalProperties(t)}}case"required":{let t=String(a.missingProperty);return{pointer:`${o}/${rt(t)}`,message:s.required(t)}}case"not":{let t=xn[o.slice(o.lastIndexOf("/")+1)];return{pointer:t?`${o}/${t.field}`:o,message:s.not(t)}}case"anyOf":{let t=vt(e,n),r=t.every(i=>i.keyword==="required")?t.map(i=>String(i.params.missingProperty)):[];return{pointer:o,message:s.anyOf(r)}}case"discriminator":{let t=String(a.tag);return{pointer:`${o}/${rt(t)}`,message:s.discriminator(t,bn)}}case"enum":return{pointer:o,message:s.enum(a.allowedValues.map(String))};case"type":return{pointer:o,message:s.type(String(a.type))};case"minLength":return{pointer:o,message:s.minLength(Number(a.limit))};case"pattern":return{pointer:o,message:s.pattern(vn(String(a.pattern)))};case"minItems":return{pointer:o,message:s.minItems(Number(a.limit))};case"minimum":return{pointer:o,message:s.minimum(Number(a.limit))};case"const":return{pointer:o,message:s.const(String(a.allowedValue))};case"oneOf":return{pointer:o,message:s.oneOf};default:return{pointer:o,message:e.message??e.keyword}}}function wt(e,n={}){if(nt(e))return{ok:!0};let s=nt.errors??[],a=new Set(s.filter(r=>r.keyword==="anyOf").flatMap(r=>vt(r,s))),o=Fe[n.lang??"ja"];return{ok:!1,errors:s.filter(r=>r.keyword!=="if"&&!a.has(r)).map(r=>wn(r,s,o))}}var $t=1;function $n(e){if(typeof e!="object"||e===null)return;let n=e.version;return typeof n=="number"&&n>$t?n:void 0}var kn=(e,n)=>({pointer:"/version",message:Fe[n].newer(e,$t)});function kt(e,n={}){let s=$n(e);if(s!==void 0)return{ok:!1,errors:[kn(s,n.lang??"ja")]};let a=wt(e,n);return a.ok?{ok:!0,diagram:e,warnings:[]}:a}function Pn(e){let n={edges:[],events:[],busy:0},s=Y.edgeAt,a,o=0;return e.events.forEach((t,r)=>{if(t.type==="edge"){let i=t.carry.kind!=="none",l=s,c=l+(i?Y.drawCarry:Y.draw);n.edges.push({event:r,a:l,b:c,carries:i,coin:t.carry.kind==="coin",named:t.label!==void 0}),s=l+Y.stagger,a=c,o=0,n.busy=Math.max(n.busy,c)}else if(t.type==="action")n.events.push({event:r,at:s}),n.busy=Math.max(n.busy,s+Y.action),s+=Y.action,o=0;else{let i=(a??s)+Y.change*o++;n.events.push({event:r,at:i}),n.busy=Math.max(n.busy,i)}}),n}function Pt(e){let n=e.steps.map(Pn),s=[],a=Y.intro;e.steps.forEach((d,v)=>{let E=Math.min(Y.stepMax,Math.max(Y.stepMin,Y.stepBase+[...d.body].length*Y.perChar)),h=Math.max(E,(n[v]?.busy??0)+Y.dwell);s.push({start:a,end:a+h}),a+=h});let t=Math.ceil(a+Y.outro),r=t-Y.tail,i=[],l=[],c=[],f=[];n.forEach((d,v)=>{let E=s[v],h=[];for(let x of d.edges){let w=E.start+x.a;i.push({step:v,event:x.event,start:w,drawn:E.start+x.b,end:E.end}),x.carries&&f.push({step:v,event:x.event,who:x.coin?"coin":"main",a:w,b:E.start+x.b}),x.named&&h.push({step:v,event:x.event,start:w+Y.labelDelay,end:E.end})}h.forEach((x,w)=>{let T=h[w+2];T&&(x.end=Math.min(x.end,T.start))}),l.push(...h);for(let x of d.events)c.push({step:v,event:x.event,at:E.start+x.at})});let u=s[0]?.start??0,g=f.some(d=>d.who==="main"),p=[];for(let d of["main","coin"]){let v=f.filter(E=>E.who===d);v.forEach((E,h)=>{let x=v[h+1],w=h===0&&(d==="main"||!g);p.push({step:E.step,event:E.event,who:d,depart:E.a,arrive:E.b,start:w?Math.min(u,E.a):E.a,end:x?Math.max(x.a,E.b):r})})}return p.sort((d,v)=>d.depart-v.depart),{total:t,last:r,steps:s,edges:i,carriers:p,labels:l,badges:s.map((d,v)=>({step:v,appears:d.start})),events:c,stills:s.map(d=>d.end-Y.still)}}var He={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",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 fe=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),$=e=>Math.round(e*100)/100,ue=e=>e==="coin"?"--c:var(--coin);--ct:var(--coint)":`--c:var(--c-${e});--ct:var(--t-${e})`;function st(e,n,s,a,o="dg-gl"){let t=e===void 0?void 0:He[e];return t?`<path class="${o}" transform="translate(${$(n)} ${$(s)}) scale(${a})" d="${t}"/>`:""}var Mn=e=>e.map(([n,s],a)=>`${a===0?"M":"L"} ${$(n)} ${$(s)}`).join(" ");function Sn(e){let[n,s]=e[e.length-1],[a,o]=e[e.length-2],t=Math.hypot(n-a,s-o)||1,r=(n-a)/t,i=(s-o)/t,{arrow:l,arrowHalf:c}=b.edge;return`M ${$(n-r*l-i*c)} ${$(s-i*l+r*c)} L ${$(n)} ${$(s)} L ${$(n-r*l+i*c)} ${$(s-i*l-r*c)}`}function On(e,n){let s=[[0,{opacity:0}]];for(let[a,o]of n)s.push([a,{opacity:0},Z.out],[a+Y.fade,{opacity:1}],[o-.1,{opacity:1},Z.inOut],[o+.25,{opacity:0}]);return s.push([e.total,{opacity:0}]),e.kf(s)}function Mt(e,n){let s=[];for(let a=0;a<n.length;){let o=a;for(;o+1<n.length&&n[o+1]===n[o]+1;)o++;s.push([e.t.steps[n[a]].start,e.t.steps[n[o]].end]),a=o+1}return On(e.m,s)}function St(e){let{radius:n,icon:s,iconRadius:a,iconScale:o,nameY:t,line:r}=b.region,{x:i,y:l}=e.header,c=e.lines.map((g,p)=>`<text class="dg-bz" x="${$(i)}" y="${$(e.y+t+p*r)}">${fe(g)}</text>`).join(""),f=e.note?`<text class="dg-bx" x="${$(i)}" y="${$(e.y+t+e.lines.length*r+1)}">${fe(e.note)}</text>`:"",u=e.icon&&He[e.icon]?`<rect class="dg-bi" x="${$(i)}" y="${$(l)}" width="${s}" height="${s}" rx="${a}"/>${st(e.icon,i+s/2,l+s/2,o)}`:"";return`<g style="${ue(e.color)}"><rect class="dg-band" x="${$(e.x+.5)}" y="${$(e.y+.5)}" width="${$(e.w-1)}" height="${$(e.h-1)}" rx="${n}"/>${u}${c}${f}</g>`}function Ot(e,n,s,a){let o=[[0,e.sub??"","dg-ss"],...s];return o.map(([t,r,i],l)=>{let c=o[l+1]?.[0],f=l===0?c===void 0?"":n.until(c-Y.untilFade):c===void 0?n.rise(t):n.rise(t,c-Y.untilFade);return r===""?"":`<g${f?` class="dg-a" style="${f}"`:""}><text class="${i}" x="${$(e.cx)}" y="${$(a)}" text-anchor="middle">${fe(r)}</text></g>`}).join("")}function Et(e,n,s,a,o){let t=(r,i="")=>`<rect class="${r}" x="${$(e.x)}" y="${$(a)}" width="${$(e.w)}" height="${o}" rx="${b.box.radius}"${i}/>`;return`${s?`<g class="dg-a" style="${s}">${t("dg-halo")}</g>`:""}${t("dg-st",` ${n.sh}`)}${s?`<g class="dg-a" style="${s}">${t("dg-on")}</g>`:""}`}function qt(e,n,s,a){let{icon:o,iconRadius:t,iconScale:r,iconY:i,nameY:l,subY:c}=b.box,f=Ot(e,n.m,a,e.cy+c),u=s.length>0?Mt(n,s):void 0,g=e.icon&&He[e.icon]?`<rect class="dg-ic" x="${$(e.cx-o/2)}" y="${$(e.cy+i-o/2)}" width="${o}" height="${o}" rx="${t}"/>${st(e.icon,e.cx,e.cy+i,r)}`:"";return`<g style="${ue(e.color)}">${Et(e,n,u,e.y,e.h)}${g}<text class="dg-sn" x="${$(e.cx)}" y="${$(e.cy+l)}" text-anchor="middle">${fe(e.name)}</text>${f}</g>`}function Lt(e,n,s,a){let{pad:o,h:t,nameY:r,subY:i}=b.follow.head,l=Ot(e,n.m,a,o+i),c=s.length>0?Mt(n,s):void 0;return`<g style="${ue(e.color)}">${Et(e,n,c,o,t)}<text class="dg-sn" x="${$(e.cx)}" y="${$(o+r)}" text-anchor="middle">${fe(e.name)}</text>${l}</g>`}function Tt(e,n,s){return`<line class="dg-ll" x1="${$(e)}" y1="${$(n)}" x2="${$(e)}" y2="${$(s)}"/>`}function jt(e,n,s){let{m:a}=s,o=Mn(e.points),t=Sn(e.points),{start:r,drawn:i,end:l}=n,c=[[l,{opacity:1},Z.inOut],[l+.4,{opacity:.45}],[s.end+.3,{opacity:.45},Z.inOut],[s.end+1,{opacity:.95}],[a.last,{opacity:.95},Z.inOut],[a.total,{opacity:0}]],f=a.kf([[0,{opacity:0,"stroke-dashoffset":1}],[r,{opacity:0,"stroke-dashoffset":1},Z.inOut],[r+.05,{opacity:1}],[i,{"stroke-dashoffset":0}],[a.last,{"stroke-dashoffset":0}],[a.total,{"stroke-dashoffset":1}],...c]),u=a.kf([[0,{opacity:0}],[i-.05,{opacity:0}],[i,{opacity:1}],...c]),g=-(l-i)*26,p=a.kf([[0,{opacity:0,"stroke-dashoffset":0}],[i,{opacity:0,"stroke-dashoffset":0}],[i+.25,{opacity:.9}],[l-.1,{opacity:.9},Z.inOut],[l+.2,{opacity:0,"stroke-dashoffset":g}],[a.total,{opacity:0,"stroke-dashoffset":g}]]);return{base:`<path class="dg-e" d="${o}"/><path class="dg-eh" d="${t}"/>`,lit:`<g style="${ue(e.color)}"><path class="dg-e-on dg-a" pathLength="1" d="${o}" style="${f}"/><path class="dg-eh-on dg-a" d="${t}" style="${u}"/><path class="dg-flow dg-a" d="${o}" style="${p}"/></g>`}}function Nt(e,n,s){let a=e.family==="sans"?" dg-capj":"",{radius:o}=b.label;return`<g class="dg-cap${a} dg-a" style="${ue(e.color)};${s.m.rise(n.start,n.end,!0)}"><rect x="${$(e.x)}" y="${$(e.y)}" width="${$(e.w)}" height="${e.h}" rx="${o}"/><text x="${$(e.x+e.w/2)}" y="${$(e.y+e.h/2+b.baseline.label)}" text-anchor="middle">${fe(e.text)}</text></g>`}function At(e,n,s,a){return`<g class="dg-act dg-a" style="${ue(e.color)};${a.m.rise(n,s,!0)}"><rect x="${$(e.x)}" y="${$(e.y)}" width="${$(e.w)}" height="${e.h}" rx="${b.action.radius}"/><text x="${$(e.x+e.w/2)}" y="${$(e.y+e.h/2+b.baseline.action)}" text-anchor="middle">${fe(e.text)}</text></g>`}function En(e,n){let s=b.carrier;if(e.carry.kind==="coin")return`<circle class="dg-coin" r="${s.coinR}"/><circle class="dg-coin-in" r="${s.coinIn}"/>`;if(e.carry.kind==="tag"){let a=e.carry.text,o=be(a),t=z(a,o?L.carrierJa:L.carrier)+s.tagPadX*2;return`<rect class="dg-car" x="${$(-t/2)}" y="${-s.tagH/2}" width="${$(t)}" height="${s.tagH}" rx="${s.tagH/2}" ${n}/><text class="dg-car-t${o?" dg-car-tj":""}" y="${b.baseline.carrier}" text-anchor="middle">${fe(a)}</text>`}return`<rect class="dg-env" x="${-s.envW/2}" y="${-s.envH/2}" width="${s.envW}" height="${s.envH}" rx="3" ${n}/><path class="dg-env-in" d="M -8 -4.5 L 0 1.5 L 8 -4.5"/>`}var qn=e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2;function Ct(e,n,s){let{m:a}=s,o=b.carrier.samples,t=et(e.points),{depart:r,arrive:i,start:l,end:c}=n,f=[];for(let E=0;E<=o;E++){let[h,x]=Ze(e.points,qn(E/o)*t);f.push([r+(i-r)*E/o,h,x])}let u=f[0],g=f[f.length-1],p=e.settle??[g[1],g[2]],d=[[0,u[1],u[2]],...f];e.settle&&d.push([Math.min(i+.3,Math.max(c,i+.01)),p[0],p[1]]),d.push([c,p[0],p[1]],[a.total,p[0],p[1]]);let v=c<a.last?.05:.18;return`<g class="dg-a" style="${a.move(d,a.blink(l+.02,c,v))}">${En(e,s.sh)}</g>`}function Rt(e,n){let{m:s}=n,a=n.t.steps[e.step],o=a.start,t=a.end,{r,ring:i}=b.badge,l=s.kf([[0,{opacity:0,transform:"scale(.5)"}],[o,{opacity:0,transform:"scale(.5)"},Z.pop],[o+.35,{opacity:1,transform:"scale(1)"}],[t,{opacity:1,transform:"scale(1)"},Z.inOut],[t+.4,{opacity:0,transform:"scale(1)"}],[s.total,{opacity:0,transform:"scale(.5)"}]]),c=s.kf([[0,{opacity:0}],[t,{opacity:0},Z.inOut],[t+.4,{opacity:1}],[s.last,{opacity:1},Z.inOut],[s.total,{opacity:0}]]),f=s.kf([[0,{opacity:0,transform:"scale(1)"}],[o+.05,{opacity:0,transform:"scale(1)"}],[o+.1,{opacity:.7,transform:"scale(1)"},Z.out],[o+.9,{opacity:0,transform:"scale(2.3)"}],[s.total,{opacity:0,transform:"scale(1)"}]]),u=$(e.x),g=$(e.y),p=$(e.y+b.baseline.badge),d=e.step+1;return`<g class="dg-bd" data-step="${e.step}" style="${ue(e.color)}"><circle class="dg-bdr dg-popc dg-a" cx="${u}" cy="${g}" r="${i}" style="${f}"/><g class="dg-a" style="${c}"><circle class="dg-bdp" cx="${u}" cy="${g}" r="${i}"/><text class="dg-bdpt" x="${u}" y="${p}" text-anchor="middle">${d}</text></g><g class="dg-popc dg-a" style="${l}"><circle class="dg-bdf" cx="${u}" cy="${g}" r="${r}"/><text class="dg-bdft" x="${u}" y="${p}" text-anchor="middle">${d}</text></g></g>`}function Dt(e,n,s){let{m:a,sh:o}=s,t=b.strip,r=e.y+t.h/2,i=[`<rect class="dg-strip" x="${$(e.x+.5)}" y="${$(e.y+.5)}" width="${$(e.w-1)}" height="${$(e.h-1)}" rx="${b.region.radius}" ${o}/>`,`<g style="${ue("slate")}"><rect class="dg-bi" x="${$(e.x+t.pad)}" y="${$(r-t.icon/2)}" width="${t.icon}" height="${t.icon}" rx="${b.box.iconRadius}"/>${st("env",e.x+t.pad+t.icon/2,r,.78)}</g>`,`<text class="dg-sh" x="${$(e.x+t.titleX)}" y="${$(r+b.baseline.stripTitle)}">${fe(e.title)}</text>`];return e.fields.forEach((l,c)=>{let f=e.fields[c-1];if(f&&f.y===l.y){let d=l.x-t.fieldGap/2;i.push(`<line class="dg-sep" x1="${$(d)}" y1="${$(l.y+t.sepInset)}" x2="${$(d)}" y2="${$(l.y+t.h-t.sepInset)}"/>`)}i.push(`<text class="dg-fl" x="${$(l.x)}" y="${$(l.y+t.nameY)}">${fe(l.name)}</text>`);let u=n.get(l.name)??[],g=u.filter(d=>d.value!==void 0),p=u.filter(d=>d.tag!==void 0);g.forEach((d,v)=>{let E=g[v+1]?.at,h=d.value,x=E===void 0?a.rise(d.at):a.rise(d.at,E-Y.untilFade);i.push(`<g class="dg-a" style="${x}"><text class="${be(h)?"dg-fvj":"dg-fv"}" x="${$(l.x)}" y="${$(l.y+t.valueY)}">${fe(h)}</text></g>`)}),p.forEach((d,v)=>{let E=p[v+1]?.at,h=d.tag,x=[...g].reverse().find(A=>A.at<=d.at+1e-9)?.value,w=l.x+(x?z(x,be(x)?L.fieldValueJa:L.fieldValue)+t.tagGap:0),T=z(h,L.tag)+t.tagPadX*2,k=l.y+t.valueY-t.tagH/2-b.baseline.tag;i.push(`<g class="dg-tg dg-popc dg-a" style="${ue(d.color)};${E===void 0?a.pop(d.at):a.pop(d.at,E-Y.untilFade)}"><rect x="${$(w)}" y="${$(k)}" width="${$(T)}" height="${t.tagH}" rx="${t.tagH/2}"/><text x="${$(w+T/2)}" y="${$(k+t.tagH/2+b.baseline.tag)}" text-anchor="middle">${fe(h)}</text></g>`)})}),i.join("")}var Ft=e=>Math.round(e*100)/100,Ke=class{constructor(n,s,a){this.prefix=n;this.total=s;this.last=a}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 s=`${this.prefix}-${this.count++}`,a=new Map;for(let[t,r,i]of[...n].sort((l,c)=>l[0]-c[0])){let l=this.pct(t),c=a.get(l)??{props:{}};Object.assign(c.props,r),i&&(c.ease=i),a.set(l,c)}let o=[...a].map(([t,{props:r,ease:i}])=>{let l=Object.entries(r).map(([c,f])=>`${c}:${f}`);return i&&l.push(`animation-timing-function:${i}`),`${t}%{${l.join(";")}}`}).join("");return this.frames.push(`@keyframes ${s}{${o}}`),`animation-name:${s}`}vis(n,s=this.last,a={}){let o=a.f??Y.fade,t=a.on??{},r=a.off??{},i=a.within?Math.max(n+o,s-o):s;return this.kf([[0,{opacity:0,...r}],[n,{opacity:0,...r},a.ein??Z.out],[n+o,{opacity:1,...t}],[i,{opacity:1,...t},Z.inOut],[Math.min(i+o,this.total),{opacity:0,...r}],[this.total,{opacity:0,...r}]])}rise(n,s=this.last,a=!1){return this.vis(n,s,{on:{transform:"translateY(0)"},off:{transform:`translateY(${b.rise}px)`},within:a})}pop(n,s=this.last){return this.vis(n,s,{f:Y.popFade,ein:Z.pop,on:{transform:"scale(1)"},off:{transform:`scale(${b.popFrom})`}})}until(n){let s=Y.untilFade;return this.kf([[0,{opacity:1}],[n,{opacity:1},Z.inOut],[n+s,{opacity:0}],[this.last,{opacity:0}],[this.total,{opacity:1}]])}move(n,s=[]){return this.kf(n.map(([a,o,t,r=1,i])=>[a,{transform:`translate(${Ft(o)}px,${Ft(t)}px) scale(${r})`},i]).concat(s))}blink(n,s,a){return[[0,{opacity:0}],[n-.01,{opacity:0}],[n,{opacity:1}],[s,{opacity:1}],[s+a,{opacity:0}],[this.total,{opacity:0}]]}};var ae=e=>`font:${e.weight} ${e.size}px var(--${e.family})`,ye=(e,n="var(--surf)")=>`color-mix(in srgb,var(--c) ${e}%,${n})`,pe=b.stroke,he=b.mix,Ln=[".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:${ye(he.regionIcon)};stroke:${ye(he.regionIconEdge,"transparent")}}`,`.dg-bz{${ae(L.regionName)};fill:var(--ct)}`,`.dg-bx{${ae(L.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:${ye(he.icon)}}`,`.dg-gl{fill:none;stroke:var(--c);stroke-width:${pe.glyph};stroke-linecap:round;stroke-linejoin:round}`,`.dg-sn{${ae(L.boxName)};fill:var(--ink)}`,`.dg-ss{${ae(L.boxSub)};fill:var(--mute)}`,`.dg-ss-ok{${ae(L.boxSubStrong)};fill:var(--ct)}`,`.dg-ss-act{${ae(L.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-bd{cursor:pointer}",".dg-bdf{fill:var(--c)}",`.dg-bdft{${ae(L.badge)};fill:var(--on-c)}`,`.dg-bdr{fill:none;stroke:var(--c);stroke-width:${pe.badgeRing}}`,`.dg-bdp{fill:${ye(he.badgePast)};stroke:${ye(he.badgePastEdge,"transparent")};stroke-width:${pe.hair}}`,`.dg-bdpt{${ae(L.badge)};fill:var(--ct)}`,`.dg-cap rect,.dg-act rect{fill:${ye(he.cap)};stroke:${ye(he.capEdge,"transparent")}}`,`.dg-cap text{${ae(L.label)};fill:var(--ct)}`,`.dg-capj text{${ae(L.labelJa)}}`,`.dg-act text{${ae(L.action)};fill:var(--ct)}`,".dg-car{fill:var(--carry,var(--ink))}",`.dg-car-t{${ae(L.carrier)};fill:var(--bg)}`,`.dg-car-tj{${ae(L.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{${ae(L.stripTitle)};fill:var(--ink)}`,`.dg-fl{${ae(L.fieldName)};fill:var(--mute)}`,`.dg-fv{${ae(L.fieldValue)};fill:var(--ink)}`,`.dg-fvj{${ae(L.fieldValueJa)};fill:var(--ink)}`,".dg-tg rect{fill:var(--c)}",`.dg-tg text{${ae(L.tag)};fill:var(--on-c)}`,".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{${ae(L.miniTitle)};fill:var(--mute)}`,".dg-mm-world{fill:var(--sunk);stroke:var(--hair)}",`.dg-mm-band{fill:${ye(he.miniBand)};stroke:${ye(he.miniBandEdge,"transparent")};stroke-width:.6}`,`.dg-mm-card{fill:${ye(he.mini)}}`,`.dg-mm-vp{fill:color-mix(in srgb,var(--ink) ${he.view}%,transparent);stroke:var(--ink);stroke-width:${pe.badgeRing};vector-effect:non-scaling-stroke}`].join("");function Tn(e){let n=2166136261;for(let s=0;s<e.length;s++)n^=e.charCodeAt(s),n=Math.imul(n,16777619);return(n>>>0).toString(36)}function jn(e){let n=new Map,s=(a,o)=>{n.set(a,(n.get(a)??new Set).add(o))};return e.steps.forEach((a,o)=>{for(let t of a.events)t.type==="edge"?(s(t.from,o),s(t.to,o)):(t.type==="action"||t.type==="swap")&&s(t.box,o)}),new Map([...n].map(([a,o])=>[a,[...o].sort((t,r)=>t-r)]))}function Nn(e,n,s){let a=[],o=0;for(let r of n.events){let i=e.steps[r.step]?.events[r.event];i?.type==="swap"&&a.push({t:r.at,order:o++,box:i.box,set:i.text}),s&&i?.type==="action"&&(a.push({t:r.at,order:o++,box:i.box,act:i.label}),a.push({t:n.steps[r.step].end,order:o++,box:i.box,act:null}))}a.sort((r,i)=>r.t-i.t||r.order-i.order);let t=new Map;for(let r of e.boxes){let i=[r.sub??"","dg-ss"],l,c=i.join("|"),f=[];for(let g of a.filter(p=>p.box===r.id)){g.set!==void 0&&(i=[g.set,"dg-ss-ok"],l=void 0),g.act!==void 0&&(l=g.act??void 0);let p=l!==void 0?[l,"dg-ss-act"]:i;p.join("|")!==c&&(c=p.join("|"),f.push([g.t,p[0],p[1]]))}let u=f.filter((g,p)=>{let d=f[p+1];return d===void 0||d[0]-g[0]>=Y.minShow});t.set(r.id,u)}return t}function An(e,n,s){let a=new Map;for(let o of n.events){let t=e.steps[o.step]?.events[o.event];if(t?.type!=="strip")continue;let r=s.badges[o.step]?.color??"slate",i=a.get(t.field)??[];i.push({at:o.at,color:r,...t.value!==void 0?{value:t.value}:{},...t.tag!==void 0?{tag:t.tag}:{}}),a.set(t.field,i)}return a}function it(e,n,s,a,o,t){let r=Tn(`${JSON.stringify(e)}|${a.id}|${o}|${t?`${t.width}|${t.lang}`:""}`),i=new Ke(`dg${r}`,s.total,s.last),l={m:i,t:s,sh:`filter="url(#dg-sh-${r})"`,end:s.steps[s.steps.length-1].end},c=jn(e),f=Nn(e,s,n.kind==="architecture"),u={band:[],base:[],lit:[],node:[],badge:[],top:[]};for(let k of n.regions)u.band.push(St(k));n.strip&&u.band.push(Dt(n.strip,An(e,s,n),l));for(let k of n.lifelines)u.base.push(Tt(k.x,k.y1,k.y2));for(let k of n.edges){let A=s.edges.find(H=>H.step===k.step&&H.event===k.event);if(!A)continue;let F=jt(k,A,l);u.base.push(F.base),u.lit.push(F.lit)}for(let k of n.boxes)u.node.push(qt(k,l,c.get(k.id)??[],f.get(k.id)??[]));for(let k of n.badges)u.badge.push(Rt(k,l));for(let k of n.labels){let A=s.labels.find(F=>F.step===k.step&&F.event===k.event);A&&u.top.push(Nt(k,A,l))}for(let k of n.actions){let A=s.events.find(F=>F.step===k.step&&F.event===k.event);A&&u.top.push(At(k,A.at,s.steps[k.step].end,l))}for(let k of s.carriers){let A=n.edges.find(F=>F.step===k.step&&F.event===k.event);A&&u.top.push(Ct(A,k,l))}let g=Object.values(u).map(k=>k.join("")).join(""),{near:p,far:d,nearY:v,farY:E}=b.shadow,h=`<filter id="dg-sh-${r}" x="-20%" y="-30%" width="140%" height="180%"><feDropShadow dx="0" dy="${v}" stdDeviation="${p}" style="flood-color:var(--sh);flood-opacity:var(--shA)"/><feDropShadow dx="0" dy="${E}" stdDeviation="${d}" style="flood-color:var(--sh);flood-opacity:var(--shB)"/></filter>`,x=t&&n.kind==="sequence"?n.boxes.map(k=>Lt(k,l,c.get(k.id)??[],f.get(k.id)??[])).join(""):"",w=t?Dn(n,s,e,i,r,g,t,x):{body:`<rect class="dg-bg" width="${n.width}" height="${n.height}" rx="${b.region.radius}"/>${g}`,w:n.width,h:n.height},T=`.dg-${r}{${Ee};--T:${s.total}s;${Oe(a,o)}}${Ln}${i.frames.join("")}`;return`<svg xmlns="http://www.w3.org/2000/svg" class="dg dg-${r}" viewBox="0 0 ${Math.ceil(w.w)} ${Math.ceil(w.h)}" width="${Math.ceil(w.w)}" height="${Math.ceil(w.h)}" role="img" aria-label="${fe(e.title)}" data-dragon="figure" data-view="${t?"follow":"fixed"}"><style>${T}</style><defs>${h}</defs>${w.body}</svg>`}function Bt(e){let n=Math.min(...e.map(a=>a.x)),s=Math.min(...e.map(a=>a.y));return{x:n,y:s,w:Math.max(...e.map(a=>a.x+a.w))-n,h:Math.max(...e.map(a=>a.y+a.h))-s}}function Cn(e,n,s){let a=It(e,n,s);return a.length===0?void 0:Bt(a)}function Rn(e,n,s,a){let o=b.badge.r+b.follow.badgeRoom,{x:t,y:r}=e,i=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-o,y:r-o,w:o*2,h:o*2};for(let c of[...n].sort((f,u)=>i(f)-i(u))){let f=Bt([l,c]);f.w<=s&&f.h<=a&&(l=f)}return l}function It(e,n,s){let a=[];for(let o of e.edges.filter(t=>t.step===s)){let t=o.points.map(i=>i[0]),r=o.points.map(i=>i[1]);a.push({x:Math.min(...t),y:Math.min(...r),w:Math.max(...t)-Math.min(...t),h:Math.max(...r)-Math.min(...r)})}a.push(...e.labels.filter(o=>o.step===s),...e.actions.filter(o=>o.step===s));for(let o of n.steps[s]?.events??[]){let t=o.type==="edge"?[o.from,o.to]:o.type==="action"||o.type==="swap"?[o.box]:[];for(let r of t){let i=e.boxes.find(l=>l.id===r);i&&(e.kind==="architecture"||o.type==="swap")&&a.push(i)}}return a}function Dn(e,n,s,a,o,t,r,i){let l=b.follow,c=b.mini,f=Math.max(1,r.width),u=Math.min(e.width,f),g=we[r.lang].overview,p=I=>{let V=Math.min(c.w,u*.4,I*.4/e.height*e.width),C=V/e.width,G=e.height*C,U=Math.max(V,Math.ceil(z(g,L.miniTitle)));return{vh:I,mw:V,k:C,mh:G,bw:U,bgW:U+c.pad*2,bgH:G+c.pad*2+c.title,beside:G>V}},d=p(Math.min(e.height,Math.max(l.minH,u*l.aspect))),v=d.beside&&f<l.narrow,E=r.height===void 0?Number.POSITIVE_INFINITY:d.beside?r.height:r.height-d.bgH-c.inset,{vh:h,mw:x,k:w,mh:T,bw:k,bgW:A,bgH:F,beside:H}=E<d.vh?p(Math.max(l.fitMinH,E)):{...d,vh:Number.isFinite(E)?Math.min(e.height,E):d.vh},_=H&&!v?Math.min(e.width,f-A-c.inset):u,me=I=>Math.min(e.width-_/2,Math.max(_/2,I)),ge=i===""?0:Math.max(...e.boxes.map(I=>I.y+I.h))+l.headRoom,re=i===""?0:l.head.pad*2+l.head.h,te=h-re,de=I=>Math.min(e.height-te/2,Math.max(ge+te/2,I)),M=b.badge.r,q=[e.width/2,e.height/2],D=n.steps.map((I,V)=>{let C=Cn(e,s,V);q=C?[C.x+C.w/2,C.y+C.h/2]:q;let G=[me(q[0]),de(q[1])],U=e.badges.find(N=>N.step===V);if(!U||Math.abs(U.x-G[0])<=_/2-M&&Math.abs(U.y-G[1])<=te/2-M)return G;let j=Rn(U,It(e,s,V),_,te);return q=[j.x+j.w/2,j.y+j.h/2],[me(q[0]),de(q[1])]}).map(([I,V])=>[I,V-re/2]),B=D[0],R=[[0,B[0],B[1]],[n.steps[0].start,B[0],B[1]]];D.forEach((I,V)=>{if(V===0)return;let C=D[V-1],G=n.steps[V].start;R.push([G,C[0],C[1],1,Z.inOut],[G+l.ease,I[0],I[1]])});let K=D[D.length-1];R.push([n.last,K[0],K[1],1,Z.inOut],[n.total,B[0],B[1]]);let se=a.move(R.map(([I,V,C,G,U])=>[I,_/2-V,h/2-C,G,U])),m=H?_+c.inset:_-A-c.inset,S=H?0:h+c.inset,y=m+c.pad,P=y+(k-x)/2,W=S+c.pad+c.title,X=v?{clip:"",body:""}:(()=>{let I=[...e.regions.map(C=>`<rect class="dg-mm-band" style="${ue(C.color)}" x="${P+C.x*w}" y="${W+C.y*w}" width="${C.w*w}" height="${C.h*w}" rx="3"/>`),...e.boxes.map(C=>`<rect class="dg-mm-card" style="${ue(C.color)}" x="${P+C.x*w}" y="${W+C.y*w}" width="${C.w*w}" height="${C.h*w}" rx="1.5"/>`)].join(""),V=a.move(R.map(([C,G,U,,j])=>[C,P+(G-_/2)*w,W+(U-h/2)*w,1,j]));return{clip:`<clipPath id="dg-mm-${o}"><rect x="${P}" y="${W}" width="${x}" height="${T}" rx="4"/></clipPath>`,body:`<rect class="dg-mm-bg" x="${m}" y="${S}" width="${A}" height="${F}" rx="${c.radius}"/><text class="dg-mm-t" x="${y}" y="${W-c.pad+2}">${g}</text><g clip-path="url(#dg-mm-${o})"><rect class="dg-mm-world" x="${P}" y="${W}" width="${x}" height="${T}"/>${I}<rect class="dg-mm-vp dg-a"${re===0?"":` y="${re*w}"`} width="${_*w}" height="${(h-re)*w}" rx="2" style="${V}"/></g>`}})(),le=re===0?"":`<g class="dg-hd"><rect class="dg-hd-bg" width="${_}" height="${re}"/><line class="dg-sep" x1="0" y1="${re}" x2="${_}" y2="${re}"/><g class="dg-a" style="${a.move(R.map(([I,V,,C,G])=>[I,_/2-V,0,C,G]))}">${i}</g></g>`;return{body:`<defs><clipPath id="dg-vp-${o}"><rect width="${_}" height="${h}" rx="${b.region.radius}"/></clipPath>${X.clip}</defs><g clip-path="url(#dg-vp-${o})"><rect class="dg-vp-bg" width="${_}" height="${h}"/><g class="dg-a" style="${se}">${t}</g>${le}</g><rect class="dg-vp-frame" x="0.5" y="0.5" width="${_-1}" height="${h-1}" rx="${b.region.radius}"/>${X.body}`,w:H&&!v?_+c.inset+A:u,h:H?h:S+F}}function Vt(e,n={}){let s=n.lang??"ja",a=kt(e,{lang:s});if(!a.ok)throw new Error(we[s].cannotDraw(a.errors.map(c=>`${c.pointer} ${c.message}`).join(" / ")));let o=a.diagram,t=Se(n.palette),r=n.theme==="dark"?"dark":"light",i=o.kind==="sequence"?ht(o):ut(o),l=Pt(o);return{svg:it(o,i,l,t,r),palette:t.id,theme:r,...o.view?{view:o.view}:{},fonts:{...$e},layout:i,timeline:l,diagram:o}}function ot(e,n,s){let a=Math.max(0,n)/e.layout.width,t=(s===void 0?a:Math.min(a,Math.max(0,s)/e.layout.height))*L.boxName.size;return e.view?{mode:e.view,textPx:t}:{mode:t>=pt?"fixed":"follow",textPx:t}}var ze=e=>`font:${e.weight} ${e.size}px var(--${e.family})`,ee=e=>`${e}px`;function Fn(){let e=b.player,n=ee(e.hidden);return[`.dg-player{display:flex;flex-direction:column;gap:${ee(e.gap)};color:var(--ink)}`,`.dg-player .dg-frame{border-radius:${ee(e.radius)};overflow:hidden}`,".dg-bar{container:dg-bar/inline-size}",`.dg-row{display:flex;align-items:flex-start;gap:${ee(e.gap)}}`,`.dg-btns{display:flex;gap:${ee(e.gap/2)};flex:none}`,`.dg-btn{width:${ee(e.button)};height:${ee(e.button)};border-radius:${ee(e.radius)};border:${ee(b.stroke.hair)} solid var(--hair);background:var(--surf);color:var(--ink);${ze(L.button)};cursor:pointer}`,`.dg-btn:focus-visible{outline:${ee(e.focus)} solid var(--c-blue);outline-offset:${ee(e.focus)}}`,`.dg-say{display:flex;gap:${ee(e.gap)};min-width:0}`,`.dg-no{${ze(L.stepNo)};color:var(--mute);padding-top:${ee(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{${ze(L.stepTitle)};margin:0}`,`.dg-tb{${ze(L.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 < ${ee(e.narrow)}){.dg-row{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:start;gap:0 ${ee(e.gap)}}.dg-say,.dg-txt,.dg-txt>*{display:contents}.dg-btns{grid-area:1/1;margin-bottom:${ee(e.gap/2)}}.dg-btn{width:${ee(e.touch)};height:${ee(e.touch)}}.dg-no{grid-area:1/2;display:flex;align-items:center;min-height:${ee(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:${ee(e.touch)};height:${ee(e.touch)}}}`].join("")}function Bn(e){if(e.getElementById("dragon-player-css"))return;let n=e.createElement("style");n.id="dragon-player-css",n.textContent=Fn(),e.head.appendChild(n)}var Pe={prev:"\u2039",pause:"\u275A\u275A",play:"\u25B6",next:"\u203A"},_t=e=>String(e).padStart(2,"0"),In=(e,n)=>`${_t(e+1)}/${_t(n)}`;function Wt(e,n,s={}){let a=e.ownerDocument,o=a.defaultView,t=!!o?.matchMedia?.("(prefers-reduced-motion: reduce)").matches,r=Vt(n,s),i=s.lang??"ja",l=we[i],c=Se(r.palette),{timeline:f}=r,u=r.diagram.steps,g=u.length;Bn(a);let p=a.createElement("div");p.className="dg-player",p.dataset.dragon="player",p.setAttribute("style",`${Ee};${Oe(c,r.theme)}`);let d=a.createElement("div");d.className="dg-frame";let v=(j,N,ie)=>{let ce=a.createElement("button");return ce.type="button",ce.className="dg-btn",ce.dataset.dragon=j,ce.setAttribute("aria-label",N),ce.textContent=ie,ce},E=v("prev",l.prev,Pe.prev),h=v("toggle",l.pause,Pe.pause),x=v("next",l.next,Pe.next),w=a.createElement("div");w.className="dg-btns",w.setAttribute("lang",i),w.append(E,h,x);let T=a.createElement("div");T.className="dg-say",T.setAttribute("aria-hidden","true");let k=a.createElement("div");k.className="dg-no",k.dataset.dragon="step-no";let A=a.createElement("div");A.className="dg-txt";let F=a.createElement("p");F.className="dg-tt",F.dataset.dragon="step-title";let H=a.createElement("p");H.className="dg-tb",H.dataset.dragon="step-body";let _=a.createElement("div");_.append(F,H),A.append(_);for(let j of u){let N=a.createElement("div");N.className="dg-room",N.dataset.dragon="caption-room";let ie=a.createElement("p");ie.className="dg-tt",ie.textContent=j.title;let ce=a.createElement("p");ce.className="dg-tb",ce.textContent=j.body,N.append(ie,ce),A.append(N)}T.append(k,A);for(let j of[k,F,H])j.setAttribute("aria-hidden","true");let me=a.createElement("div");me.className="dg-row",me.append(w,T);let ge=a.createElement("div");ge.className="dg-bar",ge.append(me);let re=a.createElement("ol");re.className="dg-sr",re.dataset.dragon="steps",re.setAttribute("aria-label",l.steps(r.diagram.title));for(let j of u){let N=a.createElement("li"),ie=a.createElement("strong");ie.textContent=j.title,N.append(ie);for(let ce of j.body.split(`
2
- `)){let at=a.createElement("p");at.textContent=ce,N.append(at)}re.append(N)}p.append(d,ge,re),e.append(p);let te=()=>d.clientWidth||e.clientWidth||r.layout.width,de=()=>{if(!s.fitHeight||!o)return;let j=o.getComputedStyle(d),N=d.clientHeight-(Number.parseFloat(j.paddingTop)||0)-(Number.parseFloat(j.paddingBottom)||0);return N>0?N:void 0},M=ot(r,te(),de()).mode,q=te(),O=de(),D=null,B=0,R=!t,K=t?f.stills[0]??0:0,se=Date.now(),m=j=>{let N;if(j!==void 0){let ie=a.createElement("div");ie.innerHTML=j,N=ie.querySelector("svg")}else N=D?D.cloneNode(!0):null;N&&(N.setAttribute("aria-hidden","true"),N.removeAttribute("role"),N.removeAttribute("aria-label"),N.style.setProperty("--at",String(K)),N.style.setProperty("--play",R?"running":"paused"),N.dataset.motion=R?"play":"still",D?D.replaceWith(N):d.append(N),D=N,se=Date.now())},S=()=>M==="follow"?it(r.diagram,r.layout,f,c,r.theme,{width:q,...O===void 0?{}:{height:O},lang:i}):r.svg,y=()=>R?(K+(Date.now()-se)/1e3)%f.total:K,P=j=>{let N=0;return f.steps.forEach((ie,ce)=>{ie.start<=j&&(N=ce)}),N},W=()=>{let j=u[B];k.textContent=In(B,g),F.textContent=j?.title??"",H.textContent=j?.body??"",h.setAttribute("aria-label",R?l.pause:l.play),h.textContent=R?Pe.pause:Pe.play,s.onStep?.(B)},J=(j,N)=>{K=j,R=N,m(),W()},X=j=>{B=Math.min(g-1,Math.max(0,j));let N=f.steps[B];J(R?N.start:f.stills[B]??N.start,R)};m(S()),W();let le=o?.setInterval(()=>{if(!R)return;let j=P(y());j!==B&&(B=j,W())},120),ne=()=>X(B-1),I=()=>X(B+1),V=()=>R?J(y(),!1):J(K,!0),C=j=>{let N=j.target?.closest?.("[data-step]"),ie=N?Number(N.getAttribute("data-step")):Number.NaN;Number.isInteger(ie)&&X(ie)};E.addEventListener("click",ne),x.addEventListener("click",I),h.addEventListener("click",V),d.addEventListener("click",C);let G=o?.ResizeObserver,U=G?new G(()=>{let j=te(),N=de(),ie=ot(r,j,N).mode;if(ie===M&&(M==="fixed"||j===q&&N===O))return;let ce=y();M=ie,q=j,O=N,K=ce,m(S())}):void 0;return U?.observe(d),{get step(){return B},get playing(){return R},next:I,prev:ne,play:()=>{R||J(K,!0)},pause:()=>{R&&J(y(),!1)},destroy:()=>{le!==void 0&&o?.clearInterval(le),U?.disconnect(),E.removeEventListener("click",ne),x.removeEventListener("click",I),h.removeEventListener("click",V),d.removeEventListener("click",C),p.remove()}}}return Xt(Vn);})();
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);})();