@johnoscott/isometric-engine 0.16.0 → 0.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/iso-systems.js CHANGED
@@ -1,74 +1,74 @@
1
- var Km=Object.defineProperty;var ho=(t,e)=>{for(var s in e)Km(t,s,{get:e[s],enumerable:!0})};var _d={};ho(_d,{Bounds:()=>ci,C:()=>Ct,DiagError:()=>ia,FONTS:()=>wt,Kernel:()=>yr,MONO:()=>tn,S:()=>lt,VEl:()=>Ii,allowed:()=>ic,apply:()=>ai,bubble:()=>go,buildSvg:()=>Rd,center:()=>Hs,colorRef:()=>Un,contrast:()=>Ci,createHash:()=>Cd,depthSort:()=>mi,didYouMean:()=>Vt,distance:()=>sc,envelope:()=>yo,esc:()=>vt,extendTheme:()=>_s,faceFrame:()=>Pl,fileLines:()=>bo,formatDiag:()=>rc,formatDiags:()=>Ad,greyOf:()=>zi,iso:()=>Ne,keyGlyph:()=>wo,loadTheme:()=>Tr,matStr:()=>li,monoOf:()=>ca,n1:()=>bt,parse:()=>oa,parseSvg:()=>oc,placeholderFace:()=>di,pt:()=>Us,screenFaces:()=>gr,screenGlass:()=>fi,serialize:()=>aa,sha256Hex:()=>ac,socketGlyph:()=>xo,tag:()=>Se,termLines:()=>pi,textWidth:()=>Pn,themeCss:()=>ra,themeParts:()=>Ri,vdoc:()=>Id});var jp={sans700_13:{"0":.6787,"1":.5059,"2":.6372,"3":.6631,"4":.6812,"5":.6577,"6":.6777,"7":.6172,"8":.688,"9":.6777," ":.252,"!":.3506,'"':.563,"#":.6655,$:.6655,"%":1.0298,"&":.7388,"'":.3418,"(":.4229,")":.4229,"*":.4785,"+":.6655,",":.3418,"-":.4785,".":.3418,"/":.3286,":":.3418,";":.3418,"<":.6655,"=":.6655,">":.6655,"?":.5513,"@":.9214,A:.7266,B:.6875,C:.7354,D:.7417,E:.6162,F:.5918,G:.7544,H:.7773,I:.3125,J:.5952,K:.7036,L:.5889,M:.9009,N:.7622,O:.7808,P:.668,Q:.7808,R:.6885,S:.6694,T:.6543,U:.7544,V:.7153,W:1.0034,X:.7236,Y:.7021,Z:.6699,"[":.4229,"\\":.3286,"]":.4229,"^":.6655,_:.5845,"`":.4941,a:.584,b:.6455,c:.5815,d:.6455,e:.5952,f:.407,g:.6396,h:.6265,i:.2813,j:.2813,k:.5957,l:.2891,m:.9263,n:.6216,o:.6138,p:.6411,q:.6416,r:.4338,s:.5513,t:.4114,u:.6216,v:.5771,w:.8413,x:.5747,y:.5913,z:.5605,"{":.4229,"|":.2935,"}":.4229,"~":.6655,"\xB7":.3418,"\u2192":.9375,"\u2190":.9375,"\u2191":.8096,"\u2193":.8096,"\u2019":.3418,"\u2018":.3418,"\u201C":.5474,"\u201D":.5474,"\u2026":.9482,"\u2013":.6216,"\u2014":.9045,"\u2715":.7622,"\xD7":.6655,"\u2248":.6655,"\u2264":.6655,"\u2265":.6655,\u00E9:.5952},sans800_15:{"0":.687,"1":.5122,"2":.6406,"3":.6675,"4":.686,"5":.6626,"6":.6836,"7":.6191,"8":.6968,"9":.6836," ":.2344,"!":.3555,'"':.5835,"#":.6694,$:.6694,"%":1.0566,"&":.7397,"'":.3491,"(":.4287,")":.4287,"*":.4731,"+":.6694,",":.3491,"-":.4731,".":.3491,"/":.3286,":":.3491,";":.3491,"<":.6694,"=":.6694,">":.6694,"?":.5562,"@":.9146,A:.7363,B:.6899,C:.7339,D:.7388,E:.6147,F:.5903,G:.749,H:.7813,I:.3198,J:.6064,K:.7104,L:.5879,M:.9019,N:.7612,O:.7759,P:.6709,Q:.7759,R:.6924,S:.6719,T:.6533,U:.7524,V:.7212,W:1.0073,X:.731,Y:.71,Z:.6646,"[":.4287,"\\":.3286,"]":.4287,"^":.6694,_:.5889,"`":.4844,a:.5864,b:.6479,c:.5811,d:.6479,e:.5952,f:.4139,g:.6416,h:.6309,i:.2847,j:.2847,k:.605,l:.2935,m:.937,n:.626,o:.6138,p:.6436,q:.6445,r:.4406,s:.5557,t:.4198,u:.626,v:.5806,w:.856,x:.5835,y:.5996,z:.5601,"{":.4287,"|":.2974,"}":.4287,"~":.6694,"\xB7":.3491,"\u2192":.9404,"\u2190":.9404,"\u2191":.811,"\u2193":.811,"\u2019":.3491,"\u2018":.3491,"\u201C":.5688,"\u201D":.5688,"\u2026":.9883,"\u2013":.626,"\u2014":.9118,"\u2715":.7622,"\xD7":.6694,"\u2248":.6694,"\u2264":.6694,"\u2265":.6694,\u00E9:.5952},sans800_10_5:{"0":.7114,"1":.5366,"2":.665,"3":.6919,"4":.7104,"5":.687,"6":.708,"7":.6436,"8":.7212,"9":.708," ":.2588,"!":.3799,'"':.6079,"#":.6938,$:.6938,"%":1.0811,"&":.7642,"'":.3735,"(":.4531,")":.4531,"*":.4976,"+":.6938,",":.3735,"-":.4976,".":.3735,"/":.353,":":.3735,";":.3735,"<":.6938,"=":.6938,">":.6938,"?":.5806,"@":.939,A:.7607,B:.7144,C:.7583,D:.7632,E:.6392,F:.6147,G:.7734,H:.8057,I:.3442,J:.6309,K:.7349,L:.6123,M:.9263,N:.7856,O:.8003,P:.6953,Q:.8003,R:.7168,S:.6963,T:.6777,U:.7769,V:.7456,W:1.0317,X:.7554,Y:.7344,Z:.689,"[":.4531,"\\":.353,"]":.4531,"^":.6938,_:.6133,"`":.5088,a:.6108,b:.6724,c:.6055,d:.6724,e:.6196,f:.4383,g:.666,h:.6553,i:.3091,j:.3091,k:.6294,l:.3179,m:.9614,n:.6504,o:.6382,p:.668,q:.6689,r:.465,s:.5801,t:.4442,u:.6504,v:.605,w:.8804,x:.6079,y:.624,z:.5845,"{":.4531,"|":.3218,"}":.4531,"~":.6938,"\xB7":.3735,"\u2192":.9648,"\u2190":.9648,"\u2191":.8354,"\u2193":.8354,"\u2019":.3735,"\u2018":.3735,"\u201C":.5933,"\u201D":.5933,"\u2026":1.0127,"\u2013":.6504,"\u2014":.9204,"\u2715":.7622,"\xD7":.6938,"\u2248":.6938,"\u2264":.6938,"\u2265":.6938,\u00E9:.6196},sans600_12:{"0":.6665,"1":.4956,"2":.6299,"3":.6548,"4":.6724,"5":.6484,"6":.668,"7":.6113,"8":.6753,"9":.668," ":.2656,"!":.3413,'"':.5386,"#":.6577,$:.6577,"%":.999,"&":.7334,"'":.3306,"(":.4131,")":.4131,"*":.48,"+":.6577,",":.3306,"-":.48,".":.3306,"/":.3247,":":.3306,";":.3306,"<":.6577,"=":.6577,">":.6577,"?":.5425,"@":.9238,A:.7129,B:.6812,C:.7329,D:.7402,E:.6133,F:.5889,G:.7559,H:.7695,I:.3013,J:.5801,K:.6924,L:.5859,M:.8955,N:.7593,O:.7813,P:.6606,Q:.7813,R:.6807,S:.6626,T:.6514,U:.7524,V:.7056,W:.9956,X:.7124,Y:.6904,Z:.6709,"[":.4131,"\\":.3247,"]":.4131,"^":.6577,_:.5757,"`":.5,a:.5771,b:.6392,c:.5781,d:.6392,e:.5908,f:.3957,g:.6333,h:.6177,i:.2739,j:.2734,k:.582,l:.2808,m:.9116,n:.6128,o:.6099,p:.6348,q:.6348,r:.4232,s:.543,t:.3991,u:.6128,v:.5693,w:.8228,x:.562,y:.5791,z:.5571,"{":.4131,"|":.2856,"}":.4131,"~":.6577,"\xB7":.3306,"\u2192":.9307,"\u2190":.9307,"\u2191":.8037,"\u2193":.8037,"\u2019":.3306,"\u2018":.3306,"\u201C":.522,"\u201D":.522,"\u2026":.9043,"\u2013":.6128,"\u2014":.8957,"\u2715":.7622,"\xD7":.6577,"\u2248":.6577,"\u2264":.6577,"\u2265":.6577,\u00E9:.5908},sans800_12:{"0":.7026,"1":.5278,"2":.6563,"3":.6831,"4":.7017,"5":.6782,"6":.6992,"7":.6348,"8":.7124,"9":.6992," ":.25,"!":.3711,'"':.5991,"#":.6851,$:.6851,"%":1.0723,"&":.7554,"'":.3647,"(":.4443,")":.4443,"*":.4888,"+":.6851,",":.3647,"-":.4888,".":.3647,"/":.3442,":":.3647,";":.3647,"<":.6851,"=":.6851,">":.6851,"?":.5718,"@":.9302,A:.752,B:.7056,C:.7495,D:.7544,E:.6304,F:.606,G:.7646,H:.7969,I:.3354,J:.6221,K:.7261,L:.6035,M:.9175,N:.7769,O:.7915,P:.6865,Q:.7915,R:.708,S:.6875,T:.6689,U:.7681,V:.7368,W:1.0229,X:.7466,Y:.7256,Z:.6802,"[":.4443,"\\":.3442,"]":.4443,"^":.6851,_:.6045,"`":.5,a:.6021,b:.6636,c:.5967,d:.6636,e:.6108,f:.4295,g:.6572,h:.6465,i:.3003,j:.3003,k:.6206,l:.3091,m:.9526,n:.6416,o:.6294,p:.6592,q:.6602,r:.4562,s:.5713,t:.4354,u:.6416,v:.5962,w:.8716,x:.5991,y:.6152,z:.5757,"{":.4443,"|":.313,"}":.4443,"~":.6851,"\xB7":.3647,"\u2192":.9561,"\u2190":.9561,"\u2191":.8267,"\u2193":.8267,"\u2019":.3647,"\u2018":.3647,"\u201C":.5845,"\u201D":.5845,"\u2026":1.0039,"\u2013":.6416,"\u2014":.9173,"\u2715":.7622,"\xD7":.6851,"\u2248":.6851,"\u2264":.6851,"\u2265":.6851,\u00E9:.6108},sans800_11_5:{"0":.7056,"1":.5308,"2":.6592,"3":.686,"4":.7046,"5":.6812,"6":.7021,"7":.6377,"8":.7153,"9":.7021," ":.2529,"!":.374,'"':.6021,"#":.688,$:.688,"%":1.0752,"&":.7583,"'":.3677,"(":.4473,")":.4473,"*":.4917,"+":.688,",":.3677,"-":.4917,".":.3677,"/":.3472,":":.3677,";":.3677,"<":.688,"=":.688,">":.688,"?":.5747,"@":.9331,A:.7549,B:.7085,C:.7524,D:.7573,E:.6333,F:.6089,G:.7676,H:.7998,I:.3384,J:.625,K:.729,L:.6064,M:.9204,N:.7798,O:.7944,P:.6895,Q:.7944,R:.7109,S:.6904,T:.6719,U:.771,V:.7397,W:1.0259,X:.7495,Y:.7285,Z:.6831,"[":.4473,"\\":.3472,"]":.4473,"^":.688,_:.6074,"`":.5029,a:.605,b:.6665,c:.5996,d:.6665,e:.6138,f:.4325,g:.6602,h:.6494,i:.3032,j:.3032,k:.6235,l:.312,m:.9556,n:.6445,o:.6323,p:.6621,q:.6631,r:.4591,s:.5742,t:.4383,u:.6445,v:.5991,w:.8745,x:.6021,y:.6182,z:.5786,"{":.4473,"|":.3159,"}":.4473,"~":.688,"\xB7":.3677,"\u2192":.959,"\u2190":.959,"\u2191":.8296,"\u2193":.8296,"\u2019":.3677,"\u2018":.3677,"\u201C":.5874,"\u201D":.5874,"\u2026":1.0068,"\u2013":.6445,"\u2014":.9183,"\u2715":.7622,"\xD7":.688,"\u2248":.688,"\u2264":.688,"\u2265":.688,\u00E9:.6138},sans400_13:{"0":.624,"1":.458,"2":.5977,"3":.6211,"4":.6377,"5":.6123,"6":.6309,"7":.582,"8":.6328,"9":.6309," ":.2754,"!":.3052,'"':.4717,"#":.624,$:.624,"%":.9194,"&":.7056,"'":.291,"(":.376,")":.376,"*":.4658,"+":.624,",":.291,"-":.4658,".":.291,"/":.2988,":":.291,";":.291,"<":.624,"=":.624,">":.624,"?":.5068,"@":.9121,A:.668,B:.6514,C:.71,D:.7207,E:.5898,F:.5664,G:.7407,H:.7363,I:.2617,J:.5322,K:.6528,L:.562,M:.8682,N:.7363,O:.7656,P:.6294,Q:.7656,R:.6475,S:.6313,T:.6279,U:.7314,V:.668,W:.9619,X:.6729,Y:.6494,Z:.6558,"[":.376,"\\":.2988,"]":.376,"^":.624,_:.5405,"`":.4941,a:.5459,b:.6084,c:.5537,d:.6084,e:.5654,f:.356,g:.6035,h:.5825,i:.2412,j:.2407,k:.5371,l:.2471,m:.8643,n:.5776,o:.585,p:.6045,q:.6035,r:.3843,s:.5083,t:.3574,u:.5776,v:.5361,w:.7686,x:.5186,y:.5371,z:.5332,"{":.376,"|":.2529,"}":.376,"~":.624,"\xB7":.291,"\u2192":.8999,"\u2190":.8999,"\u2191":.7754,"\u2193":.7754,"\u2019":.291,"\u2018":.291,"\u201C":.4531,"\u201D":.4531,"\u2026":.7988,"\u2013":.5776,"\u2014":.872,"\u2715":.7622,"\xD7":.624,"\u2248":.624,"\u2264":.624,"\u2265":.624,\u00E9:.5654},mono400_11:{"0":.6021,"1":.6021,"2":.6021,"3":.6021,"4":.6021,"5":.6021,"6":.6021,"7":.6021,"8":.6021,"9":.6021," ":.6021,"!":.6021,'"':.6021,"#":.6021,$:.6021,"%":.6021,"&":.6021,"'":.6021,"(":.6021,")":.6021,"*":.6021,"+":.6021,",":.6021,"-":.6021,".":.6021,"/":.6021,":":.6021,";":.6021,"<":.6021,"=":.6021,">":.6021,"?":.6021,"@":.6021,A:.6021,B:.6021,C:.6021,D:.6021,E:.6021,F:.6021,G:.6021,H:.6021,I:.6021,J:.6021,K:.6021,L:.6021,M:.6021,N:.6021,O:.6021,P:.6021,Q:.6021,R:.6021,S:.6021,T:.6021,U:.6021,V:.6021,W:.6021,X:.6021,Y:.6021,Z:.6021,"[":.6021,"\\":.6021,"]":.6021,"^":.6021,_:.6021,"`":.6021,a:.6021,b:.6021,c:.6021,d:.6021,e:.6021,f:.6021,g:.6021,h:.6021,i:.6021,j:.6021,k:.6021,l:.6021,m:.6021,n:.6021,o:.6021,p:.6021,q:.6021,r:.6021,s:.6021,t:.6021,u:.6021,v:.6021,w:.6021,x:.6021,y:.6021,z:.6021,"{":.6021,"|":.6021,"}":.6021,"~":.6021,"\xB7":.6021,"\u2192":.6021,"\u2190":.6021,"\u2191":.6021,"\u2193":.6021,"\u2019":.6021,"\u2018":.6021,"\u201C":.6021,"\u201D":.6021,"\u2026":.6021,"\u2013":.6021,"\u2014":.6021,"\u2715":.6021,"\xD7":.6021,"\u2248":.6021,"\u2264":.6021,"\u2265":.6021,\u00E9:.6021},mono600_11:{"0":.6021,"1":.6021,"2":.6021,"3":.6021,"4":.6021,"5":.6021,"6":.6021,"7":.6021,"8":.6021,"9":.6021," ":.6021,"!":.6021,'"':.6021,"#":.6021,$:.6021,"%":.6021,"&":.6021,"'":.6021,"(":.6021,")":.6021,"*":.6021,"+":.6021,",":.6021,"-":.6021,".":.6021,"/":.6021,":":.6021,";":.6021,"<":.6021,"=":.6021,">":.6021,"?":.6021,"@":.6021,A:.6021,B:.6021,C:.6021,D:.6021,E:.6021,F:.6021,G:.6021,H:.6021,I:.6021,J:.6021,K:.6021,L:.6021,M:.6021,N:.6021,O:.6021,P:.6021,Q:.6021,R:.6021,S:.6021,T:.6021,U:.6021,V:.6021,W:.6021,X:.6021,Y:.6021,Z:.6021,"[":.6021,"\\":.6021,"]":.6021,"^":.6021,_:.6021,"`":.6021,a:.6021,b:.6021,c:.6021,d:.6021,e:.6021,f:.6021,g:.6021,h:.6021,i:.6021,j:.6021,k:.6021,l:.6021,m:.6021,n:.6021,o:.6021,p:.6021,q:.6021,r:.6021,s:.6021,t:.6021,u:.6021,v:.6021,w:.6021,x:.6021,y:.6021,z:.6021,"{":.6021,"|":.6021,"}":.6021,"~":.6021,"\xB7":.6021,"\u2192":.6021,"\u2190":.6021,"\u2191":.6021,"\u2193":.6021,"\u2019":.6021,"\u2018":.6021,"\u201C":.6021,"\u201D":.6021,"\u2026":.6021,"\u2013":.6021,"\u2014":.6021,"\u2715":.6021,"\xD7":.6021,"\u2248":.6021,"\u2264":.6021,"\u2265":.6021,\u00E9:.6021}};var lt=34,Ct=Math.cos(Math.PI/6),Ne=(t,e,s=0)=>[(t-e)*Ct*lt,(t+e)*.5*lt-s*lt],bt=t=>{let e=Math.round(t*10)/10;return Object.is(e,-0)?"0":String(e)},Us=t=>`${bt(t[0])},${bt(t[1])}`,vt=t=>t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");function Se(t,e={},s){let r="";for(let i in e){let o=e[i];o==null||o===!1||o===""||(r+=` ${i}="${vt(typeof o=="number"?bt(o):o)}"`)}return s===void 0?`<${t}${r}/>`:`<${t}${r}>${s}</${t}>`}var wt={lbl:{key:"sans700_13",size:13},sub:{key:"mono400_11",size:11},slabname:{key:"sans800_15",size:15,spacing:.12},sm:{key:"sans800_10_5",size:10.5,spacing:.1},floor:{key:"mono600_11",size:11,spacing:.01},say:{key:"sans600_12",size:12},tunname:{key:"sans800_12",size:12,spacing:.14},badge:{key:"sans800_11_5",size:11.5}};function Pn(t,e){let s=jp[e.key],r=e.key.startsWith("mono")?.6:.58,i=0;for(let o of t)i+=s[o]??r;return(i+(e.spacing??0)*[...t].length)*e.size}var ai=(t,e,s)=>[t[0]*e+t[2]*s+t[4],t[1]*e+t[3]*s+t[5]],li=t=>`matrix(${t.map(e=>Math.round(e*1e4)/1e4).join(" ")})`;function Pl(t,e){if(e==="left"){let[i,o]=Ne(t.x0,t.y1,t.z1);return{m:[Ct,.5,0,1,i,o],w:(t.x1-t.x0)*lt,h:(t.z1-t.z0)*lt}}if(e==="right"){let[i,o]=Ne(t.x1,t.y1,t.z1);return{m:[Ct,-.5,0,1,i,o],w:(t.y1-t.y0)*lt,h:(t.z1-t.z0)*lt}}let[s,r]=Ne(t.x0,t.y0,t.z1);return{m:[Ct,.5,-Ct,.5,s,r],w:(t.x1-t.x0)*lt,h:(t.y1-t.y0)*lt}}var ci=class{x0=1/0;y0=1/0;x1=-1/0;y1=-1/0;add(e){e[0]<this.x0&&(this.x0=e[0]),e[0]>this.x1&&(this.x1=e[0]),e[1]<this.y0&&(this.y0=e[1]),e[1]>this.y1&&(this.y1=e[1])}addRect(e,s,r,i){this.add([e,s]),this.add([e+r,s+i])}get empty(){return this.x0===1/0}},yr=class{bounds=new ci;texts=[];planes=[];planePolys=[];defs=new Map;poly(e,s,r={}){let i=e.map(o=>Ne(o[0],o[1],o[2]));return i.forEach(o=>this.bounds.add(o)),Se("polygon",{points:i.map(Us).join(" "),class:s,...r})}line3(e,s,r,i={}){let o=Ne(...e),n=Ne(...s);return this.bounds.add(o),this.bounds.add(n),Se("line",{x1:o[0],y1:o[1],x2:n[0],y2:n[1],class:r,...i})}blockFaces(e){let{x0:s,y0:r,x1:i,y1:o,z0:n,z1:a}=e;return this.poly([[s,o,n],[i,o,n],[i,o,a],[s,o,a]],"lft")+this.poly([[i,r,n],[i,o,n],[i,o,a],[i,r,a]],"rgt")+this.poly([[s,r,a],[i,r,a],[i,o,a],[s,o,a]],"top")}onFace(e,s,r,i){let o=Pl(e,s);for(let[n,a]of[[0,0],[o.w,0],[0,o.h],[o.w,o.h]])this.bounds.add(ai(o.m,n,a));return Se("g",{class:i,transform:li(o.m)},r(o.w,o.h))}onMatrix(e,s,r,i,o){for(let[n,a]of[[0,0],[s,0],[0,r],[s,r]])this.bounds.add(ai(e,n,a));return Se("g",{class:o,transform:li(e)},i(s,r))}text(e,s,r,i,o,n="middle",a={},f){let p=Pn(r,o),l={x:n==="start"?e:n==="end"?e-p:e-p/2,y:s-o.size*.8,w:p,h:o.size*1.05,text:r,owner:f};return this.bounds.addRect(l.x-2,l.y-2,l.w+4,l.h+4),this.texts.push(l),Se("text",{x:e,y:s,class:i,"text-anchor":n==="start"?void 0:n,...a},vt(r))}planeText(e,s,r,i,o="start",n={}){let a=Pn(s,i),f=o==="start"?0:o==="end"?-a:-a/2,p=[[f,-i.size*.8],[f+a,-i.size*.8],[f,i.size*.25],[f+a,i.size*.25]].map(([d,m])=>ai(e,d,m));p.forEach(d=>this.bounds.add(d));let c=p.map(d=>d[0]),l=p.map(d=>d[1]);return this.planePolys.push([p[0],p[1],p[3],p[2]]),this.planes.push({x:Math.min(...c),y:Math.min(...l),w:Math.max(...c)-Math.min(...c),h:Math.max(...l)-Math.min(...l)}),Se("text",{transform:li(e),class:r,"text-anchor":o==="start"?void 0:o,...n},vt(s))}floorText(e,s,r,i,o,n="x",a="start",f={}){let[p,c]=Ne(e,s,r),l=n==="x"?[Ct,.5,-Ct,.5,p,c]:[Ct,-.5,Ct,.5,p,c];return this.planeText(l,i,o,wt.floor,a,f)}faceText(e,s,r,i,o,n,a="left",f="start",p={}){let[c,l]=Ne(e,s,r),d=a==="left"?[Ct,.5,0,1,c,l]:[Ct,-.5,0,1,c,l];return this.planeText(d,i,o,n,f,p)}def(e,s){this.defs.set(e,s)}},Hs=t=>[(t.x0+t.x1)/2,(t.y0+t.y1)/2,t.z1];function pi(t,e,s){let r="";for(let i=0;i<s;i++){let o=e.z1-(e.z1-e.z0)*(.28+i*.2),n=(e.x1-e.x0)*(i===s-1?.35:.62-i*.1);r+=t.line3([e.x0+.35,e.y1,o],[e.x0+.35+n,e.y1,o],"det")}return r}function yo(t,e){let r=e.z1,i=[e.x0+.55,e.y0+.55,r],o=[e.x1-.55,e.y0+.55,r],n=[e.x1-.55,e.y1-.55,r],a=[e.x0+.55,e.y1-.55,r],f=[(e.x0+e.x1)/2,(e.y0+e.y1)/2,r];return t.poly([i,o,n,a],"det")+t.line3(i,f,"det")+t.line3(f,o,"det")}function go(t,e){let r=e.z1,i=t.poly([[e.x0+.55,e.y0+.55,r],[e.x1-.55,e.y0+.55,r],[e.x1-.55,e.y1-.55,r],[e.x0+.55,e.y1-.55,r]],"det");for(let o=1;o<=2;o++){let n=e.y0+.55+(e.y1-e.y0-1.1)*o/3;i+=t.line3([e.x0+.55+.3,n,r],[e.x1-.55-.3-(o===2?.5:0),n,r],"det")}return i}function bo(t,e){let r=e.z1,i=(e.y0+e.y1)/2;return t.line3([e.x0+.3,i-.2,r],[e.x1-.3,i-.2,r],"det")+t.line3([e.x0+.3,i+.2,r],[e.x1-.3-.3,i+.2,r],"det")}function wo(t,e){let s=(e.x0+e.x1)/2,r=(e.y0+e.y1)/2,i=e.z1+.005,o=Math.min(e.x1-e.x0,e.y1-e.y0)*.16,n=[];for(let a=0;a<20;a++){let f=a/20*Math.PI*2;n.push([s-o*1.4+Math.cos(f)*o,r+Math.sin(f)*o,i])}return t.poly(n,"det")+t.line3([s-o*.4,r,i],[s+o*2.2,r,i],"det")+t.line3([s+o*1.7,r,i],[s+o*1.7,r+o*.8,i],"det")}function xo(t,e){let s=(e.x0+e.x1)/2,r=(e.y0+e.y1)/2,i=e.z1+.005,o=Math.min(e.x1-e.x0,e.y1-e.y0)*.28,n=[];for(let a=0;a<24;a++){let f=a/24*Math.PI*2;n.push([s+Math.cos(f)*o,r+Math.sin(f)*o,i])}return t.poly(n,"det sock-hole")}var Ys=(t,e,s,r,i,o=0)=>Se("rect",{class:t,x:e,y:s,width:r,height:i,rx:o||void 0}),gr={terminal(t,e){let s="",r=Math.max(2,Math.floor((e-12)/9));for(let i=0;i<r;i++){let o=10+i*9,n=(t-18)*[.7,.45,.6,.3,.55][i%5];s+=Se("line",{class:"ln",x1:8,y1:o,x2:8+n,y2:o})}return s},chat(t,e){return[[6,.62,"w"],[.3,.58,"m"],[6,.46,"w"],[.42,.5,"m"]].map((r,i)=>{let o=(t-14)*r[1],n=r[0]===6?7:t-7-o;return Ys(r[2],n,8+i*(e-18)/4,o,(e-18)/4-4,3)}).join("")},desktop(t,e){return Ys("wall",5,5,t-10,e-10,2)+Ys("bar",5,5,t-10,6)+Ys("win",t*.5,13,t*.38,e*.42,2)},tiles(t,e){let n=(t-12-5)/3,a=(e-12-2.5*1)/2,f="";for(let p=0;p<2;p++)for(let c=0;c<3;c++){let l=6+c*(n+2.5),d=6+p*(a+2.5);f+=Ys("t",l,d,n,a,1.5),[.3,.52,.74].forEach((m,h)=>{f+=Se("line",{class:"ln",x1:l+2.5,y1:d+a*m,x2:l+2.5+(n-5)*[.8,.5,.65][(h+p+c)%3],y2:d+a*m})})}return f}};function di(t,e){let s=t/2,r=e/2,i=Math.min(t,e)*.22;return Ys("unk",t*.2,e*.2,t*.6,e*.6,2)+Se("path",{class:"unk-q",d:`M${bt(s-i*.5)},${bt(r-i*.45)}a${bt(i*.5)},${bt(i*.5)} 0 1 1 ${bt(i*.5)},${bt(i*.55)}v${bt(i*.3)}`})+Se("circle",{class:"unk-dot",cx:bt(s),cy:bt(r+i*.75),r:bt(Math.max(.8,i*.1))})}function fi(t,e){return Ys("glass",3,3,t-6,e-6,3)}function Zm(t){let e=[Ne(t.x0,t.y0,t.z1),Ne(t.x1,t.y0,t.z0),Ne(t.x0,t.y1,t.z0),Ne(t.x1,t.y1,t.z0),Ne(t.x1,t.y1,t.z1),Ne(t.x0,t.y0,t.z0)],s=e.map(i=>i[0]),r=e.map(i=>i[1]);return[Math.min(...s),Math.min(...r),Math.max(...s),Math.max(...r)]}function Um(t,e){let r=t.x1<=e.x0+1e-6,i=e.x1<=t.x0+1e-6,o=t.y1<=e.y0+1e-6,n=e.y1<=t.y0+1e-6,a=t.z1<=e.z0+1e-6,f=e.z1<=t.z0+1e-6,p=r||o||a,c=i||n||f;return p&&!c?-1:c&&!p?1:0}function mi(t){let e=t.length,s=t.map(p=>Zm(p.box)),r=p=>p.box.x0+p.box.y0+p.box.z0*.01,i=t.map(()=>[]),o=new Array(e).fill(0);for(let p=0;p<e;p++)for(let c=p+1;c<e;c++){let l=s[p],d=s[c];if(l[2]<=d[0]||d[2]<=l[0]||l[3]<=d[1]||d[3]<=l[1])continue;let m=Um(t[p].box,t[c].box);m<0?(i[p].push(c),o[c]++):m>0&&(i[c].push(p),o[p]++)}let n=[],a=t.map((p,c)=>c).filter(p=>!o[p]),f=new Array(e).fill(!1);for(;n.length<e;){if(!a.length){let c=t.map((l,d)=>d).filter(l=>!f[l]).sort((l,d)=>r(t[l])-r(t[d]));a.push(c[0]),o[c[0]]=0}a.sort((c,l)=>r(t[c])-r(t[l])||c-l);let p=a.shift();if(!f[p]){f[p]=!0,n.push(t[p]);for(let c of i[p])!f[c]&&--o[c]===0&&a.push(c)}}return n}var ko=Symbol.for("yaml.alias"),$o=Symbol.for("yaml.document"),Dn=Symbol.for("yaml.map"),Ol=Symbol.for("yaml.pair"),bn=Symbol.for("yaml.scalar"),gs=Symbol.for("yaml.seq"),on=Symbol.for("yaml.node.type"),Bn=t=>!!t&&typeof t=="object"&&t[on]===ko,ss=t=>!!t&&typeof t=="object"&&t[on]===$o,pn=t=>!!t&&typeof t=="object"&&t[on]===Dn,Xe=t=>!!t&&typeof t=="object"&&t[on]===Ol,Ge=t=>!!t&&typeof t=="object"&&t[on]===bn,dn=t=>!!t&&typeof t=="object"&&t[on]===gs;function ct(t){if(t&&typeof t=="object")switch(t[on]){case Dn:case gs:return!0}return!1}function nt(t){if(t&&typeof t=="object")switch(t[on]){case ko:case Dn:case bn:case gs:return!0}return!1}var So=t=>(Ge(t)||ct(t))&&!!t.anchor;var fn=Symbol("break visit"),_p=Symbol("skip children"),rs=Symbol("remove node");function is(t,e){let s=Fp(e);ss(t)?br(null,t.contents,s,Object.freeze([t]))===rs&&(t.contents=null):br(null,t,s,Object.freeze([]))}is.BREAK=fn;is.SKIP=_p;is.REMOVE=rs;function br(t,e,s,r){let i=Dp(t,e,s,r);if(nt(i)||Xe(i))return Bp(t,r,i),br(t,i,s,r);if(typeof i!="symbol"){if(ct(e)){r=Object.freeze(r.concat(e));for(let o=0;o<e.items.length;++o){let n=br(o,e.items[o],s,r);if(typeof n=="number")o=n-1;else{if(n===fn)return fn;n===rs&&(e.items.splice(o,1),o-=1)}}}else if(Xe(e)){r=Object.freeze(r.concat(e));let o=br("key",e.key,s,r);if(o===fn)return fn;o===rs&&(e.key=null);let n=br("value",e.value,s,r);if(n===fn)return fn;n===rs&&(e.value=null)}}return i}async function vo(t,e){let s=Fp(e);ss(t)?await wr(null,t.contents,s,Object.freeze([t]))===rs&&(t.contents=null):await wr(null,t,s,Object.freeze([]))}vo.BREAK=fn;vo.SKIP=_p;vo.REMOVE=rs;async function wr(t,e,s,r){let i=await Dp(t,e,s,r);if(nt(i)||Xe(i))return Bp(t,r,i),wr(t,i,s,r);if(typeof i!="symbol"){if(ct(e)){r=Object.freeze(r.concat(e));for(let o=0;o<e.items.length;++o){let n=await wr(o,e.items[o],s,r);if(typeof n=="number")o=n-1;else{if(n===fn)return fn;n===rs&&(e.items.splice(o,1),o-=1)}}}else if(Xe(e)){r=Object.freeze(r.concat(e));let o=await wr("key",e.key,s,r);if(o===fn)return fn;o===rs&&(e.key=null);let n=await wr("value",e.value,s,r);if(n===fn)return fn;n===rs&&(e.value=null)}}return i}function Fp(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function Dp(t,e,s,r){if(typeof s=="function")return s(t,e,r);if(pn(e))return s.Map?.(t,e,r);if(dn(e))return s.Seq?.(t,e,r);if(Xe(e))return s.Pair?.(t,e,r);if(Ge(e))return s.Scalar?.(t,e,r);if(Bn(e))return s.Alias?.(t,e,r)}function Bp(t,e,s){let r=e[e.length-1];if(ct(r))r.items[t]=s;else if(Xe(r))t==="key"?r.key=s:r.value=s;else if(ss(r))r.contents=s;else{let i=Bn(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}var Hm={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Ym=t=>t.replace(/[!,[\]{}]/g,e=>Hm[e]),os=class t{constructor(e,s){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,s)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,s){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let r=e.trim().split(/[ \t]+/),i=r.shift();switch(i){case"%TAG":{if(r.length!==2&&(s(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[o,n]=r;return this.tags[o]=n,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return s(0,"%YAML directive should contain exactly one part"),!1;let[o]=r;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let n=/^\d+\.\d+$/.test(o);return s(6,`Unsupported YAML version ${o}`,n),!1}}default:return s(0,`Unknown directive ${i}`,!0),!1}}tagName(e,s){if(e==="!")return"!";if(e[0]!=="!")return s(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let n=e.slice(2,-1);return n==="!"||n==="!!"?(s(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&s("Verbatim tags must end with a >"),n)}let[,r,i]=e.match(/^(.*!)([^!]*)$/s);i||s(`The ${e} tag has no suffix`);let o=this.tags[r];if(o)try{return o+decodeURIComponent(i)}catch(n){return s(String(n)),null}return r==="!"?e:(s(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[s,r]of Object.entries(this.tags))if(e.startsWith(r))return s+Ym(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let s=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),i;if(e&&r.length>0&&nt(e.contents)){let o={};is(e.contents,(n,a)=>{nt(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,n]of r)o==="!!"&&n==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(n)))&&s.push(`%TAG ${o} ${n}`);return s.join(`
2
- `)}};os.defaultYaml={explicit:!1,version:"1.2"};os.defaultTags={"!!":"tag:yaml.org,2002:"};function Mo(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let s=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(s)}return!0}function Al(t){let e=new Set;return is(t,{Value(s,r){r.anchor&&e.add(r.anchor)}}),e}function Tl(t,e){for(let s=1;;++s){let r=`${t}${s}`;if(!e.has(r))return r}}function qp(t,e){let s=[],r=new Map,i=null;return{onAnchor:o=>{s.push(o),i??(i=Al(t));let n=Tl(e,i);return i.add(n),n},setAnchors:()=>{for(let o of s){let n=r.get(o);if(typeof n=="object"&&n.anchor&&(Ge(n.node)||ct(n.node)))n.node.anchor=n.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:r}}function Ns(t,e,s,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let i=0,o=r.length;i<o;++i){let n=r[i],a=Ns(t,r,String(i),n);a===void 0?delete r[i]:a!==n&&(r[i]=a)}else if(r instanceof Map)for(let i of Array.from(r.keys())){let o=r.get(i),n=Ns(t,r,i,o);n===void 0?r.delete(i):n!==o&&r.set(i,n)}else if(r instanceof Set)for(let i of Array.from(r)){let o=Ns(t,r,i,i);o===void 0?r.delete(i):o!==i&&(r.delete(i),r.add(o))}else for(let[i,o]of Object.entries(r)){let n=Ns(t,r,i,o);n===void 0?delete r[i]:n!==o&&(r[i]=n)}return t.call(e,s,r)}function qt(t,e,s){if(Array.isArray(t))return t.map((r,i)=>qt(r,String(i),s));if(t&&typeof t.toJSON=="function"){if(!s||!So(t))return t.toJSON(e,s);let r={aliasCount:0,count:1,res:void 0};s.anchors.set(t,r),s.onCreate=o=>{r.res=o,delete s.onCreate};let i=t.toJSON(e,s);return s.onCreate&&s.onCreate(i),i}return typeof t=="bigint"&&!s?.keep?Number(t):t}var Rs=class{constructor(e){Object.defineProperty(this,on,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:s,maxAliasCount:r,onAnchor:i,reviver:o}={}){if(!ss(e))throw new TypeError("A document argument is required");let n={anchors:new Map,doc:e,keep:!0,mapAsMap:s===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},a=qt(this,"",n);if(typeof i=="function")for(let{count:f,res:p}of n.anchors.values())i(p,f);return typeof o=="function"?Ns(o,{"":a},"",a):a}};var bs=class extends Rs{constructor(e){super(ko),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,s){if(s?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let r;s?.aliasResolveCache?r=s.aliasResolveCache:(r=[],is(e,{Node:(o,n)=>{(Bn(n)||So(n))&&r.push(n)}}),s&&(s.aliasResolveCache=r));let i;for(let o of r){if(o===this)break;o.anchor===this.source&&(i=o)}if(i&&s){let{anchors:o,doc:n,maxAliasCount:a}=s,f=o.get(i);if(f||(qt(i,null,s),f=o.get(i)),f?.res===void 0){let p="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(p)}if(a>=0&&(f.count+=1,f.aliasCount===0&&(f.aliasCount=Po(n,i,o)),f.count*f.aliasCount>a)){let p="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(p)}}return i}toJSON(e,s){if(!s)return{source:this.source};let r=this.resolve(s.doc,s);if(!r){let i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(i)}return s.anchors.get(r).res}toString(e,s,r){let i=`*${this.source}`;if(e){if(Mo(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(e.implicitKey)return`${i} `}return i}};function Po(t,e,s){if(Bn(e)){let r=e.resolve(t),i=s&&r&&s.get(r);return i?i.count*i.aliasCount:0}else if(ct(e)){let r=0;for(let i of e.items){let o=Po(t,i,s);o>r&&(r=o)}return r}else if(Xe(e)){let r=Po(t,e.key,s),i=Po(t,e.value,s);return Math.max(r,i)}return 1}var Oo=t=>!t||typeof t!="function"&&typeof t!="object",Re=class extends Rs{constructor(e){super(bn),this.value=e}toJSON(e,s){return s?.keep?this.value:qt(this.value,e,s)}toString(){return String(this.value)}};Re.BLOCK_FOLDED="BLOCK_FOLDED";Re.BLOCK_LITERAL="BLOCK_LITERAL";Re.PLAIN="PLAIN";Re.QUOTE_DOUBLE="QUOTE_DOUBLE";Re.QUOTE_SINGLE="QUOTE_SINGLE";var Wm="tag:yaml.org,2002:";function Jm(t,e,s){if(e){let r=s.filter(o=>o.tag===e),i=r.find(o=>!o.format)??r[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return s.find(r=>r.identify?.(t)&&!r.format)}function ws(t,e,s){if(ss(t)&&(t=t.contents),nt(t))return t;if(Xe(t)){let l=s.schema[Dn].createNode?.(s.schema,null,s);return l.items.push(t),l}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:o,schema:n,sourceObjects:a}=s,f;if(r&&t&&typeof t=="object"){if(f=a.get(t),f)return f.anchor??(f.anchor=i(t)),new bs(f.anchor);f={anchor:null,node:null},a.set(t,f)}e?.startsWith("!!")&&(e=Wm+e.slice(2));let p=Jm(t,e,n.tags);if(!p){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let l=new Re(t);return f&&(f.node=l),l}p=t instanceof Map?n[Dn]:Symbol.iterator in Object(t)?n[gs]:n[Dn]}o&&(o(p),delete s.onTagObj);let c=p?.createNode?p.createNode(s.schema,t,s):typeof p?.nodeClass?.from=="function"?p.nodeClass.from(s.schema,t,s):new Re(t);return e?c.tag=e:p.default||(c.tag=p.tag),f&&(f.node=c),c}function ui(t,e,s){let r=s;for(let i=e.length-1;i>=0;--i){let o=e[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let n=[];n[o]=r,r=n}else r=new Map([[o,r]])}return ws(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var kr=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,xr=class extends Rs{constructor(e,s){super(e),Object.defineProperty(this,"schema",{value:s,configurable:!0,enumerable:!1,writable:!0})}clone(e){let s=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(s.schema=e),s.items=s.items.map(r=>nt(r)||Xe(r)?r.clone(e):r),this.range&&(s.range=this.range.slice()),s}addIn(e,s){if(kr(e))this.add(s);else{let[r,...i]=e,o=this.get(r,!0);if(ct(o))o.addIn(i,s);else if(o===void 0&&this.schema)this.set(r,ui(this.schema,i,s));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(e){let[s,...r]=e;if(r.length===0)return this.delete(s);let i=this.get(s,!0);if(ct(i))return i.deleteIn(r);throw new Error(`Expected YAML collection at ${s}. Remaining path: ${r}`)}getIn(e,s){let[r,...i]=e,o=this.get(r,!0);return i.length===0?!s&&Ge(o)?o.value:o:ct(o)?o.getIn(i,s):void 0}hasAllNullValues(e){return this.items.every(s=>{if(!Xe(s))return!1;let r=s.value;return r==null||e&&Ge(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[s,...r]=e;if(r.length===0)return this.has(s);let i=this.get(s,!0);return ct(i)?i.hasIn(r):!1}setIn(e,s){let[r,...i]=e;if(i.length===0)this.set(r,s);else{let o=this.get(r,!0);if(ct(o))o.setIn(i,s);else if(o===void 0&&this.schema)this.set(r,ui(this.schema,i,s));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}};var Vp=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function On(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var as=(t,e,s)=>t.endsWith(`
3
- `)?On(s,e):s.includes(`
1
+ var Zm=Object.defineProperty;var yo=(t,e)=>{for(var s in e)Zm(t,s,{get:e[s],enumerable:!0})};var Bd={};yo(Bd,{Bounds:()=>ci,C:()=>Ct,DiagError:()=>la,FONTS:()=>wt,Kernel:()=>yr,MONO:()=>tn,S:()=>ct,VEl:()=>Ii,allowed:()=>lc,apply:()=>ai,bubble:()=>xo,buildSvg:()=>Cd,center:()=>Hs,colorRef:()=>Hn,contrast:()=>Ci,createHash:()=>_d,depthSort:()=>mi,didYouMean:()=>Vt,distance:()=>oc,envelope:()=>wo,esc:()=>vt,extendTheme:()=>_s,faceFrame:()=>Tl,fileLines:()=>ko,formatDiag:()=>ac,formatDiags:()=>Nd,greyOf:()=>zi,iso:()=>Re,keyGlyph:()=>$o,loadTheme:()=>Tr,matStr:()=>li,monoOf:()=>fa,n1:()=>bt,parse:()=>ca,parseSvg:()=>cc,placeholderFace:()=>di,pt:()=>Us,screenFaces:()=>gr,screenGlass:()=>fi,serialize:()=>pa,sha256Hex:()=>pc,socketGlyph:()=>So,tag:()=>Me,termLines:()=>pi,textWidth:()=>On,themeCss:()=>aa,themeParts:()=>Ri,vdoc:()=>jd,withFont:()=>bo});var Fp={sans700_13:{"0":.6787,"1":.5059,"2":.6372,"3":.6631,"4":.6812,"5":.6577,"6":.6777,"7":.6172,"8":.688,"9":.6777," ":.252,"!":.3506,'"':.563,"#":.6655,$:.6655,"%":1.0298,"&":.7388,"'":.3418,"(":.4229,")":.4229,"*":.4785,"+":.6655,",":.3418,"-":.4785,".":.3418,"/":.3286,":":.3418,";":.3418,"<":.6655,"=":.6655,">":.6655,"?":.5513,"@":.9214,A:.7266,B:.6875,C:.7354,D:.7417,E:.6162,F:.5918,G:.7544,H:.7773,I:.3125,J:.5952,K:.7036,L:.5889,M:.9009,N:.7622,O:.7808,P:.668,Q:.7808,R:.6885,S:.6694,T:.6543,U:.7544,V:.7153,W:1.0034,X:.7236,Y:.7021,Z:.6699,"[":.4229,"\\":.3286,"]":.4229,"^":.6655,_:.5845,"`":.4941,a:.584,b:.6455,c:.5815,d:.6455,e:.5952,f:.407,g:.6396,h:.6265,i:.2813,j:.2813,k:.5957,l:.2891,m:.9263,n:.6216,o:.6138,p:.6411,q:.6416,r:.4338,s:.5513,t:.4114,u:.6216,v:.5771,w:.8413,x:.5747,y:.5913,z:.5605,"{":.4229,"|":.2935,"}":.4229,"~":.6655,"\xB7":.3418,"\u2192":.9375,"\u2190":.9375,"\u2191":.8096,"\u2193":.8096,"\u2019":.3418,"\u2018":.3418,"\u201C":.5474,"\u201D":.5474,"\u2026":.9482,"\u2013":.6216,"\u2014":.9045,"\u2715":.7622,"\xD7":.6655,"\u2248":.6655,"\u2264":.6655,"\u2265":.6655,\u00E9:.5952},sans800_15:{"0":.687,"1":.5122,"2":.6406,"3":.6675,"4":.686,"5":.6626,"6":.6836,"7":.6191,"8":.6968,"9":.6836," ":.2344,"!":.3555,'"':.5835,"#":.6694,$:.6694,"%":1.0566,"&":.7397,"'":.3491,"(":.4287,")":.4287,"*":.4731,"+":.6694,",":.3491,"-":.4731,".":.3491,"/":.3286,":":.3491,";":.3491,"<":.6694,"=":.6694,">":.6694,"?":.5562,"@":.9146,A:.7363,B:.6899,C:.7339,D:.7388,E:.6147,F:.5903,G:.749,H:.7813,I:.3198,J:.6064,K:.7104,L:.5879,M:.9019,N:.7612,O:.7759,P:.6709,Q:.7759,R:.6924,S:.6719,T:.6533,U:.7524,V:.7212,W:1.0073,X:.731,Y:.71,Z:.6646,"[":.4287,"\\":.3286,"]":.4287,"^":.6694,_:.5889,"`":.4844,a:.5864,b:.6479,c:.5811,d:.6479,e:.5952,f:.4139,g:.6416,h:.6309,i:.2847,j:.2847,k:.605,l:.2935,m:.937,n:.626,o:.6138,p:.6436,q:.6445,r:.4406,s:.5557,t:.4198,u:.626,v:.5806,w:.856,x:.5835,y:.5996,z:.5601,"{":.4287,"|":.2974,"}":.4287,"~":.6694,"\xB7":.3491,"\u2192":.9404,"\u2190":.9404,"\u2191":.811,"\u2193":.811,"\u2019":.3491,"\u2018":.3491,"\u201C":.5688,"\u201D":.5688,"\u2026":.9883,"\u2013":.626,"\u2014":.9118,"\u2715":.7622,"\xD7":.6694,"\u2248":.6694,"\u2264":.6694,"\u2265":.6694,\u00E9:.5952},sans800_10_5:{"0":.7114,"1":.5366,"2":.665,"3":.6919,"4":.7104,"5":.687,"6":.708,"7":.6436,"8":.7212,"9":.708," ":.2588,"!":.3799,'"':.6079,"#":.6938,$:.6938,"%":1.0811,"&":.7642,"'":.3735,"(":.4531,")":.4531,"*":.4976,"+":.6938,",":.3735,"-":.4976,".":.3735,"/":.353,":":.3735,";":.3735,"<":.6938,"=":.6938,">":.6938,"?":.5806,"@":.939,A:.7607,B:.7144,C:.7583,D:.7632,E:.6392,F:.6147,G:.7734,H:.8057,I:.3442,J:.6309,K:.7349,L:.6123,M:.9263,N:.7856,O:.8003,P:.6953,Q:.8003,R:.7168,S:.6963,T:.6777,U:.7769,V:.7456,W:1.0317,X:.7554,Y:.7344,Z:.689,"[":.4531,"\\":.353,"]":.4531,"^":.6938,_:.6133,"`":.5088,a:.6108,b:.6724,c:.6055,d:.6724,e:.6196,f:.4383,g:.666,h:.6553,i:.3091,j:.3091,k:.6294,l:.3179,m:.9614,n:.6504,o:.6382,p:.668,q:.6689,r:.465,s:.5801,t:.4442,u:.6504,v:.605,w:.8804,x:.6079,y:.624,z:.5845,"{":.4531,"|":.3218,"}":.4531,"~":.6938,"\xB7":.3735,"\u2192":.9648,"\u2190":.9648,"\u2191":.8354,"\u2193":.8354,"\u2019":.3735,"\u2018":.3735,"\u201C":.5933,"\u201D":.5933,"\u2026":1.0127,"\u2013":.6504,"\u2014":.9204,"\u2715":.7622,"\xD7":.6938,"\u2248":.6938,"\u2264":.6938,"\u2265":.6938,\u00E9:.6196},sans600_12:{"0":.6665,"1":.4956,"2":.6299,"3":.6548,"4":.6724,"5":.6484,"6":.668,"7":.6113,"8":.6753,"9":.668," ":.2656,"!":.3413,'"':.5386,"#":.6577,$:.6577,"%":.999,"&":.7334,"'":.3306,"(":.4131,")":.4131,"*":.48,"+":.6577,",":.3306,"-":.48,".":.3306,"/":.3247,":":.3306,";":.3306,"<":.6577,"=":.6577,">":.6577,"?":.5425,"@":.9238,A:.7129,B:.6812,C:.7329,D:.7402,E:.6133,F:.5889,G:.7559,H:.7695,I:.3013,J:.5801,K:.6924,L:.5859,M:.8955,N:.7593,O:.7813,P:.6606,Q:.7813,R:.6807,S:.6626,T:.6514,U:.7524,V:.7056,W:.9956,X:.7124,Y:.6904,Z:.6709,"[":.4131,"\\":.3247,"]":.4131,"^":.6577,_:.5757,"`":.5,a:.5771,b:.6392,c:.5781,d:.6392,e:.5908,f:.3957,g:.6333,h:.6177,i:.2739,j:.2734,k:.582,l:.2808,m:.9116,n:.6128,o:.6099,p:.6348,q:.6348,r:.4232,s:.543,t:.3991,u:.6128,v:.5693,w:.8228,x:.562,y:.5791,z:.5571,"{":.4131,"|":.2856,"}":.4131,"~":.6577,"\xB7":.3306,"\u2192":.9307,"\u2190":.9307,"\u2191":.8037,"\u2193":.8037,"\u2019":.3306,"\u2018":.3306,"\u201C":.522,"\u201D":.522,"\u2026":.9043,"\u2013":.6128,"\u2014":.8957,"\u2715":.7622,"\xD7":.6577,"\u2248":.6577,"\u2264":.6577,"\u2265":.6577,\u00E9:.5908},sans800_12:{"0":.7026,"1":.5278,"2":.6563,"3":.6831,"4":.7017,"5":.6782,"6":.6992,"7":.6348,"8":.7124,"9":.6992," ":.25,"!":.3711,'"':.5991,"#":.6851,$:.6851,"%":1.0723,"&":.7554,"'":.3647,"(":.4443,")":.4443,"*":.4888,"+":.6851,",":.3647,"-":.4888,".":.3647,"/":.3442,":":.3647,";":.3647,"<":.6851,"=":.6851,">":.6851,"?":.5718,"@":.9302,A:.752,B:.7056,C:.7495,D:.7544,E:.6304,F:.606,G:.7646,H:.7969,I:.3354,J:.6221,K:.7261,L:.6035,M:.9175,N:.7769,O:.7915,P:.6865,Q:.7915,R:.708,S:.6875,T:.6689,U:.7681,V:.7368,W:1.0229,X:.7466,Y:.7256,Z:.6802,"[":.4443,"\\":.3442,"]":.4443,"^":.6851,_:.6045,"`":.5,a:.6021,b:.6636,c:.5967,d:.6636,e:.6108,f:.4295,g:.6572,h:.6465,i:.3003,j:.3003,k:.6206,l:.3091,m:.9526,n:.6416,o:.6294,p:.6592,q:.6602,r:.4562,s:.5713,t:.4354,u:.6416,v:.5962,w:.8716,x:.5991,y:.6152,z:.5757,"{":.4443,"|":.313,"}":.4443,"~":.6851,"\xB7":.3647,"\u2192":.9561,"\u2190":.9561,"\u2191":.8267,"\u2193":.8267,"\u2019":.3647,"\u2018":.3647,"\u201C":.5845,"\u201D":.5845,"\u2026":1.0039,"\u2013":.6416,"\u2014":.9173,"\u2715":.7622,"\xD7":.6851,"\u2248":.6851,"\u2264":.6851,"\u2265":.6851,\u00E9:.6108},sans800_11_5:{"0":.7056,"1":.5308,"2":.6592,"3":.686,"4":.7046,"5":.6812,"6":.7021,"7":.6377,"8":.7153,"9":.7021," ":.2529,"!":.374,'"':.6021,"#":.688,$:.688,"%":1.0752,"&":.7583,"'":.3677,"(":.4473,")":.4473,"*":.4917,"+":.688,",":.3677,"-":.4917,".":.3677,"/":.3472,":":.3677,";":.3677,"<":.688,"=":.688,">":.688,"?":.5747,"@":.9331,A:.7549,B:.7085,C:.7524,D:.7573,E:.6333,F:.6089,G:.7676,H:.7998,I:.3384,J:.625,K:.729,L:.6064,M:.9204,N:.7798,O:.7944,P:.6895,Q:.7944,R:.7109,S:.6904,T:.6719,U:.771,V:.7397,W:1.0259,X:.7495,Y:.7285,Z:.6831,"[":.4473,"\\":.3472,"]":.4473,"^":.688,_:.6074,"`":.5029,a:.605,b:.6665,c:.5996,d:.6665,e:.6138,f:.4325,g:.6602,h:.6494,i:.3032,j:.3032,k:.6235,l:.312,m:.9556,n:.6445,o:.6323,p:.6621,q:.6631,r:.4591,s:.5742,t:.4383,u:.6445,v:.5991,w:.8745,x:.6021,y:.6182,z:.5786,"{":.4473,"|":.3159,"}":.4473,"~":.688,"\xB7":.3677,"\u2192":.959,"\u2190":.959,"\u2191":.8296,"\u2193":.8296,"\u2019":.3677,"\u2018":.3677,"\u201C":.5874,"\u201D":.5874,"\u2026":1.0068,"\u2013":.6445,"\u2014":.9183,"\u2715":.7622,"\xD7":.688,"\u2248":.688,"\u2264":.688,"\u2265":.688,\u00E9:.6138},sans400_13:{"0":.624,"1":.458,"2":.5977,"3":.6211,"4":.6377,"5":.6123,"6":.6309,"7":.582,"8":.6328,"9":.6309," ":.2754,"!":.3052,'"':.4717,"#":.624,$:.624,"%":.9194,"&":.7056,"'":.291,"(":.376,")":.376,"*":.4658,"+":.624,",":.291,"-":.4658,".":.291,"/":.2988,":":.291,";":.291,"<":.624,"=":.624,">":.624,"?":.5068,"@":.9121,A:.668,B:.6514,C:.71,D:.7207,E:.5898,F:.5664,G:.7407,H:.7363,I:.2617,J:.5322,K:.6528,L:.562,M:.8682,N:.7363,O:.7656,P:.6294,Q:.7656,R:.6475,S:.6313,T:.6279,U:.7314,V:.668,W:.9619,X:.6729,Y:.6494,Z:.6558,"[":.376,"\\":.2988,"]":.376,"^":.624,_:.5405,"`":.4941,a:.5459,b:.6084,c:.5537,d:.6084,e:.5654,f:.356,g:.6035,h:.5825,i:.2412,j:.2407,k:.5371,l:.2471,m:.8643,n:.5776,o:.585,p:.6045,q:.6035,r:.3843,s:.5083,t:.3574,u:.5776,v:.5361,w:.7686,x:.5186,y:.5371,z:.5332,"{":.376,"|":.2529,"}":.376,"~":.624,"\xB7":.291,"\u2192":.8999,"\u2190":.8999,"\u2191":.7754,"\u2193":.7754,"\u2019":.291,"\u2018":.291,"\u201C":.4531,"\u201D":.4531,"\u2026":.7988,"\u2013":.5776,"\u2014":.872,"\u2715":.7622,"\xD7":.624,"\u2248":.624,"\u2264":.624,"\u2265":.624,\u00E9:.5654},mono400_11:{"0":.6021,"1":.6021,"2":.6021,"3":.6021,"4":.6021,"5":.6021,"6":.6021,"7":.6021,"8":.6021,"9":.6021," ":.6021,"!":.6021,'"':.6021,"#":.6021,$:.6021,"%":.6021,"&":.6021,"'":.6021,"(":.6021,")":.6021,"*":.6021,"+":.6021,",":.6021,"-":.6021,".":.6021,"/":.6021,":":.6021,";":.6021,"<":.6021,"=":.6021,">":.6021,"?":.6021,"@":.6021,A:.6021,B:.6021,C:.6021,D:.6021,E:.6021,F:.6021,G:.6021,H:.6021,I:.6021,J:.6021,K:.6021,L:.6021,M:.6021,N:.6021,O:.6021,P:.6021,Q:.6021,R:.6021,S:.6021,T:.6021,U:.6021,V:.6021,W:.6021,X:.6021,Y:.6021,Z:.6021,"[":.6021,"\\":.6021,"]":.6021,"^":.6021,_:.6021,"`":.6021,a:.6021,b:.6021,c:.6021,d:.6021,e:.6021,f:.6021,g:.6021,h:.6021,i:.6021,j:.6021,k:.6021,l:.6021,m:.6021,n:.6021,o:.6021,p:.6021,q:.6021,r:.6021,s:.6021,t:.6021,u:.6021,v:.6021,w:.6021,x:.6021,y:.6021,z:.6021,"{":.6021,"|":.6021,"}":.6021,"~":.6021,"\xB7":.6021,"\u2192":.6021,"\u2190":.6021,"\u2191":.6021,"\u2193":.6021,"\u2019":.6021,"\u2018":.6021,"\u201C":.6021,"\u201D":.6021,"\u2026":.6021,"\u2013":.6021,"\u2014":.6021,"\u2715":.6021,"\xD7":.6021,"\u2248":.6021,"\u2264":.6021,"\u2265":.6021,\u00E9:.6021},mono600_11:{"0":.6021,"1":.6021,"2":.6021,"3":.6021,"4":.6021,"5":.6021,"6":.6021,"7":.6021,"8":.6021,"9":.6021," ":.6021,"!":.6021,'"':.6021,"#":.6021,$:.6021,"%":.6021,"&":.6021,"'":.6021,"(":.6021,")":.6021,"*":.6021,"+":.6021,",":.6021,"-":.6021,".":.6021,"/":.6021,":":.6021,";":.6021,"<":.6021,"=":.6021,">":.6021,"?":.6021,"@":.6021,A:.6021,B:.6021,C:.6021,D:.6021,E:.6021,F:.6021,G:.6021,H:.6021,I:.6021,J:.6021,K:.6021,L:.6021,M:.6021,N:.6021,O:.6021,P:.6021,Q:.6021,R:.6021,S:.6021,T:.6021,U:.6021,V:.6021,W:.6021,X:.6021,Y:.6021,Z:.6021,"[":.6021,"\\":.6021,"]":.6021,"^":.6021,_:.6021,"`":.6021,a:.6021,b:.6021,c:.6021,d:.6021,e:.6021,f:.6021,g:.6021,h:.6021,i:.6021,j:.6021,k:.6021,l:.6021,m:.6021,n:.6021,o:.6021,p:.6021,q:.6021,r:.6021,s:.6021,t:.6021,u:.6021,v:.6021,w:.6021,x:.6021,y:.6021,z:.6021,"{":.6021,"|":.6021,"}":.6021,"~":.6021,"\xB7":.6021,"\u2192":.6021,"\u2190":.6021,"\u2191":.6021,"\u2193":.6021,"\u2019":.6021,"\u2018":.6021,"\u201C":.6021,"\u201D":.6021,"\u2026":.6021,"\u2013":.6021,"\u2014":.6021,"\u2715":.6021,"\xD7":.6021,"\u2248":.6021,"\u2264":.6021,"\u2265":.6021,\u00E9:.6021}};var ct=34,Ct=Math.cos(Math.PI/6),Re=(t,e,s=0)=>[(t-e)*Ct*ct,(t+e)*.5*ct-s*ct],bt=t=>{let e=Math.round(t*10)/10;return Object.is(e,-0)?"0":String(e)},Us=t=>`${bt(t[0])},${bt(t[1])}`,vt=t=>t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");function Me(t,e={},s){let r="";for(let i in e){let o=e[i];o==null||o===!1||o===""||(r+=` ${i}="${vt(typeof o=="number"?bt(o):o)}"`)}return s===void 0?`<${t}${r}/>`:`<${t}${r}>${s}</${t}>`}var wt={lbl:{key:"sans700_13",size:13},sub:{key:"mono400_11",size:11},slabname:{key:"sans800_15",size:15,spacing:.12},sm:{key:"sans800_10_5",size:10.5,spacing:.1},floor:{key:"mono600_11",size:11,spacing:.01},say:{key:"sans600_12",size:12},tunname:{key:"sans800_12",size:12,spacing:.14},badge:{key:"sans800_11_5",size:11.5}},go;function bo(t,e){let s=go;go=t;try{return e()}finally{go=s}}function On(t,e){let s=go?.widths[e.key]??Fp[e.key],r=e.key.startsWith("mono")?.6:.58,i=0;for(let o of t)i+=s[o]??r;return(i+(e.spacing??0)*[...t].length)*e.size}var ai=(t,e,s)=>[t[0]*e+t[2]*s+t[4],t[1]*e+t[3]*s+t[5]],li=t=>`matrix(${t.map(e=>Math.round(e*1e4)/1e4).join(" ")})`;function Tl(t,e){if(e==="left"){let[i,o]=Re(t.x0,t.y1,t.z1);return{m:[Ct,.5,0,1,i,o],w:(t.x1-t.x0)*ct,h:(t.z1-t.z0)*ct}}if(e==="right"){let[i,o]=Re(t.x1,t.y1,t.z1);return{m:[Ct,-.5,0,1,i,o],w:(t.y1-t.y0)*ct,h:(t.z1-t.z0)*ct}}let[s,r]=Re(t.x0,t.y0,t.z1);return{m:[Ct,.5,-Ct,.5,s,r],w:(t.x1-t.x0)*ct,h:(t.y1-t.y0)*ct}}var ci=class{x0=1/0;y0=1/0;x1=-1/0;y1=-1/0;add(e){e[0]<this.x0&&(this.x0=e[0]),e[0]>this.x1&&(this.x1=e[0]),e[1]<this.y0&&(this.y0=e[1]),e[1]>this.y1&&(this.y1=e[1])}addRect(e,s,r,i){this.add([e,s]),this.add([e+r,s+i])}get empty(){return this.x0===1/0}},yr=class{bounds=new ci;texts=[];planes=[];planePolys=[];defs=new Map;poly(e,s,r={}){let i=e.map(o=>Re(o[0],o[1],o[2]));return i.forEach(o=>this.bounds.add(o)),Me("polygon",{points:i.map(Us).join(" "),class:s,...r})}line3(e,s,r,i={}){let o=Re(...e),n=Re(...s);return this.bounds.add(o),this.bounds.add(n),Me("line",{x1:o[0],y1:o[1],x2:n[0],y2:n[1],class:r,...i})}blockFaces(e){let{x0:s,y0:r,x1:i,y1:o,z0:n,z1:a}=e;return this.poly([[s,o,n],[i,o,n],[i,o,a],[s,o,a]],"lft")+this.poly([[i,r,n],[i,o,n],[i,o,a],[i,r,a]],"rgt")+this.poly([[s,r,a],[i,r,a],[i,o,a],[s,o,a]],"top")}onFace(e,s,r,i){let o=Tl(e,s);for(let[n,a]of[[0,0],[o.w,0],[0,o.h],[o.w,o.h]])this.bounds.add(ai(o.m,n,a));return Me("g",{class:i,transform:li(o.m)},r(o.w,o.h))}onMatrix(e,s,r,i,o){for(let[n,a]of[[0,0],[s,0],[0,r],[s,r]])this.bounds.add(ai(e,n,a));return Me("g",{class:o,transform:li(e)},i(s,r))}text(e,s,r,i,o,n="middle",a={},f){let p=On(r,o),l={x:n==="start"?e:n==="end"?e-p:e-p/2,y:s-o.size*.8,w:p,h:o.size*1.05,text:r,owner:f};return this.bounds.addRect(l.x-2,l.y-2,l.w+4,l.h+4),this.texts.push(l),Me("text",{x:e,y:s,class:i,"text-anchor":n==="start"?void 0:n,...a},vt(r))}planeText(e,s,r,i,o="start",n={}){let a=On(s,i),f=o==="start"?0:o==="end"?-a:-a/2,p=[[f,-i.size*.8],[f+a,-i.size*.8],[f,i.size*.25],[f+a,i.size*.25]].map(([d,m])=>ai(e,d,m));p.forEach(d=>this.bounds.add(d));let c=p.map(d=>d[0]),l=p.map(d=>d[1]);return this.planePolys.push([p[0],p[1],p[3],p[2]]),this.planes.push({x:Math.min(...c),y:Math.min(...l),w:Math.max(...c)-Math.min(...c),h:Math.max(...l)-Math.min(...l)}),Me("text",{transform:li(e),class:r,"text-anchor":o==="start"?void 0:o,...n},vt(s))}floorText(e,s,r,i,o,n="x",a="start",f={}){let[p,c]=Re(e,s,r),l=n==="x"?[Ct,.5,-Ct,.5,p,c]:[Ct,-.5,Ct,.5,p,c];return this.planeText(l,i,o,wt.floor,a,f)}faceText(e,s,r,i,o,n,a="left",f="start",p={}){let[c,l]=Re(e,s,r),d=a==="left"?[Ct,.5,0,1,c,l]:[Ct,-.5,0,1,c,l];return this.planeText(d,i,o,n,f,p)}def(e,s){this.defs.set(e,s)}},Hs=t=>[(t.x0+t.x1)/2,(t.y0+t.y1)/2,t.z1];function pi(t,e,s){let r="";for(let i=0;i<s;i++){let o=e.z1-(e.z1-e.z0)*(.28+i*.2),n=(e.x1-e.x0)*(i===s-1?.35:.62-i*.1);r+=t.line3([e.x0+.35,e.y1,o],[e.x0+.35+n,e.y1,o],"det")}return r}function wo(t,e){let r=e.z1,i=[e.x0+.55,e.y0+.55,r],o=[e.x1-.55,e.y0+.55,r],n=[e.x1-.55,e.y1-.55,r],a=[e.x0+.55,e.y1-.55,r],f=[(e.x0+e.x1)/2,(e.y0+e.y1)/2,r];return t.poly([i,o,n,a],"det")+t.line3(i,f,"det")+t.line3(f,o,"det")}function xo(t,e){let r=e.z1,i=t.poly([[e.x0+.55,e.y0+.55,r],[e.x1-.55,e.y0+.55,r],[e.x1-.55,e.y1-.55,r],[e.x0+.55,e.y1-.55,r]],"det");for(let o=1;o<=2;o++){let n=e.y0+.55+(e.y1-e.y0-1.1)*o/3;i+=t.line3([e.x0+.55+.3,n,r],[e.x1-.55-.3-(o===2?.5:0),n,r],"det")}return i}function ko(t,e){let r=e.z1,i=(e.y0+e.y1)/2;return t.line3([e.x0+.3,i-.2,r],[e.x1-.3,i-.2,r],"det")+t.line3([e.x0+.3,i+.2,r],[e.x1-.3-.3,i+.2,r],"det")}function $o(t,e){let s=(e.x0+e.x1)/2,r=(e.y0+e.y1)/2,i=e.z1+.005,o=Math.min(e.x1-e.x0,e.y1-e.y0)*.16,n=[];for(let a=0;a<20;a++){let f=a/20*Math.PI*2;n.push([s-o*1.4+Math.cos(f)*o,r+Math.sin(f)*o,i])}return t.poly(n,"det")+t.line3([s-o*.4,r,i],[s+o*2.2,r,i],"det")+t.line3([s+o*1.7,r,i],[s+o*1.7,r+o*.8,i],"det")}function So(t,e){let s=(e.x0+e.x1)/2,r=(e.y0+e.y1)/2,i=e.z1+.005,o=Math.min(e.x1-e.x0,e.y1-e.y0)*.28,n=[];for(let a=0;a<24;a++){let f=a/24*Math.PI*2;n.push([s+Math.cos(f)*o,r+Math.sin(f)*o,i])}return t.poly(n,"det sock-hole")}var Ys=(t,e,s,r,i,o=0)=>Me("rect",{class:t,x:e,y:s,width:r,height:i,rx:o||void 0}),gr={terminal(t,e){let s="",r=Math.max(2,Math.floor((e-12)/9));for(let i=0;i<r;i++){let o=10+i*9,n=(t-18)*[.7,.45,.6,.3,.55][i%5];s+=Me("line",{class:"ln",x1:8,y1:o,x2:8+n,y2:o})}return s},chat(t,e){return[[6,.62,"w"],[.3,.58,"m"],[6,.46,"w"],[.42,.5,"m"]].map((r,i)=>{let o=(t-14)*r[1],n=r[0]===6?7:t-7-o;return Ys(r[2],n,8+i*(e-18)/4,o,(e-18)/4-4,3)}).join("")},desktop(t,e){return Ys("wall",5,5,t-10,e-10,2)+Ys("bar",5,5,t-10,6)+Ys("win",t*.5,13,t*.38,e*.42,2)},tiles(t,e){let n=(t-12-5)/3,a=(e-12-2.5*1)/2,f="";for(let p=0;p<2;p++)for(let c=0;c<3;c++){let l=6+c*(n+2.5),d=6+p*(a+2.5);f+=Ys("t",l,d,n,a,1.5),[.3,.52,.74].forEach((m,h)=>{f+=Me("line",{class:"ln",x1:l+2.5,y1:d+a*m,x2:l+2.5+(n-5)*[.8,.5,.65][(h+p+c)%3],y2:d+a*m})})}return f}};function di(t,e){let s=t/2,r=e/2,i=Math.min(t,e)*.22;return Ys("unk",t*.2,e*.2,t*.6,e*.6,2)+Me("path",{class:"unk-q",d:`M${bt(s-i*.5)},${bt(r-i*.45)}a${bt(i*.5)},${bt(i*.5)} 0 1 1 ${bt(i*.5)},${bt(i*.55)}v${bt(i*.3)}`})+Me("circle",{class:"unk-dot",cx:bt(s),cy:bt(r+i*.75),r:bt(Math.max(.8,i*.1))})}function fi(t,e){return Ys("glass",3,3,t-6,e-6,3)}function Hm(t){let e=[Re(t.x0,t.y0,t.z1),Re(t.x1,t.y0,t.z0),Re(t.x0,t.y1,t.z0),Re(t.x1,t.y1,t.z0),Re(t.x1,t.y1,t.z1),Re(t.x0,t.y0,t.z0)],s=e.map(i=>i[0]),r=e.map(i=>i[1]);return[Math.min(...s),Math.min(...r),Math.max(...s),Math.max(...r)]}function Ym(t,e){let r=t.x1<=e.x0+1e-6,i=e.x1<=t.x0+1e-6,o=t.y1<=e.y0+1e-6,n=e.y1<=t.y0+1e-6,a=t.z1<=e.z0+1e-6,f=e.z1<=t.z0+1e-6,p=r||o||a,c=i||n||f;return p&&!c?-1:c&&!p?1:0}function mi(t){let e=t.length,s=t.map(p=>Hm(p.box)),r=p=>p.box.x0+p.box.y0+p.box.z0*.01,i=t.map(()=>[]),o=new Array(e).fill(0);for(let p=0;p<e;p++)for(let c=p+1;c<e;c++){let l=s[p],d=s[c];if(l[2]<=d[0]||d[2]<=l[0]||l[3]<=d[1]||d[3]<=l[1])continue;let m=Ym(t[p].box,t[c].box);m<0?(i[p].push(c),o[c]++):m>0&&(i[c].push(p),o[p]++)}let n=[],a=t.map((p,c)=>c).filter(p=>!o[p]),f=new Array(e).fill(!1);for(;n.length<e;){if(!a.length){let c=t.map((l,d)=>d).filter(l=>!f[l]).sort((l,d)=>r(t[l])-r(t[d]));a.push(c[0]),o[c[0]]=0}a.sort((c,l)=>r(t[c])-r(t[l])||c-l);let p=a.shift();if(!f[p]){f[p]=!0,n.push(t[p]);for(let c of i[p])!f[c]&&--o[c]===0&&a.push(c)}}return n}var vo=Symbol.for("yaml.alias"),Mo=Symbol.for("yaml.document"),Bn=Symbol.for("yaml.map"),El=Symbol.for("yaml.pair"),bn=Symbol.for("yaml.scalar"),gs=Symbol.for("yaml.seq"),on=Symbol.for("yaml.node.type"),qn=t=>!!t&&typeof t=="object"&&t[on]===vo,ss=t=>!!t&&typeof t=="object"&&t[on]===Mo,pn=t=>!!t&&typeof t=="object"&&t[on]===Bn,et=t=>!!t&&typeof t=="object"&&t[on]===El,Ue=t=>!!t&&typeof t=="object"&&t[on]===bn,dn=t=>!!t&&typeof t=="object"&&t[on]===gs;function pt(t){if(t&&typeof t=="object")switch(t[on]){case Bn:case gs:return!0}return!1}function st(t){if(t&&typeof t=="object")switch(t[on]){case vo:case Bn:case bn:case gs:return!0}return!1}var Po=t=>(Ue(t)||pt(t))&&!!t.anchor;var fn=Symbol("break visit"),Bp=Symbol("skip children"),rs=Symbol("remove node");function is(t,e){let s=qp(e);ss(t)?br(null,t.contents,s,Object.freeze([t]))===rs&&(t.contents=null):br(null,t,s,Object.freeze([]))}is.BREAK=fn;is.SKIP=Bp;is.REMOVE=rs;function br(t,e,s,r){let i=Vp(t,e,s,r);if(st(i)||et(i))return Kp(t,r,i),br(t,i,s,r);if(typeof i!="symbol"){if(pt(e)){r=Object.freeze(r.concat(e));for(let o=0;o<e.items.length;++o){let n=br(o,e.items[o],s,r);if(typeof n=="number")o=n-1;else{if(n===fn)return fn;n===rs&&(e.items.splice(o,1),o-=1)}}}else if(et(e)){r=Object.freeze(r.concat(e));let o=br("key",e.key,s,r);if(o===fn)return fn;o===rs&&(e.key=null);let n=br("value",e.value,s,r);if(n===fn)return fn;n===rs&&(e.value=null)}}return i}async function Oo(t,e){let s=qp(e);ss(t)?await wr(null,t.contents,s,Object.freeze([t]))===rs&&(t.contents=null):await wr(null,t,s,Object.freeze([]))}Oo.BREAK=fn;Oo.SKIP=Bp;Oo.REMOVE=rs;async function wr(t,e,s,r){let i=await Vp(t,e,s,r);if(st(i)||et(i))return Kp(t,r,i),wr(t,i,s,r);if(typeof i!="symbol"){if(pt(e)){r=Object.freeze(r.concat(e));for(let o=0;o<e.items.length;++o){let n=await wr(o,e.items[o],s,r);if(typeof n=="number")o=n-1;else{if(n===fn)return fn;n===rs&&(e.items.splice(o,1),o-=1)}}}else if(et(e)){r=Object.freeze(r.concat(e));let o=await wr("key",e.key,s,r);if(o===fn)return fn;o===rs&&(e.key=null);let n=await wr("value",e.value,s,r);if(n===fn)return fn;n===rs&&(e.value=null)}}return i}function qp(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function Vp(t,e,s,r){if(typeof s=="function")return s(t,e,r);if(pn(e))return s.Map?.(t,e,r);if(dn(e))return s.Seq?.(t,e,r);if(et(e))return s.Pair?.(t,e,r);if(Ue(e))return s.Scalar?.(t,e,r);if(qn(e))return s.Alias?.(t,e,r)}function Kp(t,e,s){let r=e[e.length-1];if(pt(r))r.items[t]=s;else if(et(r))t==="key"?r.key=s:r.value=s;else if(ss(r))r.contents=s;else{let i=qn(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}var Wm={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Jm=t=>t.replace(/[!,[\]{}]/g,e=>Wm[e]),os=class t{constructor(e,s){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,s)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,s){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let r=e.trim().split(/[ \t]+/),i=r.shift();switch(i){case"%TAG":{if(r.length!==2&&(s(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[o,n]=r;return this.tags[o]=n,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return s(0,"%YAML directive should contain exactly one part"),!1;let[o]=r;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let n=/^\d+\.\d+$/.test(o);return s(6,`Unsupported YAML version ${o}`,n),!1}}default:return s(0,`Unknown directive ${i}`,!0),!1}}tagName(e,s){if(e==="!")return"!";if(e[0]!=="!")return s(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let n=e.slice(2,-1);return n==="!"||n==="!!"?(s(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&s("Verbatim tags must end with a >"),n)}let[,r,i]=e.match(/^(.*!)([^!]*)$/s);i||s(`The ${e} tag has no suffix`);let o=this.tags[r];if(o)try{return o+decodeURIComponent(i)}catch(n){return s(String(n)),null}return r==="!"?e:(s(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[s,r]of Object.entries(this.tags))if(e.startsWith(r))return s+Jm(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let s=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),i;if(e&&r.length>0&&st(e.contents)){let o={};is(e.contents,(n,a)=>{st(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,n]of r)o==="!!"&&n==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(n)))&&s.push(`%TAG ${o} ${n}`);return s.join(`
2
+ `)}};os.defaultYaml={explicit:!1,version:"1.2"};os.defaultTags={"!!":"tag:yaml.org,2002:"};function Ao(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let s=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(s)}return!0}function Nl(t){let e=new Set;return is(t,{Value(s,r){r.anchor&&e.add(r.anchor)}}),e}function Rl(t,e){for(let s=1;;++s){let r=`${t}${s}`;if(!e.has(r))return r}}function Gp(t,e){let s=[],r=new Map,i=null;return{onAnchor:o=>{s.push(o),i??(i=Nl(t));let n=Rl(e,i);return i.add(n),n},setAnchors:()=>{for(let o of s){let n=r.get(o);if(typeof n=="object"&&n.anchor&&(Ue(n.node)||pt(n.node)))n.node.anchor=n.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:r}}function Ns(t,e,s,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let i=0,o=r.length;i<o;++i){let n=r[i],a=Ns(t,r,String(i),n);a===void 0?delete r[i]:a!==n&&(r[i]=a)}else if(r instanceof Map)for(let i of Array.from(r.keys())){let o=r.get(i),n=Ns(t,r,i,o);n===void 0?r.delete(i):n!==o&&r.set(i,n)}else if(r instanceof Set)for(let i of Array.from(r)){let o=Ns(t,r,i,i);o===void 0?r.delete(i):o!==i&&(r.delete(i),r.add(o))}else for(let[i,o]of Object.entries(r)){let n=Ns(t,r,i,o);n===void 0?delete r[i]:n!==o&&(r[i]=n)}return t.call(e,s,r)}function qt(t,e,s){if(Array.isArray(t))return t.map((r,i)=>qt(r,String(i),s));if(t&&typeof t.toJSON=="function"){if(!s||!Po(t))return t.toJSON(e,s);let r={aliasCount:0,count:1,res:void 0};s.anchors.set(t,r),s.onCreate=o=>{r.res=o,delete s.onCreate};let i=t.toJSON(e,s);return s.onCreate&&s.onCreate(i),i}return typeof t=="bigint"&&!s?.keep?Number(t):t}var Rs=class{constructor(e){Object.defineProperty(this,on,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:s,maxAliasCount:r,onAnchor:i,reviver:o}={}){if(!ss(e))throw new TypeError("A document argument is required");let n={anchors:new Map,doc:e,keep:!0,mapAsMap:s===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},a=qt(this,"",n);if(typeof i=="function")for(let{count:f,res:p}of n.anchors.values())i(p,f);return typeof o=="function"?Ns(o,{"":a},"",a):a}};var bs=class extends Rs{constructor(e){super(vo),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,s){if(s?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let r;s?.aliasResolveCache?r=s.aliasResolveCache:(r=[],is(e,{Node:(o,n)=>{(qn(n)||Po(n))&&r.push(n)}}),s&&(s.aliasResolveCache=r));let i;for(let o of r){if(o===this)break;o.anchor===this.source&&(i=o)}if(i&&s){let{anchors:o,doc:n,maxAliasCount:a}=s,f=o.get(i);if(f||(qt(i,null,s),f=o.get(i)),f?.res===void 0){let p="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(p)}if(a>=0&&(f.count+=1,f.aliasCount===0&&(f.aliasCount=To(n,i,o)),f.count*f.aliasCount>a)){let p="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(p)}}return i}toJSON(e,s){if(!s)return{source:this.source};let r=this.resolve(s.doc,s);if(!r){let i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(i)}return s.anchors.get(r).res}toString(e,s,r){let i=`*${this.source}`;if(e){if(Ao(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(e.implicitKey)return`${i} `}return i}};function To(t,e,s){if(qn(e)){let r=e.resolve(t),i=s&&r&&s.get(r);return i?i.count*i.aliasCount:0}else if(pt(e)){let r=0;for(let i of e.items){let o=To(t,i,s);o>r&&(r=o)}return r}else if(et(e)){let r=To(t,e.key,s),i=To(t,e.value,s);return Math.max(r,i)}return 1}var Eo=t=>!t||typeof t!="function"&&typeof t!="object",Ie=class extends Rs{constructor(e){super(bn),this.value=e}toJSON(e,s){return s?.keep?this.value:qt(this.value,e,s)}toString(){return String(this.value)}};Ie.BLOCK_FOLDED="BLOCK_FOLDED";Ie.BLOCK_LITERAL="BLOCK_LITERAL";Ie.PLAIN="PLAIN";Ie.QUOTE_DOUBLE="QUOTE_DOUBLE";Ie.QUOTE_SINGLE="QUOTE_SINGLE";var Xm="tag:yaml.org,2002:";function Qm(t,e,s){if(e){let r=s.filter(o=>o.tag===e),i=r.find(o=>!o.format)??r[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return s.find(r=>r.identify?.(t)&&!r.format)}function ws(t,e,s){if(ss(t)&&(t=t.contents),st(t))return t;if(et(t)){let l=s.schema[Bn].createNode?.(s.schema,null,s);return l.items.push(t),l}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:o,schema:n,sourceObjects:a}=s,f;if(r&&t&&typeof t=="object"){if(f=a.get(t),f)return f.anchor??(f.anchor=i(t)),new bs(f.anchor);f={anchor:null,node:null},a.set(t,f)}e?.startsWith("!!")&&(e=Xm+e.slice(2));let p=Qm(t,e,n.tags);if(!p){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let l=new Ie(t);return f&&(f.node=l),l}p=t instanceof Map?n[Bn]:Symbol.iterator in Object(t)?n[gs]:n[Bn]}o&&(o(p),delete s.onTagObj);let c=p?.createNode?p.createNode(s.schema,t,s):typeof p?.nodeClass?.from=="function"?p.nodeClass.from(s.schema,t,s):new Ie(t);return e?c.tag=e:p.default||(c.tag=p.tag),f&&(f.node=c),c}function ui(t,e,s){let r=s;for(let i=e.length-1;i>=0;--i){let o=e[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let n=[];n[o]=r,r=n}else r=new Map([[o,r]])}return ws(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var kr=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,xr=class extends Rs{constructor(e,s){super(e),Object.defineProperty(this,"schema",{value:s,configurable:!0,enumerable:!1,writable:!0})}clone(e){let s=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(s.schema=e),s.items=s.items.map(r=>st(r)||et(r)?r.clone(e):r),this.range&&(s.range=this.range.slice()),s}addIn(e,s){if(kr(e))this.add(s);else{let[r,...i]=e,o=this.get(r,!0);if(pt(o))o.addIn(i,s);else if(o===void 0&&this.schema)this.set(r,ui(this.schema,i,s));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(e){let[s,...r]=e;if(r.length===0)return this.delete(s);let i=this.get(s,!0);if(pt(i))return i.deleteIn(r);throw new Error(`Expected YAML collection at ${s}. Remaining path: ${r}`)}getIn(e,s){let[r,...i]=e,o=this.get(r,!0);return i.length===0?!s&&Ue(o)?o.value:o:pt(o)?o.getIn(i,s):void 0}hasAllNullValues(e){return this.items.every(s=>{if(!et(s))return!1;let r=s.value;return r==null||e&&Ue(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[s,...r]=e;if(r.length===0)return this.has(s);let i=this.get(s,!0);return pt(i)?i.hasIn(r):!1}setIn(e,s){let[r,...i]=e;if(i.length===0)this.set(r,s);else{let o=this.get(r,!0);if(pt(o))o.setIn(i,s);else if(o===void 0&&this.schema)this.set(r,ui(this.schema,i,s));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}};var Zp=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function An(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var as=(t,e,s)=>t.endsWith(`
3
+ `)?An(s,e):s.includes(`
4
4
  `)?`
5
- `+On(s,e):(t.endsWith(" ")?"":" ")+s;var El="flow",Ao="block",hi="quoted";function yi(t,e,s="flow",{indentAtStart:r,lineWidth:i=80,minContentWidth:o=20,onFold:n,onOverflow:a}={}){if(!i||i<0)return t;i<o&&(o=0);let f=Math.max(1+o,1+i-e.length);if(t.length<=f)return t;let p=[],c={},l=i-e.length;typeof r=="number"&&(r>i-Math.max(2,o)?p.push(0):l=i-r);let d,m,h=!1,y=-1,g=-1,k=-1;s===Ao&&(y=Kp(t,y,e.length),y!==-1&&(l=y+f));for(let b;b=t[y+=1];){if(s===hi&&b==="\\"){switch(g=y,t[y+1]){case"x":y+=3;break;case"u":y+=5;break;case"U":y+=9;break;default:y+=1}k=y}if(b===`
6
- `)s===Ao&&(y=Kp(t,y,e.length)),l=y+e.length+f,d=void 0;else{if(b===" "&&m&&m!==" "&&m!==`
5
+ `+An(s,e):(t.endsWith(" ")?"":" ")+s;var Il="flow",No="block",hi="quoted";function yi(t,e,s="flow",{indentAtStart:r,lineWidth:i=80,minContentWidth:o=20,onFold:n,onOverflow:a}={}){if(!i||i<0)return t;i<o&&(o=0);let f=Math.max(1+o,1+i-e.length);if(t.length<=f)return t;let p=[],c={},l=i-e.length;typeof r=="number"&&(r>i-Math.max(2,o)?p.push(0):l=i-r);let d,m,h=!1,y=-1,g=-1,k=-1;s===No&&(y=Up(t,y,e.length),y!==-1&&(l=y+f));for(let b;b=t[y+=1];){if(s===hi&&b==="\\"){switch(g=y,t[y+1]){case"x":y+=3;break;case"u":y+=5;break;case"U":y+=9;break;default:y+=1}k=y}if(b===`
6
+ `)s===No&&(y=Up(t,y,e.length)),l=y+e.length+f,d=void 0;else{if(b===" "&&m&&m!==" "&&m!==`
7
7
  `&&m!==" "){let x=t[y+1];x&&x!==" "&&x!==`
8
8
  `&&x!==" "&&(d=y)}if(y>=l)if(d)p.push(d),l=d+f,d=void 0;else if(s===hi){for(;m===" "||m===" ";)m=b,b=t[y+=1],h=!0;let x=y>k+1?y-2:g-1;if(c[x])return t;p.push(x),c[x]=!0,l=x+f,d=void 0}else h=!0}m=b}if(h&&a&&a(),p.length===0)return t;n&&n();let u=t.slice(0,p[0]);for(let b=0;b<p.length;++b){let x=p[b],w=p[b+1]||t.length;x===0?u=`
9
9
  ${e}${t.slice(0,w)}`:(s===hi&&c[x]&&(u+=`${t[x]}\\`),u+=`
10
- ${e}${t.slice(x+1,w)}`)}return u}function Kp(t,e,s){let r=e,i=e+1,o=t[i];for(;o===" "||o===" ";)if(e<i+s)o=t[++e];else{do o=t[++e];while(o&&o!==`
11
- `);r=e,i=e+1,o=t[i]}return r}var Eo=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),No=t=>/^(%|---|\.\.\.)/m.test(t);function Xm(t,e,s){if(!e||e<0)return!1;let r=e-s,i=t.length;if(i<=r)return!1;for(let o=0,n=0;o<i;++o)if(t[o]===`
12
- `){if(o-n>r)return!0;if(n=o+1,i-n<=r)return!1}return!0}function gi(t,e){let s=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return s;let{implicitKey:r}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(No(t)?" ":""),n="",a=0;for(let f=0,p=s[f];p;p=s[++f])if(p===" "&&s[f+1]==="\\"&&s[f+2]==="n"&&(n+=s.slice(a,f)+"\\ ",f+=1,a=f,p="\\"),p==="\\")switch(s[f+1]){case"u":{n+=s.slice(a,f);let c=s.substr(f+2,4);switch(c){case"0000":n+="\\0";break;case"0007":n+="\\a";break;case"000b":n+="\\v";break;case"001b":n+="\\e";break;case"0085":n+="\\N";break;case"00a0":n+="\\_";break;case"2028":n+="\\L";break;case"2029":n+="\\P";break;default:c.substr(0,2)==="00"?n+="\\x"+c.substr(2):n+=s.substr(f,6)}f+=5,a=f+1}break;case"n":if(r||s[f+2]==='"'||s.length<i)f+=1;else{for(n+=s.slice(a,f)+`
10
+ ${e}${t.slice(x+1,w)}`)}return u}function Up(t,e,s){let r=e,i=e+1,o=t[i];for(;o===" "||o===" ";)if(e<i+s)o=t[++e];else{do o=t[++e];while(o&&o!==`
11
+ `);r=e,i=e+1,o=t[i]}return r}var Io=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),zo=t=>/^(%|---|\.\.\.)/m.test(t);function eu(t,e,s){if(!e||e<0)return!1;let r=e-s,i=t.length;if(i<=r)return!1;for(let o=0,n=0;o<i;++o)if(t[o]===`
12
+ `){if(o-n>r)return!0;if(n=o+1,i-n<=r)return!1}return!0}function gi(t,e){let s=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return s;let{implicitKey:r}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(zo(t)?" ":""),n="",a=0;for(let f=0,p=s[f];p;p=s[++f])if(p===" "&&s[f+1]==="\\"&&s[f+2]==="n"&&(n+=s.slice(a,f)+"\\ ",f+=1,a=f,p="\\"),p==="\\")switch(s[f+1]){case"u":{n+=s.slice(a,f);let c=s.substr(f+2,4);switch(c){case"0000":n+="\\0";break;case"0007":n+="\\a";break;case"000b":n+="\\v";break;case"001b":n+="\\e";break;case"0085":n+="\\N";break;case"00a0":n+="\\_";break;case"2028":n+="\\L";break;case"2029":n+="\\P";break;default:c.substr(0,2)==="00"?n+="\\x"+c.substr(2):n+=s.substr(f,6)}f+=5,a=f+1}break;case"n":if(r||s[f+2]==='"'||s.length<i)f+=1;else{for(n+=s.slice(a,f)+`
13
13
 
14
14
  `;s[f+2]==="\\"&&s[f+3]==="n"&&s[f+4]!=='"';)n+=`
15
- `,f+=2;n+=o,s[f+2]===" "&&(n+="\\"),f+=1,a=f+1}break;default:f+=1}return n=a?n+s.slice(a):s,r?n:yi(n,o,hi,Eo(e,!1))}function Nl(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
16
- `)||/[ \t]\n|\n[ \t]/.test(t))return gi(t,e);let s=e.indent||(No(t)?" ":""),r="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
17
- ${s}`)+"'";return e.implicitKey?r:yi(r,s,El,Eo(e,!1))}function $r(t,e){let{singleQuote:s}=e.options,r;if(s===!1)r=gi;else{let i=t.includes('"'),o=t.includes("'");i&&!o?r=Nl:o&&!i?r=gi:r=s?Nl:gi}return r(t,e)}var Rl;try{Rl=new RegExp(`(^|(?<!
15
+ `,f+=2;n+=o,s[f+2]===" "&&(n+="\\"),f+=1,a=f+1}break;default:f+=1}return n=a?n+s.slice(a):s,r?n:yi(n,o,hi,Io(e,!1))}function zl(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
16
+ `)||/[ \t]\n|\n[ \t]/.test(t))return gi(t,e);let s=e.indent||(zo(t)?" ":""),r="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
17
+ ${s}`)+"'";return e.implicitKey?r:yi(r,s,Il,Io(e,!1))}function $r(t,e){let{singleQuote:s}=e.options,r;if(s===!1)r=gi;else{let i=t.includes('"'),o=t.includes("'");i&&!o?r=zl:o&&!i?r=gi:r=s?zl:gi}return r(t,e)}var Cl;try{Cl=new RegExp(`(^|(?<!
18
18
  ))
19
19
  +(?!
20
- |$)`,"g")}catch{Rl=/\n+(?!\n|$)/g}function To({comment:t,type:e,value:s},r,i,o){let{blockQuote:n,commentString:a,lineWidth:f}=r.options;if(!n||/\n[\t ]+$/.test(s))return $r(s,r);let p=r.indent||(r.forceBlockIndent||No(s)?" ":""),c=n==="literal"?!0:n==="folded"||e===Re.BLOCK_FOLDED?!1:e===Re.BLOCK_LITERAL?!0:!Xm(s,f,p.length);if(!s)return c?`|
20
+ |$)`,"g")}catch{Cl=/\n+(?!\n|$)/g}function Ro({comment:t,type:e,value:s},r,i,o){let{blockQuote:n,commentString:a,lineWidth:f}=r.options;if(!n||/\n[\t ]+$/.test(s))return $r(s,r);let p=r.indent||(r.forceBlockIndent||zo(s)?" ":""),c=n==="literal"?!0:n==="folded"||e===Ie.BLOCK_FOLDED?!1:e===Ie.BLOCK_LITERAL?!0:!eu(s,f,p.length);if(!s)return c?`|
21
21
  `:`>
22
22
  `;let l,d;for(d=s.length;d>0;--d){let w=s[d-1];if(w!==`
23
23
  `&&w!==" "&&w!==" ")break}let m=s.substring(d),h=m.indexOf(`
24
24
  `);h===-1?l="-":s===m||h!==m.length-1?(l="+",o&&o()):l="",m&&(s=s.slice(0,-m.length),m[m.length-1]===`
25
- `&&(m=m.slice(0,-1)),m=m.replace(Rl,`$&${p}`));let y=!1,g,k=-1;for(g=0;g<s.length;++g){let w=s[g];if(w===" ")y=!0;else if(w===`
25
+ `&&(m=m.slice(0,-1)),m=m.replace(Cl,`$&${p}`));let y=!1,g,k=-1;for(g=0;g<s.length;++g){let w=s[g];if(w===" ")y=!0;else if(w===`
26
26
  `)k=g;else break}let u=s.substring(0,k<g?k+1:g);u&&(s=s.substring(u.length),u=u.replace(/\n+/g,`$&${p}`));let x=(y?p?"2":"1":"")+l;if(t&&(x+=" "+a(t.replace(/ ?[\r\n]+/g," ")),i&&i()),!c){let w=s.replace(/\n+/g,`
27
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${p}`),$=!1,v=Eo(r,!0);n!=="folded"&&e!==Re.BLOCK_FOLDED&&(v.onOverflow=()=>{$=!0});let O=yi(`${u}${w}${m}`,p,Ao,v);if(!$)return`>${x}
27
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${p}`),$=!1,S=Io(r,!0);n!=="folded"&&e!==Ie.BLOCK_FOLDED&&(S.onOverflow=()=>{$=!0});let O=yi(`${u}${w}${m}`,p,No,S);if(!$)return`>${x}
28
28
  ${p}${O}`}return s=s.replace(/\n+/g,`$&${p}`),`|${x}
29
- ${p}${u}${s}${m}`}function Qm(t,e,s,r){let{type:i,value:o}=t,{actualString:n,implicitKey:a,indent:f,indentStep:p,inFlow:c}=e;if(a&&o.includes(`
29
+ ${p}${u}${s}${m}`}function tu(t,e,s,r){let{type:i,value:o}=t,{actualString:n,implicitKey:a,indent:f,indentStep:p,inFlow:c}=e;if(a&&o.includes(`
30
30
  `)||c&&/[[\]{},]/.test(o))return $r(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||c||!o.includes(`
31
- `)?$r(o,e):To(t,e,s,r);if(!a&&!c&&i!==Re.PLAIN&&o.includes(`
32
- `))return To(t,e,s,r);if(No(o)){if(f==="")return e.forceBlockIndent=!0,To(t,e,s,r);if(a&&f===p)return $r(o,e)}let l=o.replace(/\n+/g,`$&
33
- ${f}`);if(n){let d=y=>y.default&&y.tag!=="tag:yaml.org,2002:str"&&y.test?.test(l),{compat:m,tags:h}=e.doc.schema;if(h.some(d)||m?.some(d))return $r(o,e)}return a?l:yi(l,f,El,Eo(e,!1))}function Ws(t,e,s,r){let{implicitKey:i,inFlow:o}=e,n=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==Re.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(n.value)&&(a=Re.QUOTE_DOUBLE);let f=c=>{switch(c){case Re.BLOCK_FOLDED:case Re.BLOCK_LITERAL:return i||o?$r(n.value,e):To(n,e,s,r);case Re.QUOTE_DOUBLE:return gi(n.value,e);case Re.QUOTE_SINGLE:return Nl(n.value,e);case Re.PLAIN:return Qm(n,e,s,r);default:return null}},p=f(a);if(p===null){let{defaultKeyType:c,defaultStringType:l}=e.options,d=i&&c||l;if(p=f(d),p===null)throw new Error(`Unsupported default string type ${d}`)}return p}function Ro(t,e){let s=Object.assign({blockQuote:!0,commentString:Vp,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),r;switch(s.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:t,flowCollectionPadding:s.flowCollectionPadding?" ":"",indent:"",indentStep:typeof s.indent=="number"?" ".repeat(s.indent):" ",inFlow:r,options:s}}function eu(t,e){if(e.tag){let i=t.filter(o=>o.tag===e.tag);if(i.length>0)return i.find(o=>o.format===e.format)??i[0]}let s,r;if(Ge(e)){r=e.value;let i=t.filter(o=>o.identify?.(r));if(i.length>1){let o=i.filter(n=>n.test);o.length>0&&(i=o)}s=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else r=e,s=t.find(i=>i.nodeClass&&r instanceof i.nodeClass);if(!s){let i=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${i} value`)}return s}function tu(t,e,{anchors:s,doc:r}){if(!r.directives)return"";let i=[],o=(Ge(t)||ct(t))&&t.anchor;o&&Mo(o)&&(s.add(o),i.push(`&${o}`));let n=t.tag??(e.default?null:e.tag);return n&&i.push(r.directives.tagString(n)),i.join(" ")}function xs(t,e,s,r){if(Xe(t))return t.toString(e,s,r);if(Bn(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i,o=nt(t)?t:e.doc.createNode(t,{onTagObj:f=>i=f});i??(i=eu(e.doc.schema.tags,o));let n=tu(o,i,e);n.length>0&&(e.indentAtStart=(e.indentAtStart??0)+n.length+1);let a=typeof i.stringify=="function"?i.stringify(o,e,s,r):Ge(o)?Ws(o,e,s,r):o.toString(e,s,r);return n?Ge(o)||a[0]==="{"||a[0]==="["?`${n} ${a}`:`${n}
34
- ${e.indent}${a}`:a}function Gp({key:t,value:e},s,r,i){let{allNullValues:o,doc:n,indent:a,indentStep:f,options:{commentString:p,indentSeq:c,simpleKeys:l}}=s,d=nt(t)&&t.comment||null;if(l){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(ct(t)||!nt(t)&&typeof t=="object"){let v="With simple keys, collection cannot be used as a key value";throw new Error(v)}}let m=!l&&(!t||d&&e==null&&!s.inFlow||ct(t)||(Ge(t)?t.type===Re.BLOCK_FOLDED||t.type===Re.BLOCK_LITERAL:typeof t=="object"));s=Object.assign({},s,{allNullValues:!1,implicitKey:!m&&(l||!o),indent:a+f});let h=!1,y=!1,g=xs(t,s,()=>h=!0,()=>y=!0);if(!m&&!s.inFlow&&g.length>1024){if(l)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");m=!0}if(s.inFlow){if(o||e==null)return h&&r&&r(),g===""?"?":m?`? ${g}`:g}else if(o&&!l||e==null&&m)return g=`? ${g}`,d&&!h?g+=as(g,s.indent,p(d)):y&&i&&i(),g;h&&(d=null),m?(d&&(g+=as(g,s.indent,p(d))),g=`? ${g}
35
- ${a}:`):(g=`${g}:`,d&&(g+=as(g,s.indent,p(d))));let k,u,b;nt(e)?(k=!!e.spaceBefore,u=e.commentBefore,b=e.comment):(k=!1,u=null,b=null,e&&typeof e=="object"&&(e=n.createNode(e))),s.implicitKey=!1,!m&&!d&&Ge(e)&&(s.indentAtStart=g.length+1),y=!1,!c&&f.length>=2&&!s.inFlow&&!m&&dn(e)&&!e.flow&&!e.tag&&!e.anchor&&(s.indent=s.indent.substring(2));let x=!1,w=xs(e,s,()=>x=!0,()=>y=!0),$=" ";if(d||k||u){if($=k?`
36
- `:"",u){let v=p(u);$+=`
37
- ${On(v,s.indent)}`}w===""&&!s.inFlow?$===`
31
+ `)?$r(o,e):Ro(t,e,s,r);if(!a&&!c&&i!==Ie.PLAIN&&o.includes(`
32
+ `))return Ro(t,e,s,r);if(zo(o)){if(f==="")return e.forceBlockIndent=!0,Ro(t,e,s,r);if(a&&f===p)return $r(o,e)}let l=o.replace(/\n+/g,`$&
33
+ ${f}`);if(n){let d=y=>y.default&&y.tag!=="tag:yaml.org,2002:str"&&y.test?.test(l),{compat:m,tags:h}=e.doc.schema;if(h.some(d)||m?.some(d))return $r(o,e)}return a?l:yi(l,f,Il,Io(e,!1))}function Ws(t,e,s,r){let{implicitKey:i,inFlow:o}=e,n=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==Ie.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(n.value)&&(a=Ie.QUOTE_DOUBLE);let f=c=>{switch(c){case Ie.BLOCK_FOLDED:case Ie.BLOCK_LITERAL:return i||o?$r(n.value,e):Ro(n,e,s,r);case Ie.QUOTE_DOUBLE:return gi(n.value,e);case Ie.QUOTE_SINGLE:return zl(n.value,e);case Ie.PLAIN:return tu(n,e,s,r);default:return null}},p=f(a);if(p===null){let{defaultKeyType:c,defaultStringType:l}=e.options,d=i&&c||l;if(p=f(d),p===null)throw new Error(`Unsupported default string type ${d}`)}return p}function Co(t,e){let s=Object.assign({blockQuote:!0,commentString:Zp,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),r;switch(s.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:t,flowCollectionPadding:s.flowCollectionPadding?" ":"",indent:"",indentStep:typeof s.indent=="number"?" ".repeat(s.indent):" ",inFlow:r,options:s}}function nu(t,e){if(e.tag){let i=t.filter(o=>o.tag===e.tag);if(i.length>0)return i.find(o=>o.format===e.format)??i[0]}let s,r;if(Ue(e)){r=e.value;let i=t.filter(o=>o.identify?.(r));if(i.length>1){let o=i.filter(n=>n.test);o.length>0&&(i=o)}s=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else r=e,s=t.find(i=>i.nodeClass&&r instanceof i.nodeClass);if(!s){let i=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${i} value`)}return s}function su(t,e,{anchors:s,doc:r}){if(!r.directives)return"";let i=[],o=(Ue(t)||pt(t))&&t.anchor;o&&Ao(o)&&(s.add(o),i.push(`&${o}`));let n=t.tag??(e.default?null:e.tag);return n&&i.push(r.directives.tagString(n)),i.join(" ")}function xs(t,e,s,r){if(et(t))return t.toString(e,s,r);if(qn(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i,o=st(t)?t:e.doc.createNode(t,{onTagObj:f=>i=f});i??(i=nu(e.doc.schema.tags,o));let n=su(o,i,e);n.length>0&&(e.indentAtStart=(e.indentAtStart??0)+n.length+1);let a=typeof i.stringify=="function"?i.stringify(o,e,s,r):Ue(o)?Ws(o,e,s,r):o.toString(e,s,r);return n?Ue(o)||a[0]==="{"||a[0]==="["?`${n} ${a}`:`${n}
34
+ ${e.indent}${a}`:a}function Hp({key:t,value:e},s,r,i){let{allNullValues:o,doc:n,indent:a,indentStep:f,options:{commentString:p,indentSeq:c,simpleKeys:l}}=s,d=st(t)&&t.comment||null;if(l){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(pt(t)||!st(t)&&typeof t=="object"){let S="With simple keys, collection cannot be used as a key value";throw new Error(S)}}let m=!l&&(!t||d&&e==null&&!s.inFlow||pt(t)||(Ue(t)?t.type===Ie.BLOCK_FOLDED||t.type===Ie.BLOCK_LITERAL:typeof t=="object"));s=Object.assign({},s,{allNullValues:!1,implicitKey:!m&&(l||!o),indent:a+f});let h=!1,y=!1,g=xs(t,s,()=>h=!0,()=>y=!0);if(!m&&!s.inFlow&&g.length>1024){if(l)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");m=!0}if(s.inFlow){if(o||e==null)return h&&r&&r(),g===""?"?":m?`? ${g}`:g}else if(o&&!l||e==null&&m)return g=`? ${g}`,d&&!h?g+=as(g,s.indent,p(d)):y&&i&&i(),g;h&&(d=null),m?(d&&(g+=as(g,s.indent,p(d))),g=`? ${g}
35
+ ${a}:`):(g=`${g}:`,d&&(g+=as(g,s.indent,p(d))));let k,u,b;st(e)?(k=!!e.spaceBefore,u=e.commentBefore,b=e.comment):(k=!1,u=null,b=null,e&&typeof e=="object"&&(e=n.createNode(e))),s.implicitKey=!1,!m&&!d&&Ue(e)&&(s.indentAtStart=g.length+1),y=!1,!c&&f.length>=2&&!s.inFlow&&!m&&dn(e)&&!e.flow&&!e.tag&&!e.anchor&&(s.indent=s.indent.substring(2));let x=!1,w=xs(e,s,()=>x=!0,()=>y=!0),$=" ";if(d||k||u){if($=k?`
36
+ `:"",u){let S=p(u);$+=`
37
+ ${An(S,s.indent)}`}w===""&&!s.inFlow?$===`
38
38
  `&&b&&($=`
39
39
 
40
40
  `):$+=`
41
- ${s.indent}`}else if(!m&&ct(e)){let v=w[0],O=w.indexOf(`
42
- `),C=O!==-1,A=s.inFlow??e.flow??e.items.length===0;if(C||!A){let R=!1;if(C&&(v==="&"||v==="!")){let M=w.indexOf(" ");v==="&"&&M!==-1&&M<O&&w[M+1]==="!"&&(M=w.indexOf(" ",M+1)),(M===-1||O<M)&&(R=!0)}R||($=`
41
+ ${s.indent}`}else if(!m&&pt(e)){let S=w[0],O=w.indexOf(`
42
+ `),z=O!==-1,A=s.inFlow??e.flow??e.items.length===0;if(z||!A){let R=!1;if(z&&(S==="&"||S==="!")){let P=w.indexOf(" ");S==="&"&&P!==-1&&P<O&&w[P+1]==="!"&&(P=w.indexOf(" ",P+1)),(P===-1||O<P)&&(R=!0)}R||($=`
43
43
  ${s.indent}`)}}else(w===""||w[0]===`
44
- `)&&($="");return g+=$+w,s.inFlow?x&&r&&r():b&&!x?g+=as(g,s.indent,p(b)):y&&i&&i(),g}function Io(t,e){(t==="debug"||t==="warn")&&console.warn(e)}var zo="<<",qn={identify:t=>t===zo||typeof t=="symbol"&&t.description===zo,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Re(Symbol(zo)),{addToJSMap:zl}),stringify:()=>zo},Zp=(t,e)=>(qn.identify(e)||Ge(e)&&(!e.type||e.type===Re.PLAIN)&&qn.identify(e.value))&&t?.doc.schema.tags.some(s=>s.tag===qn.tag&&s.default);function zl(t,e,s){let r=Up(t,s);if(dn(r))for(let i of r.items)Il(t,e,i);else if(Array.isArray(r))for(let i of r)Il(t,e,i);else Il(t,e,r)}function Il(t,e,s){let r=Up(t,s);if(!pn(r))throw new Error("Merge sources must be maps or map aliases");let i=r.toJSON(null,t,Map);for(let[o,n]of i)e instanceof Map?e.has(o)||e.set(o,n):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:n,writable:!0,enumerable:!0,configurable:!0});return e}function Up(t,e){return t&&Bn(e)?e.resolve(t.doc,t):e}function Co(t,e,{key:s,value:r}){if(nt(s)&&s.addToJSMap)s.addToJSMap(t,e,r);else if(Zp(t,s))zl(t,e,r);else{let i=qt(s,"",t);if(e instanceof Map)e.set(i,qt(r,i,t));else if(e instanceof Set)e.add(i);else{let o=nu(s,i,t),n=qt(r,o,t);o in e?Object.defineProperty(e,o,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[o]=n}}return e}function nu(t,e,s){if(e===null)return"";if(typeof e!="object")return String(e);if(nt(t)&&s?.doc){let r=Ro(s.doc,{});r.anchors=new Set;for(let o of s.anchors.keys())r.anchors.add(o.anchor);r.inFlow=!0,r.inStringifyKey=!0;let i=t.toString(r);if(!s.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),Io(s.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),s.mapKeyWarned=!0}return i}return JSON.stringify(e)}function Sr(t,e,s){let r=ws(t,void 0,s),i=ws(e,void 0,s);return new Et(r,i)}var Et=class t{constructor(e,s=null){Object.defineProperty(this,on,{value:Ol}),this.key=e,this.value=s}clone(e){let{key:s,value:r}=this;return nt(s)&&(s=s.clone(e)),nt(r)&&(r=r.clone(e)),new t(s,r)}toJSON(e,s){let r=s?.mapAsMap?new Map:{};return Co(s,r,this)}toString(e,s,r){return e?.doc?Gp(this,e,s,r):JSON.stringify(this)}};function Lo(t,e,s){return(e.inFlow??t.flow?ru:su)(t,e,s)}function su({comment:t,items:e},s,{blockItemPrefix:r,flowChars:i,itemIndent:o,onChompKeep:n,onComment:a}){let{indent:f,options:{commentString:p}}=s,c=Object.assign({},s,{indent:o,type:null}),l=!1,d=[];for(let h=0;h<e.length;++h){let y=e[h],g=null;if(nt(y))!l&&y.spaceBefore&&d.push(""),jo(s,d,y.commentBefore,l),y.comment&&(g=y.comment);else if(Xe(y)){let u=nt(y.key)?y.key:null;u&&(!l&&u.spaceBefore&&d.push(""),jo(s,d,u.commentBefore,l))}l=!1;let k=xs(y,c,()=>g=null,()=>l=!0);g&&(k+=as(k,o,p(g))),l&&g&&(l=!1),d.push(r+k)}let m;if(d.length===0)m=i.start+i.end;else{m=d[0];for(let h=1;h<d.length;++h){let y=d[h];m+=y?`
44
+ `)&&($="");return g+=$+w,s.inFlow?x&&r&&r():b&&!x?g+=as(g,s.indent,p(b)):y&&i&&i(),g}function jo(t,e){(t==="debug"||t==="warn")&&console.warn(e)}var Lo="<<",Vn={identify:t=>t===Lo||typeof t=="symbol"&&t.description===Lo,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Ie(Symbol(Lo)),{addToJSMap:Ll}),stringify:()=>Lo},Yp=(t,e)=>(Vn.identify(e)||Ue(e)&&(!e.type||e.type===Ie.PLAIN)&&Vn.identify(e.value))&&t?.doc.schema.tags.some(s=>s.tag===Vn.tag&&s.default);function Ll(t,e,s){let r=Wp(t,s);if(dn(r))for(let i of r.items)jl(t,e,i);else if(Array.isArray(r))for(let i of r)jl(t,e,i);else jl(t,e,r)}function jl(t,e,s){let r=Wp(t,s);if(!pn(r))throw new Error("Merge sources must be maps or map aliases");let i=r.toJSON(null,t,Map);for(let[o,n]of i)e instanceof Map?e.has(o)||e.set(o,n):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:n,writable:!0,enumerable:!0,configurable:!0});return e}function Wp(t,e){return t&&qn(e)?e.resolve(t.doc,t):e}function _o(t,e,{key:s,value:r}){if(st(s)&&s.addToJSMap)s.addToJSMap(t,e,r);else if(Yp(t,s))Ll(t,e,r);else{let i=qt(s,"",t);if(e instanceof Map)e.set(i,qt(r,i,t));else if(e instanceof Set)e.add(i);else{let o=ru(s,i,t),n=qt(r,o,t);o in e?Object.defineProperty(e,o,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[o]=n}}return e}function ru(t,e,s){if(e===null)return"";if(typeof e!="object")return String(e);if(st(t)&&s?.doc){let r=Co(s.doc,{});r.anchors=new Set;for(let o of s.anchors.keys())r.anchors.add(o.anchor);r.inFlow=!0,r.inStringifyKey=!0;let i=t.toString(r);if(!s.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),jo(s.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),s.mapKeyWarned=!0}return i}return JSON.stringify(e)}function Sr(t,e,s){let r=ws(t,void 0,s),i=ws(e,void 0,s);return new Et(r,i)}var Et=class t{constructor(e,s=null){Object.defineProperty(this,on,{value:El}),this.key=e,this.value=s}clone(e){let{key:s,value:r}=this;return st(s)&&(s=s.clone(e)),st(r)&&(r=r.clone(e)),new t(s,r)}toJSON(e,s){let r=s?.mapAsMap?new Map:{};return _o(s,r,this)}toString(e,s,r){return e?.doc?Hp(this,e,s,r):JSON.stringify(this)}};function Do(t,e,s){return(e.inFlow??t.flow?ou:iu)(t,e,s)}function iu({comment:t,items:e},s,{blockItemPrefix:r,flowChars:i,itemIndent:o,onChompKeep:n,onComment:a}){let{indent:f,options:{commentString:p}}=s,c=Object.assign({},s,{indent:o,type:null}),l=!1,d=[];for(let h=0;h<e.length;++h){let y=e[h],g=null;if(st(y))!l&&y.spaceBefore&&d.push(""),Fo(s,d,y.commentBefore,l),y.comment&&(g=y.comment);else if(et(y)){let u=st(y.key)?y.key:null;u&&(!l&&u.spaceBefore&&d.push(""),Fo(s,d,u.commentBefore,l))}l=!1;let k=xs(y,c,()=>g=null,()=>l=!0);g&&(k+=as(k,o,p(g))),l&&g&&(l=!1),d.push(r+k)}let m;if(d.length===0)m=i.start+i.end;else{m=d[0];for(let h=1;h<d.length;++h){let y=d[h];m+=y?`
45
45
  ${f}${y}`:`
46
46
  `}}return t?(m+=`
47
- `+On(p(t),f),a&&a()):l&&n&&n(),m}function ru({items:t},e,{flowChars:s,itemIndent:r}){let{indent:i,indentStep:o,flowCollectionPadding:n,options:{commentString:a}}=e;r+=o;let f=Object.assign({},e,{indent:r,inFlow:!0,type:null}),p=!1,c=0,l=[];for(let h=0;h<t.length;++h){let y=t[h],g=null;if(nt(y))y.spaceBefore&&l.push(""),jo(e,l,y.commentBefore,!1),y.comment&&(g=y.comment);else if(Xe(y)){let u=nt(y.key)?y.key:null;u&&(u.spaceBefore&&l.push(""),jo(e,l,u.commentBefore,!1),u.comment&&(p=!0));let b=nt(y.value)?y.value:null;b?(b.comment&&(g=b.comment),b.commentBefore&&(p=!0)):y.value==null&&u?.comment&&(g=u.comment)}g&&(p=!0);let k=xs(y,f,()=>g=null);p||(p=l.length>c||k.includes(`
47
+ `+An(p(t),f),a&&a()):l&&n&&n(),m}function ou({items:t},e,{flowChars:s,itemIndent:r}){let{indent:i,indentStep:o,flowCollectionPadding:n,options:{commentString:a}}=e;r+=o;let f=Object.assign({},e,{indent:r,inFlow:!0,type:null}),p=!1,c=0,l=[];for(let h=0;h<t.length;++h){let y=t[h],g=null;if(st(y))y.spaceBefore&&l.push(""),Fo(e,l,y.commentBefore,!1),y.comment&&(g=y.comment);else if(et(y)){let u=st(y.key)?y.key:null;u&&(u.spaceBefore&&l.push(""),Fo(e,l,u.commentBefore,!1),u.comment&&(p=!0));let b=st(y.value)?y.value:null;b?(b.comment&&(g=b.comment),b.commentBefore&&(p=!0)):y.value==null&&u?.comment&&(g=u.comment)}g&&(p=!0);let k=xs(y,f,()=>g=null);p||(p=l.length>c||k.includes(`
48
48
  `)),h<t.length-1?k+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(p||(p=l.reduce((u,b)=>u+b.length+2,2)+(k.length+2)>e.options.lineWidth)),p&&(k+=",")),g&&(k+=as(k,r,a(g))),l.push(k),c=l.length}let{start:d,end:m}=s;if(l.length===0)return d+m;if(!p){let h=l.reduce((y,g)=>y+g.length+2,2);p=e.options.lineWidth>0&&h>e.options.lineWidth}if(p){let h=d;for(let y of l)h+=y?`
49
49
  ${o}${i}${y}`:`
50
50
  `;return`${h}
51
- ${i}${m}`}else return`${d}${n}${l.join(" ")}${n}${m}`}function jo({indent:t,options:{commentString:e}},s,r,i){if(r&&i&&(r=r.replace(/^\n+/,"")),r){let o=On(e(r),t);s.push(o.trimStart())}}function Is(t,e){let s=Ge(e)?e.value:e;for(let r of t)if(Xe(r)&&(r.key===e||r.key===s||Ge(r.key)&&r.key.value===s))return r}var jt=class extends xr{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Dn,e),this.items=[]}static from(e,s,r){let{keepUndefined:i,replacer:o}=r,n=new this(e),a=(f,p)=>{if(typeof o=="function")p=o.call(s,f,p);else if(Array.isArray(o)&&!o.includes(f))return;(p!==void 0||i)&&n.items.push(Sr(f,p,r))};if(s instanceof Map)for(let[f,p]of s)a(f,p);else if(s&&typeof s=="object")for(let f of Object.keys(s))a(f,s[f]);return typeof e.sortMapEntries=="function"&&n.items.sort(e.sortMapEntries),n}add(e,s){let r;Xe(e)?r=e:!e||typeof e!="object"||!("key"in e)?r=new Et(e,e?.value):r=new Et(e.key,e.value);let i=Is(this.items,r.key),o=this.schema?.sortMapEntries;if(i){if(!s)throw new Error(`Key ${r.key} already set`);Ge(i.value)&&Oo(r.value)?i.value.value=r.value:i.value=r.value}else if(o){let n=this.items.findIndex(a=>o(r,a)<0);n===-1?this.items.push(r):this.items.splice(n,0,r)}else this.items.push(r)}delete(e){let s=Is(this.items,e);return s?this.items.splice(this.items.indexOf(s),1).length>0:!1}get(e,s){let i=Is(this.items,e)?.value;return(!s&&Ge(i)?i.value:i)??void 0}has(e){return!!Is(this.items,e)}set(e,s){this.add(new Et(e,s),!0)}toJSON(e,s,r){let i=r?new r:s?.mapAsMap?new Map:{};s?.onCreate&&s.onCreate(i);for(let o of this.items)Co(s,i,o);return i}toString(e,s,r){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Xe(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Lo(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:s})}};var Vn={collection:"map",default:!0,nodeClass:jt,tag:"tag:yaml.org,2002:map",resolve(t,e){return pn(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,s)=>jt.from(t,e,s)};var Qt=class extends xr{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(gs,e),this.items=[]}add(e){this.items.push(e)}delete(e){let s=_o(e);return typeof s!="number"?!1:this.items.splice(s,1).length>0}get(e,s){let r=_o(e);if(typeof r!="number")return;let i=this.items[r];return!s&&Ge(i)?i.value:i}has(e){let s=_o(e);return typeof s=="number"&&s<this.items.length}set(e,s){let r=_o(e);if(typeof r!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[r];Ge(i)&&Oo(s)?i.value=s:this.items[r]=s}toJSON(e,s){let r=[];s?.onCreate&&s.onCreate(r);let i=0;for(let o of this.items)r.push(qt(o,String(i++),s));return r}toString(e,s,r){return e?Lo(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:r,onComment:s}):JSON.stringify(this)}static from(e,s,r){let{replacer:i}=r,o=new this(e);if(s&&Symbol.iterator in Object(s)){let n=0;for(let a of s){if(typeof i=="function"){let f=s instanceof Set?a:String(n++);a=i.call(s,f,a)}o.items.push(ws(a,void 0,r))}}return o}};function _o(t){let e=Ge(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}var Kn={collection:"seq",default:!0,nodeClass:Qt,tag:"tag:yaml.org,2002:seq",resolve(t,e){return dn(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,s)=>Qt.from(t,e,s)};var zs={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,s,r){return e=Object.assign({actualString:!0},e),Ws(t,e,s,r)}};var Js={identify:t=>t==null,createNode:()=>new Re(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Re(null),stringify:({source:t},e)=>typeof t=="string"&&Js.test.test(t)?t:e.options.nullStr};var bi={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Re(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},s){if(t&&bi.test.test(t)){let r=t[0]==="t"||t[0]==="T";if(e===r)return t}return e?s.options.trueStr:s.options.falseStr}};function en({format:t,minFractionDigits:e,tag:s,value:r}){if(typeof r=="bigint")return String(r);let i=typeof r=="number"?r:Number(r);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(r,-0)?"-0":JSON.stringify(r);if(!t&&e&&(!s||s==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let n=o.indexOf(".");n<0&&(n=o.length,o+=".");let a=e-(o.length-n-1);for(;a-- >0;)o+="0"}return o}var Fo={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:en},Do={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():en(t)}},Bo={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new Re(parseFloat(t)),s=t.indexOf(".");return s!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-s-1),e},stringify:en};var qo=t=>typeof t=="bigint"||Number.isInteger(t),Cl=(t,e,s,{intAsBigInt:r})=>r?BigInt(t):parseInt(t.substring(e),s);function Hp(t,e,s){let{value:r}=t;return qo(r)&&r>=0?s+r.toString(e):en(t)}var Vo={identify:t=>qo(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,s)=>Cl(t,2,8,s),stringify:t=>Hp(t,8,"0o")},Ko={identify:qo,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,s)=>Cl(t,0,10,s),stringify:en},Go={identify:t=>qo(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,s)=>Cl(t,2,16,s),stringify:t=>Hp(t,16,"0x")};var Yp=[Vn,Kn,zs,Js,bi,Vo,Ko,Go,Fo,Do,Bo];function Wp(t){return typeof t=="bigint"||Number.isInteger(t)}var Zo=({value:t})=>JSON.stringify(t),iu=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Zo},{identify:t=>t==null,createNode:()=>new Re(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Zo},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Zo},{identify:Wp,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:s})=>s?BigInt(t):parseInt(t,10),stringify:({value:t})=>Wp(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:Zo}],ou={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Jp=[Vn,Kn].concat(iu,ou);var wi={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof atob=="function"){let s=atob(t.replace(/[\n\r]/g,"")),r=new Uint8Array(s.length);for(let i=0;i<s.length;++i)r[i]=s.charCodeAt(i);return r}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:s},r,i,o){if(!s)return"";let n=s,a;if(typeof btoa=="function"){let f="";for(let p=0;p<n.length;++p)f+=String.fromCharCode(n[p]);a=btoa(f)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=Re.BLOCK_LITERAL),e!==Re.QUOTE_DOUBLE){let f=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),p=Math.ceil(a.length/f),c=new Array(p);for(let l=0,d=0;l<p;++l,d+=f)c[l]=a.substr(d,f);a=c.join(e===Re.BLOCK_LITERAL?`
52
- `:" ")}return Ws({comment:t,type:e,value:a},r,i,o)}};function jl(t,e){if(dn(t))for(let s=0;s<t.items.length;++s){let r=t.items[s];if(!Xe(r)){if(pn(r)){r.items.length>1&&e("Each pair must have its own sequence indicator");let i=r.items[0]||new Et(new Re(null));if(r.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${r.commentBefore}
51
+ ${i}${m}`}else return`${d}${n}${l.join(" ")}${n}${m}`}function Fo({indent:t,options:{commentString:e}},s,r,i){if(r&&i&&(r=r.replace(/^\n+/,"")),r){let o=An(e(r),t);s.push(o.trimStart())}}function Is(t,e){let s=Ue(e)?e.value:e;for(let r of t)if(et(r)&&(r.key===e||r.key===s||Ue(r.key)&&r.key.value===s))return r}var jt=class extends xr{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Bn,e),this.items=[]}static from(e,s,r){let{keepUndefined:i,replacer:o}=r,n=new this(e),a=(f,p)=>{if(typeof o=="function")p=o.call(s,f,p);else if(Array.isArray(o)&&!o.includes(f))return;(p!==void 0||i)&&n.items.push(Sr(f,p,r))};if(s instanceof Map)for(let[f,p]of s)a(f,p);else if(s&&typeof s=="object")for(let f of Object.keys(s))a(f,s[f]);return typeof e.sortMapEntries=="function"&&n.items.sort(e.sortMapEntries),n}add(e,s){let r;et(e)?r=e:!e||typeof e!="object"||!("key"in e)?r=new Et(e,e?.value):r=new Et(e.key,e.value);let i=Is(this.items,r.key),o=this.schema?.sortMapEntries;if(i){if(!s)throw new Error(`Key ${r.key} already set`);Ue(i.value)&&Eo(r.value)?i.value.value=r.value:i.value=r.value}else if(o){let n=this.items.findIndex(a=>o(r,a)<0);n===-1?this.items.push(r):this.items.splice(n,0,r)}else this.items.push(r)}delete(e){let s=Is(this.items,e);return s?this.items.splice(this.items.indexOf(s),1).length>0:!1}get(e,s){let i=Is(this.items,e)?.value;return(!s&&Ue(i)?i.value:i)??void 0}has(e){return!!Is(this.items,e)}set(e,s){this.add(new Et(e,s),!0)}toJSON(e,s,r){let i=r?new r:s?.mapAsMap?new Map:{};s?.onCreate&&s.onCreate(i);for(let o of this.items)_o(s,i,o);return i}toString(e,s,r){if(!e)return JSON.stringify(this);for(let i of this.items)if(!et(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Do(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:s})}};var Kn={collection:"map",default:!0,nodeClass:jt,tag:"tag:yaml.org,2002:map",resolve(t,e){return pn(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,s)=>jt.from(t,e,s)};var Qt=class extends xr{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(gs,e),this.items=[]}add(e){this.items.push(e)}delete(e){let s=Bo(e);return typeof s!="number"?!1:this.items.splice(s,1).length>0}get(e,s){let r=Bo(e);if(typeof r!="number")return;let i=this.items[r];return!s&&Ue(i)?i.value:i}has(e){let s=Bo(e);return typeof s=="number"&&s<this.items.length}set(e,s){let r=Bo(e);if(typeof r!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[r];Ue(i)&&Eo(s)?i.value=s:this.items[r]=s}toJSON(e,s){let r=[];s?.onCreate&&s.onCreate(r);let i=0;for(let o of this.items)r.push(qt(o,String(i++),s));return r}toString(e,s,r){return e?Do(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:r,onComment:s}):JSON.stringify(this)}static from(e,s,r){let{replacer:i}=r,o=new this(e);if(s&&Symbol.iterator in Object(s)){let n=0;for(let a of s){if(typeof i=="function"){let f=s instanceof Set?a:String(n++);a=i.call(s,f,a)}o.items.push(ws(a,void 0,r))}}return o}};function Bo(t){let e=Ue(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}var Gn={collection:"seq",default:!0,nodeClass:Qt,tag:"tag:yaml.org,2002:seq",resolve(t,e){return dn(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,s)=>Qt.from(t,e,s)};var zs={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,s,r){return e=Object.assign({actualString:!0},e),Ws(t,e,s,r)}};var Js={identify:t=>t==null,createNode:()=>new Ie(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Ie(null),stringify:({source:t},e)=>typeof t=="string"&&Js.test.test(t)?t:e.options.nullStr};var bi={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Ie(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},s){if(t&&bi.test.test(t)){let r=t[0]==="t"||t[0]==="T";if(e===r)return t}return e?s.options.trueStr:s.options.falseStr}};function en({format:t,minFractionDigits:e,tag:s,value:r}){if(typeof r=="bigint")return String(r);let i=typeof r=="number"?r:Number(r);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(r,-0)?"-0":JSON.stringify(r);if(!t&&e&&(!s||s==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let n=o.indexOf(".");n<0&&(n=o.length,o+=".");let a=e-(o.length-n-1);for(;a-- >0;)o+="0"}return o}var qo={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:en},Vo={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():en(t)}},Ko={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new Ie(parseFloat(t)),s=t.indexOf(".");return s!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-s-1),e},stringify:en};var Go=t=>typeof t=="bigint"||Number.isInteger(t),_l=(t,e,s,{intAsBigInt:r})=>r?BigInt(t):parseInt(t.substring(e),s);function Jp(t,e,s){let{value:r}=t;return Go(r)&&r>=0?s+r.toString(e):en(t)}var Zo={identify:t=>Go(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,s)=>_l(t,2,8,s),stringify:t=>Jp(t,8,"0o")},Uo={identify:Go,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,s)=>_l(t,0,10,s),stringify:en},Ho={identify:t=>Go(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,s)=>_l(t,2,16,s),stringify:t=>Jp(t,16,"0x")};var Xp=[Kn,Gn,zs,Js,bi,Zo,Uo,Ho,qo,Vo,Ko];function Qp(t){return typeof t=="bigint"||Number.isInteger(t)}var Yo=({value:t})=>JSON.stringify(t),au=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Yo},{identify:t=>t==null,createNode:()=>new Ie(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Yo},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Yo},{identify:Qp,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:s})=>s?BigInt(t):parseInt(t,10),stringify:({value:t})=>Qp(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:Yo}],lu={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},ed=[Kn,Gn].concat(au,lu);var wi={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof atob=="function"){let s=atob(t.replace(/[\n\r]/g,"")),r=new Uint8Array(s.length);for(let i=0;i<s.length;++i)r[i]=s.charCodeAt(i);return r}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:s},r,i,o){if(!s)return"";let n=s,a;if(typeof btoa=="function"){let f="";for(let p=0;p<n.length;++p)f+=String.fromCharCode(n[p]);a=btoa(f)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=Ie.BLOCK_LITERAL),e!==Ie.QUOTE_DOUBLE){let f=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),p=Math.ceil(a.length/f),c=new Array(p);for(let l=0,d=0;l<p;++l,d+=f)c[l]=a.substr(d,f);a=c.join(e===Ie.BLOCK_LITERAL?`
52
+ `:" ")}return Ws({comment:t,type:e,value:a},r,i,o)}};function Fl(t,e){if(dn(t))for(let s=0;s<t.items.length;++s){let r=t.items[s];if(!et(r)){if(pn(r)){r.items.length>1&&e("Each pair must have its own sequence indicator");let i=r.items[0]||new Et(new Ie(null));if(r.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${r.commentBefore}
53
53
  ${i.key.commentBefore}`:r.commentBefore),r.comment){let o=i.value??i.key;o.comment=o.comment?`${r.comment}
54
- ${o.comment}`:r.comment}r=i}t.items[s]=Xe(r)?r:new Et(r)}}else e("Expected a sequence for this tag");return t}function Ll(t,e,s){let{replacer:r}=s,i=new Qt(t);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let n of e){typeof r=="function"&&(n=r.call(e,String(o++),n));let a,f;if(Array.isArray(n))if(n.length===2)a=n[0],f=n[1];else throw new TypeError(`Expected [key, value] tuple: ${n}`);else if(n&&n instanceof Object){let p=Object.keys(n);if(p.length===1)a=p[0],f=n[a];else throw new TypeError(`Expected tuple with one key, not ${p.length} keys`)}else a=n;i.items.push(Sr(a,f,s))}return i}var xi={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:jl,createNode:Ll};var vr=class t extends Qt{constructor(){super(),this.add=jt.prototype.add.bind(this),this.delete=jt.prototype.delete.bind(this),this.get=jt.prototype.get.bind(this),this.has=jt.prototype.has.bind(this),this.set=jt.prototype.set.bind(this),this.tag=t.tag}toJSON(e,s){if(!s)return super.toJSON(e);let r=new Map;s?.onCreate&&s.onCreate(r);for(let i of this.items){let o,n;if(Xe(i)?(o=qt(i.key,"",s),n=qt(i.value,o,s)):o=qt(i,"",s),r.has(o))throw new Error("Ordered maps must not include duplicate keys");r.set(o,n)}return r}static from(e,s,r){let i=Ll(e,s,r),o=new this;return o.items=i.items,o}};vr.tag="tag:yaml.org,2002:omap";var ki={collection:"seq",identify:t=>t instanceof Map,nodeClass:vr,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let s=jl(t,e),r=[];for(let{key:i}of s.items)Ge(i)&&(r.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):r.push(i.value));return Object.assign(new vr,s)},createNode:(t,e,s)=>vr.from(t,e,s)};function Xp({value:t,source:e},s){return e&&(t?_l:Fl).test.test(e)?e:t?s.options.trueStr:s.options.falseStr}var _l={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Re(!0),stringify:Xp},Fl={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Re(!1),stringify:Xp};var Qp={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:en},ed={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():en(t)}},td={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new Re(parseFloat(t.replace(/_/g,""))),s=t.indexOf(".");if(s!==-1){let r=t.substring(s+1).replace(/_/g,"");r[r.length-1]==="0"&&(e.minFractionDigits=r.length)}return e},stringify:en};var $i=t=>typeof t=="bigint"||Number.isInteger(t);function Uo(t,e,s,{intAsBigInt:r}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),r){switch(s){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let n=BigInt(t);return i==="-"?BigInt(-1)*n:n}let o=parseInt(t,s);return i==="-"?-1*o:o}function Dl(t,e,s){let{value:r}=t;if($i(r)){let i=r.toString(e);return r<0?"-"+s+i.substr(1):s+i}return en(t)}var nd={identify:$i,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,s)=>Uo(t,2,2,s),stringify:t=>Dl(t,2,"0b")},sd={identify:$i,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,s)=>Uo(t,1,8,s),stringify:t=>Dl(t,8,"0")},rd={identify:$i,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,s)=>Uo(t,0,10,s),stringify:en},id={identify:$i,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,s)=>Uo(t,2,16,s),stringify:t=>Dl(t,16,"0x")};var Mr=class t extends jt{constructor(e){super(e),this.tag=t.tag}add(e){let s;Xe(e)?s=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?s=new Et(e.key,null):s=new Et(e,null),Is(this.items,s.key)||this.items.push(s)}get(e,s){let r=Is(this.items,e);return!s&&Xe(r)?Ge(r.key)?r.key.value:r.key:r}set(e,s){if(typeof s!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof s}`);let r=Is(this.items,e);r&&!s?this.items.splice(this.items.indexOf(r),1):!r&&s&&this.items.push(new Et(e))}toJSON(e,s){return super.toJSON(e,s,Set)}toString(e,s,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),s,r);throw new Error("Set items must all have null values")}static from(e,s,r){let{replacer:i}=r,o=new this(e);if(s&&Symbol.iterator in Object(s))for(let n of s)typeof i=="function"&&(n=i.call(s,n,n)),o.items.push(Sr(n,null,r));return o}};Mr.tag="tag:yaml.org,2002:set";var Si={collection:"map",identify:t=>t instanceof Set,nodeClass:Mr,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,s)=>Mr.from(t,e,s),resolve(t,e){if(pn(t)){if(t.hasAllNullValues(!0))return Object.assign(new Mr,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};function Bl(t,e){let s=t[0],r=s==="-"||s==="+"?t.substring(1):t,i=n=>e?BigInt(n):Number(n),o=r.replace(/_/g,"").split(":").reduce((n,a)=>n*i(60)+i(a),i(0));return s==="-"?i(-1)*o:o}function od(t){let{value:e}=t,s=n=>n;if(typeof e=="bigint")s=n=>BigInt(n);else if(isNaN(e)||!isFinite(e))return en(t);let r="";e<0&&(r="-",e*=s(-1));let i=s(60),o=[e%i];return e<60?o.unshift(0):(e=(e-o[0])/i,o.unshift(e%i),e>=60&&(e=(e-o[0])/i,o.unshift(e))),r+o.map(n=>String(n).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Ho={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:s})=>Bl(t,s),stringify:od},Yo={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>Bl(t,!1),stringify:od},Pr={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(Pr.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,s,r,i,o,n,a]=e.map(Number),f=e[7]?Number((e[7]+"00").substr(1,3)):0,p=Date.UTC(s,r-1,i,o||0,n||0,a||0,f),c=e[8];if(c&&c!=="Z"){let l=Bl(c,!1);Math.abs(l)<30&&(l*=60),p-=6e4*l}return new Date(p)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};var ql=[Vn,Kn,zs,Js,_l,Fl,nd,sd,rd,id,Qp,ed,td,wi,qn,ki,xi,Si,Ho,Yo,Pr];var ad=new Map([["core",Yp],["failsafe",[Vn,Kn,zs]],["json",Jp],["yaml11",ql],["yaml-1.1",ql]]),ld={binary:wi,bool:bi,float:Bo,floatExp:Do,floatNaN:Fo,floatTime:Yo,int:Ko,intHex:Go,intOct:Vo,intTime:Ho,map:Vn,merge:qn,null:Js,omap:ki,pairs:xi,seq:Kn,set:Si,timestamp:Pr},cd={"tag:yaml.org,2002:binary":wi,"tag:yaml.org,2002:merge":qn,"tag:yaml.org,2002:omap":ki,"tag:yaml.org,2002:pairs":xi,"tag:yaml.org,2002:set":Si,"tag:yaml.org,2002:timestamp":Pr};function Wo(t,e,s){let r=ad.get(e);if(r&&!t)return s&&!r.includes(qn)?r.concat(qn):r.slice();let i=r;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(ad.keys()).filter(n=>n!=="yaml11").map(n=>JSON.stringify(n)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)i=i.concat(o);else typeof t=="function"&&(i=t(i.slice()));return s&&(i=i.concat(qn)),i.reduce((o,n)=>{let a=typeof n=="string"?ld[n]:n;if(!a){let f=JSON.stringify(n),p=Object.keys(ld).map(c=>JSON.stringify(c)).join(", ");throw new Error(`Unknown custom tag ${f}; use one of ${p}`)}return o.includes(a)||o.push(a),o},[])}var au=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,vi=class t{constructor({compat:e,customTags:s,merge:r,resolveKnownTags:i,schema:o,sortMapEntries:n,toStringDefaults:a}){this.compat=Array.isArray(e)?Wo(e,"compat"):e?Wo(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?cd:{},this.tags=Wo(s,this.name,r),this.toStringOptions=a??null,Object.defineProperty(this,Dn,{value:Vn}),Object.defineProperty(this,bn,{value:zs}),Object.defineProperty(this,gs,{value:Kn}),this.sortMapEntries=typeof n=="function"?n:n===!0?au:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};function pd(t,e){let s=[],r=e.directives===!0;if(e.directives!==!1&&t.directives){let f=t.directives.toString(t);f?(s.push(f),r=!0):t.directives.docStart&&(r=!0)}r&&s.push("---");let i=Ro(t,e),{commentString:o}=i.options;if(t.commentBefore){s.length!==1&&s.unshift("");let f=o(t.commentBefore);s.unshift(On(f,""))}let n=!1,a=null;if(t.contents){if(nt(t.contents)){if(t.contents.spaceBefore&&r&&s.push(""),t.contents.commentBefore){let c=o(t.contents.commentBefore);s.push(On(c,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let f=a?void 0:()=>n=!0,p=xs(t.contents,i,()=>a=null,f);a&&(p+=as(p,"",o(a))),(p[0]==="|"||p[0]===">")&&s[s.length-1]==="---"?s[s.length-1]=`--- ${p}`:s.push(p)}else s.push(xs(t.contents,i));if(t.directives?.docEnd)if(t.comment){let f=o(t.comment);f.includes(`
55
- `)?(s.push("..."),s.push(On(f,""))):s.push(`... ${f}`)}else s.push("...");else{let f=t.comment;f&&n&&(f=f.replace(/^\n+/,"")),f&&((!n||a)&&s[s.length-1]!==""&&s.push(""),s.push(On(o(f),"")))}return s.join(`
54
+ ${o.comment}`:r.comment}r=i}t.items[s]=et(r)?r:new Et(r)}}else e("Expected a sequence for this tag");return t}function Dl(t,e,s){let{replacer:r}=s,i=new Qt(t);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let n of e){typeof r=="function"&&(n=r.call(e,String(o++),n));let a,f;if(Array.isArray(n))if(n.length===2)a=n[0],f=n[1];else throw new TypeError(`Expected [key, value] tuple: ${n}`);else if(n&&n instanceof Object){let p=Object.keys(n);if(p.length===1)a=p[0],f=n[a];else throw new TypeError(`Expected tuple with one key, not ${p.length} keys`)}else a=n;i.items.push(Sr(a,f,s))}return i}var xi={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Fl,createNode:Dl};var vr=class t extends Qt{constructor(){super(),this.add=jt.prototype.add.bind(this),this.delete=jt.prototype.delete.bind(this),this.get=jt.prototype.get.bind(this),this.has=jt.prototype.has.bind(this),this.set=jt.prototype.set.bind(this),this.tag=t.tag}toJSON(e,s){if(!s)return super.toJSON(e);let r=new Map;s?.onCreate&&s.onCreate(r);for(let i of this.items){let o,n;if(et(i)?(o=qt(i.key,"",s),n=qt(i.value,o,s)):o=qt(i,"",s),r.has(o))throw new Error("Ordered maps must not include duplicate keys");r.set(o,n)}return r}static from(e,s,r){let i=Dl(e,s,r),o=new this;return o.items=i.items,o}};vr.tag="tag:yaml.org,2002:omap";var ki={collection:"seq",identify:t=>t instanceof Map,nodeClass:vr,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let s=Fl(t,e),r=[];for(let{key:i}of s.items)Ue(i)&&(r.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):r.push(i.value));return Object.assign(new vr,s)},createNode:(t,e,s)=>vr.from(t,e,s)};function td({value:t,source:e},s){return e&&(t?Bl:ql).test.test(e)?e:t?s.options.trueStr:s.options.falseStr}var Bl={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Ie(!0),stringify:td},ql={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Ie(!1),stringify:td};var nd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:en},sd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():en(t)}},rd={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new Ie(parseFloat(t.replace(/_/g,""))),s=t.indexOf(".");if(s!==-1){let r=t.substring(s+1).replace(/_/g,"");r[r.length-1]==="0"&&(e.minFractionDigits=r.length)}return e},stringify:en};var $i=t=>typeof t=="bigint"||Number.isInteger(t);function Wo(t,e,s,{intAsBigInt:r}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),r){switch(s){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let n=BigInt(t);return i==="-"?BigInt(-1)*n:n}let o=parseInt(t,s);return i==="-"?-1*o:o}function Vl(t,e,s){let{value:r}=t;if($i(r)){let i=r.toString(e);return r<0?"-"+s+i.substr(1):s+i}return en(t)}var id={identify:$i,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,s)=>Wo(t,2,2,s),stringify:t=>Vl(t,2,"0b")},od={identify:$i,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,s)=>Wo(t,1,8,s),stringify:t=>Vl(t,8,"0")},ad={identify:$i,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,s)=>Wo(t,0,10,s),stringify:en},ld={identify:$i,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,s)=>Wo(t,2,16,s),stringify:t=>Vl(t,16,"0x")};var Mr=class t extends jt{constructor(e){super(e),this.tag=t.tag}add(e){let s;et(e)?s=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?s=new Et(e.key,null):s=new Et(e,null),Is(this.items,s.key)||this.items.push(s)}get(e,s){let r=Is(this.items,e);return!s&&et(r)?Ue(r.key)?r.key.value:r.key:r}set(e,s){if(typeof s!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof s}`);let r=Is(this.items,e);r&&!s?this.items.splice(this.items.indexOf(r),1):!r&&s&&this.items.push(new Et(e))}toJSON(e,s){return super.toJSON(e,s,Set)}toString(e,s,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),s,r);throw new Error("Set items must all have null values")}static from(e,s,r){let{replacer:i}=r,o=new this(e);if(s&&Symbol.iterator in Object(s))for(let n of s)typeof i=="function"&&(n=i.call(s,n,n)),o.items.push(Sr(n,null,r));return o}};Mr.tag="tag:yaml.org,2002:set";var Si={collection:"map",identify:t=>t instanceof Set,nodeClass:Mr,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,s)=>Mr.from(t,e,s),resolve(t,e){if(pn(t)){if(t.hasAllNullValues(!0))return Object.assign(new Mr,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};function Kl(t,e){let s=t[0],r=s==="-"||s==="+"?t.substring(1):t,i=n=>e?BigInt(n):Number(n),o=r.replace(/_/g,"").split(":").reduce((n,a)=>n*i(60)+i(a),i(0));return s==="-"?i(-1)*o:o}function cd(t){let{value:e}=t,s=n=>n;if(typeof e=="bigint")s=n=>BigInt(n);else if(isNaN(e)||!isFinite(e))return en(t);let r="";e<0&&(r="-",e*=s(-1));let i=s(60),o=[e%i];return e<60?o.unshift(0):(e=(e-o[0])/i,o.unshift(e%i),e>=60&&(e=(e-o[0])/i,o.unshift(e))),r+o.map(n=>String(n).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Jo={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:s})=>Kl(t,s),stringify:cd},Xo={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>Kl(t,!1),stringify:cd},Pr={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(Pr.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,s,r,i,o,n,a]=e.map(Number),f=e[7]?Number((e[7]+"00").substr(1,3)):0,p=Date.UTC(s,r-1,i,o||0,n||0,a||0,f),c=e[8];if(c&&c!=="Z"){let l=Kl(c,!1);Math.abs(l)<30&&(l*=60),p-=6e4*l}return new Date(p)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};var Gl=[Kn,Gn,zs,Js,Bl,ql,id,od,ad,ld,nd,sd,rd,wi,Vn,ki,xi,Si,Jo,Xo,Pr];var pd=new Map([["core",Xp],["failsafe",[Kn,Gn,zs]],["json",ed],["yaml11",Gl],["yaml-1.1",Gl]]),dd={binary:wi,bool:bi,float:Ko,floatExp:Vo,floatNaN:qo,floatTime:Xo,int:Uo,intHex:Ho,intOct:Zo,intTime:Jo,map:Kn,merge:Vn,null:Js,omap:ki,pairs:xi,seq:Gn,set:Si,timestamp:Pr},fd={"tag:yaml.org,2002:binary":wi,"tag:yaml.org,2002:merge":Vn,"tag:yaml.org,2002:omap":ki,"tag:yaml.org,2002:pairs":xi,"tag:yaml.org,2002:set":Si,"tag:yaml.org,2002:timestamp":Pr};function Qo(t,e,s){let r=pd.get(e);if(r&&!t)return s&&!r.includes(Vn)?r.concat(Vn):r.slice();let i=r;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(pd.keys()).filter(n=>n!=="yaml11").map(n=>JSON.stringify(n)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)i=i.concat(o);else typeof t=="function"&&(i=t(i.slice()));return s&&(i=i.concat(Vn)),i.reduce((o,n)=>{let a=typeof n=="string"?dd[n]:n;if(!a){let f=JSON.stringify(n),p=Object.keys(dd).map(c=>JSON.stringify(c)).join(", ");throw new Error(`Unknown custom tag ${f}; use one of ${p}`)}return o.includes(a)||o.push(a),o},[])}var cu=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,vi=class t{constructor({compat:e,customTags:s,merge:r,resolveKnownTags:i,schema:o,sortMapEntries:n,toStringDefaults:a}){this.compat=Array.isArray(e)?Qo(e,"compat"):e?Qo(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?fd:{},this.tags=Qo(s,this.name,r),this.toStringOptions=a??null,Object.defineProperty(this,Bn,{value:Kn}),Object.defineProperty(this,bn,{value:zs}),Object.defineProperty(this,gs,{value:Gn}),this.sortMapEntries=typeof n=="function"?n:n===!0?cu:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};function md(t,e){let s=[],r=e.directives===!0;if(e.directives!==!1&&t.directives){let f=t.directives.toString(t);f?(s.push(f),r=!0):t.directives.docStart&&(r=!0)}r&&s.push("---");let i=Co(t,e),{commentString:o}=i.options;if(t.commentBefore){s.length!==1&&s.unshift("");let f=o(t.commentBefore);s.unshift(An(f,""))}let n=!1,a=null;if(t.contents){if(st(t.contents)){if(t.contents.spaceBefore&&r&&s.push(""),t.contents.commentBefore){let c=o(t.contents.commentBefore);s.push(An(c,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let f=a?void 0:()=>n=!0,p=xs(t.contents,i,()=>a=null,f);a&&(p+=as(p,"",o(a))),(p[0]==="|"||p[0]===">")&&s[s.length-1]==="---"?s[s.length-1]=`--- ${p}`:s.push(p)}else s.push(xs(t.contents,i));if(t.directives?.docEnd)if(t.comment){let f=o(t.comment);f.includes(`
55
+ `)?(s.push("..."),s.push(An(f,""))):s.push(`... ${f}`)}else s.push("...");else{let f=t.comment;f&&n&&(f=f.replace(/^\n+/,"")),f&&((!n||a)&&s[s.length-1]!==""&&s.push(""),s.push(An(o(f),"")))}return s.join(`
56
56
  `)+`
57
- `}var Cs=class t{constructor(e,s,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,on,{value:$o});let i=null;typeof s=="function"||Array.isArray(s)?i=s:r===void 0&&s&&(r=s,s=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=o;let{version:n}=o;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(n=this.directives.yaml.version)):this.directives=new os({version:n}),this.setSchema(n,r),this.contents=e===void 0?null:this.createNode(e,i,r)}clone(){let e=Object.create(t.prototype,{[on]:{value:$o}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=nt(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Or(this.contents)&&this.contents.add(e)}addIn(e,s){Or(this.contents)&&this.contents.addIn(e,s)}createAlias(e,s){if(!e.anchor){let r=Al(this);e.anchor=!s||r.has(s)?Tl(s||"a",r):s}return new bs(e.anchor)}createNode(e,s,r){let i;if(typeof s=="function")e=s.call({"":e},"",e),i=s;else if(Array.isArray(s)){let g=u=>typeof u=="number"||u instanceof String||u instanceof Number,k=s.filter(g).map(String);k.length>0&&(s=s.concat(k)),i=s}else r===void 0&&s&&(r=s,s=void 0);let{aliasDuplicateObjects:o,anchorPrefix:n,flow:a,keepUndefined:f,onTagObj:p,tag:c}=r??{},{onAnchor:l,setAnchors:d,sourceObjects:m}=qp(this,n||"a"),h={aliasDuplicateObjects:o??!0,keepUndefined:f??!1,onAnchor:l,onTagObj:p,replacer:i,schema:this.schema,sourceObjects:m},y=ws(e,c,h);return a&&ct(y)&&(y.flow=!0),d(),y}createPair(e,s,r={}){let i=this.createNode(e,null,r),o=this.createNode(s,null,r);return new Et(i,o)}delete(e){return Or(this.contents)?this.contents.delete(e):!1}deleteIn(e){return kr(e)?this.contents==null?!1:(this.contents=null,!0):Or(this.contents)?this.contents.deleteIn(e):!1}get(e,s){return ct(this.contents)?this.contents.get(e,s):void 0}getIn(e,s){return kr(e)?!s&&Ge(this.contents)?this.contents.value:this.contents:ct(this.contents)?this.contents.getIn(e,s):void 0}has(e){return ct(this.contents)?this.contents.has(e):!1}hasIn(e){return kr(e)?this.contents!==void 0:ct(this.contents)?this.contents.hasIn(e):!1}set(e,s){this.contents==null?this.contents=ui(this.schema,[e],s):Or(this.contents)&&this.contents.set(e,s)}setIn(e,s){kr(e)?this.contents=s:this.contents==null?this.contents=ui(this.schema,Array.from(e),s):Or(this.contents)&&this.contents.setIn(e,s)}setSchema(e,s={}){typeof e=="number"&&(e=String(e));let r;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new os({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new os({version:e}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(s.schema instanceof Object)this.schema=s.schema;else if(r)this.schema=new vi(Object.assign(r,s));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:s,mapAsMap:r,maxAliasCount:i,onAnchor:o,reviver:n}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},f=qt(this.contents,s??"",a);if(typeof o=="function")for(let{count:p,res:c}of a.anchors.values())o(c,p);return typeof n=="function"?Ns(n,{"":f},"",f):f}toJSON(e,s){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:s})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let s=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${s}`)}return pd(this,e)}};function Or(t){if(ct(t))return!0;throw new Error("Expected a YAML collection as document contents")}var Mi=class extends Error{constructor(e,s,r,i){super(),this.name=e,this.code=r,this.message=i,this.pos=s}},Gn=class extends Mi{constructor(e,s,r){super("YAMLParseError",e,s,r)}},Pi=class extends Mi{constructor(e,s,r){super("YAMLWarning",e,s,r)}},Vl=(t,e)=>s=>{if(s.pos[0]===-1)return;s.linePos=s.pos.map(a=>e.linePos(a));let{line:r,col:i}=s.linePos[0];s.message+=` at line ${r}, column ${i}`;let o=i-1,n=t.substring(e.lineStarts[r-1],e.lineStarts[r]).replace(/[\n\r]+$/,"");if(o>=60&&n.length>80){let a=Math.min(o-39,n.length-79);n="\u2026"+n.substring(a),o-=a-1}if(n.length>80&&(n=n.substring(0,79)+"\u2026"),r>1&&/^ *$/.test(n.substring(0,o))){let a=t.substring(e.lineStarts[r-2],e.lineStarts[r-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
57
+ `}var Cs=class t{constructor(e,s,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,on,{value:Mo});let i=null;typeof s=="function"||Array.isArray(s)?i=s:r===void 0&&s&&(r=s,s=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=o;let{version:n}=o;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(n=this.directives.yaml.version)):this.directives=new os({version:n}),this.setSchema(n,r),this.contents=e===void 0?null:this.createNode(e,i,r)}clone(){let e=Object.create(t.prototype,{[on]:{value:Mo}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=st(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Or(this.contents)&&this.contents.add(e)}addIn(e,s){Or(this.contents)&&this.contents.addIn(e,s)}createAlias(e,s){if(!e.anchor){let r=Nl(this);e.anchor=!s||r.has(s)?Rl(s||"a",r):s}return new bs(e.anchor)}createNode(e,s,r){let i;if(typeof s=="function")e=s.call({"":e},"",e),i=s;else if(Array.isArray(s)){let g=u=>typeof u=="number"||u instanceof String||u instanceof Number,k=s.filter(g).map(String);k.length>0&&(s=s.concat(k)),i=s}else r===void 0&&s&&(r=s,s=void 0);let{aliasDuplicateObjects:o,anchorPrefix:n,flow:a,keepUndefined:f,onTagObj:p,tag:c}=r??{},{onAnchor:l,setAnchors:d,sourceObjects:m}=Gp(this,n||"a"),h={aliasDuplicateObjects:o??!0,keepUndefined:f??!1,onAnchor:l,onTagObj:p,replacer:i,schema:this.schema,sourceObjects:m},y=ws(e,c,h);return a&&pt(y)&&(y.flow=!0),d(),y}createPair(e,s,r={}){let i=this.createNode(e,null,r),o=this.createNode(s,null,r);return new Et(i,o)}delete(e){return Or(this.contents)?this.contents.delete(e):!1}deleteIn(e){return kr(e)?this.contents==null?!1:(this.contents=null,!0):Or(this.contents)?this.contents.deleteIn(e):!1}get(e,s){return pt(this.contents)?this.contents.get(e,s):void 0}getIn(e,s){return kr(e)?!s&&Ue(this.contents)?this.contents.value:this.contents:pt(this.contents)?this.contents.getIn(e,s):void 0}has(e){return pt(this.contents)?this.contents.has(e):!1}hasIn(e){return kr(e)?this.contents!==void 0:pt(this.contents)?this.contents.hasIn(e):!1}set(e,s){this.contents==null?this.contents=ui(this.schema,[e],s):Or(this.contents)&&this.contents.set(e,s)}setIn(e,s){kr(e)?this.contents=s:this.contents==null?this.contents=ui(this.schema,Array.from(e),s):Or(this.contents)&&this.contents.setIn(e,s)}setSchema(e,s={}){typeof e=="number"&&(e=String(e));let r;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new os({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new os({version:e}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(s.schema instanceof Object)this.schema=s.schema;else if(r)this.schema=new vi(Object.assign(r,s));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:s,mapAsMap:r,maxAliasCount:i,onAnchor:o,reviver:n}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},f=qt(this.contents,s??"",a);if(typeof o=="function")for(let{count:p,res:c}of a.anchors.values())o(c,p);return typeof n=="function"?Ns(n,{"":f},"",f):f}toJSON(e,s){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:s})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let s=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${s}`)}return md(this,e)}};function Or(t){if(pt(t))return!0;throw new Error("Expected a YAML collection as document contents")}var Mi=class extends Error{constructor(e,s,r,i){super(),this.name=e,this.code=r,this.message=i,this.pos=s}},Zn=class extends Mi{constructor(e,s,r){super("YAMLParseError",e,s,r)}},Pi=class extends Mi{constructor(e,s,r){super("YAMLWarning",e,s,r)}},Zl=(t,e)=>s=>{if(s.pos[0]===-1)return;s.linePos=s.pos.map(a=>e.linePos(a));let{line:r,col:i}=s.linePos[0];s.message+=` at line ${r}, column ${i}`;let o=i-1,n=t.substring(e.lineStarts[r-1],e.lineStarts[r]).replace(/[\n\r]+$/,"");if(o>=60&&n.length>80){let a=Math.min(o-39,n.length-79);n="\u2026"+n.substring(a),o-=a-1}if(n.length>80&&(n=n.substring(0,79)+"\u2026"),r>1&&/^ *$/.test(n.substring(0,o))){let a=t.substring(e.lineStarts[r-2],e.lineStarts[r-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
58
58
  `),n=a+n}if(/[^ ]/.test(n)){let a=1,f=s.linePos[1];f?.line===r&&f.col>i&&(a=Math.max(1,Math.min(f.col-i,80-o)));let p=" ".repeat(o)+"^".repeat(a);s.message+=`:
59
59
 
60
60
  ${n}
61
61
  ${p}
62
- `}};function ls(t,{flow:e,indicator:s,next:r,offset:i,onError:o,parentIndent:n,startOnNewline:a}){let f=!1,p=a,c=a,l="",d="",m=!1,h=!1,y=null,g=null,k=null,u=null,b=null,x=null,w=null;for(let O of t)switch(h&&(O.type!=="space"&&O.type!=="newline"&&O.type!=="comma"&&o(O.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h=!1),y&&(p&&O.type!=="comment"&&O.type!=="newline"&&o(y,"TAB_AS_INDENT","Tabs are not allowed as indentation"),y=null),O.type){case"space":!e&&(s!=="doc-start"||r?.type!=="flow-collection")&&O.source.includes(" ")&&(y=O),c=!0;break;case"comment":{c||o(O,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let C=O.source.substring(1)||" ";l?l+=d+C:l=C,d="",p=!1;break}case"newline":p?l?l+=O.source:(!x||s!=="seq-item-ind")&&(f=!0):d+=O.source,p=!0,m=!0,(g||k)&&(u=O),c=!0;break;case"anchor":g&&o(O,"MULTIPLE_ANCHORS","A node can have at most one anchor"),O.source.endsWith(":")&&o(O.offset+O.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=O,w??(w=O.offset),p=!1,c=!1,h=!0;break;case"tag":{k&&o(O,"MULTIPLE_TAGS","A node can have at most one tag"),k=O,w??(w=O.offset),p=!1,c=!1,h=!0;break}case s:(g||k)&&o(O,"BAD_PROP_ORDER",`Anchors and tags must be after the ${O.source} indicator`),x&&o(O,"UNEXPECTED_TOKEN",`Unexpected ${O.source} in ${e??"collection"}`),x=O,p=s==="seq-item-ind"||s==="explicit-key-ind",c=!1;break;case"comma":if(e){b&&o(O,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),b=O,p=!1,c=!1;break}default:o(O,"UNEXPECTED_TOKEN",`Unexpected ${O.type} token`),p=!1,c=!1}let $=t[t.length-1],v=$?$.offset+$.source.length:i;return h&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&o(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),y&&(p&&y.indent<=n||r?.type==="block-map"||r?.type==="block-seq")&&o(y,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:b,found:x,spaceBefore:f,comment:l,hasNewline:m,anchor:g,tag:k,newlineAfterProp:u,end:v,start:w??v}}function js(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
63
- `))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let s of e.start)if(s.type==="newline")return!0;if(e.sep){for(let s of e.sep)if(s.type==="newline")return!0}if(js(e.key)||js(e.value))return!0}return!1;default:return!0}}function Oi(t,e,s){if(e?.type==="flow-collection"){let r=e.end[0];r.indent===t&&(r.source==="]"||r.source==="}")&&js(e)&&s(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function Jo(t,e,s){let{uniqueKeys:r}=t.options;if(r===!1)return!1;let i=typeof r=="function"?r:(o,n)=>o===n||Ge(o)&&Ge(n)&&o.value===n.value;return e.some(o=>i(o.key,s))}var dd="All mapping items must start at the same column";function fd({composeNode:t,composeEmptyNode:e},s,r,i,o){let n=o?.nodeClass??jt,a=new n(s.schema);s.atRoot&&(s.atRoot=!1);let f=r.offset,p=null;for(let c of r.items){let{start:l,key:d,sep:m,value:h}=c,y=ls(l,{indicator:"explicit-key-ind",next:d??m?.[0],offset:f,onError:i,parentIndent:r.indent,startOnNewline:!0}),g=!y.found;if(g){if(d&&(d.type==="block-seq"?i(f,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in d&&d.indent!==r.indent&&i(f,"BAD_INDENT",dd)),!y.anchor&&!y.tag&&!m){p=y.end,y.comment&&(a.comment?a.comment+=`
64
- `+y.comment:a.comment=y.comment);continue}(y.newlineAfterProp||js(d))&&i(d??l[l.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else y.found?.indent!==r.indent&&i(f,"BAD_INDENT",dd);s.atKey=!0;let k=y.end,u=d?t(s,d,y,i):e(s,k,l,null,y,i);s.schema.compat&&Oi(r.indent,d,i),s.atKey=!1,Jo(s,a.items,u)&&i(k,"DUPLICATE_KEY","Map keys must be unique");let b=ls(m??[],{indicator:"map-value-ind",next:h,offset:u.range[2],onError:i,parentIndent:r.indent,startOnNewline:!d||d.type==="block-scalar"});if(f=b.end,b.found){g&&(h?.type==="block-map"&&!b.hasNewline&&i(f,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),s.options.strict&&y.start<b.found.offset-1024&&i(u.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let x=h?t(s,h,b,i):e(s,f,m,null,b,i);s.schema.compat&&Oi(r.indent,h,i),f=x.range[2];let w=new Et(u,x);s.options.keepSourceTokens&&(w.srcToken=c),a.items.push(w)}else{g&&i(u.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),b.comment&&(u.comment?u.comment+=`
65
- `+b.comment:u.comment=b.comment);let x=new Et(u);s.options.keepSourceTokens&&(x.srcToken=c),a.items.push(x)}}return p&&p<f&&i(p,"IMPOSSIBLE","Map comment with trailing content"),a.range=[r.offset,f,p??f],a}function md({composeNode:t,composeEmptyNode:e},s,r,i,o){let n=o?.nodeClass??Qt,a=new n(s.schema);s.atRoot&&(s.atRoot=!1),s.atKey&&(s.atKey=!1);let f=r.offset,p=null;for(let{start:c,value:l}of r.items){let d=ls(c,{indicator:"seq-item-ind",next:l,offset:f,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||l)l?.type==="block-seq"?i(d.end,"BAD_INDENT","All sequence items must start at the same column"):i(f,"MISSING_CHAR","Sequence item without - indicator");else{p=d.end,d.comment&&(a.comment=d.comment);continue}let m=l?t(s,l,d,i):e(s,d.end,c,null,d,i);s.schema.compat&&Oi(r.indent,l,i),f=m.range[2],a.items.push(m)}return a.range=[r.offset,f,p??f],a}function cs(t,e,s,r){let i="";if(t){let o=!1,n="";for(let a of t){let{source:f,type:p}=a;switch(p){case"space":o=!0;break;case"comment":{s&&!o&&r(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let c=f.substring(1)||" ";i?i+=n+c:i=c,n="";break}case"newline":i&&(n+=f),o=!0;break;default:r(a,"UNEXPECTED_TOKEN",`Unexpected ${p} at node end`)}e+=f.length}}return{comment:i,offset:e}}var Kl="Block collections are not allowed within flow collections",Gl=t=>t&&(t.type==="block-map"||t.type==="block-seq");function ud({composeNode:t,composeEmptyNode:e},s,r,i,o){let n=r.start.source==="{",a=n?"flow map":"flow sequence",f=o?.nodeClass??(n?jt:Qt),p=new f(s.schema);p.flow=!0;let c=s.atRoot;c&&(s.atRoot=!1),s.atKey&&(s.atKey=!1);let l=r.offset+r.start.source.length;for(let g=0;g<r.items.length;++g){let k=r.items[g],{start:u,key:b,sep:x,value:w}=k,$=ls(u,{flow:a,indicator:"explicit-key-ind",next:b??x?.[0],offset:l,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!$.found){if(!$.anchor&&!$.tag&&!x&&!w){g===0&&$.comma?i($.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):g<r.items.length-1&&i($.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),$.comment&&(p.comment?p.comment+=`
66
- `+$.comment:p.comment=$.comment),l=$.end;continue}!n&&s.options.strict&&js(b)&&i(b,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(g===0)$.comma&&i($.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if($.comma||i($.start,"MISSING_CHAR",`Missing , between ${a} items`),$.comment){let v="";e:for(let O of u)switch(O.type){case"comma":case"space":break;case"comment":v=O.source.substring(1);break e;default:break e}if(v){let O=p.items[p.items.length-1];Xe(O)&&(O=O.value??O.key),O.comment?O.comment+=`
67
- `+v:O.comment=v,$.comment=$.comment.substring(v.length+1)}}if(!n&&!x&&!$.found){let v=w?t(s,w,$,i):e(s,$.end,x,null,$,i);p.items.push(v),l=v.range[2],Gl(w)&&i(v.range,"BLOCK_IN_FLOW",Kl)}else{s.atKey=!0;let v=$.end,O=b?t(s,b,$,i):e(s,v,u,null,$,i);Gl(b)&&i(O.range,"BLOCK_IN_FLOW",Kl),s.atKey=!1;let C=ls(x??[],{flow:a,indicator:"map-value-ind",next:w,offset:O.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(C.found){if(!n&&!$.found&&s.options.strict){if(x)for(let M of x){if(M===C.found)break;if(M.type==="newline"){i(M,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}$.start<C.found.offset-1024&&i(C.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else w&&("source"in w&&w.source?.[0]===":"?i(w,"MISSING_CHAR",`Missing space after : in ${a}`):i(C.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let A=w?t(s,w,C,i):C.found?e(s,C.end,x,null,C,i):null;A?Gl(w)&&i(A.range,"BLOCK_IN_FLOW",Kl):C.comment&&(O.comment?O.comment+=`
68
- `+C.comment:O.comment=C.comment);let R=new Et(O,A);if(s.options.keepSourceTokens&&(R.srcToken=k),n){let M=p;Jo(s,M.items,O)&&i(v,"DUPLICATE_KEY","Map keys must be unique"),M.items.push(R)}else{let M=new jt(s.schema);M.flow=!0,M.items.push(R);let T=(A??O).range;M.range=[O.range[0],T[1],T[2]],p.items.push(M)}l=A?A.range[2]:C.end}}let d=n?"}":"]",[m,...h]=r.end,y=l;if(m?.source===d)y=m.offset+m.source.length;else{let g=a[0].toUpperCase()+a.substring(1),k=c?`${g} must end with a ${d}`:`${g} in block collection must be sufficiently indented and end with a ${d}`;i(l,c?"MISSING_CHAR":"BAD_INDENT",k),m&&m.source.length!==1&&h.unshift(m)}if(h.length>0){let g=cs(h,y,s.options.strict,i);g.comment&&(p.comment?p.comment+=`
69
- `+g.comment:p.comment=g.comment),p.range=[r.offset,y,g.offset]}else p.range=[r.offset,y,y];return p}function Zl(t,e,s,r,i,o){let n=s.type==="block-map"?fd(t,e,s,r,o):s.type==="block-seq"?md(t,e,s,r,o):ud(t,e,s,r,o),a=n.constructor;return i==="!"||i===a.tagName?(n.tag=a.tagName,n):(i&&(n.tag=i),n)}function hd(t,e,s,r,i){let o=r.tag,n=o?e.directives.tagName(o.source,d=>i(o,"TAG_RESOLVE_FAILED",d)):null;if(s.type==="block-seq"){let{anchor:d,newlineAfterProp:m}=r,h=d&&o?d.offset>o.offset?d:o:d??o;h&&(!m||m.offset<h.offset)&&i(h,"MISSING_CHAR","Missing newline after block sequence props")}let a=s.type==="block-map"?"map":s.type==="block-seq"?"seq":s.start.source==="{"?"map":"seq";if(!o||!n||n==="!"||n===jt.tagName&&a==="map"||n===Qt.tagName&&a==="seq")return Zl(t,e,s,i,n);let f=e.schema.tags.find(d=>d.tag===n&&d.collection===a);if(!f){let d=e.schema.knownTags[n];if(d?.collection===a)e.schema.tags.push(Object.assign({},d,{default:!1})),f=d;else return d?i(o,"BAD_COLLECTION_TYPE",`${d.tag} used for ${a} collection, but expects ${d.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,!0),Zl(t,e,s,i,n)}let p=Zl(t,e,s,i,n,f),c=f.resolve?.(p,d=>i(o,"TAG_RESOLVE_FAILED",d),e.options)??p,l=nt(c)?c:new Re(c);return l.range=p.range,l.tag=n,f?.format&&(l.format=f.format),l}function Ul(t,e,s){let r=e.offset,i=lu(e,t.options.strict,s);if(!i)return{value:"",type:null,comment:"",range:[r,r,r]};let o=i.mode===">"?Re.BLOCK_FOLDED:Re.BLOCK_LITERAL,n=e.source?cu(e.source):[],a=n.length;for(let y=n.length-1;y>=0;--y){let g=n[y][1];if(g===""||g==="\r")a=y;else break}if(a===0){let y=i.chomp==="+"&&n.length>0?`
62
+ `}};function ls(t,{flow:e,indicator:s,next:r,offset:i,onError:o,parentIndent:n,startOnNewline:a}){let f=!1,p=a,c=a,l="",d="",m=!1,h=!1,y=null,g=null,k=null,u=null,b=null,x=null,w=null;for(let O of t)switch(h&&(O.type!=="space"&&O.type!=="newline"&&O.type!=="comma"&&o(O.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h=!1),y&&(p&&O.type!=="comment"&&O.type!=="newline"&&o(y,"TAB_AS_INDENT","Tabs are not allowed as indentation"),y=null),O.type){case"space":!e&&(s!=="doc-start"||r?.type!=="flow-collection")&&O.source.includes(" ")&&(y=O),c=!0;break;case"comment":{c||o(O,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let z=O.source.substring(1)||" ";l?l+=d+z:l=z,d="",p=!1;break}case"newline":p?l?l+=O.source:(!x||s!=="seq-item-ind")&&(f=!0):d+=O.source,p=!0,m=!0,(g||k)&&(u=O),c=!0;break;case"anchor":g&&o(O,"MULTIPLE_ANCHORS","A node can have at most one anchor"),O.source.endsWith(":")&&o(O.offset+O.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=O,w??(w=O.offset),p=!1,c=!1,h=!0;break;case"tag":{k&&o(O,"MULTIPLE_TAGS","A node can have at most one tag"),k=O,w??(w=O.offset),p=!1,c=!1,h=!0;break}case s:(g||k)&&o(O,"BAD_PROP_ORDER",`Anchors and tags must be after the ${O.source} indicator`),x&&o(O,"UNEXPECTED_TOKEN",`Unexpected ${O.source} in ${e??"collection"}`),x=O,p=s==="seq-item-ind"||s==="explicit-key-ind",c=!1;break;case"comma":if(e){b&&o(O,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),b=O,p=!1,c=!1;break}default:o(O,"UNEXPECTED_TOKEN",`Unexpected ${O.type} token`),p=!1,c=!1}let $=t[t.length-1],S=$?$.offset+$.source.length:i;return h&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&o(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),y&&(p&&y.indent<=n||r?.type==="block-map"||r?.type==="block-seq")&&o(y,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:b,found:x,spaceBefore:f,comment:l,hasNewline:m,anchor:g,tag:k,newlineAfterProp:u,end:S,start:w??S}}function js(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
63
+ `))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let s of e.start)if(s.type==="newline")return!0;if(e.sep){for(let s of e.sep)if(s.type==="newline")return!0}if(js(e.key)||js(e.value))return!0}return!1;default:return!0}}function Oi(t,e,s){if(e?.type==="flow-collection"){let r=e.end[0];r.indent===t&&(r.source==="]"||r.source==="}")&&js(e)&&s(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function ea(t,e,s){let{uniqueKeys:r}=t.options;if(r===!1)return!1;let i=typeof r=="function"?r:(o,n)=>o===n||Ue(o)&&Ue(n)&&o.value===n.value;return e.some(o=>i(o.key,s))}var ud="All mapping items must start at the same column";function hd({composeNode:t,composeEmptyNode:e},s,r,i,o){let n=o?.nodeClass??jt,a=new n(s.schema);s.atRoot&&(s.atRoot=!1);let f=r.offset,p=null;for(let c of r.items){let{start:l,key:d,sep:m,value:h}=c,y=ls(l,{indicator:"explicit-key-ind",next:d??m?.[0],offset:f,onError:i,parentIndent:r.indent,startOnNewline:!0}),g=!y.found;if(g){if(d&&(d.type==="block-seq"?i(f,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in d&&d.indent!==r.indent&&i(f,"BAD_INDENT",ud)),!y.anchor&&!y.tag&&!m){p=y.end,y.comment&&(a.comment?a.comment+=`
64
+ `+y.comment:a.comment=y.comment);continue}(y.newlineAfterProp||js(d))&&i(d??l[l.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else y.found?.indent!==r.indent&&i(f,"BAD_INDENT",ud);s.atKey=!0;let k=y.end,u=d?t(s,d,y,i):e(s,k,l,null,y,i);s.schema.compat&&Oi(r.indent,d,i),s.atKey=!1,ea(s,a.items,u)&&i(k,"DUPLICATE_KEY","Map keys must be unique");let b=ls(m??[],{indicator:"map-value-ind",next:h,offset:u.range[2],onError:i,parentIndent:r.indent,startOnNewline:!d||d.type==="block-scalar"});if(f=b.end,b.found){g&&(h?.type==="block-map"&&!b.hasNewline&&i(f,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),s.options.strict&&y.start<b.found.offset-1024&&i(u.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let x=h?t(s,h,b,i):e(s,f,m,null,b,i);s.schema.compat&&Oi(r.indent,h,i),f=x.range[2];let w=new Et(u,x);s.options.keepSourceTokens&&(w.srcToken=c),a.items.push(w)}else{g&&i(u.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),b.comment&&(u.comment?u.comment+=`
65
+ `+b.comment:u.comment=b.comment);let x=new Et(u);s.options.keepSourceTokens&&(x.srcToken=c),a.items.push(x)}}return p&&p<f&&i(p,"IMPOSSIBLE","Map comment with trailing content"),a.range=[r.offset,f,p??f],a}function yd({composeNode:t,composeEmptyNode:e},s,r,i,o){let n=o?.nodeClass??Qt,a=new n(s.schema);s.atRoot&&(s.atRoot=!1),s.atKey&&(s.atKey=!1);let f=r.offset,p=null;for(let{start:c,value:l}of r.items){let d=ls(c,{indicator:"seq-item-ind",next:l,offset:f,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||l)l?.type==="block-seq"?i(d.end,"BAD_INDENT","All sequence items must start at the same column"):i(f,"MISSING_CHAR","Sequence item without - indicator");else{p=d.end,d.comment&&(a.comment=d.comment);continue}let m=l?t(s,l,d,i):e(s,d.end,c,null,d,i);s.schema.compat&&Oi(r.indent,l,i),f=m.range[2],a.items.push(m)}return a.range=[r.offset,f,p??f],a}function cs(t,e,s,r){let i="";if(t){let o=!1,n="";for(let a of t){let{source:f,type:p}=a;switch(p){case"space":o=!0;break;case"comment":{s&&!o&&r(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let c=f.substring(1)||" ";i?i+=n+c:i=c,n="";break}case"newline":i&&(n+=f),o=!0;break;default:r(a,"UNEXPECTED_TOKEN",`Unexpected ${p} at node end`)}e+=f.length}}return{comment:i,offset:e}}var Ul="Block collections are not allowed within flow collections",Hl=t=>t&&(t.type==="block-map"||t.type==="block-seq");function gd({composeNode:t,composeEmptyNode:e},s,r,i,o){let n=r.start.source==="{",a=n?"flow map":"flow sequence",f=o?.nodeClass??(n?jt:Qt),p=new f(s.schema);p.flow=!0;let c=s.atRoot;c&&(s.atRoot=!1),s.atKey&&(s.atKey=!1);let l=r.offset+r.start.source.length;for(let g=0;g<r.items.length;++g){let k=r.items[g],{start:u,key:b,sep:x,value:w}=k,$=ls(u,{flow:a,indicator:"explicit-key-ind",next:b??x?.[0],offset:l,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!$.found){if(!$.anchor&&!$.tag&&!x&&!w){g===0&&$.comma?i($.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):g<r.items.length-1&&i($.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),$.comment&&(p.comment?p.comment+=`
66
+ `+$.comment:p.comment=$.comment),l=$.end;continue}!n&&s.options.strict&&js(b)&&i(b,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(g===0)$.comma&&i($.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if($.comma||i($.start,"MISSING_CHAR",`Missing , between ${a} items`),$.comment){let S="";e:for(let O of u)switch(O.type){case"comma":case"space":break;case"comment":S=O.source.substring(1);break e;default:break e}if(S){let O=p.items[p.items.length-1];et(O)&&(O=O.value??O.key),O.comment?O.comment+=`
67
+ `+S:O.comment=S,$.comment=$.comment.substring(S.length+1)}}if(!n&&!x&&!$.found){let S=w?t(s,w,$,i):e(s,$.end,x,null,$,i);p.items.push(S),l=S.range[2],Hl(w)&&i(S.range,"BLOCK_IN_FLOW",Ul)}else{s.atKey=!0;let S=$.end,O=b?t(s,b,$,i):e(s,S,u,null,$,i);Hl(b)&&i(O.range,"BLOCK_IN_FLOW",Ul),s.atKey=!1;let z=ls(x??[],{flow:a,indicator:"map-value-ind",next:w,offset:O.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(z.found){if(!n&&!$.found&&s.options.strict){if(x)for(let P of x){if(P===z.found)break;if(P.type==="newline"){i(P,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}$.start<z.found.offset-1024&&i(z.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else w&&("source"in w&&w.source?.[0]===":"?i(w,"MISSING_CHAR",`Missing space after : in ${a}`):i(z.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let A=w?t(s,w,z,i):z.found?e(s,z.end,x,null,z,i):null;A?Hl(w)&&i(A.range,"BLOCK_IN_FLOW",Ul):z.comment&&(O.comment?O.comment+=`
68
+ `+z.comment:O.comment=z.comment);let R=new Et(O,A);if(s.options.keepSourceTokens&&(R.srcToken=k),n){let P=p;ea(s,P.items,O)&&i(S,"DUPLICATE_KEY","Map keys must be unique"),P.items.push(R)}else{let P=new jt(s.schema);P.flow=!0,P.items.push(R);let E=(A??O).range;P.range=[O.range[0],E[1],E[2]],p.items.push(P)}l=A?A.range[2]:z.end}}let d=n?"}":"]",[m,...h]=r.end,y=l;if(m?.source===d)y=m.offset+m.source.length;else{let g=a[0].toUpperCase()+a.substring(1),k=c?`${g} must end with a ${d}`:`${g} in block collection must be sufficiently indented and end with a ${d}`;i(l,c?"MISSING_CHAR":"BAD_INDENT",k),m&&m.source.length!==1&&h.unshift(m)}if(h.length>0){let g=cs(h,y,s.options.strict,i);g.comment&&(p.comment?p.comment+=`
69
+ `+g.comment:p.comment=g.comment),p.range=[r.offset,y,g.offset]}else p.range=[r.offset,y,y];return p}function Yl(t,e,s,r,i,o){let n=s.type==="block-map"?hd(t,e,s,r,o):s.type==="block-seq"?yd(t,e,s,r,o):gd(t,e,s,r,o),a=n.constructor;return i==="!"||i===a.tagName?(n.tag=a.tagName,n):(i&&(n.tag=i),n)}function bd(t,e,s,r,i){let o=r.tag,n=o?e.directives.tagName(o.source,d=>i(o,"TAG_RESOLVE_FAILED",d)):null;if(s.type==="block-seq"){let{anchor:d,newlineAfterProp:m}=r,h=d&&o?d.offset>o.offset?d:o:d??o;h&&(!m||m.offset<h.offset)&&i(h,"MISSING_CHAR","Missing newline after block sequence props")}let a=s.type==="block-map"?"map":s.type==="block-seq"?"seq":s.start.source==="{"?"map":"seq";if(!o||!n||n==="!"||n===jt.tagName&&a==="map"||n===Qt.tagName&&a==="seq")return Yl(t,e,s,i,n);let f=e.schema.tags.find(d=>d.tag===n&&d.collection===a);if(!f){let d=e.schema.knownTags[n];if(d?.collection===a)e.schema.tags.push(Object.assign({},d,{default:!1})),f=d;else return d?i(o,"BAD_COLLECTION_TYPE",`${d.tag} used for ${a} collection, but expects ${d.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,!0),Yl(t,e,s,i,n)}let p=Yl(t,e,s,i,n,f),c=f.resolve?.(p,d=>i(o,"TAG_RESOLVE_FAILED",d),e.options)??p,l=st(c)?c:new Ie(c);return l.range=p.range,l.tag=n,f?.format&&(l.format=f.format),l}function Wl(t,e,s){let r=e.offset,i=pu(e,t.options.strict,s);if(!i)return{value:"",type:null,comment:"",range:[r,r,r]};let o=i.mode===">"?Ie.BLOCK_FOLDED:Ie.BLOCK_LITERAL,n=e.source?du(e.source):[],a=n.length;for(let y=n.length-1;y>=0;--y){let g=n[y][1];if(g===""||g==="\r")a=y;else break}if(a===0){let y=i.chomp==="+"&&n.length>0?`
70
70
  `.repeat(Math.max(1,n.length-1)):"",g=r+i.length;return e.source&&(g+=e.source.length),{value:y,type:o,comment:i.comment,range:[r,g,g]}}let f=e.indent+i.indent,p=e.offset+i.length,c=0;for(let y=0;y<a;++y){let[g,k]=n[y];if(k===""||k==="\r")i.indent===0&&g.length>f&&(f=g.length);else{g.length<f&&s(p+g.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(f=g.length),c=y,f===0&&!t.atRoot&&s(p,"BAD_INDENT","Block scalar values in collections must be indented");break}p+=g.length+k.length+1}for(let y=n.length-1;y>=a;--y)n[y][0].length>f&&(a=y+1);let l="",d="",m=!1;for(let y=0;y<c;++y)l+=n[y][0].slice(f)+`
71
- `;for(let y=c;y<a;++y){let[g,k]=n[y];p+=g.length+k.length+1;let u=k[k.length-1]==="\r";if(u&&(k=k.slice(0,-1)),k&&g.length<f){let x=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;s(p-k.length-(u?2:1),"BAD_INDENT",x),g=""}o===Re.BLOCK_LITERAL?(l+=d+g.slice(f)+k,d=`
71
+ `;for(let y=c;y<a;++y){let[g,k]=n[y];p+=g.length+k.length+1;let u=k[k.length-1]==="\r";if(u&&(k=k.slice(0,-1)),k&&g.length<f){let x=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;s(p-k.length-(u?2:1),"BAD_INDENT",x),g=""}o===Ie.BLOCK_LITERAL?(l+=d+g.slice(f)+k,d=`
72
72
  `):g.length>f||k[0]===" "?(d===" "?d=`
73
73
  `:!m&&d===`
74
74
  `&&(d=`
@@ -81,76 +81,76 @@ ${p}
81
81
  `+n[y][0].slice(f);l[l.length-1]!==`
82
82
  `&&(l+=`
83
83
  `);break;default:l+=`
84
- `}let h=r+i.length+e.source.length;return{value:l,type:o,comment:i.comment,range:[r,h,h]}}function lu({offset:t,props:e},s,r){if(e[0].type!=="block-scalar-header")return r(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=e[0],o=i[0],n=0,a="",f=-1;for(let d=1;d<i.length;++d){let m=i[d];if(!a&&(m==="-"||m==="+"))a=m;else{let h=Number(m);!n&&h?n=h:f===-1&&(f=t+d)}}f!==-1&&r(f,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let p=!1,c="",l=i.length;for(let d=1;d<e.length;++d){let m=e[d];switch(m.type){case"space":p=!0;case"newline":l+=m.source.length;break;case"comment":s&&!p&&r(m,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),l+=m.source.length,c=m.source.substring(1);break;case"error":r(m,"UNEXPECTED_TOKEN",m.message),l+=m.source.length;break;default:{let h=`Unexpected token in block scalar header: ${m.type}`;r(m,"UNEXPECTED_TOKEN",h);let y=m.source;y&&typeof y=="string"&&(l+=y.length)}}}return{mode:o,indent:n,chomp:a,comment:c,length:l}}function cu(t){let e=t.split(/\n( *)/),s=e[0],r=s.match(/^( *)/),o=[r?.[1]?[r[1],s.slice(r[1].length)]:["",s]];for(let n=1;n<e.length;n+=2)o.push([e[n],e[n+1]]);return o}function Hl(t,e,s){let{offset:r,type:i,source:o,end:n}=t,a,f,p=(d,m,h)=>s(r+d,m,h);switch(i){case"scalar":a=Re.PLAIN,f=pu(o,p);break;case"single-quoted-scalar":a=Re.QUOTE_SINGLE,f=du(o,p);break;case"double-quoted-scalar":a=Re.QUOTE_DOUBLE,f=fu(o,p);break;default:return s(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[r,r+o.length,r+o.length]}}let c=r+o.length,l=cs(n,c,e,s);return{value:f,type:a,comment:l.comment,range:[r,c,l.offset]}}function pu(t,e){let s="";switch(t[0]){case" ":s="a tab character";break;case",":s="flow indicator character ,";break;case"%":s="directive indicator character %";break;case"|":case">":{s=`block scalar indicator ${t[0]}`;break}case"@":case"`":{s=`reserved character ${t[0]}`;break}}return s&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${s}`),yd(t)}function du(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),yd(t.slice(1,-1)).replace(/''/g,"'")}function yd(t){let e=/(.*?)\r?\n/sy,s=e.exec(t);if(!s)return t;let r,i;try{r=new RegExp("(?<![ ])[ ]+$"),i=new RegExp("^[ ]+|(?<![ ])[ ]+$","g")}catch{r=/[ \t]+$/,i=/^[ \t]+|[ \t]+$/g}let o=s[1].replace(r,""),n=" ",a=e.lastIndex;for(;s=e.exec(t);){let p=s[1].replace(i,"");p===""?n===`
84
+ `}let h=r+i.length+e.source.length;return{value:l,type:o,comment:i.comment,range:[r,h,h]}}function pu({offset:t,props:e},s,r){if(e[0].type!=="block-scalar-header")return r(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=e[0],o=i[0],n=0,a="",f=-1;for(let d=1;d<i.length;++d){let m=i[d];if(!a&&(m==="-"||m==="+"))a=m;else{let h=Number(m);!n&&h?n=h:f===-1&&(f=t+d)}}f!==-1&&r(f,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let p=!1,c="",l=i.length;for(let d=1;d<e.length;++d){let m=e[d];switch(m.type){case"space":p=!0;case"newline":l+=m.source.length;break;case"comment":s&&!p&&r(m,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),l+=m.source.length,c=m.source.substring(1);break;case"error":r(m,"UNEXPECTED_TOKEN",m.message),l+=m.source.length;break;default:{let h=`Unexpected token in block scalar header: ${m.type}`;r(m,"UNEXPECTED_TOKEN",h);let y=m.source;y&&typeof y=="string"&&(l+=y.length)}}}return{mode:o,indent:n,chomp:a,comment:c,length:l}}function du(t){let e=t.split(/\n( *)/),s=e[0],r=s.match(/^( *)/),o=[r?.[1]?[r[1],s.slice(r[1].length)]:["",s]];for(let n=1;n<e.length;n+=2)o.push([e[n],e[n+1]]);return o}function Jl(t,e,s){let{offset:r,type:i,source:o,end:n}=t,a,f,p=(d,m,h)=>s(r+d,m,h);switch(i){case"scalar":a=Ie.PLAIN,f=fu(o,p);break;case"single-quoted-scalar":a=Ie.QUOTE_SINGLE,f=mu(o,p);break;case"double-quoted-scalar":a=Ie.QUOTE_DOUBLE,f=uu(o,p);break;default:return s(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[r,r+o.length,r+o.length]}}let c=r+o.length,l=cs(n,c,e,s);return{value:f,type:a,comment:l.comment,range:[r,c,l.offset]}}function fu(t,e){let s="";switch(t[0]){case" ":s="a tab character";break;case",":s="flow indicator character ,";break;case"%":s="directive indicator character %";break;case"|":case">":{s=`block scalar indicator ${t[0]}`;break}case"@":case"`":{s=`reserved character ${t[0]}`;break}}return s&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${s}`),wd(t)}function mu(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),wd(t.slice(1,-1)).replace(/''/g,"'")}function wd(t){let e=/(.*?)\r?\n/sy,s=e.exec(t);if(!s)return t;let r,i;try{r=new RegExp("(?<![ ])[ ]+$"),i=new RegExp("^[ ]+|(?<![ ])[ ]+$","g")}catch{r=/[ \t]+$/,i=/^[ \t]+|[ \t]+$/g}let o=s[1].replace(r,""),n=" ",a=e.lastIndex;for(;s=e.exec(t);){let p=s[1].replace(i,"");p===""?n===`
85
85
  `?o+=n:n=`
86
- `:(o+=n+p,n=" "),a=e.lastIndex}let f=/[ \t]*(.*)/sy;return f.lastIndex=a,s=f.exec(t),o+n+(s?.[1]??"")}function fu(t,e){let s="";for(let r=1;r<t.length-1;++r){let i=t[r];if(!(i==="\r"&&t[r+1]===`
86
+ `:(o+=n+p,n=" "),a=e.lastIndex}let f=/[ \t]*(.*)/sy;return f.lastIndex=a,s=f.exec(t),o+n+(s?.[1]??"")}function uu(t,e){let s="";for(let r=1;r<t.length-1;++r){let i=t[r];if(!(i==="\r"&&t[r+1]===`
87
87
  `))if(i===`
88
- `){let{fold:o,offset:n}=mu(t,r);s+=o,r=n}else if(i==="\\"){let o=t[++r],n=uu[o];if(n)s+=n;else if(o===`
88
+ `){let{fold:o,offset:n}=hu(t,r);s+=o,r=n}else if(i==="\\"){let o=t[++r],n=yu[o];if(n)s+=n;else if(o===`
89
89
  `)for(o=t[r+1];o===" "||o===" ";)o=t[++r+1];else if(o==="\r"&&t[r+1]===`
90
- `)for(o=t[++r+1];o===" "||o===" ";)o=t[++r+1];else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;s+=hu(t,r+1,a,e),r+=a}else{let a=t.substr(r-1,2);e(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),s+=a}}else if(i===" "||i===" "){let o=r,n=t[r+1];for(;n===" "||n===" ";)n=t[++r+1];n!==`
90
+ `)for(o=t[++r+1];o===" "||o===" ";)o=t[++r+1];else if(o==="x"||o==="u"||o==="U"){let a=o==="x"?2:o==="u"?4:8;s+=gu(t,r+1,a,e),r+=a}else{let a=t.substr(r-1,2);e(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),s+=a}}else if(i===" "||i===" "){let o=r,n=t[r+1];for(;n===" "||n===" ";)n=t[++r+1];n!==`
91
91
  `&&!(n==="\r"&&t[r+2]===`
92
- `)&&(s+=r>o?t.slice(o,r+1):i)}else s+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),s}function mu(t,e){let s="",r=t[e+1];for(;(r===" "||r===" "||r===`
92
+ `)&&(s+=r>o?t.slice(o,r+1):i)}else s+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),s}function hu(t,e){let s="",r=t[e+1];for(;(r===" "||r===" "||r===`
93
93
  `||r==="\r")&&!(r==="\r"&&t[e+2]!==`
94
94
  `);)r===`
95
95
  `&&(s+=`
96
- `),e+=1,r=t[e+1];return s||(s=" "),{fold:s,offset:e}}var uu={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
97
- `,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function hu(t,e,s,r){let i=t.substr(e,s),n=i.length===s&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(n)}catch{let a=t.substr(e-2,s+2);return r(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}function Yl(t,e,s,r){let{value:i,type:o,comment:n,range:a}=e.type==="block-scalar"?Ul(t,e,r):Hl(e,t.options.strict,r),f=s?t.directives.tagName(s.source,l=>r(s,"TAG_RESOLVE_FAILED",l)):null,p;t.options.stringKeys&&t.atKey?p=t.schema[bn]:f?p=yu(t.schema,i,f,s,r):e.type==="scalar"?p=gu(t,i,e,r):p=t.schema[bn];let c;try{let l=p.resolve(i,d=>r(s??e,"TAG_RESOLVE_FAILED",d),t.options);c=Ge(l)?l:new Re(l)}catch(l){let d=l instanceof Error?l.message:String(l);r(s??e,"TAG_RESOLVE_FAILED",d),c=new Re(i)}return c.range=a,c.source=i,o&&(c.type=o),f&&(c.tag=f),p.format&&(c.format=p.format),n&&(c.comment=n),c}function yu(t,e,s,r,i){if(s==="!")return t[bn];let o=[];for(let a of t.tags)if(!a.collection&&a.tag===s)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let n=t.knownTags[s];return n&&!n.collection?(t.tags.push(Object.assign({},n,{default:!1,test:void 0})),n):(i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,s!=="tag:yaml.org,2002:str"),t[bn])}function gu({atKey:t,directives:e,schema:s},r,i,o){let n=s.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(r))||s[bn];if(s.compat){let a=s.compat.find(f=>f.default&&f.test?.test(r))??s[bn];if(n.tag!==a.tag){let f=e.tagString(n.tag),p=e.tagString(a.tag),c=`Value may be parsed as either ${f} or ${p}`;o(i,"TAG_RESOLVE_FAILED",c,!0)}}return n}function gd(t,e,s){if(e){s??(s=e.length);for(let r=s-1;r>=0;--r){let i=e[r];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++r];i?.type==="space";)t+=i.source.length,i=e[++r];break}}return t}var bu={composeNode:Wl,composeEmptyNode:Xo};function Wl(t,e,s,r){let i=t.atKey,{spaceBefore:o,comment:n,anchor:a,tag:f}=s,p,c=!0;switch(e.type){case"alias":p=wu(t,e,r),(a||f)&&r(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":p=Yl(t,e,f,r),a&&(p.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{p=hd(bu,t,e,s,r),a&&(p.anchor=a.source.substring(1))}catch(l){let d=l instanceof Error?l.message:String(l);r(e,"RESOURCE_EXHAUSTION",d)}break;default:{let l=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;r(e,"UNEXPECTED_TOKEN",l),c=!1}}return p??(p=Xo(t,e.offset,void 0,null,s,r)),a&&p.anchor===""&&r(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!Ge(p)||typeof p.value!="string"||p.tag&&p.tag!=="tag:yaml.org,2002:str")&&r(f??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(p.spaceBefore=!0),n&&(e.type==="scalar"&&e.source===""?p.comment=n:p.commentBefore=n),t.options.keepSourceTokens&&c&&(p.srcToken=e),p}function Xo(t,e,s,r,{spaceBefore:i,comment:o,anchor:n,tag:a,end:f},p){let c={type:"scalar",offset:gd(e,s,r),indent:-1,source:""},l=Yl(t,c,a,p);return n&&(l.anchor=n.source.substring(1),l.anchor===""&&p(n,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(l.spaceBefore=!0),o&&(l.comment=o,l.range[2]=f),l}function wu({options:t},{offset:e,source:s,end:r},i){let o=new bs(s.substring(1));o.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+s.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let n=e+s.length,a=cs(r,n,t.strict,i);return o.range=[e,n,a.offset],a.comment&&(o.comment=a.comment),o}function bd(t,e,{offset:s,start:r,value:i,end:o},n){let a=Object.assign({_directives:e},t),f=new Cs(void 0,a),p={atKey:!1,atRoot:!0,directives:f.directives,options:f.options,schema:f.schema},c=ls(r,{indicator:"doc-start",next:i??o?.[0],offset:s,onError:n,parentIndent:0,startOnNewline:!0});c.found&&(f.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!c.hasNewline&&n(c.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),f.contents=i?Wl(p,i,c,n):Xo(p,c.end,r,null,c,n);let l=f.contents.range[2],d=cs(o,l,!1,n);return d.comment&&(f.comment=d.comment),f.range=[s,l,d.offset],f}function Ai(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:s}=t;return[e,e+(typeof s=="string"?s.length:1)]}function wd(t){let e="",s=!1,r=!1;for(let i=0;i<t.length;++i){let o=t[i];switch(o[0]){case"#":e+=(e===""?"":r?`
96
+ `),e+=1,r=t[e+1];return s||(s=" "),{fold:s,offset:e}}var yu={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
97
+ `,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function gu(t,e,s,r){let i=t.substr(e,s),n=i.length===s&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(n)}catch{let a=t.substr(e-2,s+2);return r(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}function Xl(t,e,s,r){let{value:i,type:o,comment:n,range:a}=e.type==="block-scalar"?Wl(t,e,r):Jl(e,t.options.strict,r),f=s?t.directives.tagName(s.source,l=>r(s,"TAG_RESOLVE_FAILED",l)):null,p;t.options.stringKeys&&t.atKey?p=t.schema[bn]:f?p=bu(t.schema,i,f,s,r):e.type==="scalar"?p=wu(t,i,e,r):p=t.schema[bn];let c;try{let l=p.resolve(i,d=>r(s??e,"TAG_RESOLVE_FAILED",d),t.options);c=Ue(l)?l:new Ie(l)}catch(l){let d=l instanceof Error?l.message:String(l);r(s??e,"TAG_RESOLVE_FAILED",d),c=new Ie(i)}return c.range=a,c.source=i,o&&(c.type=o),f&&(c.tag=f),p.format&&(c.format=p.format),n&&(c.comment=n),c}function bu(t,e,s,r,i){if(s==="!")return t[bn];let o=[];for(let a of t.tags)if(!a.collection&&a.tag===s)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let n=t.knownTags[s];return n&&!n.collection?(t.tags.push(Object.assign({},n,{default:!1,test:void 0})),n):(i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,s!=="tag:yaml.org,2002:str"),t[bn])}function wu({atKey:t,directives:e,schema:s},r,i,o){let n=s.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(r))||s[bn];if(s.compat){let a=s.compat.find(f=>f.default&&f.test?.test(r))??s[bn];if(n.tag!==a.tag){let f=e.tagString(n.tag),p=e.tagString(a.tag),c=`Value may be parsed as either ${f} or ${p}`;o(i,"TAG_RESOLVE_FAILED",c,!0)}}return n}function xd(t,e,s){if(e){s??(s=e.length);for(let r=s-1;r>=0;--r){let i=e[r];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++r];i?.type==="space";)t+=i.source.length,i=e[++r];break}}return t}var xu={composeNode:Ql,composeEmptyNode:ta};function Ql(t,e,s,r){let i=t.atKey,{spaceBefore:o,comment:n,anchor:a,tag:f}=s,p,c=!0;switch(e.type){case"alias":p=ku(t,e,r),(a||f)&&r(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":p=Xl(t,e,f,r),a&&(p.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{p=bd(xu,t,e,s,r),a&&(p.anchor=a.source.substring(1))}catch(l){let d=l instanceof Error?l.message:String(l);r(e,"RESOURCE_EXHAUSTION",d)}break;default:{let l=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;r(e,"UNEXPECTED_TOKEN",l),c=!1}}return p??(p=ta(t,e.offset,void 0,null,s,r)),a&&p.anchor===""&&r(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!Ue(p)||typeof p.value!="string"||p.tag&&p.tag!=="tag:yaml.org,2002:str")&&r(f??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(p.spaceBefore=!0),n&&(e.type==="scalar"&&e.source===""?p.comment=n:p.commentBefore=n),t.options.keepSourceTokens&&c&&(p.srcToken=e),p}function ta(t,e,s,r,{spaceBefore:i,comment:o,anchor:n,tag:a,end:f},p){let c={type:"scalar",offset:xd(e,s,r),indent:-1,source:""},l=Xl(t,c,a,p);return n&&(l.anchor=n.source.substring(1),l.anchor===""&&p(n,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(l.spaceBefore=!0),o&&(l.comment=o,l.range[2]=f),l}function ku({options:t},{offset:e,source:s,end:r},i){let o=new bs(s.substring(1));o.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+s.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let n=e+s.length,a=cs(r,n,t.strict,i);return o.range=[e,n,a.offset],a.comment&&(o.comment=a.comment),o}function kd(t,e,{offset:s,start:r,value:i,end:o},n){let a=Object.assign({_directives:e},t),f=new Cs(void 0,a),p={atKey:!1,atRoot:!0,directives:f.directives,options:f.options,schema:f.schema},c=ls(r,{indicator:"doc-start",next:i??o?.[0],offset:s,onError:n,parentIndent:0,startOnNewline:!0});c.found&&(f.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!c.hasNewline&&n(c.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),f.contents=i?Ql(p,i,c,n):ta(p,c.end,r,null,c,n);let l=f.contents.range[2],d=cs(o,l,!1,n);return d.comment&&(f.comment=d.comment),f.range=[s,l,d.offset],f}function Ai(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:s}=t;return[e,e+(typeof s=="string"?s.length:1)]}function $d(t){let e="",s=!1,r=!1;for(let i=0;i<t.length;++i){let o=t[i];switch(o[0]){case"#":e+=(e===""?"":r?`
98
98
 
99
99
  `:`
100
- `)+(o.substring(1)||" "),s=!0,r=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),s=!1;break;default:s||(r=!0),s=!1}}return{comment:e,afterEmptyLine:r}}var Ti=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(s,r,i,o)=>{let n=Ai(s);o?this.warnings.push(new Pi(n,r,i)):this.errors.push(new Gn(n,r,i))},this.directives=new os({version:e.version||"1.2"}),this.options=e}decorate(e,s){let{comment:r,afterEmptyLine:i}=wd(this.prelude);if(r){let o=e.contents;if(s)e.comment=e.comment?`${e.comment}
101
- ${r}`:r;else if(i||e.directives.docStart||!o)e.commentBefore=r;else if(ct(o)&&!o.flow&&o.items.length>0){let n=o.items[0];Xe(n)&&(n=n.key);let a=n.commentBefore;n.commentBefore=a?`${r}
100
+ `)+(o.substring(1)||" "),s=!0,r=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),s=!1;break;default:s||(r=!0),s=!1}}return{comment:e,afterEmptyLine:r}}var Ti=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(s,r,i,o)=>{let n=Ai(s);o?this.warnings.push(new Pi(n,r,i)):this.errors.push(new Zn(n,r,i))},this.directives=new os({version:e.version||"1.2"}),this.options=e}decorate(e,s){let{comment:r,afterEmptyLine:i}=$d(this.prelude);if(r){let o=e.contents;if(s)e.comment=e.comment?`${e.comment}
101
+ ${r}`:r;else if(i||e.directives.docStart||!o)e.commentBefore=r;else if(pt(o)&&!o.flow&&o.items.length>0){let n=o.items[0];et(n)&&(n=n.key);let a=n.commentBefore;n.commentBefore=a?`${r}
102
102
  ${a}`:r}else{let n=o.commentBefore;o.commentBefore=n?`${r}
103
- ${n}`:r}}if(s){for(let o=0;o<this.errors.length;++o)e.errors.push(this.errors[o]);for(let o=0;o<this.warnings.length;++o)e.warnings.push(this.warnings[o])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:wd(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,s=!1,r=-1){for(let i of e)yield*this.next(i);yield*this.end(s,r)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(s,r,i)=>{let o=Ai(e);o[0]+=s,this.onError(o,"BAD_DIRECTIVE",r,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let s=bd(this.options,this.directives,e,this.onError);this.atDirectives&&!s.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(s,!1),this.doc&&(yield this.doc),this.doc=s,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let s=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,r=new Gn(Ai(e),"UNEXPECTED_TOKEN",s);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){let r="Unexpected doc-end without preceding document";this.errors.push(new Gn(Ai(e),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let s=cs(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),s.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
104
- ${s.comment}`:s.comment}this.doc.range[2]=s.offset;break}default:this.errors.push(new Gn(Ai(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,s=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let r=Object.assign({_directives:this.directives},this.options),i=new Cs(void 0,r);this.atDirectives&&this.onError(s,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,s,s],this.decorate(i,!1),yield i}}};var Jl=Symbol("break visit"),xu=Symbol("skip children"),xd=Symbol("remove item");function Xs(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),kd(Object.freeze([]),t,e)}Xs.BREAK=Jl;Xs.SKIP=xu;Xs.REMOVE=xd;Xs.itemAtPath=(t,e)=>{let s=t;for(let[r,i]of e){let o=s?.[r];if(o&&"items"in o)s=o.items[i];else return}return s};Xs.parentCollection=(t,e)=>{let s=Xs.itemAtPath(t,e.slice(0,-1)),r=e[e.length-1][0],i=s?.[r];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function kd(t,e,s){let r=s(e,t);if(typeof r=="symbol")return r;for(let i of["key","value"]){let o=e[i];if(o&&"items"in o){for(let n=0;n<o.items.length;++n){let a=kd(Object.freeze(t.concat([[i,n]])),o.items[n],s);if(typeof a=="number")n=a-1;else{if(a===Jl)return Jl;a===xd&&(o.items.splice(n,1),n-=1)}}typeof r=="function"&&i==="key"&&(r=r(e,t))}}return typeof r=="function"?r(e,t):r}var Xl="\uFEFF",Ql="",ec="",Qo="";function $d(t){switch(t){case Xl:return"byte-order-mark";case Ql:return"doc-mode";case ec:return"flow-error-end";case Qo:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
103
+ ${n}`:r}}if(s){for(let o=0;o<this.errors.length;++o)e.errors.push(this.errors[o]);for(let o=0;o<this.warnings.length;++o)e.warnings.push(this.warnings[o])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:$d(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,s=!1,r=-1){for(let i of e)yield*this.next(i);yield*this.end(s,r)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(s,r,i)=>{let o=Ai(e);o[0]+=s,this.onError(o,"BAD_DIRECTIVE",r,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let s=kd(this.options,this.directives,e,this.onError);this.atDirectives&&!s.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(s,!1),this.doc&&(yield this.doc),this.doc=s,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let s=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,r=new Zn(Ai(e),"UNEXPECTED_TOKEN",s);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){let r="Unexpected doc-end without preceding document";this.errors.push(new Zn(Ai(e),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let s=cs(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),s.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
104
+ ${s.comment}`:s.comment}this.doc.range[2]=s.offset;break}default:this.errors.push(new Zn(Ai(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,s=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let r=Object.assign({_directives:this.directives},this.options),i=new Cs(void 0,r);this.atDirectives&&this.onError(s,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,s,s],this.decorate(i,!1),yield i}}};var ec=Symbol("break visit"),$u=Symbol("skip children"),Sd=Symbol("remove item");function Xs(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),vd(Object.freeze([]),t,e)}Xs.BREAK=ec;Xs.SKIP=$u;Xs.REMOVE=Sd;Xs.itemAtPath=(t,e)=>{let s=t;for(let[r,i]of e){let o=s?.[r];if(o&&"items"in o)s=o.items[i];else return}return s};Xs.parentCollection=(t,e)=>{let s=Xs.itemAtPath(t,e.slice(0,-1)),r=e[e.length-1][0],i=s?.[r];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function vd(t,e,s){let r=s(e,t);if(typeof r=="symbol")return r;for(let i of["key","value"]){let o=e[i];if(o&&"items"in o){for(let n=0;n<o.items.length;++n){let a=vd(Object.freeze(t.concat([[i,n]])),o.items[n],s);if(typeof a=="number")n=a-1;else{if(a===ec)return ec;a===Sd&&(o.items.splice(n,1),n-=1)}}typeof r=="function"&&i==="key"&&(r=r(e,t))}}return typeof r=="function"?r(e,t):r}var tc="\uFEFF",nc="",sc="",na="";function Md(t){switch(t){case tc:return"byte-order-mark";case nc:return"doc-mode";case sc:return"flow-error-end";case na:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
105
105
  `:case`\r
106
- `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function Zn(t){switch(t){case void 0:case" ":case`
107
- `:case"\r":case" ":return!0;default:return!1}}var Sd=new Set("0123456789ABCDEFabcdef"),$u=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),ea=new Set(",[]{}"),Su=new Set(` ,[]{}
108
- \r `),tc=t=>!t||Su.has(t),Ei=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,s=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!s;let r=this.next??"stream";for(;r&&(s||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let e=this.pos,s=this.buffer[e];for(;s===" "||s===" ";)s=this.buffer[++e];return!s||s==="#"||s===`
106
+ `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function Un(t){switch(t){case void 0:case" ":case`
107
+ `:case"\r":case" ":return!0;default:return!1}}var Pd=new Set("0123456789ABCDEFabcdef"),vu=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),sa=new Set(",[]{}"),Mu=new Set(` ,[]{}
108
+ \r `),rc=t=>!t||Mu.has(t),Ei=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,s=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!s;let r=this.next??"stream";for(;r&&(s||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let e=this.pos,s=this.buffer[e];for(;s===" "||s===" ";)s=this.buffer[++e];return!s||s==="#"||s===`
109
109
  `?!0:s==="\r"?this.buffer[e+1]===`
110
110
  `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let s=this.buffer[e];if(this.indentNext>0){let r=0;for(;s===" ";)s=this.buffer[++r+e];if(s==="\r"){let i=this.buffer[r+e+1];if(i===`
111
111
  `||!i&&!this.atEnd)return e+r+1}return s===`
112
- `||r>=this.indentNext||!s&&!this.atEnd?e+r:-1}if(s==="-"||s==="."){let r=this.buffer.substr(e,3);if((r==="---"||r==="...")&&Zn(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
113
- `,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===Xl&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let s=e.length,r=e.indexOf("#");for(;r!==-1;){let o=e[r-1];if(o===" "||o===" "){s=r-1;break}else r=e.indexOf("#",r+1)}for(;;){let o=e[s-1];if(o===" "||o===" ")s-=1;else break}let i=(yield*this.pushCount(s))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){let s=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-s),yield*this.pushNewline(),"stream"}return yield Ql,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let s=this.peek(3);if((s==="---"||s==="...")&&Zn(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,s==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Zn(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,s]=this.peek(2);if(!s&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Zn(s)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let s=yield*this.pushIndicators();switch(e[s]){case"#":yield*this.pushCount(e.length-s);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(tc),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return s+=yield*this.parseBlockScalarHeader(),s+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-s),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,s,r=-1;do e=yield*this.pushNewline(),e>0?(s=yield*this.pushSpaces(!1),this.indentValue=r=s):s=0,s+=yield*this.pushSpaces(!0);while(e+s>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&i[0]!=="#"||r===0&&(i.startsWith("---")||i.startsWith("..."))&&Zn(i[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield ec,yield*this.parseLineStart();let o=0;for(;i[o]===",";)o+=yield*this.pushCount(1),o+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(o+=yield*this.pushIndicators(),i[o]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-o),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(tc),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let n=this.charAt(1);if(this.flowKey||Zn(n)||n===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),s=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;s!==-1&&this.buffer[s+1]==="'";)s=this.buffer.indexOf("'",s+2);else for(;s!==-1;){let o=0;for(;this.buffer[s-1-o]==="\\";)o+=1;if(o%2===0)break;s=this.buffer.indexOf('"',s+1)}let r=this.buffer.substring(0,s),i=r.indexOf(`
112
+ `||r>=this.indentNext||!s&&!this.atEnd?e+r:-1}if(s==="-"||s==="."){let r=this.buffer.substr(e,3);if((r==="---"||r==="...")&&Un(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
113
+ `,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===tc&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let s=e.length,r=e.indexOf("#");for(;r!==-1;){let o=e[r-1];if(o===" "||o===" "){s=r-1;break}else r=e.indexOf("#",r+1)}for(;;){let o=e[s-1];if(o===" "||o===" ")s-=1;else break}let i=(yield*this.pushCount(s))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){let s=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-s),yield*this.pushNewline(),"stream"}return yield nc,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let s=this.peek(3);if((s==="---"||s==="...")&&Un(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,s==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Un(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,s]=this.peek(2);if(!s&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Un(s)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let s=yield*this.pushIndicators();switch(e[s]){case"#":yield*this.pushCount(e.length-s);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(rc),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return s+=yield*this.parseBlockScalarHeader(),s+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-s),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,s,r=-1;do e=yield*this.pushNewline(),e>0?(s=yield*this.pushSpaces(!1),this.indentValue=r=s):s=0,s+=yield*this.pushSpaces(!0);while(e+s>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&i[0]!=="#"||r===0&&(i.startsWith("---")||i.startsWith("..."))&&Un(i[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield sc,yield*this.parseLineStart();let o=0;for(;i[o]===",";)o+=yield*this.pushCount(1),o+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(o+=yield*this.pushIndicators(),i[o]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-o),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(rc),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let n=this.charAt(1);if(this.flowKey||Un(n)||n===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),s=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;s!==-1&&this.buffer[s+1]==="'";)s=this.buffer.indexOf("'",s+2);else for(;s!==-1;){let o=0;for(;this.buffer[s-1-o]==="\\";)o+=1;if(o%2===0)break;s=this.buffer.indexOf('"',s+1)}let r=this.buffer.substring(0,s),i=r.indexOf(`
114
114
  `,this.pos);if(i!==-1){for(;i!==-1;){let o=this.continueScalar(i+1);if(o===-1)break;i=r.indexOf(`
115
- `,o)}i!==-1&&(s=i-(r[i-1]==="\r"?2:1))}if(s===-1){if(!this.atEnd)return this.setNext("quoted-scalar");s=this.buffer.length}return yield*this.pushToIndex(s+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let s=this.buffer[++e];if(s==="+")this.blockScalarKeep=!0;else if(s>"0"&&s<="9")this.blockScalarIndent=Number(s)-1;else if(s!=="-")break}return yield*this.pushUntil(s=>Zn(s)||s==="#")}*parseBlockScalar(){let e=this.pos-1,s=0,r;e:for(let o=this.pos;r=this.buffer[o];++o)switch(r){case" ":s+=1;break;case`
115
+ `,o)}i!==-1&&(s=i-(r[i-1]==="\r"?2:1))}if(s===-1){if(!this.atEnd)return this.setNext("quoted-scalar");s=this.buffer.length}return yield*this.pushToIndex(s+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let s=this.buffer[++e];if(s==="+")this.blockScalarKeep=!0;else if(s>"0"&&s<="9")this.blockScalarIndent=Number(s)-1;else if(s!=="-")break}return yield*this.pushUntil(s=>Un(s)||s==="#")}*parseBlockScalar(){let e=this.pos-1,s=0,r;e:for(let o=this.pos;r=this.buffer[o];++o)switch(r){case" ":s+=1;break;case`
116
116
  `:e=o,s=0;break;case"\r":{let n=this.buffer[o+1];if(!n&&!this.atEnd)return this.setNext("block-scalar");if(n===`
117
117
  `)break}default:break e}if(!r&&!this.atEnd)return this.setNext("block-scalar");if(s>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=s:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let o=this.continueScalar(e+1);if(o===-1)break;e=this.buffer.indexOf(`
118
118
  `,o)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let i=e+1;for(r=this.buffer[i];r===" ";)r=this.buffer[++i];if(r===" "){for(;r===" "||r===" "||r==="\r"||r===`
119
119
  `;)r=this.buffer[++i];e=i-1}else if(!this.blockScalarKeep)do{let o=e-1,n=this.buffer[o];n==="\r"&&(n=this.buffer[--o]);let a=o;for(;n===" ";)n=this.buffer[--o];if(n===`
120
- `&&o>=this.pos&&o+1+s>a)e=o;else break}while(!0);return yield Qo,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,s=this.pos-1,r=this.pos-1,i;for(;i=this.buffer[++r];)if(i===":"){let o=this.buffer[r+1];if(Zn(o)||e&&ea.has(o))break;s=r}else if(Zn(i)){let o=this.buffer[r+1];if(i==="\r"&&(o===`
120
+ `&&o>=this.pos&&o+1+s>a)e=o;else break}while(!0);return yield na,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,s=this.pos-1,r=this.pos-1,i;for(;i=this.buffer[++r];)if(i===":"){let o=this.buffer[r+1];if(Un(o)||e&&sa.has(o))break;s=r}else if(Un(i)){let o=this.buffer[r+1];if(i==="\r"&&(o===`
121
121
  `?(r+=1,i=`
122
- `,o=this.buffer[r+1]):s=r),o==="#"||e&&ea.has(o))break;if(i===`
123
- `){let n=this.continueScalar(r+1);if(n===-1)break;r=Math.max(r,n-2)}}else{if(e&&ea.has(i))break;s=r}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Qo,yield*this.pushToIndex(s+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,s){let r=this.buffer.slice(this.pos,e);return r?(yield r,this.pos+=r.length,r.length):(s&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(tc),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let s=this.flowLevel>0,r=this.charAt(1);if(Zn(r)||s&&ea.has(r)){s?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,s=this.buffer[e];for(;!Zn(s)&&s!==">";)s=this.buffer[++e];return yield*this.pushToIndex(s===">"?e+1:e,!1)}else{let e=this.pos+1,s=this.buffer[e];for(;s;)if($u.has(s))s=this.buffer[++e];else if(s==="%"&&Sd.has(this.buffer[e+1])&&Sd.has(this.buffer[e+2]))s=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
122
+ `,o=this.buffer[r+1]):s=r),o==="#"||e&&sa.has(o))break;if(i===`
123
+ `){let n=this.continueScalar(r+1);if(n===-1)break;r=Math.max(r,n-2)}}else{if(e&&sa.has(i))break;s=r}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield na,yield*this.pushToIndex(s+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,s){let r=this.buffer.slice(this.pos,e);return r?(yield r,this.pos+=r.length,r.length):(s&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(rc),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let s=this.flowLevel>0,r=this.charAt(1);if(Un(r)||s&&sa.has(r)){s?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,s=this.buffer[e];for(;!Un(s)&&s!==">";)s=this.buffer[++e];return yield*this.pushToIndex(s===">"?e+1:e,!1)}else{let e=this.pos+1,s=this.buffer[e];for(;s;)if(vu.has(s))s=this.buffer[++e];else if(s==="%"&&Pd.has(this.buffer[e+1])&&Pd.has(this.buffer[e+2]))s=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
124
124
  `?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
125
- `?yield*this.pushCount(2):0}*pushSpaces(e){let s=this.pos-1,r;do r=this.buffer[++s];while(r===" "||e&&r===" ");let i=s-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=s),i}*pushUntil(e){let s=this.pos,r=this.buffer[s];for(;!e(r);)r=this.buffer[++s];return yield*this.pushToIndex(s,!1)}};var Qs=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let s=0,r=this.lineStarts.length;for(;s<r;){let o=s+r>>1;this.lineStarts[o]<e?s=o+1:r=o}if(this.lineStarts[s]===e)return{line:s+1,col:1};if(s===0)return{line:0,col:e};let i=this.lineStarts[s-1];return{line:s,col:e-i+1}}}};function Ls(t,e){for(let s=0;s<t.length;++s)if(t[s].type===e)return!0;return!1}function vd(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function Pd(t){switch(t?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function ta(t){switch(t.type){case"document":return t.start;case"block-map":{let e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function Ar(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function na(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let s=0;s<e.length;++s)t.push(e[s])}function Md(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!Ls(e.start,"explicit-key-ind")&&!Ls(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,Pd(e.value)?e.value.end?na(e.value.end,e.sep):e.value.end=e.sep:na(e.start,e.sep),delete e.sep)}var Ni=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Ei,this.onNewLine=e}*parse(e,s=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(e,s))yield*this.next(r);s||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let s=$d(e);if(s)if(s==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=s,yield*this.step(),s){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let r=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let s=e??this.stack.pop();if(!s)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield s;else{let r=this.peek(1);switch(s.type==="block-scalar"?s.indent="indent"in r?r.indent:0:s.type==="flow-collection"&&r.type==="document"&&(s.indent=0),s.type==="flow-collection"&&Md(s),r.type){case"document":r.value=s;break;case"block-scalar":r.props.push(s);break;case"block-map":{let i=r.items[r.items.length-1];if(i.value){r.items.push({start:[],key:s,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=s;else{Object.assign(i,{key:s,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=r.items[r.items.length-1];i.value?r.items.push({start:[],value:s}):i.value=s;break}case"flow-collection":{let i=r.items[r.items.length-1];!i||i.value?r.items.push({start:[],key:s,sep:[]}):i.sep?i.value=s:Object.assign(i,{key:s,sep:[]});return}default:yield*this.pop(),yield*this.pop(s)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(s.type==="block-map"||s.type==="block-seq")){let i=s.items[s.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&vd(i.start)===-1&&(s.indent===0||i.start.every(o=>o.type!=="comment"||o.indent<s.indent))&&(r.type==="document"?r.end=i.start:r.items.push({start:i.start}),s.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{vd(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let s=this.startBlockValue(e);s?this.stack.push(s):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let s=ta(this.peek(2)),r=Ar(s),i;e.end?(i=e.end,i.push(this.sourceToken),delete e.end):i=[this.sourceToken];let o={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let s=this.source.indexOf(`
125
+ `?yield*this.pushCount(2):0}*pushSpaces(e){let s=this.pos-1,r;do r=this.buffer[++s];while(r===" "||e&&r===" ");let i=s-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=s),i}*pushUntil(e){let s=this.pos,r=this.buffer[s];for(;!e(r);)r=this.buffer[++s];return yield*this.pushToIndex(s,!1)}};var Qs=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let s=0,r=this.lineStarts.length;for(;s<r;){let o=s+r>>1;this.lineStarts[o]<e?s=o+1:r=o}if(this.lineStarts[s]===e)return{line:s+1,col:1};if(s===0)return{line:0,col:e};let i=this.lineStarts[s-1];return{line:s,col:e-i+1}}}};function Ls(t,e){for(let s=0;s<t.length;++s)if(t[s].type===e)return!0;return!1}function Od(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function Td(t){switch(t?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function ra(t){switch(t.type){case"document":return t.start;case"block-map":{let e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function Ar(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function ia(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let s=0;s<e.length;++s)t.push(e[s])}function Ad(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!Ls(e.start,"explicit-key-ind")&&!Ls(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,Td(e.value)?e.value.end?ia(e.value.end,e.sep):e.value.end=e.sep:ia(e.start,e.sep),delete e.sep)}var Ni=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Ei,this.onNewLine=e}*parse(e,s=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(e,s))yield*this.next(r);s||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let s=Md(e);if(s)if(s==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=s,yield*this.step(),s){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let r=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let s=e??this.stack.pop();if(!s)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield s;else{let r=this.peek(1);switch(s.type==="block-scalar"?s.indent="indent"in r?r.indent:0:s.type==="flow-collection"&&r.type==="document"&&(s.indent=0),s.type==="flow-collection"&&Ad(s),r.type){case"document":r.value=s;break;case"block-scalar":r.props.push(s);break;case"block-map":{let i=r.items[r.items.length-1];if(i.value){r.items.push({start:[],key:s,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=s;else{Object.assign(i,{key:s,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=r.items[r.items.length-1];i.value?r.items.push({start:[],value:s}):i.value=s;break}case"flow-collection":{let i=r.items[r.items.length-1];!i||i.value?r.items.push({start:[],key:s,sep:[]}):i.sep?i.value=s:Object.assign(i,{key:s,sep:[]});return}default:yield*this.pop(),yield*this.pop(s)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(s.type==="block-map"||s.type==="block-seq")){let i=s.items[s.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&Od(i.start)===-1&&(s.indent===0||i.start.every(o=>o.type!=="comment"||o.indent<s.indent))&&(r.type==="document"?r.end=i.start:r.items.push({start:i.start}),s.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{Od(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let s=this.startBlockValue(e);s?this.stack.push(s):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let s=ra(this.peek(2)),r=Ar(s),i;e.end?(i=e.end,i.push(this.sourceToken),delete e.end):i=[this.sourceToken];let o={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let s=this.source.indexOf(`
126
126
  `)+1;for(;s!==0;)this.onNewLine(this.offset+s),s=this.source.indexOf(`
127
- `,s)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let s=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,s.value){let r="end"in s.value?s.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else s.sep?s.sep.push(this.sourceToken):s.start.push(this.sourceToken);return;case"space":case"comment":if(s.value)e.items.push({start:[this.sourceToken]});else if(s.sep)s.sep.push(this.sourceToken);else{if(this.atIndentedComment(s.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){na(i,s.start),i.push(this.sourceToken),e.items.pop();return}}s.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let r=!this.onKeyLine&&this.indent===e.indent,i=r&&(s.sep||s.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&s.sep&&!s.value){let n=[];for(let a=0;a<s.sep.length;++a){let f=s.sep[a];switch(f.type){case"newline":n.push(a);break;case"space":break;case"comment":f.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(o=s.sep.splice(n[1]))}switch(this.type){case"anchor":case"tag":i||s.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):s.sep?s.sep.push(this.sourceToken):s.start.push(this.sourceToken);return;case"explicit-key-ind":!s.sep&&!s.explicitKey?(s.start.push(this.sourceToken),s.explicitKey=!0):i||s.value?(o.push(this.sourceToken),e.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(s.explicitKey)if(s.sep)if(s.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ls(s.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(Pd(s.key)&&!Ls(s.sep,"newline")){let n=Ar(s.start),a=s.key,f=s.sep;f.push(this.sourceToken),delete s.key,delete s.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:a,sep:f}]})}else o.length>0?s.sep=s.sep.concat(o,this.sourceToken):s.sep.push(this.sourceToken);else if(Ls(s.start,"newline"))Object.assign(s,{key:null,sep:[this.sourceToken]});else{let n=Ar(s.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]})}else s.sep?s.value||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):Ls(s.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):s.sep.push(this.sourceToken):Object.assign(s,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let n=this.flowScalar(this.type);i||s.value?(e.items.push({start:o,key:n,sep:[]}),this.onKeyLine=!0):s.sep?this.stack.push(n):(Object.assign(s,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let n=this.startBlockValue(e);if(n){if(n.type==="block-seq"){if(!s.explicitKey&&s.sep&&!Ls(s.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&e.items.push({start:o});this.stack.push(n);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let s=e.items[e.items.length-1];switch(this.type){case"newline":if(s.value){let r="end"in s.value?s.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else s.start.push(this.sourceToken);return;case"space":case"comment":if(s.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(s.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){na(i,s.start),i.push(this.sourceToken),e.items.pop();return}}s.start.push(this.sourceToken)}return;case"anchor":case"tag":if(s.value||this.indent<=e.indent)break;s.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;s.value||Ls(s.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):s.start.push(this.sourceToken);return}if(this.indent>e.indent){let r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let s=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!s||s.sep?e.items.push({start:[this.sourceToken]}):s.start.push(this.sourceToken);return;case"map-value-ind":!s||s.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):s.sep?s.sep.push(this.sourceToken):Object.assign(s,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!s||s.value?e.items.push({start:[this.sourceToken]}):s.sep?s.sep.push(this.sourceToken):s.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!s||s.value?e.items.push({start:[],key:i,sep:[]}):s.sep?this.stack.push(i):Object.assign(s,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let r=this.startBlockValue(e);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let i=ta(r),o=Ar(i);Md(e);let n=e.end.splice(1,e.end.length);n.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let s=this.source.indexOf(`
127
+ `,s)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let s=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,s.value){let r="end"in s.value?s.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else s.sep?s.sep.push(this.sourceToken):s.start.push(this.sourceToken);return;case"space":case"comment":if(s.value)e.items.push({start:[this.sourceToken]});else if(s.sep)s.sep.push(this.sourceToken);else{if(this.atIndentedComment(s.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){ia(i,s.start),i.push(this.sourceToken),e.items.pop();return}}s.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let r=!this.onKeyLine&&this.indent===e.indent,i=r&&(s.sep||s.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&s.sep&&!s.value){let n=[];for(let a=0;a<s.sep.length;++a){let f=s.sep[a];switch(f.type){case"newline":n.push(a);break;case"space":break;case"comment":f.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(o=s.sep.splice(n[1]))}switch(this.type){case"anchor":case"tag":i||s.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):s.sep?s.sep.push(this.sourceToken):s.start.push(this.sourceToken);return;case"explicit-key-ind":!s.sep&&!s.explicitKey?(s.start.push(this.sourceToken),s.explicitKey=!0):i||s.value?(o.push(this.sourceToken),e.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(s.explicitKey)if(s.sep)if(s.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ls(s.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(Td(s.key)&&!Ls(s.sep,"newline")){let n=Ar(s.start),a=s.key,f=s.sep;f.push(this.sourceToken),delete s.key,delete s.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:a,sep:f}]})}else o.length>0?s.sep=s.sep.concat(o,this.sourceToken):s.sep.push(this.sourceToken);else if(Ls(s.start,"newline"))Object.assign(s,{key:null,sep:[this.sourceToken]});else{let n=Ar(s.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]})}else s.sep?s.value||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):Ls(s.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):s.sep.push(this.sourceToken):Object.assign(s,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let n=this.flowScalar(this.type);i||s.value?(e.items.push({start:o,key:n,sep:[]}),this.onKeyLine=!0):s.sep?this.stack.push(n):(Object.assign(s,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let n=this.startBlockValue(e);if(n){if(n.type==="block-seq"){if(!s.explicitKey&&s.sep&&!Ls(s.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&e.items.push({start:o});this.stack.push(n);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let s=e.items[e.items.length-1];switch(this.type){case"newline":if(s.value){let r="end"in s.value?s.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else s.start.push(this.sourceToken);return;case"space":case"comment":if(s.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(s.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){ia(i,s.start),i.push(this.sourceToken),e.items.pop();return}}s.start.push(this.sourceToken)}return;case"anchor":case"tag":if(s.value||this.indent<=e.indent)break;s.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;s.value||Ls(s.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):s.start.push(this.sourceToken);return}if(this.indent>e.indent){let r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let s=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!s||s.sep?e.items.push({start:[this.sourceToken]}):s.start.push(this.sourceToken);return;case"map-value-ind":!s||s.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):s.sep?s.sep.push(this.sourceToken):Object.assign(s,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!s||s.value?e.items.push({start:[this.sourceToken]}):s.sep?s.sep.push(this.sourceToken):s.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!s||s.value?e.items.push({start:[],key:i,sep:[]}):s.sep?this.stack.push(i):Object.assign(s,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let r=this.startBlockValue(e);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let i=ra(r),o=Ar(i);Ad(e);let n=e.end.splice(1,e.end.length);n.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let s=this.source.indexOf(`
128
128
  `)+1;for(;s!==0;)this.onNewLine(this.offset+s),s=this.source.indexOf(`
129
- `,s)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let s=ta(e),r=Ar(s);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let s=ta(e),r=Ar(s);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,s){return this.type!=="comment"||this.indent<=s?!1:e.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};function vu(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Qs||null,prettyErrors:e}}function sa(t,e={}){let{lineCounter:s,prettyErrors:r}=vu(e),i=new Ni(s?.addNewLine),o=new Ti(e),n=null;for(let a of o.compose(i.parse(t),!0,t.length))if(!n)n=a;else if(n.options.logLevel!=="silent"){n.errors.push(new Gn(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&s&&(n.errors.forEach(Vl(t,s)),n.warnings.forEach(Vl(t,s))),n}function nc(t,e,s){let r;typeof e=="function"?r=e:s===void 0&&e&&typeof e=="object"&&(s=e);let i=sa(t,s);if(!i)return null;if(i.warnings.forEach(o=>Io(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},s))}function Tr(t){let e=nc(t);for(let s of["light","dark","kinds","roles"])if(!e||typeof e[s]!="object")throw new Error(`theme: missing "${s}"`);return e}function _s(t,e={},s={}){let r={...t.kinds};for(let[i,o]of Object.entries(s)){let n=r[o.like??i]??r.control;r[i]={color:o.color??n.color,dash:o.dash??n.dash,legend:o.legend??n.legend}}return{...t,roles:{...t.roles,...e},kinds:r}}var Od=t=>Object.entries(t).map(([e,s])=>`--${e}:${s}`).join(";");function Un(t,e){return e in t.light?`var(--${e})`:e}function ra(t){let{light:e,dark:s,rest:r}=Ri(t);return`:root{${e}}
129
+ `,s)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let s=ra(e),r=Ar(s);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let s=ra(e),r=Ar(s);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,s){return this.type!=="comment"||this.indent<=s?!1:e.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};function Pu(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Qs||null,prettyErrors:e}}function oa(t,e={}){let{lineCounter:s,prettyErrors:r}=Pu(e),i=new Ni(s?.addNewLine),o=new Ti(e),n=null;for(let a of o.compose(i.parse(t),!0,t.length))if(!n)n=a;else if(n.options.logLevel!=="silent"){n.errors.push(new Zn(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&s&&(n.errors.forEach(Zl(t,s)),n.warnings.forEach(Zl(t,s))),n}function ic(t,e,s){let r;typeof e=="function"?r=e:s===void 0&&e&&typeof e=="object"&&(s=e);let i=oa(t,s);if(!i)return null;if(i.warnings.forEach(o=>jo(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},s))}function Tr(t){let e=ic(t);for(let s of["light","dark","kinds","roles"])if(!e||typeof e[s]!="object")throw new Error(`theme: missing "${s}"`);return e}function _s(t,e={},s={}){let r={...t.kinds};for(let[i,o]of Object.entries(s)){let n=r[o.like??i]??r.control;r[i]={color:o.color??n.color,dash:o.dash??n.dash,legend:o.legend??n.legend}}return{...t,roles:{...t.roles,...e},kinds:r}}var Ed=t=>Object.entries(t).map(([e,s])=>`--${e}:${s}`).join(";");function Hn(t,e){return e in t.light?`var(--${e})`:e}function aa(t){let{light:e,dark:s,rest:r}=Ri(t);return`:root{${e}}
130
130
  @media (prefers-color-scheme: dark){:root:not([data-theme="light"]){${s}}}
131
131
  :root[data-theme="dark"]{${s}}
132
132
  ${r}`}function Ri(t){let e="";for(let[s,r]of Object.entries(t.roles))e+=`.k-${s}{--h:${r.h};--s:${r.s}%}`,r.top?e+=`.k-${s} .top{fill:${r.top}}`:r.tint&&(e+=`.k-${s} .top{fill:color-mix(in srgb,hsl(${r.h} ${Math.min(100,r.s+15)}% 50%) ${r.tint}%,var(--pad-top))}`),e+=`
133
- `;for(let[s,r]of Object.entries(t.kinds)){let i=Un(t,r.color),o=r.dash==="dashed"?";stroke-dasharray:7 6;stroke-width:2.4":r.dash==="dotted"?";stroke-dasharray:3 6;stroke-width:2.4":"";e+=`.f-${s}{stroke:${i}${o}} .t-${s}{fill:${i}} .c-${s}{--c:${i}}
134
- `}return{light:Od(t.light),dark:Od(t.dark),rest:e}}var ia=class extends Error{diags;constructor(e){super(e.map(s=>`${s.line}:${s.col} ${s.message}`).join(`
135
- `)),this.diags=e}};function sc(t,e){let s=t.length,r=e.length;if(!s)return r;if(!r)return s;let i=Array.from({length:s+1},(o,n)=>[n,...Array(r).fill(0)]);for(let o=0;o<=r;o++)i[0][o]=o;for(let o=1;o<=s;o++)for(let n=1;n<=r;n++){let a=t[o-1]===e[n-1]?0:1;i[o][n]=Math.min(i[o-1][n]+1,i[o][n-1]+1,i[o-1][n-1]+a),o>1&&n>1&&t[o-1]===e[n-2]&&t[o-2]===e[n-1]&&(i[o][n]=Math.min(i[o][n],i[o-2][n-2]+1))}return i[s][r]}function Vt(t,e){let s,r=1/0,i=t.toLowerCase();for(let n of e){let a=sc(i,n.toLowerCase());a<r&&(r=a,s=n)}if(s===void 0)return;let o=Math.max(1,Math.min(3,Math.floor(Math.max(t.length,s.length)/3)));return r<=o?s:void 0}function rc(t,e,s){t.file&&(e=t.file,s=t.source);let i=`${t.line?`${e}:${t.line}:${t.col}`:e} ${t.severity}: ${t.message}`;if(t.hint&&(i+=`
133
+ `;for(let[s,r]of Object.entries(t.kinds)){let i=Hn(t,r.color),o=r.dash==="dashed"?";stroke-dasharray:7 6;stroke-width:2.4":r.dash==="dotted"?";stroke-dasharray:3 6;stroke-width:2.4":"";e+=`.f-${s}{stroke:${i}${o}} .t-${s}{fill:${i}} .c-${s}{--c:${i}}
134
+ `}return{light:Ed(t.light),dark:Ed(t.dark),rest:e}}var la=class extends Error{diags;constructor(e){super(e.map(s=>`${s.line}:${s.col} ${s.message}`).join(`
135
+ `)),this.diags=e}};function oc(t,e){let s=t.length,r=e.length;if(!s)return r;if(!r)return s;let i=Array.from({length:s+1},(o,n)=>[n,...Array(r).fill(0)]);for(let o=0;o<=r;o++)i[0][o]=o;for(let o=1;o<=s;o++)for(let n=1;n<=r;n++){let a=t[o-1]===e[n-1]?0:1;i[o][n]=Math.min(i[o-1][n]+1,i[o][n-1]+1,i[o-1][n-1]+a),o>1&&n>1&&t[o-1]===e[n-2]&&t[o-2]===e[n-1]&&(i[o][n]=Math.min(i[o][n],i[o-2][n-2]+1))}return i[s][r]}function Vt(t,e){let s,r=1/0,i=t.toLowerCase();for(let n of e){let a=oc(i,n.toLowerCase());a<r&&(r=a,s=n)}if(s===void 0)return;let o=Math.max(1,Math.min(3,Math.floor(Math.max(t.length,s.length)/3)));return r<=o?s:void 0}function ac(t,e,s){t.file&&(e=t.file,s=t.source);let i=`${t.line?`${e}:${t.line}:${t.col}`:e} ${t.severity}: ${t.message}`;if(t.hint&&(i+=`
136
136
  ${t.hint}`),s&&t.line){let n=s.split(/\r?\n/)[t.line-1]??"",a=String(t.line).padStart(4);i+=`
137
137
  ${a} | ${n}
138
- ${" ".repeat(a.length)} | ${" ".repeat(Math.max(0,t.col-1))}^`}return i}function Ad(t,e,s){return t.map(r=>rc(r,e,s)).join(`
138
+ ${" ".repeat(a.length)} | ${" ".repeat(Math.max(0,t.col-1))}^`}return i}function Nd(t,e,s){return t.map(r=>ac(r,e,s)).join(`
139
139
 
140
- `)}function Td(t){return t.split("/").slice(1).map(e=>{let s=e.replace(/~1/g,"/").replace(/~0/g,"~");return/^\d+$/.test(s)?Number(s):s})}function oa(t){let e=new Qs,s=sa(t,{lineCounter:e,prettyErrors:!1,uniqueKeys:!0}),r=[],i=f=>{let p=e.linePos(f);return{line:p.line,col:p.col}};for(let f of s.errors){let p=i(f.pos[0]),c=f.message.split(`
140
+ `)}function Rd(t){return t.split("/").slice(1).map(e=>{let s=e.replace(/~1/g,"/").replace(/~0/g,"~");return/^\d+$/.test(s)?Number(s):s})}function ca(t){let e=new Qs,s=oa(t,{lineCounter:e,prettyErrors:!1,uniqueKeys:!0}),r=[],i=f=>{let p=e.linePos(f);return{line:p.line,col:p.col}};for(let f of s.errors){let p=i(f.pos[0]),c=f.message.split(`
141
141
  `)[0],l=/Nested mappings|Implicit keys|mapping values/i.test(c)?`text that contains ": " (a colon followed by a blank) must be in quotes, e.g. command: 'send "a: b"'`:/Map keys must be unique/i.test(c)?"a key is written twice in the same map":void 0;r.push({severity:"error",message:`YAML: ${c}`,line:p.line,col:p.col,path:"",hint:l})}for(let f of s.warnings){let p=i(f.pos[0]);r.push({severity:"warning",message:`YAML: ${f.message.split(`
142
- `)[0]}`,line:p.line,col:p.col,path:""})}function o(f,p={}){let c=Td(f),l=s.contents,d={line:1,col:1},m=h=>{let y=h?.range;y&&(d=i(y[0]))};m(l);for(let h=0;h<c.length;h++){let y=c[h];if(pn(l)){let g=l.items.find(k=>Xe(k)&&Ge(k.key)&&String(k.key.value)===String(y));if(!g)break;if(p.key&&h===c.length-1)return m(g.key),d;m(g.key),l=g.value,l&&m(l)}else if(dn(l)&&typeof y=="number"){if(l=l.items[y],!l)break;m(l)}else break}return d}function n(f){let p=s.contents;for(let m of Td(f)){if(pn(p)){let h=p.items.find(y=>Xe(y)&&Ge(y.key)&&String(y.key.value)===String(m));if(!h)return;p=h.value}else if(dn(p)&&typeof m=="number")p=p.items[m];else return;if(!p)return}let c=p.range;if(!c)return;let l=e.linePos(Math.max(c[0],c[1]-1)).line,d=t.split(/\r?\n/);for(;l>e.linePos(c[0]).line&&/^\s*(#.*)?$/.test(d[l-1]??"");)l--;return{start:e.linePos(c[0]).line,end:l}}let a=null;return s.errors.length||(a=s.toJS({maxAliasCount:100})),{data:a,locate:o,span:n,diags:r}}var Pu=new Set(["svg","g","defs","marker","symbol","title","desc","path","polygon","polyline","line","rect","circle","ellipse","text","tspan","linearGradient","radialGradient","stop","clipPath"]),Ou=new Set(["id","class","role","transform","viewBox","width","height","x","y","x1","y1","x2","y2","cx","cy","r","rx","ry","fx","fy","d","points","offset","gradientUnits","gradientTransform","markerWidth","markerHeight","refX","refY","orient","markerUnits","text-anchor","dominant-baseline","font-size","font-weight","letter-spacing","fill","stroke","stroke-width","stroke-dasharray","stroke-linecap","stroke-linejoin","opacity","fill-opacity","stroke-opacity","stop-color","stop-opacity","marker-start","marker-mid","marker-end","clip-path","preserveAspectRatio","vector-effect","paint-order","style"]),Au=new Set(["fill","stroke","marker-start","marker-mid","marker-end","clip-path","style"]),Tu={amp:"&",lt:"<",gt:">",quot:'"',apos:"'","#39":"'"},Ed=t=>t.replace(/&(amp|lt|gt|quot|apos|#39);/g,(e,s)=>Tu[s]);function ic(t,e){return t.startsWith("data-")||t.startsWith("aria-")?/^[a-z][\w-]*$/.test(t):!(!Ou.has(t)||Au.has(t)&&/url\(\s*(?!['"]?#)|javascript:|expression\(|@import/i.test(e))}function oc(t){let e={name:"#root",attrs:[],children:[]},s=[{node:e,dropped:!1}],r=/<(?:!--)[\s\S]*?-->|<\/([a-zA-Z][\w:-]*)\s*>|<([a-zA-Z][\w:-]*)((?:\s+[\w:-]+="[^"]*")*)\s*(\/?)>|([^<]+)/g,i,o=0;for(;i=r.exec(t);){if(i.index!==o)throw new Error(`not the renderer's SVG at ${o}: ${JSON.stringify(t.slice(o,o+40))}`);o=r.lastIndex;let n=s[s.length-1];if(i[0].charAt(1)!=="!"){if(i[1]){if(s.length<2||n.node.name!==i[1])throw new Error(`a stray </${i[1]}>`);s.pop();continue}if(i[2]){let a=i[2],f=[];for(let l of i[3].matchAll(/([\w:-]+)="([^"]*)"/g)){let d=l[1],m=Ed(l[2]);d==="xmlns"||d.startsWith("xmlns:")||ic(d,m)&&f.push([d,m])}let p={name:a,attrs:f,children:[]},c=n.dropped||!Pu.has(a);c||n.node.children.push(p),i[4]||s.push({node:p,dropped:c});continue}!n.dropped&&i[5].trim()&&n.node.children.push(Ed(i[5]))}}if(o!==t.length)throw new Error(`not the renderer's SVG at ${o}`);if(s.length!==1)throw new Error(`<${s[s.length-1].node.name}> is never closed`);return e}var Eu="http://www.w3.org/2000/svg",Nd=t=>t.replace(/var\(--([a-zA-Z][\w-]*)/g,"var(--iso-$1");function Rd(t,e=document){let s=i=>{let o=e.createElementNS(Eu,i.name);for(let[n,a]of i.attrs)n==="style"?o.style.cssText=Nd(a):o.setAttribute(n,/var\(--/.test(a)?Nd(a):a);for(let n of i.children)o.append(typeof n=="string"?e.createTextNode(n):s(n));return o},r=oc(t).children.find(i=>typeof i!="string"&&i.name==="svg");if(!r)throw new Error("the drawing has no <svg>");return s(r)}var Nu=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),Ii=class t{name;attrs=[];children=[];style={};constructor(e){this.name=e}setAttribute(e,s){let r=this.attrs.findIndex(i=>i[0]===e);r>=0?this.attrs[r][1]=String(s):this.attrs.push([e,String(s)])}getAttribute(e){return this.attrs.find(s=>s[0]===e)?.[1]??null}append(...e){for(let s of e)s!=null&&this.children.push(s)}set textContent(e){this.children=[String(e)]}get textContent(){return this.children.map(e=>typeof e=="string"?e:e.textContent).join("")}toNode(){let e=Object.entries(this.style).filter(([,s])=>s!==""&&s!==void 0).map(([s,r])=>`${Nu(s)}:${r}`).join(";");return{name:this.name,attrs:e?[...this.attrs,["style",e]]:[...this.attrs],children:this.children.map(s=>s instanceof t?s.toNode():s)}}},Id={createElementNS:(t,e)=>new Ii(e)},zd=t=>t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),Ru=t=>zd(t).replace(/"/g,"&quot;");function aa(t,e=new Set(["style"])){if(typeof t=="string")return zd(t);let s=t.attrs.map(([i,o])=>` ${i}="${Ru(o)}"`).join("");if(!t.children.length)return`<${t.name}${s}/>`;let r=e.has(t.name)?t.children.map(i=>typeof i=="string"?i.replace(/<\//g,"<\\/"):aa(i,e)).join(""):t.children.map(i=>aa(i,e)).join("");return`<${t.name}${s}>${r}</${t.name}>`}var Iu=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function ac(t){let e=new TextEncoder().encode(t),s=e.length,r=Math.ceil((s+9)/64),i=new Uint8Array(r*64);i.set(e),i[s]=128;let o=new DataView(i.buffer);o.setUint32(i.length-4,s*8>>>0),o.setUint32(i.length-8,Math.floor(s/536870912));let n=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),a=new Uint32Array(64),f=(p,c)=>p>>>c|p<<32-c;for(let p=0;p<r;p++){for(let u=0;u<16;u++)a[u]=o.getUint32(p*64+u*4);for(let u=16;u<64;u++){let b=f(a[u-15],7)^f(a[u-15],18)^a[u-15]>>>3,x=f(a[u-2],17)^f(a[u-2],19)^a[u-2]>>>10;a[u]=a[u-16]+b+a[u-7]+x>>>0}let[c,l,d,m,h,y,g,k]=n;for(let u=0;u<64;u++){let b=k+(f(h,6)^f(h,11)^f(h,25))+(h&y^~h&g)+Iu[u]+a[u]>>>0,x=(f(c,2)^f(c,13)^f(c,22))+(c&l^c&d^l&d)>>>0;k=g,g=y,y=h,h=m+b>>>0,m=d,d=l,l=c,c=b+x>>>0}n[0]+=c,n[1]+=l,n[2]+=d,n[3]+=m,n[4]+=h,n[5]+=y,n[6]+=g,n[7]+=k}return[...n].map(p=>p.toString(16).padStart(8,"0")).join("")}function Cd(t){if(t!=="sha256")throw new Error(`only sha256 here, not ${t}`);let e="",s={update(r){return e+=r,s},digest(r){return ac(e)}};return s}var Ld=t=>{if(t&&typeof t=="object"){Object.freeze(t);for(let e of Object.values(t))Ld(e)}return t},la=[86,81,76],zu=["send","reply","token","blocked","user","event","control","planned"],tn=Ld({light:{paper:"#ffffff",ink:"#141414",steps:[{top:"#f4f4f4",left:"#dcdcdc",right:"#c4c4c4",edge:"#3a3a3a"},{top:"#dedede",left:"#bfbfbf",right:"#a2a2a2",edge:"#2e2e2e"},{top:"#bcbcbc",left:"#9a9a9a",right:"#7e7e7e",edge:"#222222"},{top:"#8f8f8f",left:"#707070",right:"#565656",edge:"#141414"}]},dark:{paper:"#161616",ink:"#f2f2f2",steps:[{top:"#2a2a2a",left:"#222222",right:"#1b1b1b",edge:"#b8b8b8"},{top:"#454545",left:"#383838",right:"#2c2c2c",edge:"#c8c8c8"},{top:"#6a6a6a",left:"#565656",right:"#444444",edge:"#dadada"},{top:"#9c9c9c",left:"#808080",right:"#686868",edge:"#141414"}]},patterns:["none","hatch","hatch-wide","dots"],rhythms:[{dash:[],width:2.6},{dash:[9,4],width:2.4},{dash:[7,6],width:2.4},{dash:[3,6],width:2.4},{dash:[1.5,3.5],width:2.6},{dash:[10,3,2,3],width:2.4},{dash:[],width:1.4},{dash:[7,6],width:1.4},{dash:[3,3],width:1.6},{dash:[14,4],width:1.8}],kindOrder:zu,thresholds:la,darkWidthAdd:.4}),Cu=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i,ju=/^hsl\(\s*([+-]?(?:\d+\.?\d*|\.\d+))\s+([+-]?(?:\d+\.?\d*|\.\d+))%\s+([+-]?(?:\d+\.?\d*|\.\d+))%\s*\)$/i;function Lu(t){if(typeof t!="string")throw new Error(`mono: invalid colour "${String(t)}"`);let e=t.trim(),s=Cu.exec(e);if(s){let i=s[1];return i.length===3?[parseInt(i[0]+i[0],16)/255,parseInt(i[1]+i[1],16)/255,parseInt(i[2]+i[2],16)/255]:[parseInt(i.slice(0,2),16)/255,parseInt(i.slice(2,4),16)/255,parseInt(i.slice(4,6),16)/255]}let r=ju.exec(e);if(r){let i=Number(r[1]),o=Number(r[2]),n=Number(r[3]);if(!Number.isFinite(i)||o<0||o>100||n<0||n>100)throw new Error(`mono: invalid colour "${t}"`);let a=(i%360+360)%360,f=o/100,p=n/100,c=f*Math.min(p,1-p),l=d=>{let m=(d+a/30)%12;return p-c*Math.max(-1,Math.min(m-3,9-m,1))};return[l(0),l(8),l(4)]}throw new Error(`mono: invalid colour "${t}"`)}function lc(t){let[e,s,r]=Lu(t),i=o=>o<=.04045?o/12.92:((o+.055)/1.055)**2.4;return .2126*i(e)+.7152*i(s)+.0722*i(r)}function zi(t){let e=lc(t);return e>216/24389?116*Math.cbrt(e)-16:24389/27*e}function Ci(t,e){let s=lc(t),r=lc(e);return(Math.max(s,r)+.05)/(Math.min(s,r)+.05)}var _u=new Set(tn.patterns),Fu=new Map(tn.kindOrder.map((t,e)=>[t,e])),Du=(t,e)=>t<e?-1:t>e?1:0,jd=t=>[...new Set(t)].sort(Du),Bu=t=>Math.round(t*100)/100;function qu(t){return t>=la[0]?0:t>=la[1]?1:t>=la[2]?2:3}function Vu(t){if(t.roles)for(let[e,s]of Object.entries(t.roles)){if(s.step!==void 0&&(typeof s.step!="number"||!Number.isInteger(s.step)||s.step<0||s.step>3))throw new Error(`mono: invalid step "${String(s.step)}" for role "${e}"`);if(s.pattern!==void 0&&(typeof s.pattern!="string"||!_u.has(s.pattern)))throw new Error(`mono: invalid pattern "${String(s.pattern)}" for role "${e}"`)}if(t.kinds)for(let[e,s]of Object.entries(t.kinds)){if(s.dash!==void 0&&(!Array.isArray(s.dash)||!s.dash.every(r=>typeof r=="number"&&Number.isFinite(r)&&r>=0)))throw new Error(`mono: invalid dash "${String(s.dash)}" for kind "${e}"`);if(s.width!==void 0&&(typeof s.width!="number"||!Number.isFinite(s.width)||s.width<=0))throw new Error(`mono: invalid width "${String(s.width)}" for kind "${e}"`)}}function ca(t,e,s,r){if(e!=="light"&&e!=="dark")throw new Error(`mono: invalid mode "${String(e)}"`);r&&Vu(r);let i=tn[e],o=[],n=t.light["l-top"],a=jd(s?.roles??Object.keys(t.roles)),f=new Map,p=[[],[],[],[]];for(let g of a){let k=r?.roles?.[g]?.step,u;if(k!==void 0)u=k;else{let b=t.roles[g];if(!b)throw new Error(`mono: unknown role "${g}"`);if(typeof n!="string")throw new Error('mono: theme.light is missing "l-top"');u=qu(zi(`hsl(${b.h} ${b.s}% ${n})`))}f.set(g,u),p[u].push(g)}let c=new Map;for(let g=0;g<p.length;g++){let k=p[g];for(let u=0;u<k.length;u++){let b=k[u],x=r?.roles?.[b]?.pattern;if(x!==void 0)c.set(b,x);else{let w=u%tn.patterns.length,$=tn.patterns[w];if(c.set(b,$),u>=tn.patterns.length){let v=k.slice(0,u).find(O=>c.get(O)===$);v!==void 0&&o.push(`role "${b}" wraps on step ${g} to pattern "${$}", matching "${v}"`)}}}}let l={};for(let g of a){let k=f.get(g),u=c.get(g),b=i.steps[k];l[g]={step:k,pattern:u,top:b.top,left:b.left,right:b.right,edge:b.edge}}let d=jd(s?.kinds??Object.keys(t.kinds)),m=e==="dark"?tn.darkWidthAdd:0,h={},y=0;for(let g of d){let k=r?.kinds?.[g],u=Fu.get(g),b;if(u!==void 0)b=u;else if(b=tn.kindOrder.length+y,y++,b>=tn.rhythms.length){let v=b%tn.rhythms.length;(!k||k.dash===void 0||k.width===void 0)&&o.push(`kind "${g}" exceeds the ${tn.rhythms.length} line rhythms; reusing rhythm ${v}`),b=v}let x=tn.rhythms[b],w=k?.dash!==void 0?[...k.dash]:[...x.dash],$=k?.width!==void 0?k.width:Bu(x.width+m);h[g]={dash:w,width:$}}return{mode:e,paper:i.paper,ink:i.ink,roles:l,kinds:h,warnings:o}}var Rf={};ho(Rf,{ANTS_CSS:()=>pf,ANT_DASH:()=>Nc,ANT_SPEED:()=>Gi,ANT_STILL:()=>Rc,ASSEMBLE_STYLES:()=>jr,BOARD_3D:()=>qs,BOARD_CSS:()=>Tf,DISASSEMBLE_STYLES:()=>Lr,EASING_NAMES:()=>Yi,EXTRAPOLATE:()=>or,FLAT_DEFAULTS:()=>Hc,FLAT_FONTS:()=>Yc,FONT_STACKS:()=>Lc,GRID_CSS:()=>eo,LABEL_BUDGET:()=>Ia,MARKS_CSS:()=>Qi,MOTION_EASINGS:()=>Qd,MOTION_ORDERS:()=>sr,MOTION_SCHEMA:()=>hf,MotionBuilder:()=>Ui,NodesBuilder:()=>Dr,Obstacles:()=>nr,PAGE_CSS:()=>Kc,PLAYER_CSS:()=>Za,PLAYER_UI_CSS:()=>Gc,ROUTE_BUDGET:()=>wa,SeriesBuilder:()=>Br,WALL_T:()=>ps,alongPath:()=>Ta,antDash:()=>Zi,antsOf:()=>Ss,assemble:()=>Ec,assembly:()=>Pa,baseCss:()=>Ur,bezier:()=>Ds,bindMotion:()=>vs,boardCatalog:()=>Ef,boardDiagram:()=>Nf,boardErrors:()=>Ya,boardOf:()=>Wa,boxAsset:()=>an,boxSilhouette:()=>Sf,calloutRect:()=>xc,cardAsset:()=>Wc,checkMotion:()=>Fa,cloudPath:()=>mc,compileRaw:()=>Ua,convexOverlap:()=>Bi,curveAt:()=>Vr,defaultLabel:()=>Dd,disassemble:()=>lf,drawCloud:()=>Er,drawDecos:()=>fc,drawLooks:()=>Ca,drawingCss:()=>ar,durationFor:()=>qc,easeOf:()=>Xn,facePainter:()=>tr,flatHit:()=>Af,floorAt:()=>Rr,floorOf:()=>vf,focusView:()=>_a,gateBox:()=>Fi,iconPainter:()=>ji,inConvex:()=>kc,introSvg:()=>cf,kindsCss:()=>da,labelRect:()=>qi,layoutFlat:()=>Hr,lineRectArea:()=>Zd,localAt:()=>$f,markCss:()=>fa,metricsMeasure:()=>Of,midpoint:()=>Vc,monoCss:()=>Bc,monoOfDrawing:()=>Ka,monoTheme:()=>Dc,motion:()=>ff,motionModel:()=>rr,motionOfSteps:()=>Da,motionOrder:()=>Oc,motionSource:()=>Ji,msOf:()=>Jn,noSource:()=>Zc,nodeKind:()=>er,nodeKindOr:()=>An,offscreen:()=>Cr,openList:()=>yc,overlap2:()=>ua,overlaps:()=>Ha,paddingOf:()=>Mf,paint:()=>Ea,paintMono:()=>Va,parseEnd:()=>wn,place:()=>Nr,placeBoard:()=>to,placeCallout:()=>va,placeNodeLabel:()=>Vi,placeholderIcon:()=>dc,planOf:()=>_r,plate:()=>Li,polyBounds:()=>Hn,polyRectArea:()=>zr,readMs:()=>Wi,rectArea:()=>wc,regionKind:()=>Ot,regionRole:()=>za,registerMarks:()=>Fd,renderScene:()=>Fr,resolveSteps:()=>Ga,resolveSvg:()=>Zr,routeAll:()=>xa,screenToGrid:()=>kf,silhouette:()=>Yt,simplify:()=>Di,snapMove:()=>Pf,springAt:()=>qr,svgAt:()=>Ki,usedIn:()=>Fc,wallHeight:()=>pa,wallsOf:()=>Ra,withAnts:()=>ja});var Ot=(t,e)=>e!==void 0&&Object.hasOwn(t.regions,e)?t.regions[e]:void 0,er=(t,e)=>t.nodes[e??t.defaultNode],An=(t,e)=>er(t,e)??t.nodes[t.defaultNode],pa=t=>Object.values(t.regions).find(e=>e.shape==="walled")?.z[1]??.8,da=t=>Object.values(t.regions).map(e=>e.css??"").join("");var cc=Object.create(null),pc=[];function Fd(t){Object.assign(cc,t.icons??{}),Object.assign(gr,t.faces??{}),t.css&&!pc.includes(t.css)&&pc.push(t.css)}var fa=()=>pc.join(""),ji=t=>Object.hasOwn(cc,t)?cc[t]:void 0,tr=t=>Object.hasOwn(gr,t)?gr[t]:void 0;function dc(t,e){let s=(e.x0+e.x1)/2,r=(e.y0+e.y1)/2,i=e.z1+.005,o=Math.min(.6,(e.x1-e.x0)*.24,(e.y1-e.y0)*.24),n=[[s-o,r-o,i],[s+o,r-o,i],[s+o,r+o,i],[s-o,r+o,i]];return t.poly(n,"ico-unknown")+t.line3([s-o*.3,r-o*.35,i],[s+o*.3,r-o*.35,i],"ico-unknown-q")+t.line3([s+o*.3,r-o*.35,i],[s,r+o*.1,i],"ico-unknown-q")+t.line3([s,r+o*.45,i],[s,r+o*.5,i],"ico-unknown-q")}function fc(t,e,s){let r="";for(let i of s??[])i==="terminal"?r+=pi(t,e,3):i==="envelope"?r+=yo(t,e):i==="bubble"?r+=go(t,e):i==="file-lines"?r+=bo(t,e):typeof i=="object"&&(i.terminal&&(r+=pi(t,e,i.terminal)),i.icon&&(r+=(ji(i.icon)??dc)(t,e)));return r}var Ku=(t,e)=>(t.deco??e.deco??[]).filter(s=>s!=="ghost");function an(t,e,s,r,i,o){let n={name:t,description:e,size:s,role:r,deco:i,draw:(a,f,p)=>a.blockFaces(f)+fc(a,f,Ku(p,n))+(o?o(a,f):"")};return n}function Li(t){let[e,s]=Hs(t);return{x0:e-.75,y0:s-.75,x1:e+.75,y1:s+.75,z0:t.z0,z1:t.z0+.18}}function mc(t,e){let s=Math.max(8,Math.min(t,e)*.18),r=s*.55,i=r,o=r,n=t-r,a=e-r,f=(p,c,l,d)=>{let m=Math.hypot(l-p,d-c),h=Math.max(1,Math.round(m/(s*1.7))),y="";for(let g=1;g<=h;g++){let k=p+(l-p)*g/h,u=c+(d-c)*g/h,b=m/h/2*1.08;y+=` A${b.toFixed(1)},${b.toFixed(1)} 0 0 1 ${k.toFixed(1)},${u.toFixed(1)}`}return y};return`M${i.toFixed(1)},${o.toFixed(1)}`+f(i,o,n,o)+f(n,o,n,a)+f(n,a,i,a)+f(i,a,i,o)+"Z"}function Er(t,e){let s={...e,z0:e.z1},r=a=>{let[f,p]=Ne(e.x0,e.y0,a);return[Ct,.5,-Ct,.5,f,p]},i=(e.x1-e.x0)*lt,o=(e.y1-e.y0)*lt,n=mc(i,o);return t.onMatrix(r(e.z0),i,o,()=>Se("path",{d:n,class:"lft cloud-side"}))+t.onMatrix(r(e.z1),i,o,()=>Se("path",{d:n,class:"top cloud-top"}))}function Dd(t,e){let[s,r]=Ne((t.x0+t.x1)/2,(t.y0+t.y1)/2,t.z1+.75);return{x:s,y:r-18+(e?0:6),anchor:"middle"}}var ps=.16,uc=["right-of","left-of","below","behind"];function Nr(t,e,s,r,i,o={},n){let a=[],f=(M,T,S,N=!1,z="error")=>{let K=s.locate(M,{key:N});a.push({severity:z,message:T,line:K.line,col:K.col,path:M,hint:S})},p=[],c=new Map,l=[],d=new Map,m=new Set([...Object.keys(r.roles),...Object.keys(o)]);function h(M,T){let S=c.get(M.id);if(S){let N=s.locate(S.path+"/id");return f(M.path+"/id",`duplicate id "${M.id}" (first used on line ${N.line})`),!1}return c.set(M.id,M),p.push(M),M.parent=T,T?T.children.push(M):l.push(M),!0}let y=()=>({x0:0,y0:0,z0:0,x1:0,y1:0,z1:0});function g(M,T,S){let N={id:M.id,type:"node",path:T,children:[],box:y(),floor:0,node:M,appears:M.appears,disappears:M.disappears};h(N,S)&&(M.nodes??[]).forEach((z,K)=>g(z,`${T}/nodes/${K}`,N))}function k(M,T,S){let N={id:M.id,type:"region",path:T,children:[],box:y(),floor:0,region:M,appears:M.appears,disappears:M.disappears};h(N,S)&&((M.nodes??[]).forEach((z,K)=>g(z,`${T}/nodes/${K}`,N)),(M.regions??[]).forEach((z,K)=>k(z,`${T}/regions/${K}`,N)))}(t.regions??[]).forEach((M,T)=>k(M,`${e}/regions/${T}`,void 0)),(t.nodes??[]).forEach((M,T)=>g(M,`${e}/nodes/${T}`,void 0));let u=()=>c.keys(),b=()=>p.filter(M=>M.type==="region").map(M=>M.id);for(let M of[...p]){let T=M.node??M.region;if(T.in!==void 0){let N=c.get(T.in);if(!N){f(M.path+"/in",`unknown region "${T.in}"`+_i(T.in,b()));continue}if(N.type!=="region"){f(M.path+"/in",`"${T.in}" is a node, not a region; put nodes on a node with its own "nodes:" list`);continue}if(M.parent&&M.parent!==N){f(M.path+"/in",`"${M.id}" is written inside "${M.parent.id}" but says in: ${T.in}; use one or the other`);continue}for(let z=N;z;z=z.parent)if(z===M){f(M.path+"/in",`"${M.id}" cannot be inside itself`);continue}M.parent||(l.splice(l.indexOf(M),1),M.parent=N,N.children.push(M))}if(M.node){let N=M.node.asset;N!==void 0&&!er(i,N)&&f(M.path+"/asset",`unknown asset "${N}"`+_i(N,Object.keys(i.nodes)),`assets: ${Object.keys(i.nodes).join(", ")}`)}let S=(M.node??M.region).role;S!==void 0&&!m.has(S)&&f(M.path+"/role",`unknown colour role "${S}"`+_i(S,m),`add it under "roles:" at the top of the file, or use one of: ${[...m].join(", ")}`)}for(let M of p){let T=M.region?.gate;if(!T?.node)continue;let S=c.get(T.node);if(!S){f(M.path+"/gate/node",`unknown node "${T.node}"`+_i(T.node,u()));continue}if(S.type!=="node"){f(M.path+"/gate/node",`"${T.node}" is a region; a gate is a node`);continue}S.placedBy=M.id;let N=S.node;(N.at||uc.some(z=>N[z]))&&f(S.path,`"${S.id}" is the gate of "${M.id}", which places it; its own placement is ignored`,void 0,!1,"warning")}let x=M=>M.gap??t.gap??2;function w(M){let T=M.node,S=An(i,T.asset),N=T.size,z=S.size[0],K=S.size[1],J=S.size[2];if(N&&(z=N[0],K=N[1],N.length>2&&(J=N[2])),M.placedBy){let Z=c.get(M.placedBy).region,L=Z.gate,U=L.width??2,H=N?Math.min(z,K):.3;J=N&&N.length>2?J:L.height??(Z.height??pa(i))+.3,L.side==="e"||L.side==="w"?(z=H,K=U):(z=U,K=H)}return[z,K,J]}function $(M,T,S,N,z){for(let Y of T)O(Y);let K=T.filter(Y=>!Y.placedBy),J=new Set(K),Z=new Set,L=[],U=new Set,H=Y=>{let ie=Y.node??Y.region,Ae=[];for(let De of uc){let I=ie[De];if(I===void 0)continue;let V=c.get(I);if(!V){f(`${Y.path}/${De}`,`unknown id "${I}"`+_i(I,u()));continue}if(V===Y){f(`${Y.path}/${De}`,`"${Y.id}" cannot be placed ${De} itself`);continue}if(!J.has(V)){let te=ae=>ae.parent?`"${ae.parent.id}"`:"the scene";f(`${Y.path}/${De}`,`"${I}" is in ${te(V)} but "${Y.id}" is in ${te(Y)}; relative placement works between items in the same region`,V.placedBy?`"${I}" is a gate, placed by its ${c.get(V.placedBy)?.region?.kind??"region"}`:`place "${Y.id}" relative to something in ${te(Y)}, or use "at:"`);continue}Ae.push(V)}if(!Ae.length&&!ie.at){let De=K.indexOf(Y);De>0&&Ae.push(K[De-1])}return Ae},ee=Y=>{if(!Z.has(Y)){if(U.has(Y)){f(Y.path,`placement loop: "${Y.id}" is placed relative to something placed relative to it`);return}U.add(Y),H(Y).forEach(ee),U.delete(Y),Z.add(Y),L.push(Y)}};K.forEach(ee);for(let Y of L){let ie=Y.node??Y.region,Ae=d.get(Y),De=uc.find(I=>ie[I]!==void 0&&c.get(ie[I])&&J.has(c.get(ie[I])));if(ie.at&&De&&f(`${Y.path}/at`,`"${Y.id}" has both "at" and "${De}"; "at" wins`,void 0,!0,"warning"),ie.at)Ae.x=ie.at[0],Ae.y=ie.at[1];else if(De)v(Ae,d.get(c.get(ie[De])),De,x(ie),ie.align??"center");else{let I=K.indexOf(Y);I>0?v(Ae,d.get(K[I-1]),N==="row"?"right-of":"below",x(ie),"center"):(Ae.x=S,Ae.y=S)}ie.shift&&(Ae.x+=ie.shift[0],Ae.y+=ie.shift[1])}if(z||!K.length)return{w:0,d:0};let j=1/0,q=1/0,G=-1/0,Q=-1/0;for(let Y of K){let ie=d.get(Y);j=Math.min(j,ie.x),q=Math.min(q,ie.y),G=Math.max(G,ie.x+ie.w),Q=Math.max(Q,ie.y+ie.d)}let ce=Math.min(0,j-S),pe=Math.min(0,q-S);if(ce||pe)for(let Y of K){let ie=d.get(Y);ie.x-=ce,ie.y-=pe}return{w:G-ce+S,d:Q-pe+S}}function v(M,T,S,N,z){let K=()=>{M.y=z==="start"?T.y:z==="end"?T.y+T.d-M.d:T.y+(T.d-M.d)/2},J=()=>{M.x=z==="start"?T.x:z==="end"?T.x+T.w-M.w:T.x+(T.w-M.w)/2};S==="right-of"?(M.x=T.x+T.w+N,K()):S==="left-of"?(M.x=T.x-N-M.w,K()):S==="below"?(M.y=T.y+T.d+N,J()):(M.y=T.y-N-M.d,J())}function O(M){if(M.type==="node"){let[L,U,H]=w(M);d.set(M,{x:0,y:0,w:L,d:U,h:H,z:M.node.z??0}),M.children.length&&$(M,M.children,0,"row",!0);return}let T=M.region,S=T.padding??Ot(i,T.kind)?.pad,N=!!T.size,z=$(M,M.children,S,T.flow??"row",N),K=T.size?T.size[0]:Math.max(z.w,S*2+.5),J=T.size?T.size[1]:Math.max(z.d,S*2+.5);if(!T.size&&T.gate){let L=(T.gate.width??2)+1;T.gate.side==="e"||T.gate.side==="w"?J=Math.max(J,L):K=Math.max(K,L)}let Z=T.size&&T.size.length>2?T.size[2]:T.height??Ot(i,T.kind).z[1];d.set(M,{x:0,y:0,w:K,d:J,h:Z,z:0})}$(void 0,l,0,t.flow??"row",!0);function C(M,T,S,N){let z=d.get(M),K=T+z.x,J=S+z.y;if(M.type==="region"){let Z=Ot(i,M.region.kind),[L]=Z.z,U=Z.floor,H=Z.shape==="slab"&&Ot(i,M.parent?.region?.kind)?.shape==="slab"?0:L,ee=M.region.z??0,j=N+H+ee,q=N+z.h+ee;M.box={x0:K,y0:J,z0:j,x1:K+z.w,y1:J+z.d,z1:q},M.floor=U?q:N}else{let Z=N+z.z;M.box={x0:K,y0:J,z0:Z,x1:K+z.w,y1:J+z.d,z1:Z+z.h},M.floor=M.box.z1}for(let Z of M.children)Z.placedBy||C(Z,K,J,M.floor)}for(let M of l)M.placedBy||C(M,0,0,0);if(n){let M=S=>Math.round(S/n)*n,T=S=>Math.round(S*1e9)/1e9;for(let S of p){if(S.placedBy)continue;let N=S.box,z=M(N.x0),K=M(N.x1),J=M(N.y0),Z=M(N.y1);K-z<n&&(K=z+n),Z-J<n&&(Z=J+n),S.box={...N,x0:T(z),x1:T(K),y0:T(J),y1:T(Z)};let L=S.node??S.region;L.at&&L.at.forEach((U,H)=>{let ee=U/n;Math.abs(ee-Math.round(ee))>1e-6&&f(`${S.path}/at/${H}`,`${U} is not on the ${n} grid; it is drawn at ${T(M(U))}`,void 0,!1,"warning")})}}for(let M of p){let T=M.region?.gate;if(!T?.node)continue;let S=c.get(T.node);!S||S.placedBy!==M.id||(S.box=Fi(M,d.get(S).h,d.get(S).w,d.get(S).d),S.floor=S.box.z1)}for(let M of p){let T=M.children.filter(S=>!S.placedBy);for(let S=0;S<T.length;S++)for(let N=S+1;N<T.length;N++){let z=T[S],K=T[N];ma(z,i)||ma(K,i)||ua(z.box,K.box)&&f(K.path,`"${K.id}" overlaps "${z.id}"`,'move one with "at", a relative placement, "gap" or "shift"',!1,"warning")}if(M.parent&&M.parent.type==="region"&&!M.placedBy){let S=M.parent.box,N=M.box,z=1e-6;(N.x0<S.x0-z||N.y0<S.y0-z||N.x1>S.x1+z||N.y1>S.y1+z)&&f(M.path,`"${M.id}" sticks out of region "${M.parent.id}"`,`make "${M.parent.id}" bigger, or leave out its "size" so it fits its contents`,!1,"warning")}}{let M=l.filter(T=>!T.placedBy);for(let T=0;T<M.length;T++)for(let S=T+1;S<M.length;S++){let N=M[T],z=M[S];ua(N.box,z.box)&&!ma(N,i)&&!ma(z,i)&&f(z.path,`"${z.id}" overlaps "${N.id}"`,'move one with "at", a relative placement, "gap" or "shift"',!1,"warning")}}let A=new Set,R=a.filter(M=>{let T=M.path+M.message;return A.has(T)?!1:(A.add(T),!0)});return{items:p,byId:c,roots:l,diags:R,catalog:i}}var ma=(t,e)=>t.type==="region"&&["zone","tunnel"].includes(Ot(e,t.region.kind)?.shape??"");function Fi(t,e,s,r){let i=t.region.gate,o=t.box,n=t.box.z0,a=i.at??.5,f=i.width??2;if(i.side==="w"||i.side==="e"){let l=i.side==="w"?o.x0+ps/2:o.x1-ps/2,d=o.y0+(o.y1-o.y0)*a;return{x0:l-s/2,x1:l+s/2,y0:d-f/2,y1:d+f/2,z0:n,z1:n+e}}let p=i.side==="n"?o.y0+ps/2:o.y1-ps/2,c=o.x0+(o.x1-o.x0)*a;return{x0:c-f/2,x1:c+f/2,y0:p-r/2,y1:p+r/2,z0:n,z1:n+e}}function ua(t,e,s=1e-6){return t.x0<e.x1-s&&e.x0<t.x1-s&&t.y0<e.y1-s&&e.y0<t.y1-s}function _i(t,e){let s=Vt(t,e);return s?` (did you mean "${s}"?)`:""}var ks=.2,ha=.05,Gu=.6,ya=.25,ga={n:[0,-1],s:[0,1],e:[1,0],w:[-1,0]};function wn(t){let e=/^(.*?)(?:\.(n|e|s|w|top))?$/.exec(t);return{id:e[1],side:e[2]}}var Bd=new WeakMap;function Rr(t,e,s){let r=Bd.get(t);if(!r){r=[];for(let n of t.items){if(n.type!=="region"||!Ot(t.catalog,n.region.kind)?.floor)continue;let a=0;for(let f=n.parent;f;f=f.parent)a++;r.push({r:n,d:a})}Bd.set(t,r)}let i=0,o=-1;for(let{r:n,d:a}of r){let f=n.box,p=1e-6;e>=f.x0-p&&e<=f.x1+p&&s>=f.y0-p&&s<=f.y1+p&&a>o&&(o=a,i=n.floor)}return i}function Zu(t,e){let s=[(t.x0+t.x1)/2,(t.y0+t.y1)/2],r=[(e.x0+e.x1)/2,(e.y0+e.y1)/2],i=r[0]-s[0],o=r[1]-s[1],n=Math.max(e.x0-t.x1,t.x0-e.x1),a=Math.max(e.y0-t.y1,t.y0-e.y1);return n>0&&(a<=0||n>=a)?i>0?"e":"w":a>0?o>0?"s":"n":Math.abs(i)>=Math.abs(o)?i>0?"e":"w":o>0?"s":"n"}var wa=5e5;function xa(t,e,s,r,i,o){let n=[],a=(b,x,w,$="error")=>{let v=r.locate(b);n.push({severity:$,message:x,line:v.line,col:v.col,path:b,hint:w})},f=t.routes??[],p={left:wa},c=0,l=()=>s.items.map(b=>b.id),d=new Map,m=[],h=[];f.forEach((b,x)=>{let w=`${e}/routes/${x}`;(d.has(b.id)||s.byId.has(b.id))&&a(w+"/id",`duplicate id "${b.id}"`),d.set(b.id,x);let $=b.kind??"send";i.has($)||a(w+"/kind",`unknown flow kind "${$}"`+hc($,i),`kinds: ${[...i].join(", ")}; add one under "kinds:"`);let v={id:b.id,raw:b,path:w,kind:$,points:[]},O=(C,A)=>{let{id:R}=wn(C),M=s.byId.get(R);if(!M){a(`${w}/${A}`,`unknown node "${R}"`+hc(R,l()));return}return M};v.from=O(b.from,"from"),v.to=O(b.to,"to"),m.push(v),h.push({r:v})});let y=new Map;for(let b of h){let{r:x}=b;if(!x.from||!x.to||x.raw.points)continue;let w=wn(x.raw.from).side,$=wn(x.raw.to).side,v=x.raw.via?.[0],O=x.raw.via?.[x.raw.via.length-1],C=(T,S)=>{if(Array.isArray(T))return{x0:T[0],x1:T[0],y0:T[1],y1:T[1],z0:0,z1:0};if(typeof T=="string"){let N=s.byId.get(wn(T).id);if(N)return N.box}return S.box},A=(T,S,N)=>{let z=S??Zu(T.box,N);return{node:T,side:z,explicit:!!S,p:[0,0],z:0}};b.a=A(x.from,w,C(v,x.to)),b.b=A(x.to,$,C(O,x.from));let R=C(v,x.to),M=C(O,x.from);for(let[T,S]of[[b.a,R],[b.b,M]]){let N=`${T.node.id}.${T.side}`;y.has(N)||y.set(N,[]),y.get(N).push({e:T,other:[(S.x0+S.x1)/2,(S.y0+S.y1)/2]})}}for(let[,b]of y){let x=b[0].e,w=x.node.box,$=x.side,v=$==="e"||$==="w"?1:0;b.sort((T,S)=>T.other[v]-S.other[v]);let O=v?w.y0:w.x0,C=v?w.y1:w.x1,A=(O+C)/2,R=Math.max(0,C-O-.3),M=b.length>1?Math.min(Gu,R/(b.length-1)):0;b.forEach((T,S)=>{let N=(S-(b.length-1)/2)*M,z=A+N,K=T.e.node.box.z0;if($==="top"){T.e.p=[(w.x0+w.x1)/2,(w.y0+w.y1)/2],T.e.z=w.z1;return}let[J,Z]=ga[$];T.e.p=v?[J>0?w.x1+ha:w.x0-ha,z]:[z,Z>0?w.y1+ha:w.y0-ha],T.e.z=K})}let g=[];for(let b of s.items)b.type==="node"&&g.push(b.box);let k=[];for(let b of s.items.filter(x=>Ot(s.catalog,x.region?.kind)?.shape==="walled")){let{x0:x,y0:w,x1:$,y1:v}=b.box,O=ps,C=b.region.gate,A=[[{x0:x,y0:w,x1:$,y1:w+O,z0:0,z1:0},"n"],[{x0:x,y0:v-O,x1:$,y1:v,z0:0,z1:0},"s"],[{x0:x,y0:w,x1:x+O,y1:v,z0:0,z1:0},"w"],[{x0:$-O,y0:w,x1:$,y1:v,z0:0,z1:0},"e"]];for(let[R,M]of A)if(C&&C.side===M){if(C.node)continue;let T=C.at??.5,S=C.width??2;if(M==="e"||M==="w"){let N=w+(v-w)*T;k.push({...R,y1:N-S/2},{...R,y0:N+S/2})}else{let N=x+($-x)*T;k.push({...R,x1:N-S/2},{...R,x0:N+S/2})}}else k.push(R)}let u=new Map;for(let b of h){let{r:x,a:w,b:$}=b;if(x.raw.points){x.points=x.raw.points.map(z=>[z[0],z[1],z.length>2?z[2]:Rr(s,z[0],z[1])+.01]);continue}if(!w||!$)continue;let v=[];(x.raw.via??[]).forEach((z,K)=>{if(Array.isArray(z))if(o){let J=Z=>Math.round(Math.round(Z/o)*o*1e9)/1e9;z.forEach((Z,L)=>{Math.abs(Z/o-Math.round(Z/o))>1e-6&&a(`${x.path}/via/${K}/${L}`,`${Z} is not on the ${o} grid; it is drawn at ${J(Z)}`,void 0,"warning")}),v.push({p:[J(z[0]),J(z[1])]})}else v.push({p:[z[0],z[1]]});else{let{id:J,side:Z}=wn(z),L=s.byId.get(J);if(!L){a(`${x.path}/via/${K}`,`unknown node "${J}"`+hc(J,l()));return}let U=Z&&Z!=="top"?Z:"n",[H,ee]=ga[U],j=L.box;v.push({p:[H?H>0?j.x1+.4:j.x0-.4:(j.x0+j.x1)/2,ee?ee>0?j.y1+.4:j.y0-.4:(j.y0+j.y1)/2]})}});let C=g.filter(z=>z!==w.node.box&&z!==$.node.box).concat(x.raw.cross?[]:k).filter(z=>!ba(w.node.box,z)&&!ba($.node.box,z)&&!ba(z,w.node.box)&&!ba(z,$.node.box)),A=w.side==="top"?void 0:ga[w.side],R=$.side==="top"?void 0:ga[$.side],M=[w.p,...v.map(z=>z.p),$.p],T=[w.p],S=A,N=!0;for(let z=0;z+1<M.length;z++){let K=z+2===M.length,J=Hu(M[z],M[z+1],C,u,S,K&&R?[-R[0],-R[1]]:void 0,p);if(!J){N=!1;break}T.push(...J.slice(1));let Z=T.length;if(Z>=2){let L=Math.sign(T[Z-1][0]-T[Z-2][0]),U=Math.sign(T[Z-1][1]-T[Z-2][1]);S=[L,U]}}!N&&p.left<=0?(c++,T=[w.p,[$.p[0],w.p[1]],$.p]):N||(a(x.path,`no path found for route "${x.id}" from "${w.node.id}" to "${$.node.id}"`,'add "via" points, or use "points" to draw it by hand',"warning"),T=[w.p,[$.p[0],w.p[1]],$.p]),T=Di(T);for(let z=0;z+1<T.length;z++)Uu(u,T[z],T[z+1]);x.points=Ju(s,T,w,$)}return c&&a(e,`${c} of ${m.length} routes were drawn as plain elbows: the scene is too large to route them all around what stands in the way (${wa.toLocaleString("en")} search steps)`,'split it into scenes, or give the busiest routes "via" points or "points"',"warning"),{routes:m,diags:n}}function ba(t,e){return e.x0>=t.x0-1e-6&&e.x1<=t.x1+1e-6&&e.y0>=t.y0-1e-6&&e.y1<=t.y1+1e-6&&e.z0>=t.z1-1e-6}var qd=(t,e)=>`${Math.round(t/ks)},${Math.round(e/ks)}`;function Uu(t,e,s){let r=Math.max(1,Math.round(Math.hypot(s[0]-e[0],s[1]-e[1])/ks));for(let i=0;i<=r;i++){let o=qd(e[0]+(s[0]-e[0])*i/r,e[1]+(s[1]-e[1])*i/r);t.set(o,(t.get(o)??0)+1)}}function Vd(t,e,s){for(let r of s)if(t>r.x0-ya&&t<r.x1+ya&&e>r.y0-ya&&e<r.y1+ya)return!0;return!1}function Hu(t,e,s,r,i,o,n={left:1/0}){if((Math.abs(t[0]-e[0])<1e-6||Math.abs(t[1]-e[1])<1e-6)&&Wu(t,e,s)){let L=[Math.sign(e[0]-t[0]),Math.sign(e[1]-t[1])],U=!i||i[0]===L[0]&&i[1]===L[1],H=!o||o[0]===L[0]&&o[1]===L[1];if(U&&H)return[t,e]}if(n.left<=0)return null;let a=L=>Math.round((L-t[0])/ks),f=L=>Math.round((L-t[1])/ks),p=L=>t[0]+L*ks,c=L=>t[1]+L*ks,l=a(e[0]),d=f(e[1]),m=30,h=Math.min(0,l)-m,y=Math.max(0,l)+m,g=Math.min(0,d)-m,k=Math.max(0,d)+m,u=1.2,b=ks,x=.06,w=[[1,0],[-1,0],[0,1],[0,-1]],$=y-h+1,v=k-g+1,O=(L,U)=>(L-h)*v+(U-g),C=new Int8Array($*v).fill(-1),A=new Float64Array($*v).fill(-1),R=new Float64Array($*v*4).fill(1/0),M=(L,U)=>{let H=O(L,U);return C[H]<0&&(C[H]=Vd(p(L),c(U),s)?1:0),C[H]===1},T=(L,U)=>{let H=O(L,U);return A[H]<0&&(A[H]=r.get(qd(p(L),c(U)))??0),A[H]},S=yc(),N=(L,U)=>(Math.abs(L-l)+Math.abs(U-d))*b,z=i?w.findIndex(L=>L[0]===i[0]&&L[1]===i[1]):-1;S.push({i:0,j:0,d:z,g:0,f:N(0,0),idx:0,hp:0});let K=(L,U)=>Math.abs(L)+Math.abs(U)<=2,J=(L,U)=>Math.abs(L-l)+Math.abs(U-d)<=2,Z=0;for(;S.length()&&Z++<2e5;){if(n.left--<=0)return null;let L=S.take();if(L.i===l&&L.j===d&&!(o&&L.d>=0&&(w[L.d][0]!==o[0]||w[L.d][1]!==o[1]))){let U=[];for(let H=L;H;H=H.prev)U.push([p(H.i),c(H.j)]);return U.reverse(),U[0]=t,Yu(Di(U),e)}for(let U=0;U<4;U++){let H=w[U];if(L.d>=0&&H[0]===-w[L.d][0]&&H[1]===-w[L.d][1])continue;let ee=L.i+H[0],j=L.j+H[1];if(ee<h||ee>y||j<g||j>k||!K(ee,j)&&!J(ee,j)&&M(ee,j))continue;if((K(ee,j)||J(ee,j))&&M(ee,j)&&!(ee===l&&j===d)){let ce=K(ee,j)?i:o&&[-o[0],-o[1]];if(!ce||(K(ee,j)?H[0]!==ce[0]||H[1]!==ce[1]:H[0]!==o[0]||H[1]!==o[1]))continue}let q=L.d>=0&&L.d!==U?u:0,G=L.g+b+q+T(ee,j)*x,Q=O(ee,j)*4+U;R[Q]<=G||(R[Q]=G,S.push({i:ee,j,d:U,g:G,f:G+N(ee,j),prev:L,idx:0,hp:0}))}}return null}function yc(){let t=[],e=[],s=(n,a)=>n.f<a.f||n.f===a.f&&n.idx<a.idx,r=(n,a)=>{let f=e[n];e[n]=e[a],e[a]=f,e[n].hp=n,e[a].hp=a},i=n=>{for(;n>0;){let a=n-1>>1;if(!s(e[n],e[a]))break;r(n,a),n=a}},o=n=>{for(;;){let a=2*n+1,f=a+1,p=n;if(a<e.length&&s(e[a],e[p])&&(p=a),f<e.length&&s(e[f],e[p])&&(p=f),p===n)return;r(n,p),n=p}};return{length:()=>t.length,push(n){n.idx=t.length,t.push(n),n.hp=e.length,e.push(n),i(n.hp)},take(){let n=e[0],a=e.pop();e.length&&(e[0]=a,a.hp=0,o(0));let f=t.pop();return f!==n&&(t[n.idx]=f,f.idx=n.idx,i(f.hp)),n}}}function Yu(t,e){let s=t.map(o=>[o[0],o[1]]),r=s.length,i=s[r-1];if(r>=2){let o=s[r-2];Math.abs(o[1]-i[1])<1e-9?(o[1]=e[1],r>=3&&Math.abs(s[r-3][1]-i[1])<1e-9&&(s[r-3][1]=e[1])):Math.abs(o[0]-i[0])<1e-9&&(o[0]=e[0],r>=3&&Math.abs(s[r-3][0]-i[0])<1e-9&&(s[r-3][0]=e[0]))}return s[r-1]=e,Di(s)}function Wu(t,e,s){let r=Math.max(1,Math.round(Math.hypot(e[0]-t[0],e[1]-t[1])/(ks/2)));for(let i=2;i<r-1;i++)if(Vd(t[0]+(e[0]-t[0])*i/r,t[1]+(e[1]-t[1])*i/r,s))return!1;return!0}function Di(t){let e=[];for(let s of t){let r=e.length;if(!(r&&Math.abs(e[r-1][0]-s[0])<1e-6&&Math.abs(e[r-1][1]-s[1])<1e-6)){if(r>=2){let i=e[r-2],o=e[r-1];if(Math.abs(i[0]-o[0])<1e-6&&Math.abs(o[0]-s[0])<1e-6||Math.abs(i[1]-o[1])<1e-6&&Math.abs(o[1]-s[1])<1e-6){e[r-1]=s;continue}}e.push(s)}}return e}function Ju(t,e,s,r){let i=new Set,o=new Set;for(let p of t.items)p.type!=="region"||!Ot(t.catalog,p.region.kind)?.floor||(i.add(p.box.x0),i.add(p.box.x1),o.add(p.box.y0),o.add(p.box.y1));let n=[],a=(p,c)=>Rr(t,p,c)+.01;for(let p=0;p+1<e.length;p++){let[c,l]=e[p],[d,m]=e[p+1],h=[0,1];if(Math.abs(l-m)<1e-6)for(let y of i){let g=(y-c)/(d-c);g>1e-6&&g<1-1e-6&&h.push(g)}else for(let y of o){let g=(y-l)/(m-l);g>1e-6&&g<1-1e-6&&h.push(g)}h.sort((y,g)=>y-g);for(let y=0;y+1<h.length;y++){let g=h[y],k=h[y+1],u=(g+k)/2,b=a(c+(d-c)*u,l+(m-l)*u),x=[c+(d-c)*g,l+(m-l)*g,b],w=[c+(d-c)*k,l+(m-l)*k,b],$=n[n.length-1];$&&(Math.abs($[0]-x[0])>1e-6||Math.abs($[1]-x[1])>1e-6||Math.abs($[2]-x[2])>1e-6)?n.push(x):$||n.push(x),n.push(w)}}n.length&&(n[0][2]=s.side==="top"?s.z:s.node.box.z0+.01,n[n.length-1][2]=r.side==="top"?r.z:r.node.box.z0+.01);let f=[];for(let p of n){let c=f.length;if(c>=2){let l=f[c-2],d=f[c-1],m=Math.abs(l[2]-d[2])<1e-9&&Math.abs(d[2]-p[2])<1e-9,h=Math.abs(l[0]-d[0])<1e-6&&Math.abs(d[0]-p[0])<1e-6||Math.abs(l[1]-d[1])<1e-6&&Math.abs(d[1]-p[1])<1e-6;if(m&&h){f[c-1]=p;continue}}f.push(p)}return f}function hc(t,e){let s=Vt(t,e);return s?` (did you mean "${s}"?)`:""}function Yt(t){return[Ne(t.x0,t.y0,t.z1),Ne(t.x1,t.y0,t.z1),Ne(t.x1,t.y0,t.z0),Ne(t.x1,t.y1,t.z0),Ne(t.x0,t.y1,t.z0),Ne(t.x0,t.y1,t.z1)]}function Hn(t){let e=t.map(o=>o[0]),s=t.map(o=>o[1]),r=Math.min(...e),i=Math.min(...s);return{x:r,y:i,w:Math.max(...e)-r,h:Math.max(...s)-i}}function zr(t,e){let s=t,r=(a,f)=>{let p=[];for(let c=0;c<s.length;c++){let l=s[c],d=s[(c+1)%s.length],m=a(l),h=a(d);m&&p.push(l),m!==h&&p.push(f(l,d))}s=p},i=a=>(f,p)=>[a,f[1]+(p[1]-f[1])*(a-f[0])/(p[0]-f[0])],o=a=>(f,p)=>[f[0]+(p[0]-f[0])*(a-f[1])/(p[1]-f[1]),a];if(r(a=>a[0]>=e.x,i(e.x)),!s.length||(r(a=>a[0]<=e.x+e.w,i(e.x+e.w)),!s.length)||(r(a=>a[1]>=e.y,o(e.y)),!s.length)||(r(a=>a[1]<=e.y+e.h,o(e.y+e.h)),!s.length))return 0;let n=0;for(let a=0;a<s.length;a++){let f=s[a],p=s[(a+1)%s.length];n+=f[0]*p[1]-p[0]*f[1]}return Math.abs(n)/2}function wc(t,e){let s=Math.min(t.x+t.w,e.x+e.w)-Math.max(t.x,e.x),r=Math.min(t.y+t.h,e.y+e.h)-Math.max(t.y,e.y);return s>0&&r>0?s*r:0}function Zd(t,e){let s=0;for(let r=0;r+1<t.length;r++){let i=t[r],o=t[r+1],n=Math.hypot(o[0]-i[0],o[1]-i[1]),a=Math.max(1,Math.ceil(n/4));for(let f=0;f<a;f++){let p=i[0]+(o[0]-i[0])*(f+.5)/a,c=i[1]+(o[1]-i[1])*(f+.5)/a;p>=e.x&&p<=e.x+e.w&&c>=e.y&&c<=e.y+e.h&&(s+=n/a*4)}}return s}var $s=64,$a=class{cells=new Map;n=0;add(e,s,r,i,o){for(let n=Math.floor(s/$s);n<=Math.floor(i/$s);n++)for(let a=Math.floor(r/$s);a<=Math.floor(o/$s);a++){let f=n*1048576+a,p=this.cells.get(f);p||this.cells.set(f,p=[]),p[p.length-1]!==e&&p.push(e)}}query(e,s,r,i){let o=new Set;for(let n=Math.floor(e/$s);n<=Math.floor(r/$s);n++)for(let a=Math.floor(s/$s);a<=Math.floor(i/$s);a++){let f=this.cells.get(n*1048576+a);if(f)for(let p of f)o.add(p)}return[...o].sort((n,a)=>n-a)}},gc=t=>{let e=1/0,s=1/0,r=-1/0,i=-1/0;for(let[o,n]of t)o<e&&(e=o),o>r&&(r=o),n<s&&(s=n),n>i&&(i=n);return[e,s,r,i]},Sa=new WeakMap;function Fs(t,e){let s=Sa.get(t);for((!s||s.n>t.length)&&Sa.set(t,s=new $a);s.n<t.length;s.n++){let[r,i,o,n]=e(t[s.n]);s.add(s.n,r,i,o,n)}return s}function Kd(t){let e=Sa.get(t);for((!e||e.n>t.length)&&Sa.set(t,e=new $a);e.n<t.length;e.n++){let s=t[e.n].pts;for(let r=0;r+1<s.length;r++){let i=s[r],o=s[r+1],n=e.n*65536+r,a=Math.max(1,Math.ceil(Math.hypot(o[0]-i[0],o[1]-i[1])/($s/2)));for(let f=0;f<a;f++){let p=f/a,c=(f+1)/a,l=i[0]+(o[0]-i[0])*p,d=i[1]+(o[1]-i[1])*p,m=i[0]+(o[0]-i[0])*c,h=i[1]+(o[1]-i[1])*c;e.add(n,Math.min(l,m)-1,Math.min(d,h)-1,Math.max(l,m)+1,Math.max(d,h)+1)}}}return e}var ds=(t,e,s,r,i)=>t.query(e,s,r,i),Ir=t=>gc(t),ka=t=>[t.x,t.y,t.x+t.w,t.y+t.h];function Gd(t,e,s,[r,i,o,n]){let a=0,f=s-1;for(let p of[0,1]){let c=e[p]-t[p],l=p?i:r,d=p?n:o;if(Math.abs(c)<1e-12){if(t[p]<l||t[p]>d)return[1,0];continue}let m=(l-t[p])/c*s-.5,h=(d-t[p])/c*s-.5;m>h&&([m,h]=[h,m]),a=Math.max(a,Math.floor(m)-1),f=Math.min(f,Math.ceil(h)+1)}return[a,f]}var nr=class t{polys=[];rects=[];lines=[];solids=[];slants=[];budget={spots:1/0,over:!1,told:!1};hidden(e){let s=0;for(let r of ds(Fs(this.solids,Ir),...ka(e)))s+=zr(this.solids[r],e);return s}hiddenPoly(e){let s=0;for(let r of ds(Fs(this.solids,Ir),...gc(e)))s+=Bi(e,this.solids[r]);return s}costPoly(e,s=1/0){let r=gc(e),i=0;for(let o of ds(Fs(this.polys,n=>Ir(n.poly)),...r))i+=Bi(e,this.polys[o].poly);for(let o of ds(Fs(this.rects,n=>ka(n.r)),...r))i+=zr(e,this.rects[o].r)*2;for(let o of ds(Fs(this.slants,Ir),...r))i+=Bi(e,this.slants[o])*2;if(i>=s)return i;for(let o of ds(Kd(this.lines),...r)){if(i>=s)return i;let n=this.lines[Math.floor(o/65536)].pts,a=o%65536,f=n[a],p=n[a+1],c=Math.hypot(p[0]-f[0],p[1]-f[1]),l=Math.max(1,Math.ceil(c/4)),[d,m]=Gd(f,p,l,r);for(let h=d;h<=m;h++)kc(e,[f[0]+(p[0]-f[0])*(h+.5)/l,f[1]+(p[1]-f[1])*(h+.5)/l])&&(i+=c/l*4*.6)}return i}cost(e,s,r=.6){let i=ka(e),o=0;for(let n of ds(Fs(this.polys,a=>Ir(a.poly)),...i)){let a=this.polys[n];o+=zr(a.poly,e)*(a.owner===s?1.5:1)}for(let n of ds(Fs(this.rects,a=>ka(a.r)),...i)){let a=this.rects[n];(a.owner!==s||!s)&&(o+=wc(a.r,e)*2)}for(let n of ds(Fs(this.slants,Ir),...i))o+=zr(this.slants[n],e)*2;if(r){let n=-1,a=0;for(let f of ds(Kd(this.lines),...i)){let p=Math.floor(f/65536);p!==n&&(n>=0&&(o+=a*r),n=p,a=0);let c=this.lines[p].pts,l=f%65536,d=c[l],m=c[l+1],h=Math.hypot(m[0]-d[0],m[1]-d[1]),y=Math.max(1,Math.ceil(h/4)),[g,k]=Gd(d,m,y,i);for(let u=g;u<=k;u++){let b=d[0]+(m[0]-d[0])*(u+.5)/y,x=d[1]+(m[1]-d[1])*(u+.5)/y;b>=e.x&&b<=e.x+e.w&&x>=e.y&&x<=e.y+e.h&&(a+=h/y*4)}}n>=0&&(o+=a*r)}return o}fork(){let e=new t;return e.budget=this.budget,e.polys=this.polys,e.lines=this.lines,e.solids=this.solids,e.rects=[...this.rects],e.slants=this.slants,e}},Ud=14;function qi(t,e,s,r){let i=Math.max(t.name?Pn(t.name,wt.lbl):0,t.sub?Pn(t.sub,wt.sub):0)+4,o=(t.name?1:0)+(t.sub?1:0),n=s-(t.name?11:9)-1,a=(o-1)*Ud+(t.name?11:9)+4;return{x:r==="start"?e-2:r==="end"?e-i+2:e-i/2,y:n,w:i,h:a}}function Vi(t,e,s,r,i,o){let n=Hn(s),a=Ne((e.x0+e.x1)/2,(e.y0+e.y1)/2,e.z1)[0],p=((t.name?1:0)+(t.sub?1:0)-1)*Ud+4,c=n.y-6-p,l=n.y+Math.min(n.h,60)*.45,d=[];o&&d.push({...o,pen:0}),d.push({x:a,y:c,anchor:"middle",pen:o?20:0});for(let y of[12,24,40])d.push({x:a,y:c-y,anchor:"middle",pen:20+y});for(let y of[-30,30,-60,60])d.push({x:a+y,y:c-4,anchor:"middle",pen:30+Math.abs(y)});d.push({x:n.x+n.w+8,y:l,anchor:"start",pen:120}),d.push({x:n.x-8,y:l,anchor:"end",pen:120}),d.push({x:a,y:n.y+n.h+14,anchor:"middle",pen:300});let m,h=1/0;for(let y of d){let g=qi(t,y.x,y.y,y.anchor),k=r.cost(g,i,.15)*2+y.pen;k<h&&(h=k,m={x:y.x,y:y.y,anchor:y.anchor,rect:g})}return m}function xc(t,e,s,r){return{x:(r==="start"?e:r==="end"?e-t:e-t/2)-2,y:s-14,w:t+4,h:28}}function va(t,e,s,r,i){let o=[{...r,pen:0}];for(let c of[-46,-66,-86,-106,-126,-146])for(let l of[0,-70,70,-140,140])o.push({x:e+l,y:s+c,anchor:"middle",pen:10+(-c-46)*.5+Math.abs(l)*.4});for(let c of[34,60,86])o.push({x:e,y:s+c,anchor:"middle",pen:60+c*.3});let n=r.x-e,a=r.y-s;for(let c of[-1,1])for(let l of[16,32,48])o.push({...r,y:s+a+c*l,x:e+n,pen:5+l});for(let c of[-1,1])for(let l of[30,60,90])for(let d of[0,16,-16])o.push({...r,x:e+n+c*l,y:s+a+d,pen:8+l*.6+Math.abs(d)});let f,p=1/0;for(let c of o){let l=xc(t,c.x,c.y,c.anchor),d=i.cost(l,void 0,.05)*3+c.pen;d<p&&(p=d,f={x:c.x,y:c.y,anchor:c.anchor,rect:l})}return f}var Hd=t=>{let e=0;for(let s=0;s<t.length;s++){let r=t[s],i=t[(s+1)%t.length];e+=r[0]*i[1]-i[0]*r[1]}return e/2},bc=t=>Hd(t)<0?[...t].reverse():t;function kc(t,e){let s=bc(t);for(let r=0;r<s.length;r++){let i=s[r],o=s[(r+1)%s.length];if((o[0]-i[0])*(e[1]-i[1])-(o[1]-i[1])*(e[0]-i[0])<0)return!1}return!0}function Bi(t,e){let s=bc(t),r=bc(e);for(let i=0;i<r.length&&s.length;i++){let o=r[i],n=r[(i+1)%r.length],a=p=>(n[0]-o[0])*(p[1]-o[1])-(n[1]-o[1])*(p[0]-o[0]),f=s;s=[];for(let p=0;p<f.length;p++){let c=f[p],l=f[(p+1)%f.length],d=a(c),m=a(l);if(d>=0&&s.push(c),d>=0!=m>=0){let h=d/(d-m);s.push([c[0]+(l[0]-c[0])*h,c[1]+(l[1]-c[1])*h])}}}return s.length>=3?Math.abs(Hd(s)):0}var Ma=24;function Cr(t,e){let[s,r,i,o]=e,n=t.x+t.w/2,a=t.y+t.h/2,f=[["left",n-s],["right",s+i-n],["top",a-r],["bottom",r+o-a]];f.sort((c,l)=>c[1]-l[1]);let p=f[0][0];return p==="left"?{edge:p,dx:-(t.x+t.w-s)-Ma,dy:0}:p==="right"?{edge:p,dx:s+i-t.x+Ma,dy:0}:p==="top"?{edge:p,dx:0,dy:-(t.y+t.h-r)-Ma}:{edge:p,dx:0,dy:r+o-t.y+Ma}}function Pa(t,e,s){let r=x=>{let w=0;for(let $=x.parent;$;$=$.parent)w++;return w},i=x=>x.box.x0+x.box.y0+x.box.z0*.01,o=t.items.filter(x=>x.type==="region").sort((x,w)=>r(x)-r(w)||i(x)-i(w)),n=t.items.filter(x=>x.type==="node").sort((x,w)=>i(x)-i(w)||x.box.z0-w.box.z0),a=[],f=Math.min(90,400/Math.max(1,o.length)),p=650;o.forEach((x,w)=>{let $=Hn(Yt(x.box));a.push({id:x.id,kind:"region",...Cr($,s),delay:Math.round(w*f),dur:p,bbox:$})});let c=250+Math.round(f*o.length),l=Math.min(70,700/Math.max(1,n.length)),d=600;n.forEach((x,w)=>{let $=Hn(Yt(x.box));a.push({id:x.id,kind:"node",...Cr($,s),delay:Math.round(c+w*l),dur:d,bbox:$})});let m=n.length?c+(n.length-1)*l:c,h=Math.round(m+300),y=Math.min(30,300/Math.max(1,e.length)),g=400,k=e.filter(x=>x.points.length>=2).map((x,w)=>({id:x.id,delay:Math.round(h+w*y),dur:g})),u={delay:h+200,dur:400},b=Math.max(...a.map(x=>x.delay+x.dur),...k.map(x=>x.delay+x.dur),u.delay+u.dur);return{pieces:a,routes:k,labels:u,total:b}}var jr=["edge","drop","rise","fly","pop","scatter","build","fade"],Lr=["explode","lift-off","sink","scatter","fly-out","collapse","fade","reverse"],sr=["by-depth","by-layer","by-region","by-flow","as-listed","random"],Qd=["linear","ease","ease-in","ease-out","settle","spring","bounce"],Tn=t=>Math.round(t*100)/100||0,ln=t=>Math.round(t*1e4)/1e4||0;function rr(t){let e=i=>{let o=0;for(let n=i.parent;n;n=n.parent)o++;return o},s=i=>{let o=[];for(let n=i;n;n=n.parent){let a=(n.region??n.node)?.motion;a&&o.unshift(a)}return o.length?Object.assign({},...o):void 0},r=new Set(t.layout.items.filter(i=>i.region&&t.layout.catalog&&t.rendered.svg.includes(`class="tunnel" data-id="${i.id}"`)).map(i=>i.id));return{viewBox:t.rendered.viewBox,pieces:t.layout.items.map(i=>{let o=i.box,n=Ne((o.x0+o.x1)/2,(o.y0+o.y1)/2,o.z0),a=s(i);return{id:i.id,kind:i.type,...i.parent?{parent:i.parent.id}:{},depth:e(i),layer:r.has(i.id)?2:i.type==="region"?0:1,key:Tn(o.x0+o.y0+o.z0*.01),bbox:Hn(Yt(o)),foot:[Tn(n[0]),Tn(n[1])],base:[Ne(o.x0,o.y1,o.z0),Ne(o.x1,o.y1,o.z0),Ne(o.x1,o.y0,o.z0)].map(f=>[Tn(f[0]),Tn(f[1])]),...a?{motion:a}:{}}}),routes:t.routes.filter(i=>t.rendered.paths[i.id]).map(i=>({id:i.id,path:t.rendered.paths[i.id],...Xu(i.raw)})),notes:Object.fromEntries((t.raw.notes??[]).map((i,o)=>[`${t.id}-note-${o}`,i.on])),intro:t.rendered.assembly}}var Yd=t=>typeof t=="string"?t.split(".")[0]:void 0,Xu=t=>{let e=Yd(t.from),s=Yd(t.to);return{...e?{from:e}:{},...s?{to:s}:{}}},Oa=(t,e,s,r)=>i=>{if(i<=0)return 0;if(i>=1)return 1;let o=(f,p,c)=>3*f*c*(1-c)**2+3*p*c*c*(1-c)+c**3,n=0,a=1;for(let f=0;f<40;f++){let p=(n+a)/2;o(t,s,p)<i?n=p:a=p}return o(e,r,(n+a)/2)},$c={linear:t=>t,ease:Oa(.42,0,.58,1),"ease-in":Oa(.42,0,1,1),"ease-out":Oa(0,0,.58,1),settle:Oa(.16,.84,.3,1),spring:t=>t<=0?0:t>=1?1:1-Math.exp(-6*t)*Math.cos(9.5*t)*(1-t),bounce:t=>{if(t<=0)return 0;if(t>=1)return 1;let e=7.5625,s=2.75;return t<1/s?e*t*t:t<2/s?e*(t-1.5/s)**2+.75:t<2.5/s?e*(t-2.25/s)**2+.9375:e*(t-2.625/s)**2+.984375}};function Mc(t){let e=t>>>0;return()=>{e=e+1831565813>>>0;let s=e;return s=Math.imul(s^s>>>15,s|1),s^=s+Math.imul(s^s>>>7,s|61),((s^s>>>14)>>>0)/4294967296}}var Wd=t=>{let e=2166136261;for(let s=0;s<t.length;s++)e^=t.charCodeAt(s),e=Math.imul(e,16777619);return e>>>0},Yn=t=>Math.max(0,Math.min(1,t)),Aa=24;function Sc(t,e,s){let[r,i,o,n]=e;return s==="left"?[-(t.x+t.w-r)-Aa,0]:s==="right"?[r+o-t.x+Aa,0]:s==="top"?[0,-(t.y+t.h-i)-Aa]:[0,i+n-t.y+Aa]}function Oc(t,e,s={}){let r=t.pieces,i=new Map(r.map(y=>[y.id,y])),o=(y,g)=>y.depth-g.depth||y.key-g.key;if(e==="as-listed")return[...r];if(e==="random"){let y=Mc(s.seed??1);return r.map(g=>[y(),g]).sort((g,k)=>g[0]-k[0]).map(g=>g[1])}if(e==="by-layer")return[...r].sort((y,g)=>y.layer-g.layer||o(y,g));if(e==="by-depth")return[...r].sort((y,g)=>y.key-g.key||y.depth-g.depth);let n=new Map;for(let y of[...r].sort(o)){let g=n.get(y.parent)??[];g.push(y),n.set(y.parent,g)}let a=[],f=new Set,p=y=>{if(f.has(y.id))return;let g=y.parent?i.get(y.parent):void 0;g&&p(g),f.add(y.id),a.push(y)};if(e==="by-region"){let y=g=>{for(let k of n.get(g)??[])p(k),y(k.id)};return y(),a}let c=new Map,l=new Set;for(let y of t.routes)y.from&&y.to&&(c.set(y.from,[...c.get(y.from)??[],y.to]),l.add(y.to));let d=s.source??t.routes.find(y=>y.from&&!l.has(y.from))?.from??t.routes[0]?.from,m=d?[d]:[],h=new Set(m);for(;m.length;){let y=m.shift(),g=i.get(y);g&&p(g);for(let k of c.get(y)??[])h.has(k)||(h.add(k),m.push(k))}for(let y of[...r].sort(o))p(y);return a}var Qu={edge:"settle",drop:"settle",rise:"ease-out",fly:"settle",pop:"spring",scatter:"settle",build:"ease-out",fade:"linear",explode:"ease-in","lift-off":"ease-in",sink:"ease-in","fly-out":"ease-in",collapse:"ease-in"},eh={"lift-off":"lift",sink:"rise",scatter:"scatter","fly-out":"edge",fade:"fade",explode:"explode",collapse:"collapse"};function _r(t,e,s={}){let r=s.seed??1,i=e==="disassemble",o=i&&s.style==="reverse",n=Z=>{if(!i)return Z.motion?.style??s.style??"edge";let L=Z.motion?.out??s.style??"fly-out";return L==="reverse"?Z.motion?.style??s.of??"edge":eh[L]},a=Z=>i?Z.motion?.out??s.style??"fly-out":n(Z),f=!i&&!s.order&&s.stagger===void 0&&s.piece===void 0&&s.overlap===void 0&&(s.style??"edge")==="edge",p=s.order??(s.style==="build"?"by-layer":"by-depth"),c=[],l,d,m=(Z,L,U)=>{let H=n(Z),ee=Z.motion?.easing??s.easing??Qu[i&&a(Z)!=="reverse"?a(Z):H]??"ease";return{p:Z,delay:L+(Z.motion?.delay??0),dur:Math.max(1,Z.motion?.duration??U),style:H,curve:$c[ee],from:Z.motion?.from??s.from??"left"}};if(f){let Z=new Map(t.pieces.map(L=>[L.id,L]));for(let L of t.intro.pieces){let U=Z.get(L.id);U&&c.push(m(U,L.delay,L.dur))}l=t.intro.routes.map(L=>({...L})),d={...t.intro.labels}}else{let Z=Oc(t,p,{seed:r,source:s.source}),L=s.piece??600,U=s.stagger??Math.min(70,900/Math.max(1,Z.length)),H=Yn(s.overlap??.5),ee=o||i?[...Z].reverse():Z,j=Math.min(30,300/Math.max(1,t.routes.length)),q=400,G=400;if(i){d={delay:0,dur:G};let Q=G*(1-H);l=[...t.routes].reverse().map((Y,ie)=>({id:Y.id,delay:Q+ie*j,dur:q}));let ce=Math.max(Q,...l.map(Y=>Y.delay+Y.dur)),pe=Math.max(0,ce-H*q);ee.forEach((Y,ie)=>c.push(m(Y,pe+ie*U,L)))}else{ee.forEach((Y,ie)=>c.push(m(Y,ie*U,L)));let Q=Math.max(0,...c.map(Y=>Y.delay+Y.dur)),ce=Math.max(0,Q-H*L);l=t.routes.map((Y,ie)=>({id:Y.id,delay:ce+ie*j,dur:q}));let pe=Math.max(ce,...l.map(Y=>Y.delay+Y.dur));d={delay:Math.max(0,pe-H*G),dur:G}}}let h=s.pulses&&t.routes.length?700:0;if(h&&i)for(let Z of[...c,...l,d])Z.delay+=h;let y=Math.max(1,...c.map(Z=>Z.delay+Z.dur),...l.map(Z=>Z.delay+Z.dur),d.delay+d.dur),g=i?0:y;h&&!i&&(y+=h);let k=s.duration!==void 0?Math.max(1,s.duration)/y:1;for(let Z of[...c,...l,d])Z.delay=Tn(Z.delay*k),Z.dur=Math.max(.01,Tn(Z.dur*k));let u=s.duration!==void 0?Math.max(1,s.duration):Math.max(1,Tn(y)),b=new Map(c.map(Z=>[Z.p.id,Z])),x=new Map(l.map(Z=>[Z.id,Z])),[w,$,v,O]=t.viewBox,C=[w+v/2,$+O/2],A=Z=>[Z.x+Z.w/2,Z.y+Z.h/2],R=(Z,L)=>{let U=s.point;if(Array.isArray(U))return U;if(U==="region"||L==="collapse"&&U===void 0&&Z.parent){let H=t.pieces.find(ee=>ee.id===Z.parent);return H?H.foot:C}if(typeof U=="string"){let H=t.pieces.find(ee=>ee.id===U);if(H)return H.foot}return C};function M(Z,L,U){let{p:H}=Z,ee=H.bbox,j=1-L,q=(G,Q)=>({dx:Tn(G*j),dy:Tn(Q*j)});switch(Z.style){case"drop":return q(...Sc(ee,t.viewBox,"top"));case"lift":return q(...Sc(ee,t.viewBox,"top"));case"fly":return q(...Sc(ee,t.viewBox,Z.from));case"rise":{let G=ee.h*j,[Q,ce,pe]=H.base,Y=ee.y-ee.h-4;return{...q(0,ee.h),clip:[[Q[0],Q[1]-G],[ce[0],ce[1]-G],[pe[0],pe[1]-G],[pe[0]+2,Y-G],[Q[0]-2,Y-G]].map(ie=>[Tn(ie[0]),Tn(ie[1])])}}case"pop":return{scale:ln(Math.max(0,L)),about:H.foot,opacity:ln(Yn(U*4))};case"scatter":{let G=Mc((r^Wd(H.id))>>>0),Q=G()*Math.PI*2,ce=.35+G()*.65;return{...q(Math.cos(Q)*v*ce*.6,Math.sin(Q)*O*ce*.6),opacity:ln(Yn(L*1.6))}}case"build":return{...q(0,-18),opacity:ln(Yn(L))};case"fade":return{opacity:ln(Yn(L))};case"explode":{let G=R(H,"explode"),Q=A(ee),ce=Q[0]-G[0],pe=Q[1]-G[1],Y=Math.hypot(ce,pe),ie=Mc((r^Wd(H.id))>>>0),Ae=ie()*Math.PI*2,De=Y>1?[ce/Y,pe/Y]:[Math.cos(Ae),Math.sin(Ae)],I=Math.hypot(v,O)+Math.max(ee.w,ee.h);return q(De[0]*I,De[1]*I)}case"collapse":{let G=R(H,"collapse");return{...q(G[0]-H.foot[0],G[1]-H.foot[1]),scale:ln(Math.max(0,L)),about:H.foot,opacity:ln(Yn(L*3))}}default:{let G=Cr(ee,t.viewBox);return q(G.dx,G.dy)}}}let T=(Z,L,U)=>{let H=Yn((Z-L)/U);return i?1-H:H},S={opacity:0},N=s.connectors??"draw",z=s.labels??"fade",K=[...t.pieces.map(Z=>Z.id),...t.routes.map(Z=>Z.id),...Object.keys(t.notes)];function J(Z){let L=Math.max(0,Math.min(u,Number.isFinite(Z)?Z:0));if(i?L<=0:L>=u)return{};let U=i?L>=u:L<=0,H={},ee={},j={};for(let pe of c){let Y=U?0:T(L,pe.delay,pe.dur);Y<=0?H[pe.p.id]=S:Y<1&&(H[pe.p.id]=M(pe,i?1-pe.curve(1-Y):pe.curve(Y),Y))}for(let pe of t.routes){let Y=x.get(pe.id),ie=U||!Y?0:T(L,Y.delay,Y.dur);ie<=0?ee[pe.id]={opacity:0,drawn:0}:ie<1&&(ee[pe.id]=N==="fade"?{opacity:ln(ie)}:N==="grow"?{drawn:ln(ie),by:"grow"}:{drawn:ln($c["ease-out"](ie))})}let q=U?0:T(L,d.delay,d.dur),G=q<=0?S:q>=1?void 0:z==="type"?{typed:ln(q)}:{opacity:ln(q)};for(let pe of K){let Y=G;if(z==="with-piece"){let ie=Object.hasOwn(t.notes,pe)?t.notes[pe]:pe,Ae=ie===void 0?void 0:b.get(ie)??x.get(ie);if(Ae){let De=U?0:T(L,Ae.delay,Ae.dur);Y=De<=0?S:De>=1?void 0:{opacity:ln(De)}}}Y&&(j[pe]=Y)}let Q=[];if(h&&!U){let pe=(L-g*k)/(h*k);if(pe>0&&pe<1)for(let Y of t.routes)Q.push({route:Y.id,at:ln($c.ease(pe))})}let ce=pe=>Object.keys(pe).length>0;return{...ce(H)?{items:H}:{},...ce(j)?{labels:j}:{},...ce(ee)?{routes:ee}:{},...q<1?{marks:{opacity:ln(Math.max(0,q))}}:{},...Q.length?{tokens:Q}:{}}}return{kind:e,duration:u,pieces:c.map(Z=>({id:Z.p.id,delay:Z.delay,dur:Z.dur,style:a(Z.p)})),routes:l,labels:d,at:J}}var xt=t=>{let e=t.toFixed(2);return e==="-0.00"?"0":String(Number(e))},th=(t,e)=>`translate(${xt(t[0])} ${xt(t[1])}) scale(${Number(e.toFixed(4))}) translate(${xt(-t[0])} ${xt(-t[1])})`,Ac=t=>[...t.matchAll(/(-?[\d.]+),(-?[\d.]+)/g)].map(e=>[Number(e[1]),Number(e[2])]),Tc=t=>t.slice(1).reduce((e,s,r)=>e+Math.hypot(s[0]-t[r][0],s[1]-t[r][1]),0);function Ta(t,e){let s=Ac(t),r=Tc(s)*e;for(let i=0;i+1<s.length;i++){let o=Math.hypot(s[i+1][0]-s[i][0],s[i+1][1]-s[i][1]);if(r<=o&&o>0){let n=r/o;return[s[i][0]+(s[i+1][0]-s[i][0])*n,s[i][1]+(s[i+1][1]-s[i][1])*n]}r-=o}return s[s.length-1]??[0,0]}function nh(t,e){let s=Ac(t),r=Ta(t,e),i=[],o=Tc(s)*e;for(let n=0;n<s.length;n++){i.push(s[n]);let a=n+1<s.length?Math.hypot(s[n+1][0]-s[n][0],s[n+1][1]-s[n][1]):1/0;if(o<=a)break;o-=a}return"M"+[...i,r].map(n=>`${xt(n[0])},${xt(n[1])}`).join(" L")}var fs=t=>String(Number(t.toFixed(4)));function sh(t,e){let s=t.match(/&[^;\s]+;|[\s\S]/gu)??[];return s.slice(0,Math.round(s.length*e)).join("")}function rh(t){let e=[];return(t.dx||t.dy)&&e.push(`translate(${xt(t.dx??0)} ${xt(t.dy??0)})`),t.scale!==void 0&&t.scale!==1&&e.push(th(t.about??[0,0],t.scale)),{attrs:{...t.opacity===void 0||t.opacity===1?{}:{opacity:fs(t.opacity)},...e.length?{transform:e.join(" ")}:{}},clip:t.clip}}function ih(t,e){let s={attrs:t.opacity===void 0||t.opacity===1?{}:{opacity:fs(t.opacity)}};if(t.drawn!==void 0&&t.drawn<1&&e!==void 0){let r=Yn(t.drawn),i=Tc(Ac(e));s.path=t.by==="grow"?{d:nh(e,r),head:!1}:{style:`stroke-dasharray:${xt(i)} ${xt(i)};stroke-dashoffset:${xt(i*(1-r))}`,head:!1}}else t.ants&&(s.path={style:`stroke-dasharray:${xt(t.ants.dash[0])} ${xt(t.ants.dash[1])};stroke-dashoffset:${xt(-t.ants.offset)}`,head:!0});return s}function ef(t,e,s,r,i){if(r==="label"||r==="note"){let n=t.labels&&Object.hasOwn(t.labels,s)?t.labels[s]:void 0;return n&&{attrs:{...n.opacity===void 0||n.opacity===1?{}:{opacity:fs(n.opacity)},...n.dx||n.dy?{transform:`translate(${xt(n.dx??0)} ${xt(n.dy??0)})`}:{}},...n.typed===void 0||n.typed>=1?{}:{typed:n.typed}}}if(e==="route"){let n=t.routes&&Object.hasOwn(t.routes,s)?t.routes[s]:void 0;return n&&ih(n,i(s))}let o=t.items&&Object.hasOwn(t.items,s)?t.items[s]:void 0;return o&&rh(o)}function tf(t,e,s){let r=[];for(let i of t.outlines??[])r.push(["polygon",{points:i.points.map(o=>o.map(xt).join(",")).join(" "),class:"ring",fill:"none","stroke-width":"2.5","stroke-linejoin":"round",...i.opacity===void 0?{}:{opacity:fs(i.opacity)},...s?{stroke:i.color??s.control}:{style:`stroke:${i.color??"var(--ring,var(--control,currentColor))"}`}}]);for(let i of t.pulses??[])r.push(["ellipse",{cx:xt(i.x),cy:xt(i.y),rx:xt(i.rx),ry:xt(i.ry),class:"ring",fill:"none","stroke-width":"2.5",...i.opacity===void 0?{}:{opacity:fs(i.opacity)},...s?{stroke:i.color??s.control}:{style:`stroke:${i.color??"currentColor"}`}}]);for(let i of t.tokens??[]){let o=e(i.route);if(o===void 0)continue;let[n,a]=Ta(o,Yn(i.at));r.push(["circle",{cx:xt(n),cy:xt(a),r:"7",class:"tok",...s?{fill:i.color??(i.kind!==void 0?s.kinds?.[i.kind]:void 0)??s.control,stroke:s.surface,"stroke-width":"2.5"}:{style:`fill:${i.color??(i.kind!==void 0?`var(--${i.kind},var(--control,currentColor))`:"var(--control,currentColor)")}`}}])}return r}var nf=t=>Object.keys(t).every(e=>e==="morph"||t[e]===void 0),sf=new Set(["marks","badges"]),Jd=t=>t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;");function Pc(t){let e=new Map,s=[];for(let r of t.matchAll(/<(\/?)([a-zA-Z]+)((?:\s+[\w:-]+="[^"]*")*)\s*(\/?)>/g)){if(r[1]){let n=s.pop();n?.key!==void 0&&e.set(n.key,[n.from,r.index]);continue}if(r[4])continue;let i=/\sdata-item="([^"]*)"/.exec(r[3])?.[1],o=/\sdata-part="([^"]*)"/.exec(r[3])?.[1];s.push({...s.length===2&&i!==void 0&&o!==void 0?{key:`${of(i)}
143
- ${o}`}:{},from:r.index+r[0].length})}return e}var Xd=new WeakMap;function oh(t,e){let s=Xd.get(t)??new Map;Xd.set(t,s);let r=s.get(e);if(!r){s.set(e,r=new Map);let i=t.variants?.[e],o=Pc(t.svg);if(i!==void 0)for(let[n,[a,f]]of Pc(i)){let p=o.get(n);p&&t.looks?.[n.split(`
144
- `)[0]]?.includes(e)&&t.svg.slice(...p)!==i.slice(a,f)&&r.set(n,i.slice(a,f))}}return r}function rf(t,e,s,r){let i=[];for(let o of t.looks?.[e]??[]){let n=Yn(r[o]??0),a=n>0?oh(t,o).get(`${e}
145
- ${s}`):void 0;a!==void 0&&i.push([a,n])}return i.length?{own:Yn(1-i.reduce((o,[,n])=>o+n,0)),looks:i}:void 0}var ah=(t,e)=>(e.own>0?`<g opacity="${fs(e.own)}">${t}</g>`:"")+e.looks.map(([s,r])=>`<g opacity="${fs(r)}">${s}</g>`).join("");function lh(t,e){let s="",r=0;for(let[i,[o,n]]of[...Pc(t.svg)].sort((a,f)=>a[1][0]-f[1][0])){let[a,f]=i.split(`
146
- `),p=Object.hasOwn(e,a)?rf(t,a,f,e[a]):void 0;p&&(s+=t.svg.slice(r,o)+ah(t.svg.slice(o,n),p),r=n)}return s+t.svg.slice(r)}function Ki(t,e){if(nf(e))return t.rendered.svg;let s=e.variants?lh(t.rendered,e.variants):t.rendered.svg,r=l=>Object.hasOwn(t.rendered.paths,l)?t.rendered.paths[l]:void 0,i=0,o="",n="",a=0,f,p=s.replace(/<(\/?)([a-zA-Z]+)((?:\s+[\w:-]+="[^"]*")*)\s*(\/?)>|([^<]+)/g,(l,d,m,h,y,g)=>{if(g!==void 0)return f?.w.typed===void 0?l:sh(g,f.w.typed);if(d)return i--,f&&i===f.at&&(f=void 0),i===1&&(o=""),l;let k=i;y||i++;let u={};for(let[,b,x]of h.matchAll(/([\w:-]+)="([^"]*)"/g))u[b]=x;if(k===0){if(!e.camera)return l;u.viewBox=e.camera.map(xt).join(" ")}else if(k===1)if(o=m==="g"&&u.class?.startsWith("g-")?u.class.slice(2):"",sf.has(o)&&e.marks&&e.marks.opacity!==1)u.opacity=fs(e.marks.opacity);else return l;else if(k===2&&u["data-part"]!==void 0){let b=u["data-route"]===void 0?"item":"route",x=of(u["data-route"]??u["data-item"]??""),w=ef(e,b,x,u["data-part"],r);if(!w)return l;for(let[$,v]of Object.entries(w.attrs))u[$]=Jd(v);if(w.clip){let $=`${t.id}-mc${a++}`;n+=`<clipPath id="${$}"><polygon points="${w.clip.map(v=>v.join(",")).join(" ")}"/></clipPath>`,u["clip-path"]=`url(#${$})`}if(!y&&(w.path||w.typed!==void 0)&&(f={at:k,w}),!Object.keys(w.attrs).length&&!w.clip)return l}else if(f?.w.path&&m==="path"&&u.class?.split(" ")[0]==="flow"){let b=f.w.path;b.d!==void 0&&(u.d=b.d),b.style!==void 0&&(u.style=b.style),b.head||delete u["marker-end"]}else return l;return`<${m}${Object.entries(u).map(([b,x])=>` ${b}="${x}"`).join("")}${y?"/":""}>`});n&&(p=p.replace(/<defs>|<defs\/>/,l=>l==="<defs/>"?`<defs>${n}</defs>`:l+n));let c=tf(e,r,t.rendered.inks);return c.length&&(p=p.replace('<g class="g-anim">',l=>l+c.map(([d,m])=>`<${d}${Object.entries(m).map(([h,y])=>` ${h}="${Jd(y)}"`).join("")}/>`).join(""))),p}var of=t=>t.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&amp;/g,"&"),vc=new WeakMap;function Ea(t,e,s,r={}){let i=vc.get(t);if(i){for(let[u,b]of i.mixed)u.replaceChildren(...b);for(let[u,b]of i.attrs)for(let[x,w]of b)w===null?u.removeAttribute(x):u.setAttribute(x,w);for(let[u,b,x]of i.gone.reverse())b.insertBefore(u,x);for(let[u,b]of i.texts)u.data=b;for(let u of i.made)u.remove();vc.delete(t)}if(nf(e))return;let o={attrs:new Map,texts:new Map,gone:[],made:[],mixed:[]};vc.set(t,o);let n=(u,b,x)=>{let w=o.attrs.get(u)??new Map;w.has(b)||w.set(b,b==="style"?u.getAttribute(b)||null:u.getAttribute(b)),o.attrs.set(u,w),x===null?u.removeAttribute(b):u.setAttribute(b,x)},a=t.ownerDocument,f=(u,b,x)=>{let w=a.createElementNS("http://www.w3.org/2000/svg",u);for(let[$,v]of Object.entries(b))w.setAttribute($,v);return x.append(w),o.made.push(w),w},p=Array.from(t.children),c=u=>p.find(b=>b.getAttribute("class")===`g-${u}`),l=new Map;for(let u of Array.from(c("flows")?.children??[])){let b=u.getAttribute("data-route"),x=u.querySelector("path.flow")?.getAttribute("d");b!==null&&x&&l.set(b,x)}let d=u=>l.get(u);e.camera&&n(t,"viewBox",e.camera.map(xt).join(" "));for(let u of sf){let b=c(u);b&&e.marks&&e.marks.opacity!==1&&n(b,"opacity",fs(e.marks.opacity))}let m=0,h=p.find(u=>u.localName==="defs"),y=h?.firstChild??null,g=t.getAttribute("data-scene")??"scene";for(let u of p)for(let b of Array.from(u.children)){let x=b.getAttribute("data-part");if(x===null)continue;let w=b.getAttribute("data-route"),$=w===null?b.getAttribute("data-item")??"":"",v=s&&e.variants&&Object.hasOwn(e.variants,$)?rf(s,$,x,e.variants[$]):void 0;if(v){let A=Array.from(b.childNodes),R=(T,S)=>{let N=a.createElementNS("http://www.w3.org/2000/svg","g");return N.setAttribute("opacity",fs(T)),N.append(...S),N},M=T=>Array.from(a.importNode(new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg">${T}</svg>`,"image/svg+xml").documentElement,!0).childNodes);o.mixed.push([b,A]),b.replaceChildren(...v.own>0?[R(v.own,A)]:[],...v.looks.map(([T,S])=>R(S,M(T))))}let O=ef(e,w===null?"item":"route",w??b.getAttribute("data-item")??"",x,d);if(!O)continue;for(let[A,R]of Object.entries(O.attrs))n(b,A,R);if(O.clip&&h){let A=f("clipPath",{id:`${g}-mc${m++}`},h);h.insertBefore(A,y);let R=a.createElementNS("http://www.w3.org/2000/svg","polygon");R.setAttribute("points",O.clip.map(M=>M.join(",")).join(" ")),A.append(R),n(b,"clip-path",`url(#${A.id})`)}if(O.typed!==void 0){let A=[];for(let R=a.createTreeWalker(b,4);R.nextNode();)A.push(R.currentNode);for(let R of A)o.texts.set(R,R.data),R.data=Array.from(R.data).slice(0,Math.round(Array.from(R.data).length*O.typed)).join(""),R.data||(o.gone.push([R,R.parentNode,R.nextSibling]),R.remove())}let C=O.path&&b.querySelector("path.flow");C&&O.path&&(O.path.d!==void 0&&n(C,"d",O.path.d),O.path.style!==void 0&&(r.styles==="cssom"?(n(C,"style",null),C.style.cssText=O.path.style):n(C,"style",O.path.style)),O.path.head||n(C,"marker-end",null))}let k=c("anim");if(k)for(let[u,b]of tf(e,d,s?.inks))f(u,b,k)}var af=(t,e)=>({...e,frame:s=>Ki(t,e.at(s))}),Ec=(t,e={})=>af(t,_r(rr(t),"assemble",e)),lf=(t,e={})=>af(t,_r(rr(t),"disassemble",e)),cf=(t,e)=>Ec(t).frame(e);var za=(t,e)=>e.role??Ot(t,e.kind)?.role,Na=(t,e)=>Ot(t,e.region.kind)?.shape,xn=(t,e,s,r="item")=>s?Se("g",{[`data-${r}`]:t,"data-part":e},s):"";function Fr({scene:t,layout:e,routes:s,steps:r,theme:i,id:o,gridStep:n=1}){let a=new yr,f={base:"",floor:"",flows:"",blocks:[],air:"",labels:"",marks:"",badges:""},p=new nr;p.budget.spots=Ia;let c=S=>r.vis[S]?{"data-vis":"1"}:{},l=e.items.filter(S=>S.type==="region"),d=S=>{let N=0;for(let z=S.parent;z;z=z.parent)N++;return N},m=e.catalog,h=l.filter(S=>Na(m,S)!=="walled"&&Na(m,S)!=="tunnel"),y=mi(h.map(S=>({box:S.box,r:S}))).map(S=>S.r).sort((S,N)=>d(S)-d(N));for(let S of y)f.base+=ph(a,m,S,c(S.id),n);for(let S of l.filter(N=>Na(m,N)==="walled")){for(let z of Ra(S))p.solids.push(Yt(z));for(let[z,K]of Ra(S).entries())f.blocks.push({box:K,svg:xn(S.id,`wall-${z+1}`,Se("g",{class:`blk k-${za(m,S.region)} wall${S.region.ghost?" ghost":""}`,"data-id":S.id,"data-dim":"1",...c(S.id)},a.blockFaces(K)))});let N=S.region.gate;if(N&&!N.node){let z=Fi(S,N.height??(S.region.height??.8)+.3,.3,.3);p.solids.push(Yt(z)),f.blocks.push({box:z,svg:xn(S.id,"gate",Se("g",{class:"blk k-gate","data-id":S.id,...c(S.id)},a.blockFaces(z)))})}S.region.label&&(S.region["label-style"]??"face")!=="none"&&(f.labels+=xn(S.id,"name",a.faceText(S.box.x0+.3,S.box.y1,S.box.z0+.13,S.region.label,"slabname sm fz",wt.sm,"left","start",{"data-id":S.id,...c(S.id)})))}for(let S of l.filter(N=>Na(m,N)==="tunnel"))f.air+=xn(S.id,"block",fh(a,S,c(S.id)));let g=e.items.filter(S=>S.type==="node");for(let S of g){let N=S.node,z=An(m,N.asset),K=N.ghost||(N.deco??[]).includes("ghost"),J=["blk",`k-${N.role??z.role}`,z.cls,K?"ghost":""].filter(Boolean).join(" ");f.blocks.push({box:S.box,svg:xn(S.id,"block",Se("g",{class:J,"data-id":S.id,"data-dim":"1",...c(S.id)},z.draw(a,S.box,N)))}),p.polys.push({poly:Yt(S.box),owner:S.id}),p.solids.push(Yt(S.box))}let k=mi(f.blocks).map(S=>S.svg).join(""),u=new Set,b={};for(let S of s){if(S.points.length<2)continue;let N=S.points.map(J=>Ne(J[0],J[1],J[2]));N.forEach(J=>a.bounds.add(J));let z="M"+N.map(Us).join(" L");b[S.id]=z;let K=S.raw.arrow!==!1;K&&u.add(S.kind),f.flows+=xn(S.id,"line",Se("g",{"data-hl":S.id,"data-id":S.id,...c(S.id)},Se("path",{d:z,class:`flow f-${S.kind}`,"marker-end":K?`url(#ah-${o}-${S.kind})`:void 0})),"route"),p.lines.push({pts:N,owner:S.id})}for(let S of u)a.def(`ah-${o}-${S}`,Se("marker",{id:`ah-${o}-${S}`,viewBox:"0 0 10 10",refX:"7",refY:"5",markerWidth:"4.2",markerHeight:"4.2",orient:"auto-start-reverse"},Se("path",{d:"M0,0 L10,5 L0,10 z",style:`fill:${Un(i,i.kinds[S]?.color??"control")}`})));for(let S of a.planePolys)p.slants.push(S);let x=g.filter(S=>S.node.label||S.node.sub).sort((S,N)=>(N.box.x1-N.box.x0)*(N.box.y1-N.box.y0)-(S.box.x1-S.box.x0)*(S.box.y1-S.box.y0));for(let S of x)f.labels+=xn(S.id,"label",dh(a,m,S,p,c(S.id)));let w=[];for(let S of s)if(S.raw.label&&S.points.length>=2){let N=mh(a,S,p,c(S.id),e);f.floor+=xn(S.id,"label",N.svg,"route"),N.warning&&w.push({path:`${S.path}/label`,message:N.warning}),p.budget.over&&!p.budget.told&&(p.budget.told=!0,w.push({path:S.path,message:`from route "${S.id}" on, route labels were placed without weighing what other labels and lines cover: the scene is too large to search every spot (${Ia.toLocaleString("en")} spots); split it into scenes, or give the labels "along", "side" or "at"`}))}(t.notes??[]).forEach((S,N)=>{let z=xn(`${o}-note-${N}`,"note",uh(a,S,e,s,`${o}-note-${N}`));S.floor?f.floor+=z:f.labels+=z});let $=[],v=new Map;for(let S of r.says){let N=v.get(S.step)??p.fork();v.set(S.step,N);let z=Pn(S.text,wt.say)+18,K=va(z,S.ax,S.ay,{x:S.x,y:S.y,anchor:S.anchor},N);N.rects.push({r:K.rect,owner:""}),$.push({step:S.step,...K.rect,text:S.text});let J=K.rect.x+2;a.bounds.addRect(K.rect.x,K.rect.y,K.rect.w,K.rect.h);let Z=Un(i,i.kinds[S.kind]?.color??"control");f.marks+=Se("g",{class:"say","data-step":S.step},Se("rect",{x:J,y:K.y-12,width:z,height:24,rx:12,style:`stroke:${Z}`})+Se("text",{x:J+z/2,y:K.y+4,"text-anchor":"middle",style:`fill:${Z}`},vt(S.text)))}for(let S of r.marks){let[N,z]=Ne(...S.p);a.bounds.addRect(N-12,z-12,24,24),f.marks+=Se("g",{class:"xm","data-step":S.step,"data-hl":S.on},Se("circle",{cx:N,cy:z,r:10})+Se("path",{d:`M${bt(N-4.5)},${bt(z-4.5)} L${bt(N+4.5)},${bt(z+4.5)} M${bt(N+4.5)},${bt(z-4.5)} L${bt(N-4.5)},${bt(z+4.5)}`}))}for(let S of r.badges){let[N,z]=Ne(...S.p);a.bounds.addRect(N-13,z-13,26,26),f.badges+=Se("g",{class:`badge c-${S.kind}`,"data-go":S.step,"data-badge":S.step,tabindex:"0",role:"button","aria-label":`Step ${S.num}`},Se("circle",{cx:N,cy:z,r:11.5})+Se("text",{x:N,y:z+.5},String(S.num)))}let O=a.bounds,C=22,A=O.empty?[0,0,100,100]:[Math.floor(O.x0-C),Math.floor(O.y0-C),Math.ceil(O.x1-O.x0+C*2),Math.ceil(O.y1-O.y0+C*2)],R=[...a.defs.values()].join(""),M=(S,N)=>Se("g",{class:"g-"+S},N);return{svg:Se("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:A.join(" "),role:"img","aria-label":t.aria??t.title,"data-scene":o},Se("defs",{},R)+M("base",f.base)+M("floor",f.floor)+M("flows",f.flows)+M("blocks",k)+M("air",f.air)+M("labels",f.labels)+M("marks",f.marks)+M("badges",f.badges)+M("anim","")),viewBox:A,texts:a.texts,paths:b,warnings:w,callouts:$,assembly:Pa(e,s,A)}}function ch(t,e){let s=t.z1+.002,r=1e-6,i=[],o=(n,a)=>{let f=Ne(n[0],n[1],s),p=Ne(a[0],a[1],s);i.push(`M${Us(f)}L${Us(p)}`)};for(let n=Math.ceil((t.x0+r)/e)*e;n<t.x1-r;n+=e)o([n,t.y0],[n,t.y1]);for(let n=Math.ceil((t.y0+r)/e)*e;n<t.y1-r;n+=e)o([t.x0,n],[t.x1,n]);return i.length?Se("path",{class:"grid",d:i.join("")}):""}function ph(t,e,s,r,i=1){let o=s.region,n=s.box,a=za(e,o),f=Ot(e,o.kind),p=f?.shape,c={"data-id":s.id,"data-dim":"1",...r},l="";p==="cloud"?l=Se("g",{class:`blk k-${a} cloud`,...c},Er(t,n)):p==="zone"?l=Se("g",{class:`zone k-${a}`,...c},t.poly([[n.x0,n.y0,n.z1],[n.x1,n.y0,n.z1],[n.x1,n.y1,n.z1],[n.x0,n.y1,n.z1]])):l=Se("g",{class:`blk k-${a}${o.ghost?" ghost":""}`,...c},t.blockFaces(n)+ch(n,i)),l=xn(s.id,"block",l);let d=o["label-style"]??f?.labelStyle;if(o.label&&d!=="none")if(d==="face"){let m=n.z1-n.z0,h=u=>u.size*.73/lt,y=p==="slab"&&.28+h(wt.slabname)+.08>m,g=p==="slab"&&!y,k=g?n.z0+.28:y?n.z0+Math.max(.02,(m-h(wt.sm))/2):n.z0+Math.min(.1,m*.25);l+=xn(s.id,"name",Se("g",c,t.faceText(n.x0+(g?.6:.3),n.y1,k,o.label,g?"slabname":"slabname sm",g?wt.slabname:wt.sm,"left","start")))}else if(d==="face-right")l+=xn(s.id,"name",Se("g",c,t.faceText(n.x1,n.y0+.6,n.z0+Math.max(.14,(n.z1-n.z0)*.2),o.label,"slabname",wt.slabname,"right","end")));else{let m=p==="cloud"?"middle":"start",h=p==="cloud"?(n.x0+n.x1)/2:n.x0+.35,y=p==="cloud"?(n.y0+n.y1)/2:n.y1-.35;l+=xn(s.id,"name",Se("g",c,t.floorText(h,y,n.z1+.01,o.label,"slabname sm","x",m)))}return l}function Ra(t){let{x0:e,y0:s,x1:r,y1:i,z0:o,z1:n}=t.box,a=ps,f=t.region.gate,p=[],c=d=>{d.x1-d.x0>1e-6&&d.y1-d.y0>1e-6&&p.push({...d,z0:o,z1:n})},l=(d,m,h)=>{if(!f||f.side!==h)return[[d,m]];let y=f.at??.5,g=f.width??2,k=h==="e"||h==="w"?s+(i-s)*y:e+(r-e)*y;return[[d,k-g/2],[k+g/2,m]]};for(let[d,m]of l(e,r,"n"))c({x0:d,y0:s,x1:m,y1:s+a});for(let[d,m]of l(s+a,i-a,"w"))c({x0:e,y0:d,x1:e+a,y1:m});for(let[d,m]of l(s+a,i-a,"e"))c({x0:r-a,y0:d,x1:r,y1:m});for(let[d,m]of l(e,r,"s"))c({x0:d,y0:i-a,x1:m,y1:i});return p}function dh(t,e,s,r,i){let o=s.node,n=An(e,o.asset),a=s.box,f={name:o.label,sub:o.sub},p=o["label-at"],c;if(p){let d=Hn(Yt(a)),m=p.side??"above",h=d.y+Math.min(d.h,60)*.45;m==="right"?c={x:d.x+d.w+8,y:h,anchor:"start"}:m==="left"?c={x:d.x-8,y:h,anchor:"end"}:m==="below"?c={x:d.x+d.w/2,y:d.y+d.h+14,anchor:"middle"}:c=Vi(f,a,Yt(a),new nr,s.id),c={...c,x:c.x+(p.dx??0),y:c.y+(p.dy??0)}}else{let d=n.label?n.label(a,o,!!o.sub):void 0;c=Vi(f,a,Yt(a),r,s.id,d)}r.rects.push({r:qi(f,c.x,c.y,c.anchor),owner:""});let l="";return o.label&&(l+=t.text(c.x,c.y,o.label,"lbl",wt.lbl,c.anchor,{},s.id)),o.sub&&(l+=t.text(c.x,o.label?c.y+14:c.y,o.sub,"sub mono",wt.sub,c.anchor,{},s.id)),Se("g",{"data-id":s.id,"data-dim":"1",...i},l)}function fh(t,e,s){let{x0:r,y0:i,x1:o,y1:n,z0:a,z1:f}=e.box,p=t.blockFaces(e.box),c=o-r>=n-i,l=Math.max(1,Math.round((c?o-r:n-i)/1.6));for(let m=1;m<l;m++){let h=c?r+(o-r)*m/l:i+(n-i)*m/l;p+=t.poly(c?[[h,i,f],[h,n,f],[h,n,a]]:[[r,h,f],[o,h,f],[o,h,a]],"rib")}let d=e.region.label;return d&&e.region["label-style"]!=="none"&&(p+=c?t.faceText(r+.35,n,a+.14,d,"tunname",wt.tunname,"left","start"):t.faceText(o,n-.35,a+.18,d,"tunname",wt.tunname,"right","start")),Se("g",{class:"tunnel","data-id":e.id,"data-dim":"1",...s},p)}var Ia=2e4;function mh(t,e,s,r,i){let o=typeof e.raw.label=="string"?{text:e.raw.label}:e.raw.label,n=`floor mono t-${e.kind}`,a={"data-hl":e.id,...r},f=wt.floor;if(o.at){let u=o.at.length>2?o.at[2]:e.points[0][2];return{svg:t.floorText(o.at[0],o.at[1],u,o.text,n,o.dir??"x",o.anchor??"start",a)}}let p=e.points,c=[];for(let u=0;u+1<p.length;u++){let b=p[u],x=p[u+1];Math.abs(b[2]-x[2])>1e-6||c.push({i:u,len:Math.hypot(x[0]-b[0],x[1]-b[1])})}if(!c.length)return{svg:"",warning:`label "${o.text}" of route "${e.id}" was dropped: the route has no level segment`};let l=o.along?c.filter(u=>u.i===Math.min(o.along-1,p.length-2)):[...c].sort((u,b)=>b.len-u.len),d=.22,m=11/lt,h=u=>{let b=Pn(u,f)/lt,x,w=1/0,$=0;e:for(let v of l.length?l:c){let O=p[v.i],C=p[v.i+1],A=O[2],R=Math.abs(O[1]-C[1])<1e-6,M=R?Math.min(O[0],C[0]):Math.min(O[1],C[1]),T=R?Math.max(O[0],C[0]):Math.max(O[1],C[1]),S=R?O[1]:O[0],N=o.side==="left"?[-1]:o.side==="right"?[1]:[-1,1],z=[];for(let K=M+.3;K<=Math.max(M+.3,T-b-.2)+1e-9;K+=.4)z.push(K);for(let K=T-b-.2+.4;K<T+.5&&T-M<b+.5;K+=.6)z.push(K);for(let K of N)for(let J of z){if(w<=$*.5)break e;let Z=K<0?S-d:S+d+m,L,U,H;if(R?(L=J,U=Z,H=[Ne(L,U-m,A),Ne(L+b,U-m,A),Ne(L+b,U,A),Ne(L,U,A)]):(L=Z,U=J+b,H=[Ne(L-m,U,A),Ne(L-m,U-b,A),Ne(L,U-b,A),Ne(L,U,A)]),(R?[[L,U-m],[L+b,U-m],[L+b,U],[L,U]]:[[L-m,U],[L-m,U-b],[L,U-b],[L,U]]).some(([ce,pe])=>Math.abs(Rr(i,ce,pe)+.01-A)>.001)){$++;continue}let j=s.hiddenPoly(H),q=j*50+$*.5,G=s.budget.spots-- >0;G||(s.budget.over=!0);let Q=q>=w?1/0:G?q+s.costPoly(H,w-q):q;$++,Q<w&&(w=Q,x={x:L,y:U,z:A,dir:R?"x":"y",rect:Hn(H),poly:H,hidden:j})}}return x&&x.hidden<6?x:void 0},y=o.text,g=h(y),k;if(!g){let u=o.text.split(/(\s+)/);for(let b=u.length-1;b>0&&!g;b--){let x=u.slice(0,b).join("").trimEnd().replace(/[\s,;:·–-]+$/,"")+"\u2026";if(x.length<6)break;let w=h(x);w&&(g=w,y=x)}k=g?`label of route "${e.id}" shortened to "${y}": no clear floor for the whole text`:`label "${o.text}" of route "${e.id}" was dropped: blocks cover every spot beside it`,g?k+='; give it "along", "side" or "at", or move the nodes apart':k+='; give it "at: [x, y]", or move the nodes apart'}return g?(s.slants.push(g.poly),{svg:t.floorText(g.x,g.y,g.z+.01,y,n,g.dir,"start",a),warning:k}):{svg:"",warning:k}}function uh(t,e,s,r,i){let o=e.on?r.find(c=>c.id===e.on):void 0,n=e.on&&!o?s.byId.get(e.on):void 0,a=e.at,f={"data-id":i,"data-hl":o?.id,"data-dim":o?void 0:"1"},p=e.kind??o?.kind??"control";if(e.floor){let c=a&&a.length>2?a[2]:o?o.points[0][2]:n?n.floor:.36,[l,d]=a?[a[0],a[1]]:o?[o.points[0][0]+.35,o.points[0][1]-.25]:n?[n.box.x0+.3,n.box.y1-.3]:[0,0];return t.floorText(l,d,c+.01,e.floor,`floor mono t-${p}`,e.dir??"x",e.anchor??"start",f)}if(e.face){let c=n?.box,[l,d,m]=a?[a[0],a[1],a[2]??.45]:c?[c.x0+.3,c.y1,c.z0+.13]:[0,0,0];return t.faceText(l,d,m,e.face,"slabname sm",wt.sm,"left",e.anchor??"start",f)}if(e.label||e.sub){let c=n?.box,l=a?[a[0],a[1],a[2]??.36]:c?[(c.x0+c.x1)/2,(c.y0+c.y1)/2,c.z1+.75]:[0,0,0],[d,m]=Ne(l[0],l[1],l[2]),h=d+(e.dx??0),y=m-18+(e.dy??0),g=e.anchor??"middle",k="";return e.label&&(k+=t.text(h,y,e.label,"lbl",wt.lbl,g)),e.sub&&(k+=t.text(h,e.label?y+14:y,e.sub,"sub mono",wt.sub,g)),Se("g",f,k)}return""}function Ca(t,e){let s={};for(let r of t.layout.items){let i=(r.region??r.node)?.variants;i&&(s[r.id]=Object.keys(i))}Object.keys(s).length&&(t.rendered.looks=s,t.rendered.variants=Object.fromEntries([...new Set(Object.values(s).flat())].map(r=>[r,Fr({scene:t.raw,routes:t.routes,steps:t.steps,theme:e,id:t.raw.id,gridStep:t.grid.step??t.grid.snap??1,layout:{...t.layout,items:t.layout.items.map(i=>{let o=(i.region??i.node)?.variants?.[r];return o?i.region?{...i,region:{...i.region,...o,deco:void 0}}:{...i,node:{...i.node,...o}}:i})}}).svg])))}var Gi=29.09090909090909,Nc={solid:[9,7],dashed:[7,6],dotted:[3,6]},Rc=["blocked","planned"],pf=`
142
+ `)[0]}`,line:p.line,col:p.col,path:""})}function o(f,p={}){let c=Rd(f),l=s.contents,d={line:1,col:1},m=h=>{let y=h?.range;y&&(d=i(y[0]))};m(l);for(let h=0;h<c.length;h++){let y=c[h];if(pn(l)){let g=l.items.find(k=>et(k)&&Ue(k.key)&&String(k.key.value)===String(y));if(!g)break;if(p.key&&h===c.length-1)return m(g.key),d;m(g.key),l=g.value,l&&m(l)}else if(dn(l)&&typeof y=="number"){if(l=l.items[y],!l)break;m(l)}else break}return d}function n(f){let p=s.contents;for(let m of Rd(f)){if(pn(p)){let h=p.items.find(y=>et(y)&&Ue(y.key)&&String(y.key.value)===String(m));if(!h)return;p=h.value}else if(dn(p)&&typeof m=="number")p=p.items[m];else return;if(!p)return}let c=p.range;if(!c)return;let l=e.linePos(Math.max(c[0],c[1]-1)).line,d=t.split(/\r?\n/);for(;l>e.linePos(c[0]).line&&/^\s*(#.*)?$/.test(d[l-1]??"");)l--;return{start:e.linePos(c[0]).line,end:l}}let a=null;return s.errors.length||(a=s.toJS({maxAliasCount:100})),{data:a,locate:o,span:n,diags:r}}var Au=new Set(["svg","g","defs","marker","symbol","title","desc","path","polygon","polyline","line","rect","circle","ellipse","text","tspan","linearGradient","radialGradient","stop","clipPath"]),Tu=new Set(["id","class","role","transform","viewBox","width","height","x","y","x1","y1","x2","y2","cx","cy","r","rx","ry","fx","fy","d","points","offset","gradientUnits","gradientTransform","markerWidth","markerHeight","refX","refY","orient","markerUnits","text-anchor","dominant-baseline","font-size","font-weight","letter-spacing","fill","stroke","stroke-width","stroke-dasharray","stroke-linecap","stroke-linejoin","opacity","fill-opacity","stroke-opacity","stop-color","stop-opacity","marker-start","marker-mid","marker-end","clip-path","preserveAspectRatio","vector-effect","paint-order","style"]),Eu=new Set(["fill","stroke","marker-start","marker-mid","marker-end","clip-path","style"]),Nu={amp:"&",lt:"<",gt:">",quot:'"',apos:"'","#39":"'"},Id=t=>t.replace(/&(amp|lt|gt|quot|apos|#39);/g,(e,s)=>Nu[s]);function lc(t,e){return t.startsWith("data-")||t.startsWith("aria-")?/^[a-z][\w-]*$/.test(t):!(!Tu.has(t)||Eu.has(t)&&/url\(\s*(?!['"]?#)|javascript:|expression\(|@import/i.test(e))}function cc(t){let e={name:"#root",attrs:[],children:[]},s=[{node:e,dropped:!1}],r=/<(?:!--)[\s\S]*?-->|<\/([a-zA-Z][\w:-]*)\s*>|<([a-zA-Z][\w:-]*)((?:\s+[\w:-]+="[^"]*")*)\s*(\/?)>|([^<]+)/g,i,o=0;for(;i=r.exec(t);){if(i.index!==o)throw new Error(`not the renderer's SVG at ${o}: ${JSON.stringify(t.slice(o,o+40))}`);o=r.lastIndex;let n=s[s.length-1];if(i[0].charAt(1)!=="!"){if(i[1]){if(s.length<2||n.node.name!==i[1])throw new Error(`a stray </${i[1]}>`);s.pop();continue}if(i[2]){let a=i[2],f=[];for(let l of i[3].matchAll(/([\w:-]+)="([^"]*)"/g)){let d=l[1],m=Id(l[2]);d==="xmlns"||d.startsWith("xmlns:")||lc(d,m)&&f.push([d,m])}let p={name:a,attrs:f,children:[]},c=n.dropped||!Au.has(a);c||n.node.children.push(p),i[4]||s.push({node:p,dropped:c});continue}!n.dropped&&i[5].trim()&&n.node.children.push(Id(i[5]))}}if(o!==t.length)throw new Error(`not the renderer's SVG at ${o}`);if(s.length!==1)throw new Error(`<${s[s.length-1].node.name}> is never closed`);return e}var Ru="http://www.w3.org/2000/svg",zd=t=>t.replace(/var\(--([a-zA-Z][\w-]*)/g,"var(--iso-$1");function Cd(t,e=document){let s=i=>{let o=e.createElementNS(Ru,i.name);for(let[n,a]of i.attrs)n==="style"?o.style.cssText=zd(a):o.setAttribute(n,/var\(--/.test(a)?zd(a):a);for(let n of i.children)o.append(typeof n=="string"?e.createTextNode(n):s(n));return o},r=cc(t).children.find(i=>typeof i!="string"&&i.name==="svg");if(!r)throw new Error("the drawing has no <svg>");return s(r)}var Iu=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),Ii=class t{name;attrs=[];children=[];style={};constructor(e){this.name=e}setAttribute(e,s){let r=this.attrs.findIndex(i=>i[0]===e);r>=0?this.attrs[r][1]=String(s):this.attrs.push([e,String(s)])}getAttribute(e){return this.attrs.find(s=>s[0]===e)?.[1]??null}append(...e){for(let s of e)s!=null&&this.children.push(s)}set textContent(e){this.children=[String(e)]}get textContent(){return this.children.map(e=>typeof e=="string"?e:e.textContent).join("")}toNode(){let e=Object.entries(this.style).filter(([,s])=>s!==""&&s!==void 0).map(([s,r])=>`${Iu(s)}:${r}`).join(";");return{name:this.name,attrs:e?[...this.attrs,["style",e]]:[...this.attrs],children:this.children.map(s=>s instanceof t?s.toNode():s)}}},jd={createElementNS:(t,e)=>new Ii(e)},Ld=t=>t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),zu=t=>Ld(t).replace(/"/g,"&quot;");function pa(t,e=new Set(["style"])){if(typeof t=="string")return Ld(t);let s=t.attrs.map(([i,o])=>` ${i}="${zu(o)}"`).join("");if(!t.children.length)return`<${t.name}${s}/>`;let r=e.has(t.name)?t.children.map(i=>typeof i=="string"?i.replace(/<\//g,"<\\/"):pa(i,e)).join(""):t.children.map(i=>pa(i,e)).join("");return`<${t.name}${s}>${r}</${t.name}>`}var Cu=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function pc(t){let e=new TextEncoder().encode(t),s=e.length,r=Math.ceil((s+9)/64),i=new Uint8Array(r*64);i.set(e),i[s]=128;let o=new DataView(i.buffer);o.setUint32(i.length-4,s*8>>>0),o.setUint32(i.length-8,Math.floor(s/536870912));let n=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),a=new Uint32Array(64),f=(p,c)=>p>>>c|p<<32-c;for(let p=0;p<r;p++){for(let u=0;u<16;u++)a[u]=o.getUint32(p*64+u*4);for(let u=16;u<64;u++){let b=f(a[u-15],7)^f(a[u-15],18)^a[u-15]>>>3,x=f(a[u-2],17)^f(a[u-2],19)^a[u-2]>>>10;a[u]=a[u-16]+b+a[u-7]+x>>>0}let[c,l,d,m,h,y,g,k]=n;for(let u=0;u<64;u++){let b=k+(f(h,6)^f(h,11)^f(h,25))+(h&y^~h&g)+Cu[u]+a[u]>>>0,x=(f(c,2)^f(c,13)^f(c,22))+(c&l^c&d^l&d)>>>0;k=g,g=y,y=h,h=m+b>>>0,m=d,d=l,l=c,c=b+x>>>0}n[0]+=c,n[1]+=l,n[2]+=d,n[3]+=m,n[4]+=h,n[5]+=y,n[6]+=g,n[7]+=k}return[...n].map(p=>p.toString(16).padStart(8,"0")).join("")}function _d(t){if(t!=="sha256")throw new Error(`only sha256 here, not ${t}`);let e="",s={update(r){return e+=r,s},digest(r){return pc(e)}};return s}var Dd=t=>{if(t&&typeof t=="object"){Object.freeze(t);for(let e of Object.values(t))Dd(e)}return t},da=[86,81,76],ju=["send","reply","token","blocked","user","event","control","planned"],tn=Dd({light:{paper:"#ffffff",ink:"#141414",steps:[{top:"#f4f4f4",left:"#dcdcdc",right:"#c4c4c4",edge:"#3a3a3a"},{top:"#dedede",left:"#bfbfbf",right:"#a2a2a2",edge:"#2e2e2e"},{top:"#bcbcbc",left:"#9a9a9a",right:"#7e7e7e",edge:"#222222"},{top:"#8f8f8f",left:"#707070",right:"#565656",edge:"#141414"}]},dark:{paper:"#161616",ink:"#f2f2f2",steps:[{top:"#2a2a2a",left:"#222222",right:"#1b1b1b",edge:"#b8b8b8"},{top:"#454545",left:"#383838",right:"#2c2c2c",edge:"#c8c8c8"},{top:"#6a6a6a",left:"#565656",right:"#444444",edge:"#dadada"},{top:"#9c9c9c",left:"#808080",right:"#686868",edge:"#141414"}]},patterns:["none","hatch","hatch-wide","dots"],rhythms:[{dash:[],width:2.6},{dash:[9,4],width:2.4},{dash:[7,6],width:2.4},{dash:[3,6],width:2.4},{dash:[1.5,3.5],width:2.6},{dash:[10,3,2,3],width:2.4},{dash:[],width:1.4},{dash:[7,6],width:1.4},{dash:[3,3],width:1.6},{dash:[14,4],width:1.8}],kindOrder:ju,thresholds:da,darkWidthAdd:.4}),Lu=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i,_u=/^hsl\(\s*([+-]?(?:\d+\.?\d*|\.\d+))\s+([+-]?(?:\d+\.?\d*|\.\d+))%\s+([+-]?(?:\d+\.?\d*|\.\d+))%\s*\)$/i;function Fu(t){if(typeof t!="string")throw new Error(`mono: invalid colour "${String(t)}"`);let e=t.trim(),s=Lu.exec(e);if(s){let i=s[1];return i.length===3?[parseInt(i[0]+i[0],16)/255,parseInt(i[1]+i[1],16)/255,parseInt(i[2]+i[2],16)/255]:[parseInt(i.slice(0,2),16)/255,parseInt(i.slice(2,4),16)/255,parseInt(i.slice(4,6),16)/255]}let r=_u.exec(e);if(r){let i=Number(r[1]),o=Number(r[2]),n=Number(r[3]);if(!Number.isFinite(i)||o<0||o>100||n<0||n>100)throw new Error(`mono: invalid colour "${t}"`);let a=(i%360+360)%360,f=o/100,p=n/100,c=f*Math.min(p,1-p),l=d=>{let m=(d+a/30)%12;return p-c*Math.max(-1,Math.min(m-3,9-m,1))};return[l(0),l(8),l(4)]}throw new Error(`mono: invalid colour "${t}"`)}function dc(t){let[e,s,r]=Fu(t),i=o=>o<=.04045?o/12.92:((o+.055)/1.055)**2.4;return .2126*i(e)+.7152*i(s)+.0722*i(r)}function zi(t){let e=dc(t);return e>216/24389?116*Math.cbrt(e)-16:24389/27*e}function Ci(t,e){let s=dc(t),r=dc(e);return(Math.max(s,r)+.05)/(Math.min(s,r)+.05)}var Du=new Set(tn.patterns),Bu=new Map(tn.kindOrder.map((t,e)=>[t,e])),qu=(t,e)=>t<e?-1:t>e?1:0,Fd=t=>[...new Set(t)].sort(qu),Vu=t=>Math.round(t*100)/100;function Ku(t){return t>=da[0]?0:t>=da[1]?1:t>=da[2]?2:3}function Gu(t){if(t.roles)for(let[e,s]of Object.entries(t.roles)){if(s.step!==void 0&&(typeof s.step!="number"||!Number.isInteger(s.step)||s.step<0||s.step>3))throw new Error(`mono: invalid step "${String(s.step)}" for role "${e}"`);if(s.pattern!==void 0&&(typeof s.pattern!="string"||!Du.has(s.pattern)))throw new Error(`mono: invalid pattern "${String(s.pattern)}" for role "${e}"`)}if(t.kinds)for(let[e,s]of Object.entries(t.kinds)){if(s.dash!==void 0&&(!Array.isArray(s.dash)||!s.dash.every(r=>typeof r=="number"&&Number.isFinite(r)&&r>=0)))throw new Error(`mono: invalid dash "${String(s.dash)}" for kind "${e}"`);if(s.width!==void 0&&(typeof s.width!="number"||!Number.isFinite(s.width)||s.width<=0))throw new Error(`mono: invalid width "${String(s.width)}" for kind "${e}"`)}}function fa(t,e,s,r){if(e!=="light"&&e!=="dark")throw new Error(`mono: invalid mode "${String(e)}"`);r&&Gu(r);let i=tn[e],o=[],n=t.light["l-top"],a=Fd(s?.roles??Object.keys(t.roles)),f=new Map,p=[[],[],[],[]];for(let g of a){let k=r?.roles?.[g]?.step,u;if(k!==void 0)u=k;else{let b=t.roles[g];if(!b)throw new Error(`mono: unknown role "${g}"`);if(typeof n!="string")throw new Error('mono: theme.light is missing "l-top"');u=Ku(zi(`hsl(${b.h} ${b.s}% ${n})`))}f.set(g,u),p[u].push(g)}let c=new Map;for(let g=0;g<p.length;g++){let k=p[g];for(let u=0;u<k.length;u++){let b=k[u],x=r?.roles?.[b]?.pattern;if(x!==void 0)c.set(b,x);else{let w=u%tn.patterns.length,$=tn.patterns[w];if(c.set(b,$),u>=tn.patterns.length){let S=k.slice(0,u).find(O=>c.get(O)===$);S!==void 0&&o.push(`role "${b}" wraps on step ${g} to pattern "${$}", matching "${S}"`)}}}}let l={};for(let g of a){let k=f.get(g),u=c.get(g),b=i.steps[k];l[g]={step:k,pattern:u,top:b.top,left:b.left,right:b.right,edge:b.edge}}let d=Fd(s?.kinds??Object.keys(t.kinds)),m=e==="dark"?tn.darkWidthAdd:0,h={},y=0;for(let g of d){let k=r?.kinds?.[g],u=Bu.get(g),b;if(u!==void 0)b=u;else if(b=tn.kindOrder.length+y,y++,b>=tn.rhythms.length){let S=b%tn.rhythms.length;(!k||k.dash===void 0||k.width===void 0)&&o.push(`kind "${g}" exceeds the ${tn.rhythms.length} line rhythms; reusing rhythm ${S}`),b=S}let x=tn.rhythms[b],w=k?.dash!==void 0?[...k.dash]:[...x.dash],$=k?.width!==void 0?k.width:Vu(x.width+m);h[g]={dash:w,width:$}}return{mode:e,paper:i.paper,ink:i.ink,roles:l,kinds:h,warnings:o}}var Cf={};yo(Cf,{ANTS_CSS:()=>mf,ANT_DASH:()=>zc,ANT_SPEED:()=>Gi,ANT_STILL:()=>Cc,ASSEMBLE_STYLES:()=>jr,BOARD_3D:()=>qs,BOARD_CSS:()=>Rf,DISASSEMBLE_STYLES:()=>Lr,EASING_NAMES:()=>Yi,EXTRAPOLATE:()=>or,FLAT_DEFAULTS:()=>Wc,FLAT_FONTS:()=>Jc,FONT_STACKS:()=>Qi,GRID_CSS:()=>to,LABEL_BUDGET:()=>ja,MARKS_CSS:()=>eo,MOTION_EASINGS:()=>nf,MOTION_ORDERS:()=>sr,MOTION_SCHEMA:()=>bf,MotionBuilder:()=>Ui,NodesBuilder:()=>Dr,Obstacles:()=>nr,PAGE_CSS:()=>Zc,PLAYER_CSS:()=>Ya,PLAYER_UI_CSS:()=>Uc,ROUTE_BUDGET:()=>$a,SeriesBuilder:()=>Br,WALL_T:()=>ps,alongPath:()=>Ra,antDash:()=>Zi,antsOf:()=>Ss,assemble:()=>Ic,assembly:()=>Ta,baseCss:()=>Ur,bezier:()=>Ds,bindMotion:()=>vs,boardCatalog:()=>If,boardDiagram:()=>zf,boardErrors:()=>Xa,boardOf:()=>Qa,boxAsset:()=>an,boxSilhouette:()=>Pf,calloutRect:()=>Sc,cardAsset:()=>Xc,checkMotion:()=>qa,cloudPath:()=>yc,compileRaw:()=>Wa,convexOverlap:()=>Bi,curveAt:()=>Vr,defaultLabel:()=>Vd,disassemble:()=>df,drawCloud:()=>Er,drawDecos:()=>hc,drawLooks:()=>_a,drawingCss:()=>ar,durationFor:()=>Kc,easeOf:()=>Xn,facePainter:()=>tr,flatHit:()=>Nf,floorAt:()=>Rr,floorOf:()=>Of,focusView:()=>Ba,gateBox:()=>Fi,iconPainter:()=>ji,inConvex:()=>vc,introSvg:()=>ff,kindsCss:()=>ua,labelRect:()=>qi,layoutFlat:()=>Hr,lineRectArea:()=>Yd,localAt:()=>Mf,markCss:()=>ha,metricsMeasure:()=>Ef,midpoint:()=>Gc,monoCss:()=>Vc,monoOfDrawing:()=>Ua,monoTheme:()=>qc,motion:()=>hf,motionModel:()=>rr,motionOfSteps:()=>Va,motionOrder:()=>Ec,motionSource:()=>Ji,msOf:()=>kn,noSource:()=>Hc,nodeKind:()=>er,nodeKindOr:()=>Tn,offscreen:()=>Cr,openList:()=>wc,overlap2:()=>ga,overlaps:()=>Ja,paddingOf:()=>Af,paint:()=>Ia,paintMono:()=>Za,parseEnd:()=>wn,place:()=>Nr,placeBoard:()=>no,placeCallout:()=>Oa,placeNodeLabel:()=>Vi,placeholderIcon:()=>uc,planOf:()=>_r,plate:()=>Li,polyBounds:()=>Yn,polyRectArea:()=>zr,readMs:()=>Wi,rectArea:()=>$c,regionKind:()=>Ot,regionRole:()=>La,registerMarks:()=>qd,renderScene:()=>Fr,resolveSteps:()=>Ha,resolveSvg:()=>Zr,routeAll:()=>Sa,screenToGrid:()=>vf,silhouette:()=>Yt,simplify:()=>Di,snapMove:()=>Tf,springAt:()=>qr,svgAt:()=>Ki,usedIn:()=>Bc,wallHeight:()=>ma,wallsOf:()=>Ca,withAnts:()=>Fa});var Ot=(t,e)=>e!==void 0&&Object.hasOwn(t.regions,e)?t.regions[e]:void 0,er=(t,e)=>t.nodes[e??t.defaultNode],Tn=(t,e)=>er(t,e)??t.nodes[t.defaultNode],ma=t=>Object.values(t.regions).find(e=>e.shape==="walled")?.z[1]??.8,ua=t=>Object.values(t.regions).map(e=>e.css??"").join("");var fc=Object.create(null),mc=[];function qd(t){Object.assign(fc,t.icons??{}),Object.assign(gr,t.faces??{}),t.css&&!mc.includes(t.css)&&mc.push(t.css)}var ha=()=>mc.join(""),ji=t=>Object.hasOwn(fc,t)?fc[t]:void 0,tr=t=>Object.hasOwn(gr,t)?gr[t]:void 0;function uc(t,e){let s=(e.x0+e.x1)/2,r=(e.y0+e.y1)/2,i=e.z1+.005,o=Math.min(.6,(e.x1-e.x0)*.24,(e.y1-e.y0)*.24),n=[[s-o,r-o,i],[s+o,r-o,i],[s+o,r+o,i],[s-o,r+o,i]];return t.poly(n,"ico-unknown")+t.line3([s-o*.3,r-o*.35,i],[s+o*.3,r-o*.35,i],"ico-unknown-q")+t.line3([s+o*.3,r-o*.35,i],[s,r+o*.1,i],"ico-unknown-q")+t.line3([s,r+o*.45,i],[s,r+o*.5,i],"ico-unknown-q")}function hc(t,e,s){let r="";for(let i of s??[])i==="terminal"?r+=pi(t,e,3):i==="envelope"?r+=wo(t,e):i==="bubble"?r+=xo(t,e):i==="file-lines"?r+=ko(t,e):typeof i=="object"&&(i.terminal&&(r+=pi(t,e,i.terminal)),i.icon&&(r+=(ji(i.icon)??uc)(t,e)));return r}var Zu=(t,e)=>(t.deco??e.deco??[]).filter(s=>s!=="ghost");function an(t,e,s,r,i,o){let n={name:t,description:e,size:s,role:r,deco:i,draw:(a,f,p)=>a.blockFaces(f)+hc(a,f,Zu(p,n))+(o?o(a,f):"")};return n}function Li(t){let[e,s]=Hs(t);return{x0:e-.75,y0:s-.75,x1:e+.75,y1:s+.75,z0:t.z0,z1:t.z0+.18}}function yc(t,e){let s=Math.max(8,Math.min(t,e)*.18),r=s*.55,i=r,o=r,n=t-r,a=e-r,f=(p,c,l,d)=>{let m=Math.hypot(l-p,d-c),h=Math.max(1,Math.round(m/(s*1.7))),y="";for(let g=1;g<=h;g++){let k=p+(l-p)*g/h,u=c+(d-c)*g/h,b=m/h/2*1.08;y+=` A${b.toFixed(1)},${b.toFixed(1)} 0 0 1 ${k.toFixed(1)},${u.toFixed(1)}`}return y};return`M${i.toFixed(1)},${o.toFixed(1)}`+f(i,o,n,o)+f(n,o,n,a)+f(n,a,i,a)+f(i,a,i,o)+"Z"}function Er(t,e){let s={...e,z0:e.z1},r=a=>{let[f,p]=Re(e.x0,e.y0,a);return[Ct,.5,-Ct,.5,f,p]},i=(e.x1-e.x0)*ct,o=(e.y1-e.y0)*ct,n=yc(i,o);return t.onMatrix(r(e.z0),i,o,()=>Me("path",{d:n,class:"lft cloud-side"}))+t.onMatrix(r(e.z1),i,o,()=>Me("path",{d:n,class:"top cloud-top"}))}function Vd(t,e){let[s,r]=Re((t.x0+t.x1)/2,(t.y0+t.y1)/2,t.z1+.75);return{x:s,y:r-18+(e?0:6),anchor:"middle"}}var ps=.16,gc=["right-of","left-of","below","behind"];function Nr(t,e,s,r,i,o={},n){let a=[],f=(P,E,v,N=!1,C="error")=>{let V=s.locate(P,{key:N});a.push({severity:C,message:E,line:V.line,col:V.col,path:P,hint:v})},p=[],c=new Map,l=[],d=new Map,m=new Set([...Object.keys(r.roles),...Object.keys(o)]);function h(P,E){let v=c.get(P.id);if(v){let N=s.locate(v.path+"/id");return f(P.path+"/id",`duplicate id "${P.id}" (first used on line ${N.line})`),!1}return c.set(P.id,P),p.push(P),P.parent=E,E?E.children.push(P):l.push(P),!0}let y=()=>({x0:0,y0:0,z0:0,x1:0,y1:0,z1:0});function g(P,E,v){let N={id:P.id,type:"node",path:E,children:[],box:y(),floor:0,node:P,appears:P.appears,disappears:P.disappears};h(N,v)&&(P.nodes??[]).forEach((C,V)=>g(C,`${E}/nodes/${V}`,N))}function k(P,E,v){let N={id:P.id,type:"region",path:E,children:[],box:y(),floor:0,region:P,appears:P.appears,disappears:P.disappears};h(N,v)&&((P.nodes??[]).forEach((C,V)=>g(C,`${E}/nodes/${V}`,N)),(P.regions??[]).forEach((C,V)=>k(C,`${E}/regions/${V}`,N)))}(t.regions??[]).forEach((P,E)=>k(P,`${e}/regions/${E}`,void 0)),(t.nodes??[]).forEach((P,E)=>g(P,`${e}/nodes/${E}`,void 0));let u=()=>c.keys(),b=()=>p.filter(P=>P.type==="region").map(P=>P.id);for(let P of[...p]){let E=P.node??P.region;if(E.in!==void 0){let N=c.get(E.in);if(!N){f(P.path+"/in",`unknown region "${E.in}"`+_i(E.in,b()));continue}if(N.type!=="region"){f(P.path+"/in",`"${E.in}" is a node, not a region; put nodes on a node with its own "nodes:" list`);continue}if(P.parent&&P.parent!==N){f(P.path+"/in",`"${P.id}" is written inside "${P.parent.id}" but says in: ${E.in}; use one or the other`);continue}for(let C=N;C;C=C.parent)if(C===P){f(P.path+"/in",`"${P.id}" cannot be inside itself`);continue}P.parent||(l.splice(l.indexOf(P),1),P.parent=N,N.children.push(P))}if(P.node){let N=P.node.asset;N!==void 0&&!er(i,N)&&f(P.path+"/asset",`unknown asset "${N}"`+_i(N,Object.keys(i.nodes)),`assets: ${Object.keys(i.nodes).join(", ")}`)}let v=(P.node??P.region).role;v!==void 0&&!m.has(v)&&f(P.path+"/role",`unknown colour role "${v}"`+_i(v,m),`add it under "roles:" at the top of the file, or use one of: ${[...m].join(", ")}`)}for(let P of p){let E=P.region?.gate;if(!E?.node)continue;let v=c.get(E.node);if(!v){f(P.path+"/gate/node",`unknown node "${E.node}"`+_i(E.node,u()));continue}if(v.type!=="node"){f(P.path+"/gate/node",`"${E.node}" is a region; a gate is a node`);continue}v.placedBy=P.id;let N=v.node;(N.at||gc.some(C=>N[C]))&&f(v.path,`"${v.id}" is the gate of "${P.id}", which places it; its own placement is ignored`,void 0,!1,"warning")}let x=P=>P.gap??t.gap??2;function w(P){let E=P.node,v=Tn(i,E.asset),N=E.size,C=v.size[0],V=v.size[1],Y=v.size[2];if(N&&(C=N[0],V=N[1],N.length>2&&(Y=N[2])),P.placedBy){let Z=c.get(P.placedBy).region,j=Z.gate,K=j.width??2,U=N?Math.min(C,V):.3;Y=N&&N.length>2?Y:j.height??(Z.height??ma(i))+.3,j.side==="e"||j.side==="w"?(C=U,V=K):(C=K,V=U)}return[C,V,Y]}function $(P,E,v,N,C){for(let H of E)O(H);let V=E.filter(H=>!H.placedBy),Y=new Set(V),Z=new Set,j=[],K=new Set,U=H=>{let oe=H.node??H.region,Ae=[];for(let _e of gc){let I=oe[_e];if(I===void 0)continue;let se=c.get(I);if(!se){f(`${H.path}/${_e}`,`unknown id "${I}"`+_i(I,u()));continue}if(se===H){f(`${H.path}/${_e}`,`"${H.id}" cannot be placed ${_e} itself`);continue}if(!Y.has(se)){let ge=xe=>xe.parent?`"${xe.parent.id}"`:"the scene";f(`${H.path}/${_e}`,`"${I}" is in ${ge(se)} but "${H.id}" is in ${ge(H)}; relative placement works between items in the same region`,se.placedBy?`"${I}" is a gate, placed by its ${c.get(se.placedBy)?.region?.kind??"region"}`:`place "${H.id}" relative to something in ${ge(H)}, or use "at:"`);continue}Ae.push(se)}if(!Ae.length&&!oe.at){let _e=V.indexOf(H);_e>0&&Ae.push(V[_e-1])}return Ae},ee=H=>{if(!Z.has(H)){if(K.has(H)){f(H.path,`placement loop: "${H.id}" is placed relative to something placed relative to it`);return}K.add(H),U(H).forEach(ee),K.delete(H),Z.add(H),j.push(H)}};V.forEach(ee);for(let H of j){let oe=H.node??H.region,Ae=d.get(H),_e=gc.find(I=>oe[I]!==void 0&&c.get(oe[I])&&Y.has(c.get(oe[I])));if(oe.at&&_e&&f(`${H.path}/at`,`"${H.id}" has both "at" and "${_e}"; "at" wins`,void 0,!0,"warning"),oe.at)Ae.x=oe.at[0],Ae.y=oe.at[1];else if(_e)S(Ae,d.get(c.get(oe[_e])),_e,x(oe),oe.align??"center");else{let I=V.indexOf(H);I>0?S(Ae,d.get(V[I-1]),N==="row"?"right-of":"below",x(oe),"center"):(Ae.x=v,Ae.y=v)}oe.shift&&(Ae.x+=oe.shift[0],Ae.y+=oe.shift[1])}if(C||!V.length)return{w:0,d:0};let L=1/0,q=1/0,G=-1/0,X=-1/0;for(let H of V){let oe=d.get(H);L=Math.min(L,oe.x),q=Math.min(q,oe.y),G=Math.max(G,oe.x+oe.w),X=Math.max(X,oe.y+oe.d)}let ce=Math.min(0,L-v),le=Math.min(0,q-v);if(ce||le)for(let H of V){let oe=d.get(H);oe.x-=ce,oe.y-=le}return{w:G-ce+v,d:X-le+v}}function S(P,E,v,N,C){let V=()=>{P.y=C==="start"?E.y:C==="end"?E.y+E.d-P.d:E.y+(E.d-P.d)/2},Y=()=>{P.x=C==="start"?E.x:C==="end"?E.x+E.w-P.w:E.x+(E.w-P.w)/2};v==="right-of"?(P.x=E.x+E.w+N,V()):v==="left-of"?(P.x=E.x-N-P.w,V()):v==="below"?(P.y=E.y+E.d+N,Y()):(P.y=E.y-N-P.d,Y())}function O(P){if(P.type==="node"){let[j,K,U]=w(P);d.set(P,{x:0,y:0,w:j,d:K,h:U,z:P.node.z??0}),P.children.length&&$(P,P.children,0,"row",!0);return}let E=P.region,v=E.padding??Ot(i,E.kind)?.pad,N=!!E.size,C=$(P,P.children,v,E.flow??"row",N),V=E.size?E.size[0]:Math.max(C.w,v*2+.5),Y=E.size?E.size[1]:Math.max(C.d,v*2+.5);if(!E.size&&E.gate){let j=(E.gate.width??2)+1;E.gate.side==="e"||E.gate.side==="w"?Y=Math.max(Y,j):V=Math.max(V,j)}let Z=E.size&&E.size.length>2?E.size[2]:E.height??Ot(i,E.kind).z[1];d.set(P,{x:0,y:0,w:V,d:Y,h:Z,z:0})}$(void 0,l,0,t.flow??"row",!0);function z(P,E,v,N){let C=d.get(P),V=E+C.x,Y=v+C.y;if(P.type==="region"){let Z=Ot(i,P.region.kind),[j]=Z.z,K=Z.floor,U=Z.shape==="slab"&&Ot(i,P.parent?.region?.kind)?.shape==="slab"?0:j,ee=P.region.z??0,L=N+U+ee,q=N+C.h+ee;P.box={x0:V,y0:Y,z0:L,x1:V+C.w,y1:Y+C.d,z1:q},P.floor=K?q:N}else{let Z=N+C.z;P.box={x0:V,y0:Y,z0:Z,x1:V+C.w,y1:Y+C.d,z1:Z+C.h},P.floor=P.box.z1}for(let Z of P.children)Z.placedBy||z(Z,V,Y,P.floor)}for(let P of l)P.placedBy||z(P,0,0,0);if(n){let P=v=>Math.round(v/n)*n,E=v=>Math.round(v*1e9)/1e9;for(let v of p){if(v.placedBy)continue;let N=v.box,C=P(N.x0),V=P(N.x1),Y=P(N.y0),Z=P(N.y1);V-C<n&&(V=C+n),Z-Y<n&&(Z=Y+n),v.box={...N,x0:E(C),x1:E(V),y0:E(Y),y1:E(Z)};let j=v.node??v.region;j.at&&j.at.forEach((K,U)=>{let ee=K/n;Math.abs(ee-Math.round(ee))>1e-6&&f(`${v.path}/at/${U}`,`${K} is not on the ${n} grid; it is drawn at ${E(P(K))}`,void 0,!1,"warning")})}}for(let P of p){let E=P.region?.gate;if(!E?.node)continue;let v=c.get(E.node);!v||v.placedBy!==P.id||(v.box=Fi(P,d.get(v).h,d.get(v).w,d.get(v).d),v.floor=v.box.z1)}for(let P of p){let E=P.children.filter(v=>!v.placedBy);for(let v=0;v<E.length;v++)for(let N=v+1;N<E.length;N++){let C=E[v],V=E[N];ya(C,i)||ya(V,i)||ga(C.box,V.box)&&f(V.path,`"${V.id}" overlaps "${C.id}"`,'move one with "at", a relative placement, "gap" or "shift"',!1,"warning")}if(P.parent&&P.parent.type==="region"&&!P.placedBy){let v=P.parent.box,N=P.box,C=1e-6;(N.x0<v.x0-C||N.y0<v.y0-C||N.x1>v.x1+C||N.y1>v.y1+C)&&f(P.path,`"${P.id}" sticks out of region "${P.parent.id}"`,`make "${P.parent.id}" bigger, or leave out its "size" so it fits its contents`,!1,"warning")}}{let P=l.filter(E=>!E.placedBy);for(let E=0;E<P.length;E++)for(let v=E+1;v<P.length;v++){let N=P[E],C=P[v];ga(N.box,C.box)&&!ya(N,i)&&!ya(C,i)&&f(C.path,`"${C.id}" overlaps "${N.id}"`,'move one with "at", a relative placement, "gap" or "shift"',!1,"warning")}}let A=new Set,R=a.filter(P=>{let E=P.path+P.message;return A.has(E)?!1:(A.add(E),!0)});return{items:p,byId:c,roots:l,diags:R,catalog:i}}var ya=(t,e)=>t.type==="region"&&["zone","tunnel"].includes(Ot(e,t.region.kind)?.shape??"");function Fi(t,e,s,r){let i=t.region.gate,o=t.box,n=t.box.z0,a=i.at??.5,f=i.width??2;if(i.side==="w"||i.side==="e"){let l=i.side==="w"?o.x0+ps/2:o.x1-ps/2,d=o.y0+(o.y1-o.y0)*a;return{x0:l-s/2,x1:l+s/2,y0:d-f/2,y1:d+f/2,z0:n,z1:n+e}}let p=i.side==="n"?o.y0+ps/2:o.y1-ps/2,c=o.x0+(o.x1-o.x0)*a;return{x0:c-f/2,x1:c+f/2,y0:p-r/2,y1:p+r/2,z0:n,z1:n+e}}function ga(t,e,s=1e-6){return t.x0<e.x1-s&&e.x0<t.x1-s&&t.y0<e.y1-s&&e.y0<t.y1-s}function _i(t,e){let s=Vt(t,e);return s?` (did you mean "${s}"?)`:""}var ks=.2,ba=.05,Uu=.6,wa=.25,xa={n:[0,-1],s:[0,1],e:[1,0],w:[-1,0]};function wn(t){let e=/^(.*?)(?:\.(n|e|s|w|top))?$/.exec(t);return{id:e[1],side:e[2]}}var Kd=new WeakMap;function Rr(t,e,s){let r=Kd.get(t);if(!r){r=[];for(let n of t.items){if(n.type!=="region"||!Ot(t.catalog,n.region.kind)?.floor)continue;let a=0;for(let f=n.parent;f;f=f.parent)a++;r.push({r:n,d:a})}Kd.set(t,r)}let i=0,o=-1;for(let{r:n,d:a}of r){let f=n.box,p=1e-6;e>=f.x0-p&&e<=f.x1+p&&s>=f.y0-p&&s<=f.y1+p&&a>o&&(o=a,i=n.floor)}return i}function Hu(t,e){let s=[(t.x0+t.x1)/2,(t.y0+t.y1)/2],r=[(e.x0+e.x1)/2,(e.y0+e.y1)/2],i=r[0]-s[0],o=r[1]-s[1],n=Math.max(e.x0-t.x1,t.x0-e.x1),a=Math.max(e.y0-t.y1,t.y0-e.y1);return n>0&&(a<=0||n>=a)?i>0?"e":"w":a>0?o>0?"s":"n":Math.abs(i)>=Math.abs(o)?i>0?"e":"w":o>0?"s":"n"}var $a=5e5;function Sa(t,e,s,r,i,o){let n=[],a=(b,x,w,$="error")=>{let S=r.locate(b);n.push({severity:$,message:x,line:S.line,col:S.col,path:b,hint:w})},f=t.routes??[],p={left:$a},c=0,l=()=>s.items.map(b=>b.id),d=new Map,m=[],h=[];f.forEach((b,x)=>{let w=`${e}/routes/${x}`;(d.has(b.id)||s.byId.has(b.id))&&a(w+"/id",`duplicate id "${b.id}"`),d.set(b.id,x);let $=b.kind??"send";i.has($)||a(w+"/kind",`unknown flow kind "${$}"`+bc($,i),`kinds: ${[...i].join(", ")}; add one under "kinds:"`);let S={id:b.id,raw:b,path:w,kind:$,points:[]},O=(z,A)=>{let{id:R}=wn(z),P=s.byId.get(R);if(!P){a(`${w}/${A}`,`unknown node "${R}"`+bc(R,l()));return}return P};S.from=O(b.from,"from"),S.to=O(b.to,"to"),m.push(S),h.push({r:S})});let y=new Map;for(let b of h){let{r:x}=b;if(!x.from||!x.to||x.raw.points)continue;let w=wn(x.raw.from).side,$=wn(x.raw.to).side,S=x.raw.via?.[0],O=x.raw.via?.[x.raw.via.length-1],z=(E,v)=>{if(Array.isArray(E))return{x0:E[0],x1:E[0],y0:E[1],y1:E[1],z0:0,z1:0};if(typeof E=="string"){let N=s.byId.get(wn(E).id);if(N)return N.box}return v.box},A=(E,v,N)=>{let C=v??Hu(E.box,N);return{node:E,side:C,explicit:!!v,p:[0,0],z:0}};b.a=A(x.from,w,z(S,x.to)),b.b=A(x.to,$,z(O,x.from));let R=z(S,x.to),P=z(O,x.from);for(let[E,v]of[[b.a,R],[b.b,P]]){let N=`${E.node.id}.${E.side}`;y.has(N)||y.set(N,[]),y.get(N).push({e:E,other:[(v.x0+v.x1)/2,(v.y0+v.y1)/2]})}}for(let[,b]of y){let x=b[0].e,w=x.node.box,$=x.side,S=$==="e"||$==="w"?1:0;b.sort((E,v)=>E.other[S]-v.other[S]);let O=S?w.y0:w.x0,z=S?w.y1:w.x1,A=(O+z)/2,R=Math.max(0,z-O-.3),P=b.length>1?Math.min(Uu,R/(b.length-1)):0;b.forEach((E,v)=>{let N=(v-(b.length-1)/2)*P,C=A+N,V=E.e.node.box.z0;if($==="top"){E.e.p=[(w.x0+w.x1)/2,(w.y0+w.y1)/2],E.e.z=w.z1;return}let[Y,Z]=xa[$];E.e.p=S?[Y>0?w.x1+ba:w.x0-ba,C]:[C,Z>0?w.y1+ba:w.y0-ba],E.e.z=V})}let g=[];for(let b of s.items)b.type==="node"&&g.push(b.box);let k=[];for(let b of s.items.filter(x=>Ot(s.catalog,x.region?.kind)?.shape==="walled")){let{x0:x,y0:w,x1:$,y1:S}=b.box,O=ps,z=b.region.gate,A=[[{x0:x,y0:w,x1:$,y1:w+O,z0:0,z1:0},"n"],[{x0:x,y0:S-O,x1:$,y1:S,z0:0,z1:0},"s"],[{x0:x,y0:w,x1:x+O,y1:S,z0:0,z1:0},"w"],[{x0:$-O,y0:w,x1:$,y1:S,z0:0,z1:0},"e"]];for(let[R,P]of A)if(z&&z.side===P){if(z.node)continue;let E=z.at??.5,v=z.width??2;if(P==="e"||P==="w"){let N=w+(S-w)*E;k.push({...R,y1:N-v/2},{...R,y0:N+v/2})}else{let N=x+($-x)*E;k.push({...R,x1:N-v/2},{...R,x0:N+v/2})}}else k.push(R)}let u=new Map;for(let b of h){let{r:x,a:w,b:$}=b;if(x.raw.points){x.points=x.raw.points.map(C=>[C[0],C[1],C.length>2?C[2]:Rr(s,C[0],C[1])+.01]);continue}if(!w||!$)continue;let S=[];(x.raw.via??[]).forEach((C,V)=>{if(Array.isArray(C))if(o){let Y=Z=>Math.round(Math.round(Z/o)*o*1e9)/1e9;C.forEach((Z,j)=>{Math.abs(Z/o-Math.round(Z/o))>1e-6&&a(`${x.path}/via/${V}/${j}`,`${Z} is not on the ${o} grid; it is drawn at ${Y(Z)}`,void 0,"warning")}),S.push({p:[Y(C[0]),Y(C[1])]})}else S.push({p:[C[0],C[1]]});else{let{id:Y,side:Z}=wn(C),j=s.byId.get(Y);if(!j){a(`${x.path}/via/${V}`,`unknown node "${Y}"`+bc(Y,l()));return}let K=Z&&Z!=="top"?Z:"n",[U,ee]=xa[K],L=j.box;S.push({p:[U?U>0?L.x1+.4:L.x0-.4:(L.x0+L.x1)/2,ee?ee>0?L.y1+.4:L.y0-.4:(L.y0+L.y1)/2]})}});let z=g.filter(C=>C!==w.node.box&&C!==$.node.box).concat(x.raw.cross?[]:k).filter(C=>!ka(w.node.box,C)&&!ka($.node.box,C)&&!ka(C,w.node.box)&&!ka(C,$.node.box)),A=w.side==="top"?void 0:xa[w.side],R=$.side==="top"?void 0:xa[$.side],P=[w.p,...S.map(C=>C.p),$.p],E=[w.p],v=A,N=!0;for(let C=0;C+1<P.length;C++){let V=C+2===P.length,Y=Wu(P[C],P[C+1],z,u,v,V&&R?[-R[0],-R[1]]:void 0,p);if(!Y){N=!1;break}E.push(...Y.slice(1));let Z=E.length;if(Z>=2){let j=Math.sign(E[Z-1][0]-E[Z-2][0]),K=Math.sign(E[Z-1][1]-E[Z-2][1]);v=[j,K]}}!N&&p.left<=0?(c++,E=[w.p,[$.p[0],w.p[1]],$.p]):N||(a(x.path,`no path found for route "${x.id}" from "${w.node.id}" to "${$.node.id}"`,'add "via" points, or use "points" to draw it by hand',"warning"),E=[w.p,[$.p[0],w.p[1]],$.p]),E=Di(E);for(let C=0;C+1<E.length;C++)Yu(u,E[C],E[C+1]);x.points=Qu(s,E,w,$)}return c&&a(e,`${c} of ${m.length} routes were drawn as plain elbows: the scene is too large to route them all around what stands in the way (${$a.toLocaleString("en")} search steps)`,'split it into scenes, or give the busiest routes "via" points or "points"',"warning"),{routes:m,diags:n}}function ka(t,e){return e.x0>=t.x0-1e-6&&e.x1<=t.x1+1e-6&&e.y0>=t.y0-1e-6&&e.y1<=t.y1+1e-6&&e.z0>=t.z1-1e-6}var Gd=(t,e)=>`${Math.round(t/ks)},${Math.round(e/ks)}`;function Yu(t,e,s){let r=Math.max(1,Math.round(Math.hypot(s[0]-e[0],s[1]-e[1])/ks));for(let i=0;i<=r;i++){let o=Gd(e[0]+(s[0]-e[0])*i/r,e[1]+(s[1]-e[1])*i/r);t.set(o,(t.get(o)??0)+1)}}function Zd(t,e,s){for(let r of s)if(t>r.x0-wa&&t<r.x1+wa&&e>r.y0-wa&&e<r.y1+wa)return!0;return!1}function Wu(t,e,s,r,i,o,n={left:1/0}){if((Math.abs(t[0]-e[0])<1e-6||Math.abs(t[1]-e[1])<1e-6)&&Xu(t,e,s)){let j=[Math.sign(e[0]-t[0]),Math.sign(e[1]-t[1])],K=!i||i[0]===j[0]&&i[1]===j[1],U=!o||o[0]===j[0]&&o[1]===j[1];if(K&&U)return[t,e]}if(n.left<=0)return null;let a=j=>Math.round((j-t[0])/ks),f=j=>Math.round((j-t[1])/ks),p=j=>t[0]+j*ks,c=j=>t[1]+j*ks,l=a(e[0]),d=f(e[1]),m=30,h=Math.min(0,l)-m,y=Math.max(0,l)+m,g=Math.min(0,d)-m,k=Math.max(0,d)+m,u=1.2,b=ks,x=.06,w=[[1,0],[-1,0],[0,1],[0,-1]],$=y-h+1,S=k-g+1,O=(j,K)=>(j-h)*S+(K-g),z=new Int8Array($*S).fill(-1),A=new Float64Array($*S).fill(-1),R=new Float64Array($*S*4).fill(1/0),P=(j,K)=>{let U=O(j,K);return z[U]<0&&(z[U]=Zd(p(j),c(K),s)?1:0),z[U]===1},E=(j,K)=>{let U=O(j,K);return A[U]<0&&(A[U]=r.get(Gd(p(j),c(K)))??0),A[U]},v=wc(),N=(j,K)=>(Math.abs(j-l)+Math.abs(K-d))*b,C=i?w.findIndex(j=>j[0]===i[0]&&j[1]===i[1]):-1;v.push({i:0,j:0,d:C,g:0,f:N(0,0),idx:0,hp:0});let V=(j,K)=>Math.abs(j)+Math.abs(K)<=2,Y=(j,K)=>Math.abs(j-l)+Math.abs(K-d)<=2,Z=0;for(;v.length()&&Z++<2e5;){if(n.left--<=0)return null;let j=v.take();if(j.i===l&&j.j===d&&!(o&&j.d>=0&&(w[j.d][0]!==o[0]||w[j.d][1]!==o[1]))){let K=[];for(let U=j;U;U=U.prev)K.push([p(U.i),c(U.j)]);return K.reverse(),K[0]=t,Ju(Di(K),e)}for(let K=0;K<4;K++){let U=w[K];if(j.d>=0&&U[0]===-w[j.d][0]&&U[1]===-w[j.d][1])continue;let ee=j.i+U[0],L=j.j+U[1];if(ee<h||ee>y||L<g||L>k||!V(ee,L)&&!Y(ee,L)&&P(ee,L))continue;if((V(ee,L)||Y(ee,L))&&P(ee,L)&&!(ee===l&&L===d)){let ce=V(ee,L)?i:o&&[-o[0],-o[1]];if(!ce||(V(ee,L)?U[0]!==ce[0]||U[1]!==ce[1]:U[0]!==o[0]||U[1]!==o[1]))continue}let q=j.d>=0&&j.d!==K?u:0,G=j.g+b+q+E(ee,L)*x,X=O(ee,L)*4+K;R[X]<=G||(R[X]=G,v.push({i:ee,j:L,d:K,g:G,f:G+N(ee,L),prev:j,idx:0,hp:0}))}}return null}function wc(){let t=[],e=[],s=(n,a)=>n.f<a.f||n.f===a.f&&n.idx<a.idx,r=(n,a)=>{let f=e[n];e[n]=e[a],e[a]=f,e[n].hp=n,e[a].hp=a},i=n=>{for(;n>0;){let a=n-1>>1;if(!s(e[n],e[a]))break;r(n,a),n=a}},o=n=>{for(;;){let a=2*n+1,f=a+1,p=n;if(a<e.length&&s(e[a],e[p])&&(p=a),f<e.length&&s(e[f],e[p])&&(p=f),p===n)return;r(n,p),n=p}};return{length:()=>t.length,push(n){n.idx=t.length,t.push(n),n.hp=e.length,e.push(n),i(n.hp)},take(){let n=e[0],a=e.pop();e.length&&(e[0]=a,a.hp=0,o(0));let f=t.pop();return f!==n&&(t[n.idx]=f,f.idx=n.idx,i(f.hp)),n}}}function Ju(t,e){let s=t.map(o=>[o[0],o[1]]),r=s.length,i=s[r-1];if(r>=2){let o=s[r-2];Math.abs(o[1]-i[1])<1e-9?(o[1]=e[1],r>=3&&Math.abs(s[r-3][1]-i[1])<1e-9&&(s[r-3][1]=e[1])):Math.abs(o[0]-i[0])<1e-9&&(o[0]=e[0],r>=3&&Math.abs(s[r-3][0]-i[0])<1e-9&&(s[r-3][0]=e[0]))}return s[r-1]=e,Di(s)}function Xu(t,e,s){let r=Math.max(1,Math.round(Math.hypot(e[0]-t[0],e[1]-t[1])/(ks/2)));for(let i=2;i<r-1;i++)if(Zd(t[0]+(e[0]-t[0])*i/r,t[1]+(e[1]-t[1])*i/r,s))return!1;return!0}function Di(t){let e=[];for(let s of t){let r=e.length;if(!(r&&Math.abs(e[r-1][0]-s[0])<1e-6&&Math.abs(e[r-1][1]-s[1])<1e-6)){if(r>=2){let i=e[r-2],o=e[r-1];if(Math.abs(i[0]-o[0])<1e-6&&Math.abs(o[0]-s[0])<1e-6||Math.abs(i[1]-o[1])<1e-6&&Math.abs(o[1]-s[1])<1e-6){e[r-1]=s;continue}}e.push(s)}}return e}function Qu(t,e,s,r){let i=new Set,o=new Set;for(let p of t.items)p.type!=="region"||!Ot(t.catalog,p.region.kind)?.floor||(i.add(p.box.x0),i.add(p.box.x1),o.add(p.box.y0),o.add(p.box.y1));let n=[],a=(p,c)=>Rr(t,p,c)+.01;for(let p=0;p+1<e.length;p++){let[c,l]=e[p],[d,m]=e[p+1],h=[0,1];if(Math.abs(l-m)<1e-6)for(let y of i){let g=(y-c)/(d-c);g>1e-6&&g<1-1e-6&&h.push(g)}else for(let y of o){let g=(y-l)/(m-l);g>1e-6&&g<1-1e-6&&h.push(g)}h.sort((y,g)=>y-g);for(let y=0;y+1<h.length;y++){let g=h[y],k=h[y+1],u=(g+k)/2,b=a(c+(d-c)*u,l+(m-l)*u),x=[c+(d-c)*g,l+(m-l)*g,b],w=[c+(d-c)*k,l+(m-l)*k,b],$=n[n.length-1];$&&(Math.abs($[0]-x[0])>1e-6||Math.abs($[1]-x[1])>1e-6||Math.abs($[2]-x[2])>1e-6)?n.push(x):$||n.push(x),n.push(w)}}n.length&&(n[0][2]=s.side==="top"?s.z:s.node.box.z0+.01,n[n.length-1][2]=r.side==="top"?r.z:r.node.box.z0+.01);let f=[];for(let p of n){let c=f.length;if(c>=2){let l=f[c-2],d=f[c-1],m=Math.abs(l[2]-d[2])<1e-9&&Math.abs(d[2]-p[2])<1e-9,h=Math.abs(l[0]-d[0])<1e-6&&Math.abs(d[0]-p[0])<1e-6||Math.abs(l[1]-d[1])<1e-6&&Math.abs(d[1]-p[1])<1e-6;if(m&&h){f[c-1]=p;continue}}f.push(p)}return f}function bc(t,e){let s=Vt(t,e);return s?` (did you mean "${s}"?)`:""}function Yt(t){return[Re(t.x0,t.y0,t.z1),Re(t.x1,t.y0,t.z1),Re(t.x1,t.y0,t.z0),Re(t.x1,t.y1,t.z0),Re(t.x0,t.y1,t.z0),Re(t.x0,t.y1,t.z1)]}function Yn(t){let e=t.map(o=>o[0]),s=t.map(o=>o[1]),r=Math.min(...e),i=Math.min(...s);return{x:r,y:i,w:Math.max(...e)-r,h:Math.max(...s)-i}}function zr(t,e){let s=t,r=(a,f)=>{let p=[];for(let c=0;c<s.length;c++){let l=s[c],d=s[(c+1)%s.length],m=a(l),h=a(d);m&&p.push(l),m!==h&&p.push(f(l,d))}s=p},i=a=>(f,p)=>[a,f[1]+(p[1]-f[1])*(a-f[0])/(p[0]-f[0])],o=a=>(f,p)=>[f[0]+(p[0]-f[0])*(a-f[1])/(p[1]-f[1]),a];if(r(a=>a[0]>=e.x,i(e.x)),!s.length||(r(a=>a[0]<=e.x+e.w,i(e.x+e.w)),!s.length)||(r(a=>a[1]>=e.y,o(e.y)),!s.length)||(r(a=>a[1]<=e.y+e.h,o(e.y+e.h)),!s.length))return 0;let n=0;for(let a=0;a<s.length;a++){let f=s[a],p=s[(a+1)%s.length];n+=f[0]*p[1]-p[0]*f[1]}return Math.abs(n)/2}function $c(t,e){let s=Math.min(t.x+t.w,e.x+e.w)-Math.max(t.x,e.x),r=Math.min(t.y+t.h,e.y+e.h)-Math.max(t.y,e.y);return s>0&&r>0?s*r:0}function Yd(t,e){let s=0;for(let r=0;r+1<t.length;r++){let i=t[r],o=t[r+1],n=Math.hypot(o[0]-i[0],o[1]-i[1]),a=Math.max(1,Math.ceil(n/4));for(let f=0;f<a;f++){let p=i[0]+(o[0]-i[0])*(f+.5)/a,c=i[1]+(o[1]-i[1])*(f+.5)/a;p>=e.x&&p<=e.x+e.w&&c>=e.y&&c<=e.y+e.h&&(s+=n/a*4)}}return s}var $s=64,Ma=class{cells=new Map;n=0;add(e,s,r,i,o){for(let n=Math.floor(s/$s);n<=Math.floor(i/$s);n++)for(let a=Math.floor(r/$s);a<=Math.floor(o/$s);a++){let f=n*1048576+a,p=this.cells.get(f);p||this.cells.set(f,p=[]),p[p.length-1]!==e&&p.push(e)}}query(e,s,r,i){let o=new Set;for(let n=Math.floor(e/$s);n<=Math.floor(r/$s);n++)for(let a=Math.floor(s/$s);a<=Math.floor(i/$s);a++){let f=this.cells.get(n*1048576+a);if(f)for(let p of f)o.add(p)}return[...o].sort((n,a)=>n-a)}},xc=t=>{let e=1/0,s=1/0,r=-1/0,i=-1/0;for(let[o,n]of t)o<e&&(e=o),o>r&&(r=o),n<s&&(s=n),n>i&&(i=n);return[e,s,r,i]},Pa=new WeakMap;function Fs(t,e){let s=Pa.get(t);for((!s||s.n>t.length)&&Pa.set(t,s=new Ma);s.n<t.length;s.n++){let[r,i,o,n]=e(t[s.n]);s.add(s.n,r,i,o,n)}return s}function Ud(t){let e=Pa.get(t);for((!e||e.n>t.length)&&Pa.set(t,e=new Ma);e.n<t.length;e.n++){let s=t[e.n].pts;for(let r=0;r+1<s.length;r++){let i=s[r],o=s[r+1],n=e.n*65536+r,a=Math.max(1,Math.ceil(Math.hypot(o[0]-i[0],o[1]-i[1])/($s/2)));for(let f=0;f<a;f++){let p=f/a,c=(f+1)/a,l=i[0]+(o[0]-i[0])*p,d=i[1]+(o[1]-i[1])*p,m=i[0]+(o[0]-i[0])*c,h=i[1]+(o[1]-i[1])*c;e.add(n,Math.min(l,m)-1,Math.min(d,h)-1,Math.max(l,m)+1,Math.max(d,h)+1)}}}return e}var ds=(t,e,s,r,i)=>t.query(e,s,r,i),Ir=t=>xc(t),va=t=>[t.x,t.y,t.x+t.w,t.y+t.h];function Hd(t,e,s,[r,i,o,n]){let a=0,f=s-1;for(let p of[0,1]){let c=e[p]-t[p],l=p?i:r,d=p?n:o;if(Math.abs(c)<1e-12){if(t[p]<l||t[p]>d)return[1,0];continue}let m=(l-t[p])/c*s-.5,h=(d-t[p])/c*s-.5;m>h&&([m,h]=[h,m]),a=Math.max(a,Math.floor(m)-1),f=Math.min(f,Math.ceil(h)+1)}return[a,f]}var nr=class t{polys=[];rects=[];lines=[];solids=[];slants=[];budget={spots:1/0,over:!1,told:!1};hidden(e){let s=0;for(let r of ds(Fs(this.solids,Ir),...va(e)))s+=zr(this.solids[r],e);return s}hiddenPoly(e){let s=0;for(let r of ds(Fs(this.solids,Ir),...xc(e)))s+=Bi(e,this.solids[r]);return s}costPoly(e,s=1/0){let r=xc(e),i=0;for(let o of ds(Fs(this.polys,n=>Ir(n.poly)),...r))i+=Bi(e,this.polys[o].poly);for(let o of ds(Fs(this.rects,n=>va(n.r)),...r))i+=zr(e,this.rects[o].r)*2;for(let o of ds(Fs(this.slants,Ir),...r))i+=Bi(e,this.slants[o])*2;if(i>=s)return i;for(let o of ds(Ud(this.lines),...r)){if(i>=s)return i;let n=this.lines[Math.floor(o/65536)].pts,a=o%65536,f=n[a],p=n[a+1],c=Math.hypot(p[0]-f[0],p[1]-f[1]),l=Math.max(1,Math.ceil(c/4)),[d,m]=Hd(f,p,l,r);for(let h=d;h<=m;h++)vc(e,[f[0]+(p[0]-f[0])*(h+.5)/l,f[1]+(p[1]-f[1])*(h+.5)/l])&&(i+=c/l*4*.6)}return i}cost(e,s,r=.6){let i=va(e),o=0;for(let n of ds(Fs(this.polys,a=>Ir(a.poly)),...i)){let a=this.polys[n];o+=zr(a.poly,e)*(a.owner===s?1.5:1)}for(let n of ds(Fs(this.rects,a=>va(a.r)),...i)){let a=this.rects[n];(a.owner!==s||!s)&&(o+=$c(a.r,e)*2)}for(let n of ds(Fs(this.slants,Ir),...i))o+=zr(this.slants[n],e)*2;if(r){let n=-1,a=0;for(let f of ds(Ud(this.lines),...i)){let p=Math.floor(f/65536);p!==n&&(n>=0&&(o+=a*r),n=p,a=0);let c=this.lines[p].pts,l=f%65536,d=c[l],m=c[l+1],h=Math.hypot(m[0]-d[0],m[1]-d[1]),y=Math.max(1,Math.ceil(h/4)),[g,k]=Hd(d,m,y,i);for(let u=g;u<=k;u++){let b=d[0]+(m[0]-d[0])*(u+.5)/y,x=d[1]+(m[1]-d[1])*(u+.5)/y;b>=e.x&&b<=e.x+e.w&&x>=e.y&&x<=e.y+e.h&&(a+=h/y*4)}}n>=0&&(o+=a*r)}return o}fork(){let e=new t;return e.budget=this.budget,e.polys=this.polys,e.lines=this.lines,e.solids=this.solids,e.rects=[...this.rects],e.slants=this.slants,e}},Wd=14;function qi(t,e,s,r){let i=Math.max(t.name?On(t.name,wt.lbl):0,t.sub?On(t.sub,wt.sub):0)+4,o=(t.name?1:0)+(t.sub?1:0),n=s-(t.name?11:9)-1,a=(o-1)*Wd+(t.name?11:9)+4;return{x:r==="start"?e-2:r==="end"?e-i+2:e-i/2,y:n,w:i,h:a}}function Vi(t,e,s,r,i,o){let n=Yn(s),a=Re((e.x0+e.x1)/2,(e.y0+e.y1)/2,e.z1)[0],p=((t.name?1:0)+(t.sub?1:0)-1)*Wd+4,c=n.y-6-p,l=n.y+Math.min(n.h,60)*.45,d=[];o&&d.push({...o,pen:0}),d.push({x:a,y:c,anchor:"middle",pen:o?20:0});for(let y of[12,24,40])d.push({x:a,y:c-y,anchor:"middle",pen:20+y});for(let y of[-30,30,-60,60])d.push({x:a+y,y:c-4,anchor:"middle",pen:30+Math.abs(y)});d.push({x:n.x+n.w+8,y:l,anchor:"start",pen:120}),d.push({x:n.x-8,y:l,anchor:"end",pen:120}),d.push({x:a,y:n.y+n.h+14,anchor:"middle",pen:300});let m,h=1/0;for(let y of d){let g=qi(t,y.x,y.y,y.anchor),k=r.cost(g,i,.15)*2+y.pen;k<h&&(h=k,m={x:y.x,y:y.y,anchor:y.anchor,rect:g})}return m}function Sc(t,e,s,r){return{x:(r==="start"?e:r==="end"?e-t:e-t/2)-2,y:s-14,w:t+4,h:28}}function Oa(t,e,s,r,i){let o=[{...r,pen:0}];for(let c of[-46,-66,-86,-106,-126,-146])for(let l of[0,-70,70,-140,140])o.push({x:e+l,y:s+c,anchor:"middle",pen:10+(-c-46)*.5+Math.abs(l)*.4});for(let c of[34,60,86])o.push({x:e,y:s+c,anchor:"middle",pen:60+c*.3});let n=r.x-e,a=r.y-s;for(let c of[-1,1])for(let l of[16,32,48])o.push({...r,y:s+a+c*l,x:e+n,pen:5+l});for(let c of[-1,1])for(let l of[30,60,90])for(let d of[0,16,-16])o.push({...r,x:e+n+c*l,y:s+a+d,pen:8+l*.6+Math.abs(d)});let f,p=1/0;for(let c of o){let l=Sc(t,c.x,c.y,c.anchor),d=i.cost(l,void 0,.05)*3+c.pen;d<p&&(p=d,f={x:c.x,y:c.y,anchor:c.anchor,rect:l})}return f}var Jd=t=>{let e=0;for(let s=0;s<t.length;s++){let r=t[s],i=t[(s+1)%t.length];e+=r[0]*i[1]-i[0]*r[1]}return e/2},kc=t=>Jd(t)<0?[...t].reverse():t;function vc(t,e){let s=kc(t);for(let r=0;r<s.length;r++){let i=s[r],o=s[(r+1)%s.length];if((o[0]-i[0])*(e[1]-i[1])-(o[1]-i[1])*(e[0]-i[0])<0)return!1}return!0}function Bi(t,e){let s=kc(t),r=kc(e);for(let i=0;i<r.length&&s.length;i++){let o=r[i],n=r[(i+1)%r.length],a=p=>(n[0]-o[0])*(p[1]-o[1])-(n[1]-o[1])*(p[0]-o[0]),f=s;s=[];for(let p=0;p<f.length;p++){let c=f[p],l=f[(p+1)%f.length],d=a(c),m=a(l);if(d>=0&&s.push(c),d>=0!=m>=0){let h=d/(d-m);s.push([c[0]+(l[0]-c[0])*h,c[1]+(l[1]-c[1])*h])}}}return s.length>=3?Math.abs(Jd(s)):0}var Aa=24;function Cr(t,e){let[s,r,i,o]=e,n=t.x+t.w/2,a=t.y+t.h/2,f=[["left",n-s],["right",s+i-n],["top",a-r],["bottom",r+o-a]];f.sort((c,l)=>c[1]-l[1]);let p=f[0][0];return p==="left"?{edge:p,dx:-(t.x+t.w-s)-Aa,dy:0}:p==="right"?{edge:p,dx:s+i-t.x+Aa,dy:0}:p==="top"?{edge:p,dx:0,dy:-(t.y+t.h-r)-Aa}:{edge:p,dx:0,dy:r+o-t.y+Aa}}function Ta(t,e,s){let r=x=>{let w=0;for(let $=x.parent;$;$=$.parent)w++;return w},i=x=>x.box.x0+x.box.y0+x.box.z0*.01,o=t.items.filter(x=>x.type==="region").sort((x,w)=>r(x)-r(w)||i(x)-i(w)),n=t.items.filter(x=>x.type==="node").sort((x,w)=>i(x)-i(w)||x.box.z0-w.box.z0),a=[],f=Math.min(90,400/Math.max(1,o.length)),p=650;o.forEach((x,w)=>{let $=Yn(Yt(x.box));a.push({id:x.id,kind:"region",...Cr($,s),delay:Math.round(w*f),dur:p,bbox:$})});let c=250+Math.round(f*o.length),l=Math.min(70,700/Math.max(1,n.length)),d=600;n.forEach((x,w)=>{let $=Yn(Yt(x.box));a.push({id:x.id,kind:"node",...Cr($,s),delay:Math.round(c+w*l),dur:d,bbox:$})});let m=n.length?c+(n.length-1)*l:c,h=Math.round(m+300),y=Math.min(30,300/Math.max(1,e.length)),g=400,k=e.filter(x=>x.points.length>=2).map((x,w)=>({id:x.id,delay:Math.round(h+w*y),dur:g})),u={delay:h+200,dur:400},b=Math.max(...a.map(x=>x.delay+x.dur),...k.map(x=>x.delay+x.dur),u.delay+u.dur);return{pieces:a,routes:k,labels:u,total:b}}var jr=["edge","drop","rise","fly","pop","scatter","build","fade"],Lr=["explode","lift-off","sink","scatter","fly-out","collapse","fade","reverse"],sr=["by-depth","by-layer","by-region","by-flow","as-listed","random"],nf=["linear","ease","ease-in","ease-out","settle","spring","bounce"],En=t=>Math.round(t*100)/100||0,ln=t=>Math.round(t*1e4)/1e4||0;function rr(t){let e=i=>{let o=0;for(let n=i.parent;n;n=n.parent)o++;return o},s=i=>{let o=[];for(let n=i;n;n=n.parent){let a=(n.region??n.node)?.motion;a&&o.unshift(a)}return o.length?Object.assign({},...o):void 0},r=new Set(t.layout.items.filter(i=>i.region&&t.layout.catalog&&t.rendered.svg.includes(`class="tunnel" data-id="${i.id}"`)).map(i=>i.id));return{viewBox:t.rendered.viewBox,pieces:t.layout.items.map(i=>{let o=i.box,n=Re((o.x0+o.x1)/2,(o.y0+o.y1)/2,o.z0),a=s(i);return{id:i.id,kind:i.type,...i.parent?{parent:i.parent.id}:{},depth:e(i),layer:r.has(i.id)?2:i.type==="region"?0:1,key:En(o.x0+o.y0+o.z0*.01),bbox:Yn(Yt(o)),foot:[En(n[0]),En(n[1])],base:[Re(o.x0,o.y1,o.z0),Re(o.x1,o.y1,o.z0),Re(o.x1,o.y0,o.z0)].map(f=>[En(f[0]),En(f[1])]),...a?{motion:a}:{}}}),routes:t.routes.filter(i=>t.rendered.paths[i.id]).map(i=>({id:i.id,path:t.rendered.paths[i.id],...eh(i.raw)})),notes:Object.fromEntries((t.raw.notes??[]).map((i,o)=>[`${t.id}-note-${o}`,i.on])),intro:t.rendered.assembly}}var Xd=t=>typeof t=="string"?t.split(".")[0]:void 0,eh=t=>{let e=Xd(t.from),s=Xd(t.to);return{...e?{from:e}:{},...s?{to:s}:{}}},Ea=(t,e,s,r)=>i=>{if(i<=0)return 0;if(i>=1)return 1;let o=(f,p,c)=>3*f*c*(1-c)**2+3*p*c*c*(1-c)+c**3,n=0,a=1;for(let f=0;f<40;f++){let p=(n+a)/2;o(t,s,p)<i?n=p:a=p}return o(e,r,(n+a)/2)},Mc={linear:t=>t,ease:Ea(.42,0,.58,1),"ease-in":Ea(.42,0,1,1),"ease-out":Ea(0,0,.58,1),settle:Ea(.16,.84,.3,1),spring:t=>t<=0?0:t>=1?1:1-Math.exp(-6*t)*Math.cos(9.5*t)*(1-t),bounce:t=>{if(t<=0)return 0;if(t>=1)return 1;let e=7.5625,s=2.75;return t<1/s?e*t*t:t<2/s?e*(t-1.5/s)**2+.75:t<2.5/s?e*(t-2.25/s)**2+.9375:e*(t-2.625/s)**2+.984375}};function Ac(t){let e=t>>>0;return()=>{e=e+1831565813>>>0;let s=e;return s=Math.imul(s^s>>>15,s|1),s^=s+Math.imul(s^s>>>7,s|61),((s^s>>>14)>>>0)/4294967296}}var Qd=t=>{let e=2166136261;for(let s=0;s<t.length;s++)e^=t.charCodeAt(s),e=Math.imul(e,16777619);return e>>>0},Wn=t=>Math.max(0,Math.min(1,t)),Na=24;function Pc(t,e,s){let[r,i,o,n]=e;return s==="left"?[-(t.x+t.w-r)-Na,0]:s==="right"?[r+o-t.x+Na,0]:s==="top"?[0,-(t.y+t.h-i)-Na]:[0,i+n-t.y+Na]}function Ec(t,e,s={}){let r=t.pieces,i=new Map(r.map(y=>[y.id,y])),o=(y,g)=>y.depth-g.depth||y.key-g.key;if(e==="as-listed")return[...r];if(e==="random"){let y=Ac(s.seed??1);return r.map(g=>[y(),g]).sort((g,k)=>g[0]-k[0]).map(g=>g[1])}if(e==="by-layer")return[...r].sort((y,g)=>y.layer-g.layer||o(y,g));if(e==="by-depth")return[...r].sort((y,g)=>y.key-g.key||y.depth-g.depth);let n=new Map;for(let y of[...r].sort(o)){let g=n.get(y.parent)??[];g.push(y),n.set(y.parent,g)}let a=[],f=new Set,p=y=>{if(f.has(y.id))return;let g=y.parent?i.get(y.parent):void 0;g&&p(g),f.add(y.id),a.push(y)};if(e==="by-region"){let y=g=>{for(let k of n.get(g)??[])p(k),y(k.id)};return y(),a}let c=new Map,l=new Set;for(let y of t.routes)y.from&&y.to&&(c.set(y.from,[...c.get(y.from)??[],y.to]),l.add(y.to));let d=s.source??t.routes.find(y=>y.from&&!l.has(y.from))?.from??t.routes[0]?.from,m=d?[d]:[],h=new Set(m);for(;m.length;){let y=m.shift(),g=i.get(y);g&&p(g);for(let k of c.get(y)??[])h.has(k)||(h.add(k),m.push(k))}for(let y of[...r].sort(o))p(y);return a}var th={edge:"settle",drop:"settle",rise:"ease-out",fly:"settle",pop:"spring",scatter:"settle",build:"ease-out",fade:"linear",explode:"ease-in","lift-off":"ease-in",sink:"ease-in","fly-out":"ease-in",collapse:"ease-in"},nh={"lift-off":"lift",sink:"rise",scatter:"scatter","fly-out":"edge",fade:"fade",explode:"explode",collapse:"collapse"};function _r(t,e,s={}){let r=s.seed??1,i=e==="disassemble",o=i&&s.style==="reverse",n=Z=>{if(!i)return Z.motion?.style??s.style??"edge";let j=Z.motion?.out??s.style??"fly-out";return j==="reverse"?Z.motion?.style??s.of??"edge":nh[j]},a=Z=>i?Z.motion?.out??s.style??"fly-out":n(Z),f=!i&&!s.order&&s.stagger===void 0&&s.piece===void 0&&s.overlap===void 0&&(s.style??"edge")==="edge",p=s.order??(s.style==="build"?"by-layer":"by-depth"),c=[],l,d,m=(Z,j,K)=>{let U=n(Z),ee=Z.motion?.easing??s.easing??th[i&&a(Z)!=="reverse"?a(Z):U]??"ease";return{p:Z,delay:j+(Z.motion?.delay??0),dur:Math.max(1,Z.motion?.duration??K),style:U,curve:Mc[ee],from:Z.motion?.from??s.from??"left"}};if(f){let Z=new Map(t.pieces.map(j=>[j.id,j]));for(let j of t.intro.pieces){let K=Z.get(j.id);K&&c.push(m(K,j.delay,j.dur))}l=t.intro.routes.map(j=>({...j})),d={...t.intro.labels}}else{let Z=Ec(t,p,{seed:r,source:s.source}),j=s.piece??600,K=s.stagger??Math.min(70,900/Math.max(1,Z.length)),U=Wn(s.overlap??.5),ee=o||i?[...Z].reverse():Z,L=Math.min(30,300/Math.max(1,t.routes.length)),q=400,G=400;if(i){d={delay:0,dur:G};let X=G*(1-U);l=[...t.routes].reverse().map((H,oe)=>({id:H.id,delay:X+oe*L,dur:q}));let ce=Math.max(X,...l.map(H=>H.delay+H.dur)),le=Math.max(0,ce-U*q);ee.forEach((H,oe)=>c.push(m(H,le+oe*K,j)))}else{ee.forEach((H,oe)=>c.push(m(H,oe*K,j)));let X=Math.max(0,...c.map(H=>H.delay+H.dur)),ce=Math.max(0,X-U*j);l=t.routes.map((H,oe)=>({id:H.id,delay:ce+oe*L,dur:q}));let le=Math.max(ce,...l.map(H=>H.delay+H.dur));d={delay:Math.max(0,le-U*G),dur:G}}}let h=s.pulses&&t.routes.length?700:0;if(h&&i)for(let Z of[...c,...l,d])Z.delay+=h;let y=Math.max(1,...c.map(Z=>Z.delay+Z.dur),...l.map(Z=>Z.delay+Z.dur),d.delay+d.dur),g=i?0:y;h&&!i&&(y+=h);let k=s.duration!==void 0?Math.max(1,s.duration)/y:1;for(let Z of[...c,...l,d])Z.delay=En(Z.delay*k),Z.dur=Math.max(.01,En(Z.dur*k));let u=s.duration!==void 0?Math.max(1,s.duration):Math.max(1,En(y)),b=new Map(c.map(Z=>[Z.p.id,Z])),x=new Map(l.map(Z=>[Z.id,Z])),[w,$,S,O]=t.viewBox,z=[w+S/2,$+O/2],A=Z=>[Z.x+Z.w/2,Z.y+Z.h/2],R=(Z,j)=>{let K=s.point;if(Array.isArray(K))return K;if(K==="region"||j==="collapse"&&K===void 0&&Z.parent){let U=t.pieces.find(ee=>ee.id===Z.parent);return U?U.foot:z}if(typeof K=="string"){let U=t.pieces.find(ee=>ee.id===K);if(U)return U.foot}return z};function P(Z,j,K){let{p:U}=Z,ee=U.bbox,L=1-j,q=(G,X)=>({dx:En(G*L),dy:En(X*L)});switch(Z.style){case"drop":return q(...Pc(ee,t.viewBox,"top"));case"lift":return q(...Pc(ee,t.viewBox,"top"));case"fly":return q(...Pc(ee,t.viewBox,Z.from));case"rise":{let G=ee.h*L,[X,ce,le]=U.base,H=ee.y-ee.h-4;return{...q(0,ee.h),clip:[[X[0],X[1]-G],[ce[0],ce[1]-G],[le[0],le[1]-G],[le[0]+2,H-G],[X[0]-2,H-G]].map(oe=>[En(oe[0]),En(oe[1])])}}case"pop":return{scale:ln(Math.max(0,j)),about:U.foot,opacity:ln(Wn(K*4))};case"scatter":{let G=Ac((r^Qd(U.id))>>>0),X=G()*Math.PI*2,ce=.35+G()*.65;return{...q(Math.cos(X)*S*ce*.6,Math.sin(X)*O*ce*.6),opacity:ln(Wn(j*1.6))}}case"build":return{...q(0,-18),opacity:ln(Wn(j))};case"fade":return{opacity:ln(Wn(j))};case"explode":{let G=R(U,"explode"),X=A(ee),ce=X[0]-G[0],le=X[1]-G[1],H=Math.hypot(ce,le),oe=Ac((r^Qd(U.id))>>>0),Ae=oe()*Math.PI*2,_e=H>1?[ce/H,le/H]:[Math.cos(Ae),Math.sin(Ae)],I=Math.hypot(S,O)+Math.max(ee.w,ee.h);return q(_e[0]*I,_e[1]*I)}case"collapse":{let G=R(U,"collapse");return{...q(G[0]-U.foot[0],G[1]-U.foot[1]),scale:ln(Math.max(0,j)),about:U.foot,opacity:ln(Wn(j*3))}}default:{let G=Cr(ee,t.viewBox);return q(G.dx,G.dy)}}}let E=(Z,j,K)=>{let U=Wn((Z-j)/K);return i?1-U:U},v={opacity:0},N=s.connectors??"draw",C=s.labels??"fade",V=[...t.pieces.map(Z=>Z.id),...t.routes.map(Z=>Z.id),...Object.keys(t.notes)];function Y(Z){let j=Math.max(0,Math.min(u,Number.isFinite(Z)?Z:0));if(i?j<=0:j>=u)return{};let K=i?j>=u:j<=0,U={},ee={},L={};for(let le of c){let H=K?0:E(j,le.delay,le.dur);H<=0?U[le.p.id]=v:H<1&&(U[le.p.id]=P(le,i?1-le.curve(1-H):le.curve(H),H))}for(let le of t.routes){let H=x.get(le.id),oe=K||!H?0:E(j,H.delay,H.dur);oe<=0?ee[le.id]={opacity:0,drawn:0}:oe<1&&(ee[le.id]=N==="fade"?{opacity:ln(oe)}:N==="grow"?{drawn:ln(oe),by:"grow"}:{drawn:ln(Mc["ease-out"](oe))})}let q=K?0:E(j,d.delay,d.dur),G=q<=0?v:q>=1?void 0:C==="type"?{typed:ln(q)}:{opacity:ln(q)};for(let le of V){let H=G;if(C==="with-piece"){let oe=Object.hasOwn(t.notes,le)?t.notes[le]:le,Ae=oe===void 0?void 0:b.get(oe)??x.get(oe);if(Ae){let _e=K?0:E(j,Ae.delay,Ae.dur);H=_e<=0?v:_e>=1?void 0:{opacity:ln(_e)}}}H&&(L[le]=H)}let X=[];if(h&&!K){let le=(j-g*k)/(h*k);if(le>0&&le<1)for(let H of t.routes)X.push({route:H.id,at:ln(Mc.ease(le))})}let ce=le=>Object.keys(le).length>0;return{...ce(U)?{items:U}:{},...ce(L)?{labels:L}:{},...ce(ee)?{routes:ee}:{},...q<1?{marks:{opacity:ln(Math.max(0,q))}}:{},...X.length?{tokens:X}:{}}}return{kind:e,duration:u,pieces:c.map(Z=>({id:Z.p.id,delay:Z.delay,dur:Z.dur,style:a(Z.p)})),routes:l,labels:d,at:Y}}var xt=t=>{let e=t.toFixed(2);return e==="-0.00"?"0":String(Number(e))},sh=(t,e)=>`translate(${xt(t[0])} ${xt(t[1])}) scale(${Number(e.toFixed(4))}) translate(${xt(-t[0])} ${xt(-t[1])})`,Nc=t=>[...t.matchAll(/(-?[\d.]+),(-?[\d.]+)/g)].map(e=>[Number(e[1]),Number(e[2])]),Rc=t=>t.slice(1).reduce((e,s,r)=>e+Math.hypot(s[0]-t[r][0],s[1]-t[r][1]),0);function Ra(t,e){let s=Nc(t),r=Rc(s)*e;for(let i=0;i+1<s.length;i++){let o=Math.hypot(s[i+1][0]-s[i][0],s[i+1][1]-s[i][1]);if(r<=o&&o>0){let n=r/o;return[s[i][0]+(s[i+1][0]-s[i][0])*n,s[i][1]+(s[i+1][1]-s[i][1])*n]}r-=o}return s[s.length-1]??[0,0]}function rh(t,e){let s=Nc(t),r=Ra(t,e),i=[],o=Rc(s)*e;for(let n=0;n<s.length;n++){i.push(s[n]);let a=n+1<s.length?Math.hypot(s[n+1][0]-s[n][0],s[n+1][1]-s[n][1]):1/0;if(o<=a)break;o-=a}return"M"+[...i,r].map(n=>`${xt(n[0])},${xt(n[1])}`).join(" L")}var fs=t=>String(Number(t.toFixed(4)));function ih(t,e){let s=t.match(/&[^;\s]+;|[\s\S]/gu)??[];return s.slice(0,Math.round(s.length*e)).join("")}function oh(t){let e=[];return(t.dx||t.dy)&&e.push(`translate(${xt(t.dx??0)} ${xt(t.dy??0)})`),t.scale!==void 0&&t.scale!==1&&e.push(sh(t.about??[0,0],t.scale)),{attrs:{...t.opacity===void 0||t.opacity===1?{}:{opacity:fs(t.opacity)},...e.length?{transform:e.join(" ")}:{}},clip:t.clip}}function ah(t,e){let s={attrs:t.opacity===void 0||t.opacity===1?{}:{opacity:fs(t.opacity)}};if(t.drawn!==void 0&&t.drawn<1&&e!==void 0){let r=Wn(t.drawn),i=Rc(Nc(e));s.path=t.by==="grow"?{d:rh(e,r),head:!1}:{style:`stroke-dasharray:${xt(i)} ${xt(i)};stroke-dashoffset:${xt(i*(1-r))}`,head:!1}}else t.ants&&(s.path={style:`stroke-dasharray:${xt(t.ants.dash[0])} ${xt(t.ants.dash[1])};stroke-dashoffset:${xt(-t.ants.offset)}`,head:!0});return s}function sf(t,e,s,r,i){if(r==="label"||r==="note"){let n=t.labels&&Object.hasOwn(t.labels,s)?t.labels[s]:void 0;return n&&{attrs:{...n.opacity===void 0||n.opacity===1?{}:{opacity:fs(n.opacity)},...n.dx||n.dy?{transform:`translate(${xt(n.dx??0)} ${xt(n.dy??0)})`}:{}},...n.typed===void 0||n.typed>=1?{}:{typed:n.typed}}}if(e==="route"){let n=t.routes&&Object.hasOwn(t.routes,s)?t.routes[s]:void 0;return n&&ah(n,i(s))}let o=t.items&&Object.hasOwn(t.items,s)?t.items[s]:void 0;return o&&oh(o)}function rf(t,e,s){let r=[];for(let i of t.outlines??[])r.push(["polygon",{points:i.points.map(o=>o.map(xt).join(",")).join(" "),class:"ring",fill:"none","stroke-width":"2.5","stroke-linejoin":"round",...i.opacity===void 0?{}:{opacity:fs(i.opacity)},...s?{stroke:i.color??s.control}:{style:`stroke:${i.color??"var(--ring,var(--control,currentColor))"}`}}]);for(let i of t.pulses??[])r.push(["ellipse",{cx:xt(i.x),cy:xt(i.y),rx:xt(i.rx),ry:xt(i.ry),class:"ring",fill:"none","stroke-width":"2.5",...i.opacity===void 0?{}:{opacity:fs(i.opacity)},...s?{stroke:i.color??s.control}:{style:`stroke:${i.color??"currentColor"}`}}]);for(let i of t.tokens??[]){let o=e(i.route);if(o===void 0)continue;let[n,a]=Ra(o,Wn(i.at));r.push(["circle",{cx:xt(n),cy:xt(a),r:"7",class:"tok",...s?{fill:i.color??(i.kind!==void 0?s.kinds?.[i.kind]:void 0)??s.control,stroke:s.surface,"stroke-width":"2.5"}:{style:`fill:${i.color??(i.kind!==void 0?`var(--${i.kind},var(--control,currentColor))`:"var(--control,currentColor)")}`}}])}return r}var of=t=>Object.keys(t).every(e=>e==="morph"||t[e]===void 0),af=new Set(["marks","badges"]),ef=t=>t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;");function Tc(t){let e=new Map,s=[];for(let r of t.matchAll(/<(\/?)([a-zA-Z]+)((?:\s+[\w:-]+="[^"]*")*)\s*(\/?)>/g)){if(r[1]){let n=s.pop();n?.key!==void 0&&e.set(n.key,[n.from,r.index]);continue}if(r[4])continue;let i=/\sdata-item="([^"]*)"/.exec(r[3])?.[1],o=/\sdata-part="([^"]*)"/.exec(r[3])?.[1];s.push({...s.length===2&&i!==void 0&&o!==void 0?{key:`${cf(i)}
143
+ ${o}`}:{},from:r.index+r[0].length})}return e}var tf=new WeakMap;function lh(t,e){let s=tf.get(t)??new Map;tf.set(t,s);let r=s.get(e);if(!r){s.set(e,r=new Map);let i=t.variants?.[e],o=Tc(t.svg);if(i!==void 0)for(let[n,[a,f]]of Tc(i)){let p=o.get(n);p&&t.looks?.[n.split(`
144
+ `)[0]]?.includes(e)&&t.svg.slice(...p)!==i.slice(a,f)&&r.set(n,i.slice(a,f))}}return r}function lf(t,e,s,r){let i=[];for(let o of t.looks?.[e]??[]){let n=Wn(r[o]??0),a=n>0?lh(t,o).get(`${e}
145
+ ${s}`):void 0;a!==void 0&&i.push([a,n])}return i.length?{own:Wn(1-i.reduce((o,[,n])=>o+n,0)),looks:i}:void 0}var ch=(t,e)=>(e.own>0?`<g opacity="${fs(e.own)}">${t}</g>`:"")+e.looks.map(([s,r])=>`<g opacity="${fs(r)}">${s}</g>`).join("");function ph(t,e){let s="",r=0;for(let[i,[o,n]]of[...Tc(t.svg)].sort((a,f)=>a[1][0]-f[1][0])){let[a,f]=i.split(`
146
+ `),p=Object.hasOwn(e,a)?lf(t,a,f,e[a]):void 0;p&&(s+=t.svg.slice(r,o)+ch(t.svg.slice(o,n),p),r=n)}return s+t.svg.slice(r)}function Ki(t,e){if(of(e))return t.rendered.svg;let s=e.variants?ph(t.rendered,e.variants):t.rendered.svg,r=l=>Object.hasOwn(t.rendered.paths,l)?t.rendered.paths[l]:void 0,i=0,o="",n="",a=0,f,p=s.replace(/<(\/?)([a-zA-Z]+)((?:\s+[\w:-]+="[^"]*")*)\s*(\/?)>|([^<]+)/g,(l,d,m,h,y,g)=>{if(g!==void 0)return f?.w.typed===void 0?l:ih(g,f.w.typed);if(d)return i--,f&&i===f.at&&(f=void 0),i===1&&(o=""),l;let k=i;y||i++;let u={};for(let[,b,x]of h.matchAll(/([\w:-]+)="([^"]*)"/g))u[b]=x;if(k===0){if(!e.camera)return l;u.viewBox=e.camera.map(xt).join(" ")}else if(k===1)if(o=m==="g"&&u.class?.startsWith("g-")?u.class.slice(2):"",af.has(o)&&e.marks&&e.marks.opacity!==1)u.opacity=fs(e.marks.opacity);else return l;else if(k===2&&u["data-part"]!==void 0){let b=u["data-route"]===void 0?"item":"route",x=cf(u["data-route"]??u["data-item"]??""),w=sf(e,b,x,u["data-part"],r);if(!w)return l;for(let[$,S]of Object.entries(w.attrs))u[$]=ef(S);if(w.clip){let $=`${t.id}-mc${a++}`;n+=`<clipPath id="${$}"><polygon points="${w.clip.map(S=>S.join(",")).join(" ")}"/></clipPath>`,u["clip-path"]=`url(#${$})`}if(!y&&(w.path||w.typed!==void 0)&&(f={at:k,w}),!Object.keys(w.attrs).length&&!w.clip)return l}else if(f?.w.path&&m==="path"&&u.class?.split(" ")[0]==="flow"){let b=f.w.path;b.d!==void 0&&(u.d=b.d),b.style!==void 0&&(u.style=b.style),b.head||delete u["marker-end"]}else return l;return`<${m}${Object.entries(u).map(([b,x])=>` ${b}="${x}"`).join("")}${y?"/":""}>`});n&&(p=p.replace(/<defs>|<defs\/>/,l=>l==="<defs/>"?`<defs>${n}</defs>`:l+n));let c=rf(e,r,t.rendered.inks);return c.length&&(p=p.replace('<g class="g-anim">',l=>l+c.map(([d,m])=>`<${d}${Object.entries(m).map(([h,y])=>` ${h}="${ef(y)}"`).join("")}/>`).join(""))),p}var cf=t=>t.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&amp;/g,"&"),Oc=new WeakMap;function Ia(t,e,s,r={}){let i=Oc.get(t);if(i){for(let[u,b]of i.mixed)u.replaceChildren(...b);for(let[u,b]of i.attrs)for(let[x,w]of b)w===null?u.removeAttribute(x):u.setAttribute(x,w);for(let[u,b,x]of i.gone.reverse())b.insertBefore(u,x);for(let[u,b]of i.texts)u.data=b;for(let u of i.made)u.remove();Oc.delete(t)}if(of(e))return;let o={attrs:new Map,texts:new Map,gone:[],made:[],mixed:[]};Oc.set(t,o);let n=(u,b,x)=>{let w=o.attrs.get(u)??new Map;w.has(b)||w.set(b,b==="style"?u.getAttribute(b)||null:u.getAttribute(b)),o.attrs.set(u,w),x===null?u.removeAttribute(b):u.setAttribute(b,x)},a=t.ownerDocument,f=(u,b,x)=>{let w=a.createElementNS("http://www.w3.org/2000/svg",u);for(let[$,S]of Object.entries(b))w.setAttribute($,S);return x.append(w),o.made.push(w),w},p=Array.from(t.children),c=u=>p.find(b=>b.getAttribute("class")===`g-${u}`),l=new Map;for(let u of Array.from(c("flows")?.children??[])){let b=u.getAttribute("data-route"),x=u.querySelector("path.flow")?.getAttribute("d");b!==null&&x&&l.set(b,x)}let d=u=>l.get(u);e.camera&&n(t,"viewBox",e.camera.map(xt).join(" "));for(let u of af){let b=c(u);b&&e.marks&&e.marks.opacity!==1&&n(b,"opacity",fs(e.marks.opacity))}let m=0,h=p.find(u=>u.localName==="defs"),y=h?.firstChild??null,g=t.getAttribute("data-scene")??"scene";for(let u of p)for(let b of Array.from(u.children)){let x=b.getAttribute("data-part");if(x===null)continue;let w=b.getAttribute("data-route"),$=w===null?b.getAttribute("data-item")??"":"",S=s&&e.variants&&Object.hasOwn(e.variants,$)?lf(s,$,x,e.variants[$]):void 0;if(S){let A=Array.from(b.childNodes),R=(E,v)=>{let N=a.createElementNS("http://www.w3.org/2000/svg","g");return N.setAttribute("opacity",fs(E)),N.append(...v),N},P=E=>Array.from(a.importNode(new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg">${E}</svg>`,"image/svg+xml").documentElement,!0).childNodes);o.mixed.push([b,A]),b.replaceChildren(...S.own>0?[R(S.own,A)]:[],...S.looks.map(([E,v])=>R(v,P(E))))}let O=sf(e,w===null?"item":"route",w??b.getAttribute("data-item")??"",x,d);if(!O)continue;for(let[A,R]of Object.entries(O.attrs))n(b,A,R);if(O.clip&&h){let A=f("clipPath",{id:`${g}-mc${m++}`},h);h.insertBefore(A,y);let R=a.createElementNS("http://www.w3.org/2000/svg","polygon");R.setAttribute("points",O.clip.map(P=>P.join(",")).join(" ")),A.append(R),n(b,"clip-path",`url(#${A.id})`)}if(O.typed!==void 0){let A=[];for(let R=a.createTreeWalker(b,4);R.nextNode();)A.push(R.currentNode);for(let R of A)o.texts.set(R,R.data),R.data=Array.from(R.data).slice(0,Math.round(Array.from(R.data).length*O.typed)).join(""),R.data||(o.gone.push([R,R.parentNode,R.nextSibling]),R.remove())}let z=O.path&&b.querySelector("path.flow");z&&O.path&&(O.path.d!==void 0&&n(z,"d",O.path.d),O.path.style!==void 0&&(r.styles==="cssom"?(n(z,"style",null),z.style.cssText=O.path.style):n(z,"style",O.path.style)),O.path.head||n(z,"marker-end",null))}let k=c("anim");if(k)for(let[u,b]of rf(e,d,s?.inks))f(u,b,k)}var pf=(t,e)=>({...e,frame:s=>Ki(t,e.at(s))}),Ic=(t,e={})=>pf(t,_r(rr(t),"assemble",e)),df=(t,e={})=>pf(t,_r(rr(t),"disassemble",e)),ff=(t,e)=>Ic(t).frame(e);var La=(t,e)=>e.role??Ot(t,e.kind)?.role,za=(t,e)=>Ot(t,e.region.kind)?.shape,xn=(t,e,s,r="item")=>s?Me("g",{[`data-${r}`]:t,"data-part":e},s):"";function Fr({scene:t,layout:e,routes:s,steps:r,theme:i,id:o,gridStep:n=1}){let a=new yr,f={base:"",floor:"",flows:"",blocks:[],air:"",labels:"",marks:"",badges:""},p=new nr;p.budget.spots=ja;let c=v=>r.vis[v]?{"data-vis":"1"}:{},l=e.items.filter(v=>v.type==="region"),d=v=>{let N=0;for(let C=v.parent;C;C=C.parent)N++;return N},m=e.catalog,h=l.filter(v=>za(m,v)!=="walled"&&za(m,v)!=="tunnel"),y=mi(h.map(v=>({box:v.box,r:v}))).map(v=>v.r).sort((v,N)=>d(v)-d(N));for(let v of y)f.base+=fh(a,m,v,c(v.id),n);for(let v of l.filter(N=>za(m,N)==="walled")){for(let C of Ca(v))p.solids.push(Yt(C));for(let[C,V]of Ca(v).entries())f.blocks.push({box:V,svg:xn(v.id,`wall-${C+1}`,Me("g",{class:`blk k-${La(m,v.region)} wall${v.region.ghost?" ghost":""}`,"data-id":v.id,"data-dim":"1",...c(v.id)},a.blockFaces(V)))});let N=v.region.gate;if(N&&!N.node){let C=Fi(v,N.height??(v.region.height??.8)+.3,.3,.3);p.solids.push(Yt(C)),f.blocks.push({box:C,svg:xn(v.id,"gate",Me("g",{class:"blk k-gate","data-id":v.id,...c(v.id)},a.blockFaces(C)))})}v.region.label&&(v.region["label-style"]??"face")!=="none"&&(f.labels+=xn(v.id,"name",a.faceText(v.box.x0+.3,v.box.y1,v.box.z0+.13,v.region.label,"slabname sm fz",wt.sm,"left","start",{"data-id":v.id,...c(v.id)})))}for(let v of l.filter(N=>za(m,N)==="tunnel"))f.air+=xn(v.id,"block",uh(a,v,c(v.id)));let g=e.items.filter(v=>v.type==="node");for(let v of g){let N=v.node,C=Tn(m,N.asset),V=N.ghost||(N.deco??[]).includes("ghost"),Y=["blk",`k-${N.role??C.role}`,C.cls,V?"ghost":""].filter(Boolean).join(" ");f.blocks.push({box:v.box,svg:xn(v.id,"block",Me("g",{class:Y,"data-id":v.id,"data-dim":"1",...c(v.id)},C.draw(a,v.box,N)))}),p.polys.push({poly:Yt(v.box),owner:v.id}),p.solids.push(Yt(v.box))}let k=mi(f.blocks).map(v=>v.svg).join(""),u=new Set,b={};for(let v of s){if(v.points.length<2)continue;let N=v.points.map(Y=>Re(Y[0],Y[1],Y[2]));N.forEach(Y=>a.bounds.add(Y));let C="M"+N.map(Us).join(" L");b[v.id]=C;let V=v.raw.arrow!==!1;V&&u.add(v.kind),f.flows+=xn(v.id,"line",Me("g",{"data-hl":v.id,"data-id":v.id,...c(v.id)},Me("path",{d:C,class:`flow f-${v.kind}`,"marker-end":V?`url(#ah-${o}-${v.kind})`:void 0})),"route"),p.lines.push({pts:N,owner:v.id})}for(let v of u)a.def(`ah-${o}-${v}`,Me("marker",{id:`ah-${o}-${v}`,viewBox:"0 0 10 10",refX:"7",refY:"5",markerWidth:"4.2",markerHeight:"4.2",orient:"auto-start-reverse"},Me("path",{d:"M0,0 L10,5 L0,10 z",style:`fill:${Hn(i,i.kinds[v]?.color??"control")}`})));for(let v of a.planePolys)p.slants.push(v);let x=g.filter(v=>v.node.label||v.node.sub).sort((v,N)=>(N.box.x1-N.box.x0)*(N.box.y1-N.box.y0)-(v.box.x1-v.box.x0)*(v.box.y1-v.box.y0));for(let v of x)f.labels+=xn(v.id,"label",mh(a,m,v,p,c(v.id)));let w=[];for(let v of s)if(v.raw.label&&v.points.length>=2){let N=hh(a,v,p,c(v.id),e);f.floor+=xn(v.id,"label",N.svg,"route"),N.warning&&w.push({path:`${v.path}/label`,message:N.warning}),p.budget.over&&!p.budget.told&&(p.budget.told=!0,w.push({path:v.path,message:`from route "${v.id}" on, route labels were placed without weighing what other labels and lines cover: the scene is too large to search every spot (${ja.toLocaleString("en")} spots); split it into scenes, or give the labels "along", "side" or "at"`}))}(t.notes??[]).forEach((v,N)=>{let C=xn(`${o}-note-${N}`,"note",yh(a,v,e,s,`${o}-note-${N}`));v.floor?f.floor+=C:f.labels+=C});let $=[],S=new Map;for(let v of r.says){let N=S.get(v.step)??p.fork();S.set(v.step,N);let C=On(v.text,wt.say)+18,V=Oa(C,v.ax,v.ay,{x:v.x,y:v.y,anchor:v.anchor},N);N.rects.push({r:V.rect,owner:""}),$.push({step:v.step,...V.rect,text:v.text});let Y=V.rect.x+2;a.bounds.addRect(V.rect.x,V.rect.y,V.rect.w,V.rect.h);let Z=Hn(i,i.kinds[v.kind]?.color??"control");f.marks+=Me("g",{class:"say","data-step":v.step},Me("rect",{x:Y,y:V.y-12,width:C,height:24,rx:12,style:`stroke:${Z}`})+Me("text",{x:Y+C/2,y:V.y+4,"text-anchor":"middle",style:`fill:${Z}`},vt(v.text)))}for(let v of r.marks){let[N,C]=Re(...v.p);a.bounds.addRect(N-12,C-12,24,24),f.marks+=Me("g",{class:"xm","data-step":v.step,"data-hl":v.on},Me("circle",{cx:N,cy:C,r:10})+Me("path",{d:`M${bt(N-4.5)},${bt(C-4.5)} L${bt(N+4.5)},${bt(C+4.5)} M${bt(N+4.5)},${bt(C-4.5)} L${bt(N-4.5)},${bt(C+4.5)}`}))}for(let v of r.badges){let[N,C]=Re(...v.p);a.bounds.addRect(N-13,C-13,26,26),f.badges+=Me("g",{class:`badge c-${v.kind}`,"data-go":v.step,"data-badge":v.step,tabindex:"0",role:"button","aria-label":`Step ${v.num}`},Me("circle",{cx:N,cy:C,r:11.5})+Me("text",{x:N,y:C+.5},String(v.num)))}let O=a.bounds,z=22,A=O.empty?[0,0,100,100]:[Math.floor(O.x0-z),Math.floor(O.y0-z),Math.ceil(O.x1-O.x0+z*2),Math.ceil(O.y1-O.y0+z*2)],R=[...a.defs.values()].join(""),P=(v,N)=>Me("g",{class:"g-"+v},N);return{svg:Me("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:A.join(" "),role:"img","aria-label":t.aria??t.title,"data-scene":o},Me("defs",{},R)+P("base",f.base)+P("floor",f.floor)+P("flows",f.flows)+P("blocks",k)+P("air",f.air)+P("labels",f.labels)+P("marks",f.marks)+P("badges",f.badges)+P("anim","")),viewBox:A,texts:a.texts,paths:b,warnings:w,callouts:$,assembly:Ta(e,s,A)}}function dh(t,e){let s=t.z1+.002,r=1e-6,i=[],o=(n,a)=>{let f=Re(n[0],n[1],s),p=Re(a[0],a[1],s);i.push(`M${Us(f)}L${Us(p)}`)};for(let n=Math.ceil((t.x0+r)/e)*e;n<t.x1-r;n+=e)o([n,t.y0],[n,t.y1]);for(let n=Math.ceil((t.y0+r)/e)*e;n<t.y1-r;n+=e)o([t.x0,n],[t.x1,n]);return i.length?Me("path",{class:"grid",d:i.join("")}):""}function fh(t,e,s,r,i=1){let o=s.region,n=s.box,a=La(e,o),f=Ot(e,o.kind),p=f?.shape,c={"data-id":s.id,"data-dim":"1",...r},l="";p==="cloud"?l=Me("g",{class:`blk k-${a} cloud`,...c},Er(t,n)):p==="zone"?l=Me("g",{class:`zone k-${a}`,...c},t.poly([[n.x0,n.y0,n.z1],[n.x1,n.y0,n.z1],[n.x1,n.y1,n.z1],[n.x0,n.y1,n.z1]])):l=Me("g",{class:`blk k-${a}${o.ghost?" ghost":""}`,...c},t.blockFaces(n)+dh(n,i)),l=xn(s.id,"block",l);let d=o["label-style"]??f?.labelStyle;if(o.label&&d!=="none")if(d==="face"){let m=n.z1-n.z0,h=u=>u.size*.73/ct,y=p==="slab"&&.28+h(wt.slabname)+.08>m,g=p==="slab"&&!y,k=g?n.z0+.28:y?n.z0+Math.max(.02,(m-h(wt.sm))/2):n.z0+Math.min(.1,m*.25);l+=xn(s.id,"name",Me("g",c,t.faceText(n.x0+(g?.6:.3),n.y1,k,o.label,g?"slabname":"slabname sm",g?wt.slabname:wt.sm,"left","start")))}else if(d==="face-right")l+=xn(s.id,"name",Me("g",c,t.faceText(n.x1,n.y0+.6,n.z0+Math.max(.14,(n.z1-n.z0)*.2),o.label,"slabname",wt.slabname,"right","end")));else{let m=p==="cloud"?"middle":"start",h=p==="cloud"?(n.x0+n.x1)/2:n.x0+.35,y=p==="cloud"?(n.y0+n.y1)/2:n.y1-.35;l+=xn(s.id,"name",Me("g",c,t.floorText(h,y,n.z1+.01,o.label,"slabname sm","x",m)))}return l}function Ca(t){let{x0:e,y0:s,x1:r,y1:i,z0:o,z1:n}=t.box,a=ps,f=t.region.gate,p=[],c=d=>{d.x1-d.x0>1e-6&&d.y1-d.y0>1e-6&&p.push({...d,z0:o,z1:n})},l=(d,m,h)=>{if(!f||f.side!==h)return[[d,m]];let y=f.at??.5,g=f.width??2,k=h==="e"||h==="w"?s+(i-s)*y:e+(r-e)*y;return[[d,k-g/2],[k+g/2,m]]};for(let[d,m]of l(e,r,"n"))c({x0:d,y0:s,x1:m,y1:s+a});for(let[d,m]of l(s+a,i-a,"w"))c({x0:e,y0:d,x1:e+a,y1:m});for(let[d,m]of l(s+a,i-a,"e"))c({x0:r-a,y0:d,x1:r,y1:m});for(let[d,m]of l(e,r,"s"))c({x0:d,y0:i-a,x1:m,y1:i});return p}function mh(t,e,s,r,i){let o=s.node,n=Tn(e,o.asset),a=s.box,f={name:o.label,sub:o.sub},p=o["label-at"],c;if(p){let d=Yn(Yt(a)),m=p.side??"above",h=d.y+Math.min(d.h,60)*.45;m==="right"?c={x:d.x+d.w+8,y:h,anchor:"start"}:m==="left"?c={x:d.x-8,y:h,anchor:"end"}:m==="below"?c={x:d.x+d.w/2,y:d.y+d.h+14,anchor:"middle"}:c=Vi(f,a,Yt(a),new nr,s.id),c={...c,x:c.x+(p.dx??0),y:c.y+(p.dy??0)}}else{let d=n.label?n.label(a,o,!!o.sub):void 0;c=Vi(f,a,Yt(a),r,s.id,d)}r.rects.push({r:qi(f,c.x,c.y,c.anchor),owner:""});let l="";return o.label&&(l+=t.text(c.x,c.y,o.label,"lbl",wt.lbl,c.anchor,{},s.id)),o.sub&&(l+=t.text(c.x,o.label?c.y+14:c.y,o.sub,"sub mono",wt.sub,c.anchor,{},s.id)),Me("g",{"data-id":s.id,"data-dim":"1",...i},l)}function uh(t,e,s){let{x0:r,y0:i,x1:o,y1:n,z0:a,z1:f}=e.box,p=t.blockFaces(e.box),c=o-r>=n-i,l=Math.max(1,Math.round((c?o-r:n-i)/1.6));for(let m=1;m<l;m++){let h=c?r+(o-r)*m/l:i+(n-i)*m/l;p+=t.poly(c?[[h,i,f],[h,n,f],[h,n,a]]:[[r,h,f],[o,h,f],[o,h,a]],"rib")}let d=e.region.label;return d&&e.region["label-style"]!=="none"&&(p+=c?t.faceText(r+.35,n,a+.14,d,"tunname",wt.tunname,"left","start"):t.faceText(o,n-.35,a+.18,d,"tunname",wt.tunname,"right","start")),Me("g",{class:"tunnel","data-id":e.id,"data-dim":"1",...s},p)}var ja=2e4;function hh(t,e,s,r,i){let o=typeof e.raw.label=="string"?{text:e.raw.label}:e.raw.label,n=`floor mono t-${e.kind}`,a={"data-hl":e.id,...r},f=wt.floor;if(o.at){let u=o.at.length>2?o.at[2]:e.points[0][2];return{svg:t.floorText(o.at[0],o.at[1],u,o.text,n,o.dir??"x",o.anchor??"start",a)}}let p=e.points,c=[];for(let u=0;u+1<p.length;u++){let b=p[u],x=p[u+1];Math.abs(b[2]-x[2])>1e-6||c.push({i:u,len:Math.hypot(x[0]-b[0],x[1]-b[1])})}if(!c.length)return{svg:"",warning:`label "${o.text}" of route "${e.id}" was dropped: the route has no level segment`};let l=o.along?c.filter(u=>u.i===Math.min(o.along-1,p.length-2)):[...c].sort((u,b)=>b.len-u.len),d=.22,m=11/ct,h=u=>{let b=On(u,f)/ct,x,w=1/0,$=0;e:for(let S of l.length?l:c){let O=p[S.i],z=p[S.i+1],A=O[2],R=Math.abs(O[1]-z[1])<1e-6,P=R?Math.min(O[0],z[0]):Math.min(O[1],z[1]),E=R?Math.max(O[0],z[0]):Math.max(O[1],z[1]),v=R?O[1]:O[0],N=o.side==="left"?[-1]:o.side==="right"?[1]:[-1,1],C=[];for(let V=P+.3;V<=Math.max(P+.3,E-b-.2)+1e-9;V+=.4)C.push(V);for(let V=E-b-.2+.4;V<E+.5&&E-P<b+.5;V+=.6)C.push(V);for(let V of N)for(let Y of C){if(w<=$*.5)break e;let Z=V<0?v-d:v+d+m,j,K,U;if(R?(j=Y,K=Z,U=[Re(j,K-m,A),Re(j+b,K-m,A),Re(j+b,K,A),Re(j,K,A)]):(j=Z,K=Y+b,U=[Re(j-m,K,A),Re(j-m,K-b,A),Re(j,K-b,A),Re(j,K,A)]),(R?[[j,K-m],[j+b,K-m],[j+b,K],[j,K]]:[[j-m,K],[j-m,K-b],[j,K-b],[j,K]]).some(([ce,le])=>Math.abs(Rr(i,ce,le)+.01-A)>.001)){$++;continue}let L=s.hiddenPoly(U),q=L*50+$*.5,G=s.budget.spots-- >0;G||(s.budget.over=!0);let X=q>=w?1/0:G?q+s.costPoly(U,w-q):q;$++,X<w&&(w=X,x={x:j,y:K,z:A,dir:R?"x":"y",rect:Yn(U),poly:U,hidden:L})}}return x&&x.hidden<6?x:void 0},y=o.text,g=h(y),k;if(!g){let u=o.text.split(/(\s+)/);for(let b=u.length-1;b>0&&!g;b--){let x=u.slice(0,b).join("").trimEnd().replace(/[\s,;:·–-]+$/,"")+"\u2026";if(x.length<6)break;let w=h(x);w&&(g=w,y=x)}k=g?`label of route "${e.id}" shortened to "${y}": no clear floor for the whole text`:`label "${o.text}" of route "${e.id}" was dropped: blocks cover every spot beside it`,g?k+='; give it "along", "side" or "at", or move the nodes apart':k+='; give it "at: [x, y]", or move the nodes apart'}return g?(s.slants.push(g.poly),{svg:t.floorText(g.x,g.y,g.z+.01,y,n,g.dir,"start",a),warning:k}):{svg:"",warning:k}}function yh(t,e,s,r,i){let o=e.on?r.find(c=>c.id===e.on):void 0,n=e.on&&!o?s.byId.get(e.on):void 0,a=e.at,f={"data-id":i,"data-hl":o?.id,"data-dim":o?void 0:"1"},p=e.kind??o?.kind??"control";if(e.floor){let c=a&&a.length>2?a[2]:o?o.points[0][2]:n?n.floor:.36,[l,d]=a?[a[0],a[1]]:o?[o.points[0][0]+.35,o.points[0][1]-.25]:n?[n.box.x0+.3,n.box.y1-.3]:[0,0];return t.floorText(l,d,c+.01,e.floor,`floor mono t-${p}`,e.dir??"x",e.anchor??"start",f)}if(e.face){let c=n?.box,[l,d,m]=a?[a[0],a[1],a[2]??.45]:c?[c.x0+.3,c.y1,c.z0+.13]:[0,0,0];return t.faceText(l,d,m,e.face,"slabname sm",wt.sm,"left",e.anchor??"start",f)}if(e.label||e.sub){let c=n?.box,l=a?[a[0],a[1],a[2]??.36]:c?[(c.x0+c.x1)/2,(c.y0+c.y1)/2,c.z1+.75]:[0,0,0],[d,m]=Re(l[0],l[1],l[2]),h=d+(e.dx??0),y=m-18+(e.dy??0),g=e.anchor??"middle",k="";return e.label&&(k+=t.text(h,y,e.label,"lbl",wt.lbl,g)),e.sub&&(k+=t.text(h,e.label?y+14:y,e.sub,"sub mono",wt.sub,g)),Me("g",f,k)}return""}function _a(t,e){let s={};for(let r of t.layout.items){let i=(r.region??r.node)?.variants;i&&(s[r.id]=Object.keys(i))}Object.keys(s).length&&(t.rendered.looks=s,t.rendered.variants=Object.fromEntries([...new Set(Object.values(s).flat())].map(r=>[r,Fr({scene:t.raw,routes:t.routes,steps:t.steps,theme:e,id:t.raw.id,gridStep:t.grid.step??t.grid.snap??1,layout:{...t.layout,items:t.layout.items.map(i=>{let o=(i.region??i.node)?.variants?.[r];return o?i.region?{...i,region:{...i.region,...o,deco:void 0}}:{...i,node:{...i.node,...o}}:i})}}).svg])))}var Gi=29.09090909090909,zc={solid:[9,7],dashed:[7,6],dotted:[3,6]},Cc=["blocked","planned"],mf=`
147
147
  .flow.iso-ants{stroke-dasharray:var(--ant-on) var(--ant-off);animation:iso-ants var(--ant-turn) linear infinite;animation-play-state:var(--ants,running)}
148
148
  @keyframes iso-ants{to{stroke-dashoffset:var(--ant-to)}}
149
- `;function Zi(t,e={}){return(e.still??Rc).includes(t)?void 0:e.dash??e.kinds?.[t]?.ants??Nc[e.kinds?.[t]?.dash??"solid"]}function Ss(t){let e=t?.ants;return e?e===!0?{}:Array.isArray(e)?{ids:e}:e:void 0}function ja(t,e={}){let s=new Map(t.routes.map(n=>[n.id,n.kind])),r=e.ids&&new Set(e.ids),i=e.speed??Gi,o=n=>String(Number(n.toFixed(3)));return t.rendered.svg.replace(/(<g data-route="([^"]*)" data-part="line">(?:<g[^>]*>)*)<path ([^>]*?)\s*\/>/g,(n,a,f,p)=>{let c=f.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&"),l=r&&!r.has(c)?void 0:Zi(s.get(c)??"",e);if(!l||!/class="flow\b/.test(p))return n;let d=l[0]+l[1],m=o(d/Math.max(1e-6,Math.abs(i))),h=o(i<0?d:-d);return e.by==="css"?`${a}<path ${p.replace(/class="flow\b/,'class="flow iso-ants')} style="--ant-on:${o(l[0])};--ant-off:${o(l[1])};--ant-to:${h};--ant-turn:${m}s"/>`:e.by==="none"?`${a}<path ${p.replace(/ ?stroke-dasharray="[^"]*"/,"")} style="stroke-dasharray:${o(l[0])} ${o(l[1])}"/>`:`${a}<path ${p.replace(/ ?stroke-dasharray="[^"]*"/,"")} style="stroke-dasharray:${o(l[0])} ${o(l[1])}"><animate attributeName="stroke-dashoffset" from="0" to="${h}" dur="${m}s" repeatCount="indefinite"/></path>`})}var ir=t=>typeof t=="string"?[t]:[...t],La=t=>JSON.parse(JSON.stringify(t)),En=(t={})=>({...t.from===void 0?{}:{from:t.from},...t.over===void 0?{}:{duration:t.over},...t.easing===void 0?{}:{easing:t.easing}}),Dr=class t{nodes=[];add(e){return this.nodes.push(La(e)),this}assemble(e={},s={}){return this.add({assemble:e,...En(s)})}disassemble(e={},s={}){return this.add({disassemble:e,...En(s)})}travel(e,s={}){let{each:r,hold:i,loop:o}=s;return this.add({travel:e,...En(s),each:r,hold:i,loop:o})}pulse(e,s={}){return this.add({pulse:ir(e),...En(s),loop:s.loop})}ants(e=!0,s={}){return this.add({ants:e===!0?!0:ir(e),...En(s),speed:s.speed,dash:s.dash})}draw(e,s={}){return this.add({draw:ir(e),...En(s),by:s.by,stagger:s.stagger})}type(e,s={}){return this.add({type:ir(e),...En(s)})}move(e,s){return this.add({move:e,...s})}lift(e,s,r={}){return this.add({lift:ir(e),by:s,...En(r),stagger:r.stagger,to:r.to,opacity:r.opacity})}focus(e,s={}){let{scope:r,level:i,always:o}=s;return this.add({focus:{lit:ir(e),scope:r,level:i,always:o},...En(s),fade:s.fade})}highlight(e,s={}){return this.add({highlight:ir(e),...En(s),fade:s.fade})}get camera(){return{focus:(e,s={})=>this.add({camera:{focus:e,zoom:s.zoom,margin:s.margin},...En(s)}),fit:(e={})=>this.add({camera:"fit",...En(e)})}}sequence(e,s={},r){return this.add({sequence:df(e,s,r)})}series(e){let s=new Br;return e(s),this.add({series:s.items})}layers(e){let s=new t;return e(s),this.add({layers:s.nodes})}};function df(t,e,s){let{read:r,duration:i,...o}=e,n=new Dr;return s?.(n),La({...t===void 0?{}:{name:t},...o,...r!==void 0?{duration:{read:r}}:i!==void 0?{duration:i}:{},...n.nodes.length?{children:n.nodes}:{}})}var Br=class{items=[];sequence(e,s={},r){return this.items.push({sequence:df(e,s,r)}),this}transition(e){return this.items.push({transition:La(e)}),this}},Ui=class extends Br{over=[];marks={};head;constructor(e={}){super(),this.head=e}beat(e,s,r={},i){return this.sequence(e,{...r,say:s},i)}assemble(e={},s={}){return this.sequence(void 0,{},r=>r.assemble(e,s))}disassemble(e={},s={}){return this.sequence(void 0,{},r=>r.disassemble(e,s))}mark(e,s){return this.marks[e]=s,this}layers(e){let s=new Dr;return e(s),this.over.push(...s.nodes),this}toJSON(){return La({isomotion:1,...this.head,...this.items.length?{series:this.items}:{},...this.over.length?{layers:this.over}:{},...Object.keys(this.marks).length?{markers:this.marks}:{}})}},ff=(t={})=>new Ui(t);function _a(t,e){if(!e)return t;let[s,r,i,o]=e,n=t[2]/t[3],a=i-s,f=o-r;a/f<n?a=f*n:f=a/n,a=Math.min(a,t[2]),f=Math.min(f,t[3]);let p=(s+i)/2,c=(r+o)/2,l=Math.max(t[0],Math.min(t[0]+t[2]-a,p-a/2)),d=Math.max(t[1],Math.min(t[1]+t[3]-f,c-f/2));return[l,d,a,f]}var Yi=["linear","ease","ease-in","ease-out","ease-in-out","settle","bounce"],or=["extend","clamp","wrap","identity"];function Jn(t,e){if(typeof t=="number")return Number.isFinite(t)?t:void 0;if(typeof t!="string")return;let s=/^(-?\d+(?:\.\d+)?)(ms|s|f)?$/.exec(t.trim());if(!s)return;let r=Number(s[1]);return s[2]==="s"?r*1e3:s[2]==="f"?e?r/e*1e3:void 0:r}function Wi(t,e){let s=e===!0?{}:e,r=s.base??2600,i=s.perChar??40,o=s.min??5600,n=s.max??12500;return Math.max(o,Math.min(n,r+(t?.text??"").length*i))}var Ds=(t,e,s,r)=>i=>{if(i<=0)return 0;if(i>=1)return 1;let o=(f,p,c)=>3*f*c*(1-c)**2+3*p*c*c*(1-c)+c**3,n=0,a=1;for(let f=0;f<50;f++){let p=(n+a)/2;o(t,s,p)<i?n=p:a=p}return o(e,r,(n+a)/2)},hh=t=>{if(t<=0)return 0;if(t>=1)return 1;let e=7.5625,s=2.75;return t<1/s?e*t*t:t<2/s?e*(t-1.5/s)**2+.75:t<2.5/s?e*(t-2.25/s)**2+.9375:e*(t-2.625/s)**2+.984375},yh={linear:t=>t,ease:Ds(.25,.1,.25,1),"ease-in":Ds(.42,0,1,1),"ease-out":Ds(0,0,.58,1),"ease-in-out":Ds(.42,0,.58,1),settle:Ds(.16,.84,.3,1),bounce:hh};function qr(t,e={}){let s=e.mass??1,r=e.stiffness??100,i=e.damping??10,o=Math.max(0,t)/1e3,n=Math.sqrt(r/s),a=i/(2*Math.sqrt(r*s)),f;if(a<1){let p=n*Math.sqrt(1-a*a);f=1-Math.exp(-a*n*o)*(Math.cos(p*o)+a*n/p*Math.sin(p*o))}else f=1-Math.exp(-n*o)*(1+n*o);return e.overshootClamping?Math.min(1,f):f}function Xn(t,e,s="ease-in-out"){let r=t??s;return typeof r=="string"?yh[r]:"bezier"in r?Ds(...r.bezier):i=>i<=0?0:i>=1?1:qr(i*e,r.spring)}function Vr(t,e,s){let r=t.times.map(l=>Jn(l,s)),i=t.values,o=r.length;if(o===1)return i[0];let n=(l,d)=>{if(l==="clamp")return d?i[0]:i[o-1];if(l==="identity")return e;if(l==="wrap"){let m=r[o-1]-r[0];return Vr({...t,extrapolateLeft:"clamp",extrapolateRight:"clamp"},r[0]+((e-r[0])%m+m)%m,s)}};if(e<r[0]){let l=n(t.extrapolateLeft??"extend",!0);if(l!==void 0)return l}if(e>r[o-1]){let l=n(t.extrapolateRight??"extend",!1);if(l!==void 0)return l}let a=0;for(;a<o-2&&e>=r[a+1];)a++;let f=r[a+1]-r[a],p=(e-r[a])/f,c=p<0||p>1?p:Xn(t.easing,f,"linear")(p);return i[a]+(i[a+1]-i[a])*c}var Ic=["sequence","series","layers","assemble","disassemble","travel","pulse","ants","draw","type","move","lift","focus","highlight","camera"],mf={morph:"the 2D morph is a later version's",diff:"diffs are a later version's",switch:"a look is a beat's: its variants"},Wn=["from","duration","easing"],Hi={sequence:[],series:[],layers:[],assemble:Wn,disassemble:Wn,travel:[...Wn,"each","hold","loop"],pulse:[...Wn,"loop"],ants:[...Wn,"speed","dash"],draw:[...Wn,"by","stagger"],type:Wn,move:["from","x","y","scale","opacity"],lift:[...Wn,"by","stagger","to","opacity"],focus:[...Wn,"fade"],highlight:[...Wn,"fade"],camera:Wn},gh=["name","from","offset","duration","loop","playbackRate","trimBefore","say","show","hide","focus","highlight","levels","variants","enter","ants","children","layers","series"],At=t=>!!t&&typeof t=="object"&&!Array.isArray(t);function Fa(t){let e=[],s=(u,b,x)=>{e.push({severity:"error",path:u,message:b,...x?{hint:x}:{}})},r=(u,b,x)=>{for(let w of Object.keys(u))if(!b.includes(w)){let $=Vt(w,b);s(`${x}/${w}`,`unknown key "${w}"`,$?`did you mean "${$}"?`:void 0)}};if(!At(t))return s("","a motion document is a map"),e;r(t,["isomotion","fps","seed","ambient","series","layers","markers"],""),t.isomotion!==1&&s("/isomotion","isomotion is 1");let i=typeof t.fps=="number"&&t.fps>0?t.fps:void 0;t.fps!==void 0&&i===void 0&&s("/fps","fps is a number over 0"),t.seed!==void 0&&!Number.isInteger(t.seed)&&s("/seed","seed is a whole number"),t.ambient!==void 0&&t.ambient!=="on"&&t.ambient!=="off"&&s("/ambient",'ambient is "on" or "off"');let o=(u,b,x={})=>{if(u===void 0)return;if(typeof u=="string"&&/f$/.test(u)&&i===void 0){s(b,`"${u}" is in frames: the document needs its fps`);return}let w=Jn(u,i);w===void 0?s(b,`${JSON.stringify(u)} isn't a time (ms, "1.2s", "450ms", "30f")`):w<0&&!x.negative&&s(b,"a time can't be negative")},n=(u,b,x)=>{if(u!==void 0&&!b.includes(u)){let w=typeof u=="string"?Vt(u,b):void 0;s(x,`${JSON.stringify(u)} isn't one of ${b.join(", ")}`,w?`did you mean "${w}"?`:void 0)}},a=(u,b,x={})=>{u!==void 0&&(typeof u!="number"||!Number.isFinite(u)||x.min!==void 0&&u<x.min||x.max!==void 0&&u>x.max||x.over!==void 0&&u<=x.over)&&s(b,`${JSON.stringify(u)} isn't a number${x.over!==void 0?` over ${x.over}`:x.min!==void 0?` from ${x.min}${x.max!==void 0?` to ${x.max}`:""}`:""}`)},f=(u,b)=>{if(u!==void 0){if(!Array.isArray(u)){s(b,"a list of ids");return}u.forEach((x,w)=>{typeof x!="string"&&s(`${b}/${w}`,"an id")})}},p=(u,b,x=[])=>{if(!At(u)){s(b,"a spring is a map");return}r(u,["mass","damping","stiffness","overshootClamping",...x],b);for(let w of["mass","damping","stiffness"])a(u[w],`${b}/${w}`,{over:0});u.overshootClamping!==void 0&&typeof u.overshootClamping!="boolean"&&s(`${b}/overshootClamping`,"true or false")},c=(u,b)=>{if(u!==void 0){if(typeof u=="string"){n(u,Yi,b);return}if(At(u)&&"bezier"in u){r(u,["bezier"],b),(!Array.isArray(u.bezier)||u.bezier.length!==4||u.bezier.some(x=>typeof x!="number"))&&s(`${b}/bezier`,"four numbers");return}if(At(u)&&"spring"in u){r(u,["spring"],b),p(u.spring,`${b}/spring`);return}s(b,"an easing is a name, { bezier: [a, b, c, d] } or { spring: { \u2026 } }")}},l=(u,b)=>{if(u===void 0)return;if(!At(u)){s(b,"a curve is { times, values }");return}r(u,["times","values","easing","extrapolateLeft","extrapolateRight"],b);let x=u.times,w=u.values;if(!Array.isArray(x)||!x.length)s(`${b}/times`,"a list of times");else{x.forEach((v,O)=>o(v,`${b}/times/${O}`,{negative:!0}));let $=x.map(v=>Jn(v,i));for(let v=1;v<$.length;v++)$[v]!==void 0&&$[v-1]!==void 0&&$[v]<=$[v-1]&&s(`${b}/times/${v}`,"times go up")}!Array.isArray(w)||w.some($=>typeof $!="number")?s(`${b}/values`,"a list of numbers"):Array.isArray(x)&&w.length!==x.length&&s(`${b}/values`,`${w.length} values for ${x.length} times`),c(u.easing,`${b}/easing`),n(u.extrapolateLeft,or,`${b}/extrapolateLeft`),n(u.extrapolateRight,or,`${b}/extrapolateRight`)},d=(u,b)=>{if(u!==void 0){if(!At(u)){s(b,"focus is { lit: [ids] }");return}r(u,["lit","scope","level","always"],b),u.lit===void 0&&s(`${b}/lit`,"what is lit"),f(u.lit,`${b}/lit`),f(u.always,`${b}/always`),n(u.scope,["all","links"],`${b}/scope`),a(u.level,`${b}/level`,{min:0,max:1})}},m=(u,b)=>{u!==void 0&&typeof u!="string"&&s(b,"text")},h=new Map;function y(u,b,x){if(!At(u)){s(b,"a sequence is a map");return}if(r(u,gh,b),u.name!==void 0&&(typeof u.name!="string"||!/^[A-Za-z][\w-]*$/.test(u.name)?s(`${b}/name`,"a name is letters, digits, - and _, from a letter"):h.has(u.name)?s(`${b}/name`,`"${u.name}" is already a name (${h.get(u.name)})`):h.set(u.name,b)),x&&u.from!==void 0&&s(`${b}/from`,"in a series a sequence follows the one before","offset moves it"),!x&&u.offset!==void 0&&s(`${b}/offset`,"offset is for a series","use from"),o(u.from,`${b}/from`),o(u.offset,`${b}/offset`,{negative:!0}),o(u.trimBefore,`${b}/trimBefore`),At(u.duration)){r(u.duration,["read"],`${b}/duration`);let w=u.duration.read;if(w!==!0&&!At(w))s(`${b}/duration/read`,"true, or { base, perChar, min, max }");else if(At(w)){r(w,["base","perChar","min","max"],`${b}/duration/read`);for(let $ of["base","perChar","min","max"])a(w[$],`${b}/duration/read/${$}`,{min:0})}}else o(u.duration,`${b}/duration`);if(u.loop!==void 0&&typeof u.loop!="boolean"&&!(Number.isInteger(u.loop)&&u.loop>=1)&&s(`${b}/loop`,"true, false, or how many times"),a(u.playbackRate,`${b}/playbackRate`,{over:0}),u.say!==void 0)if(!At(u.say))s(`${b}/say`,"say is a map");else{let w=u.say;r(w,["chapter","title","text","code","facts","color"],`${b}/say`);for(let $ of["chapter","title","text","code","color"])m(w[$],`${b}/say/${$}`);w.facts!==void 0&&(!Array.isArray(w.facts)||w.facts.some($=>!Array.isArray($)||$.length!==2||$.some(v=>typeof v!="string")))&&s(`${b}/say/facts`,"a list of [name, value]")}for(let w of["show","hide","highlight"])f(u[w],`${b}/${w}`);if(d(u.focus,`${b}/focus`),u.levels!==void 0)if(!At(u.levels))s(`${b}/levels`,"levels is a map: an id, and how much of it");else for(let[w,$]of Object.entries(u.levels))a($,`${b}/levels/${w}`,{min:0,max:1});if(u.variants!==void 0)if(!At(u.variants))s(`${b}/variants`,"variants is a map: an id, and the name of its look");else for(let[w,$]of Object.entries(u.variants))typeof $!="string"&&s(`${b}/variants/${w}`,`a look's name, or "" for its own`);u.enter!==void 0&&(At(u.enter)?(r(u.enter,["fade","easing"],`${b}/enter`),u.enter.fade===void 0&&s(`${b}/enter/fade`,"how long the fade is"),o(u.enter.fade,`${b}/enter/fade`),c(u.enter.easing,`${b}/enter/easing`)):s(`${b}/enter`,"enter is { fade }")),u.ants!==void 0&&typeof u.ants!="boolean"&&f(u.ants,`${b}/ants`);for(let w of["children","layers"])u[w]!==void 0&&k(u[w],`${b}/${w}`);u.series!==void 0&&g(u.series,`${b}/series`)}function g(u,b){if(!Array.isArray(u)){s(b,"a series is a list");return}u.forEach((x,w)=>{let $=`${b}/${w}`;if(!At(x)||Object.keys(x).length!==1||!("sequence"in x||"transition"in x)){s($,"a series holds sequences and transitions");return}if("sequence"in x){y(x.sequence,`${$}/sequence`,!0);return}let v=x.transition,O=`${$}/transition`,C=A=>At(u[A])&&"sequence"in u[A];if((!C(w-1)||!C(w+1))&&s(O,"a transition is between two sequences"),!At(v)){s(O,"a transition is { presentation, timing }");return}r(v,["presentation","timing"],O),v.presentation===void 0?s(`${O}/presentation`,"a presentation"):n(v.presentation,["fade","none"],`${O}/presentation`),At(v.timing)?"linear"in v.timing?(r(v.timing,["linear"],`${O}/timing`),o(v.timing.linear,`${O}/timing/linear`)):"spring"in v.timing?(r(v.timing,["spring"],`${O}/timing`),p(v.timing.spring,`${O}/timing/spring`,["duration"]),At(v.timing.spring)&&o(v.timing.spring.duration,`${O}/timing/spring/duration`)):s(`${O}/timing`,"a timing is { linear } or { spring }"):s(`${O}/timing`,"a timing is { linear } or { spring }")})}function k(u,b){if(!Array.isArray(u)){s(b,"a list");return}u.forEach((x,w)=>{let $=`${b}/${w}`;if(!At(x)){s($,"a map");return}let v=Ic.filter(R=>R in x);if(v.length!==1){let R=Object.keys(x).find(S=>S in mf),M=Object.keys(x)[0],T=M?Vt(M,Ic):void 0;s($,R?`${R}: ${mf[R]}`:v.length?`one of ${v.join(", ")}, not several`:`one of ${Ic.join(", ")}`,!R&&!v.length&&T?`did you mean "${T}"?`:void 0);return}let O=v[0],C=x[O],A=`${$}/${O}`;r(x,[O,...Hi[O]],$),Hi[O].includes("from")&&o(x.from,`${$}/from`),Hi[O].includes("duration")&&(o(x.duration,`${$}/duration`),c(x.easing,`${$}/easing`));for(let R of["each","hold","stagger","fade"])Hi[O].includes(R)&&o(x[R],`${$}/${R}`);if(Hi[O].includes("loop")&&x.loop!==void 0&&typeof x.loop!="boolean"&&s(`${$}/loop`,"true or false"),O==="sequence")y(C,A,!1);else if(O==="series")g(C,A);else if(O==="layers")k(C,A);else if(O==="assemble"||O==="disassemble")At(C)?(n(C.style,O==="assemble"?jr:Lr,`${A}/style`),n(C.order,sr,`${A}/order`),C.duration!==void 0&&s(`${A}/duration`,"its length is beside it","duration is the node's")):s(A,`${O} is a map (its options)`);else if(O==="travel")!Array.isArray(C)||!C.length?s(A,"a list of connectors"):C.forEach((R,M)=>{Array.isArray(R)?f(R,`${A}/${M}`):typeof R!="string"&&s(`${A}/${M}`,"a connector, or a list of them at once")});else if(O==="ants")C!==!0&&f(C,A),a(x.speed,`${$}/speed`),x.dash!==void 0&&(!Array.isArray(x.dash)||x.dash.length!==2||x.dash.some(R=>typeof R!="number"||R<=0))&&s(`${$}/dash`,"two numbers over 0: on, off");else if(O==="move"){typeof C!="string"&&s(A,"an id");for(let R of["x","y","scale","opacity"])l(x[R],`${$}/${R}`)}else if(O==="focus")d(C,A);else if(O==="camera"){if(C!=="fit")if(!At(C))s(A,'"fit", or { focus, zoom, margin }');else{r(C,["focus","zoom","margin"],A),a(C.zoom,`${A}/zoom`,{over:0}),a(C.margin,`${A}/margin`);let R=C.focus;typeof R=="string"||Array.isArray(R)&&(R.every(M=>typeof M=="string")||R.length===4&&R.every(M=>typeof M=="number"))||s(`${A}/focus`,"an id, some ids, or a box [x, y, w, h]")}}else f(C,A);O==="draw"&&n(x.by,["stroke","grow"],`${$}/by`),O==="lift"&&(x.by===void 0&&s(`${$}/by`,"how far apart"),a(x.by,`${$}/by`),n(x.to,["up","down"],`${$}/to`),l(x.opacity,`${$}/opacity`))})}if(t.series!==void 0&&g(t.series,"/series"),t.layers!==void 0&&k(t.layers,"/layers"),t.markers!==void 0)if(!At(t.markers))s("/markers","markers is a map");else for(let[u,b]of Object.entries(t.markers))if(typeof b=="string"&&/^[A-Za-z][\w-]*([+-].+)?$/.test(b)){let x=/^([A-Za-z][\w-]*?)(?:([+-])(\d.*))?$/.exec(b);if(x&&(h.has(x[1])?x[1]:void 0))x[3]!==void 0&&o(x[3],`/markers/${u}`);else if(!h.has(b)){let v=Vt(x?.[1]??b,h.keys());s(`/markers/${u}`,`no sequence is named "${x?.[1]??b}"`,v?`did you mean "${v}"?`:void 0)}}else o(b,`/markers/${u}`);return e}var kn=t=>Math.round(t*100)/100||0,Wt=t=>Math.round(t*1e4)/1e4||0,Nn=t=>Math.max(0,Math.min(1,t)),Kr=(t,e,s)=>t+(e-t)*s,bh=250,zc=class{items=new Map;labels=new Map;routes=new Map;tokens=[];pulses=[];outlines=[];variants={};marks=1;at(e,s){let r=e.get(s);return r||e.set(s,r={}),r}item(e,s){let r=this.at(this.items,e);s.opacity!==void 0&&(r.opacity=(r.opacity??1)*s.opacity),s.dx&&(r.dx=(r.dx??0)+s.dx),s.dy&&(r.dy=(r.dy??0)+s.dy),s.scale!==void 0&&(r.scale=(r.scale??1)*s.scale,r.about=s.about??r.about),s.clip&&(r.clip=s.clip)}label(e,s){let r=this.at(this.labels,e);s.opacity!==void 0&&(r.opacity=(r.opacity??1)*s.opacity),s.dx&&(r.dx=(r.dx??0)+s.dx),s.dy&&(r.dy=(r.dy??0)+s.dy),s.typed!==void 0&&(r.typed=Math.min(r.typed??1,s.typed))}route(e,s){let r=this.at(this.routes,e);s.opacity!==void 0&&(r.opacity=(r.opacity??1)*s.opacity),s.drawn!==void 0&&s.drawn<(r.drawn??1)&&(r.drawn=s.drawn,r.by=s.by),s.ants&&(r.ants=s.ants)}add(e){for(let[s,r]of Object.entries(e.items??{}))this.item(s,r);for(let[s,r]of Object.entries(e.labels??{}))this.label(s,r);for(let[s,r]of Object.entries(e.routes??{}))this.route(s,r);e.marks&&(this.marks*=e.marks.opacity),this.tokens.push(...e.tokens??[]),this.pulses.push(...e.pulses??[])}state(e){let s={},r=(c,l)=>{let d={};for(let[m,h]of c){let y=l(h);Object.keys(y).length&&(d[m]=y)}return d},i=c=>Object.keys(c).length>0,o=c=>c===void 0||Wt(c)>=1?{}:{opacity:Wt(Math.max(0,c))},n=c=>({...kn(c.dx??0)?{dx:kn(c.dx)}:{},...kn(c.dy??0)?{dy:kn(c.dy)}:{}}),a=r(this.items,c=>({...o(c.opacity),...n(c),...c.scale!==void 0&&Wt(c.scale)!==1?{scale:Wt(c.scale),...c.about?{about:c.about}:{}}:{},...c.clip?{clip:c.clip}:{}})),f=r(this.labels,c=>({...o(c.opacity),...c.typed!==void 0&&c.typed<1?{typed:Wt(c.typed)}:{},...n(c)})),p=r(this.routes,c=>{let l=c.opacity!==void 0&&Wt(c.opacity)<=0,d=c.drawn!==void 0&&c.drawn<1;return{...o(c.opacity),...d?{drawn:Wt(c.drawn),...c.by?{by:c.by}:{}}:{},...c.ants&&!l&&!d?{ants:c.ants}:{}}});return i(a)&&(s.items=a),i(f)&&(s.labels=f),i(p)&&(s.routes=p),Wt(this.marks)<1&&(s.marks={opacity:Wt(this.marks)}),this.tokens.length&&(s.tokens=this.tokens),this.pulses.length&&(s.pulses=this.pulses),this.outlines.length&&(s.outlines=this.outlines),i(this.variants)&&(s.variants=this.variants),e&&(s.camera=e),s}};function Ji(t){let e=Ss(t.raw),s=t.rendered.looks,r=rr(t),i=Object.keys(r.notes).filter(o=>r.notes[o]===void 0);return{model:r,kinds:Object.fromEntries(t.routes.map(o=>[o.id,o.kind])),outlines:Object.fromEntries(t.layout.items.map(o=>[o.id,Yt(o.box).map(n=>[kn(n[0]),kn(n[1])])])),...s&&Object.keys(s).length?{looks:s}:{},...e?{ants:e}:{},...i.length?{free:i}:{}}}function vs(t,e,s={}){let r="model"in t?t:Ji(t),i=r.free?{...r.model,notes:{...r.model.notes,...Object.fromEntries(r.free.map(P=>[P,void 0]))}}:r.model,o=Fa(e),n=e.fps,a=r.ants,f=()=>({ok:!1,diags:o,duration:0,beats:[],markers:{},ambient:"on",loops:!1,at:()=>({}),cues:()=>{},beatAt:()=>{},startOf:()=>{}});if(o.length)return f();let p=(P,B,W)=>{o.push({severity:"error",path:P,message:B,...W?{hint:W}:{}})},c=(P,B)=>P===void 0?B:Jn(P,n),l=new Map(i.pieces.map(P=>[P.id,P])),d=new Set(i.routes.map(P=>P.id)),m=new Set(Object.keys(i.notes)),h=new Map(Object.entries(r.kinds)),y=[...l.keys(),...d,...m],g=new Set(y),k=new Map;for(let[P,B]of Object.entries(i.notes))B!==void 0&&k.set(B,[...k.get(B)??[],P]);let u={any:g,thing:new Set(l.keys()),route:d},b={any:"thing, connector or note",thing:"thing",route:"connector"},x=(P,B,W="any")=>{if(!u[W].has(P)){let fe=Vt(P,u[W]);p(B,`no ${b[W]} "${P}" in this drawing`,fe?`did you mean "${fe}"?`:void 0)}},w=(P,B,W="any")=>P?.forEach((fe,me)=>x(fe,`${B}/${me}`,W)),$=new Map(Object.entries(r.outlines)),v=new Map;function O(P,B){let W="from"in P?c(P.from,0):0,fe="duration"in P?c(P.duration,NaN):NaN,me=Number.isFinite(fe);if("sequence"in P){let X=P.sequence;return c(X.from,0)+M(X,`${B}/sequence`)}if("series"in P)return T(P.series,`${B}/series`).end;if("layers"in P)return Math.max(0,...P.layers.map((X,ne)=>O(X,`${B}/layers/${ne}`)));if("assemble"in P||"disassemble"in P){let X="assemble"in P?"assemble":"disassemble",ne="assemble"in P?P.assemble:P.disassemble,ye=v.get(P);return ye||v.set(P,ye=_r(i,X,{seed:e.seed??1,...ne,...me?{duration:fe}:{}})),W+ye.duration}return"draw"in P?W+(me?fe:400)+Math.max(0,P.draw.length-1)*c(P.stagger,0):"lift"in P?W+Math.max(me?fe:750,...P.opacity?.times.map(X=>Jn(X,n))??[])+Math.max(0,P.lift.length-1)*c(P.stagger,0):me?W+fe:"travel"in P?P.loop?W:W+P.travel.length*c(P.each,1150):"pulse"in P?P.loop?W:W+1500:"type"in P?W+400:"camera"in P?W+900:"move"in P?W+Math.max(0,...[P.x,P.y,P.scale,P.opacity].flatMap(X=>X?.times.map(ne=>Jn(ne,n))??[])):W}let C=(P,B)=>Math.max(0,...(P.children??[]).map((W,fe)=>O(W,`${B}/children/${fe}`)),...(P.layers??[]).map((W,fe)=>O(W,`${B}/layers/${fe}`)),P.series?T(P.series,`${B}/series`).end:0),A=new Map;function R(P,B){let W=A.get(P);if(W!==void 0)return W;let fe;return P.duration!==void 0&&typeof P.duration=="object"?fe=Wi(P.say,P.duration.read):fe=P.duration!==void 0?c(P.duration,0):C(P,B),P.duration===void 0&&fe<=0&&P.say&&(fe=Wi(P.say,!0)),fe<=0&&p(`${B}/duration`,"how long is it? (nothing in it says)"),A.set(P,fe),fe}let M=(P,B)=>{let W=R(P,B),fe=P.playbackRate??1;return P.loop===!0?W/fe:(typeof P.loop=="number"?W*P.loop:W)/fe};function T(P,B){let W=[],fe=0,me;return P.forEach((X,ne)=>{if("transition"in X){let D=X.transition,le=D.timing,ue=D.presentation==="none"?0:"linear"in le?c(le.linear,0):c(le.spring.duration,wh(le.spring));me={t:D,length:ue};return}let ye=X.sequence,$e=`${B}/${ne}/sequence`,E=M(ye,$e),_=Math.max(0,fe+c(ye.offset,0)-(me?.length??0));me&&W.length&&me.length>Math.min(W[W.length-1].end-W[W.length-1].start,E)&&p(`${B}/${ne-1}/transition/timing`,"a transition is no longer than either side of it"),W.push({s:ye,path:$e,start:_,end:_+E,...me?{into:me}:{}}),fe=_+E,me=void 0}),{list:W,end:Math.max(0,...W.map(X=>X.end))}}let S=T(e.series??[],"/series"),N=Math.max(0,...(e.layers??[]).map((P,B)=>O(P,`/layers/${B}`))),z=Math.max(S.end,N);z<=0&&!o.length&&p("","a motion document has a series, or layers, that last");let K=new Map,J=[],Z=i.viewBox,L=(P,B,W)=>{let fe=W!==void 0?1/W:Math.max((P.w+B*2)/Z[2],(P.h+B*2)/Z[3]);return[P.x+P.w/2-Z[2]*fe/2,P.y+P.h/2-Z[3]*fe/2,Z[2]*fe,Z[3]*fe]};function U(P,B,W){let fe=me=>W?{at:W.at+me/W.rate,rate:W.rate}:void 0;if("sequence"in P){ee(P.sequence,`${B}/sequence`,fe(c(P.sequence.from,0)),!1);return}if("series"in P){for(let me of T(P.series,`${B}/series`).list)ee(me.s,me.path,fe(me.start),!1);return}if("layers"in P){P.layers.forEach((me,X)=>U(me,`${B}/layers/${X}`,W));return}if("travel"in P)P.travel.forEach((me,X)=>(Array.isArray(me)?me:[me]).forEach((ne,ye)=>x(ne.split(":")[0],`${B}/travel/${X}${Array.isArray(me)?`/${ye}`:""}`,"route")));else if("pulse"in P)w(P.pulse,`${B}/pulse`,"thing");else if("ants"in P)P.ants!==!0&&w(P.ants,`${B}/ants`,"route");else if("draw"in P)w(P.draw,`${B}/draw`,"route");else if("type"in P)w(P.type,`${B}/type`);else if("move"in P)x(P.move,`${B}/move`,"thing");else if("lift"in P)w(P.lift,`${B}/lift`,"thing");else if("focus"in P)H(P.focus,`${B}/focus`);else if("highlight"in P)w(P.highlight,`${B}/highlight`,"thing");else if("camera"in P){let me=P.camera,X=c(P.duration,900);if(!W){p(`${B}/camera`,"a camera can't be in a loop");return}let ne=Z;if(me!=="fit"){let ye=me.focus;if(Array.isArray(ye)&&typeof ye[0]=="number")ne=L({x:ye[0],y:ye[1],w:ye[2],h:ye[3]},me.margin??0,me.zoom);else{let $e=typeof ye=="string"?[ye]:ye;$e.forEach((_,D)=>x(_,`${B}/camera/focus${typeof ye=="string"?"":`/${D}`}`,"thing"));let E=$e.map(_=>l.get(_)?.bbox).filter(_=>!!_);if(E.length){let _=Math.min(...E.map(le=>le.x)),D=Math.min(...E.map(le=>le.y));ne=L({x:_,y:D,w:Math.max(...E.map(le=>le.x+le.w))-_,h:Math.max(...E.map(le=>le.y+le.h))-D},me.margin??40,me.zoom)}}}J.push({at:W.at+c(P.from,0)/W.rate,over:X/W.rate,ease:Xn(P.easing,X,"settle"),to:ne})}}let H=(P,B)=>{P&&(w(P.lit,`${B}/lit`),w(P.always,`${B}/always`))};function ee(P,B,W,fe){if(P.name!==void 0&&W&&K.set(P.name,W.at),!fe)for(let ne of["show","hide","say","enter","focus","highlight","levels","variants","ants"])P[ne]!==void 0&&p(`${B}/${ne}`,`${ne} is for a sequence of the document's own series`,ne==="focus"||ne==="highlight"||ne==="ants"?`here, a child: { ${ne}: \u2026 }`:void 0);w(P.show,`${B}/show`),w(P.hide,`${B}/hide`),w(P.highlight,`${B}/highlight`,"thing"),H(P.focus,`${B}/focus`);for(let ne of Object.keys(P.levels??{}))ne!=="*"&&x(ne,`${B}/levels/${ne}`);for(let[ne,ye]of Object.entries(P.variants??{})){x(ne,`${B}/variants/${ne}`,"thing");let $e=r.looks?.[ne]??[];if(l.has(ne)&&ye!==""&&!$e.includes(ye)){let E=Vt(ye,$e);p(`${B}/variants/${ne}`,$e.length?`${ne} has no look "${ye}" (it has ${$e.join(", ")})`:`${ne} declares no looks (variants: in the diagram)`,E?`did you mean "${E}"?`:void 0)}}Array.isArray(P.ants)&&w(P.ants,`${B}/ants`,"route");let me=P.playbackRate??1,X=W&&!P.loop?{at:W.at-c(P.trimBefore,0)/(W.rate*me),rate:W.rate*me}:void 0;if((P.children??[]).forEach((ne,ye)=>U(ne,`${B}/children/${ye}`,X)),(P.layers??[]).forEach((ne,ye)=>U(ne,`${B}/layers/${ye}`,X)),P.series)for(let ne of T(P.series,`${B}/series`).list)ee(ne.s,ne.path,X&&{at:X.at+ne.start/X.rate,rate:X.rate},!1)}for(let P of S.list)ee(P.s,P.path,{at:P.start,rate:1},!0);(e.layers??[]).forEach((P,B)=>U(P,`/layers/${B}`,{at:0,rate:1})),J.sort((P,B)=>P.at-B.at);let j={};for(let[P,B]of Object.entries(e.markers??{})){let W=Jn(B,n);if(W!==void 0){j[P]=W;continue}let fe=String(B),me=[...K.keys()].filter(ye=>fe===ye||fe.startsWith(ye+"+")||fe.startsWith(ye+"-")).sort((ye,$e)=>$e.length-ye.length)[0];if(me===void 0){p(`/markers/${P}`,`"${fe}" isn't a moment of this document`);continue}let X=fe.slice(me.length),ne=X?Jn(X.slice(1),n):0;if(ne===void 0){p(`/markers/${P}`,`"${X}" isn't a time`);continue}j[P]=K.get(me)+(X[0]==="-"?-ne:ne)}if(o.length)return f();let q=S.list.map((P,B)=>({name:P.s.name??`beat-${B+1}`,index:B,start:P.start,end:P.end,...P.s.say?{say:P.s.say}:{}})),G=new Map;for(let P of S.list){for(let B of P.s.show??[])G.has(B)||G.set(B,!1);for(let B of P.s.hide??[])G.has(B)||G.set(B,!0)}let Q=[new Map(G)];for(let P of S.list){let B=new Map(Q[Q.length-1]);for(let W of P.s.show??[])B.set(W,!0);for(let W of P.s.hide??[])B.set(W,!1);Q.push(B)}let ce=[new Map];for(let P of S.list){let B=new Map(ce[ce.length-1]);for(let[W,fe]of Object.entries(P.s.variants??{}))B.set(W,fe);ce.push(B)}let pe=(P,B)=>!P||P.lit.includes(B)||P.always?.includes(B)||P.scope==="links"&&l.has(B)?1:P.level??.12,Y=(P,B)=>{let W=P<0?void 0:S.list[P].s.levels;return W?W[B]??W["*"]??1:1},ie=(P,B)=>(Q[P+1].get(B)===!1?0:1)*(P<0?1:pe(S.list[P].s.focus,B))*Y(P,B),Ae=(P,B)=>{let W=i.notes[B];if(W===void 0)return ie(P,B);let fe=P<0?void 0:S.list[P].s.levels?.[B];return ie(P,W)*(Q[P+1].get(B)===!1?0:1)*(fe??1)},De=P=>{let B=-1;for(let W=0;W<S.list.length;W++)S.list[W].start<=P&&(B=W);return B},I=(P,B)=>{let W=S.list[P],fe=B-W.start;if(W.into&&W.into.length>0){let ne=W.into.t.timing;return"spring"in ne?fe>=W.into.length?1:Nn(qr(fe,{...ne.spring,overshootClamping:!0})/qr(W.into.length,{...ne.spring,overshootClamping:!0})):Nn(fe/W.into.length)}let me=W.s.enter;if(!me)return 1;let X=c(me.fade,0);return X<=0?1:Xn(me.easing,X,"ease")(Nn(fe/X))};function V(P,B,W,fe,me){if("sequence"in P){let $e=P.sequence,E=c($e.from,0);ke($e,B-E,W-E,Ie($e,fe-E),me);return}if("series"in P){for(let $e of T(P.series,"").list)ke($e.s,B-$e.start,W-$e.start,$e.end-$e.start,me);return}if("layers"in P){for(let $e of P.layers)V($e,B,W,fe,me);return}let X=c("from"in P?P.from:void 0,0),ne=B-X;if("assemble"in P||"disassemble"in P){me.sum.add(v.get(P).at(ne));return}if("draw"in P){let $e=Math.max(1,c(P.duration,400)),E=c(P.stagger,0),_=Xn(P.easing,$e,"ease-out");P.draw.forEach((D,le)=>{let ue=_(Nn((ne-le*E)/$e));ue<=0?(me.sum.route(D,{opacity:0,drawn:0}),me.sum.label(D,{opacity:0})):ue<1&&(me.sum.route(D,{drawn:ue,...P.by?{by:P.by}:{}}),me.sum.label(D,{opacity:ue}))});return}if("type"in P){let $e=c(P.duration,400),E=Xn(P.easing,$e,"linear")(Nn(ne/Math.max(1,$e)));if(E<1)for(let _ of P.type)me.sum.label(_,E<=0?{opacity:0}:{typed:E});return}if("move"in P){let $e=ue=>ue?Vr(ue,ne,n):void 0,E=$e(P.x)??0,_=$e(P.y)??0,D=$e(P.scale),le=$e(P.opacity);me.sum.item(P.move,{dx:E,dy:_,...D===void 0?{}:{scale:D,about:l.get(P.move).foot},...le===void 0?{}:{opacity:Nn(le)}});for(let ue of[P.move,...k.get(P.move)??[]])me.sum.label(ue,{dx:E,dy:_,...le===void 0?{}:{opacity:Nn(le)}});return}if("lift"in P){let $e=c(P.stagger,0),E=Math.max(1,c(P.duration,750)),_=Xn(P.easing,E,"ease-out"),D=P.to==="down",le=P.lift.length;P.lift.forEach((ue,Ce)=>{let oe=ne-(D?le-1-Ce:Ce)*$e,Le=_(Nn(oe/E)),Pe=(Ce+1)*P.by*(D?Le:-Le),xe=P.opacity?Nn(Vr(P.opacity,oe,n)):1;if(!(!Pe&&xe>=1)){me.sum.item(ue,{dy:Pe,opacity:xe});for(let _e of[ue,...k.get(ue)??[]])me.sum.label(_e,{dy:Pe,opacity:xe})}});return}if("camera"in P)return;let ye=P.duration===void 0?Math.max(0,fe-X):c(P.duration,0);if(!(ne<0||ne>ye)){if("focus"in P||"highlight"in P){let $e=Math.max(1,c(P.fade,bh)),E=Nn(Math.min(ne/$e,P.duration===void 0?1:(ye-ne)/$e)),_=Xn(P.easing,$e,"linear")(E);if("focus"in P)be(P.focus,_,me.sum);else for(let D of P.highlight)me.shown(D)&&Te(D,_,me.sum);return}if("ants"in P){ze(P.ants===!0?[...d]:P.ants,me,P.speed,P.dash);return}if("pulse"in P){let E=P.loop?ae(W-X,1500,me)/1500:ne/Math.max(1,P.duration===void 0?1500:ye);if(E<0||E>=1)return;for(let _ of P.pulse)if(me.shown(_)){let D=l.get(_),le=D.bbox.w*.5*(.7+E*.6);me.sum.pulses.push({x:kn(D.foot[0]),y:kn(D.foot[1]),rx:kn(le),ry:kn(le*.58),opacity:Wt(1-E)})}return}if("travel"in P){let $e=c(P.each,1150),E=c(P.hold,P.loop?700:0),_=P.travel.length*$e+E,D=P.loop?ae(W-X,_,me):ne,le=Math.floor(D/$e);if(le>=P.travel.length)return;let ue=(D-le*$e)/$e,Ce=Xn(P.easing,$e,"ease-in-out")(ue),oe=P.travel[le];for(let Le of Array.isArray(oe)?oe:[oe]){let[Pe,xe]=Le.split(":");me.shown(Pe)&&me.sum.tokens.push({route:Pe,at:Wt((xe??h.get(Pe))==="blocked"?te(ue):Ce),...xe?{kind:xe}:{}})}}}}let te=P=>P<.7?P/.7:1-(P-.7)/.3*.25,ae=(P,B,W)=>W.off?0:(P%B+B)%B,Te=(P,B,W)=>{Wt(B)>0&&$.has(P)&&W.outlines.push({id:P,points:$.get(P),...Wt(B)<1?{opacity:Wt(B)}:{}})},be=(P,B,W)=>{for(let fe of y){let me=m.has(fe)&&!P.lit.includes(fe)&&!P.always?.includes(fe)?i.notes[fe]:void 0,X=Kr(1,pe(P,me??fe),B);X>=1||(l.has(fe)?(W.item(fe,{opacity:X}),W.label(fe,{opacity:X})):d.has(fe)?(W.route(fe,{opacity:X}),W.label(fe,{opacity:X})):W.label(fe,{opacity:X}))}},ze=(P,B,W=Gi,fe)=>{for(let me of P){let X=Zi(h.get(me)??"",{dash:fe,kinds:s.kinds,still:s.still});if(!X)continue;let ne=X[0]+X[1],ye=ae(W*B.A/1e3,ne,B);B.sum.route(me,{ants:{dash:X,offset:kn(ye)}})}},Ie=(P,B)=>P.loop===!0?Math.max(0,B):M(P,"");function ke(P,B,W,fe,me){if(B<0||B>fe||B===fe&&fe<z&&fe>0&&P.loop)return;let X=P.playbackRate??1,ne=R(P,""),ye=c(P.trimBefore,0),$e=P.loop&&ne>0?B*X%ne:B*X,E=$e+ye,_=W*X+ye;for(let D of P.children??[])V(D,E,_,ne+ye,me);for(let D of P.layers??[])V(D,E,_,ne+ye,me);if(P.series)for(let D of T(P.series,"").list)ke(D.s,E-D.start,_-D.start,D.end-D.start,me)}function Be(P,B={}){let W=Math.max(0,Math.min(z,Number.isFinite(P)?P:0)),fe=B.ambient==="off"||e.ambient==="off"&&B.ambient===void 0,me=typeof B.ambient=="number"?B.ambient:W,X=new zc,ne=De(W),ye=ne<0?1:I(ne,W),$e=(oe,Le)=>ne<0?Le(-1,oe):ye>=1?Le(ne,oe):Kr(Le(ne-1,oe),Le(ne,oe),ye),E=oe=>(ne<0?Q[0]:Q[ne+1]).get(oe)!==!1;if(G.size||S.list.some(oe=>oe.s.focus||oe.s.levels))for(let oe of y){let Le=$e(oe,m.has(oe)?Ae:ie);Le>=1||(l.has(oe)&&X.item(oe,{opacity:Le}),d.has(oe)&&X.route(oe,{opacity:Le}),X.label(oe,{opacity:Le}))}if(ne>=0)for(let oe of ce[ce.length-1].keys()){let Le=ce[ne].get(oe)??"",Pe=ce[ne+1].get(oe)??"",xe={};Le&&ye<1&&(xe[Le]=Wt(1-ye)),Pe&&(xe[Pe]=Wt((xe[Pe]??0)+ye));for(let _e of Object.keys(xe))xe[_e]<=0&&delete xe[_e];Object.keys(xe).length&&(X.variants[oe]=xe)}if(ne>=0){let oe=new Set(S.list[ne].s.highlight??[]),Le=new Set(ne>0&&ye<1?S.list[ne-1].s.highlight??[]:[]);for(let Pe of new Set([...Le,...oe]))Te(Pe,Kr(Le.has(Pe)?1:0,oe.has(Pe)?1:0,ye),X)}let _={sum:X,shown:E,off:fe,A:me},D=ne>=0?S.list[ne].s.ants:void 0,le=D===void 0?a:void 0;D?ze(D===!0?[...d]:D,_):le&&ze(le.ids??[...d],_,le.speed,le.dash),S.list.forEach((oe,Le)=>{W>=oe.start&&(W<oe.end||Le===ne&&W<=oe.end)&&ke(oe.s,W-oe.start,me-oe.start,oe.end-oe.start,_)});for(let oe of e.layers??[])V(oe,W,me,z,_);let ue;for(let oe of J){if(oe.at>W)break;let Le=oe.over<=0?1:oe.ease(Nn((W-oe.at)/oe.over)),Pe=ue??Z;if(Le>=1){ue=oe.to;continue}let xe=Pe[2],_e=oe.to[2],Ue=Math.exp(Kr(Math.log(xe),Math.log(_e),Le)),mt=Math.abs(_e-xe)<1e-6?Le:(Ue-xe)/(_e-xe),ys=Kr(Pe[0]+Pe[2]/2,oe.to[0]+oe.to[2]/2,mt),kt=Kr(Pe[1]+Pe[3]/2,oe.to[1]+oe.to[3]/2,mt),at=Ue*Z[3]/Z[2];ue=[ys-Ue/2,kt-at/2,Ue,at]}let Ce=ue?.map(kn);return X.state(Ce&&Ce.some((oe,Le)=>Math.abs(oe-Z[Le])>.005)?Ce:void 0)}let Qe=P=>{if(!P||typeof P!="object")return!1;if(Array.isArray(P))return P.some(Qe);let B=P;return B.ants!==void 0&&B.ants!==!1||B.loop===!0&&("travel"in B||"pulse"in B)?!0:Object.values(B).some(Qe)},Ke=a!==void 0||Qe(e.series)||Qe(e.layers),pt=P=>{let B=De(Math.max(0,Math.min(z,P)));return B<0?void 0:q[B]};return{ok:!0,diags:o,duration:z,beats:q,markers:j,ambient:e.ambient??"on",loops:Ke,at:Be,beatAt:pt,startOf:P=>K.get(P)??q.find(B=>B.name===P)?.start,cues(P){let B=pt(P);if(!B)return;let W=Math.max(0,Math.min(z,P));return{beat:B.name,index:B.index,of:q.length,progress:Wt(Nn((W-B.start)/Math.max(1,B.end-B.start))),...B.say?{say:B.say,...B.say.chapter!==void 0?{chapter:B.say.chapter}:{},...B.say.color!==void 0?{color:B.say.color}:{}}:{}}}}}function wh(t){let e=t.mass??1,s=t.stiffness??100,r=t.damping??10,i=Math.sqrt(s/e),o=Math.min(1,r/(2*Math.sqrt(s*e)));return Math.ceil(Math.log(200)/(o*i)*1e3*(o>=1?1.6:1))}function Da(t){let{steps:e,vis:s}=t.steps,r=t.rendered.viewBox,i=!1,o=rr(t),n=new Set([...o.pieces.map(c=>c.id),...o.routes.map(c=>c.id),...Object.keys(o.notes)]),a=c=>n.has(c),f=Object.keys(o.notes).filter(c=>o.notes[c]===void 0),p=e.map((c,l)=>{let d=[],m=[];for(let[u,b]of Object.entries(s))(l===0?!b.includes(!0):b[l-1]&&!b[l])?m.push(u):l>0&&b[l]&&!b[l-1]&&d.push(u);let h=[],y=u=>`${u.route}:${u.kind}`;c.phases.length&&h.push({travel:c.phases.map(u=>u.length===1?y(u[0]):u.map(y)),each:1150,hold:700,loop:!0});let g=(t.raw.steps??[])[l]?.pulse?.filter(u=>t.layout.byId.has(u))??[];if(g.length&&h.push({pulse:g,loop:!0}),c.focus){let[u,b,x,w]=_a(r,c.focus).map(kn);h.push({camera:{focus:[u,b,x,w]},duration:900,easing:"ease-in-out"}),i=!0}else i&&(h.push({camera:"fit",duration:900,easing:"ease-in-out"}),i=!1);let k={name:`step-${c.n}`,duration:c.duration,say:{title:c.heading,...c.caption?{text:c.caption}:{},...c.command?{code:c.command}:{}}};return d.length&&(k.show=d),m.length&&(k.hide=m),k.focus=t.raw.dim==="all"?{lit:c.lit.filter(a),scope:"all",level:.14}:{lit:c.lit.filter(a),scope:"links",level:.12,...f.length?{always:f}:{}},h.length&&(k.children=h),{sequence:k}});return{isomotion:1,...p.length?{series:p}:{}}}var xh={anyOf:[{type:"number"},{type:"string",pattern:"^-?\\d+(\\.\\d+)?(ms|s|f)?$"}]},kh={type:"array",items:{type:"string"}},$h={anyOf:[{enum:Yi},{type:"object",required:["bezier"],additionalProperties:!1,properties:{bezier:{type:"array",items:{type:"number"},minItems:4,maxItems:4}}},{type:"object",required:["spring"],additionalProperties:!1,properties:{spring:{$ref:"#/$defs/spring"}}}]},uf={from:{$ref:"#/$defs/time"},duration:{$ref:"#/$defs/time"},easing:{$ref:"#/$defs/ease"}},mn=(t,e,s={},r=!0)=>({type:"object",required:[t],additionalProperties:!1,properties:{[t]:e,...r?uf:{},...s}}),hf={$schema:"https://json-schema.org/draft/2020-12/schema",title:"isomotion/1",type:"object",required:["isomotion"],additionalProperties:!1,properties:{isomotion:{const:1},fps:{type:"number",exclusiveMinimum:0,description:'Frames a second, for lengths written "30f".'},seed:{type:"integer"},ambient:{enum:["on","off"],description:"Off: the ants and the looping tokens and pulses stand still, each at its start."},series:{$ref:"#/$defs/series"},layers:{$ref:"#/$defs/nodes"},markers:{type:"object",additionalProperties:{anyOf:[{type:"number"},{type:"string"}]}}},$defs:{time:xh,ids:kh,ease:$h,spring:{type:"object",additionalProperties:!1,properties:{mass:{type:"number",exclusiveMinimum:0},damping:{type:"number",exclusiveMinimum:0},stiffness:{type:"number",exclusiveMinimum:0},overshootClamping:{type:"boolean"}}},curve:{type:"object",required:["times","values"],additionalProperties:!1,properties:{times:{type:"array",items:{$ref:"#/$defs/time"},minItems:1},values:{type:"array",items:{type:"number"},minItems:1},easing:{$ref:"#/$defs/ease"},extrapolateLeft:{enum:or},extrapolateRight:{enum:or}}},say:{type:"object",additionalProperties:!1,properties:{chapter:{type:"string"},title:{type:"string"},text:{type:"string"},code:{type:"string"},color:{type:"string"},facts:{type:"array",items:{type:"array",items:{type:"string"},minItems:2,maxItems:2}}}},focus:{type:"object",required:["lit"],additionalProperties:!1,properties:{lit:{$ref:"#/$defs/ids"},scope:{enum:["all","links"]},level:{type:"number",minimum:0,maximum:1},always:{$ref:"#/$defs/ids"}}},sequence:{type:"object",additionalProperties:!1,properties:{name:{type:"string",pattern:"^[A-Za-z][\\w-]*$"},from:{$ref:"#/$defs/time"},offset:{$ref:"#/$defs/time"},trimBefore:{$ref:"#/$defs/time"},duration:{anyOf:[{$ref:"#/$defs/time"},{type:"object",required:["read"],additionalProperties:!1,properties:{read:{anyOf:[{const:!0},{type:"object",additionalProperties:!1,properties:{base:{type:"number"},perChar:{type:"number"},min:{type:"number"},max:{type:"number"}}}]}}}]},loop:{anyOf:[{type:"boolean"},{type:"integer",minimum:1}]},playbackRate:{type:"number",exclusiveMinimum:0},say:{$ref:"#/$defs/say"},show:{$ref:"#/$defs/ids"},hide:{$ref:"#/$defs/ids"},focus:{$ref:"#/$defs/focus"},highlight:{$ref:"#/$defs/ids"},levels:{type:"object",additionalProperties:{type:"number",minimum:0,maximum:1}},variants:{type:"object",additionalProperties:{type:"string"}},enter:{type:"object",required:["fade"],additionalProperties:!1,properties:{fade:{$ref:"#/$defs/time"},easing:{$ref:"#/$defs/ease"}}},ants:{anyOf:[{type:"boolean"},{$ref:"#/$defs/ids"}]},children:{$ref:"#/$defs/nodes"},layers:{$ref:"#/$defs/nodes"},series:{$ref:"#/$defs/series"}}},series:{type:"array",items:{anyOf:[{$ref:"#/$defs/seq"},mn("transition",{type:"object",required:["presentation","timing"],additionalProperties:!1,properties:{presentation:{enum:["fade","none"]},timing:{anyOf:[{type:"object",required:["linear"],additionalProperties:!1,properties:{linear:{$ref:"#/$defs/time"}}},{type:"object",required:["spring"],additionalProperties:!1,properties:{spring:{type:"object",additionalProperties:!1,properties:{mass:{type:"number",exclusiveMinimum:0},damping:{type:"number",exclusiveMinimum:0},stiffness:{type:"number",exclusiveMinimum:0},overshootClamping:{type:"boolean"},duration:{$ref:"#/$defs/time"}}}}}]}}},{},!1)]}},seq:mn("sequence",{$ref:"#/$defs/sequence"},{},!1),plan:{type:"object"},nodes:{type:"array",items:{anyOf:[{$ref:"#/$defs/seq"},mn("series",{$ref:"#/$defs/series"},{},!1),mn("layers",{$ref:"#/$defs/nodes"},{},!1),mn("assemble",{type:"object",properties:{style:{enum:jr},order:{enum:sr}}}),mn("disassemble",{type:"object",properties:{style:{enum:Lr},order:{enum:sr}}}),mn("travel",{type:"array",items:{anyOf:[{type:"string"},{$ref:"#/$defs/ids"}]},minItems:1},{each:{$ref:"#/$defs/time"},hold:{$ref:"#/$defs/time"},loop:{type:"boolean"}}),mn("pulse",{$ref:"#/$defs/ids"},{loop:{type:"boolean"}}),mn("ants",{anyOf:[{const:!0},{$ref:"#/$defs/ids"}]},{speed:{type:"number"},dash:{type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:2}}),mn("draw",{$ref:"#/$defs/ids"},{by:{enum:["stroke","grow"]},stagger:{$ref:"#/$defs/time"}}),mn("type",{$ref:"#/$defs/ids"}),{type:"object",required:["move"],additionalProperties:!1,properties:{move:{type:"string"},from:{$ref:"#/$defs/time"},x:{$ref:"#/$defs/curve"},y:{$ref:"#/$defs/curve"},scale:{$ref:"#/$defs/curve"},opacity:{$ref:"#/$defs/curve"}}},{type:"object",required:["lift","by"],additionalProperties:!1,properties:{lift:{$ref:"#/$defs/ids"},by:{type:"number"},stagger:{$ref:"#/$defs/time"},to:{enum:["up","down"]},opacity:{$ref:"#/$defs/curve"},...uf}},mn("focus",{$ref:"#/$defs/focus"},{fade:{$ref:"#/$defs/time"}}),mn("highlight",{$ref:"#/$defs/ids"},{fade:{$ref:"#/$defs/time"}}),mn("camera",{anyOf:[{const:"fit"},{type:"object",required:["focus"],additionalProperties:!1,properties:{focus:{anyOf:[{type:"string"},{$ref:"#/$defs/ids"},{type:"array",items:{type:"number"},minItems:4,maxItems:4}]},zoom:{type:"number",exclusiveMinimum:0},margin:{type:"number"}}}]})]}}}};var bf=new Set(["fill","stroke","stroke-width","stroke-dasharray","stroke-linecap","stroke-linejoin","opacity","fill-opacity","stroke-opacity","font-size","font-weight","font-family","letter-spacing","text-anchor","dominant-baseline","paint-order","display","stop-color","stop-opacity"]),Sh=new Set("cursor pointer-events transition animation transform-box transform-origin user-select".split(" "));function vh(t,e){let s={classes:[],not:[],attrs:[],child:e},r=t,i=n=>{let a=n.exec(r);return a&&(r=r.slice(a[0].length)),a},o=i(/^[a-zA-Z][\w-]*/);for(o?s.tag=o[0]:i(/^\*/);r;){let n;if(n=i(/^\.([\w-]+)/))s.classes.push(n[1]);else if(n=i(/^:not\(\.([\w-]+)\)/))s.not.push(n[1]);else if(n=i(/^\[([\w-]+)(?:="([^"]*)")?\]/))s.attrs.push([n[1],n[2]]);else throw new Error(`resolve: a selector it doesn't know: ${t}`)}return s}function Mh(t){let e=t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/@keyframes[^{]*\{(?:[^{}]*\{[^}]*\})*[^{}]*\}/g,"").replace(/@media[^{]*\{(?:[^{}]*\{[^}]*\})*[^{}]*\}/g,"");if(/@/.test(e.replace(/"[^"]*"/g,"")))throw new Error("resolve: an at-rule it doesn't know");let s=[];for(let r of e.matchAll(/([^{}]+)\{([^{}]*)\}/g)){let i=r[2].split(";").map(o=>o.trim()).filter(Boolean).map(o=>{let n=o.indexOf(":"),a=o.slice(0,n).trim(),f=o.slice(n+1).trim();return[a,f.replace(/\s*!important$/,""),/!important$/.test(f)]});for(let o of i)if(!o[0].startsWith("--")&&!bf.has(o[0])&&!Sh.has(o[0]))throw new Error(`resolve: a property it doesn't know: ${o[0]}`);for(let o of r[1].split(",").map(n=>n.trim()).filter(Boolean)){if(o.includes(":root")||o.includes("::")||/^(html|body)\b/.test(o))continue;let a=o.replace(/\s*>\s*/g," >").split(/\s+/).map(p=>vh(p.replace(/^>/,""),p.startsWith(">"))),f=a.reduce((p,c)=>p+10*(c.classes.length+c.not.length+c.attrs.length)+(c.tag?1:0),0);s.push({parts:a,spec:f,order:s.length,decls:i})}}return s}function Ph(t){let e={name:"#root",attrs:[],children:[]},s=e;for(let r of t.matchAll(/<\/[a-zA-Z][\w:-]*>|<([a-zA-Z][\w:-]*)((?:\s+[\w:-]+="[^"]*")*)\s*(\/?)>|([^<]+)/g)){if(r[4]!==void 0){s.children.push(r[4]);continue}if(r[1]===void 0){s=s.parent;continue}let i={name:r[1],attrs:[...r[2].matchAll(/([\w:-]+)="([^"]*)"/g)].map(o=>[o[1],o[2]]),children:[],parent:s};s.children.push(i),r[3]||(s=i)}return e.children[0]}var wf=t=>typeof t=="string"?t:`<${t.name}${t.attrs.map(([e,s])=>` ${e}="${s}"`).join("")}${t.children.length||t.name==="g"?`>${t.children.map(wf).join("")}</${t.name}>`:"/>"}`,Xi=(t,e)=>t.attrs.find(s=>s[0]===e)?.[1],Gr=(t,e,s)=>{let r=t.attrs.find(i=>i[0]===e);r?r[1]=s:t.attrs.push([e,s])},Oh=t=>(Xi(t,"class")??"").split(/\s+/).filter(Boolean);function Ah(t,e){if(e.tag&&e.tag!==t.name)return!1;let s=Oh(t);return e.classes.every(r=>s.includes(r))&&!e.not.some(r=>s.includes(r))&&e.attrs.every(([r,i])=>{let o=Xi(t,r);return o!==void 0&&(i===void 0||o===i)})}function Cc(t,e,s=e.length-1){if(!Ah(t,e[s]))return!1;if(s===0)return!0;let r=t.parent;if(e[s].child)return!!r&&r.name!=="#root"&&Cc(r,e,s-1);for(;r&&r.name!=="#root";r=r.parent)if(Cc(r,e,s-1))return!0;return!1}var Bs=t=>t.endsWith("%")?parseFloat(t)/100:parseFloat(t);function Th(t,e,s,r){let i=(1-Math.abs(2*s-1))*e,o=(t%360+360)%360/60,n=i*(1-Math.abs(o%2-1)),a=s-i/2,[f,p,c]=o<1?[i,n,0]:o<2?[n,i,0]:o<3?[0,i,n]:o<4?[0,n,i]:o<5?[n,0,i]:[i,0,n];return[(f+a)*255,(p+a)*255,(c+a)*255,r]}function xf(t,e){let s=[],r=0,i="";for(let o of t)o==="("&&r++,o===")"&&r--,o===e&&r===0?(s.push(i.trim()),i=""):i+=o;return[...s,i.trim()].filter(Boolean)}var yf={transparent:[0,0,0,0],black:[0,0,0,1],white:[255,255,255,1]};function Ba(t){let e=t.trim();if(Object.hasOwn(yf,e))return yf[e];let s=/^#([0-9a-f]{3,8})$/i.exec(e);if(s){let r=s[1].length<6?[...s[1]].map(i=>i+i).join(""):s[1];return[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16),r.length===8?parseInt(r.slice(6),16)/255:1]}if(s=/^hsla?\((.*)\)$/.exec(e),s){let[r,i]=s[1].split("/").map(p=>p.trim()),[o,n,a,f]=r.split(/[\s,]+/);return Th(parseFloat(o),Bs(n),Bs(a),i!==void 0?Bs(i):f!==void 0?Bs(f):1)}if(s=/^rgba?\((.*)\)$/.exec(e),s){let[r,i,o,n]=s[1].split(/[\s,/]+/).filter(Boolean);return[Bs(r),Bs(i),Bs(o),n===void 0?1:Bs(n)]}if(s=/^color-mix\(in srgb\s*,(.*)\)$/.exec(e),s){let[r,i]=xf(s[1],",").map(c=>{let l=/^(.*?)\s+([\d.]+)%$/.exec(c);return l?{c:Ba(l[1]),p:Number(l[2])/100}:{c:Ba(c),p:void 0}});if(!r?.c||!i?.c)return;let o=r.p??(i.p===void 0?.5:1-i.p),n=i.p??1-o,a=o+n,f=(r.c[3]*o+i.c[3]*n)/a,p=c=>f===0?0:(r.c[c]*r.c[3]*o+i.c[c]*i.c[3]*n)/a/f;return[p(0),p(1),p(2),f*Math.min(1,a)]}}var gf=t=>"#"+[t[0],t[1],t[2]].map(e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0")).join(""),Eh=t=>String(Math.round(t*1e4)/1e4);function jc(t,e,s=0){if(s>20)throw new Error(`resolve: a custom property in a loop: ${t}`);let r=t.indexOf("var(");if(r<0)return t;let i=0,o=r+3;do t[o]==="("&&i++,t[o]===")"&&i--,o++;while(i>0&&o<t.length);let[n,...a]=xf(t.slice(r+4,o-1),","),f=e.get(n)??(a.length?a.join(","):void 0);if(f===void 0)throw new Error(`resolve: no value for ${n}`);return jc(t.slice(0,r)+f+t.slice(o),e,s+1)}var Nh=t=>new Map(t.split(";").filter(Boolean).map(e=>{let s=e.indexOf(":");return[e.slice(0,s).trim(),e.slice(s+1).trim()]})),Lc={sans:"system-ui, -apple-system, Segoe UI, Roboto, sans-serif",mono:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"};function Zr(t,e){let s=Ri(e.theme),r=e.fonts??Lc,i=Mh(`.mono{font-family:${r.mono.replace(/"/g,"")}}
149
+ `;function Zi(t,e={}){return(e.still??Cc).includes(t)?void 0:e.dash??e.kinds?.[t]?.ants??zc[e.kinds?.[t]?.dash??"solid"]}function Ss(t){let e=t?.ants;return e?e===!0?{}:Array.isArray(e)?{ids:e}:e:void 0}function Fa(t,e={}){let s=new Map(t.routes.map(n=>[n.id,n.kind])),r=e.ids&&new Set(e.ids),i=e.speed??Gi,o=n=>String(Number(n.toFixed(3)));return t.rendered.svg.replace(/(<g data-route="([^"]*)" data-part="line">(?:<g[^>]*>)*)<path ([^>]*?)\s*\/>/g,(n,a,f,p)=>{let c=f.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&"),l=r&&!r.has(c)?void 0:Zi(s.get(c)??"",e);if(!l||!/class="flow\b/.test(p))return n;let d=l[0]+l[1],m=o(d/Math.max(1e-6,Math.abs(i))),h=o(i<0?d:-d);return e.by==="css"?`${a}<path ${p.replace(/class="flow\b/,'class="flow iso-ants')} style="--ant-on:${o(l[0])};--ant-off:${o(l[1])};--ant-to:${h};--ant-turn:${m}s"/>`:e.by==="none"?`${a}<path ${p.replace(/ ?stroke-dasharray="[^"]*"/,"")} style="stroke-dasharray:${o(l[0])} ${o(l[1])}"/>`:`${a}<path ${p.replace(/ ?stroke-dasharray="[^"]*"/,"")} style="stroke-dasharray:${o(l[0])} ${o(l[1])}"><animate attributeName="stroke-dashoffset" from="0" to="${h}" dur="${m}s" repeatCount="indefinite"/></path>`})}var ir=t=>typeof t=="string"?[t]:[...t],Da=t=>JSON.parse(JSON.stringify(t)),Nn=(t={})=>({...t.from===void 0?{}:{from:t.from},...t.over===void 0?{}:{duration:t.over},...t.easing===void 0?{}:{easing:t.easing}}),Dr=class t{nodes=[];add(e){return this.nodes.push(Da(e)),this}assemble(e={},s={}){return this.add({assemble:e,...Nn(s)})}disassemble(e={},s={}){return this.add({disassemble:e,...Nn(s)})}travel(e,s={}){let{each:r,hold:i,loop:o}=s;return this.add({travel:e,...Nn(s),each:r,hold:i,loop:o})}pulse(e,s={}){return this.add({pulse:ir(e),...Nn(s),loop:s.loop})}ants(e=!0,s={}){return this.add({ants:e===!0?!0:ir(e),...Nn(s),speed:s.speed,dash:s.dash})}draw(e,s={}){return this.add({draw:ir(e),...Nn(s),by:s.by,stagger:s.stagger})}type(e,s={}){return this.add({type:ir(e),...Nn(s)})}move(e,s){return this.add({move:e,...s})}lift(e,s,r={}){return this.add({lift:ir(e),by:s,...Nn(r),stagger:r.stagger,to:r.to,opacity:r.opacity})}focus(e,s={}){let{scope:r,level:i,always:o}=s;return this.add({focus:{lit:ir(e),scope:r,level:i,always:o},...Nn(s),fade:s.fade})}highlight(e,s={}){return this.add({highlight:ir(e),...Nn(s),fade:s.fade})}get camera(){return{focus:(e,s={})=>this.add({camera:{focus:e,zoom:s.zoom,margin:s.margin},...Nn(s)}),fit:(e={})=>this.add({camera:"fit",...Nn(e)})}}sequence(e,s={},r){return this.add({sequence:uf(e,s,r)})}series(e){let s=new Br;return e(s),this.add({series:s.items})}layers(e){let s=new t;return e(s),this.add({layers:s.nodes})}};function uf(t,e,s){let{read:r,duration:i,...o}=e,n=new Dr;return s?.(n),Da({...t===void 0?{}:{name:t},...o,...r!==void 0?{duration:{read:r}}:i!==void 0?{duration:i}:{},...n.nodes.length?{children:n.nodes}:{}})}var Br=class{items=[];sequence(e,s={},r){return this.items.push({sequence:uf(e,s,r)}),this}transition(e){return this.items.push({transition:Da(e)}),this}},Ui=class extends Br{over=[];marks={};head;constructor(e={}){super(),this.head=e}beat(e,s,r={},i){return this.sequence(e,{...r,say:s},i)}assemble(e={},s={}){return this.sequence(void 0,{},r=>r.assemble(e,s))}disassemble(e={},s={}){return this.sequence(void 0,{},r=>r.disassemble(e,s))}mark(e,s){return this.marks[e]=s,this}layers(e){let s=new Dr;return e(s),this.over.push(...s.nodes),this}toJSON(){return Da({isomotion:1,...this.head,...this.items.length?{series:this.items}:{},...this.over.length?{layers:this.over}:{},...Object.keys(this.marks).length?{markers:this.marks}:{}})}},hf=(t={})=>new Ui(t);function Ba(t,e){if(!e)return t;let[s,r,i,o]=e,n=t[2]/t[3],a=i-s,f=o-r;a/f<n?a=f*n:f=a/n,a=Math.min(a,t[2]),f=Math.min(f,t[3]);let p=(s+i)/2,c=(r+o)/2,l=Math.max(t[0],Math.min(t[0]+t[2]-a,p-a/2)),d=Math.max(t[1],Math.min(t[1]+t[3]-f,c-f/2));return[l,d,a,f]}var Yi=["linear","ease","ease-in","ease-out","ease-in-out","settle","bounce"],or=["extend","clamp","wrap","identity"];function kn(t,e){if(typeof t=="number")return Number.isFinite(t)?t:void 0;if(typeof t!="string")return;let s=/^(-?\d+(?:\.\d+)?)(ms|s|f)?$/.exec(t.trim());if(!s)return;let r=Number(s[1]);return s[2]==="s"?r*1e3:s[2]==="f"?e?r/e*1e3:void 0:r}function Wi(t,e){let s=e===!0?{}:e,r=s.base??2600,i=s.perChar??40,o=s.min??5600,n=s.max??12500;return Math.max(o,Math.min(n,r+(t?.text??"").length*i))}var Ds=(t,e,s,r)=>i=>{if(i<=0)return 0;if(i>=1)return 1;let o=(f,p,c)=>3*f*c*(1-c)**2+3*p*c*c*(1-c)+c**3,n=0,a=1;for(let f=0;f<50;f++){let p=(n+a)/2;o(t,s,p)<i?n=p:a=p}return o(e,r,(n+a)/2)},gh=t=>{if(t<=0)return 0;if(t>=1)return 1;let e=7.5625,s=2.75;return t<1/s?e*t*t:t<2/s?e*(t-1.5/s)**2+.75:t<2.5/s?e*(t-2.25/s)**2+.9375:e*(t-2.625/s)**2+.984375},bh={linear:t=>t,ease:Ds(.25,.1,.25,1),"ease-in":Ds(.42,0,1,1),"ease-out":Ds(0,0,.58,1),"ease-in-out":Ds(.42,0,.58,1),settle:Ds(.16,.84,.3,1),bounce:gh};function qr(t,e={}){let s=e.mass??1,r=e.stiffness??100,i=e.damping??10,o=Math.max(0,t)/1e3,n=Math.sqrt(r/s),a=i/(2*Math.sqrt(r*s)),f;if(a<1){let p=n*Math.sqrt(1-a*a);f=1-Math.exp(-a*n*o)*(Math.cos(p*o)+a*n/p*Math.sin(p*o))}else f=1-Math.exp(-n*o)*(1+n*o);return e.overshootClamping?Math.min(1,f):f}function Xn(t,e,s="ease-in-out"){let r=t??s;return typeof r=="string"?bh[r]:"bezier"in r?Ds(...r.bezier):i=>i<=0?0:i>=1?1:qr(i*e,r.spring)}function Vr(t,e,s){let r=t.times.map(l=>kn(l,s)),i=t.values,o=r.length;if(o===1)return i[0];let n=(l,d)=>{if(l==="clamp")return d?i[0]:i[o-1];if(l==="identity")return e;if(l==="wrap"){let m=r[o-1]-r[0];return Vr({...t,extrapolateLeft:"clamp",extrapolateRight:"clamp"},r[0]+((e-r[0])%m+m)%m,s)}};if(e<r[0]){let l=n(t.extrapolateLeft??"extend",!0);if(l!==void 0)return l}if(e>r[o-1]){let l=n(t.extrapolateRight??"extend",!1);if(l!==void 0)return l}let a=0;for(;a<o-2&&e>=r[a+1];)a++;let f=r[a+1]-r[a],p=(e-r[a])/f,c=p<0||p>1?p:Xn(t.easing,f,"linear")(p);return i[a]+(i[a+1]-i[a])*c}var jc=["sequence","series","layers","assemble","disassemble","travel","pulse","ants","draw","type","move","lift","focus","highlight","camera"],yf={morph:"the 2D morph is a later version's",diff:"diffs are a later version's",switch:"a look is a beat's: its variants"},Jn=["from","duration","easing"],Hi={sequence:[],series:[],layers:[],assemble:Jn,disassemble:Jn,travel:[...Jn,"each","hold","loop"],pulse:[...Jn,"loop"],ants:[...Jn,"speed","dash"],draw:[...Jn,"by","stagger"],type:Jn,move:["from","x","y","scale","opacity"],lift:[...Jn,"by","stagger","to","opacity"],focus:[...Jn,"fade"],highlight:[...Jn,"fade"],camera:Jn},wh=["name","from","offset","duration","loop","playbackRate","trimBefore","say","show","hide","focus","highlight","levels","variants","enter","ants","children","layers","series"],At=t=>!!t&&typeof t=="object"&&!Array.isArray(t);function qa(t){let e=[],s=(u,b,x)=>{e.push({severity:"error",path:u,message:b,...x?{hint:x}:{}})},r=(u,b,x)=>{for(let w of Object.keys(u))if(!b.includes(w)){let $=Vt(w,b);s(`${x}/${w}`,`unknown key "${w}"`,$?`did you mean "${$}"?`:void 0)}};if(!At(t))return s("","a motion document is a map"),e;r(t,["isomotion","fps","seed","ambient","series","layers","markers"],""),t.isomotion!==1&&s("/isomotion","isomotion is 1");let i=typeof t.fps=="number"&&t.fps>0?t.fps:void 0;t.fps!==void 0&&i===void 0&&s("/fps","fps is a number over 0"),t.seed!==void 0&&!Number.isInteger(t.seed)&&s("/seed","seed is a whole number"),t.ambient!==void 0&&t.ambient!=="on"&&t.ambient!=="off"&&s("/ambient",'ambient is "on" or "off"');let o=(u,b,x={})=>{if(u===void 0)return;if(typeof u=="string"&&/f$/.test(u)&&i===void 0){s(b,`"${u}" is in frames: the document needs its fps`);return}let w=kn(u,i);w===void 0?s(b,`${JSON.stringify(u)} isn't a time (ms, "1.2s", "450ms", "30f")`):w<0&&!x.negative&&s(b,"a time can't be negative")},n=(u,b,x)=>{if(u!==void 0&&!b.includes(u)){let w=typeof u=="string"?Vt(u,b):void 0;s(x,`${JSON.stringify(u)} isn't one of ${b.join(", ")}`,w?`did you mean "${w}"?`:void 0)}},a=(u,b,x={})=>{u!==void 0&&(typeof u!="number"||!Number.isFinite(u)||x.min!==void 0&&u<x.min||x.max!==void 0&&u>x.max||x.over!==void 0&&u<=x.over)&&s(b,`${JSON.stringify(u)} isn't a number${x.over!==void 0?` over ${x.over}`:x.min!==void 0?` from ${x.min}${x.max!==void 0?` to ${x.max}`:""}`:""}`)},f=(u,b)=>{if(u!==void 0){if(!Array.isArray(u)){s(b,"a list of ids");return}u.forEach((x,w)=>{typeof x!="string"&&s(`${b}/${w}`,"an id")})}},p=(u,b,x=[])=>{if(!At(u)){s(b,"a spring is a map");return}r(u,["mass","damping","stiffness","overshootClamping",...x],b);for(let w of["mass","damping","stiffness"])a(u[w],`${b}/${w}`,{over:0});u.overshootClamping!==void 0&&typeof u.overshootClamping!="boolean"&&s(`${b}/overshootClamping`,"true or false")},c=(u,b)=>{if(u!==void 0){if(typeof u=="string"){n(u,Yi,b);return}if(At(u)&&"bezier"in u){r(u,["bezier"],b),(!Array.isArray(u.bezier)||u.bezier.length!==4||u.bezier.some(x=>typeof x!="number"))&&s(`${b}/bezier`,"four numbers");return}if(At(u)&&"spring"in u){r(u,["spring"],b),p(u.spring,`${b}/spring`);return}s(b,"an easing is a name, { bezier: [a, b, c, d] } or { spring: { \u2026 } }")}},l=(u,b)=>{if(u===void 0)return;if(!At(u)){s(b,"a curve is { times, values }");return}r(u,["times","values","easing","extrapolateLeft","extrapolateRight"],b);let x=u.times,w=u.values;if(!Array.isArray(x)||!x.length)s(`${b}/times`,"a list of times");else{x.forEach((S,O)=>o(S,`${b}/times/${O}`,{negative:!0}));let $=x.map(S=>kn(S,i));for(let S=1;S<$.length;S++)$[S]!==void 0&&$[S-1]!==void 0&&$[S]<=$[S-1]&&s(`${b}/times/${S}`,"times go up")}!Array.isArray(w)||w.some($=>typeof $!="number")?s(`${b}/values`,"a list of numbers"):Array.isArray(x)&&w.length!==x.length&&s(`${b}/values`,`${w.length} values for ${x.length} times`),c(u.easing,`${b}/easing`),n(u.extrapolateLeft,or,`${b}/extrapolateLeft`),n(u.extrapolateRight,or,`${b}/extrapolateRight`)},d=(u,b)=>{if(u!==void 0){if(!At(u)){s(b,"focus is { lit: [ids] }");return}r(u,["lit","scope","level","always"],b),u.lit===void 0&&s(`${b}/lit`,"what is lit"),f(u.lit,`${b}/lit`),f(u.always,`${b}/always`),n(u.scope,["all","links"],`${b}/scope`),a(u.level,`${b}/level`,{min:0,max:1})}},m=(u,b)=>{u!==void 0&&typeof u!="string"&&s(b,"text")},h=new Map;function y(u,b,x){if(!At(u)){s(b,"a sequence is a map");return}if(r(u,wh,b),u.name!==void 0&&(typeof u.name!="string"||!/^[A-Za-z][\w-]*$/.test(u.name)?s(`${b}/name`,"a name is letters, digits, - and _, from a letter"):h.has(u.name)?s(`${b}/name`,`"${u.name}" is already a name (${h.get(u.name)})`):h.set(u.name,b)),x&&u.from!==void 0&&s(`${b}/from`,"in a series a sequence follows the one before","offset moves it"),!x&&u.offset!==void 0&&s(`${b}/offset`,"offset is for a series","use from"),o(u.from,`${b}/from`),o(u.offset,`${b}/offset`,{negative:!0}),o(u.trimBefore,`${b}/trimBefore`),At(u.duration)){r(u.duration,["read"],`${b}/duration`);let w=u.duration.read;if(w!==!0&&!At(w))s(`${b}/duration/read`,"true, or { base, perChar, min, max }");else if(At(w)){r(w,["base","perChar","min","max"],`${b}/duration/read`);for(let $ of["base","perChar","min","max"])a(w[$],`${b}/duration/read/${$}`,{min:0})}}else o(u.duration,`${b}/duration`);if(u.loop!==void 0&&typeof u.loop!="boolean"&&!(Number.isInteger(u.loop)&&u.loop>=1)&&s(`${b}/loop`,"true, false, or how many times"),a(u.playbackRate,`${b}/playbackRate`,{over:0}),u.say!==void 0)if(!At(u.say))s(`${b}/say`,"say is a map");else{let w=u.say;r(w,["chapter","title","text","code","facts","color"],`${b}/say`);for(let $ of["chapter","title","text","code","color"])m(w[$],`${b}/say/${$}`);w.facts!==void 0&&(!Array.isArray(w.facts)||w.facts.some($=>!Array.isArray($)||$.length!==2||$.some(S=>typeof S!="string")))&&s(`${b}/say/facts`,"a list of [name, value]")}for(let w of["show","hide","highlight"])f(u[w],`${b}/${w}`);if(d(u.focus,`${b}/focus`),u.levels!==void 0)if(!At(u.levels))s(`${b}/levels`,"levels is a map: an id, and how much of it");else for(let[w,$]of Object.entries(u.levels))a($,`${b}/levels/${w}`,{min:0,max:1});if(u.variants!==void 0)if(!At(u.variants))s(`${b}/variants`,"variants is a map: an id, and the name of its look");else for(let[w,$]of Object.entries(u.variants))typeof $!="string"&&s(`${b}/variants/${w}`,`a look's name, or "" for its own`);u.enter!==void 0&&(At(u.enter)?(r(u.enter,["fade","easing"],`${b}/enter`),u.enter.fade===void 0&&s(`${b}/enter/fade`,"how long the fade is"),o(u.enter.fade,`${b}/enter/fade`),c(u.enter.easing,`${b}/enter/easing`)):s(`${b}/enter`,"enter is { fade }")),u.ants!==void 0&&typeof u.ants!="boolean"&&f(u.ants,`${b}/ants`);for(let w of["children","layers"])u[w]!==void 0&&k(u[w],`${b}/${w}`);u.series!==void 0&&g(u.series,`${b}/series`)}function g(u,b){if(!Array.isArray(u)){s(b,"a series is a list");return}u.forEach((x,w)=>{let $=`${b}/${w}`;if(!At(x)||Object.keys(x).length!==1||!("sequence"in x||"transition"in x)){s($,"a series holds sequences and transitions");return}if("sequence"in x){y(x.sequence,`${$}/sequence`,!0);return}let S=x.transition,O=`${$}/transition`,z=A=>At(u[A])&&"sequence"in u[A];if((!z(w-1)||!z(w+1))&&s(O,"a transition is between two sequences"),!At(S)){s(O,"a transition is { presentation, timing }");return}r(S,["presentation","timing"],O),S.presentation===void 0?s(`${O}/presentation`,"a presentation"):n(S.presentation,["fade","none"],`${O}/presentation`),At(S.timing)?"linear"in S.timing?(r(S.timing,["linear"],`${O}/timing`),o(S.timing.linear,`${O}/timing/linear`)):"spring"in S.timing?(r(S.timing,["spring"],`${O}/timing`),p(S.timing.spring,`${O}/timing/spring`,["duration"]),At(S.timing.spring)&&o(S.timing.spring.duration,`${O}/timing/spring/duration`)):s(`${O}/timing`,"a timing is { linear } or { spring }"):s(`${O}/timing`,"a timing is { linear } or { spring }")})}function k(u,b){if(!Array.isArray(u)){s(b,"a list");return}u.forEach((x,w)=>{let $=`${b}/${w}`;if(!At(x)){s($,"a map");return}let S=jc.filter(R=>R in x);if(S.length!==1){let R=Object.keys(x).find(v=>v in yf),P=Object.keys(x)[0],E=P?Vt(P,jc):void 0;s($,R?`${R}: ${yf[R]}`:S.length?`one of ${S.join(", ")}, not several`:`one of ${jc.join(", ")}`,!R&&!S.length&&E?`did you mean "${E}"?`:void 0);return}let O=S[0],z=x[O],A=`${$}/${O}`;r(x,[O,...Hi[O]],$),Hi[O].includes("from")&&o(x.from,`${$}/from`),Hi[O].includes("duration")&&(o(x.duration,`${$}/duration`),c(x.easing,`${$}/easing`));for(let R of["each","hold","stagger","fade"])Hi[O].includes(R)&&o(x[R],`${$}/${R}`);if(Hi[O].includes("loop")&&x.loop!==void 0&&typeof x.loop!="boolean"&&s(`${$}/loop`,"true or false"),O==="sequence")y(z,A,!1);else if(O==="series")g(z,A);else if(O==="layers")k(z,A);else if(O==="assemble"||O==="disassemble")At(z)?(n(z.style,O==="assemble"?jr:Lr,`${A}/style`),n(z.order,sr,`${A}/order`),z.duration!==void 0&&s(`${A}/duration`,"its length is beside it","duration is the node's")):s(A,`${O} is a map (its options)`);else if(O==="travel")!Array.isArray(z)||!z.length?s(A,"a list of connectors"):z.forEach((R,P)=>{Array.isArray(R)?f(R,`${A}/${P}`):typeof R!="string"&&s(`${A}/${P}`,"a connector, or a list of them at once")});else if(O==="ants")z!==!0&&f(z,A),a(x.speed,`${$}/speed`),x.dash!==void 0&&(!Array.isArray(x.dash)||x.dash.length!==2||x.dash.some(R=>typeof R!="number"||R<=0))&&s(`${$}/dash`,"two numbers over 0: on, off");else if(O==="move"){typeof z!="string"&&s(A,"an id");for(let R of["x","y","scale","opacity"])l(x[R],`${$}/${R}`)}else if(O==="focus")d(z,A);else if(O==="camera"){if(z!=="fit")if(!At(z))s(A,'"fit", or { focus, zoom, margin }');else{r(z,["focus","zoom","margin"],A),a(z.zoom,`${A}/zoom`,{over:0}),a(z.margin,`${A}/margin`);let R=z.focus;typeof R=="string"||Array.isArray(R)&&(R.every(P=>typeof P=="string")||R.length===4&&R.every(P=>typeof P=="number"))||s(`${A}/focus`,"an id, some ids, or a box [x, y, w, h]")}}else f(z,A);O==="draw"&&n(x.by,["stroke","grow"],`${$}/by`),O==="lift"&&(x.by===void 0&&s(`${$}/by`,"how far apart"),a(x.by,`${$}/by`),n(x.to,["up","down"],`${$}/to`),l(x.opacity,`${$}/opacity`))})}if(t.series!==void 0&&g(t.series,"/series"),t.layers!==void 0&&k(t.layers,"/layers"),t.markers!==void 0)if(!At(t.markers))s("/markers","markers is a map");else for(let[u,b]of Object.entries(t.markers))if(typeof b=="string"&&/^[A-Za-z][\w-]*([+-].+)?$/.test(b)){let x=/^([A-Za-z][\w-]*?)(?:([+-])(\d.*))?$/.exec(b);if(x&&(h.has(x[1])?x[1]:void 0))x[3]!==void 0&&o(x[3],`/markers/${u}`);else if(!h.has(b)){let S=Vt(x?.[1]??b,h.keys());s(`/markers/${u}`,`no sequence is named "${x?.[1]??b}"`,S?`did you mean "${S}"?`:void 0)}}else o(b,`/markers/${u}`);return e}var $n=t=>Math.round(t*100)/100||0,Wt=t=>Math.round(t*1e4)/1e4||0,Rn=t=>Math.max(0,Math.min(1,t)),Kr=(t,e,s)=>t+(e-t)*s,xh=250,Lc=class{items=new Map;labels=new Map;routes=new Map;tokens=[];pulses=[];outlines=[];variants={};marks=1;at(e,s){let r=e.get(s);return r||e.set(s,r={}),r}item(e,s){let r=this.at(this.items,e);s.opacity!==void 0&&(r.opacity=(r.opacity??1)*s.opacity),s.dx&&(r.dx=(r.dx??0)+s.dx),s.dy&&(r.dy=(r.dy??0)+s.dy),s.scale!==void 0&&(r.scale=(r.scale??1)*s.scale,r.about=s.about??r.about),s.clip&&(r.clip=s.clip)}label(e,s){let r=this.at(this.labels,e);s.opacity!==void 0&&(r.opacity=(r.opacity??1)*s.opacity),s.dx&&(r.dx=(r.dx??0)+s.dx),s.dy&&(r.dy=(r.dy??0)+s.dy),s.typed!==void 0&&(r.typed=Math.min(r.typed??1,s.typed))}route(e,s){let r=this.at(this.routes,e);s.opacity!==void 0&&(r.opacity=(r.opacity??1)*s.opacity),s.drawn!==void 0&&s.drawn<(r.drawn??1)&&(r.drawn=s.drawn,r.by=s.by),s.ants&&(r.ants=s.ants)}add(e){for(let[s,r]of Object.entries(e.items??{}))this.item(s,r);for(let[s,r]of Object.entries(e.labels??{}))this.label(s,r);for(let[s,r]of Object.entries(e.routes??{}))this.route(s,r);e.marks&&(this.marks*=e.marks.opacity),this.tokens.push(...e.tokens??[]),this.pulses.push(...e.pulses??[])}state(e){let s={},r=(c,l)=>{let d={};for(let[m,h]of c){let y=l(h);Object.keys(y).length&&(d[m]=y)}return d},i=c=>Object.keys(c).length>0,o=c=>c===void 0||Wt(c)>=1?{}:{opacity:Wt(Math.max(0,c))},n=c=>({...$n(c.dx??0)?{dx:$n(c.dx)}:{},...$n(c.dy??0)?{dy:$n(c.dy)}:{}}),a=r(this.items,c=>({...o(c.opacity),...n(c),...c.scale!==void 0&&Wt(c.scale)!==1?{scale:Wt(c.scale),...c.about?{about:c.about}:{}}:{},...c.clip?{clip:c.clip}:{}})),f=r(this.labels,c=>({...o(c.opacity),...c.typed!==void 0&&c.typed<1?{typed:Wt(c.typed)}:{},...n(c)})),p=r(this.routes,c=>{let l=c.opacity!==void 0&&Wt(c.opacity)<=0,d=c.drawn!==void 0&&c.drawn<1;return{...o(c.opacity),...d?{drawn:Wt(c.drawn),...c.by?{by:c.by}:{}}:{},...c.ants&&!l&&!d?{ants:c.ants}:{}}});return i(a)&&(s.items=a),i(f)&&(s.labels=f),i(p)&&(s.routes=p),Wt(this.marks)<1&&(s.marks={opacity:Wt(this.marks)}),this.tokens.length&&(s.tokens=this.tokens),this.pulses.length&&(s.pulses=this.pulses),this.outlines.length&&(s.outlines=this.outlines),i(this.variants)&&(s.variants=this.variants),e&&(s.camera=e),s}};function Ji(t){let e=Ss(t.raw),s=t.rendered.looks,r=rr(t),i=Object.keys(r.notes).filter(o=>r.notes[o]===void 0);return{model:r,kinds:Object.fromEntries(t.routes.map(o=>[o.id,o.kind])),outlines:Object.fromEntries(t.layout.items.map(o=>[o.id,Yt(o.box).map(n=>[$n(n[0]),$n(n[1])])])),...s&&Object.keys(s).length?{looks:s}:{},...e?{ants:e}:{},...i.length?{free:i}:{}}}function vs(t,e,s={}){let r="model"in t?t:Ji(t),i=r.free?{...r.model,notes:{...r.model.notes,...Object.fromEntries(r.free.map(M=>[M,void 0]))}}:r.model,o=qa(e),n=e.fps,a=r.ants,f=()=>({ok:!1,diags:o,duration:0,beats:[],markers:{},ambient:"on",loops:!1,at:()=>({}),cues:()=>{},beatAt:()=>{},startOf:()=>{}});if(o.length)return f();let p=(M,D,W)=>{o.push({severity:"error",path:M,message:D,...W?{hint:W}:{}})},c=(M,D)=>M===void 0?D:kn(M,n),l=new Map(i.pieces.map(M=>[M.id,M])),d=new Set(i.routes.map(M=>M.id)),m=new Set(Object.keys(i.notes)),h=new Map(Object.entries(r.kinds)),y=[...l.keys(),...d,...m],g=new Set(y),k=new Map;for(let[M,D]of Object.entries(i.notes))D!==void 0&&k.set(D,[...k.get(D)??[],M]);let u={any:g,thing:new Set(l.keys()),route:d},b={any:"thing, connector or note",thing:"thing",route:"connector"},x=(M,D,W="any")=>{if(!u[W].has(M)){let he=Vt(M,u[W]);p(D,`no ${b[W]} "${M}" in this drawing`,he?`did you mean "${he}"?`:void 0)}},w=(M,D,W="any")=>M?.forEach((he,fe)=>x(he,`${D}/${fe}`,W)),$=new Map(Object.entries(r.outlines)),S=new Map;function O(M,D){let W="from"in M?c(M.from,0):0,he="duration"in M?c(M.duration,NaN):NaN,fe=Number.isFinite(he);if("sequence"in M){let J=M.sequence;return c(J.from,0)+P(J,`${D}/sequence`)}if("series"in M)return E(M.series,`${D}/series`).end;if("layers"in M)return Math.max(0,...M.layers.map((J,ne)=>O(J,`${D}/layers/${ne}`)));if("assemble"in M||"disassemble"in M){let J="assemble"in M?"assemble":"disassemble",ne="assemble"in M?M.assemble:M.disassemble,ye=S.get(M);return ye||S.set(M,ye=_r(i,J,{seed:e.seed??1,...ne,...fe?{duration:he}:{}})),W+ye.duration}return"draw"in M?W+(fe?he:400)+Math.max(0,M.draw.length-1)*c(M.stagger,0):"lift"in M?W+Math.max(fe?he:750,...M.opacity?.times.map(J=>kn(J,n))??[])+Math.max(0,M.lift.length-1)*c(M.stagger,0):fe?W+he:"travel"in M?M.loop?W:W+M.travel.length*c(M.each,1150):"pulse"in M?M.loop?W:W+1500:"type"in M?W+400:"camera"in M?W+900:"move"in M?W+Math.max(0,...[M.x,M.y,M.scale,M.opacity].flatMap(J=>J?.times.map(ne=>kn(ne,n))??[])):W}let z=(M,D)=>Math.max(0,...(M.children??[]).map((W,he)=>O(W,`${D}/children/${he}`)),...(M.layers??[]).map((W,he)=>O(W,`${D}/layers/${he}`)),M.series?E(M.series,`${D}/series`).end:0),A=new Map;function R(M,D){let W=A.get(M);if(W!==void 0)return W;let he;return M.duration!==void 0&&typeof M.duration=="object"?he=Wi(M.say,M.duration.read):he=M.duration!==void 0?c(M.duration,0):z(M,D),M.duration===void 0&&he<=0&&M.say&&(he=Wi(M.say,!0)),he<=0&&p(`${D}/duration`,"how long is it? (nothing in it says)"),A.set(M,he),he}let P=(M,D)=>{let W=R(M,D),he=M.playbackRate??1;return M.loop===!0?W/he:(typeof M.loop=="number"?W*M.loop:W)/he};function E(M,D){let W=[],he=0,fe;return M.forEach((J,ne)=>{if("transition"in J){let B=J.transition,pe=B.timing,me=B.presentation==="none"?0:kh(pe,n);fe={t:B,length:me};return}let ye=J.sequence,ve=`${D}/${ne}/sequence`,T=P(ye,ve),_=Math.max(0,he+c(ye.offset,0)-(fe?.length??0));fe&&W.length&&fe.length>Math.min(W[W.length-1].end-W[W.length-1].start,T)&&p(`${D}/${ne-1}/transition/timing`,"a transition is no longer than either side of it"),W.push({s:ye,path:ve,start:_,end:_+T,...fe?{into:fe}:{}}),he=_+T,fe=void 0}),{list:W,end:Math.max(0,...W.map(J=>J.end))}}let v=E(e.series??[],"/series"),N=Math.max(0,...(e.layers??[]).map((M,D)=>O(M,`/layers/${D}`))),C=Math.max(v.end,N);C<=0&&!o.length&&p("","a motion document has a series, or layers, that last");let V=new Map,Y=[],Z=i.viewBox,j=(M,D,W)=>{let he=W!==void 0?1/W:Math.max((M.w+D*2)/Z[2],(M.h+D*2)/Z[3]);return[M.x+M.w/2-Z[2]*he/2,M.y+M.h/2-Z[3]*he/2,Z[2]*he,Z[3]*he]};function K(M,D,W){let he=fe=>W?{at:W.at+fe/W.rate,rate:W.rate}:void 0;if("sequence"in M){ee(M.sequence,`${D}/sequence`,he(c(M.sequence.from,0)),!1);return}if("series"in M){for(let fe of E(M.series,`${D}/series`).list)ee(fe.s,fe.path,he(fe.start),!1);return}if("layers"in M){M.layers.forEach((fe,J)=>K(fe,`${D}/layers/${J}`,W));return}if("assemble"in M||"disassemble"in M){O(M,D);return}if("travel"in M)M.travel.forEach((fe,J)=>(Array.isArray(fe)?fe:[fe]).forEach((ne,ye)=>x(ne.split(":")[0],`${D}/travel/${J}${Array.isArray(fe)?`/${ye}`:""}`,"route")));else if("pulse"in M)w(M.pulse,`${D}/pulse`,"thing");else if("ants"in M)M.ants!==!0&&w(M.ants,`${D}/ants`,"route");else if("draw"in M)w(M.draw,`${D}/draw`,"route");else if("type"in M)w(M.type,`${D}/type`);else if("move"in M)x(M.move,`${D}/move`,"thing");else if("lift"in M)w(M.lift,`${D}/lift`,"thing");else if("focus"in M)U(M.focus,`${D}/focus`);else if("highlight"in M)w(M.highlight,`${D}/highlight`,"thing");else if("camera"in M){let fe=M.camera,J=c(M.duration,900);if(!W){p(`${D}/camera`,"a camera can't be in a loop");return}let ne=Z;if(fe!=="fit"){let ye=fe.focus;if(Array.isArray(ye)&&typeof ye[0]=="number")ne=j({x:ye[0],y:ye[1],w:ye[2],h:ye[3]},fe.margin??0,fe.zoom);else{let ve=typeof ye=="string"?[ye]:ye;ve.forEach((_,B)=>x(_,`${D}/camera/focus${typeof ye=="string"?"":`/${B}`}`,"thing"));let T=ve.map(_=>l.get(_)?.bbox).filter(_=>!!_);if(T.length){let _=Math.min(...T.map(pe=>pe.x)),B=Math.min(...T.map(pe=>pe.y));ne=j({x:_,y:B,w:Math.max(...T.map(pe=>pe.x+pe.w))-_,h:Math.max(...T.map(pe=>pe.y+pe.h))-B},fe.margin??40,fe.zoom)}}}Y.push({at:W.at+c(M.from,0)/W.rate,over:J/W.rate,ease:Xn(M.easing,J,"settle"),to:ne})}}let U=(M,D)=>{M&&(w(M.lit,`${D}/lit`),w(M.always,`${D}/always`))};function ee(M,D,W,he){if(M.name!==void 0&&W&&V.set(M.name,W.at),!he)for(let ne of["show","hide","say","enter","focus","highlight","levels","variants","ants"])M[ne]!==void 0&&p(`${D}/${ne}`,`${ne} is for a sequence of the document's own series`,ne==="focus"||ne==="highlight"||ne==="ants"?`here, a child: { ${ne}: \u2026 }`:void 0);w(M.show,`${D}/show`),w(M.hide,`${D}/hide`),w(M.highlight,`${D}/highlight`,"thing"),U(M.focus,`${D}/focus`);for(let ne of Object.keys(M.levels??{}))ne!=="*"&&x(ne,`${D}/levels/${ne}`);for(let[ne,ye]of Object.entries(M.variants??{})){x(ne,`${D}/variants/${ne}`,"thing");let ve=r.looks?.[ne]??[];if(l.has(ne)&&ye!==""&&!ve.includes(ye)){let T=Vt(ye,ve);p(`${D}/variants/${ne}`,ve.length?`${ne} has no look "${ye}" (it has ${ve.join(", ")})`:`${ne} declares no looks (variants: in the diagram)`,T?`did you mean "${T}"?`:void 0)}}Array.isArray(M.ants)&&w(M.ants,`${D}/ants`,"route");let fe=M.playbackRate??1,J=W&&!M.loop?{at:W.at-c(M.trimBefore,0)/(W.rate*fe),rate:W.rate*fe}:void 0;if((M.children??[]).forEach((ne,ye)=>K(ne,`${D}/children/${ye}`,J)),(M.layers??[]).forEach((ne,ye)=>K(ne,`${D}/layers/${ye}`,J)),M.series)for(let ne of E(M.series,`${D}/series`).list)ee(ne.s,ne.path,J&&{at:J.at+ne.start/J.rate,rate:J.rate},!1)}for(let M of v.list)ee(M.s,M.path,{at:M.start,rate:1},!0);(e.layers??[]).forEach((M,D)=>K(M,`/layers/${D}`,{at:0,rate:1})),Y.sort((M,D)=>M.at-D.at);let L={};for(let[M,D]of Object.entries(e.markers??{})){let W=kn(D,n);if(W!==void 0){L[M]=W;continue}let he=String(D),fe=[...V.keys()].filter(ye=>he===ye||he.startsWith(ye+"+")||he.startsWith(ye+"-")).sort((ye,ve)=>ve.length-ye.length)[0];if(fe===void 0){p(`/markers/${M}`,`"${he}" isn't a moment of this document`);continue}let J=he.slice(fe.length),ne=J?kn(J.slice(1),n):0;if(ne===void 0){p(`/markers/${M}`,`"${J}" isn't a time`);continue}L[M]=V.get(fe)+(J[0]==="-"?-ne:ne)}if(o.length)return f();let q=v.list.map((M,D)=>({name:M.s.name??`beat-${D+1}`,index:D,start:M.start,end:M.end,...M.s.say?{say:M.s.say}:{}})),G=new Map;for(let M of v.list){for(let D of M.s.show??[])G.has(D)||G.set(D,!1);for(let D of M.s.hide??[])G.has(D)||G.set(D,!0)}let X=[new Map(G)];for(let M of v.list){let D=new Map(X[X.length-1]);for(let W of M.s.show??[])D.set(W,!0);for(let W of M.s.hide??[])D.set(W,!1);X.push(D)}let ce=[new Map];for(let M of v.list){let D=new Map(ce[ce.length-1]);for(let[W,he]of Object.entries(M.s.variants??{}))D.set(W,he);ce.push(D)}let le=(M,D)=>!M||M.lit.includes(D)||M.always?.includes(D)||M.scope==="links"&&l.has(D)?1:M.level??.12,H=(M,D)=>{let W=M<0?void 0:v.list[M].s.levels;return W?W[D]??W["*"]??1:1},oe=(M,D)=>(X[M+1].get(D)===!1?0:1)*(M<0?1:le(v.list[M].s.focus,D))*H(M,D),Ae=(M,D)=>{let W=i.notes[D];if(W===void 0)return oe(M,D);let he=M<0?void 0:v.list[M].s.levels?.[D];return oe(M,W)*(X[M+1].get(D)===!1?0:1)*(he??1)},_e=M=>{let D=-1;for(let W=0;W<v.list.length;W++)v.list[W].start<=M&&(D=W);return D},I=(M,D)=>{let W=v.list[M],he=D-W.start;if(W.into&&W.into.length>0)return $h(W.into.t.timing,he,W.into.length);let fe=W.s.enter;if(!fe)return 1;let J=c(fe.fade,0);return J<=0?1:Xn(fe.easing,J,"ease")(Rn(he/J))};function se(M,D,W,he,fe){if("sequence"in M){let ve=M.sequence,T=c(ve.from,0);te(ve,D-T,W-T,Q(ve,he-T),fe);return}if("series"in M){for(let ve of E(M.series,"").list)te(ve.s,D-ve.start,W-ve.start,ve.end-ve.start,fe);return}if("layers"in M){for(let ve of M.layers)se(ve,D,W,he,fe);return}let J=c("from"in M?M.from:void 0,0),ne=D-J;if("assemble"in M||"disassemble"in M){fe.sum.add(S.get(M).at(ne));return}if("draw"in M){let ve=Math.max(1,c(M.duration,400)),T=c(M.stagger,0),_=Xn(M.easing,ve,"ease-out");M.draw.forEach((B,pe)=>{let me=_(Rn((ne-pe*T)/ve));me<=0?(fe.sum.route(B,{opacity:0,drawn:0}),fe.sum.label(B,{opacity:0})):me<1&&(fe.sum.route(B,{drawn:me,...M.by?{by:M.by}:{}}),fe.sum.label(B,{opacity:me}))});return}if("type"in M){let ve=c(M.duration,400),T=Xn(M.easing,ve,"linear")(Rn(ne/Math.max(1,ve)));if(T<1)for(let _ of M.type)fe.sum.label(_,T<=0?{opacity:0}:{typed:T});return}if("move"in M){let ve=me=>me?Vr(me,ne,n):void 0,T=ve(M.x)??0,_=ve(M.y)??0,B=ve(M.scale),pe=ve(M.opacity);fe.sum.item(M.move,{dx:T,dy:_,...B===void 0?{}:{scale:B,about:l.get(M.move).foot},...pe===void 0?{}:{opacity:Rn(pe)}});for(let me of[M.move,...k.get(M.move)??[]])fe.sum.label(me,{dx:T,dy:_,...pe===void 0?{}:{opacity:Rn(pe)}});return}if("lift"in M){let ve=c(M.stagger,0),T=Math.max(1,c(M.duration,750)),_=Xn(M.easing,T,"ease-out"),B=M.to==="down",pe=M.lift.length;M.lift.forEach((me,Ce)=>{let ae=ne-(B?pe-1-Ce:Ce)*ve,Le=_(Rn(ae/T)),Te=(Ce+1)*M.by*(B?Le:-Le),Se=M.opacity?Rn(Vr(M.opacity,ae,n)):1;if(!(!Te&&Se>=1)){fe.sum.item(me,{dy:Te,opacity:Se});for(let Fe of[me,...k.get(me)??[]])fe.sum.label(Fe,{dy:Te,opacity:Se})}});return}if("camera"in M)return;let ye=M.duration===void 0?Math.max(0,he-J):c(M.duration,0);if(!(ne<0||ne>ye)){if("focus"in M||"highlight"in M){let ve=Math.max(1,c(M.fade,xh)),T=Rn(Math.min(ne/ve,M.duration===void 0?1:(ye-ne)/ve)),_=Xn(M.easing,ve,"linear")(T);if("focus"in M)$e(M.focus,_,fe.sum);else for(let B of M.highlight)fe.shown(B)&&Ke(B,_,fe.sum);return}if("ants"in M){Ze(M.ants===!0?[...d]:M.ants,fe,M.speed,M.dash);return}if("pulse"in M){let T=M.loop?xe(W-J,1500,fe)/1500:ne/Math.max(1,M.duration===void 0?1500:ye);if(T<0||T>=1)return;for(let _ of M.pulse)if(fe.shown(_)){let B=l.get(_),pe=B.bbox.w*.5*(.7+T*.6);fe.sum.pulses.push({x:$n(B.foot[0]),y:$n(B.foot[1]),rx:$n(pe),ry:$n(pe*.58),opacity:Wt(1-T)})}return}if("travel"in M){let ve=c(M.each,1150),T=c(M.hold,M.loop?700:0),_=M.travel.length*ve+T,B=M.loop?xe(W-J,_,fe):ne,pe=Math.floor(B/ve);if(pe>=M.travel.length)return;let me=(B-pe*ve)/ve,Ce=Xn(M.easing,ve,"ease-in-out")(me),ae=M.travel[pe];for(let Le of Array.isArray(ae)?ae:[ae]){let[Te,Se]=Le.split(":");fe.shown(Te)&&fe.sum.tokens.push({route:Te,at:Wt((Se??h.get(Te))==="blocked"?ge(me):Ce),...Se?{kind:Se}:{}})}}}}let ge=M=>M<.7?M/.7:1-(M-.7)/.3*.25,xe=(M,D,W)=>W.off?0:(M%D+D)%D,Ke=(M,D,W)=>{Wt(D)>0&&$.has(M)&&W.outlines.push({id:M,points:$.get(M),...Wt(D)<1?{opacity:Wt(D)}:{}})},$e=(M,D,W)=>{for(let he of y){let fe=m.has(he)&&!M.lit.includes(he)&&!M.always?.includes(he)?i.notes[he]:void 0,J=Kr(1,le(M,fe??he),D);J>=1||(l.has(he)?(W.item(he,{opacity:J}),W.label(he,{opacity:J})):d.has(he)?(W.route(he,{opacity:J}),W.label(he,{opacity:J})):W.label(he,{opacity:J}))}},Ze=(M,D,W=Gi,he)=>{for(let fe of M){let J=Zi(h.get(fe)??"",{dash:he,kinds:s.kinds,still:s.still});if(!J)continue;let ne=J[0]+J[1],ye=xe(W*D.A/1e3,ne,D);D.sum.route(fe,{ants:{dash:J,offset:$n(ye)}})}},Q=(M,D)=>M.loop===!0?Math.max(0,D):P(M,"");function te(M,D,W,he,fe){if(D<0||D>he||D===he&&he<C&&he>0&&M.loop)return;let J=M.playbackRate??1,ne=R(M,""),ye=c(M.trimBefore,0),ve=M.loop&&ne>0?D*J%ne:D*J,T=ve+ye,_=W*J+ye;for(let B of M.children??[])se(B,T,_,ne+ye,fe);for(let B of M.layers??[])se(B,T,_,ne+ye,fe);if(M.series)for(let B of E(M.series,"").list)te(B.s,T-B.start,_-B.start,B.end-B.start,fe)}function we(M,D={}){let W=Math.max(0,Math.min(C,Number.isFinite(M)?M:0)),he=D.ambient==="off"||e.ambient==="off"&&D.ambient===void 0,fe=typeof D.ambient=="number"?D.ambient:W,J=new Lc,ne=_e(W),ye=ne<0?1:I(ne,W),ve=(ae,Le)=>ne<0?Le(-1,ae):ye>=1?Le(ne,ae):Kr(Le(ne-1,ae),Le(ne,ae),ye),T=ae=>(ne<0?X[0]:X[ne+1]).get(ae)!==!1;if(G.size||v.list.some(ae=>ae.s.focus||ae.s.levels))for(let ae of y){let Le=ve(ae,m.has(ae)?Ae:oe);Le>=1||(l.has(ae)&&J.item(ae,{opacity:Le}),d.has(ae)&&J.route(ae,{opacity:Le}),J.label(ae,{opacity:Le}))}if(ne>=0)for(let ae of ce[ce.length-1].keys()){let Le=ce[ne].get(ae)??"",Te=ce[ne+1].get(ae)??"",Se={};Le&&ye<1&&(Se[Le]=Wt(1-ye)),Te&&(Se[Te]=Wt((Se[Te]??0)+ye));for(let Fe of Object.keys(Se))Se[Fe]<=0&&delete Se[Fe];Object.keys(Se).length&&(J.variants[ae]=Se)}if(ne>=0){let ae=new Set(v.list[ne].s.highlight??[]),Le=new Set(ne>0&&ye<1?v.list[ne-1].s.highlight??[]:[]);for(let Te of new Set([...Le,...ae]))Ke(Te,Kr(Le.has(Te)?1:0,ae.has(Te)?1:0,ye),J)}let _={sum:J,shown:T,off:he,A:fe},B=ne>=0?v.list[ne].s.ants:void 0,pe=B===void 0?a:void 0;B?Ze(B===!0?[...d]:B,_):pe&&Ze(pe.ids??[...d],_,pe.speed,pe.dash),v.list.forEach((ae,Le)=>{W>=ae.start&&(W<ae.end||Le===ne&&W<=ae.end)&&te(ae.s,W-ae.start,fe-ae.start,ae.end-ae.start,_)});for(let ae of e.layers??[])se(ae,W,fe,C,_);let me;for(let ae of Y){if(ae.at>W)break;let Le=ae.over<=0?1:ae.ease(Rn((W-ae.at)/ae.over)),Te=me??Z;if(Le>=1){me=ae.to;continue}let Se=Te[2],Fe=ae.to[2],Ye=Math.exp(Kr(Math.log(Se),Math.log(Fe),Le)),mt=Math.abs(Fe-Se)<1e-6?Le:(Ye-Se)/(Fe-Se),ys=Kr(Te[0]+Te[2]/2,ae.to[0]+ae.to[2]/2,mt),kt=Kr(Te[1]+Te[3]/2,ae.to[1]+ae.to[3]/2,mt),lt=Ye*Z[3]/Z[2];me=[ys-Ye/2,kt-lt/2,Ye,lt]}let Ce=me?.map($n);return J.state(Ce&&Ce.some((ae,Le)=>Math.abs(ae-Z[Le])>.005)?Ce:void 0)}let ze=M=>{if(!M||typeof M!="object")return!1;if(Array.isArray(M))return M.some(ze);let D=M;return D.ants!==void 0&&D.ants!==!1||D.loop===!0&&("travel"in D||"pulse"in D)?!0:Object.values(D).some(ze)},De=a!==void 0||ze(e.series)||ze(e.layers),qe=M=>{let D=_e(Math.max(0,Math.min(C,M)));return D<0?void 0:q[D]};return{ok:!0,diags:o,duration:C,beats:q,markers:L,ambient:e.ambient??"on",loops:De,at:we,beatAt:qe,startOf:M=>V.get(M)??q.find(D=>D.name===M)?.start,cues(M){let D=qe(M);if(!D)return;let W=Math.max(0,Math.min(C,M));return{beat:D.name,index:D.index,of:q.length,progress:Wt(Rn((W-D.start)/Math.max(1,D.end-D.start))),...D.say?{say:D.say,...D.say.chapter!==void 0?{chapter:D.say.chapter}:{},...D.say.color!==void 0?{color:D.say.color}:{}}:{}}}}}var kh=(t,e)=>"linear"in t?kn(t.linear,e)??0:kn(t.spring.duration,e)??Sh(t.spring);function $h(t,e,s){return s<=0||e>=s?1:"spring"in t?Rn(qr(e,{...t.spring,overshootClamping:!0})/qr(s,{...t.spring,overshootClamping:!0})):Rn(e/s)}function Sh(t){let e=t.mass??1,s=t.stiffness??100,r=t.damping??10,i=Math.sqrt(s/e),o=Math.min(1,r/(2*Math.sqrt(s*e)));return Math.ceil(Math.log(200)/(o*i)*1e3*(o>=1?1.6:1))}function Va(t){let{steps:e,vis:s}=t.steps,r=t.rendered.viewBox,i=!1,o=rr(t),n=new Set([...o.pieces.map(c=>c.id),...o.routes.map(c=>c.id),...Object.keys(o.notes)]),a=c=>n.has(c),f=Object.keys(o.notes).filter(c=>o.notes[c]===void 0),p=e.map((c,l)=>{let d=[],m=[];for(let[u,b]of Object.entries(s))(l===0?!b.includes(!0):b[l-1]&&!b[l])?m.push(u):l>0&&b[l]&&!b[l-1]&&d.push(u);let h=[],y=u=>`${u.route}:${u.kind}`;c.phases.length&&h.push({travel:c.phases.map(u=>u.length===1?y(u[0]):u.map(y)),each:1150,hold:700,loop:!0});let g=(t.raw.steps??[])[l]?.pulse?.filter(u=>t.layout.byId.has(u))??[];if(g.length&&h.push({pulse:g,loop:!0}),c.focus){let[u,b,x,w]=Ba(r,c.focus).map($n);h.push({camera:{focus:[u,b,x,w]},duration:900,easing:"ease-in-out"}),i=!0}else i&&(h.push({camera:"fit",duration:900,easing:"ease-in-out"}),i=!1);let k={name:`step-${c.n}`,duration:c.duration,say:{title:c.heading,...c.caption?{text:c.caption}:{},...c.command?{code:c.command}:{}}};return d.length&&(k.show=d),m.length&&(k.hide=m),k.focus=t.raw.dim==="all"?{lit:c.lit.filter(a),scope:"all",level:.14}:{lit:c.lit.filter(a),scope:"links",level:.12,...f.length?{always:f}:{}},h.length&&(k.children=h),{sequence:k}});return{isomotion:1,...p.length?{series:p}:{}}}var vh={anyOf:[{type:"number"},{type:"string",pattern:"^-?\\d+(\\.\\d+)?(ms|s|f)?$"}]},Mh={type:"array",items:{type:"string"}},Ph={anyOf:[{enum:Yi},{type:"object",required:["bezier"],additionalProperties:!1,properties:{bezier:{type:"array",items:{type:"number"},minItems:4,maxItems:4}}},{type:"object",required:["spring"],additionalProperties:!1,properties:{spring:{$ref:"#/$defs/spring"}}}]},gf={from:{$ref:"#/$defs/time"},duration:{$ref:"#/$defs/time"},easing:{$ref:"#/$defs/ease"}},mn=(t,e,s={},r=!0)=>({type:"object",required:[t],additionalProperties:!1,properties:{[t]:e,...r?gf:{},...s}}),bf={$schema:"https://json-schema.org/draft/2020-12/schema",title:"isomotion/1",type:"object",required:["isomotion"],additionalProperties:!1,properties:{isomotion:{const:1},fps:{type:"number",exclusiveMinimum:0,description:'Frames a second, for lengths written "30f".'},seed:{type:"integer"},ambient:{enum:["on","off"],description:"Off: the ants and the looping tokens and pulses stand still, each at its start."},series:{$ref:"#/$defs/series"},layers:{$ref:"#/$defs/nodes"},markers:{type:"object",additionalProperties:{anyOf:[{type:"number"},{type:"string"}]}}},$defs:{time:vh,ids:Mh,ease:Ph,spring:{type:"object",additionalProperties:!1,properties:{mass:{type:"number",exclusiveMinimum:0},damping:{type:"number",exclusiveMinimum:0},stiffness:{type:"number",exclusiveMinimum:0},overshootClamping:{type:"boolean"}}},curve:{type:"object",required:["times","values"],additionalProperties:!1,properties:{times:{type:"array",items:{$ref:"#/$defs/time"},minItems:1},values:{type:"array",items:{type:"number"},minItems:1},easing:{$ref:"#/$defs/ease"},extrapolateLeft:{enum:or},extrapolateRight:{enum:or}}},say:{type:"object",additionalProperties:!1,properties:{chapter:{type:"string"},title:{type:"string"},text:{type:"string"},code:{type:"string"},color:{type:"string"},facts:{type:"array",items:{type:"array",items:{type:"string"},minItems:2,maxItems:2}}}},focus:{type:"object",required:["lit"],additionalProperties:!1,properties:{lit:{$ref:"#/$defs/ids"},scope:{enum:["all","links"]},level:{type:"number",minimum:0,maximum:1},always:{$ref:"#/$defs/ids"}}},sequence:{type:"object",additionalProperties:!1,properties:{name:{type:"string",pattern:"^[A-Za-z][\\w-]*$"},from:{$ref:"#/$defs/time"},offset:{$ref:"#/$defs/time"},trimBefore:{$ref:"#/$defs/time"},duration:{anyOf:[{$ref:"#/$defs/time"},{type:"object",required:["read"],additionalProperties:!1,properties:{read:{anyOf:[{const:!0},{type:"object",additionalProperties:!1,properties:{base:{type:"number"},perChar:{type:"number"},min:{type:"number"},max:{type:"number"}}}]}}}]},loop:{anyOf:[{type:"boolean"},{type:"integer",minimum:1}]},playbackRate:{type:"number",exclusiveMinimum:0},say:{$ref:"#/$defs/say"},show:{$ref:"#/$defs/ids"},hide:{$ref:"#/$defs/ids"},focus:{$ref:"#/$defs/focus"},highlight:{$ref:"#/$defs/ids"},levels:{type:"object",additionalProperties:{type:"number",minimum:0,maximum:1}},variants:{type:"object",additionalProperties:{type:"string"}},enter:{type:"object",required:["fade"],additionalProperties:!1,properties:{fade:{$ref:"#/$defs/time"},easing:{$ref:"#/$defs/ease"}}},ants:{anyOf:[{type:"boolean"},{$ref:"#/$defs/ids"}]},children:{$ref:"#/$defs/nodes"},layers:{$ref:"#/$defs/nodes"},series:{$ref:"#/$defs/series"}}},series:{type:"array",items:{anyOf:[{$ref:"#/$defs/seq"},mn("transition",{type:"object",required:["presentation","timing"],additionalProperties:!1,properties:{presentation:{enum:["fade","none"]},timing:{anyOf:[{type:"object",required:["linear"],additionalProperties:!1,properties:{linear:{$ref:"#/$defs/time"}}},{type:"object",required:["spring"],additionalProperties:!1,properties:{spring:{type:"object",additionalProperties:!1,properties:{mass:{type:"number",exclusiveMinimum:0},damping:{type:"number",exclusiveMinimum:0},stiffness:{type:"number",exclusiveMinimum:0},overshootClamping:{type:"boolean"},duration:{$ref:"#/$defs/time"}}}}}]}}},{},!1)]}},seq:mn("sequence",{$ref:"#/$defs/sequence"},{},!1),plan:{type:"object"},nodes:{type:"array",items:{anyOf:[{$ref:"#/$defs/seq"},mn("series",{$ref:"#/$defs/series"},{},!1),mn("layers",{$ref:"#/$defs/nodes"},{},!1),mn("assemble",{type:"object",properties:{style:{enum:jr},order:{enum:sr}}}),mn("disassemble",{type:"object",properties:{style:{enum:Lr},order:{enum:sr}}}),mn("travel",{type:"array",items:{anyOf:[{type:"string"},{$ref:"#/$defs/ids"}]},minItems:1},{each:{$ref:"#/$defs/time"},hold:{$ref:"#/$defs/time"},loop:{type:"boolean"}}),mn("pulse",{$ref:"#/$defs/ids"},{loop:{type:"boolean"}}),mn("ants",{anyOf:[{const:!0},{$ref:"#/$defs/ids"}]},{speed:{type:"number"},dash:{type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:2}}),mn("draw",{$ref:"#/$defs/ids"},{by:{enum:["stroke","grow"]},stagger:{$ref:"#/$defs/time"}}),mn("type",{$ref:"#/$defs/ids"}),{type:"object",required:["move"],additionalProperties:!1,properties:{move:{type:"string"},from:{$ref:"#/$defs/time"},x:{$ref:"#/$defs/curve"},y:{$ref:"#/$defs/curve"},scale:{$ref:"#/$defs/curve"},opacity:{$ref:"#/$defs/curve"}}},{type:"object",required:["lift","by"],additionalProperties:!1,properties:{lift:{$ref:"#/$defs/ids"},by:{type:"number"},stagger:{$ref:"#/$defs/time"},to:{enum:["up","down"]},opacity:{$ref:"#/$defs/curve"},...gf}},mn("focus",{$ref:"#/$defs/focus"},{fade:{$ref:"#/$defs/time"}}),mn("highlight",{$ref:"#/$defs/ids"},{fade:{$ref:"#/$defs/time"}}),mn("camera",{anyOf:[{const:"fit"},{type:"object",required:["focus"],additionalProperties:!1,properties:{focus:{anyOf:[{type:"string"},{$ref:"#/$defs/ids"},{type:"array",items:{type:"number"},minItems:4,maxItems:4}]},zoom:{type:"number",exclusiveMinimum:0},margin:{type:"number"}}}]})]}}}};var kf=new Set(["fill","stroke","stroke-width","stroke-dasharray","stroke-linecap","stroke-linejoin","opacity","fill-opacity","stroke-opacity","font-size","font-weight","font-family","letter-spacing","text-anchor","dominant-baseline","paint-order","display","stop-color","stop-opacity"]),Oh=new Set("cursor pointer-events transition animation transform-box transform-origin user-select".split(" "));function Ah(t,e){let s={classes:[],not:[],attrs:[],child:e},r=t,i=n=>{let a=n.exec(r);return a&&(r=r.slice(a[0].length)),a},o=i(/^[a-zA-Z][\w-]*/);for(o?s.tag=o[0]:i(/^\*/);r;){let n;if(n=i(/^\.([\w-]+)/))s.classes.push(n[1]);else if(n=i(/^:not\(\.([\w-]+)\)/))s.not.push(n[1]);else if(n=i(/^\[([\w-]+)(?:="([^"]*)")?\]/))s.attrs.push([n[1],n[2]]);else throw new Error(`resolve: a selector it doesn't know: ${t}`)}return s}function Th(t){let e=t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/@keyframes[^{]*\{(?:[^{}]*\{[^}]*\})*[^{}]*\}/g,"").replace(/@media[^{]*\{(?:[^{}]*\{[^}]*\})*[^{}]*\}/g,"");if(/@/.test(e.replace(/"[^"]*"/g,"")))throw new Error("resolve: an at-rule it doesn't know");let s=[];for(let r of e.matchAll(/([^{}]+)\{([^{}]*)\}/g)){let i=r[2].split(";").map(o=>o.trim()).filter(Boolean).map(o=>{let n=o.indexOf(":"),a=o.slice(0,n).trim(),f=o.slice(n+1).trim();return[a,f.replace(/\s*!important$/,""),/!important$/.test(f)]});for(let o of i)if(!o[0].startsWith("--")&&!kf.has(o[0])&&!Oh.has(o[0]))throw new Error(`resolve: a property it doesn't know: ${o[0]}`);for(let o of r[1].split(",").map(n=>n.trim()).filter(Boolean)){if(o.includes(":root")||o.includes("::")||/^(html|body)\b/.test(o))continue;let a=o.replace(/\s*>\s*/g," >").split(/\s+/).map(p=>Ah(p.replace(/^>/,""),p.startsWith(">"))),f=a.reduce((p,c)=>p+10*(c.classes.length+c.not.length+c.attrs.length)+(c.tag?1:0),0);s.push({parts:a,spec:f,order:s.length,decls:i})}}return s}function Eh(t){let e={name:"#root",attrs:[],children:[]},s=e;for(let r of t.matchAll(/<\/[a-zA-Z][\w:-]*>|<([a-zA-Z][\w:-]*)((?:\s+[\w:-]+="[^"]*")*)\s*(\/?)>|([^<]+)/g)){if(r[4]!==void 0){s.children.push(r[4]);continue}if(r[1]===void 0){s=s.parent;continue}let i={name:r[1],attrs:[...r[2].matchAll(/([\w:-]+)="([^"]*)"/g)].map(o=>[o[1],o[2]]),children:[],parent:s};s.children.push(i),r[3]||(s=i)}return e.children[0]}var $f=t=>typeof t=="string"?t:`<${t.name}${t.attrs.map(([e,s])=>` ${e}="${s}"`).join("")}${t.children.length||t.name==="g"?`>${t.children.map($f).join("")}</${t.name}>`:"/>"}`,Xi=(t,e)=>t.attrs.find(s=>s[0]===e)?.[1],Gr=(t,e,s)=>{let r=t.attrs.find(i=>i[0]===e);r?r[1]=s:t.attrs.push([e,s])},Nh=t=>(Xi(t,"class")??"").split(/\s+/).filter(Boolean);function Rh(t,e){if(e.tag&&e.tag!==t.name)return!1;let s=Nh(t);return e.classes.every(r=>s.includes(r))&&!e.not.some(r=>s.includes(r))&&e.attrs.every(([r,i])=>{let o=Xi(t,r);return o!==void 0&&(i===void 0||o===i)})}function _c(t,e,s=e.length-1){if(!Rh(t,e[s]))return!1;if(s===0)return!0;let r=t.parent;if(e[s].child)return!!r&&r.name!=="#root"&&_c(r,e,s-1);for(;r&&r.name!=="#root";r=r.parent)if(_c(r,e,s-1))return!0;return!1}var Bs=t=>t.endsWith("%")?parseFloat(t)/100:parseFloat(t);function Ih(t,e,s,r){let i=(1-Math.abs(2*s-1))*e,o=(t%360+360)%360/60,n=i*(1-Math.abs(o%2-1)),a=s-i/2,[f,p,c]=o<1?[i,n,0]:o<2?[n,i,0]:o<3?[0,i,n]:o<4?[0,n,i]:o<5?[n,0,i]:[i,0,n];return[(f+a)*255,(p+a)*255,(c+a)*255,r]}function Sf(t,e){let s=[],r=0,i="";for(let o of t)o==="("&&r++,o===")"&&r--,o===e&&r===0?(s.push(i.trim()),i=""):i+=o;return[...s,i.trim()].filter(Boolean)}var wf={transparent:[0,0,0,0],black:[0,0,0,1],white:[255,255,255,1]};function Ka(t){let e=t.trim();if(Object.hasOwn(wf,e))return wf[e];let s=/^#([0-9a-f]{3,8})$/i.exec(e);if(s){let r=s[1].length<6?[...s[1]].map(i=>i+i).join(""):s[1];return[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16),r.length===8?parseInt(r.slice(6),16)/255:1]}if(s=/^hsla?\((.*)\)$/.exec(e),s){let[r,i]=s[1].split("/").map(p=>p.trim()),[o,n,a,f]=r.split(/[\s,]+/);return Ih(parseFloat(o),Bs(n),Bs(a),i!==void 0?Bs(i):f!==void 0?Bs(f):1)}if(s=/^rgba?\((.*)\)$/.exec(e),s){let[r,i,o,n]=s[1].split(/[\s,/]+/).filter(Boolean);return[Bs(r),Bs(i),Bs(o),n===void 0?1:Bs(n)]}if(s=/^color-mix\(in srgb\s*,(.*)\)$/.exec(e),s){let[r,i]=Sf(s[1],",").map(c=>{let l=/^(.*?)\s+([\d.]+)%$/.exec(c);return l?{c:Ka(l[1]),p:Number(l[2])/100}:{c:Ka(c),p:void 0}});if(!r?.c||!i?.c)return;let o=r.p??(i.p===void 0?.5:1-i.p),n=i.p??1-o,a=o+n,f=(r.c[3]*o+i.c[3]*n)/a,p=c=>f===0?0:(r.c[c]*r.c[3]*o+i.c[c]*i.c[3]*n)/a/f;return[p(0),p(1),p(2),f*Math.min(1,a)]}}var xf=t=>"#"+[t[0],t[1],t[2]].map(e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0")).join(""),zh=t=>String(Math.round(t*1e4)/1e4);function Fc(t,e,s=0){if(s>20)throw new Error(`resolve: a custom property in a loop: ${t}`);let r=t.indexOf("var(");if(r<0)return t;let i=0,o=r+3;do t[o]==="("&&i++,t[o]===")"&&i--,o++;while(i>0&&o<t.length);let[n,...a]=Sf(t.slice(r+4,o-1),","),f=e.get(n)??(a.length?a.join(","):void 0);if(f===void 0)throw new Error(`resolve: no value for ${n}`);return Fc(t.slice(0,r)+f+t.slice(o),e,s+1)}var Ch=t=>new Map(t.split(";").filter(Boolean).map(e=>{let s=e.indexOf(":");return[e.slice(0,s).trim(),e.slice(s+1).trim()]})),Qi={sans:"system-ui, -apple-system, Segoe UI, Roboto, sans-serif",mono:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"};function Zr(t,e){let s=Ri(e.theme),r=e.fonts??Qi,i=Th(`.mono{font-family:${r.mono.replace(/"/g,"")}}
150
150
  ${s.rest}
151
- ${e.css}`),o=Ph(t);Gr(o,"font-family",r.sans.replace(/"/g,""));let n=(a,f)=>{let p=f,c=new Map,l=(h,y,g)=>{let k=c.get(h);(!k||g[0]>k.rank[0]||g[0]===k.rank[0]&&(g[1]>k.rank[1]||g[1]===k.rank[1]&&g[2]>=k.rank[2]))&&c.set(h,{v:y,rank:g})};for(let h of i)if(Cc(a,h.parts))for(let[y,g,k]of h.decls)l(y,g,[k?1:0,h.spec,h.order]);let d=Xi(a,"style");if(d){for(let h of d.split(";").map(y=>y.trim()).filter(Boolean)){let y=h.indexOf(":");l(h.slice(0,y).trim(),h.slice(y+1).trim(),[0,1e6,0])}a.attrs=a.attrs.filter(h=>h[0]!=="style")}for(let[h,y]of c)h.startsWith("--")&&(p===f&&(p=new Map(f)),p.set(h,y.v));let m={};for(let[h,y]of c){if(!bf.has(h))continue;let g=jc(y.v,p).trim();if(h==="fill"||h==="stroke"||h==="stop-color"){if(g==="none"||g==="currentColor"||g==="inherit"||g.startsWith("url(")){Gr(a,h,g);continue}let k=Ba(g);if(!k)throw new Error(`resolve: a colour it doesn't know: ${g}`);Gr(a,h,gf(k)),k[3]!==1&&(m[h==="stop-color"?"stop":h]=k[3])}else Gr(a,h,h==="letter-spacing"||h==="font-size"||h==="stroke-width"?g:g.replace(/"/g,""))}for(let[h,y]of Object.entries(m))Gr(a,`${h}-opacity`,Eh(y*Number(Xi(a,`${h}-opacity`)??1)));Xi(a,"opacity")==="0"&&(Gr(a,"display","none"),a.attrs=a.attrs.filter(h=>h[0]!=="opacity"));for(let h of a.attrs)if(/var\(|hsl\(|color-mix/.test(h[1])){let y=jc(h[1],p),g=Ba(y);h[1]=g?gf(g):y}for(let h of a.children)typeof h!="string"&&n(h,p)};return n(o,Nh(e.mode==="dark"?`${s.light};${s.dark}`:s.light)),wf(o)}var qa=t=>`${Math.round(parseInt(t.slice(1,3),16)/255*1e4)/100}%`,_c=(t,e,s)=>{let[r,i]=[t,e].map(n=>parseInt(n.slice(1,3),16)),o=Math.round(r+(i-r)*s).toString(16).padStart(2,"0");return`#${o}${o}${o}`};function Fc(t,e,s){let r=new Set([...t.matchAll(/\sclass="([^"]*)"/g)].flatMap(i=>i[1].split(/\s+/)).filter(i=>i.startsWith("k-")).map(i=>i.slice(2)));return{roles:Object.keys(e.roles).filter(i=>r.has(i)),kinds:[...new Set(s)].filter(i=>i in e.kinds)}}function Dc(t,e){let s=tn[e.mode].steps,r=(p,c)=>e.roles[p]??s[c],i={};for(let[p,c]of Object.entries(t.light))i[p]=/%$/.test(c)?c:e.ink;let o=r("slab",0),n=r("pad",0);Object.assign(i,{bg:e.paper,surface:e.paper,on:e.paper,ink:e.ink,muted:_c(e.paper,e.ink,.72),line:_c(e.paper,e.ink,.3),"code-bg":_c(e.paper,e.ink,.06),"slab-top":o.top,"slab-l":o.left,"slab-r":o.right,"pad-top":n.top});let a=Object.fromEntries(Object.entries(t.roles).map(([p])=>[p,{h:0,s:0}])),f=Object.fromEntries(Object.entries(t.kinds).map(([p,c])=>[p,{...c,color:e.ink}]));return _s({...t,light:i,dark:i,roles:a,kinds:f})}function Bc(t){let e="";for(let[s,r]of Object.entries(t.roles))e+=`.k-${s}{--s:0%;--l-top:${qa(r.top)};--l-left:${qa(r.left)};--l-right:${qa(r.right)};--l-edge:${qa(r.edge)}}
151
+ ${e.css}`),o=Eh(t);Gr(o,"font-family",r.sans.replace(/"/g,""));let n=(a,f)=>{let p=f,c=new Map,l=(h,y,g)=>{let k=c.get(h);(!k||g[0]>k.rank[0]||g[0]===k.rank[0]&&(g[1]>k.rank[1]||g[1]===k.rank[1]&&g[2]>=k.rank[2]))&&c.set(h,{v:y,rank:g})};for(let h of i)if(_c(a,h.parts))for(let[y,g,k]of h.decls)l(y,g,[k?1:0,h.spec,h.order]);let d=Xi(a,"style");if(d){for(let h of d.split(";").map(y=>y.trim()).filter(Boolean)){let y=h.indexOf(":");l(h.slice(0,y).trim(),h.slice(y+1).trim(),[0,1e6,0])}a.attrs=a.attrs.filter(h=>h[0]!=="style")}for(let[h,y]of c)h.startsWith("--")&&(p===f&&(p=new Map(f)),p.set(h,y.v));let m={};for(let[h,y]of c){if(!kf.has(h))continue;let g=Fc(y.v,p).trim();if(h==="fill"||h==="stroke"||h==="stop-color"){if(g==="none"||g==="currentColor"||g==="inherit"||g.startsWith("url(")){Gr(a,h,g);continue}let k=Ka(g);if(!k)throw new Error(`resolve: a colour it doesn't know: ${g}`);Gr(a,h,xf(k)),k[3]!==1&&(m[h==="stop-color"?"stop":h]=k[3])}else Gr(a,h,h==="letter-spacing"||h==="font-size"||h==="stroke-width"?g:g.replace(/"/g,""))}for(let[h,y]of Object.entries(m))Gr(a,`${h}-opacity`,zh(y*Number(Xi(a,`${h}-opacity`)??1)));Xi(a,"opacity")==="0"&&(Gr(a,"display","none"),a.attrs=a.attrs.filter(h=>h[0]!=="opacity"));for(let h of a.attrs)if(/var\(|hsl\(|color-mix/.test(h[1])){let y=Fc(h[1],p),g=Ka(y);h[1]=g?xf(g):y}for(let h of a.children)typeof h!="string"&&n(h,p)};return n(o,Ch(e.mode==="dark"?`${s.light};${s.dark}`:s.light)),$f(o)}var Ga=t=>`${Math.round(parseInt(t.slice(1,3),16)/255*1e4)/100}%`,Dc=(t,e,s)=>{let[r,i]=[t,e].map(n=>parseInt(n.slice(1,3),16)),o=Math.round(r+(i-r)*s).toString(16).padStart(2,"0");return`#${o}${o}${o}`};function Bc(t,e,s){let r=new Set([...t.matchAll(/\sclass="([^"]*)"/g)].flatMap(i=>i[1].split(/\s+/)).filter(i=>i.startsWith("k-")).map(i=>i.slice(2)));return{roles:Object.keys(e.roles).filter(i=>r.has(i)),kinds:[...new Set(s)].filter(i=>i in e.kinds)}}function qc(t,e){let s=tn[e.mode].steps,r=(p,c)=>e.roles[p]??s[c],i={};for(let[p,c]of Object.entries(t.light))i[p]=/%$/.test(c)?c:e.ink;let o=r("slab",0),n=r("pad",0);Object.assign(i,{bg:e.paper,surface:e.paper,on:e.paper,ink:e.ink,muted:Dc(e.paper,e.ink,.72),line:Dc(e.paper,e.ink,.3),"code-bg":Dc(e.paper,e.ink,.06),"slab-top":o.top,"slab-l":o.left,"slab-r":o.right,"pad-top":n.top});let a=Object.fromEntries(Object.entries(t.roles).map(([p])=>[p,{h:0,s:0}])),f=Object.fromEntries(Object.entries(t.kinds).map(([p,c])=>[p,{...c,color:e.ink}]));return _s({...t,light:i,dark:i,roles:a,kinds:f})}function Vc(t){let e="";for(let[s,r]of Object.entries(t.roles))e+=`.k-${s}{--s:0%;--l-top:${Ga(r.top)};--l-left:${Ga(r.left)};--l-right:${Ga(r.right)};--l-edge:${Ga(r.edge)}}
152
152
  `;for(let[s,r]of Object.entries(t.kinds))e+=`.flow.f-${s}{stroke-width:${r.width}${r.dash.length?`;stroke-dasharray:${r.dash.join(" ")}`:";stroke-dasharray:none"}}
153
- `;return e}var Rh={hatch:{size:6,draw:(t,e)=>`<path d="M0,6L6,0M-1.5,1.5L1.5,-1.5M4.5,7.5L7.5,4.5" stroke="${t}" stroke-width="${e}" fill="none"/>`},"hatch-wide":{size:12,draw:(t,e)=>`<path d="M0,0L12,12M-3,9L3,15M9,-3L15,3" stroke="${t}" stroke-width="${e}" fill="none"/>`},dots:{size:8,draw:(t,e)=>`<circle cx="2" cy="2" r="${e+.2}" fill="${t}"/><circle cx="6" cy="6" r="${e+.2}" fill="${t}"/>`}},Ih=t=>Math.round(t*100)/100,zh=(t,e)=>Ci(t,e.ink)>=Ci(t,e.paper)?e.ink:e.paper;function Va(t,e,s){let r=new Map,i=(f,p)=>{let c=`${s}-mono-${f}-${p.slice(1)}`,l=Rh[f],d=e.mode==="dark"?1.2:.9;return r.has(c)||r.set(c,`<pattern id="${c}" width="${l.size}" height="${l.size}" patternUnits="userSpaceOnUse">${l.draw(p,Ih(d))}</pattern>`),c},o=[],n="",a="";for(let f of t.matchAll(/<\/[a-zA-Z][\w:-]*>|<([a-zA-Z][\w:-]*)((?:\s+[\w:-]+="[^"]*")*)\s*(\/?)>|[^<]+/g)){if(n+=f[0],f[0].startsWith("</")){o.pop();continue}if(f[1]===void 0)continue;let p=(/\sclass="([^"]*)"/.exec(f[2])?.[1]??"").split(/\s+/);o.length===1&&(a=p.find(y=>y.startsWith("g-"))??"");let c=p.find(y=>y.startsWith("k-"))?.slice(2)??o.at(-1);if(f[3]||o.push(p.includes("ghost")?"":c),!f[3]||f[1]!=="polygon"&&f[1]!=="path"||!c||!p.some(y=>y==="top"||y==="lft"||y==="rgt")||a==="g-base"&&!p.includes("rgt"))continue;let l=Object.hasOwn(e.roles,c)?e.roles[c].pattern:"none",d=/\sfill="(#[0-9a-f]{6})"/.exec(f[2])?.[1],m=/\s(points|d)="[^"]*"/.exec(f[2])?.[0];if(l==="none"||!d||!m)continue;let h=/\sfill-opacity="[^"]*"/.exec(f[2])?.[0]??"";n+=`<${f[1]}${m} class="mono-pattern" fill="url(#${i(l,zh(d,e))})" stroke="none"${h}/>`}return n=n.replace(/#([0-9a-f]{6})\b/g,(f,p)=>p.slice(0,2)===p.slice(2,4)&&p.slice(2,4)===p.slice(4,6)?f:Ch(f)),r.size&&(n=n.replace(/<defs\/>|<defs>/,f=>f==="<defs/>"?`<defs>${[...r.values()].join("")}</defs>`:f+[...r.values()].join(""))),n}function Ch(t){let e=zi(t),s=e>8?((e+16)/116)**3:e/(24389/27),r=s<=.0031308?s*12.92:1.055*s**(1/2.4)-.055,i=Math.max(0,Math.min(255,Math.round(r*255))).toString(16).padStart(2,"0");return`#${i}${i}${i}`}function Ka(t,e,s,r,i){let o=ca(e,s,Fc(t,e,r),i);return{look:o,theme:Dc(e,o),css:Bc(o)}}function qc(t){return Math.max(5600,Math.min(12500,2600+t.length*40))}function Ga(t,e,s,r,i,o){let n=[],a=(A,R,M,T="error")=>{let S=i.locate(A);n.push({severity:T,message:R,line:S.line,col:S.col,path:A,hint:M})},f=t.steps??[],p=new Set(Object.keys(o.kinds)),c=new Map(r.map(A=>[A.id,A])),l=()=>[...s.byId.keys(),...c.keys()],d=new Map;f.forEach((A,R)=>{A.id&&(d.has(A.id)&&a(`${e}/steps/${R}/id`,`duplicate step id "${A.id}"`),d.set(A.id,R+1))});let m=f.length,h=(A,R)=>{if(typeof A=="number"){if(A<1||A>m){a(R,`there is no step ${A}; this scene has ${m} step(s)`);return}return A}let M=d.get(A);return M===void 0&&a(R,`unknown step "${A}"`+Rn(A,d.keys())),M},y=A=>Un(o,o.kinds[A]?.color??"control"),g=[],k=A=>{g.includes(A)||g.push(A)};for(let A of r)k(A.kind);let u={},b=(A,R,M,T)=>{if(R===void 0&&M===void 0)return;let S=R!==void 0?h(R,T+"/appears"):1,N=M!==void 0?h(M,T+"/disappears"):m+1;u[A]=Array.from({length:m},(z,K)=>K+1>=(S??1)&&K+1<(N??m+1))};for(let A of s.items)b(A.id,A.appears,A.disappears,A.path);for(let A of r)b(A.id,A.raw.appears,A.raw.disappears,A.path);let x=[],w=[],$=[],v=[],O=()=>{for(let A of r){if(A.raw.appears!==void 0||A.raw.disappears!==void 0)continue;let R=[A.from,A.to].map(M=>M&&(u[M.id]??C(M)));R.some(Boolean)&&(u[A.id]=Array.from({length:m},(M,T)=>R.every(S=>!S||S[T])))}},C=A=>{for(let R=A.parent;R;R=R.parent)if(u[R.id])return u[R.id]};return f.forEach((A,R)=>{let M=R+1,T=`${e}/steps/${R}`,S=A.kind??"control";p.has(S)||a(T+"/kind",`unknown flow kind "${S}"`+Rn(S,p)),k(S);let N=new Set,z=[];(A.animate??[]).forEach((L,U)=>{let H=Array.isArray(L)?L:[L],ee=[];H.forEach((j,q)=>{let G=Array.isArray(L)?`${T}/animate/${U}/${q}`:`${T}/animate/${U}`,Q,ce;if(typeof j=="string"){let ie=/^([^:\s]+)\s*(?::\s*(\S+))?$/.exec(j.trim());Q=ie?ie[1]:j,ce=ie?.[2]}else{let ie=Object.entries(j)[0];Q=ie[0],ce=ie[1]}let pe=c.get(Q);if(!pe){a(G,`unknown route "${Q}"`+Rn(Q,c.keys()));return}if(ce&&!p.has(ce)){a(G,`unknown flow kind "${ce}"`+Rn(ce,p));return}let Y=ce??pe.kind;k(Y),ee.push({route:Q,kind:Y,color:y(Y)}),N.add(Q),pe.from&&N.add(pe.from.id),pe.to&&N.add(pe.to.id)}),ee.length&&z.push(ee)});let K=[];(A.pulse??[]).forEach((L,U)=>{let H=s.byId.get(L);if(!H){a(`${T}/pulse/${U}`,`unknown node "${L}"`+Rn(L,s.byId.keys()));return}let ee,j,q,G,Q=H.node?er(s.catalog,H.node.asset):void 0;if(Q?.pulse)[ee,j,q,G]=Q.pulse(H.box);else{let Y=H.box;ee=(Y.x0+Y.x1)/2,j=(Y.y0+Y.y1)/2,q=Y.z1,G=Math.max(22,Math.min(60,(Y.x1-Y.x0+Y.y1-Y.y0)*8.5))}let[ce,pe]=Ne(ee,j,q);K.push([ce,pe,G*1.7,G*.98]),N.add(L)}),(A.highlight??[]).forEach((L,U)=>{!s.byId.has(L)&&!c.has(L)&&a(`${T}/highlight/${U}`,`unknown id "${L}"`+Rn(L,l())),N.add(L)});for(let[L,U]of[["show",!0],["hide",!1]])(A[L]??[]).forEach((H,ee)=>{if(!s.byId.has(H)&&!c.has(H)){a(`${T}/${L}/${ee}`,`unknown id "${H}"`+Rn(H,l()));return}let j=u[H]??(u[H]=Array(m).fill(!U));for(let q=R;q<m;q++)j[q]=U});if((A.say??[]).forEach((L,U)=>{let H,ee;if(Array.isArray(L.at))[H,ee]=Ne(L.at[0],L.at[1],L.at[2]??.36);else{let q=s.byId.get(L.at);if(!q){a(`${T}/say/${U}/at`,`unknown node "${L.at}"`+Rn(L.at,s.byId.keys()));return}let G=q.box;[H,ee]=Ne((G.x0+G.x1)/2,(G.y0+G.y1)/2,G.z1+.75)}let j=L.kind??S;p.has(j)||a(`${T}/say/${U}/kind`,`unknown flow kind "${j}"`+Rn(j,p)),w.push({step:M,x:H+(L.dx??0),y:ee+(L.dy??(Array.isArray(L.at)?0:-46)),ax:H,ay:ee,text:L.text,kind:j,anchor:L.anchor??"middle"})}),(A.mark??[]).forEach((L,U)=>{if(L.at){$.push({step:M,p:[L.at[0],L.at[1],L.at[2]??.36]});return}let H=L.on?c.get(L.on):void 0;if(!H){a(`${T}/mark/${U}`,L.on?`unknown route "${L.on}"`+Rn(L.on,c.keys()):'a mark needs "on: ROUTE" or "at: [x, y]"');return}let ee=H.points[H.points.length-1];$.push({step:M,p:[ee[0],ee[1],ee[2]+.6],on:H.id}),N.add(H.id)}),t.badges&&A.badge!==!1){let L=Array.isArray(A.badge)?[A.badge[0],A.badge[1],A.badge[2]??.36]:void 0,U=typeof A.badge=="string"?A.badge:z[0]?.[0]?.route,H=U?c.get(U):void 0;if(!L)if(H)L=Vc(H.points);else if(U&&s.byId.get(U)){let ee=s.byId.get(U).box;L=[(ee.x0+ee.x1)/2,(ee.y0+ee.y1)/2,ee.z1+.3]}else typeof A.badge=="string"&&a(`${T}/badge`,`unknown id "${A.badge}"`+Rn(A.badge,l()));L&&v.push({step:M,num:A.number??M,kind:S,p:L})}for(let L of[...N])for(let U=s.byId.get(L)?.parent;U;U=U.parent)N.add(U.id);for(let L of s.items)L.region?.kind==="tunnel"&&(L.region.around??[]).some(U=>N.has(U))&&N.add(L.id);let J;if(A.focus?.length){let L=1/0,U=1/0,H=-1/0,ee=-1/0;A.focus.forEach((j,q)=>{let G=s.byId.get(j);if(!G){a(`${T}/focus/${q}`,`unknown node or region "${j}"`+Rn(j,s.byId.keys()));return}let Q=G.box;for(let[ce,pe,Y]of[[Q.x0,Q.y0,Q.z1],[Q.x1,Q.y0,Q.z0],[Q.x0,Q.y1,Q.z0],[Q.x1,Q.y1,Q.z0],[Q.x1,Q.y0,Q.z1],[Q.x0,Q.y1,Q.z1]]){let[ie,Ae]=Ne(ce,pe,Y);L=Math.min(L,ie),U=Math.min(U,Ae),H=Math.max(H,ie),ee=Math.max(ee,Ae)}N.add(j)}),L<1/0&&(J=[Math.round(L-60),Math.round(U-70),Math.round(H+60),Math.round(ee+40)])}let Z=A.caption??"";x.push({n:M,num:A.number??M,kind:S,color:y(S),heading:A.heading,caption:Z,command:A.command??"",phases:z,pulses:K,lit:[...N],duration:A.duration===void 0||A.duration==="auto"?qc(Z):A.duration,...J?{focus:J}:{}})}),O(),{steps:x,says:w,marks:$,badges:v,vis:u,diags:n,kindsUsed:g}}function Vc(t){let e=t.slice(1).map((r,i)=>Math.hypot(r[0]-t[i][0],r[1]-t[i][1],r[2]-t[i][2])),s=e.reduce((r,i)=>r+i,0)/2;for(let r=0;r<e.length;r++){if(s<=e[r]&&e[r]>0){let i=s/e[r],o=t[r],n=t[r+1];return[o[0]+(n[0]-o[0])*i,o[1]+(n[1]-o[1])*i,o[2]+(n[2]-o[2])*i]}s-=e[r]}return t[0]}function Rn(t,e){let s=Vt(t,e);return s?` (did you mean "${s}"?)`:""}var Kc=`
153
+ `;return e}var jh={hatch:{size:6,draw:(t,e)=>`<path d="M0,6L6,0M-1.5,1.5L1.5,-1.5M4.5,7.5L7.5,4.5" stroke="${t}" stroke-width="${e}" fill="none"/>`},"hatch-wide":{size:12,draw:(t,e)=>`<path d="M0,0L12,12M-3,9L3,15M9,-3L15,3" stroke="${t}" stroke-width="${e}" fill="none"/>`},dots:{size:8,draw:(t,e)=>`<circle cx="2" cy="2" r="${e+.2}" fill="${t}"/><circle cx="6" cy="6" r="${e+.2}" fill="${t}"/>`}},Lh=t=>Math.round(t*100)/100,_h=(t,e)=>Ci(t,e.ink)>=Ci(t,e.paper)?e.ink:e.paper;function Za(t,e,s){let r=new Map,i=(f,p)=>{let c=`${s}-mono-${f}-${p.slice(1)}`,l=jh[f],d=e.mode==="dark"?1.2:.9;return r.has(c)||r.set(c,`<pattern id="${c}" width="${l.size}" height="${l.size}" patternUnits="userSpaceOnUse">${l.draw(p,Lh(d))}</pattern>`),c},o=[],n="",a="";for(let f of t.matchAll(/<\/[a-zA-Z][\w:-]*>|<([a-zA-Z][\w:-]*)((?:\s+[\w:-]+="[^"]*")*)\s*(\/?)>|[^<]+/g)){if(n+=f[0],f[0].startsWith("</")){o.pop();continue}if(f[1]===void 0)continue;let p=(/\sclass="([^"]*)"/.exec(f[2])?.[1]??"").split(/\s+/);o.length===1&&(a=p.find(y=>y.startsWith("g-"))??"");let c=p.find(y=>y.startsWith("k-"))?.slice(2)??o.at(-1);if(f[3]||o.push(p.includes("ghost")?"":c),!f[3]||f[1]!=="polygon"&&f[1]!=="path"||!c||!p.some(y=>y==="top"||y==="lft"||y==="rgt")||a==="g-base"&&!p.includes("rgt"))continue;let l=Object.hasOwn(e.roles,c)?e.roles[c].pattern:"none",d=/\sfill="(#[0-9a-f]{6})"/.exec(f[2])?.[1],m=/\s(points|d)="[^"]*"/.exec(f[2])?.[0];if(l==="none"||!d||!m)continue;let h=/\sfill-opacity="[^"]*"/.exec(f[2])?.[0]??"";n+=`<${f[1]}${m} class="mono-pattern" fill="url(#${i(l,_h(d,e))})" stroke="none"${h}/>`}return n=n.replace(/#([0-9a-f]{6})\b/g,(f,p)=>p.slice(0,2)===p.slice(2,4)&&p.slice(2,4)===p.slice(4,6)?f:Fh(f)),r.size&&(n=n.replace(/<defs\/>|<defs>/,f=>f==="<defs/>"?`<defs>${[...r.values()].join("")}</defs>`:f+[...r.values()].join(""))),n}function Fh(t){let e=zi(t),s=e>8?((e+16)/116)**3:e/(24389/27),r=s<=.0031308?s*12.92:1.055*s**(1/2.4)-.055,i=Math.max(0,Math.min(255,Math.round(r*255))).toString(16).padStart(2,"0");return`#${i}${i}${i}`}function Ua(t,e,s,r,i){let o=fa(e,s,Bc(t,e,r),i);return{look:o,theme:qc(e,o),css:Vc(o)}}function Kc(t){return Math.max(5600,Math.min(12500,2600+t.length*40))}function Ha(t,e,s,r,i,o){let n=[],a=(A,R,P,E="error")=>{let v=i.locate(A);n.push({severity:E,message:R,line:v.line,col:v.col,path:A,hint:P})},f=t.steps??[],p=new Set(Object.keys(o.kinds)),c=new Map(r.map(A=>[A.id,A])),l=()=>[...s.byId.keys(),...c.keys()],d=new Map;f.forEach((A,R)=>{A.id&&(d.has(A.id)&&a(`${e}/steps/${R}/id`,`duplicate step id "${A.id}"`),d.set(A.id,R+1))});let m=f.length,h=(A,R)=>{if(typeof A=="number"){if(A<1||A>m){a(R,`there is no step ${A}; this scene has ${m} step(s)`);return}return A}let P=d.get(A);return P===void 0&&a(R,`unknown step "${A}"`+In(A,d.keys())),P},y=A=>Hn(o,o.kinds[A]?.color??"control"),g=[],k=A=>{g.includes(A)||g.push(A)};for(let A of r)k(A.kind);let u={},b=(A,R,P,E)=>{if(R===void 0&&P===void 0)return;let v=R!==void 0?h(R,E+"/appears"):1,N=P!==void 0?h(P,E+"/disappears"):m+1;u[A]=Array.from({length:m},(C,V)=>V+1>=(v??1)&&V+1<(N??m+1))};for(let A of s.items)b(A.id,A.appears,A.disappears,A.path);for(let A of r)b(A.id,A.raw.appears,A.raw.disappears,A.path);let x=[],w=[],$=[],S=[],O=()=>{for(let A of r){if(A.raw.appears!==void 0||A.raw.disappears!==void 0)continue;let R=[A.from,A.to].map(P=>P&&(u[P.id]??z(P)));R.some(Boolean)&&(u[A.id]=Array.from({length:m},(P,E)=>R.every(v=>!v||v[E])))}},z=A=>{for(let R=A.parent;R;R=R.parent)if(u[R.id])return u[R.id]};return f.forEach((A,R)=>{let P=R+1,E=`${e}/steps/${R}`,v=A.kind??"control";p.has(v)||a(E+"/kind",`unknown flow kind "${v}"`+In(v,p)),k(v);let N=new Set,C=[];(A.animate??[]).forEach((j,K)=>{let U=Array.isArray(j)?j:[j],ee=[];U.forEach((L,q)=>{let G=Array.isArray(j)?`${E}/animate/${K}/${q}`:`${E}/animate/${K}`,X,ce;if(typeof L=="string"){let oe=/^([^:\s]+)\s*(?::\s*(\S+))?$/.exec(L.trim());X=oe?oe[1]:L,ce=oe?.[2]}else{let oe=Object.entries(L)[0];X=oe[0],ce=oe[1]}let le=c.get(X);if(!le){a(G,`unknown route "${X}"`+In(X,c.keys()));return}if(ce&&!p.has(ce)){a(G,`unknown flow kind "${ce}"`+In(ce,p));return}let H=ce??le.kind;k(H),ee.push({route:X,kind:H,color:y(H)}),N.add(X),le.from&&N.add(le.from.id),le.to&&N.add(le.to.id)}),ee.length&&C.push(ee)});let V=[];(A.pulse??[]).forEach((j,K)=>{let U=s.byId.get(j);if(!U){a(`${E}/pulse/${K}`,`unknown node "${j}"`+In(j,s.byId.keys()));return}let ee,L,q,G,X=U.node?er(s.catalog,U.node.asset):void 0;if(X?.pulse)[ee,L,q,G]=X.pulse(U.box);else{let H=U.box;ee=(H.x0+H.x1)/2,L=(H.y0+H.y1)/2,q=H.z1,G=Math.max(22,Math.min(60,(H.x1-H.x0+H.y1-H.y0)*8.5))}let[ce,le]=Re(ee,L,q);V.push([ce,le,G*1.7,G*.98]),N.add(j)}),(A.highlight??[]).forEach((j,K)=>{!s.byId.has(j)&&!c.has(j)&&a(`${E}/highlight/${K}`,`unknown id "${j}"`+In(j,l())),N.add(j)});for(let[j,K]of[["show",!0],["hide",!1]])(A[j]??[]).forEach((U,ee)=>{if(!s.byId.has(U)&&!c.has(U)){a(`${E}/${j}/${ee}`,`unknown id "${U}"`+In(U,l()));return}let L=u[U]??(u[U]=Array(m).fill(!K));for(let q=R;q<m;q++)L[q]=K});if((A.say??[]).forEach((j,K)=>{let U,ee;if(Array.isArray(j.at))[U,ee]=Re(j.at[0],j.at[1],j.at[2]??.36);else{let q=s.byId.get(j.at);if(!q){a(`${E}/say/${K}/at`,`unknown node "${j.at}"`+In(j.at,s.byId.keys()));return}let G=q.box;[U,ee]=Re((G.x0+G.x1)/2,(G.y0+G.y1)/2,G.z1+.75)}let L=j.kind??v;p.has(L)||a(`${E}/say/${K}/kind`,`unknown flow kind "${L}"`+In(L,p)),w.push({step:P,x:U+(j.dx??0),y:ee+(j.dy??(Array.isArray(j.at)?0:-46)),ax:U,ay:ee,text:j.text,kind:L,anchor:j.anchor??"middle"})}),(A.mark??[]).forEach((j,K)=>{if(j.at){$.push({step:P,p:[j.at[0],j.at[1],j.at[2]??.36]});return}let U=j.on?c.get(j.on):void 0;if(!U){a(`${E}/mark/${K}`,j.on?`unknown route "${j.on}"`+In(j.on,c.keys()):'a mark needs "on: ROUTE" or "at: [x, y]"');return}let ee=U.points[U.points.length-1];$.push({step:P,p:[ee[0],ee[1],ee[2]+.6],on:U.id}),N.add(U.id)}),t.badges&&A.badge!==!1){let j=Array.isArray(A.badge)?[A.badge[0],A.badge[1],A.badge[2]??.36]:void 0,K=typeof A.badge=="string"?A.badge:C[0]?.[0]?.route,U=K?c.get(K):void 0;if(!j)if(U)j=Gc(U.points);else if(K&&s.byId.get(K)){let ee=s.byId.get(K).box;j=[(ee.x0+ee.x1)/2,(ee.y0+ee.y1)/2,ee.z1+.3]}else typeof A.badge=="string"&&a(`${E}/badge`,`unknown id "${A.badge}"`+In(A.badge,l()));j&&S.push({step:P,num:A.number??P,kind:v,p:j})}for(let j of[...N])for(let K=s.byId.get(j)?.parent;K;K=K.parent)N.add(K.id);for(let j of s.items)j.region?.kind==="tunnel"&&(j.region.around??[]).some(K=>N.has(K))&&N.add(j.id);let Y;if(A.focus?.length){let j=1/0,K=1/0,U=-1/0,ee=-1/0;A.focus.forEach((L,q)=>{let G=s.byId.get(L);if(!G){a(`${E}/focus/${q}`,`unknown node or region "${L}"`+In(L,s.byId.keys()));return}let X=G.box;for(let[ce,le,H]of[[X.x0,X.y0,X.z1],[X.x1,X.y0,X.z0],[X.x0,X.y1,X.z0],[X.x1,X.y1,X.z0],[X.x1,X.y0,X.z1],[X.x0,X.y1,X.z1]]){let[oe,Ae]=Re(ce,le,H);j=Math.min(j,oe),K=Math.min(K,Ae),U=Math.max(U,oe),ee=Math.max(ee,Ae)}N.add(L)}),j<1/0&&(Y=[Math.round(j-60),Math.round(K-70),Math.round(U+60),Math.round(ee+40)])}let Z=A.caption??"";x.push({n:P,num:A.number??P,kind:v,color:y(v),heading:A.heading,caption:Z,command:A.command??"",phases:C,pulses:V,lit:[...N],duration:A.duration===void 0||A.duration==="auto"?Kc(Z):A.duration,...Y?{focus:Y}:{}})}),O(),{steps:x,says:w,marks:$,badges:S,vis:u,diags:n,kindsUsed:g}}function Gc(t){let e=t.slice(1).map((r,i)=>Math.hypot(r[0]-t[i][0],r[1]-t[i][1],r[2]-t[i][2])),s=e.reduce((r,i)=>r+i,0)/2;for(let r=0;r<e.length;r++){if(s<=e[r]&&e[r]>0){let i=s/e[r],o=t[r],n=t[r+1];return[o[0]+(n[0]-o[0])*i,o[1]+(n[1]-o[1])*i,o[2]+(n[2]-o[2])*i]}s-=e[r]}return t[0]}function In(t,e){let s=Vt(t,e);return s?` (did you mean "${s}"?)`:""}var Zc=`
154
154
  *{box-sizing:border-box}
155
155
  html,body{margin:0}
156
156
  body{background:var(--bg);color:var(--ink);font:15px/1.55 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;-webkit-font-smoothing:antialiased;overflow-x:hidden}
@@ -174,7 +174,7 @@ h2{font-size:20px;margin:44px 0 4px;letter-spacing:-.005em;text-wrap:balance}
174
174
  .legend i{display:inline-block;width:26px;height:0;border-top:3px solid}
175
175
  .legend i.box{height:10px;border-width:1.5px;border-style:solid;border-radius:2px}
176
176
  footer{margin-top:40px;font-size:12.5px;color:var(--muted)}
177
- `,ar=t=>jh+da(t)+Lh+fa(),jh=`
177
+ `,ar=t=>Dh+ua(t)+Bh+ha(),Dh=`
178
178
  /* blocks: hue per role, lightness per face and theme */
179
179
  .blk .top{fill:hsl(var(--h) var(--s) var(--l-top))}
180
180
  .blk .lft{fill:hsl(var(--h) var(--s) var(--l-left))}
@@ -215,14 +215,14 @@ footer{margin-top:40px;font-size:12.5px;color:var(--muted)}
215
215
  .floor.t-control{fill:var(--muted)}
216
216
  .slabname{font-size:15px;font-weight:800;fill:var(--muted);letter-spacing:.12em;opacity:.8}
217
217
  .slabname.sm{font-size:10.5px;letter-spacing:.1em;opacity:1}
218
- `,Lh=`.tunnel polygon{fill:hsl(205 85% 55% / .17);stroke:hsl(205 75% 45% / .8);stroke-width:1.3;stroke-linejoin:round}
218
+ `,Bh=`.tunnel polygon{fill:hsl(205 85% 55% / .17);stroke:hsl(205 75% 45% / .8);stroke-width:1.3;stroke-linejoin:round}
219
219
  .tunnel .top{fill:hsl(205 85% 65% / .22)}
220
220
  .tunnel .rib{fill:none;stroke:hsl(205 75% 45% / .5);stroke-width:1}
221
221
  .tunname{font-size:12px;font-weight:800;letter-spacing:.14em;fill:var(--tunnel-text);paint-order:stroke;stroke:var(--surface);stroke-width:3px;stroke-linejoin:round}
222
222
 
223
223
  /* flows */
224
224
  .flow{fill:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:round}
225
- `,Ur=t=>Kc+ar(t),Qi=`
225
+ `,Ur=t=>Zc+ar(t),eo=`
226
226
  /* step marks */
227
227
  .xm circle{fill:var(--surface);stroke:var(--blocked);stroke-width:2.5}
228
228
  .xm path{stroke:var(--blocked);stroke-width:3;stroke-linecap:round}
@@ -245,7 +245,7 @@ svg.all .badge{opacity:1}
245
245
  svg.focus.all [data-hl]:not(.hl),svg.focus.all.dim-all [data-dim]:not(.hl){opacity:.9}
246
246
  svg [data-step]:not(.on),svg.all [data-step]{opacity:0!important;pointer-events:none}
247
247
  .pre{opacity:0!important;pointer-events:none}
248
- `,Gc=`
248
+ `,Uc=`
249
249
  /* player */
250
250
  .player{display:flex;align-items:flex-start;gap:10px 14px;padding:12px 16px;border-top:1px solid var(--line);flex-wrap:wrap}
251
251
  .ctrls{display:flex;gap:6px;flex:none}
@@ -280,20 +280,20 @@ details.steps li code{font-size:11.5px}
280
280
  .still .ctrls,.still .tools{display:none}
281
281
  .tools{display:flex;gap:6px;flex:none;order:3;margin-left:auto}
282
282
  .pbtn.small{font-size:12px;padding:4px 11px;font-weight:600;color:var(--muted)}
283
- .pbtn.small[aria-pressed="true"]{color:var(--ink);border-color:var(--muted);background:var(--surface)}`,eo=`
283
+ .pbtn.small[aria-pressed="true"]{color:var(--ink);border-color:var(--muted);background:var(--surface)}`,to=`
284
284
  .grid{display:none;fill:none;stroke:var(--ink);stroke-width:.6;opacity:.16;pointer-events:none}
285
285
  svg.show-grid .grid{display:inline}
286
286
  svg.pre-assemble > g:not(.g-anim){opacity:0}
287
- `,Za=Qi+Gc+eo;var Zc=t=>({data:t,locate:()=>({line:0,col:0}),span:()=>{},diags:[]});function Ua(t,e,s,r=Zc(t),i,o={},n=[]){let a=_s(Tr(e),t.roles,t.kinds),f=[],p=new Map;return t.scenes.forEach((c,l)=>{let d=`/scenes/${l}`;if(p.has(c.id)){let u=r.locate(d+"/id");n.push({severity:"error",message:`duplicate scene id "${c.id}"`,line:u.line,col:u.col,path:d+"/id"})}p.set(c.id,l);let m={...t.grid,...c.grid,...o.snap?{snap:o.snap}:{}},h=Nr(c,d,r,a,s,t.roles,m.snap);n.push(...h.diags);let y=xa(c,d,h,r,new Set(Object.keys(a.kinds)),m.snap);n.push(...y.diags);let g=Ga(c,d,h,y.routes,r,a);n.push(...g.diags),n.push(..._h(c,d,s,r));let k=Fr({scene:c,layout:h,routes:y.routes,steps:g,theme:a,id:c.id,gridStep:m.step??m.snap??1});for(let u of k.warnings){let b=r.locate(u.path);n.push({severity:"warning",message:u.message,line:b.line,col:b.col,path:u.path})}f.push({id:c.id,raw:c,layout:h,routes:y.routes,steps:g,rendered:k,grid:m,assemble:c.assemble??t.assemble??!1})}),n.sort((c,l)=>c.line-l.line||c.col-l.col),{ok:!n.some(c=>c.severity==="error"),diags:n,doc:t,theme:a,catalog:s,scenes:f,parsed:r,source:i}}function _h(t,e,s,r){let i=[],o=(a,f)=>{let p=r.locate(a);i.push({severity:"warning",message:f,line:p.line,col:p.col,path:a})},n=(a,f)=>{a.nodes?.forEach((p,c)=>{let l=`${f}/nodes/${c}`;(p.deco??An(s,p.asset).deco??[]).forEach((d,m)=>{typeof d=="object"&&d.icon&&!ji(d.icon)&&o(p.deco?`${l}/deco/${m}/icon`:l,`node "${p.id}": no icon "${d.icon}" is registered here, so it is drawn as a placeholder`)}),p.face!==void 0&&!tr(p.face)&&o(`${l}/face`,`node "${p.id}": no screen face "${p.face}" is registered here, so it is drawn as a placeholder`)}),a.regions?.forEach((p,c)=>n(p,`${f}/regions/${c}`))};return n(t,e),i}function kf(t,e){let s=t/(Ct*lt),r=2*e/lt;return[(s+r)/2,(r-s)/2]}function $f(t,e){let s=t.layout.byId.get(e);if(!s)return;let r=s.parent?[s.parent.box.x0,s.parent.box.y0]:[0,0];return[s.box.x0-r[0],s.box.y0-r[1]]}function Sf(t){let e=[];for(let s of[t.x0,t.x1])for(let r of[t.y0,t.y1])for(let i of[t.z0,t.z1])e.push(Ne(s,r,i));return Fh(e)}function vf(t){return[[t.x0,t.y0],[t.x1,t.y0],[t.x1,t.y1],[t.x0,t.y1]].map(([e,s])=>Ne(e,s,t.z0))}function Fh(t){let e=[...new Map(t.map(o=>[`${o[0].toFixed(3)},${o[1].toFixed(3)}`,o])).values()].sort((o,n)=>o[0]-n[0]||o[1]-n[1]);if(e.length<3)return e;let s=(o,n,a)=>(n[0]-o[0])*(a[1]-o[1])-(n[1]-o[1])*(a[0]-o[0]),r=[],i=[];for(let o of e){for(;r.length>=2&&s(r[r.length-2],r[r.length-1],o)<=1e-9;)r.pop();r.push(o)}for(let o of[...e].reverse()){for(;i.length>=2&&s(i[i.length-2],i[i.length-1],o)<=1e-9;)i.pop();i.push(o)}return[...r.slice(0,-1),...i.slice(0,-1)]}var Mf=(t,e)=>e?.padding??Ot(t,e?.kind)?.pad??0;function Pf(t,e,s,r,i){let o=c=>Math.round(c/s)*s,n=o(t[0]+e[0]),a=o(t[1]+e[1]),f={left:!1,right:!1,top:!1,bottom:!1};if(i){let c=Math.ceil(i.pad/s-1e-9)*s,l=Math.floor((i.w-i.pad-r[0])/s+1e-9)*s,d=Math.floor((i.d-i.pad-r[1])/s+1e-9)*s;n<c&&(n=c,f.left=!0),l>=c&&n>l&&(n=l,f.right=!0),a<c&&(a=c,f.top=!0),d>=c&&a>d&&(a=d,f.bottom=!0)}let p=c=>Math.round(c*1e3)/1e3;return{at:[p(n),p(a)],delta:[p(n-t[0]),p(a-t[1])],clamped:f}}function Ha(t,e){return e.some(r=>t.x0<r.x1-1e-6&&t.x1>r.x0+1e-6&&t.y0<r.y1-1e-6&&t.y1>r.y0+1e-6)}var Hc=Object.freeze({W:178,H:58,GX:44,GY:44,PAD:22,TITLE:30,CH:96,cardRx:9,panelRx:14,bend:70,overlap:400,crossPanel:300,border:120,nearEdge:200,margin:16}),Yc={name:{key:"sans600_12",size:13},sub:{key:"sans400_13",size:10},title:{key:"sans700_13",size:12,spacing:.02},titleSub:{key:"sans400_13",size:10.5},label:{key:"sans600_12",size:10.5}},Of=(t,e)=>Pn(t,Yc[e]);function Ya(t){let e=[],s=new Map,r=(f,p)=>{if(typeof p!="string"||!p){e.push(`${f} has no id`);return}let c=s.get(p);c?e.push(`duplicate id "${p}": a ${c} and a ${f} (cards and panels share one set of ids)`):s.set(p,f)};for(let f of t.cards)r("card",f.id),(!Array.isArray(f.cell)||f.cell.length!==2||!f.cell.every(p=>Number.isInteger(p)&&p>=0))&&e.push(`card "${f.id}": cell must be [column, row], whole numbers from 0`);for(let f of t.panels??[]){r("panel",f.id);let p=f.cells;(!Array.isArray(p)||p.length!==4||!p.every(c=>Number.isInteger(c)&&c>=0)||p[2]<p[0]||p[3]<p[1])&&e.push(`panel "${f.id}": cells must be [c0, r0, c1, r1] with c0 \u2264 c1 and r0 \u2264 r1`)}let i=new Map;for(let f of t.cards){let p=String(f.cell);i.has(p)?e.push(`cards "${i.get(p)}" and "${f.id}" are both at cell [${p}]`):i.set(p,f.id)}let o=(t.panels??[]).filter(f=>Array.isArray(f.cells)&&f.cells.length===4);for(let f=0;f<o.length;f++)for(let p=f+1;p<o.length;p++){let c=o[f].cells,l=o[p].cells;c[0]<=l[2]&&l[0]<=c[2]&&c[1]<=l[3]&&l[1]<=c[3]&&!Uc(c,l)&&!Uc(l,c)&&e.push(`panels "${o[f].id}" and "${o[p].id}" overlap without one holding the other`)}let n=new Set([...t.cards.map(f=>f.id),...o.map(f=>f.id)]),a=new Set(o.map(f=>f.id));return(t.links??[]).forEach((f,p)=>{let c=`link ${f.id?`"${f.id}"`:p}`;for(let l of["a","b"])n.has(f[l])||e.push(`${c}: ${l} "${f[l]}" is no card or panel`);for(let l of["aOn","bOn"])f[l]!==void 0&&!a.has(f[l])&&e.push(`${c}: ${l} "${f[l]}" is no panel`);f.id!==void 0&&r("link",f.id)}),e}var Uc=(t,e)=>t[0]>=e[0]&&t[2]<=e[2]&&t[1]>=e[1]&&t[3]<=e[3];function to(t,e){let{W:s,H:r,GX:i,GY:o,PAD:n,TITLE:a,CH:f}=e,p=t.panels??[],c=j=>(j[2]-j[0]+1)*(j[3]-j[1]+1),l=(j,q)=>{let G=p[j].cells,Q=p[q].cells;return Uc(Q,G)?c(G)>c(Q)||j<q:!1},d=p.map((j,q)=>{let G=-1;return p.forEach((Q,ce)=>{ce!==q&&l(ce,q)&&(G<0||l(G,ce))&&(G=ce)}),G}),m=j=>d[j]<0?0:1+m(d[j]),h=(j,q)=>{let G=-1;p.forEach((ce,pe)=>{let Y=ce.cells;j>=Y[0]&&j<=Y[2]&&q>=Y[1]&&q<=Y[3]&&(G<0||l(G,pe))&&(G=pe)});let Q=[];for(let ce=G;ce>=0;ce=d[ce])Q.unshift(ce);return Q},y=Math.max(1,...t.cards.map(j=>j.cell[0]+1),...p.map(j=>j.cells[2]+1)),g=Math.max(1,...t.cards.map(j=>j.cell[1]+1),...p.map(j=>j.cells[3]+1)),k=[];for(let j=0;j<y;j++){k.push([]);for(let q=0;q<g;q++)k[j].push(h(j,q))}let u=(j,q,G)=>{let Q=j.filter(pe=>!q.includes(pe)),ce=q.filter(pe=>!j.includes(pe));return!Q.length&&!ce.length?0:Q.length*(n+(G?a:0))+ce.length*n+f},b=new Array(y+1).fill(0),x=new Array(g+1).fill(0);for(let j=0;j<g;j++)for(let q=1;q<y;q++){let G=u(k[q-1][j],k[q][j],!1);G&&(b[q]=Math.max(b[q],G-i))}for(let j=0;j<y;j++)for(let q=1;q<g;q++){let G=u(k[j][q-1],k[j][q],!0);G&&(x[q]=Math.max(x[q],G-o))}let w=j=>{let q=j*(s+i);for(let G=1;G<=j;G++)q+=b[G];return q},$=j=>{let q=j*(r+o);for(let G=1;G<=j;G++)q+=x[G];return q},v=(j,q,G,Q)=>G===q?j(q):j(q)+(Q-q)*(j(G)-j(q))/(G-q),O=p.map(()=>new Set),C=(j,q)=>{for(let G=j;G>=0;G=d[G])O[G].add(q)};p.forEach((j,q)=>{C(q,j.cells[1]),C(q,j.cells[3])});for(let j of t.cards){let q=k[j.cell[0]][j.cell[1]];q.length&&C(q[q.length-1],j.cell[1])}let A=p.map(()=>new Map),R=(j,q)=>j.slice(j.indexOf(q)+1);for(let j of p.map((q,G)=>G).sort((q,G)=>m(q)-m(G)||q-G)){let q=p[j].cells,G=[...O[j]].sort((ce,pe)=>ce-pe),Q=d[j]>=0?A[d[j]].get(G[0]):$(G[0]);A[j].set(G[0],Q);for(let ce=1;ce<G.length;ce++){let pe=0;for(let Y=q[0];Y<=q[2];Y++)pe=Math.max(pe,u(R(k[Y][G[ce-1]],j),R(k[Y][G[ce]],j),!0));Q+=r+Math.max(o,pe),A[j].set(G[ce],Q)}}let M=p.map(()=>new Set),T=(j,q)=>{for(let G=j;G>=0;G=d[G])M[G].add(q)};p.forEach((j,q)=>{T(q,j.cells[0]),T(q,j.cells[2])});for(let j of t.cards){let q=k[j.cell[0]][j.cell[1]];q.length&&T(q[q.length-1],j.cell[0])}let S=p.map(()=>new Map);for(let j of p.map((q,G)=>G).sort((q,G)=>m(q)-m(G)||q-G)){let q=p[j].cells,G=[...M[j]].sort((ce,pe)=>ce-pe);if(d[j]<0&&!d.includes(j)&&G.length===q[2]-q[0]+1){for(let ce of G)S[j].set(ce,v(w,q[0],q[2],ce));continue}let Q=d[j]>=0?S[d[j]].get(G[0]):w(G[0]);S[j].set(G[0],Q);for(let ce=1;ce<G.length;ce++){let pe=0;for(let Y=q[1];Y<=q[3];Y++)pe=Math.max(pe,u(R(k[G[ce-1]][Y],j),R(k[G[ce]][Y],j),!1));Q+=s+Math.max(i,pe),S[j].set(G[ce],Q)}}let N=(j,q)=>{let G=k[j][q],Q=G.length?G[G.length-1]:-1;return Q>=0?[S[Q].get(j),A[Q].get(q)]:[w(j),$(q)]},z=p.map((j,q)=>q).sort((j,q)=>m(q)-m(j)||j-q),K=new Array(p.length);for(let j of z){let q=p[j].cells,G=[],Q=[];for(let Y of t.cards){let ie=k[Y.cell[0]][Y.cell[1]];ie[ie.length-1]===j&&(G.push(S[j].get(Y.cell[0])),Q.push(A[j].get(Y.cell[1])))}let ce=Y=>Y.cell[0]>=q[0]&&Y.cell[0]<=q[2]&&Y.cell[1]>=q[1]&&Y.cell[1]<=q[3];for(let Y of[q[1],q[3]])t.cards.some(ie=>ie.cell[1]===Y&&ce(ie))||Q.push(A[j].get(Y));for(let Y of[q[0],q[2]])t.cards.some(ie=>ie.cell[0]===Y&&ce(ie))||G.push(S[j].get(Y));let pe={l:G.length?Math.min(...G):1/0,t:Q.length?Math.min(...Q):1/0,r:G.length?Math.max(...G)+s:-1/0,b:Q.length?Math.max(...Q)+r:-1/0};p.forEach((Y,ie)=>{if(d[ie]!==j)return;let Ae=K[ie];pe.l=Math.min(pe.l,Ae.l),pe.t=Math.min(pe.t,Ae.t),pe.r=Math.max(pe.r,Ae.r),pe.b=Math.max(pe.b,Ae.b)}),K[j]={l:pe.l-n,t:pe.t-n,r:pe.r+n,b:pe.b+n+a}}let J=t.cards.map(j=>N(j.cell[0],j.cell[1])),Z=t.cards.map(j=>{let q=k[j.cell[0]][j.cell[1]];return q.length?q[q.length-1]:-1}),L=(j,q)=>{for(let G=j;G>=0;G=d[G])if(G===q)return!0;return!1},U=(j,q)=>{t.cards.forEach((G,Q)=>{Z[Q]>=0&&L(Z[Q],j)&&(J[Q]=[J[Q][0]+q,J[Q][1]])}),p.forEach((G,Q)=>{L(Q,j)&&(K[Q]={...K[Q],l:K[Q].l+q,r:K[Q].r+q})})},H=j=>{let q=[],G=[],Q=[],ce=[];t.cards.forEach((I,V)=>{Z[V]===j&&(q.push(J[V][0]),Q.push(J[V][0]+s),G.push(J[V][1]),ce.push(J[V][1]+r))}),p.forEach((I,V)=>{d[V]===j&&(q.push(K[V].l),Q.push(K[V].r),G.push(K[V].t),ce.push(K[V].b))});let pe=K[j],Y=Math.min(...q,pe.l+n),ie=Math.max(...Q,pe.r-n),Ae=Math.min(...G,pe.t+n),De=Math.max(...ce,pe.b-n-a);K[j]={l:Y-n,t:Ae-n,r:ie+n,b:De+n+a}};for(let j of z)if(d[j]<0&&!d.includes(j))H(j);else{let G=[];t.cards.forEach((ie,Ae)=>{Z[Ae]===j&&G.push({l:J[Ae][0],r:J[Ae][0]+s,t:J[Ae][1],b:J[Ae][1]+r,card:Ae})}),p.forEach((ie,Ae)=>{d[Ae]===j&&G.push({...K[Ae],panel:Ae})}),G.sort((ie,Ae)=>ie.l-Ae.l||ie.t-Ae.t);let Q=Math.min(...G.map(ie=>ie.l)),ce=[];for(let ie of G){let Ae=Q;for(let I of ce)I.t<ie.b&&ie.t<I.b&&I.r<=ie.l+1e-6&&(Ae=Math.max(Ae,I.r+(I.card!==void 0&&ie.card!==void 0?i:f)));let De=Ae-ie.l;De<-1e-6&&(ie.card!==void 0?J[ie.card]=[J[ie.card][0]+De,J[ie.card][1]]:U(ie.panel,De),ie.l+=De,ie.r+=De),ce.push(ie)}let pe=G.map(ie=>ie.l),Y=G.map(ie=>ie.r);K[j]={...K[j],l:Math.min(...pe)-n,r:Math.max(...Y)+n}}return{prect:K,parentIx:d,depthOf:m,pos:N,cardAt:j=>J[j]}}function Hr(t,e,s={}){if(s.wrap){let{wrap:E,..._}=s;return Hr(Dh(t,e,E.aspect,_),e,_)}let r=Ya(t);if(r.length)throw new Error(`the board has ${r.length} error${r.length>1?"s":""}:
287
+ `,Ya=eo+Uc+to;var Hc=t=>({data:t,locate:()=>({line:0,col:0}),span:()=>{},diags:[]});function Wa(t,e,s,r=Hc(t),i,o={},n=[]){let a=_s(Tr(e),t.roles,t.kinds),f=[],p=new Map;return t.scenes.forEach((c,l)=>{let d=`/scenes/${l}`;if(p.has(c.id)){let u=r.locate(d+"/id");n.push({severity:"error",message:`duplicate scene id "${c.id}"`,line:u.line,col:u.col,path:d+"/id"})}p.set(c.id,l);let m={...t.grid,...c.grid,...o.snap?{snap:o.snap}:{}},h=Nr(c,d,r,a,s,t.roles,m.snap);n.push(...h.diags);let y=Sa(c,d,h,r,new Set(Object.keys(a.kinds)),m.snap);n.push(...y.diags);let g=Ha(c,d,h,y.routes,r,a);n.push(...g.diags),n.push(...qh(c,d,s,r));let k=Fr({scene:c,layout:h,routes:y.routes,steps:g,theme:a,id:c.id,gridStep:m.step??m.snap??1});for(let u of k.warnings){let b=r.locate(u.path);n.push({severity:"warning",message:u.message,line:b.line,col:b.col,path:u.path})}f.push({id:c.id,raw:c,layout:h,routes:y.routes,steps:g,rendered:k,grid:m,assemble:c.assemble??t.assemble??!1})}),n.sort((c,l)=>c.line-l.line||c.col-l.col),{ok:!n.some(c=>c.severity==="error"),diags:n,doc:t,theme:a,catalog:s,scenes:f,parsed:r,source:i}}function qh(t,e,s,r){let i=[],o=(a,f)=>{let p=r.locate(a);i.push({severity:"warning",message:f,line:p.line,col:p.col,path:a})},n=(a,f)=>{a.nodes?.forEach((p,c)=>{let l=`${f}/nodes/${c}`;(p.deco??Tn(s,p.asset).deco??[]).forEach((d,m)=>{typeof d=="object"&&d.icon&&!ji(d.icon)&&o(p.deco?`${l}/deco/${m}/icon`:l,`node "${p.id}": no icon "${d.icon}" is registered here, so it is drawn as a placeholder`)}),p.face!==void 0&&!tr(p.face)&&o(`${l}/face`,`node "${p.id}": no screen face "${p.face}" is registered here, so it is drawn as a placeholder`)}),a.regions?.forEach((p,c)=>n(p,`${f}/regions/${c}`))};return n(t,e),i}function vf(t,e){let s=t/(Ct*ct),r=2*e/ct;return[(s+r)/2,(r-s)/2]}function Mf(t,e){let s=t.layout.byId.get(e);if(!s)return;let r=s.parent?[s.parent.box.x0,s.parent.box.y0]:[0,0];return[s.box.x0-r[0],s.box.y0-r[1]]}function Pf(t){let e=[];for(let s of[t.x0,t.x1])for(let r of[t.y0,t.y1])for(let i of[t.z0,t.z1])e.push(Re(s,r,i));return Vh(e)}function Of(t){return[[t.x0,t.y0],[t.x1,t.y0],[t.x1,t.y1],[t.x0,t.y1]].map(([e,s])=>Re(e,s,t.z0))}function Vh(t){let e=[...new Map(t.map(o=>[`${o[0].toFixed(3)},${o[1].toFixed(3)}`,o])).values()].sort((o,n)=>o[0]-n[0]||o[1]-n[1]);if(e.length<3)return e;let s=(o,n,a)=>(n[0]-o[0])*(a[1]-o[1])-(n[1]-o[1])*(a[0]-o[0]),r=[],i=[];for(let o of e){for(;r.length>=2&&s(r[r.length-2],r[r.length-1],o)<=1e-9;)r.pop();r.push(o)}for(let o of[...e].reverse()){for(;i.length>=2&&s(i[i.length-2],i[i.length-1],o)<=1e-9;)i.pop();i.push(o)}return[...r.slice(0,-1),...i.slice(0,-1)]}var Af=(t,e)=>e?.padding??Ot(t,e?.kind)?.pad??0;function Tf(t,e,s,r,i){let o=c=>Math.round(c/s)*s,n=o(t[0]+e[0]),a=o(t[1]+e[1]),f={left:!1,right:!1,top:!1,bottom:!1};if(i){let c=Math.ceil(i.pad/s-1e-9)*s,l=Math.floor((i.w-i.pad-r[0])/s+1e-9)*s,d=Math.floor((i.d-i.pad-r[1])/s+1e-9)*s;n<c&&(n=c,f.left=!0),l>=c&&n>l&&(n=l,f.right=!0),a<c&&(a=c,f.top=!0),d>=c&&a>d&&(a=d,f.bottom=!0)}let p=c=>Math.round(c*1e3)/1e3;return{at:[p(n),p(a)],delta:[p(n-t[0]),p(a-t[1])],clamped:f}}function Ja(t,e){return e.some(r=>t.x0<r.x1-1e-6&&t.x1>r.x0+1e-6&&t.y0<r.y1-1e-6&&t.y1>r.y0+1e-6)}var Wc=Object.freeze({W:178,H:58,GX:44,GY:44,PAD:22,TITLE:30,CH:96,cardRx:9,panelRx:14,bend:70,overlap:400,crossPanel:300,border:120,nearEdge:200,margin:16}),Jc={name:{key:"sans600_12",size:13},sub:{key:"sans400_13",size:10},title:{key:"sans700_13",size:12,spacing:.02},titleSub:{key:"sans400_13",size:10.5},label:{key:"sans600_12",size:10.5}},Ef=(t,e)=>On(t,Jc[e]);function Xa(t){let e=[],s=new Map,r=(f,p)=>{if(typeof p!="string"||!p){e.push(`${f} has no id`);return}let c=s.get(p);c?e.push(`duplicate id "${p}": a ${c} and a ${f} (cards and panels share one set of ids)`):s.set(p,f)};for(let f of t.cards)r("card",f.id),(!Array.isArray(f.cell)||f.cell.length!==2||!f.cell.every(p=>Number.isInteger(p)&&p>=0))&&e.push(`card "${f.id}": cell must be [column, row], whole numbers from 0`);for(let f of t.panels??[]){r("panel",f.id);let p=f.cells;(!Array.isArray(p)||p.length!==4||!p.every(c=>Number.isInteger(c)&&c>=0)||p[2]<p[0]||p[3]<p[1])&&e.push(`panel "${f.id}": cells must be [c0, r0, c1, r1] with c0 \u2264 c1 and r0 \u2264 r1`)}let i=new Map;for(let f of t.cards){let p=String(f.cell);i.has(p)?e.push(`cards "${i.get(p)}" and "${f.id}" are both at cell [${p}]`):i.set(p,f.id)}let o=(t.panels??[]).filter(f=>Array.isArray(f.cells)&&f.cells.length===4);for(let f=0;f<o.length;f++)for(let p=f+1;p<o.length;p++){let c=o[f].cells,l=o[p].cells;c[0]<=l[2]&&l[0]<=c[2]&&c[1]<=l[3]&&l[1]<=c[3]&&!Yc(c,l)&&!Yc(l,c)&&e.push(`panels "${o[f].id}" and "${o[p].id}" overlap without one holding the other`)}let n=new Set([...t.cards.map(f=>f.id),...o.map(f=>f.id)]),a=new Set(o.map(f=>f.id));return(t.links??[]).forEach((f,p)=>{let c=`link ${f.id?`"${f.id}"`:p}`;for(let l of["a","b"])n.has(f[l])||e.push(`${c}: ${l} "${f[l]}" is no card or panel`);for(let l of["aOn","bOn"])f[l]!==void 0&&!a.has(f[l])&&e.push(`${c}: ${l} "${f[l]}" is no panel`);f.id!==void 0&&r("link",f.id)}),e}var Yc=(t,e)=>t[0]>=e[0]&&t[2]<=e[2]&&t[1]>=e[1]&&t[3]<=e[3];function no(t,e){let{W:s,H:r,GX:i,GY:o,PAD:n,TITLE:a,CH:f}=e,p=t.panels??[],c=L=>(L[2]-L[0]+1)*(L[3]-L[1]+1),l=(L,q)=>{let G=p[L].cells,X=p[q].cells;return Yc(X,G)?c(G)>c(X)||L<q:!1},d=p.map((L,q)=>{let G=-1;return p.forEach((X,ce)=>{ce!==q&&l(ce,q)&&(G<0||l(G,ce))&&(G=ce)}),G}),m=L=>d[L]<0?0:1+m(d[L]),h=(L,q)=>{let G=-1;p.forEach((ce,le)=>{let H=ce.cells;L>=H[0]&&L<=H[2]&&q>=H[1]&&q<=H[3]&&(G<0||l(G,le))&&(G=le)});let X=[];for(let ce=G;ce>=0;ce=d[ce])X.unshift(ce);return X},y=Math.max(1,...t.cards.map(L=>L.cell[0]+1),...p.map(L=>L.cells[2]+1)),g=Math.max(1,...t.cards.map(L=>L.cell[1]+1),...p.map(L=>L.cells[3]+1)),k=[];for(let L=0;L<y;L++){k.push([]);for(let q=0;q<g;q++)k[L].push(h(L,q))}let u=(L,q,G)=>{let X=L.filter(le=>!q.includes(le)),ce=q.filter(le=>!L.includes(le));return!X.length&&!ce.length?0:X.length*(n+(G?a:0))+ce.length*n+f},b=new Array(y+1).fill(0),x=new Array(g+1).fill(0);for(let L=0;L<g;L++)for(let q=1;q<y;q++){let G=u(k[q-1][L],k[q][L],!1);G&&(b[q]=Math.max(b[q],G-i))}for(let L=0;L<y;L++)for(let q=1;q<g;q++){let G=u(k[L][q-1],k[L][q],!0);G&&(x[q]=Math.max(x[q],G-o))}let w=L=>{let q=L*(s+i);for(let G=1;G<=L;G++)q+=b[G];return q},$=L=>{let q=L*(r+o);for(let G=1;G<=L;G++)q+=x[G];return q},S=(L,q,G,X)=>G===q?L(q):L(q)+(X-q)*(L(G)-L(q))/(G-q),O=p.map(()=>new Set),z=(L,q)=>{for(let G=L;G>=0;G=d[G])O[G].add(q)};p.forEach((L,q)=>{z(q,L.cells[1]),z(q,L.cells[3])});for(let L of t.cards){let q=k[L.cell[0]][L.cell[1]];q.length&&z(q[q.length-1],L.cell[1])}let A=p.map(()=>new Map),R=(L,q)=>L.slice(L.indexOf(q)+1);for(let L of p.map((q,G)=>G).sort((q,G)=>m(q)-m(G)||q-G)){let q=p[L].cells,G=[...O[L]].sort((ce,le)=>ce-le),X=d[L]>=0?A[d[L]].get(G[0]):$(G[0]);A[L].set(G[0],X);for(let ce=1;ce<G.length;ce++){let le=0;for(let H=q[0];H<=q[2];H++)le=Math.max(le,u(R(k[H][G[ce-1]],L),R(k[H][G[ce]],L),!0));X+=r+Math.max(o,le),A[L].set(G[ce],X)}}let P=p.map(()=>new Set),E=(L,q)=>{for(let G=L;G>=0;G=d[G])P[G].add(q)};p.forEach((L,q)=>{E(q,L.cells[0]),E(q,L.cells[2])});for(let L of t.cards){let q=k[L.cell[0]][L.cell[1]];q.length&&E(q[q.length-1],L.cell[0])}let v=p.map(()=>new Map);for(let L of p.map((q,G)=>G).sort((q,G)=>m(q)-m(G)||q-G)){let q=p[L].cells,G=[...P[L]].sort((ce,le)=>ce-le);if(d[L]<0&&!d.includes(L)&&G.length===q[2]-q[0]+1){for(let ce of G)v[L].set(ce,S(w,q[0],q[2],ce));continue}let X=d[L]>=0?v[d[L]].get(G[0]):w(G[0]);v[L].set(G[0],X);for(let ce=1;ce<G.length;ce++){let le=0;for(let H=q[1];H<=q[3];H++)le=Math.max(le,u(R(k[G[ce-1]][H],L),R(k[G[ce]][H],L),!1));X+=s+Math.max(i,le),v[L].set(G[ce],X)}}let N=(L,q)=>{let G=k[L][q],X=G.length?G[G.length-1]:-1;return X>=0?[v[X].get(L),A[X].get(q)]:[w(L),$(q)]},C=p.map((L,q)=>q).sort((L,q)=>m(q)-m(L)||L-q),V=new Array(p.length);for(let L of C){let q=p[L].cells,G=[],X=[];for(let H of t.cards){let oe=k[H.cell[0]][H.cell[1]];oe[oe.length-1]===L&&(G.push(v[L].get(H.cell[0])),X.push(A[L].get(H.cell[1])))}let ce=H=>H.cell[0]>=q[0]&&H.cell[0]<=q[2]&&H.cell[1]>=q[1]&&H.cell[1]<=q[3];for(let H of[q[1],q[3]])t.cards.some(oe=>oe.cell[1]===H&&ce(oe))||X.push(A[L].get(H));for(let H of[q[0],q[2]])t.cards.some(oe=>oe.cell[0]===H&&ce(oe))||G.push(v[L].get(H));let le={l:G.length?Math.min(...G):1/0,t:X.length?Math.min(...X):1/0,r:G.length?Math.max(...G)+s:-1/0,b:X.length?Math.max(...X)+r:-1/0};p.forEach((H,oe)=>{if(d[oe]!==L)return;let Ae=V[oe];le.l=Math.min(le.l,Ae.l),le.t=Math.min(le.t,Ae.t),le.r=Math.max(le.r,Ae.r),le.b=Math.max(le.b,Ae.b)}),V[L]={l:le.l-n,t:le.t-n,r:le.r+n,b:le.b+n+a}}let Y=t.cards.map(L=>N(L.cell[0],L.cell[1])),Z=t.cards.map(L=>{let q=k[L.cell[0]][L.cell[1]];return q.length?q[q.length-1]:-1}),j=(L,q)=>{for(let G=L;G>=0;G=d[G])if(G===q)return!0;return!1},K=(L,q)=>{t.cards.forEach((G,X)=>{Z[X]>=0&&j(Z[X],L)&&(Y[X]=[Y[X][0]+q,Y[X][1]])}),p.forEach((G,X)=>{j(X,L)&&(V[X]={...V[X],l:V[X].l+q,r:V[X].r+q})})},U=L=>{let q=[],G=[],X=[],ce=[];t.cards.forEach((I,se)=>{Z[se]===L&&(q.push(Y[se][0]),X.push(Y[se][0]+s),G.push(Y[se][1]),ce.push(Y[se][1]+r))}),p.forEach((I,se)=>{d[se]===L&&(q.push(V[se].l),X.push(V[se].r),G.push(V[se].t),ce.push(V[se].b))});let le=V[L],H=Math.min(...q,le.l+n),oe=Math.max(...X,le.r-n),Ae=Math.min(...G,le.t+n),_e=Math.max(...ce,le.b-n-a);V[L]={l:H-n,t:Ae-n,r:oe+n,b:_e+n+a}};for(let L of C)if(d[L]<0&&!d.includes(L))U(L);else{let G=[];t.cards.forEach((oe,Ae)=>{Z[Ae]===L&&G.push({l:Y[Ae][0],r:Y[Ae][0]+s,t:Y[Ae][1],b:Y[Ae][1]+r,card:Ae})}),p.forEach((oe,Ae)=>{d[Ae]===L&&G.push({...V[Ae],panel:Ae})}),G.sort((oe,Ae)=>oe.l-Ae.l||oe.t-Ae.t);let X=Math.min(...G.map(oe=>oe.l)),ce=[];for(let oe of G){let Ae=X;for(let I of ce)I.t<oe.b&&oe.t<I.b&&I.r<=oe.l+1e-6&&(Ae=Math.max(Ae,I.r+(I.card!==void 0&&oe.card!==void 0?i:f)));let _e=Ae-oe.l;_e<-1e-6&&(oe.card!==void 0?Y[oe.card]=[Y[oe.card][0]+_e,Y[oe.card][1]]:K(oe.panel,_e),oe.l+=_e,oe.r+=_e),ce.push(oe)}let le=G.map(oe=>oe.l),H=G.map(oe=>oe.r);V[L]={...V[L],l:Math.min(...le)-n,r:Math.max(...H)+n}}return{prect:V,parentIx:d,depthOf:m,pos:N,cardAt:L=>Y[L]}}function Hr(t,e,s={}){if(s.wrap){let{wrap:T,..._}=s;return Hr(Kh(t,e,T.aspect,_),e,_)}let r=Xa(t);if(r.length)throw new Error(`the board has ${r.length} error${r.length>1?"s":""}:
288
288
  ${r.join(`
289
- `)}`);let i={...Hc,...s},{W:o,H:n}=i,a=E=>Math.round(E*10)/10,f=[],p=t.panels??[],{prect:c,parentIx:l,depthOf:d,cardAt:m}=to(t,i),h=p.map((E,_)=>{let D=c[_],le=e(E.label??"","title")+(E.sub?e(E.sub,"titleSub"):0);return{...E,rect:D,titleAt:[a(D.l+16),a(D.b-15)],depth:d(_),parent:l[_]>=0?p[l[_]].id:void 0,title:{l:D.l+10,r:D.l+22+le,t:D.b-30,b:D.b-6}}}),y=t.cards.map(E=>{let[_,D]=m(t.cards.indexOf(E));return{...E,rect:{l:_,t:D,r:_+o,b:D+n}}}),g=new Map;h.forEach(E=>g.set(E.id,E.rect)),y.forEach(E=>g.set(E.id,E.rect));let k=y.map(E=>E.rect),u=h.map(E=>E.rect),b=h.filter(E=>E.label).map(E=>E.title),x=(E,_)=>E.l>=_.l&&E.r<=_.r&&E.t>=_.t&&E.b<=_.b,w=(E,_,D,le)=>Math.min(E[0],_[0])<D.r+le&&Math.max(E[0],_[0])>D.l-le&&Math.min(E[1],_[1])<D.b+le&&Math.max(E[1],_[1])>D.t-le,$=(E,_)=>u.reduce((D,le)=>{if(E[0]===_[0]){let ue=Math.min(E[1],_[1]),Ce=Math.max(E[1],_[1]);E[0]>le.l&&E[0]<le.r&&(D+=[le.t,le.b].filter(oe=>oe>ue+1&&oe<Ce-1).length)}else{let ue=Math.min(E[0],_[0]),Ce=Math.max(E[0],_[0]);E[1]>le.t&&E[1]<le.b&&(D+=[le.l,le.r].filter(oe=>oe>ue+1&&oe<Ce-1).length)}return D},0),v=(E,_)=>u.some(D=>E[1]===_[1]?[D.t,D.b].some(le=>Math.abs(E[1]-le)<16&&Math.max(E[0],_[0])>D.l&&Math.min(E[0],_[0])<D.r):[D.l,D.r].some(le=>Math.abs(E[0]-le)<16&&Math.max(E[1],_[1])>D.t&&Math.min(E[1],_[1])<D.b)),O=(E,_,D,le)=>u.filter(ue=>ue!==D&&ue!==le&&!x(D,ue)&&!x(le,ue)&&w(E,_,{l:ue.l+3,r:ue.r-3,t:ue.t+3,b:ue.b-3},0)).length,C=[],A=new Map,R=new Map,M=(E,_)=>{C.push([E,_]);let[D,le]=E[1]===_[1]?[A,E[1]]:E[0]===_[0]?[R,E[0]]:[void 0,0];if(!D)return;let ue=Math.floor(le/6);(D.get(ue)??D.set(ue,[]).get(ue)).push([E,_])},T=(E,_)=>{let D=E[1]===_[1];if(!D&&E[0]!==_[0])return 0;let le=D?1:0,ue=D?0:1,Ce=D?A:R,oe=Math.floor(E[le]/6),Le=Math.min(E[ue],_[ue]),Pe=Math.max(E[ue],_[ue]),xe=0;for(let _e=oe-1;_e<=oe+1;_e++)for(let[Ue,mt]of Ce.get(_e)??[])Math.abs(E[le]-Ue[le])<6&&Math.min(Pe,Math.max(Ue[ue],mt[ue]))-Math.max(Le,Math.min(Ue[ue],mt[ue]))>0&&xe++;return xe},S=[...g.values()],N=Math.min(...S.map(E=>E.l)),z=Math.max(...S.map(E=>E.r)),K=Math.min(...S.map(E=>E.t)),J=Math.max(...S.map(E=>E.b)),Z=(E,_)=>{let D=(E+_)/2;return[D,D-12,D+12,D-24,D+24]},L=(()=>{let E=[];return k.forEach(_=>k.forEach(D=>{D.t>_.b&&D.l<_.r+400&&D.r>_.l-400&&E.push(...Z(_.b,D.t))})),E.push(K-22,K-34,J+22,J+34),[...new Set(E.map(Math.round))]})(),U=(()=>{let E=[];return k.forEach(_=>k.forEach(D=>{D.l>_.r&&E.push(...Z(_.r,D.l))})),E.push(N-22,N-34,z+22,z+34),[...new Set(E.map(Math.round))]})(),H=new Map,ee=new Map,j=E=>{let _=H.get(E);return _||H.set(E,_=k.filter(D=>E<D.b+6&&E>D.t-6)),_},q=E=>{let _=ee.get(E);return _||ee.set(E,_=k.filter(D=>E<D.r+6&&E>D.l-6)),_},G=i.crossPanel/i.overlap,Q=i.border/i.overlap,ce=i.nearEdge/i.overlap;function pe(E,_,D,le,ue=!0){let Ce=0;for(let xe=1;xe<E.length;xe++)Ce+=Math.abs(E[xe-1][0]-E[xe][0])+Math.abs(E[xe-1][1]-E[xe][1]);let oe=Ce+i.bend*(E.length-2);if(oe>=le)return oe;let Le=0,Pe=0;for(let xe=1;xe<E.length;xe++){let _e=E[xe-1],Ue=E[xe];if(ue){if(ae(_e,Ue,_,D)||v(_e,Ue))return 1/0;continue}for(let mt of _e[1]===Ue[1]?j(_e[1]):q(_e[0]))mt!==_&&mt!==D&&w(_e,Ue,mt,6)&&Le++;for(let mt of b)w(_e,Ue,mt,2)&&Le++}for(let xe=1;xe<E.length;xe++){let _e=E[xe-1],Ue=E[xe];if(Pe+=T(_e,Ue)+G*O(_e,Ue,_,D)+Q*$(_e,Ue),v(_e,Ue)&&(Pe+=ce),oe+i.overlap*Pe>=le)return oe+i.overlap*Pe}return oe+i.overlap*Pe+Le*1e5}let Y=E=>(E.l+E.r)/2,ie=E=>(E.t+E.b)/2,Ae=[0,-22,22,-44,44],De={bc:1/0},I=(E,_,D,le)=>Math.abs(E-D)+Math.abs(_-le),V=(E,_,D,le,ue,Ce,oe,Le)=>{let Pe=0;return Pe+=I(E,_,D,le),Pe+=I(D,le,ue,Ce),Pe+=I(ue,Ce,oe,Le),Pe+i.bend*2},te=(E,_,D,le,ue,Ce,oe,Le,Pe,xe)=>{let _e=0;return _e+=I(E,_,D,le),_e+=I(D,le,ue,Ce),_e+=I(ue,Ce,oe,Le),_e+=I(oe,Le,Pe,xe),_e+i.bend*3},ae=(E,_,D,le)=>{for(let ue of E[1]===_[1]?j(E[1]):q(E[0]))if(ue!==D&&ue!==le&&w(E,_,ue,6))return!0;for(let ue of b)if(w(E,_,ue,2))return!0;return v(E,_)};function Te(E,_,D,le){let ue=Math.max(E.l,_.l),Ce=Math.min(E.r,_.r);if(Ce-ue>24)for(let at of Ae){let ht=(ue+Ce)/2+at;ht>ue+8&&ht<Ce-8&&D(_.t>=E.b?[[ht,E.b],[ht,_.t]]:[[ht,E.t],[ht,_.b]])}let oe=Math.max(E.t,_.t),Le=Math.min(E.b,_.b);if(Le-oe>16)for(let at of[0,-10,10]){let ht=(oe+Le)/2+at;D(_.l>=E.r?[[E.r,ht],[_.l,ht]]:[[E.l,ht],[_.r,ht]])}let Pe=U.length,xe=L.length,_e=new Uint8Array(Ae.length*xe),Ue=new Uint8Array(Ae.length*xe),mt=new Uint8Array(Ae.length*Pe),ys=new Uint8Array(Ae.length*Pe),kt=(at,ht,Ln,Kt)=>le?(at[ht]||(at[ht]=ae(Ln,Kt,E,_)?2:1),at[ht]===1):!0;Ae.forEach((at,ht)=>Ae.forEach((Ln,Kt)=>{let _t=Y(E)+at,Dt=Y(_)+Ln,Gt=ie(E)+at/3,$t=ie(_)+Ln/3;L.forEach((We,_n)=>{let yt=We>E.b?E.b:We<E.t?E.t:null,cn=We>_.b?_.b:We<_.t?_.t:null;yt!==null&&cn!==null&&V(_t,yt,_t,We,Dt,We,Dt,cn)<De.bc&&kt(_e,ht*xe+_n,[_t,yt],[_t,We])&&kt(Ue,Kt*xe+_n,[Dt,We],[Dt,cn])&&D([[_t,yt],[_t,We],[Dt,We],[Dt,cn]])}),U.forEach((We,_n)=>{let yt=We>E.r?E.r:We<E.l?E.l:null,cn=We>_.r?_.r:We<_.l?_.l:null;yt!==null&&cn!==null&&V(yt,Gt,We,Gt,We,$t,cn,$t)<De.bc&&kt(mt,ht*Pe+_n,[yt,Gt],[We,Gt])&&kt(ys,Kt*Pe+_n,[We,$t],[cn,$t])&&D([[yt,Gt],[We,Gt],[We,$t],[cn,$t]])}),at===0&&Ln===0&&U.forEach((We,_n)=>L.forEach((yt,cn)=>{let F=We>E.r?E.r:We<E.l?E.l:null,se=yt>_.b?_.b:yt<_.t?_.t:null;F!==null&&se!==null&&te(F,Gt,We,Gt,We,yt,Dt,yt,Dt,se)<De.bc&&kt(mt,ht*Pe+_n,[F,Gt],[We,Gt])&&kt(Ue,Kt*xe+cn,[Dt,yt],[Dt,se])&&D([[F,Gt],[We,Gt],[We,yt],[Dt,yt],[Dt,se]]);let he=yt>E.b?E.b:yt<E.t?E.t:null,ge=We>_.r?_.r:We<_.l?_.l:null;he!==null&&ge!==null&&te(_t,he,_t,yt,We,yt,We,$t,ge,$t)<De.bc&&kt(_e,ht*xe+cn,[_t,he],[_t,yt])&&kt(ys,Kt*Pe+_n,[We,$t],[ge,$t])&&D([[_t,he],[_t,yt],[We,yt],[We,$t],[ge,$t]])}));let ur=Y(E)<_.l?_.l:Y(E)>_.r?_.r:null,Zt=$t<E.t?E.t:$t>E.b?E.b:null;ur!==null&&Zt!==null&&D([[_t,Zt],[_t,$t],[ur,$t]]);let Zs=ie(E)<_.t?_.t:ie(E)>_.b?_.b:null,hr=Dt<E.l?E.l:Dt>E.r?E.r:null;Zs!==null&&hr!==null&&D([[hr,Gt],[Dt,Gt],[Dt,Zs]])}))}function be(E,_,D,le){for(let ue of Ae){let Ce=Y(E)+ue,oe=ie(E)+ue/3,Le=[[[Ce,E.t],[Ce,_.t]],[[E.r,oe],[_.r,oe]],[[Ce,E.b],[Ce,_.b]],[[E.l,oe],[_.l,oe]]];for(let Pe of Le)le(D?[Pe[1],Pe[0]]:Pe)}}let ze=(E,_,D,le)=>{let ue=null;return De.bc=1/0,E(Ce=>{let oe=pe(Ce,_,D,De.bc,le);oe<De.bc&&(De.bc=oe,ue=Ce)},le),ue},Ie=[],ke=E=>u.some(_=>[_.l,_.r].some(D=>E.l<D+3&&E.r>D-3&&E.b>_.t&&E.t<_.b)||[_.t,_.b].some(D=>E.t<D+3&&E.b>D-3&&E.r>_.l&&E.l<_.r)),Be=E=>C.filter(([_,D])=>w(_,D,E,1)).length,Qe=E=>b.some(_=>E.l<_.r&&E.r>_.l&&E.t<_.b&&E.b>_.t),Ke=E=>k.filter(_=>E.l<_.r+3&&E.r>_.l-3&&E.t<_.b+3&&E.b>_.t-3).length,pt=E=>Ie.filter(_=>E.l<_.r+4&&E.r>_.l-4&&E.t<_.b+2&&E.b>_.t-2).length,P=E=>50*me(E)+3*Be(E)+(ke(E)?1:0)+(Qe(E)?5:0)+5*Ke(E)+5*pt(E),B=E=>Be(E)>0||ke(E)||Qe(E)||Ke(E)>0||pt(E)>0,W=[];(t.links??[]).forEach((E,_)=>{let D=E.id??`link-${_}`,le=g.get(E.aOn??E.a),ue=g.get(E.bOn??E.b);if(le===ue){f.push(`link "${D}" joins "${E.aOn??E.a}" to itself: not drawn`),W.push({...E,id:D,points:[],routed:!1});return}let Ce=x(le,ue)?Pe=>be(le,ue,!1,Pe):x(ue,le)?Pe=>be(ue,le,!0,Pe):(Pe,xe)=>Te(le,ue,Pe,xe),oe=ze(Ce,le,ue,!0),Le=!0;if(oe||(oe=ze(Ce,le,ue,!1),Le=!1,f.push(`link "${D}": no clear route; drawn the least bad way`)),!oe){W.push({...E,id:D,points:[],routed:!1});return}for(let Pe=1;Pe<oe.length;Pe++)M(oe[Pe-1],oe[Pe]);W.push({...E,id:D,points:oe,routed:Le})});let fe=[];for(let E=0;E<C.length;E++)for(let _=E+1;_<C.length;_++){let[D,le]=C[E],[ue,Ce]=C[_],oe=D[1]===le[1],Le=ue[1]===Ce[1];if(oe===Le)continue;let[Pe,xe]=oe?[[D,le],[ue,Ce]]:[[ue,Ce],[D,le]],_e=xe[0][0],Ue=Pe[0][1];_e>Math.min(Pe[0][0],Pe[1][0])&&_e<Math.max(Pe[0][0],Pe[1][0])&&Ue>Math.min(xe[0][1],xe[1][1])&&Ue<Math.max(xe[0][1],xe[1][1])&&fe.push([_e,Ue])}let me=E=>fe.filter(([_,D])=>_>E.l-2&&_<E.r+2&&D>E.t-2&&D<E.b+2).length;for(let E of W){let _=E,D=E.points;if(!_.label||!D.length)continue;let le=[];for(let xe=1;xe<D.length;xe++)le.push([D[xe-1],D[xe]]);let ue=xe=>Math.abs(xe[0][0]-xe[1][0])+Math.abs(xe[0][1]-xe[1][1]);le.sort((xe,_e)=>ue(_e)-ue(xe));let Ce=e(_.label,"label")+6,oe=null,Le=null,Pe=1/0;for(let[xe,_e]of le){let Ue=(xe[0]+_e[0])/2,mt=(xe[1]+_e[1])/2,ys=xe[1]===_e[1]?[0,-.3,.3,-.15,.15].flatMap(kt=>{let at=Ue+kt*Math.abs(xe[0]-_e[0]);return[[at,mt-6,"middle"],[at,mt+15,"middle"]]}):[0,-.3,.3].flatMap(kt=>{let at=mt+4+kt*Math.abs(xe[1]-_e[1]);return[[Ue+7,at,"start"],[Ue-7,at,"end"],[Ue+24,at,"start"],[Ue-24,at,"end"]]});for(let[kt,at,ht]of ys){let Ln=ht==="middle"?kt-Ce/2:ht==="end"?kt-Ce:kt,Kt={l:Ln,r:Ln+Ce,t:at-11,b:at+3};if(!B(Kt)){oe=[kt,at,ht,Kt];break}let _t=P(Kt);_t<Pe&&(Pe=_t,Le=[kt,at,ht,Kt])}if(oe)break}if(!oe&&Le&&(oe=Le),!oe){let[xe,_e]=le[0],Ue=(xe[0]+_e[0])/2,mt=(xe[1]+_e[1])/2-6;oe=[Ue,mt,"middle",{l:Ue-Ce/2,r:Ue+Ce/2,t:mt-11,b:mt+3}]}Ie.push(oe[3]),E.at={x:a(oe[0]),y:a(oe[1]),anchor:oe[2],box:oe[3],text:_.label}}let X=[],ne=[];for(let E of[...S,...Ie,...h.map(_=>_.title)])X.push(E.l,E.r),ne.push(E.t,E.b);for(let E of W)for(let _ of E.points)X.push(_[0]),ne.push(_[1]);let ye=i.margin,$e={l:Math.min(...X)-ye,t:Math.min(...ne)-ye,r:Math.max(...X)+ye,b:Math.max(...ne)+ye};return{cards:y,panels:h,links:W,bounds:$e,options:i,warnings:f}}function Af(t,e,s){let r=o=>e>=o.l&&e<=o.r&&s>=o.t&&s<=o.b,i=t.cards.find(o=>r(o.rect));return i?i.id:[...t.panels].sort((o,n)=>n.depth-o.depth).find(o=>r(o.rect))?.id}function Dh(t,e,s,r={}){let i=a=>{let f=Hr(a,e,r);return Math.max(f.bounds.r-f.bounds.l,(f.bounds.b-f.bounds.t)*s)},o=t,n=i(t);for(let a=0;a<12;a++){let f,p=n;for(let c of Bh(o)){if(Ya(c).length)continue;let l=i(c);l<p-.5&&(p=l,f=c)}if(!f)break;o=f,n=p}return o}function*Bh(t){let e=t.panels??[],s=(n,a)=>n[0]>=a[0]&&n[2]<=a[2]&&n[1]>=a[1]&&n[3]<=a[3],r=(n,a)=>n.every((f,p)=>f===a[p]),i=(n,a=-1)=>{let f=-1;return e.forEach((p,c)=>{c===a||!s(n,p.cells)||a>=0&&c>a&&r(p.cells,e[a].cells)||(f<0||s(p.cells,e[f].cells)&&(!r(p.cells,e[f].cells)||c>f))&&(f=c)}),f},o=n=>{let a=[];return e.forEach((f,p)=>{i(f.cells,p)===n&&a.push({range:[...f.cells],panel:p})}),t.cards.forEach((f,p)=>{let c=[f.cell[0],f.cell[1],f.cell[0],f.cell[1]];i(c)===n&&a.push({range:c,card:p})}),a};for(let n of[-1,...e.map((a,f)=>f)]){let a=o(n);if(n>=0&&!a.some(l=>l.panel!==void 0))continue;let f=l=>[l.range[1],l.range[3]],p=[];for(let l of[...a].sort((d,m)=>d.range[1]-m.range[1]||d.range[0]-m.range[0])){let d=p.find(m=>m.some(h=>f(h)[0]<=f(l)[1]&&f(l)[0]<=f(h)[1]));d?d.push(l):p.push([l])}let c=Math.max(...a.map(l=>l.range[3]));for(let l of p){l.sort((d,m)=>d.range[0]-m.range[0]);for(let d=1;d<l.length;d++){let m=l.slice(d),h=l[0].range[0],y=c+1,g=Math.min(...m.map($=>$.range[1])),k=Math.max(...m.map($=>$.range[3]))-g+1,u=t.cards.map($=>({...$,cell:[...$.cell]})),b=e.map($=>({...$,cells:[...$.cells]}));for(let $ of u)$.cell[1]>c&&($.cell[1]+=k);let x=new Set;for(let $=n;$>=0&&!x.has($);$=i(e[$].cells,$))x.add($);b.forEach(($,v)=>{$.cells[1]>c?($.cells[1]+=k,$.cells[3]+=k):(x.has(v)||$.cells[1]<=c&&$.cells[3]>c)&&($.cells[3]+=k)});let w=h;for(let $ of m){let v=w-$.range[0],O=y+($.range[1]-g)-$.range[1],C=A=>A[0]>=$.range[0]&&A[0]<=$.range[2]&&A[1]>=$.range[1]&&A[1]<=$.range[3];t.cards.forEach((A,R)=>{C([A.cell[0],A.cell[1]])&&(u[R].cell=[A.cell[0]+v,A.cell[1]+O])}),e.forEach((A,R)=>{s(A.cells,$.range)&&(b[R].cells=[A.cells[0]+v,A.cells[1]+O,A.cells[2]+v,A.cells[3]+O])}),w+=$.range[2]-$.range[0]+1}e.forEach(($,v)=>{let O=t.cards.map((C,A)=>s([C.cell[0],C.cell[1],C.cell[0],C.cell[1]],$.cells)?u[A].cell:void 0).filter(C=>!!C);O.length&&(b[v].cells=[Math.min(...O.map(C=>C[0])),Math.min(...O.map(C=>C[1])),Math.max(...O.map(C=>C[0])),Math.max(...O.map(C=>C[1]))])}),yield{cards:u,panels:b,links:t.links}}}}}function Wa(t,e=()=>!0){let s=t.layout.items.filter(v=>e(v.id)),r=t.layout.catalog,i=!t.layout.items.some(v=>v.type==="node"),o=v=>i?!v.children.some(O=>e(O.id)):v.type==="node"&&!v.children.some(O=>O.type==="node"&&e(O.id)),n=s.filter(o),a=v=>{let O=[];for(let C=v;C;C=C.parent)O.unshift(C);return O},f=new Map(n.map(v=>[v.id,a(v)])),p=(v,O)=>{let C=f.get(v.id),A=f.get(O.id),R=0;for(;R<C.length&&R<A.length&&C[R]===A[R];)R++;return[C[R].box,A[R].box]},c=1e-6,l=(v,O)=>{let[C,A]=p(v,O);return C.y1<=A.y0+c&&C.x0<A.x1-c&&A.x0<C.x1-c},d=(v,O)=>{let[C,A]=p(v,O);return C.x1<=A.x0+c&&C.y0<A.y1-c&&A.y0<C.y1-c},m=(v,O)=>{let C=new Map,A=[];for(let R of[...n].sort((M,T)=>O(M)-O(T))){let M=0;for(let T of A)C.get(T.id)+1>M&&v(T,R)&&(M=C.get(T.id)+1);C.set(R.id,M),A.push(R)}return C},h=m(l,v=>v.box.y0),y=m(d,v=>v.box.x0),g=Math.min(...n.map(v=>v.box.x1-v.box.x0))/2;for(let v of n)if(!v.parent)for(let O of n)O.parent&&O.box.x0<=v.box.x0+g&&y.set(v.id,Math.max(y.get(v.id),y.get(O.id)));let k=new Map;for(let v of n)k.set(v.id,[y.get(v.id),h.get(v.id)]);let u=new Map;for(let v of n){let O=k.get(v.id),C=u.get(String(O));if(C!==void 0&&C!==v.id){for(let[,A]of k)A[0]>O[0]&&A!==O&&A[0]++;O[0]++,u.clear();for(let A of n)u.set(String(k.get(A.id)),A.id)}else u.set(String(O),v.id)}let b=n.map(v=>{if(v.region){let A=v.region;return{id:v.id,label:A.label??v.id,sub:void 0,role:A.role??Ot(r,A.kind)?.role??"grey",ghost:A.ghost||void 0,cell:k.get(v.id)}}let O=v.node,C=An(r,O.asset);return{id:v.id,label:O.label??v.id,sub:O.sub,role:O.role??C.role,ghost:O.ghost||void 0,cell:k.get(v.id)}}),x=[];for(let v of s){if(o(v))continue;let O=[],C=S=>{for(let N of S.children){let z=k.get(N.id);z&&O.push(z),C(N)}};if(C(v),!O.length)continue;let A=O.map(S=>S[0]),R=O.map(S=>S[1]),M=v.type==="region"?v.region.label:v.node.label??v.id,T=v.type==="region"?v.region.role??Ot(r,v.region.kind)?.role:v.node.role??An(r,v.node.asset).role;x.push({id:v.id,label:M,sub:v.type==="node"?v.node.sub:void 0,role:T,cells:[Math.min(...A),Math.min(...R),Math.max(...A),Math.max(...R)]})}let w=new Set([...b.map(v=>v.id),...x.map(v=>v.id)]),$=[];for(let v of t.routes){if(!e(v.id))continue;let O=wn(v.raw.from).id,C=wn(v.raw.to).id;if(!w.has(O)||!w.has(C))continue;let A=typeof v.raw.label=="string"?v.raw.label:v.raw.label?.text;$.push({id:v.id,a:O,b:C,kind:v.kind,label:A})}return{cards:b,panels:x,links:$}}var qs={W:4,D:2,H:.9,GX:2,GY:2.4,PAD:.6,CH:2.2,PANEL_H:.3},Tf=`
289
+ `)}`);let i={...Wc,...s},{W:o,H:n}=i,a=T=>Math.round(T*10)/10,f=[],p=t.panels??[],{prect:c,parentIx:l,depthOf:d,cardAt:m}=no(t,i),h=p.map((T,_)=>{let B=c[_],pe=e(T.label??"","title")+(T.sub?e(T.sub,"titleSub"):0);return{...T,rect:B,titleAt:[a(B.l+16),a(B.b-15)],depth:d(_),parent:l[_]>=0?p[l[_]].id:void 0,title:{l:B.l+10,r:B.l+22+pe,t:B.b-30,b:B.b-6}}}),y=t.cards.map(T=>{let[_,B]=m(t.cards.indexOf(T));return{...T,rect:{l:_,t:B,r:_+o,b:B+n}}}),g=new Map;h.forEach(T=>g.set(T.id,T.rect)),y.forEach(T=>g.set(T.id,T.rect));let k=y.map(T=>T.rect),u=h.map(T=>T.rect),b=h.filter(T=>T.label).map(T=>T.title),x=(T,_)=>T.l>=_.l&&T.r<=_.r&&T.t>=_.t&&T.b<=_.b,w=(T,_,B,pe)=>Math.min(T[0],_[0])<B.r+pe&&Math.max(T[0],_[0])>B.l-pe&&Math.min(T[1],_[1])<B.b+pe&&Math.max(T[1],_[1])>B.t-pe,$=(T,_)=>u.reduce((B,pe)=>{if(T[0]===_[0]){let me=Math.min(T[1],_[1]),Ce=Math.max(T[1],_[1]);T[0]>pe.l&&T[0]<pe.r&&(B+=[pe.t,pe.b].filter(ae=>ae>me+1&&ae<Ce-1).length)}else{let me=Math.min(T[0],_[0]),Ce=Math.max(T[0],_[0]);T[1]>pe.t&&T[1]<pe.b&&(B+=[pe.l,pe.r].filter(ae=>ae>me+1&&ae<Ce-1).length)}return B},0),S=(T,_)=>u.some(B=>T[1]===_[1]?[B.t,B.b].some(pe=>Math.abs(T[1]-pe)<16&&Math.max(T[0],_[0])>B.l&&Math.min(T[0],_[0])<B.r):[B.l,B.r].some(pe=>Math.abs(T[0]-pe)<16&&Math.max(T[1],_[1])>B.t&&Math.min(T[1],_[1])<B.b)),O=(T,_,B,pe)=>u.filter(me=>me!==B&&me!==pe&&!x(B,me)&&!x(pe,me)&&w(T,_,{l:me.l+3,r:me.r-3,t:me.t+3,b:me.b-3},0)).length,z=[],A=new Map,R=new Map,P=(T,_)=>{z.push([T,_]);let[B,pe]=T[1]===_[1]?[A,T[1]]:T[0]===_[0]?[R,T[0]]:[void 0,0];if(!B)return;let me=Math.floor(pe/6);(B.get(me)??B.set(me,[]).get(me)).push([T,_])},E=(T,_)=>{let B=T[1]===_[1];if(!B&&T[0]!==_[0])return 0;let pe=B?1:0,me=B?0:1,Ce=B?A:R,ae=Math.floor(T[pe]/6),Le=Math.min(T[me],_[me]),Te=Math.max(T[me],_[me]),Se=0;for(let Fe=ae-1;Fe<=ae+1;Fe++)for(let[Ye,mt]of Ce.get(Fe)??[])Math.abs(T[pe]-Ye[pe])<6&&Math.min(Te,Math.max(Ye[me],mt[me]))-Math.max(Le,Math.min(Ye[me],mt[me]))>0&&Se++;return Se},v=[...g.values()],N=Math.min(...v.map(T=>T.l)),C=Math.max(...v.map(T=>T.r)),V=Math.min(...v.map(T=>T.t)),Y=Math.max(...v.map(T=>T.b)),Z=(T,_)=>{let B=(T+_)/2;return[B,B-12,B+12,B-24,B+24]},j=(()=>{let T=[];return k.forEach(_=>k.forEach(B=>{B.t>_.b&&B.l<_.r+400&&B.r>_.l-400&&T.push(...Z(_.b,B.t))})),T.push(V-22,V-34,Y+22,Y+34),[...new Set(T.map(Math.round))]})(),K=(()=>{let T=[];return k.forEach(_=>k.forEach(B=>{B.l>_.r&&T.push(...Z(_.r,B.l))})),T.push(N-22,N-34,C+22,C+34),[...new Set(T.map(Math.round))]})(),U=new Map,ee=new Map,L=T=>{let _=U.get(T);return _||U.set(T,_=k.filter(B=>T<B.b+6&&T>B.t-6)),_},q=T=>{let _=ee.get(T);return _||ee.set(T,_=k.filter(B=>T<B.r+6&&T>B.l-6)),_},G=i.crossPanel/i.overlap,X=i.border/i.overlap,ce=i.nearEdge/i.overlap;function le(T,_,B,pe,me=!0){let Ce=0;for(let Se=1;Se<T.length;Se++)Ce+=Math.abs(T[Se-1][0]-T[Se][0])+Math.abs(T[Se-1][1]-T[Se][1]);let ae=Ce+i.bend*(T.length-2);if(ae>=pe)return ae;let Le=0,Te=0;for(let Se=1;Se<T.length;Se++){let Fe=T[Se-1],Ye=T[Se];if(me){if(xe(Fe,Ye,_,B)||S(Fe,Ye))return 1/0;continue}for(let mt of Fe[1]===Ye[1]?L(Fe[1]):q(Fe[0]))mt!==_&&mt!==B&&w(Fe,Ye,mt,6)&&Le++;for(let mt of b)w(Fe,Ye,mt,2)&&Le++}for(let Se=1;Se<T.length;Se++){let Fe=T[Se-1],Ye=T[Se];if(Te+=E(Fe,Ye)+G*O(Fe,Ye,_,B)+X*$(Fe,Ye),S(Fe,Ye)&&(Te+=ce),ae+i.overlap*Te>=pe)return ae+i.overlap*Te}return ae+i.overlap*Te+Le*1e5}let H=T=>(T.l+T.r)/2,oe=T=>(T.t+T.b)/2,Ae=[0,-22,22,-44,44],_e={bc:1/0},I=(T,_,B,pe)=>Math.abs(T-B)+Math.abs(_-pe),se=(T,_,B,pe,me,Ce,ae,Le)=>{let Te=0;return Te+=I(T,_,B,pe),Te+=I(B,pe,me,Ce),Te+=I(me,Ce,ae,Le),Te+i.bend*2},ge=(T,_,B,pe,me,Ce,ae,Le,Te,Se)=>{let Fe=0;return Fe+=I(T,_,B,pe),Fe+=I(B,pe,me,Ce),Fe+=I(me,Ce,ae,Le),Fe+=I(ae,Le,Te,Se),Fe+i.bend*3},xe=(T,_,B,pe)=>{for(let me of T[1]===_[1]?L(T[1]):q(T[0]))if(me!==B&&me!==pe&&w(T,_,me,6))return!0;for(let me of b)if(w(T,_,me,2))return!0;return S(T,_)};function Ke(T,_,B,pe){let me=Math.max(T.l,_.l),Ce=Math.min(T.r,_.r);if(Ce-me>24)for(let lt of Ae){let ht=(me+Ce)/2+lt;ht>me+8&&ht<Ce-8&&B(_.t>=T.b?[[ht,T.b],[ht,_.t]]:[[ht,T.t],[ht,_.b]])}let ae=Math.max(T.t,_.t),Le=Math.min(T.b,_.b);if(Le-ae>16)for(let lt of[0,-10,10]){let ht=(ae+Le)/2+lt;B(_.l>=T.r?[[T.r,ht],[_.l,ht]]:[[T.l,ht],[_.r,ht]])}let Te=K.length,Se=j.length,Fe=new Uint8Array(Ae.length*Se),Ye=new Uint8Array(Ae.length*Se),mt=new Uint8Array(Ae.length*Te),ys=new Uint8Array(Ae.length*Te),kt=(lt,ht,_n,Kt)=>pe?(lt[ht]||(lt[ht]=xe(_n,Kt,T,_)?2:1),lt[ht]===1):!0;Ae.forEach((lt,ht)=>Ae.forEach((_n,Kt)=>{let _t=H(T)+lt,Dt=H(_)+_n,Gt=oe(T)+lt/3,$t=oe(_)+_n/3;j.forEach((Xe,Fn)=>{let yt=Xe>T.b?T.b:Xe<T.t?T.t:null,cn=Xe>_.b?_.b:Xe<_.t?_.t:null;yt!==null&&cn!==null&&se(_t,yt,_t,Xe,Dt,Xe,Dt,cn)<_e.bc&&kt(Fe,ht*Se+Fn,[_t,yt],[_t,Xe])&&kt(Ye,Kt*Se+Fn,[Dt,Xe],[Dt,cn])&&B([[_t,yt],[_t,Xe],[Dt,Xe],[Dt,cn]])}),K.forEach((Xe,Fn)=>{let yt=Xe>T.r?T.r:Xe<T.l?T.l:null,cn=Xe>_.r?_.r:Xe<_.l?_.l:null;yt!==null&&cn!==null&&se(yt,Gt,Xe,Gt,Xe,$t,cn,$t)<_e.bc&&kt(mt,ht*Te+Fn,[yt,Gt],[Xe,Gt])&&kt(ys,Kt*Te+Fn,[Xe,$t],[cn,$t])&&B([[yt,Gt],[Xe,Gt],[Xe,$t],[cn,$t]])}),lt===0&&_n===0&&K.forEach((Xe,Fn)=>j.forEach((yt,cn)=>{let F=Xe>T.r?T.r:Xe<T.l?T.l:null,re=yt>_.b?_.b:yt<_.t?_.t:null;F!==null&&re!==null&&ge(F,Gt,Xe,Gt,Xe,yt,Dt,yt,Dt,re)<_e.bc&&kt(mt,ht*Te+Fn,[F,Gt],[Xe,Gt])&&kt(Ye,Kt*Se+cn,[Dt,yt],[Dt,re])&&B([[F,Gt],[Xe,Gt],[Xe,yt],[Dt,yt],[Dt,re]]);let ue=yt>T.b?T.b:yt<T.t?T.t:null,be=Xe>_.r?_.r:Xe<_.l?_.l:null;ue!==null&&be!==null&&ge(_t,ue,_t,yt,Xe,yt,Xe,$t,be,$t)<_e.bc&&kt(Fe,ht*Se+cn,[_t,ue],[_t,yt])&&kt(ys,Kt*Te+Fn,[Xe,$t],[be,$t])&&B([[_t,ue],[_t,yt],[Xe,yt],[Xe,$t],[be,$t]])}));let ur=H(T)<_.l?_.l:H(T)>_.r?_.r:null,Zt=$t<T.t?T.t:$t>T.b?T.b:null;ur!==null&&Zt!==null&&B([[_t,Zt],[_t,$t],[ur,$t]]);let Zs=oe(T)<_.t?_.t:oe(T)>_.b?_.b:null,hr=Dt<T.l?T.l:Dt>T.r?T.r:null;Zs!==null&&hr!==null&&B([[hr,Gt],[Dt,Gt],[Dt,Zs]])}))}function $e(T,_,B,pe){for(let me of Ae){let Ce=H(T)+me,ae=oe(T)+me/3,Le=[[[Ce,T.t],[Ce,_.t]],[[T.r,ae],[_.r,ae]],[[Ce,T.b],[Ce,_.b]],[[T.l,ae],[_.l,ae]]];for(let Te of Le)pe(B?[Te[1],Te[0]]:Te)}}let Ze=(T,_,B,pe)=>{let me=null;return _e.bc=1/0,T(Ce=>{let ae=le(Ce,_,B,_e.bc,pe);ae<_e.bc&&(_e.bc=ae,me=Ce)},pe),me},Q=[],te=T=>u.some(_=>[_.l,_.r].some(B=>T.l<B+3&&T.r>B-3&&T.b>_.t&&T.t<_.b)||[_.t,_.b].some(B=>T.t<B+3&&T.b>B-3&&T.r>_.l&&T.l<_.r)),we=T=>z.filter(([_,B])=>w(_,B,T,1)).length,ze=T=>b.some(_=>T.l<_.r&&T.r>_.l&&T.t<_.b&&T.b>_.t),De=T=>k.filter(_=>T.l<_.r+3&&T.r>_.l-3&&T.t<_.b+3&&T.b>_.t-3).length,qe=T=>Q.filter(_=>T.l<_.r+4&&T.r>_.l-4&&T.t<_.b+2&&T.b>_.t-2).length,M=T=>50*fe(T)+3*we(T)+(te(T)?1:0)+(ze(T)?5:0)+5*De(T)+5*qe(T),D=T=>we(T)>0||te(T)||ze(T)||De(T)>0||qe(T)>0,W=[];(t.links??[]).forEach((T,_)=>{let B=T.id??`link-${_}`,pe=g.get(T.aOn??T.a),me=g.get(T.bOn??T.b);if(pe===me){f.push(`link "${B}" joins "${T.aOn??T.a}" to itself: not drawn`),W.push({...T,id:B,points:[],routed:!1});return}let Ce=x(pe,me)?Te=>$e(pe,me,!1,Te):x(me,pe)?Te=>$e(me,pe,!0,Te):(Te,Se)=>Ke(pe,me,Te,Se),ae=Ze(Ce,pe,me,!0),Le=!0;if(ae||(ae=Ze(Ce,pe,me,!1),Le=!1,f.push(`link "${B}": no clear route; drawn the least bad way`)),!ae){W.push({...T,id:B,points:[],routed:!1});return}for(let Te=1;Te<ae.length;Te++)P(ae[Te-1],ae[Te]);W.push({...T,id:B,points:ae,routed:Le})});let he=[];for(let T=0;T<z.length;T++)for(let _=T+1;_<z.length;_++){let[B,pe]=z[T],[me,Ce]=z[_],ae=B[1]===pe[1],Le=me[1]===Ce[1];if(ae===Le)continue;let[Te,Se]=ae?[[B,pe],[me,Ce]]:[[me,Ce],[B,pe]],Fe=Se[0][0],Ye=Te[0][1];Fe>Math.min(Te[0][0],Te[1][0])&&Fe<Math.max(Te[0][0],Te[1][0])&&Ye>Math.min(Se[0][1],Se[1][1])&&Ye<Math.max(Se[0][1],Se[1][1])&&he.push([Fe,Ye])}let fe=T=>he.filter(([_,B])=>_>T.l-2&&_<T.r+2&&B>T.t-2&&B<T.b+2).length;for(let T of W){let _=T,B=T.points;if(!_.label||!B.length)continue;let pe=[];for(let Se=1;Se<B.length;Se++)pe.push([B[Se-1],B[Se]]);let me=Se=>Math.abs(Se[0][0]-Se[1][0])+Math.abs(Se[0][1]-Se[1][1]);pe.sort((Se,Fe)=>me(Fe)-me(Se));let Ce=e(_.label,"label")+6,ae=null,Le=null,Te=1/0;for(let[Se,Fe]of pe){let Ye=(Se[0]+Fe[0])/2,mt=(Se[1]+Fe[1])/2,ys=Se[1]===Fe[1]?[0,-.3,.3,-.15,.15].flatMap(kt=>{let lt=Ye+kt*Math.abs(Se[0]-Fe[0]);return[[lt,mt-6,"middle"],[lt,mt+15,"middle"]]}):[0,-.3,.3].flatMap(kt=>{let lt=mt+4+kt*Math.abs(Se[1]-Fe[1]);return[[Ye+7,lt,"start"],[Ye-7,lt,"end"],[Ye+24,lt,"start"],[Ye-24,lt,"end"]]});for(let[kt,lt,ht]of ys){let _n=ht==="middle"?kt-Ce/2:ht==="end"?kt-Ce:kt,Kt={l:_n,r:_n+Ce,t:lt-11,b:lt+3};if(!D(Kt)){ae=[kt,lt,ht,Kt];break}let _t=M(Kt);_t<Te&&(Te=_t,Le=[kt,lt,ht,Kt])}if(ae)break}if(!ae&&Le&&(ae=Le),!ae){let[Se,Fe]=pe[0],Ye=(Se[0]+Fe[0])/2,mt=(Se[1]+Fe[1])/2-6;ae=[Ye,mt,"middle",{l:Ye-Ce/2,r:Ye+Ce/2,t:mt-11,b:mt+3}]}Q.push(ae[3]),T.at={x:a(ae[0]),y:a(ae[1]),anchor:ae[2],box:ae[3],text:_.label}}let J=[],ne=[];for(let T of[...v,...Q,...h.map(_=>_.title)])J.push(T.l,T.r),ne.push(T.t,T.b);for(let T of W)for(let _ of T.points)J.push(_[0]),ne.push(_[1]);let ye=i.margin,ve={l:Math.min(...J)-ye,t:Math.min(...ne)-ye,r:Math.max(...J)+ye,b:Math.max(...ne)+ye};return{cards:y,panels:h,links:W,bounds:ve,options:i,warnings:f}}function Nf(t,e,s){let r=o=>e>=o.l&&e<=o.r&&s>=o.t&&s<=o.b,i=t.cards.find(o=>r(o.rect));return i?i.id:[...t.panels].sort((o,n)=>n.depth-o.depth).find(o=>r(o.rect))?.id}function Kh(t,e,s,r={}){let i=a=>{let f=Hr(a,e,r);return Math.max(f.bounds.r-f.bounds.l,(f.bounds.b-f.bounds.t)*s)},o=t,n=i(t);for(let a=0;a<12;a++){let f,p=n;for(let c of Gh(o)){if(Xa(c).length)continue;let l=i(c);l<p-.5&&(p=l,f=c)}if(!f)break;o=f,n=p}return o}function*Gh(t){let e=t.panels??[],s=(n,a)=>n[0]>=a[0]&&n[2]<=a[2]&&n[1]>=a[1]&&n[3]<=a[3],r=(n,a)=>n.every((f,p)=>f===a[p]),i=(n,a=-1)=>{let f=-1;return e.forEach((p,c)=>{c===a||!s(n,p.cells)||a>=0&&c>a&&r(p.cells,e[a].cells)||(f<0||s(p.cells,e[f].cells)&&(!r(p.cells,e[f].cells)||c>f))&&(f=c)}),f},o=n=>{let a=[];return e.forEach((f,p)=>{i(f.cells,p)===n&&a.push({range:[...f.cells],panel:p})}),t.cards.forEach((f,p)=>{let c=[f.cell[0],f.cell[1],f.cell[0],f.cell[1]];i(c)===n&&a.push({range:c,card:p})}),a};for(let n of[-1,...e.map((a,f)=>f)]){let a=o(n);if(n>=0&&!a.some(l=>l.panel!==void 0))continue;let f=l=>[l.range[1],l.range[3]],p=[];for(let l of[...a].sort((d,m)=>d.range[1]-m.range[1]||d.range[0]-m.range[0])){let d=p.find(m=>m.some(h=>f(h)[0]<=f(l)[1]&&f(l)[0]<=f(h)[1]));d?d.push(l):p.push([l])}let c=Math.max(...a.map(l=>l.range[3]));for(let l of p){l.sort((d,m)=>d.range[0]-m.range[0]);for(let d=1;d<l.length;d++){let m=l.slice(d),h=l[0].range[0],y=c+1,g=Math.min(...m.map($=>$.range[1])),k=Math.max(...m.map($=>$.range[3]))-g+1,u=t.cards.map($=>({...$,cell:[...$.cell]})),b=e.map($=>({...$,cells:[...$.cells]}));for(let $ of u)$.cell[1]>c&&($.cell[1]+=k);let x=new Set;for(let $=n;$>=0&&!x.has($);$=i(e[$].cells,$))x.add($);b.forEach(($,S)=>{$.cells[1]>c?($.cells[1]+=k,$.cells[3]+=k):(x.has(S)||$.cells[1]<=c&&$.cells[3]>c)&&($.cells[3]+=k)});let w=h;for(let $ of m){let S=w-$.range[0],O=y+($.range[1]-g)-$.range[1],z=A=>A[0]>=$.range[0]&&A[0]<=$.range[2]&&A[1]>=$.range[1]&&A[1]<=$.range[3];t.cards.forEach((A,R)=>{z([A.cell[0],A.cell[1]])&&(u[R].cell=[A.cell[0]+S,A.cell[1]+O])}),e.forEach((A,R)=>{s(A.cells,$.range)&&(b[R].cells=[A.cells[0]+S,A.cells[1]+O,A.cells[2]+S,A.cells[3]+O])}),w+=$.range[2]-$.range[0]+1}e.forEach(($,S)=>{let O=t.cards.map((z,A)=>s([z.cell[0],z.cell[1],z.cell[0],z.cell[1]],$.cells)?u[A].cell:void 0).filter(z=>!!z);O.length&&(b[S].cells=[Math.min(...O.map(z=>z[0])),Math.min(...O.map(z=>z[1])),Math.max(...O.map(z=>z[0])),Math.max(...O.map(z=>z[1]))])}),yield{cards:u,panels:b,links:t.links}}}}}function Qa(t,e=()=>!0){let s=t.layout.items.filter(S=>e(S.id)),r=t.layout.catalog,i=!t.layout.items.some(S=>S.type==="node"),o=S=>i?!S.children.some(O=>e(O.id)):S.type==="node"&&!S.children.some(O=>O.type==="node"&&e(O.id)),n=s.filter(o),a=S=>{let O=[];for(let z=S;z;z=z.parent)O.unshift(z);return O},f=new Map(n.map(S=>[S.id,a(S)])),p=(S,O)=>{let z=f.get(S.id),A=f.get(O.id),R=0;for(;R<z.length&&R<A.length&&z[R]===A[R];)R++;return[z[R].box,A[R].box]},c=1e-6,l=(S,O)=>{let[z,A]=p(S,O);return z.y1<=A.y0+c&&z.x0<A.x1-c&&A.x0<z.x1-c},d=(S,O)=>{let[z,A]=p(S,O);return z.x1<=A.x0+c&&z.y0<A.y1-c&&A.y0<z.y1-c},m=(S,O)=>{let z=new Map,A=[];for(let R of[...n].sort((P,E)=>O(P)-O(E))){let P=0;for(let E of A)z.get(E.id)+1>P&&S(E,R)&&(P=z.get(E.id)+1);z.set(R.id,P),A.push(R)}return z},h=m(l,S=>S.box.y0),y=m(d,S=>S.box.x0),g=Math.min(...n.map(S=>S.box.x1-S.box.x0))/2;for(let S of n)if(!S.parent)for(let O of n)O.parent&&O.box.x0<=S.box.x0+g&&y.set(S.id,Math.max(y.get(S.id),y.get(O.id)));let k=new Map;for(let S of n)k.set(S.id,[y.get(S.id),h.get(S.id)]);let u=new Map;for(let S of n){let O=k.get(S.id),z=u.get(String(O));if(z!==void 0&&z!==S.id){for(let[,A]of k)A[0]>O[0]&&A!==O&&A[0]++;O[0]++,u.clear();for(let A of n)u.set(String(k.get(A.id)),A.id)}else u.set(String(O),S.id)}let b=n.map(S=>{if(S.region){let A=S.region;return{id:S.id,label:A.label??S.id,sub:void 0,role:A.role??Ot(r,A.kind)?.role??"grey",ghost:A.ghost||void 0,cell:k.get(S.id)}}let O=S.node,z=Tn(r,O.asset);return{id:S.id,label:O.label??S.id,sub:O.sub,role:O.role??z.role,ghost:O.ghost||void 0,cell:k.get(S.id)}}),x=[];for(let S of s){if(o(S))continue;let O=[],z=v=>{for(let N of v.children){let C=k.get(N.id);C&&O.push(C),z(N)}};if(z(S),!O.length)continue;let A=O.map(v=>v[0]),R=O.map(v=>v[1]),P=S.type==="region"?S.region.label:S.node.label??S.id,E=S.type==="region"?S.region.role??Ot(r,S.region.kind)?.role:S.node.role??Tn(r,S.node.asset).role;x.push({id:S.id,label:P,sub:S.type==="node"?S.node.sub:void 0,role:E,cells:[Math.min(...A),Math.min(...R),Math.max(...A),Math.max(...R)]})}let w=new Set([...b.map(S=>S.id),...x.map(S=>S.id)]),$=[];for(let S of t.routes){if(!e(S.id))continue;let O=wn(S.raw.from).id,z=wn(S.raw.to).id;if(!w.has(O)||!w.has(z))continue;let A=typeof S.raw.label=="string"?S.raw.label:S.raw.label?.text;$.push({id:S.id,a:O,b:z,kind:S.kind,label:A})}return{cards:b,panels:x,links:$}}var qs={W:4,D:2,H:.9,GX:2,GY:2.4,PAD:.6,CH:2.2,PANEL_H:.3},Rf=`
290
290
  .blk .card-name{font-size:13px;font-weight:600;fill:var(--ink)}
291
291
  .blk .card-sub{font-size:10px;fill:var(--ink);opacity:.75}
292
292
  .blk.ghost .card-name,.blk.ghost .card-sub{fill:var(--muted)}
293
- `;function Wc(t){return{name:"card",description:"A card: a slab with its name on its front face",size:[qs.W,qs.D,qs.H],role:"grey",draw(e,s,r){let i=t(r.id),o=e.blockFaces(s);if(!i)return o;let n=s.z1-s.z0;return o+=e.faceText(s.x0+.2,s.y1,s.z0+(i.sub?n*.52:n*.34),i.label,"card-name",wt.lbl,"left","start"),i.sub&&(o+=e.faceText(s.x0+.2,s.y1,s.z0+n*.14,i.sub,"card-sub",wt.sub,"left","start")),o}}}function Ef(t){let e=new Map(t.cards.map(s=>[s.id,{label:s.label,sub:s.sub}]));return{regions:{panel:{shape:"slab",pad:qs.PAD,z:[qs.PANEL_H,0],floor:!0,role:"grey",labelStyle:"floor"}},nodes:{card:Wc(s=>e.get(s))},defaultNode:"card"}}function Nf(t,e={}){let s=qs,{prect:r,parentIx:i,cardAt:o}=to(t,{W:s.W,H:s.D,GX:s.GX,GY:s.GY,PAD:s.PAD,TITLE:0,CH:s.CH}),n=t.panels??[],a=h=>Math.round(h*1e3)/1e3,f=h=>(h.cells[2]-h.cells[0]+1)*(h.cells[3]-h.cells[1]+1),p=h=>{let y=-1;return n.forEach((g,k)=>{let u=g.cells;h.cell[0]>=u[0]&&h.cell[0]<=u[2]&&h.cell[1]>=u[1]&&h.cell[1]<=u[3]&&(y<0||f(g)<=f(n[y]))&&(y=k)}),y},c=n.map((h,y)=>{let g=r[y],k=i[y]>=0?r[i[y]]:{l:0,t:0};return{id:h.id,kind:"panel",label:h.label,role:h.role,at:[a(g.l-k.l),a(g.t-k.t)],size:[a(g.r-g.l),a(g.b-g.t)],regions:[],nodes:[]}}),l=[],d=[];c.forEach((h,y)=>i[y]>=0?c[i[y]].regions.push(h):l.push(h));for(let h of t.cards){let[y,g]=o(t.cards.indexOf(h)),k=p(h),u=k>=0?r[k]:{l:0,t:0},b={id:h.id,asset:"card",role:h.role,ghost:h.ghost||void 0,at:[a(y-u.l),a(g-u.t)],size:[s.W,s.D,s.H]};(k>=0?c[k].nodes:d).push(b)}for(let h of c)h.regions.length||delete h.regions,h.nodes.length||delete h.nodes;let m=(t.links??[]).map((h,y)=>({id:h.id??`link-${y}`,from:h.aOn??h.a,to:h.bOn??h.b,kind:h.kind,label:h.label}));return{isodiag:1,title:e.title,kinds:e.kinds,roles:e.roles,scenes:[{id:"board",title:e.title??"board",regions:l,nodes:d,routes:m}]}}var vm={};ho(vm,{APPEARS:()=>jf,BASE_FIELDS:()=>dp,BINS:()=>Jf,BIN_MS:()=>zn,CARD:()=>Mt,DUAL_VIEW_CSS:()=>Sm,IDLES:()=>Lf,MAX_ZOOM:()=>Xa,MIN_ZOOM:()=>Ja,P3:()=>st,PLAY_CSS:()=>Yf,SEGMENT_NAME:()=>rl,SEVERITIES:()=>un,TIMELINE_VERSION:()=>Wf,activityOf:()=>gp,attr:()=>Qn,binNext:()=>pl,binStart:()=>lr,buildLayer:()=>ao,cardMotion:()=>_f,clamp:()=>Ps,cls:()=>Df,crumbs:()=>Jr,dualView:()=>xm,ease:()=>oo,escapeName:()=>al,extent:()=>Qa,findGaps:()=>dl,fitWithOverlay:()=>Bf,flatCss:()=>hm,flatSvg:()=>gl,formatScope:()=>Xf,gapKey:()=>pr,gapLabel:()=>cr,h:()=>re,hasSegment:()=>tm,highlights:()=>ro,isZone:()=>rm,isoVars:()=>qf,join:()=>Qf,kindOf:()=>Yr,legend:()=>cp,levelOf:()=>Jt,markConnectors:()=>xl,md:()=>$n,measureIn:()=>bl,memorySource:()=>cm,modeFor:()=>yp,morphSvgs:()=>wm,mountPlayer:()=>Hf,mountTimeline:()=>mm,n:()=>ep,nameOf:()=>Wr,node:()=>Ff,offsetAt:()=>nn,overlayPaint:()=>zf,pageClock:()=>pp,parentOf:()=>em,prefixAt:()=>Ms,prune:()=>np,pts:()=>no,rangeOf:()=>so,readTime:()=>fp,rectOf:()=>ym,renderPage:()=>Kf,rewrite:()=>tp,scope:()=>rp,scopePattern:()=>il,scopeRules:()=>ol,scopeSelector:()=>sp,searchFor:()=>Xr,severities:()=>nm,stepData:()=>lp,storedMode:()=>km,ticks:()=>fl,timeScale:()=>Qr,toCSV:()=>ul,toJSON:()=>ml,transport:()=>tl,unite:()=>el,viewToggle:()=>$m,viewport:()=>If,within:()=>hn});function qh(t,e,s){let i=(a,f,p,c,l)=>Math.min((a-48)/(p-f),...c===void 0||l===void 0?[]:[[l-c,12],[l-f,30],[p-c,30]].map(([d,m])=>d>0?(a-m)/d:1/0)),o=Math.min(Xa,Math.max(Ja,Math.min(i(t.w,e.x,e.x+e.w,s?.x,s&&s.x+s.w),i(t.h,e.y,e.y+e.h,s?.y,s&&s.y+s.h)))),n=(a,f,p,c,l)=>{let d=(f+p)/2;if(c===void 0||l===void 0)return d;let m=l-(a/2-6)/o,h=c+(a/2-6)/o;return m>h?(m+h)/2:Math.max(m,Math.min(h,d))};return{k:o,cx:n(t.w,e.x,e.x+e.w,s?.x,s&&s.x+s.w),cy:n(t.h,e.y,e.y+e.h,s?.y,s&&s.y+s.h)}}var Ja=.1,Xa=8;function If(t,e){let s,r,i=!1,o=0,n=0,a=0,f=0,p=0,c=!1,l=()=>{let v=t.getBoundingClientRect();return{w:Math.max(1,v.width),h:Math.max(1,v.height)}},d=(v=s)=>{let O=l();return Math.min(O.w/v.w,O.h/v.h)},m=v=>{o++;try{v()}finally{o--}};function h(){let v=e.svg();if(!v||!s)return;o||(i=!0);let O=l(),C=d(),A=O.w/C,R=O.h/C;s={x:s.x+(s.w-A)/2,y:s.y+(s.h-R)/2,w:A,h:R},v.setAttribute("viewBox",`${s.x.toFixed(2)} ${s.y.toFixed(2)} ${s.w.toFixed(2)} ${s.h.toFixed(2)}`),n=C,e.onApply(C),a&&Math.abs(C/a-1)>.02&&(cancelAnimationFrame(f),f=requestAnimationFrame(()=>{f=0,e.onRezoom()}))}let y=(v,O)=>{let C=t.getBoundingClientRect(),A=d();return{x:s.x+(v-C.left)/A,y:s.y+(O-C.top)/A}};function g(v,O,C){if(!s)return;let A=d(),R=Math.min(Xa,Math.max(Ja,A*v)),M=t.getBoundingClientRect(),T=O??M.left+M.width/2,S=C??M.top+M.height/2,N=y(T,S),z=l();s={x:N.x-(T-M.left)/R,y:N.y-(S-M.top)/R,w:z.w/R,h:z.h/R},h()}function k(v=r,O){if(!v)return;let C=l(),{k:A,cx:R,cy:M}=qh(C,v,O),T={x:R-C.w/A/2,y:M-C.h/A/2,w:C.w/A,h:C.h/A};if(s&&Math.abs(T.w/s.w-1)<.001&&Math.abs(T.h/s.h-1)<.001&&Math.abs(T.x-s.x)<T.w*.001&&Math.abs(T.y-s.y)<T.h*.001){h();return}s=T,h()}function u(){for(let v=0,O="";v<4;v++){let C=e.itemsBox()??r;if(!C)return;let A=[C.x,C.y,C.w,C.h].map(M=>Math.round(M)).join();if(A===O)break;O=A;let R=Math.max(24,Math.min(C.w,C.h)*.06);if(m(()=>k({x:C.x-R,y:C.y-R,w:C.w+R*2,h:C.h+R*2},e.alsoBox?.())),!e.marksShowing()||!a||Math.abs(d()/a-1)<=.02)break;cancelAnimationFrame(f),f=0,e.onRezoom()}i=!1}function b(){if(i||!e.svg()||!s)return;let v=t.getBoundingClientRect();v.width<2||v.height<2||u()}function x(){if(!s)return;let v=d();g(1/v)}function w(){return new Promise(v=>{let O=0,C=n,A=()=>{if(c){v();return}let R=!!(f||p)||n!==C;C=n,O=R?0:O+1,O>=2?v():requestAnimationFrame(A)};requestAnimationFrame(A)})}let $=new ResizeObserver(()=>{if(!(!s||c)){if(i&&n){let v=l(),O=s.x+s.w/2,C=s.y+s.h/2;s={x:O-v.w/n/2,y:C-v.h/n/2,w:v.w/n,h:v.h/n}}i||(cancelAnimationFrame(p),p=requestAnimationFrame(()=>{p=0,c||b()})),m(h)}});return $.observe(t),{get view(){return s},set view(v){s=v},get full(){return r},set full(v){r=v},get moved(){return i},get zoom(){return n},painted(v){a=v},size:l,scale:d,quietly:m,applyView:h,toSvg:y,zoomAt:g,fit:k,fitItems:u,autoFit:b,actual:x,settled:w,dispose(){cancelAnimationFrame(p),cancelAnimationFrame(f),$.disconnect(),c=!0}}}var Tt="http://www.w3.org/2000/svg",Mt={half:2.4,h:3.2,t:.25,above:1.4,lift:3.8,fan:.32,gap:.3},st=(t,e,s)=>[(t-e)*Ct*lt,(t+e)*.5*lt-s*lt],no=t=>t.map(([e,s])=>`${e.toFixed(1)},${s.toFixed(1)}`).join(" ");function zf(t,e){function s(o,n,a){let f=t.k(),p=(l,d,m,h,y="")=>{let g=o.createElementNS(Tt,"g");g.setAttribute("class",`live-badge ${m.cls} ${y}`.trim());let k=8/f,u=o.createElementNS(Tt,"circle");if(u.setAttribute("cx",String(l)),u.setAttribute("cy",String(d)),u.setAttribute("r",String(k)),g.append(u),"g"in m){let x=o.createElementNS(Tt,"text");x.setAttribute("x",String(l)),x.setAttribute("y",String(d)),x.style.fontSize=`${(10/f).toFixed(2)}px`,x.textContent=m.g,g.append(x)}else{let x=o.createElementNS(Tt,"use");x.setAttribute("href",t.iconHref(m.icon));let w=11/f;x.setAttribute("x",String(l-w/2)),x.setAttribute("y",String(d-w/2)),x.setAttribute("width",String(w)),x.setAttribute("height",String(w)),g.append(x)}let b=o.createElementNS(Tt,"title");b.textContent=h,g.append(b),n(g)},c=(l,d)=>{for(let m of t.outlinesFor(l)){if(m.kind!=="poly")continue;let h=o.createElementNS(Tt,"polygon");h.setAttribute("class",d),h.setAttribute("points",m.points.map(([y,g])=>`${y.toFixed(1)},${g.toFixed(1)}`).join(" ")),n(h)}};for(let l of a){let d=t.boxOf(l.at);if(d){if(l.outline&&c(l.at,l.outline),l.badge)p(d.x,d.y,l.badge,l.title);else if(l.hit){let m=o.createElementNS(Tt,"title");m.textContent=l.title;let h=o.createElementNS(Tt,"rect");h.setAttribute("class","live-hit"),h.setAttribute("x",String(d.x)),h.setAttribute("y",String(d.y)),h.setAttribute("width",String(d.w)),h.setAttribute("height",String(d.h)),h.append(m),n(h)}if((l.beside??[]).forEach((m,h)=>p(d.x+18*(h+1)/f,d.y,m.glyph,m.title)),l.dot&&p(d.x,d.y+d.h,l.dot.glyph,l.dot.title),l.tag){let m=o.createElementNS(Tt,"text");m.setAttribute("class",`live-life ${l.tag.cls}`),m.setAttribute("x",String(d.x+d.w)),m.setAttribute("y",String(d.y+d.h)),m.style.fontSize=`${(9/f).toFixed(2)}px`,m.textContent=l.tag.text,n(m)}}}}function r(o,n,a){for(let f of a){let p=o.createElementNS(Tt,"g");p.setAttribute("class",`live-extra${f.cls}`);for(let[b,x]of f.data)p.setAttribute(b,x);let{x:c,y:l,w:d,hgt:m,k:h}=f.rect,y=o.createElementNS(Tt,"rect");y.setAttribute("x",String(c)),y.setAttribute("y",String(l)),y.setAttribute("width",String(d)),y.setAttribute("height",String(m)),y.setAttribute("rx",String(6/h));let g=o.createElementNS(Tt,"text");g.setAttribute("x",String(c+8/h)),g.setAttribute("y",String(l+13/h)),g.style.fontSize=`${(11/h).toFixed(2)}px`,g.textContent=f.line1;let k=o.createElementNS(Tt,"text");k.setAttribute("class","sub"),k.setAttribute("x",String(c+8/h)),k.setAttribute("y",String(l+27/h)),k.style.fontSize=`${(9/h).toFixed(2)}px`,k.textContent=f.line2;let u=o.createElementNS(Tt,"title");u.textContent=f.title,p.append(y,g,k,u),n(p)}}function i(o,n,a){let f=[];for(let p of a){let c=p.over,l=(c.x0+c.x1)/2,d=(c.y0+c.y1)/2,m=0,h={x0:0,y0:0,x1:0,y1:0};for(let L=0;L<6;L++){let U=c.z1+Mt.above+m,H=U+Mt.h,ee=[st(l-Mt.half,d+Mt.t,U),st(l+Mt.half,d+Mt.t,U),st(l+Mt.half,d-Mt.t,H),st(l-Mt.half,d+Mt.t,H)];if(h={x0:Math.min(...ee.map(j=>j[0])),y0:Math.min(...ee.map(j=>j[1])),x1:Math.max(...ee.map(j=>j[0])),y1:Math.max(...ee.map(j=>j[1]))},!Ha(h,f))break;m+=Mt.lift}f.push(h);let y=c.z1+Mt.above+m,g=y+Mt.h,k=l-Mt.half,u=l+Mt.half,b=d+Mt.t,x=d-Mt.t,w=o.createElementNS(Tt,"g");w.setAttribute("class",`${e}-card${p.cls}`);for(let[L,U]of p.data)w.setAttribute(L,U);let[$,v]=st(l,d,c.z1+.15),O=`${$.toFixed(1)}px ${v.toFixed(1)}px`;w.style.transformOrigin=O;let C=o.createElementNS(Tt,"g");C.setAttribute("class",`${e}-float`),C.style.transformOrigin=O;let A=[];for(let L=Math.min(p.count-1,3);L>=1;L--){let U=L*Mt.fan,H=x-(L-1)*(2*Mt.t+Mt.gap)-Mt.gap,ee=H-2*Mt.t,j=k+U,q=u+U,G=y+U,Q=g+U,ce=(pe,Y)=>{let ie=o.createElementNS(Tt,"polygon");ie.setAttribute("class",`${e}-face stacked ${pe}`),ie.setAttribute("points",no(Y)),C.append(ie)};ce("s-top",[st(j,ee,Q),st(q,ee,Q),st(q,H,Q),st(j,H,Q)]),ce("s-side",[st(q,ee,G),st(q,H,G),st(q,H,Q),st(q,ee,Q)]),ce("s-front",[st(j,H,G),st(q,H,G),st(q,H,Q),st(j,H,Q)]),A.push({x0:j,x1:q,y0:ee,y1:H,z0:G,z1:Q})}let R=o.createElementNS(Tt,"polygon");R.setAttribute("class",`${e}-tail`),R.setAttribute("points",no([st(l-.5,b,y+.05),st(l+.5,b,y+.05),st(l,d,c.z1+.15)]));let M=(L,U)=>{let H=o.createElementNS(Tt,"polygon");return H.setAttribute("class",L),H.setAttribute("points",no(U)),H},T=M(`${e}-face front`,[st(k,b,y),st(u,b,y),st(u,b,g),st(k,b,g)]);C.append(R,M(`${e}-face top`,[st(k,x,g),st(u,x,g),st(u,b,g),st(k,b,g)]),M(`${e}-face side`,[st(u,x,y),st(u,b,y),st(u,b,g),st(u,x,g)]),T);let[S,N]=st(k,b,g),z=40,K=o.createElementNS(Tt,"g");K.setAttribute("transform",`matrix(${(Ct*lt/z).toFixed(4)} ${(.5*lt/z).toFixed(4)} 0 ${(lt/z).toFixed(4)} ${S.toFixed(1)} ${N.toFixed(1)})`);let J=(L,U,H,ee)=>{let j=o.createElementNS(Tt,"text");return j.setAttribute("class",L),j.setAttribute("x",String(U)),j.setAttribute("y",String(H)),j.textContent=ee,j};if(K.append(J(`${e}-mark`,34,98,p.mark),J(`${e}-who`,70,52,p.who),J(`${e}-age`,70,82,p.age)),p.line!==void 0&&K.append(J(`${e}-q`,12,118,p.line)),p.count>1){let L=o.createElementNS(Tt,"circle");L.setAttribute("class",`${e}-count-bg`),L.setAttribute("cx","178"),L.setAttribute("cy","14"),L.setAttribute("r","15"),K.append(L,J(`${e}-count`,178,14,String(p.count)))}C.append(K);let Z=o.createElementNS(Tt,"title");Z.textContent=p.title,w.append(C,Z),t.onCard?.(w,{cx:l,cy:d,tipZ:c.z1+.15,card:{x0:k,x1:u,y0:x,y1:b,z0:y,z1:g},panes:A.reverse()}),n(w)}}return{paintMarks:s,paintGhosts:r,paintCards:i}}var jf=[["scale","Scale"],["spin","Spin"],["dissolve","Dissolve"],["inflate","Inflate"]],Lf=[["none","None"],["jiggle","Jiggle"],["pirouette","Pirouette"],["glow","Glow"],["breathe","Breathe"]];function Vh(t){let e=2166136261;for(let s=0;s<t.length;s++)e^=t.charCodeAt(s),e=Math.imul(e,16777619);return(e>>>0)%1e3/1e3}var Jc=t=>t<0?0:t>1?1:1-Math.pow(1-t,3),Cf=t=>t<0?0:t>1?1:t*t*t,Xc=Math.PI*2,Qc={appear:{scale:420,spin:760,dissolve:520,inflate:640},disappear:{scale:320,spin:600,dissolve:420,inflate:420},period:{jiggle:4200,pirouette:6400,glow:3200,breathe:4400}},In={windup:220,turn:980,land:260};function _f(t,e,{prefix:s,key:r,alt:i}){let o={...e},n=1,a=new Map,f=new WeakSet,p=0,c=0,l=new WeakMap,d=new WeakMap;function m(R){p=0;for(let[M,T]of a){if(!M.isConnected){a.delete(M);continue}let S;if(T.repeat){if(S=(R+(T.offset??0))%T.repeat/T.dur,S>1){f.has(M)&&(t.restore(M),f.delete(M),M.style.removeProperty("transform"));continue}}else if(S=(R-T.start)/T.dur,S>=1){h(M,T);continue}let N=T.frame(Math.max(0,S));t.spin(M,N.theta,N.lift),f.add(M),d.set(M,N),N.scale!==1?M.style.transform=`scale(${N.scale.toFixed(4)})`:M.style.removeProperty("transform"),c++}a.size&&(p=requestAnimationFrame(m))}function h(R,M){a.delete(R),f.has(R)&&(t.restore(R),f.delete(R)),R.style.removeProperty("transform"),M.done?.()}function y(R){let M=a.get(R.card);M&&h(R.card,M),a.set(R.card,R),p||(p=requestAnimationFrame(m))}let g=8,k=0,u=R=>(k++,R.finally(()=>{k--}));function b(R){return!o.enabled||k>=g?Promise.resolve():u(w(R))}function x(R){return!o.enabled||k>=g?Promise.resolve():u($(R))}function w(R){let M=Qc.appear[o.appear]/n;if(o.appear==="spin")return new Promise(N=>y({card:R,start:performance.now(),dur:M,frame:z=>({theta:(1-Jc(z))*Xc,lift:0,scale:Math.max(.001,Jc(z))}),done:N}));let T=o.appear==="scale"?[{transform:"scale(0)"},{transform:"scale(1)"}]:o.appear==="dissolve"?[{opacity:0,filter:"blur(4px)"},{opacity:1,filter:"blur(0px)"}]:[{transform:"scale(0)",easing:"cubic-bezier(.3,0,.4,1)"},{transform:"scale(1.16)",offset:.55,easing:"ease-in-out"},{transform:"scale(.95)",offset:.78,easing:"ease-in-out"},{transform:"scale(1)"}];return R.animate(T,{duration:M,easing:o.appear==="inflate"?"linear":"ease-out"}).finished.then(()=>{},()=>{})}function $(R){let M=Qc.disappear[o.appear]/n;if(o.appear==="spin")return new Promise(N=>y({card:R,start:performance.now(),dur:M,frame:z=>({theta:Cf(z)*Xc,lift:0,scale:Math.max(.001,1-Cf(z))}),done:()=>{R.style.transform="scale(0)",N()}}));let T=o.appear==="scale"?[{transform:"scale(1)"},{transform:"scale(0)"}]:o.appear==="dissolve"?[{opacity:1,filter:"blur(0px)"},{opacity:0,filter:"blur(4px)"}]:[{transform:"scale(1)"},{transform:"scale(1.08)",offset:.3},{transform:"scale(0)"}];return R.animate(T,{duration:M,easing:"ease-in",fill:"forwards"}).finished.then(()=>{},()=>{})}function v(R){l.get(R)?.cancel(),l.delete(R);let M=a.get(R);M?.repeat&&h(R,M)}function O(R,M){if(v(R),!o.enabled||o.idle==="none"||R.classList.contains("still"))return;let T=R.getAttribute(r)??R.getAttribute(i)??"",S=(M??Qc.period[o.idle])/n,N=Vh(T)*S;if(o.idle==="pirouette"){let L=(In.windup+In.turn+In.land)/n,U=In.windup/(In.windup+In.turn+In.land),H=(In.windup+In.turn)/(In.windup+In.turn+In.land);y({card:R,start:0,dur:L,repeat:S,offset:N,frame:ee=>{if(ee<U)return{theta:-.35*Math.sin(ee/U*Math.PI/2),lift:0,scale:1};if(ee<H){let q=(ee-U)/(H-U);return{theta:-.35*(1-q)+Jc(q)*Xc,lift:.9*Math.sin(q*Math.PI),scale:1}}let j=(ee-H)/(1-H);return{theta:0,lift:0,scale:1-.04*Math.sin(j*Math.PI)}}});return}let z=R.querySelector(`.${s}-float`)??R,K=t.amber(),J=o.idle==="jiggle"?[{transform:"scale(1)",offset:0},{transform:"scale(1.07)",offset:.04},{transform:"scale(.97)",offset:.08},{transform:"scale(1.02)",offset:.11},{transform:"scale(1)",offset:.14},{transform:"scale(1)",offset:1}]:o.idle==="glow"?[{filter:`drop-shadow(0 0 0px ${K})`},{filter:`drop-shadow(0 0 7px ${K})`},{filter:`drop-shadow(0 0 0px ${K})`}]:[{transform:"scale(1)"},{transform:"scale(1.035)"},{transform:"scale(1)"}],Z=z.animate(J,{duration:S,iterations:1/0,easing:o.idle==="jiggle"?"linear":"ease-in-out"});Z.startTime=(document.timeline.currentTime??0)-((document.timeline.currentTime??0)+N)%S,l.set(R,Z)}function C(R,M,T,S,N=!1){N&&(S=!1);for(let[K,J]of M)!R.has(K)&&!N&&b(J),!l.has(J)&&!a.get(J)?.repeat&&O(J);if(!o.enabled||!S)return;let z=t.leavingLayer();if(z)for(let[K,J]of T){let Z=R.get(K);!Z||M.has(K)||(v(Z),Z.setAttribute("class",`${s}-leaving${J?" expired":""}`),Z.removeAttribute(i),z.append(Z),x(Z).then(()=>Z.remove()))}}function A(R){for(let[M,T]of[...a])h(M,T);p&&cancelAnimationFrame(p),p=0;for(let M of document.getAnimations())M.effect?.target?.closest?.(`.live-layer, .${s}-leaving-layer`)&&M.cancel();t.leavingLayer()?.replaceChildren()}return{get settings(){return{...o}},set(R,M){let T=o;if(o={...o,...R},(!o.enabled||T.idle!==o.idle||T.enabled!==o.enabled)&&(A(void 0),o.enabled))for(let S of M)O(S)},update:C,appear:b,disappear:x,startIdle:O,stopIdle:v,stopAll:A,async preview(R){o.enabled&&await Promise.all(R.map(async M=>{if(v(M),await b(M),o.idle!=="none"&&!M.classList.contains("still")){let T=o.idle==="pirouette"?1800:1400;O(M,T),await new Promise(S=>setTimeout(S,T*2.2/n)),v(M)}else await new Promise(T=>setTimeout(T,700/n));await x(M);for(let T of M.getAnimations())T.cancel();M.style.removeProperty("transform"),O(M)}))},get stats(){return{jobs:a.size,raf:!!p,frames:c,effects:k}},setSpeed(R){n=R},lastFrame:R=>d.get(R)}}var ep=t=>String(Math.round(t*100)/100),Ff=(t,e={},...s)=>({name:t,attrs:Object.entries(e).map(([r,i])=>[r,typeof i=="number"?ep(i):i]),children:s});function tp(t,e){if(typeof t=="string")return t;let s=t.attrs.map(([r,i])=>{if(r==="id")return[r,e+i];let o=i.replace(/var\(--([a-zA-Z][\w-]*)/g,"var(--iso-$1").replace(/url\(\s*(['"]?)#/g,(n,a)=>`url(${a}#${e}`);return(r==="href"||r==="xlink:href")&&o.startsWith("#")&&!o.startsWith(`#${e}`)&&(o=`#${e}${o.slice(1)}`),[r,o]});return{name:t.name,attrs:s,children:t.children.map(r=>tp(r,e))}}function np(t,e){if(typeof t=="string")return t;if(!e(t))return{...t,children:t.children.map(s=>np(s,e)).filter(s=>s!==void 0)}}var Df=t=>(t.attrs.find(e=>e[0]==="class")?.[1]??"").split(/\s+/),Qn=(t,e)=>t.attrs.find(s=>s[0]===e)?.[1];function Qa(t){let e=[],s=[],r=n=>{if(typeof n=="string")return;let a=Qn(n,"transform");if(a&&/matrix/.test(a))return;let f=Qn(n,"points");if(f)for(let p of f.trim().split(/\s+/)){let[c,l]=p.split(",").map(Number);Number.isFinite(c)&&Number.isFinite(l)&&(e.push(c),s.push(l))}if(n.name==="rect"){let p=Number(Qn(n,"x")),c=Number(Qn(n,"y")),l=Number(Qn(n,"width")),d=Number(Qn(n,"height"));[p,c,l,d].every(Number.isFinite)&&(e.push(p,p+l),s.push(c,c+d))}if(n.name==="circle"){let p=Number(Qn(n,"cx")),c=Number(Qn(n,"cy")),l=Number(Qn(n,"r"));[p,c,l].every(Number.isFinite)&&(e.push(p-l,p+l),s.push(c-l,c+l))}n.children.forEach(r)};if(t.forEach(r),!e.length)return;let i=Math.min(...e),o=Math.min(...s);return{x:i,y:o,w:Math.max(...e)-i,h:Math.max(...s)-o}}var el=(t,e)=>{if(!e)return t;let s=Math.min(t.x,e.x),r=Math.min(t.y,e.y);return{x:s,y:r,w:Math.max(t.x+t.w,e.x+e.w)-s,h:Math.max(t.y+t.h,e.y+e.h)-r}};function Bf(t,e,s){let r=a=>Math.min((e.width-e.pad*2)/a.w,(e.height-e.pad*2)/a.h),i=r(t),o=s(i),n=el(t,Qa(o));return i=r(n),o=s(i),n=el(t,Qa(o)),i=r(n),{k:i,box:n,live:o}}var qf=t=>t.replace(/--([a-zA-Z][\w-]*)/g,"--iso-$1");function Kh(t){let e=[],s=0,r=t.replace(/\/\*[\s\S]*?\*\//g,"");for(;s<r.length;){let i=r.indexOf("{",s);if(i<0)break;let o=1,n=i+1;for(;n<r.length&&o;)r[n]==="{"?o++:r[n]==="}"&&o--,n++;e.push([r.slice(s,i).trim(),r.slice(i+1,n-1)]),s=n}return e}function Gh(t){let e=[],s=0,r=0;for(let i=0;i<t.length;i++){let o=t[i];o==="("||o==="["?s++:o===")"||o==="]"?s--:o===","&&!s&&(e.push(t.slice(r,i).trim()),r=i+1)}return e.push(t.slice(r).trim()),e.filter(Boolean)}function sp(t,e,s){let r=/^:root((?:\[[^\]]*\]|:not\([^)]*\))*)(.*)$/.exec(t),i=s.replace(/^\./,"");if(r){let o=r[1],n=r[2].trim();return`${o?`.${i}${o} `:""}${e}${n?" "+n:""}`}if(/^(html|body|\*)\b/.test(t)||/^[a-z]+$/.test(t)&&!/^(svg|g|text|path|polygon|rect|circle|line)$/.test(t))throw new Error(`the canvas's CSS can't style the page: "${t}"`);return`${e} ${t}`}function rp(t,e,s){let r="";for(let[i,o]of Kh(t)){if(i.startsWith("@keyframes")){r+=`@keyframes iso-${i.slice(10).trim()}{${o}}
294
- `;continue}if(i.startsWith("@media")||i.startsWith("@supports")){r+=`${i}{${rp(o,e,s)}}
295
- `;continue}if(i.startsWith("@"))throw new Error(`the canvas's CSS has an at-rule it can't scope: ${i}`);r+=`${Gh(i).map(n=>sp(n,e,s)).join(",")}{${o.replace(/\banimation:\s*([a-z][\w-]*)/g,"animation:iso-$1")}}
296
- `}return r}var ip=["<","script"].join("");function $n(t){return t?vt(t).replace(/`([^`]+)`/g,"<code>$1</code>").replace(/\*\*([^*]+)\*\*/g,"<b>$1</b>").replace(/(^|[^*])\*([^*\s][^*]*)\*/g,"$1<em>$2</em>").replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,(e,s,r)=>/^(https?:|#|\.{0,2}\/)/.test(r.replace(/&amp;/g,"&"))?`<a href="${r}">${s}</a>`:s):""}var op=t=>(t??"").split(/\n\s*\n/).filter(Boolean).map(e=>`<p class="sec-sub">${$n(e.trim())}</p>`).join(""),Vf=(t,e)=>!!e.motion&&vs(e,e.motion,{kinds:t.theme.kinds}).ok;function ap(t,e){return Vf(t,e)?vs(e,e.motion,{kinds:t.theme.kinds}).beats.map(s=>({n:s.index+1,num:s.index+1,kind:"control",color:s.say?.color??Un(t.theme,t.theme.kinds.control?.color??"control"),heading:s.say?.title??s.name,caption:s.say?.text??"",command:s.say?.code??"",phases:[],pulses:[],lit:[],duration:s.end-s.start})):e.steps.steps}function lp(t){return JSON.stringify({scenes:t.scenes.map(e=>{let s=Vf(t,e),r=ap(t,e),i=s?e.motion:e.steps.steps.length?Da(e):void 0;return{id:e.id,loop:e.raw.loop??!0,dim:e.raw.dim??"flows",vis:e.steps.vis,steps:r.map(({focus:o,...n})=>({...n,caption:$n(n.caption)})),assemble:e.assemble,grid:!!e.grid.show,source:Ji(e),...i?{doc:i}:{},...s?{own:s}:{}}})})}function cp(t,e){let s=t.theme,r=e.raw.legend;if(r===!1)return"";let i=Array.isArray(r)?r:e.steps.kindsUsed.filter(a=>e.routes.some(f=>f.kind===a)||e.steps.steps.some(f=>f.phases.some(p=>p.some(c=>c.kind===a)))),o=a=>`<span><i${a.box?' class="box"':""} style="${a.swatch}"></i>${a.label}</span>`,n=i.map(a=>{let f=Ot(t.catalog,a)?.legend;if(f)return o(f);let p=s.kinds[a];return p?`<span><i style="${`border-color:${Un(s,p.color)}${p.dash==="dashed"?";border-top-style:dashed":p.dash==="dotted"?";border-top-style:dotted":""}`}"></i>${$n(p.legend)}</span>`:""});if(!Array.isArray(r)){let a=new Set(e.layout.items.map(f=>f.region?.kind));for(let[f,p]of Object.entries(t.catalog.regions))p.legend?.auto&&a.has(f)&&n.push(o(p.legend))}return n.join("")}function Zh(t,e){let s=ap(t,e),r=`<div class="tools">
293
+ `;function Xc(t){return{name:"card",description:"A card: a slab with its name on its front face",size:[qs.W,qs.D,qs.H],role:"grey",draw(e,s,r){let i=t(r.id),o=e.blockFaces(s);if(!i)return o;let n=s.z1-s.z0;return o+=e.faceText(s.x0+.2,s.y1,s.z0+(i.sub?n*.52:n*.34),i.label,"card-name",wt.lbl,"left","start"),i.sub&&(o+=e.faceText(s.x0+.2,s.y1,s.z0+n*.14,i.sub,"card-sub",wt.sub,"left","start")),o}}}function If(t){let e=new Map(t.cards.map(s=>[s.id,{label:s.label,sub:s.sub}]));return{regions:{panel:{shape:"slab",pad:qs.PAD,z:[qs.PANEL_H,0],floor:!0,role:"grey",labelStyle:"floor"}},nodes:{card:Xc(s=>e.get(s))},defaultNode:"card"}}function zf(t,e={}){let s=qs,{prect:r,parentIx:i,cardAt:o}=no(t,{W:s.W,H:s.D,GX:s.GX,GY:s.GY,PAD:s.PAD,TITLE:0,CH:s.CH}),n=t.panels??[],a=h=>Math.round(h*1e3)/1e3,f=h=>(h.cells[2]-h.cells[0]+1)*(h.cells[3]-h.cells[1]+1),p=h=>{let y=-1;return n.forEach((g,k)=>{let u=g.cells;h.cell[0]>=u[0]&&h.cell[0]<=u[2]&&h.cell[1]>=u[1]&&h.cell[1]<=u[3]&&(y<0||f(g)<=f(n[y]))&&(y=k)}),y},c=n.map((h,y)=>{let g=r[y],k=i[y]>=0?r[i[y]]:{l:0,t:0};return{id:h.id,kind:"panel",label:h.label,role:h.role,at:[a(g.l-k.l),a(g.t-k.t)],size:[a(g.r-g.l),a(g.b-g.t)],regions:[],nodes:[]}}),l=[],d=[];c.forEach((h,y)=>i[y]>=0?c[i[y]].regions.push(h):l.push(h));for(let h of t.cards){let[y,g]=o(t.cards.indexOf(h)),k=p(h),u=k>=0?r[k]:{l:0,t:0},b={id:h.id,asset:"card",role:h.role,ghost:h.ghost||void 0,at:[a(y-u.l),a(g-u.t)],size:[s.W,s.D,s.H]};(k>=0?c[k].nodes:d).push(b)}for(let h of c)h.regions.length||delete h.regions,h.nodes.length||delete h.nodes;let m=(t.links??[]).map((h,y)=>({id:h.id??`link-${y}`,from:h.aOn??h.a,to:h.bOn??h.b,kind:h.kind,label:h.label}));return{isodiag:1,title:e.title,kinds:e.kinds,roles:e.roles,scenes:[{id:"board",title:e.title??"board",regions:l,nodes:d,routes:m}]}}var Pm={};yo(Pm,{APPEARS:()=>Ff,BASE_FIELDS:()=>up,BINS:()=>Qf,BIN_MS:()=>Cn,CARD:()=>Mt,DUAL_VIEW_CSS:()=>Mm,IDLES:()=>Df,MAX_ZOOM:()=>tl,MIN_ZOOM:()=>el,P3:()=>rt,PLAY_CSS:()=>Jf,SEGMENT_NAME:()=>al,SEVERITIES:()=>un,TIMELINE_VERSION:()=>Xf,activityOf:()=>xp,attr:()=>Qn,binNext:()=>ml,binStart:()=>lr,buildLayer:()=>lo,cardMotion:()=>Bf,clamp:()=>Ps,cls:()=>Vf,crumbs:()=>Jr,dualView:()=>$m,ease:()=>ao,escapeName:()=>pl,extent:()=>nl,findGaps:()=>ul,fitWithOverlay:()=>Kf,flatCss:()=>gm,flatSvg:()=>xl,formatScope:()=>em,gapKey:()=>pr,gapLabel:()=>cr,h:()=>ie,hasSegment:()=>sm,highlights:()=>io,isZone:()=>om,isoVars:()=>Gf,join:()=>tm,kindOf:()=>Yr,legend:()=>dp,levelOf:()=>Jt,markConnectors:()=>Sl,md:()=>Sn,measureIn:()=>kl,memorySource:()=>dm,modeFor:()=>wp,morphSvgs:()=>km,mountPlayer:()=>Wf,mountTimeline:()=>hm,n:()=>np,nameOf:()=>Wr,node:()=>qf,offsetAt:()=>nn,overlayPaint:()=>Lf,pageClock:()=>fp,parentOf:()=>nm,prefixAt:()=>Ms,prune:()=>rp,pts:()=>so,rangeOf:()=>ro,readTime:()=>hp,rectOf:()=>bm,renderPage:()=>Uf,rewrite:()=>sp,scope:()=>op,scopePattern:()=>ll,scopeRules:()=>cl,scopeSelector:()=>ip,searchFor:()=>Xr,severities:()=>rm,stepData:()=>pp,storedMode:()=>Sm,ticks:()=>hl,timeScale:()=>Qr,toCSV:()=>gl,toJSON:()=>yl,transport:()=>rl,unite:()=>sl,viewToggle:()=>vm,viewport:()=>jf,within:()=>hn});function Zh(t,e,s){let i=(a,f,p,c,l)=>Math.min((a-48)/(p-f),...c===void 0||l===void 0?[]:[[l-c,12],[l-f,30],[p-c,30]].map(([d,m])=>d>0?(a-m)/d:1/0)),o=Math.min(tl,Math.max(el,Math.min(i(t.w,e.x,e.x+e.w,s?.x,s&&s.x+s.w),i(t.h,e.y,e.y+e.h,s?.y,s&&s.y+s.h)))),n=(a,f,p,c,l)=>{let d=(f+p)/2;if(c===void 0||l===void 0)return d;let m=l-(a/2-6)/o,h=c+(a/2-6)/o;return m>h?(m+h)/2:Math.max(m,Math.min(h,d))};return{k:o,cx:n(t.w,e.x,e.x+e.w,s?.x,s&&s.x+s.w),cy:n(t.h,e.y,e.y+e.h,s?.y,s&&s.y+s.h)}}var el=.1,tl=8;function jf(t,e){let s,r,i=!1,o=0,n=0,a=0,f=0,p=0,c=!1,l=()=>{let S=t.getBoundingClientRect();return{w:Math.max(1,S.width),h:Math.max(1,S.height)}},d=(S=s)=>{let O=l();return Math.min(O.w/S.w,O.h/S.h)},m=S=>{o++;try{S()}finally{o--}};function h(){let S=e.svg();if(!S||!s)return;o||(i=!0);let O=l(),z=d(),A=O.w/z,R=O.h/z;s={x:s.x+(s.w-A)/2,y:s.y+(s.h-R)/2,w:A,h:R},S.setAttribute("viewBox",`${s.x.toFixed(2)} ${s.y.toFixed(2)} ${s.w.toFixed(2)} ${s.h.toFixed(2)}`),n=z,e.onApply(z),a&&Math.abs(z/a-1)>.02&&(cancelAnimationFrame(f),f=requestAnimationFrame(()=>{f=0,e.onRezoom()}))}let y=(S,O)=>{let z=t.getBoundingClientRect(),A=d();return{x:s.x+(S-z.left)/A,y:s.y+(O-z.top)/A}};function g(S,O,z){if(!s)return;let A=d(),R=Math.min(tl,Math.max(el,A*S)),P=t.getBoundingClientRect(),E=O??P.left+P.width/2,v=z??P.top+P.height/2,N=y(E,v),C=l();s={x:N.x-(E-P.left)/R,y:N.y-(v-P.top)/R,w:C.w/R,h:C.h/R},h()}function k(S=r,O){if(!S)return;let z=l(),{k:A,cx:R,cy:P}=Zh(z,S,O),E={x:R-z.w/A/2,y:P-z.h/A/2,w:z.w/A,h:z.h/A};if(s&&Math.abs(E.w/s.w-1)<.001&&Math.abs(E.h/s.h-1)<.001&&Math.abs(E.x-s.x)<E.w*.001&&Math.abs(E.y-s.y)<E.h*.001){h();return}s=E,h()}function u(){for(let S=0,O="";S<4;S++){let z=e.itemsBox()??r;if(!z)return;let A=[z.x,z.y,z.w,z.h].map(P=>Math.round(P)).join();if(A===O)break;O=A;let R=Math.max(24,Math.min(z.w,z.h)*.06);if(m(()=>k({x:z.x-R,y:z.y-R,w:z.w+R*2,h:z.h+R*2},e.alsoBox?.())),!e.marksShowing()||!a||Math.abs(d()/a-1)<=.02)break;cancelAnimationFrame(f),f=0,e.onRezoom()}i=!1}function b(){if(i||!e.svg()||!s)return;let S=t.getBoundingClientRect();S.width<2||S.height<2||u()}function x(){if(!s)return;let S=d();g(1/S)}function w(){return new Promise(S=>{let O=0,z=n,A=()=>{if(c){S();return}let R=!!(f||p)||n!==z;z=n,O=R?0:O+1,O>=2?S():requestAnimationFrame(A)};requestAnimationFrame(A)})}let $=new ResizeObserver(()=>{if(!(!s||c)){if(i&&n){let S=l(),O=s.x+s.w/2,z=s.y+s.h/2;s={x:O-S.w/n/2,y:z-S.h/n/2,w:S.w/n,h:S.h/n}}i||(cancelAnimationFrame(p),p=requestAnimationFrame(()=>{p=0,c||b()})),m(h)}});return $.observe(t),{get view(){return s},set view(S){s=S},get full(){return r},set full(S){r=S},get moved(){return i},get zoom(){return n},painted(S){a=S},size:l,scale:d,quietly:m,applyView:h,toSvg:y,zoomAt:g,fit:k,fitItems:u,autoFit:b,actual:x,settled:w,dispose(){cancelAnimationFrame(p),cancelAnimationFrame(f),$.disconnect(),c=!0}}}var Tt="http://www.w3.org/2000/svg",Mt={half:2.4,h:3.2,t:.25,above:1.4,lift:3.8,fan:.32,gap:.3},rt=(t,e,s)=>[(t-e)*Ct*ct,(t+e)*.5*ct-s*ct],so=t=>t.map(([e,s])=>`${e.toFixed(1)},${s.toFixed(1)}`).join(" ");function Lf(t,e){function s(o,n,a){let f=t.k(),p=(l,d,m,h,y="")=>{let g=o.createElementNS(Tt,"g");g.setAttribute("class",`live-badge ${m.cls} ${y}`.trim());let k=8/f,u=o.createElementNS(Tt,"circle");if(u.setAttribute("cx",String(l)),u.setAttribute("cy",String(d)),u.setAttribute("r",String(k)),g.append(u),"g"in m){let x=o.createElementNS(Tt,"text");x.setAttribute("x",String(l)),x.setAttribute("y",String(d)),x.style.fontSize=`${(10/f).toFixed(2)}px`,x.textContent=m.g,g.append(x)}else{let x=o.createElementNS(Tt,"use");x.setAttribute("href",t.iconHref(m.icon));let w=11/f;x.setAttribute("x",String(l-w/2)),x.setAttribute("y",String(d-w/2)),x.setAttribute("width",String(w)),x.setAttribute("height",String(w)),g.append(x)}let b=o.createElementNS(Tt,"title");b.textContent=h,g.append(b),n(g)},c=(l,d)=>{for(let m of t.outlinesFor(l)){if(m.kind!=="poly")continue;let h=o.createElementNS(Tt,"polygon");h.setAttribute("class",d),h.setAttribute("points",m.points.map(([y,g])=>`${y.toFixed(1)},${g.toFixed(1)}`).join(" ")),n(h)}};for(let l of a){let d=t.boxOf(l.at);if(d){if(l.outline&&c(l.at,l.outline),l.badge)p(d.x,d.y,l.badge,l.title);else if(l.hit){let m=o.createElementNS(Tt,"title");m.textContent=l.title;let h=o.createElementNS(Tt,"rect");h.setAttribute("class","live-hit"),h.setAttribute("x",String(d.x)),h.setAttribute("y",String(d.y)),h.setAttribute("width",String(d.w)),h.setAttribute("height",String(d.h)),h.append(m),n(h)}if((l.beside??[]).forEach((m,h)=>p(d.x+18*(h+1)/f,d.y,m.glyph,m.title)),l.dot&&p(d.x,d.y+d.h,l.dot.glyph,l.dot.title),l.tag){let m=o.createElementNS(Tt,"text");m.setAttribute("class",`live-life ${l.tag.cls}`),m.setAttribute("x",String(d.x+d.w)),m.setAttribute("y",String(d.y+d.h)),m.style.fontSize=`${(9/f).toFixed(2)}px`,m.textContent=l.tag.text,n(m)}}}}function r(o,n,a){for(let f of a){let p=o.createElementNS(Tt,"g");p.setAttribute("class",`live-extra${f.cls}`);for(let[b,x]of f.data)p.setAttribute(b,x);let{x:c,y:l,w:d,hgt:m,k:h}=f.rect,y=o.createElementNS(Tt,"rect");y.setAttribute("x",String(c)),y.setAttribute("y",String(l)),y.setAttribute("width",String(d)),y.setAttribute("height",String(m)),y.setAttribute("rx",String(6/h));let g=o.createElementNS(Tt,"text");g.setAttribute("x",String(c+8/h)),g.setAttribute("y",String(l+13/h)),g.style.fontSize=`${(11/h).toFixed(2)}px`,g.textContent=f.line1;let k=o.createElementNS(Tt,"text");k.setAttribute("class","sub"),k.setAttribute("x",String(c+8/h)),k.setAttribute("y",String(l+27/h)),k.style.fontSize=`${(9/h).toFixed(2)}px`,k.textContent=f.line2;let u=o.createElementNS(Tt,"title");u.textContent=f.title,p.append(y,g,k,u),n(p)}}function i(o,n,a){let f=[];for(let p of a){let c=p.over,l=(c.x0+c.x1)/2,d=(c.y0+c.y1)/2,m=0,h={x0:0,y0:0,x1:0,y1:0};for(let j=0;j<6;j++){let K=c.z1+Mt.above+m,U=K+Mt.h,ee=[rt(l-Mt.half,d+Mt.t,K),rt(l+Mt.half,d+Mt.t,K),rt(l+Mt.half,d-Mt.t,U),rt(l-Mt.half,d+Mt.t,U)];if(h={x0:Math.min(...ee.map(L=>L[0])),y0:Math.min(...ee.map(L=>L[1])),x1:Math.max(...ee.map(L=>L[0])),y1:Math.max(...ee.map(L=>L[1]))},!Ja(h,f))break;m+=Mt.lift}f.push(h);let y=c.z1+Mt.above+m,g=y+Mt.h,k=l-Mt.half,u=l+Mt.half,b=d+Mt.t,x=d-Mt.t,w=o.createElementNS(Tt,"g");w.setAttribute("class",`${e}-card${p.cls}`);for(let[j,K]of p.data)w.setAttribute(j,K);let[$,S]=rt(l,d,c.z1+.15),O=`${$.toFixed(1)}px ${S.toFixed(1)}px`;w.style.transformOrigin=O;let z=o.createElementNS(Tt,"g");z.setAttribute("class",`${e}-float`),z.style.transformOrigin=O;let A=[];for(let j=Math.min(p.count-1,3);j>=1;j--){let K=j*Mt.fan,U=x-(j-1)*(2*Mt.t+Mt.gap)-Mt.gap,ee=U-2*Mt.t,L=k+K,q=u+K,G=y+K,X=g+K,ce=(le,H)=>{let oe=o.createElementNS(Tt,"polygon");oe.setAttribute("class",`${e}-face stacked ${le}`),oe.setAttribute("points",so(H)),z.append(oe)};ce("s-top",[rt(L,ee,X),rt(q,ee,X),rt(q,U,X),rt(L,U,X)]),ce("s-side",[rt(q,ee,G),rt(q,U,G),rt(q,U,X),rt(q,ee,X)]),ce("s-front",[rt(L,U,G),rt(q,U,G),rt(q,U,X),rt(L,U,X)]),A.push({x0:L,x1:q,y0:ee,y1:U,z0:G,z1:X})}let R=o.createElementNS(Tt,"polygon");R.setAttribute("class",`${e}-tail`),R.setAttribute("points",so([rt(l-.5,b,y+.05),rt(l+.5,b,y+.05),rt(l,d,c.z1+.15)]));let P=(j,K)=>{let U=o.createElementNS(Tt,"polygon");return U.setAttribute("class",j),U.setAttribute("points",so(K)),U},E=P(`${e}-face front`,[rt(k,b,y),rt(u,b,y),rt(u,b,g),rt(k,b,g)]);z.append(R,P(`${e}-face top`,[rt(k,x,g),rt(u,x,g),rt(u,b,g),rt(k,b,g)]),P(`${e}-face side`,[rt(u,x,y),rt(u,b,y),rt(u,b,g),rt(u,x,g)]),E);let[v,N]=rt(k,b,g),C=40,V=o.createElementNS(Tt,"g");V.setAttribute("transform",`matrix(${(Ct*ct/C).toFixed(4)} ${(.5*ct/C).toFixed(4)} 0 ${(ct/C).toFixed(4)} ${v.toFixed(1)} ${N.toFixed(1)})`);let Y=(j,K,U,ee)=>{let L=o.createElementNS(Tt,"text");return L.setAttribute("class",j),L.setAttribute("x",String(K)),L.setAttribute("y",String(U)),L.textContent=ee,L};if(V.append(Y(`${e}-mark`,34,98,p.mark),Y(`${e}-who`,70,52,p.who),Y(`${e}-age`,70,82,p.age)),p.line!==void 0&&V.append(Y(`${e}-q`,12,118,p.line)),p.count>1){let j=o.createElementNS(Tt,"circle");j.setAttribute("class",`${e}-count-bg`),j.setAttribute("cx","178"),j.setAttribute("cy","14"),j.setAttribute("r","15"),V.append(j,Y(`${e}-count`,178,14,String(p.count)))}z.append(V);let Z=o.createElementNS(Tt,"title");Z.textContent=p.title,w.append(z,Z),t.onCard?.(w,{cx:l,cy:d,tipZ:c.z1+.15,card:{x0:k,x1:u,y0:x,y1:b,z0:y,z1:g},panes:A.reverse()}),n(w)}}return{paintMarks:s,paintGhosts:r,paintCards:i}}var Ff=[["scale","Scale"],["spin","Spin"],["dissolve","Dissolve"],["inflate","Inflate"]],Df=[["none","None"],["jiggle","Jiggle"],["pirouette","Pirouette"],["glow","Glow"],["breathe","Breathe"]];function Uh(t){let e=2166136261;for(let s=0;s<t.length;s++)e^=t.charCodeAt(s),e=Math.imul(e,16777619);return(e>>>0)%1e3/1e3}var Qc=t=>t<0?0:t>1?1:1-Math.pow(1-t,3),_f=t=>t<0?0:t>1?1:t*t*t,ep=Math.PI*2,tp={appear:{scale:420,spin:760,dissolve:520,inflate:640},disappear:{scale:320,spin:600,dissolve:420,inflate:420},period:{jiggle:4200,pirouette:6400,glow:3200,breathe:4400}},zn={windup:220,turn:980,land:260};function Bf(t,e,{prefix:s,key:r,alt:i}){let o={...e},n=1,a=new Map,f=new WeakSet,p=0,c=0,l=new WeakMap,d=new WeakMap;function m(R){p=0;for(let[P,E]of a){if(!P.isConnected){a.delete(P);continue}let v;if(E.repeat){if(v=(R+(E.offset??0))%E.repeat/E.dur,v>1){f.has(P)&&(t.restore(P),f.delete(P),P.style.removeProperty("transform"));continue}}else if(v=(R-E.start)/E.dur,v>=1){h(P,E);continue}let N=E.frame(Math.max(0,v));t.spin(P,N.theta,N.lift),f.add(P),d.set(P,N),N.scale!==1?P.style.transform=`scale(${N.scale.toFixed(4)})`:P.style.removeProperty("transform"),c++}a.size&&(p=requestAnimationFrame(m))}function h(R,P){a.delete(R),f.has(R)&&(t.restore(R),f.delete(R)),R.style.removeProperty("transform"),P.done?.()}function y(R){let P=a.get(R.card);P&&h(R.card,P),a.set(R.card,R),p||(p=requestAnimationFrame(m))}let g=8,k=0,u=R=>(k++,R.finally(()=>{k--}));function b(R){return!o.enabled||k>=g?Promise.resolve():u(w(R))}function x(R){return!o.enabled||k>=g?Promise.resolve():u($(R))}function w(R){let P=tp.appear[o.appear]/n;if(o.appear==="spin")return new Promise(N=>y({card:R,start:performance.now(),dur:P,frame:C=>({theta:(1-Qc(C))*ep,lift:0,scale:Math.max(.001,Qc(C))}),done:N}));let E=o.appear==="scale"?[{transform:"scale(0)"},{transform:"scale(1)"}]:o.appear==="dissolve"?[{opacity:0,filter:"blur(4px)"},{opacity:1,filter:"blur(0px)"}]:[{transform:"scale(0)",easing:"cubic-bezier(.3,0,.4,1)"},{transform:"scale(1.16)",offset:.55,easing:"ease-in-out"},{transform:"scale(.95)",offset:.78,easing:"ease-in-out"},{transform:"scale(1)"}];return R.animate(E,{duration:P,easing:o.appear==="inflate"?"linear":"ease-out"}).finished.then(()=>{},()=>{})}function $(R){let P=tp.disappear[o.appear]/n;if(o.appear==="spin")return new Promise(N=>y({card:R,start:performance.now(),dur:P,frame:C=>({theta:_f(C)*ep,lift:0,scale:Math.max(.001,1-_f(C))}),done:()=>{R.style.transform="scale(0)",N()}}));let E=o.appear==="scale"?[{transform:"scale(1)"},{transform:"scale(0)"}]:o.appear==="dissolve"?[{opacity:1,filter:"blur(0px)"},{opacity:0,filter:"blur(4px)"}]:[{transform:"scale(1)"},{transform:"scale(1.08)",offset:.3},{transform:"scale(0)"}];return R.animate(E,{duration:P,easing:"ease-in",fill:"forwards"}).finished.then(()=>{},()=>{})}function S(R){l.get(R)?.cancel(),l.delete(R);let P=a.get(R);P?.repeat&&h(R,P)}function O(R,P){if(S(R),!o.enabled||o.idle==="none"||R.classList.contains("still"))return;let E=R.getAttribute(r)??R.getAttribute(i)??"",v=(P??tp.period[o.idle])/n,N=Uh(E)*v;if(o.idle==="pirouette"){let j=(zn.windup+zn.turn+zn.land)/n,K=zn.windup/(zn.windup+zn.turn+zn.land),U=(zn.windup+zn.turn)/(zn.windup+zn.turn+zn.land);y({card:R,start:0,dur:j,repeat:v,offset:N,frame:ee=>{if(ee<K)return{theta:-.35*Math.sin(ee/K*Math.PI/2),lift:0,scale:1};if(ee<U){let q=(ee-K)/(U-K);return{theta:-.35*(1-q)+Qc(q)*ep,lift:.9*Math.sin(q*Math.PI),scale:1}}let L=(ee-U)/(1-U);return{theta:0,lift:0,scale:1-.04*Math.sin(L*Math.PI)}}});return}let C=R.querySelector(`.${s}-float`)??R,V=t.amber(),Y=o.idle==="jiggle"?[{transform:"scale(1)",offset:0},{transform:"scale(1.07)",offset:.04},{transform:"scale(.97)",offset:.08},{transform:"scale(1.02)",offset:.11},{transform:"scale(1)",offset:.14},{transform:"scale(1)",offset:1}]:o.idle==="glow"?[{filter:`drop-shadow(0 0 0px ${V})`},{filter:`drop-shadow(0 0 7px ${V})`},{filter:`drop-shadow(0 0 0px ${V})`}]:[{transform:"scale(1)"},{transform:"scale(1.035)"},{transform:"scale(1)"}],Z=C.animate(Y,{duration:v,iterations:1/0,easing:o.idle==="jiggle"?"linear":"ease-in-out"});Z.startTime=(document.timeline.currentTime??0)-((document.timeline.currentTime??0)+N)%v,l.set(R,Z)}function z(R,P,E,v,N=!1){N&&(v=!1);for(let[V,Y]of P)!R.has(V)&&!N&&b(Y),!l.has(Y)&&!a.get(Y)?.repeat&&O(Y);if(!o.enabled||!v)return;let C=t.leavingLayer();if(C)for(let[V,Y]of E){let Z=R.get(V);!Z||P.has(V)||(S(Z),Z.setAttribute("class",`${s}-leaving${Y?" expired":""}`),Z.removeAttribute(i),C.append(Z),x(Z).then(()=>Z.remove()))}}function A(R){for(let[P,E]of[...a])h(P,E);p&&cancelAnimationFrame(p),p=0;for(let P of document.getAnimations())P.effect?.target?.closest?.(`.live-layer, .${s}-leaving-layer`)&&P.cancel();t.leavingLayer()?.replaceChildren()}return{get settings(){return{...o}},set(R,P){let E=o;if(o={...o,...R},(!o.enabled||E.idle!==o.idle||E.enabled!==o.enabled)&&(A(void 0),o.enabled))for(let v of P)O(v)},update:z,appear:b,disappear:x,startIdle:O,stopIdle:S,stopAll:A,async preview(R){o.enabled&&await Promise.all(R.map(async P=>{if(S(P),await b(P),o.idle!=="none"&&!P.classList.contains("still")){let E=o.idle==="pirouette"?1800:1400;O(P,E),await new Promise(v=>setTimeout(v,E*2.2/n)),S(P)}else await new Promise(E=>setTimeout(E,700/n));await x(P);for(let E of P.getAnimations())E.cancel();P.style.removeProperty("transform"),O(P)}))},get stats(){return{jobs:a.size,raf:!!p,frames:c,effects:k}},setSpeed(R){n=R},lastFrame:R=>d.get(R)}}var np=t=>String(Math.round(t*100)/100),qf=(t,e={},...s)=>({name:t,attrs:Object.entries(e).map(([r,i])=>[r,typeof i=="number"?np(i):i]),children:s});function sp(t,e){if(typeof t=="string")return t;let s=t.attrs.map(([r,i])=>{if(r==="id")return[r,e+i];let o=i.replace(/var\(--([a-zA-Z][\w-]*)/g,"var(--iso-$1").replace(/url\(\s*(['"]?)#/g,(n,a)=>`url(${a}#${e}`);return(r==="href"||r==="xlink:href")&&o.startsWith("#")&&!o.startsWith(`#${e}`)&&(o=`#${e}${o.slice(1)}`),[r,o]});return{name:t.name,attrs:s,children:t.children.map(r=>sp(r,e))}}function rp(t,e){if(typeof t=="string")return t;if(!e(t))return{...t,children:t.children.map(s=>rp(s,e)).filter(s=>s!==void 0)}}var Vf=t=>(t.attrs.find(e=>e[0]==="class")?.[1]??"").split(/\s+/),Qn=(t,e)=>t.attrs.find(s=>s[0]===e)?.[1];function nl(t){let e=[],s=[],r=n=>{if(typeof n=="string")return;let a=Qn(n,"transform");if(a&&/matrix/.test(a))return;let f=Qn(n,"points");if(f)for(let p of f.trim().split(/\s+/)){let[c,l]=p.split(",").map(Number);Number.isFinite(c)&&Number.isFinite(l)&&(e.push(c),s.push(l))}if(n.name==="rect"){let p=Number(Qn(n,"x")),c=Number(Qn(n,"y")),l=Number(Qn(n,"width")),d=Number(Qn(n,"height"));[p,c,l,d].every(Number.isFinite)&&(e.push(p,p+l),s.push(c,c+d))}if(n.name==="circle"){let p=Number(Qn(n,"cx")),c=Number(Qn(n,"cy")),l=Number(Qn(n,"r"));[p,c,l].every(Number.isFinite)&&(e.push(p-l,p+l),s.push(c-l,c+l))}n.children.forEach(r)};if(t.forEach(r),!e.length)return;let i=Math.min(...e),o=Math.min(...s);return{x:i,y:o,w:Math.max(...e)-i,h:Math.max(...s)-o}}var sl=(t,e)=>{if(!e)return t;let s=Math.min(t.x,e.x),r=Math.min(t.y,e.y);return{x:s,y:r,w:Math.max(t.x+t.w,e.x+e.w)-s,h:Math.max(t.y+t.h,e.y+e.h)-r}};function Kf(t,e,s){let r=a=>Math.min((e.width-e.pad*2)/a.w,(e.height-e.pad*2)/a.h),i=r(t),o=s(i),n=sl(t,nl(o));return i=r(n),o=s(i),n=sl(t,nl(o)),i=r(n),{k:i,box:n,live:o}}var Gf=t=>t.replace(/--([a-zA-Z][\w-]*)/g,"--iso-$1");function Hh(t){let e=[],s=0,r=t.replace(/\/\*[\s\S]*?\*\//g,"");for(;s<r.length;){let i=r.indexOf("{",s);if(i<0)break;let o=1,n=i+1;for(;n<r.length&&o;)r[n]==="{"?o++:r[n]==="}"&&o--,n++;e.push([r.slice(s,i).trim(),r.slice(i+1,n-1)]),s=n}return e}function Yh(t){let e=[],s=0,r=0;for(let i=0;i<t.length;i++){let o=t[i];o==="("||o==="["?s++:o===")"||o==="]"?s--:o===","&&!s&&(e.push(t.slice(r,i).trim()),r=i+1)}return e.push(t.slice(r).trim()),e.filter(Boolean)}function ip(t,e,s){let r=/^:root((?:\[[^\]]*\]|:not\([^)]*\))*)(.*)$/.exec(t),i=s.replace(/^\./,"");if(r){let o=r[1],n=r[2].trim();return`${o?`.${i}${o} `:""}${e}${n?" "+n:""}`}if(/^(html|body|\*)\b/.test(t)||/^[a-z]+$/.test(t)&&!/^(svg|g|text|path|polygon|rect|circle|line)$/.test(t))throw new Error(`the canvas's CSS can't style the page: "${t}"`);return`${e} ${t}`}function op(t,e,s){let r="";for(let[i,o]of Hh(t)){if(i.startsWith("@keyframes")){r+=`@keyframes iso-${i.slice(10).trim()}{${o}}
294
+ `;continue}if(i.startsWith("@media")||i.startsWith("@supports")){r+=`${i}{${op(o,e,s)}}
295
+ `;continue}if(i.startsWith("@"))throw new Error(`the canvas's CSS has an at-rule it can't scope: ${i}`);r+=`${Yh(i).map(n=>ip(n,e,s)).join(",")}{${o.replace(/\banimation:\s*([a-z][\w-]*)/g,"animation:iso-$1")}}
296
+ `}return r}var ap=["<","script"].join("");function Sn(t){return t?vt(t).replace(/`([^`]+)`/g,"<code>$1</code>").replace(/\*\*([^*]+)\*\*/g,"<b>$1</b>").replace(/(^|[^*])\*([^*\s][^*]*)\*/g,"$1<em>$2</em>").replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,(e,s,r)=>/^(https?:|#|\.{0,2}\/)/.test(r.replace(/&amp;/g,"&"))?`<a href="${r}">${s}</a>`:s):""}var lp=t=>(t??"").split(/\n\s*\n/).filter(Boolean).map(e=>`<p class="sec-sub">${Sn(e.trim())}</p>`).join(""),Zf=(t,e)=>!!e.motion&&vs(e,e.motion,{kinds:t.theme.kinds}).ok;function cp(t,e){return Zf(t,e)?vs(e,e.motion,{kinds:t.theme.kinds}).beats.map(s=>({n:s.index+1,num:s.index+1,kind:"control",color:s.say?.color??Hn(t.theme,t.theme.kinds.control?.color??"control"),heading:s.say?.title??s.name,caption:s.say?.text??"",command:s.say?.code??"",phases:[],pulses:[],lit:[],duration:s.end-s.start})):e.steps.steps}function pp(t){return JSON.stringify({scenes:t.scenes.map(e=>{let s=Zf(t,e),r=cp(t,e),i=s?e.motion:e.steps.steps.length?Va(e):void 0;return{id:e.id,loop:e.raw.loop??!0,dim:e.raw.dim??"flows",vis:e.steps.vis,steps:r.map(({focus:o,...n})=>({...n,caption:Sn(n.caption)})),assemble:e.assemble,grid:!!e.grid.show,source:Ji(e),...i?{doc:i}:{},...s?{own:s}:{}}})})}function dp(t,e){let s=t.theme,r=e.raw.legend;if(r===!1)return"";let i=Array.isArray(r)?r:e.steps.kindsUsed.filter(a=>e.routes.some(f=>f.kind===a)||e.steps.steps.some(f=>f.phases.some(p=>p.some(c=>c.kind===a)))),o=a=>`<span><i${a.box?' class="box"':""} style="${a.swatch}"></i>${a.label}</span>`,n=i.map(a=>{let f=Ot(t.catalog,a)?.legend;if(f)return o(f);let p=s.kinds[a];return p?`<span><i style="${`border-color:${Hn(s,p.color)}${p.dash==="dashed"?";border-top-style:dashed":p.dash==="dotted"?";border-top-style:dotted":""}`}"></i>${Sn(p.legend)}</span>`:""});if(!Array.isArray(r)){let a=new Set(e.layout.items.map(f=>f.region?.kind));for(let[f,p]of Object.entries(t.catalog.regions))p.legend?.auto&&a.has(f)&&n.push(o(p.legend))}return n.join("")}function Wh(t,e){let s=cp(t,e),r=`<div class="tools">
297
297
  <button class="pbtn small" type="button" data-a="grid" aria-pressed="${e.grid.show?"true":"false"}" title="Show the floor grid">Grid</button>
298
298
  <button class="pbtn small" type="button" data-a="assemble" title="Draw the diagram again, piece by piece">Assemble</button>
299
299
  </div>`;if(!s.length)return`<div class="player">${r}</div>`;let i=s[0];return`<div class="player">
@@ -305,22 +305,22 @@ svg.pre-assemble > g:not(.g-anim){opacity:0}
305
305
  ${r}
306
306
  <div class="cap" aria-live="polite">
307
307
  <div class="cap-h"><span class="num" style="background:${i.color}">${i.num}</span><span class="h">${vt(i.heading)}</span><span class="cnt">1 / ${s.length}</span></div>
308
- <p class="cap-t">${$n(i.caption)}</p>
308
+ <p class="cap-t">${Sn(i.caption)}</p>
309
309
  <pre class="cap-c">${vt(i.command)}</pre>
310
310
  <div class="prog"><i></i></div>
311
311
  </div>
312
312
  <div class="dots"></div>
313
- </div>`}function Uh(t,e){let s=ap(t,e);return s.length?`<details class="steps"><summary>All ${s.length} steps as text</summary><ol>${s.map(r=>`<li value="${r.num}"><b>${vt(r.heading)}.</b> ${$n(r.caption)}${r.command?`<br><code>${vt(r.command)}</code>`:""}</li>`).join("")}</ol></details>`:""}function Kf(t,e={}){let s=t.doc,r=s.title??s.scenes[0]?.title??"Diagram",i=(s.pills??[]).map(n=>`<span class="pill">${$n(n)}</span>`).join(""),o=t.scenes.map(n=>`
313
+ </div>`}function Jh(t,e){let s=cp(t,e);return s.length?`<details class="steps"><summary>All ${s.length} steps as text</summary><ol>${s.map(r=>`<li value="${r.num}"><b>${vt(r.heading)}.</b> ${Sn(r.caption)}${r.command?`<br><code>${vt(r.command)}</code>`:""}</li>`).join("")}</ol></details>`:""}function Uf(t,e={}){let s=t.doc,r=s.title??s.scenes[0]?.title??"Diagram",i=(s.pills??[]).map(n=>`<span class="pill">${Sn(n)}</span>`).join(""),o=t.scenes.map(n=>`
314
314
  <section class="scene" id="scene-${vt(n.id)}">
315
315
  <h2>${vt(n.raw.title)}</h2>
316
- ${op(n.raw.caption)}
316
+ ${lp(n.raw.caption)}
317
317
  <div class="figure" tabindex="-1">
318
318
  <div class="scroller">${n.grid.show?n.rendered.svg.replace("<svg ",'<svg class="show-grid" '):n.rendered.svg}</div>
319
- ${Zh(t,n)}
320
- <div class="legend">${cp(t,n)}</div>
319
+ ${Wh(t,n)}
320
+ <div class="legend">${dp(t,n)}</div>
321
321
  </div>
322
- ${Uh(t,n)}
323
- ${n.raw.after?`<div class="after">${op(n.raw.after)}</div>`:""}
322
+ ${Jh(t,n)}
323
+ ${n.raw.after?`<div class="after">${lp(n.raw.after)}</div>`:""}
324
324
  </section>`).join(`
325
325
  `);return`<!doctype html>
326
326
  <html lang="en">
@@ -330,7 +330,7 @@ svg.pre-assemble > g:not(.g-anim){opacity:0}
330
330
  <title>${vt(r)}</title>
331
331
  ${s.lede?`<meta name="description" content="${vt(s.lede)}">`:""}
332
332
  <style>
333
- ${ra(t.theme)}${Ur(t.catalog)}${Za}
333
+ ${aa(t.theme)}${Ur(t.catalog)}${Ya}
334
334
  </style>
335
335
  ${e.extraHead??""}
336
336
  </head>
@@ -339,16 +339,16 @@ ${e.extraHead??""}
339
339
  <header class="page">
340
340
  <div>
341
341
  <h1>${vt(r)}</h1>
342
- ${s.lede?`<p class="lede">${$n(s.lede)}</p>`:""}
342
+ ${s.lede?`<p class="lede">${Sn(s.lede)}</p>`:""}
343
343
  </div>
344
344
  <div class="pills">${i}<button class="theme" id="themeBtn" type="button">Theme</button></div>
345
345
  </header>
346
346
  ${o}
347
- ${s.after?op(s.after):""}
348
- ${s.footer?`<footer>${$n(s.footer)}</footer>`:""}
347
+ ${s.after?lp(s.after):""}
348
+ ${s.footer?`<footer>${Sn(s.footer)}</footer>`:""}
349
349
  </div>
350
- ${ip} type="application/json" id="diagram-steps">${lp(t).replace(/</g,"\\u003c")}<\/script>
351
- ${ip}>
350
+ ${ap} type="application/json" id="diagram-steps">${pp(t).replace(/</g,"\\u003c")}<\/script>
351
+ ${ap}>
352
352
  (function(){
353
353
  var root=document.documentElement, m=/theme=(light|dark)/.exec(location.hash);
354
354
  try{var t=localStorage.getItem('diagram-theme'); if(t) root.dataset.theme=t;}catch(e){}
@@ -360,11 +360,11 @@ ${ip}>
360
360
  });
361
361
  })();
362
362
  <\/script>
363
- ${e.runtime?`${ip}>${e.runtime}<\/script>`:""}
363
+ ${e.runtime?`${ap}>${e.runtime}<\/script>`:""}
364
364
  ${e.extraBody??""}
365
365
  </body>
366
366
  </html>
367
- `}function pp(){let t=globalThis;return{now:()=>performance.now(),next(e){let s={},r=()=>{s.raf!==void 0&&t.cancelAnimationFrame?.(s.raf),clearTimeout(s.timer),e()};return s.raf=t.requestAnimationFrame?.(r),s.timer=setTimeout(r,s.raf===void 0?16:100),s},cancel(e){let s=e;s.raf!==void 0&&t.cancelAnimationFrame?.(s.raf),clearTimeout(s.timer)}}}var Hh=400;function tl(t,e={}){let s=e.clock??pp(),r=t,i=0,o=b(e.rate??1),n=e.loop??!1,a=!1,f=!0,p=!1,c=(e.ambient??r.ambient)==="on",l=c?0:"off",d,m=0,h=r.beatAt(0),y=!1,g=0,k,u={};function b(N){if(!(Number.isFinite(N)&&N>0))throw new Error("rate is a number over 0");return N}let x=N=>Math.max(0,Math.min(r.duration,N));function w(N,...z){for(let K of[...u[N]??[]])K(...z)}let $=()=>f&&!p&&(a||c&&r.loops);function v(){$()?d===void 0&&(m=s.now(),d=s.next(A)):d!==void 0&&(s.cancel(d),d=void 0)}function O(N,z){let K=g;for(let J of r.beats)if(!(J.start<=N||J.start>z||J.index===h?.index)&&(h=J,y=!0,w("beat",J,"play"),g!==K))return!1;return!0}function C(N){if(!a){w("time",i,"ambient");return}let z=i,K=i+N,J=g;if(k!==void 0&&K>=k){if(i=k,!O(z,i))return;k=void 0,a=!1,w("time",i,"play"),g===J&&w("pause");return}if(K<r.duration){i=K,O(z,i)&&w("time",i,"play");return}if(n){if(!O(z,r.duration)||(i=K%r.duration,c&&(l=i),h=void 0,w("loop"),g!==J))return;let Z=r.beatAt(0);if(Z&&(h=Z,w("beat",Z,"play"),g!==J||!O(Z.start,i)))return;w("time",i,"play");return}i=r.duration,O(z,i)&&(a=!1,w("time",i,"play"),g===J&&(w("pause"),g===J&&w("end")))}function A(){d=void 0;let N=s.now(),z=Math.max(0,N-m)*o;m=N,c&&l!=="off"&&(l+=z),C(z),d===void 0&&$()&&(d=s.next(A))}function R(N,z=!1){let K=r.beatAt(i);g++;let J=g,Z=K?.name!==h?.name||K?.index!==h?.index;h=K,!(K&&(Z||z)&&(y=!0,w("beat",K,N),g!==J))&&w("time",i,N)}function M(N,z={}){if(p||!Number.isFinite(N))return;let K=x(N);c&&l!=="off"&&(l=z.join?K:l+K-i),i=K,m=s.now(),k!==void 0&&i>=k&&(k=void 0),R("seek"),v()}function T(){p||(i=0,c&&(l=0),k=void 0,m=s.now(),R("seek",!0),v())}let S={get timeline(){return r},get duration(){return r.duration},get time(){return i},get ambientTime(){return l},get playing(){return a},get beat(){return h},get cue(){return r.cues(i)},get rate(){return o},set rate(N){let z=b(N);z!==o&&(o=z,w("rate",z))},get loop(){return n},set loop(N){n=N},get ambient(){return c},set ambient(N){p||N===c||(c=N,c&&l==="off"&&(l=h?.start??0),v(),w("ambient",c),w("time",i,"ambient"))},get active(){return f},set active(N){N!==f&&(f=N,v())},state:()=>r.at(i,{ambient:l}),play(N={}){p||a||r.duration<=0||(i>=r.duration&&N.until===void 0&&T(),k=N.until!==void 0&&N.until>i&&N.until<=r.duration?N.until:void 0,!(N.until!==void 0&&k===void 0)&&(a=!0,m=s.now(),v(),w("play"),a&&!y&&h&&(y=!0,w("beat",h,"play"))))},pause(){a&&(a=!1,k=void 0,g++,v(),w("pause"))},toggle(){a?S.pause():S.play()},seek:M,seekBeat(N){let z=typeof N=="number"?r.beats[N]?.start:r.beats.find(K=>K.name===N)?.start;return z===void 0?!1:(M(z),!0)},next(){let N=r.beats.find(z=>z.start>i);M(N?N.start:r.duration)},prev(){let N=[...r.beats].reverse().find(z=>z.start<i-Hh);M(N?N.start:0)},restart:T,rebind(N){if(p||!N.ok)return!1;k=void 0;let z=r.beatAt(i),K=z?(i-z.start)/Math.max(1,z.end-z.start):0,J=l==="off"?0:l-i,Z=r;if(r=N,z){let L=N.beats.find(U=>U.name===z.name);if(L)i=L.start+K*(L.end-L.start);else{let U=Z.beats.filter(H=>H.index<z.index).reverse().map(H=>N.beats.find(ee=>ee.name===H.name)).find(Boolean);i=U?U.start:0}}return i=x(i),c&&l!=="off"&&(l=i+J),m=s.now(),R("rebind"),v(),!0},on(N,z){let K=u[N]??=new Set;return K.add(z),()=>{K.delete(z)}},dispose(){p=!0,g++,a=!1,d!==void 0&&s.cancel(d),d=void 0;for(let N of Object.keys(u))u[N].clear()}};return v(),S}function re(t,e=null,...s){let r=document.createElement(t);for(let[i,o]of Object.entries(e??{}))if(!(o==null||o===!1))if(i==="class")r.className=String(o);else if(i==="on")for(let[n,a]of Object.entries(o))r.addEventListener(n,a);else r.setAttribute(i,o===!0?"":String(o));for(let i of s)i!=null&&i!==!1&&r.append(i instanceof Node?i:document.createTextNode(String(i)));return r}var sl=new Map;function Gf(){let t,e=.35;for(let[s,r]of sl)r.wants&&r.seen>=e&&(r.seen>e||!t)&&(t=s,e=r.seen);for(let[s,r]of sl)r.wants&&r.auto(s===t)}var Zf=t=>{let e=new DOMParser().parseFromString(t,"image/svg+xml");if(e.documentElement.localName!=="svg")throw new Error("the drawing is not SVG");return document.importNode(e.documentElement,!0)},nl=t=>{let e=Math.round(t/1e3);return`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`},Uf={ok:!0,diags:[],duration:0,beats:[],markers:{},ambient:"on",loops:!1,at:()=>({}),cues:()=>{},beatAt:()=>{},startOf:()=>{}};function Yh(t){let e={...t.camera?{camera:t.camera}:{},...t.variants?{variants:t.variants}:{}};for(let s of["items","labels","routes"]){let r=Object.entries(t[s]??{}).filter(([,i])=>i.opacity===0).map(([i])=>[i,{opacity:0}]);r.length&&(e[s]=Object.fromEntries(r))}return e}function Hf(t,e){if(e.timeline&&!e.timeline.ok)throw new Error(`the motion has faults: ${e.timeline.diags.map(V=>`${V.path}: ${V.message}`).join("; ")}`);let s=e.scene,r=Zf(s.rendered.svg),i,o,n=!1,a=!1,f=tl(e.timeline??Uf,{loop:e.loop,rate:e.rate,ambient:e.ambient,clock:e.clock}),p=e.controls??!0,c=e.reducedMotion==="respect"&&typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches,l=c,d=(V,te,ae,Te)=>re("button",{type:"button",class:`iso-play-btn ${V}`,"aria-label":te,title:te,on:{click:Te}},ae),m=re("div",{class:"iso-play-stage"},r),h=d("back","Back","\u2039",()=>ce(()=>Y(Math.max(0,G()-1)))),y=d("play","Play","\u25B6",()=>ie()),g=d("next","Next","\u203A",()=>ce(()=>Y(Math.min(f.timeline.beats.length-1,G()+1)))),k=d("again","Reset","\u21BA",()=>ce(()=>{pe(),f.restart()})),u=d("ambient","Ambient motion","\u223F",()=>{Q(),f.ambient=!f.ambient,ee()}),b=re("input",{type:"range",class:"iso-play-bar",min:0,step:1,"aria-label":"Time",on:{input:(()=>ce(()=>{pe(),f.seek(Number(b.value))}))}}),x=re("span",{class:"iso-play-time"}),w=re("div",{class:"iso-play-dots"}),$=re("span",{class:"iso-play-num"}),v=re("span",{class:"iso-play-title"}),O=re("span",{class:"iso-play-chapter"}),C=re("span",{class:"iso-play-count"}),A=re("div",{class:"iso-play-text"}),R=re("pre",{class:"iso-play-code"}),M=re("dl",{class:"iso-play-facts"}),T=re("div",{class:"iso-play-say","aria-live":"polite"},re("div",{class:"iso-play-head"},$,v,O,C),A,R,M),S=re("details",{class:"iso-play-list"}),N=re("div",{class:"iso-play-row"},h,y,g,k,u,b,x),z=re("div",{class:"iso-play",role:"group","aria-roledescription":"animated diagram","aria-label":e.label??"Diagram",tabindex:p?0:void 0,"data-mode":e.mode??"light"},m,p&&N,p&&w,p&&T,p&&S);t.append(z);let K=[];function J(){let V=f.timeline.beats,te=V.length>0,ae=V.some(ze=>ze.say);K=[],w.replaceChildren();let Te,be;for(let ze of V){(!Te||ze.say?.chapter!==be)&&(Te=re("span",{class:"iso-play-group",role:"group","aria-label":ze.say?.chapter,title:ze.say?.chapter}),w.append(Te),be=ze.say?.chapter);let Ie=re("button",{type:"button",class:"iso-play-dot","aria-label":`Step ${ze.index+1}: ${ze.say?.title??ze.name}`,title:ze.say?.title??ze.name,on:{click:(()=>ce(()=>Y(ze.index)))}});Te.append(Ie),K.push(Ie)}S.replaceChildren(re("summary",null,`All ${V.length} steps as text`),re("ol",null,...V.map(ze=>re("li",null,...Z(ze)))));for(let ze of[h,g,w])ze.hidden=!te;T.hidden=!ae,S.hidden=!ae,u.hidden=!f.timeline.loops,b.max=String(Math.round(f.duration));for(let ze of[y,k,b,x])ze.hidden=f.duration<=0;L=void 0}function Z(V){let te=V.say,ae=[re("b",null,te?.title??V.name)];if(te?.text){let Te=re("div",null);Te.innerHTML=$n(te.text),ae.push(Te)}return te?.code&&ae.push(re("code",null,te.code)),te?.facts?.length&&ae.push(re("span",null,te.facts.map(([Te,be])=>`${Te}: ${be}`).join(" \xB7 "))),ae}let L;function U(V){let te=String((V?.index??-1)+1);for(let ae of r.querySelectorAll("[data-badge]"))ae.classList.toggle("on",ae.getAttribute("data-badge")===te),e.steps&&(ae.getAttribute("data-badge")===te||l?ae.removeAttribute("opacity"):ae.setAttribute("opacity","0.14"));if(e.steps)for(let ae of r.querySelectorAll("[data-step]"))ae.setAttribute("visibility",ae.getAttribute("data-step")===te&&!l?"visible":"hidden")}function H(){let V=f.beat;if(V===L||(L=V,U(V),!p))return;let te=V?.say;$.textContent=V?String(V.index+1):"",$.style.backgroundColor=te?.color??"",v.textContent=te?.title??V?.name??"",O.textContent=te?.chapter??"",C.textContent=V?`${V.index+1} / ${f.timeline.beats.length}`:"",A.innerHTML=$n(te?.text),R.textContent=te?.code??"",M.replaceChildren(...(te?.facts??[]).flatMap(([ae,Te])=>[re("dt",null,ae),re("dd",null,Te)])),R.hidden=!te?.code,M.hidden=!te?.facts?.length,K.forEach((ae,Te)=>{ae.classList.toggle("on",Te===V?.index),ae.classList.toggle("done",V!==void 0&&Te<V.index),Te===V?.index?ae.setAttribute("aria-current","step"):ae.removeAttribute("aria-current")})}function ee(){let V=i!==void 0?f.timeline.at(i,{ambient:i}):l?Yh(f.timeline.at(f.duration,{ambient:"off"})):f.state();Ea(r,V,s.rendered,{styles:"cssom"}),z.dataset.time=String(Math.round(i??f.time)),i!==void 0?U(f.timeline.beatAt(i)):H(),p&&(b.value=String(Math.round(f.time)),b.setAttribute("aria-valuetext",`${nl(f.time)} of ${nl(f.duration)}${f.beat?`, ${f.beat.say?.title??f.beat.name}`:""}`),x.textContent=`${nl(f.time)} / ${nl(f.duration)}`)}function j(){let V=q();y.textContent=V?"\u275A\u275A":"\u25B6",y.setAttribute("aria-label",V?"Pause":"Play"),y.title=V?"Pause":"Play",u.setAttribute("aria-pressed",String(f.ambient)),T.setAttribute("aria-live",V?"off":"polite"),z.dataset.playing=String(V)}let q=()=>f.playing&&o===void 0,G=()=>f.beat?.index??0;function Q(){l&&(l=!1,L=void 0)}function ce(V){Q(),n=!0,V(),j(),ee()}function pe(){o=void 0,f.pause()}function Y(V){let te=f.timeline.beats[V];if(!te||a)return;f.pause(),f.seek(te.start,{join:!0});let ae=f.timeline.beats[V+1]?.start??1/0;o=Math.max(te.start,Math.min(te.end,ae,f.duration)-1),f.play({until:o})}function ie(){Q(),q()?(n=!0,pe()):(n=!1,o=void 0,f.pause(),f.play()),j(),ee()}f.on("time",ee),f.on("play",j),f.on("ambient",j),f.on("pause",()=>{o=void 0,j()}),z.addEventListener("keydown",V=>{let te=V.key,ae=V.target;V.altKey||V.ctrlKey||V.metaKey||ae===b||(te==="ArrowRight"||te==="ArrowLeft"?(V.preventDefault(),(te==="ArrowRight"?g:h).click()):te==="Home"?(V.preventDefault(),k.click()):(te===" "||te==="k")&&ae===z&&(V.preventDefault(),ie()))});let Ae=V=>{let te=V.target.closest?.("[data-go]"),ae=V.key;!te||V.type==="keydown"&&ae!=="Enter"&&ae!==" "||(V.preventDefault(),V.stopPropagation(),ce(()=>Y(Number(te.getAttribute("data-go"))-1)))};m.addEventListener("click",Ae),m.addEventListener("keydown",Ae);let De={seen:0,wants:e.autoplay==="visible"&&!c,auto(V){V?!n&&!q()&&(o=void 0,f.play()):q()&&(o=void 0,f.pause())}};sl.set(z,De);let I=typeof IntersectionObserver=="function"?new IntersectionObserver(V=>{for(let te of V)De.seen=te.isIntersecting?te.intersectionRatio:0,i===void 0&&(f.active=te.isIntersecting);Gf()},{threshold:[0,.2,.35,.5,.7,.9,1]}):void 0;return I?.observe(z),J(),j(),ee(),e.autoplay===!0&&!c&&f.play(),{root:z,transport:f,step:V=>ce(()=>Y(V)),set(V,te=Uf,ae){if(a||!te.ok)return!1;let Te=Zf(V.rendered.svg);return s=V,r.replaceWith(Te),r=Te,ae&&(z.dataset.mode=ae),o!==void 0&&pe(),f.rebind(te),J(),j(),ee(),!0},freeze(V){i=V,f.pause(),f.active=!1,z.classList.add("frozen"),ee()},dispose(){a=!0,I?.disconnect(),sl.delete(z),f.dispose(),z.remove(),Gf()}}}var Yf=`
367
+ `}function fp(){let t=globalThis;return{now:()=>performance.now(),next(e){let s={},r=()=>{s.raf!==void 0&&t.cancelAnimationFrame?.(s.raf),clearTimeout(s.timer),e()};return s.raf=t.requestAnimationFrame?.(r),s.timer=setTimeout(r,s.raf===void 0?16:100),s},cancel(e){let s=e;s.raf!==void 0&&t.cancelAnimationFrame?.(s.raf),clearTimeout(s.timer)}}}var Xh=400;function rl(t,e={}){let s=e.clock??fp(),r=t,i=0,o=b(e.rate??1),n=e.loop??!1,a=!1,f=!0,p=!1,c=(e.ambient??r.ambient)==="on",l=c?0:"off",d,m=0,h=r.beatAt(0),y=!1,g=0,k,u={};function b(N){if(!(Number.isFinite(N)&&N>0))throw new Error("rate is a number over 0");return N}let x=N=>Math.max(0,Math.min(r.duration,N));function w(N,...C){for(let V of[...u[N]??[]])V(...C)}let $=()=>f&&!p&&(a||c&&r.loops);function S(){$()?d===void 0&&(m=s.now(),d=s.next(A)):d!==void 0&&(s.cancel(d),d=void 0)}function O(N,C){let V=g;for(let Y of r.beats)if(!(Y.start<=N||Y.start>C||Y.index===h?.index)&&(h=Y,y=!0,w("beat",Y,"play"),g!==V))return!1;return!0}function z(N){if(!a){w("time",i,"ambient");return}let C=i,V=i+N,Y=g;if(k!==void 0&&V>=k){if(i=k,!O(C,i))return;k=void 0,a=!1,w("time",i,"play"),g===Y&&w("pause");return}if(V<r.duration){i=V,O(C,i)&&w("time",i,"play");return}if(n){if(!O(C,r.duration)||(i=V%r.duration,c&&(l=i),h=void 0,w("loop"),g!==Y))return;let Z=r.beatAt(0);if(Z&&(h=Z,w("beat",Z,"play"),g!==Y||!O(Z.start,i)))return;w("time",i,"play");return}i=r.duration,O(C,i)&&(a=!1,w("time",i,"play"),g===Y&&(w("pause"),g===Y&&w("end")))}function A(){d=void 0;let N=s.now(),C=Math.max(0,N-m)*o;m=N,c&&l!=="off"&&(l+=C),z(C),d===void 0&&$()&&(d=s.next(A))}function R(N,C=!1){let V=r.beatAt(i);g++;let Y=g,Z=V?.name!==h?.name||V?.index!==h?.index;h=V,!(V&&(Z||C)&&(y=!0,w("beat",V,N),g!==Y))&&w("time",i,N)}function P(N,C={}){if(p||!Number.isFinite(N))return;let V=x(N);c&&l!=="off"&&(l=C.join?V:l+V-i),i=V,m=s.now(),k!==void 0&&i>=k&&(k=void 0),R("seek"),S()}function E(){p||(i=0,c&&(l=0),k=void 0,m=s.now(),R("seek",!0),S())}let v={get timeline(){return r},get duration(){return r.duration},get time(){return i},get ambientTime(){return l},get playing(){return a},get beat(){return h},get cue(){return r.cues(i)},get rate(){return o},set rate(N){let C=b(N);C!==o&&(o=C,w("rate",C))},get loop(){return n},set loop(N){n=N},get ambient(){return c},set ambient(N){p||N===c||(c=N,c&&l==="off"&&(l=h?.start??0),S(),w("ambient",c),w("time",i,"ambient"))},get active(){return f},set active(N){N!==f&&(f=N,S())},state:()=>r.at(i,{ambient:l}),play(N={}){p||a||r.duration<=0||(i>=r.duration&&N.until===void 0&&E(),k=N.until!==void 0&&N.until>i&&N.until<=r.duration?N.until:void 0,!(N.until!==void 0&&k===void 0)&&(a=!0,m=s.now(),S(),w("play"),a&&!y&&h&&(y=!0,w("beat",h,"play"))))},pause(){a&&(a=!1,k=void 0,g++,S(),w("pause"))},toggle(){a?v.pause():v.play()},seek:P,seekBeat(N){let C=typeof N=="number"?r.beats[N]?.start:r.beats.find(V=>V.name===N)?.start;return C===void 0?!1:(P(C),!0)},next(){let N=r.beats.find(C=>C.start>i);P(N?N.start:r.duration)},prev(){let N=[...r.beats].reverse().find(C=>C.start<i-Xh);P(N?N.start:0)},restart:E,rebind(N){if(p||!N.ok)return!1;k=void 0;let C=r.beatAt(i),V=C?(i-C.start)/Math.max(1,C.end-C.start):0,Y=l==="off"?0:l-i,Z=r;if(r=N,C){let j=N.beats.find(K=>K.name===C.name);if(j)i=j.start+V*(j.end-j.start);else{let K=Z.beats.filter(U=>U.index<C.index).reverse().map(U=>N.beats.find(ee=>ee.name===U.name)).find(Boolean);i=K?K.start:0}}return i=x(i),c&&l!=="off"&&(l=i+Y),m=s.now(),R("rebind"),S(),!0},on(N,C){let V=u[N]??=new Set;return V.add(C),()=>{V.delete(C)}},dispose(){p=!0,g++,a=!1,d!==void 0&&s.cancel(d),d=void 0;for(let N of Object.keys(u))u[N].clear()}};return S(),v}function ie(t,e=null,...s){let r=document.createElement(t);for(let[i,o]of Object.entries(e??{}))if(!(o==null||o===!1))if(i==="class")r.className=String(o);else if(i==="on")for(let[n,a]of Object.entries(o))r.addEventListener(n,a);else r.setAttribute(i,o===!0?"":String(o));for(let i of s)i!=null&&i!==!1&&r.append(i instanceof Node?i:document.createTextNode(String(i)));return r}var ol=new Map;function mp(){let t,e=.35;for(let[s,r]of ol)r.wants&&r.seen>=e&&(r.seen>e||!t)&&(t=s,e=r.seen);for(let[s,r]of ol)r.wants&&r.auto(s===t)}var Hf=t=>{let e=new DOMParser().parseFromString(t,"image/svg+xml");if(e.documentElement.localName!=="svg")throw new Error("the drawing is not SVG");return document.importNode(e.documentElement,!0)},il=t=>{let e=Math.round(t/1e3);return`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`},Yf={ok:!0,diags:[],duration:0,beats:[],markers:{},ambient:"on",loops:!1,at:()=>({}),cues:()=>{},beatAt:()=>{},startOf:()=>{}};function Qh(t){let e={...t.camera?{camera:t.camera}:{},...t.variants?{variants:t.variants}:{}};for(let s of["items","labels","routes"]){let r=Object.entries(t[s]??{}).filter(([,i])=>i.opacity===0).map(([i])=>[i,{opacity:0}]);r.length&&(e[s]=Object.fromEntries(r))}return e}function Wf(t,e){if(e.timeline&&!e.timeline.ok)throw new Error(`the motion has faults: ${e.timeline.diags.map(Q=>`${Q.path}: ${Q.message}`).join("; ")}`);let s=e.scene,r=Hf(s.rendered.svg),i,o,n=!1,a=!1,f=rl(e.timeline??Yf,{loop:e.loop,rate:e.rate,ambient:e.ambient,clock:e.clock}),p=e.controls??!0,c=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches,l=c&&e.reducedMotion==="respect",d=l,m=!1,h=!0,y=(Q,te,we,ze)=>ie("button",{type:"button",class:`iso-play-btn ${Q}`,"aria-label":te,title:te,on:{click:ze}},we),g=ie("div",{class:"iso-play-stage"},r),k=y("back","Back","\u2039",()=>_e(()=>ge(Math.max(0,oe()-1)))),u=y("play","Play","\u25B6",()=>xe()),b=y("next","Next","\u203A",()=>_e(()=>ge(Math.min(f.timeline.beats.length-1,oe()+1)))),x=y("again","Reset","\u21BA",()=>_e(()=>{I(),m?f.seek(0):f.restart()})),w=y("ambient","Ambient motion","\u223F",()=>{Ae(),f.ambient=!f.ambient,ce()}),$=y("still","Motion off","Motion off",()=>se(!m));$.title="Draw everything in place, with nothing moving";let S=ie("input",{type:"range",class:"iso-play-bar",min:0,step:1,"aria-label":"Time",on:{input:(()=>_e(()=>{I(),f.seek(Number(S.value))}))}}),O=ie("span",{class:"iso-play-time"}),z=ie("div",{class:"iso-play-dots"}),A=ie("span",{class:"iso-play-num"}),R=ie("span",{class:"iso-play-title"}),P=ie("span",{class:"iso-play-chapter"}),E=ie("span",{class:"iso-play-count"}),v=ie("div",{class:"iso-play-text"}),N=ie("pre",{class:"iso-play-code"}),C=ie("dl",{class:"iso-play-facts"}),V=ie("div",{class:"iso-play-say","aria-live":"polite"},ie("div",{class:"iso-play-head"},A,R,P,E),v,N,C),Y=ie("details",{class:"iso-play-list"}),Z=ie("div",{class:"iso-play-row"},k,u,b,x,w,$,S,O),j=ie("div",{class:"iso-play-row"}),K=ie("div",{class:"iso-play",role:"group","aria-roledescription":"animated diagram","aria-label":e.label??"Diagram",tabindex:p?0:void 0,"data-mode":e.mode??"light"},g,p?Z:j,p&&z,p&&V,p&&Y);t.append(K);let U=[];function ee(){let Q=f.timeline.beats,te=Q.length>0,we=Q.some(qe=>qe.say);U=[],z.replaceChildren();let ze,De;for(let qe of Q){(!ze||qe.say?.chapter!==De)&&(ze=ie("span",{class:"iso-play-group",role:"group","aria-label":qe.say?.chapter,title:qe.say?.chapter}),z.append(ze),De=qe.say?.chapter);let M=ie("button",{type:"button",class:"iso-play-dot","aria-label":`Step ${qe.index+1}: ${qe.say?.title??qe.name}`,title:qe.say?.title??qe.name,on:{click:(()=>_e(()=>ge(qe.index)))}});ze.append(M),U.push(M)}Y.replaceChildren(ie("summary",null,`All ${Q.length} steps as text`),ie("ol",null,...Q.map(qe=>ie("li",null,...L(qe)))));for(let qe of[k,b,z])qe.hidden=!te;V.hidden=!we,Y.hidden=!we,w.hidden=!f.timeline.loops,$.hidden=!c||l||f.duration<=0&&!f.timeline.loops||!p&&!e.autoplay&&!f.timeline.loops,j.hidden=$.hidden,!p&&!$.hidden&&j.append($),S.max=String(Math.round(f.duration));for(let qe of[u,x,S,O])qe.hidden=f.duration<=0;q=void 0}function L(Q){let te=Q.say,we=[ie("b",null,te?.title??Q.name)];if(te?.text){let ze=ie("div",null);ze.innerHTML=Sn(te.text),we.push(ze)}return te?.code&&we.push(ie("code",null,te.code)),te?.facts?.length&&we.push(ie("span",null,te.facts.map(([ze,De])=>`${ze}: ${De}`).join(" \xB7 "))),we}let q;function G(Q){let te=String((Q?.index??-1)+1);for(let we of r.querySelectorAll("[data-badge]"))we.classList.toggle("on",we.getAttribute("data-badge")===te),e.steps&&(we.getAttribute("data-badge")===te||d?we.removeAttribute("opacity"):we.setAttribute("opacity","0.14"));if(e.steps)for(let we of r.querySelectorAll("[data-step]"))we.setAttribute("visibility",we.getAttribute("data-step")===te&&!d?"visible":"hidden")}function X(){let Q=f.beat;if(Q===q||(q=Q,G(Q),!p))return;let te=Q?.say;A.textContent=Q?String(Q.index+1):"",A.style.backgroundColor=te?.color??"",R.textContent=te?.title??Q?.name??"",P.textContent=te?.chapter??"",E.textContent=Q?`${Q.index+1} / ${f.timeline.beats.length}`:"",v.innerHTML=Sn(te?.text),N.textContent=te?.code??"",C.replaceChildren(...(te?.facts??[]).flatMap(([we,ze])=>[ie("dt",null,we),ie("dd",null,ze)])),N.hidden=!te?.code,C.hidden=!te?.facts?.length,U.forEach((we,ze)=>{we.classList.toggle("on",ze===Q?.index),we.classList.toggle("done",Q!==void 0&&ze<Q.index),ze===Q?.index?we.setAttribute("aria-current","step"):we.removeAttribute("aria-current")})}function ce(){let Q=i!==void 0?f.timeline.at(i,{ambient:i}):d?Qh(f.timeline.at(f.duration,{ambient:"off"})):m?f.timeline.at(f.time,{ambient:"off"}):f.state();Ia(r,Q,s.rendered,{styles:"cssom"}),K.dataset.time=String(Math.round(i??f.time)),i!==void 0?G(f.timeline.beatAt(i)):X(),p&&(S.value=String(Math.round(f.time)),S.setAttribute("aria-valuetext",`${il(f.time)} of ${il(f.duration)}${f.beat?`, ${f.beat.say?.title??f.beat.name}`:""}`),O.textContent=`${il(f.time)} / ${il(f.duration)}`)}function le(){let Q=H();u.textContent=Q?"\u275A\u275A":"\u25B6",u.setAttribute("aria-label",Q?"Pause":"Play"),u.title=Q?"Pause":"Play",w.setAttribute("aria-pressed",String(f.ambient)),V.setAttribute("aria-live",Q?"off":"polite"),K.dataset.playing=String(Q),$.setAttribute("aria-pressed",String(m)),u.disabled=m,w.disabled=m}let H=()=>f.playing&&o===void 0,oe=()=>f.beat?.index??0;function Ae(){d&&(d=!1,q=void 0)}function _e(Q){Ae(),n=!0,Q(),le(),ce()}function I(){o=void 0,f.pause()}function se(Q){a||Q===m||(m=Q,d=Q,q=void 0,I(),f.active=h&&!m,f.seek(m?f.duration:0),m&&(Y.open=!0),G(f.beat),le(),ce(),!m&&e.autoplay===!0&&!n&&f.play(),mp())}function ge(Q){let te=f.timeline.beats[Q];if(!te||a)return;f.pause(),f.seek(te.start,{join:!0});let we=f.timeline.beats[Q+1]?.start??1/0;if(o=Math.max(te.start,Math.min(te.end,we,f.duration)-1),m){let ze=o;o=void 0,f.seek(ze);return}f.play({until:o})}function xe(){m||(Ae(),H()?(n=!0,I()):(n=!1,o=void 0,f.pause(),f.play()),le(),ce())}f.on("time",ce),f.on("play",le),f.on("ambient",le),f.on("pause",()=>{o=void 0,le()}),K.addEventListener("keydown",Q=>{let te=Q.key,we=Q.target;Q.altKey||Q.ctrlKey||Q.metaKey||we===S||(te==="ArrowRight"||te==="ArrowLeft"?(Q.preventDefault(),(te==="ArrowRight"?b:k).click()):te==="Home"?(Q.preventDefault(),x.click()):(te===" "||te==="k")&&we===K&&(Q.preventDefault(),xe()))});let Ke=Q=>{let te=Q.target.closest?.("[data-go]"),we=Q.key;!te||Q.type==="keydown"&&we!=="Enter"&&we!==" "||(Q.preventDefault(),Q.stopPropagation(),_e(()=>ge(Number(te.getAttribute("data-go"))-1)))};g.addEventListener("click",Ke),g.addEventListener("keydown",Ke);let $e={seen:0,wants:e.autoplay==="visible"&&!l,auto(Q){Q?!m&&!n&&!H()&&(o=void 0,f.play()):H()&&(o=void 0,f.pause())}};ol.set(K,$e);let Ze=typeof IntersectionObserver=="function"?new IntersectionObserver(Q=>{for(let te of Q)$e.seen=te.isIntersecting?te.intersectionRatio:0,h=te.isIntersecting,i===void 0&&(f.active=h&&!m);mp()},{threshold:[0,.2,.35,.5,.7,.9,1]}):void 0;return Ze?.observe(K),ee(),le(),ce(),e.autoplay===!0&&!l&&f.play(),{root:K,transport:f,step:Q=>_e(()=>ge(Q)),set(Q,te=Yf,we){if(a||!te.ok)return!1;let ze=Hf(Q.rendered.svg);return s=Q,r.replaceWith(ze),r=ze,we&&(K.dataset.mode=we),o!==void 0&&I(),f.rebind(te),ee(),le(),ce(),!0},freeze(Q){i=Q,f.pause(),f.active=!1,K.classList.add("frozen"),ce()},dispose(){a=!0,Ze?.disconnect(),ol.delete(K),f.dispose(),K.remove(),mp()}}}var Jf=`
368
368
  .iso-play{--ip-ink:#1c2026;--ip-muted:#68707c;--ip-line:#dfe3e8;--ip-bg:#fff;--ip-code:#f2f4f7;--ip-focus:#2a64d6;container:iso-play/inline-size;display:block;color:var(--ip-ink);background:var(--ip-bg);font:14px/1.5 system-ui,-apple-system,"Segoe UI",sans-serif;border-radius:10px}
369
369
  .iso-play[data-mode="dark"]{--ip-ink:#e6e9ee;--ip-muted:#98a1ae;--ip-line:#333a44;--ip-bg:#15181d;--ip-code:#1f242b;--ip-focus:#7aa7ff;color-scheme:dark}
370
370
  .iso-play:focus-visible,.iso-play button:focus-visible,.iso-play input:focus-visible,.iso-play summary:focus-visible{outline:2px solid var(--ip-focus);outline-offset:2px}
@@ -376,6 +376,9 @@ ${e.extraBody??""}
376
376
  .iso-play-btn:hover{border-color:var(--ip-muted)}
377
377
  .iso-play-btn.play{background:var(--ip-ink);color:var(--ip-bg);border-color:var(--ip-ink);min-width:44px}
378
378
  .iso-play-btn.ambient[aria-pressed="false"]{color:var(--ip-muted);text-decoration:line-through}
379
+ .iso-play-btn.still{font-size:12px;white-space:nowrap}
380
+ .iso-play-btn.still[aria-pressed="true"]{background:var(--ip-ink);color:var(--ip-bg)}
381
+ .iso-play-btn:disabled{opacity:.4;cursor:default}
379
382
  .iso-play-bar{flex:1 1 60px;min-width:0;accent-color:var(--ip-ink)}
380
383
  .iso-play-time{color:var(--ip-muted);font-size:12px;font-variant-numeric:tabular-nums;white-space:nowrap}
381
384
  .iso-play-dots{display:flex;flex-wrap:wrap;gap:4px 12px;padding:2px 12px}
@@ -399,10 +402,10 @@ ${e.extraBody??""}
399
402
  .iso-play-list summary{color:var(--ip-muted);cursor:pointer}
400
403
  .iso-play.frozen>:not(.iso-play-stage){display:none}
401
404
  @container iso-play (max-width:420px){.iso-play-time{display:none}.iso-play-row{flex-wrap:wrap}.iso-play-bar{flex-basis:100%;order:9}}
402
- `;var Wf=1,rl="(?:[^/:%\\s]|%[0-9A-F]{2})+",un=["debug","info","notice","warning","error"],Jf=["1m","1h","1d"],zn={"1m":6e4,"1h":36e5,"1d":864e5},il=t=>`^(?:(?:${t.kinds.join("|")}):(?:${rl})(?:/(?:${t.kinds.join("|")}):(?:${rl}))*)?$`;function ol(t){let e=new RegExp(il(t)),s=o=>e.test(o);function r(o){if(!e.test(o))throw new Error(`not a scope path: ${JSON.stringify(o)}`);return o===""?[]:o.split("/").map(n=>{let a=n.indexOf(":");return{kind:n.slice(0,a),name:decodeURIComponent(n.slice(a+1))}})}function i(o){let n="";for(let a of r(o)){if(!t.parents[a.kind].includes(n))return!1;n=a.kind}return!0}return{isScope:s,parseScope:r,wellNested:i}}var al=t=>t.replace(/[%/:\s]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`),Xf=t=>t.map(e=>`${e.kind}:${al(e.name)}`).join("/"),Qf=(t,e,s)=>(t?`${t}/`:"")+`${e}:${al(s)}`,Jt=t=>t===""?0:t.split("/").length;function Ms(t,e){return e<=0?"":(t===""?[]:t.split("/")).slice(0,e).join("/")}var em=t=>Ms(t,Jt(t)-1),hn=(t,e)=>e===""||t===e||t.startsWith(`${e}/`),tm=(t,e)=>t!==""&&t.split("/").includes(e),Yr=t=>t===""?"fleet":t.slice(t.lastIndexOf("/")+1).split(":")[0],Wr=t=>t===""?"all hosts":decodeURIComponent(t.slice(t.lastIndexOf("/")+1).split(":").slice(1).join(":"));function Jr(t){let e=[{scope:"",label:"all hosts",kind:"fleet"}];for(let s=1;s<=Jt(t);s++){let r=Ms(t,s);e.push({scope:r,label:Wr(r),kind:Yr(r)})}return e}var dp=["kind","source","severity","scope","since","before"];function Wh(t){let e=[],s=0;for(;s<t.length;){for(;s<t.length&&/\s/.test(t[s]);)s++;if(s>=t.length)break;let r=!1;t[s]==="-"&&s+1<t.length&&!/\s/.test(t[s+1])&&(r=!0,s++);let i=/^(attr\.[a-z][a-z0-9_]*|[a-z]+):/.exec(t.slice(s)),o;i&&(o=i[1],s+=i[0].length);let n="",a=!1;if(t[s]==='"'){let f=t.indexOf('"',s+1);n=t.slice(s+1,f<0?t.length:f),a=!0,s=f<0?t.length:f+1}else{let f=s;for(;s<t.length&&!/\s/.test(t[s]);)s++;n=t.slice(f,s)}e.push({neg:r,raw:n,quoted:a,field:o})}return e}var Jh=/^(\d+)(s|m|h|d|w)$/,Xh={s:1e3,m:6e4,h:36e5,d:864e5,w:7*864e5};function fp(t,e){let s=Jh.exec(t);if(s)return e-Number(s[1])*Xh[s[2]];let r=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?)?(Z|[+-]\d{2}:?\d{2})?$/.exec(t);if(!r)return;let[,i,o,n,a="0",f="0",p="0",c="0",l]=r;if(l){let m=Date.parse(t.replace(" ","T"));return Number.isNaN(m)?void 0:m}let d=new Date(+i,+o-1,+n,+a,+f,+p,+c.padEnd(3,"0")).getTime();return Number.isNaN(d)?void 0:d}function Qh(t,e,s=Date.now()){let r=[],i=[];for(let o of Wh(e??"")){let n=p=>{let c=o.field?`${o.field}:${o.raw}`:o.raw;p&&i.push(`${JSON.stringify(c)}: ${p}; searched as text`),c&&r.push({neg:o.neg,value:c})};if(!o.field){n();continue}if(!(t.includes(o.field)||o.field.startsWith("attr."))){n(`no field ${o.field}`);continue}if(!o.raw){n(`${o.field}: needs a value`);continue}let f=o.field;if(f==="severity"){let p=/^(>=|<=|>|<|=)?(.*)$/.exec(o.raw);if(!un.includes(p[2])){n(`no severity ${p[2]} (${un.join(", ")})`);continue}r.push({neg:o.neg,field:f,op:p[1]??"=",value:p[2]})}else if(f==="since"||f==="before"){let p=fp(o.raw,s);if(p===void 0){n(`can't read the time ${o.raw} (15m, 2h, 3d, 1w, or a date like 2026-11-20 or 2026-11-20T09:30)`);continue}if(o.neg){n(`-${f} isn't allowed (use ${f==="since"?"before":"since"})`);continue}r.push({neg:!1,field:f,value:o.raw,time:p})}else r.push({neg:o.neg,field:f,value:o.raw})}return{terms:r,warnings:i}}var ll=t=>un.indexOf(t),ey={"=":"eq",">=":"ge",">":"gt","<=":"le","<":"lt"};function ty(t,e){switch(t.field){case void 0:return{field:"text",value:t.value};case"kind":case"source":return t.value.endsWith("*")?{field:t.field,value:t.value.slice(0,-1),prefix:!0}:{field:t.field,value:t.value};case"severity":return{field:"severity",op:ey[t.op??"="],value:t.value};case"scope":return{field:"scope",value:t.value,from:e.topKinds.some(s=>t.value.startsWith(`${s}:`))?"top":"segments"};case"since":case"before":return;default:return e.links.includes(t.field)?{field:"link",link:t.field,value:t.value}:{field:"attr",key:t.field.slice(5),value:t.value}}}function ny(t,e){let s=[],r=new Map;for(let i of e.terms){let o=ty(i,t);if(!o)continue;if(i.neg){s.push({not:!0,any:[o]});continue}if(o.field==="text"||o.field==="severity"){s.push({any:[o]});continue}let n=o.field==="link"?`link.${o.link}`:o.field==="attr"?`attr.${o.key}`:o.field,a=r.get(n);if(a)a.any.push(o);else{let f={any:[o]};r.set(n,f),s.push(f)}}return{all:s}}function sy(t,e,s,r){switch(e.field){case"text":{let i=e.value.toLowerCase();if(s.summary.toLowerCase().includes(i)||s.kind.toLowerCase().includes(i)||s.source.toLowerCase().includes(i)||s.scope.toLowerCase().includes(i))return!0;for(let[o,n]of Object.entries(s.attrs))if(typeof n=="string"&&!r.has(`${s.source}.${o}`)&&n.toLowerCase().includes(i))return!0;return!1}case"kind":case"source":{let i=s[e.field];return e.prefix?i.startsWith(e.value):i===e.value}case"severity":{let i=ll(s.severity),o=ll(e.value);return e.op==="ge"?i>=o:e.op==="gt"?i>o:e.op==="le"?i<=o:e.op==="lt"?i<o:i===o}case"scope":return e.from==="top"?hn(s.scope,e.value):`/${s.scope}/`.includes(`/${e.value}/`);case"link":return t.linkMatch?.(String(e.link),e.value,s)??s.links[e.link]===e.value;case"attr":{let i=s.attrs[e.key];return i!=null&&String(i).toLowerCase()===e.value.toLowerCase()}}}function Xr(t){let e=[...dp,...t.links],s=(a,f=Date.now())=>Qh(e,a,f),r=a=>ny(t,a);function i(a,f,p,c){let l=s(a,f);return{where:r(l),...so(l,p,c),warnings:l.warnings}}function o(a,f=[]){let p=new Set(f),c=a?.all??[];return c.length?l=>c.every(d=>d.any.some(m=>sy(t,m,l,p))!==!!d.not):()=>!0}return{FIELDS:e,parseSearch:s,toAst:r,compileSearch:i,matchAst:o,matcher:(a,f=[])=>o(r(a),f)}}function so(t,e,s){for(let r of t.terms)r.field==="since"&&(e=Math.max(e,r.time)),r.field==="before"&&(s=Math.min(s,r.time));return{from:e,to:Math.max(e,s)}}function ro(t,e){let s=e.toLowerCase(),r=[];for(let o of t.terms){if(o.neg||o.field||!o.value)continue;let n=o.value.toLowerCase();for(let a=s.indexOf(n);a>=0;a=s.indexOf(n,a+n.length))r.push([a,a+n.length])}r.sort((o,n)=>o[0]-n[0]);let i=[];for(let o of r){let n=i[i.length-1];n&&o[0]<=n[1]?n[1]=Math.max(n[1],o[1]):i.push([...o])}return i}var nm=t=>un.filter(e=>ll(e)>=ll(t));var sm=new Map,cl=new Map;function nn(t,e){if(!t||t==="UTC")return 0;let s=`${t}|${Math.floor(e/(15*6e4))}`,r=cl.get(s);if(r!==void 0)return r;let i=sm.get(t);if(!i){try{i=new Intl.DateTimeFormat("en-US",{timeZone:t,hourCycle:"h23",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})}catch{return 0}sm.set(t,i)}let o={};for(let f of i.formatToParts(new Date(e)))f.type!=="literal"&&(o[f.type]=Number(f.value));let n=Date.UTC(o.year,o.month-1,o.day,o.hour%24,o.minute,o.second),a=Math.round((n-Math.floor(e/1e3)*1e3)/6e4)*6e4;return cl.size>5e4&&cl.clear(),cl.set(s,a),a}var rm=t=>{try{return new Intl.DateTimeFormat("en-US",{timeZone:t}),!0}catch{return!1}};function lr(t,e,s){if(e==="1m")return Math.floor(t/6e4)*6e4;let r=nn(s,t);if(e==="1h")return r%36e5===0?Math.floor(t/36e5)*36e5:Math.floor((t+r)/36e5)*36e5-r;let i=Math.floor((t+r)/864e5)*864e5,o=i-nn(s,i-r);return o>t?o=i-864e5-nn(s,i-864e5-r):pl(o,s)<=t&&(o=pl(o,s)),o}function pl(t,e,s="1d"){if(s==="1m")return t+6e4;if(s==="1h")return t+36e5;let r=nn(e,t),i=Math.floor((t+r)/864e5)*864e5+864e5;return i-nn(e,i-r)}var Vs=6e4,Ks=36e5,Cn=864e5;function dl(t,e,s,r={}){let i=Math.max((r.minFrac??.15)*(s-e),r.minMs??10*Vs),o=t.filter(([f,p])=>p>=e&&f<s).map(([f,p])=>[Math.max(e,f),Math.min(s,Math.max(f,p))]).sort((f,p)=>f[0]-p[0]),n=[];if(!o.length)return n;let a=e;for(let[f,p]of o)f-a>i&&n.push({from:a,to:f}),a=Math.max(a,p);return s-a>i&&n.push({from:a,to:s}),n}function cr(t){if(t>=Cn){let e=Math.floor(t/Cn),s=Math.round((t-e*Cn)/Ks);return s?`${e} d ${s} h`:`${e} d`}if(t>=Ks){let e=Math.floor(t/Ks),s=Math.round((t-e*Ks)/Vs);return s&&e<10?`${e} h ${s} min`:`${e} h`}return`${Math.max(1,Math.round(t/Vs))} min`}var pr=t=>`${t.from}-${t.to}`;function Qr(t,e,s,r=[],i={}){let o=i.cut??24,n=Math.max(1,s),a=Math.max(1,e-t),f=r.filter(b=>b.to>t&&b.from<e).map(b=>({from:Math.max(t,b.from),to:Math.min(e,b.to),w:i.weights?.get(pr(b))??0})).sort((b,x)=>b.from-x.from),p=f.reduce((b,x)=>b+(x.to-x.from)*(1-x.w),0),c=f.reduce((b,x)=>b+(1-x.w)*o,0),l=(n-c)/Math.max(1,a-p);if(!(l>0)||c>n*.6)return Qr(t,e,s,[],i);let d=[[t,0]],m=0,h=t,y=[];for(let b of f){m+=(b.from-h)*l,d.push([b.from,m]);let x=(1-b.w)*o+b.w*l*(b.to-b.from);y.push({from:b.from,to:b.to,x0:m,x1:m+x,weight:b.w}),m+=x,d.push([b.to,m]),h=b.to}d.push([e,m+(e-h)*l]);let g=b=>{if(b<=t)return(b-t)*l;if(b>=e)return d[d.length-1][1]+(b-e)*l;let x=0,w=d.length-1;for(;w-x>1;){let A=x+w>>1;d[A][0]<=b?x=A:w=A}let[$,v]=d[x],[O,C]=d[w];return O===$?v:v+(b-$)/(O-$)*(C-v)},k=b=>y.find(x=>x.weight<1&&b>x.x0&&b<x.x1);return{t0:t,t1:e,width:n,cuts:y,x:g,t:b=>{let x=k(b);if(x)return b-x.x0<x.x1-b?x.from:x.to;if(b<=0)return t+b/l;let w=0,$=d.length-1;if(b>=d[$][1])return e+(b-d[$][1])/l;for(;$-w>1;){let R=w+$>>1;d[R][1]<=b?w=R:$=R}let[v,O]=d[w],[C,A]=d[$];return A===O?v:v+(b-O)/(A-O)*(C-v)},cutAt:k,msPerPx:1/l}}var mp=[1e3,5e3,15e3,3e4,Vs,5*Vs,15*Vs,30*Vs,Ks,3*Ks,6*Ks,12*Ks,Cn,2*Cn,7*Cn,14*Cn,28*Cn];function fl(t,e,s=80){let r=mp.find(f=>f/t.msPerPx>=s)??mp[mp.length-1],i=[],o=f=>{let p=new Date(f+nn(e,f)),c=String(p.getUTCHours()).padStart(2,"0"),l=String(p.getUTCMinutes()).padStart(2,"0"),d=String(p.getUTCSeconds()).padStart(2,"0"),m=`${p.getUTCDate()} ${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][p.getUTCMonth()]}`,h=c==="00"&&l==="00"&&d==="00";return r>=Cn||h?{label:m,major:!0}:{label:r<Vs?`${c}:${l}:${d}`:`${c}:${l}`,major:!1}},n=[],a=t.t0;for(let f of t.cuts)f.weight<1&&(n.push([a,f.from]),a=f.to);n.push([a,t.t1]);for(let[f,p]of n){let c=d=>d-nn(e,d-nn(e,d)),l=Math.ceil((f+nn(e,f))/r)*r;r>=7*Cn&&(l=Math.ceil((f+nn(e,f))/Cn)*Cn);for(let d=0,m=c(l);m<p&&d<2e3;d++,l+=r,m=c(l)){if(m<f)continue;let h=t.x(m),y=i[i.length-1];(!y||h-y.x>=s*.6)&&i.push({t:m,x:h,...o(m)})}}return i}var ry=["id","time","t","dur","scope","source","kind","severity","summary"],iy=t=>{if(t==null)return"";let e=typeof t=="string"&&/^[=+\-@\t\r]/.test(t)?`'${t}`:String(t);return/[",\n\r]/.test(e)?`"${e.replace(/"/g,'""')}"`:e},im=(t,e)=>e.size?{...t,attrs:Object.fromEntries(Object.entries(t.attrs).filter(([s])=>!e.has(`${t.source}.${s}`)))}:t;function ml(t,e=[]){let s=new Set(e);return JSON.stringify(t.map(r=>im(r,s)),null,2)+`
403
- `}function ul(t,e=[]){let s=new Set(e),r=t.map(f=>im(f,s)),i=[...new Set(r.flatMap(f=>Object.keys(f.attrs)))].sort(),o=[...new Set(r.flatMap(f=>Object.keys(f.links)))].sort(),n=[...ry,...i.map(f=>`attr.${f}`),...o.map(f=>`link.${f}`)],a=r.map(f=>[f.id,new Date(f.t).toISOString(),f.t,f.dur,f.scope,f.source,f.kind,f.severity,f.summary,...i.map(p=>f.attrs[p]),...o.map(p=>f.links[p])].map(iy).join(","));return[n.join(","),...a].join(`\r
405
+ `;var Xf=1,al="(?:[^/:%\\s]|%[0-9A-F]{2})+",un=["debug","info","notice","warning","error"],Qf=["1m","1h","1d"],Cn={"1m":6e4,"1h":36e5,"1d":864e5},ll=t=>`^(?:(?:${t.kinds.join("|")}):(?:${al})(?:/(?:${t.kinds.join("|")}):(?:${al}))*)?$`;function cl(t){let e=new RegExp(ll(t)),s=o=>e.test(o);function r(o){if(!e.test(o))throw new Error(`not a scope path: ${JSON.stringify(o)}`);return o===""?[]:o.split("/").map(n=>{let a=n.indexOf(":");return{kind:n.slice(0,a),name:decodeURIComponent(n.slice(a+1))}})}function i(o){let n="";for(let a of r(o)){if(!t.parents[a.kind].includes(n))return!1;n=a.kind}return!0}return{isScope:s,parseScope:r,wellNested:i}}var pl=t=>t.replace(/[%/:\s]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`),em=t=>t.map(e=>`${e.kind}:${pl(e.name)}`).join("/"),tm=(t,e,s)=>(t?`${t}/`:"")+`${e}:${pl(s)}`,Jt=t=>t===""?0:t.split("/").length;function Ms(t,e){return e<=0?"":(t===""?[]:t.split("/")).slice(0,e).join("/")}var nm=t=>Ms(t,Jt(t)-1),hn=(t,e)=>e===""||t===e||t.startsWith(`${e}/`),sm=(t,e)=>t!==""&&t.split("/").includes(e),Yr=t=>t===""?"fleet":t.slice(t.lastIndexOf("/")+1).split(":")[0],Wr=t=>t===""?"all hosts":decodeURIComponent(t.slice(t.lastIndexOf("/")+1).split(":").slice(1).join(":"));function Jr(t){let e=[{scope:"",label:"all hosts",kind:"fleet"}];for(let s=1;s<=Jt(t);s++){let r=Ms(t,s);e.push({scope:r,label:Wr(r),kind:Yr(r)})}return e}var up=["kind","source","severity","scope","since","before"];function ey(t){let e=[],s=0;for(;s<t.length;){for(;s<t.length&&/\s/.test(t[s]);)s++;if(s>=t.length)break;let r=!1;t[s]==="-"&&s+1<t.length&&!/\s/.test(t[s+1])&&(r=!0,s++);let i=/^(attr\.[a-z][a-z0-9_]*|[a-z]+):/.exec(t.slice(s)),o;i&&(o=i[1],s+=i[0].length);let n="",a=!1;if(t[s]==='"'){let f=t.indexOf('"',s+1);n=t.slice(s+1,f<0?t.length:f),a=!0,s=f<0?t.length:f+1}else{let f=s;for(;s<t.length&&!/\s/.test(t[s]);)s++;n=t.slice(f,s)}e.push({neg:r,raw:n,quoted:a,field:o})}return e}var ty=/^(\d+)(s|m|h|d|w)$/,ny={s:1e3,m:6e4,h:36e5,d:864e5,w:7*864e5};function hp(t,e){let s=ty.exec(t);if(s)return e-Number(s[1])*ny[s[2]];let r=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?)?(Z|[+-]\d{2}:?\d{2})?$/.exec(t);if(!r)return;let[,i,o,n,a="0",f="0",p="0",c="0",l]=r;if(l){let m=Date.parse(t.replace(" ","T"));return Number.isNaN(m)?void 0:m}let d=new Date(+i,+o-1,+n,+a,+f,+p,+c.padEnd(3,"0")).getTime();return Number.isNaN(d)?void 0:d}function sy(t,e,s=Date.now()){let r=[],i=[];for(let o of ey(e??"")){let n=p=>{let c=o.field?`${o.field}:${o.raw}`:o.raw;p&&i.push(`${JSON.stringify(c)}: ${p}; searched as text`),c&&r.push({neg:o.neg,value:c})};if(!o.field){n();continue}if(!(t.includes(o.field)||o.field.startsWith("attr."))){n(`no field ${o.field}`);continue}if(!o.raw){n(`${o.field}: needs a value`);continue}let f=o.field;if(f==="severity"){let p=/^(>=|<=|>|<|=)?(.*)$/.exec(o.raw);if(!un.includes(p[2])){n(`no severity ${p[2]} (${un.join(", ")})`);continue}r.push({neg:o.neg,field:f,op:p[1]??"=",value:p[2]})}else if(f==="since"||f==="before"){let p=hp(o.raw,s);if(p===void 0){n(`can't read the time ${o.raw} (15m, 2h, 3d, 1w, or a date like 2026-11-20 or 2026-11-20T09:30)`);continue}if(o.neg){n(`-${f} isn't allowed (use ${f==="since"?"before":"since"})`);continue}r.push({neg:!1,field:f,value:o.raw,time:p})}else r.push({neg:o.neg,field:f,value:o.raw})}return{terms:r,warnings:i}}var dl=t=>un.indexOf(t),ry={"=":"eq",">=":"ge",">":"gt","<=":"le","<":"lt"};function iy(t,e){switch(t.field){case void 0:return{field:"text",value:t.value};case"kind":case"source":return t.value.endsWith("*")?{field:t.field,value:t.value.slice(0,-1),prefix:!0}:{field:t.field,value:t.value};case"severity":return{field:"severity",op:ry[t.op??"="],value:t.value};case"scope":return{field:"scope",value:t.value,from:e.topKinds.some(s=>t.value.startsWith(`${s}:`))?"top":"segments"};case"since":case"before":return;default:return e.links.includes(t.field)?{field:"link",link:t.field,value:t.value}:{field:"attr",key:t.field.slice(5),value:t.value}}}function oy(t,e){let s=[],r=new Map;for(let i of e.terms){let o=iy(i,t);if(!o)continue;if(i.neg){s.push({not:!0,any:[o]});continue}if(o.field==="text"||o.field==="severity"){s.push({any:[o]});continue}let n=o.field==="link"?`link.${o.link}`:o.field==="attr"?`attr.${o.key}`:o.field,a=r.get(n);if(a)a.any.push(o);else{let f={any:[o]};r.set(n,f),s.push(f)}}return{all:s}}function ay(t,e,s,r){switch(e.field){case"text":{let i=e.value.toLowerCase();if(s.summary.toLowerCase().includes(i)||s.kind.toLowerCase().includes(i)||s.source.toLowerCase().includes(i)||s.scope.toLowerCase().includes(i))return!0;for(let[o,n]of Object.entries(s.attrs))if(typeof n=="string"&&!r.has(`${s.source}.${o}`)&&n.toLowerCase().includes(i))return!0;return!1}case"kind":case"source":{let i=s[e.field];return e.prefix?i.startsWith(e.value):i===e.value}case"severity":{let i=dl(s.severity),o=dl(e.value);return e.op==="ge"?i>=o:e.op==="gt"?i>o:e.op==="le"?i<=o:e.op==="lt"?i<o:i===o}case"scope":return e.from==="top"?hn(s.scope,e.value):`/${s.scope}/`.includes(`/${e.value}/`);case"link":return t.linkMatch?.(String(e.link),e.value,s)??s.links[e.link]===e.value;case"attr":{let i=s.attrs[e.key];return i!=null&&String(i).toLowerCase()===e.value.toLowerCase()}}}function Xr(t){let e=[...up,...t.links],s=(a,f=Date.now())=>sy(e,a,f),r=a=>oy(t,a);function i(a,f,p,c){let l=s(a,f);return{where:r(l),...ro(l,p,c),warnings:l.warnings}}function o(a,f=[]){let p=new Set(f),c=a?.all??[];return c.length?l=>c.every(d=>d.any.some(m=>ay(t,m,l,p))!==!!d.not):()=>!0}return{FIELDS:e,parseSearch:s,toAst:r,compileSearch:i,matchAst:o,matcher:(a,f=[])=>o(r(a),f)}}function ro(t,e,s){for(let r of t.terms)r.field==="since"&&(e=Math.max(e,r.time)),r.field==="before"&&(s=Math.min(s,r.time));return{from:e,to:Math.max(e,s)}}function io(t,e){let s=e.toLowerCase(),r=[];for(let o of t.terms){if(o.neg||o.field||!o.value)continue;let n=o.value.toLowerCase();for(let a=s.indexOf(n);a>=0;a=s.indexOf(n,a+n.length))r.push([a,a+n.length])}r.sort((o,n)=>o[0]-n[0]);let i=[];for(let o of r){let n=i[i.length-1];n&&o[0]<=n[1]?n[1]=Math.max(n[1],o[1]):i.push([...o])}return i}var rm=t=>un.filter(e=>dl(e)>=dl(t));var im=new Map,fl=new Map;function nn(t,e){if(!t||t==="UTC")return 0;let s=`${t}|${Math.floor(e/(15*6e4))}`,r=fl.get(s);if(r!==void 0)return r;let i=im.get(t);if(!i){try{i=new Intl.DateTimeFormat("en-US",{timeZone:t,hourCycle:"h23",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})}catch{return 0}im.set(t,i)}let o={};for(let f of i.formatToParts(new Date(e)))f.type!=="literal"&&(o[f.type]=Number(f.value));let n=Date.UTC(o.year,o.month-1,o.day,o.hour%24,o.minute,o.second),a=Math.round((n-Math.floor(e/1e3)*1e3)/6e4)*6e4;return fl.size>5e4&&fl.clear(),fl.set(s,a),a}var om=t=>{try{return new Intl.DateTimeFormat("en-US",{timeZone:t}),!0}catch{return!1}};function lr(t,e,s){if(e==="1m")return Math.floor(t/6e4)*6e4;let r=nn(s,t);if(e==="1h")return r%36e5===0?Math.floor(t/36e5)*36e5:Math.floor((t+r)/36e5)*36e5-r;let i=Math.floor((t+r)/864e5)*864e5,o=i-nn(s,i-r);return o>t?o=i-864e5-nn(s,i-864e5-r):ml(o,s)<=t&&(o=ml(o,s)),o}function ml(t,e,s="1d"){if(s==="1m")return t+6e4;if(s==="1h")return t+36e5;let r=nn(e,t),i=Math.floor((t+r)/864e5)*864e5+864e5;return i-nn(e,i-r)}var Vs=6e4,Ks=36e5,jn=864e5;function ul(t,e,s,r={}){let i=Math.max((r.minFrac??.15)*(s-e),r.minMs??10*Vs),o=t.filter(([f,p])=>p>=e&&f<s).map(([f,p])=>[Math.max(e,f),Math.min(s,Math.max(f,p))]).sort((f,p)=>f[0]-p[0]),n=[];if(!o.length)return n;let a=e;for(let[f,p]of o)f-a>i&&n.push({from:a,to:f}),a=Math.max(a,p);return s-a>i&&n.push({from:a,to:s}),n}function cr(t){if(t>=jn){let e=Math.floor(t/jn),s=Math.round((t-e*jn)/Ks);return s?`${e} d ${s} h`:`${e} d`}if(t>=Ks){let e=Math.floor(t/Ks),s=Math.round((t-e*Ks)/Vs);return s&&e<10?`${e} h ${s} min`:`${e} h`}return`${Math.max(1,Math.round(t/Vs))} min`}var pr=t=>`${t.from}-${t.to}`;function Qr(t,e,s,r=[],i={}){let o=i.cut??24,n=Math.max(1,s),a=Math.max(1,e-t),f=r.filter(b=>b.to>t&&b.from<e).map(b=>({from:Math.max(t,b.from),to:Math.min(e,b.to),w:i.weights?.get(pr(b))??0})).sort((b,x)=>b.from-x.from),p=f.reduce((b,x)=>b+(x.to-x.from)*(1-x.w),0),c=f.reduce((b,x)=>b+(1-x.w)*o,0),l=(n-c)/Math.max(1,a-p);if(!(l>0)||c>n*.6)return Qr(t,e,s,[],i);let d=[[t,0]],m=0,h=t,y=[];for(let b of f){m+=(b.from-h)*l,d.push([b.from,m]);let x=(1-b.w)*o+b.w*l*(b.to-b.from);y.push({from:b.from,to:b.to,x0:m,x1:m+x,weight:b.w}),m+=x,d.push([b.to,m]),h=b.to}d.push([e,m+(e-h)*l]);let g=b=>{if(b<=t)return(b-t)*l;if(b>=e)return d[d.length-1][1]+(b-e)*l;let x=0,w=d.length-1;for(;w-x>1;){let A=x+w>>1;d[A][0]<=b?x=A:w=A}let[$,S]=d[x],[O,z]=d[w];return O===$?S:S+(b-$)/(O-$)*(z-S)},k=b=>y.find(x=>x.weight<1&&b>x.x0&&b<x.x1);return{t0:t,t1:e,width:n,cuts:y,x:g,t:b=>{let x=k(b);if(x)return b-x.x0<x.x1-b?x.from:x.to;if(b<=0)return t+b/l;let w=0,$=d.length-1;if(b>=d[$][1])return e+(b-d[$][1])/l;for(;$-w>1;){let R=w+$>>1;d[R][1]<=b?w=R:$=R}let[S,O]=d[w],[z,A]=d[$];return A===O?S:S+(b-O)/(A-O)*(z-S)},cutAt:k,msPerPx:1/l}}var yp=[1e3,5e3,15e3,3e4,Vs,5*Vs,15*Vs,30*Vs,Ks,3*Ks,6*Ks,12*Ks,jn,2*jn,7*jn,14*jn,28*jn];function hl(t,e,s=80){let r=yp.find(f=>f/t.msPerPx>=s)??yp[yp.length-1],i=[],o=f=>{let p=new Date(f+nn(e,f)),c=String(p.getUTCHours()).padStart(2,"0"),l=String(p.getUTCMinutes()).padStart(2,"0"),d=String(p.getUTCSeconds()).padStart(2,"0"),m=`${p.getUTCDate()} ${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][p.getUTCMonth()]}`,h=c==="00"&&l==="00"&&d==="00";return r>=jn||h?{label:m,major:!0}:{label:r<Vs?`${c}:${l}:${d}`:`${c}:${l}`,major:!1}},n=[],a=t.t0;for(let f of t.cuts)f.weight<1&&(n.push([a,f.from]),a=f.to);n.push([a,t.t1]);for(let[f,p]of n){let c=d=>d-nn(e,d-nn(e,d)),l=Math.ceil((f+nn(e,f))/r)*r;r>=7*jn&&(l=Math.ceil((f+nn(e,f))/jn)*jn);for(let d=0,m=c(l);m<p&&d<2e3;d++,l+=r,m=c(l)){if(m<f)continue;let h=t.x(m),y=i[i.length-1];(!y||h-y.x>=s*.6)&&i.push({t:m,x:h,...o(m)})}}return i}var ly=["id","time","t","dur","scope","source","kind","severity","summary"],cy=t=>{if(t==null)return"";let e=typeof t=="string"&&/^[=+\-@\t\r]/.test(t)?`'${t}`:String(t);return/[",\n\r]/.test(e)?`"${e.replace(/"/g,'""')}"`:e},am=(t,e)=>e.size?{...t,attrs:Object.fromEntries(Object.entries(t.attrs).filter(([s])=>!e.has(`${t.source}.${s}`)))}:t;function yl(t,e=[]){let s=new Set(e);return JSON.stringify(t.map(r=>am(r,s)),null,2)+`
406
+ `}function gl(t,e=[]){let s=new Set(e),r=t.map(f=>am(f,s)),i=[...new Set(r.flatMap(f=>Object.keys(f.attrs)))].sort(),o=[...new Set(r.flatMap(f=>Object.keys(f.links)))].sort(),n=[...ly,...i.map(f=>`attr.${f}`),...o.map(f=>`link.${f}`)],a=r.map(f=>[f.id,new Date(f.t).toISOString(),f.t,f.dur,f.scope,f.source,f.kind,f.severity,f.summary,...i.map(p=>f.attrs[p]),...o.map(p=>f.links[p])].map(cy).join(","));return[n.join(","),...a].join(`\r
404
407
  `)+`\r
405
- `}var oy=864e5,es=36e5,hl=(t,e)=>t.t-e.t||(t.id<e.id?-1:t.id>e.id?1:0);function ms(t,e){let s=0,r=t.length;for(;s<r;){let i=s+r>>1;t[i].t<e?s=i+1:r=i}return s}var lm=(t,e)=>{t.min=Math.min(t.min,e.min),t.max=Math.max(t.max,e.max),t.sum+=e.sum,t.count+=e.count};function om(t,e,s){let r=[];for(let i of t){let o=lr(i.t,e,s),n=r[r.length-1];n&&n.t===o?lm(n,i):r.push({t:o,min:i.min,max:i.max,sum:i.sum,count:i.count})}return r}function up(t,e,s,r){for(let n=ms(t,e.t);n<t.length&&t[n].t===e.t;n++)if(s(t[n])){t[n]=e;return}let i=t[t.length-1];if(!i||r(i,e)<=0){t.push(e);return}let o=ms(t,e.t);for(;o<t.length&&r(t[o],e)<0;)o++;t.splice(o,0,e)}function am(t,e,s){for(let r=ms(t,e);r<t.length&&t[r].t===e;r++)if(s(t[r])){t.splice(r,1);return}}function cm(t,e,s={}){let r=t.catalog,{isScope:i}=ol(e),{parseSearch:o,matchAst:n,toAst:a}=Xr(e),f=I=>Object.fromEntries(e.flags.filter(V=>I?.[V]).map(V=>[V,!0])),p=s.now??r.now,c=(r.names??[]).flatMap(I=>(I.aliases??[]).map(V=>[V,I.scope])).sort((I,V)=>V[0].length-I[0].length),l=new Map,d=I=>{if(!c.length)return I;let V=l.get(I);if(V===void 0){let te=c.find(([ae])=>hn(I,ae));V=te?te[1]+I.slice(te[0].length):I,l.set(I,V)}return V},m=new Map((r.names??[]).map(I=>[I.scope,I])),h=I=>c.length?{...I,scope:d(I.scope)}:I,y=I=>`${I.source}\0${I.id}`,g=t.events.map(h).sort(hl),k=new Map;for(let I of g)k.set(y(I),I);let u=g.filter(I=>I.dur!==void 0&&!I.open),b=u.reduce((I,V)=>Math.max(I,V.dur),0),x=new Map;for(let I of g)I.open&&x.set(y(I),I);let w=new Map,$=new Set,v=I=>{for(let V=Jt(I);V>=1;V--){let te=Ms(I,V);if($.has(te))break;$.add(te)}},O=new Map;for(let I of r.sources)for(let V of I.series)O.set(V.name,V.type);let C=r.sources.flatMap(I=>(I.sensitive??[]).map(V=>`${I.name}.${V}`)),A=new Map;for(let I of r.sources)A.set(I.name,{events:I.defaultRetention.events,rollups:{...I.defaultRetention.rollups},setBy:"default"});for(let I of r.retention)A.set(I.source,{events:I.events,rollups:{...I.rollups},setBy:I.setBy});let R=new Map;for(let I of r.sources)for(let V of I.series)R.set(V.name,I.name);function M(I){let V=d(I.scope),te=`${I.series}\0${V}`,ae=w.get(te);ae||(ae={series:I.series,scope:V,fine:[],cache:new Map},w.set(te,ae),v(V));let Te="value"in I?{t:I.t,min:I.value,max:I.value,sum:I.value,count:1}:{t:I.t,min:I.min,max:I.max,sum:I.sum,count:I.count};up(ae.fine,Te,be=>be.t===Te.t,(be,ze)=>be.t-ze.t),ae.cache.clear()}for(let I of g)v(I.scope);for(let I of t.metrics)M(I);let T=new Map,S=new Set,N=(I,V)=>{S.add(I.source);let te=T.get(I.scope);te||T.set(I.scope,te=new Map);let ae=te.get(I.source);ae||te.set(I.source,ae=new Map);let Te=Math.floor(I.t/es)*es,be=ae.get(Te);if(be||ae.set(Te,be={t:Te,count:0,severity:{},kinds:{},first:1/0,last:-1/0}),be.count+=V,V>0)be.first=Math.min(be.first,I.t),be.last=Math.max(be.last,I.t);else if(I.t===be.first||I.t===be.last){be.first=1/0,be.last=-1/0;for(let ze=ms(g,Te);ze<g.length&&g[ze].t<Te+es;ze++){let Ie=g[ze];Ie.scope===I.scope&&Ie.source===I.source&&(be.first=Math.min(be.first,Ie.t),be.last=Math.max(be.last,Ie.t))}}be.severity[I.severity]=(be.severity[I.severity]??0)+V,be.kinds[I.kind]=(be.kinds[I.kind]??0)+V,be.severity[I.severity]===0&&delete be.severity[I.severity],be.kinds[I.kind]===0&&delete be.kinds[I.kind],be.count||ae.delete(Te)};for(let I of g)N(I,1);let z=(I,V,te)=>{let ae=`${V}|${te??""}`,Te=I.cache.get(ae);return Te||(Te=V==="1d"?om(z(I,"1h",te),"1d",te):om(I.fine,V,te),I.cache.set(ae,Te)),Te},K=I=>I===null?-1/0:p-I*oy,J=I=>K(A.get(I)?.events??null),Z=(I,V)=>{let te=A.get(I);return K(te?V?te.rollups[V]:te.events:null)};function L(I){let V=[];for(let te of new Set(I)){let ae=A.get(te);if(!ae)continue;let Te=g.find(ke=>ke.source===te&&ke.t>=J(te))?.t,be=ke=>{let Be=1/0;for(let Qe of w.values())if(R.get(Qe.series)===te){let Ke=(ke?z(Qe,ke):Qe.fine).find(pt=>pt.t>=Z(te,ke));Ke&&Ke.t<Be&&(Be=Ke.t)}return Be===1/0?void 0:Be},ze=[Te,be()].filter(ke=>ke!==void 0),Ie={};for(let ke of["1m","1h","1d"]){let Be=be(ke)??(Te!==void 0&&Te>=Z(te,ke)?Te:void 0);Be!==void 0&&(Ie[ke]=Math.max(Be,Z(te,ke)))}V.push({source:te,events:ae.events,rollups:{...ae.rollups},setBy:ae.setBy,keptFrom:{...ze.length?{events:Math.min(...ze)}:{},rollups:Ie}})}return V}function U(I){let V=I.where,te={from:I.from,to:I.to},ae=[];if(!V&&I.q){let Ke=o(I.q,p);V=a(Ke),te=so(Ke,I.from,I.to),ae=Ke.warnings}let Te=n(V,C),be=I.filters??{},ze=be.source?.length?new Set(be.source):void 0,Ie=be.kind?.length?new Set(be.kind):void 0,ke=be.severity?.length?new Set(be.severity):void 0,Be=be.scope?.length?be.scope:void 0;return{test:Ke=>hn(Ke.scope,I.scope)&&(!ze||ze.has(Ke.source))&&(!Ie||Ie.has(Ke.kind))&&(!ke||ke.has(Ke.severity))&&(!Be||Be.some(pt=>hn(Ke.scope,pt)))&&Ke.t>=J(Ke.source)&&Te(Ke),range:te,warnings:ae}}function H(I){let V=Jt(I.scope),te=V+I.depth,ae=new Map,Te=ke=>{let Be=ae.get(ke);return Be===void 0&&!ae.has(ke)&&(Be=hn(ke,I.scope)?Jt(ke)>=te?Ms(ke,te):ke:void 0,ae.set(ke,Be)),Be},be=ke=>{let Be=0,Qe=Jt(ke)+1;for(let Ke of $)Jt(Ke)===Qe&&hn(Ke,ke)&&Be++;return Be},ze=new Map,Ie=ke=>{let Be=ze.get(ke);if(!Be){let Qe=Jt(ke)-V,Ke=m.get(ke);Be={scope:ke,label:Ke?.label??Wr(ke),kind:Yr(ke),...f(Ke),depth:Qe,...Qe<I.depth?{own:!0}:{},children:be(ke),count:0},ze.set(ke,Be)}return Be};for(let ke of $)Jt(ke)===te&&hn(ke,I.scope)&&Ie(ke);return te===0&&Ie(""),{at:Te,add:Ie,rows:ze}}let ee=I=>[...I.values()].sort((V,te)=>V.scope===te.scope?0:V.scope<te.scope?-1:1);function j(I,V){let te=[];for(let ae=ms(u,I-b);ae<u.length&&u[ae].t<I;ae++)u[ae].t+u[ae].dur>I&&te.push(u[ae]);for(let ae of x.values())ae.t<I&&p>I&&te.push(ae);for(let ae=ms(g,I);ae<g.length&&g[ae].t<V;ae++)te.push(g[ae]);return te}function q(I,V,te,ae){let Te=I.series?new Set(I.series):void 0,be=new Map;for(let Ie of w.values()){if(Te&&!Te.has(Ie.series))continue;let ke=V(Ie.scope);if(ke===void 0)continue;let Be=R.get(Ie.series)??"",Qe=Z(Be,I.bin),Ke=I.bin?z(Ie,I.bin,I.tz):Ie.fine;for(let pt=ms(Ke,I.bin?lr(te,I.bin,I.tz):te);pt<Ke.length&&Ke[pt].t<ae;pt++){let P=Ke[pt];if(P.t<Qe)continue;let B=`${Ie.series}\0${ke}\0${P.t}`,W=be.get(B);W?lm(W,P):be.set(B,{series:Ie.series,scope:ke,t:P.t,bin:I.bin??"1m",min:P.min,max:P.max,sum:P.sum,count:P.count})}}let ze=[...be.values()].sort((Ie,ke)=>Ie.t-ke.t||(Ie.series<ke.series?-1:1)||(Ie.scope<ke.scope?-1:1));return I.bin?ze:ze.map(Ie=>({series:Ie.series,scope:Ie.scope,t:Ie.t,value:Ie.count===1||O.get(Ie.series)!=="gauge"?Ie.sum:Ie.sum/Ie.count}))}let G=I=>`${I.t}:${I.id}`,Q=(I,V)=>{let te=V.indexOf(":"),ae=Number(V.slice(0,te)),Te=V.slice(te+1);return I.t>ae||I.t===ae&&I.id>Te};function ce(I){if(I.bin!=="1h"&&I.bin!=="1d"||(I.where?.all.length??0)||I.q||I.filters?.kind?.length||I.filters?.severity?.length||I.filters?.scope?.length||nn(I.tz,I.from)%es||nn(I.tz,I.to)%es)return;let V=I.filters?.source?.length?new Set(I.filters.source):void 0,te=X=>Math.max(I.from,J(X)),{at:ae,add:Te,rows:be}=H(I),ze=new Set,Ie=new Map,ke=0,Be=(X,ne)=>{let ye=lr(ne,I.bin,I.tz),$e=`${X}\0${ye}`,E=Ie.get($e);return E||(E={scope:X,t:ye,bin:I.bin,count:0,severity:{},kinds:{}},Ie.set($e,E)),E},Qe=(X,ne,ye)=>{let $e=Te(X);$e.count+=ye,ke+=ye,($e.first===void 0||ne<$e.first)&&($e.first=ne),($e.last===void 0||ne>$e.last)&&($e.last=ne)},Ke=Math.floor(I.to/es)*es;for(let[X,ne]of T){let ye=ae(X);if(ye!==void 0)for(let[$e,E]of ne){if(V&&!V.has($e))continue;let _=Math.ceil(te($e)/es)*es;for(let[D,le]of E){if(D<_||D>=Ke)continue;Qe(ye,le.first,le.count),le.last>(be.get(ye).last??-1/0)&&(be.get(ye).last=le.last),ze.add($e);let ue=Be(ye,D);ue.count+=le.count;for(let[Ce,oe]of Object.entries(le.severity))ue.severity[Ce]=(ue.severity[Ce]??0)+oe;for(let[Ce,oe]of Object.entries(le.kinds))ue.kinds[Ce]=(ue.kinds[Ce]??0)+oe}}}let pt=X=>hn(X.scope,I.scope)&&(!V||V.has(X.source))&&X.t>=J(X.source)&&ae(X.scope)!==void 0,P=X=>{let ne=ae(X.scope);Qe(ne,X.t,1),ze.add(X.source);let ye=Be(ne,X.t);ye.count++,ye.severity[X.severity]=(ye.severity[X.severity]??0)+1,ye.kinds[X.kind]=(ye.kinds[X.kind]??0)+1};for(let X of S){if(V&&!V.has(X))continue;let ne=te(X),ye=Math.ceil(ne/es)*es,$e=ye>=Ke?[[ne,I.to]]:[[ne,ye],[Ke,I.to]];for(let[E,_]of $e)for(let D=ms(g,E);D<g.length&&g[D].t<_;D++){let le=g[D];le.source===X&&pt(le)&&P(le)}}let B=zn[I.bin],W=[];for(let X=ms(u,I.from-b);X<u.length&&u[X].t<I.from;X++){let ne=u[X];ne.t+ne.dur>I.from&&pt(ne)&&(Qe(ae(ne.scope),ne.t,1),ze.add(ne.source),ne.dur>=B&&W.length<5e3&&W.push(ne))}for(let X of x.values())X.t<I.from&&p>I.from&&pt(X)&&(Qe(ae(X.scope),X.t,1),ze.add(X.source),W.length<5e3&&W.push(X));for(let X=ms(u,I.from);X<u.length&&u[X].t<I.to&&W.length<5e3;X++)u[X].dur>=B&&pt(u[X])&&W.push(u[X]);for(let X of x.values())X.t>=I.from&&X.t<I.to&&W.length<5e3&&pt(X)&&W.push(X);let fe=q(I,ae,I.from,I.to);for(let X of fe){let ne=R.get(X.series);ne&&ze.add(ne)}let me=[...Ie.values()].sort((X,ne)=>X.t-ne.t||(X.scope<ne.scope?-1:1));return{timeline:1,type:"result",rows:ee(be),bins:me,spans:W,metrics:fe,total:ke,retention:L(ze)}}async function pe(I){if(!i(I.scope))throw new Error(`not a scope path: ${JSON.stringify(I.scope)}`);let V=ce(I);if(V)return V;let{test:te,range:ae,warnings:Te}=U(I),{at:be,add:ze,rows:Ie}=H(I),ke=new Set,Be=[];for(let fe of j(ae.from,ae.to)){if(!te(fe))continue;let me=be(fe.scope);if(me===void 0)continue;let X=ze(me);X.count++,(X.first===void 0||fe.t<X.first)&&(X.first=fe.t),(X.last===void 0||fe.t>X.last)&&(X.last=fe.t),ke.add(fe.source),Be.push(fe)}Be.sort(hl);let Qe=q(I,be,ae.from,ae.to);for(let fe of Qe){let me=R.get(fe.series);me&&ke.add(me)}let Ke={timeline:1,type:"result",total:Be.length,...Te.length?{warnings:Te}:{}};if(I.bin){let fe=zn[I.bin],me=new Map,X=[];for(let ye of Be){if((ye.open||ye.dur!==void 0&&ye.dur>=fe)&&X.length<5e3&&X.push(ye),ye.t<ae.from)continue;let $e=be(ye.scope),E=lr(ye.t,I.bin,I.tz),_=`${$e}\0${E}`,D=me.get(_);D||(D={scope:$e,t:E,bin:I.bin,count:0,severity:{},kinds:{}},me.set(_,D)),D.count++,D.severity[ye.severity]=(D.severity[ye.severity]??0)+1,D.kinds[ye.kind]=(D.kinds[ye.kind]??0)+1}let ne=[...me.values()].sort((ye,$e)=>ye.t-$e.t||(ye.scope<$e.scope?-1:1));return{...Ke,rows:ee(Ie),bins:ne,spans:X,metrics:Qe,retention:L(ke)}}let pt=Math.min(1e4,Math.max(1,I.limit??2e3)),P=I.cursor?Be.findIndex(fe=>Q(fe,I.cursor)):0,B=P<0?[]:Be.slice(P,P+pt),W=P>=0&&P+pt<Be.length;return{...Ke,rows:ee(Ie),events:B,metrics:Qe,retention:L(ke),...W?{next:G(B[B.length-1])}:{}}}let Y=new Set,ie=I=>un.includes(I),Ae=0;function De(I){let V=y(I),te=k.get(V);te&&(am(g,te.t,ae=>ae===te),N(te,-1),te.dur!==void 0&&!te.open&&am(u,te.t,ae=>ae===te),x.delete(V)),k.set(V,I),N(I,1),up(g,I,()=>!1,hl),I.open?x.set(V,I):I.dur!==void 0&&(up(u,I,()=>!1,hl),b=Math.max(b,I.dur)),v(I.scope)}return{async catalog(){return{...r,now:p,retention:L(r.sources.map(I=>I.name))}},query:pe,subscribe(I,V){let te={q:I,on:V};return Y.add(te),()=>{Y.delete(te)}},...s.stateAt?{stateAt:(I,V)=>s.stateAt(I,V)}:{},append(I,V=[],te){te!==void 0&&(p=Math.max(p,te));let ae=new Set($),Te=I.map(h);for(let be of Te){if(!ie(be.severity))throw new Error(`not a severity: ${be.severity}`);De(be)}for(let be of V)M(be);Ae++;for(let be of Y){let{test:ze}=U(be.q),{at:Ie}=H(be.q),ke=Te.filter(B=>ze(B)&&Ie(B.scope)!==void 0),Be=be.q.series?new Set(be.q.series):void 0,Qe=V.filter(B=>hn(d(B.scope),be.q.scope)&&(!Be||Be.has(B.series))).map(B=>({...B,scope:Ie(d(B.scope))})),Ke=[...$].filter(B=>!ae.has(B)),pt=Jt(be.q.scope)+be.q.depth,P=Ke.filter(B=>Jt(B)===pt&&hn(B,be.q.scope)).map(B=>({scope:B,label:m.get(B)?.label??Wr(B),kind:Yr(B),depth:be.q.depth,children:0,count:0}));be.on({timeline:1,type:"batch",events:ke,metrics:Qe,...P.length?{rows:P}:{},now:p,resume:String(Ae)})}},setRetention(I,V){A.set(I,{events:V.events,rollups:{...V.rollups},setBy:"user"})},get now(){return p},get size(){let I=0;for(let V of w.values())I+=V.fine.length;return{events:g.length,samples:I}}}}var pm="http://www.w3.org/2000/svg",dr=22,yl=38,us=26,ay=210,ly=24,io=6e4,fr=36e5,Sn=864e5,dm={"15m":15*io,"1h":fr,"1d":Sn,"1w":7*Sn},fm=t=>un.indexOf(t),cy={debug:"dot",info:"circle",notice:"square",warning:"triangle",error:"diamond"},gt=(t,e,s)=>{let r=document.createElementNS(pm,t);for(let[i,o]of Object.entries(e))o!==void 0&&r.setAttribute(i,String(o));if(s){let i=document.createElementNS(pm,"title");i.textContent=s,r.append(i)}return r},sn=(t,e)=>{try{return new Intl.DateTimeFormat(void 0,{timeZone:e,dateStyle:"medium",timeStyle:"medium"}).format(t)}catch{return new Date(t).toISOString()}},hp=t=>t<1e3?`${Math.round(t)} ms`:t<io?`${(t/1e3).toFixed(1)} s`:cr(t),py=(t,e)=>e==="bytes"?t>=1e9?`${(t/1e9).toFixed(1)} GB`:t>=1e6?`${(t/1e6).toFixed(1)} MB`:t>=1e3?`${(t/1e3).toFixed(1)} kB`:`${Math.round(t)} B`:`${Math.round(t*10)/10}${e==="count"?"":` ${e}`}`;function yp(t,e){if(t<=3*fr)return{kind:"single"};for(let s of["1m","1h","1d"])if(t/zn[s]<=e/2)return{kind:"binned",bin:s};return{kind:"binned",bin:"1d"}}function gp(t,e,s){let r=[];for(let n of t.events??[])r.push([n.t,n.t]),n.dur!==void 0&&!n.open&&r.push([n.t+n.dur,n.t+n.dur]);for(let n of t.spans??[])r.push([n.t,n.t]),n.dur!==void 0&&!n.open&&r.push([n.t+n.dur,n.t+n.dur]);let i=e.kind==="binned"?zn[e.bin]:io;for(let n of t.bins??[])n.count&&r.push([n.t,n.t+zn[n.bin]]);let o=new Map;for(let n of t.metrics){let a="value"in n?n.value:n.sum,f=`${n.series}|${n.scope}`,p=(s?.get(n.series)??"counter")==="counter"?a!==0:o.get(f)!==a;o.set(f,a),p&&r.push([n.t,n.t+i])}return r}function mm(t,e){let s=e.tz??Intl.DateTimeFormat().resolvedOptions().timeZone,r=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches,i=e.motion??!r;t.classList.add(...e.rootClass??[],"tlx");let{parseSearch:o,compileSearch:n}=Xr(e.catalog),a=(F="system")=>{t.style.colorScheme=F==="system"?"light dark":F,F==="system"?delete t.dataset.theme:t.dataset.theme=F};a(e.theme),t.setAttribute("role","region"),t.setAttribute("aria-label","Timeline");let f,p="",c=1,l="",d={},m=!1,h=e.collapseGaps??!0,y={t0:0,t1:Sn},g,k="",u={from:0,to:0,mode:{kind:"single"},key:""},b,x,w,$,v=!0,O=0,C=0,A=!1,R,M=[],T=[],S=-1,N=new Set,z=new Map,K=[],J=Qr(0,Sn,800),Z=new Map,L=[],U=re("nav",{class:"tlx-crumbs","aria-label":"Scope"}),H=re("div",{class:"segmented tlx-quick",role:"group","aria-label":"Range"});for(let F of["15m","1h","1d","1w","run"]){let se=re("button",{type:"button",class:"seg","data-v":F,title:F==="run"?"The latest run":`The last ${F}`},F==="run"?"this run":F);se.addEventListener("click",()=>ys(F)),H.append(se)}let ee=re("button",{type:"button",class:"btn sm tlx-live","aria-pressed":"false",title:"Follow what happens now"},"Live"),j=re("button",{type:"button",class:"btn sm quiet tlx-now",hidden:!0,title:"Back to the live edge"},"Back to now"),q=re("button",{type:"button",class:"btn sm quiet tlx-fit",title:"Everything in this scope"},"Fit"),G=re("input",{type:"checkbox",class:"tlx-gaps"});G.checked=h;let Q=!0,ce=re("input",{type:"checkbox",class:"tlx-quiet"});ce.checked=Q;let pe=re("input",{type:"search",class:"input tlx-q",placeholder:"Search: words, kind:\u2026, source:\u2026, severity:>=warning, -kind:\u2026","aria-label":"Search the timeline",spellcheck:"false"}),Y=re("span",{class:"tlx-hits",role:"status","aria-live":"polite"}),ie=re("button",{type:"button",class:"btn sm quiet tlx-prev",title:"Previous hit (\u21E7N)","aria-label":"Previous hit"},"\u2039"),Ae=re("button",{type:"button",class:"btn sm quiet tlx-next",title:"Next hit (N)","aria-label":"Next hit"},"\u203A"),De=re("div",{class:"tlx-facets",role:"group","aria-label":"Sources"}),I=re("select",{class:"input tlx-sev","aria-label":"Severity"},re("option",{value:""},"every severity"),...un.slice(1).map(F=>re("option",{value:F},`${F} and above`))),V=re("select",{class:"input tlx-views","aria-label":"Saved views",hidden:!e.views},re("option",{value:""},"Saved views\u2026")),te=re("button",{type:"button",class:"btn sm quiet tlx-save",hidden:!e.saveView,title:"Save this view"},"Save view"),ae=re("div",{class:"tlx-warn",role:"status",hidden:!0}),Te=re("div",{class:"tlx-status",role:"status"}),be=re("span",{class:"tlx-canvas-note"}),ze=re("div",{class:"tlx-labels"}),Ie=re("div",{class:"tlx-lanes",tabindex:"0",role:"application","aria-label":"Timeline lanes: drag to pan, wheel to zoom, drag the axis to choose a range, click it to move the playhead. Keys: \u2190 \u2192 pan, + \u2212 zoom, N next hit"}),ke=gt("svg",{class:"tlx-svg"});Ie.append(ke);let Be=re("div",{class:"tlx-scroll"},re("div",{class:"tlx-grid"},ze,Ie)),Qe=re("section",{class:"tlx-table",hidden:!0,"aria-label":"The events in the chosen range"}),Ke=re("aside",{class:"tlx-detail",hidden:!0,"aria-label":"The event"});t.replaceChildren(re("div",{class:"tlx-bar"},U,re("span",{class:"spacer"}),H,ee,j,q,re("label",{class:"tlx-gaps-label",title:"Draw long empty stretches as narrow breaks"},G,"Collapse gaps"),re("label",{class:"tlx-gaps-label",title:"Hide the rows with nothing in this range"},ce,"Hide quiet rows")),re("div",{class:"tlx-bar"},pe,Y,ie,Ae,I,V,te),De,ae,re("div",{class:"tlx-body"},Be,Ke),re("div",{class:"tlx-foot"},Te,re("span",{class:"spacer"}),be),Qe);let pt=()=>Math.max(200,Ie.clientWidth||800),P=()=>{let F=(Me,He)=>(Me.own?-1:0)-(He.own?-1:0)||Me.scope.localeCompare(He.scope,void 0,{numeric:!0}),he=(g?.rows??[]).filter(Me=>!Q||Me.count>0||Me.own||(g?.rows.length??0)<=1).sort(F).map(Me=>({kind:"row",row:Me})),ge=new Set(g?.metrics.map(Me=>Me.series)??[]);for(let Me of[...ge].sort()){let He=Z.get(Me);he.push({kind:"metric",series:Me,unit:He?.unit??"count",type:He?.type??"counter",title:He?.title??Me})}return he},B=(F,se)=>f?.names?.find(he=>he.scope===F)?.label??se,W=F=>F.kind==="metric"?yl:dr,fe=()=>yp(y.t1-y.t0,pt()),me=()=>f?.now??Date.now();function X(){return{timeline:1,type:"view",name:"",scope:p,depth:c,range:{from:Math.round(y.t0),to:Math.round(y.t1)},...l?{q:l}:{},...Object.keys(d).length?{filters:d}:{},...m?{live:m}:{},...h?{}:{collapseGaps:!1},...Q?{}:{quietRows:!0}}}function ne(F){F.scope!==void 0&&(p=F.scope),F.depth!==void 0&&(c=F.depth),l=F.q??"",pe.value=l,d=F.filters??{},I.value=d.severity?.length?d.severity[0]:"",h=F.collapseGaps??e.collapseGaps??!0,G.checked=h,Q=!F.quietRows,ce.checked=Q,N.clear(),z.clear();let se=F.range;se&&"last"in se?ys(se.last,!1):se&&(y={t0:se.from,t1:se.to}),kt(!!F.live,!1)}let ye=()=>{let F=X();if(e.onViewChange?.(F),!!e.urlState)try{history.replaceState(null,"",`#timeline=${encodeURIComponent(JSON.stringify(F))}`)}catch{}},$e=()=>{if(!e.urlState)return;let F=/#timeline=(.+)$/.exec(location.hash);if(F)try{return JSON.parse(decodeURIComponent(F[1]))}catch{return}};function E(F,se,he,ge={}){let Me=n(l,me(),F,se);M=Me.warnings;let He=l?[]:d.source?[...Z].filter(([,dt])=>d.source.includes(dt.source)).map(([dt])=>dt):void 0;return{timeline:1,type:"query",scope:p,depth:c,from:Me.from,to:Me.to,tz:s,...he.kind==="binned"?{bin:he.bin}:{},...l?{q:l,where:Me.where}:{},...Object.keys(d).length?{filters:d}:{},...He?{series:He}:{},...ge}}let _=()=>JSON.stringify([p,c,l,d,fe()]);async function D(F=!1){let se=fe(),he=_(),ge=y.t1-y.t0;if(!F&&g&&he===u.key&&y.t0>=u.from&&y.t1<=u.to){ue();return}if(C){A=!0;return}C++;let Me=y.t0-ge/2,He=Math.min(y.t1+ge/2,Math.max(y.t1,me()+ge*.1));try{let dt=await e.source.query(E(Me,He,se,se.kind==="single"?{limit:1e4}:{}));se.kind==="single"&&dt.next&&(dt=await e.source.query(E(Me,He,{kind:"binned",bin:"1m"}))),g=dt,k=he,u={from:Me,to:He,mode:se,key:he}}catch(dt){Te.textContent=`The history couldn't be read: ${String(dt?.message??dt)}`}finally{C--}ue(),ye(),A&&(A=!1,D())}function le(){let F=pt(),se=fe();if(K=[],h&&g){let he=new Map([...Z].map(([ge,Me])=>[ge,Me.type]));K=dl(gp(g,se,he),y.t0,Math.min(y.t1,Math.max(y.t0,me())),{minFrac:.15,minMs:10*io}),se.kind==="binned"&&(K=K.filter(ge=>ge.to-ge.from>=2*zn[se.bin])),K=K.filter(ge=>!(N.has(pr(ge))&&(z.get(pr(ge))??1)>=1))}J=Qr(y.t0,y.t1,F,K,{cut:ly,weights:z})}let ue=()=>{O||(O=requestAnimationFrame(Ce))};function Ce(){O=0,le();let F=pt(),se=P(),he=u.mode,ge=[],Me=us;for(let de of se)ge.push(Me),Me+=W(de);let He=Math.max(Me,us+dr);ke.setAttribute("width",String(F)),ke.setAttribute("height",String(He)),ke.setAttribute("viewBox",`0 0 ${F} ${He}`);let dt=Be.scrollTop-200,ns=Be.scrollTop+(Be.clientHeight||600)+200,Ve=[],qe=J.x;Ve.push(gt("rect",{class:"tlx-axis",x:0,y:0,width:F,height:us}));let Xt=(g?.retention??[]).map(de=>({r:de,from:he.kind==="binned"?de.keptFrom.rollups[he.bin]??de.keptFrom.events:de.keptFrom.events,days:he.kind==="binned"?de.rollups[he.bin]:de.events})).filter(de=>de.from!==void 0);if(Xt.length){let de=Math.min(...Xt.map(Oe=>Oe.from));de>y.t0&&Ve.push(gt("rect",{class:"tlx-notkept",x:Math.max(0,qe(y.t0)),y:us,width:Math.max(0,qe(de)-Math.max(0,qe(y.t0))),height:He-us},`Nothing kept before ${sn(de,s)}: ${Xt.map(Oe=>`${Oe.r.source} ${Oe.days===null?"kept until deleted":`kept ${Oe.days} days`}`).join(", ")}`))}let gn=me();gn<y.t1&&Ve.push(gt("rect",{class:"tlx-future",x:qe(gn),y:us,width:F-qe(gn),height:He-us}));for(let de of fl(J,s,90)){Ve.push(gt("line",{class:`tlx-tick${de.major?" major":""}`,x1:de.x,x2:de.x,y1:us-6,y2:He}));let Oe=gt("text",{class:"tlx-ticklabel",x:de.x+3,y:16});Oe.textContent=de.label,Ve.push(Oe)}$&&Ve.push(gt("rect",{class:"tlx-brush",x:qe($.from),y:0,width:Math.max(1,qe($.to)-qe($.from)),height:He}));let mo=he.kind==="single"?(g?.events??[]).filter(de=>de.dur!==void 0||de.open):g?.spans??[],Dm=he.kind==="single"?(g?.events??[]).filter(de=>de.dur===void 0&&!de.open):[],Np=new Map;se.forEach((de,Oe)=>{de.kind==="row"&&Np.set(de.row.scope,Oe)});let uo=de=>{let Oe=Jt(p)+c,tt=Jt(de)>=Oe?Ms(de,Oe):de;return Np.get(tt)},oi=de=>ge[de]+W(se[de])>=dt&&ge[de]<=ns;if(se.forEach((de,Oe)=>{oi(Oe)&&Ve.push(gt("rect",{class:`tlx-lane${Oe%2?" odd":""}${de.kind==="metric"?" metric":""}`,x:0,y:ge[Oe],width:F,height:W(de)}))}),he.kind==="binned"){let de=new Map;for(let Oe of g?.bins??[]){let tt=uo(Oe.scope);tt!==void 0&&de.set(tt,Math.max(de.get(tt)??0,Oe.count))}for(let Oe of g?.bins??[]){let tt=uo(Oe.scope);if(tt===void 0||!oi(tt))continue;let ft=qe(Oe.t),it=qe(Oe.t+zn[Oe.bin]);if(it<0||ft>F)continue;let St=[...un].reverse().find(vn=>(Oe.severity[vn]??0)>0)??"info",Ut=Math.max(2,(dr-8)*Math.sqrt(Oe.count)/Math.sqrt(de.get(tt)||1));Ve.push(gt("rect",{class:"tlx-countbar",x:ft,y:ge[tt]+dr-3-Ut,width:Math.max(1,it-ft-.5),height:Ut,"data-t":Oe.t},`${sn(Oe.t,s)}: ${Oe.count} event${Oe.count===1?"":"s"}${St!=="info"&&St!=="debug"?`, the worst ${St}`:""}`)),(St==="warning"||St==="error")&&Ve.push(gt("rect",{class:`tlx-heat sev-${St}`,x:ft,y:ge[tt]+dr-(St==="error"?4:3),width:Math.max(1,it-ft-.5),height:St==="error"?3:2}))}}for(let de of mo){let Oe=uo(de.scope);if(Oe===void 0||!oi(Oe))continue;let tt=de.open?gn:de.t+(de.dur??0),ft=qe(de.t),it=qe(tt);if(it<-2||ft>F+2)continue;let St=`tlx-span sev-${de.severity}${de.open?" open":""}${w?.id===de.id?" selected":""}`,Ut=`${de.summary} \xB7 ${sn(de.t,s)}${de.open?", still going":`, ${hp(tt-de.t)}`}`,vn=ge[Oe]+5,Es=he.kind==="binned"?4:8,Mn=ft;for(let Fn of J.cuts)Fn.weight>=1||Fn.x1<=ft||Fn.x0>=it||(Fn.x0>Mn&&Ve.push(gt("rect",{class:St,x:Mn,y:vn,width:Math.max(1,Fn.x0-Mn),height:Es,rx:2,"data-id":de.id},Ut)),Ve.push(gt("path",{class:`${St} through`,d:`M${Fn.x0} ${vn+Es/2} H${Fn.x1}`,"data-id":de.id},`${Ut} (lasted through the break)`)),Mn=Fn.x1);it>Mn&&Ve.push(gt("rect",{class:St,x:Math.max(-2,Mn),y:vn,width:Math.max(2,Math.min(F+2,it)-Math.max(-2,Mn)),height:Es,rx:2,"data-id":de.id},Ut))}let Rp=new Map;for(let de of Dm){let Oe=uo(de.scope);if(Oe===void 0||!oi(Oe))continue;let tt=qe(de.t);if(tt<-6||tt>F+6||tt-(Rp.get(Oe)??-1/0)<3)continue;Rp.set(Oe,tt);let ft=ge[Oe]+dr/2+2,it=4,St=cy[de.severity],Ut=St==="diamond"?`M${tt} ${ft-it-1} l${it+1} ${it+1} l${-it-1} ${it+1} l${-it-1} ${-it-1} z`:St==="triangle"?`M${tt} ${ft-it-1} l${it+1} ${2*it+1} h${-2*it-2} z`:St==="square"?`M${tt-it+.5} ${ft-it+.5} h${2*it-1} v${2*it-1} h${-2*it+1} z`:"",vn=`${sn(de.t,s)} \xB7 ${de.summary}`,Es=`tlx-mark sev-${de.severity}${w?.id===de.id?" selected":""}${S>=0&&T[S]?.id===de.id?" hit":""}`;Ve.push(Ut?gt("path",{class:Es,d:Ut,"data-id":de.id},vn):gt("circle",{class:Es,cx:tt,cy:ft,r:St==="dot"?2.5:it,"data-id":de.id},vn))}se.forEach((de,Oe)=>{if(de.kind!=="metric"||!oi(Oe))return;let tt=new Map;for(let ut of g?.metrics??[]){if(ut.series!==de.series)continue;let Ht="value"in ut?{min:ut.value,max:ut.value,sum:ut.value,count:1}:{min:ut.min,max:ut.max,sum:ut.sum,count:ut.count},Bt=tt.get(ut.t);Bt?(Bt.min=Math.min(Bt.min,Ht.min),Bt.max=Math.max(Bt.max,Ht.max),Bt.sum+=Ht.sum,Bt.count+=Ht.count):tt.set(ut.t,{...Ht})}let ft=[...tt].sort((ut,Ht)=>ut[0]-Ht[0]);if(!ft.length)return;let it=he.kind==="binned"?zn[he.bin]:io,St=ut=>de.type==="gauge"?ut.sum/Math.max(1,ut.count):ut.sum,Ut=Math.max(1e-9,...ft.map(([,ut])=>de.type==="gauge"?ut.max:St(ut))),vn=ge[Oe]+yl-4,Es=yl-10,Mn=ut=>vn-ut/Ut*Es;if(de.type==="gauge"){let ut=ft.map(([Ht,Bt])=>`${qe(Ht)},${Mn(Bt.max)}`).join(" ")+" "+[...ft].reverse().map(([Ht,Bt])=>`${qe(Ht)},${Mn(Bt.min)}`).join(" ");Ve.push(gt("polygon",{class:"tlx-band",points:ut})),Ve.push(gt("polyline",{class:"tlx-line",points:ft.map(([Ht,Bt])=>`${qe(Ht+it/2)},${Mn(St(Bt))}`).join(" ")}))}else{let ut="",Ht=-1/0;for(let[Bt,Bm]of ft){let qm=qe(Bt),Ip=qe(Bt+it),zp=Mn(St(Bm));ut+=Bt>Ht?`M${qm} ${vn} V${zp} H${Ip}`:` V${zp} H${Ip}`,Ht=Bt+it;let Cp=ft.find(([Vm])=>Vm>Bt);(!Cp||Cp[0]>Ht)&&(ut+=` V${vn} Z`)}Ve.push(gt("path",{class:"tlx-area",d:ut}))}let Fn=gt("text",{class:"tlx-peak",x:4,y:ge[Oe]+11});Fn.textContent=`peak ${py(Ut,de.unit)}${de.type==="counter"?` per ${he.kind==="binned"?he.bin:"1m"}`:""}`,Ve.push(Fn)});for(let de of J.cuts){if(de.weight>=1)continue;let Oe=it=>{let St=`M${it} 0`;for(let Ut=0;Ut<He;Ut+=8)St+=` L${it+(Ut/8%2?-3:3)} ${Ut+8}`;return St},tt=gt("g",{class:"tlx-cut",tabindex:0,role:"button","data-from":de.from,"data-to":de.to,"aria-label":`A break of ${cr(de.to-de.from)} with nothing shown, from ${sn(de.from,s)} to ${sn(de.to,s)}: press to open it`},`${cr(de.to-de.from)} with nothing here: ${sn(de.from,s)} to ${sn(de.to,s)} (click to open)`);tt.append(gt("rect",{class:"tlx-cut-bg",x:de.x0,y:0,width:de.x1-de.x0,height:He})),tt.append(gt("path",{class:"tlx-cut-edge",d:Oe(de.x0+3)}),gt("path",{class:"tlx-cut-edge",d:Oe(de.x1-3)}));let ft=gt("text",{class:"tlx-cut-label",x:(de.x0+de.x1)/2,y:15,"text-anchor":"middle"});ft.textContent=cr(de.to-de.from),tt.append(ft),Ve.push(tt)}if(b!==void 0){let de=qe(b);Ve.push(gt("line",{class:"tlx-playhead",x1:de,x2:de,y1:0,y2:He})),Ve.push(gt("path",{class:"tlx-handle",d:`M${de-6} 0 h12 v8 l-6 7 l-6 -7 z`},`the playhead: ${sn(b,s)}`))}ke.replaceChildren(...Ve),ze.replaceChildren(re("div",{class:"tlx-labelhead",style:`height:${us}px`},fe().kind==="single"?"single events":`per ${fe().kind==="binned"?fe().bin:""}`),...se.map(de=>{if(de.kind==="metric")return re("div",{class:"tlx-rowlabel metric",style:`height:${yl}px`,title:`${de.title} (${de.type==="counter"?"sums":"min, max and mean"})`},de.title);let Oe=de.row,tt=re("div",{class:`tlx-rowlabel${Oe.own?" own":""}`,style:`height:${dr}px`,"data-scope":Oe.scope,title:`${Oe.scope||"all hosts"} \xB7 ${Oe.count} event${Oe.count===1?"":"s"}`},re("span",{class:"tlx-kind"},e.catalog.flags.find(ft=>Oe[ft])??Oe.kind),re("span",{class:"tlx-name"},Oe.own?`${Oe.label} (itself)`:Oe.label),re("span",{class:"tlx-count"},String(Oe.count)));if(!Oe.own&&Oe.scope!==p){let ft=re("button",{type:"button",class:"tlx-drill",title:Oe.children?`Into ${Oe.label}: its ${Oe.children} part${Oe.children===1?"":"s"}`:`Into ${Oe.label}`,"aria-label":`Into ${Oe.label}`},"\u203A");ft.addEventListener("click",()=>at(Oe.scope)),tt.append(ft)}return tt})),ze.style.width=`${ay}px`,oe()}function oe(){U.replaceChildren(...Jr(p).flatMap((ge,Me,He)=>{let dt=re("button",{type:"button",class:`tlx-crumb${Me===He.length-1?" current":""}`,"aria-current":Me===He.length-1?"location":void 0},B(ge.scope,ge.label));return dt.addEventListener("click",()=>{ge.scope!==p&&(p=ge.scope,c=1,D(!0))}),Me?[re("span",{class:"tlx-sep","aria-hidden":"true"},"/"),dt]:[dt]})),ee.setAttribute("aria-pressed",String(m)),ee.classList.toggle("on",m),j.hidden=!m||v;let F=fe(),se=g?.total??0,he=(g?.retention??[]).filter(ge=>ge.events!==null).map(ge=>`${ge.source} kept ${ge.events} d`);Te.textContent=`${sn(y.t0,s)} \u2013 ${sn(y.t1,s)} \xB7 ${F.kind==="single"?"single events":`bins of ${F.bin}`} \xB7 ${se} event${se===1?"":"s"}${K.length?` \xB7 ${K.length} break${K.length===1?"":"s"}`:""}${he.length?` \xB7 ${he.slice(0,3).join(", ")}`:""}`,ae.hidden=!M.length,ae.textContent=M.join(" \xB7 "),Y.textContent=l?T.length?`${S+1>0?`${S+1} of `:""}${T.length}${T.length>=2e3?"+":""} hit${T.length===1?"":"s"}`:`${se?`${se} hit${se===1?"":"s"}`:"no hits"}`:"";for(let ge of H.querySelectorAll(".seg"))ge.classList.remove("on");be.textContent=b===void 0?"":x?(()=>{let ge=e.stamp?.(x)??{};return`Canvas: the state recorded at ${sn(Date.parse(ge.at??"")||b,s)}${ge.tag?` (${ge.tag})`:""}`})():"No state recorded here",be.classList.toggle("none",b!==void 0&&!x)}function Le(){De.replaceChildren();for(let F of f?.sources??[]){let se=!d.source?.length||d.source.includes(F.name),he=re("button",{type:"button",class:`tlx-chip${se?" on":""}${F.status==="not-yet"?" notyet":""}`,"aria-pressed":String(se&&F.status!=="not-yet"),disabled:F.status==="not-yet",title:F.status==="not-yet"?`${F.title}: not kept yet`:`${F.title}${Pe(F)}`},F.name);F.status!=="not-yet"&&he.addEventListener("click",()=>xe(F.name)),De.append(he)}}let Pe=F=>{let se=f?.retention.find(he=>he.source===F.name);return se?` (kept ${se.events===null?"until deleted":`${se.events} days`})`:""};function xe(F){let se=(f?.sources??[]).filter(ge=>ge.status==="kept").map(ge=>ge.name),he=d.source?.length?[...d.source]:[...se];he=he.includes(F)?he.filter(ge=>ge!==F):[...he,F],d={...d,...he.length===se.length?{source:void 0}:{source:he}},d.source||delete d.source,Le(),D(!0),Ue()}let _e=0;pe.addEventListener("input",()=>{clearTimeout(_e),_e=setTimeout(()=>{l=pe.value.trim(),S=-1,D(!0),Ue()},250)}),pe.addEventListener("keydown",F=>{F.key==="Enter"&&(F.preventDefault(),clearTimeout(_e),l=pe.value.trim(),D(!0).then(()=>Ue()).then(()=>mt(F.shiftKey?-1:1)))});async function Ue(){if(!l){T=[],S=-1,oe();return}let F=y.t1-y.t0;T=(await e.source.query(E(y.t0-F*4,Math.max(y.t1+F*4,me()),{kind:"single"},{limit:2e3}))).events??[],S=Math.min(S,T.length-1),oe()}function mt(F){if(!T.length)return;let se=(y.t0+y.t1)/2;S<0?S=F>0?Math.max(0,T.findIndex(Me=>Me.t>=se)):Math.max(0,T.length-1-[...T].reverse().findIndex(Me=>Me.t<=se)):S=(S+F+T.length)%T.length;let he=T[S],ge=Math.min(y.t1-y.t0,2*fr);y={t0:he.t-ge/2,t1:he.t+ge/2},v=!1,$t(he),D()}ie.addEventListener("click",()=>mt(-1)),Ae.addEventListener("click",()=>mt(1)),I.addEventListener("change",()=>{let F=I.value;d={...d,...F?{severity:un.filter(se=>fm(se)>=fm(F))}:{}},F||delete d.severity,D(!0),Ue()});async function ys(F,se=!0){let he=me();if(F==="run"){let ge=await e.source.query({timeline:1,type:"query",scope:p,depth:0,from:he-30*Sn,to:he+1,filters:{kind:["run"]},limit:1e4}).catch(()=>{}),Me=ge?.events?.[ge.events.length-1];y=Me?{t0:Me.t-(Me.dur??fr)*.02,t1:(Me.open?he:Me.t+(Me.dur??fr))+(Me.dur??fr)*.04}:{t0:he-Sn,t1:he+Sn*.02}}else y={t0:he-dm[F],t1:he+dm[F]*.02};v=!0,N.clear(),z.clear(),se&&D()}function kt(F,se=!0){if(m=F,R?.(),R=void 0,F&&e.source.subscribe){let he=0,ge=0;R=e.source.subscribe(E(me()-fr,me()+365*Sn,{kind:"single"}),Me=>{if(f&&(f.now=Math.max(f.now,Me.now)),v){let dt=y.t1-y.t0;y={t0:Me.now-dt*.98,t1:Me.now+dt*.02}}let He=Date.now();He-he>500?(he=He,D(!0)):ge||(ge=setTimeout(()=>{ge=0,he=Date.now(),D(!0)},500))}),v=!0}se&&(oe(),ye())}ee.addEventListener("click",()=>kt(!m)),j.addEventListener("click",()=>{v=!0;let F=y.t1-y.t0,se=me();y={t0:se-F*.98,t1:se+F*.02},D()}),q.addEventListener("click",()=>{ht()}),G.addEventListener("change",()=>{h=G.checked,N.clear(),z.clear(),ue(),ye()}),ce.addEventListener("change",()=>{Q=ce.checked,ue(),ye()});function at(F){let se=g?.rows.find(he=>he.scope===F);p=F,c=se&&se.children===0?0:1,$=void 0,Qe.hidden=!0,D(!0)}async function ht(){let F=me(),he=((await e.source.query({timeline:1,type:"query",scope:p,depth:0,from:F-400*Sn,to:F+1,bin:"1d",tz:s}).catch(()=>{}))?.bins??[]).map(Me=>Me.t),ge=he.length?Math.min(...he):F-7*Sn;y={t0:ge,t1:F+(F-ge)*.02},v=!0,D()}let Ln=0;async function Kt(F){if(b=F,ue(),F===void 0){x=void 0;return}let se=++Ln,he=e.source.stateAt?await e.source.stateAt(p,F).catch(()=>{}):void 0;se===Ln&&(x=he,e.onPlayhead?.(F,he),oe())}async function _t(F,se){$={from:Math.min(F,se),to:Math.max(F,se)},ue();let he=await e.source.query(E($.from,$.to,{kind:"single"},{limit:500})),ge=o(l),Me=Ve=>{let qe=[],zt=0;for(let[Xt,gn]of ro(ge,Ve))qe.push(Ve.slice(zt,Xt),re("mark",null,Ve.slice(Xt,gn))),zt=gn;return qe.push(Ve.slice(zt)),qe},He=(he.events??[]).map(Ve=>{let qe=re("tr",{"data-id":Ve.id,tabindex:"0"},re("td",null,sn(Ve.t,s)),re("td",null,Ve.dur!==void 0?hp(Ve.dur):Ve.open?"still going":""),re("td",null,Ve.source),re("td",null,Ve.kind),re("td",{class:`sev-${Ve.severity}`},Ve.severity),re("td",{class:"tlx-sum"},...Me(Ve.summary)),re("td",{class:"tlx-scope"},Ve.scope));return qe.addEventListener("click",()=>$t(Ve)),qe.addEventListener("keydown",zt=>{zt.key==="Enter"&&$t(Ve)}),qe}),dt=re("button",{type:"button",class:"btn sm quiet","aria-label":"Close the table"},"Close");dt.addEventListener("click",()=>{$=void 0,Qe.hidden=!0,ue()});let ns=Ve=>{let qe=re("button",{type:"button",class:"btn sm","data-export":Ve},Ve.toUpperCase());return qe.addEventListener("click",()=>{Gt(Ve)}),qe};Qe.replaceChildren(re("div",{class:"tlx-table-head"},re("strong",null,`${he.total} event${he.total===1?"":"s"}`),re("span",null,` ${sn($.from,s)} \u2013 ${sn($.to,s)}${he.total>500?" (the first 500 shown; the export has them all)":""}`),re("span",{class:"spacer"}),re("span",null,"Export: "),ns("json"),ns("csv"),dt),re("div",{class:"tlx-table-wrap"},re("table",null,re("thead",null,re("tr",null,...["When","Long","Source","Kind","Severity","What","Scope"].map(Ve=>re("th",{scope:"col"},Ve)))),re("tbody",null,...He)))),Qe.hidden=!1}async function Dt(){if(!$)return[];let F=[],se;do{let he=await e.source.query(E($.from,$.to,{kind:"single"},{limit:1e4,...se?{cursor:se}:{}}));F.push(...he.events??[]),se=he.next}while(se&&F.length<2e5);return F}async function Gt(F){let se=await Dt(),he=F==="json"?ml(se,L):ul(se,L),ge=`timeline-${new Date($.from).toISOString().slice(0,16).replace(/:/g,"")}.${F}`,Me=F==="json"?"application/json":"text/csv";if(e.onExport){e.onExport(ge,he,Me);return}let He=re("a",{href:`data:${Me};charset=utf-8,${encodeURIComponent(he)}`,download:ge});document.body.append(He),He.click(),He.remove()}function $t(F){if(w=F,ue(),!F){Ke.hidden=!0;return}let se=f?.sources.find(qe=>qe.name===F.source),he=new Set(se?.sensitive??[]),ge=o(l),Me=qe=>{let zt=[],Xt=0;for(let[gn,mo]of ro(ge,qe))zt.push(qe.slice(Xt,gn),re("mark",null,qe.slice(gn,mo))),Xt=mo;return zt.push(qe.slice(Xt)),zt},He=(qe,zt)=>{if(!zt)return null;let Xt=re("button",{type:"button",class:"btn sm"},qe);return Xt.addEventListener("click",zt),Xt},dt=Object.entries(F.attrs).map(([qe,zt])=>{if(!he.has(qe))return re("tr",null,re("th",{scope:"row"},qe),re("td",null,...Me(String(zt))));let Xt=re("button",{type:"button",class:"btn sm quiet",title:"This can name a remote host, a folder or free text"},"Show"),gn=re("td",{class:"tlx-sensitive"},"hidden ",Xt);return Xt.addEventListener("click",()=>gn.replaceChildren(String(zt))),re("tr",null,re("th",{scope:"row"},qe),gn)}),ns=re("button",{type:"button",class:"btn sm quiet tlx-close","aria-label":"Close"},"\xD7");ns.addEventListener("click",()=>$t(void 0));let Ve=Jr(F.scope).slice(1).map(qe=>{let zt=re("button",{type:"button",class:"tlx-crumb"},B(qe.scope,qe.label));return zt.addEventListener("click",()=>at(qe.scope)),zt});Ke.replaceChildren(re("div",{class:"tlx-detail-head"},re("strong",null,F.kind),ns),re("p",{class:`tlx-sev sev-${F.severity}`},`${F.severity} \xB7 ${se?.title??F.source}`),re("p",{class:"tlx-sum"},...Me(F.summary)),re("p",null,sn(F.t,s),F.dur!==void 0?` \xB7 ${hp(F.dur)}${F.open?" so far":""}`:F.open?" \xB7 still going":""),re("p",{class:"tlx-crumbs small"},...Ve),...dt.length?[re("table",{class:"tlx-attrs"},re("tbody",null,...dt))]:[],re("div",{class:"tlx-links"},...(e.actions?.(F)??[]).map(([qe,zt])=>He(qe,zt)))),Ke.hidden=!1}function ur(F,se){let he=pr({from:F,to:se});if(!K.find(dt=>dt.from===F&&dt.to===se))return;if(N.add(he),!i){z.set(he,1),ue();return}let Me=performance.now(),He=dt=>{let ns=Math.min(1,(dt-Me)/260);z.set(he,1-(1-ns)**3),Ce(),ns<1&&requestAnimationFrame(He)};requestAnimationFrame(He)}let Zt,Zs=F=>F.clientX-ke.getBoundingClientRect().left;ke.addEventListener("pointerdown",F=>{let se=Zs(F),he=F.clientY-ke.getBoundingClientRect().top,ge=F.target.closest?.(".tlx-cut");if(ge){F.preventDefault(),ur(Number(ge.getAttribute("data-from")),Number(ge.getAttribute("data-to")));return}ke.setPointerCapture(F.pointerId),Zt={kind:he<us||F.shiftKey?"brush":F.target.classList.contains("tlx-handle")?"scrub":"pan",x0:se,t0:J.t(se),v0:y,moved:!1},F.preventDefault(),Ie.focus({preventScroll:!0})}),ke.addEventListener("pointermove",F=>{if(!Zt)return;let se=Zs(F);if(Math.abs(se-Zt.x0)>3&&(Zt.moved=!0),!!Zt.moved)if(Zt.kind==="pan"){let he=(Zt.x0-se)*J.msPerPx;y={t0:Zt.v0.t0+he,t1:Zt.v0.t1+he},v=!1,D()}else Zt.kind==="scrub"?Kt(J.t(se)):($={from:Math.min(Zt.t0,J.t(se)),to:Math.max(Zt.t0,J.t(se))},ue())}),ke.addEventListener("pointerup",F=>{let se=Zt;if(Zt=void 0,!se)return;let he=Zs(F);if(se.kind==="brush"&&se.moved){_t(se.t0,J.t(he));return}if(se.kind==="brush"&&!se.moved){Kt(J.t(he));return}if(se.kind==="pan"&&!se.moved){let ge=F.target.closest?.("[data-id]")?.getAttribute("data-id"),Me=ge?[...g?.events??[],...g?.spans??[]].find(He=>He.id===ge):void 0;Me?($t(Me),Kt(Me.t)):Kt(J.t(he))}}),ke.addEventListener("keydown",F=>{let se=F.target.closest?.(".tlx-cut");se&&(F.key==="Enter"||F.key===" ")&&(F.preventDefault(),ur(Number(se.getAttribute("data-from")),Number(se.getAttribute("data-to"))))}),ke.addEventListener("wheel",F=>{F.preventDefault();let se=Zs(F);if(F.shiftKey||Math.abs(F.deltaX)>Math.abs(F.deltaY)){let he=(F.shiftKey?F.deltaY:F.deltaX)*J.msPerPx;y={t0:y.t0+he,t1:y.t1+he},v=!1}else hr(J.t(se),Math.exp(F.deltaY*.0015),se/pt());D()},{passive:!1});function hr(F,se,he=.5){let ge=Math.min(400*Sn,Math.max(1e4,(y.t1-y.t0)*se));y={t0:F-he*ge,t1:F+(1-he)*ge},N.clear(),z.clear(),se<1&&(v=m&&y.t1>=me())}Ie.addEventListener("keydown",F=>{let se=y.t1-y.t0;if(F.key==="ArrowLeft"||F.key==="ArrowRight"){let he=se*.15*(F.key==="ArrowLeft"?-1:1);y={t0:y.t0+he,t1:y.t1+he},v=!1}else if(F.key==="+"||F.key==="=")hr((y.t0+y.t1)/2,.6);else if(F.key==="-"||F.key==="_")hr((y.t0+y.t1)/2,1/.6);else if(F.key==="n"||F.key==="N"){mt(F.shiftKey?-1:1),F.preventDefault();return}else if(F.key==="Escape")$t(void 0),$=void 0,Qe.hidden=!0;else return;F.preventDefault(),D()}),t.addEventListener("keydown",F=>{F.key==="/"&&document.activeElement!==pe&&!F.target.closest("input, select, textarea")&&(F.preventDefault(),pe.focus())}),Be.addEventListener("scroll",()=>ue(),{passive:!0}),te.addEventListener("click",async()=>{let F=`${Jr(p).slice(-1)[0].label}${l?`: ${l}`:""}`.slice(0,80);await e.saveView?.({...X(),name:F}),await _n()});let We=[];async function _n(){e.views&&(We=await e.views(),V.replaceChildren(re("option",{value:""},"Saved views\u2026"),...We.map((F,se)=>re("option",{value:String(se)},F.name))))}V.addEventListener("change",()=>{let F=We[Number(V.value)];F&&(ne(F),Le(),D(!0)),V.value=""});let yt=typeof ResizeObserver=="function"?new ResizeObserver(()=>ue()):void 0;yt?.observe(Ie);let cn=(async()=>{f=await e.source.catalog(),L=f.sources.flatMap(ge=>(ge.sensitive??[]).map(Me=>`${ge.name}.${Me}`));for(let ge of f.sources)for(let Me of ge.series)Z.set(Me.name,{unit:Me.unit,type:Me.type,title:Me.title,source:ge.name});p=f.hosts.length===1?`host:${f.hosts[0].replace(/[%/:\s]/g,ge=>`%${ge.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`)}`:"";let se=f.now;y={t0:se-Sn,t1:se+Sn*.02};let he=$e()??e.view;he&&ne(he),Le(),await _n(),await D(!0),l&&await Ue()})();return{el:t,ready:cn,get view(){return X()},setView(F){return ne(F),Le(),D(!0)},setRange(F,se){return y={t0:F,t1:se},v=!1,D()},setPlayhead:Kt,setLive:kt,setTheme:a,refresh:()=>D(!0),internal:{get result(){return g},get mode(){return fe()},get scale(){return J},get gaps(){return K},get playState(){return x},get hits(){return T},get selected(){return w},get follow(){return v},openCut:ur,showTable:_t,rangeEvents:Dt,exportRange:Gt,select:$t,stepHit:mt,drill:at,findHits:Ue,paint:Ce,lines:P},dispose(){R?.(),yt?.disconnect(),O&&cancelAnimationFrame(O),t.replaceChildren()}}}var dy={arrow:{d:"M0,0 L10,5 L0,10 z",refX:9},open:{d:"M0,0 L10,5 L0,10 L3,5 z",refX:9},diamond:{d:"M0,5 L5,1.5 L10,5 L5,8.5 z",refX:1}},rn=t=>(Math.round(t*10)/10).toString(),um=t=>(t??"link").replace(/[^\w-]/g,"_");function gl(t,e){let{id:s}=e,r=e.styles??{},i=t.options,o=t.bounds,n=new Map,a=(m,h)=>{let y=r[m]??{},g=h==="start"?y.start??"none":y.end??"arrow";if(g!=="none")return(n.get(m)??n.set(m,new Set).get(m)).add(g),`url(#${s}-mk-${m}-${g})`},f="",p="",c="",l="";for(let m of[...t.panels].sort((h,y)=>h.depth-y.depth)){let h=m.rect,y=m.label?Se("text",{class:"pl",x:m.titleAt[0],y:m.titleAt[1]},vt(m.label)+(m.sub?Se("tspan",{class:"pls",dx:10},vt(m.sub)):"")):"";f+=Se("g",{class:`panel k-${m.role??"grey"}`,"data-id":m.id},Se("rect",{class:"face",x:rn(h.l),y:rn(h.t),width:rn(h.r-h.l),height:rn(h.b-h.t),rx:i.panelRx})+y)}for(let m of t.links){if(!m.points.length)continue;let h=um(m.kind);p+=Se("path",{class:`conn k-${h}`,d:"M"+m.points.map(y=>`${rn(y[0])},${rn(y[1])}`).join(" L"),"data-id":m.id,"data-a":m.a,"data-b":m.b,"marker-start":a(h,"start"),"marker-end":a(h,"end")}),m.at&&(l+=Se("text",{class:`cl k-${h}`,x:m.at.x,y:m.at.y,"text-anchor":m.at.anchor==="start"?void 0:m.at.anchor,"data-for":m.id},vt(m.at.text)))}for(let m of t.cards){let h=m.rect;c+=Se("g",{class:`card k-${m.role??"grey"}${m.ghost?" ghost":""}`,"data-id":m.id,tabindex:0,role:"button","aria-label":m.sub?`${m.label}: ${m.sub}`:m.label},Se("rect",{class:"face",x:rn(h.l),y:rn(h.t),width:i.W,height:i.H,rx:i.cardRx})+Se("text",{class:"lt",x:rn(h.l+14),y:rn(h.t+24)},vt(m.label))+(m.sub?Se("text",{class:"st",x:rn(h.l+14),y:rn(h.t+42)},vt(m.sub)):""))}let d="";for(let[m,h]of n)for(let y of h){let g=dy[y];d+=Se("marker",{id:`${s}-mk-${m}-${y}`,viewBox:"0 0 10 10",refX:g.refX,refY:5,markerWidth:5.4,markerHeight:5.4,orient:"auto-start-reverse"},Se("path",{d:g.d,class:`mk k-${m}`}))}return Se("svg",{xmlns:"http://www.w3.org/2000/svg",class:"flat",viewBox:`${rn(o.l)} ${rn(o.t)} ${rn(o.r-o.l)} ${rn(o.b-o.t)}`,role:"img","aria-label":e.title??"drawing, flat view","data-view":"2d"},(d?Se("defs",{},d):"")+Se("g",{class:"panels"},f)+Se("g",{class:"conns"},p)+Se("g",{class:"cards"},c)+Se("g",{class:"labels"},l))}function hm(t={}){let e=r=>r?r.startsWith("#")||r.includes("(")?r:`var(--${r})`:"var(--ink)",s=`
408
+ `}var py=864e5,es=36e5,bl=(t,e)=>t.t-e.t||(t.id<e.id?-1:t.id>e.id?1:0);function ms(t,e){let s=0,r=t.length;for(;s<r;){let i=s+r>>1;t[i].t<e?s=i+1:r=i}return s}var pm=(t,e)=>{t.min=Math.min(t.min,e.min),t.max=Math.max(t.max,e.max),t.sum+=e.sum,t.count+=e.count};function lm(t,e,s){let r=[];for(let i of t){let o=lr(i.t,e,s),n=r[r.length-1];n&&n.t===o?pm(n,i):r.push({t:o,min:i.min,max:i.max,sum:i.sum,count:i.count})}return r}function gp(t,e,s,r){for(let n=ms(t,e.t);n<t.length&&t[n].t===e.t;n++)if(s(t[n])){t[n]=e;return}let i=t[t.length-1];if(!i||r(i,e)<=0){t.push(e);return}let o=ms(t,e.t);for(;o<t.length&&r(t[o],e)<0;)o++;t.splice(o,0,e)}function cm(t,e,s){for(let r=ms(t,e);r<t.length&&t[r].t===e;r++)if(s(t[r])){t.splice(r,1);return}}function dm(t,e,s={}){let r=t.catalog,{isScope:i}=cl(e),{parseSearch:o,matchAst:n,toAst:a}=Xr(e),f=I=>Object.fromEntries(e.flags.filter(se=>I?.[se]).map(se=>[se,!0])),p=s.now??r.now,c=(r.names??[]).flatMap(I=>(I.aliases??[]).map(se=>[se,I.scope])).sort((I,se)=>se[0].length-I[0].length),l=new Map,d=I=>{if(!c.length)return I;let se=l.get(I);if(se===void 0){let ge=c.find(([xe])=>hn(I,xe));se=ge?ge[1]+I.slice(ge[0].length):I,l.set(I,se)}return se},m=new Map((r.names??[]).map(I=>[I.scope,I])),h=I=>c.length?{...I,scope:d(I.scope)}:I,y=I=>`${I.source}\0${I.id}`,g=t.events.map(h).sort(bl),k=new Map;for(let I of g)k.set(y(I),I);let u=g.filter(I=>I.dur!==void 0&&!I.open),b=u.reduce((I,se)=>Math.max(I,se.dur),0),x=new Map;for(let I of g)I.open&&x.set(y(I),I);let w=new Map,$=new Set,S=I=>{for(let se=Jt(I);se>=1;se--){let ge=Ms(I,se);if($.has(ge))break;$.add(ge)}},O=new Map;for(let I of r.sources)for(let se of I.series)O.set(se.name,se.type);let z=r.sources.flatMap(I=>(I.sensitive??[]).map(se=>`${I.name}.${se}`)),A=new Map;for(let I of r.sources)A.set(I.name,{events:I.defaultRetention.events,rollups:{...I.defaultRetention.rollups},setBy:"default"});for(let I of r.retention)A.set(I.source,{events:I.events,rollups:{...I.rollups},setBy:I.setBy});let R=new Map;for(let I of r.sources)for(let se of I.series)R.set(se.name,I.name);function P(I){let se=d(I.scope),ge=`${I.series}\0${se}`,xe=w.get(ge);xe||(xe={series:I.series,scope:se,fine:[],cache:new Map},w.set(ge,xe),S(se));let Ke="value"in I?{t:I.t,min:I.value,max:I.value,sum:I.value,count:1}:{t:I.t,min:I.min,max:I.max,sum:I.sum,count:I.count};gp(xe.fine,Ke,$e=>$e.t===Ke.t,($e,Ze)=>$e.t-Ze.t),xe.cache.clear()}for(let I of g)S(I.scope);for(let I of t.metrics)P(I);let E=new Map,v=new Set,N=(I,se)=>{v.add(I.source);let ge=E.get(I.scope);ge||E.set(I.scope,ge=new Map);let xe=ge.get(I.source);xe||ge.set(I.source,xe=new Map);let Ke=Math.floor(I.t/es)*es,$e=xe.get(Ke);if($e||xe.set(Ke,$e={t:Ke,count:0,severity:{},kinds:{},first:1/0,last:-1/0}),$e.count+=se,se>0)$e.first=Math.min($e.first,I.t),$e.last=Math.max($e.last,I.t);else if(I.t===$e.first||I.t===$e.last){$e.first=1/0,$e.last=-1/0;for(let Ze=ms(g,Ke);Ze<g.length&&g[Ze].t<Ke+es;Ze++){let Q=g[Ze];Q.scope===I.scope&&Q.source===I.source&&($e.first=Math.min($e.first,Q.t),$e.last=Math.max($e.last,Q.t))}}$e.severity[I.severity]=($e.severity[I.severity]??0)+se,$e.kinds[I.kind]=($e.kinds[I.kind]??0)+se,$e.severity[I.severity]===0&&delete $e.severity[I.severity],$e.kinds[I.kind]===0&&delete $e.kinds[I.kind],$e.count||xe.delete(Ke)};for(let I of g)N(I,1);let C=(I,se,ge)=>{let xe=`${se}|${ge??""}`,Ke=I.cache.get(xe);return Ke||(Ke=se==="1d"?lm(C(I,"1h",ge),"1d",ge):lm(I.fine,se,ge),I.cache.set(xe,Ke)),Ke},V=I=>I===null?-1/0:p-I*py,Y=I=>V(A.get(I)?.events??null),Z=(I,se)=>{let ge=A.get(I);return V(ge?se?ge.rollups[se]:ge.events:null)};function j(I){let se=[];for(let ge of new Set(I)){let xe=A.get(ge);if(!xe)continue;let Ke=g.find(te=>te.source===ge&&te.t>=Y(ge))?.t,$e=te=>{let we=1/0;for(let ze of w.values())if(R.get(ze.series)===ge){let De=(te?C(ze,te):ze.fine).find(qe=>qe.t>=Z(ge,te));De&&De.t<we&&(we=De.t)}return we===1/0?void 0:we},Ze=[Ke,$e()].filter(te=>te!==void 0),Q={};for(let te of["1m","1h","1d"]){let we=$e(te)??(Ke!==void 0&&Ke>=Z(ge,te)?Ke:void 0);we!==void 0&&(Q[te]=Math.max(we,Z(ge,te)))}se.push({source:ge,events:xe.events,rollups:{...xe.rollups},setBy:xe.setBy,keptFrom:{...Ze.length?{events:Math.min(...Ze)}:{},rollups:Q}})}return se}function K(I){let se=I.where,ge={from:I.from,to:I.to},xe=[];if(!se&&I.q){let De=o(I.q,p);se=a(De),ge=ro(De,I.from,I.to),xe=De.warnings}let Ke=n(se,z),$e=I.filters??{},Ze=$e.source?.length?new Set($e.source):void 0,Q=$e.kind?.length?new Set($e.kind):void 0,te=$e.severity?.length?new Set($e.severity):void 0,we=$e.scope?.length?$e.scope:void 0;return{test:De=>hn(De.scope,I.scope)&&(!Ze||Ze.has(De.source))&&(!Q||Q.has(De.kind))&&(!te||te.has(De.severity))&&(!we||we.some(qe=>hn(De.scope,qe)))&&De.t>=Y(De.source)&&Ke(De),range:ge,warnings:xe}}function U(I){let se=Jt(I.scope),ge=se+I.depth,xe=new Map,Ke=te=>{let we=xe.get(te);return we===void 0&&!xe.has(te)&&(we=hn(te,I.scope)?Jt(te)>=ge?Ms(te,ge):te:void 0,xe.set(te,we)),we},$e=te=>{let we=0,ze=Jt(te)+1;for(let De of $)Jt(De)===ze&&hn(De,te)&&we++;return we},Ze=new Map,Q=te=>{let we=Ze.get(te);if(!we){let ze=Jt(te)-se,De=m.get(te);we={scope:te,label:De?.label??Wr(te),kind:Yr(te),...f(De),depth:ze,...ze<I.depth?{own:!0}:{},children:$e(te),count:0},Ze.set(te,we)}return we};for(let te of $)Jt(te)===ge&&hn(te,I.scope)&&Q(te);return ge===0&&Q(""),{at:Ke,add:Q,rows:Ze}}let ee=I=>[...I.values()].sort((se,ge)=>se.scope===ge.scope?0:se.scope<ge.scope?-1:1);function L(I,se){let ge=[];for(let xe=ms(u,I-b);xe<u.length&&u[xe].t<I;xe++)u[xe].t+u[xe].dur>I&&ge.push(u[xe]);for(let xe of x.values())xe.t<I&&p>I&&ge.push(xe);for(let xe=ms(g,I);xe<g.length&&g[xe].t<se;xe++)ge.push(g[xe]);return ge}function q(I,se,ge,xe){let Ke=I.series?new Set(I.series):void 0,$e=new Map;for(let Q of w.values()){if(Ke&&!Ke.has(Q.series))continue;let te=se(Q.scope);if(te===void 0)continue;let we=R.get(Q.series)??"",ze=Z(we,I.bin),De=I.bin?C(Q,I.bin,I.tz):Q.fine;for(let qe=ms(De,I.bin?lr(ge,I.bin,I.tz):ge);qe<De.length&&De[qe].t<xe;qe++){let M=De[qe];if(M.t<ze)continue;let D=`${Q.series}\0${te}\0${M.t}`,W=$e.get(D);W?pm(W,M):$e.set(D,{series:Q.series,scope:te,t:M.t,bin:I.bin??"1m",min:M.min,max:M.max,sum:M.sum,count:M.count})}}let Ze=[...$e.values()].sort((Q,te)=>Q.t-te.t||(Q.series<te.series?-1:1)||(Q.scope<te.scope?-1:1));return I.bin?Ze:Ze.map(Q=>({series:Q.series,scope:Q.scope,t:Q.t,value:Q.count===1||O.get(Q.series)!=="gauge"?Q.sum:Q.sum/Q.count}))}let G=I=>`${I.t}:${I.id}`,X=(I,se)=>{let ge=se.indexOf(":"),xe=Number(se.slice(0,ge)),Ke=se.slice(ge+1);return I.t>xe||I.t===xe&&I.id>Ke};function ce(I){if(I.bin!=="1h"&&I.bin!=="1d"||(I.where?.all.length??0)||I.q||I.filters?.kind?.length||I.filters?.severity?.length||I.filters?.scope?.length||nn(I.tz,I.from)%es||nn(I.tz,I.to)%es)return;let se=I.filters?.source?.length?new Set(I.filters.source):void 0,ge=J=>Math.max(I.from,Y(J)),{at:xe,add:Ke,rows:$e}=U(I),Ze=new Set,Q=new Map,te=0,we=(J,ne)=>{let ye=lr(ne,I.bin,I.tz),ve=`${J}\0${ye}`,T=Q.get(ve);return T||(T={scope:J,t:ye,bin:I.bin,count:0,severity:{},kinds:{}},Q.set(ve,T)),T},ze=(J,ne,ye)=>{let ve=Ke(J);ve.count+=ye,te+=ye,(ve.first===void 0||ne<ve.first)&&(ve.first=ne),(ve.last===void 0||ne>ve.last)&&(ve.last=ne)},De=Math.floor(I.to/es)*es;for(let[J,ne]of E){let ye=xe(J);if(ye!==void 0)for(let[ve,T]of ne){if(se&&!se.has(ve))continue;let _=Math.ceil(ge(ve)/es)*es;for(let[B,pe]of T){if(B<_||B>=De)continue;ze(ye,pe.first,pe.count),pe.last>($e.get(ye).last??-1/0)&&($e.get(ye).last=pe.last),Ze.add(ve);let me=we(ye,B);me.count+=pe.count;for(let[Ce,ae]of Object.entries(pe.severity))me.severity[Ce]=(me.severity[Ce]??0)+ae;for(let[Ce,ae]of Object.entries(pe.kinds))me.kinds[Ce]=(me.kinds[Ce]??0)+ae}}}let qe=J=>hn(J.scope,I.scope)&&(!se||se.has(J.source))&&J.t>=Y(J.source)&&xe(J.scope)!==void 0,M=J=>{let ne=xe(J.scope);ze(ne,J.t,1),Ze.add(J.source);let ye=we(ne,J.t);ye.count++,ye.severity[J.severity]=(ye.severity[J.severity]??0)+1,ye.kinds[J.kind]=(ye.kinds[J.kind]??0)+1};for(let J of v){if(se&&!se.has(J))continue;let ne=ge(J),ye=Math.ceil(ne/es)*es,ve=ye>=De?[[ne,I.to]]:[[ne,ye],[De,I.to]];for(let[T,_]of ve)for(let B=ms(g,T);B<g.length&&g[B].t<_;B++){let pe=g[B];pe.source===J&&qe(pe)&&M(pe)}}let D=Cn[I.bin],W=[];for(let J=ms(u,I.from-b);J<u.length&&u[J].t<I.from;J++){let ne=u[J];ne.t+ne.dur>I.from&&qe(ne)&&(ze(xe(ne.scope),ne.t,1),Ze.add(ne.source),ne.dur>=D&&W.length<5e3&&W.push(ne))}for(let J of x.values())J.t<I.from&&p>I.from&&qe(J)&&(ze(xe(J.scope),J.t,1),Ze.add(J.source),W.length<5e3&&W.push(J));for(let J=ms(u,I.from);J<u.length&&u[J].t<I.to&&W.length<5e3;J++)u[J].dur>=D&&qe(u[J])&&W.push(u[J]);for(let J of x.values())J.t>=I.from&&J.t<I.to&&W.length<5e3&&qe(J)&&W.push(J);let he=q(I,xe,I.from,I.to);for(let J of he){let ne=R.get(J.series);ne&&Ze.add(ne)}let fe=[...Q.values()].sort((J,ne)=>J.t-ne.t||(J.scope<ne.scope?-1:1));return{timeline:1,type:"result",rows:ee($e),bins:fe,spans:W,metrics:he,total:te,retention:j(Ze)}}async function le(I){if(!i(I.scope))throw new Error(`not a scope path: ${JSON.stringify(I.scope)}`);let se=ce(I);if(se)return se;let{test:ge,range:xe,warnings:Ke}=K(I),{at:$e,add:Ze,rows:Q}=U(I),te=new Set,we=[];for(let he of L(xe.from,xe.to)){if(!ge(he))continue;let fe=$e(he.scope);if(fe===void 0)continue;let J=Ze(fe);J.count++,(J.first===void 0||he.t<J.first)&&(J.first=he.t),(J.last===void 0||he.t>J.last)&&(J.last=he.t),te.add(he.source),we.push(he)}we.sort(bl);let ze=q(I,$e,xe.from,xe.to);for(let he of ze){let fe=R.get(he.series);fe&&te.add(fe)}let De={timeline:1,type:"result",total:we.length,...Ke.length?{warnings:Ke}:{}};if(I.bin){let he=Cn[I.bin],fe=new Map,J=[];for(let ye of we){if((ye.open||ye.dur!==void 0&&ye.dur>=he)&&J.length<5e3&&J.push(ye),ye.t<xe.from)continue;let ve=$e(ye.scope),T=lr(ye.t,I.bin,I.tz),_=`${ve}\0${T}`,B=fe.get(_);B||(B={scope:ve,t:T,bin:I.bin,count:0,severity:{},kinds:{}},fe.set(_,B)),B.count++,B.severity[ye.severity]=(B.severity[ye.severity]??0)+1,B.kinds[ye.kind]=(B.kinds[ye.kind]??0)+1}let ne=[...fe.values()].sort((ye,ve)=>ye.t-ve.t||(ye.scope<ve.scope?-1:1));return{...De,rows:ee(Q),bins:ne,spans:J,metrics:ze,retention:j(te)}}let qe=Math.min(1e4,Math.max(1,I.limit??2e3)),M=I.cursor?we.findIndex(he=>X(he,I.cursor)):0,D=M<0?[]:we.slice(M,M+qe),W=M>=0&&M+qe<we.length;return{...De,rows:ee(Q),events:D,metrics:ze,retention:j(te),...W?{next:G(D[D.length-1])}:{}}}let H=new Set,oe=I=>un.includes(I),Ae=0;function _e(I){let se=y(I),ge=k.get(se);ge&&(cm(g,ge.t,xe=>xe===ge),N(ge,-1),ge.dur!==void 0&&!ge.open&&cm(u,ge.t,xe=>xe===ge),x.delete(se)),k.set(se,I),N(I,1),gp(g,I,()=>!1,bl),I.open?x.set(se,I):I.dur!==void 0&&(gp(u,I,()=>!1,bl),b=Math.max(b,I.dur)),S(I.scope)}return{async catalog(){return{...r,now:p,retention:j(r.sources.map(I=>I.name))}},query:le,subscribe(I,se){let ge={q:I,on:se};return H.add(ge),()=>{H.delete(ge)}},...s.stateAt?{stateAt:(I,se)=>s.stateAt(I,se)}:{},append(I,se=[],ge){ge!==void 0&&(p=Math.max(p,ge));let xe=new Set($),Ke=I.map(h);for(let $e of Ke){if(!oe($e.severity))throw new Error(`not a severity: ${$e.severity}`);_e($e)}for(let $e of se)P($e);Ae++;for(let $e of H){let{test:Ze}=K($e.q),{at:Q}=U($e.q),te=Ke.filter(D=>Ze(D)&&Q(D.scope)!==void 0),we=$e.q.series?new Set($e.q.series):void 0,ze=se.filter(D=>hn(d(D.scope),$e.q.scope)&&(!we||we.has(D.series))).map(D=>({...D,scope:Q(d(D.scope))})),De=[...$].filter(D=>!xe.has(D)),qe=Jt($e.q.scope)+$e.q.depth,M=De.filter(D=>Jt(D)===qe&&hn(D,$e.q.scope)).map(D=>({scope:D,label:m.get(D)?.label??Wr(D),kind:Yr(D),depth:$e.q.depth,children:0,count:0}));$e.on({timeline:1,type:"batch",events:te,metrics:ze,...M.length?{rows:M}:{},now:p,resume:String(Ae)})}},setRetention(I,se){A.set(I,{events:se.events,rollups:{...se.rollups},setBy:"user"})},get now(){return p},get size(){let I=0;for(let se of w.values())I+=se.fine.length;return{events:g.length,samples:I}}}}var fm="http://www.w3.org/2000/svg",dr=22,wl=38,us=26,dy=210,fy=24,oo=6e4,fr=36e5,vn=864e5,mm={"15m":15*oo,"1h":fr,"1d":vn,"1w":7*vn},um=t=>un.indexOf(t),my={debug:"dot",info:"circle",notice:"square",warning:"triangle",error:"diamond"},gt=(t,e,s)=>{let r=document.createElementNS(fm,t);for(let[i,o]of Object.entries(e))o!==void 0&&r.setAttribute(i,String(o));if(s){let i=document.createElementNS(fm,"title");i.textContent=s,r.append(i)}return r},sn=(t,e)=>{try{return new Intl.DateTimeFormat(void 0,{timeZone:e,dateStyle:"medium",timeStyle:"medium"}).format(t)}catch{return new Date(t).toISOString()}},bp=t=>t<1e3?`${Math.round(t)} ms`:t<oo?`${(t/1e3).toFixed(1)} s`:cr(t),uy=(t,e)=>e==="bytes"?t>=1e9?`${(t/1e9).toFixed(1)} GB`:t>=1e6?`${(t/1e6).toFixed(1)} MB`:t>=1e3?`${(t/1e3).toFixed(1)} kB`:`${Math.round(t)} B`:`${Math.round(t*10)/10}${e==="count"?"":` ${e}`}`;function wp(t,e){if(t<=3*fr)return{kind:"single"};for(let s of["1m","1h","1d"])if(t/Cn[s]<=e/2)return{kind:"binned",bin:s};return{kind:"binned",bin:"1d"}}function xp(t,e,s){let r=[];for(let n of t.events??[])r.push([n.t,n.t]),n.dur!==void 0&&!n.open&&r.push([n.t+n.dur,n.t+n.dur]);for(let n of t.spans??[])r.push([n.t,n.t]),n.dur!==void 0&&!n.open&&r.push([n.t+n.dur,n.t+n.dur]);let i=e.kind==="binned"?Cn[e.bin]:oo;for(let n of t.bins??[])n.count&&r.push([n.t,n.t+Cn[n.bin]]);let o=new Map;for(let n of t.metrics){let a="value"in n?n.value:n.sum,f=`${n.series}|${n.scope}`,p=(s?.get(n.series)??"counter")==="counter"?a!==0:o.get(f)!==a;o.set(f,a),p&&r.push([n.t,n.t+i])}return r}function hm(t,e){let s=e.tz??Intl.DateTimeFormat().resolvedOptions().timeZone,r=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches,i=e.motion??!r;t.classList.add(...e.rootClass??[],"tlx");let{parseSearch:o,compileSearch:n}=Xr(e.catalog),a=(F="system")=>{t.style.colorScheme=F==="system"?"light dark":F,F==="system"?delete t.dataset.theme:t.dataset.theme=F};a(e.theme),t.setAttribute("role","region"),t.setAttribute("aria-label","Timeline");let f,p="",c=1,l="",d={},m=!1,h=e.collapseGaps??!0,y={t0:0,t1:vn},g,k="",u={from:0,to:0,mode:{kind:"single"},key:""},b,x,w,$,S=!0,O=0,z=0,A=!1,R,P=[],E=[],v=-1,N=new Set,C=new Map,V=[],Y=Qr(0,vn,800),Z=new Map,j=[],K=ie("nav",{class:"tlx-crumbs","aria-label":"Scope"}),U=ie("div",{class:"segmented tlx-quick",role:"group","aria-label":"Range"});for(let F of["15m","1h","1d","1w","run"]){let re=ie("button",{type:"button",class:"seg","data-v":F,title:F==="run"?"The latest run":`The last ${F}`},F==="run"?"this run":F);re.addEventListener("click",()=>ys(F)),U.append(re)}let ee=ie("button",{type:"button",class:"btn sm tlx-live","aria-pressed":"false",title:"Follow what happens now"},"Live"),L=ie("button",{type:"button",class:"btn sm quiet tlx-now",hidden:!0,title:"Back to the live edge"},"Back to now"),q=ie("button",{type:"button",class:"btn sm quiet tlx-fit",title:"Everything in this scope"},"Fit"),G=ie("input",{type:"checkbox",class:"tlx-gaps"});G.checked=h;let X=!0,ce=ie("input",{type:"checkbox",class:"tlx-quiet"});ce.checked=X;let le=ie("input",{type:"search",class:"input tlx-q",placeholder:"Search: words, kind:\u2026, source:\u2026, severity:>=warning, -kind:\u2026","aria-label":"Search the timeline",spellcheck:"false"}),H=ie("span",{class:"tlx-hits",role:"status","aria-live":"polite"}),oe=ie("button",{type:"button",class:"btn sm quiet tlx-prev",title:"Previous hit (\u21E7N)","aria-label":"Previous hit"},"\u2039"),Ae=ie("button",{type:"button",class:"btn sm quiet tlx-next",title:"Next hit (N)","aria-label":"Next hit"},"\u203A"),_e=ie("div",{class:"tlx-facets",role:"group","aria-label":"Sources"}),I=ie("select",{class:"input tlx-sev","aria-label":"Severity"},ie("option",{value:""},"every severity"),...un.slice(1).map(F=>ie("option",{value:F},`${F} and above`))),se=ie("select",{class:"input tlx-views","aria-label":"Saved views",hidden:!e.views},ie("option",{value:""},"Saved views\u2026")),ge=ie("button",{type:"button",class:"btn sm quiet tlx-save",hidden:!e.saveView,title:"Save this view"},"Save view"),xe=ie("div",{class:"tlx-warn",role:"status",hidden:!0}),Ke=ie("div",{class:"tlx-status",role:"status"}),$e=ie("span",{class:"tlx-canvas-note"}),Ze=ie("div",{class:"tlx-labels"}),Q=ie("div",{class:"tlx-lanes",tabindex:"0",role:"application","aria-label":"Timeline lanes: drag to pan, wheel to zoom, drag the axis to choose a range, click it to move the playhead. Keys: \u2190 \u2192 pan, + \u2212 zoom, N next hit"}),te=gt("svg",{class:"tlx-svg"});Q.append(te);let we=ie("div",{class:"tlx-scroll"},ie("div",{class:"tlx-grid"},Ze,Q)),ze=ie("section",{class:"tlx-table",hidden:!0,"aria-label":"The events in the chosen range"}),De=ie("aside",{class:"tlx-detail",hidden:!0,"aria-label":"The event"});t.replaceChildren(ie("div",{class:"tlx-bar"},K,ie("span",{class:"spacer"}),U,ee,L,q,ie("label",{class:"tlx-gaps-label",title:"Draw long empty stretches as narrow breaks"},G,"Collapse gaps"),ie("label",{class:"tlx-gaps-label",title:"Hide the rows with nothing in this range"},ce,"Hide quiet rows")),ie("div",{class:"tlx-bar"},le,H,oe,Ae,I,se,ge),_e,xe,ie("div",{class:"tlx-body"},we,De),ie("div",{class:"tlx-foot"},Ke,ie("span",{class:"spacer"}),$e),ze);let qe=()=>Math.max(200,Q.clientWidth||800),M=()=>{let F=(Oe,We)=>(Oe.own?-1:0)-(We.own?-1:0)||Oe.scope.localeCompare(We.scope,void 0,{numeric:!0}),ue=(g?.rows??[]).filter(Oe=>!X||Oe.count>0||Oe.own||(g?.rows.length??0)<=1).sort(F).map(Oe=>({kind:"row",row:Oe})),be=new Set(g?.metrics.map(Oe=>Oe.series)??[]);for(let Oe of[...be].sort()){let We=Z.get(Oe);ue.push({kind:"metric",series:Oe,unit:We?.unit??"count",type:We?.type??"counter",title:We?.title??Oe})}return ue},D=(F,re)=>f?.names?.find(ue=>ue.scope===F)?.label??re,W=F=>F.kind==="metric"?wl:dr,he=()=>wp(y.t1-y.t0,qe()),fe=()=>f?.now??Date.now();function J(){return{timeline:1,type:"view",name:"",scope:p,depth:c,range:{from:Math.round(y.t0),to:Math.round(y.t1)},...l?{q:l}:{},...Object.keys(d).length?{filters:d}:{},...m?{live:m}:{},...h?{}:{collapseGaps:!1},...X?{}:{quietRows:!0}}}function ne(F){F.scope!==void 0&&(p=F.scope),F.depth!==void 0&&(c=F.depth),l=F.q??"",le.value=l,d=F.filters??{},I.value=d.severity?.length?d.severity[0]:"",h=F.collapseGaps??e.collapseGaps??!0,G.checked=h,X=!F.quietRows,ce.checked=X,N.clear(),C.clear();let re=F.range;re&&"last"in re?ys(re.last,!1):re&&(y={t0:re.from,t1:re.to}),kt(!!F.live,!1)}let ye=()=>{let F=J();if(e.onViewChange?.(F),!!e.urlState)try{history.replaceState(null,"",`#timeline=${encodeURIComponent(JSON.stringify(F))}`)}catch{}},ve=()=>{if(!e.urlState)return;let F=/#timeline=(.+)$/.exec(location.hash);if(F)try{return JSON.parse(decodeURIComponent(F[1]))}catch{return}};function T(F,re,ue,be={}){let Oe=n(l,fe(),F,re);P=Oe.warnings;let We=l?[]:d.source?[...Z].filter(([,dt])=>d.source.includes(dt.source)).map(([dt])=>dt):void 0;return{timeline:1,type:"query",scope:p,depth:c,from:Oe.from,to:Oe.to,tz:s,...ue.kind==="binned"?{bin:ue.bin}:{},...l?{q:l,where:Oe.where}:{},...Object.keys(d).length?{filters:d}:{},...We?{series:We}:{},...be}}let _=()=>JSON.stringify([p,c,l,d,he()]);async function B(F=!1){let re=he(),ue=_(),be=y.t1-y.t0;if(!F&&g&&ue===u.key&&y.t0>=u.from&&y.t1<=u.to){me();return}if(z){A=!0;return}z++;let Oe=y.t0-be/2,We=Math.min(y.t1+be/2,Math.max(y.t1,fe()+be*.1));try{let dt=await e.source.query(T(Oe,We,re,re.kind==="single"?{limit:1e4}:{}));re.kind==="single"&&dt.next&&(dt=await e.source.query(T(Oe,We,{kind:"binned",bin:"1m"}))),g=dt,k=ue,u={from:Oe,to:We,mode:re,key:ue}}catch(dt){Ke.textContent=`The history couldn't be read: ${String(dt?.message??dt)}`}finally{z--}me(),ye(),A&&(A=!1,B())}function pe(){let F=qe(),re=he();if(V=[],h&&g){let ue=new Map([...Z].map(([be,Oe])=>[be,Oe.type]));V=ul(xp(g,re,ue),y.t0,Math.min(y.t1,Math.max(y.t0,fe())),{minFrac:.15,minMs:10*oo}),re.kind==="binned"&&(V=V.filter(be=>be.to-be.from>=2*Cn[re.bin])),V=V.filter(be=>!(N.has(pr(be))&&(C.get(pr(be))??1)>=1))}Y=Qr(y.t0,y.t1,F,V,{cut:fy,weights:C})}let me=()=>{O||(O=requestAnimationFrame(Ce))};function Ce(){O=0,pe();let F=qe(),re=M(),ue=u.mode,be=[],Oe=us;for(let de of re)be.push(Oe),Oe+=W(de);let We=Math.max(Oe,us+dr);te.setAttribute("width",String(F)),te.setAttribute("height",String(We)),te.setAttribute("viewBox",`0 0 ${F} ${We}`);let dt=we.scrollTop-200,ns=we.scrollTop+(we.clientHeight||600)+200,Ge=[],Ve=Y.x;Ge.push(gt("rect",{class:"tlx-axis",x:0,y:0,width:F,height:us}));let Xt=(g?.retention??[]).map(de=>({r:de,from:ue.kind==="binned"?de.keptFrom.rollups[ue.bin]??de.keptFrom.events:de.keptFrom.events,days:ue.kind==="binned"?de.rollups[ue.bin]:de.events})).filter(de=>de.from!==void 0);if(Xt.length){let de=Math.min(...Xt.map(Ee=>Ee.from));de>y.t0&&Ge.push(gt("rect",{class:"tlx-notkept",x:Math.max(0,Ve(y.t0)),y:us,width:Math.max(0,Ve(de)-Math.max(0,Ve(y.t0))),height:We-us},`Nothing kept before ${sn(de,s)}: ${Xt.map(Ee=>`${Ee.r.source} ${Ee.days===null?"kept until deleted":`kept ${Ee.days} days`}`).join(", ")}`))}let gn=fe();gn<y.t1&&Ge.push(gt("rect",{class:"tlx-future",x:Ve(gn),y:us,width:F-Ve(gn),height:We-us}));for(let de of hl(Y,s,90)){Ge.push(gt("line",{class:`tlx-tick${de.major?" major":""}`,x1:de.x,x2:de.x,y1:us-6,y2:We}));let Ee=gt("text",{class:"tlx-ticklabel",x:de.x+3,y:16});Ee.textContent=de.label,Ge.push(Ee)}$&&Ge.push(gt("rect",{class:"tlx-brush",x:Ve($.from),y:0,width:Math.max(1,Ve($.to)-Ve($.from)),height:We}));let uo=ue.kind==="single"?(g?.events??[]).filter(de=>de.dur!==void 0||de.open):g?.spans??[],qm=ue.kind==="single"?(g?.events??[]).filter(de=>de.dur===void 0&&!de.open):[],zp=new Map;re.forEach((de,Ee)=>{de.kind==="row"&&zp.set(de.row.scope,Ee)});let ho=de=>{let Ee=Jt(p)+c,nt=Jt(de)>=Ee?Ms(de,Ee):de;return zp.get(nt)},oi=de=>be[de]+W(re[de])>=dt&&be[de]<=ns;if(re.forEach((de,Ee)=>{oi(Ee)&&Ge.push(gt("rect",{class:`tlx-lane${Ee%2?" odd":""}${de.kind==="metric"?" metric":""}`,x:0,y:be[Ee],width:F,height:W(de)}))}),ue.kind==="binned"){let de=new Map;for(let Ee of g?.bins??[]){let nt=ho(Ee.scope);nt!==void 0&&de.set(nt,Math.max(de.get(nt)??0,Ee.count))}for(let Ee of g?.bins??[]){let nt=ho(Ee.scope);if(nt===void 0||!oi(nt))continue;let ft=Ve(Ee.t),ot=Ve(Ee.t+Cn[Ee.bin]);if(ot<0||ft>F)continue;let St=[...un].reverse().find(Mn=>(Ee.severity[Mn]??0)>0)??"info",Ut=Math.max(2,(dr-8)*Math.sqrt(Ee.count)/Math.sqrt(de.get(nt)||1));Ge.push(gt("rect",{class:"tlx-countbar",x:ft,y:be[nt]+dr-3-Ut,width:Math.max(1,ot-ft-.5),height:Ut,"data-t":Ee.t},`${sn(Ee.t,s)}: ${Ee.count} event${Ee.count===1?"":"s"}${St!=="info"&&St!=="debug"?`, the worst ${St}`:""}`)),(St==="warning"||St==="error")&&Ge.push(gt("rect",{class:`tlx-heat sev-${St}`,x:ft,y:be[nt]+dr-(St==="error"?4:3),width:Math.max(1,ot-ft-.5),height:St==="error"?3:2}))}}for(let de of uo){let Ee=ho(de.scope);if(Ee===void 0||!oi(Ee))continue;let nt=de.open?gn:de.t+(de.dur??0),ft=Ve(de.t),ot=Ve(nt);if(ot<-2||ft>F+2)continue;let St=`tlx-span sev-${de.severity}${de.open?" open":""}${w?.id===de.id?" selected":""}`,Ut=`${de.summary} \xB7 ${sn(de.t,s)}${de.open?", still going":`, ${bp(nt-de.t)}`}`,Mn=be[Ee]+5,Es=ue.kind==="binned"?4:8,Pn=ft;for(let Dn of Y.cuts)Dn.weight>=1||Dn.x1<=ft||Dn.x0>=ot||(Dn.x0>Pn&&Ge.push(gt("rect",{class:St,x:Pn,y:Mn,width:Math.max(1,Dn.x0-Pn),height:Es,rx:2,"data-id":de.id},Ut)),Ge.push(gt("path",{class:`${St} through`,d:`M${Dn.x0} ${Mn+Es/2} H${Dn.x1}`,"data-id":de.id},`${Ut} (lasted through the break)`)),Pn=Dn.x1);ot>Pn&&Ge.push(gt("rect",{class:St,x:Math.max(-2,Pn),y:Mn,width:Math.max(2,Math.min(F+2,ot)-Math.max(-2,Pn)),height:Es,rx:2,"data-id":de.id},Ut))}let Cp=new Map;for(let de of qm){let Ee=ho(de.scope);if(Ee===void 0||!oi(Ee))continue;let nt=Ve(de.t);if(nt<-6||nt>F+6||nt-(Cp.get(Ee)??-1/0)<3)continue;Cp.set(Ee,nt);let ft=be[Ee]+dr/2+2,ot=4,St=my[de.severity],Ut=St==="diamond"?`M${nt} ${ft-ot-1} l${ot+1} ${ot+1} l${-ot-1} ${ot+1} l${-ot-1} ${-ot-1} z`:St==="triangle"?`M${nt} ${ft-ot-1} l${ot+1} ${2*ot+1} h${-2*ot-2} z`:St==="square"?`M${nt-ot+.5} ${ft-ot+.5} h${2*ot-1} v${2*ot-1} h${-2*ot+1} z`:"",Mn=`${sn(de.t,s)} \xB7 ${de.summary}`,Es=`tlx-mark sev-${de.severity}${w?.id===de.id?" selected":""}${v>=0&&E[v]?.id===de.id?" hit":""}`;Ge.push(Ut?gt("path",{class:Es,d:Ut,"data-id":de.id},Mn):gt("circle",{class:Es,cx:nt,cy:ft,r:St==="dot"?2.5:ot,"data-id":de.id},Mn))}re.forEach((de,Ee)=>{if(de.kind!=="metric"||!oi(Ee))return;let nt=new Map;for(let ut of g?.metrics??[]){if(ut.series!==de.series)continue;let Ht="value"in ut?{min:ut.value,max:ut.value,sum:ut.value,count:1}:{min:ut.min,max:ut.max,sum:ut.sum,count:ut.count},Bt=nt.get(ut.t);Bt?(Bt.min=Math.min(Bt.min,Ht.min),Bt.max=Math.max(Bt.max,Ht.max),Bt.sum+=Ht.sum,Bt.count+=Ht.count):nt.set(ut.t,{...Ht})}let ft=[...nt].sort((ut,Ht)=>ut[0]-Ht[0]);if(!ft.length)return;let ot=ue.kind==="binned"?Cn[ue.bin]:oo,St=ut=>de.type==="gauge"?ut.sum/Math.max(1,ut.count):ut.sum,Ut=Math.max(1e-9,...ft.map(([,ut])=>de.type==="gauge"?ut.max:St(ut))),Mn=be[Ee]+wl-4,Es=wl-10,Pn=ut=>Mn-ut/Ut*Es;if(de.type==="gauge"){let ut=ft.map(([Ht,Bt])=>`${Ve(Ht)},${Pn(Bt.max)}`).join(" ")+" "+[...ft].reverse().map(([Ht,Bt])=>`${Ve(Ht)},${Pn(Bt.min)}`).join(" ");Ge.push(gt("polygon",{class:"tlx-band",points:ut})),Ge.push(gt("polyline",{class:"tlx-line",points:ft.map(([Ht,Bt])=>`${Ve(Ht+ot/2)},${Pn(St(Bt))}`).join(" ")}))}else{let ut="",Ht=-1/0;for(let[Bt,Vm]of ft){let Km=Ve(Bt),jp=Ve(Bt+ot),Lp=Pn(St(Vm));ut+=Bt>Ht?`M${Km} ${Mn} V${Lp} H${jp}`:` V${Lp} H${jp}`,Ht=Bt+ot;let _p=ft.find(([Gm])=>Gm>Bt);(!_p||_p[0]>Ht)&&(ut+=` V${Mn} Z`)}Ge.push(gt("path",{class:"tlx-area",d:ut}))}let Dn=gt("text",{class:"tlx-peak",x:4,y:be[Ee]+11});Dn.textContent=`peak ${uy(Ut,de.unit)}${de.type==="counter"?` per ${ue.kind==="binned"?ue.bin:"1m"}`:""}`,Ge.push(Dn)});for(let de of Y.cuts){if(de.weight>=1)continue;let Ee=ot=>{let St=`M${ot} 0`;for(let Ut=0;Ut<We;Ut+=8)St+=` L${ot+(Ut/8%2?-3:3)} ${Ut+8}`;return St},nt=gt("g",{class:"tlx-cut",tabindex:0,role:"button","data-from":de.from,"data-to":de.to,"aria-label":`A break of ${cr(de.to-de.from)} with nothing shown, from ${sn(de.from,s)} to ${sn(de.to,s)}: press to open it`},`${cr(de.to-de.from)} with nothing here: ${sn(de.from,s)} to ${sn(de.to,s)} (click to open)`);nt.append(gt("rect",{class:"tlx-cut-bg",x:de.x0,y:0,width:de.x1-de.x0,height:We})),nt.append(gt("path",{class:"tlx-cut-edge",d:Ee(de.x0+3)}),gt("path",{class:"tlx-cut-edge",d:Ee(de.x1-3)}));let ft=gt("text",{class:"tlx-cut-label",x:(de.x0+de.x1)/2,y:15,"text-anchor":"middle"});ft.textContent=cr(de.to-de.from),nt.append(ft),Ge.push(nt)}if(b!==void 0){let de=Ve(b);Ge.push(gt("line",{class:"tlx-playhead",x1:de,x2:de,y1:0,y2:We})),Ge.push(gt("path",{class:"tlx-handle",d:`M${de-6} 0 h12 v8 l-6 7 l-6 -7 z`},`the playhead: ${sn(b,s)}`))}te.replaceChildren(...Ge),Ze.replaceChildren(ie("div",{class:"tlx-labelhead",style:`height:${us}px`},he().kind==="single"?"single events":`per ${he().kind==="binned"?he().bin:""}`),...re.map(de=>{if(de.kind==="metric")return ie("div",{class:"tlx-rowlabel metric",style:`height:${wl}px`,title:`${de.title} (${de.type==="counter"?"sums":"min, max and mean"})`},de.title);let Ee=de.row,nt=ie("div",{class:`tlx-rowlabel${Ee.own?" own":""}`,style:`height:${dr}px`,"data-scope":Ee.scope,title:`${Ee.scope||"all hosts"} \xB7 ${Ee.count} event${Ee.count===1?"":"s"}`},ie("span",{class:"tlx-kind"},e.catalog.flags.find(ft=>Ee[ft])??Ee.kind),ie("span",{class:"tlx-name"},Ee.own?`${Ee.label} (itself)`:Ee.label),ie("span",{class:"tlx-count"},String(Ee.count)));if(!Ee.own&&Ee.scope!==p){let ft=ie("button",{type:"button",class:"tlx-drill",title:Ee.children?`Into ${Ee.label}: its ${Ee.children} part${Ee.children===1?"":"s"}`:`Into ${Ee.label}`,"aria-label":`Into ${Ee.label}`},"\u203A");ft.addEventListener("click",()=>lt(Ee.scope)),nt.append(ft)}return nt})),Ze.style.width=`${dy}px`,ae()}function ae(){K.replaceChildren(...Jr(p).flatMap((be,Oe,We)=>{let dt=ie("button",{type:"button",class:`tlx-crumb${Oe===We.length-1?" current":""}`,"aria-current":Oe===We.length-1?"location":void 0},D(be.scope,be.label));return dt.addEventListener("click",()=>{be.scope!==p&&(p=be.scope,c=1,B(!0))}),Oe?[ie("span",{class:"tlx-sep","aria-hidden":"true"},"/"),dt]:[dt]})),ee.setAttribute("aria-pressed",String(m)),ee.classList.toggle("on",m),L.hidden=!m||S;let F=he(),re=g?.total??0,ue=(g?.retention??[]).filter(be=>be.events!==null).map(be=>`${be.source} kept ${be.events} d`);Ke.textContent=`${sn(y.t0,s)} \u2013 ${sn(y.t1,s)} \xB7 ${F.kind==="single"?"single events":`bins of ${F.bin}`} \xB7 ${re} event${re===1?"":"s"}${V.length?` \xB7 ${V.length} break${V.length===1?"":"s"}`:""}${ue.length?` \xB7 ${ue.slice(0,3).join(", ")}`:""}`,xe.hidden=!P.length,xe.textContent=P.join(" \xB7 "),H.textContent=l?E.length?`${v+1>0?`${v+1} of `:""}${E.length}${E.length>=2e3?"+":""} hit${E.length===1?"":"s"}`:`${re?`${re} hit${re===1?"":"s"}`:"no hits"}`:"";for(let be of U.querySelectorAll(".seg"))be.classList.remove("on");$e.textContent=b===void 0?"":x?(()=>{let be=e.stamp?.(x)??{};return`Canvas: the state recorded at ${sn(Date.parse(be.at??"")||b,s)}${be.tag?` (${be.tag})`:""}`})():"No state recorded here",$e.classList.toggle("none",b!==void 0&&!x)}function Le(){_e.replaceChildren();for(let F of f?.sources??[]){let re=!d.source?.length||d.source.includes(F.name),ue=ie("button",{type:"button",class:`tlx-chip${re?" on":""}${F.status==="not-yet"?" notyet":""}`,"aria-pressed":String(re&&F.status!=="not-yet"),disabled:F.status==="not-yet",title:F.status==="not-yet"?`${F.title}: not kept yet`:`${F.title}${Te(F)}`},F.name);F.status!=="not-yet"&&ue.addEventListener("click",()=>Se(F.name)),_e.append(ue)}}let Te=F=>{let re=f?.retention.find(ue=>ue.source===F.name);return re?` (kept ${re.events===null?"until deleted":`${re.events} days`})`:""};function Se(F){let re=(f?.sources??[]).filter(be=>be.status==="kept").map(be=>be.name),ue=d.source?.length?[...d.source]:[...re];ue=ue.includes(F)?ue.filter(be=>be!==F):[...ue,F],d={...d,...ue.length===re.length?{source:void 0}:{source:ue}},d.source||delete d.source,Le(),B(!0),Ye()}let Fe=0;le.addEventListener("input",()=>{clearTimeout(Fe),Fe=setTimeout(()=>{l=le.value.trim(),v=-1,B(!0),Ye()},250)}),le.addEventListener("keydown",F=>{F.key==="Enter"&&(F.preventDefault(),clearTimeout(Fe),l=le.value.trim(),B(!0).then(()=>Ye()).then(()=>mt(F.shiftKey?-1:1)))});async function Ye(){if(!l){E=[],v=-1,ae();return}let F=y.t1-y.t0;E=(await e.source.query(T(y.t0-F*4,Math.max(y.t1+F*4,fe()),{kind:"single"},{limit:2e3}))).events??[],v=Math.min(v,E.length-1),ae()}function mt(F){if(!E.length)return;let re=(y.t0+y.t1)/2;v<0?v=F>0?Math.max(0,E.findIndex(Oe=>Oe.t>=re)):Math.max(0,E.length-1-[...E].reverse().findIndex(Oe=>Oe.t<=re)):v=(v+F+E.length)%E.length;let ue=E[v],be=Math.min(y.t1-y.t0,2*fr);y={t0:ue.t-be/2,t1:ue.t+be/2},S=!1,$t(ue),B()}oe.addEventListener("click",()=>mt(-1)),Ae.addEventListener("click",()=>mt(1)),I.addEventListener("change",()=>{let F=I.value;d={...d,...F?{severity:un.filter(re=>um(re)>=um(F))}:{}},F||delete d.severity,B(!0),Ye()});async function ys(F,re=!0){let ue=fe();if(F==="run"){let be=await e.source.query({timeline:1,type:"query",scope:p,depth:0,from:ue-30*vn,to:ue+1,filters:{kind:["run"]},limit:1e4}).catch(()=>{}),Oe=be?.events?.[be.events.length-1];y=Oe?{t0:Oe.t-(Oe.dur??fr)*.02,t1:(Oe.open?ue:Oe.t+(Oe.dur??fr))+(Oe.dur??fr)*.04}:{t0:ue-vn,t1:ue+vn*.02}}else y={t0:ue-mm[F],t1:ue+mm[F]*.02};S=!0,N.clear(),C.clear(),re&&B()}function kt(F,re=!0){if(m=F,R?.(),R=void 0,F&&e.source.subscribe){let ue=0,be=0;R=e.source.subscribe(T(fe()-fr,fe()+365*vn,{kind:"single"}),Oe=>{if(f&&(f.now=Math.max(f.now,Oe.now)),S){let dt=y.t1-y.t0;y={t0:Oe.now-dt*.98,t1:Oe.now+dt*.02}}let We=Date.now();We-ue>500?(ue=We,B(!0)):be||(be=setTimeout(()=>{be=0,ue=Date.now(),B(!0)},500))}),S=!0}re&&(ae(),ye())}ee.addEventListener("click",()=>kt(!m)),L.addEventListener("click",()=>{S=!0;let F=y.t1-y.t0,re=fe();y={t0:re-F*.98,t1:re+F*.02},B()}),q.addEventListener("click",()=>{ht()}),G.addEventListener("change",()=>{h=G.checked,N.clear(),C.clear(),me(),ye()}),ce.addEventListener("change",()=>{X=ce.checked,me(),ye()});function lt(F){let re=g?.rows.find(ue=>ue.scope===F);p=F,c=re&&re.children===0?0:1,$=void 0,ze.hidden=!0,B(!0)}async function ht(){let F=fe(),ue=((await e.source.query({timeline:1,type:"query",scope:p,depth:0,from:F-400*vn,to:F+1,bin:"1d",tz:s}).catch(()=>{}))?.bins??[]).map(Oe=>Oe.t),be=ue.length?Math.min(...ue):F-7*vn;y={t0:be,t1:F+(F-be)*.02},S=!0,B()}let _n=0;async function Kt(F){if(b=F,me(),F===void 0){x=void 0;return}let re=++_n,ue=e.source.stateAt?await e.source.stateAt(p,F).catch(()=>{}):void 0;re===_n&&(x=ue,e.onPlayhead?.(F,ue),ae())}async function _t(F,re){$={from:Math.min(F,re),to:Math.max(F,re)},me();let ue=await e.source.query(T($.from,$.to,{kind:"single"},{limit:500})),be=o(l),Oe=Ge=>{let Ve=[],zt=0;for(let[Xt,gn]of io(be,Ge))Ve.push(Ge.slice(zt,Xt),ie("mark",null,Ge.slice(Xt,gn))),zt=gn;return Ve.push(Ge.slice(zt)),Ve},We=(ue.events??[]).map(Ge=>{let Ve=ie("tr",{"data-id":Ge.id,tabindex:"0"},ie("td",null,sn(Ge.t,s)),ie("td",null,Ge.dur!==void 0?bp(Ge.dur):Ge.open?"still going":""),ie("td",null,Ge.source),ie("td",null,Ge.kind),ie("td",{class:`sev-${Ge.severity}`},Ge.severity),ie("td",{class:"tlx-sum"},...Oe(Ge.summary)),ie("td",{class:"tlx-scope"},Ge.scope));return Ve.addEventListener("click",()=>$t(Ge)),Ve.addEventListener("keydown",zt=>{zt.key==="Enter"&&$t(Ge)}),Ve}),dt=ie("button",{type:"button",class:"btn sm quiet","aria-label":"Close the table"},"Close");dt.addEventListener("click",()=>{$=void 0,ze.hidden=!0,me()});let ns=Ge=>{let Ve=ie("button",{type:"button",class:"btn sm","data-export":Ge},Ge.toUpperCase());return Ve.addEventListener("click",()=>{Gt(Ge)}),Ve};ze.replaceChildren(ie("div",{class:"tlx-table-head"},ie("strong",null,`${ue.total} event${ue.total===1?"":"s"}`),ie("span",null,` ${sn($.from,s)} \u2013 ${sn($.to,s)}${ue.total>500?" (the first 500 shown; the export has them all)":""}`),ie("span",{class:"spacer"}),ie("span",null,"Export: "),ns("json"),ns("csv"),dt),ie("div",{class:"tlx-table-wrap"},ie("table",null,ie("thead",null,ie("tr",null,...["When","Long","Source","Kind","Severity","What","Scope"].map(Ge=>ie("th",{scope:"col"},Ge)))),ie("tbody",null,...We)))),ze.hidden=!1}async function Dt(){if(!$)return[];let F=[],re;do{let ue=await e.source.query(T($.from,$.to,{kind:"single"},{limit:1e4,...re?{cursor:re}:{}}));F.push(...ue.events??[]),re=ue.next}while(re&&F.length<2e5);return F}async function Gt(F){let re=await Dt(),ue=F==="json"?yl(re,j):gl(re,j),be=`timeline-${new Date($.from).toISOString().slice(0,16).replace(/:/g,"")}.${F}`,Oe=F==="json"?"application/json":"text/csv";if(e.onExport){e.onExport(be,ue,Oe);return}let We=ie("a",{href:`data:${Oe};charset=utf-8,${encodeURIComponent(ue)}`,download:be});document.body.append(We),We.click(),We.remove()}function $t(F){if(w=F,me(),!F){De.hidden=!0;return}let re=f?.sources.find(Ve=>Ve.name===F.source),ue=new Set(re?.sensitive??[]),be=o(l),Oe=Ve=>{let zt=[],Xt=0;for(let[gn,uo]of io(be,Ve))zt.push(Ve.slice(Xt,gn),ie("mark",null,Ve.slice(gn,uo))),Xt=uo;return zt.push(Ve.slice(Xt)),zt},We=(Ve,zt)=>{if(!zt)return null;let Xt=ie("button",{type:"button",class:"btn sm"},Ve);return Xt.addEventListener("click",zt),Xt},dt=Object.entries(F.attrs).map(([Ve,zt])=>{if(!ue.has(Ve))return ie("tr",null,ie("th",{scope:"row"},Ve),ie("td",null,...Oe(String(zt))));let Xt=ie("button",{type:"button",class:"btn sm quiet",title:"This can name a remote host, a folder or free text"},"Show"),gn=ie("td",{class:"tlx-sensitive"},"hidden ",Xt);return Xt.addEventListener("click",()=>gn.replaceChildren(String(zt))),ie("tr",null,ie("th",{scope:"row"},Ve),gn)}),ns=ie("button",{type:"button",class:"btn sm quiet tlx-close","aria-label":"Close"},"\xD7");ns.addEventListener("click",()=>$t(void 0));let Ge=Jr(F.scope).slice(1).map(Ve=>{let zt=ie("button",{type:"button",class:"tlx-crumb"},D(Ve.scope,Ve.label));return zt.addEventListener("click",()=>lt(Ve.scope)),zt});De.replaceChildren(ie("div",{class:"tlx-detail-head"},ie("strong",null,F.kind),ns),ie("p",{class:`tlx-sev sev-${F.severity}`},`${F.severity} \xB7 ${re?.title??F.source}`),ie("p",{class:"tlx-sum"},...Oe(F.summary)),ie("p",null,sn(F.t,s),F.dur!==void 0?` \xB7 ${bp(F.dur)}${F.open?" so far":""}`:F.open?" \xB7 still going":""),ie("p",{class:"tlx-crumbs small"},...Ge),...dt.length?[ie("table",{class:"tlx-attrs"},ie("tbody",null,...dt))]:[],ie("div",{class:"tlx-links"},...(e.actions?.(F)??[]).map(([Ve,zt])=>We(Ve,zt)))),De.hidden=!1}function ur(F,re){let ue=pr({from:F,to:re});if(!V.find(dt=>dt.from===F&&dt.to===re))return;if(N.add(ue),!i){C.set(ue,1),me();return}let Oe=performance.now(),We=dt=>{let ns=Math.min(1,(dt-Oe)/260);C.set(ue,1-(1-ns)**3),Ce(),ns<1&&requestAnimationFrame(We)};requestAnimationFrame(We)}let Zt,Zs=F=>F.clientX-te.getBoundingClientRect().left;te.addEventListener("pointerdown",F=>{let re=Zs(F),ue=F.clientY-te.getBoundingClientRect().top,be=F.target.closest?.(".tlx-cut");if(be){F.preventDefault(),ur(Number(be.getAttribute("data-from")),Number(be.getAttribute("data-to")));return}te.setPointerCapture(F.pointerId),Zt={kind:ue<us||F.shiftKey?"brush":F.target.classList.contains("tlx-handle")?"scrub":"pan",x0:re,t0:Y.t(re),v0:y,moved:!1},F.preventDefault(),Q.focus({preventScroll:!0})}),te.addEventListener("pointermove",F=>{if(!Zt)return;let re=Zs(F);if(Math.abs(re-Zt.x0)>3&&(Zt.moved=!0),!!Zt.moved)if(Zt.kind==="pan"){let ue=(Zt.x0-re)*Y.msPerPx;y={t0:Zt.v0.t0+ue,t1:Zt.v0.t1+ue},S=!1,B()}else Zt.kind==="scrub"?Kt(Y.t(re)):($={from:Math.min(Zt.t0,Y.t(re)),to:Math.max(Zt.t0,Y.t(re))},me())}),te.addEventListener("pointerup",F=>{let re=Zt;if(Zt=void 0,!re)return;let ue=Zs(F);if(re.kind==="brush"&&re.moved){_t(re.t0,Y.t(ue));return}if(re.kind==="brush"&&!re.moved){Kt(Y.t(ue));return}if(re.kind==="pan"&&!re.moved){let be=F.target.closest?.("[data-id]")?.getAttribute("data-id"),Oe=be?[...g?.events??[],...g?.spans??[]].find(We=>We.id===be):void 0;Oe?($t(Oe),Kt(Oe.t)):Kt(Y.t(ue))}}),te.addEventListener("keydown",F=>{let re=F.target.closest?.(".tlx-cut");re&&(F.key==="Enter"||F.key===" ")&&(F.preventDefault(),ur(Number(re.getAttribute("data-from")),Number(re.getAttribute("data-to"))))}),te.addEventListener("wheel",F=>{F.preventDefault();let re=Zs(F);if(F.shiftKey||Math.abs(F.deltaX)>Math.abs(F.deltaY)){let ue=(F.shiftKey?F.deltaY:F.deltaX)*Y.msPerPx;y={t0:y.t0+ue,t1:y.t1+ue},S=!1}else hr(Y.t(re),Math.exp(F.deltaY*.0015),re/qe());B()},{passive:!1});function hr(F,re,ue=.5){let be=Math.min(400*vn,Math.max(1e4,(y.t1-y.t0)*re));y={t0:F-ue*be,t1:F+(1-ue)*be},N.clear(),C.clear(),re<1&&(S=m&&y.t1>=fe())}Q.addEventListener("keydown",F=>{let re=y.t1-y.t0;if(F.key==="ArrowLeft"||F.key==="ArrowRight"){let ue=re*.15*(F.key==="ArrowLeft"?-1:1);y={t0:y.t0+ue,t1:y.t1+ue},S=!1}else if(F.key==="+"||F.key==="=")hr((y.t0+y.t1)/2,.6);else if(F.key==="-"||F.key==="_")hr((y.t0+y.t1)/2,1/.6);else if(F.key==="n"||F.key==="N"){mt(F.shiftKey?-1:1),F.preventDefault();return}else if(F.key==="Escape")$t(void 0),$=void 0,ze.hidden=!0;else return;F.preventDefault(),B()}),t.addEventListener("keydown",F=>{F.key==="/"&&document.activeElement!==le&&!F.target.closest("input, select, textarea")&&(F.preventDefault(),le.focus())}),we.addEventListener("scroll",()=>me(),{passive:!0}),ge.addEventListener("click",async()=>{let F=`${Jr(p).slice(-1)[0].label}${l?`: ${l}`:""}`.slice(0,80);await e.saveView?.({...J(),name:F}),await Fn()});let Xe=[];async function Fn(){e.views&&(Xe=await e.views(),se.replaceChildren(ie("option",{value:""},"Saved views\u2026"),...Xe.map((F,re)=>ie("option",{value:String(re)},F.name))))}se.addEventListener("change",()=>{let F=Xe[Number(se.value)];F&&(ne(F),Le(),B(!0)),se.value=""});let yt=typeof ResizeObserver=="function"?new ResizeObserver(()=>me()):void 0;yt?.observe(Q);let cn=(async()=>{f=await e.source.catalog(),j=f.sources.flatMap(be=>(be.sensitive??[]).map(Oe=>`${be.name}.${Oe}`));for(let be of f.sources)for(let Oe of be.series)Z.set(Oe.name,{unit:Oe.unit,type:Oe.type,title:Oe.title,source:be.name});p=f.hosts.length===1?`host:${f.hosts[0].replace(/[%/:\s]/g,be=>`%${be.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`)}`:"";let re=f.now;y={t0:re-vn,t1:re+vn*.02};let ue=ve()??e.view;ue&&ne(ue),Le(),await Fn(),await B(!0),l&&await Ye()})();return{el:t,ready:cn,get view(){return J()},setView(F){return ne(F),Le(),B(!0)},setRange(F,re){return y={t0:F,t1:re},S=!1,B()},setPlayhead:Kt,setLive:kt,setTheme:a,refresh:()=>B(!0),internal:{get result(){return g},get mode(){return he()},get scale(){return Y},get gaps(){return V},get playState(){return x},get hits(){return E},get selected(){return w},get follow(){return S},openCut:ur,showTable:_t,rangeEvents:Dt,exportRange:Gt,select:$t,stepHit:mt,drill:lt,findHits:Ye,paint:Ce,lines:M},dispose(){R?.(),yt?.disconnect(),O&&cancelAnimationFrame(O),t.replaceChildren()}}}var hy={arrow:{d:"M0,0 L10,5 L0,10 z",refX:9},open:{d:"M0,0 L10,5 L0,10 L3,5 z",refX:9},diamond:{d:"M0,5 L5,1.5 L10,5 L5,8.5 z",refX:1}},rn=t=>(Math.round(t*10)/10).toString(),ym=t=>(t??"link").replace(/[^\w-]/g,"_");function xl(t,e){let{id:s}=e,r=e.styles??{},i=t.options,o=t.bounds,n=new Map,a=(m,h)=>{let y=r[m]??{},g=h==="start"?y.start??"none":y.end??"arrow";if(g!=="none")return(n.get(m)??n.set(m,new Set).get(m)).add(g),`url(#${s}-mk-${m}-${g})`},f="",p="",c="",l="";for(let m of[...t.panels].sort((h,y)=>h.depth-y.depth)){let h=m.rect,y=m.label?Me("text",{class:"pl",x:m.titleAt[0],y:m.titleAt[1]},vt(m.label)+(m.sub?Me("tspan",{class:"pls",dx:10},vt(m.sub)):"")):"";f+=Me("g",{class:`panel k-${m.role??"grey"}`,"data-id":m.id},Me("rect",{class:"face",x:rn(h.l),y:rn(h.t),width:rn(h.r-h.l),height:rn(h.b-h.t),rx:i.panelRx})+y)}for(let m of t.links){if(!m.points.length)continue;let h=ym(m.kind);p+=Me("path",{class:`conn k-${h}`,d:"M"+m.points.map(y=>`${rn(y[0])},${rn(y[1])}`).join(" L"),"data-id":m.id,"data-a":m.a,"data-b":m.b,"marker-start":a(h,"start"),"marker-end":a(h,"end")}),m.at&&(l+=Me("text",{class:`cl k-${h}`,x:m.at.x,y:m.at.y,"text-anchor":m.at.anchor==="start"?void 0:m.at.anchor,"data-for":m.id},vt(m.at.text)))}for(let m of t.cards){let h=m.rect;c+=Me("g",{class:`card k-${m.role??"grey"}${m.ghost?" ghost":""}`,"data-id":m.id,tabindex:0,role:"button","aria-label":m.sub?`${m.label}: ${m.sub}`:m.label},Me("rect",{class:"face",x:rn(h.l),y:rn(h.t),width:i.W,height:i.H,rx:i.cardRx})+Me("text",{class:"lt",x:rn(h.l+14),y:rn(h.t+24)},vt(m.label))+(m.sub?Me("text",{class:"st",x:rn(h.l+14),y:rn(h.t+42)},vt(m.sub)):""))}let d="";for(let[m,h]of n)for(let y of h){let g=hy[y];d+=Me("marker",{id:`${s}-mk-${m}-${y}`,viewBox:"0 0 10 10",refX:g.refX,refY:5,markerWidth:5.4,markerHeight:5.4,orient:"auto-start-reverse"},Me("path",{d:g.d,class:`mk k-${m}`}))}return Me("svg",{xmlns:"http://www.w3.org/2000/svg",class:"flat",viewBox:`${rn(o.l)} ${rn(o.t)} ${rn(o.r-o.l)} ${rn(o.b-o.t)}`,role:"img","aria-label":e.title??"drawing, flat view","data-view":"2d"},(d?Me("defs",{},d):"")+Me("g",{class:"panels"},f)+Me("g",{class:"conns"},p)+Me("g",{class:"cards"},c)+Me("g",{class:"labels"},l))}function gm(t={}){let e=r=>r?r.startsWith("#")||r.includes("(")?r:`var(--${r})`:"var(--ink)",s=`
406
409
  .flat{font-family:inherit}
407
410
  .flat .card{cursor:pointer;outline:none}
408
411
  .flat .card .face{fill:hsl(var(--h) var(--s) var(--l-top));stroke:hsl(var(--h) var(--s) var(--l-edge) / .55);stroke-width:1}
@@ -420,8 +423,8 @@ ${e.extraBody??""}
420
423
  .flat .panel.sel .face{stroke:var(--accent,#2f6fd6);stroke-width:2}
421
424
  .flat .conn.hot{stroke-width:3}
422
425
  .flat .conn.dim,.flat .cl.dim{opacity:.3}
423
- `;for(let[r,i]of Object.entries(t)){let o=um(r),n=e(i.color);s+=`.flat .conn.k-${o}{stroke:${n}${i.dash?`;stroke-dasharray:${i.dash}`:""}${i.width?`;stroke-width:${i.width}`:""}} .flat .mk.k-${o}{fill:${n}} .flat .cl.k-${o}{fill:${n}}
424
- `}return s}var fy={name:["card","lt"],sub:["card","st"],title:["panel","pl"],titleSub:["panel","pls"],label:["","cl"]};function bl(t){let e="http://www.w3.org/2000/svg",s=document.createElementNS(e,"svg");s.setAttribute("class","flat"),s.setAttribute("aria-hidden","true"),s.style.cssText="position:absolute;left:-10000px;top:0;width:10px;height:10px;visibility:hidden",t.appendChild(s);let r={};for(let[n,[a,f]]of Object.entries(fy)){let p=document.createElementNS(e,"g");a&&p.setAttribute("class",a);let c=document.createElementNS(e,"text");c.setAttribute("class",f),p.appendChild(c),s.appendChild(p),r[n]=c}let i=new Map,o=((n,a)=>{let f=a+"\0"+n,p=i.get(f);return p===void 0&&(r[a].textContent=n,p=r[a].getComputedTextLength(),i.set(f,p)),p});return o.dispose=()=>s.remove(),o}var ym=(t,e)=>t.cards.find(s=>s.id===e)?.rect??t.panels.find(s=>s.id===e)?.rect;var Gs="http://www.w3.org/2000/svg";function xl(t,e,s){let r=new Map((s?.links??[]).map((i,o)=>[i.id??`link-${o}`,i]));for(let i of e.routes){let o=r.get(i.id),n=o?.a??wn(i.raw.from).id,a=o?.b??wn(i.raw.to).id;for(let f of t.querySelectorAll(`[data-id="${CSS.escape(i.id)}"]`))f.setAttribute("data-a",n),f.setAttribute("data-b",a)}}var my=(t="auto")=>t==="always"||t==="auto"&&!(typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches);function wm(t,e,s,r,i={}){let o=i.duration??600;if(!o||!my(i.motion))return;let n=ao(t,e,s,r);t.appendChild(n.svg),n.at(0);let a=0,f=!1,p,c=new Promise(h=>p=h),l=()=>{f||(f=!0,cancelAnimationFrame(a),n.svg.remove(),p())},d=performance.now(),m=h=>{if(f)return;let y=Math.min(1,(h-d)/o);n.at(y),y<1?a=requestAnimationFrame(m):l()};return a=requestAnimationFrame(m),{done:c,finish:l}}var Ps=t=>Math.max(0,Math.min(1,t)),oo=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2;function wl(t){let e=t.cloneNode(!0),s=[t,...t.querySelectorAll("*")],r=[e,...e.querySelectorAll("*")];return s.forEach((i,o)=>{let n=getComputedStyle(i),a=r[o];a.removeAttribute("class"),a.removeAttribute("tabindex");for(let f of["fill","fill-opacity","stroke","stroke-width","stroke-dasharray","stroke-opacity","opacity","font-size","font-weight","font-family","letter-spacing","paint-order","stroke-linejoin","text-anchor"])a.style.setProperty(f,n.getPropertyValue(f))}),e}var bp=(t,e)=>{let s=t.getBoundingClientRect();return{x:s.left-e.left,y:s.top-e.top,w:s.width,h:s.height}},gm=t=>{let e=Math.min(...t.map(o=>o.x)),s=Math.min(...t.map(o=>o.y)),r=Math.max(...t.map(o=>o.x+o.w)),i=Math.max(...t.map(o=>o.y+o.h));return{x:e,y:s,w:r-e,h:i-s}},uy=(t,e)=>{let s=t.getScreenCTM();return`matrix(${s.a} ${s.b} ${s.c} ${s.d} ${s.e-e.left} ${s.f-e.top})`},bm=(t,e,s)=>{let r=1+(e.w/Math.max(t.w,1e-6)-1)*s,i=1+(e.h/Math.max(t.h,1e-6)-1)*s,o=(e.x-t.x*(e.w/Math.max(t.w,1e-6)))*s,n=(e.y-t.y*(e.h/Math.max(t.h,1e-6)))*s;return`matrix(${r} 0 0 ${i} ${o} ${n})`};function hy(t,e){let s=t.querySelector("polygon.top");if(!s)return;let r=s.getScreenCTM(),i=[];for(let o=0;o<s.points.numberOfItems;o++){let n=s.points.getItem(o);i.push([r.a*n.x+r.c*n.y+r.e-e.left,r.b*n.x+r.d*n.y+r.f-e.top])}return i.length===4?{pts:i,fill:getComputedStyle(s).fill}:void 0}function ao(t,e,s,r){let i=t.getBoundingClientRect(),o=document.createElementNS(Gs,"svg");o.setAttribute("class","dual-morph"),o.setAttribute("aria-hidden","true"),o.style.cssText=`position:absolute;left:0;top:0;width:${i.width}px;height:${Math.max(i.height,e.getBoundingClientRect().height,s.getBoundingClientRect().height)}px;overflow:visible;pointer-events:none`;let n=w=>{let $=document.createElementNS(Gs,"g");return $.setAttribute("transform",uy(w,i)),$},a=w=>w.hasAttribute("data-a")||w.hasAttribute("data-for"),f=w=>{let $=new Map;for(let v of w.querySelectorAll("[data-id]")){if(a(v)||v.parentElement?.closest("[data-id]")||v.closest(".overlay"))continue;let O=v.getAttribute("data-id");($.get(O)??$.set(O,[]).get(O)).push(v)}return $},p=f(e),c=f(s),l=document.createElementNS(Gs,"g"),d=document.createElementNS(Gs,"g"),m=n(e),h=n(s);for(let w of e.querySelectorAll("[data-a],[data-for]"))w.closest(".overlay")||m.appendChild(wl(w));for(let w of s.querySelectorAll("[data-a],[data-for]"))w.closest(".overlay")||h.appendChild(wl(w));l.appendChild(m),d.appendChild(h);let y=[...h.querySelectorAll("path")].map(w=>{let $=w.getTotalLength?.()??0;return{p:w,len:$}}),g=[...h.children].filter(w=>w.tagName.toLowerCase()==="text"),k=[...(r==="2d"?p:c).keys()],u=[],b=document.createElementNS(Gs,"g");for(let w of new Set([...k,...p.keys(),...c.keys()])){let $=p.get(w),v=c.get(w),O={};if($){O.a=gm($.map(N=>bp(N,i)));let T=document.createElementNS(Gs,"g"),S=n(e);for(let N of $)S.appendChild(wl(N));T.appendChild(S),O.src=T}if(v){O.b=gm(v.map(N=>bp(N,i)));let T=document.createElementNS(Gs,"g"),S=n(s);for(let N of v)S.appendChild(wl(N));T.appendChild(S),O.dst=T}let C=r==="3d"?$?.[0]:v?.[0],A=r==="3d"?v?.[0]:$?.[0],R=C?hy(C,i):void 0,M=A?.querySelector("rect.face");if(R&&M){let T=bp(M,i),S=[[T.x,T.y],[T.x+T.w,T.y],[T.x+T.w,T.y+T.h],[T.x,T.y+T.h]],N=R.pts.reduce((L,U,H)=>U[0]<R.pts[L][0]?H:L,0),z=[...R.pts.slice(N),...R.pts.slice(0,N)],K=[z[0],z[1],z[2],z[3]],J=getComputedStyle(M).fill,Z=document.createElementNS(Gs,"polygon");O.face=Z,O.faceFrom=r==="3d"?K:S,O.faceTo=r==="3d"?S:K,O.faceFill=r==="3d"?[R.fill,J]:[J,R.fill]}O.src&&b.appendChild(O.src),O.face&&b.appendChild(O.face),O.dst&&b.appendChild(O.dst),u.push(O)}o.append(l,b,d);let x=(w,$,v)=>`color-mix(in srgb, ${w} ${Math.round((1-v)*100)}%, ${$})`;return{svg:o,at(w){let $=Ps(w/.2),v=oo(Ps((w-.2)/.6)),O=Ps((w-.8)/.2);l.setAttribute("opacity",String(1-$));for(let{p:C,len:A}of y)C.style.strokeDasharray=`${A} ${A}`,C.style.strokeDashoffset=String(A*(1-O));d.setAttribute("opacity",String(O>0?1:0));for(let C of g)C.style.opacity=String(O);for(let C of u)if(C.src&&(C.src.setAttribute("transform",C.a&&C.b?bm(C.a,C.b,v):""),C.src.setAttribute("opacity",String(C.b?1-Ps(v/(C.face?.35:.6)):1-v))),C.dst&&(C.dst.setAttribute("transform",C.a&&C.b?bm(C.b,C.a,1-v):""),C.dst.setAttribute("opacity",String(C.a?Ps((v-(C.face?.65:.4))/(C.face?.35:.6)):v))),C.face){let A=C.faceFrom.map((R,M)=>[R[0]+(C.faceTo[M][0]-R[0])*v,R[1]+(C.faceTo[M][1]-R[1])*v]);C.face.setAttribute("points",A.map(R=>R.join(",")).join(" ")),C.face.style.fill=x(C.faceFill[0],C.faceFill[1],v),C.face.setAttribute("opacity",String(v<.08?v/.08:v>.92?(1-v)/.08:1))}}}}var yy=0;function xm(t,e,s={}){let r=`dv${++yy}`,i=document.createElement("div");i.className="dual-view",i.style.position="relative",t.appendChild(i);let o=document.createElement("div"),n=document.createElement("div");o.className="dual-3d",n.className="dual-2d",i.append(o,n),o.innerHTML=e.rendered.svg;let a=o.querySelector("svg");a.setAttribute("data-view","3d");let f=s.board??Wa(e);xl(a,e,f);let p=new Set(e.routes.map(A=>A.id));for(let A of a.querySelectorAll("g[data-id]")){let R=A.getAttribute("data-id");p.has(R)||A.hasAttribute("tabindex")||!A.querySelector("polygon")||(A.setAttribute("tabindex","0"),A.setAttribute("role","button"),A.setAttribute("aria-label",R))}let c=bl(n),l=Hr(f,c,s.flat);c.dispose(),n.innerHTML=gl(l,{id:r,title:s.title,styles:s.styles});let d=n.querySelector("svg");for(let A of[a,d])A.style.display="block",A.style.width="100%",A.style.height="auto";s.title&&a.setAttribute("aria-label",s.title);let m=s.mode??"3d",h,y=A=>A==="3d"?o:n,g=A=>A==="3d"?a:d,k=A=>{o.hidden=A!=="3d",n.hidden=A!=="2d";for(let R of[o,n])R.style.cssText="";i.style.height="",i.dataset.mode=A};k(m);let u=()=>{for(let A of[a,d]){for(let R of A.querySelectorAll("[data-id]"))R.classList.toggle("sel",!!h&&R.getAttribute("data-id")===h);for(let R of A.querySelectorAll("[data-a]")){let M=!!h&&(R.getAttribute("data-a")===h||R.getAttribute("data-b")===h);R.classList.toggle("hot",M),R.classList.toggle("dim",!!h&&!M),A.querySelector(`[data-for="${CSS.escape(R.getAttribute("data-id")??"")}"]`)?.classList.toggle("dim",!!h&&!M)}}},b=A=>{h=A,u()},x=A=>{let R=A.target.closest?.("[data-id]");if(!R||!i.contains(R)||R.hasAttribute("data-a"))return;let M=R.getAttribute("data-id");b(M),s.onSelect?.(M)},w=A=>{(A.key==="Enter"||A.key===" ")&&A.target.matches?.("[data-id][tabindex]")&&(A.preventDefault(),x(A))};i.addEventListener("click",x),i.addEventListener("keydown",w);let $,v=()=>{if(!$)return;cancelAnimationFrame($.frame),$.layer.remove();let A=$;$=void 0,m=A.to,k(m),u(),A.done()},O=A=>{!A||!h||g(m).querySelector(`[data-id="${CSS.escape(h)}"][tabindex]`)?.focus({preventScroll:!0})};return{get mode(){return $?$.to:m},layout:l,root:i,morph:A=>{let R=i.contains(document.activeElement);if($&&v(),A===m)return O(R),Promise.resolve();let M=s.motion??"auto";return M==="never"||M==="auto"&&typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches||!(s.duration??600)?(m=A,k(m),u(),O(R),Promise.resolve()):new Promise(S=>{let N=m,z=i.getBoundingClientRect().height;o.hidden=!1,n.hidden=!1;for(let ee of[o,n])ee.style.cssText="position:absolute;left:0;top:0;right:0;visibility:hidden";let K=y(A).getBoundingClientRect().height;i.style.height=`${z}px`;let J=ao(i,g(N),g(A),N);i.appendChild(J.svg);let Z=s.duration??600,L=performance.now(),U={frame:0,layer:J.svg,to:A,done:()=>{O(R),S()}},H=ee=>{if($!==U)return;let j=Math.min(1,(ee-L)/Z);J.at(j),i.style.height=`${z+(K-z)*oo(Ps((j-.2)/.6))}px`,j<1?U.frame=requestAnimationFrame(H):v()};$=U,U.frame=requestAnimationFrame(H)})},select:b,get selected(){return h},svgOf:g,destroy(){$&&v(),i.removeEventListener("click",x),i.removeEventListener("keydown",w),i.remove()}}}function km(t="iso-view"){try{let e=localStorage.getItem(t);return e==="2d"||e==="3d"?e:void 0}catch{return}}function $m(t,e,s={}){let r=s.storageKey??"iso-view",i=Array.isArray(e)?e:[e],o=document.createElement("div");o.className="view-switch",o.setAttribute("role","group"),o.setAttribute("aria-label","Drawing view");let n=["3d","2d"].map((f,p)=>{let c=document.createElement("button");return c.type="button",c.dataset.mode=f,c.textContent=(s.labels??["3D","2D"])[p],c.addEventListener("click",()=>{try{localStorage.setItem(r,f)}catch{}a(f);for(let l of i)l.morph(f)}),o.appendChild(c),c}),a=f=>n.forEach(p=>p.setAttribute("aria-pressed",String(p.dataset.mode===f)));return a(i[0]?.mode??"3d"),t.appendChild(o),o}var Sm=`
426
+ `;for(let[r,i]of Object.entries(t)){let o=ym(r),n=e(i.color);s+=`.flat .conn.k-${o}{stroke:${n}${i.dash?`;stroke-dasharray:${i.dash}`:""}${i.width?`;stroke-width:${i.width}`:""}} .flat .mk.k-${o}{fill:${n}} .flat .cl.k-${o}{fill:${n}}
427
+ `}return s}var yy={name:["card","lt"],sub:["card","st"],title:["panel","pl"],titleSub:["panel","pls"],label:["","cl"]};function kl(t){let e="http://www.w3.org/2000/svg",s=document.createElementNS(e,"svg");s.setAttribute("class","flat"),s.setAttribute("aria-hidden","true"),s.style.cssText="position:absolute;left:-10000px;top:0;width:10px;height:10px;visibility:hidden",t.appendChild(s);let r={};for(let[n,[a,f]]of Object.entries(yy)){let p=document.createElementNS(e,"g");a&&p.setAttribute("class",a);let c=document.createElementNS(e,"text");c.setAttribute("class",f),p.appendChild(c),s.appendChild(p),r[n]=c}let i=new Map,o=((n,a)=>{let f=a+"\0"+n,p=i.get(f);return p===void 0&&(r[a].textContent=n,p=r[a].getComputedTextLength(),i.set(f,p)),p});return o.dispose=()=>s.remove(),o}var bm=(t,e)=>t.cards.find(s=>s.id===e)?.rect??t.panels.find(s=>s.id===e)?.rect;var Gs="http://www.w3.org/2000/svg";function Sl(t,e,s){let r=new Map((s?.links??[]).map((i,o)=>[i.id??`link-${o}`,i]));for(let i of e.routes){let o=r.get(i.id),n=o?.a??wn(i.raw.from).id,a=o?.b??wn(i.raw.to).id;for(let f of t.querySelectorAll(`[data-id="${CSS.escape(i.id)}"]`))f.setAttribute("data-a",n),f.setAttribute("data-b",a)}}var gy=(t="auto")=>t==="always"||t==="auto"&&!(typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches);function km(t,e,s,r,i={}){let o=i.duration??600;if(!o||!gy(i.motion))return;let n=lo(t,e,s,r);t.appendChild(n.svg),n.at(0);let a=0,f=!1,p,c=new Promise(h=>p=h),l=()=>{f||(f=!0,cancelAnimationFrame(a),n.svg.remove(),p())},d=performance.now(),m=h=>{if(f)return;let y=Math.min(1,(h-d)/o);n.at(y),y<1?a=requestAnimationFrame(m):l()};return a=requestAnimationFrame(m),{done:c,finish:l}}var Ps=t=>Math.max(0,Math.min(1,t)),ao=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2;function $l(t){let e=t.cloneNode(!0),s=[t,...t.querySelectorAll("*")],r=[e,...e.querySelectorAll("*")];return s.forEach((i,o)=>{let n=getComputedStyle(i),a=r[o];a.removeAttribute("class"),a.removeAttribute("tabindex");for(let f of["fill","fill-opacity","stroke","stroke-width","stroke-dasharray","stroke-opacity","opacity","font-size","font-weight","font-family","letter-spacing","paint-order","stroke-linejoin","text-anchor"])a.style.setProperty(f,n.getPropertyValue(f))}),e}var kp=(t,e)=>{let s=t.getBoundingClientRect();return{x:s.left-e.left,y:s.top-e.top,w:s.width,h:s.height}},wm=t=>{let e=Math.min(...t.map(o=>o.x)),s=Math.min(...t.map(o=>o.y)),r=Math.max(...t.map(o=>o.x+o.w)),i=Math.max(...t.map(o=>o.y+o.h));return{x:e,y:s,w:r-e,h:i-s}},by=(t,e)=>{let s=t.getScreenCTM();return`matrix(${s.a} ${s.b} ${s.c} ${s.d} ${s.e-e.left} ${s.f-e.top})`},xm=(t,e,s)=>{let r=1+(e.w/Math.max(t.w,1e-6)-1)*s,i=1+(e.h/Math.max(t.h,1e-6)-1)*s,o=(e.x-t.x*(e.w/Math.max(t.w,1e-6)))*s,n=(e.y-t.y*(e.h/Math.max(t.h,1e-6)))*s;return`matrix(${r} 0 0 ${i} ${o} ${n})`};function wy(t,e){let s=t.querySelector("polygon.top");if(!s)return;let r=s.getScreenCTM(),i=[];for(let o=0;o<s.points.numberOfItems;o++){let n=s.points.getItem(o);i.push([r.a*n.x+r.c*n.y+r.e-e.left,r.b*n.x+r.d*n.y+r.f-e.top])}return i.length===4?{pts:i,fill:getComputedStyle(s).fill}:void 0}function lo(t,e,s,r){let i=t.getBoundingClientRect(),o=document.createElementNS(Gs,"svg");o.setAttribute("class","dual-morph"),o.setAttribute("aria-hidden","true"),o.style.cssText=`position:absolute;left:0;top:0;width:${i.width}px;height:${Math.max(i.height,e.getBoundingClientRect().height,s.getBoundingClientRect().height)}px;overflow:visible;pointer-events:none`;let n=w=>{let $=document.createElementNS(Gs,"g");return $.setAttribute("transform",by(w,i)),$},a=w=>w.hasAttribute("data-a")||w.hasAttribute("data-for"),f=w=>{let $=new Map;for(let S of w.querySelectorAll("[data-id]")){if(a(S)||S.parentElement?.closest("[data-id]")||S.closest(".overlay"))continue;let O=S.getAttribute("data-id");($.get(O)??$.set(O,[]).get(O)).push(S)}return $},p=f(e),c=f(s),l=document.createElementNS(Gs,"g"),d=document.createElementNS(Gs,"g"),m=n(e),h=n(s);for(let w of e.querySelectorAll("[data-a],[data-for]"))w.closest(".overlay")||m.appendChild($l(w));for(let w of s.querySelectorAll("[data-a],[data-for]"))w.closest(".overlay")||h.appendChild($l(w));l.appendChild(m),d.appendChild(h);let y=[...h.querySelectorAll("path")].map(w=>{let $=w.getTotalLength?.()??0;return{p:w,len:$}}),g=[...h.children].filter(w=>w.tagName.toLowerCase()==="text"),k=[...(r==="2d"?p:c).keys()],u=[],b=document.createElementNS(Gs,"g");for(let w of new Set([...k,...p.keys(),...c.keys()])){let $=p.get(w),S=c.get(w),O={};if($){O.a=wm($.map(N=>kp(N,i)));let E=document.createElementNS(Gs,"g"),v=n(e);for(let N of $)v.appendChild($l(N));E.appendChild(v),O.src=E}if(S){O.b=wm(S.map(N=>kp(N,i)));let E=document.createElementNS(Gs,"g"),v=n(s);for(let N of S)v.appendChild($l(N));E.appendChild(v),O.dst=E}let z=r==="3d"?$?.[0]:S?.[0],A=r==="3d"?S?.[0]:$?.[0],R=z?wy(z,i):void 0,P=A?.querySelector("rect.face");if(R&&P){let E=kp(P,i),v=[[E.x,E.y],[E.x+E.w,E.y],[E.x+E.w,E.y+E.h],[E.x,E.y+E.h]],N=R.pts.reduce((j,K,U)=>K[0]<R.pts[j][0]?U:j,0),C=[...R.pts.slice(N),...R.pts.slice(0,N)],V=[C[0],C[1],C[2],C[3]],Y=getComputedStyle(P).fill,Z=document.createElementNS(Gs,"polygon");O.face=Z,O.faceFrom=r==="3d"?V:v,O.faceTo=r==="3d"?v:V,O.faceFill=r==="3d"?[R.fill,Y]:[Y,R.fill]}O.src&&b.appendChild(O.src),O.face&&b.appendChild(O.face),O.dst&&b.appendChild(O.dst),u.push(O)}o.append(l,b,d);let x=(w,$,S)=>`color-mix(in srgb, ${w} ${Math.round((1-S)*100)}%, ${$})`;return{svg:o,at(w){let $=Ps(w/.2),S=ao(Ps((w-.2)/.6)),O=Ps((w-.8)/.2);l.setAttribute("opacity",String(1-$));for(let{p:z,len:A}of y)z.style.strokeDasharray=`${A} ${A}`,z.style.strokeDashoffset=String(A*(1-O));d.setAttribute("opacity",String(O>0?1:0));for(let z of g)z.style.opacity=String(O);for(let z of u)if(z.src&&(z.src.setAttribute("transform",z.a&&z.b?xm(z.a,z.b,S):""),z.src.setAttribute("opacity",String(z.b?1-Ps(S/(z.face?.35:.6)):1-S))),z.dst&&(z.dst.setAttribute("transform",z.a&&z.b?xm(z.b,z.a,1-S):""),z.dst.setAttribute("opacity",String(z.a?Ps((S-(z.face?.65:.4))/(z.face?.35:.6)):S))),z.face){let A=z.faceFrom.map((R,P)=>[R[0]+(z.faceTo[P][0]-R[0])*S,R[1]+(z.faceTo[P][1]-R[1])*S]);z.face.setAttribute("points",A.map(R=>R.join(",")).join(" ")),z.face.style.fill=x(z.faceFill[0],z.faceFill[1],S),z.face.setAttribute("opacity",String(S<.08?S/.08:S>.92?(1-S)/.08:1))}}}}var xy=0;function $m(t,e,s={}){let r=`dv${++xy}`,i=document.createElement("div");i.className="dual-view",i.style.position="relative",t.appendChild(i);let o=document.createElement("div"),n=document.createElement("div");o.className="dual-3d",n.className="dual-2d",i.append(o,n),o.innerHTML=e.rendered.svg;let a=o.querySelector("svg");a.setAttribute("data-view","3d");let f=s.board??Qa(e);Sl(a,e,f);let p=new Set(e.routes.map(A=>A.id));for(let A of a.querySelectorAll("g[data-id]")){let R=A.getAttribute("data-id");p.has(R)||A.hasAttribute("tabindex")||!A.querySelector("polygon")||(A.setAttribute("tabindex","0"),A.setAttribute("role","button"),A.setAttribute("aria-label",R))}let c=kl(n),l=Hr(f,c,s.flat);c.dispose(),n.innerHTML=xl(l,{id:r,title:s.title,styles:s.styles});let d=n.querySelector("svg");for(let A of[a,d])A.style.display="block",A.style.width="100%",A.style.height="auto";s.title&&a.setAttribute("aria-label",s.title);let m=s.mode??"3d",h,y=A=>A==="3d"?o:n,g=A=>A==="3d"?a:d,k=A=>{o.hidden=A!=="3d",n.hidden=A!=="2d";for(let R of[o,n])R.style.cssText="";i.style.height="",i.dataset.mode=A};k(m);let u=()=>{for(let A of[a,d]){for(let R of A.querySelectorAll("[data-id]"))R.classList.toggle("sel",!!h&&R.getAttribute("data-id")===h);for(let R of A.querySelectorAll("[data-a]")){let P=!!h&&(R.getAttribute("data-a")===h||R.getAttribute("data-b")===h);R.classList.toggle("hot",P),R.classList.toggle("dim",!!h&&!P),A.querySelector(`[data-for="${CSS.escape(R.getAttribute("data-id")??"")}"]`)?.classList.toggle("dim",!!h&&!P)}}},b=A=>{h=A,u()},x=A=>{let R=A.target.closest?.("[data-id]");if(!R||!i.contains(R)||R.hasAttribute("data-a"))return;let P=R.getAttribute("data-id");b(P),s.onSelect?.(P)},w=A=>{(A.key==="Enter"||A.key===" ")&&A.target.matches?.("[data-id][tabindex]")&&(A.preventDefault(),x(A))};i.addEventListener("click",x),i.addEventListener("keydown",w);let $,S=()=>{if(!$)return;cancelAnimationFrame($.frame),$.layer.remove();let A=$;$=void 0,m=A.to,k(m),u(),A.done()},O=A=>{!A||!h||g(m).querySelector(`[data-id="${CSS.escape(h)}"][tabindex]`)?.focus({preventScroll:!0})};return{get mode(){return $?$.to:m},layout:l,root:i,morph:A=>{let R=i.contains(document.activeElement);if($&&S(),A===m)return O(R),Promise.resolve();let P=s.motion??"auto";return P==="never"||P==="auto"&&typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches||!(s.duration??600)?(m=A,k(m),u(),O(R),Promise.resolve()):new Promise(v=>{let N=m,C=i.getBoundingClientRect().height;o.hidden=!1,n.hidden=!1;for(let ee of[o,n])ee.style.cssText="position:absolute;left:0;top:0;right:0;visibility:hidden";let V=y(A).getBoundingClientRect().height;i.style.height=`${C}px`;let Y=lo(i,g(N),g(A),N);i.appendChild(Y.svg);let Z=s.duration??600,j=performance.now(),K={frame:0,layer:Y.svg,to:A,done:()=>{O(R),v()}},U=ee=>{if($!==K)return;let L=Math.min(1,(ee-j)/Z);Y.at(L),i.style.height=`${C+(V-C)*ao(Ps((L-.2)/.6))}px`,L<1?K.frame=requestAnimationFrame(U):S()};$=K,K.frame=requestAnimationFrame(U)})},select:b,get selected(){return h},svgOf:g,destroy(){$&&S(),i.removeEventListener("click",x),i.removeEventListener("keydown",w),i.remove()}}}function Sm(t="iso-view"){try{let e=localStorage.getItem(t);return e==="2d"||e==="3d"?e:void 0}catch{return}}function vm(t,e,s={}){let r=s.storageKey??"iso-view",i=Array.isArray(e)?e:[e],o=document.createElement("div");o.className="view-switch",o.setAttribute("role","group"),o.setAttribute("aria-label","Drawing view");let n=["3d","2d"].map((f,p)=>{let c=document.createElement("button");return c.type="button",c.dataset.mode=f,c.textContent=(s.labels??["3D","2D"])[p],c.addEventListener("click",()=>{try{localStorage.setItem(r,f)}catch{}a(f);for(let l of i)l.morph(f)}),o.appendChild(c),c}),a=f=>n.forEach(p=>p.setAttribute("aria-pressed",String(p.dataset.mode===f)));return a(i[0]?.mode??"3d"),t.appendChild(o),o}var Mm=`
425
428
  .view-switch{display:inline-flex;border:1px solid var(--line);border-radius:8px;overflow:hidden;background:var(--surface);font:600 12px/1 system-ui,sans-serif;box-shadow:0 1px 4px rgba(0,0,0,.12)}
426
429
  .view-switch button{font:inherit;border:0;background:none;color:var(--ink);padding:6px 10px;cursor:pointer}
427
430
  .view-switch button+button{border-left:1px solid var(--line)}
@@ -431,7 +434,7 @@ ${e.extraBody??""}
431
434
  .dual-view .blk.sel polygon{stroke:var(--accent,#2f6fd6);stroke-width:2.4}
432
435
  .dual-view [data-a].dim{opacity:.3}
433
436
  .dual-view [data-a].hot path{stroke-width:3.4}
434
- `;var Fm={};ho(Fm,{BASE_CSS:()=>Om,CompileError:()=>fo,DRAWING_CSS:()=>Pm,NODE_ASSETS:()=>lo,REGION_KINDS:()=>wp,compile:()=>Ml,getAsset:()=>Mm,renderSvg:()=>_m,systems:()=>ts});var gy={name:"volume",description:"Stored data that is kept: a drum with two bands (a volume, a room's history, an archive).",size:[1.8,1.8,1.3],role:"folder",draw(t,e){let[s,r]=Hs(e),i=Math.min(e.x1-e.x0,e.y1-e.y0)/2,o=(c,l)=>[s+i*Math.cos(c*Math.PI/180),r+i*Math.sin(c*Math.PI/180),l],n=(c,l,d)=>Array.from({length:13},(m,h)=>o(c+(l-c)*h/12,d)),a=(c,l,d)=>t.poly([...n(c,l,e.z0),...n(c,l,e.z1).reverse()],d),f=e.z1-e.z0,p=c=>n(-45,135,c).slice(1).map((l,d,m)=>t.line3(d?m[d-1]:o(-45,c),l,"det")).join("");return a(45,135,"lft")+a(-45,45,"rgt")+p(e.z0+f*.36)+p(e.z0+f*.68)+t.poly(Array.from({length:32},(c,l)=>o(l*360/32,e.z1)),"top")}},by={name:"orb",description:"An agent: a white sphere with two eyes, on a small plate.",size:[1.5,1.5,1.6],role:"lead",cls:"orb",draw(t,e){t.def("orbG",Se("radialGradient",{id:"orbG",cx:"0.36",cy:"0.30",r:"0.80"},Se("stop",{offset:"0",style:"stop-color:#ffffff"})+Se("stop",{offset:"0.62",style:"stop-color:#f6f6f4"})+Se("stop",{offset:"1",style:"stop-color:#cfd0d6"})));let s=Li(e),[r,i]=Ne((e.x0+e.x1)/2,(e.y0+e.y1)/2,s.z1),o=23,n=i-o+3;t.bounds.add([r-o,n-o]),t.bounds.add([r+o,n+o]);let a=(f,p,c,l)=>Se("rect",{class:"eye",x:r+f-c/2,y:n+p-l/2,width:c,height:l,rx:c/2,transform:`rotate(-24 ${(r+f).toFixed(1)} ${(n+p).toFixed(1)})`});return t.blockFaces(s)+Se("ellipse",{class:"shade",cx:r,cy:i+1,rx:o*.8,ry:o*.3})+Se("circle",{class:"ball",cx:r,cy:n,r:o})+a(3,-7,6.4,13.5)+a(14,-12,5.4,10.5)},label(t,e,s){let[r,i]=Ne((t.x0+t.x1)/2,(t.y0+t.y1)/2,t.z0+1.95);return{x:r,y:i-26+(s?0:14),anchor:"middle"}},pulse:t=>[(t.x0+t.x1)/2,(t.y0+t.y1)/2,t.z0+.8,26]},wy={name:"person",description:"A human: body and head on a small plate. The label sits to the right.",size:[1.5,1.5,1.6],role:"person",cls:"person",draw(t,e){let s=Li(e),[r,i]=Ne((e.x0+e.x1)/2,(e.y0+e.y1)/2,s.z1);t.bounds.add([r-13,i-50]);let o=n=>n.toFixed(1);return t.blockFaces(s)+Se("path",{class:"body",d:`M${o(r-13)},${o(i-4)} C${o(r-13)},${o(i-34)} ${o(r+13)},${o(i-34)} ${o(r+13)},${o(i-4)} Q${o(r)},${o(i+4)} ${o(r-13)},${o(i-4)}z`})+Se("circle",{class:"head",cx:r,cy:i-40,r:10})},label(t){let[e,s]=Ne((t.x0+t.x1)/2,(t.y0+t.y1)/2,t.z0);return{x:e+30,y:s+2,anchor:"start"}},pulse:t=>[(t.x0+t.x1)/2,(t.y0+t.y1)/2,t.z0+.9,26]},xy={name:"screen",description:"An upright screen or terminal panel. `face`: terminal, chat, desktop, tiles, or one the host registers. `facing`: turn in degrees.",size:[1.64,.3,1.75],role:"term",draw(t,e,s){let[r,i]=Hs(e),o=(e.x1-e.x0)/2,n=e.z1-e.z0,a=.14,f=(s.facing??0)*Math.PI/180,p=Math.cos(f),c=Math.sin(f),l=Math.sin(f)*a,d=-Math.cos(f)*a,m=[r-p*o,i-c*o],h=[r+p*o,i+c*o],y=e.z0,g=e.z1,k=t.poly([[h[0],h[1],y],[h[0]+l,h[1]+d,y],[h[0]+l,h[1]+d,g],[h[0],h[1],g]],"rgt")+t.poly([[m[0],m[1],g],[h[0],h[1],g],[h[0]+l,h[1]+d,g],[m[0]+l,m[1]+d,g]],"top")+t.poly([[m[0],m[1],y],[h[0],h[1],y],[h[0],h[1],g],[m[0],m[1],g]],"lft"),u=Ne(m[0],m[1],g),b=Ne(h[0],h[1],g),x=2*o*lt,w=n*lt,$=[(b[0]-u[0])/x,(b[1]-u[1])/x,0,1,u[0],u[1]],v=tr(s.face??"terminal")??di;return k+=t.onMatrix($,x,w,(O,C)=>fi(O,C)+v(O,C),"scr"),k}},ky={name:"monitor",description:"A block with a screen painted on its front-left face. `face` as for screen.",size:[2.4,.8,1.8],role:"term",draw(t,e,s){let r=tr(s.face??"terminal")??di;return t.blockFaces(e)+t.onFace(e,"left",(i,o)=>fi(i,o)+r(i,o),"scr")}},$y={name:"cloud",description:"A cloud lying on the floor: the internet, or a hosted service.",size:[3,2.4,.3],role:"cloud",draw:(t,e)=>Er(t,e)},lo={block:an("block","A box. Size and colour role are free; add decorations with `deco`.",[2.4,2.4,1.6],"grey"),session:an("session","An agent session: a box with terminal lines (`deco: [terminal: 4]`; add an icon the host registers with `icon: NAME`).",[2.6,2.6,1.8],"work",[{terminal:4}]),terminal:an("terminal","A box with terminal lines on its front.",[1.6,1.2,.8],"term",[{terminal:2}]),server:an("server","A service or daemon: a low box with two terminal lines.",[3,2.2,.9],"doz",[{terminal:2}]),chat:an("chat","A chat server or room: a box with a chat bubble on top.",[3.6,4.4,1.3],"chat",["bubble"]),mailbox:an("mailbox","A room or inbox: terminal lines and an envelope on top.",[2.4,2.4,1.6],"mail",[{terminal:3},"envelope"]),file:an("file","A file or document: a low box with lines on top.",[1.6,1.6,.6],"file",["file-lines"]),folder:an("folder","A folder or directory: a flat box.",[1.6,1.6,.5],"folder"),key:an("key","A secret: a low box with a key on top.",[1.6,1.6,.6],"key",[],(t,e)=>wo(t,e)),socket:an("socket","A socket: a small box with a round opening on top.",[1.2,1.2,.5],"socket",[],(t,e)=>xo(t,e)),gate:an("gate","A gate or proxy: a narrow upright slab, usually set in a fence wall.",[.3,2,1.1],"gate"),placeholder:an("placeholder","A placeholder value: a small low box with lines.",[1.2,1,.45],"placeholder",["file-lines"]),orb:by,person:wy,screen:xy,monitor:ky,cloud:$y,volume:gy};function Mm(t){return lo[t??"block"]}var Sy="border-color:hsl(38 80% 45%);background:hsl(38 80% 55% / .2)",wp={slab:{shape:"slab",pad:1.2,z:[-.8,.35],floor:!0,role:"slab",labelStyle:"face"},pad:{shape:"block",pad:.6,z:[0,.2],floor:!0,role:"pad",labelStyle:"floor"},fence:{shape:"walled",pad:.7,z:[0,.8],floor:!1,role:"fence",labelStyle:"face",legend:{label:"Fence",swatch:Sy,box:!0,auto:!0},css:`.fz{fill:var(--fence-text)!important;opacity:1!important}
435
- `},vm:{shape:"block",pad:.6,z:[0,.45],floor:!0,role:"sandbox",labelStyle:"face",legend:{label:"Sandbox VM",swatch:"border-color:hsl(170 35% 40%);background:hsl(170 40% 50% / .2)",box:!0,auto:!0}},platform:{shape:"block",pad:.6,z:[0,.7],floor:!0,role:"server",labelStyle:"face-right"},cloud:{shape:"cloud",pad:.8,z:[0,.2],floor:!0,role:"cloud",labelStyle:"floor"},zone:{shape:"zone",pad:.5,z:[0,.005],floor:!1,role:"grey",labelStyle:"floor"},tunnel:{shape:"tunnel",pad:0,z:[0,.8],floor:!1,role:"socket",labelStyle:"none",legend:{label:"Tailscale tunnel",swatch:"border-color:hsl(205 70% 50%);border-top-width:9px;opacity:.35",box:!1,auto:!1}}},ts={regions:wp,nodes:lo,defaultNode:"block"};var Pm=ar(ts),Om=Ur(ts);var Tm=$l,rt={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://isodiag.local/schema/isodiag-1.json",title:"isodiag diagram",description:"A page of isometric, animated diagrams. See docs/FORMAT.md.",type:"object",required:["isodiag","scenes"],additionalProperties:!1,properties:{isodiag:{const:1,description:"Format version. Always 1."},title:{type:"string"},lede:{type:"string"},pills:{type:"array",items:{type:"string"}},theme:{type:"string",description:"'default' or a path to a theme file"},roles:{type:"object",description:"Extra or changed colour roles for nodes and regions",additionalProperties:{$ref:"#/$defs/role"}},kinds:{type:"object",description:"Extra flow kinds, or new legend text for the standard ones",additionalProperties:{$ref:"#/$defs/kindDef"}},after:{type:"string",description:"Markdown shown after all scenes"},grid:{$ref:"#/$defs/grid"},assemble:{type:"boolean",description:"draw each scene by flying its parts in from the nearest edge, then play"},footer:{type:"string"},treatment:{enum:["mono"],description:"How a self-contained drawing (renderSvg, <isometric-diagram>) is painted: mono, black and white. A host may say otherwise. The page isodiag build writes is in colour."},scenes:{type:"array",minItems:1,items:{$ref:"#/$defs/scene"}}},$defs:{motion:{type:"object",additionalProperties:!1,minProperties:1,description:"how this piece (a region: its contents too) moves when the drawing assembles or disassembles",properties:{style:{enum:["edge","drop","rise","fly","pop","scatter","build","fade"],description:"how it arrives"},out:{enum:["explode","lift-off","sink","scatter","fly-out","collapse","fade","reverse"],description:"how it leaves"},easing:{enum:["linear","ease","ease-in","ease-out","settle","spring","bounce"]},from:{enum:["left","right","top","bottom"],description:"fly: the side it comes from"},delay:{type:"number",minimum:0,description:"ms after its turn"},duration:{type:"number",exclusiveMinimum:0,description:"ms its own move takes"}}},variants:{type:"object",minProperties:1,propertyNames:{$ref:"#/$defs/id"},description:"other looks of it, by name, for a motion to switch to (its box stays as it is)",additionalProperties:{type:"object",additionalProperties:!1,minProperties:1,properties:{role:{type:"string"},ghost:{type:"boolean"},label:{type:"string"},sub:{type:"string"},face:{type:"string",pattern:"^[a-z][a-z0-9-]*$"},deco:{type:"array",items:{$ref:"#/$defs/deco"}}}}},id:{type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},grid:{type:"object",additionalProperties:!1,properties:{snap:{type:"number",exclusiveMinimum:0,description:"round every placed edge and route waypoint to this step, in grid units"},show:{type:"boolean",description:"draw the floor grid when the page opens (the Grid button toggles it)"},step:{type:"number",exclusiveMinimum:0,description:"spacing of the drawn grid lines; default the snap step, or 1"}}},num:{type:"number"},point2:{type:"array",items:{type:"number"},minItems:2,maxItems:2},size2or3:{type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:3},stepRef:{anyOf:[{type:"string"},{type:"integer",minimum:1}]},side:{enum:["n","e","s","w"]},align:{enum:["start","center","end"]},role:{type:"object",additionalProperties:!1,required:["h","s"],properties:{h:{type:"number",minimum:0,maximum:360,description:"hue"},s:{type:"number",minimum:0,maximum:100,description:"saturation, percent"},top:{type:"string",description:"CSS colour for the top face, overriding the computed one"},tint:{type:"number",minimum:0,maximum:100,description:"percent of the role colour mixed into the pad colour for the top face"}}},kindDef:{type:"object",additionalProperties:!1,properties:{legend:{type:"string"},like:{type:"string",description:"a standard kind whose colour and line style this one uses"},color:{type:"string"},dash:{enum:["solid","dashed","dotted"]}}},placement:{properties:{in:{$ref:"#/$defs/id"},at:{$ref:"#/$defs/point2"},"right-of":{$ref:"#/$defs/id"},"left-of":{$ref:"#/$defs/id"},below:{$ref:"#/$defs/id"},behind:{$ref:"#/$defs/id"},gap:{type:"number"},align:{$ref:"#/$defs/align"},shift:{$ref:"#/$defs/point2",description:"nudge after placement, grid units [dx, dy]"},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},scene:{type:"object",required:["id","title"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},title:{type:"string"},ants:{description:"its connectors march, showing which way they flow: all that may, these, or with a speed (units a second) and a dash",anyOf:[{type:"boolean"},{type:"array",items:{type:"string"}},{type:"object",additionalProperties:!1,properties:{ids:{type:"array",items:{type:"string"}},speed:{type:"number"},dash:{type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:2}}}]},motion:{type:"object",description:"the scene's motion document (isomotion/1; its `isomotion: 1` may be left out)"},caption:{type:"string"},aria:{type:"string"},gap:{type:"number",exclusiveMinimum:0},flow:{enum:["row","column"]},regions:{type:"array",items:{$ref:"#/$defs/region"}},nodes:{type:"array",items:{$ref:"#/$defs/node"}},routes:{type:"array",items:{$ref:"#/$defs/route"}},notes:{type:"array",items:{$ref:"#/$defs/note"}},steps:{type:"array",items:{$ref:"#/$defs/step"}},legend:{anyOf:[{enum:["auto"]},{const:!1},{type:"array",items:{type:"string"}}]},badges:{type:"boolean"},grid:{$ref:"#/$defs/grid"},assemble:{type:"boolean",description:"draw the scene by flying its parts in from the nearest edge, then play"},loop:{type:"boolean",description:"the player wraps from the last step to the first (default true)"},dim:{enum:["flows","all"],description:"what a step dims: only flows, their labels and marks (default), or nodes too"},after:{type:"string"}}},region:{type:"object",required:["id","kind"],unevaluatedProperties:!1,allOf:[{$ref:"#/$defs/placement"}],properties:{id:{$ref:"#/$defs/id"},kind:{enum:["slab","pad","fence","vm","cloud","zone","platform","tunnel"]},label:{type:"string"},"label-style":{enum:["face","face-right","floor","none"]},ghost:{type:"boolean",description:"drawn as a dashed outline: not there yet, out of reach, or stopped"},role:{type:"string"},size:{$ref:"#/$defs/size2or3"},padding:{type:"number",minimum:0},height:{type:"number",exclusiveMinimum:0},z:{type:"number",description:"lift above the floor it stands on (tunnels)"},flow:{enum:["row","column"]},gate:{type:"object",additionalProperties:!1,required:["side"],properties:{side:{$ref:"#/$defs/side"},at:{type:"number",minimum:0,maximum:1,description:"centre of the gate along the wall, 0..1"},width:{type:"number",exclusiveMinimum:0},height:{type:"number",exclusiveMinimum:0},node:{$ref:"#/$defs/id"}}},around:{type:"array",items:{$ref:"#/$defs/id"},description:"tunnel: routes it wraps"},regions:{type:"array",items:{$ref:"#/$defs/region"}},motion:{$ref:"#/$defs/motion"},variants:{$ref:"#/$defs/variants"},nodes:{type:"array",items:{$ref:"#/$defs/node"}}}},deco:{anyOf:[{enum:["envelope","bubble","file-lines","ghost","terminal"]},{type:"object",additionalProperties:!1,minProperties:1,maxProperties:1,properties:{terminal:{type:"integer",minimum:1,maximum:8},icon:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"an icon the host registers (none by default); one nothing registers is drawn as a placeholder, with a warning"},screen:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"terminal, chat, desktop, tiles, or a face the host registers"}}}]},node:{type:"object",required:["id"],unevaluatedProperties:!1,allOf:[{$ref:"#/$defs/placement"}],properties:{id:{$ref:"#/$defs/id"},asset:{type:"string",description:"asset name from the library; default 'block'"},role:{type:"string",description:"colour role"},label:{type:"string"},sub:{type:"string"},size:{$ref:"#/$defs/size2or3"},z:{type:"number",description:"lift above the floor it stands on"},deco:{type:"array",items:{$ref:"#/$defs/deco"}},ghost:{type:"boolean"},face:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"screen asset: what the screen shows: terminal, chat, desktop, tiles, or a face the host registers"},facing:{type:"number",description:"screen asset: rotation in degrees"},"label-at":{type:"object",additionalProperties:!1,properties:{side:{enum:["above","right","left","below"]},dx:{type:"number"},dy:{type:"number"}}},motion:{$ref:"#/$defs/motion"},variants:{$ref:"#/$defs/variants"},nodes:{type:"array",items:{$ref:"#/$defs/node"},description:"nodes standing on top of this one"}}},endpoint:{type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"},route:{type:"object",required:["id","from","to"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},from:{$ref:"#/$defs/endpoint"},to:{$ref:"#/$defs/endpoint"},kind:{type:"string"},via:{type:"array",items:{anyOf:[{$ref:"#/$defs/point2"},{$ref:"#/$defs/endpoint"}]}},points:{type:"array",items:{type:"array",items:{type:"number"},minItems:2,maxItems:3},description:"exact polyline in grid units; skips the router"},lane:{type:"number"},arrow:{type:"boolean"},cross:{type:"boolean",description:"the route may pass through fence walls (it crosses a boundary)"},label:{anyOf:[{type:"string"},{type:"object",additionalProperties:!1,required:["text"],properties:{text:{type:"string"},along:{type:"integer",minimum:1},side:{enum:["left","right"]},at:{type:"array",items:{type:"number"},minItems:2,maxItems:3,description:"exact place [x, y] or [x, y, z]; skips placement"},dir:{enum:["x","y"]},anchor:{enum:["start","middle","end"]}}}]},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},note:{type:"object",additionalProperties:!1,properties:{floor:{type:"string"},face:{type:"string"},label:{type:"string"},sub:{type:"string"},at:{anyOf:[{$ref:"#/$defs/point2"},{type:"array",items:{type:"number"},minItems:3,maxItems:3}]},on:{$ref:"#/$defs/id",description:"a node, region or route; a note on a route dims and lights with it"},kind:{type:"string"},dir:{enum:["x","y"]},anchor:{enum:["start","middle","end"]},dx:{type:"number"},dy:{type:"number"},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},routeRef:{anyOf:[{type:"string"},{type:"object",minProperties:1,maxProperties:1,additionalProperties:{type:"string"}}]},phase:{anyOf:[{$ref:"#/$defs/routeRef"},{type:"array",items:{$ref:"#/$defs/routeRef"}}]},step:{type:"object",required:["heading"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},number:{type:"integer",minimum:1,description:"the number shown; defaults to the position"},kind:{type:"string"},heading:{type:"string"},caption:{type:"string"},command:{type:"string"},animate:{type:"array",items:{$ref:"#/$defs/phase"}},pulse:{type:"array",items:{$ref:"#/$defs/id"}},highlight:{type:"array",items:{$ref:"#/$defs/id"}},focus:{type:"array",items:{$ref:"#/$defs/id"},description:"nodes or regions to zoom to for this step; the view eases back on steps without focus"},show:{type:"array",items:{$ref:"#/$defs/id"}},hide:{type:"array",items:{$ref:"#/$defs/id"}},say:{type:"array",items:{type:"object",additionalProperties:!1,required:["at","text"],properties:{at:{anyOf:[{$ref:"#/$defs/id"},{type:"array",items:{type:"number"},minItems:2,maxItems:3}],description:"a node (the callout sits above it) or a grid point [x, y, z]"},text:{type:"string"},kind:{type:"string"},dx:{type:"number"},dy:{type:"number"},anchor:{enum:["start","middle","end"]}}}},mark:{type:"array",items:{type:"object",additionalProperties:!1,properties:{on:{$ref:"#/$defs/id"},at:{type:"array",items:{type:"number"},minItems:2,maxItems:3}}}},badge:{anyOf:[{type:"boolean"},{$ref:"#/$defs/id"},{type:"array",items:{type:"number"},minItems:2,maxItems:3}],description:"false, a route or node id, or a grid point [x, y, z]"},duration:{anyOf:[{const:"auto"},{type:"integer",minimum:500}]}}}}},Lt={type:"object",additionalProperties:!1,required:["h","s"],properties:{h:{type:"number",minimum:0,maximum:360,description:"hue"},s:{type:"number",minimum:0,maximum:100,description:"saturation, percent"},top:{type:"string",description:"CSS colour for the top face, overriding the computed one"},tint:{type:"number",minimum:0,maximum:100,description:"percent of the role colour mixed into the pad colour for the top face"}}},jn={type:"object",additionalProperties:!1,properties:{legend:{type:"string"},like:{type:"string",description:"a standard kind whose colour and line style this one uses"},color:{type:"string"},dash:{enum:["solid","dashed","dotted"]}}},Rt={type:"object",additionalProperties:!1,properties:{snap:{type:"number",exclusiveMinimum:0,description:"round every placed edge and route waypoint to this step, in grid units"},show:{type:"boolean",description:"draw the floor grid when the page opens (the Grid button toggles it)"},step:{type:"number",exclusiveMinimum:0,description:"spacing of the drawn grid lines; default the snap step, or 1"}}},co=Object.prototype.hasOwnProperty,ve={type:"object",required:["id","title"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},title:{type:"string"},ants:{description:"its connectors march, showing which way they flow: all that may, these, or with a speed (units a second) and a dash",anyOf:[{type:"boolean"},{type:"array",items:{type:"string"}},{type:"object",additionalProperties:!1,properties:{ids:{type:"array",items:{type:"string"}},speed:{type:"number"},dash:{type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:2}}}]},motion:{type:"object",description:"the scene's motion document (isomotion/1; its `isomotion: 1` may be left out)"},caption:{type:"string"},aria:{type:"string"},gap:{type:"number",exclusiveMinimum:0},flow:{enum:["row","column"]},regions:{type:"array",items:{$ref:"#/$defs/region"}},nodes:{type:"array",items:{$ref:"#/$defs/node"}},routes:{type:"array",items:{$ref:"#/$defs/route"}},notes:{type:"array",items:{$ref:"#/$defs/note"}},steps:{type:"array",items:{$ref:"#/$defs/step"}},legend:{anyOf:[{enum:["auto"]},{const:!1},{type:"array",items:{type:"string"}}]},badges:{type:"boolean"},grid:{$ref:"#/$defs/grid"},assemble:{type:"boolean",description:"draw the scene by flying its parts in from the nearest edge, then play"},loop:{type:"boolean",description:"the player wraps from the last step to the first (default true)"},dim:{enum:["flows","all"],description:"what a step dims: only flows, their labels and marks (default), or nodes too"},after:{type:"string"}}},Ee={type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},It=new RegExp("^[A-Za-z][A-Za-z0-9_-]*$","u"),Fe={type:"object",required:["id","kind"],unevaluatedProperties:!1,allOf:[{$ref:"#/$defs/placement"}],properties:{id:{$ref:"#/$defs/id"},kind:{enum:["slab","pad","fence","vm","cloud","zone","platform","tunnel"]},label:{type:"string"},"label-style":{enum:["face","face-right","floor","none"]},ghost:{type:"boolean",description:"drawn as a dashed outline: not there yet, out of reach, or stopped"},role:{type:"string"},size:{$ref:"#/$defs/size2or3"},padding:{type:"number",minimum:0},height:{type:"number",exclusiveMinimum:0},z:{type:"number",description:"lift above the floor it stands on (tunnels)"},flow:{enum:["row","column"]},gate:{type:"object",additionalProperties:!1,required:["side"],properties:{side:{$ref:"#/$defs/side"},at:{type:"number",minimum:0,maximum:1,description:"centre of the gate along the wall, 0..1"},width:{type:"number",exclusiveMinimum:0},height:{type:"number",exclusiveMinimum:0},node:{$ref:"#/$defs/id"}}},around:{type:"array",items:{$ref:"#/$defs/id"},description:"tunnel: routes it wraps"},regions:{type:"array",items:{$ref:"#/$defs/region"}},motion:{$ref:"#/$defs/motion"},variants:{$ref:"#/$defs/variants"},nodes:{type:"array",items:{$ref:"#/$defs/node"}}}},yn={type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:3},xp={enum:["n","e","s","w"]},Ze={type:"object",additionalProperties:!1,minProperties:1,description:"how this piece (a region: its contents too) moves when the drawing assembles or disassembles",properties:{style:{enum:["edge","drop","rise","fly","pop","scatter","build","fade"],description:"how it arrives"},out:{enum:["explode","lift-off","sink","scatter","fly-out","collapse","fade","reverse"],description:"how it leaves"},easing:{enum:["linear","ease","ease-in","ease-out","settle","spring","bounce"]},from:{enum:["left","right","top","bottom"],description:"fly: the side it comes from"},delay:{type:"number",minimum:0,description:"ms after its turn"},duration:{type:"number",exclusiveMinimum:0,description:"ms its own move takes"}}},Am={properties:{in:{$ref:"#/$defs/id"},at:{$ref:"#/$defs/point2"},"right-of":{$ref:"#/$defs/id"},"left-of":{$ref:"#/$defs/id"},below:{$ref:"#/$defs/id"},behind:{$ref:"#/$defs/id"},gap:{type:"number"},align:{$ref:"#/$defs/align"},shift:{$ref:"#/$defs/point2",description:"nudge after placement, grid units [dx, dy]"},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},Pt={type:"array",items:{type:"number"},minItems:2,maxItems:2},kp={enum:["start","center","end"]},Ye={anyOf:[{type:"string"},{type:"integer",minimum:1}]};function As(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=As.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(t.in!==void 0){let l=t.in;if(typeof l=="string"){if(!It.test(l)){let d={instancePath:e+"/in",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/in",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}if(t.at!==void 0){let l=t.at;if(Array.isArray(l)){if(l.length>2){let m={instancePath:e+"/at",schemaPath:"#/$defs/point2/maxItems",keyword:"maxItems",params:{limit:2},message:"must NOT have more than 2 items",schema:2,parentSchema:Pt,data:l};n===null?n=[m]:n.push(m),a++}if(l.length<2){let m={instancePath:e+"/at",schemaPath:"#/$defs/point2/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:Pt,data:l};n===null?n=[m]:n.push(m),a++}let d=l.length;for(let m=0;m<d;m++){let h=l[m];if(typeof h!="number"){let y={instancePath:e+"/at/"+m,schemaPath:"#/$defs/point2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Pt.items.type,parentSchema:Pt.items,data:h};n===null?n=[y]:n.push(y),a++}}}else{let d={instancePath:e+"/at",schemaPath:"#/$defs/point2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Pt.type,parentSchema:Pt,data:l};n===null?n=[d]:n.push(d),a++}}if(t["right-of"]!==void 0){let l=t["right-of"];if(typeof l=="string"){if(!It.test(l)){let d={instancePath:e+"/right-of",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/right-of",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}if(t["left-of"]!==void 0){let l=t["left-of"];if(typeof l=="string"){if(!It.test(l)){let d={instancePath:e+"/left-of",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/left-of",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}if(t.below!==void 0){let l=t.below;if(typeof l=="string"){if(!It.test(l)){let d={instancePath:e+"/below",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/below",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}if(t.behind!==void 0){let l=t.behind;if(typeof l=="string"){if(!It.test(l)){let d={instancePath:e+"/behind",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/behind",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}if(t.gap!==void 0){let l=t.gap;if(typeof l!="number"){let d={instancePath:e+"/gap",schemaPath:"#/properties/gap/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Am.properties.gap.type,parentSchema:Am.properties.gap,data:l};n===null?n=[d]:n.push(d),a++}}if(t.align!==void 0){let l=t.align;if(!(l==="start"||l==="center"||l==="end")){let d={instancePath:e+"/align",schemaPath:"#/$defs/align/enum",keyword:"enum",params:{allowedValues:kp.enum},message:"must be equal to one of the allowed values",schema:kp.enum,parentSchema:kp,data:l};n===null?n=[d]:n.push(d),a++}}if(t.shift!==void 0){let l=t.shift;if(Array.isArray(l)){if(l.length>2){let m={instancePath:e+"/shift",schemaPath:"#/$defs/point2/maxItems",keyword:"maxItems",params:{limit:2},message:"must NOT have more than 2 items",schema:2,parentSchema:Pt,data:l};n===null?n=[m]:n.push(m),a++}if(l.length<2){let m={instancePath:e+"/shift",schemaPath:"#/$defs/point2/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:Pt,data:l};n===null?n=[m]:n.push(m),a++}let d=l.length;for(let m=0;m<d;m++){let h=l[m];if(typeof h!="number"){let y={instancePath:e+"/shift/"+m,schemaPath:"#/$defs/point2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Pt.items.type,parentSchema:Pt.items,data:h};n===null?n=[y]:n.push(y),a++}}}else{let d={instancePath:e+"/shift",schemaPath:"#/$defs/point2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Pt.type,parentSchema:Pt,data:l};n===null?n=[d]:n.push(d),a++}}if(t.appears!==void 0){let l=t.appears,d=a,m=!1,h=a;if(typeof l!="string"){let g={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ye.anyOf[0].type,parentSchema:Ye.anyOf[0],data:l};n===null?n=[g]:n.push(g),a++}var p=h===a;m=m||p;let y=a;if(!(typeof l=="number"&&!(l%1)&&!isNaN(l))){let g={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Ye.anyOf[1].type,parentSchema:Ye.anyOf[1],data:l};n===null?n=[g]:n.push(g),a++}if(typeof l=="number"&&(l<1||isNaN(l))){let g={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Ye.anyOf[1],data:l};n===null?n=[g]:n.push(g),a++}var p=y===a;if(m=m||p,m)a=d,n!==null&&(d?n.length=d:n=null);else{let g={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Ye.anyOf,parentSchema:Ye,data:l};n===null?n=[g]:n.push(g),a++}}if(t.disappears!==void 0){let l=t.disappears,d=a,m=!1,h=a;if(typeof l!="string"){let g={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ye.anyOf[0].type,parentSchema:Ye.anyOf[0],data:l};n===null?n=[g]:n.push(g),a++}var c=h===a;m=m||c;let y=a;if(!(typeof l=="number"&&!(l%1)&&!isNaN(l))){let g={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Ye.anyOf[1].type,parentSchema:Ye.anyOf[1],data:l};n===null?n=[g]:n.push(g),a++}if(typeof l=="number"&&(l<1||isNaN(l))){let g={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Ye.anyOf[1],data:l};n===null?n=[g]:n.push(g),a++}var c=y===a;if(m=m||c,m)a=d,n!==null&&(d?n.length=d:n=null);else{let g={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Ye.anyOf,parentSchema:Ye,data:l};n===null?n=[g]:n.push(g),a++}}}return As.errors=n,a===0}As.evaluated={props:{in:!0,at:!0,"right-of":!0,"left-of":!0,below:!0,behind:!0,gap:!0,align:!0,shift:!0,appears:!0,disappears:!0},dynamicProps:!1,dynamicItems:!1};var Nt={type:"object",minProperties:1,propertyNames:{$ref:"#/$defs/id"},description:"other looks of it, by name, for a motion to switch to (its box stays as it is)",additionalProperties:{type:"object",additionalProperties:!1,minProperties:1,properties:{role:{type:"string"},ghost:{type:"boolean"},label:{type:"string"},sub:{type:"string"},face:{type:"string",pattern:"^[a-z][a-z0-9-]*$"},deco:{type:"array",items:{$ref:"#/$defs/deco"}}}}},Je={anyOf:[{enum:["envelope","bubble","file-lines","ghost","terminal"]},{type:"object",additionalProperties:!1,minProperties:1,maxProperties:1,properties:{terminal:{type:"integer",minimum:1,maximum:8},icon:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"an icon the host registers (none by default); one nothing registers is drawn as a placeholder, with a warning"},screen:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"terminal, chat, desktop, tiles, or a face the host registers"}}}]},ei=new RegExp("^[a-z][a-z0-9-]*$","u");function Ts(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=Ts.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(Object.keys(t).length<1){let l={instancePath:e,schemaPath:"#/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Nt,data:t};n===null?n=[l]:n.push(l),a++}for(let l in t){let d=a;if(typeof l=="string"){if(!It.test(l)){let m={instancePath:e,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:l,propertyName:l};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:l,propertyName:l};n===null?n=[m]:n.push(m),a++}var p=d===a;if(!p){let m={instancePath:e,schemaPath:"#/propertyNames",keyword:"propertyNames",params:{propertyName:l},message:"property name must be valid",schema:Nt.propertyNames,parentSchema:Nt,data:t};n===null?n=[m]:n.push(m),a++}}for(let l in t){let d=t[l];if(d&&typeof d=="object"&&!Array.isArray(d)){if(Object.keys(d).length<1){let m={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/additionalProperties/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Nt.additionalProperties,data:d};n===null?n=[m]:n.push(m),a++}for(let m in d)if(!(m==="role"||m==="ghost"||m==="label"||m==="sub"||m==="face"||m==="deco")){let h={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/additionalProperties/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:m},message:"must NOT have additional properties",schema:!1,parentSchema:Nt.additionalProperties,data:d};n===null?n=[h]:n.push(h),a++}if(d.role!==void 0){let m=d.role;if(typeof m!="string"){let h={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/role",schemaPath:"#/additionalProperties/properties/role/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Nt.additionalProperties.properties.role.type,parentSchema:Nt.additionalProperties.properties.role,data:m};n===null?n=[h]:n.push(h),a++}}if(d.ghost!==void 0){let m=d.ghost;if(typeof m!="boolean"){let h={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/ghost",schemaPath:"#/additionalProperties/properties/ghost/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Nt.additionalProperties.properties.ghost.type,parentSchema:Nt.additionalProperties.properties.ghost,data:m};n===null?n=[h]:n.push(h),a++}}if(d.label!==void 0){let m=d.label;if(typeof m!="string"){let h={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/label",schemaPath:"#/additionalProperties/properties/label/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Nt.additionalProperties.properties.label.type,parentSchema:Nt.additionalProperties.properties.label,data:m};n===null?n=[h]:n.push(h),a++}}if(d.sub!==void 0){let m=d.sub;if(typeof m!="string"){let h={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/sub",schemaPath:"#/additionalProperties/properties/sub/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Nt.additionalProperties.properties.sub.type,parentSchema:Nt.additionalProperties.properties.sub,data:m};n===null?n=[h]:n.push(h),a++}}if(d.face!==void 0){let m=d.face;if(typeof m=="string"){if(!ei.test(m)){let h={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/face",schemaPath:"#/additionalProperties/properties/face/pattern",keyword:"pattern",params:{pattern:"^[a-z][a-z0-9-]*$"},message:'must match pattern "^[a-z][a-z0-9-]*$"',schema:"^[a-z][a-z0-9-]*$",parentSchema:Nt.additionalProperties.properties.face,data:m};n===null?n=[h]:n.push(h),a++}}else{let h={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/face",schemaPath:"#/additionalProperties/properties/face/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Nt.additionalProperties.properties.face.type,parentSchema:Nt.additionalProperties.properties.face,data:m};n===null?n=[h]:n.push(h),a++}}if(d.deco!==void 0){let m=d.deco;if(Array.isArray(m)){let h=m.length;for(let y=0;y<h;y++){let g=m[y],k=a,u=!1,b=a;if(!(g==="envelope"||g==="bubble"||g==="file-lines"||g==="ghost"||g==="terminal")){let w={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y,schemaPath:"#/$defs/deco/anyOf/0/enum",keyword:"enum",params:{allowedValues:Je.anyOf[0].enum},message:"must be equal to one of the allowed values",schema:Je.anyOf[0].enum,parentSchema:Je.anyOf[0],data:g};n===null?n=[w]:n.push(w),a++}var c=b===a;u=u||c;let x=a;if(g&&typeof g=="object"&&!Array.isArray(g)){if(Object.keys(g).length>1){let w={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y,schemaPath:"#/$defs/deco/anyOf/1/maxProperties",keyword:"maxProperties",params:{limit:1},message:"must NOT have more than 1 properties",schema:1,parentSchema:Je.anyOf[1],data:g};n===null?n=[w]:n.push(w),a++}if(Object.keys(g).length<1){let w={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y,schemaPath:"#/$defs/deco/anyOf/1/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Je.anyOf[1],data:g};n===null?n=[w]:n.push(w),a++}for(let w in g)if(!(w==="terminal"||w==="icon"||w==="screen")){let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y,schemaPath:"#/$defs/deco/anyOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:w},message:"must NOT have additional properties",schema:!1,parentSchema:Je.anyOf[1],data:g};n===null?n=[$]:n.push($),a++}if(g.terminal!==void 0){let w=g.terminal;if(!(typeof w=="number"&&!(w%1)&&!isNaN(w))){let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Je.anyOf[1].properties.terminal.type,parentSchema:Je.anyOf[1].properties.terminal,data:w};n===null?n=[$]:n.push($),a++}if(typeof w=="number"){if(w>8||isNaN(w)){let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/maximum",keyword:"maximum",params:{comparison:"<=",limit:8},message:"must be <= 8",schema:8,parentSchema:Je.anyOf[1].properties.terminal,data:w};n===null?n=[$]:n.push($),a++}if(w<1||isNaN(w)){let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Je.anyOf[1].properties.terminal,data:w};n===null?n=[$]:n.push($),a++}}}if(g.icon!==void 0){let w=g.icon;if(typeof w=="string"){if(!ei.test(w)){let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/icon",schemaPath:"#/$defs/deco/anyOf/1/properties/icon/pattern",keyword:"pattern",params:{pattern:"^[a-z][a-z0-9-]*$"},message:'must match pattern "^[a-z][a-z0-9-]*$"',schema:"^[a-z][a-z0-9-]*$",parentSchema:Je.anyOf[1].properties.icon,data:w};n===null?n=[$]:n.push($),a++}}else{let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/icon",schemaPath:"#/$defs/deco/anyOf/1/properties/icon/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Je.anyOf[1].properties.icon.type,parentSchema:Je.anyOf[1].properties.icon,data:w};n===null?n=[$]:n.push($),a++}}if(g.screen!==void 0){let w=g.screen;if(typeof w=="string"){if(!ei.test(w)){let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/screen",schemaPath:"#/$defs/deco/anyOf/1/properties/screen/pattern",keyword:"pattern",params:{pattern:"^[a-z][a-z0-9-]*$"},message:'must match pattern "^[a-z][a-z0-9-]*$"',schema:"^[a-z][a-z0-9-]*$",parentSchema:Je.anyOf[1].properties.screen,data:w};n===null?n=[$]:n.push($),a++}}else{let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/screen",schemaPath:"#/$defs/deco/anyOf/1/properties/screen/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Je.anyOf[1].properties.screen.type,parentSchema:Je.anyOf[1].properties.screen,data:w};n===null?n=[$]:n.push($),a++}}}else{let w={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y,schemaPath:"#/$defs/deco/anyOf/1/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Je.anyOf[1].type,parentSchema:Je.anyOf[1],data:g};n===null?n=[w]:n.push(w),a++}var c=x===a;if(u=u||c,u)a=k,n!==null&&(k?n.length=k:n=null);else{let w={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y,schemaPath:"#/$defs/deco/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Je.anyOf,parentSchema:Je,data:g};n===null?n=[w]:n.push(w),a++}}}else{let h={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco",schemaPath:"#/additionalProperties/properties/deco/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Nt.additionalProperties.properties.deco.type,parentSchema:Nt.additionalProperties.properties.deco,data:m};n===null?n=[h]:n.push(h),a++}}}else{let m={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/additionalProperties/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Nt.additionalProperties.type,parentSchema:Nt.additionalProperties,data:d};n===null?n=[m]:n.push(m),a++}}}else{let l={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Nt.type,parentSchema:Nt,data:t};n===null?n=[l]:n.push(l),a++}return Ts.errors=n,a===0}Ts.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var et={type:"object",required:["id"],unevaluatedProperties:!1,allOf:[{$ref:"#/$defs/placement"}],properties:{id:{$ref:"#/$defs/id"},asset:{type:"string",description:"asset name from the library; default 'block'"},role:{type:"string",description:"colour role"},label:{type:"string"},sub:{type:"string"},size:{$ref:"#/$defs/size2or3"},z:{type:"number",description:"lift above the floor it stands on"},deco:{type:"array",items:{$ref:"#/$defs/deco"}},ghost:{type:"boolean"},face:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"screen asset: what the screen shows: terminal, chat, desktop, tiles, or a face the host registers"},facing:{type:"number",description:"screen asset: rotation in degrees"},"label-at":{type:"object",additionalProperties:!1,properties:{side:{enum:["above","right","left","below"]},dx:{type:"number"},dy:{type:"number"}}},motion:{$ref:"#/$defs/motion"},variants:{$ref:"#/$defs/variants"},nodes:{type:"array",items:{$ref:"#/$defs/node"},description:"nodes standing on top of this one"}}},$p={validate:hs};function hs(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=hs.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),As(t,{instancePath:e,parentData:s,parentDataProperty:r,rootData:i,dynamicAnchors:o})||(n=n===null?As.errors:n.concat(As.errors),a=n.length),t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let c={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'",schema:et.required,parentSchema:et,data:t};n===null?n=[c]:n.push(c),a++}if(t.id!==void 0){let c=t.id;if(typeof c=="string"){if(!It.test(c)){let l={instancePath:e+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:c};n===null?n=[l]:n.push(l),a++}}if(t.asset!==void 0){let c=t.asset;if(typeof c!="string"){let l={instancePath:e+"/asset",schemaPath:"#/properties/asset/type",keyword:"type",params:{type:"string"},message:"must be string",schema:et.properties.asset.type,parentSchema:et.properties.asset,data:c};n===null?n=[l]:n.push(l),a++}}if(t.role!==void 0){let c=t.role;if(typeof c!="string"){let l={instancePath:e+"/role",schemaPath:"#/properties/role/type",keyword:"type",params:{type:"string"},message:"must be string",schema:et.properties.role.type,parentSchema:et.properties.role,data:c};n===null?n=[l]:n.push(l),a++}}if(t.label!==void 0){let c=t.label;if(typeof c!="string"){let l={instancePath:e+"/label",schemaPath:"#/properties/label/type",keyword:"type",params:{type:"string"},message:"must be string",schema:et.properties.label.type,parentSchema:et.properties.label,data:c};n===null?n=[l]:n.push(l),a++}}if(t.sub!==void 0){let c=t.sub;if(typeof c!="string"){let l={instancePath:e+"/sub",schemaPath:"#/properties/sub/type",keyword:"type",params:{type:"string"},message:"must be string",schema:et.properties.sub.type,parentSchema:et.properties.sub,data:c};n===null?n=[l]:n.push(l),a++}}if(t.size!==void 0){let c=t.size;if(Array.isArray(c)){if(c.length>3){let d={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:yn,data:c};n===null?n=[d]:n.push(d),a++}if(c.length<2){let d={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:yn,data:c};n===null?n=[d]:n.push(d),a++}let l=c.length;for(let d=0;d<l;d++){let m=c[d];if(typeof m=="number"){if(m<=0||isNaN(m)){let h={instancePath:e+"/size/"+d,schemaPath:"#/$defs/size2or3/items/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:yn.items,data:m};n===null?n=[h]:n.push(h),a++}}else{let h={instancePath:e+"/size/"+d,schemaPath:"#/$defs/size2or3/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:yn.items.type,parentSchema:yn.items,data:m};n===null?n=[h]:n.push(h),a++}}}else{let l={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/type",keyword:"type",params:{type:"array"},message:"must be array",schema:yn.type,parentSchema:yn,data:c};n===null?n=[l]:n.push(l),a++}}if(t.z!==void 0){let c=t.z;if(typeof c!="number"){let l={instancePath:e+"/z",schemaPath:"#/properties/z/type",keyword:"type",params:{type:"number"},message:"must be number",schema:et.properties.z.type,parentSchema:et.properties.z,data:c};n===null?n=[l]:n.push(l),a++}}if(t.deco!==void 0){let c=t.deco;if(Array.isArray(c)){let l=c.length;for(let d=0;d<l;d++){let m=c[d],h=a,y=!1,g=a;if(!(m==="envelope"||m==="bubble"||m==="file-lines"||m==="ghost"||m==="terminal")){let u={instancePath:e+"/deco/"+d,schemaPath:"#/$defs/deco/anyOf/0/enum",keyword:"enum",params:{allowedValues:Je.anyOf[0].enum},message:"must be equal to one of the allowed values",schema:Je.anyOf[0].enum,parentSchema:Je.anyOf[0],data:m};n===null?n=[u]:n.push(u),a++}var p=g===a;y=y||p;let k=a;if(m&&typeof m=="object"&&!Array.isArray(m)){if(Object.keys(m).length>1){let u={instancePath:e+"/deco/"+d,schemaPath:"#/$defs/deco/anyOf/1/maxProperties",keyword:"maxProperties",params:{limit:1},message:"must NOT have more than 1 properties",schema:1,parentSchema:Je.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}if(Object.keys(m).length<1){let u={instancePath:e+"/deco/"+d,schemaPath:"#/$defs/deco/anyOf/1/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Je.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}for(let u in m)if(!(u==="terminal"||u==="icon"||u==="screen")){let b={instancePath:e+"/deco/"+d,schemaPath:"#/$defs/deco/anyOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:u},message:"must NOT have additional properties",schema:!1,parentSchema:Je.anyOf[1],data:m};n===null?n=[b]:n.push(b),a++}if(m.terminal!==void 0){let u=m.terminal;if(!(typeof u=="number"&&!(u%1)&&!isNaN(u))){let b={instancePath:e+"/deco/"+d+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Je.anyOf[1].properties.terminal.type,parentSchema:Je.anyOf[1].properties.terminal,data:u};n===null?n=[b]:n.push(b),a++}if(typeof u=="number"){if(u>8||isNaN(u)){let b={instancePath:e+"/deco/"+d+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/maximum",keyword:"maximum",params:{comparison:"<=",limit:8},message:"must be <= 8",schema:8,parentSchema:Je.anyOf[1].properties.terminal,data:u};n===null?n=[b]:n.push(b),a++}if(u<1||isNaN(u)){let b={instancePath:e+"/deco/"+d+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Je.anyOf[1].properties.terminal,data:u};n===null?n=[b]:n.push(b),a++}}}if(m.icon!==void 0){let u=m.icon;if(typeof u=="string"){if(!ei.test(u)){let b={instancePath:e+"/deco/"+d+"/icon",schemaPath:"#/$defs/deco/anyOf/1/properties/icon/pattern",keyword:"pattern",params:{pattern:"^[a-z][a-z0-9-]*$"},message:'must match pattern "^[a-z][a-z0-9-]*$"',schema:"^[a-z][a-z0-9-]*$",parentSchema:Je.anyOf[1].properties.icon,data:u};n===null?n=[b]:n.push(b),a++}}else{let b={instancePath:e+"/deco/"+d+"/icon",schemaPath:"#/$defs/deco/anyOf/1/properties/icon/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Je.anyOf[1].properties.icon.type,parentSchema:Je.anyOf[1].properties.icon,data:u};n===null?n=[b]:n.push(b),a++}}if(m.screen!==void 0){let u=m.screen;if(typeof u=="string"){if(!ei.test(u)){let b={instancePath:e+"/deco/"+d+"/screen",schemaPath:"#/$defs/deco/anyOf/1/properties/screen/pattern",keyword:"pattern",params:{pattern:"^[a-z][a-z0-9-]*$"},message:'must match pattern "^[a-z][a-z0-9-]*$"',schema:"^[a-z][a-z0-9-]*$",parentSchema:Je.anyOf[1].properties.screen,data:u};n===null?n=[b]:n.push(b),a++}}else{let b={instancePath:e+"/deco/"+d+"/screen",schemaPath:"#/$defs/deco/anyOf/1/properties/screen/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Je.anyOf[1].properties.screen.type,parentSchema:Je.anyOf[1].properties.screen,data:u};n===null?n=[b]:n.push(b),a++}}}else{let u={instancePath:e+"/deco/"+d,schemaPath:"#/$defs/deco/anyOf/1/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Je.anyOf[1].type,parentSchema:Je.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}var p=k===a;if(y=y||p,y)a=h,n!==null&&(h?n.length=h:n=null);else{let u={instancePath:e+"/deco/"+d,schemaPath:"#/$defs/deco/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Je.anyOf,parentSchema:Je,data:m};n===null?n=[u]:n.push(u),a++}}}else{let l={instancePath:e+"/deco",schemaPath:"#/properties/deco/type",keyword:"type",params:{type:"array"},message:"must be array",schema:et.properties.deco.type,parentSchema:et.properties.deco,data:c};n===null?n=[l]:n.push(l),a++}}if(t.ghost!==void 0){let c=t.ghost;if(typeof c!="boolean"){let l={instancePath:e+"/ghost",schemaPath:"#/properties/ghost/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:et.properties.ghost.type,parentSchema:et.properties.ghost,data:c};n===null?n=[l]:n.push(l),a++}}if(t.face!==void 0){let c=t.face;if(typeof c=="string"){if(!ei.test(c)){let l={instancePath:e+"/face",schemaPath:"#/properties/face/pattern",keyword:"pattern",params:{pattern:"^[a-z][a-z0-9-]*$"},message:'must match pattern "^[a-z][a-z0-9-]*$"',schema:"^[a-z][a-z0-9-]*$",parentSchema:et.properties.face,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/face",schemaPath:"#/properties/face/type",keyword:"type",params:{type:"string"},message:"must be string",schema:et.properties.face.type,parentSchema:et.properties.face,data:c};n===null?n=[l]:n.push(l),a++}}if(t.facing!==void 0){let c=t.facing;if(typeof c!="number"){let l={instancePath:e+"/facing",schemaPath:"#/properties/facing/type",keyword:"type",params:{type:"number"},message:"must be number",schema:et.properties.facing.type,parentSchema:et.properties.facing,data:c};n===null?n=[l]:n.push(l),a++}}if(t["label-at"]!==void 0){let c=t["label-at"];if(c&&typeof c=="object"&&!Array.isArray(c)){for(let l in c)if(!(l==="side"||l==="dx"||l==="dy")){let d={instancePath:e+"/label-at",schemaPath:"#/properties/label-at/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:l},message:"must NOT have additional properties",schema:!1,parentSchema:et.properties["label-at"],data:c};n===null?n=[d]:n.push(d),a++}if(c.side!==void 0){let l=c.side;if(!(l==="above"||l==="right"||l==="left"||l==="below")){let d={instancePath:e+"/label-at/side",schemaPath:"#/properties/label-at/properties/side/enum",keyword:"enum",params:{allowedValues:et.properties["label-at"].properties.side.enum},message:"must be equal to one of the allowed values",schema:et.properties["label-at"].properties.side.enum,parentSchema:et.properties["label-at"].properties.side,data:l};n===null?n=[d]:n.push(d),a++}}if(c.dx!==void 0){let l=c.dx;if(typeof l!="number"){let d={instancePath:e+"/label-at/dx",schemaPath:"#/properties/label-at/properties/dx/type",keyword:"type",params:{type:"number"},message:"must be number",schema:et.properties["label-at"].properties.dx.type,parentSchema:et.properties["label-at"].properties.dx,data:l};n===null?n=[d]:n.push(d),a++}}if(c.dy!==void 0){let l=c.dy;if(typeof l!="number"){let d={instancePath:e+"/label-at/dy",schemaPath:"#/properties/label-at/properties/dy/type",keyword:"type",params:{type:"number"},message:"must be number",schema:et.properties["label-at"].properties.dy.type,parentSchema:et.properties["label-at"].properties.dy,data:l};n===null?n=[d]:n.push(d),a++}}}else{let l={instancePath:e+"/label-at",schemaPath:"#/properties/label-at/type",keyword:"type",params:{type:"object"},message:"must be object",schema:et.properties["label-at"].type,parentSchema:et.properties["label-at"],data:c};n===null?n=[l]:n.push(l),a++}}if(t.motion!==void 0){let c=t.motion;if(c&&typeof c=="object"&&!Array.isArray(c)){if(Object.keys(c).length<1){let l={instancePath:e+"/motion",schemaPath:"#/$defs/motion/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Ze,data:c};n===null?n=[l]:n.push(l),a++}for(let l in c)if(!(l==="style"||l==="out"||l==="easing"||l==="from"||l==="delay"||l==="duration")){let d={instancePath:e+"/motion",schemaPath:"#/$defs/motion/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:l},message:"must NOT have additional properties",schema:!1,parentSchema:Ze,data:c};n===null?n=[d]:n.push(d),a++}if(c.style!==void 0){let l=c.style;if(!(l==="edge"||l==="drop"||l==="rise"||l==="fly"||l==="pop"||l==="scatter"||l==="build"||l==="fade")){let d={instancePath:e+"/motion/style",schemaPath:"#/$defs/motion/properties/style/enum",keyword:"enum",params:{allowedValues:Ze.properties.style.enum},message:"must be equal to one of the allowed values",schema:Ze.properties.style.enum,parentSchema:Ze.properties.style,data:l};n===null?n=[d]:n.push(d),a++}}if(c.out!==void 0){let l=c.out;if(!(l==="explode"||l==="lift-off"||l==="sink"||l==="scatter"||l==="fly-out"||l==="collapse"||l==="fade"||l==="reverse")){let d={instancePath:e+"/motion/out",schemaPath:"#/$defs/motion/properties/out/enum",keyword:"enum",params:{allowedValues:Ze.properties.out.enum},message:"must be equal to one of the allowed values",schema:Ze.properties.out.enum,parentSchema:Ze.properties.out,data:l};n===null?n=[d]:n.push(d),a++}}if(c.easing!==void 0){let l=c.easing;if(!(l==="linear"||l==="ease"||l==="ease-in"||l==="ease-out"||l==="settle"||l==="spring"||l==="bounce")){let d={instancePath:e+"/motion/easing",schemaPath:"#/$defs/motion/properties/easing/enum",keyword:"enum",params:{allowedValues:Ze.properties.easing.enum},message:"must be equal to one of the allowed values",schema:Ze.properties.easing.enum,parentSchema:Ze.properties.easing,data:l};n===null?n=[d]:n.push(d),a++}}if(c.from!==void 0){let l=c.from;if(!(l==="left"||l==="right"||l==="top"||l==="bottom")){let d={instancePath:e+"/motion/from",schemaPath:"#/$defs/motion/properties/from/enum",keyword:"enum",params:{allowedValues:Ze.properties.from.enum},message:"must be equal to one of the allowed values",schema:Ze.properties.from.enum,parentSchema:Ze.properties.from,data:l};n===null?n=[d]:n.push(d),a++}}if(c.delay!==void 0){let l=c.delay;if(typeof l=="number"){if(l<0||isNaN(l)){let d={instancePath:e+"/motion/delay",schemaPath:"#/$defs/motion/properties/delay/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:Ze.properties.delay,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/motion/delay",schemaPath:"#/$defs/motion/properties/delay/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Ze.properties.delay.type,parentSchema:Ze.properties.delay,data:l};n===null?n=[d]:n.push(d),a++}}if(c.duration!==void 0){let l=c.duration;if(typeof l=="number"){if(l<=0||isNaN(l)){let d={instancePath:e+"/motion/duration",schemaPath:"#/$defs/motion/properties/duration/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Ze.properties.duration,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/motion/duration",schemaPath:"#/$defs/motion/properties/duration/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Ze.properties.duration.type,parentSchema:Ze.properties.duration,data:l};n===null?n=[d]:n.push(d),a++}}}else{let l={instancePath:e+"/motion",schemaPath:"#/$defs/motion/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Ze.type,parentSchema:Ze,data:c};n===null?n=[l]:n.push(l),a++}}if(t.variants!==void 0&&(Ts(t.variants,{instancePath:e+"/variants",parentData:t,parentDataProperty:"variants",rootData:i,dynamicAnchors:o})||(n=n===null?Ts.errors:n.concat(Ts.errors),a=n.length)),t.nodes!==void 0){let c=t.nodes;if(Array.isArray(c)){let l=c.length;for(let d=0;d<l;d++)$p.validate(c[d],{instancePath:e+"/nodes/"+d,parentData:c,parentDataProperty:d,rootData:i,dynamicAnchors:o})||(n=n===null?$p.validate.errors:n.concat($p.validate.errors),a=n.length)}else{let l={instancePath:e+"/nodes",schemaPath:"#/properties/nodes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:et.properties.nodes.type,parentSchema:et.properties.nodes,data:c};n===null?n=[l]:n.push(l),a++}}for(let c in t)if(c!=="id"&&c!=="asset"&&c!=="role"&&c!=="label"&&c!=="sub"&&c!=="size"&&c!=="z"&&c!=="deco"&&c!=="ghost"&&c!=="face"&&c!=="facing"&&c!=="label-at"&&c!=="motion"&&c!=="variants"&&c!=="nodes"&&c!=="in"&&c!=="at"&&c!=="right-of"&&c!=="left-of"&&c!=="below"&&c!=="behind"&&c!=="gap"&&c!=="align"&&c!=="shift"&&c!=="appears"&&c!=="disappears"){let l={instancePath:e,schemaPath:"#/unevaluatedProperties",keyword:"unevaluatedProperties",params:{unevaluatedProperty:c},message:"must NOT have unevaluated properties",schema:!1,parentSchema:et,data:t};n===null?n=[l]:n.push(l),a++}}else{let c={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:et.type,parentSchema:et,data:t};n===null?n=[c]:n.push(c),a++}return hs.errors=n,a===0}hs.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var Sp={validate:mr};function mr(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=mr.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),As(t,{instancePath:e,parentData:s,parentDataProperty:r,rootData:i,dynamicAnchors:o})||(n=n===null?As.errors:n.concat(As.errors),a=n.length),t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let p={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'",schema:Fe.required,parentSchema:Fe,data:t};n===null?n=[p]:n.push(p),a++}if(t.kind===void 0){let p={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"kind"},message:"must have required property 'kind'",schema:Fe.required,parentSchema:Fe,data:t};n===null?n=[p]:n.push(p),a++}if(t.id!==void 0){let p=t.id;if(typeof p=="string"){if(!It.test(p)){let c={instancePath:e+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:p};n===null?n=[c]:n.push(c),a++}}else{let c={instancePath:e+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:p};n===null?n=[c]:n.push(c),a++}}if(t.kind!==void 0){let p=t.kind;if(!(p==="slab"||p==="pad"||p==="fence"||p==="vm"||p==="cloud"||p==="zone"||p==="platform"||p==="tunnel")){let c={instancePath:e+"/kind",schemaPath:"#/properties/kind/enum",keyword:"enum",params:{allowedValues:Fe.properties.kind.enum},message:"must be equal to one of the allowed values",schema:Fe.properties.kind.enum,parentSchema:Fe.properties.kind,data:p};n===null?n=[c]:n.push(c),a++}}if(t.label!==void 0){let p=t.label;if(typeof p!="string"){let c={instancePath:e+"/label",schemaPath:"#/properties/label/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Fe.properties.label.type,parentSchema:Fe.properties.label,data:p};n===null?n=[c]:n.push(c),a++}}if(t["label-style"]!==void 0){let p=t["label-style"];if(!(p==="face"||p==="face-right"||p==="floor"||p==="none")){let c={instancePath:e+"/label-style",schemaPath:"#/properties/label-style/enum",keyword:"enum",params:{allowedValues:Fe.properties["label-style"].enum},message:"must be equal to one of the allowed values",schema:Fe.properties["label-style"].enum,parentSchema:Fe.properties["label-style"],data:p};n===null?n=[c]:n.push(c),a++}}if(t.ghost!==void 0){let p=t.ghost;if(typeof p!="boolean"){let c={instancePath:e+"/ghost",schemaPath:"#/properties/ghost/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Fe.properties.ghost.type,parentSchema:Fe.properties.ghost,data:p};n===null?n=[c]:n.push(c),a++}}if(t.role!==void 0){let p=t.role;if(typeof p!="string"){let c={instancePath:e+"/role",schemaPath:"#/properties/role/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Fe.properties.role.type,parentSchema:Fe.properties.role,data:p};n===null?n=[c]:n.push(c),a++}}if(t.size!==void 0){let p=t.size;if(Array.isArray(p)){if(p.length>3){let l={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:yn,data:p};n===null?n=[l]:n.push(l),a++}if(p.length<2){let l={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:yn,data:p};n===null?n=[l]:n.push(l),a++}let c=p.length;for(let l=0;l<c;l++){let d=p[l];if(typeof d=="number"){if(d<=0||isNaN(d)){let m={instancePath:e+"/size/"+l,schemaPath:"#/$defs/size2or3/items/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:yn.items,data:d};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e+"/size/"+l,schemaPath:"#/$defs/size2or3/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:yn.items.type,parentSchema:yn.items,data:d};n===null?n=[m]:n.push(m),a++}}}else{let c={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/type",keyword:"type",params:{type:"array"},message:"must be array",schema:yn.type,parentSchema:yn,data:p};n===null?n=[c]:n.push(c),a++}}if(t.padding!==void 0){let p=t.padding;if(typeof p=="number"){if(p<0||isNaN(p)){let c={instancePath:e+"/padding",schemaPath:"#/properties/padding/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:Fe.properties.padding,data:p};n===null?n=[c]:n.push(c),a++}}else{let c={instancePath:e+"/padding",schemaPath:"#/properties/padding/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Fe.properties.padding.type,parentSchema:Fe.properties.padding,data:p};n===null?n=[c]:n.push(c),a++}}if(t.height!==void 0){let p=t.height;if(typeof p=="number"){if(p<=0||isNaN(p)){let c={instancePath:e+"/height",schemaPath:"#/properties/height/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Fe.properties.height,data:p};n===null?n=[c]:n.push(c),a++}}else{let c={instancePath:e+"/height",schemaPath:"#/properties/height/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Fe.properties.height.type,parentSchema:Fe.properties.height,data:p};n===null?n=[c]:n.push(c),a++}}if(t.z!==void 0){let p=t.z;if(typeof p!="number"){let c={instancePath:e+"/z",schemaPath:"#/properties/z/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Fe.properties.z.type,parentSchema:Fe.properties.z,data:p};n===null?n=[c]:n.push(c),a++}}if(t.flow!==void 0){let p=t.flow;if(!(p==="row"||p==="column")){let c={instancePath:e+"/flow",schemaPath:"#/properties/flow/enum",keyword:"enum",params:{allowedValues:Fe.properties.flow.enum},message:"must be equal to one of the allowed values",schema:Fe.properties.flow.enum,parentSchema:Fe.properties.flow,data:p};n===null?n=[c]:n.push(c),a++}}if(t.gate!==void 0){let p=t.gate;if(p&&typeof p=="object"&&!Array.isArray(p)){if(p.side===void 0){let c={instancePath:e+"/gate",schemaPath:"#/properties/gate/required",keyword:"required",params:{missingProperty:"side"},message:"must have required property 'side'",schema:Fe.properties.gate.required,parentSchema:Fe.properties.gate,data:p};n===null?n=[c]:n.push(c),a++}for(let c in p)if(!(c==="side"||c==="at"||c==="width"||c==="height"||c==="node")){let l={instancePath:e+"/gate",schemaPath:"#/properties/gate/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:c},message:"must NOT have additional properties",schema:!1,parentSchema:Fe.properties.gate,data:p};n===null?n=[l]:n.push(l),a++}if(p.side!==void 0){let c=p.side;if(!(c==="n"||c==="e"||c==="s"||c==="w")){let l={instancePath:e+"/gate/side",schemaPath:"#/$defs/side/enum",keyword:"enum",params:{allowedValues:xp.enum},message:"must be equal to one of the allowed values",schema:xp.enum,parentSchema:xp,data:c};n===null?n=[l]:n.push(l),a++}}if(p.at!==void 0){let c=p.at;if(typeof c=="number"){if(c>1||isNaN(c)){let l={instancePath:e+"/gate/at",schemaPath:"#/properties/gate/properties/at/maximum",keyword:"maximum",params:{comparison:"<=",limit:1},message:"must be <= 1",schema:1,parentSchema:Fe.properties.gate.properties.at,data:c};n===null?n=[l]:n.push(l),a++}if(c<0||isNaN(c)){let l={instancePath:e+"/gate/at",schemaPath:"#/properties/gate/properties/at/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:Fe.properties.gate.properties.at,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/gate/at",schemaPath:"#/properties/gate/properties/at/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Fe.properties.gate.properties.at.type,parentSchema:Fe.properties.gate.properties.at,data:c};n===null?n=[l]:n.push(l),a++}}if(p.width!==void 0){let c=p.width;if(typeof c=="number"){if(c<=0||isNaN(c)){let l={instancePath:e+"/gate/width",schemaPath:"#/properties/gate/properties/width/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Fe.properties.gate.properties.width,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/gate/width",schemaPath:"#/properties/gate/properties/width/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Fe.properties.gate.properties.width.type,parentSchema:Fe.properties.gate.properties.width,data:c};n===null?n=[l]:n.push(l),a++}}if(p.height!==void 0){let c=p.height;if(typeof c=="number"){if(c<=0||isNaN(c)){let l={instancePath:e+"/gate/height",schemaPath:"#/properties/gate/properties/height/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Fe.properties.gate.properties.height,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/gate/height",schemaPath:"#/properties/gate/properties/height/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Fe.properties.gate.properties.height.type,parentSchema:Fe.properties.gate.properties.height,data:c};n===null?n=[l]:n.push(l),a++}}if(p.node!==void 0){let c=p.node;if(typeof c=="string"){if(!It.test(c)){let l={instancePath:e+"/gate/node",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/gate/node",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:c};n===null?n=[l]:n.push(l),a++}}}else{let c={instancePath:e+"/gate",schemaPath:"#/properties/gate/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Fe.properties.gate.type,parentSchema:Fe.properties.gate,data:p};n===null?n=[c]:n.push(c),a++}}if(t.around!==void 0){let p=t.around;if(Array.isArray(p)){let c=p.length;for(let l=0;l<c;l++){let d=p[l];if(typeof d=="string"){if(!It.test(d)){let m={instancePath:e+"/around/"+l,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:d};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e+"/around/"+l,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:d};n===null?n=[m]:n.push(m),a++}}}else{let c={instancePath:e+"/around",schemaPath:"#/properties/around/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Fe.properties.around.type,parentSchema:Fe.properties.around,data:p};n===null?n=[c]:n.push(c),a++}}if(t.regions!==void 0){let p=t.regions;if(Array.isArray(p)){let c=p.length;for(let l=0;l<c;l++)Sp.validate(p[l],{instancePath:e+"/regions/"+l,parentData:p,parentDataProperty:l,rootData:i,dynamicAnchors:o})||(n=n===null?Sp.validate.errors:n.concat(Sp.validate.errors),a=n.length)}else{let c={instancePath:e+"/regions",schemaPath:"#/properties/regions/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Fe.properties.regions.type,parentSchema:Fe.properties.regions,data:p};n===null?n=[c]:n.push(c),a++}}if(t.motion!==void 0){let p=t.motion;if(p&&typeof p=="object"&&!Array.isArray(p)){if(Object.keys(p).length<1){let c={instancePath:e+"/motion",schemaPath:"#/$defs/motion/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Ze,data:p};n===null?n=[c]:n.push(c),a++}for(let c in p)if(!(c==="style"||c==="out"||c==="easing"||c==="from"||c==="delay"||c==="duration")){let l={instancePath:e+"/motion",schemaPath:"#/$defs/motion/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:c},message:"must NOT have additional properties",schema:!1,parentSchema:Ze,data:p};n===null?n=[l]:n.push(l),a++}if(p.style!==void 0){let c=p.style;if(!(c==="edge"||c==="drop"||c==="rise"||c==="fly"||c==="pop"||c==="scatter"||c==="build"||c==="fade")){let l={instancePath:e+"/motion/style",schemaPath:"#/$defs/motion/properties/style/enum",keyword:"enum",params:{allowedValues:Ze.properties.style.enum},message:"must be equal to one of the allowed values",schema:Ze.properties.style.enum,parentSchema:Ze.properties.style,data:c};n===null?n=[l]:n.push(l),a++}}if(p.out!==void 0){let c=p.out;if(!(c==="explode"||c==="lift-off"||c==="sink"||c==="scatter"||c==="fly-out"||c==="collapse"||c==="fade"||c==="reverse")){let l={instancePath:e+"/motion/out",schemaPath:"#/$defs/motion/properties/out/enum",keyword:"enum",params:{allowedValues:Ze.properties.out.enum},message:"must be equal to one of the allowed values",schema:Ze.properties.out.enum,parentSchema:Ze.properties.out,data:c};n===null?n=[l]:n.push(l),a++}}if(p.easing!==void 0){let c=p.easing;if(!(c==="linear"||c==="ease"||c==="ease-in"||c==="ease-out"||c==="settle"||c==="spring"||c==="bounce")){let l={instancePath:e+"/motion/easing",schemaPath:"#/$defs/motion/properties/easing/enum",keyword:"enum",params:{allowedValues:Ze.properties.easing.enum},message:"must be equal to one of the allowed values",schema:Ze.properties.easing.enum,parentSchema:Ze.properties.easing,data:c};n===null?n=[l]:n.push(l),a++}}if(p.from!==void 0){let c=p.from;if(!(c==="left"||c==="right"||c==="top"||c==="bottom")){let l={instancePath:e+"/motion/from",schemaPath:"#/$defs/motion/properties/from/enum",keyword:"enum",params:{allowedValues:Ze.properties.from.enum},message:"must be equal to one of the allowed values",schema:Ze.properties.from.enum,parentSchema:Ze.properties.from,data:c};n===null?n=[l]:n.push(l),a++}}if(p.delay!==void 0){let c=p.delay;if(typeof c=="number"){if(c<0||isNaN(c)){let l={instancePath:e+"/motion/delay",schemaPath:"#/$defs/motion/properties/delay/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:Ze.properties.delay,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/motion/delay",schemaPath:"#/$defs/motion/properties/delay/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Ze.properties.delay.type,parentSchema:Ze.properties.delay,data:c};n===null?n=[l]:n.push(l),a++}}if(p.duration!==void 0){let c=p.duration;if(typeof c=="number"){if(c<=0||isNaN(c)){let l={instancePath:e+"/motion/duration",schemaPath:"#/$defs/motion/properties/duration/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Ze.properties.duration,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/motion/duration",schemaPath:"#/$defs/motion/properties/duration/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Ze.properties.duration.type,parentSchema:Ze.properties.duration,data:c};n===null?n=[l]:n.push(l),a++}}}else{let c={instancePath:e+"/motion",schemaPath:"#/$defs/motion/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Ze.type,parentSchema:Ze,data:p};n===null?n=[c]:n.push(c),a++}}if(t.variants!==void 0&&(Ts(t.variants,{instancePath:e+"/variants",parentData:t,parentDataProperty:"variants",rootData:i,dynamicAnchors:o})||(n=n===null?Ts.errors:n.concat(Ts.errors),a=n.length)),t.nodes!==void 0){let p=t.nodes;if(Array.isArray(p)){let c=p.length;for(let l=0;l<c;l++)hs(p[l],{instancePath:e+"/nodes/"+l,parentData:p,parentDataProperty:l,rootData:i,dynamicAnchors:o})||(n=n===null?hs.errors:n.concat(hs.errors),a=n.length)}else{let c={instancePath:e+"/nodes",schemaPath:"#/properties/nodes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Fe.properties.nodes.type,parentSchema:Fe.properties.nodes,data:p};n===null?n=[c]:n.push(c),a++}}for(let p in t)if(p!=="id"&&p!=="kind"&&p!=="label"&&p!=="label-style"&&p!=="ghost"&&p!=="role"&&p!=="size"&&p!=="padding"&&p!=="height"&&p!=="z"&&p!=="flow"&&p!=="gate"&&p!=="around"&&p!=="regions"&&p!=="motion"&&p!=="variants"&&p!=="nodes"&&p!=="in"&&p!=="at"&&p!=="right-of"&&p!=="left-of"&&p!=="below"&&p!=="behind"&&p!=="gap"&&p!=="align"&&p!=="shift"&&p!=="appears"&&p!=="disappears"){let c={instancePath:e,schemaPath:"#/unevaluatedProperties",keyword:"unevaluatedProperties",params:{unevaluatedProperty:p},message:"must NOT have unevaluated properties",schema:!1,parentSchema:Fe,data:t};n===null?n=[c]:n.push(c),a++}}else{let p={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Fe.type,parentSchema:Fe,data:t};n===null?n=[p]:n.push(p),a++}return mr.errors=n,a===0}mr.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var je={type:"object",required:["id","from","to"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},from:{$ref:"#/$defs/endpoint"},to:{$ref:"#/$defs/endpoint"},kind:{type:"string"},via:{type:"array",items:{anyOf:[{$ref:"#/$defs/point2"},{$ref:"#/$defs/endpoint"}]}},points:{type:"array",items:{type:"array",items:{type:"number"},minItems:2,maxItems:3},description:"exact polyline in grid units; skips the router"},lane:{type:"number"},arrow:{type:"boolean"},cross:{type:"boolean",description:"the route may pass through fence walls (it crosses a boundary)"},label:{anyOf:[{type:"string"},{type:"object",additionalProperties:!1,required:["text"],properties:{text:{type:"string"},along:{type:"integer",minimum:1},side:{enum:["left","right"]},at:{type:"array",items:{type:"number"},minItems:2,maxItems:3,description:"exact place [x, y] or [x, y, z]; skips placement"},dir:{enum:["x","y"]},anchor:{enum:["start","middle","end"]}}}]},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},Os={type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"},vp=new RegExp("^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$","u");function ti(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=ti.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let m={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'",schema:je.required,parentSchema:je,data:t};n===null?n=[m]:n.push(m),a++}if(t.from===void 0){let m={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"from"},message:"must have required property 'from'",schema:je.required,parentSchema:je,data:t};n===null?n=[m]:n.push(m),a++}if(t.to===void 0){let m={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"to"},message:"must have required property 'to'",schema:je.required,parentSchema:je,data:t};n===null?n=[m]:n.push(m),a++}for(let m in t)if(!co.call(je.properties,m)){let h={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:m},message:"must NOT have additional properties",schema:!1,parentSchema:je,data:t};n===null?n=[h]:n.push(h),a++}if(t.id!==void 0){let m=t.id;if(typeof m=="string"){if(!It.test(m)){let h={instancePath:e+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:m};n===null?n=[h]:n.push(h),a++}}else{let h={instancePath:e+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:m};n===null?n=[h]:n.push(h),a++}}if(t.from!==void 0){let m=t.from;if(typeof m=="string"){if(!vp.test(m)){let h={instancePath:e+"/from",schemaPath:"#/$defs/endpoint/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"',schema:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$",parentSchema:Os,data:m};n===null?n=[h]:n.push(h),a++}}else{let h={instancePath:e+"/from",schemaPath:"#/$defs/endpoint/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Os.type,parentSchema:Os,data:m};n===null?n=[h]:n.push(h),a++}}if(t.to!==void 0){let m=t.to;if(typeof m=="string"){if(!vp.test(m)){let h={instancePath:e+"/to",schemaPath:"#/$defs/endpoint/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"',schema:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$",parentSchema:Os,data:m};n===null?n=[h]:n.push(h),a++}}else{let h={instancePath:e+"/to",schemaPath:"#/$defs/endpoint/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Os.type,parentSchema:Os,data:m};n===null?n=[h]:n.push(h),a++}}if(t.kind!==void 0){let m=t.kind;if(typeof m!="string"){let h={instancePath:e+"/kind",schemaPath:"#/properties/kind/type",keyword:"type",params:{type:"string"},message:"must be string",schema:je.properties.kind.type,parentSchema:je.properties.kind,data:m};n===null?n=[h]:n.push(h),a++}}if(t.via!==void 0){let m=t.via;if(Array.isArray(m)){let h=m.length;for(let y=0;y<h;y++){let g=m[y],k=a,u=!1,b=a;if(Array.isArray(g)){if(g.length>2){let $={instancePath:e+"/via/"+y,schemaPath:"#/$defs/point2/maxItems",keyword:"maxItems",params:{limit:2},message:"must NOT have more than 2 items",schema:2,parentSchema:Pt,data:g};n===null?n=[$]:n.push($),a++}if(g.length<2){let $={instancePath:e+"/via/"+y,schemaPath:"#/$defs/point2/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:Pt,data:g};n===null?n=[$]:n.push($),a++}let w=g.length;for(let $=0;$<w;$++){let v=g[$];if(typeof v!="number"){let O={instancePath:e+"/via/"+y+"/"+$,schemaPath:"#/$defs/point2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Pt.items.type,parentSchema:Pt.items,data:v};n===null?n=[O]:n.push(O),a++}}}else{let w={instancePath:e+"/via/"+y,schemaPath:"#/$defs/point2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Pt.type,parentSchema:Pt,data:g};n===null?n=[w]:n.push(w),a++}var p=b===a;u=u||p;let x=a;if(typeof g=="string"){if(!vp.test(g)){let w={instancePath:e+"/via/"+y,schemaPath:"#/$defs/endpoint/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"',schema:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$",parentSchema:Os,data:g};n===null?n=[w]:n.push(w),a++}}else{let w={instancePath:e+"/via/"+y,schemaPath:"#/$defs/endpoint/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Os.type,parentSchema:Os,data:g};n===null?n=[w]:n.push(w),a++}var p=x===a;if(u=u||p,u)a=k,n!==null&&(k?n.length=k:n=null);else{let w={instancePath:e+"/via/"+y,schemaPath:"#/properties/via/items/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:je.properties.via.items.anyOf,parentSchema:je.properties.via.items,data:g};n===null?n=[w]:n.push(w),a++}}}else{let h={instancePath:e+"/via",schemaPath:"#/properties/via/type",keyword:"type",params:{type:"array"},message:"must be array",schema:je.properties.via.type,parentSchema:je.properties.via,data:m};n===null?n=[h]:n.push(h),a++}}if(t.points!==void 0){let m=t.points;if(Array.isArray(m)){let h=m.length;for(let y=0;y<h;y++){let g=m[y];if(Array.isArray(g)){if(g.length>3){let u={instancePath:e+"/points/"+y,schemaPath:"#/properties/points/items/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:je.properties.points.items,data:g};n===null?n=[u]:n.push(u),a++}if(g.length<2){let u={instancePath:e+"/points/"+y,schemaPath:"#/properties/points/items/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:je.properties.points.items,data:g};n===null?n=[u]:n.push(u),a++}let k=g.length;for(let u=0;u<k;u++){let b=g[u];if(typeof b!="number"){let x={instancePath:e+"/points/"+y+"/"+u,schemaPath:"#/properties/points/items/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:je.properties.points.items.items.type,parentSchema:je.properties.points.items.items,data:b};n===null?n=[x]:n.push(x),a++}}}else{let k={instancePath:e+"/points/"+y,schemaPath:"#/properties/points/items/type",keyword:"type",params:{type:"array"},message:"must be array",schema:je.properties.points.items.type,parentSchema:je.properties.points.items,data:g};n===null?n=[k]:n.push(k),a++}}}else{let h={instancePath:e+"/points",schemaPath:"#/properties/points/type",keyword:"type",params:{type:"array"},message:"must be array",schema:je.properties.points.type,parentSchema:je.properties.points,data:m};n===null?n=[h]:n.push(h),a++}}if(t.lane!==void 0){let m=t.lane;if(typeof m!="number"){let h={instancePath:e+"/lane",schemaPath:"#/properties/lane/type",keyword:"type",params:{type:"number"},message:"must be number",schema:je.properties.lane.type,parentSchema:je.properties.lane,data:m};n===null?n=[h]:n.push(h),a++}}if(t.arrow!==void 0){let m=t.arrow;if(typeof m!="boolean"){let h={instancePath:e+"/arrow",schemaPath:"#/properties/arrow/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:je.properties.arrow.type,parentSchema:je.properties.arrow,data:m};n===null?n=[h]:n.push(h),a++}}if(t.cross!==void 0){let m=t.cross;if(typeof m!="boolean"){let h={instancePath:e+"/cross",schemaPath:"#/properties/cross/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:je.properties.cross.type,parentSchema:je.properties.cross,data:m};n===null?n=[h]:n.push(h),a++}}if(t.label!==void 0){let m=t.label,h=a,y=!1,g=a;if(typeof m!="string"){let u={instancePath:e+"/label",schemaPath:"#/properties/label/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:je.properties.label.anyOf[0].type,parentSchema:je.properties.label.anyOf[0],data:m};n===null?n=[u]:n.push(u),a++}var c=g===a;y=y||c;let k=a;if(m&&typeof m=="object"&&!Array.isArray(m)){if(m.text===void 0){let u={instancePath:e+"/label",schemaPath:"#/properties/label/anyOf/1/required",keyword:"required",params:{missingProperty:"text"},message:"must have required property 'text'",schema:je.properties.label.anyOf[1].required,parentSchema:je.properties.label.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}for(let u in m)if(!(u==="text"||u==="along"||u==="side"||u==="at"||u==="dir"||u==="anchor")){let b={instancePath:e+"/label",schemaPath:"#/properties/label/anyOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:u},message:"must NOT have additional properties",schema:!1,parentSchema:je.properties.label.anyOf[1],data:m};n===null?n=[b]:n.push(b),a++}if(m.text!==void 0){let u=m.text;if(typeof u!="string"){let b={instancePath:e+"/label/text",schemaPath:"#/properties/label/anyOf/1/properties/text/type",keyword:"type",params:{type:"string"},message:"must be string",schema:je.properties.label.anyOf[1].properties.text.type,parentSchema:je.properties.label.anyOf[1].properties.text,data:u};n===null?n=[b]:n.push(b),a++}}if(m.along!==void 0){let u=m.along;if(!(typeof u=="number"&&!(u%1)&&!isNaN(u))){let b={instancePath:e+"/label/along",schemaPath:"#/properties/label/anyOf/1/properties/along/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:je.properties.label.anyOf[1].properties.along.type,parentSchema:je.properties.label.anyOf[1].properties.along,data:u};n===null?n=[b]:n.push(b),a++}if(typeof u=="number"&&(u<1||isNaN(u))){let b={instancePath:e+"/label/along",schemaPath:"#/properties/label/anyOf/1/properties/along/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:je.properties.label.anyOf[1].properties.along,data:u};n===null?n=[b]:n.push(b),a++}}if(m.side!==void 0){let u=m.side;if(!(u==="left"||u==="right")){let b={instancePath:e+"/label/side",schemaPath:"#/properties/label/anyOf/1/properties/side/enum",keyword:"enum",params:{allowedValues:je.properties.label.anyOf[1].properties.side.enum},message:"must be equal to one of the allowed values",schema:je.properties.label.anyOf[1].properties.side.enum,parentSchema:je.properties.label.anyOf[1].properties.side,data:u};n===null?n=[b]:n.push(b),a++}}if(m.at!==void 0){let u=m.at;if(Array.isArray(u)){if(u.length>3){let x={instancePath:e+"/label/at",schemaPath:"#/properties/label/anyOf/1/properties/at/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:je.properties.label.anyOf[1].properties.at,data:u};n===null?n=[x]:n.push(x),a++}if(u.length<2){let x={instancePath:e+"/label/at",schemaPath:"#/properties/label/anyOf/1/properties/at/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:je.properties.label.anyOf[1].properties.at,data:u};n===null?n=[x]:n.push(x),a++}let b=u.length;for(let x=0;x<b;x++){let w=u[x];if(typeof w!="number"){let $={instancePath:e+"/label/at/"+x,schemaPath:"#/properties/label/anyOf/1/properties/at/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:je.properties.label.anyOf[1].properties.at.items.type,parentSchema:je.properties.label.anyOf[1].properties.at.items,data:w};n===null?n=[$]:n.push($),a++}}}else{let b={instancePath:e+"/label/at",schemaPath:"#/properties/label/anyOf/1/properties/at/type",keyword:"type",params:{type:"array"},message:"must be array",schema:je.properties.label.anyOf[1].properties.at.type,parentSchema:je.properties.label.anyOf[1].properties.at,data:u};n===null?n=[b]:n.push(b),a++}}if(m.dir!==void 0){let u=m.dir;if(!(u==="x"||u==="y")){let b={instancePath:e+"/label/dir",schemaPath:"#/properties/label/anyOf/1/properties/dir/enum",keyword:"enum",params:{allowedValues:je.properties.label.anyOf[1].properties.dir.enum},message:"must be equal to one of the allowed values",schema:je.properties.label.anyOf[1].properties.dir.enum,parentSchema:je.properties.label.anyOf[1].properties.dir,data:u};n===null?n=[b]:n.push(b),a++}}if(m.anchor!==void 0){let u=m.anchor;if(!(u==="start"||u==="middle"||u==="end")){let b={instancePath:e+"/label/anchor",schemaPath:"#/properties/label/anyOf/1/properties/anchor/enum",keyword:"enum",params:{allowedValues:je.properties.label.anyOf[1].properties.anchor.enum},message:"must be equal to one of the allowed values",schema:je.properties.label.anyOf[1].properties.anchor.enum,parentSchema:je.properties.label.anyOf[1].properties.anchor,data:u};n===null?n=[b]:n.push(b),a++}}}else{let u={instancePath:e+"/label",schemaPath:"#/properties/label/anyOf/1/type",keyword:"type",params:{type:"object"},message:"must be object",schema:je.properties.label.anyOf[1].type,parentSchema:je.properties.label.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}var c=k===a;if(y=y||c,y)a=h,n!==null&&(h?n.length=h:n=null);else{let u={instancePath:e+"/label",schemaPath:"#/properties/label/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:je.properties.label.anyOf,parentSchema:je.properties.label,data:m};n===null?n=[u]:n.push(u),a++}}if(t.appears!==void 0){let m=t.appears,h=a,y=!1,g=a;if(typeof m!="string"){let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ye.anyOf[0].type,parentSchema:Ye.anyOf[0],data:m};n===null?n=[u]:n.push(u),a++}var l=g===a;y=y||l;let k=a;if(!(typeof m=="number"&&!(m%1)&&!isNaN(m))){let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Ye.anyOf[1].type,parentSchema:Ye.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}if(typeof m=="number"&&(m<1||isNaN(m))){let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Ye.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}var l=k===a;if(y=y||l,y)a=h,n!==null&&(h?n.length=h:n=null);else{let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Ye.anyOf,parentSchema:Ye,data:m};n===null?n=[u]:n.push(u),a++}}if(t.disappears!==void 0){let m=t.disappears,h=a,y=!1,g=a;if(typeof m!="string"){let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ye.anyOf[0].type,parentSchema:Ye.anyOf[0],data:m};n===null?n=[u]:n.push(u),a++}var d=g===a;y=y||d;let k=a;if(!(typeof m=="number"&&!(m%1)&&!isNaN(m))){let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Ye.anyOf[1].type,parentSchema:Ye.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}if(typeof m=="number"&&(m<1||isNaN(m))){let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Ye.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}var d=k===a;if(y=y||d,y)a=h,n!==null&&(h?n.length=h:n=null);else{let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Ye.anyOf,parentSchema:Ye,data:m};n===null?n=[u]:n.push(u),a++}}}else{let m={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:je.type,parentSchema:je,data:t};n===null?n=[m]:n.push(m),a++}return ti.errors=n,a===0}ti.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var ot={type:"object",additionalProperties:!1,properties:{floor:{type:"string"},face:{type:"string"},label:{type:"string"},sub:{type:"string"},at:{anyOf:[{$ref:"#/$defs/point2"},{type:"array",items:{type:"number"},minItems:3,maxItems:3}]},on:{$ref:"#/$defs/id",description:"a node, region or route; a note on a route dims and lights with it"},kind:{type:"string"},dir:{enum:["x","y"]},anchor:{enum:["start","middle","end"]},dx:{type:"number"},dy:{type:"number"},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}};function ni(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=ni.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){for(let m in t)if(!co.call(ot.properties,m)){let h={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:m},message:"must NOT have additional properties",schema:!1,parentSchema:ot,data:t};n===null?n=[h]:n.push(h),a++}if(t.floor!==void 0){let m=t.floor;if(typeof m!="string"){let h={instancePath:e+"/floor",schemaPath:"#/properties/floor/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ot.properties.floor.type,parentSchema:ot.properties.floor,data:m};n===null?n=[h]:n.push(h),a++}}if(t.face!==void 0){let m=t.face;if(typeof m!="string"){let h={instancePath:e+"/face",schemaPath:"#/properties/face/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ot.properties.face.type,parentSchema:ot.properties.face,data:m};n===null?n=[h]:n.push(h),a++}}if(t.label!==void 0){let m=t.label;if(typeof m!="string"){let h={instancePath:e+"/label",schemaPath:"#/properties/label/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ot.properties.label.type,parentSchema:ot.properties.label,data:m};n===null?n=[h]:n.push(h),a++}}if(t.sub!==void 0){let m=t.sub;if(typeof m!="string"){let h={instancePath:e+"/sub",schemaPath:"#/properties/sub/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ot.properties.sub.type,parentSchema:ot.properties.sub,data:m};n===null?n=[h]:n.push(h),a++}}if(t.at!==void 0){let m=t.at,h=a,y=!1,g=a;if(Array.isArray(m)){if(m.length>2){let b={instancePath:e+"/at",schemaPath:"#/$defs/point2/maxItems",keyword:"maxItems",params:{limit:2},message:"must NOT have more than 2 items",schema:2,parentSchema:Pt,data:m};n===null?n=[b]:n.push(b),a++}if(m.length<2){let b={instancePath:e+"/at",schemaPath:"#/$defs/point2/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:Pt,data:m};n===null?n=[b]:n.push(b),a++}let u=m.length;for(let b=0;b<u;b++){let x=m[b];if(typeof x!="number"){let w={instancePath:e+"/at/"+b,schemaPath:"#/$defs/point2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Pt.items.type,parentSchema:Pt.items,data:x};n===null?n=[w]:n.push(w),a++}}}else{let u={instancePath:e+"/at",schemaPath:"#/$defs/point2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Pt.type,parentSchema:Pt,data:m};n===null?n=[u]:n.push(u),a++}var c=g===a;if(y=y||c,c)var p=!0;let k=a;if(Array.isArray(m)){if(m.length>3){let b={instancePath:e+"/at",schemaPath:"#/properties/at/anyOf/1/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:ot.properties.at.anyOf[1],data:m};n===null?n=[b]:n.push(b),a++}if(m.length<3){let b={instancePath:e+"/at",schemaPath:"#/properties/at/anyOf/1/minItems",keyword:"minItems",params:{limit:3},message:"must NOT have fewer than 3 items",schema:3,parentSchema:ot.properties.at.anyOf[1],data:m};n===null?n=[b]:n.push(b),a++}let u=m.length;for(let b=0;b<u;b++){let x=m[b];if(typeof x!="number"){let w={instancePath:e+"/at/"+b,schemaPath:"#/properties/at/anyOf/1/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:ot.properties.at.anyOf[1].items.type,parentSchema:ot.properties.at.anyOf[1].items,data:x};n===null?n=[w]:n.push(w),a++}}}else{let u={instancePath:e+"/at",schemaPath:"#/properties/at/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ot.properties.at.anyOf[1].type,parentSchema:ot.properties.at.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}var c=k===a;if(y=y||c,c&&p!==!0&&(p=!0),y)a=h,n!==null&&(h?n.length=h:n=null);else{let u={instancePath:e+"/at",schemaPath:"#/properties/at/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:ot.properties.at.anyOf,parentSchema:ot.properties.at,data:m};n===null?n=[u]:n.push(u),a++}}if(t.on!==void 0){let m=t.on;if(typeof m=="string"){if(!It.test(m)){let h={instancePath:e+"/on",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:m};n===null?n=[h]:n.push(h),a++}}else{let h={instancePath:e+"/on",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:m};n===null?n=[h]:n.push(h),a++}}if(t.kind!==void 0){let m=t.kind;if(typeof m!="string"){let h={instancePath:e+"/kind",schemaPath:"#/properties/kind/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ot.properties.kind.type,parentSchema:ot.properties.kind,data:m};n===null?n=[h]:n.push(h),a++}}if(t.dir!==void 0){let m=t.dir;if(!(m==="x"||m==="y")){let h={instancePath:e+"/dir",schemaPath:"#/properties/dir/enum",keyword:"enum",params:{allowedValues:ot.properties.dir.enum},message:"must be equal to one of the allowed values",schema:ot.properties.dir.enum,parentSchema:ot.properties.dir,data:m};n===null?n=[h]:n.push(h),a++}}if(t.anchor!==void 0){let m=t.anchor;if(!(m==="start"||m==="middle"||m==="end")){let h={instancePath:e+"/anchor",schemaPath:"#/properties/anchor/enum",keyword:"enum",params:{allowedValues:ot.properties.anchor.enum},message:"must be equal to one of the allowed values",schema:ot.properties.anchor.enum,parentSchema:ot.properties.anchor,data:m};n===null?n=[h]:n.push(h),a++}}if(t.dx!==void 0){let m=t.dx;if(typeof m!="number"){let h={instancePath:e+"/dx",schemaPath:"#/properties/dx/type",keyword:"type",params:{type:"number"},message:"must be number",schema:ot.properties.dx.type,parentSchema:ot.properties.dx,data:m};n===null?n=[h]:n.push(h),a++}}if(t.dy!==void 0){let m=t.dy;if(typeof m!="number"){let h={instancePath:e+"/dy",schemaPath:"#/properties/dy/type",keyword:"type",params:{type:"number"},message:"must be number",schema:ot.properties.dy.type,parentSchema:ot.properties.dy,data:m};n===null?n=[h]:n.push(h),a++}}if(t.appears!==void 0){let m=t.appears,h=a,y=!1,g=a;if(typeof m!="string"){let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ye.anyOf[0].type,parentSchema:Ye.anyOf[0],data:m};n===null?n=[u]:n.push(u),a++}var l=g===a;y=y||l;let k=a;if(!(typeof m=="number"&&!(m%1)&&!isNaN(m))){let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Ye.anyOf[1].type,parentSchema:Ye.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}if(typeof m=="number"&&(m<1||isNaN(m))){let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Ye.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}var l=k===a;if(y=y||l,y)a=h,n!==null&&(h?n.length=h:n=null);else{let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Ye.anyOf,parentSchema:Ye,data:m};n===null?n=[u]:n.push(u),a++}}if(t.disappears!==void 0){let m=t.disappears,h=a,y=!1,g=a;if(typeof m!="string"){let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ye.anyOf[0].type,parentSchema:Ye.anyOf[0],data:m};n===null?n=[u]:n.push(u),a++}var d=g===a;y=y||d;let k=a;if(!(typeof m=="number"&&!(m%1)&&!isNaN(m))){let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Ye.anyOf[1].type,parentSchema:Ye.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}if(typeof m=="number"&&(m<1||isNaN(m))){let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Ye.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}var d=k===a;if(y=y||d,y)a=h,n!==null&&(h?n.length=h:n=null);else{let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Ye.anyOf,parentSchema:Ye,data:m};n===null?n=[u]:n.push(u),a++}}}else{let m={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:ot.type,parentSchema:ot,data:t};n===null?n=[m]:n.push(m),a++}return ni.errors=n,a===0}ni.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var we={type:"object",required:["heading"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},number:{type:"integer",minimum:1,description:"the number shown; defaults to the position"},kind:{type:"string"},heading:{type:"string"},caption:{type:"string"},command:{type:"string"},animate:{type:"array",items:{$ref:"#/$defs/phase"}},pulse:{type:"array",items:{$ref:"#/$defs/id"}},highlight:{type:"array",items:{$ref:"#/$defs/id"}},focus:{type:"array",items:{$ref:"#/$defs/id"},description:"nodes or regions to zoom to for this step; the view eases back on steps without focus"},show:{type:"array",items:{$ref:"#/$defs/id"}},hide:{type:"array",items:{$ref:"#/$defs/id"}},say:{type:"array",items:{type:"object",additionalProperties:!1,required:["at","text"],properties:{at:{anyOf:[{$ref:"#/$defs/id"},{type:"array",items:{type:"number"},minItems:2,maxItems:3}],description:"a node (the callout sits above it) or a grid point [x, y, z]"},text:{type:"string"},kind:{type:"string"},dx:{type:"number"},dy:{type:"number"},anchor:{enum:["start","middle","end"]}}}},mark:{type:"array",items:{type:"object",additionalProperties:!1,properties:{on:{$ref:"#/$defs/id"},at:{type:"array",items:{type:"number"},minItems:2,maxItems:3}}}},badge:{anyOf:[{type:"boolean"},{$ref:"#/$defs/id"},{type:"array",items:{type:"number"},minItems:2,maxItems:3}],description:"false, a route or node id, or a grid point [x, y, z]"},duration:{anyOf:[{const:"auto"},{type:"integer",minimum:500}]}}},kl={anyOf:[{$ref:"#/$defs/routeRef"},{type:"array",items:{$ref:"#/$defs/routeRef"}}]},Ft={anyOf:[{type:"string"},{type:"object",minProperties:1,maxProperties:1,additionalProperties:{type:"string"}}]};function si(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=si.evaluated;f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0);let p=a,c=!1,l=a,d=a,m=!1,h=a;if(typeof t!="string"){let $={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ft.anyOf[0].type,parentSchema:Ft.anyOf[0],data:t};n===null?n=[$]:n.push($),a++}var g=h===a;m=m||g;let y=a;if(t&&typeof t=="object"&&!Array.isArray(t)){if(Object.keys(t).length>1){let $={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf/1/maxProperties",keyword:"maxProperties",params:{limit:1},message:"must NOT have more than 1 properties",schema:1,parentSchema:Ft.anyOf[1],data:t};n===null?n=[$]:n.push($),a++}if(Object.keys(t).length<1){let $={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf/1/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Ft.anyOf[1],data:t};n===null?n=[$]:n.push($),a++}for(let $ in t){let v=t[$];if(typeof v!="string"){let O={instancePath:e+"/"+$.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/routeRef/anyOf/1/additionalProperties/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ft.anyOf[1].additionalProperties.type,parentSchema:Ft.anyOf[1].additionalProperties,data:v};n===null?n=[O]:n.push(O),a++}}}else{let $={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf/1/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Ft.anyOf[1].type,parentSchema:Ft.anyOf[1],data:t};n===null?n=[$]:n.push($),a++}var g=y===a;if(m=m||g,g)var k=!0;if(m)a=d,n!==null&&(d?n.length=d:n=null);else{let $={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Ft.anyOf,parentSchema:Ft,data:t};n===null?n=[$]:n.push($),a++}var x=l===a;c=c||x;let u=a;if(Array.isArray(t)){let $=t.length;for(let v=0;v<$;v++){let O=t[v],C=a,A=!1,R=a;if(typeof O!="string"){let T={instancePath:e+"/"+v,schemaPath:"#/$defs/routeRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ft.anyOf[0].type,parentSchema:Ft.anyOf[0],data:O};n===null?n=[T]:n.push(T),a++}var b=R===a;A=A||b;let M=a;if(O&&typeof O=="object"&&!Array.isArray(O)){if(Object.keys(O).length>1){let T={instancePath:e+"/"+v,schemaPath:"#/$defs/routeRef/anyOf/1/maxProperties",keyword:"maxProperties",params:{limit:1},message:"must NOT have more than 1 properties",schema:1,parentSchema:Ft.anyOf[1],data:O};n===null?n=[T]:n.push(T),a++}if(Object.keys(O).length<1){let T={instancePath:e+"/"+v,schemaPath:"#/$defs/routeRef/anyOf/1/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Ft.anyOf[1],data:O};n===null?n=[T]:n.push(T),a++}for(let T in O){let S=O[T];if(typeof S!="string"){let N={instancePath:e+"/"+v+"/"+T.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/routeRef/anyOf/1/additionalProperties/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ft.anyOf[1].additionalProperties.type,parentSchema:Ft.anyOf[1].additionalProperties,data:S};n===null?n=[N]:n.push(N),a++}}}else{let T={instancePath:e+"/"+v,schemaPath:"#/$defs/routeRef/anyOf/1/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Ft.anyOf[1].type,parentSchema:Ft.anyOf[1],data:O};n===null?n=[T]:n.push(T),a++}var b=M===a;if(A=A||b,A)a=C,n!==null&&(C?n.length=C:n=null);else{let T={instancePath:e+"/"+v,schemaPath:"#/$defs/routeRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Ft.anyOf,parentSchema:Ft,data:O};n===null?n=[T]:n.push(T),a++}}}else{let $={instancePath:e,schemaPath:"#/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array",schema:kl.anyOf[1].type,parentSchema:kl.anyOf[1],data:t};n===null?n=[$]:n.push($),a++}var x=u===a;if(c=c||x,x)var w=!0;if(c)a=p,n!==null&&(p?n.length=p:n=null);else{let $={instancePath:e,schemaPath:"#/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:kl.anyOf,parentSchema:kl,data:t};n===null?n=[$]:n.push($),a++}return si.errors=n,f.props=k,f.items=w,a===0}si.evaluated={dynamicProps:!0,dynamicItems:!0};function ri(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=ri.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(t.heading===void 0){let d={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"heading"},message:"must have required property 'heading'",schema:we.required,parentSchema:we,data:t};n===null?n=[d]:n.push(d),a++}for(let d in t)if(!co.call(we.properties,d)){let m={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:d},message:"must NOT have additional properties",schema:!1,parentSchema:we,data:t};n===null?n=[m]:n.push(m),a++}if(t.id!==void 0){let d=t.id;if(typeof d=="string"){if(!It.test(d)){let m={instancePath:e+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:d};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:d};n===null?n=[m]:n.push(m),a++}}if(t.number!==void 0){let d=t.number;if(!(typeof d=="number"&&!(d%1)&&!isNaN(d))){let m={instancePath:e+"/number",schemaPath:"#/properties/number/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:we.properties.number.type,parentSchema:we.properties.number,data:d};n===null?n=[m]:n.push(m),a++}if(typeof d=="number"&&(d<1||isNaN(d))){let m={instancePath:e+"/number",schemaPath:"#/properties/number/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:we.properties.number,data:d};n===null?n=[m]:n.push(m),a++}}if(t.kind!==void 0){let d=t.kind;if(typeof d!="string"){let m={instancePath:e+"/kind",schemaPath:"#/properties/kind/type",keyword:"type",params:{type:"string"},message:"must be string",schema:we.properties.kind.type,parentSchema:we.properties.kind,data:d};n===null?n=[m]:n.push(m),a++}}if(t.heading!==void 0){let d=t.heading;if(typeof d!="string"){let m={instancePath:e+"/heading",schemaPath:"#/properties/heading/type",keyword:"type",params:{type:"string"},message:"must be string",schema:we.properties.heading.type,parentSchema:we.properties.heading,data:d};n===null?n=[m]:n.push(m),a++}}if(t.caption!==void 0){let d=t.caption;if(typeof d!="string"){let m={instancePath:e+"/caption",schemaPath:"#/properties/caption/type",keyword:"type",params:{type:"string"},message:"must be string",schema:we.properties.caption.type,parentSchema:we.properties.caption,data:d};n===null?n=[m]:n.push(m),a++}}if(t.command!==void 0){let d=t.command;if(typeof d!="string"){let m={instancePath:e+"/command",schemaPath:"#/properties/command/type",keyword:"type",params:{type:"string"},message:"must be string",schema:we.properties.command.type,parentSchema:we.properties.command,data:d};n===null?n=[m]:n.push(m),a++}}if(t.animate!==void 0){let d=t.animate;if(Array.isArray(d)){let m=d.length;for(let h=0;h<m;h++)si(d[h],{instancePath:e+"/animate/"+h,parentData:d,parentDataProperty:h,rootData:i,dynamicAnchors:o})||(n=n===null?si.errors:n.concat(si.errors),a=n.length)}else{let m={instancePath:e+"/animate",schemaPath:"#/properties/animate/type",keyword:"type",params:{type:"array"},message:"must be array",schema:we.properties.animate.type,parentSchema:we.properties.animate,data:d};n===null?n=[m]:n.push(m),a++}}if(t.pulse!==void 0){let d=t.pulse;if(Array.isArray(d)){let m=d.length;for(let h=0;h<m;h++){let y=d[h];if(typeof y=="string"){if(!It.test(y)){let g={instancePath:e+"/pulse/"+h,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:y};n===null?n=[g]:n.push(g),a++}}else{let g={instancePath:e+"/pulse/"+h,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:y};n===null?n=[g]:n.push(g),a++}}}else{let m={instancePath:e+"/pulse",schemaPath:"#/properties/pulse/type",keyword:"type",params:{type:"array"},message:"must be array",schema:we.properties.pulse.type,parentSchema:we.properties.pulse,data:d};n===null?n=[m]:n.push(m),a++}}if(t.highlight!==void 0){let d=t.highlight;if(Array.isArray(d)){let m=d.length;for(let h=0;h<m;h++){let y=d[h];if(typeof y=="string"){if(!It.test(y)){let g={instancePath:e+"/highlight/"+h,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:y};n===null?n=[g]:n.push(g),a++}}else{let g={instancePath:e+"/highlight/"+h,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:y};n===null?n=[g]:n.push(g),a++}}}else{let m={instancePath:e+"/highlight",schemaPath:"#/properties/highlight/type",keyword:"type",params:{type:"array"},message:"must be array",schema:we.properties.highlight.type,parentSchema:we.properties.highlight,data:d};n===null?n=[m]:n.push(m),a++}}if(t.focus!==void 0){let d=t.focus;if(Array.isArray(d)){let m=d.length;for(let h=0;h<m;h++){let y=d[h];if(typeof y=="string"){if(!It.test(y)){let g={instancePath:e+"/focus/"+h,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:y};n===null?n=[g]:n.push(g),a++}}else{let g={instancePath:e+"/focus/"+h,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:y};n===null?n=[g]:n.push(g),a++}}}else{let m={instancePath:e+"/focus",schemaPath:"#/properties/focus/type",keyword:"type",params:{type:"array"},message:"must be array",schema:we.properties.focus.type,parentSchema:we.properties.focus,data:d};n===null?n=[m]:n.push(m),a++}}if(t.show!==void 0){let d=t.show;if(Array.isArray(d)){let m=d.length;for(let h=0;h<m;h++){let y=d[h];if(typeof y=="string"){if(!It.test(y)){let g={instancePath:e+"/show/"+h,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:y};n===null?n=[g]:n.push(g),a++}}else{let g={instancePath:e+"/show/"+h,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:y};n===null?n=[g]:n.push(g),a++}}}else{let m={instancePath:e+"/show",schemaPath:"#/properties/show/type",keyword:"type",params:{type:"array"},message:"must be array",schema:we.properties.show.type,parentSchema:we.properties.show,data:d};n===null?n=[m]:n.push(m),a++}}if(t.hide!==void 0){let d=t.hide;if(Array.isArray(d)){let m=d.length;for(let h=0;h<m;h++){let y=d[h];if(typeof y=="string"){if(!It.test(y)){let g={instancePath:e+"/hide/"+h,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:y};n===null?n=[g]:n.push(g),a++}}else{let g={instancePath:e+"/hide/"+h,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:y};n===null?n=[g]:n.push(g),a++}}}else{let m={instancePath:e+"/hide",schemaPath:"#/properties/hide/type",keyword:"type",params:{type:"array"},message:"must be array",schema:we.properties.hide.type,parentSchema:we.properties.hide,data:d};n===null?n=[m]:n.push(m),a++}}if(t.say!==void 0){let d=t.say;if(Array.isArray(d)){let m=d.length;for(let h=0;h<m;h++){let y=d[h];if(y&&typeof y=="object"&&!Array.isArray(y)){if(y.at===void 0){let g={instancePath:e+"/say/"+h,schemaPath:"#/properties/say/items/required",keyword:"required",params:{missingProperty:"at"},message:"must have required property 'at'",schema:we.properties.say.items.required,parentSchema:we.properties.say.items,data:y};n===null?n=[g]:n.push(g),a++}if(y.text===void 0){let g={instancePath:e+"/say/"+h,schemaPath:"#/properties/say/items/required",keyword:"required",params:{missingProperty:"text"},message:"must have required property 'text'",schema:we.properties.say.items.required,parentSchema:we.properties.say.items,data:y};n===null?n=[g]:n.push(g),a++}for(let g in y)if(!(g==="at"||g==="text"||g==="kind"||g==="dx"||g==="dy"||g==="anchor")){let k={instancePath:e+"/say/"+h,schemaPath:"#/properties/say/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:g},message:"must NOT have additional properties",schema:!1,parentSchema:we.properties.say.items,data:y};n===null?n=[k]:n.push(k),a++}if(y.at!==void 0){let g=y.at,k=a,u=!1,b=a;if(typeof g=="string"){if(!It.test(g)){let w={instancePath:e+"/say/"+h+"/at",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:g};n===null?n=[w]:n.push(w),a++}}else{let w={instancePath:e+"/say/"+h+"/at",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:g};n===null?n=[w]:n.push(w),a++}var p=b===a;u=u||p;let x=a;if(Array.isArray(g)){if(g.length>3){let $={instancePath:e+"/say/"+h+"/at",schemaPath:"#/properties/say/items/properties/at/anyOf/1/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:we.properties.say.items.properties.at.anyOf[1],data:g};n===null?n=[$]:n.push($),a++}if(g.length<2){let $={instancePath:e+"/say/"+h+"/at",schemaPath:"#/properties/say/items/properties/at/anyOf/1/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:we.properties.say.items.properties.at.anyOf[1],data:g};n===null?n=[$]:n.push($),a++}let w=g.length;for(let $=0;$<w;$++){let v=g[$];if(typeof v!="number"){let O={instancePath:e+"/say/"+h+"/at/"+$,schemaPath:"#/properties/say/items/properties/at/anyOf/1/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:we.properties.say.items.properties.at.anyOf[1].items.type,parentSchema:we.properties.say.items.properties.at.anyOf[1].items,data:v};n===null?n=[O]:n.push(O),a++}}}else{let w={instancePath:e+"/say/"+h+"/at",schemaPath:"#/properties/say/items/properties/at/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array",schema:we.properties.say.items.properties.at.anyOf[1].type,parentSchema:we.properties.say.items.properties.at.anyOf[1],data:g};n===null?n=[w]:n.push(w),a++}var p=x===a;if(u=u||p,u)a=k,n!==null&&(k?n.length=k:n=null);else{let w={instancePath:e+"/say/"+h+"/at",schemaPath:"#/properties/say/items/properties/at/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:we.properties.say.items.properties.at.anyOf,parentSchema:we.properties.say.items.properties.at,data:g};n===null?n=[w]:n.push(w),a++}}if(y.text!==void 0){let g=y.text;if(typeof g!="string"){let k={instancePath:e+"/say/"+h+"/text",schemaPath:"#/properties/say/items/properties/text/type",keyword:"type",params:{type:"string"},message:"must be string",schema:we.properties.say.items.properties.text.type,parentSchema:we.properties.say.items.properties.text,data:g};n===null?n=[k]:n.push(k),a++}}if(y.kind!==void 0){let g=y.kind;if(typeof g!="string"){let k={instancePath:e+"/say/"+h+"/kind",schemaPath:"#/properties/say/items/properties/kind/type",keyword:"type",params:{type:"string"},message:"must be string",schema:we.properties.say.items.properties.kind.type,parentSchema:we.properties.say.items.properties.kind,data:g};n===null?n=[k]:n.push(k),a++}}if(y.dx!==void 0){let g=y.dx;if(typeof g!="number"){let k={instancePath:e+"/say/"+h+"/dx",schemaPath:"#/properties/say/items/properties/dx/type",keyword:"type",params:{type:"number"},message:"must be number",schema:we.properties.say.items.properties.dx.type,parentSchema:we.properties.say.items.properties.dx,data:g};n===null?n=[k]:n.push(k),a++}}if(y.dy!==void 0){let g=y.dy;if(typeof g!="number"){let k={instancePath:e+"/say/"+h+"/dy",schemaPath:"#/properties/say/items/properties/dy/type",keyword:"type",params:{type:"number"},message:"must be number",schema:we.properties.say.items.properties.dy.type,parentSchema:we.properties.say.items.properties.dy,data:g};n===null?n=[k]:n.push(k),a++}}if(y.anchor!==void 0){let g=y.anchor;if(!(g==="start"||g==="middle"||g==="end")){let k={instancePath:e+"/say/"+h+"/anchor",schemaPath:"#/properties/say/items/properties/anchor/enum",keyword:"enum",params:{allowedValues:we.properties.say.items.properties.anchor.enum},message:"must be equal to one of the allowed values",schema:we.properties.say.items.properties.anchor.enum,parentSchema:we.properties.say.items.properties.anchor,data:g};n===null?n=[k]:n.push(k),a++}}}else{let g={instancePath:e+"/say/"+h,schemaPath:"#/properties/say/items/type",keyword:"type",params:{type:"object"},message:"must be object",schema:we.properties.say.items.type,parentSchema:we.properties.say.items,data:y};n===null?n=[g]:n.push(g),a++}}}else{let m={instancePath:e+"/say",schemaPath:"#/properties/say/type",keyword:"type",params:{type:"array"},message:"must be array",schema:we.properties.say.type,parentSchema:we.properties.say,data:d};n===null?n=[m]:n.push(m),a++}}if(t.mark!==void 0){let d=t.mark;if(Array.isArray(d)){let m=d.length;for(let h=0;h<m;h++){let y=d[h];if(y&&typeof y=="object"&&!Array.isArray(y)){for(let g in y)if(!(g==="on"||g==="at")){let k={instancePath:e+"/mark/"+h,schemaPath:"#/properties/mark/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:g},message:"must NOT have additional properties",schema:!1,parentSchema:we.properties.mark.items,data:y};n===null?n=[k]:n.push(k),a++}if(y.on!==void 0){let g=y.on;if(typeof g=="string"){if(!It.test(g)){let k={instancePath:e+"/mark/"+h+"/on",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:g};n===null?n=[k]:n.push(k),a++}}else{let k={instancePath:e+"/mark/"+h+"/on",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:g};n===null?n=[k]:n.push(k),a++}}if(y.at!==void 0){let g=y.at;if(Array.isArray(g)){if(g.length>3){let u={instancePath:e+"/mark/"+h+"/at",schemaPath:"#/properties/mark/items/properties/at/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:we.properties.mark.items.properties.at,data:g};n===null?n=[u]:n.push(u),a++}if(g.length<2){let u={instancePath:e+"/mark/"+h+"/at",schemaPath:"#/properties/mark/items/properties/at/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:we.properties.mark.items.properties.at,data:g};n===null?n=[u]:n.push(u),a++}let k=g.length;for(let u=0;u<k;u++){let b=g[u];if(typeof b!="number"){let x={instancePath:e+"/mark/"+h+"/at/"+u,schemaPath:"#/properties/mark/items/properties/at/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:we.properties.mark.items.properties.at.items.type,parentSchema:we.properties.mark.items.properties.at.items,data:b};n===null?n=[x]:n.push(x),a++}}}else{let k={instancePath:e+"/mark/"+h+"/at",schemaPath:"#/properties/mark/items/properties/at/type",keyword:"type",params:{type:"array"},message:"must be array",schema:we.properties.mark.items.properties.at.type,parentSchema:we.properties.mark.items.properties.at,data:g};n===null?n=[k]:n.push(k),a++}}}else{let g={instancePath:e+"/mark/"+h,schemaPath:"#/properties/mark/items/type",keyword:"type",params:{type:"object"},message:"must be object",schema:we.properties.mark.items.type,parentSchema:we.properties.mark.items,data:y};n===null?n=[g]:n.push(g),a++}}}else{let m={instancePath:e+"/mark",schemaPath:"#/properties/mark/type",keyword:"type",params:{type:"array"},message:"must be array",schema:we.properties.mark.type,parentSchema:we.properties.mark,data:d};n===null?n=[m]:n.push(m),a++}}if(t.badge!==void 0){let d=t.badge,m=a,h=!1,y=a;if(typeof d!="boolean"){let u={instancePath:e+"/badge",schemaPath:"#/properties/badge/anyOf/0/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:we.properties.badge.anyOf[0].type,parentSchema:we.properties.badge.anyOf[0],data:d};n===null?n=[u]:n.push(u),a++}var c=y===a;h=h||c;let g=a;if(typeof d=="string"){if(!It.test(d)){let u={instancePath:e+"/badge",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:d};n===null?n=[u]:n.push(u),a++}}else{let u={instancePath:e+"/badge",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:d};n===null?n=[u]:n.push(u),a++}var c=g===a;h=h||c;let k=a;if(Array.isArray(d)){if(d.length>3){let b={instancePath:e+"/badge",schemaPath:"#/properties/badge/anyOf/2/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:we.properties.badge.anyOf[2],data:d};n===null?n=[b]:n.push(b),a++}if(d.length<2){let b={instancePath:e+"/badge",schemaPath:"#/properties/badge/anyOf/2/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:we.properties.badge.anyOf[2],data:d};n===null?n=[b]:n.push(b),a++}let u=d.length;for(let b=0;b<u;b++){let x=d[b];if(typeof x!="number"){let w={instancePath:e+"/badge/"+b,schemaPath:"#/properties/badge/anyOf/2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:we.properties.badge.anyOf[2].items.type,parentSchema:we.properties.badge.anyOf[2].items,data:x};n===null?n=[w]:n.push(w),a++}}}else{let u={instancePath:e+"/badge",schemaPath:"#/properties/badge/anyOf/2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:we.properties.badge.anyOf[2].type,parentSchema:we.properties.badge.anyOf[2],data:d};n===null?n=[u]:n.push(u),a++}var c=k===a;if(h=h||c,h)a=m,n!==null&&(m?n.length=m:n=null);else{let u={instancePath:e+"/badge",schemaPath:"#/properties/badge/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:we.properties.badge.anyOf,parentSchema:we.properties.badge,data:d};n===null?n=[u]:n.push(u),a++}}if(t.duration!==void 0){let d=t.duration,m=a,h=!1,y=a;if(d!=="auto"){let k={instancePath:e+"/duration",schemaPath:"#/properties/duration/anyOf/0/const",keyword:"const",params:{allowedValue:"auto"},message:"must be equal to constant",schema:"auto",parentSchema:we.properties.duration.anyOf[0],data:d};n===null?n=[k]:n.push(k),a++}var l=y===a;h=h||l;let g=a;if(!(typeof d=="number"&&!(d%1)&&!isNaN(d))){let k={instancePath:e+"/duration",schemaPath:"#/properties/duration/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:we.properties.duration.anyOf[1].type,parentSchema:we.properties.duration.anyOf[1],data:d};n===null?n=[k]:n.push(k),a++}if(typeof d=="number"&&(d<500||isNaN(d))){let k={instancePath:e+"/duration",schemaPath:"#/properties/duration/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:500},message:"must be >= 500",schema:500,parentSchema:we.properties.duration.anyOf[1],data:d};n===null?n=[k]:n.push(k),a++}var l=g===a;if(h=h||l,h)a=m,n!==null&&(m?n.length=m:n=null);else{let k={instancePath:e+"/duration",schemaPath:"#/properties/duration/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:we.properties.duration.anyOf,parentSchema:we.properties.duration,data:d};n===null?n=[k]:n.push(k),a++}}}else{let d={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:we.type,parentSchema:we,data:t};n===null?n=[d]:n.push(d),a++}return ri.errors=n,a===0}ri.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function ii(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=ii.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let l={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'",schema:ve.required,parentSchema:ve,data:t};n===null?n=[l]:n.push(l),a++}if(t.title===void 0){let l={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"title"},message:"must have required property 'title'",schema:ve.required,parentSchema:ve,data:t};n===null?n=[l]:n.push(l),a++}for(let l in t)if(!co.call(ve.properties,l)){let d={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:l},message:"must NOT have additional properties",schema:!1,parentSchema:ve,data:t};n===null?n=[d]:n.push(d),a++}if(t.id!==void 0){let l=t.id;if(typeof l=="string"){if(!It.test(l)){let d={instancePath:e+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}if(t.title!==void 0){let l=t.title;if(typeof l!="string"){let d={instancePath:e+"/title",schemaPath:"#/properties/title/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ve.properties.title.type,parentSchema:ve.properties.title,data:l};n===null?n=[d]:n.push(d),a++}}if(t.ants!==void 0){let l=t.ants,d=a,m=!1,h=a;if(typeof l!="boolean"){let k={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf/0/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:ve.properties.ants.anyOf[0].type,parentSchema:ve.properties.ants.anyOf[0],data:l};n===null?n=[k]:n.push(k),a++}var p=h===a;m=m||p;let y=a;if(Array.isArray(l)){let k=l.length;for(let u=0;u<k;u++){let b=l[u];if(typeof b!="string"){let x={instancePath:e+"/ants/"+u,schemaPath:"#/properties/ants/anyOf/1/items/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ve.properties.ants.anyOf[1].items.type,parentSchema:ve.properties.ants.anyOf[1].items,data:b};n===null?n=[x]:n.push(x),a++}}}else{let k={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ve.properties.ants.anyOf[1].type,parentSchema:ve.properties.ants.anyOf[1],data:l};n===null?n=[k]:n.push(k),a++}var p=y===a;m=m||p;let g=a;if(l&&typeof l=="object"&&!Array.isArray(l)){for(let k in l)if(!(k==="ids"||k==="speed"||k==="dash")){let u={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf/2/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:k},message:"must NOT have additional properties",schema:!1,parentSchema:ve.properties.ants.anyOf[2],data:l};n===null?n=[u]:n.push(u),a++}if(l.ids!==void 0){let k=l.ids;if(Array.isArray(k)){let u=k.length;for(let b=0;b<u;b++){let x=k[b];if(typeof x!="string"){let w={instancePath:e+"/ants/ids/"+b,schemaPath:"#/properties/ants/anyOf/2/properties/ids/items/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ve.properties.ants.anyOf[2].properties.ids.items.type,parentSchema:ve.properties.ants.anyOf[2].properties.ids.items,data:x};n===null?n=[w]:n.push(w),a++}}}else{let u={instancePath:e+"/ants/ids",schemaPath:"#/properties/ants/anyOf/2/properties/ids/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ve.properties.ants.anyOf[2].properties.ids.type,parentSchema:ve.properties.ants.anyOf[2].properties.ids,data:k};n===null?n=[u]:n.push(u),a++}}if(l.speed!==void 0){let k=l.speed;if(typeof k!="number"){let u={instancePath:e+"/ants/speed",schemaPath:"#/properties/ants/anyOf/2/properties/speed/type",keyword:"type",params:{type:"number"},message:"must be number",schema:ve.properties.ants.anyOf[2].properties.speed.type,parentSchema:ve.properties.ants.anyOf[2].properties.speed,data:k};n===null?n=[u]:n.push(u),a++}}if(l.dash!==void 0){let k=l.dash;if(Array.isArray(k)){if(k.length>2){let b={instancePath:e+"/ants/dash",schemaPath:"#/properties/ants/anyOf/2/properties/dash/maxItems",keyword:"maxItems",params:{limit:2},message:"must NOT have more than 2 items",schema:2,parentSchema:ve.properties.ants.anyOf[2].properties.dash,data:k};n===null?n=[b]:n.push(b),a++}if(k.length<2){let b={instancePath:e+"/ants/dash",schemaPath:"#/properties/ants/anyOf/2/properties/dash/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:ve.properties.ants.anyOf[2].properties.dash,data:k};n===null?n=[b]:n.push(b),a++}let u=k.length;for(let b=0;b<u;b++){let x=k[b];if(typeof x=="number"){if(x<=0||isNaN(x)){let w={instancePath:e+"/ants/dash/"+b,schemaPath:"#/properties/ants/anyOf/2/properties/dash/items/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:ve.properties.ants.anyOf[2].properties.dash.items,data:x};n===null?n=[w]:n.push(w),a++}}else{let w={instancePath:e+"/ants/dash/"+b,schemaPath:"#/properties/ants/anyOf/2/properties/dash/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:ve.properties.ants.anyOf[2].properties.dash.items.type,parentSchema:ve.properties.ants.anyOf[2].properties.dash.items,data:x};n===null?n=[w]:n.push(w),a++}}}else{let u={instancePath:e+"/ants/dash",schemaPath:"#/properties/ants/anyOf/2/properties/dash/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ve.properties.ants.anyOf[2].properties.dash.type,parentSchema:ve.properties.ants.anyOf[2].properties.dash,data:k};n===null?n=[u]:n.push(u),a++}}}else{let k={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf/2/type",keyword:"type",params:{type:"object"},message:"must be object",schema:ve.properties.ants.anyOf[2].type,parentSchema:ve.properties.ants.anyOf[2],data:l};n===null?n=[k]:n.push(k),a++}var p=g===a;if(m=m||p,m)a=d,n!==null&&(d?n.length=d:n=null);else{let k={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:ve.properties.ants.anyOf,parentSchema:ve.properties.ants,data:l};n===null?n=[k]:n.push(k),a++}}if(t.motion!==void 0){let l=t.motion;if(!(l&&typeof l=="object"&&!Array.isArray(l))){let d={instancePath:e+"/motion",schemaPath:"#/properties/motion/type",keyword:"type",params:{type:"object"},message:"must be object",schema:ve.properties.motion.type,parentSchema:ve.properties.motion,data:l};n===null?n=[d]:n.push(d),a++}}if(t.caption!==void 0){let l=t.caption;if(typeof l!="string"){let d={instancePath:e+"/caption",schemaPath:"#/properties/caption/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ve.properties.caption.type,parentSchema:ve.properties.caption,data:l};n===null?n=[d]:n.push(d),a++}}if(t.aria!==void 0){let l=t.aria;if(typeof l!="string"){let d={instancePath:e+"/aria",schemaPath:"#/properties/aria/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ve.properties.aria.type,parentSchema:ve.properties.aria,data:l};n===null?n=[d]:n.push(d),a++}}if(t.gap!==void 0){let l=t.gap;if(typeof l=="number"){if(l<=0||isNaN(l)){let d={instancePath:e+"/gap",schemaPath:"#/properties/gap/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:ve.properties.gap,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/gap",schemaPath:"#/properties/gap/type",keyword:"type",params:{type:"number"},message:"must be number",schema:ve.properties.gap.type,parentSchema:ve.properties.gap,data:l};n===null?n=[d]:n.push(d),a++}}if(t.flow!==void 0){let l=t.flow;if(!(l==="row"||l==="column")){let d={instancePath:e+"/flow",schemaPath:"#/properties/flow/enum",keyword:"enum",params:{allowedValues:ve.properties.flow.enum},message:"must be equal to one of the allowed values",schema:ve.properties.flow.enum,parentSchema:ve.properties.flow,data:l};n===null?n=[d]:n.push(d),a++}}if(t.regions!==void 0){let l=t.regions;if(Array.isArray(l)){let d=l.length;for(let m=0;m<d;m++)mr(l[m],{instancePath:e+"/regions/"+m,parentData:l,parentDataProperty:m,rootData:i,dynamicAnchors:o})||(n=n===null?mr.errors:n.concat(mr.errors),a=n.length)}else{let d={instancePath:e+"/regions",schemaPath:"#/properties/regions/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ve.properties.regions.type,parentSchema:ve.properties.regions,data:l};n===null?n=[d]:n.push(d),a++}}if(t.nodes!==void 0){let l=t.nodes;if(Array.isArray(l)){let d=l.length;for(let m=0;m<d;m++)hs(l[m],{instancePath:e+"/nodes/"+m,parentData:l,parentDataProperty:m,rootData:i,dynamicAnchors:o})||(n=n===null?hs.errors:n.concat(hs.errors),a=n.length)}else{let d={instancePath:e+"/nodes",schemaPath:"#/properties/nodes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ve.properties.nodes.type,parentSchema:ve.properties.nodes,data:l};n===null?n=[d]:n.push(d),a++}}if(t.routes!==void 0){let l=t.routes;if(Array.isArray(l)){let d=l.length;for(let m=0;m<d;m++)ti(l[m],{instancePath:e+"/routes/"+m,parentData:l,parentDataProperty:m,rootData:i,dynamicAnchors:o})||(n=n===null?ti.errors:n.concat(ti.errors),a=n.length)}else{let d={instancePath:e+"/routes",schemaPath:"#/properties/routes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ve.properties.routes.type,parentSchema:ve.properties.routes,data:l};n===null?n=[d]:n.push(d),a++}}if(t.notes!==void 0){let l=t.notes;if(Array.isArray(l)){let d=l.length;for(let m=0;m<d;m++)ni(l[m],{instancePath:e+"/notes/"+m,parentData:l,parentDataProperty:m,rootData:i,dynamicAnchors:o})||(n=n===null?ni.errors:n.concat(ni.errors),a=n.length)}else{let d={instancePath:e+"/notes",schemaPath:"#/properties/notes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ve.properties.notes.type,parentSchema:ve.properties.notes,data:l};n===null?n=[d]:n.push(d),a++}}if(t.steps!==void 0){let l=t.steps;if(Array.isArray(l)){let d=l.length;for(let m=0;m<d;m++)ri(l[m],{instancePath:e+"/steps/"+m,parentData:l,parentDataProperty:m,rootData:i,dynamicAnchors:o})||(n=n===null?ri.errors:n.concat(ri.errors),a=n.length)}else{let d={instancePath:e+"/steps",schemaPath:"#/properties/steps/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ve.properties.steps.type,parentSchema:ve.properties.steps,data:l};n===null?n=[d]:n.push(d),a++}}if(t.legend!==void 0){let l=t.legend,d=a,m=!1,h=a;if(l!=="auto"){let k={instancePath:e+"/legend",schemaPath:"#/properties/legend/anyOf/0/enum",keyword:"enum",params:{allowedValues:ve.properties.legend.anyOf[0].enum},message:"must be equal to one of the allowed values",schema:ve.properties.legend.anyOf[0].enum,parentSchema:ve.properties.legend.anyOf[0],data:l};n===null?n=[k]:n.push(k),a++}var c=h===a;m=m||c;let y=a;if(l!==!1){let k={instancePath:e+"/legend",schemaPath:"#/properties/legend/anyOf/1/const",keyword:"const",params:{allowedValue:!1},message:"must be equal to constant",schema:!1,parentSchema:ve.properties.legend.anyOf[1],data:l};n===null?n=[k]:n.push(k),a++}var c=y===a;m=m||c;let g=a;if(Array.isArray(l)){let k=l.length;for(let u=0;u<k;u++){let b=l[u];if(typeof b!="string"){let x={instancePath:e+"/legend/"+u,schemaPath:"#/properties/legend/anyOf/2/items/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ve.properties.legend.anyOf[2].items.type,parentSchema:ve.properties.legend.anyOf[2].items,data:b};n===null?n=[x]:n.push(x),a++}}}else{let k={instancePath:e+"/legend",schemaPath:"#/properties/legend/anyOf/2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ve.properties.legend.anyOf[2].type,parentSchema:ve.properties.legend.anyOf[2],data:l};n===null?n=[k]:n.push(k),a++}var c=g===a;if(m=m||c,m)a=d,n!==null&&(d?n.length=d:n=null);else{let k={instancePath:e+"/legend",schemaPath:"#/properties/legend/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:ve.properties.legend.anyOf,parentSchema:ve.properties.legend,data:l};n===null?n=[k]:n.push(k),a++}}if(t.badges!==void 0){let l=t.badges;if(typeof l!="boolean"){let d={instancePath:e+"/badges",schemaPath:"#/properties/badges/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:ve.properties.badges.type,parentSchema:ve.properties.badges,data:l};n===null?n=[d]:n.push(d),a++}}if(t.grid!==void 0){let l=t.grid;if(l&&typeof l=="object"&&!Array.isArray(l)){for(let d in l)if(!(d==="snap"||d==="show"||d==="step")){let m={instancePath:e+"/grid",schemaPath:"#/$defs/grid/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:d},message:"must NOT have additional properties",schema:!1,parentSchema:Rt,data:l};n===null?n=[m]:n.push(m),a++}if(l.snap!==void 0){let d=l.snap;if(typeof d=="number"){if(d<=0||isNaN(d)){let m={instancePath:e+"/grid/snap",schemaPath:"#/$defs/grid/properties/snap/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Rt.properties.snap,data:d};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e+"/grid/snap",schemaPath:"#/$defs/grid/properties/snap/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Rt.properties.snap.type,parentSchema:Rt.properties.snap,data:d};n===null?n=[m]:n.push(m),a++}}if(l.show!==void 0){let d=l.show;if(typeof d!="boolean"){let m={instancePath:e+"/grid/show",schemaPath:"#/$defs/grid/properties/show/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Rt.properties.show.type,parentSchema:Rt.properties.show,data:d};n===null?n=[m]:n.push(m),a++}}if(l.step!==void 0){let d=l.step;if(typeof d=="number"){if(d<=0||isNaN(d)){let m={instancePath:e+"/grid/step",schemaPath:"#/$defs/grid/properties/step/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Rt.properties.step,data:d};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e+"/grid/step",schemaPath:"#/$defs/grid/properties/step/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Rt.properties.step.type,parentSchema:Rt.properties.step,data:d};n===null?n=[m]:n.push(m),a++}}}else{let d={instancePath:e+"/grid",schemaPath:"#/$defs/grid/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Rt.type,parentSchema:Rt,data:l};n===null?n=[d]:n.push(d),a++}}if(t.assemble!==void 0){let l=t.assemble;if(typeof l!="boolean"){let d={instancePath:e+"/assemble",schemaPath:"#/properties/assemble/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:ve.properties.assemble.type,parentSchema:ve.properties.assemble,data:l};n===null?n=[d]:n.push(d),a++}}if(t.loop!==void 0){let l=t.loop;if(typeof l!="boolean"){let d={instancePath:e+"/loop",schemaPath:"#/properties/loop/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:ve.properties.loop.type,parentSchema:ve.properties.loop,data:l};n===null?n=[d]:n.push(d),a++}}if(t.dim!==void 0){let l=t.dim;if(!(l==="flows"||l==="all")){let d={instancePath:e+"/dim",schemaPath:"#/properties/dim/enum",keyword:"enum",params:{allowedValues:ve.properties.dim.enum},message:"must be equal to one of the allowed values",schema:ve.properties.dim.enum,parentSchema:ve.properties.dim,data:l};n===null?n=[d]:n.push(d),a++}}if(t.after!==void 0){let l=t.after;if(typeof l!="string"){let d={instancePath:e+"/after",schemaPath:"#/properties/after/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ve.properties.after.type,parentSchema:ve.properties.after,data:l};n===null?n=[d]:n.push(d),a++}}}else{let l={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:ve.type,parentSchema:ve,data:t};n===null?n=[l]:n.push(l),a++}return ii.errors=n,a===0}ii.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function $l(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=$l.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(t.isodiag===void 0){let p={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"isodiag"},message:"must have required property 'isodiag'",schema:rt.required,parentSchema:rt,data:t};n===null?n=[p]:n.push(p),a++}if(t.scenes===void 0){let p={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"scenes"},message:"must have required property 'scenes'",schema:rt.required,parentSchema:rt,data:t};n===null?n=[p]:n.push(p),a++}for(let p in t)if(!co.call(rt.properties,p)){let c={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:p},message:"must NOT have additional properties",schema:!1,parentSchema:rt,data:t};n===null?n=[c]:n.push(c),a++}if(t.isodiag!==void 0){let p=t.isodiag;if(p!==1){let c={instancePath:e+"/isodiag",schemaPath:"#/properties/isodiag/const",keyword:"const",params:{allowedValue:1},message:"must be equal to constant",schema:1,parentSchema:rt.properties.isodiag,data:p};n===null?n=[c]:n.push(c),a++}}if(t.title!==void 0){let p=t.title;if(typeof p!="string"){let c={instancePath:e+"/title",schemaPath:"#/properties/title/type",keyword:"type",params:{type:"string"},message:"must be string",schema:rt.properties.title.type,parentSchema:rt.properties.title,data:p};n===null?n=[c]:n.push(c),a++}}if(t.lede!==void 0){let p=t.lede;if(typeof p!="string"){let c={instancePath:e+"/lede",schemaPath:"#/properties/lede/type",keyword:"type",params:{type:"string"},message:"must be string",schema:rt.properties.lede.type,parentSchema:rt.properties.lede,data:p};n===null?n=[c]:n.push(c),a++}}if(t.pills!==void 0){let p=t.pills;if(Array.isArray(p)){let c=p.length;for(let l=0;l<c;l++){let d=p[l];if(typeof d!="string"){let m={instancePath:e+"/pills/"+l,schemaPath:"#/properties/pills/items/type",keyword:"type",params:{type:"string"},message:"must be string",schema:rt.properties.pills.items.type,parentSchema:rt.properties.pills.items,data:d};n===null?n=[m]:n.push(m),a++}}}else{let c={instancePath:e+"/pills",schemaPath:"#/properties/pills/type",keyword:"type",params:{type:"array"},message:"must be array",schema:rt.properties.pills.type,parentSchema:rt.properties.pills,data:p};n===null?n=[c]:n.push(c),a++}}if(t.theme!==void 0){let p=t.theme;if(typeof p!="string"){let c={instancePath:e+"/theme",schemaPath:"#/properties/theme/type",keyword:"type",params:{type:"string"},message:"must be string",schema:rt.properties.theme.type,parentSchema:rt.properties.theme,data:p};n===null?n=[c]:n.push(c),a++}}if(t.roles!==void 0){let p=t.roles;if(p&&typeof p=="object"&&!Array.isArray(p))for(let c in p){let l=p[c];if(l&&typeof l=="object"&&!Array.isArray(l)){if(l.h===void 0){let d={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/role/required",keyword:"required",params:{missingProperty:"h"},message:"must have required property 'h'",schema:Lt.required,parentSchema:Lt,data:l};n===null?n=[d]:n.push(d),a++}if(l.s===void 0){let d={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/role/required",keyword:"required",params:{missingProperty:"s"},message:"must have required property 's'",schema:Lt.required,parentSchema:Lt,data:l};n===null?n=[d]:n.push(d),a++}for(let d in l)if(!(d==="h"||d==="s"||d==="top"||d==="tint")){let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/role/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:d},message:"must NOT have additional properties",schema:!1,parentSchema:Lt,data:l};n===null?n=[m]:n.push(m),a++}if(l.h!==void 0){let d=l.h;if(typeof d=="number"){if(d>360||isNaN(d)){let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/h",schemaPath:"#/$defs/role/properties/h/maximum",keyword:"maximum",params:{comparison:"<=",limit:360},message:"must be <= 360",schema:360,parentSchema:Lt.properties.h,data:d};n===null?n=[m]:n.push(m),a++}if(d<0||isNaN(d)){let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/h",schemaPath:"#/$defs/role/properties/h/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:Lt.properties.h,data:d};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/h",schemaPath:"#/$defs/role/properties/h/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Lt.properties.h.type,parentSchema:Lt.properties.h,data:d};n===null?n=[m]:n.push(m),a++}}if(l.s!==void 0){let d=l.s;if(typeof d=="number"){if(d>100||isNaN(d)){let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/s",schemaPath:"#/$defs/role/properties/s/maximum",keyword:"maximum",params:{comparison:"<=",limit:100},message:"must be <= 100",schema:100,parentSchema:Lt.properties.s,data:d};n===null?n=[m]:n.push(m),a++}if(d<0||isNaN(d)){let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/s",schemaPath:"#/$defs/role/properties/s/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:Lt.properties.s,data:d};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/s",schemaPath:"#/$defs/role/properties/s/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Lt.properties.s.type,parentSchema:Lt.properties.s,data:d};n===null?n=[m]:n.push(m),a++}}if(l.top!==void 0){let d=l.top;if(typeof d!="string"){let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/top",schemaPath:"#/$defs/role/properties/top/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Lt.properties.top.type,parentSchema:Lt.properties.top,data:d};n===null?n=[m]:n.push(m),a++}}if(l.tint!==void 0){let d=l.tint;if(typeof d=="number"){if(d>100||isNaN(d)){let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/tint",schemaPath:"#/$defs/role/properties/tint/maximum",keyword:"maximum",params:{comparison:"<=",limit:100},message:"must be <= 100",schema:100,parentSchema:Lt.properties.tint,data:d};n===null?n=[m]:n.push(m),a++}if(d<0||isNaN(d)){let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/tint",schemaPath:"#/$defs/role/properties/tint/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:Lt.properties.tint,data:d};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/tint",schemaPath:"#/$defs/role/properties/tint/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Lt.properties.tint.type,parentSchema:Lt.properties.tint,data:d};n===null?n=[m]:n.push(m),a++}}}else{let d={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/role/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Lt.type,parentSchema:Lt,data:l};n===null?n=[d]:n.push(d),a++}}else{let c={instancePath:e+"/roles",schemaPath:"#/properties/roles/type",keyword:"type",params:{type:"object"},message:"must be object",schema:rt.properties.roles.type,parentSchema:rt.properties.roles,data:p};n===null?n=[c]:n.push(c),a++}}if(t.kinds!==void 0){let p=t.kinds;if(p&&typeof p=="object"&&!Array.isArray(p))for(let c in p){let l=p[c];if(l&&typeof l=="object"&&!Array.isArray(l)){for(let d in l)if(!(d==="legend"||d==="like"||d==="color"||d==="dash")){let m={instancePath:e+"/kinds/"+c.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/kindDef/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:d},message:"must NOT have additional properties",schema:!1,parentSchema:jn,data:l};n===null?n=[m]:n.push(m),a++}if(l.legend!==void 0){let d=l.legend;if(typeof d!="string"){let m={instancePath:e+"/kinds/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/legend",schemaPath:"#/$defs/kindDef/properties/legend/type",keyword:"type",params:{type:"string"},message:"must be string",schema:jn.properties.legend.type,parentSchema:jn.properties.legend,data:d};n===null?n=[m]:n.push(m),a++}}if(l.like!==void 0){let d=l.like;if(typeof d!="string"){let m={instancePath:e+"/kinds/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/like",schemaPath:"#/$defs/kindDef/properties/like/type",keyword:"type",params:{type:"string"},message:"must be string",schema:jn.properties.like.type,parentSchema:jn.properties.like,data:d};n===null?n=[m]:n.push(m),a++}}if(l.color!==void 0){let d=l.color;if(typeof d!="string"){let m={instancePath:e+"/kinds/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/color",schemaPath:"#/$defs/kindDef/properties/color/type",keyword:"type",params:{type:"string"},message:"must be string",schema:jn.properties.color.type,parentSchema:jn.properties.color,data:d};n===null?n=[m]:n.push(m),a++}}if(l.dash!==void 0){let d=l.dash;if(!(d==="solid"||d==="dashed"||d==="dotted")){let m={instancePath:e+"/kinds/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/dash",schemaPath:"#/$defs/kindDef/properties/dash/enum",keyword:"enum",params:{allowedValues:jn.properties.dash.enum},message:"must be equal to one of the allowed values",schema:jn.properties.dash.enum,parentSchema:jn.properties.dash,data:d};n===null?n=[m]:n.push(m),a++}}}else{let d={instancePath:e+"/kinds/"+c.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/kindDef/type",keyword:"type",params:{type:"object"},message:"must be object",schema:jn.type,parentSchema:jn,data:l};n===null?n=[d]:n.push(d),a++}}else{let c={instancePath:e+"/kinds",schemaPath:"#/properties/kinds/type",keyword:"type",params:{type:"object"},message:"must be object",schema:rt.properties.kinds.type,parentSchema:rt.properties.kinds,data:p};n===null?n=[c]:n.push(c),a++}}if(t.after!==void 0){let p=t.after;if(typeof p!="string"){let c={instancePath:e+"/after",schemaPath:"#/properties/after/type",keyword:"type",params:{type:"string"},message:"must be string",schema:rt.properties.after.type,parentSchema:rt.properties.after,data:p};n===null?n=[c]:n.push(c),a++}}if(t.grid!==void 0){let p=t.grid;if(p&&typeof p=="object"&&!Array.isArray(p)){for(let c in p)if(!(c==="snap"||c==="show"||c==="step")){let l={instancePath:e+"/grid",schemaPath:"#/$defs/grid/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:c},message:"must NOT have additional properties",schema:!1,parentSchema:Rt,data:p};n===null?n=[l]:n.push(l),a++}if(p.snap!==void 0){let c=p.snap;if(typeof c=="number"){if(c<=0||isNaN(c)){let l={instancePath:e+"/grid/snap",schemaPath:"#/$defs/grid/properties/snap/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Rt.properties.snap,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/grid/snap",schemaPath:"#/$defs/grid/properties/snap/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Rt.properties.snap.type,parentSchema:Rt.properties.snap,data:c};n===null?n=[l]:n.push(l),a++}}if(p.show!==void 0){let c=p.show;if(typeof c!="boolean"){let l={instancePath:e+"/grid/show",schemaPath:"#/$defs/grid/properties/show/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Rt.properties.show.type,parentSchema:Rt.properties.show,data:c};n===null?n=[l]:n.push(l),a++}}if(p.step!==void 0){let c=p.step;if(typeof c=="number"){if(c<=0||isNaN(c)){let l={instancePath:e+"/grid/step",schemaPath:"#/$defs/grid/properties/step/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Rt.properties.step,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/grid/step",schemaPath:"#/$defs/grid/properties/step/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Rt.properties.step.type,parentSchema:Rt.properties.step,data:c};n===null?n=[l]:n.push(l),a++}}}else{let c={instancePath:e+"/grid",schemaPath:"#/$defs/grid/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Rt.type,parentSchema:Rt,data:p};n===null?n=[c]:n.push(c),a++}}if(t.assemble!==void 0){let p=t.assemble;if(typeof p!="boolean"){let c={instancePath:e+"/assemble",schemaPath:"#/properties/assemble/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:rt.properties.assemble.type,parentSchema:rt.properties.assemble,data:p};n===null?n=[c]:n.push(c),a++}}if(t.footer!==void 0){let p=t.footer;if(typeof p!="string"){let c={instancePath:e+"/footer",schemaPath:"#/properties/footer/type",keyword:"type",params:{type:"string"},message:"must be string",schema:rt.properties.footer.type,parentSchema:rt.properties.footer,data:p};n===null?n=[c]:n.push(c),a++}}if(t.treatment!==void 0){let p=t.treatment;if(p!=="mono"){let c={instancePath:e+"/treatment",schemaPath:"#/properties/treatment/enum",keyword:"enum",params:{allowedValues:rt.properties.treatment.enum},message:"must be equal to one of the allowed values",schema:rt.properties.treatment.enum,parentSchema:rt.properties.treatment,data:p};n===null?n=[c]:n.push(c),a++}}if(t.scenes!==void 0){let p=t.scenes;if(Array.isArray(p)){if(p.length<1){let l={instancePath:e+"/scenes",schemaPath:"#/properties/scenes/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items",schema:1,parentSchema:rt.properties.scenes,data:p};n===null?n=[l]:n.push(l),a++}let c=p.length;for(let l=0;l<c;l++)ii(p[l],{instancePath:e+"/scenes/"+l,parentData:p,parentDataProperty:l,rootData:i,dynamicAnchors:o})||(n=n===null?ii.errors:n.concat(ii.errors),a=n.length)}else{let c={instancePath:e+"/scenes",schemaPath:"#/properties/scenes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:rt.properties.scenes.type,parentSchema:rt.properties.scenes,data:p};n===null?n=[c]:n.push(c),a++}}}else{let p={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:rt.type,parentSchema:rt,data:t};n===null?n=[p]:n.push(p),a++}return $l.errors=n,a===0}$l.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function vy(t){let e=JSON.stringify(t),s=2166136261;for(let r=0;r<e.length;r++)s^=e.charCodeAt(r),s=Math.imul(s,16777619)>>>0;return s.toString(16)+":"+e.length}var My=new Map([["28016100:13106",Tm]]);function Mp(t){let e=My.get(vy(t));if(!e)throw new Error(`schema not precompiled into the page: ${t.$id??t.title??"?"}`);return e}var Pp={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://isodiag.local/schema/isodiag-1.json",title:"isodiag diagram",description:"A page of isometric, animated diagrams. See docs/FORMAT.md.",type:"object",required:["isodiag","scenes"],additionalProperties:!1,properties:{isodiag:{const:1,description:"Format version. Always 1."},title:{type:"string"},lede:{type:"string"},pills:{type:"array",items:{type:"string"}},theme:{type:"string",description:"'default' or a path to a theme file"},roles:{type:"object",description:"Extra or changed colour roles for nodes and regions",additionalProperties:{$ref:"#/$defs/role"}},kinds:{type:"object",description:"Extra flow kinds, or new legend text for the standard ones",additionalProperties:{$ref:"#/$defs/kindDef"}},after:{type:"string",description:"Markdown shown after all scenes"},grid:{$ref:"#/$defs/grid"},assemble:{type:"boolean",description:"draw each scene by flying its parts in from the nearest edge, then play"},footer:{type:"string"},treatment:{enum:["mono"],description:"How a self-contained drawing (renderSvg, <isometric-diagram>) is painted: mono, black and white. A host may say otherwise. The page isodiag build writes is in colour."},scenes:{type:"array",minItems:1,items:{$ref:"#/$defs/scene"}}},$defs:{motion:{type:"object",additionalProperties:!1,minProperties:1,description:"how this piece (a region: its contents too) moves when the drawing assembles or disassembles",properties:{style:{enum:["edge","drop","rise","fly","pop","scatter","build","fade"],description:"how it arrives"},out:{enum:["explode","lift-off","sink","scatter","fly-out","collapse","fade","reverse"],description:"how it leaves"},easing:{enum:["linear","ease","ease-in","ease-out","settle","spring","bounce"]},from:{enum:["left","right","top","bottom"],description:"fly: the side it comes from"},delay:{type:"number",minimum:0,description:"ms after its turn"},duration:{type:"number",exclusiveMinimum:0,description:"ms its own move takes"}}},variants:{type:"object",minProperties:1,propertyNames:{$ref:"#/$defs/id"},description:"other looks of it, by name, for a motion to switch to (its box stays as it is)",additionalProperties:{type:"object",additionalProperties:!1,minProperties:1,properties:{role:{type:"string"},ghost:{type:"boolean"},label:{type:"string"},sub:{type:"string"},face:{type:"string",pattern:"^[a-z][a-z0-9-]*$"},deco:{type:"array",items:{$ref:"#/$defs/deco"}}}}},id:{type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},grid:{type:"object",additionalProperties:!1,properties:{snap:{type:"number",exclusiveMinimum:0,description:"round every placed edge and route waypoint to this step, in grid units"},show:{type:"boolean",description:"draw the floor grid when the page opens (the Grid button toggles it)"},step:{type:"number",exclusiveMinimum:0,description:"spacing of the drawn grid lines; default the snap step, or 1"}}},num:{type:"number"},point2:{type:"array",items:{type:"number"},minItems:2,maxItems:2},size2or3:{type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:3},stepRef:{anyOf:[{type:"string"},{type:"integer",minimum:1}]},side:{enum:["n","e","s","w"]},align:{enum:["start","center","end"]},role:{type:"object",additionalProperties:!1,required:["h","s"],properties:{h:{type:"number",minimum:0,maximum:360,description:"hue"},s:{type:"number",minimum:0,maximum:100,description:"saturation, percent"},top:{type:"string",description:"CSS colour for the top face, overriding the computed one"},tint:{type:"number",minimum:0,maximum:100,description:"percent of the role colour mixed into the pad colour for the top face"}}},kindDef:{type:"object",additionalProperties:!1,properties:{legend:{type:"string"},like:{type:"string",description:"a standard kind whose colour and line style this one uses"},color:{type:"string"},dash:{enum:["solid","dashed","dotted"]}}},placement:{properties:{in:{$ref:"#/$defs/id"},at:{$ref:"#/$defs/point2"},"right-of":{$ref:"#/$defs/id"},"left-of":{$ref:"#/$defs/id"},below:{$ref:"#/$defs/id"},behind:{$ref:"#/$defs/id"},gap:{type:"number"},align:{$ref:"#/$defs/align"},shift:{$ref:"#/$defs/point2",description:"nudge after placement, grid units [dx, dy]"},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},scene:{type:"object",required:["id","title"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},title:{type:"string"},ants:{description:"its connectors march, showing which way they flow: all that may, these, or with a speed (units a second) and a dash",anyOf:[{type:"boolean"},{type:"array",items:{type:"string"}},{type:"object",additionalProperties:!1,properties:{ids:{type:"array",items:{type:"string"}},speed:{type:"number"},dash:{type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:2}}}]},motion:{type:"object",description:"the scene's motion document (isomotion/1; its `isomotion: 1` may be left out)"},caption:{type:"string"},aria:{type:"string"},gap:{type:"number",exclusiveMinimum:0},flow:{enum:["row","column"]},regions:{type:"array",items:{$ref:"#/$defs/region"}},nodes:{type:"array",items:{$ref:"#/$defs/node"}},routes:{type:"array",items:{$ref:"#/$defs/route"}},notes:{type:"array",items:{$ref:"#/$defs/note"}},steps:{type:"array",items:{$ref:"#/$defs/step"}},legend:{anyOf:[{enum:["auto"]},{const:!1},{type:"array",items:{type:"string"}}]},badges:{type:"boolean"},grid:{$ref:"#/$defs/grid"},assemble:{type:"boolean",description:"draw the scene by flying its parts in from the nearest edge, then play"},loop:{type:"boolean",description:"the player wraps from the last step to the first (default true)"},dim:{enum:["flows","all"],description:"what a step dims: only flows, their labels and marks (default), or nodes too"},after:{type:"string"}}},region:{type:"object",required:["id","kind"],unevaluatedProperties:!1,allOf:[{$ref:"#/$defs/placement"}],properties:{id:{$ref:"#/$defs/id"},kind:{enum:["slab","pad","fence","vm","cloud","zone","platform","tunnel"]},label:{type:"string"},"label-style":{enum:["face","face-right","floor","none"]},ghost:{type:"boolean",description:"drawn as a dashed outline: not there yet, out of reach, or stopped"},role:{type:"string"},size:{$ref:"#/$defs/size2or3"},padding:{type:"number",minimum:0},height:{type:"number",exclusiveMinimum:0},z:{type:"number",description:"lift above the floor it stands on (tunnels)"},flow:{enum:["row","column"]},gate:{type:"object",additionalProperties:!1,required:["side"],properties:{side:{$ref:"#/$defs/side"},at:{type:"number",minimum:0,maximum:1,description:"centre of the gate along the wall, 0..1"},width:{type:"number",exclusiveMinimum:0},height:{type:"number",exclusiveMinimum:0},node:{$ref:"#/$defs/id"}}},around:{type:"array",items:{$ref:"#/$defs/id"},description:"tunnel: routes it wraps"},regions:{type:"array",items:{$ref:"#/$defs/region"}},motion:{$ref:"#/$defs/motion"},variants:{$ref:"#/$defs/variants"},nodes:{type:"array",items:{$ref:"#/$defs/node"}}}},deco:{anyOf:[{enum:["envelope","bubble","file-lines","ghost","terminal"]},{type:"object",additionalProperties:!1,minProperties:1,maxProperties:1,properties:{terminal:{type:"integer",minimum:1,maximum:8},icon:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"an icon the host registers (none by default); one nothing registers is drawn as a placeholder, with a warning"},screen:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"terminal, chat, desktop, tiles, or a face the host registers"}}}]},node:{type:"object",required:["id"],unevaluatedProperties:!1,allOf:[{$ref:"#/$defs/placement"}],properties:{id:{$ref:"#/$defs/id"},asset:{type:"string",description:"asset name from the library; default 'block'"},role:{type:"string",description:"colour role"},label:{type:"string"},sub:{type:"string"},size:{$ref:"#/$defs/size2or3"},z:{type:"number",description:"lift above the floor it stands on"},deco:{type:"array",items:{$ref:"#/$defs/deco"}},ghost:{type:"boolean"},face:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"screen asset: what the screen shows: terminal, chat, desktop, tiles, or a face the host registers"},facing:{type:"number",description:"screen asset: rotation in degrees"},"label-at":{type:"object",additionalProperties:!1,properties:{side:{enum:["above","right","left","below"]},dx:{type:"number"},dy:{type:"number"}}},motion:{$ref:"#/$defs/motion"},variants:{$ref:"#/$defs/variants"},nodes:{type:"array",items:{$ref:"#/$defs/node"},description:"nodes standing on top of this one"}}},endpoint:{type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"},route:{type:"object",required:["id","from","to"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},from:{$ref:"#/$defs/endpoint"},to:{$ref:"#/$defs/endpoint"},kind:{type:"string"},via:{type:"array",items:{anyOf:[{$ref:"#/$defs/point2"},{$ref:"#/$defs/endpoint"}]}},points:{type:"array",items:{type:"array",items:{type:"number"},minItems:2,maxItems:3},description:"exact polyline in grid units; skips the router"},lane:{type:"number"},arrow:{type:"boolean"},cross:{type:"boolean",description:"the route may pass through fence walls (it crosses a boundary)"},label:{anyOf:[{type:"string"},{type:"object",additionalProperties:!1,required:["text"],properties:{text:{type:"string"},along:{type:"integer",minimum:1},side:{enum:["left","right"]},at:{type:"array",items:{type:"number"},minItems:2,maxItems:3,description:"exact place [x, y] or [x, y, z]; skips placement"},dir:{enum:["x","y"]},anchor:{enum:["start","middle","end"]}}}]},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},note:{type:"object",additionalProperties:!1,properties:{floor:{type:"string"},face:{type:"string"},label:{type:"string"},sub:{type:"string"},at:{anyOf:[{$ref:"#/$defs/point2"},{type:"array",items:{type:"number"},minItems:3,maxItems:3}]},on:{$ref:"#/$defs/id",description:"a node, region or route; a note on a route dims and lights with it"},kind:{type:"string"},dir:{enum:["x","y"]},anchor:{enum:["start","middle","end"]},dx:{type:"number"},dy:{type:"number"},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},routeRef:{anyOf:[{type:"string"},{type:"object",minProperties:1,maxProperties:1,additionalProperties:{type:"string"}}]},phase:{anyOf:[{$ref:"#/$defs/routeRef"},{type:"array",items:{$ref:"#/$defs/routeRef"}}]},step:{type:"object",required:["heading"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},number:{type:"integer",minimum:1,description:"the number shown; defaults to the position"},kind:{type:"string"},heading:{type:"string"},caption:{type:"string"},command:{type:"string"},animate:{type:"array",items:{$ref:"#/$defs/phase"}},pulse:{type:"array",items:{$ref:"#/$defs/id"}},highlight:{type:"array",items:{$ref:"#/$defs/id"}},focus:{type:"array",items:{$ref:"#/$defs/id"},description:"nodes or regions to zoom to for this step; the view eases back on steps without focus"},show:{type:"array",items:{$ref:"#/$defs/id"}},hide:{type:"array",items:{$ref:"#/$defs/id"}},say:{type:"array",items:{type:"object",additionalProperties:!1,required:["at","text"],properties:{at:{anyOf:[{$ref:"#/$defs/id"},{type:"array",items:{type:"number"},minItems:2,maxItems:3}],description:"a node (the callout sits above it) or a grid point [x, y, z]"},text:{type:"string"},kind:{type:"string"},dx:{type:"number"},dy:{type:"number"},anchor:{enum:["start","middle","end"]}}}},mark:{type:"array",items:{type:"object",additionalProperties:!1,properties:{on:{$ref:"#/$defs/id"},at:{type:"array",items:{type:"number"},minItems:2,maxItems:3}}}},badge:{anyOf:[{type:"boolean"},{$ref:"#/$defs/id"},{type:"array",items:{type:"number"},minItems:2,maxItems:3}],description:"false, a route or node id, or a grid point [x, y, z]"},duration:{anyOf:[{const:"auto"},{type:"integer",minimum:500}]}}}}};var Ap=[];function Em(t){Ap.includes(t)||Ap.push(t)}function Op(t){for(let e of Ap){let s=e(t);if(s!==void 0)return s}return t?"this item":"the file"}function vl(t){return t===null?"nothing":Array.isArray(t)?"a list":typeof t=="object"?"a map":typeof t=="string"?`the text "${t}"`:`${typeof t} ${String(t)}`}var Nm={string:"text",number:"a number",integer:"a whole number",boolean:"true or false",array:"a list",object:"a map"},po=new Map;function Rm(t,e){po.set(t,e)}var Tp=new Map;function Im(t,e){Tp.set(t,(s,r)=>e(vl(s),r))}var Ep=[];function zm(t,e){Ep.some(([s])=>s===t)||Ep.push([t,e])}function Oy(t){let e=t.parentSchema,s=Object.keys(e?.properties??{});e?.$ref&&po.has(e.$ref)&&s.push(...po.get(e.$ref).filter(r=>!s.includes(r)));for(let r of e?.allOf??[])r.$ref&&po.has(r.$ref)&&s.push(...po.get(r.$ref));return s}function Sl(t,e){let s=t.propertyName??(t.keyword==="propertyNames"?t.params.propertyName:void 0);if(s!==void 0){let f=`${t.instancePath}/${s.replace(/~/g,"~0").replace(/\//g,"~1")}`,p=e.locate(f,{key:!0});return{severity:"error",message:`"${s}" can't be a name`,line:p.line,col:p.col,path:f,hint:"names are a lower-case letter, then lower-case letters, digits and -"}}let r=t.instancePath,i=t.message??"is not valid",o,n=e.locate(r),a=t.params;switch(t.keyword){case"required":i=`${Op(r)} is missing "${a.missingProperty}"`;break;case"additionalProperties":case"unevaluatedProperties":{let p=String(a.additionalProperty??a.unevaluatedProperty),c=Oy(t),l=Vt(p,c);return i=`unknown key "${p}" in ${Op(r)}`+(l?` (did you mean "${l}"?)`:""),!l&&c.length&&(o=`known keys: ${c.join(", ")}`),/\s/.test(p)&&(o='inside { \u2026 } a comma starts a new key: put text with commas in quotes, e.g. label: "read once, at launch"'),n=e.locate(`${r}/${p}`,{key:!0}),{severity:"error",message:i,line:n.line,col:n.col,path:`${r}/${p}`,hint:o}}case"enum":{let p=a.allowedValues.map(String),c=typeof t.data=="string"?Vt(t.data,p):void 0,l=r.split("/").pop();i=`${vl(t.data)} is not a valid ${l&&!/^\d+$/.test(l)?`"${l}"`:"value"}`+(c?` (did you mean "${c}"?)`:""),o=`expected one of: ${p.join(", ")}`;break}case"const":i=Tp.has(r)?Tp.get(r)(t.data,a.allowedValue):`must be ${JSON.stringify(a.allowedValue)}`;break;case"type":i=`expected ${Nm[String(a.type)]??a.type}, got ${vl(t.data)}`;break;case"pattern":let f=Ep.find(([p])=>String(a.pattern).startsWith(p));f?{message:i,hint:o}=f[1](t.data):(i=`"${t.data}" is not a valid id`,o="ids start with a letter and use only letters, digits, - and _");break;case"minItems":case"maxItems":t.schema===2||t.parentSchema?.minItems===2?i=`expected a list of ${t.parentSchema.minItems===t.parentSchema.maxItems?t.parentSchema.minItems:`${t.parentSchema.minItems} to ${t.parentSchema.maxItems}`} numbers, got ${t.data.length}`:i=`list ${t.message}`;break;case"false schema":{let p=r.split("/").pop()??"",c=r.split("/").slice(0,-1).join("/");i=`"${p.replace(/~1/g,"/").replace(/~0/g,"~")}" can't be set on ${Op(c)}`,n=e.locate(r,{key:!0});break}case"minimum":case"maximum":case"exclusiveMinimum":case"exclusiveMaximum":i=`${t.data} is out of range: ${t.message}`;break}return{severity:"error",message:i,line:n.line,col:n.col,path:r,hint:o}}function Cm(t,e){let s=t.filter(n=>n.keyword==="anyOf"),r=new Set,i=[];for(let n of s){let a=n.schemaPath.replace(/\/anyOf$/,"/anyOf/"),f=t.filter(l=>l!==n&&l.schemaPath.startsWith(a)&&l.instancePath.startsWith(n.instancePath));if(f.forEach(l=>r.add(l)),r.add(n),s.some(l=>l!==n&&n.schemaPath.startsWith(l.schemaPath.replace(/\/anyOf$/,"/anyOf/"))&&l.instancePath===n.instancePath))continue;let p=f.filter(l=>l.instancePath.length>n.instancePath.length&&l.keyword!=="anyOf"),c=f.find(l=>l.keyword==="enum"&&l.instancePath===n.instancePath&&typeof n.data=="string");if(c)i.push(Sl(c,e));else if(p.length)i.push(...p.map(l=>Sl(l,e)));else{let l=f.filter(d=>d.instancePath===n.instancePath&&d.keyword!=="type"&&d.keyword!=="anyOf");if(l.length&&typeof n.data=="object"&&n.data!==null)i.push(...l.map(d=>Sl(d,e)));else{let d=[...new Set(f.filter(h=>h.keyword==="type").map(h=>Nm[String(h.params.type)]??""))].filter(Boolean),m=e.locate(n.instancePath);i.push({severity:"error",message:`${vl(n.data)} is not allowed here`+(d.length?`; expected ${d.join(" or ")}`:""),line:m.line,col:m.col,path:n.instancePath})}}}for(let n of t)r.has(n)||i.push(Sl(n,e));let o=new Set;return i.filter(n=>{let a=`${n.path}|${n.message}`;return o.has(a)?!1:(o.add(a),!0)}).sort((n,a)=>n.line-a.line||n.col-a.col)}var jm=Mp(Pp),Ay=Object.keys(Pp.$defs.placement.properties);Rm("#/$defs/placement",Ay);Im("/isodiag",t=>`"isodiag" must be 1 (the format version), got ${t}`);var Ty={scene:"a scene",region:"a region",node:"a node",route:"a route",note:"a note",step:"a step"};Em(t=>{let e=/\/(scenes|regions|nodes|routes|notes|steps)\/\d+$/.exec(t);return e?Ty[e[1].replace(/s$/,"")]??"this item":void 0});zm("^[A-Za-z][A-Za-z0-9_-]*(",t=>({message:`"${t}" is not a node reference`,hint:"write an id, optionally with a side: worker, worker.e (sides: n, e, s, w, top)"}));function Lm(t){return t.data==null||typeof t.data!="object"||Array.isArray(t.data)?[{severity:"error",message:'the file must be a YAML map with "isodiag: 1" and "scenes:"',line:1,col:1,path:""}]:jm(t.data)?[]:Cm(jm.errors??[],t)}var fo=class extends Error{diags;constructor(e){super(e.filter(s=>s.severity==="error").map(s=>`line ${s.line}: ${s.message}`).join(`
436
- `)),this.name="CompileError",this.diags=e}};function Ml(t,e,s={}){let r=Ny(t,e,s);if(!r.ok&&s.strict==="throw")throw new fo(r.diags);if(!r.ok&&s.strict&&(r.scenes=[]),s.stepMs!==void 0)for(let n of r.scenes)for(let a of n.steps.steps)a.duration=s.stepMs;if(s.treatment!==void 0&&s.treatment!=="mono"&&s.treatment!=="none")throw new Error(`treatment: there is "mono" (and "none"), and no ${JSON.stringify(s.treatment)}`);let i=(s.treatment??r.doc?.treatment)==="mono";if(s.treatment==="mono"&&!s.resolveVars)throw new Error("treatment: a self-contained drawing's (resolveVars)");let o=r.theme;if(s.resolveVars)for(let n of r.scenes){let a=s.mode??"light",f=ar(ts)+Qi+eo;if(i){Ey(n,o,a,f,s.mono);continue}let p={mode:a,theme:r.theme,css:f};n.rendered.svg=Zr(n.rendered.svg,p),n.rendered.variants&&(n.rendered.variants=Object.fromEntries(Object.entries(n.rendered.variants).map(([c,l])=>[c,Zr(l,p)]))),n.rendered.inks={surface:r.theme[p.mode].surface??r.theme.light.surface,control:r.theme[p.mode].control??r.theme.light.control,kinds:Object.fromEntries(Object.entries(r.theme.kinds).map(([c,l])=>[c,r.theme[p.mode][l.color]??l.color]))}}return s.resolveVars&&i&&o&&(r.theme={...o,kinds:Object.fromEntries(Object.entries(o.kinds).map(([n,a])=>{let f=r.scenes.map(p=>p.rendered.mono?.kinds[n]?.dash).find(p=>p&&p.length>1);return[n,f?{...a,ants:[f[0],f[1]]}:a]}))}),r}function Ey(t,e,s,r,i){let o=[t.rendered.svg,...Object.values(t.rendered.variants??{})],n=Ka(o.join(""),e,s,[...t.routes.map(f=>f.kind),...t.steps.kindsUsed],i),a=f=>Va(Zr(f,{mode:s,theme:n.theme,css:r+n.css}),n.look,t.id);t.rendered.svg=a(t.rendered.svg),t.rendered.variants&&(t.rendered.variants=Object.fromEntries(Object.entries(t.rendered.variants).map(([f,p])=>[f,a(p)]))),t.rendered.inks={surface:n.look.paper,control:n.look.ink,kinds:Object.fromEntries(Object.keys(e.kinds).map(f=>[f,n.look.ink]))},t.rendered.mono=n.look;for(let f of n.look.warnings)t.rendered.warnings.push({path:"",message:`black and white: ${f}`})}function Ny(t,e,s){let r=oa(t),i=[...r.diags];if(i.some(c=>c.severity==="error"))return{ok:!1,diags:i,catalog:ts,scenes:[]};let o=Lm(r);i.push(...o);let n=r.data;if(o.length){try{let c=_s(Tr(e),n.roles??{},n.kinds??{}),l=o.map(d=>d.path);(Array.isArray(n.scenes)?n.scenes:[]).forEach((d,m)=>{try{let h=Nr(d,`/scenes/${m}`,r,c,ts,n.roles??{});i.push(...h.diags.filter(y=>!l.some(g=>y.path===g||y.path.startsWith(g+"/"))))}catch{}})}catch{}return i.sort((c,l)=>c.line-l.line||c.col-l.col),{ok:!1,diags:i,catalog:ts,scenes:[]}}let a=Ua(n,e,ts,r,t,{snap:s.snap},i),f=0,p=(c,l,d)=>{let m=r.locate(c);a.diags.push({severity:"error",message:l,line:m.line,col:m.col,path:c,...d?{hint:d}:{}}),f++};return a.scenes.forEach((c,l)=>{Ca(c,a.theme);let d=c.raw.ants,m=Ss(c.raw)?.ids,h=c.routes.map(u=>u.id);if((m??[]).forEach((u,b)=>{h.includes(u)||p(`/scenes/${l}/ants${Array.isArray(d)?"":"/ids"}/${b}`,`no connector "${u}" in this scene`,h.length?`its connectors: ${h.slice(0,8).join(", ")}${h.length>8?", \u2026":""}`:void 0)}),!c.raw.motion)return;let y={isomotion:1,...c.raw.motion},g=`/scenes/${l}/motion`,k=vs(c,y,{kinds:a.theme.kinds}).diags;for(let u of k){let b=r.locate(g+u.path);a.diags.push({severity:u.severity,message:u.message,line:b.line,col:b.col,path:g+u.path,...u.hint?{hint:u.hint}:{}})}f+=k.length,k.length||(c.motion=y)}),f&&(a.ok=!1,a.diags.sort((c,l)=>c.line-l.line||c.col-l.col)),a}function _m(t,e){let s=Ml(t,e.theme,{mode:e.mode??"light",resolveVars:!0,strict:"throw",treatment:e.treatment,mono:e.mono}),r=s.theme.kinds,i=e.scene===void 0?s.scenes[0]:typeof e.scene=="number"?s.scenes[e.scene]:s.scenes.find(f=>f.id===e.scene);if(!i)throw new Error(`no scene ${JSON.stringify(e.scene)} (there ${s.scenes.length===1?"is":"are"} ${s.scenes.map(f=>f.id).join(", ")})`);let o=e.ants===void 0?Ss(i.raw):e.ants===!0?Ss(i.raw)??{}:e.ants||void 0;if(e.t===void 0)return o?ja(i,{...o,by:e.ambient==="off"?"none":"smil",kinds:r}):i.rendered.svg;if(e.ants)throw new Error("ants: at a moment they are its motion document's");let n=e.motion??i.motion;if(!n)throw new Error("t: this scene has no motion");let a=vs(i,n,{kinds:r});if(!a.ok)throw new Error(a.diags.map(f=>`${f.path}: ${f.message}${f.hint?` (${f.hint})`:""}`).join(`
437
- `));return Ki(i,a.at(e.t,e.ambient===void 0?{}:{ambient:e.ambient}))}export{_d as core,Rf as objects,Fm as systems,vm as viewer};
437
+ `;var Bm={};yo(Bm,{BASE_CSS:()=>Tm,CompileError:()=>mo,DRAWING_CSS:()=>Am,NODE_ASSETS:()=>co,REGION_KINDS:()=>$p,compile:()=>Al,getAsset:()=>Om,renderSvg:()=>Dm,systems:()=>ts});var ky={name:"volume",description:"Stored data that is kept: a drum with two bands (a volume, a room's history, an archive).",size:[1.8,1.8,1.3],role:"folder",draw(t,e){let[s,r]=Hs(e),i=Math.min(e.x1-e.x0,e.y1-e.y0)/2,o=(c,l)=>[s+i*Math.cos(c*Math.PI/180),r+i*Math.sin(c*Math.PI/180),l],n=(c,l,d)=>Array.from({length:13},(m,h)=>o(c+(l-c)*h/12,d)),a=(c,l,d)=>t.poly([...n(c,l,e.z0),...n(c,l,e.z1).reverse()],d),f=e.z1-e.z0,p=c=>n(-45,135,c).slice(1).map((l,d,m)=>t.line3(d?m[d-1]:o(-45,c),l,"det")).join("");return a(45,135,"lft")+a(-45,45,"rgt")+p(e.z0+f*.36)+p(e.z0+f*.68)+t.poly(Array.from({length:32},(c,l)=>o(l*360/32,e.z1)),"top")}},$y={name:"orb",description:"An agent: a white sphere with two eyes, on a small plate.",size:[1.5,1.5,1.6],role:"lead",cls:"orb",draw(t,e){t.def("orbG",Me("radialGradient",{id:"orbG",cx:"0.36",cy:"0.30",r:"0.80"},Me("stop",{offset:"0",style:"stop-color:#ffffff"})+Me("stop",{offset:"0.62",style:"stop-color:#f6f6f4"})+Me("stop",{offset:"1",style:"stop-color:#cfd0d6"})));let s=Li(e),[r,i]=Re((e.x0+e.x1)/2,(e.y0+e.y1)/2,s.z1),o=23,n=i-o+3;t.bounds.add([r-o,n-o]),t.bounds.add([r+o,n+o]);let a=(f,p,c,l)=>Me("rect",{class:"eye",x:r+f-c/2,y:n+p-l/2,width:c,height:l,rx:c/2,transform:`rotate(-24 ${(r+f).toFixed(1)} ${(n+p).toFixed(1)})`});return t.blockFaces(s)+Me("ellipse",{class:"shade",cx:r,cy:i+1,rx:o*.8,ry:o*.3})+Me("circle",{class:"ball",cx:r,cy:n,r:o})+a(3,-7,6.4,13.5)+a(14,-12,5.4,10.5)},label(t,e,s){let[r,i]=Re((t.x0+t.x1)/2,(t.y0+t.y1)/2,t.z0+1.95);return{x:r,y:i-26+(s?0:14),anchor:"middle"}},pulse:t=>[(t.x0+t.x1)/2,(t.y0+t.y1)/2,t.z0+.8,26]},Sy={name:"person",description:"A human: body and head on a small plate. The label sits to the right.",size:[1.5,1.5,1.6],role:"person",cls:"person",draw(t,e){let s=Li(e),[r,i]=Re((e.x0+e.x1)/2,(e.y0+e.y1)/2,s.z1);t.bounds.add([r-13,i-50]);let o=n=>n.toFixed(1);return t.blockFaces(s)+Me("path",{class:"body",d:`M${o(r-13)},${o(i-4)} C${o(r-13)},${o(i-34)} ${o(r+13)},${o(i-34)} ${o(r+13)},${o(i-4)} Q${o(r)},${o(i+4)} ${o(r-13)},${o(i-4)}z`})+Me("circle",{class:"head",cx:r,cy:i-40,r:10})},label(t){let[e,s]=Re((t.x0+t.x1)/2,(t.y0+t.y1)/2,t.z0);return{x:e+30,y:s+2,anchor:"start"}},pulse:t=>[(t.x0+t.x1)/2,(t.y0+t.y1)/2,t.z0+.9,26]},vy={name:"screen",description:"An upright screen or terminal panel. `face`: terminal, chat, desktop, tiles, or one the host registers. `facing`: turn in degrees.",size:[1.64,.3,1.75],role:"term",draw(t,e,s){let[r,i]=Hs(e),o=(e.x1-e.x0)/2,n=e.z1-e.z0,a=.14,f=(s.facing??0)*Math.PI/180,p=Math.cos(f),c=Math.sin(f),l=Math.sin(f)*a,d=-Math.cos(f)*a,m=[r-p*o,i-c*o],h=[r+p*o,i+c*o],y=e.z0,g=e.z1,k=t.poly([[h[0],h[1],y],[h[0]+l,h[1]+d,y],[h[0]+l,h[1]+d,g],[h[0],h[1],g]],"rgt")+t.poly([[m[0],m[1],g],[h[0],h[1],g],[h[0]+l,h[1]+d,g],[m[0]+l,m[1]+d,g]],"top")+t.poly([[m[0],m[1],y],[h[0],h[1],y],[h[0],h[1],g],[m[0],m[1],g]],"lft"),u=Re(m[0],m[1],g),b=Re(h[0],h[1],g),x=2*o*ct,w=n*ct,$=[(b[0]-u[0])/x,(b[1]-u[1])/x,0,1,u[0],u[1]],S=tr(s.face??"terminal")??di;return k+=t.onMatrix($,x,w,(O,z)=>fi(O,z)+S(O,z),"scr"),k}},My={name:"monitor",description:"A block with a screen painted on its front-left face. `face` as for screen.",size:[2.4,.8,1.8],role:"term",draw(t,e,s){let r=tr(s.face??"terminal")??di;return t.blockFaces(e)+t.onFace(e,"left",(i,o)=>fi(i,o)+r(i,o),"scr")}},Py={name:"cloud",description:"A cloud lying on the floor: the internet, or a hosted service.",size:[3,2.4,.3],role:"cloud",draw:(t,e)=>Er(t,e)},co={block:an("block","A box. Size and colour role are free; add decorations with `deco`.",[2.4,2.4,1.6],"grey"),session:an("session","An agent session: a box with terminal lines (`deco: [terminal: 4]`; add an icon the host registers with `icon: NAME`).",[2.6,2.6,1.8],"work",[{terminal:4}]),terminal:an("terminal","A box with terminal lines on its front.",[1.6,1.2,.8],"term",[{terminal:2}]),server:an("server","A service or daemon: a low box with two terminal lines.",[3,2.2,.9],"doz",[{terminal:2}]),chat:an("chat","A chat server or room: a box with a chat bubble on top.",[3.6,4.4,1.3],"chat",["bubble"]),mailbox:an("mailbox","A room or inbox: terminal lines and an envelope on top.",[2.4,2.4,1.6],"mail",[{terminal:3},"envelope"]),file:an("file","A file or document: a low box with lines on top.",[1.6,1.6,.6],"file",["file-lines"]),folder:an("folder","A folder or directory: a flat box.",[1.6,1.6,.5],"folder"),key:an("key","A secret: a low box with a key on top.",[1.6,1.6,.6],"key",[],(t,e)=>$o(t,e)),socket:an("socket","A socket: a small box with a round opening on top.",[1.2,1.2,.5],"socket",[],(t,e)=>So(t,e)),gate:an("gate","A gate or proxy: a narrow upright slab, usually set in a fence wall.",[.3,2,1.1],"gate"),placeholder:an("placeholder","A placeholder value: a small low box with lines.",[1.2,1,.45],"placeholder",["file-lines"]),orb:$y,person:Sy,screen:vy,monitor:My,cloud:Py,volume:ky};function Om(t){return co[t??"block"]}var Oy="border-color:hsl(38 80% 45%);background:hsl(38 80% 55% / .2)",$p={slab:{shape:"slab",pad:1.2,z:[-.8,.35],floor:!0,role:"slab",labelStyle:"face"},pad:{shape:"block",pad:.6,z:[0,.2],floor:!0,role:"pad",labelStyle:"floor"},fence:{shape:"walled",pad:.7,z:[0,.8],floor:!1,role:"fence",labelStyle:"face",legend:{label:"Fence",swatch:Oy,box:!0,auto:!0},css:`.fz{fill:var(--fence-text)!important;opacity:1!important}
438
+ `},vm:{shape:"block",pad:.6,z:[0,.45],floor:!0,role:"sandbox",labelStyle:"face",legend:{label:"Sandbox VM",swatch:"border-color:hsl(170 35% 40%);background:hsl(170 40% 50% / .2)",box:!0,auto:!0}},platform:{shape:"block",pad:.6,z:[0,.7],floor:!0,role:"server",labelStyle:"face-right"},cloud:{shape:"cloud",pad:.8,z:[0,.2],floor:!0,role:"cloud",labelStyle:"floor"},zone:{shape:"zone",pad:.5,z:[0,.005],floor:!1,role:"grey",labelStyle:"floor"},tunnel:{shape:"tunnel",pad:0,z:[0,.8],floor:!1,role:"socket",labelStyle:"none",legend:{label:"Tailscale tunnel",swatch:"border-color:hsl(205 70% 50%);border-top-width:9px;opacity:.35",box:!1,auto:!1}}},ts={regions:$p,nodes:co,defaultNode:"block"};var Am=ar(ts),Tm=Ur(ts);var Nm=Ml,it={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://isodiag.local/schema/isodiag-1.json",title:"isodiag diagram",description:"A page of isometric, animated diagrams. See docs/FORMAT.md.",type:"object",required:["isodiag","scenes"],additionalProperties:!1,properties:{isodiag:{const:1,description:"Format version. Always 1."},title:{type:"string"},lede:{type:"string"},pills:{type:"array",items:{type:"string"}},theme:{type:"string",description:"'default' or a path to a theme file"},roles:{type:"object",description:"Extra or changed colour roles for nodes and regions",additionalProperties:{$ref:"#/$defs/role"}},kinds:{type:"object",description:"Extra flow kinds, or new legend text for the standard ones",additionalProperties:{$ref:"#/$defs/kindDef"}},after:{type:"string",description:"Markdown shown after all scenes"},grid:{$ref:"#/$defs/grid"},assemble:{type:"boolean",description:"draw each scene by flying its parts in from the nearest edge, then play"},footer:{type:"string"},treatment:{enum:["mono"],description:"How a self-contained drawing (renderSvg, <isometric-diagram>) is painted: mono, black and white. A host may say otherwise. The page isodiag build writes is in colour."},scenes:{type:"array",minItems:1,items:{$ref:"#/$defs/scene"}}},$defs:{motion:{type:"object",additionalProperties:!1,minProperties:1,description:"how this piece (a region: its contents too) moves when the drawing assembles or disassembles",properties:{style:{enum:["edge","drop","rise","fly","pop","scatter","build","fade"],description:"how it arrives"},out:{enum:["explode","lift-off","sink","scatter","fly-out","collapse","fade","reverse"],description:"how it leaves"},easing:{enum:["linear","ease","ease-in","ease-out","settle","spring","bounce"]},from:{enum:["left","right","top","bottom"],description:"fly: the side it comes from"},delay:{type:"number",minimum:0,description:"ms after its turn"},duration:{type:"number",exclusiveMinimum:0,description:"ms its own move takes"}}},variants:{type:"object",minProperties:1,propertyNames:{$ref:"#/$defs/id"},description:"other looks of it, by name, for a motion to switch to (its box stays as it is)",additionalProperties:{type:"object",additionalProperties:!1,minProperties:1,properties:{role:{type:"string"},ghost:{type:"boolean"},label:{type:"string"},sub:{type:"string"},face:{type:"string",pattern:"^[a-z][a-z0-9-]*$"},deco:{type:"array",items:{$ref:"#/$defs/deco"}}}}},id:{type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},grid:{type:"object",additionalProperties:!1,properties:{snap:{type:"number",exclusiveMinimum:0,description:"round every placed edge and route waypoint to this step, in grid units"},show:{type:"boolean",description:"draw the floor grid when the page opens (the Grid button toggles it)"},step:{type:"number",exclusiveMinimum:0,description:"spacing of the drawn grid lines; default the snap step, or 1"}}},num:{type:"number"},point2:{type:"array",items:{type:"number"},minItems:2,maxItems:2},size2or3:{type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:3},stepRef:{anyOf:[{type:"string"},{type:"integer",minimum:1}]},side:{enum:["n","e","s","w"]},align:{enum:["start","center","end"]},role:{type:"object",additionalProperties:!1,required:["h","s"],properties:{h:{type:"number",minimum:0,maximum:360,description:"hue"},s:{type:"number",minimum:0,maximum:100,description:"saturation, percent"},top:{type:"string",description:"CSS colour for the top face, overriding the computed one"},tint:{type:"number",minimum:0,maximum:100,description:"percent of the role colour mixed into the pad colour for the top face"}}},kindDef:{type:"object",additionalProperties:!1,properties:{legend:{type:"string"},like:{type:"string",description:"a standard kind whose colour and line style this one uses"},color:{type:"string"},dash:{enum:["solid","dashed","dotted"]}}},placement:{properties:{in:{$ref:"#/$defs/id"},at:{$ref:"#/$defs/point2"},"right-of":{$ref:"#/$defs/id"},"left-of":{$ref:"#/$defs/id"},below:{$ref:"#/$defs/id"},behind:{$ref:"#/$defs/id"},gap:{type:"number"},align:{$ref:"#/$defs/align"},shift:{$ref:"#/$defs/point2",description:"nudge after placement, grid units [dx, dy]"},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},scene:{type:"object",required:["id","title"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},title:{type:"string"},ants:{description:"its connectors march, showing which way they flow: all that may, these, or with a speed (units a second) and a dash",anyOf:[{type:"boolean"},{type:"array",items:{type:"string"}},{type:"object",additionalProperties:!1,properties:{ids:{type:"array",items:{type:"string"}},speed:{type:"number"},dash:{type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:2}}}]},motion:{type:"object",description:"the scene's motion document (isomotion/1; its `isomotion: 1` may be left out)"},caption:{type:"string"},aria:{type:"string"},gap:{type:"number",exclusiveMinimum:0},flow:{enum:["row","column"]},regions:{type:"array",items:{$ref:"#/$defs/region"}},nodes:{type:"array",items:{$ref:"#/$defs/node"}},routes:{type:"array",items:{$ref:"#/$defs/route"}},notes:{type:"array",items:{$ref:"#/$defs/note"}},steps:{type:"array",items:{$ref:"#/$defs/step"}},legend:{anyOf:[{enum:["auto"]},{const:!1},{type:"array",items:{type:"string"}}]},badges:{type:"boolean"},grid:{$ref:"#/$defs/grid"},assemble:{type:"boolean",description:"draw the scene by flying its parts in from the nearest edge, then play"},loop:{type:"boolean",description:"the player wraps from the last step to the first (default true)"},dim:{enum:["flows","all"],description:"what a step dims: only flows, their labels and marks (default), or nodes too"},after:{type:"string"}}},region:{type:"object",required:["id","kind"],unevaluatedProperties:!1,allOf:[{$ref:"#/$defs/placement"}],properties:{id:{$ref:"#/$defs/id"},kind:{enum:["slab","pad","fence","vm","cloud","zone","platform","tunnel"]},label:{type:"string"},"label-style":{enum:["face","face-right","floor","none"]},ghost:{type:"boolean",description:"drawn as a dashed outline: not there yet, out of reach, or stopped"},role:{type:"string"},size:{$ref:"#/$defs/size2or3"},padding:{type:"number",minimum:0},height:{type:"number",exclusiveMinimum:0},z:{type:"number",description:"lift above the floor it stands on (tunnels)"},flow:{enum:["row","column"]},gate:{type:"object",additionalProperties:!1,required:["side"],properties:{side:{$ref:"#/$defs/side"},at:{type:"number",minimum:0,maximum:1,description:"centre of the gate along the wall, 0..1"},width:{type:"number",exclusiveMinimum:0},height:{type:"number",exclusiveMinimum:0},node:{$ref:"#/$defs/id"}}},around:{type:"array",items:{$ref:"#/$defs/id"},description:"tunnel: routes it wraps"},regions:{type:"array",items:{$ref:"#/$defs/region"}},motion:{$ref:"#/$defs/motion"},variants:{$ref:"#/$defs/variants"},nodes:{type:"array",items:{$ref:"#/$defs/node"}}}},deco:{anyOf:[{enum:["envelope","bubble","file-lines","ghost","terminal"]},{type:"object",additionalProperties:!1,minProperties:1,maxProperties:1,properties:{terminal:{type:"integer",minimum:1,maximum:8},icon:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"an icon the host registers (none by default); one nothing registers is drawn as a placeholder, with a warning"},screen:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"terminal, chat, desktop, tiles, or a face the host registers"}}}]},node:{type:"object",required:["id"],unevaluatedProperties:!1,allOf:[{$ref:"#/$defs/placement"}],properties:{id:{$ref:"#/$defs/id"},asset:{type:"string",description:"asset name from the library; default 'block'"},role:{type:"string",description:"colour role"},label:{type:"string"},sub:{type:"string"},size:{$ref:"#/$defs/size2or3"},z:{type:"number",description:"lift above the floor it stands on"},deco:{type:"array",items:{$ref:"#/$defs/deco"}},ghost:{type:"boolean"},face:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"screen asset: what the screen shows: terminal, chat, desktop, tiles, or a face the host registers"},facing:{type:"number",description:"screen asset: rotation in degrees"},"label-at":{type:"object",additionalProperties:!1,properties:{side:{enum:["above","right","left","below"]},dx:{type:"number"},dy:{type:"number"}}},motion:{$ref:"#/$defs/motion"},variants:{$ref:"#/$defs/variants"},nodes:{type:"array",items:{$ref:"#/$defs/node"},description:"nodes standing on top of this one"}}},endpoint:{type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"},route:{type:"object",required:["id","from","to"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},from:{$ref:"#/$defs/endpoint"},to:{$ref:"#/$defs/endpoint"},kind:{type:"string"},via:{type:"array",items:{anyOf:[{$ref:"#/$defs/point2"},{$ref:"#/$defs/endpoint"}]}},points:{type:"array",items:{type:"array",items:{type:"number"},minItems:2,maxItems:3},description:"exact polyline in grid units; skips the router"},lane:{type:"number"},arrow:{type:"boolean"},cross:{type:"boolean",description:"the route may pass through fence walls (it crosses a boundary)"},label:{anyOf:[{type:"string"},{type:"object",additionalProperties:!1,required:["text"],properties:{text:{type:"string"},along:{type:"integer",minimum:1},side:{enum:["left","right"]},at:{type:"array",items:{type:"number"},minItems:2,maxItems:3,description:"exact place [x, y] or [x, y, z]; skips placement"},dir:{enum:["x","y"]},anchor:{enum:["start","middle","end"]}}}]},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},note:{type:"object",additionalProperties:!1,properties:{floor:{type:"string"},face:{type:"string"},label:{type:"string"},sub:{type:"string"},at:{anyOf:[{$ref:"#/$defs/point2"},{type:"array",items:{type:"number"},minItems:3,maxItems:3}]},on:{$ref:"#/$defs/id",description:"a node, region or route; a note on a route dims and lights with it"},kind:{type:"string"},dir:{enum:["x","y"]},anchor:{enum:["start","middle","end"]},dx:{type:"number"},dy:{type:"number"},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},routeRef:{anyOf:[{type:"string"},{type:"object",minProperties:1,maxProperties:1,additionalProperties:{type:"string"}}]},phase:{anyOf:[{$ref:"#/$defs/routeRef"},{type:"array",items:{$ref:"#/$defs/routeRef"}}]},step:{type:"object",required:["heading"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},number:{type:"integer",minimum:1,description:"the number shown; defaults to the position"},kind:{type:"string"},heading:{type:"string"},caption:{type:"string"},command:{type:"string"},animate:{type:"array",items:{$ref:"#/$defs/phase"}},pulse:{type:"array",items:{$ref:"#/$defs/id"}},highlight:{type:"array",items:{$ref:"#/$defs/id"}},focus:{type:"array",items:{$ref:"#/$defs/id"},description:"nodes or regions to zoom to for this step; the view eases back on steps without focus"},show:{type:"array",items:{$ref:"#/$defs/id"}},hide:{type:"array",items:{$ref:"#/$defs/id"}},say:{type:"array",items:{type:"object",additionalProperties:!1,required:["at","text"],properties:{at:{anyOf:[{$ref:"#/$defs/id"},{type:"array",items:{type:"number"},minItems:2,maxItems:3}],description:"a node (the callout sits above it) or a grid point [x, y, z]"},text:{type:"string"},kind:{type:"string"},dx:{type:"number"},dy:{type:"number"},anchor:{enum:["start","middle","end"]}}}},mark:{type:"array",items:{type:"object",additionalProperties:!1,properties:{on:{$ref:"#/$defs/id"},at:{type:"array",items:{type:"number"},minItems:2,maxItems:3}}}},badge:{anyOf:[{type:"boolean"},{$ref:"#/$defs/id"},{type:"array",items:{type:"number"},minItems:2,maxItems:3}],description:"false, a route or node id, or a grid point [x, y, z]"},duration:{anyOf:[{const:"auto"},{type:"integer",minimum:500}]}}}}},Lt={type:"object",additionalProperties:!1,required:["h","s"],properties:{h:{type:"number",minimum:0,maximum:360,description:"hue"},s:{type:"number",minimum:0,maximum:100,description:"saturation, percent"},top:{type:"string",description:"CSS colour for the top face, overriding the computed one"},tint:{type:"number",minimum:0,maximum:100,description:"percent of the role colour mixed into the pad colour for the top face"}}},Ln={type:"object",additionalProperties:!1,properties:{legend:{type:"string"},like:{type:"string",description:"a standard kind whose colour and line style this one uses"},color:{type:"string"},dash:{enum:["solid","dashed","dotted"]}}},Rt={type:"object",additionalProperties:!1,properties:{snap:{type:"number",exclusiveMinimum:0,description:"round every placed edge and route waypoint to this step, in grid units"},show:{type:"boolean",description:"draw the floor grid when the page opens (the Grid button toggles it)"},step:{type:"number",exclusiveMinimum:0,description:"spacing of the drawn grid lines; default the snap step, or 1"}}},po=Object.prototype.hasOwnProperty,Pe={type:"object",required:["id","title"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},title:{type:"string"},ants:{description:"its connectors march, showing which way they flow: all that may, these, or with a speed (units a second) and a dash",anyOf:[{type:"boolean"},{type:"array",items:{type:"string"}},{type:"object",additionalProperties:!1,properties:{ids:{type:"array",items:{type:"string"}},speed:{type:"number"},dash:{type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:2}}}]},motion:{type:"object",description:"the scene's motion document (isomotion/1; its `isomotion: 1` may be left out)"},caption:{type:"string"},aria:{type:"string"},gap:{type:"number",exclusiveMinimum:0},flow:{enum:["row","column"]},regions:{type:"array",items:{$ref:"#/$defs/region"}},nodes:{type:"array",items:{$ref:"#/$defs/node"}},routes:{type:"array",items:{$ref:"#/$defs/route"}},notes:{type:"array",items:{$ref:"#/$defs/note"}},steps:{type:"array",items:{$ref:"#/$defs/step"}},legend:{anyOf:[{enum:["auto"]},{const:!1},{type:"array",items:{type:"string"}}]},badges:{type:"boolean"},grid:{$ref:"#/$defs/grid"},assemble:{type:"boolean",description:"draw the scene by flying its parts in from the nearest edge, then play"},loop:{type:"boolean",description:"the player wraps from the last step to the first (default true)"},dim:{enum:["flows","all"],description:"what a step dims: only flows, their labels and marks (default), or nodes too"},after:{type:"string"}}},Ne={type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},It=new RegExp("^[A-Za-z][A-Za-z0-9_-]*$","u"),Be={type:"object",required:["id","kind"],unevaluatedProperties:!1,allOf:[{$ref:"#/$defs/placement"}],properties:{id:{$ref:"#/$defs/id"},kind:{enum:["slab","pad","fence","vm","cloud","zone","platform","tunnel"]},label:{type:"string"},"label-style":{enum:["face","face-right","floor","none"]},ghost:{type:"boolean",description:"drawn as a dashed outline: not there yet, out of reach, or stopped"},role:{type:"string"},size:{$ref:"#/$defs/size2or3"},padding:{type:"number",minimum:0},height:{type:"number",exclusiveMinimum:0},z:{type:"number",description:"lift above the floor it stands on (tunnels)"},flow:{enum:["row","column"]},gate:{type:"object",additionalProperties:!1,required:["side"],properties:{side:{$ref:"#/$defs/side"},at:{type:"number",minimum:0,maximum:1,description:"centre of the gate along the wall, 0..1"},width:{type:"number",exclusiveMinimum:0},height:{type:"number",exclusiveMinimum:0},node:{$ref:"#/$defs/id"}}},around:{type:"array",items:{$ref:"#/$defs/id"},description:"tunnel: routes it wraps"},regions:{type:"array",items:{$ref:"#/$defs/region"}},motion:{$ref:"#/$defs/motion"},variants:{$ref:"#/$defs/variants"},nodes:{type:"array",items:{$ref:"#/$defs/node"}}}},yn={type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:3},Sp={enum:["n","e","s","w"]},He={type:"object",additionalProperties:!1,minProperties:1,description:"how this piece (a region: its contents too) moves when the drawing assembles or disassembles",properties:{style:{enum:["edge","drop","rise","fly","pop","scatter","build","fade"],description:"how it arrives"},out:{enum:["explode","lift-off","sink","scatter","fly-out","collapse","fade","reverse"],description:"how it leaves"},easing:{enum:["linear","ease","ease-in","ease-out","settle","spring","bounce"]},from:{enum:["left","right","top","bottom"],description:"fly: the side it comes from"},delay:{type:"number",minimum:0,description:"ms after its turn"},duration:{type:"number",exclusiveMinimum:0,description:"ms its own move takes"}}},Em={properties:{in:{$ref:"#/$defs/id"},at:{$ref:"#/$defs/point2"},"right-of":{$ref:"#/$defs/id"},"left-of":{$ref:"#/$defs/id"},below:{$ref:"#/$defs/id"},behind:{$ref:"#/$defs/id"},gap:{type:"number"},align:{$ref:"#/$defs/align"},shift:{$ref:"#/$defs/point2",description:"nudge after placement, grid units [dx, dy]"},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},Pt={type:"array",items:{type:"number"},minItems:2,maxItems:2},vp={enum:["start","center","end"]},Je={anyOf:[{type:"string"},{type:"integer",minimum:1}]};function As(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=As.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(t.in!==void 0){let l=t.in;if(typeof l=="string"){if(!It.test(l)){let d={instancePath:e+"/in",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/in",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:l};n===null?n=[d]:n.push(d),a++}}if(t.at!==void 0){let l=t.at;if(Array.isArray(l)){if(l.length>2){let m={instancePath:e+"/at",schemaPath:"#/$defs/point2/maxItems",keyword:"maxItems",params:{limit:2},message:"must NOT have more than 2 items",schema:2,parentSchema:Pt,data:l};n===null?n=[m]:n.push(m),a++}if(l.length<2){let m={instancePath:e+"/at",schemaPath:"#/$defs/point2/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:Pt,data:l};n===null?n=[m]:n.push(m),a++}let d=l.length;for(let m=0;m<d;m++){let h=l[m];if(typeof h!="number"){let y={instancePath:e+"/at/"+m,schemaPath:"#/$defs/point2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Pt.items.type,parentSchema:Pt.items,data:h};n===null?n=[y]:n.push(y),a++}}}else{let d={instancePath:e+"/at",schemaPath:"#/$defs/point2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Pt.type,parentSchema:Pt,data:l};n===null?n=[d]:n.push(d),a++}}if(t["right-of"]!==void 0){let l=t["right-of"];if(typeof l=="string"){if(!It.test(l)){let d={instancePath:e+"/right-of",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/right-of",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:l};n===null?n=[d]:n.push(d),a++}}if(t["left-of"]!==void 0){let l=t["left-of"];if(typeof l=="string"){if(!It.test(l)){let d={instancePath:e+"/left-of",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/left-of",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:l};n===null?n=[d]:n.push(d),a++}}if(t.below!==void 0){let l=t.below;if(typeof l=="string"){if(!It.test(l)){let d={instancePath:e+"/below",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/below",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:l};n===null?n=[d]:n.push(d),a++}}if(t.behind!==void 0){let l=t.behind;if(typeof l=="string"){if(!It.test(l)){let d={instancePath:e+"/behind",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/behind",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:l};n===null?n=[d]:n.push(d),a++}}if(t.gap!==void 0){let l=t.gap;if(typeof l!="number"){let d={instancePath:e+"/gap",schemaPath:"#/properties/gap/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Em.properties.gap.type,parentSchema:Em.properties.gap,data:l};n===null?n=[d]:n.push(d),a++}}if(t.align!==void 0){let l=t.align;if(!(l==="start"||l==="center"||l==="end")){let d={instancePath:e+"/align",schemaPath:"#/$defs/align/enum",keyword:"enum",params:{allowedValues:vp.enum},message:"must be equal to one of the allowed values",schema:vp.enum,parentSchema:vp,data:l};n===null?n=[d]:n.push(d),a++}}if(t.shift!==void 0){let l=t.shift;if(Array.isArray(l)){if(l.length>2){let m={instancePath:e+"/shift",schemaPath:"#/$defs/point2/maxItems",keyword:"maxItems",params:{limit:2},message:"must NOT have more than 2 items",schema:2,parentSchema:Pt,data:l};n===null?n=[m]:n.push(m),a++}if(l.length<2){let m={instancePath:e+"/shift",schemaPath:"#/$defs/point2/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:Pt,data:l};n===null?n=[m]:n.push(m),a++}let d=l.length;for(let m=0;m<d;m++){let h=l[m];if(typeof h!="number"){let y={instancePath:e+"/shift/"+m,schemaPath:"#/$defs/point2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Pt.items.type,parentSchema:Pt.items,data:h};n===null?n=[y]:n.push(y),a++}}}else{let d={instancePath:e+"/shift",schemaPath:"#/$defs/point2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Pt.type,parentSchema:Pt,data:l};n===null?n=[d]:n.push(d),a++}}if(t.appears!==void 0){let l=t.appears,d=a,m=!1,h=a;if(typeof l!="string"){let g={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Je.anyOf[0].type,parentSchema:Je.anyOf[0],data:l};n===null?n=[g]:n.push(g),a++}var p=h===a;m=m||p;let y=a;if(!(typeof l=="number"&&!(l%1)&&!isNaN(l))){let g={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Je.anyOf[1].type,parentSchema:Je.anyOf[1],data:l};n===null?n=[g]:n.push(g),a++}if(typeof l=="number"&&(l<1||isNaN(l))){let g={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Je.anyOf[1],data:l};n===null?n=[g]:n.push(g),a++}var p=y===a;if(m=m||p,m)a=d,n!==null&&(d?n.length=d:n=null);else{let g={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Je.anyOf,parentSchema:Je,data:l};n===null?n=[g]:n.push(g),a++}}if(t.disappears!==void 0){let l=t.disappears,d=a,m=!1,h=a;if(typeof l!="string"){let g={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Je.anyOf[0].type,parentSchema:Je.anyOf[0],data:l};n===null?n=[g]:n.push(g),a++}var c=h===a;m=m||c;let y=a;if(!(typeof l=="number"&&!(l%1)&&!isNaN(l))){let g={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Je.anyOf[1].type,parentSchema:Je.anyOf[1],data:l};n===null?n=[g]:n.push(g),a++}if(typeof l=="number"&&(l<1||isNaN(l))){let g={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Je.anyOf[1],data:l};n===null?n=[g]:n.push(g),a++}var c=y===a;if(m=m||c,m)a=d,n!==null&&(d?n.length=d:n=null);else{let g={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Je.anyOf,parentSchema:Je,data:l};n===null?n=[g]:n.push(g),a++}}}return As.errors=n,a===0}As.evaluated={props:{in:!0,at:!0,"right-of":!0,"left-of":!0,below:!0,behind:!0,gap:!0,align:!0,shift:!0,appears:!0,disappears:!0},dynamicProps:!1,dynamicItems:!1};var Nt={type:"object",minProperties:1,propertyNames:{$ref:"#/$defs/id"},description:"other looks of it, by name, for a motion to switch to (its box stays as it is)",additionalProperties:{type:"object",additionalProperties:!1,minProperties:1,properties:{role:{type:"string"},ghost:{type:"boolean"},label:{type:"string"},sub:{type:"string"},face:{type:"string",pattern:"^[a-z][a-z0-9-]*$"},deco:{type:"array",items:{$ref:"#/$defs/deco"}}}}},Qe={anyOf:[{enum:["envelope","bubble","file-lines","ghost","terminal"]},{type:"object",additionalProperties:!1,minProperties:1,maxProperties:1,properties:{terminal:{type:"integer",minimum:1,maximum:8},icon:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"an icon the host registers (none by default); one nothing registers is drawn as a placeholder, with a warning"},screen:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"terminal, chat, desktop, tiles, or a face the host registers"}}}]},ei=new RegExp("^[a-z][a-z0-9-]*$","u");function Ts(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=Ts.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(Object.keys(t).length<1){let l={instancePath:e,schemaPath:"#/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Nt,data:t};n===null?n=[l]:n.push(l),a++}for(let l in t){let d=a;if(typeof l=="string"){if(!It.test(l)){let m={instancePath:e,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:l,propertyName:l};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:l,propertyName:l};n===null?n=[m]:n.push(m),a++}var p=d===a;if(!p){let m={instancePath:e,schemaPath:"#/propertyNames",keyword:"propertyNames",params:{propertyName:l},message:"property name must be valid",schema:Nt.propertyNames,parentSchema:Nt,data:t};n===null?n=[m]:n.push(m),a++}}for(let l in t){let d=t[l];if(d&&typeof d=="object"&&!Array.isArray(d)){if(Object.keys(d).length<1){let m={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/additionalProperties/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Nt.additionalProperties,data:d};n===null?n=[m]:n.push(m),a++}for(let m in d)if(!(m==="role"||m==="ghost"||m==="label"||m==="sub"||m==="face"||m==="deco")){let h={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/additionalProperties/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:m},message:"must NOT have additional properties",schema:!1,parentSchema:Nt.additionalProperties,data:d};n===null?n=[h]:n.push(h),a++}if(d.role!==void 0){let m=d.role;if(typeof m!="string"){let h={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/role",schemaPath:"#/additionalProperties/properties/role/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Nt.additionalProperties.properties.role.type,parentSchema:Nt.additionalProperties.properties.role,data:m};n===null?n=[h]:n.push(h),a++}}if(d.ghost!==void 0){let m=d.ghost;if(typeof m!="boolean"){let h={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/ghost",schemaPath:"#/additionalProperties/properties/ghost/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Nt.additionalProperties.properties.ghost.type,parentSchema:Nt.additionalProperties.properties.ghost,data:m};n===null?n=[h]:n.push(h),a++}}if(d.label!==void 0){let m=d.label;if(typeof m!="string"){let h={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/label",schemaPath:"#/additionalProperties/properties/label/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Nt.additionalProperties.properties.label.type,parentSchema:Nt.additionalProperties.properties.label,data:m};n===null?n=[h]:n.push(h),a++}}if(d.sub!==void 0){let m=d.sub;if(typeof m!="string"){let h={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/sub",schemaPath:"#/additionalProperties/properties/sub/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Nt.additionalProperties.properties.sub.type,parentSchema:Nt.additionalProperties.properties.sub,data:m};n===null?n=[h]:n.push(h),a++}}if(d.face!==void 0){let m=d.face;if(typeof m=="string"){if(!ei.test(m)){let h={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/face",schemaPath:"#/additionalProperties/properties/face/pattern",keyword:"pattern",params:{pattern:"^[a-z][a-z0-9-]*$"},message:'must match pattern "^[a-z][a-z0-9-]*$"',schema:"^[a-z][a-z0-9-]*$",parentSchema:Nt.additionalProperties.properties.face,data:m};n===null?n=[h]:n.push(h),a++}}else{let h={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/face",schemaPath:"#/additionalProperties/properties/face/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Nt.additionalProperties.properties.face.type,parentSchema:Nt.additionalProperties.properties.face,data:m};n===null?n=[h]:n.push(h),a++}}if(d.deco!==void 0){let m=d.deco;if(Array.isArray(m)){let h=m.length;for(let y=0;y<h;y++){let g=m[y],k=a,u=!1,b=a;if(!(g==="envelope"||g==="bubble"||g==="file-lines"||g==="ghost"||g==="terminal")){let w={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y,schemaPath:"#/$defs/deco/anyOf/0/enum",keyword:"enum",params:{allowedValues:Qe.anyOf[0].enum},message:"must be equal to one of the allowed values",schema:Qe.anyOf[0].enum,parentSchema:Qe.anyOf[0],data:g};n===null?n=[w]:n.push(w),a++}var c=b===a;u=u||c;let x=a;if(g&&typeof g=="object"&&!Array.isArray(g)){if(Object.keys(g).length>1){let w={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y,schemaPath:"#/$defs/deco/anyOf/1/maxProperties",keyword:"maxProperties",params:{limit:1},message:"must NOT have more than 1 properties",schema:1,parentSchema:Qe.anyOf[1],data:g};n===null?n=[w]:n.push(w),a++}if(Object.keys(g).length<1){let w={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y,schemaPath:"#/$defs/deco/anyOf/1/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Qe.anyOf[1],data:g};n===null?n=[w]:n.push(w),a++}for(let w in g)if(!(w==="terminal"||w==="icon"||w==="screen")){let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y,schemaPath:"#/$defs/deco/anyOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:w},message:"must NOT have additional properties",schema:!1,parentSchema:Qe.anyOf[1],data:g};n===null?n=[$]:n.push($),a++}if(g.terminal!==void 0){let w=g.terminal;if(!(typeof w=="number"&&!(w%1)&&!isNaN(w))){let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Qe.anyOf[1].properties.terminal.type,parentSchema:Qe.anyOf[1].properties.terminal,data:w};n===null?n=[$]:n.push($),a++}if(typeof w=="number"){if(w>8||isNaN(w)){let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/maximum",keyword:"maximum",params:{comparison:"<=",limit:8},message:"must be <= 8",schema:8,parentSchema:Qe.anyOf[1].properties.terminal,data:w};n===null?n=[$]:n.push($),a++}if(w<1||isNaN(w)){let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Qe.anyOf[1].properties.terminal,data:w};n===null?n=[$]:n.push($),a++}}}if(g.icon!==void 0){let w=g.icon;if(typeof w=="string"){if(!ei.test(w)){let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/icon",schemaPath:"#/$defs/deco/anyOf/1/properties/icon/pattern",keyword:"pattern",params:{pattern:"^[a-z][a-z0-9-]*$"},message:'must match pattern "^[a-z][a-z0-9-]*$"',schema:"^[a-z][a-z0-9-]*$",parentSchema:Qe.anyOf[1].properties.icon,data:w};n===null?n=[$]:n.push($),a++}}else{let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/icon",schemaPath:"#/$defs/deco/anyOf/1/properties/icon/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Qe.anyOf[1].properties.icon.type,parentSchema:Qe.anyOf[1].properties.icon,data:w};n===null?n=[$]:n.push($),a++}}if(g.screen!==void 0){let w=g.screen;if(typeof w=="string"){if(!ei.test(w)){let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/screen",schemaPath:"#/$defs/deco/anyOf/1/properties/screen/pattern",keyword:"pattern",params:{pattern:"^[a-z][a-z0-9-]*$"},message:'must match pattern "^[a-z][a-z0-9-]*$"',schema:"^[a-z][a-z0-9-]*$",parentSchema:Qe.anyOf[1].properties.screen,data:w};n===null?n=[$]:n.push($),a++}}else{let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/screen",schemaPath:"#/$defs/deco/anyOf/1/properties/screen/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Qe.anyOf[1].properties.screen.type,parentSchema:Qe.anyOf[1].properties.screen,data:w};n===null?n=[$]:n.push($),a++}}}else{let w={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y,schemaPath:"#/$defs/deco/anyOf/1/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Qe.anyOf[1].type,parentSchema:Qe.anyOf[1],data:g};n===null?n=[w]:n.push(w),a++}var c=x===a;if(u=u||c,u)a=k,n!==null&&(k?n.length=k:n=null);else{let w={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y,schemaPath:"#/$defs/deco/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Qe.anyOf,parentSchema:Qe,data:g};n===null?n=[w]:n.push(w),a++}}}else{let h={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco",schemaPath:"#/additionalProperties/properties/deco/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Nt.additionalProperties.properties.deco.type,parentSchema:Nt.additionalProperties.properties.deco,data:m};n===null?n=[h]:n.push(h),a++}}}else{let m={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/additionalProperties/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Nt.additionalProperties.type,parentSchema:Nt.additionalProperties,data:d};n===null?n=[m]:n.push(m),a++}}}else{let l={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Nt.type,parentSchema:Nt,data:t};n===null?n=[l]:n.push(l),a++}return Ts.errors=n,a===0}Ts.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var tt={type:"object",required:["id"],unevaluatedProperties:!1,allOf:[{$ref:"#/$defs/placement"}],properties:{id:{$ref:"#/$defs/id"},asset:{type:"string",description:"asset name from the library; default 'block'"},role:{type:"string",description:"colour role"},label:{type:"string"},sub:{type:"string"},size:{$ref:"#/$defs/size2or3"},z:{type:"number",description:"lift above the floor it stands on"},deco:{type:"array",items:{$ref:"#/$defs/deco"}},ghost:{type:"boolean"},face:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"screen asset: what the screen shows: terminal, chat, desktop, tiles, or a face the host registers"},facing:{type:"number",description:"screen asset: rotation in degrees"},"label-at":{type:"object",additionalProperties:!1,properties:{side:{enum:["above","right","left","below"]},dx:{type:"number"},dy:{type:"number"}}},motion:{$ref:"#/$defs/motion"},variants:{$ref:"#/$defs/variants"},nodes:{type:"array",items:{$ref:"#/$defs/node"},description:"nodes standing on top of this one"}}},Mp={validate:hs};function hs(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=hs.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),As(t,{instancePath:e,parentData:s,parentDataProperty:r,rootData:i,dynamicAnchors:o})||(n=n===null?As.errors:n.concat(As.errors),a=n.length),t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let c={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'",schema:tt.required,parentSchema:tt,data:t};n===null?n=[c]:n.push(c),a++}if(t.id!==void 0){let c=t.id;if(typeof c=="string"){if(!It.test(c)){let l={instancePath:e+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:c};n===null?n=[l]:n.push(l),a++}}if(t.asset!==void 0){let c=t.asset;if(typeof c!="string"){let l={instancePath:e+"/asset",schemaPath:"#/properties/asset/type",keyword:"type",params:{type:"string"},message:"must be string",schema:tt.properties.asset.type,parentSchema:tt.properties.asset,data:c};n===null?n=[l]:n.push(l),a++}}if(t.role!==void 0){let c=t.role;if(typeof c!="string"){let l={instancePath:e+"/role",schemaPath:"#/properties/role/type",keyword:"type",params:{type:"string"},message:"must be string",schema:tt.properties.role.type,parentSchema:tt.properties.role,data:c};n===null?n=[l]:n.push(l),a++}}if(t.label!==void 0){let c=t.label;if(typeof c!="string"){let l={instancePath:e+"/label",schemaPath:"#/properties/label/type",keyword:"type",params:{type:"string"},message:"must be string",schema:tt.properties.label.type,parentSchema:tt.properties.label,data:c};n===null?n=[l]:n.push(l),a++}}if(t.sub!==void 0){let c=t.sub;if(typeof c!="string"){let l={instancePath:e+"/sub",schemaPath:"#/properties/sub/type",keyword:"type",params:{type:"string"},message:"must be string",schema:tt.properties.sub.type,parentSchema:tt.properties.sub,data:c};n===null?n=[l]:n.push(l),a++}}if(t.size!==void 0){let c=t.size;if(Array.isArray(c)){if(c.length>3){let d={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:yn,data:c};n===null?n=[d]:n.push(d),a++}if(c.length<2){let d={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:yn,data:c};n===null?n=[d]:n.push(d),a++}let l=c.length;for(let d=0;d<l;d++){let m=c[d];if(typeof m=="number"){if(m<=0||isNaN(m)){let h={instancePath:e+"/size/"+d,schemaPath:"#/$defs/size2or3/items/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:yn.items,data:m};n===null?n=[h]:n.push(h),a++}}else{let h={instancePath:e+"/size/"+d,schemaPath:"#/$defs/size2or3/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:yn.items.type,parentSchema:yn.items,data:m};n===null?n=[h]:n.push(h),a++}}}else{let l={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/type",keyword:"type",params:{type:"array"},message:"must be array",schema:yn.type,parentSchema:yn,data:c};n===null?n=[l]:n.push(l),a++}}if(t.z!==void 0){let c=t.z;if(typeof c!="number"){let l={instancePath:e+"/z",schemaPath:"#/properties/z/type",keyword:"type",params:{type:"number"},message:"must be number",schema:tt.properties.z.type,parentSchema:tt.properties.z,data:c};n===null?n=[l]:n.push(l),a++}}if(t.deco!==void 0){let c=t.deco;if(Array.isArray(c)){let l=c.length;for(let d=0;d<l;d++){let m=c[d],h=a,y=!1,g=a;if(!(m==="envelope"||m==="bubble"||m==="file-lines"||m==="ghost"||m==="terminal")){let u={instancePath:e+"/deco/"+d,schemaPath:"#/$defs/deco/anyOf/0/enum",keyword:"enum",params:{allowedValues:Qe.anyOf[0].enum},message:"must be equal to one of the allowed values",schema:Qe.anyOf[0].enum,parentSchema:Qe.anyOf[0],data:m};n===null?n=[u]:n.push(u),a++}var p=g===a;y=y||p;let k=a;if(m&&typeof m=="object"&&!Array.isArray(m)){if(Object.keys(m).length>1){let u={instancePath:e+"/deco/"+d,schemaPath:"#/$defs/deco/anyOf/1/maxProperties",keyword:"maxProperties",params:{limit:1},message:"must NOT have more than 1 properties",schema:1,parentSchema:Qe.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}if(Object.keys(m).length<1){let u={instancePath:e+"/deco/"+d,schemaPath:"#/$defs/deco/anyOf/1/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Qe.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}for(let u in m)if(!(u==="terminal"||u==="icon"||u==="screen")){let b={instancePath:e+"/deco/"+d,schemaPath:"#/$defs/deco/anyOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:u},message:"must NOT have additional properties",schema:!1,parentSchema:Qe.anyOf[1],data:m};n===null?n=[b]:n.push(b),a++}if(m.terminal!==void 0){let u=m.terminal;if(!(typeof u=="number"&&!(u%1)&&!isNaN(u))){let b={instancePath:e+"/deco/"+d+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Qe.anyOf[1].properties.terminal.type,parentSchema:Qe.anyOf[1].properties.terminal,data:u};n===null?n=[b]:n.push(b),a++}if(typeof u=="number"){if(u>8||isNaN(u)){let b={instancePath:e+"/deco/"+d+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/maximum",keyword:"maximum",params:{comparison:"<=",limit:8},message:"must be <= 8",schema:8,parentSchema:Qe.anyOf[1].properties.terminal,data:u};n===null?n=[b]:n.push(b),a++}if(u<1||isNaN(u)){let b={instancePath:e+"/deco/"+d+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Qe.anyOf[1].properties.terminal,data:u};n===null?n=[b]:n.push(b),a++}}}if(m.icon!==void 0){let u=m.icon;if(typeof u=="string"){if(!ei.test(u)){let b={instancePath:e+"/deco/"+d+"/icon",schemaPath:"#/$defs/deco/anyOf/1/properties/icon/pattern",keyword:"pattern",params:{pattern:"^[a-z][a-z0-9-]*$"},message:'must match pattern "^[a-z][a-z0-9-]*$"',schema:"^[a-z][a-z0-9-]*$",parentSchema:Qe.anyOf[1].properties.icon,data:u};n===null?n=[b]:n.push(b),a++}}else{let b={instancePath:e+"/deco/"+d+"/icon",schemaPath:"#/$defs/deco/anyOf/1/properties/icon/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Qe.anyOf[1].properties.icon.type,parentSchema:Qe.anyOf[1].properties.icon,data:u};n===null?n=[b]:n.push(b),a++}}if(m.screen!==void 0){let u=m.screen;if(typeof u=="string"){if(!ei.test(u)){let b={instancePath:e+"/deco/"+d+"/screen",schemaPath:"#/$defs/deco/anyOf/1/properties/screen/pattern",keyword:"pattern",params:{pattern:"^[a-z][a-z0-9-]*$"},message:'must match pattern "^[a-z][a-z0-9-]*$"',schema:"^[a-z][a-z0-9-]*$",parentSchema:Qe.anyOf[1].properties.screen,data:u};n===null?n=[b]:n.push(b),a++}}else{let b={instancePath:e+"/deco/"+d+"/screen",schemaPath:"#/$defs/deco/anyOf/1/properties/screen/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Qe.anyOf[1].properties.screen.type,parentSchema:Qe.anyOf[1].properties.screen,data:u};n===null?n=[b]:n.push(b),a++}}}else{let u={instancePath:e+"/deco/"+d,schemaPath:"#/$defs/deco/anyOf/1/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Qe.anyOf[1].type,parentSchema:Qe.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}var p=k===a;if(y=y||p,y)a=h,n!==null&&(h?n.length=h:n=null);else{let u={instancePath:e+"/deco/"+d,schemaPath:"#/$defs/deco/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Qe.anyOf,parentSchema:Qe,data:m};n===null?n=[u]:n.push(u),a++}}}else{let l={instancePath:e+"/deco",schemaPath:"#/properties/deco/type",keyword:"type",params:{type:"array"},message:"must be array",schema:tt.properties.deco.type,parentSchema:tt.properties.deco,data:c};n===null?n=[l]:n.push(l),a++}}if(t.ghost!==void 0){let c=t.ghost;if(typeof c!="boolean"){let l={instancePath:e+"/ghost",schemaPath:"#/properties/ghost/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:tt.properties.ghost.type,parentSchema:tt.properties.ghost,data:c};n===null?n=[l]:n.push(l),a++}}if(t.face!==void 0){let c=t.face;if(typeof c=="string"){if(!ei.test(c)){let l={instancePath:e+"/face",schemaPath:"#/properties/face/pattern",keyword:"pattern",params:{pattern:"^[a-z][a-z0-9-]*$"},message:'must match pattern "^[a-z][a-z0-9-]*$"',schema:"^[a-z][a-z0-9-]*$",parentSchema:tt.properties.face,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/face",schemaPath:"#/properties/face/type",keyword:"type",params:{type:"string"},message:"must be string",schema:tt.properties.face.type,parentSchema:tt.properties.face,data:c};n===null?n=[l]:n.push(l),a++}}if(t.facing!==void 0){let c=t.facing;if(typeof c!="number"){let l={instancePath:e+"/facing",schemaPath:"#/properties/facing/type",keyword:"type",params:{type:"number"},message:"must be number",schema:tt.properties.facing.type,parentSchema:tt.properties.facing,data:c};n===null?n=[l]:n.push(l),a++}}if(t["label-at"]!==void 0){let c=t["label-at"];if(c&&typeof c=="object"&&!Array.isArray(c)){for(let l in c)if(!(l==="side"||l==="dx"||l==="dy")){let d={instancePath:e+"/label-at",schemaPath:"#/properties/label-at/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:l},message:"must NOT have additional properties",schema:!1,parentSchema:tt.properties["label-at"],data:c};n===null?n=[d]:n.push(d),a++}if(c.side!==void 0){let l=c.side;if(!(l==="above"||l==="right"||l==="left"||l==="below")){let d={instancePath:e+"/label-at/side",schemaPath:"#/properties/label-at/properties/side/enum",keyword:"enum",params:{allowedValues:tt.properties["label-at"].properties.side.enum},message:"must be equal to one of the allowed values",schema:tt.properties["label-at"].properties.side.enum,parentSchema:tt.properties["label-at"].properties.side,data:l};n===null?n=[d]:n.push(d),a++}}if(c.dx!==void 0){let l=c.dx;if(typeof l!="number"){let d={instancePath:e+"/label-at/dx",schemaPath:"#/properties/label-at/properties/dx/type",keyword:"type",params:{type:"number"},message:"must be number",schema:tt.properties["label-at"].properties.dx.type,parentSchema:tt.properties["label-at"].properties.dx,data:l};n===null?n=[d]:n.push(d),a++}}if(c.dy!==void 0){let l=c.dy;if(typeof l!="number"){let d={instancePath:e+"/label-at/dy",schemaPath:"#/properties/label-at/properties/dy/type",keyword:"type",params:{type:"number"},message:"must be number",schema:tt.properties["label-at"].properties.dy.type,parentSchema:tt.properties["label-at"].properties.dy,data:l};n===null?n=[d]:n.push(d),a++}}}else{let l={instancePath:e+"/label-at",schemaPath:"#/properties/label-at/type",keyword:"type",params:{type:"object"},message:"must be object",schema:tt.properties["label-at"].type,parentSchema:tt.properties["label-at"],data:c};n===null?n=[l]:n.push(l),a++}}if(t.motion!==void 0){let c=t.motion;if(c&&typeof c=="object"&&!Array.isArray(c)){if(Object.keys(c).length<1){let l={instancePath:e+"/motion",schemaPath:"#/$defs/motion/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:He,data:c};n===null?n=[l]:n.push(l),a++}for(let l in c)if(!(l==="style"||l==="out"||l==="easing"||l==="from"||l==="delay"||l==="duration")){let d={instancePath:e+"/motion",schemaPath:"#/$defs/motion/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:l},message:"must NOT have additional properties",schema:!1,parentSchema:He,data:c};n===null?n=[d]:n.push(d),a++}if(c.style!==void 0){let l=c.style;if(!(l==="edge"||l==="drop"||l==="rise"||l==="fly"||l==="pop"||l==="scatter"||l==="build"||l==="fade")){let d={instancePath:e+"/motion/style",schemaPath:"#/$defs/motion/properties/style/enum",keyword:"enum",params:{allowedValues:He.properties.style.enum},message:"must be equal to one of the allowed values",schema:He.properties.style.enum,parentSchema:He.properties.style,data:l};n===null?n=[d]:n.push(d),a++}}if(c.out!==void 0){let l=c.out;if(!(l==="explode"||l==="lift-off"||l==="sink"||l==="scatter"||l==="fly-out"||l==="collapse"||l==="fade"||l==="reverse")){let d={instancePath:e+"/motion/out",schemaPath:"#/$defs/motion/properties/out/enum",keyword:"enum",params:{allowedValues:He.properties.out.enum},message:"must be equal to one of the allowed values",schema:He.properties.out.enum,parentSchema:He.properties.out,data:l};n===null?n=[d]:n.push(d),a++}}if(c.easing!==void 0){let l=c.easing;if(!(l==="linear"||l==="ease"||l==="ease-in"||l==="ease-out"||l==="settle"||l==="spring"||l==="bounce")){let d={instancePath:e+"/motion/easing",schemaPath:"#/$defs/motion/properties/easing/enum",keyword:"enum",params:{allowedValues:He.properties.easing.enum},message:"must be equal to one of the allowed values",schema:He.properties.easing.enum,parentSchema:He.properties.easing,data:l};n===null?n=[d]:n.push(d),a++}}if(c.from!==void 0){let l=c.from;if(!(l==="left"||l==="right"||l==="top"||l==="bottom")){let d={instancePath:e+"/motion/from",schemaPath:"#/$defs/motion/properties/from/enum",keyword:"enum",params:{allowedValues:He.properties.from.enum},message:"must be equal to one of the allowed values",schema:He.properties.from.enum,parentSchema:He.properties.from,data:l};n===null?n=[d]:n.push(d),a++}}if(c.delay!==void 0){let l=c.delay;if(typeof l=="number"){if(l<0||isNaN(l)){let d={instancePath:e+"/motion/delay",schemaPath:"#/$defs/motion/properties/delay/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:He.properties.delay,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/motion/delay",schemaPath:"#/$defs/motion/properties/delay/type",keyword:"type",params:{type:"number"},message:"must be number",schema:He.properties.delay.type,parentSchema:He.properties.delay,data:l};n===null?n=[d]:n.push(d),a++}}if(c.duration!==void 0){let l=c.duration;if(typeof l=="number"){if(l<=0||isNaN(l)){let d={instancePath:e+"/motion/duration",schemaPath:"#/$defs/motion/properties/duration/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:He.properties.duration,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/motion/duration",schemaPath:"#/$defs/motion/properties/duration/type",keyword:"type",params:{type:"number"},message:"must be number",schema:He.properties.duration.type,parentSchema:He.properties.duration,data:l};n===null?n=[d]:n.push(d),a++}}}else{let l={instancePath:e+"/motion",schemaPath:"#/$defs/motion/type",keyword:"type",params:{type:"object"},message:"must be object",schema:He.type,parentSchema:He,data:c};n===null?n=[l]:n.push(l),a++}}if(t.variants!==void 0&&(Ts(t.variants,{instancePath:e+"/variants",parentData:t,parentDataProperty:"variants",rootData:i,dynamicAnchors:o})||(n=n===null?Ts.errors:n.concat(Ts.errors),a=n.length)),t.nodes!==void 0){let c=t.nodes;if(Array.isArray(c)){let l=c.length;for(let d=0;d<l;d++)Mp.validate(c[d],{instancePath:e+"/nodes/"+d,parentData:c,parentDataProperty:d,rootData:i,dynamicAnchors:o})||(n=n===null?Mp.validate.errors:n.concat(Mp.validate.errors),a=n.length)}else{let l={instancePath:e+"/nodes",schemaPath:"#/properties/nodes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:tt.properties.nodes.type,parentSchema:tt.properties.nodes,data:c};n===null?n=[l]:n.push(l),a++}}for(let c in t)if(c!=="id"&&c!=="asset"&&c!=="role"&&c!=="label"&&c!=="sub"&&c!=="size"&&c!=="z"&&c!=="deco"&&c!=="ghost"&&c!=="face"&&c!=="facing"&&c!=="label-at"&&c!=="motion"&&c!=="variants"&&c!=="nodes"&&c!=="in"&&c!=="at"&&c!=="right-of"&&c!=="left-of"&&c!=="below"&&c!=="behind"&&c!=="gap"&&c!=="align"&&c!=="shift"&&c!=="appears"&&c!=="disappears"){let l={instancePath:e,schemaPath:"#/unevaluatedProperties",keyword:"unevaluatedProperties",params:{unevaluatedProperty:c},message:"must NOT have unevaluated properties",schema:!1,parentSchema:tt,data:t};n===null?n=[l]:n.push(l),a++}}else{let c={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:tt.type,parentSchema:tt,data:t};n===null?n=[c]:n.push(c),a++}return hs.errors=n,a===0}hs.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var Pp={validate:mr};function mr(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=mr.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),As(t,{instancePath:e,parentData:s,parentDataProperty:r,rootData:i,dynamicAnchors:o})||(n=n===null?As.errors:n.concat(As.errors),a=n.length),t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let p={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'",schema:Be.required,parentSchema:Be,data:t};n===null?n=[p]:n.push(p),a++}if(t.kind===void 0){let p={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"kind"},message:"must have required property 'kind'",schema:Be.required,parentSchema:Be,data:t};n===null?n=[p]:n.push(p),a++}if(t.id!==void 0){let p=t.id;if(typeof p=="string"){if(!It.test(p)){let c={instancePath:e+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:p};n===null?n=[c]:n.push(c),a++}}else{let c={instancePath:e+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:p};n===null?n=[c]:n.push(c),a++}}if(t.kind!==void 0){let p=t.kind;if(!(p==="slab"||p==="pad"||p==="fence"||p==="vm"||p==="cloud"||p==="zone"||p==="platform"||p==="tunnel")){let c={instancePath:e+"/kind",schemaPath:"#/properties/kind/enum",keyword:"enum",params:{allowedValues:Be.properties.kind.enum},message:"must be equal to one of the allowed values",schema:Be.properties.kind.enum,parentSchema:Be.properties.kind,data:p};n===null?n=[c]:n.push(c),a++}}if(t.label!==void 0){let p=t.label;if(typeof p!="string"){let c={instancePath:e+"/label",schemaPath:"#/properties/label/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Be.properties.label.type,parentSchema:Be.properties.label,data:p};n===null?n=[c]:n.push(c),a++}}if(t["label-style"]!==void 0){let p=t["label-style"];if(!(p==="face"||p==="face-right"||p==="floor"||p==="none")){let c={instancePath:e+"/label-style",schemaPath:"#/properties/label-style/enum",keyword:"enum",params:{allowedValues:Be.properties["label-style"].enum},message:"must be equal to one of the allowed values",schema:Be.properties["label-style"].enum,parentSchema:Be.properties["label-style"],data:p};n===null?n=[c]:n.push(c),a++}}if(t.ghost!==void 0){let p=t.ghost;if(typeof p!="boolean"){let c={instancePath:e+"/ghost",schemaPath:"#/properties/ghost/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Be.properties.ghost.type,parentSchema:Be.properties.ghost,data:p};n===null?n=[c]:n.push(c),a++}}if(t.role!==void 0){let p=t.role;if(typeof p!="string"){let c={instancePath:e+"/role",schemaPath:"#/properties/role/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Be.properties.role.type,parentSchema:Be.properties.role,data:p};n===null?n=[c]:n.push(c),a++}}if(t.size!==void 0){let p=t.size;if(Array.isArray(p)){if(p.length>3){let l={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:yn,data:p};n===null?n=[l]:n.push(l),a++}if(p.length<2){let l={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:yn,data:p};n===null?n=[l]:n.push(l),a++}let c=p.length;for(let l=0;l<c;l++){let d=p[l];if(typeof d=="number"){if(d<=0||isNaN(d)){let m={instancePath:e+"/size/"+l,schemaPath:"#/$defs/size2or3/items/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:yn.items,data:d};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e+"/size/"+l,schemaPath:"#/$defs/size2or3/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:yn.items.type,parentSchema:yn.items,data:d};n===null?n=[m]:n.push(m),a++}}}else{let c={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/type",keyword:"type",params:{type:"array"},message:"must be array",schema:yn.type,parentSchema:yn,data:p};n===null?n=[c]:n.push(c),a++}}if(t.padding!==void 0){let p=t.padding;if(typeof p=="number"){if(p<0||isNaN(p)){let c={instancePath:e+"/padding",schemaPath:"#/properties/padding/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:Be.properties.padding,data:p};n===null?n=[c]:n.push(c),a++}}else{let c={instancePath:e+"/padding",schemaPath:"#/properties/padding/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Be.properties.padding.type,parentSchema:Be.properties.padding,data:p};n===null?n=[c]:n.push(c),a++}}if(t.height!==void 0){let p=t.height;if(typeof p=="number"){if(p<=0||isNaN(p)){let c={instancePath:e+"/height",schemaPath:"#/properties/height/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Be.properties.height,data:p};n===null?n=[c]:n.push(c),a++}}else{let c={instancePath:e+"/height",schemaPath:"#/properties/height/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Be.properties.height.type,parentSchema:Be.properties.height,data:p};n===null?n=[c]:n.push(c),a++}}if(t.z!==void 0){let p=t.z;if(typeof p!="number"){let c={instancePath:e+"/z",schemaPath:"#/properties/z/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Be.properties.z.type,parentSchema:Be.properties.z,data:p};n===null?n=[c]:n.push(c),a++}}if(t.flow!==void 0){let p=t.flow;if(!(p==="row"||p==="column")){let c={instancePath:e+"/flow",schemaPath:"#/properties/flow/enum",keyword:"enum",params:{allowedValues:Be.properties.flow.enum},message:"must be equal to one of the allowed values",schema:Be.properties.flow.enum,parentSchema:Be.properties.flow,data:p};n===null?n=[c]:n.push(c),a++}}if(t.gate!==void 0){let p=t.gate;if(p&&typeof p=="object"&&!Array.isArray(p)){if(p.side===void 0){let c={instancePath:e+"/gate",schemaPath:"#/properties/gate/required",keyword:"required",params:{missingProperty:"side"},message:"must have required property 'side'",schema:Be.properties.gate.required,parentSchema:Be.properties.gate,data:p};n===null?n=[c]:n.push(c),a++}for(let c in p)if(!(c==="side"||c==="at"||c==="width"||c==="height"||c==="node")){let l={instancePath:e+"/gate",schemaPath:"#/properties/gate/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:c},message:"must NOT have additional properties",schema:!1,parentSchema:Be.properties.gate,data:p};n===null?n=[l]:n.push(l),a++}if(p.side!==void 0){let c=p.side;if(!(c==="n"||c==="e"||c==="s"||c==="w")){let l={instancePath:e+"/gate/side",schemaPath:"#/$defs/side/enum",keyword:"enum",params:{allowedValues:Sp.enum},message:"must be equal to one of the allowed values",schema:Sp.enum,parentSchema:Sp,data:c};n===null?n=[l]:n.push(l),a++}}if(p.at!==void 0){let c=p.at;if(typeof c=="number"){if(c>1||isNaN(c)){let l={instancePath:e+"/gate/at",schemaPath:"#/properties/gate/properties/at/maximum",keyword:"maximum",params:{comparison:"<=",limit:1},message:"must be <= 1",schema:1,parentSchema:Be.properties.gate.properties.at,data:c};n===null?n=[l]:n.push(l),a++}if(c<0||isNaN(c)){let l={instancePath:e+"/gate/at",schemaPath:"#/properties/gate/properties/at/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:Be.properties.gate.properties.at,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/gate/at",schemaPath:"#/properties/gate/properties/at/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Be.properties.gate.properties.at.type,parentSchema:Be.properties.gate.properties.at,data:c};n===null?n=[l]:n.push(l),a++}}if(p.width!==void 0){let c=p.width;if(typeof c=="number"){if(c<=0||isNaN(c)){let l={instancePath:e+"/gate/width",schemaPath:"#/properties/gate/properties/width/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Be.properties.gate.properties.width,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/gate/width",schemaPath:"#/properties/gate/properties/width/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Be.properties.gate.properties.width.type,parentSchema:Be.properties.gate.properties.width,data:c};n===null?n=[l]:n.push(l),a++}}if(p.height!==void 0){let c=p.height;if(typeof c=="number"){if(c<=0||isNaN(c)){let l={instancePath:e+"/gate/height",schemaPath:"#/properties/gate/properties/height/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Be.properties.gate.properties.height,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/gate/height",schemaPath:"#/properties/gate/properties/height/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Be.properties.gate.properties.height.type,parentSchema:Be.properties.gate.properties.height,data:c};n===null?n=[l]:n.push(l),a++}}if(p.node!==void 0){let c=p.node;if(typeof c=="string"){if(!It.test(c)){let l={instancePath:e+"/gate/node",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/gate/node",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:c};n===null?n=[l]:n.push(l),a++}}}else{let c={instancePath:e+"/gate",schemaPath:"#/properties/gate/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Be.properties.gate.type,parentSchema:Be.properties.gate,data:p};n===null?n=[c]:n.push(c),a++}}if(t.around!==void 0){let p=t.around;if(Array.isArray(p)){let c=p.length;for(let l=0;l<c;l++){let d=p[l];if(typeof d=="string"){if(!It.test(d)){let m={instancePath:e+"/around/"+l,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:d};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e+"/around/"+l,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:d};n===null?n=[m]:n.push(m),a++}}}else{let c={instancePath:e+"/around",schemaPath:"#/properties/around/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Be.properties.around.type,parentSchema:Be.properties.around,data:p};n===null?n=[c]:n.push(c),a++}}if(t.regions!==void 0){let p=t.regions;if(Array.isArray(p)){let c=p.length;for(let l=0;l<c;l++)Pp.validate(p[l],{instancePath:e+"/regions/"+l,parentData:p,parentDataProperty:l,rootData:i,dynamicAnchors:o})||(n=n===null?Pp.validate.errors:n.concat(Pp.validate.errors),a=n.length)}else{let c={instancePath:e+"/regions",schemaPath:"#/properties/regions/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Be.properties.regions.type,parentSchema:Be.properties.regions,data:p};n===null?n=[c]:n.push(c),a++}}if(t.motion!==void 0){let p=t.motion;if(p&&typeof p=="object"&&!Array.isArray(p)){if(Object.keys(p).length<1){let c={instancePath:e+"/motion",schemaPath:"#/$defs/motion/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:He,data:p};n===null?n=[c]:n.push(c),a++}for(let c in p)if(!(c==="style"||c==="out"||c==="easing"||c==="from"||c==="delay"||c==="duration")){let l={instancePath:e+"/motion",schemaPath:"#/$defs/motion/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:c},message:"must NOT have additional properties",schema:!1,parentSchema:He,data:p};n===null?n=[l]:n.push(l),a++}if(p.style!==void 0){let c=p.style;if(!(c==="edge"||c==="drop"||c==="rise"||c==="fly"||c==="pop"||c==="scatter"||c==="build"||c==="fade")){let l={instancePath:e+"/motion/style",schemaPath:"#/$defs/motion/properties/style/enum",keyword:"enum",params:{allowedValues:He.properties.style.enum},message:"must be equal to one of the allowed values",schema:He.properties.style.enum,parentSchema:He.properties.style,data:c};n===null?n=[l]:n.push(l),a++}}if(p.out!==void 0){let c=p.out;if(!(c==="explode"||c==="lift-off"||c==="sink"||c==="scatter"||c==="fly-out"||c==="collapse"||c==="fade"||c==="reverse")){let l={instancePath:e+"/motion/out",schemaPath:"#/$defs/motion/properties/out/enum",keyword:"enum",params:{allowedValues:He.properties.out.enum},message:"must be equal to one of the allowed values",schema:He.properties.out.enum,parentSchema:He.properties.out,data:c};n===null?n=[l]:n.push(l),a++}}if(p.easing!==void 0){let c=p.easing;if(!(c==="linear"||c==="ease"||c==="ease-in"||c==="ease-out"||c==="settle"||c==="spring"||c==="bounce")){let l={instancePath:e+"/motion/easing",schemaPath:"#/$defs/motion/properties/easing/enum",keyword:"enum",params:{allowedValues:He.properties.easing.enum},message:"must be equal to one of the allowed values",schema:He.properties.easing.enum,parentSchema:He.properties.easing,data:c};n===null?n=[l]:n.push(l),a++}}if(p.from!==void 0){let c=p.from;if(!(c==="left"||c==="right"||c==="top"||c==="bottom")){let l={instancePath:e+"/motion/from",schemaPath:"#/$defs/motion/properties/from/enum",keyword:"enum",params:{allowedValues:He.properties.from.enum},message:"must be equal to one of the allowed values",schema:He.properties.from.enum,parentSchema:He.properties.from,data:c};n===null?n=[l]:n.push(l),a++}}if(p.delay!==void 0){let c=p.delay;if(typeof c=="number"){if(c<0||isNaN(c)){let l={instancePath:e+"/motion/delay",schemaPath:"#/$defs/motion/properties/delay/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:He.properties.delay,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/motion/delay",schemaPath:"#/$defs/motion/properties/delay/type",keyword:"type",params:{type:"number"},message:"must be number",schema:He.properties.delay.type,parentSchema:He.properties.delay,data:c};n===null?n=[l]:n.push(l),a++}}if(p.duration!==void 0){let c=p.duration;if(typeof c=="number"){if(c<=0||isNaN(c)){let l={instancePath:e+"/motion/duration",schemaPath:"#/$defs/motion/properties/duration/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:He.properties.duration,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/motion/duration",schemaPath:"#/$defs/motion/properties/duration/type",keyword:"type",params:{type:"number"},message:"must be number",schema:He.properties.duration.type,parentSchema:He.properties.duration,data:c};n===null?n=[l]:n.push(l),a++}}}else{let c={instancePath:e+"/motion",schemaPath:"#/$defs/motion/type",keyword:"type",params:{type:"object"},message:"must be object",schema:He.type,parentSchema:He,data:p};n===null?n=[c]:n.push(c),a++}}if(t.variants!==void 0&&(Ts(t.variants,{instancePath:e+"/variants",parentData:t,parentDataProperty:"variants",rootData:i,dynamicAnchors:o})||(n=n===null?Ts.errors:n.concat(Ts.errors),a=n.length)),t.nodes!==void 0){let p=t.nodes;if(Array.isArray(p)){let c=p.length;for(let l=0;l<c;l++)hs(p[l],{instancePath:e+"/nodes/"+l,parentData:p,parentDataProperty:l,rootData:i,dynamicAnchors:o})||(n=n===null?hs.errors:n.concat(hs.errors),a=n.length)}else{let c={instancePath:e+"/nodes",schemaPath:"#/properties/nodes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Be.properties.nodes.type,parentSchema:Be.properties.nodes,data:p};n===null?n=[c]:n.push(c),a++}}for(let p in t)if(p!=="id"&&p!=="kind"&&p!=="label"&&p!=="label-style"&&p!=="ghost"&&p!=="role"&&p!=="size"&&p!=="padding"&&p!=="height"&&p!=="z"&&p!=="flow"&&p!=="gate"&&p!=="around"&&p!=="regions"&&p!=="motion"&&p!=="variants"&&p!=="nodes"&&p!=="in"&&p!=="at"&&p!=="right-of"&&p!=="left-of"&&p!=="below"&&p!=="behind"&&p!=="gap"&&p!=="align"&&p!=="shift"&&p!=="appears"&&p!=="disappears"){let c={instancePath:e,schemaPath:"#/unevaluatedProperties",keyword:"unevaluatedProperties",params:{unevaluatedProperty:p},message:"must NOT have unevaluated properties",schema:!1,parentSchema:Be,data:t};n===null?n=[c]:n.push(c),a++}}else{let p={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Be.type,parentSchema:Be,data:t};n===null?n=[p]:n.push(p),a++}return mr.errors=n,a===0}mr.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var je={type:"object",required:["id","from","to"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},from:{$ref:"#/$defs/endpoint"},to:{$ref:"#/$defs/endpoint"},kind:{type:"string"},via:{type:"array",items:{anyOf:[{$ref:"#/$defs/point2"},{$ref:"#/$defs/endpoint"}]}},points:{type:"array",items:{type:"array",items:{type:"number"},minItems:2,maxItems:3},description:"exact polyline in grid units; skips the router"},lane:{type:"number"},arrow:{type:"boolean"},cross:{type:"boolean",description:"the route may pass through fence walls (it crosses a boundary)"},label:{anyOf:[{type:"string"},{type:"object",additionalProperties:!1,required:["text"],properties:{text:{type:"string"},along:{type:"integer",minimum:1},side:{enum:["left","right"]},at:{type:"array",items:{type:"number"},minItems:2,maxItems:3,description:"exact place [x, y] or [x, y, z]; skips placement"},dir:{enum:["x","y"]},anchor:{enum:["start","middle","end"]}}}]},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},Os={type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"},Op=new RegExp("^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$","u");function ti(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=ti.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let m={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'",schema:je.required,parentSchema:je,data:t};n===null?n=[m]:n.push(m),a++}if(t.from===void 0){let m={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"from"},message:"must have required property 'from'",schema:je.required,parentSchema:je,data:t};n===null?n=[m]:n.push(m),a++}if(t.to===void 0){let m={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"to"},message:"must have required property 'to'",schema:je.required,parentSchema:je,data:t};n===null?n=[m]:n.push(m),a++}for(let m in t)if(!po.call(je.properties,m)){let h={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:m},message:"must NOT have additional properties",schema:!1,parentSchema:je,data:t};n===null?n=[h]:n.push(h),a++}if(t.id!==void 0){let m=t.id;if(typeof m=="string"){if(!It.test(m)){let h={instancePath:e+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:m};n===null?n=[h]:n.push(h),a++}}else{let h={instancePath:e+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:m};n===null?n=[h]:n.push(h),a++}}if(t.from!==void 0){let m=t.from;if(typeof m=="string"){if(!Op.test(m)){let h={instancePath:e+"/from",schemaPath:"#/$defs/endpoint/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"',schema:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$",parentSchema:Os,data:m};n===null?n=[h]:n.push(h),a++}}else{let h={instancePath:e+"/from",schemaPath:"#/$defs/endpoint/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Os.type,parentSchema:Os,data:m};n===null?n=[h]:n.push(h),a++}}if(t.to!==void 0){let m=t.to;if(typeof m=="string"){if(!Op.test(m)){let h={instancePath:e+"/to",schemaPath:"#/$defs/endpoint/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"',schema:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$",parentSchema:Os,data:m};n===null?n=[h]:n.push(h),a++}}else{let h={instancePath:e+"/to",schemaPath:"#/$defs/endpoint/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Os.type,parentSchema:Os,data:m};n===null?n=[h]:n.push(h),a++}}if(t.kind!==void 0){let m=t.kind;if(typeof m!="string"){let h={instancePath:e+"/kind",schemaPath:"#/properties/kind/type",keyword:"type",params:{type:"string"},message:"must be string",schema:je.properties.kind.type,parentSchema:je.properties.kind,data:m};n===null?n=[h]:n.push(h),a++}}if(t.via!==void 0){let m=t.via;if(Array.isArray(m)){let h=m.length;for(let y=0;y<h;y++){let g=m[y],k=a,u=!1,b=a;if(Array.isArray(g)){if(g.length>2){let $={instancePath:e+"/via/"+y,schemaPath:"#/$defs/point2/maxItems",keyword:"maxItems",params:{limit:2},message:"must NOT have more than 2 items",schema:2,parentSchema:Pt,data:g};n===null?n=[$]:n.push($),a++}if(g.length<2){let $={instancePath:e+"/via/"+y,schemaPath:"#/$defs/point2/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:Pt,data:g};n===null?n=[$]:n.push($),a++}let w=g.length;for(let $=0;$<w;$++){let S=g[$];if(typeof S!="number"){let O={instancePath:e+"/via/"+y+"/"+$,schemaPath:"#/$defs/point2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Pt.items.type,parentSchema:Pt.items,data:S};n===null?n=[O]:n.push(O),a++}}}else{let w={instancePath:e+"/via/"+y,schemaPath:"#/$defs/point2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Pt.type,parentSchema:Pt,data:g};n===null?n=[w]:n.push(w),a++}var p=b===a;u=u||p;let x=a;if(typeof g=="string"){if(!Op.test(g)){let w={instancePath:e+"/via/"+y,schemaPath:"#/$defs/endpoint/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"',schema:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$",parentSchema:Os,data:g};n===null?n=[w]:n.push(w),a++}}else{let w={instancePath:e+"/via/"+y,schemaPath:"#/$defs/endpoint/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Os.type,parentSchema:Os,data:g};n===null?n=[w]:n.push(w),a++}var p=x===a;if(u=u||p,u)a=k,n!==null&&(k?n.length=k:n=null);else{let w={instancePath:e+"/via/"+y,schemaPath:"#/properties/via/items/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:je.properties.via.items.anyOf,parentSchema:je.properties.via.items,data:g};n===null?n=[w]:n.push(w),a++}}}else{let h={instancePath:e+"/via",schemaPath:"#/properties/via/type",keyword:"type",params:{type:"array"},message:"must be array",schema:je.properties.via.type,parentSchema:je.properties.via,data:m};n===null?n=[h]:n.push(h),a++}}if(t.points!==void 0){let m=t.points;if(Array.isArray(m)){let h=m.length;for(let y=0;y<h;y++){let g=m[y];if(Array.isArray(g)){if(g.length>3){let u={instancePath:e+"/points/"+y,schemaPath:"#/properties/points/items/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:je.properties.points.items,data:g};n===null?n=[u]:n.push(u),a++}if(g.length<2){let u={instancePath:e+"/points/"+y,schemaPath:"#/properties/points/items/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:je.properties.points.items,data:g};n===null?n=[u]:n.push(u),a++}let k=g.length;for(let u=0;u<k;u++){let b=g[u];if(typeof b!="number"){let x={instancePath:e+"/points/"+y+"/"+u,schemaPath:"#/properties/points/items/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:je.properties.points.items.items.type,parentSchema:je.properties.points.items.items,data:b};n===null?n=[x]:n.push(x),a++}}}else{let k={instancePath:e+"/points/"+y,schemaPath:"#/properties/points/items/type",keyword:"type",params:{type:"array"},message:"must be array",schema:je.properties.points.items.type,parentSchema:je.properties.points.items,data:g};n===null?n=[k]:n.push(k),a++}}}else{let h={instancePath:e+"/points",schemaPath:"#/properties/points/type",keyword:"type",params:{type:"array"},message:"must be array",schema:je.properties.points.type,parentSchema:je.properties.points,data:m};n===null?n=[h]:n.push(h),a++}}if(t.lane!==void 0){let m=t.lane;if(typeof m!="number"){let h={instancePath:e+"/lane",schemaPath:"#/properties/lane/type",keyword:"type",params:{type:"number"},message:"must be number",schema:je.properties.lane.type,parentSchema:je.properties.lane,data:m};n===null?n=[h]:n.push(h),a++}}if(t.arrow!==void 0){let m=t.arrow;if(typeof m!="boolean"){let h={instancePath:e+"/arrow",schemaPath:"#/properties/arrow/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:je.properties.arrow.type,parentSchema:je.properties.arrow,data:m};n===null?n=[h]:n.push(h),a++}}if(t.cross!==void 0){let m=t.cross;if(typeof m!="boolean"){let h={instancePath:e+"/cross",schemaPath:"#/properties/cross/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:je.properties.cross.type,parentSchema:je.properties.cross,data:m};n===null?n=[h]:n.push(h),a++}}if(t.label!==void 0){let m=t.label,h=a,y=!1,g=a;if(typeof m!="string"){let u={instancePath:e+"/label",schemaPath:"#/properties/label/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:je.properties.label.anyOf[0].type,parentSchema:je.properties.label.anyOf[0],data:m};n===null?n=[u]:n.push(u),a++}var c=g===a;y=y||c;let k=a;if(m&&typeof m=="object"&&!Array.isArray(m)){if(m.text===void 0){let u={instancePath:e+"/label",schemaPath:"#/properties/label/anyOf/1/required",keyword:"required",params:{missingProperty:"text"},message:"must have required property 'text'",schema:je.properties.label.anyOf[1].required,parentSchema:je.properties.label.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}for(let u in m)if(!(u==="text"||u==="along"||u==="side"||u==="at"||u==="dir"||u==="anchor")){let b={instancePath:e+"/label",schemaPath:"#/properties/label/anyOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:u},message:"must NOT have additional properties",schema:!1,parentSchema:je.properties.label.anyOf[1],data:m};n===null?n=[b]:n.push(b),a++}if(m.text!==void 0){let u=m.text;if(typeof u!="string"){let b={instancePath:e+"/label/text",schemaPath:"#/properties/label/anyOf/1/properties/text/type",keyword:"type",params:{type:"string"},message:"must be string",schema:je.properties.label.anyOf[1].properties.text.type,parentSchema:je.properties.label.anyOf[1].properties.text,data:u};n===null?n=[b]:n.push(b),a++}}if(m.along!==void 0){let u=m.along;if(!(typeof u=="number"&&!(u%1)&&!isNaN(u))){let b={instancePath:e+"/label/along",schemaPath:"#/properties/label/anyOf/1/properties/along/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:je.properties.label.anyOf[1].properties.along.type,parentSchema:je.properties.label.anyOf[1].properties.along,data:u};n===null?n=[b]:n.push(b),a++}if(typeof u=="number"&&(u<1||isNaN(u))){let b={instancePath:e+"/label/along",schemaPath:"#/properties/label/anyOf/1/properties/along/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:je.properties.label.anyOf[1].properties.along,data:u};n===null?n=[b]:n.push(b),a++}}if(m.side!==void 0){let u=m.side;if(!(u==="left"||u==="right")){let b={instancePath:e+"/label/side",schemaPath:"#/properties/label/anyOf/1/properties/side/enum",keyword:"enum",params:{allowedValues:je.properties.label.anyOf[1].properties.side.enum},message:"must be equal to one of the allowed values",schema:je.properties.label.anyOf[1].properties.side.enum,parentSchema:je.properties.label.anyOf[1].properties.side,data:u};n===null?n=[b]:n.push(b),a++}}if(m.at!==void 0){let u=m.at;if(Array.isArray(u)){if(u.length>3){let x={instancePath:e+"/label/at",schemaPath:"#/properties/label/anyOf/1/properties/at/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:je.properties.label.anyOf[1].properties.at,data:u};n===null?n=[x]:n.push(x),a++}if(u.length<2){let x={instancePath:e+"/label/at",schemaPath:"#/properties/label/anyOf/1/properties/at/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:je.properties.label.anyOf[1].properties.at,data:u};n===null?n=[x]:n.push(x),a++}let b=u.length;for(let x=0;x<b;x++){let w=u[x];if(typeof w!="number"){let $={instancePath:e+"/label/at/"+x,schemaPath:"#/properties/label/anyOf/1/properties/at/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:je.properties.label.anyOf[1].properties.at.items.type,parentSchema:je.properties.label.anyOf[1].properties.at.items,data:w};n===null?n=[$]:n.push($),a++}}}else{let b={instancePath:e+"/label/at",schemaPath:"#/properties/label/anyOf/1/properties/at/type",keyword:"type",params:{type:"array"},message:"must be array",schema:je.properties.label.anyOf[1].properties.at.type,parentSchema:je.properties.label.anyOf[1].properties.at,data:u};n===null?n=[b]:n.push(b),a++}}if(m.dir!==void 0){let u=m.dir;if(!(u==="x"||u==="y")){let b={instancePath:e+"/label/dir",schemaPath:"#/properties/label/anyOf/1/properties/dir/enum",keyword:"enum",params:{allowedValues:je.properties.label.anyOf[1].properties.dir.enum},message:"must be equal to one of the allowed values",schema:je.properties.label.anyOf[1].properties.dir.enum,parentSchema:je.properties.label.anyOf[1].properties.dir,data:u};n===null?n=[b]:n.push(b),a++}}if(m.anchor!==void 0){let u=m.anchor;if(!(u==="start"||u==="middle"||u==="end")){let b={instancePath:e+"/label/anchor",schemaPath:"#/properties/label/anyOf/1/properties/anchor/enum",keyword:"enum",params:{allowedValues:je.properties.label.anyOf[1].properties.anchor.enum},message:"must be equal to one of the allowed values",schema:je.properties.label.anyOf[1].properties.anchor.enum,parentSchema:je.properties.label.anyOf[1].properties.anchor,data:u};n===null?n=[b]:n.push(b),a++}}}else{let u={instancePath:e+"/label",schemaPath:"#/properties/label/anyOf/1/type",keyword:"type",params:{type:"object"},message:"must be object",schema:je.properties.label.anyOf[1].type,parentSchema:je.properties.label.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}var c=k===a;if(y=y||c,y)a=h,n!==null&&(h?n.length=h:n=null);else{let u={instancePath:e+"/label",schemaPath:"#/properties/label/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:je.properties.label.anyOf,parentSchema:je.properties.label,data:m};n===null?n=[u]:n.push(u),a++}}if(t.appears!==void 0){let m=t.appears,h=a,y=!1,g=a;if(typeof m!="string"){let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Je.anyOf[0].type,parentSchema:Je.anyOf[0],data:m};n===null?n=[u]:n.push(u),a++}var l=g===a;y=y||l;let k=a;if(!(typeof m=="number"&&!(m%1)&&!isNaN(m))){let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Je.anyOf[1].type,parentSchema:Je.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}if(typeof m=="number"&&(m<1||isNaN(m))){let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Je.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}var l=k===a;if(y=y||l,y)a=h,n!==null&&(h?n.length=h:n=null);else{let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Je.anyOf,parentSchema:Je,data:m};n===null?n=[u]:n.push(u),a++}}if(t.disappears!==void 0){let m=t.disappears,h=a,y=!1,g=a;if(typeof m!="string"){let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Je.anyOf[0].type,parentSchema:Je.anyOf[0],data:m};n===null?n=[u]:n.push(u),a++}var d=g===a;y=y||d;let k=a;if(!(typeof m=="number"&&!(m%1)&&!isNaN(m))){let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Je.anyOf[1].type,parentSchema:Je.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}if(typeof m=="number"&&(m<1||isNaN(m))){let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Je.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}var d=k===a;if(y=y||d,y)a=h,n!==null&&(h?n.length=h:n=null);else{let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Je.anyOf,parentSchema:Je,data:m};n===null?n=[u]:n.push(u),a++}}}else{let m={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:je.type,parentSchema:je,data:t};n===null?n=[m]:n.push(m),a++}return ti.errors=n,a===0}ti.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var at={type:"object",additionalProperties:!1,properties:{floor:{type:"string"},face:{type:"string"},label:{type:"string"},sub:{type:"string"},at:{anyOf:[{$ref:"#/$defs/point2"},{type:"array",items:{type:"number"},minItems:3,maxItems:3}]},on:{$ref:"#/$defs/id",description:"a node, region or route; a note on a route dims and lights with it"},kind:{type:"string"},dir:{enum:["x","y"]},anchor:{enum:["start","middle","end"]},dx:{type:"number"},dy:{type:"number"},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}};function ni(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=ni.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){for(let m in t)if(!po.call(at.properties,m)){let h={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:m},message:"must NOT have additional properties",schema:!1,parentSchema:at,data:t};n===null?n=[h]:n.push(h),a++}if(t.floor!==void 0){let m=t.floor;if(typeof m!="string"){let h={instancePath:e+"/floor",schemaPath:"#/properties/floor/type",keyword:"type",params:{type:"string"},message:"must be string",schema:at.properties.floor.type,parentSchema:at.properties.floor,data:m};n===null?n=[h]:n.push(h),a++}}if(t.face!==void 0){let m=t.face;if(typeof m!="string"){let h={instancePath:e+"/face",schemaPath:"#/properties/face/type",keyword:"type",params:{type:"string"},message:"must be string",schema:at.properties.face.type,parentSchema:at.properties.face,data:m};n===null?n=[h]:n.push(h),a++}}if(t.label!==void 0){let m=t.label;if(typeof m!="string"){let h={instancePath:e+"/label",schemaPath:"#/properties/label/type",keyword:"type",params:{type:"string"},message:"must be string",schema:at.properties.label.type,parentSchema:at.properties.label,data:m};n===null?n=[h]:n.push(h),a++}}if(t.sub!==void 0){let m=t.sub;if(typeof m!="string"){let h={instancePath:e+"/sub",schemaPath:"#/properties/sub/type",keyword:"type",params:{type:"string"},message:"must be string",schema:at.properties.sub.type,parentSchema:at.properties.sub,data:m};n===null?n=[h]:n.push(h),a++}}if(t.at!==void 0){let m=t.at,h=a,y=!1,g=a;if(Array.isArray(m)){if(m.length>2){let b={instancePath:e+"/at",schemaPath:"#/$defs/point2/maxItems",keyword:"maxItems",params:{limit:2},message:"must NOT have more than 2 items",schema:2,parentSchema:Pt,data:m};n===null?n=[b]:n.push(b),a++}if(m.length<2){let b={instancePath:e+"/at",schemaPath:"#/$defs/point2/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:Pt,data:m};n===null?n=[b]:n.push(b),a++}let u=m.length;for(let b=0;b<u;b++){let x=m[b];if(typeof x!="number"){let w={instancePath:e+"/at/"+b,schemaPath:"#/$defs/point2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Pt.items.type,parentSchema:Pt.items,data:x};n===null?n=[w]:n.push(w),a++}}}else{let u={instancePath:e+"/at",schemaPath:"#/$defs/point2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Pt.type,parentSchema:Pt,data:m};n===null?n=[u]:n.push(u),a++}var c=g===a;if(y=y||c,c)var p=!0;let k=a;if(Array.isArray(m)){if(m.length>3){let b={instancePath:e+"/at",schemaPath:"#/properties/at/anyOf/1/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:at.properties.at.anyOf[1],data:m};n===null?n=[b]:n.push(b),a++}if(m.length<3){let b={instancePath:e+"/at",schemaPath:"#/properties/at/anyOf/1/minItems",keyword:"minItems",params:{limit:3},message:"must NOT have fewer than 3 items",schema:3,parentSchema:at.properties.at.anyOf[1],data:m};n===null?n=[b]:n.push(b),a++}let u=m.length;for(let b=0;b<u;b++){let x=m[b];if(typeof x!="number"){let w={instancePath:e+"/at/"+b,schemaPath:"#/properties/at/anyOf/1/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:at.properties.at.anyOf[1].items.type,parentSchema:at.properties.at.anyOf[1].items,data:x};n===null?n=[w]:n.push(w),a++}}}else{let u={instancePath:e+"/at",schemaPath:"#/properties/at/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array",schema:at.properties.at.anyOf[1].type,parentSchema:at.properties.at.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}var c=k===a;if(y=y||c,c&&p!==!0&&(p=!0),y)a=h,n!==null&&(h?n.length=h:n=null);else{let u={instancePath:e+"/at",schemaPath:"#/properties/at/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:at.properties.at.anyOf,parentSchema:at.properties.at,data:m};n===null?n=[u]:n.push(u),a++}}if(t.on!==void 0){let m=t.on;if(typeof m=="string"){if(!It.test(m)){let h={instancePath:e+"/on",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:m};n===null?n=[h]:n.push(h),a++}}else{let h={instancePath:e+"/on",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:m};n===null?n=[h]:n.push(h),a++}}if(t.kind!==void 0){let m=t.kind;if(typeof m!="string"){let h={instancePath:e+"/kind",schemaPath:"#/properties/kind/type",keyword:"type",params:{type:"string"},message:"must be string",schema:at.properties.kind.type,parentSchema:at.properties.kind,data:m};n===null?n=[h]:n.push(h),a++}}if(t.dir!==void 0){let m=t.dir;if(!(m==="x"||m==="y")){let h={instancePath:e+"/dir",schemaPath:"#/properties/dir/enum",keyword:"enum",params:{allowedValues:at.properties.dir.enum},message:"must be equal to one of the allowed values",schema:at.properties.dir.enum,parentSchema:at.properties.dir,data:m};n===null?n=[h]:n.push(h),a++}}if(t.anchor!==void 0){let m=t.anchor;if(!(m==="start"||m==="middle"||m==="end")){let h={instancePath:e+"/anchor",schemaPath:"#/properties/anchor/enum",keyword:"enum",params:{allowedValues:at.properties.anchor.enum},message:"must be equal to one of the allowed values",schema:at.properties.anchor.enum,parentSchema:at.properties.anchor,data:m};n===null?n=[h]:n.push(h),a++}}if(t.dx!==void 0){let m=t.dx;if(typeof m!="number"){let h={instancePath:e+"/dx",schemaPath:"#/properties/dx/type",keyword:"type",params:{type:"number"},message:"must be number",schema:at.properties.dx.type,parentSchema:at.properties.dx,data:m};n===null?n=[h]:n.push(h),a++}}if(t.dy!==void 0){let m=t.dy;if(typeof m!="number"){let h={instancePath:e+"/dy",schemaPath:"#/properties/dy/type",keyword:"type",params:{type:"number"},message:"must be number",schema:at.properties.dy.type,parentSchema:at.properties.dy,data:m};n===null?n=[h]:n.push(h),a++}}if(t.appears!==void 0){let m=t.appears,h=a,y=!1,g=a;if(typeof m!="string"){let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Je.anyOf[0].type,parentSchema:Je.anyOf[0],data:m};n===null?n=[u]:n.push(u),a++}var l=g===a;y=y||l;let k=a;if(!(typeof m=="number"&&!(m%1)&&!isNaN(m))){let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Je.anyOf[1].type,parentSchema:Je.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}if(typeof m=="number"&&(m<1||isNaN(m))){let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Je.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}var l=k===a;if(y=y||l,y)a=h,n!==null&&(h?n.length=h:n=null);else{let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Je.anyOf,parentSchema:Je,data:m};n===null?n=[u]:n.push(u),a++}}if(t.disappears!==void 0){let m=t.disappears,h=a,y=!1,g=a;if(typeof m!="string"){let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Je.anyOf[0].type,parentSchema:Je.anyOf[0],data:m};n===null?n=[u]:n.push(u),a++}var d=g===a;y=y||d;let k=a;if(!(typeof m=="number"&&!(m%1)&&!isNaN(m))){let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Je.anyOf[1].type,parentSchema:Je.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}if(typeof m=="number"&&(m<1||isNaN(m))){let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Je.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}var d=k===a;if(y=y||d,y)a=h,n!==null&&(h?n.length=h:n=null);else{let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Je.anyOf,parentSchema:Je,data:m};n===null?n=[u]:n.push(u),a++}}}else{let m={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:at.type,parentSchema:at,data:t};n===null?n=[m]:n.push(m),a++}return ni.errors=n,a===0}ni.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var ke={type:"object",required:["heading"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},number:{type:"integer",minimum:1,description:"the number shown; defaults to the position"},kind:{type:"string"},heading:{type:"string"},caption:{type:"string"},command:{type:"string"},animate:{type:"array",items:{$ref:"#/$defs/phase"}},pulse:{type:"array",items:{$ref:"#/$defs/id"}},highlight:{type:"array",items:{$ref:"#/$defs/id"}},focus:{type:"array",items:{$ref:"#/$defs/id"},description:"nodes or regions to zoom to for this step; the view eases back on steps without focus"},show:{type:"array",items:{$ref:"#/$defs/id"}},hide:{type:"array",items:{$ref:"#/$defs/id"}},say:{type:"array",items:{type:"object",additionalProperties:!1,required:["at","text"],properties:{at:{anyOf:[{$ref:"#/$defs/id"},{type:"array",items:{type:"number"},minItems:2,maxItems:3}],description:"a node (the callout sits above it) or a grid point [x, y, z]"},text:{type:"string"},kind:{type:"string"},dx:{type:"number"},dy:{type:"number"},anchor:{enum:["start","middle","end"]}}}},mark:{type:"array",items:{type:"object",additionalProperties:!1,properties:{on:{$ref:"#/$defs/id"},at:{type:"array",items:{type:"number"},minItems:2,maxItems:3}}}},badge:{anyOf:[{type:"boolean"},{$ref:"#/$defs/id"},{type:"array",items:{type:"number"},minItems:2,maxItems:3}],description:"false, a route or node id, or a grid point [x, y, z]"},duration:{anyOf:[{const:"auto"},{type:"integer",minimum:500}]}}},vl={anyOf:[{$ref:"#/$defs/routeRef"},{type:"array",items:{$ref:"#/$defs/routeRef"}}]},Ft={anyOf:[{type:"string"},{type:"object",minProperties:1,maxProperties:1,additionalProperties:{type:"string"}}]};function si(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=si.evaluated;f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0);let p=a,c=!1,l=a,d=a,m=!1,h=a;if(typeof t!="string"){let $={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ft.anyOf[0].type,parentSchema:Ft.anyOf[0],data:t};n===null?n=[$]:n.push($),a++}var g=h===a;m=m||g;let y=a;if(t&&typeof t=="object"&&!Array.isArray(t)){if(Object.keys(t).length>1){let $={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf/1/maxProperties",keyword:"maxProperties",params:{limit:1},message:"must NOT have more than 1 properties",schema:1,parentSchema:Ft.anyOf[1],data:t};n===null?n=[$]:n.push($),a++}if(Object.keys(t).length<1){let $={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf/1/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Ft.anyOf[1],data:t};n===null?n=[$]:n.push($),a++}for(let $ in t){let S=t[$];if(typeof S!="string"){let O={instancePath:e+"/"+$.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/routeRef/anyOf/1/additionalProperties/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ft.anyOf[1].additionalProperties.type,parentSchema:Ft.anyOf[1].additionalProperties,data:S};n===null?n=[O]:n.push(O),a++}}}else{let $={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf/1/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Ft.anyOf[1].type,parentSchema:Ft.anyOf[1],data:t};n===null?n=[$]:n.push($),a++}var g=y===a;if(m=m||g,g)var k=!0;if(m)a=d,n!==null&&(d?n.length=d:n=null);else{let $={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Ft.anyOf,parentSchema:Ft,data:t};n===null?n=[$]:n.push($),a++}var x=l===a;c=c||x;let u=a;if(Array.isArray(t)){let $=t.length;for(let S=0;S<$;S++){let O=t[S],z=a,A=!1,R=a;if(typeof O!="string"){let E={instancePath:e+"/"+S,schemaPath:"#/$defs/routeRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ft.anyOf[0].type,parentSchema:Ft.anyOf[0],data:O};n===null?n=[E]:n.push(E),a++}var b=R===a;A=A||b;let P=a;if(O&&typeof O=="object"&&!Array.isArray(O)){if(Object.keys(O).length>1){let E={instancePath:e+"/"+S,schemaPath:"#/$defs/routeRef/anyOf/1/maxProperties",keyword:"maxProperties",params:{limit:1},message:"must NOT have more than 1 properties",schema:1,parentSchema:Ft.anyOf[1],data:O};n===null?n=[E]:n.push(E),a++}if(Object.keys(O).length<1){let E={instancePath:e+"/"+S,schemaPath:"#/$defs/routeRef/anyOf/1/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Ft.anyOf[1],data:O};n===null?n=[E]:n.push(E),a++}for(let E in O){let v=O[E];if(typeof v!="string"){let N={instancePath:e+"/"+S+"/"+E.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/routeRef/anyOf/1/additionalProperties/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ft.anyOf[1].additionalProperties.type,parentSchema:Ft.anyOf[1].additionalProperties,data:v};n===null?n=[N]:n.push(N),a++}}}else{let E={instancePath:e+"/"+S,schemaPath:"#/$defs/routeRef/anyOf/1/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Ft.anyOf[1].type,parentSchema:Ft.anyOf[1],data:O};n===null?n=[E]:n.push(E),a++}var b=P===a;if(A=A||b,A)a=z,n!==null&&(z?n.length=z:n=null);else{let E={instancePath:e+"/"+S,schemaPath:"#/$defs/routeRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Ft.anyOf,parentSchema:Ft,data:O};n===null?n=[E]:n.push(E),a++}}}else{let $={instancePath:e,schemaPath:"#/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array",schema:vl.anyOf[1].type,parentSchema:vl.anyOf[1],data:t};n===null?n=[$]:n.push($),a++}var x=u===a;if(c=c||x,x)var w=!0;if(c)a=p,n!==null&&(p?n.length=p:n=null);else{let $={instancePath:e,schemaPath:"#/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:vl.anyOf,parentSchema:vl,data:t};n===null?n=[$]:n.push($),a++}return si.errors=n,f.props=k,f.items=w,a===0}si.evaluated={dynamicProps:!0,dynamicItems:!0};function ri(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=ri.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(t.heading===void 0){let d={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"heading"},message:"must have required property 'heading'",schema:ke.required,parentSchema:ke,data:t};n===null?n=[d]:n.push(d),a++}for(let d in t)if(!po.call(ke.properties,d)){let m={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:d},message:"must NOT have additional properties",schema:!1,parentSchema:ke,data:t};n===null?n=[m]:n.push(m),a++}if(t.id!==void 0){let d=t.id;if(typeof d=="string"){if(!It.test(d)){let m={instancePath:e+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:d};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:d};n===null?n=[m]:n.push(m),a++}}if(t.number!==void 0){let d=t.number;if(!(typeof d=="number"&&!(d%1)&&!isNaN(d))){let m={instancePath:e+"/number",schemaPath:"#/properties/number/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:ke.properties.number.type,parentSchema:ke.properties.number,data:d};n===null?n=[m]:n.push(m),a++}if(typeof d=="number"&&(d<1||isNaN(d))){let m={instancePath:e+"/number",schemaPath:"#/properties/number/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:ke.properties.number,data:d};n===null?n=[m]:n.push(m),a++}}if(t.kind!==void 0){let d=t.kind;if(typeof d!="string"){let m={instancePath:e+"/kind",schemaPath:"#/properties/kind/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ke.properties.kind.type,parentSchema:ke.properties.kind,data:d};n===null?n=[m]:n.push(m),a++}}if(t.heading!==void 0){let d=t.heading;if(typeof d!="string"){let m={instancePath:e+"/heading",schemaPath:"#/properties/heading/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ke.properties.heading.type,parentSchema:ke.properties.heading,data:d};n===null?n=[m]:n.push(m),a++}}if(t.caption!==void 0){let d=t.caption;if(typeof d!="string"){let m={instancePath:e+"/caption",schemaPath:"#/properties/caption/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ke.properties.caption.type,parentSchema:ke.properties.caption,data:d};n===null?n=[m]:n.push(m),a++}}if(t.command!==void 0){let d=t.command;if(typeof d!="string"){let m={instancePath:e+"/command",schemaPath:"#/properties/command/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ke.properties.command.type,parentSchema:ke.properties.command,data:d};n===null?n=[m]:n.push(m),a++}}if(t.animate!==void 0){let d=t.animate;if(Array.isArray(d)){let m=d.length;for(let h=0;h<m;h++)si(d[h],{instancePath:e+"/animate/"+h,parentData:d,parentDataProperty:h,rootData:i,dynamicAnchors:o})||(n=n===null?si.errors:n.concat(si.errors),a=n.length)}else{let m={instancePath:e+"/animate",schemaPath:"#/properties/animate/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ke.properties.animate.type,parentSchema:ke.properties.animate,data:d};n===null?n=[m]:n.push(m),a++}}if(t.pulse!==void 0){let d=t.pulse;if(Array.isArray(d)){let m=d.length;for(let h=0;h<m;h++){let y=d[h];if(typeof y=="string"){if(!It.test(y)){let g={instancePath:e+"/pulse/"+h,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:y};n===null?n=[g]:n.push(g),a++}}else{let g={instancePath:e+"/pulse/"+h,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:y};n===null?n=[g]:n.push(g),a++}}}else{let m={instancePath:e+"/pulse",schemaPath:"#/properties/pulse/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ke.properties.pulse.type,parentSchema:ke.properties.pulse,data:d};n===null?n=[m]:n.push(m),a++}}if(t.highlight!==void 0){let d=t.highlight;if(Array.isArray(d)){let m=d.length;for(let h=0;h<m;h++){let y=d[h];if(typeof y=="string"){if(!It.test(y)){let g={instancePath:e+"/highlight/"+h,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:y};n===null?n=[g]:n.push(g),a++}}else{let g={instancePath:e+"/highlight/"+h,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:y};n===null?n=[g]:n.push(g),a++}}}else{let m={instancePath:e+"/highlight",schemaPath:"#/properties/highlight/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ke.properties.highlight.type,parentSchema:ke.properties.highlight,data:d};n===null?n=[m]:n.push(m),a++}}if(t.focus!==void 0){let d=t.focus;if(Array.isArray(d)){let m=d.length;for(let h=0;h<m;h++){let y=d[h];if(typeof y=="string"){if(!It.test(y)){let g={instancePath:e+"/focus/"+h,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:y};n===null?n=[g]:n.push(g),a++}}else{let g={instancePath:e+"/focus/"+h,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:y};n===null?n=[g]:n.push(g),a++}}}else{let m={instancePath:e+"/focus",schemaPath:"#/properties/focus/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ke.properties.focus.type,parentSchema:ke.properties.focus,data:d};n===null?n=[m]:n.push(m),a++}}if(t.show!==void 0){let d=t.show;if(Array.isArray(d)){let m=d.length;for(let h=0;h<m;h++){let y=d[h];if(typeof y=="string"){if(!It.test(y)){let g={instancePath:e+"/show/"+h,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:y};n===null?n=[g]:n.push(g),a++}}else{let g={instancePath:e+"/show/"+h,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:y};n===null?n=[g]:n.push(g),a++}}}else{let m={instancePath:e+"/show",schemaPath:"#/properties/show/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ke.properties.show.type,parentSchema:ke.properties.show,data:d};n===null?n=[m]:n.push(m),a++}}if(t.hide!==void 0){let d=t.hide;if(Array.isArray(d)){let m=d.length;for(let h=0;h<m;h++){let y=d[h];if(typeof y=="string"){if(!It.test(y)){let g={instancePath:e+"/hide/"+h,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:y};n===null?n=[g]:n.push(g),a++}}else{let g={instancePath:e+"/hide/"+h,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:y};n===null?n=[g]:n.push(g),a++}}}else{let m={instancePath:e+"/hide",schemaPath:"#/properties/hide/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ke.properties.hide.type,parentSchema:ke.properties.hide,data:d};n===null?n=[m]:n.push(m),a++}}if(t.say!==void 0){let d=t.say;if(Array.isArray(d)){let m=d.length;for(let h=0;h<m;h++){let y=d[h];if(y&&typeof y=="object"&&!Array.isArray(y)){if(y.at===void 0){let g={instancePath:e+"/say/"+h,schemaPath:"#/properties/say/items/required",keyword:"required",params:{missingProperty:"at"},message:"must have required property 'at'",schema:ke.properties.say.items.required,parentSchema:ke.properties.say.items,data:y};n===null?n=[g]:n.push(g),a++}if(y.text===void 0){let g={instancePath:e+"/say/"+h,schemaPath:"#/properties/say/items/required",keyword:"required",params:{missingProperty:"text"},message:"must have required property 'text'",schema:ke.properties.say.items.required,parentSchema:ke.properties.say.items,data:y};n===null?n=[g]:n.push(g),a++}for(let g in y)if(!(g==="at"||g==="text"||g==="kind"||g==="dx"||g==="dy"||g==="anchor")){let k={instancePath:e+"/say/"+h,schemaPath:"#/properties/say/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:g},message:"must NOT have additional properties",schema:!1,parentSchema:ke.properties.say.items,data:y};n===null?n=[k]:n.push(k),a++}if(y.at!==void 0){let g=y.at,k=a,u=!1,b=a;if(typeof g=="string"){if(!It.test(g)){let w={instancePath:e+"/say/"+h+"/at",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:g};n===null?n=[w]:n.push(w),a++}}else{let w={instancePath:e+"/say/"+h+"/at",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:g};n===null?n=[w]:n.push(w),a++}var p=b===a;u=u||p;let x=a;if(Array.isArray(g)){if(g.length>3){let $={instancePath:e+"/say/"+h+"/at",schemaPath:"#/properties/say/items/properties/at/anyOf/1/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:ke.properties.say.items.properties.at.anyOf[1],data:g};n===null?n=[$]:n.push($),a++}if(g.length<2){let $={instancePath:e+"/say/"+h+"/at",schemaPath:"#/properties/say/items/properties/at/anyOf/1/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:ke.properties.say.items.properties.at.anyOf[1],data:g};n===null?n=[$]:n.push($),a++}let w=g.length;for(let $=0;$<w;$++){let S=g[$];if(typeof S!="number"){let O={instancePath:e+"/say/"+h+"/at/"+$,schemaPath:"#/properties/say/items/properties/at/anyOf/1/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:ke.properties.say.items.properties.at.anyOf[1].items.type,parentSchema:ke.properties.say.items.properties.at.anyOf[1].items,data:S};n===null?n=[O]:n.push(O),a++}}}else{let w={instancePath:e+"/say/"+h+"/at",schemaPath:"#/properties/say/items/properties/at/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ke.properties.say.items.properties.at.anyOf[1].type,parentSchema:ke.properties.say.items.properties.at.anyOf[1],data:g};n===null?n=[w]:n.push(w),a++}var p=x===a;if(u=u||p,u)a=k,n!==null&&(k?n.length=k:n=null);else{let w={instancePath:e+"/say/"+h+"/at",schemaPath:"#/properties/say/items/properties/at/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:ke.properties.say.items.properties.at.anyOf,parentSchema:ke.properties.say.items.properties.at,data:g};n===null?n=[w]:n.push(w),a++}}if(y.text!==void 0){let g=y.text;if(typeof g!="string"){let k={instancePath:e+"/say/"+h+"/text",schemaPath:"#/properties/say/items/properties/text/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ke.properties.say.items.properties.text.type,parentSchema:ke.properties.say.items.properties.text,data:g};n===null?n=[k]:n.push(k),a++}}if(y.kind!==void 0){let g=y.kind;if(typeof g!="string"){let k={instancePath:e+"/say/"+h+"/kind",schemaPath:"#/properties/say/items/properties/kind/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ke.properties.say.items.properties.kind.type,parentSchema:ke.properties.say.items.properties.kind,data:g};n===null?n=[k]:n.push(k),a++}}if(y.dx!==void 0){let g=y.dx;if(typeof g!="number"){let k={instancePath:e+"/say/"+h+"/dx",schemaPath:"#/properties/say/items/properties/dx/type",keyword:"type",params:{type:"number"},message:"must be number",schema:ke.properties.say.items.properties.dx.type,parentSchema:ke.properties.say.items.properties.dx,data:g};n===null?n=[k]:n.push(k),a++}}if(y.dy!==void 0){let g=y.dy;if(typeof g!="number"){let k={instancePath:e+"/say/"+h+"/dy",schemaPath:"#/properties/say/items/properties/dy/type",keyword:"type",params:{type:"number"},message:"must be number",schema:ke.properties.say.items.properties.dy.type,parentSchema:ke.properties.say.items.properties.dy,data:g};n===null?n=[k]:n.push(k),a++}}if(y.anchor!==void 0){let g=y.anchor;if(!(g==="start"||g==="middle"||g==="end")){let k={instancePath:e+"/say/"+h+"/anchor",schemaPath:"#/properties/say/items/properties/anchor/enum",keyword:"enum",params:{allowedValues:ke.properties.say.items.properties.anchor.enum},message:"must be equal to one of the allowed values",schema:ke.properties.say.items.properties.anchor.enum,parentSchema:ke.properties.say.items.properties.anchor,data:g};n===null?n=[k]:n.push(k),a++}}}else{let g={instancePath:e+"/say/"+h,schemaPath:"#/properties/say/items/type",keyword:"type",params:{type:"object"},message:"must be object",schema:ke.properties.say.items.type,parentSchema:ke.properties.say.items,data:y};n===null?n=[g]:n.push(g),a++}}}else{let m={instancePath:e+"/say",schemaPath:"#/properties/say/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ke.properties.say.type,parentSchema:ke.properties.say,data:d};n===null?n=[m]:n.push(m),a++}}if(t.mark!==void 0){let d=t.mark;if(Array.isArray(d)){let m=d.length;for(let h=0;h<m;h++){let y=d[h];if(y&&typeof y=="object"&&!Array.isArray(y)){for(let g in y)if(!(g==="on"||g==="at")){let k={instancePath:e+"/mark/"+h,schemaPath:"#/properties/mark/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:g},message:"must NOT have additional properties",schema:!1,parentSchema:ke.properties.mark.items,data:y};n===null?n=[k]:n.push(k),a++}if(y.on!==void 0){let g=y.on;if(typeof g=="string"){if(!It.test(g)){let k={instancePath:e+"/mark/"+h+"/on",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:g};n===null?n=[k]:n.push(k),a++}}else{let k={instancePath:e+"/mark/"+h+"/on",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:g};n===null?n=[k]:n.push(k),a++}}if(y.at!==void 0){let g=y.at;if(Array.isArray(g)){if(g.length>3){let u={instancePath:e+"/mark/"+h+"/at",schemaPath:"#/properties/mark/items/properties/at/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:ke.properties.mark.items.properties.at,data:g};n===null?n=[u]:n.push(u),a++}if(g.length<2){let u={instancePath:e+"/mark/"+h+"/at",schemaPath:"#/properties/mark/items/properties/at/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:ke.properties.mark.items.properties.at,data:g};n===null?n=[u]:n.push(u),a++}let k=g.length;for(let u=0;u<k;u++){let b=g[u];if(typeof b!="number"){let x={instancePath:e+"/mark/"+h+"/at/"+u,schemaPath:"#/properties/mark/items/properties/at/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:ke.properties.mark.items.properties.at.items.type,parentSchema:ke.properties.mark.items.properties.at.items,data:b};n===null?n=[x]:n.push(x),a++}}}else{let k={instancePath:e+"/mark/"+h+"/at",schemaPath:"#/properties/mark/items/properties/at/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ke.properties.mark.items.properties.at.type,parentSchema:ke.properties.mark.items.properties.at,data:g};n===null?n=[k]:n.push(k),a++}}}else{let g={instancePath:e+"/mark/"+h,schemaPath:"#/properties/mark/items/type",keyword:"type",params:{type:"object"},message:"must be object",schema:ke.properties.mark.items.type,parentSchema:ke.properties.mark.items,data:y};n===null?n=[g]:n.push(g),a++}}}else{let m={instancePath:e+"/mark",schemaPath:"#/properties/mark/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ke.properties.mark.type,parentSchema:ke.properties.mark,data:d};n===null?n=[m]:n.push(m),a++}}if(t.badge!==void 0){let d=t.badge,m=a,h=!1,y=a;if(typeof d!="boolean"){let u={instancePath:e+"/badge",schemaPath:"#/properties/badge/anyOf/0/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:ke.properties.badge.anyOf[0].type,parentSchema:ke.properties.badge.anyOf[0],data:d};n===null?n=[u]:n.push(u),a++}var c=y===a;h=h||c;let g=a;if(typeof d=="string"){if(!It.test(d)){let u={instancePath:e+"/badge",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:d};n===null?n=[u]:n.push(u),a++}}else{let u={instancePath:e+"/badge",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:d};n===null?n=[u]:n.push(u),a++}var c=g===a;h=h||c;let k=a;if(Array.isArray(d)){if(d.length>3){let b={instancePath:e+"/badge",schemaPath:"#/properties/badge/anyOf/2/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:ke.properties.badge.anyOf[2],data:d};n===null?n=[b]:n.push(b),a++}if(d.length<2){let b={instancePath:e+"/badge",schemaPath:"#/properties/badge/anyOf/2/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:ke.properties.badge.anyOf[2],data:d};n===null?n=[b]:n.push(b),a++}let u=d.length;for(let b=0;b<u;b++){let x=d[b];if(typeof x!="number"){let w={instancePath:e+"/badge/"+b,schemaPath:"#/properties/badge/anyOf/2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:ke.properties.badge.anyOf[2].items.type,parentSchema:ke.properties.badge.anyOf[2].items,data:x};n===null?n=[w]:n.push(w),a++}}}else{let u={instancePath:e+"/badge",schemaPath:"#/properties/badge/anyOf/2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ke.properties.badge.anyOf[2].type,parentSchema:ke.properties.badge.anyOf[2],data:d};n===null?n=[u]:n.push(u),a++}var c=k===a;if(h=h||c,h)a=m,n!==null&&(m?n.length=m:n=null);else{let u={instancePath:e+"/badge",schemaPath:"#/properties/badge/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:ke.properties.badge.anyOf,parentSchema:ke.properties.badge,data:d};n===null?n=[u]:n.push(u),a++}}if(t.duration!==void 0){let d=t.duration,m=a,h=!1,y=a;if(d!=="auto"){let k={instancePath:e+"/duration",schemaPath:"#/properties/duration/anyOf/0/const",keyword:"const",params:{allowedValue:"auto"},message:"must be equal to constant",schema:"auto",parentSchema:ke.properties.duration.anyOf[0],data:d};n===null?n=[k]:n.push(k),a++}var l=y===a;h=h||l;let g=a;if(!(typeof d=="number"&&!(d%1)&&!isNaN(d))){let k={instancePath:e+"/duration",schemaPath:"#/properties/duration/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:ke.properties.duration.anyOf[1].type,parentSchema:ke.properties.duration.anyOf[1],data:d};n===null?n=[k]:n.push(k),a++}if(typeof d=="number"&&(d<500||isNaN(d))){let k={instancePath:e+"/duration",schemaPath:"#/properties/duration/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:500},message:"must be >= 500",schema:500,parentSchema:ke.properties.duration.anyOf[1],data:d};n===null?n=[k]:n.push(k),a++}var l=g===a;if(h=h||l,h)a=m,n!==null&&(m?n.length=m:n=null);else{let k={instancePath:e+"/duration",schemaPath:"#/properties/duration/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:ke.properties.duration.anyOf,parentSchema:ke.properties.duration,data:d};n===null?n=[k]:n.push(k),a++}}}else{let d={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:ke.type,parentSchema:ke,data:t};n===null?n=[d]:n.push(d),a++}return ri.errors=n,a===0}ri.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function ii(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=ii.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let l={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'",schema:Pe.required,parentSchema:Pe,data:t};n===null?n=[l]:n.push(l),a++}if(t.title===void 0){let l={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"title"},message:"must have required property 'title'",schema:Pe.required,parentSchema:Pe,data:t};n===null?n=[l]:n.push(l),a++}for(let l in t)if(!po.call(Pe.properties,l)){let d={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:l},message:"must NOT have additional properties",schema:!1,parentSchema:Pe,data:t};n===null?n=[d]:n.push(d),a++}if(t.id!==void 0){let l=t.id;if(typeof l=="string"){if(!It.test(l)){let d={instancePath:e+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ne,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:l};n===null?n=[d]:n.push(d),a++}}if(t.title!==void 0){let l=t.title;if(typeof l!="string"){let d={instancePath:e+"/title",schemaPath:"#/properties/title/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Pe.properties.title.type,parentSchema:Pe.properties.title,data:l};n===null?n=[d]:n.push(d),a++}}if(t.ants!==void 0){let l=t.ants,d=a,m=!1,h=a;if(typeof l!="boolean"){let k={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf/0/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Pe.properties.ants.anyOf[0].type,parentSchema:Pe.properties.ants.anyOf[0],data:l};n===null?n=[k]:n.push(k),a++}var p=h===a;m=m||p;let y=a;if(Array.isArray(l)){let k=l.length;for(let u=0;u<k;u++){let b=l[u];if(typeof b!="string"){let x={instancePath:e+"/ants/"+u,schemaPath:"#/properties/ants/anyOf/1/items/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Pe.properties.ants.anyOf[1].items.type,parentSchema:Pe.properties.ants.anyOf[1].items,data:b};n===null?n=[x]:n.push(x),a++}}}else{let k={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Pe.properties.ants.anyOf[1].type,parentSchema:Pe.properties.ants.anyOf[1],data:l};n===null?n=[k]:n.push(k),a++}var p=y===a;m=m||p;let g=a;if(l&&typeof l=="object"&&!Array.isArray(l)){for(let k in l)if(!(k==="ids"||k==="speed"||k==="dash")){let u={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf/2/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:k},message:"must NOT have additional properties",schema:!1,parentSchema:Pe.properties.ants.anyOf[2],data:l};n===null?n=[u]:n.push(u),a++}if(l.ids!==void 0){let k=l.ids;if(Array.isArray(k)){let u=k.length;for(let b=0;b<u;b++){let x=k[b];if(typeof x!="string"){let w={instancePath:e+"/ants/ids/"+b,schemaPath:"#/properties/ants/anyOf/2/properties/ids/items/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Pe.properties.ants.anyOf[2].properties.ids.items.type,parentSchema:Pe.properties.ants.anyOf[2].properties.ids.items,data:x};n===null?n=[w]:n.push(w),a++}}}else{let u={instancePath:e+"/ants/ids",schemaPath:"#/properties/ants/anyOf/2/properties/ids/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Pe.properties.ants.anyOf[2].properties.ids.type,parentSchema:Pe.properties.ants.anyOf[2].properties.ids,data:k};n===null?n=[u]:n.push(u),a++}}if(l.speed!==void 0){let k=l.speed;if(typeof k!="number"){let u={instancePath:e+"/ants/speed",schemaPath:"#/properties/ants/anyOf/2/properties/speed/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Pe.properties.ants.anyOf[2].properties.speed.type,parentSchema:Pe.properties.ants.anyOf[2].properties.speed,data:k};n===null?n=[u]:n.push(u),a++}}if(l.dash!==void 0){let k=l.dash;if(Array.isArray(k)){if(k.length>2){let b={instancePath:e+"/ants/dash",schemaPath:"#/properties/ants/anyOf/2/properties/dash/maxItems",keyword:"maxItems",params:{limit:2},message:"must NOT have more than 2 items",schema:2,parentSchema:Pe.properties.ants.anyOf[2].properties.dash,data:k};n===null?n=[b]:n.push(b),a++}if(k.length<2){let b={instancePath:e+"/ants/dash",schemaPath:"#/properties/ants/anyOf/2/properties/dash/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:Pe.properties.ants.anyOf[2].properties.dash,data:k};n===null?n=[b]:n.push(b),a++}let u=k.length;for(let b=0;b<u;b++){let x=k[b];if(typeof x=="number"){if(x<=0||isNaN(x)){let w={instancePath:e+"/ants/dash/"+b,schemaPath:"#/properties/ants/anyOf/2/properties/dash/items/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Pe.properties.ants.anyOf[2].properties.dash.items,data:x};n===null?n=[w]:n.push(w),a++}}else{let w={instancePath:e+"/ants/dash/"+b,schemaPath:"#/properties/ants/anyOf/2/properties/dash/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Pe.properties.ants.anyOf[2].properties.dash.items.type,parentSchema:Pe.properties.ants.anyOf[2].properties.dash.items,data:x};n===null?n=[w]:n.push(w),a++}}}else{let u={instancePath:e+"/ants/dash",schemaPath:"#/properties/ants/anyOf/2/properties/dash/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Pe.properties.ants.anyOf[2].properties.dash.type,parentSchema:Pe.properties.ants.anyOf[2].properties.dash,data:k};n===null?n=[u]:n.push(u),a++}}}else{let k={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf/2/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Pe.properties.ants.anyOf[2].type,parentSchema:Pe.properties.ants.anyOf[2],data:l};n===null?n=[k]:n.push(k),a++}var p=g===a;if(m=m||p,m)a=d,n!==null&&(d?n.length=d:n=null);else{let k={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Pe.properties.ants.anyOf,parentSchema:Pe.properties.ants,data:l};n===null?n=[k]:n.push(k),a++}}if(t.motion!==void 0){let l=t.motion;if(!(l&&typeof l=="object"&&!Array.isArray(l))){let d={instancePath:e+"/motion",schemaPath:"#/properties/motion/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Pe.properties.motion.type,parentSchema:Pe.properties.motion,data:l};n===null?n=[d]:n.push(d),a++}}if(t.caption!==void 0){let l=t.caption;if(typeof l!="string"){let d={instancePath:e+"/caption",schemaPath:"#/properties/caption/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Pe.properties.caption.type,parentSchema:Pe.properties.caption,data:l};n===null?n=[d]:n.push(d),a++}}if(t.aria!==void 0){let l=t.aria;if(typeof l!="string"){let d={instancePath:e+"/aria",schemaPath:"#/properties/aria/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Pe.properties.aria.type,parentSchema:Pe.properties.aria,data:l};n===null?n=[d]:n.push(d),a++}}if(t.gap!==void 0){let l=t.gap;if(typeof l=="number"){if(l<=0||isNaN(l)){let d={instancePath:e+"/gap",schemaPath:"#/properties/gap/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Pe.properties.gap,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/gap",schemaPath:"#/properties/gap/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Pe.properties.gap.type,parentSchema:Pe.properties.gap,data:l};n===null?n=[d]:n.push(d),a++}}if(t.flow!==void 0){let l=t.flow;if(!(l==="row"||l==="column")){let d={instancePath:e+"/flow",schemaPath:"#/properties/flow/enum",keyword:"enum",params:{allowedValues:Pe.properties.flow.enum},message:"must be equal to one of the allowed values",schema:Pe.properties.flow.enum,parentSchema:Pe.properties.flow,data:l};n===null?n=[d]:n.push(d),a++}}if(t.regions!==void 0){let l=t.regions;if(Array.isArray(l)){let d=l.length;for(let m=0;m<d;m++)mr(l[m],{instancePath:e+"/regions/"+m,parentData:l,parentDataProperty:m,rootData:i,dynamicAnchors:o})||(n=n===null?mr.errors:n.concat(mr.errors),a=n.length)}else{let d={instancePath:e+"/regions",schemaPath:"#/properties/regions/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Pe.properties.regions.type,parentSchema:Pe.properties.regions,data:l};n===null?n=[d]:n.push(d),a++}}if(t.nodes!==void 0){let l=t.nodes;if(Array.isArray(l)){let d=l.length;for(let m=0;m<d;m++)hs(l[m],{instancePath:e+"/nodes/"+m,parentData:l,parentDataProperty:m,rootData:i,dynamicAnchors:o})||(n=n===null?hs.errors:n.concat(hs.errors),a=n.length)}else{let d={instancePath:e+"/nodes",schemaPath:"#/properties/nodes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Pe.properties.nodes.type,parentSchema:Pe.properties.nodes,data:l};n===null?n=[d]:n.push(d),a++}}if(t.routes!==void 0){let l=t.routes;if(Array.isArray(l)){let d=l.length;for(let m=0;m<d;m++)ti(l[m],{instancePath:e+"/routes/"+m,parentData:l,parentDataProperty:m,rootData:i,dynamicAnchors:o})||(n=n===null?ti.errors:n.concat(ti.errors),a=n.length)}else{let d={instancePath:e+"/routes",schemaPath:"#/properties/routes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Pe.properties.routes.type,parentSchema:Pe.properties.routes,data:l};n===null?n=[d]:n.push(d),a++}}if(t.notes!==void 0){let l=t.notes;if(Array.isArray(l)){let d=l.length;for(let m=0;m<d;m++)ni(l[m],{instancePath:e+"/notes/"+m,parentData:l,parentDataProperty:m,rootData:i,dynamicAnchors:o})||(n=n===null?ni.errors:n.concat(ni.errors),a=n.length)}else{let d={instancePath:e+"/notes",schemaPath:"#/properties/notes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Pe.properties.notes.type,parentSchema:Pe.properties.notes,data:l};n===null?n=[d]:n.push(d),a++}}if(t.steps!==void 0){let l=t.steps;if(Array.isArray(l)){let d=l.length;for(let m=0;m<d;m++)ri(l[m],{instancePath:e+"/steps/"+m,parentData:l,parentDataProperty:m,rootData:i,dynamicAnchors:o})||(n=n===null?ri.errors:n.concat(ri.errors),a=n.length)}else{let d={instancePath:e+"/steps",schemaPath:"#/properties/steps/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Pe.properties.steps.type,parentSchema:Pe.properties.steps,data:l};n===null?n=[d]:n.push(d),a++}}if(t.legend!==void 0){let l=t.legend,d=a,m=!1,h=a;if(l!=="auto"){let k={instancePath:e+"/legend",schemaPath:"#/properties/legend/anyOf/0/enum",keyword:"enum",params:{allowedValues:Pe.properties.legend.anyOf[0].enum},message:"must be equal to one of the allowed values",schema:Pe.properties.legend.anyOf[0].enum,parentSchema:Pe.properties.legend.anyOf[0],data:l};n===null?n=[k]:n.push(k),a++}var c=h===a;m=m||c;let y=a;if(l!==!1){let k={instancePath:e+"/legend",schemaPath:"#/properties/legend/anyOf/1/const",keyword:"const",params:{allowedValue:!1},message:"must be equal to constant",schema:!1,parentSchema:Pe.properties.legend.anyOf[1],data:l};n===null?n=[k]:n.push(k),a++}var c=y===a;m=m||c;let g=a;if(Array.isArray(l)){let k=l.length;for(let u=0;u<k;u++){let b=l[u];if(typeof b!="string"){let x={instancePath:e+"/legend/"+u,schemaPath:"#/properties/legend/anyOf/2/items/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Pe.properties.legend.anyOf[2].items.type,parentSchema:Pe.properties.legend.anyOf[2].items,data:b};n===null?n=[x]:n.push(x),a++}}}else{let k={instancePath:e+"/legend",schemaPath:"#/properties/legend/anyOf/2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Pe.properties.legend.anyOf[2].type,parentSchema:Pe.properties.legend.anyOf[2],data:l};n===null?n=[k]:n.push(k),a++}var c=g===a;if(m=m||c,m)a=d,n!==null&&(d?n.length=d:n=null);else{let k={instancePath:e+"/legend",schemaPath:"#/properties/legend/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Pe.properties.legend.anyOf,parentSchema:Pe.properties.legend,data:l};n===null?n=[k]:n.push(k),a++}}if(t.badges!==void 0){let l=t.badges;if(typeof l!="boolean"){let d={instancePath:e+"/badges",schemaPath:"#/properties/badges/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Pe.properties.badges.type,parentSchema:Pe.properties.badges,data:l};n===null?n=[d]:n.push(d),a++}}if(t.grid!==void 0){let l=t.grid;if(l&&typeof l=="object"&&!Array.isArray(l)){for(let d in l)if(!(d==="snap"||d==="show"||d==="step")){let m={instancePath:e+"/grid",schemaPath:"#/$defs/grid/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:d},message:"must NOT have additional properties",schema:!1,parentSchema:Rt,data:l};n===null?n=[m]:n.push(m),a++}if(l.snap!==void 0){let d=l.snap;if(typeof d=="number"){if(d<=0||isNaN(d)){let m={instancePath:e+"/grid/snap",schemaPath:"#/$defs/grid/properties/snap/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Rt.properties.snap,data:d};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e+"/grid/snap",schemaPath:"#/$defs/grid/properties/snap/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Rt.properties.snap.type,parentSchema:Rt.properties.snap,data:d};n===null?n=[m]:n.push(m),a++}}if(l.show!==void 0){let d=l.show;if(typeof d!="boolean"){let m={instancePath:e+"/grid/show",schemaPath:"#/$defs/grid/properties/show/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Rt.properties.show.type,parentSchema:Rt.properties.show,data:d};n===null?n=[m]:n.push(m),a++}}if(l.step!==void 0){let d=l.step;if(typeof d=="number"){if(d<=0||isNaN(d)){let m={instancePath:e+"/grid/step",schemaPath:"#/$defs/grid/properties/step/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Rt.properties.step,data:d};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e+"/grid/step",schemaPath:"#/$defs/grid/properties/step/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Rt.properties.step.type,parentSchema:Rt.properties.step,data:d};n===null?n=[m]:n.push(m),a++}}}else{let d={instancePath:e+"/grid",schemaPath:"#/$defs/grid/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Rt.type,parentSchema:Rt,data:l};n===null?n=[d]:n.push(d),a++}}if(t.assemble!==void 0){let l=t.assemble;if(typeof l!="boolean"){let d={instancePath:e+"/assemble",schemaPath:"#/properties/assemble/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Pe.properties.assemble.type,parentSchema:Pe.properties.assemble,data:l};n===null?n=[d]:n.push(d),a++}}if(t.loop!==void 0){let l=t.loop;if(typeof l!="boolean"){let d={instancePath:e+"/loop",schemaPath:"#/properties/loop/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Pe.properties.loop.type,parentSchema:Pe.properties.loop,data:l};n===null?n=[d]:n.push(d),a++}}if(t.dim!==void 0){let l=t.dim;if(!(l==="flows"||l==="all")){let d={instancePath:e+"/dim",schemaPath:"#/properties/dim/enum",keyword:"enum",params:{allowedValues:Pe.properties.dim.enum},message:"must be equal to one of the allowed values",schema:Pe.properties.dim.enum,parentSchema:Pe.properties.dim,data:l};n===null?n=[d]:n.push(d),a++}}if(t.after!==void 0){let l=t.after;if(typeof l!="string"){let d={instancePath:e+"/after",schemaPath:"#/properties/after/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Pe.properties.after.type,parentSchema:Pe.properties.after,data:l};n===null?n=[d]:n.push(d),a++}}}else{let l={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Pe.type,parentSchema:Pe,data:t};n===null?n=[l]:n.push(l),a++}return ii.errors=n,a===0}ii.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function Ml(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=Ml.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(t.isodiag===void 0){let p={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"isodiag"},message:"must have required property 'isodiag'",schema:it.required,parentSchema:it,data:t};n===null?n=[p]:n.push(p),a++}if(t.scenes===void 0){let p={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"scenes"},message:"must have required property 'scenes'",schema:it.required,parentSchema:it,data:t};n===null?n=[p]:n.push(p),a++}for(let p in t)if(!po.call(it.properties,p)){let c={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:p},message:"must NOT have additional properties",schema:!1,parentSchema:it,data:t};n===null?n=[c]:n.push(c),a++}if(t.isodiag!==void 0){let p=t.isodiag;if(p!==1){let c={instancePath:e+"/isodiag",schemaPath:"#/properties/isodiag/const",keyword:"const",params:{allowedValue:1},message:"must be equal to constant",schema:1,parentSchema:it.properties.isodiag,data:p};n===null?n=[c]:n.push(c),a++}}if(t.title!==void 0){let p=t.title;if(typeof p!="string"){let c={instancePath:e+"/title",schemaPath:"#/properties/title/type",keyword:"type",params:{type:"string"},message:"must be string",schema:it.properties.title.type,parentSchema:it.properties.title,data:p};n===null?n=[c]:n.push(c),a++}}if(t.lede!==void 0){let p=t.lede;if(typeof p!="string"){let c={instancePath:e+"/lede",schemaPath:"#/properties/lede/type",keyword:"type",params:{type:"string"},message:"must be string",schema:it.properties.lede.type,parentSchema:it.properties.lede,data:p};n===null?n=[c]:n.push(c),a++}}if(t.pills!==void 0){let p=t.pills;if(Array.isArray(p)){let c=p.length;for(let l=0;l<c;l++){let d=p[l];if(typeof d!="string"){let m={instancePath:e+"/pills/"+l,schemaPath:"#/properties/pills/items/type",keyword:"type",params:{type:"string"},message:"must be string",schema:it.properties.pills.items.type,parentSchema:it.properties.pills.items,data:d};n===null?n=[m]:n.push(m),a++}}}else{let c={instancePath:e+"/pills",schemaPath:"#/properties/pills/type",keyword:"type",params:{type:"array"},message:"must be array",schema:it.properties.pills.type,parentSchema:it.properties.pills,data:p};n===null?n=[c]:n.push(c),a++}}if(t.theme!==void 0){let p=t.theme;if(typeof p!="string"){let c={instancePath:e+"/theme",schemaPath:"#/properties/theme/type",keyword:"type",params:{type:"string"},message:"must be string",schema:it.properties.theme.type,parentSchema:it.properties.theme,data:p};n===null?n=[c]:n.push(c),a++}}if(t.roles!==void 0){let p=t.roles;if(p&&typeof p=="object"&&!Array.isArray(p))for(let c in p){let l=p[c];if(l&&typeof l=="object"&&!Array.isArray(l)){if(l.h===void 0){let d={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/role/required",keyword:"required",params:{missingProperty:"h"},message:"must have required property 'h'",schema:Lt.required,parentSchema:Lt,data:l};n===null?n=[d]:n.push(d),a++}if(l.s===void 0){let d={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/role/required",keyword:"required",params:{missingProperty:"s"},message:"must have required property 's'",schema:Lt.required,parentSchema:Lt,data:l};n===null?n=[d]:n.push(d),a++}for(let d in l)if(!(d==="h"||d==="s"||d==="top"||d==="tint")){let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/role/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:d},message:"must NOT have additional properties",schema:!1,parentSchema:Lt,data:l};n===null?n=[m]:n.push(m),a++}if(l.h!==void 0){let d=l.h;if(typeof d=="number"){if(d>360||isNaN(d)){let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/h",schemaPath:"#/$defs/role/properties/h/maximum",keyword:"maximum",params:{comparison:"<=",limit:360},message:"must be <= 360",schema:360,parentSchema:Lt.properties.h,data:d};n===null?n=[m]:n.push(m),a++}if(d<0||isNaN(d)){let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/h",schemaPath:"#/$defs/role/properties/h/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:Lt.properties.h,data:d};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/h",schemaPath:"#/$defs/role/properties/h/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Lt.properties.h.type,parentSchema:Lt.properties.h,data:d};n===null?n=[m]:n.push(m),a++}}if(l.s!==void 0){let d=l.s;if(typeof d=="number"){if(d>100||isNaN(d)){let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/s",schemaPath:"#/$defs/role/properties/s/maximum",keyword:"maximum",params:{comparison:"<=",limit:100},message:"must be <= 100",schema:100,parentSchema:Lt.properties.s,data:d};n===null?n=[m]:n.push(m),a++}if(d<0||isNaN(d)){let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/s",schemaPath:"#/$defs/role/properties/s/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:Lt.properties.s,data:d};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/s",schemaPath:"#/$defs/role/properties/s/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Lt.properties.s.type,parentSchema:Lt.properties.s,data:d};n===null?n=[m]:n.push(m),a++}}if(l.top!==void 0){let d=l.top;if(typeof d!="string"){let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/top",schemaPath:"#/$defs/role/properties/top/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Lt.properties.top.type,parentSchema:Lt.properties.top,data:d};n===null?n=[m]:n.push(m),a++}}if(l.tint!==void 0){let d=l.tint;if(typeof d=="number"){if(d>100||isNaN(d)){let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/tint",schemaPath:"#/$defs/role/properties/tint/maximum",keyword:"maximum",params:{comparison:"<=",limit:100},message:"must be <= 100",schema:100,parentSchema:Lt.properties.tint,data:d};n===null?n=[m]:n.push(m),a++}if(d<0||isNaN(d)){let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/tint",schemaPath:"#/$defs/role/properties/tint/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:Lt.properties.tint,data:d};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/tint",schemaPath:"#/$defs/role/properties/tint/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Lt.properties.tint.type,parentSchema:Lt.properties.tint,data:d};n===null?n=[m]:n.push(m),a++}}}else{let d={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/role/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Lt.type,parentSchema:Lt,data:l};n===null?n=[d]:n.push(d),a++}}else{let c={instancePath:e+"/roles",schemaPath:"#/properties/roles/type",keyword:"type",params:{type:"object"},message:"must be object",schema:it.properties.roles.type,parentSchema:it.properties.roles,data:p};n===null?n=[c]:n.push(c),a++}}if(t.kinds!==void 0){let p=t.kinds;if(p&&typeof p=="object"&&!Array.isArray(p))for(let c in p){let l=p[c];if(l&&typeof l=="object"&&!Array.isArray(l)){for(let d in l)if(!(d==="legend"||d==="like"||d==="color"||d==="dash")){let m={instancePath:e+"/kinds/"+c.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/kindDef/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:d},message:"must NOT have additional properties",schema:!1,parentSchema:Ln,data:l};n===null?n=[m]:n.push(m),a++}if(l.legend!==void 0){let d=l.legend;if(typeof d!="string"){let m={instancePath:e+"/kinds/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/legend",schemaPath:"#/$defs/kindDef/properties/legend/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ln.properties.legend.type,parentSchema:Ln.properties.legend,data:d};n===null?n=[m]:n.push(m),a++}}if(l.like!==void 0){let d=l.like;if(typeof d!="string"){let m={instancePath:e+"/kinds/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/like",schemaPath:"#/$defs/kindDef/properties/like/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ln.properties.like.type,parentSchema:Ln.properties.like,data:d};n===null?n=[m]:n.push(m),a++}}if(l.color!==void 0){let d=l.color;if(typeof d!="string"){let m={instancePath:e+"/kinds/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/color",schemaPath:"#/$defs/kindDef/properties/color/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ln.properties.color.type,parentSchema:Ln.properties.color,data:d};n===null?n=[m]:n.push(m),a++}}if(l.dash!==void 0){let d=l.dash;if(!(d==="solid"||d==="dashed"||d==="dotted")){let m={instancePath:e+"/kinds/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/dash",schemaPath:"#/$defs/kindDef/properties/dash/enum",keyword:"enum",params:{allowedValues:Ln.properties.dash.enum},message:"must be equal to one of the allowed values",schema:Ln.properties.dash.enum,parentSchema:Ln.properties.dash,data:d};n===null?n=[m]:n.push(m),a++}}}else{let d={instancePath:e+"/kinds/"+c.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/kindDef/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Ln.type,parentSchema:Ln,data:l};n===null?n=[d]:n.push(d),a++}}else{let c={instancePath:e+"/kinds",schemaPath:"#/properties/kinds/type",keyword:"type",params:{type:"object"},message:"must be object",schema:it.properties.kinds.type,parentSchema:it.properties.kinds,data:p};n===null?n=[c]:n.push(c),a++}}if(t.after!==void 0){let p=t.after;if(typeof p!="string"){let c={instancePath:e+"/after",schemaPath:"#/properties/after/type",keyword:"type",params:{type:"string"},message:"must be string",schema:it.properties.after.type,parentSchema:it.properties.after,data:p};n===null?n=[c]:n.push(c),a++}}if(t.grid!==void 0){let p=t.grid;if(p&&typeof p=="object"&&!Array.isArray(p)){for(let c in p)if(!(c==="snap"||c==="show"||c==="step")){let l={instancePath:e+"/grid",schemaPath:"#/$defs/grid/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:c},message:"must NOT have additional properties",schema:!1,parentSchema:Rt,data:p};n===null?n=[l]:n.push(l),a++}if(p.snap!==void 0){let c=p.snap;if(typeof c=="number"){if(c<=0||isNaN(c)){let l={instancePath:e+"/grid/snap",schemaPath:"#/$defs/grid/properties/snap/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Rt.properties.snap,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/grid/snap",schemaPath:"#/$defs/grid/properties/snap/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Rt.properties.snap.type,parentSchema:Rt.properties.snap,data:c};n===null?n=[l]:n.push(l),a++}}if(p.show!==void 0){let c=p.show;if(typeof c!="boolean"){let l={instancePath:e+"/grid/show",schemaPath:"#/$defs/grid/properties/show/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Rt.properties.show.type,parentSchema:Rt.properties.show,data:c};n===null?n=[l]:n.push(l),a++}}if(p.step!==void 0){let c=p.step;if(typeof c=="number"){if(c<=0||isNaN(c)){let l={instancePath:e+"/grid/step",schemaPath:"#/$defs/grid/properties/step/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Rt.properties.step,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/grid/step",schemaPath:"#/$defs/grid/properties/step/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Rt.properties.step.type,parentSchema:Rt.properties.step,data:c};n===null?n=[l]:n.push(l),a++}}}else{let c={instancePath:e+"/grid",schemaPath:"#/$defs/grid/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Rt.type,parentSchema:Rt,data:p};n===null?n=[c]:n.push(c),a++}}if(t.assemble!==void 0){let p=t.assemble;if(typeof p!="boolean"){let c={instancePath:e+"/assemble",schemaPath:"#/properties/assemble/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:it.properties.assemble.type,parentSchema:it.properties.assemble,data:p};n===null?n=[c]:n.push(c),a++}}if(t.footer!==void 0){let p=t.footer;if(typeof p!="string"){let c={instancePath:e+"/footer",schemaPath:"#/properties/footer/type",keyword:"type",params:{type:"string"},message:"must be string",schema:it.properties.footer.type,parentSchema:it.properties.footer,data:p};n===null?n=[c]:n.push(c),a++}}if(t.treatment!==void 0){let p=t.treatment;if(p!=="mono"){let c={instancePath:e+"/treatment",schemaPath:"#/properties/treatment/enum",keyword:"enum",params:{allowedValues:it.properties.treatment.enum},message:"must be equal to one of the allowed values",schema:it.properties.treatment.enum,parentSchema:it.properties.treatment,data:p};n===null?n=[c]:n.push(c),a++}}if(t.scenes!==void 0){let p=t.scenes;if(Array.isArray(p)){if(p.length<1){let l={instancePath:e+"/scenes",schemaPath:"#/properties/scenes/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items",schema:1,parentSchema:it.properties.scenes,data:p};n===null?n=[l]:n.push(l),a++}let c=p.length;for(let l=0;l<c;l++)ii(p[l],{instancePath:e+"/scenes/"+l,parentData:p,parentDataProperty:l,rootData:i,dynamicAnchors:o})||(n=n===null?ii.errors:n.concat(ii.errors),a=n.length)}else{let c={instancePath:e+"/scenes",schemaPath:"#/properties/scenes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:it.properties.scenes.type,parentSchema:it.properties.scenes,data:p};n===null?n=[c]:n.push(c),a++}}}else{let p={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:it.type,parentSchema:it,data:t};n===null?n=[p]:n.push(p),a++}return Ml.errors=n,a===0}Ml.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function Ay(t){let e=JSON.stringify(t),s=2166136261;for(let r=0;r<e.length;r++)s^=e.charCodeAt(r),s=Math.imul(s,16777619)>>>0;return s.toString(16)+":"+e.length}var Ty=new Map([["28016100:13106",Nm]]);function Ap(t){let e=Ty.get(Ay(t));if(!e)throw new Error(`schema not precompiled into the page: ${t.$id??t.title??"?"}`);return e}var Tp={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://isodiag.local/schema/isodiag-1.json",title:"isodiag diagram",description:"A page of isometric, animated diagrams. See docs/FORMAT.md.",type:"object",required:["isodiag","scenes"],additionalProperties:!1,properties:{isodiag:{const:1,description:"Format version. Always 1."},title:{type:"string"},lede:{type:"string"},pills:{type:"array",items:{type:"string"}},theme:{type:"string",description:"'default' or a path to a theme file"},roles:{type:"object",description:"Extra or changed colour roles for nodes and regions",additionalProperties:{$ref:"#/$defs/role"}},kinds:{type:"object",description:"Extra flow kinds, or new legend text for the standard ones",additionalProperties:{$ref:"#/$defs/kindDef"}},after:{type:"string",description:"Markdown shown after all scenes"},grid:{$ref:"#/$defs/grid"},assemble:{type:"boolean",description:"draw each scene by flying its parts in from the nearest edge, then play"},footer:{type:"string"},treatment:{enum:["mono"],description:"How a self-contained drawing (renderSvg, <isometric-diagram>) is painted: mono, black and white. A host may say otherwise. The page isodiag build writes is in colour."},scenes:{type:"array",minItems:1,items:{$ref:"#/$defs/scene"}}},$defs:{motion:{type:"object",additionalProperties:!1,minProperties:1,description:"how this piece (a region: its contents too) moves when the drawing assembles or disassembles",properties:{style:{enum:["edge","drop","rise","fly","pop","scatter","build","fade"],description:"how it arrives"},out:{enum:["explode","lift-off","sink","scatter","fly-out","collapse","fade","reverse"],description:"how it leaves"},easing:{enum:["linear","ease","ease-in","ease-out","settle","spring","bounce"]},from:{enum:["left","right","top","bottom"],description:"fly: the side it comes from"},delay:{type:"number",minimum:0,description:"ms after its turn"},duration:{type:"number",exclusiveMinimum:0,description:"ms its own move takes"}}},variants:{type:"object",minProperties:1,propertyNames:{$ref:"#/$defs/id"},description:"other looks of it, by name, for a motion to switch to (its box stays as it is)",additionalProperties:{type:"object",additionalProperties:!1,minProperties:1,properties:{role:{type:"string"},ghost:{type:"boolean"},label:{type:"string"},sub:{type:"string"},face:{type:"string",pattern:"^[a-z][a-z0-9-]*$"},deco:{type:"array",items:{$ref:"#/$defs/deco"}}}}},id:{type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},grid:{type:"object",additionalProperties:!1,properties:{snap:{type:"number",exclusiveMinimum:0,description:"round every placed edge and route waypoint to this step, in grid units"},show:{type:"boolean",description:"draw the floor grid when the page opens (the Grid button toggles it)"},step:{type:"number",exclusiveMinimum:0,description:"spacing of the drawn grid lines; default the snap step, or 1"}}},num:{type:"number"},point2:{type:"array",items:{type:"number"},minItems:2,maxItems:2},size2or3:{type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:3},stepRef:{anyOf:[{type:"string"},{type:"integer",minimum:1}]},side:{enum:["n","e","s","w"]},align:{enum:["start","center","end"]},role:{type:"object",additionalProperties:!1,required:["h","s"],properties:{h:{type:"number",minimum:0,maximum:360,description:"hue"},s:{type:"number",minimum:0,maximum:100,description:"saturation, percent"},top:{type:"string",description:"CSS colour for the top face, overriding the computed one"},tint:{type:"number",minimum:0,maximum:100,description:"percent of the role colour mixed into the pad colour for the top face"}}},kindDef:{type:"object",additionalProperties:!1,properties:{legend:{type:"string"},like:{type:"string",description:"a standard kind whose colour and line style this one uses"},color:{type:"string"},dash:{enum:["solid","dashed","dotted"]}}},placement:{properties:{in:{$ref:"#/$defs/id"},at:{$ref:"#/$defs/point2"},"right-of":{$ref:"#/$defs/id"},"left-of":{$ref:"#/$defs/id"},below:{$ref:"#/$defs/id"},behind:{$ref:"#/$defs/id"},gap:{type:"number"},align:{$ref:"#/$defs/align"},shift:{$ref:"#/$defs/point2",description:"nudge after placement, grid units [dx, dy]"},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},scene:{type:"object",required:["id","title"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},title:{type:"string"},ants:{description:"its connectors march, showing which way they flow: all that may, these, or with a speed (units a second) and a dash",anyOf:[{type:"boolean"},{type:"array",items:{type:"string"}},{type:"object",additionalProperties:!1,properties:{ids:{type:"array",items:{type:"string"}},speed:{type:"number"},dash:{type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:2}}}]},motion:{type:"object",description:"the scene's motion document (isomotion/1; its `isomotion: 1` may be left out)"},caption:{type:"string"},aria:{type:"string"},gap:{type:"number",exclusiveMinimum:0},flow:{enum:["row","column"]},regions:{type:"array",items:{$ref:"#/$defs/region"}},nodes:{type:"array",items:{$ref:"#/$defs/node"}},routes:{type:"array",items:{$ref:"#/$defs/route"}},notes:{type:"array",items:{$ref:"#/$defs/note"}},steps:{type:"array",items:{$ref:"#/$defs/step"}},legend:{anyOf:[{enum:["auto"]},{const:!1},{type:"array",items:{type:"string"}}]},badges:{type:"boolean"},grid:{$ref:"#/$defs/grid"},assemble:{type:"boolean",description:"draw the scene by flying its parts in from the nearest edge, then play"},loop:{type:"boolean",description:"the player wraps from the last step to the first (default true)"},dim:{enum:["flows","all"],description:"what a step dims: only flows, their labels and marks (default), or nodes too"},after:{type:"string"}}},region:{type:"object",required:["id","kind"],unevaluatedProperties:!1,allOf:[{$ref:"#/$defs/placement"}],properties:{id:{$ref:"#/$defs/id"},kind:{enum:["slab","pad","fence","vm","cloud","zone","platform","tunnel"]},label:{type:"string"},"label-style":{enum:["face","face-right","floor","none"]},ghost:{type:"boolean",description:"drawn as a dashed outline: not there yet, out of reach, or stopped"},role:{type:"string"},size:{$ref:"#/$defs/size2or3"},padding:{type:"number",minimum:0},height:{type:"number",exclusiveMinimum:0},z:{type:"number",description:"lift above the floor it stands on (tunnels)"},flow:{enum:["row","column"]},gate:{type:"object",additionalProperties:!1,required:["side"],properties:{side:{$ref:"#/$defs/side"},at:{type:"number",minimum:0,maximum:1,description:"centre of the gate along the wall, 0..1"},width:{type:"number",exclusiveMinimum:0},height:{type:"number",exclusiveMinimum:0},node:{$ref:"#/$defs/id"}}},around:{type:"array",items:{$ref:"#/$defs/id"},description:"tunnel: routes it wraps"},regions:{type:"array",items:{$ref:"#/$defs/region"}},motion:{$ref:"#/$defs/motion"},variants:{$ref:"#/$defs/variants"},nodes:{type:"array",items:{$ref:"#/$defs/node"}}}},deco:{anyOf:[{enum:["envelope","bubble","file-lines","ghost","terminal"]},{type:"object",additionalProperties:!1,minProperties:1,maxProperties:1,properties:{terminal:{type:"integer",minimum:1,maximum:8},icon:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"an icon the host registers (none by default); one nothing registers is drawn as a placeholder, with a warning"},screen:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"terminal, chat, desktop, tiles, or a face the host registers"}}}]},node:{type:"object",required:["id"],unevaluatedProperties:!1,allOf:[{$ref:"#/$defs/placement"}],properties:{id:{$ref:"#/$defs/id"},asset:{type:"string",description:"asset name from the library; default 'block'"},role:{type:"string",description:"colour role"},label:{type:"string"},sub:{type:"string"},size:{$ref:"#/$defs/size2or3"},z:{type:"number",description:"lift above the floor it stands on"},deco:{type:"array",items:{$ref:"#/$defs/deco"}},ghost:{type:"boolean"},face:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"screen asset: what the screen shows: terminal, chat, desktop, tiles, or a face the host registers"},facing:{type:"number",description:"screen asset: rotation in degrees"},"label-at":{type:"object",additionalProperties:!1,properties:{side:{enum:["above","right","left","below"]},dx:{type:"number"},dy:{type:"number"}}},motion:{$ref:"#/$defs/motion"},variants:{$ref:"#/$defs/variants"},nodes:{type:"array",items:{$ref:"#/$defs/node"},description:"nodes standing on top of this one"}}},endpoint:{type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"},route:{type:"object",required:["id","from","to"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},from:{$ref:"#/$defs/endpoint"},to:{$ref:"#/$defs/endpoint"},kind:{type:"string"},via:{type:"array",items:{anyOf:[{$ref:"#/$defs/point2"},{$ref:"#/$defs/endpoint"}]}},points:{type:"array",items:{type:"array",items:{type:"number"},minItems:2,maxItems:3},description:"exact polyline in grid units; skips the router"},lane:{type:"number"},arrow:{type:"boolean"},cross:{type:"boolean",description:"the route may pass through fence walls (it crosses a boundary)"},label:{anyOf:[{type:"string"},{type:"object",additionalProperties:!1,required:["text"],properties:{text:{type:"string"},along:{type:"integer",minimum:1},side:{enum:["left","right"]},at:{type:"array",items:{type:"number"},minItems:2,maxItems:3,description:"exact place [x, y] or [x, y, z]; skips placement"},dir:{enum:["x","y"]},anchor:{enum:["start","middle","end"]}}}]},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},note:{type:"object",additionalProperties:!1,properties:{floor:{type:"string"},face:{type:"string"},label:{type:"string"},sub:{type:"string"},at:{anyOf:[{$ref:"#/$defs/point2"},{type:"array",items:{type:"number"},minItems:3,maxItems:3}]},on:{$ref:"#/$defs/id",description:"a node, region or route; a note on a route dims and lights with it"},kind:{type:"string"},dir:{enum:["x","y"]},anchor:{enum:["start","middle","end"]},dx:{type:"number"},dy:{type:"number"},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},routeRef:{anyOf:[{type:"string"},{type:"object",minProperties:1,maxProperties:1,additionalProperties:{type:"string"}}]},phase:{anyOf:[{$ref:"#/$defs/routeRef"},{type:"array",items:{$ref:"#/$defs/routeRef"}}]},step:{type:"object",required:["heading"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},number:{type:"integer",minimum:1,description:"the number shown; defaults to the position"},kind:{type:"string"},heading:{type:"string"},caption:{type:"string"},command:{type:"string"},animate:{type:"array",items:{$ref:"#/$defs/phase"}},pulse:{type:"array",items:{$ref:"#/$defs/id"}},highlight:{type:"array",items:{$ref:"#/$defs/id"}},focus:{type:"array",items:{$ref:"#/$defs/id"},description:"nodes or regions to zoom to for this step; the view eases back on steps without focus"},show:{type:"array",items:{$ref:"#/$defs/id"}},hide:{type:"array",items:{$ref:"#/$defs/id"}},say:{type:"array",items:{type:"object",additionalProperties:!1,required:["at","text"],properties:{at:{anyOf:[{$ref:"#/$defs/id"},{type:"array",items:{type:"number"},minItems:2,maxItems:3}],description:"a node (the callout sits above it) or a grid point [x, y, z]"},text:{type:"string"},kind:{type:"string"},dx:{type:"number"},dy:{type:"number"},anchor:{enum:["start","middle","end"]}}}},mark:{type:"array",items:{type:"object",additionalProperties:!1,properties:{on:{$ref:"#/$defs/id"},at:{type:"array",items:{type:"number"},minItems:2,maxItems:3}}}},badge:{anyOf:[{type:"boolean"},{$ref:"#/$defs/id"},{type:"array",items:{type:"number"},minItems:2,maxItems:3}],description:"false, a route or node id, or a grid point [x, y, z]"},duration:{anyOf:[{const:"auto"},{type:"integer",minimum:500}]}}}}};var Np=[];function Rm(t){Np.includes(t)||Np.push(t)}function Ep(t){for(let e of Np){let s=e(t);if(s!==void 0)return s}return t?"this item":"the file"}function Ol(t){return t===null?"nothing":Array.isArray(t)?"a list":typeof t=="object"?"a map":typeof t=="string"?`the text "${t}"`:`${typeof t} ${String(t)}`}var Im={string:"text",number:"a number",integer:"a whole number",boolean:"true or false",array:"a list",object:"a map"},fo=new Map;function zm(t,e){fo.set(t,e)}var Rp=new Map;function Cm(t,e){Rp.set(t,(s,r)=>e(Ol(s),r))}var Ip=[];function jm(t,e){Ip.some(([s])=>s===t)||Ip.push([t,e])}function Ny(t){let e=t.parentSchema,s=Object.keys(e?.properties??{});e?.$ref&&fo.has(e.$ref)&&s.push(...fo.get(e.$ref).filter(r=>!s.includes(r)));for(let r of e?.allOf??[])r.$ref&&fo.has(r.$ref)&&s.push(...fo.get(r.$ref));return s}function Pl(t,e){let s=t.propertyName??(t.keyword==="propertyNames"?t.params.propertyName:void 0);if(s!==void 0){let f=`${t.instancePath}/${s.replace(/~/g,"~0").replace(/\//g,"~1")}`,p=e.locate(f,{key:!0});return{severity:"error",message:`"${s}" can't be a name`,line:p.line,col:p.col,path:f,hint:"names are a lower-case letter, then lower-case letters, digits and -"}}let r=t.instancePath,i=t.message??"is not valid",o,n=e.locate(r),a=t.params;switch(t.keyword){case"required":i=`${Ep(r)} is missing "${a.missingProperty}"`;break;case"additionalProperties":case"unevaluatedProperties":{let p=String(a.additionalProperty??a.unevaluatedProperty),c=Ny(t),l=Vt(p,c);return i=`unknown key "${p}" in ${Ep(r)}`+(l?` (did you mean "${l}"?)`:""),!l&&c.length&&(o=`known keys: ${c.join(", ")}`),/\s/.test(p)&&(o='inside { \u2026 } a comma starts a new key: put text with commas in quotes, e.g. label: "read once, at launch"'),n=e.locate(`${r}/${p}`,{key:!0}),{severity:"error",message:i,line:n.line,col:n.col,path:`${r}/${p}`,hint:o}}case"enum":{let p=a.allowedValues.map(String),c=typeof t.data=="string"?Vt(t.data,p):void 0,l=r.split("/").pop();i=`${Ol(t.data)} is not a valid ${l&&!/^\d+$/.test(l)?`"${l}"`:"value"}`+(c?` (did you mean "${c}"?)`:""),o=`expected one of: ${p.join(", ")}`;break}case"const":i=Rp.has(r)?Rp.get(r)(t.data,a.allowedValue):`must be ${JSON.stringify(a.allowedValue)}`;break;case"type":i=`expected ${Im[String(a.type)]??a.type}, got ${Ol(t.data)}`;break;case"pattern":let f=Ip.find(([p])=>String(a.pattern).startsWith(p));f?{message:i,hint:o}=f[1](t.data):(i=`"${t.data}" is not a valid id`,o="ids start with a letter and use only letters, digits, - and _");break;case"minItems":case"maxItems":t.schema===2||t.parentSchema?.minItems===2?i=`expected a list of ${t.parentSchema.minItems===t.parentSchema.maxItems?t.parentSchema.minItems:`${t.parentSchema.minItems} to ${t.parentSchema.maxItems}`} numbers, got ${t.data.length}`:i=`list ${t.message}`;break;case"false schema":{let p=r.split("/").pop()??"",c=r.split("/").slice(0,-1).join("/");i=`"${p.replace(/~1/g,"/").replace(/~0/g,"~")}" can't be set on ${Ep(c)}`,n=e.locate(r,{key:!0});break}case"minimum":case"maximum":case"exclusiveMinimum":case"exclusiveMaximum":i=`${t.data} is out of range: ${t.message}`;break}return{severity:"error",message:i,line:n.line,col:n.col,path:r,hint:o}}function Lm(t,e){let s=t.filter(n=>n.keyword==="anyOf"),r=new Set,i=[];for(let n of s){let a=n.schemaPath.replace(/\/anyOf$/,"/anyOf/"),f=t.filter(l=>l!==n&&l.schemaPath.startsWith(a)&&l.instancePath.startsWith(n.instancePath));if(f.forEach(l=>r.add(l)),r.add(n),s.some(l=>l!==n&&n.schemaPath.startsWith(l.schemaPath.replace(/\/anyOf$/,"/anyOf/"))&&l.instancePath===n.instancePath))continue;let p=f.filter(l=>l.instancePath.length>n.instancePath.length&&l.keyword!=="anyOf"),c=f.find(l=>l.keyword==="enum"&&l.instancePath===n.instancePath&&typeof n.data=="string");if(c)i.push(Pl(c,e));else if(p.length)i.push(...p.map(l=>Pl(l,e)));else{let l=f.filter(d=>d.instancePath===n.instancePath&&d.keyword!=="type"&&d.keyword!=="anyOf");if(l.length&&typeof n.data=="object"&&n.data!==null)i.push(...l.map(d=>Pl(d,e)));else{let d=[...new Set(f.filter(h=>h.keyword==="type").map(h=>Im[String(h.params.type)]??""))].filter(Boolean),m=e.locate(n.instancePath);i.push({severity:"error",message:`${Ol(n.data)} is not allowed here`+(d.length?`; expected ${d.join(" or ")}`:""),line:m.line,col:m.col,path:n.instancePath})}}}for(let n of t)r.has(n)||i.push(Pl(n,e));let o=new Set;return i.filter(n=>{let a=`${n.path}|${n.message}`;return o.has(a)?!1:(o.add(a),!0)}).sort((n,a)=>n.line-a.line||n.col-a.col)}var _m=Ap(Tp),Ry=Object.keys(Tp.$defs.placement.properties);zm("#/$defs/placement",Ry);Cm("/isodiag",t=>`"isodiag" must be 1 (the format version), got ${t}`);var Iy={scene:"a scene",region:"a region",node:"a node",route:"a route",note:"a note",step:"a step"};Rm(t=>{let e=/\/(scenes|regions|nodes|routes|notes|steps)\/\d+$/.exec(t);return e?Iy[e[1].replace(/s$/,"")]??"this item":void 0});jm("^[A-Za-z][A-Za-z0-9_-]*(",t=>({message:`"${t}" is not a node reference`,hint:"write an id, optionally with a side: worker, worker.e (sides: n, e, s, w, top)"}));function Fm(t){return t.data==null||typeof t.data!="object"||Array.isArray(t.data)?[{severity:"error",message:'the file must be a YAML map with "isodiag: 1" and "scenes:"',line:1,col:1,path:""}]:_m(t.data)?[]:Lm(_m.errors??[],t)}var mo=class extends Error{diags;constructor(e){super(e.filter(s=>s.severity==="error").map(s=>`line ${s.line}: ${s.message}`).join(`
439
+ `)),this.name="CompileError",this.diags=e}};function Al(t,e,s={}){if(s.font&&!s.resolveVars)throw new Error("font: a self-contained drawing's (resolveVars)");let r=bo(s.font,()=>Cy(t,e,s)),i=s.font&&{sans:s.font.sans,mono:s.font.mono??Qi.mono};if(!r.ok&&s.strict==="throw")throw new mo(r.diags);if(!r.ok&&s.strict&&(r.scenes=[]),s.stepMs!==void 0)for(let a of r.scenes)for(let f of a.steps.steps)f.duration=s.stepMs;if(s.treatment!==void 0&&s.treatment!=="mono"&&s.treatment!=="none")throw new Error(`treatment: there is "mono" (and "none"), and no ${JSON.stringify(s.treatment)}`);let o=(s.treatment??r.doc?.treatment)==="mono";if(s.treatment==="mono"&&!s.resolveVars)throw new Error("treatment: a self-contained drawing's (resolveVars)");let n=r.theme;if(s.resolveVars)for(let a of r.scenes){let f=s.mode??"light",p=ar(ts)+eo+to;if(o){zy(a,n,f,p,s.mono,i);continue}let c={mode:f,theme:r.theme,css:p,fonts:i};a.rendered.svg=Zr(a.rendered.svg,c),a.rendered.variants&&(a.rendered.variants=Object.fromEntries(Object.entries(a.rendered.variants).map(([l,d])=>[l,Zr(d,c)]))),a.rendered.inks={surface:r.theme[c.mode].surface??r.theme.light.surface,control:r.theme[c.mode].control??r.theme.light.control,kinds:Object.fromEntries(Object.entries(r.theme.kinds).map(([l,d])=>[l,r.theme[c.mode][d.color]??d.color]))}}if(s.font)for(let a of r.scenes){let f=s.font.name,p=c=>c.replace("<svg ",`<svg data-font="${f.replace(/[^\w-]/g,"")}" `);a.rendered.svg=p(a.rendered.svg),a.rendered.variants&&(a.rendered.variants=Object.fromEntries(Object.entries(a.rendered.variants).map(([c,l])=>[c,p(l)])))}return s.resolveVars&&o&&n&&(r.theme={...n,kinds:Object.fromEntries(Object.entries(n.kinds).map(([a,f])=>{let p=r.scenes.map(c=>c.rendered.mono?.kinds[a]?.dash).find(c=>c&&c.length>1);return[a,p?{...f,ants:[p[0],p[1]]}:f]}))}),r}function zy(t,e,s,r,i,o){let n=[t.rendered.svg,...Object.values(t.rendered.variants??{})],a=Ua(n.join(""),e,s,[...t.routes.map(p=>p.kind),...t.steps.kindsUsed],i),f=p=>Za(Zr(p,{mode:s,theme:a.theme,css:r+a.css,fonts:o}),a.look,t.id);t.rendered.svg=f(t.rendered.svg),t.rendered.variants&&(t.rendered.variants=Object.fromEntries(Object.entries(t.rendered.variants).map(([p,c])=>[p,f(c)]))),t.rendered.inks={surface:a.look.paper,control:a.look.ink,kinds:Object.fromEntries(Object.keys(e.kinds).map(p=>[p,a.look.ink]))},t.rendered.mono=a.look;for(let p of a.look.warnings)t.rendered.warnings.push({path:"",message:`black and white: ${p}`})}function Cy(t,e,s){let r=ca(t),i=[...r.diags];if(i.some(c=>c.severity==="error"))return{ok:!1,diags:i,catalog:ts,scenes:[]};let o=Fm(r);i.push(...o);let n=r.data;if(o.length){try{let c=_s(Tr(e),n.roles??{},n.kinds??{}),l=o.map(d=>d.path);(Array.isArray(n.scenes)?n.scenes:[]).forEach((d,m)=>{try{let h=Nr(d,`/scenes/${m}`,r,c,ts,n.roles??{});i.push(...h.diags.filter(y=>!l.some(g=>y.path===g||y.path.startsWith(g+"/"))))}catch{}})}catch{}return i.sort((c,l)=>c.line-l.line||c.col-l.col),{ok:!1,diags:i,catalog:ts,scenes:[]}}let a=Wa(n,e,ts,r,t,{snap:s.snap},i),f=0,p=(c,l,d)=>{let m=r.locate(c);a.diags.push({severity:"error",message:l,line:m.line,col:m.col,path:c,...d?{hint:d}:{}}),f++};return a.scenes.forEach((c,l)=>{_a(c,a.theme);let d=c.raw.ants,m=Ss(c.raw)?.ids,h=c.routes.map(u=>u.id);if((m??[]).forEach((u,b)=>{h.includes(u)||p(`/scenes/${l}/ants${Array.isArray(d)?"":"/ids"}/${b}`,`no connector "${u}" in this scene`,h.length?`its connectors: ${h.slice(0,8).join(", ")}${h.length>8?", \u2026":""}`:void 0)}),!c.raw.motion)return;let y={isomotion:1,...c.raw.motion},g=`/scenes/${l}/motion`,k=vs(c,y,{kinds:a.theme.kinds}).diags;for(let u of k){let b=r.locate(g+u.path);a.diags.push({severity:u.severity,message:u.message,line:b.line,col:b.col,path:g+u.path,...u.hint?{hint:u.hint}:{}})}f+=k.length,k.length||(c.motion=y)}),f&&(a.ok=!1,a.diags.sort((c,l)=>c.line-l.line||c.col-l.col)),a}function Dm(t,e){let s=Al(t,e.theme,{mode:e.mode??"light",resolveVars:!0,strict:"throw",treatment:e.treatment,mono:e.mono}),r=s.theme.kinds,i=e.scene===void 0?s.scenes[0]:typeof e.scene=="number"?s.scenes[e.scene]:s.scenes.find(f=>f.id===e.scene);if(!i)throw new Error(`no scene ${JSON.stringify(e.scene)} (there ${s.scenes.length===1?"is":"are"} ${s.scenes.map(f=>f.id).join(", ")})`);let o=e.ants===void 0?Ss(i.raw):e.ants===!0?Ss(i.raw)??{}:e.ants||void 0;if(e.t===void 0)return o?Fa(i,{...o,by:e.ambient==="off"?"none":"smil",kinds:r}):i.rendered.svg;if(e.ants)throw new Error("ants: at a moment they are its motion document's");let n=e.motion??i.motion;if(!n)throw new Error("t: this scene has no motion");let a=vs(i,n,{kinds:r});if(!a.ok)throw new Error(a.diags.map(f=>`${f.path}: ${f.message}${f.hint?` (${f.hint})`:""}`).join(`
440
+ `));return Ki(i,a.at(e.t,e.ambient===void 0?{}:{ambient:e.ambient}))}export{Bd as core,Cf as objects,Bm as systems,Pm as viewer};