@johnoscott/isometric-engine 0.14.1 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +1 -1
  2. package/iso-editor.js +199 -190
  3. package/iso-render.js +157 -148
  4. package/iso-systems.js +170 -159
  5. package/js/iso-objects/ants.js +36 -0
  6. package/js/iso-objects/index.js +47 -1
  7. package/js/iso-objects/looks.js +25 -0
  8. package/js/iso-objects/motion-builder.js +130 -0
  9. package/js/iso-objects/motion-doc.js +500 -0
  10. package/js/iso-objects/motion-entry.js +32 -0
  11. package/js/iso-objects/motion.js +635 -0
  12. package/js/iso-objects/resolve.js +238 -0
  13. package/js/iso-objects/scene.js +15 -13
  14. package/js/iso-objects/timeline.js +553 -0
  15. package/js/iso-systems/compile.js +59 -1
  16. package/js/iso-systems/index.js +4 -1
  17. package/js/iso-systems/render.js +20 -0
  18. package/js/iso-systems/schema.json +39 -0
  19. package/js/iso-viewer/page.js +2 -1
  20. package/js/iso-viewer/player.js +23 -34
  21. package/package.json +46 -1
  22. package/src/iso-objects/ants.ts +53 -0
  23. package/src/iso-objects/compile.ts +4 -1
  24. package/src/iso-objects/index.ts +14 -1
  25. package/src/iso-objects/looks.ts +21 -0
  26. package/src/iso-objects/motion-builder.ts +79 -0
  27. package/src/iso-objects/motion-doc.ts +361 -0
  28. package/src/iso-objects/motion-entry.ts +12 -0
  29. package/src/iso-objects/motion.ts +616 -0
  30. package/src/iso-objects/resolve.ts +196 -0
  31. package/src/iso-objects/scene.ts +29 -13
  32. package/src/iso-objects/timeline.ts +443 -0
  33. package/src/iso-objects/types.ts +20 -2
  34. package/src/iso-systems/compile.ts +58 -3
  35. package/src/iso-systems/index.ts +4 -1
  36. package/src/iso-systems/render.ts +41 -0
  37. package/src/iso-systems/schema.json +39 -0
  38. package/src/iso-viewer/page.ts +2 -1
  39. package/src/iso-viewer/player.ts +24 -41
  40. package/types/iso-objects/ants.d.ts +33 -0
  41. package/types/iso-objects/compile.d.ts +3 -0
  42. package/types/iso-objects/index.d.ts +14 -1
  43. package/types/iso-objects/looks.d.ts +4 -0
  44. package/types/iso-objects/motion-builder.d.ts +105 -0
  45. package/types/iso-objects/motion-doc.d.ts +787 -0
  46. package/types/iso-objects/motion-entry.d.ts +10 -0
  47. package/types/iso-objects/motion.d.ts +200 -0
  48. package/types/iso-objects/resolve.d.ts +20 -0
  49. package/types/iso-objects/scene.d.ts +11 -0
  50. package/types/iso-objects/timeline.d.ts +46 -0
  51. package/types/iso-objects/types.d.ts +32 -0
  52. package/types/iso-systems/compile.d.ts +20 -3
  53. package/types/iso-systems/index.d.ts +4 -1
  54. package/types/iso-systems/render.d.ts +21 -0
package/iso-systems.js CHANGED
@@ -1,145 +1,154 @@
1
- var Of=Object.defineProperty;var mi=(t,e)=>{for(var n in e)Of(t,n,{get:e[n],enumerable:!0})};var Xc={};mi(Xc,{Bounds:()=>Sr,C:()=>Et,DiagError:()=>no,FONTS:()=>yt,Kernel:()=>Dn,S:()=>Qe,VEl:()=>Gr,allowed:()=>Da,apply:()=>xr,bubble:()=>hi,buildSvg:()=>Yc,center:()=>$n,colorRef:()=>Vs,createHash:()=>Jc,depthSort:()=>Ar,didYouMean:()=>Ns,distance:()=>ja,envelope:()=>ui,esc:()=>xt,extendTheme:()=>tr,faceFrame:()=>aa,fileLines:()=>yi,formatDiag:()=>Ba,formatDiags:()=>qc,iso:()=>ke,keyGlyph:()=>gi,loadTheme:()=>er,matStr:()=>kr,n1:()=>ht,parse:()=>ro,parseSvg:()=>Va,placeholderFace:()=>$r,pt:()=>vn,screenFaces:()=>Vn,screenGlass:()=>Pr,serialize:()=>io,sha256Hex:()=>Ka,socketGlyph:()=>bi,tag:()=>fe,termLines:()=>vr,textWidth:()=>ms,themeCss:()=>so,themeParts:()=>Fa,vdoc:()=>Hc});var Xl={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 Qe=34,Et=Math.cos(Math.PI/6),ke=(t,e,n=0)=>[(t-e)*Et*Qe,(t+e)*.5*Qe-n*Qe],ht=t=>{let e=Math.round(t*10)/10;return Object.is(e,-0)?"0":String(e)},vn=t=>`${ht(t[0])},${ht(t[1])}`,xt=t=>t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");function fe(t,e={},n){let r="";for(let i in e){let o=e[i];o==null||o===!1||o===""||(r+=` ${i}="${xt(typeof o=="number"?ht(o):o)}"`)}return n===void 0?`<${t}${r}/>`:`<${t}${r}>${n}</${t}>`}var yt={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 ms(t,e){let n=Xl[e.key],r=e.key.startsWith("mono")?.6:.58,i=0;for(let o of t)i+=n[o]??r;return(i+(e.spacing??0)*[...t].length)*e.size}var xr=(t,e,n)=>[t[0]*e+t[2]*n+t[4],t[1]*e+t[3]*n+t[5]],kr=t=>`matrix(${t.map(e=>Math.round(e*1e4)/1e4).join(" ")})`;function aa(t,e){if(e==="left"){let[i,o]=ke(t.x0,t.y1,t.z1);return{m:[Et,.5,0,1,i,o],w:(t.x1-t.x0)*Qe,h:(t.z1-t.z0)*Qe}}if(e==="right"){let[i,o]=ke(t.x1,t.y1,t.z1);return{m:[Et,-.5,0,1,i,o],w:(t.y1-t.y0)*Qe,h:(t.z1-t.z0)*Qe}}let[n,r]=ke(t.x0,t.y0,t.z1);return{m:[Et,.5,-Et,.5,n,r],w:(t.x1-t.x0)*Qe,h:(t.y1-t.y0)*Qe}}var Sr=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,n,r,i){this.add([e,n]),this.add([e+r,n+i])}get empty(){return this.x0===1/0}},Dn=class{bounds=new Sr;texts=[];planes=[];planePolys=[];defs=new Map;poly(e,n,r={}){let i=e.map(o=>ke(o[0],o[1],o[2]));return i.forEach(o=>this.bounds.add(o)),fe("polygon",{points:i.map(vn).join(" "),class:n,...r})}line3(e,n,r,i={}){let o=ke(...e),s=ke(...n);return this.bounds.add(o),this.bounds.add(s),fe("line",{x1:o[0],y1:o[1],x2:s[0],y2:s[1],class:r,...i})}blockFaces(e){let{x0:n,y0:r,x1:i,y1:o,z0:s,z1:a}=e;return this.poly([[n,o,s],[i,o,s],[i,o,a],[n,o,a]],"lft")+this.poly([[i,r,s],[i,o,s],[i,o,a],[i,r,a]],"rgt")+this.poly([[n,r,a],[i,r,a],[i,o,a],[n,o,a]],"top")}onFace(e,n,r,i){let o=aa(e,n);for(let[s,a]of[[0,0],[o.w,0],[0,o.h],[o.w,o.h]])this.bounds.add(xr(o.m,s,a));return fe("g",{class:i,transform:kr(o.m)},r(o.w,o.h))}onMatrix(e,n,r,i,o){for(let[s,a]of[[0,0],[n,0],[0,r],[n,r]])this.bounds.add(xr(e,s,a));return fe("g",{class:o,transform:kr(e)},i(n,r))}text(e,n,r,i,o,s="middle",a={},d){let c=ms(r,o),p={x:s==="start"?e:s==="end"?e-c:e-c/2,y:n-o.size*.8,w:c,h:o.size*1.05,text:r,owner:d};return this.bounds.addRect(p.x-2,p.y-2,p.w+4,p.h+4),this.texts.push(p),fe("text",{x:e,y:n,class:i,"text-anchor":s==="start"?void 0:s,...a},xt(r))}planeText(e,n,r,i,o="start",s={}){let a=ms(n,i),d=o==="start"?0:o==="end"?-a:-a/2,c=[[d,-i.size*.8],[d+a,-i.size*.8],[d,i.size*.25],[d+a,i.size*.25]].map(([f,m])=>xr(e,f,m));c.forEach(f=>this.bounds.add(f));let l=c.map(f=>f[0]),p=c.map(f=>f[1]);return this.planePolys.push([c[0],c[1],c[3],c[2]]),this.planes.push({x:Math.min(...l),y:Math.min(...p),w:Math.max(...l)-Math.min(...l),h:Math.max(...p)-Math.min(...p)}),fe("text",{transform:kr(e),class:r,"text-anchor":o==="start"?void 0:o,...s},xt(n))}floorText(e,n,r,i,o,s="x",a="start",d={}){let[c,l]=ke(e,n,r),p=s==="x"?[Et,.5,-Et,.5,c,l]:[Et,-.5,Et,.5,c,l];return this.planeText(p,i,o,yt.floor,a,d)}faceText(e,n,r,i,o,s,a="left",d="start",c={}){let[l,p]=ke(e,n,r),f=a==="left"?[Et,.5,0,1,l,p]:[Et,-.5,0,1,l,p];return this.planeText(f,i,o,s,d,c)}def(e,n){this.defs.set(e,n)}},$n=t=>[(t.x0+t.x1)/2,(t.y0+t.y1)/2,t.z1];function vr(t,e,n){let r="";for(let i=0;i<n;i++){let o=e.z1-(e.z1-e.z0)*(.28+i*.2),s=(e.x1-e.x0)*(i===n-1?.35:.62-i*.1);r+=t.line3([e.x0+.35,e.y1,o],[e.x0+.35+s,e.y1,o],"det")}return r}function ui(t,e){let r=e.z1,i=[e.x0+.55,e.y0+.55,r],o=[e.x1-.55,e.y0+.55,r],s=[e.x1-.55,e.y1-.55,r],a=[e.x0+.55,e.y1-.55,r],d=[(e.x0+e.x1)/2,(e.y0+e.y1)/2,r];return t.poly([i,o,s,a],"det")+t.line3(i,d,"det")+t.line3(d,o,"det")}function hi(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 s=e.y0+.55+(e.y1-e.y0-1.1)*o/3;i+=t.line3([e.x0+.55+.3,s,r],[e.x1-.55-.3-(o===2?.5:0),s,r],"det")}return i}function yi(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 gi(t,e){let n=(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,s=[];for(let a=0;a<20;a++){let d=a/20*Math.PI*2;s.push([n-o*1.4+Math.cos(d)*o,r+Math.sin(d)*o,i])}return t.poly(s,"det")+t.line3([n-o*.4,r,i],[n+o*2.2,r,i],"det")+t.line3([n+o*1.7,r,i],[n+o*1.7,r+o*.8,i],"det")}function bi(t,e){let n=(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,s=[];for(let a=0;a<24;a++){let d=a/24*Math.PI*2;s.push([n+Math.cos(d)*o,r+Math.sin(d)*o,i])}return t.poly(s,"det sock-hole")}var Pn=(t,e,n,r,i,o=0)=>fe("rect",{class:t,x:e,y:n,width:r,height:i,rx:o||void 0}),Vn={terminal(t,e){let n="",r=Math.max(2,Math.floor((e-12)/9));for(let i=0;i<r;i++){let o=10+i*9,s=(t-18)*[.7,.45,.6,.3,.55][i%5];n+=fe("line",{class:"ln",x1:8,y1:o,x2:8+s,y2:o})}return n},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],s=r[0]===6?7:t-7-o;return Pn(r[2],s,8+i*(e-18)/4,o,(e-18)/4-4,3)}).join("")},desktop(t,e){return Pn("wall",5,5,t-10,e-10,2)+Pn("bar",5,5,t-10,6)+Pn("win",t*.5,13,t*.38,e*.42,2)},tiles(t,e){let s=(t-12-5)/3,a=(e-12-2.5*1)/2,d="";for(let c=0;c<2;c++)for(let l=0;l<3;l++){let p=6+l*(s+2.5),f=6+c*(a+2.5);d+=Pn("t",p,f,s,a,1.5),[.3,.52,.74].forEach((m,u)=>{d+=fe("line",{class:"ln",x1:p+2.5,y1:f+a*m,x2:p+2.5+(s-5)*[.8,.5,.65][(u+c+l)%3],y2:f+a*m})})}return d}};function $r(t,e){let n=t/2,r=e/2,i=Math.min(t,e)*.22;return Pn("unk",t*.2,e*.2,t*.6,e*.6,2)+fe("path",{class:"unk-q",d:`M${ht(n-i*.5)},${ht(r-i*.45)}a${ht(i*.5)},${ht(i*.5)} 0 1 1 ${ht(i*.5)},${ht(i*.55)}v${ht(i*.3)}`})+fe("circle",{class:"unk-dot",cx:ht(n),cy:ht(r+i*.75),r:ht(Math.max(.8,i*.1))})}function Pr(t,e){return Pn("glass",3,3,t-6,e-6,3)}function Tf(t){let e=[ke(t.x0,t.y0,t.z1),ke(t.x1,t.y0,t.z0),ke(t.x0,t.y1,t.z0),ke(t.x1,t.y1,t.z0),ke(t.x1,t.y1,t.z1),ke(t.x0,t.y0,t.z0)],n=e.map(i=>i[0]),r=e.map(i=>i[1]);return[Math.min(...n),Math.min(...r),Math.max(...n),Math.max(...r)]}function Nf(t,e){let r=t.x1<=e.x0+1e-6,i=e.x1<=t.x0+1e-6,o=t.y1<=e.y0+1e-6,s=e.y1<=t.y0+1e-6,a=t.z1<=e.z0+1e-6,d=e.z1<=t.z0+1e-6,c=r||o||a,l=i||s||d;return c&&!l?-1:l&&!c?1:0}function Ar(t){let e=t.length,n=t.map(c=>Tf(c.box)),r=c=>c.box.x0+c.box.y0+c.box.z0*.01,i=t.map(()=>[]),o=new Array(e).fill(0);for(let c=0;c<e;c++)for(let l=c+1;l<e;l++){let p=n[c],f=n[l];if(p[2]<=f[0]||f[2]<=p[0]||p[3]<=f[1]||f[3]<=p[1])continue;let m=Nf(t[c].box,t[l].box);m<0?(i[c].push(l),o[l]++):m>0&&(i[l].push(c),o[c]++)}let s=[],a=t.map((c,l)=>l).filter(c=>!o[c]),d=new Array(e).fill(!1);for(;s.length<e;){if(!a.length){let l=t.map((p,f)=>f).filter(p=>!d[p]).sort((p,f)=>r(t[p])-r(t[f]));a.push(l[0]),o[l[0]]=0}a.sort((l,p)=>r(t[l])-r(t[p])||l-p);let c=a.shift();if(!d[c]){d[c]=!0,s.push(t[c]);for(let l of i[c])!d[l]&&--o[l]===0&&a.push(l)}}return s}var wi=Symbol.for("yaml.alias"),xi=Symbol.for("yaml.document"),$s=Symbol.for("yaml.map"),la=Symbol.for("yaml.pair"),as=Symbol.for("yaml.scalar"),Ws=Symbol.for("yaml.seq"),Jt=Symbol.for("yaml.node.type"),Ps=t=>!!t&&typeof t=="object"&&t[Jt]===wi,Cs=t=>!!t&&typeof t=="object"&&t[Jt]===xi,es=t=>!!t&&typeof t=="object"&&t[Jt]===$s,Be=t=>!!t&&typeof t=="object"&&t[Jt]===la,ze=t=>!!t&&typeof t=="object"&&t[Jt]===as,ts=t=>!!t&&typeof t=="object"&&t[Jt]===Ws;function et(t){if(t&&typeof t=="object")switch(t[Jt]){case $s:case Ws:return!0}return!1}function Ze(t){if(t&&typeof t=="object")switch(t[Jt]){case wi:case $s:case as:case Ws:return!0}return!1}var ki=t=>(ze(t)||et(t))&&!!t.anchor;var ss=Symbol("break visit"),ec=Symbol("skip children"),Ls=Symbol("remove node");function _s(t,e){let n=tc(e);Cs(t)?Kn(null,t.contents,n,Object.freeze([t]))===Ls&&(t.contents=null):Kn(null,t,n,Object.freeze([]))}_s.BREAK=ss;_s.SKIP=ec;_s.REMOVE=Ls;function Kn(t,e,n,r){let i=sc(t,e,n,r);if(Ze(i)||Be(i))return nc(t,r,i),Kn(t,i,n,r);if(typeof i!="symbol"){if(et(e)){r=Object.freeze(r.concat(e));for(let o=0;o<e.items.length;++o){let s=Kn(o,e.items[o],n,r);if(typeof s=="number")o=s-1;else{if(s===ss)return ss;s===Ls&&(e.items.splice(o,1),o-=1)}}}else if(Be(e)){r=Object.freeze(r.concat(e));let o=Kn("key",e.key,n,r);if(o===ss)return ss;o===Ls&&(e.key=null);let s=Kn("value",e.value,n,r);if(s===ss)return ss;s===Ls&&(e.value=null)}}return i}async function Si(t,e){let n=tc(e);Cs(t)?await qn(null,t.contents,n,Object.freeze([t]))===Ls&&(t.contents=null):await qn(null,t,n,Object.freeze([]))}Si.BREAK=ss;Si.SKIP=ec;Si.REMOVE=Ls;async function qn(t,e,n,r){let i=await sc(t,e,n,r);if(Ze(i)||Be(i))return nc(t,r,i),qn(t,i,n,r);if(typeof i!="symbol"){if(et(e)){r=Object.freeze(r.concat(e));for(let o=0;o<e.items.length;++o){let s=await qn(o,e.items[o],n,r);if(typeof s=="number")o=s-1;else{if(s===ss)return ss;s===Ls&&(e.items.splice(o,1),o-=1)}}}else if(Be(e)){r=Object.freeze(r.concat(e));let o=await qn("key",e.key,n,r);if(o===ss)return ss;o===Ls&&(e.key=null);let s=await qn("value",e.value,n,r);if(s===ss)return ss;s===Ls&&(e.value=null)}}return i}function tc(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 sc(t,e,n,r){if(typeof n=="function")return n(t,e,r);if(es(e))return n.Map?.(t,e,r);if(ts(e))return n.Seq?.(t,e,r);if(Be(e))return n.Pair?.(t,e,r);if(ze(e))return n.Scalar?.(t,e,r);if(Ps(e))return n.Alias?.(t,e,r)}function nc(t,e,n){let r=e[e.length-1];if(et(r))r.items[t]=n;else if(Be(r))t==="key"?r.key=n:r.value=n;else if(Cs(r))r.contents=n;else{let i=Ps(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}var Rf={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},If=t=>t.replace(/[!,[\]{}]/g,e=>Rf[e]),Fs=class t{constructor(e,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,n)}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,n){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&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[o,s]=r;return this.tags[o]=s,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(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 s=/^\d+\.\d+$/.test(o);return n(6,`Unsupported YAML version ${o}`,s),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,n){if(e==="!")return"!";if(e[0]!=="!")return n(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let s=e.slice(2,-1);return s==="!"||s==="!!"?(n(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&n("Verbatim tags must end with a >"),s)}let[,r,i]=e.match(/^(.*!)([^!]*)$/s);i||n(`The ${e} tag has no suffix`);let o=this.tags[r];if(o)try{return o+decodeURIComponent(i)}catch(s){return n(String(s)),null}return r==="!"?e:(n(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[n,r]of Object.entries(this.tags))if(e.startsWith(r))return n+If(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),i;if(e&&r.length>0&&Ze(e.contents)){let o={};_s(e.contents,(s,a)=>{Ze(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,s]of r)o==="!!"&&s==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(s)))&&n.push(`%TAG ${o} ${s}`);return n.join(`
2
- `)}};Fs.defaultYaml={explicit:!1,version:"1.2"};Fs.defaultTags={"!!":"tag:yaml.org,2002:"};function vi(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(n)}return!0}function ca(t){let e=new Set;return _s(t,{Value(n,r){r.anchor&&e.add(r.anchor)}}),e}function pa(t,e){for(let n=1;;++n){let r=`${t}${n}`;if(!e.has(r))return r}}function rc(t,e){let n=[],r=new Map,i=null;return{onAnchor:o=>{n.push(o),i??(i=ca(t));let s=pa(e,i);return i.add(s),s},setAnchors:()=>{for(let o of n){let s=r.get(o);if(typeof s=="object"&&s.anchor&&(ze(s.node)||et(s.node)))s.node.anchor=s.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:r}}function cn(t,e,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let i=0,o=r.length;i<o;++i){let s=r[i],a=cn(t,r,String(i),s);a===void 0?delete r[i]:a!==s&&(r[i]=a)}else if(r instanceof Map)for(let i of Array.from(r.keys())){let o=r.get(i),s=cn(t,r,i,o);s===void 0?r.delete(i):s!==o&&r.set(i,s)}else if(r instanceof Set)for(let i of Array.from(r)){let o=cn(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 s=cn(t,r,i,o);s===void 0?delete r[i]:s!==o&&(r[i]=s)}return t.call(e,n,r)}function Ft(t,e,n){if(Array.isArray(t))return t.map((r,i)=>Ft(r,String(i),n));if(t&&typeof t.toJSON=="function"){if(!n||!ki(t))return t.toJSON(e,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(t,r),n.onCreate=o=>{r.res=o,delete n.onCreate};let i=t.toJSON(e,n);return n.onCreate&&n.onCreate(i),i}return typeof t=="bigint"&&!n?.keep?Number(t):t}var pn=class{constructor(e){Object.defineProperty(this,Jt,{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:n,maxAliasCount:r,onAnchor:i,reviver:o}={}){if(!Cs(e))throw new TypeError("A document argument is required");let s={anchors:new Map,doc:e,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},a=Ft(this,"",s);if(typeof i=="function")for(let{count:d,res:c}of s.anchors.values())i(c,d);return typeof o=="function"?cn(o,{"":a},"",a):a}};var Js=class extends pn{constructor(e){super(wi),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,n){if(n?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let r;n?.aliasResolveCache?r=n.aliasResolveCache:(r=[],_s(e,{Node:(o,s)=>{(Ps(s)||ki(s))&&r.push(s)}}),n&&(n.aliasResolveCache=r));let i;for(let o of r){if(o===this)break;o.anchor===this.source&&(i=o)}if(i&&n){let{anchors:o,doc:s,maxAliasCount:a}=n,d=o.get(i);if(d||(Ft(i,null,n),d=o.get(i)),d?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(a>=0&&(d.count+=1,d.aliasCount===0&&(d.aliasCount=$i(s,i,o)),d.count*d.aliasCount>a)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}}return i}toJSON(e,n){if(!n)return{source:this.source};let r=this.resolve(n.doc,n);if(!r){let i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(i)}return n.anchors.get(r).res}toString(e,n,r){let i=`*${this.source}`;if(e){if(vi(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 $i(t,e,n){if(Ps(e)){let r=e.resolve(t),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(et(e)){let r=0;for(let i of e.items){let o=$i(t,i,n);o>r&&(r=o)}return r}else if(Be(e)){let r=$i(t,e.key,n),i=$i(t,e.value,n);return Math.max(r,i)}return 1}var Pi=t=>!t||typeof t!="function"&&typeof t!="object",be=class extends pn{constructor(e){super(as),this.value=e}toJSON(e,n){return n?.keep?this.value:Ft(this.value,e,n)}toString(){return String(this.value)}};be.BLOCK_FOLDED="BLOCK_FOLDED";be.BLOCK_LITERAL="BLOCK_LITERAL";be.PLAIN="PLAIN";be.QUOTE_DOUBLE="QUOTE_DOUBLE";be.QUOTE_SINGLE="QUOTE_SINGLE";var zf="tag:yaml.org,2002:";function Cf(t,e,n){if(e){let r=n.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 n.find(r=>r.identify?.(t)&&!r.format)}function Xs(t,e,n){if(Cs(t)&&(t=t.contents),Ze(t))return t;if(Be(t)){let p=n.schema[$s].createNode?.(n.schema,null,n);return p.items.push(t),p}(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:s,sourceObjects:a}=n,d;if(r&&t&&typeof t=="object"){if(d=a.get(t),d)return d.anchor??(d.anchor=i(t)),new Js(d.anchor);d={anchor:null,node:null},a.set(t,d)}e?.startsWith("!!")&&(e=zf+e.slice(2));let c=Cf(t,e,s.tags);if(!c){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let p=new be(t);return d&&(d.node=p),p}c=t instanceof Map?s[$s]:Symbol.iterator in Object(t)?s[Ws]:s[$s]}o&&(o(c),delete n.onTagObj);let l=c?.createNode?c.createNode(n.schema,t,n):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(n.schema,t,n):new be(t);return e?l.tag=e:c.default||(l.tag=c.tag),d&&(d.node=l),l}function Mr(t,e,n){let r=n;for(let i=e.length-1;i>=0;--i){let o=e[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let s=[];s[o]=r,r=s}else r=new Map([[o,r]])}return Xs(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 Zn=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,Gn=class extends pn{constructor(e,n){super(e),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(e){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(n.schema=e),n.items=n.items.map(r=>Ze(r)||Be(r)?r.clone(e):r),this.range&&(n.range=this.range.slice()),n}addIn(e,n){if(Zn(e))this.add(n);else{let[r,...i]=e,o=this.get(r,!0);if(et(o))o.addIn(i,n);else if(o===void 0&&this.schema)this.set(r,Mr(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(e){let[n,...r]=e;if(r.length===0)return this.delete(n);let i=this.get(n,!0);if(et(i))return i.deleteIn(r);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}getIn(e,n){let[r,...i]=e,o=this.get(r,!0);return i.length===0?!n&&ze(o)?o.value:o:et(o)?o.getIn(i,n):void 0}hasAllNullValues(e){return this.items.every(n=>{if(!Be(n))return!1;let r=n.value;return r==null||e&&ze(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[n,...r]=e;if(r.length===0)return this.has(n);let i=this.get(n,!0);return et(i)?i.hasIn(r):!1}setIn(e,n){let[r,...i]=e;if(i.length===0)this.set(r,n);else{let o=this.get(r,!0);if(et(o))o.setIn(i,n);else if(o===void 0&&this.schema)this.set(r,Mr(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}};var ic=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function us(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var js=(t,e,n)=>t.endsWith(`
3
- `)?us(n,e):n.includes(`
1
+ var gm=Object.defineProperty;var co=(t,e)=>{for(var s in e)gm(t,s,{get:e[s],enumerable:!0})};var hf={};co(hf,{Bounds:()=>ii,C:()=>Ct,DiagError:()=>ea,FONTS:()=>wt,Kernel:()=>fr,S:()=>lt,VEl:()=>Ti,allowed:()=>Kl,apply:()=>si,bubble:()=>fo,buildSvg:()=>ff,center:()=>Zs,colorRef:()=>as,createHash:()=>uf,depthSort:()=>ci,didYouMean:()=>Vt,distance:()=>ql,envelope:()=>po,esc:()=>St,extendTheme:()=>Mr,faceFrame:()=>fl,fileLines:()=>mo,formatDiag:()=>Vl,formatDiags:()=>af,iso:()=>Re,keyGlyph:()=>uo,loadTheme:()=>vr,matStr:()=>ri,n1:()=>bt,parse:()=>ta,parseSvg:()=>Gl,placeholderFace:()=>ai,pt:()=>Gs,screenFaces:()=>dr,screenGlass:()=>li,serialize:()=>na,sha256Hex:()=>Zl,socketGlyph:()=>ho,tag:()=>ve,termLines:()=>oi,textWidth:()=>Sn,themeCss:()=>Qo,themeParts:()=>Ai,vdoc:()=>df});var up={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),Re=(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)},Gs=t=>`${bt(t[0])},${bt(t[1])}`,St=t=>t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");function ve(t,e={},s){let r="";for(let i in e){let o=e[i];o==null||o===!1||o===""||(r+=` ${i}="${St(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 Sn(t,e){let s=up[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 si=(t,e,s)=>[t[0]*e+t[2]*s+t[4],t[1]*e+t[3]*s+t[5]],ri=t=>`matrix(${t.map(e=>Math.round(e*1e4)/1e4).join(" ")})`;function fl(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)*lt,h:(t.z1-t.z0)*lt}}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)*lt,h:(t.z1-t.z0)*lt}}let[s,r]=Re(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 ii=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}},fr=class{bounds=new ii;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)),ve("polygon",{points:i.map(Gs).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),ve("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=fl(e,s);for(let[n,a]of[[0,0],[o.w,0],[0,o.h],[o.w,o.h]])this.bounds.add(si(o.m,n,a));return ve("g",{class:i,transform:ri(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(si(e,n,a));return ve("g",{class:o,transform:ri(e)},i(s,r))}text(e,s,r,i,o,n="middle",a={},m){let p=Sn(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:m};return this.bounds.addRect(l.x-2,l.y-2,l.w+4,l.h+4),this.texts.push(l),ve("text",{x:e,y:s,class:i,"text-anchor":n==="start"?void 0:n,...a},St(r))}planeText(e,s,r,i,o="start",n={}){let a=Sn(s,i),m=o==="start"?0:o==="end"?-a:-a/2,p=[[m,-i.size*.8],[m+a,-i.size*.8],[m,i.size*.25],[m+a,i.size*.25]].map(([f,d])=>si(e,f,d));p.forEach(f=>this.bounds.add(f));let c=p.map(f=>f[0]),l=p.map(f=>f[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)}),ve("text",{transform:ri(e),class:r,"text-anchor":o==="start"?void 0:o,...n},St(s))}floorText(e,s,r,i,o,n="x",a="start",m={}){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,m)}faceText(e,s,r,i,o,n,a="left",m="start",p={}){let[c,l]=Re(e,s,r),f=a==="left"?[Ct,.5,0,1,c,l]:[Ct,-.5,0,1,c,l];return this.planeText(f,i,o,n,m,p)}def(e,s){this.defs.set(e,s)}},Zs=t=>[(t.x0+t.x1)/2,(t.y0+t.y1)/2,t.z1];function oi(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 po(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],m=[(e.x0+e.x1)/2,(e.y0+e.y1)/2,r];return t.poly([i,o,n,a],"det")+t.line3(i,m,"det")+t.line3(m,o,"det")}function fo(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 mo(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 uo(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 m=a/20*Math.PI*2;n.push([s-o*1.4+Math.cos(m)*o,r+Math.sin(m)*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 ho(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 m=a/24*Math.PI*2;n.push([s+Math.cos(m)*o,r+Math.sin(m)*o,i])}return t.poly(n,"det sock-hole")}var Us=(t,e,s,r,i,o=0)=>ve("rect",{class:t,x:e,y:s,width:r,height:i,rx:o||void 0}),dr={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+=ve("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 Us(r[2],n,8+i*(e-18)/4,o,(e-18)/4-4,3)}).join("")},desktop(t,e){return Us("wall",5,5,t-10,e-10,2)+Us("bar",5,5,t-10,6)+Us("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,m="";for(let p=0;p<2;p++)for(let c=0;c<3;c++){let l=6+c*(n+2.5),f=6+p*(a+2.5);m+=Us("t",l,f,n,a,1.5),[.3,.52,.74].forEach((d,u)=>{m+=ve("line",{class:"ln",x1:l+2.5,y1:f+a*d,x2:l+2.5+(n-5)*[.8,.5,.65][(u+p+c)%3],y2:f+a*d})})}return m}};function ai(t,e){let s=t/2,r=e/2,i=Math.min(t,e)*.22;return Us("unk",t*.2,e*.2,t*.6,e*.6,2)+ve("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)}`})+ve("circle",{class:"unk-dot",cx:bt(s),cy:bt(r+i*.75),r:bt(Math.max(.8,i*.1))})}function li(t,e){return Us("glass",3,3,t-6,e-6,3)}function wm(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 xm(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,m=e.z1<=t.z0+1e-6,p=r||o||a,c=i||n||m;return p&&!c?-1:c&&!p?1:0}function ci(t){let e=t.length,s=t.map(p=>wm(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],f=s[c];if(l[2]<=f[0]||f[2]<=l[0]||l[3]<=f[1]||f[3]<=l[1])continue;let d=xm(t[p].box,t[c].box);d<0?(i[p].push(c),o[c]++):d>0&&(i[c].push(p),o[p]++)}let n=[],a=t.map((p,c)=>c).filter(p=>!o[p]),m=new Array(e).fill(!1);for(;n.length<e;){if(!a.length){let c=t.map((l,f)=>f).filter(l=>!m[l]).sort((l,f)=>r(t[l])-r(t[f]));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(!m[p]){m[p]=!0,n.push(t[p]);for(let c of i[p])!m[c]&&--o[c]===0&&a.push(c)}}return n}var yo=Symbol.for("yaml.alias"),go=Symbol.for("yaml.document"),_n=Symbol.for("yaml.map"),dl=Symbol.for("yaml.pair"),gn=Symbol.for("yaml.scalar"),hs=Symbol.for("yaml.seq"),rn=Symbol.for("yaml.node.type"),Fn=t=>!!t&&typeof t=="object"&&t[rn]===yo,es=t=>!!t&&typeof t=="object"&&t[rn]===go,cn=t=>!!t&&typeof t=="object"&&t[rn]===_n,Qe=t=>!!t&&typeof t=="object"&&t[rn]===dl,Ge=t=>!!t&&typeof t=="object"&&t[rn]===gn,pn=t=>!!t&&typeof t=="object"&&t[rn]===hs;function ct(t){if(t&&typeof t=="object")switch(t[rn]){case _n:case hs:return!0}return!1}function nt(t){if(t&&typeof t=="object")switch(t[rn]){case yo:case _n:case gn:case hs:return!0}return!1}var bo=t=>(Ge(t)||ct(t))&&!!t.anchor;var fn=Symbol("break visit"),yp=Symbol("skip children"),ts=Symbol("remove node");function ns(t,e){let s=gp(e);es(t)?mr(null,t.contents,s,Object.freeze([t]))===ts&&(t.contents=null):mr(null,t,s,Object.freeze([]))}ns.BREAK=fn;ns.SKIP=yp;ns.REMOVE=ts;function mr(t,e,s,r){let i=bp(t,e,s,r);if(nt(i)||Qe(i))return wp(t,r,i),mr(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=mr(o,e.items[o],s,r);if(typeof n=="number")o=n-1;else{if(n===fn)return fn;n===ts&&(e.items.splice(o,1),o-=1)}}}else if(Qe(e)){r=Object.freeze(r.concat(e));let o=mr("key",e.key,s,r);if(o===fn)return fn;o===ts&&(e.key=null);let n=mr("value",e.value,s,r);if(n===fn)return fn;n===ts&&(e.value=null)}}return i}async function wo(t,e){let s=gp(e);es(t)?await ur(null,t.contents,s,Object.freeze([t]))===ts&&(t.contents=null):await ur(null,t,s,Object.freeze([]))}wo.BREAK=fn;wo.SKIP=yp;wo.REMOVE=ts;async function ur(t,e,s,r){let i=await bp(t,e,s,r);if(nt(i)||Qe(i))return wp(t,r,i),ur(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 ur(o,e.items[o],s,r);if(typeof n=="number")o=n-1;else{if(n===fn)return fn;n===ts&&(e.items.splice(o,1),o-=1)}}}else if(Qe(e)){r=Object.freeze(r.concat(e));let o=await ur("key",e.key,s,r);if(o===fn)return fn;o===ts&&(e.key=null);let n=await ur("value",e.value,s,r);if(n===fn)return fn;n===ts&&(e.value=null)}}return i}function gp(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 bp(t,e,s,r){if(typeof s=="function")return s(t,e,r);if(cn(e))return s.Map?.(t,e,r);if(pn(e))return s.Seq?.(t,e,r);if(Qe(e))return s.Pair?.(t,e,r);if(Ge(e))return s.Scalar?.(t,e,r);if(Fn(e))return s.Alias?.(t,e,r)}function wp(t,e,s){let r=e[e.length-1];if(ct(r))r.items[t]=s;else if(Qe(r))t==="key"?r.key=s:r.value=s;else if(es(r))r.contents=s;else{let i=Fn(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}var km={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},$m=t=>t.replace(/[!,[\]{}]/g,e=>km[e]),ss=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+$m(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={};ns(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
+ `)}};ss.defaultYaml={explicit:!1,version:"1.2"};ss.defaultTags={"!!":"tag:yaml.org,2002:"};function xo(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 ml(t){let e=new Set;return ns(t,{Value(s,r){r.anchor&&e.add(r.anchor)}}),e}function ul(t,e){for(let s=1;;++s){let r=`${t}${s}`;if(!e.has(r))return r}}function xp(t,e){let s=[],r=new Map,i=null;return{onAnchor:o=>{s.push(o),i??(i=ml(t));let n=ul(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 As(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=As(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=As(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=As(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=As(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||!bo(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 Ts=class{constructor(e){Object.defineProperty(this,rn,{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(!es(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:m,res:p}of n.anchors.values())i(p,m);return typeof o=="function"?As(o,{"":a},"",a):a}};var ys=class extends Ts{constructor(e){super(yo),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=[],ns(e,{Node:(o,n)=>{(Fn(n)||bo(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,m=o.get(i);if(m||(qt(i,null,s),m=o.get(i)),m?.res===void 0){let p="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(p)}if(a>=0&&(m.count+=1,m.aliasCount===0&&(m.aliasCount=ko(n,i,o)),m.count*m.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(xo(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 ko(t,e,s){if(Fn(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=ko(t,i,s);o>r&&(r=o)}return r}else if(Qe(e)){let r=ko(t,e.key,s),i=ko(t,e.value,s);return Math.max(r,i)}return 1}var $o=t=>!t||typeof t!="function"&&typeof t!="object",ze=class extends Ts{constructor(e){super(gn),this.value=e}toJSON(e,s){return s?.keep?this.value:qt(this.value,e,s)}toString(){return String(this.value)}};ze.BLOCK_FOLDED="BLOCK_FOLDED";ze.BLOCK_LITERAL="BLOCK_LITERAL";ze.PLAIN="PLAIN";ze.QUOTE_DOUBLE="QUOTE_DOUBLE";ze.QUOTE_SINGLE="QUOTE_SINGLE";var Sm="tag:yaml.org,2002:";function vm(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 gs(t,e,s){if(es(t)&&(t=t.contents),nt(t))return t;if(Qe(t)){let l=s.schema[_n].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,m;if(r&&t&&typeof t=="object"){if(m=a.get(t),m)return m.anchor??(m.anchor=i(t)),new ys(m.anchor);m={anchor:null,node:null},a.set(t,m)}e?.startsWith("!!")&&(e=Sm+e.slice(2));let p=vm(t,e,n.tags);if(!p){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let l=new ze(t);return m&&(m.node=l),l}p=t instanceof Map?n[_n]:Symbol.iterator in Object(t)?n[hs]:n[_n]}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 ze(t);return e?c.tag=e:p.default||(c.tag=p.tag),m&&(m.node=c),c}function pi(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 gs(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 yr=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,hr=class extends Ts{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)||Qe(r)?r.clone(e):r),this.range&&(s.range=this.range.slice()),s}addIn(e,s){if(yr(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,pi(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(!Qe(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,pi(this.schema,i,s));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}};var kp=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function vn(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var rs=(t,e,s)=>t.endsWith(`
3
+ `)?vn(s,e):s.includes(`
4
4
  `)?`
5
- `+us(n,e):(t.endsWith(" ")?"":" ")+n;var fa="flow",Ai="block",Or="quoted";function Er(t,e,n="flow",{indentAtStart:r,lineWidth:i=80,minContentWidth:o=20,onFold:s,onOverflow:a}={}){if(!i||i<0)return t;i<o&&(o=0);let d=Math.max(1+o,1+i-e.length);if(t.length<=d)return t;let c=[],l={},p=i-e.length;typeof r=="number"&&(r>i-Math.max(2,o)?c.push(0):p=i-r);let f,m,u=!1,h=-1,y=-1,v=-1;n===Ai&&(h=oc(t,h,e.length),h!==-1&&(p=h+d));for(let b;b=t[h+=1];){if(n===Or&&b==="\\"){switch(y=h,t[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}v=h}if(b===`
6
- `)n===Ai&&(h=oc(t,h,e.length)),p=h+e.length+d,f=void 0;else{if(b===" "&&m&&m!==" "&&m!==`
7
- `&&m!==" "){let $=t[h+1];$&&$!==" "&&$!==`
8
- `&&$!==" "&&(f=h)}if(h>=p)if(f)c.push(f),p=f+d,f=void 0;else if(n===Or){for(;m===" "||m===" ";)m=b,b=t[h+=1],u=!0;let $=h>v+1?h-2:y-1;if(l[$])return t;c.push($),l[$]=!0,p=$+d,f=void 0}else u=!0}m=b}if(u&&a&&a(),c.length===0)return t;s&&s();let g=t.slice(0,c[0]);for(let b=0;b<c.length;++b){let $=c[b],E=c[b+1]||t.length;$===0?g=`
9
- ${e}${t.slice(0,E)}`:(n===Or&&l[$]&&(g+=`${t[$]}\\`),g+=`
10
- ${e}${t.slice($+1,E)}`)}return g}function oc(t,e,n){let r=e,i=e+1,o=t[i];for(;o===" "||o===" ";)if(e<i+n)o=t[++e];else{do o=t[++e];while(o&&o!==`
11
- `);r=e,i=e+1,o=t[i]}return r}var Oi=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Ei=t=>/^(%|---|\.\.\.)/m.test(t);function Lf(t,e,n){if(!e||e<0)return!1;let r=e-n,i=t.length;if(i<=r)return!1;for(let o=0,s=0;o<i;++o)if(t[o]===`
12
- `){if(o-s>r)return!0;if(s=o+1,i-s<=r)return!1}return!0}function Tr(t,e){let n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(Ei(t)?" ":""),s="",a=0;for(let d=0,c=n[d];c;c=n[++d])if(c===" "&&n[d+1]==="\\"&&n[d+2]==="n"&&(s+=n.slice(a,d)+"\\ ",d+=1,a=d,c="\\"),c==="\\")switch(n[d+1]){case"u":{s+=n.slice(a,d);let l=n.substr(d+2,4);switch(l){case"0000":s+="\\0";break;case"0007":s+="\\a";break;case"000b":s+="\\v";break;case"001b":s+="\\e";break;case"0085":s+="\\N";break;case"00a0":s+="\\_";break;case"2028":s+="\\L";break;case"2029":s+="\\P";break;default:l.substr(0,2)==="00"?s+="\\x"+l.substr(2):s+=n.substr(d,6)}d+=5,a=d+1}break;case"n":if(r||n[d+2]==='"'||n.length<i)d+=1;else{for(s+=n.slice(a,d)+`
5
+ `+vn(s,e):(t.endsWith(" ")?"":" ")+s;var hl="flow",So="block",fi="quoted";function di(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 m=Math.max(1+o,1+i-e.length);if(t.length<=m)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 f,d,u=!1,y=-1,g=-1,x=-1;s===So&&(y=$p(t,y,e.length),y!==-1&&(l=y+m));for(let b;b=t[y+=1];){if(s===fi&&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}x=y}if(b===`
6
+ `)s===So&&(y=$p(t,y,e.length)),l=y+e.length+m,f=void 0;else{if(b===" "&&d&&d!==" "&&d!==`
7
+ `&&d!==" "){let w=t[y+1];w&&w!==" "&&w!==`
8
+ `&&w!==" "&&(f=y)}if(y>=l)if(f)p.push(f),l=f+m,f=void 0;else if(s===fi){for(;d===" "||d===" ";)d=b,b=t[y+=1],u=!0;let w=y>x+1?y-2:g-1;if(c[w])return t;p.push(w),c[w]=!0,l=w+m,f=void 0}else u=!0}d=b}if(u&&a&&a(),p.length===0)return t;n&&n();let h=t.slice(0,p[0]);for(let b=0;b<p.length;++b){let w=p[b],k=p[b+1]||t.length;w===0?h=`
9
+ ${e}${t.slice(0,k)}`:(s===fi&&c[w]&&(h+=`${t[w]}\\`),h+=`
10
+ ${e}${t.slice(w+1,k)}`)}return h}function $p(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 Mo=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Po=t=>/^(%|---|\.\.\.)/m.test(t);function Mm(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 mi(t,e){let s=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return s;let{implicitKey:r}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(Po(t)?" ":""),n="",a=0;for(let m=0,p=s[m];p;p=s[++m])if(p===" "&&s[m+1]==="\\"&&s[m+2]==="n"&&(n+=s.slice(a,m)+"\\ ",m+=1,a=m,p="\\"),p==="\\")switch(s[m+1]){case"u":{n+=s.slice(a,m);let c=s.substr(m+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(m,6)}m+=5,a=m+1}break;case"n":if(r||s[m+2]==='"'||s.length<i)m+=1;else{for(n+=s.slice(a,m)+`
13
13
 
14
- `;n[d+2]==="\\"&&n[d+3]==="n"&&n[d+4]!=='"';)s+=`
15
- `,d+=2;s+=o,n[d+2]===" "&&(s+="\\"),d+=1,a=d+1}break;default:d+=1}return s=a?s+n.slice(a):n,r?s:Er(s,o,Or,Oi(e,!1))}function da(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
16
- `)||/[ \t]\n|\n[ \t]/.test(t))return Tr(t,e);let n=e.indent||(Ei(t)?" ":""),r="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
17
- ${n}`)+"'";return e.implicitKey?r:Er(r,n,fa,Oi(e,!1))}function Un(t,e){let{singleQuote:n}=e.options,r;if(n===!1)r=Tr;else{let i=t.includes('"'),o=t.includes("'");i&&!o?r=da:o&&!i?r=Tr:r=n?da:Tr}return r(t,e)}var ma;try{ma=new RegExp(`(^|(?<!
14
+ `;s[m+2]==="\\"&&s[m+3]==="n"&&s[m+4]!=='"';)n+=`
15
+ `,m+=2;n+=o,s[m+2]===" "&&(n+="\\"),m+=1,a=m+1}break;default:m+=1}return n=a?n+s.slice(a):s,r?n:di(n,o,fi,Mo(e,!1))}function yl(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
16
+ `)||/[ \t]\n|\n[ \t]/.test(t))return mi(t,e);let s=e.indent||(Po(t)?" ":""),r="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
17
+ ${s}`)+"'";return e.implicitKey?r:di(r,s,hl,Mo(e,!1))}function gr(t,e){let{singleQuote:s}=e.options,r;if(s===!1)r=mi;else{let i=t.includes('"'),o=t.includes("'");i&&!o?r=yl:o&&!i?r=mi:r=s?yl:mi}return r(t,e)}var gl;try{gl=new RegExp(`(^|(?<!
18
18
  ))
19
19
  +(?!
20
- |$)`,"g")}catch{ma=/\n+(?!\n|$)/g}function Mi({comment:t,type:e,value:n},r,i,o){let{blockQuote:s,commentString:a,lineWidth:d}=r.options;if(!s||/\n[\t ]+$/.test(n))return Un(n,r);let c=r.indent||(r.forceBlockIndent||Ei(n)?" ":""),l=s==="literal"?!0:s==="folded"||e===be.BLOCK_FOLDED?!1:e===be.BLOCK_LITERAL?!0:!Lf(n,d,c.length);if(!n)return l?`|
20
+ |$)`,"g")}catch{gl=/\n+(?!\n|$)/g}function vo({comment:t,type:e,value:s},r,i,o){let{blockQuote:n,commentString:a,lineWidth:m}=r.options;if(!n||/\n[\t ]+$/.test(s))return gr(s,r);let p=r.indent||(r.forceBlockIndent||Po(s)?" ":""),c=n==="literal"?!0:n==="folded"||e===ze.BLOCK_FOLDED?!1:e===ze.BLOCK_LITERAL?!0:!Mm(s,m,p.length);if(!s)return c?`|
21
21
  `:`>
22
- `;let p,f;for(f=n.length;f>0;--f){let E=n[f-1];if(E!==`
23
- `&&E!==" "&&E!==" ")break}let m=n.substring(f),u=m.indexOf(`
24
- `);u===-1?p="-":n===m||u!==m.length-1?(p="+",o&&o()):p="",m&&(n=n.slice(0,-m.length),m[m.length-1]===`
25
- `&&(m=m.slice(0,-1)),m=m.replace(ma,`$&${c}`));let h=!1,y,v=-1;for(y=0;y<n.length;++y){let E=n[y];if(E===" ")h=!0;else if(E===`
26
- `)v=y;else break}let g=n.substring(0,v<y?v+1:y);g&&(n=n.substring(g.length),g=g.replace(/\n+/g,`$&${c}`));let $=(h?c?"2":"1":"")+p;if(t&&($+=" "+a(t.replace(/ ?[\r\n]+/g," ")),i&&i()),!l){let E=n.replace(/\n+/g,`
27
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),S=!1,k=Oi(r,!0);s!=="folded"&&e!==be.BLOCK_FOLDED&&(k.onOverflow=()=>{S=!0});let T=Er(`${g}${E}${m}`,c,Ai,k);if(!S)return`>${$}
28
- ${c}${T}`}return n=n.replace(/\n+/g,`$&${c}`),`|${$}
29
- ${c}${g}${n}${m}`}function _f(t,e,n,r){let{type:i,value:o}=t,{actualString:s,implicitKey:a,indent:d,indentStep:c,inFlow:l}=e;if(a&&o.includes(`
30
- `)||l&&/[[\]{},]/.test(o))return Un(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||l||!o.includes(`
31
- `)?Un(o,e):Mi(t,e,n,r);if(!a&&!l&&i!==be.PLAIN&&o.includes(`
32
- `))return Mi(t,e,n,r);if(Ei(o)){if(d==="")return e.forceBlockIndent=!0,Mi(t,e,n,r);if(a&&d===c)return Un(o,e)}let p=o.replace(/\n+/g,`$&
33
- ${d}`);if(s){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(p),{compat:m,tags:u}=e.doc.schema;if(u.some(f)||m?.some(f))return Un(o,e)}return a?p:Er(p,d,fa,Oi(e,!1))}function An(t,e,n,r){let{implicitKey:i,inFlow:o}=e,s=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==be.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(a=be.QUOTE_DOUBLE);let d=l=>{switch(l){case be.BLOCK_FOLDED:case be.BLOCK_LITERAL:return i||o?Un(s.value,e):Mi(s,e,n,r);case be.QUOTE_DOUBLE:return Tr(s.value,e);case be.QUOTE_SINGLE:return da(s.value,e);case be.PLAIN:return _f(s,e,n,r);default:return null}},c=d(a);if(c===null){let{defaultKeyType:l,defaultStringType:p}=e.options,f=i&&l||p;if(c=d(f),c===null)throw new Error(`Unsupported default string type ${f}`)}return c}function Ti(t,e){let n=Object.assign({blockQuote:!0,commentString:ic,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(n.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:t,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:r,options:n}}function Ff(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 n,r;if(ze(e)){r=e.value;let i=t.filter(o=>o.identify?.(r));if(i.length>1){let o=i.filter(s=>s.test);o.length>0&&(i=o)}n=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else r=e,n=t.find(i=>i.nodeClass&&r instanceof i.nodeClass);if(!n){let i=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${i} value`)}return n}function jf(t,e,{anchors:n,doc:r}){if(!r.directives)return"";let i=[],o=(ze(t)||et(t))&&t.anchor;o&&vi(o)&&(n.add(o),i.push(`&${o}`));let s=t.tag??(e.default?null:e.tag);return s&&i.push(r.directives.tagString(s)),i.join(" ")}function Qs(t,e,n,r){if(Be(t))return t.toString(e,n,r);if(Ps(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=Ze(t)?t:e.doc.createNode(t,{onTagObj:d=>i=d});i??(i=Ff(e.doc.schema.tags,o));let s=jf(o,i,e);s.length>0&&(e.indentAtStart=(e.indentAtStart??0)+s.length+1);let a=typeof i.stringify=="function"?i.stringify(o,e,n,r):ze(o)?An(o,e,n,r):o.toString(e,n,r);return s?ze(o)||a[0]==="{"||a[0]==="["?`${s} ${a}`:`${s}
34
- ${e.indent}${a}`:a}function ac({key:t,value:e},n,r,i){let{allNullValues:o,doc:s,indent:a,indentStep:d,options:{commentString:c,indentSeq:l,simpleKeys:p}}=n,f=Ze(t)&&t.comment||null;if(p){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(et(t)||!Ze(t)&&typeof t=="object"){let k="With simple keys, collection cannot be used as a key value";throw new Error(k)}}let m=!p&&(!t||f&&e==null&&!n.inFlow||et(t)||(ze(t)?t.type===be.BLOCK_FOLDED||t.type===be.BLOCK_LITERAL:typeof t=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!m&&(p||!o),indent:a+d});let u=!1,h=!1,y=Qs(t,n,()=>u=!0,()=>h=!0);if(!m&&!n.inFlow&&y.length>1024){if(p)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");m=!0}if(n.inFlow){if(o||e==null)return u&&r&&r(),y===""?"?":m?`? ${y}`:y}else if(o&&!p||e==null&&m)return y=`? ${y}`,f&&!u?y+=js(y,n.indent,c(f)):h&&i&&i(),y;u&&(f=null),m?(f&&(y+=js(y,n.indent,c(f))),y=`? ${y}
35
- ${a}:`):(y=`${y}:`,f&&(y+=js(y,n.indent,c(f))));let v,g,b;Ze(e)?(v=!!e.spaceBefore,g=e.commentBefore,b=e.comment):(v=!1,g=null,b=null,e&&typeof e=="object"&&(e=s.createNode(e))),n.implicitKey=!1,!m&&!f&&ze(e)&&(n.indentAtStart=y.length+1),h=!1,!l&&d.length>=2&&!n.inFlow&&!m&&ts(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let $=!1,E=Qs(e,n,()=>$=!0,()=>h=!0),S=" ";if(f||v||g){if(S=v?`
36
- `:"",g){let k=c(g);S+=`
37
- ${us(k,n.indent)}`}E===""&&!n.inFlow?S===`
38
- `&&b&&(S=`
22
+ `;let l,f;for(f=s.length;f>0;--f){let k=s[f-1];if(k!==`
23
+ `&&k!==" "&&k!==" ")break}let d=s.substring(f),u=d.indexOf(`
24
+ `);u===-1?l="-":s===d||u!==d.length-1?(l="+",o&&o()):l="",d&&(s=s.slice(0,-d.length),d[d.length-1]===`
25
+ `&&(d=d.slice(0,-1)),d=d.replace(gl,`$&${p}`));let y=!1,g,x=-1;for(g=0;g<s.length;++g){let k=s[g];if(k===" ")y=!0;else if(k===`
26
+ `)x=g;else break}let h=s.substring(0,x<g?x+1:g);h&&(s=s.substring(h.length),h=h.replace(/\n+/g,`$&${p}`));let w=(y?p?"2":"1":"")+l;if(t&&(w+=" "+a(t.replace(/ ?[\r\n]+/g," ")),i&&i()),!c){let k=s.replace(/\n+/g,`
27
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${p}`),$=!1,v=Mo(r,!0);n!=="folded"&&e!==ze.BLOCK_FOLDED&&(v.onOverflow=()=>{$=!0});let T=di(`${h}${k}${d}`,p,So,v);if(!$)return`>${w}
28
+ ${p}${T}`}return s=s.replace(/\n+/g,`$&${p}`),`|${w}
29
+ ${p}${h}${s}${d}`}function Pm(t,e,s,r){let{type:i,value:o}=t,{actualString:n,implicitKey:a,indent:m,indentStep:p,inFlow:c}=e;if(a&&o.includes(`
30
+ `)||c&&/[[\]{},]/.test(o))return gr(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||c||!o.includes(`
31
+ `)?gr(o,e):vo(t,e,s,r);if(!a&&!c&&i!==ze.PLAIN&&o.includes(`
32
+ `))return vo(t,e,s,r);if(Po(o)){if(m==="")return e.forceBlockIndent=!0,vo(t,e,s,r);if(a&&m===p)return gr(o,e)}let l=o.replace(/\n+/g,`$&
33
+ ${m}`);if(n){let f=y=>y.default&&y.tag!=="tag:yaml.org,2002:str"&&y.test?.test(l),{compat:d,tags:u}=e.doc.schema;if(u.some(f)||d?.some(f))return gr(o,e)}return a?l:di(l,m,hl,Mo(e,!1))}function Ys(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!==ze.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(n.value)&&(a=ze.QUOTE_DOUBLE);let m=c=>{switch(c){case ze.BLOCK_FOLDED:case ze.BLOCK_LITERAL:return i||o?gr(n.value,e):vo(n,e,s,r);case ze.QUOTE_DOUBLE:return mi(n.value,e);case ze.QUOTE_SINGLE:return yl(n.value,e);case ze.PLAIN:return Pm(n,e,s,r);default:return null}},p=m(a);if(p===null){let{defaultKeyType:c,defaultStringType:l}=e.options,f=i&&c||l;if(p=m(f),p===null)throw new Error(`Unsupported default string type ${f}`)}return p}function Oo(t,e){let s=Object.assign({blockQuote:!0,commentString:kp,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 Om(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 Am(t,e,{anchors:s,doc:r}){if(!r.directives)return"";let i=[],o=(Ge(t)||ct(t))&&t.anchor;o&&xo(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 bs(t,e,s,r){if(Qe(t))return t.toString(e,s,r);if(Fn(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:m=>i=m});i??(i=Om(e.doc.schema.tags,o));let n=Am(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)?Ys(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 Sp({key:t,value:e},s,r,i){let{allNullValues:o,doc:n,indent:a,indentStep:m,options:{commentString:p,indentSeq:c,simpleKeys:l}}=s,f=nt(t)&&t.comment||null;if(l){if(f)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 d=!l&&(!t||f&&e==null&&!s.inFlow||ct(t)||(Ge(t)?t.type===ze.BLOCK_FOLDED||t.type===ze.BLOCK_LITERAL:typeof t=="object"));s=Object.assign({},s,{allNullValues:!1,implicitKey:!d&&(l||!o),indent:a+m});let u=!1,y=!1,g=bs(t,s,()=>u=!0,()=>y=!0);if(!d&&!s.inFlow&&g.length>1024){if(l)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");d=!0}if(s.inFlow){if(o||e==null)return u&&r&&r(),g===""?"?":d?`? ${g}`:g}else if(o&&!l||e==null&&d)return g=`? ${g}`,f&&!u?g+=rs(g,s.indent,p(f)):y&&i&&i(),g;u&&(f=null),d?(f&&(g+=rs(g,s.indent,p(f))),g=`? ${g}
35
+ ${a}:`):(g=`${g}:`,f&&(g+=rs(g,s.indent,p(f))));let x,h,b;nt(e)?(x=!!e.spaceBefore,h=e.commentBefore,b=e.comment):(x=!1,h=null,b=null,e&&typeof e=="object"&&(e=n.createNode(e))),s.implicitKey=!1,!d&&!f&&Ge(e)&&(s.indentAtStart=g.length+1),y=!1,!c&&m.length>=2&&!s.inFlow&&!d&&pn(e)&&!e.flow&&!e.tag&&!e.anchor&&(s.indent=s.indent.substring(2));let w=!1,k=bs(e,s,()=>w=!0,()=>y=!0),$=" ";if(f||x||h){if($=x?`
36
+ `:"",h){let v=p(h);$+=`
37
+ ${vn(v,s.indent)}`}k===""&&!s.inFlow?$===`
38
+ `&&b&&($=`
39
39
 
40
- `):S+=`
41
- ${n.indent}`}else if(!m&&et(e)){let k=E[0],T=E.indexOf(`
42
- `),z=T!==-1,A=n.inFlow??e.flow??e.items.length===0;if(z||!A){let R=!1;if(z&&(k==="&"||k==="!")){let x=E.indexOf(" ");k==="&"&&x!==-1&&x<T&&E[x+1]==="!"&&(x=E.indexOf(" ",x+1)),(x===-1||T<x)&&(R=!0)}R||(S=`
43
- ${n.indent}`)}}else(E===""||E[0]===`
44
- `)&&(S="");return y+=S+E,n.inFlow?$&&r&&r():b&&!$?y+=js(y,n.indent,c(b)):h&&i&&i(),y}function Ni(t,e){(t==="debug"||t==="warn")&&console.warn(e)}var Ri="<<",As={identify:t=>t===Ri||typeof t=="symbol"&&t.description===Ri,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new be(Symbol(Ri)),{addToJSMap:ha}),stringify:()=>Ri},lc=(t,e)=>(As.identify(e)||ze(e)&&(!e.type||e.type===be.PLAIN)&&As.identify(e.value))&&t?.doc.schema.tags.some(n=>n.tag===As.tag&&n.default);function ha(t,e,n){let r=cc(t,n);if(ts(r))for(let i of r.items)ua(t,e,i);else if(Array.isArray(r))for(let i of r)ua(t,e,i);else ua(t,e,r)}function ua(t,e,n){let r=cc(t,n);if(!es(r))throw new Error("Merge sources must be maps or map aliases");let i=r.toJSON(null,t,Map);for(let[o,s]of i)e instanceof Map?e.has(o)||e.set(o,s):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0});return e}function cc(t,e){return t&&Ps(e)?e.resolve(t.doc,t):e}function Ii(t,e,{key:n,value:r}){if(Ze(n)&&n.addToJSMap)n.addToJSMap(t,e,r);else if(lc(t,n))ha(t,e,r);else{let i=Ft(n,"",t);if(e instanceof Map)e.set(i,Ft(r,i,t));else if(e instanceof Set)e.add(i);else{let o=Bf(n,i,t),s=Ft(r,o,t);o in e?Object.defineProperty(e,o,{value:s,writable:!0,enumerable:!0,configurable:!0}):e[o]=s}}return e}function Bf(t,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if(Ze(t)&&n?.doc){let r=Ti(n.doc,{});r.anchors=new Set;for(let o of n.anchors.keys())r.anchors.add(o.anchor);r.inFlow=!0,r.inStringifyKey=!0;let i=t.toString(r);if(!n.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),Ni(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return i}return JSON.stringify(e)}function Yn(t,e,n){let r=Xs(t,void 0,n),i=Xs(e,void 0,n);return new At(r,i)}var At=class t{constructor(e,n=null){Object.defineProperty(this,Jt,{value:la}),this.key=e,this.value=n}clone(e){let{key:n,value:r}=this;return Ze(n)&&(n=n.clone(e)),Ze(r)&&(r=r.clone(e)),new t(n,r)}toJSON(e,n){let r=n?.mapAsMap?new Map:{};return Ii(n,r,this)}toString(e,n,r){return e?.doc?ac(this,e,n,r):JSON.stringify(this)}};function Ci(t,e,n){return(e.inFlow??t.flow?Vf:Df)(t,e,n)}function Df({comment:t,items:e},n,{blockItemPrefix:r,flowChars:i,itemIndent:o,onChompKeep:s,onComment:a}){let{indent:d,options:{commentString:c}}=n,l=Object.assign({},n,{indent:o,type:null}),p=!1,f=[];for(let u=0;u<e.length;++u){let h=e[u],y=null;if(Ze(h))!p&&h.spaceBefore&&f.push(""),zi(n,f,h.commentBefore,p),h.comment&&(y=h.comment);else if(Be(h)){let g=Ze(h.key)?h.key:null;g&&(!p&&g.spaceBefore&&f.push(""),zi(n,f,g.commentBefore,p))}p=!1;let v=Qs(h,l,()=>y=null,()=>p=!0);y&&(v+=js(v,o,c(y))),p&&y&&(p=!1),f.push(r+v)}let m;if(f.length===0)m=i.start+i.end;else{m=f[0];for(let u=1;u<f.length;++u){let h=f[u];m+=h?`
45
- ${d}${h}`:`
46
- `}}return t?(m+=`
47
- `+us(c(t),d),a&&a()):p&&s&&s(),m}function Vf({items:t},e,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:o,flowCollectionPadding:s,options:{commentString:a}}=e;r+=o;let d=Object.assign({},e,{indent:r,inFlow:!0,type:null}),c=!1,l=0,p=[];for(let u=0;u<t.length;++u){let h=t[u],y=null;if(Ze(h))h.spaceBefore&&p.push(""),zi(e,p,h.commentBefore,!1),h.comment&&(y=h.comment);else if(Be(h)){let g=Ze(h.key)?h.key:null;g&&(g.spaceBefore&&p.push(""),zi(e,p,g.commentBefore,!1),g.comment&&(c=!0));let b=Ze(h.value)?h.value:null;b?(b.comment&&(y=b.comment),b.commentBefore&&(c=!0)):h.value==null&&g?.comment&&(y=g.comment)}y&&(c=!0);let v=Qs(h,d,()=>y=null);c||(c=p.length>l||v.includes(`
48
- `)),u<t.length-1?v+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(c||(c=p.reduce((g,b)=>g+b.length+2,2)+(v.length+2)>e.options.lineWidth)),c&&(v+=",")),y&&(v+=js(v,r,a(y))),p.push(v),l=p.length}let{start:f,end:m}=n;if(p.length===0)return f+m;if(!c){let u=p.reduce((h,y)=>h+y.length+2,2);c=e.options.lineWidth>0&&u>e.options.lineWidth}if(c){let u=f;for(let h of p)u+=h?`
49
- ${o}${i}${h}`:`
40
+ `):$+=`
41
+ ${s.indent}`}else if(!d&&ct(e)){let v=k[0],T=k.indexOf(`
42
+ `),R=T!==-1,O=s.inFlow??e.flow??e.items.length===0;if(R||!O){let I=!1;if(R&&(v==="&"||v==="!")){let M=k.indexOf(" ");v==="&"&&M!==-1&&M<T&&k[M+1]==="!"&&(M=k.indexOf(" ",M+1)),(M===-1||T<M)&&(I=!0)}I||($=`
43
+ ${s.indent}`)}}else(k===""||k[0]===`
44
+ `)&&($="");return g+=$+k,s.inFlow?w&&r&&r():b&&!w?g+=rs(g,s.indent,p(b)):y&&i&&i(),g}function Ao(t,e){(t==="debug"||t==="warn")&&console.warn(e)}var To="<<",Dn={identify:t=>t===To||typeof t=="symbol"&&t.description===To,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new ze(Symbol(To)),{addToJSMap:wl}),stringify:()=>To},vp=(t,e)=>(Dn.identify(e)||Ge(e)&&(!e.type||e.type===ze.PLAIN)&&Dn.identify(e.value))&&t?.doc.schema.tags.some(s=>s.tag===Dn.tag&&s.default);function wl(t,e,s){let r=Mp(t,s);if(pn(r))for(let i of r.items)bl(t,e,i);else if(Array.isArray(r))for(let i of r)bl(t,e,i);else bl(t,e,r)}function bl(t,e,s){let r=Mp(t,s);if(!cn(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 Mp(t,e){return t&&Fn(e)?e.resolve(t.doc,t):e}function Eo(t,e,{key:s,value:r}){if(nt(s)&&s.addToJSMap)s.addToJSMap(t,e,r);else if(vp(t,s))wl(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=Tm(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 Tm(t,e,s){if(e===null)return"";if(typeof e!="object")return String(e);if(nt(t)&&s?.doc){let r=Oo(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)+'..."'),Ao(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 br(t,e,s){let r=gs(t,void 0,s),i=gs(e,void 0,s);return new Et(r,i)}var Et=class t{constructor(e,s=null){Object.defineProperty(this,rn,{value:dl}),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 Eo(s,r,this)}toString(e,s,r){return e?.doc?Sp(this,e,s,r):JSON.stringify(this)}};function Ro(t,e,s){return(e.inFlow??t.flow?Nm:Em)(t,e,s)}function Em({comment:t,items:e},s,{blockItemPrefix:r,flowChars:i,itemIndent:o,onChompKeep:n,onComment:a}){let{indent:m,options:{commentString:p}}=s,c=Object.assign({},s,{indent:o,type:null}),l=!1,f=[];for(let u=0;u<e.length;++u){let y=e[u],g=null;if(nt(y))!l&&y.spaceBefore&&f.push(""),No(s,f,y.commentBefore,l),y.comment&&(g=y.comment);else if(Qe(y)){let h=nt(y.key)?y.key:null;h&&(!l&&h.spaceBefore&&f.push(""),No(s,f,h.commentBefore,l))}l=!1;let x=bs(y,c,()=>g=null,()=>l=!0);g&&(x+=rs(x,o,p(g))),l&&g&&(l=!1),f.push(r+x)}let d;if(f.length===0)d=i.start+i.end;else{d=f[0];for(let u=1;u<f.length;++u){let y=f[u];d+=y?`
45
+ ${m}${y}`:`
46
+ `}}return t?(d+=`
47
+ `+vn(p(t),m),a&&a()):l&&n&&n(),d}function Nm({items:t},e,{flowChars:s,itemIndent:r}){let{indent:i,indentStep:o,flowCollectionPadding:n,options:{commentString:a}}=e;r+=o;let m=Object.assign({},e,{indent:r,inFlow:!0,type:null}),p=!1,c=0,l=[];for(let u=0;u<t.length;++u){let y=t[u],g=null;if(nt(y))y.spaceBefore&&l.push(""),No(e,l,y.commentBefore,!1),y.comment&&(g=y.comment);else if(Qe(y)){let h=nt(y.key)?y.key:null;h&&(h.spaceBefore&&l.push(""),No(e,l,h.commentBefore,!1),h.comment&&(p=!0));let b=nt(y.value)?y.value:null;b?(b.comment&&(g=b.comment),b.commentBefore&&(p=!0)):y.value==null&&h?.comment&&(g=h.comment)}g&&(p=!0);let x=bs(y,m,()=>g=null);p||(p=l.length>c||x.includes(`
48
+ `)),u<t.length-1?x+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(p||(p=l.reduce((h,b)=>h+b.length+2,2)+(x.length+2)>e.options.lineWidth)),p&&(x+=",")),g&&(x+=rs(x,r,a(g))),l.push(x),c=l.length}let{start:f,end:d}=s;if(l.length===0)return f+d;if(!p){let u=l.reduce((y,g)=>y+g.length+2,2);p=e.options.lineWidth>0&&u>e.options.lineWidth}if(p){let u=f;for(let y of l)u+=y?`
49
+ ${o}${i}${y}`:`
50
50
  `;return`${u}
51
- ${i}${m}`}else return`${f}${s}${p.join(" ")}${s}${m}`}function zi({indent:t,options:{commentString:e}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,"")),r){let o=us(e(r),t);n.push(o.trimStart())}}function fn(t,e){let n=ze(e)?e.value:e;for(let r of t)if(Be(r)&&(r.key===e||r.key===n||ze(r.key)&&r.key.value===n))return r}var Tt=class extends Gn{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super($s,e),this.items=[]}static from(e,n,r){let{keepUndefined:i,replacer:o}=r,s=new this(e),a=(d,c)=>{if(typeof o=="function")c=o.call(n,d,c);else if(Array.isArray(o)&&!o.includes(d))return;(c!==void 0||i)&&s.items.push(Yn(d,c,r))};if(n instanceof Map)for(let[d,c]of n)a(d,c);else if(n&&typeof n=="object")for(let d of Object.keys(n))a(d,n[d]);return typeof e.sortMapEntries=="function"&&s.items.sort(e.sortMapEntries),s}add(e,n){let r;Be(e)?r=e:!e||typeof e!="object"||!("key"in e)?r=new At(e,e?.value):r=new At(e.key,e.value);let i=fn(this.items,r.key),o=this.schema?.sortMapEntries;if(i){if(!n)throw new Error(`Key ${r.key} already set`);ze(i.value)&&Pi(r.value)?i.value.value=r.value:i.value=r.value}else if(o){let s=this.items.findIndex(a=>o(r,a)<0);s===-1?this.items.push(r):this.items.splice(s,0,r)}else this.items.push(r)}delete(e){let n=fn(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){let i=fn(this.items,e)?.value;return(!n&&ze(i)?i.value:i)??void 0}has(e){return!!fn(this.items,e)}set(e,n){this.add(new At(e,n),!0)}toJSON(e,n,r){let i=r?new r:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(i);for(let o of this.items)Ii(n,i,o);return i}toString(e,n,r){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Be(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})),Ci(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:n})}};var Ms={collection:"map",default:!0,nodeClass:Tt,tag:"tag:yaml.org,2002:map",resolve(t,e){return es(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,n)=>Tt.from(t,e,n)};var Zt=class extends Gn{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Ws,e),this.items=[]}add(e){this.items.push(e)}delete(e){let n=Li(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){let r=Li(e);if(typeof r!="number")return;let i=this.items[r];return!n&&ze(i)?i.value:i}has(e){let n=Li(e);return typeof n=="number"&&n<this.items.length}set(e,n){let r=Li(e);if(typeof r!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[r];ze(i)&&Pi(n)?i.value=n:this.items[r]=n}toJSON(e,n){let r=[];n?.onCreate&&n.onCreate(r);let i=0;for(let o of this.items)r.push(Ft(o,String(i++),n));return r}toString(e,n,r){return e?Ci(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:r,onComment:n}):JSON.stringify(this)}static from(e,n,r){let{replacer:i}=r,o=new this(e);if(n&&Symbol.iterator in Object(n)){let s=0;for(let a of n){if(typeof i=="function"){let d=n instanceof Set?a:String(s++);a=i.call(n,d,a)}o.items.push(Xs(a,void 0,r))}}return o}};function Li(t){let e=ze(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}var Os={collection:"seq",default:!0,nodeClass:Zt,tag:"tag:yaml.org,2002:seq",resolve(t,e){return ts(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,n)=>Zt.from(t,e,n)};var dn={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,n,r){return e=Object.assign({actualString:!0},e),An(t,e,n,r)}};var Mn={identify:t=>t==null,createNode:()=>new be(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new be(null),stringify:({source:t},e)=>typeof t=="string"&&Mn.test.test(t)?t:e.options.nullStr};var Nr={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new be(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},n){if(t&&Nr.test.test(t)){let r=t[0]==="t"||t[0]==="T";if(e===r)return t}return e?n.options.trueStr:n.options.falseStr}};function Ut({format:t,minFractionDigits:e,tag:n,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&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let s=o.indexOf(".");s<0&&(s=o.length,o+=".");let a=e-(o.length-s-1);for(;a-- >0;)o+="0"}return o}var _i={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:Ut},Fi={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():Ut(t)}},ji={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 be(parseFloat(t)),n=t.indexOf(".");return n!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-n-1),e},stringify:Ut};var Bi=t=>typeof t=="bigint"||Number.isInteger(t),ya=(t,e,n,{intAsBigInt:r})=>r?BigInt(t):parseInt(t.substring(e),n);function pc(t,e,n){let{value:r}=t;return Bi(r)&&r>=0?n+r.toString(e):Ut(t)}var Di={identify:t=>Bi(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>ya(t,2,8,n),stringify:t=>pc(t,8,"0o")},Vi={identify:Bi,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>ya(t,0,10,n),stringify:Ut},Ki={identify:t=>Bi(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>ya(t,2,16,n),stringify:t=>pc(t,16,"0x")};var fc=[Ms,Os,dn,Mn,Nr,Di,Vi,Ki,_i,Fi,ji];function dc(t){return typeof t=="bigint"||Number.isInteger(t)}var qi=({value:t})=>JSON.stringify(t),Kf=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:qi},{identify:t=>t==null,createNode:()=>new be(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:qi},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:qi},{identify:dc,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:n})=>n?BigInt(t):parseInt(t,10),stringify:({value:t})=>dc(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:qi}],qf={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},mc=[Ms,Os].concat(Kf,qf);var Rr={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof atob=="function"){let n=atob(t.replace(/[\n\r]/g,"")),r=new Uint8Array(n.length);for(let i=0;i<n.length;++i)r[i]=n.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:n},r,i,o){if(!n)return"";let s=n,a;if(typeof btoa=="function"){let d="";for(let c=0;c<s.length;++c)d+=String.fromCharCode(s[c]);a=btoa(d)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=be.BLOCK_LITERAL),e!==be.QUOTE_DOUBLE){let d=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),c=Math.ceil(a.length/d),l=new Array(c);for(let p=0,f=0;p<c;++p,f+=d)l[p]=a.substr(f,d);a=l.join(e===be.BLOCK_LITERAL?`
52
- `:" ")}return An({comment:t,type:e,value:a},r,i,o)}};function ga(t,e){if(ts(t))for(let n=0;n<t.items.length;++n){let r=t.items[n];if(!Be(r)){if(es(r)){r.items.length>1&&e("Each pair must have its own sequence indicator");let i=r.items[0]||new At(new be(null));if(r.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${r.commentBefore}
51
+ ${i}${d}`}else return`${f}${n}${l.join(" ")}${n}${d}`}function No({indent:t,options:{commentString:e}},s,r,i){if(r&&i&&(r=r.replace(/^\n+/,"")),r){let o=vn(e(r),t);s.push(o.trimStart())}}function Es(t,e){let s=Ge(e)?e.value:e;for(let r of t)if(Qe(r)&&(r.key===e||r.key===s||Ge(r.key)&&r.key.value===s))return r}var jt=class extends hr{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(_n,e),this.items=[]}static from(e,s,r){let{keepUndefined:i,replacer:o}=r,n=new this(e),a=(m,p)=>{if(typeof o=="function")p=o.call(s,m,p);else if(Array.isArray(o)&&!o.includes(m))return;(p!==void 0||i)&&n.items.push(br(m,p,r))};if(s instanceof Map)for(let[m,p]of s)a(m,p);else if(s&&typeof s=="object")for(let m of Object.keys(s))a(m,s[m]);return typeof e.sortMapEntries=="function"&&n.items.sort(e.sortMapEntries),n}add(e,s){let r;Qe(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=Es(this.items,r.key),o=this.schema?.sortMapEntries;if(i){if(!s)throw new Error(`Key ${r.key} already set`);Ge(i.value)&&$o(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=Es(this.items,e);return s?this.items.splice(this.items.indexOf(s),1).length>0:!1}get(e,s){let i=Es(this.items,e)?.value;return(!s&&Ge(i)?i.value:i)??void 0}has(e){return!!Es(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)Eo(s,i,o);return i}toString(e,s,r){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Qe(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})),Ro(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:s})}};var Bn={collection:"map",default:!0,nodeClass:jt,tag:"tag:yaml.org,2002:map",resolve(t,e){return cn(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,s)=>jt.from(t,e,s)};var Qt=class extends hr{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(hs,e),this.items=[]}add(e){this.items.push(e)}delete(e){let s=Io(e);return typeof s!="number"?!1:this.items.splice(s,1).length>0}get(e,s){let r=Io(e);if(typeof r!="number")return;let i=this.items[r];return!s&&Ge(i)?i.value:i}has(e){let s=Io(e);return typeof s=="number"&&s<this.items.length}set(e,s){let r=Io(e);if(typeof r!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[r];Ge(i)&&$o(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?Ro(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 m=s instanceof Set?a:String(n++);a=i.call(s,m,a)}o.items.push(gs(a,void 0,r))}}return o}};function Io(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 qn={collection:"seq",default:!0,nodeClass:Qt,tag:"tag:yaml.org,2002:seq",resolve(t,e){return pn(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,s)=>Qt.from(t,e,s)};var Ns={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),Ys(t,e,s,r)}};var Hs={identify:t=>t==null,createNode:()=>new ze(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new ze(null),stringify:({source:t},e)=>typeof t=="string"&&Hs.test.test(t)?t:e.options.nullStr};var ui={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new ze(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},s){if(t&&ui.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 zo={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},Co={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)}},jo={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 ze(parseFloat(t)),s=t.indexOf(".");return s!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-s-1),e},stringify:en};var Lo=t=>typeof t=="bigint"||Number.isInteger(t),xl=(t,e,s,{intAsBigInt:r})=>r?BigInt(t):parseInt(t.substring(e),s);function Pp(t,e,s){let{value:r}=t;return Lo(r)&&r>=0?s+r.toString(e):en(t)}var _o={identify:t=>Lo(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,s)=>xl(t,2,8,s),stringify:t=>Pp(t,8,"0o")},Fo={identify:Lo,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,s)=>xl(t,0,10,s),stringify:en},Do={identify:t=>Lo(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,s)=>xl(t,2,16,s),stringify:t=>Pp(t,16,"0x")};var Op=[Bn,qn,Ns,Hs,ui,_o,Fo,Do,zo,Co,jo];function Ap(t){return typeof t=="bigint"||Number.isInteger(t)}var Bo=({value:t})=>JSON.stringify(t),Rm=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Bo},{identify:t=>t==null,createNode:()=>new ze(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Bo},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Bo},{identify:Ap,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})=>Ap(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:Bo}],Im={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Tp=[Bn,qn].concat(Rm,Im);var hi={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 m="";for(let p=0;p<n.length;++p)m+=String.fromCharCode(n[p]);a=btoa(m)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=ze.BLOCK_LITERAL),e!==ze.QUOTE_DOUBLE){let m=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),p=Math.ceil(a.length/m),c=new Array(p);for(let l=0,f=0;l<p;++l,f+=m)c[l]=a.substr(f,m);a=c.join(e===ze.BLOCK_LITERAL?`
52
+ `:" ")}return Ys({comment:t,type:e,value:a},r,i,o)}};function kl(t,e){if(pn(t))for(let s=0;s<t.items.length;++s){let r=t.items[s];if(!Qe(r)){if(cn(r)){r.items.length>1&&e("Each pair must have its own sequence indicator");let i=r.items[0]||new Et(new ze(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[n]=Be(r)?r:new At(r)}}else e("Expected a sequence for this tag");return t}function ba(t,e,n){let{replacer:r}=n,i=new Zt(t);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let s of e){typeof r=="function"&&(s=r.call(e,String(o++),s));let a,d;if(Array.isArray(s))if(s.length===2)a=s[0],d=s[1];else throw new TypeError(`Expected [key, value] tuple: ${s}`);else if(s&&s instanceof Object){let c=Object.keys(s);if(c.length===1)a=c[0],d=s[a];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else a=s;i.items.push(Yn(a,d,n))}return i}var Ir={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:ga,createNode:ba};var Hn=class t extends Zt{constructor(){super(),this.add=Tt.prototype.add.bind(this),this.delete=Tt.prototype.delete.bind(this),this.get=Tt.prototype.get.bind(this),this.has=Tt.prototype.has.bind(this),this.set=Tt.prototype.set.bind(this),this.tag=t.tag}toJSON(e,n){if(!n)return super.toJSON(e);let r=new Map;n?.onCreate&&n.onCreate(r);for(let i of this.items){let o,s;if(Be(i)?(o=Ft(i.key,"",n),s=Ft(i.value,o,n)):o=Ft(i,"",n),r.has(o))throw new Error("Ordered maps must not include duplicate keys");r.set(o,s)}return r}static from(e,n,r){let i=ba(e,n,r),o=new this;return o.items=i.items,o}};Hn.tag="tag:yaml.org,2002:omap";var zr={collection:"seq",identify:t=>t instanceof Map,nodeClass:Hn,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=ga(t,e),r=[];for(let{key:i}of n.items)ze(i)&&(r.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):r.push(i.value));return Object.assign(new Hn,n)},createNode:(t,e,n)=>Hn.from(t,e,n)};function uc({value:t,source:e},n){return e&&(t?wa:xa).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var wa={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 be(!0),stringify:uc},xa={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 be(!1),stringify:uc};var hc={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:Ut},yc={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():Ut(t)}},gc={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 be(parseFloat(t.replace(/_/g,""))),n=t.indexOf(".");if(n!==-1){let r=t.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(e.minFractionDigits=r.length)}return e},stringify:Ut};var Cr=t=>typeof t=="bigint"||Number.isInteger(t);function Gi(t,e,n,{intAsBigInt:r}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),r){switch(n){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let s=BigInt(t);return i==="-"?BigInt(-1)*s:s}let o=parseInt(t,n);return i==="-"?-1*o:o}function ka(t,e,n){let{value:r}=t;if(Cr(r)){let i=r.toString(e);return r<0?"-"+n+i.substr(1):n+i}return Ut(t)}var bc={identify:Cr,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>Gi(t,2,2,n),stringify:t=>ka(t,2,"0b")},wc={identify:Cr,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>Gi(t,1,8,n),stringify:t=>ka(t,8,"0")},xc={identify:Cr,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>Gi(t,0,10,n),stringify:Ut},kc={identify:Cr,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>Gi(t,2,16,n),stringify:t=>ka(t,16,"0x")};var Wn=class t extends Tt{constructor(e){super(e),this.tag=t.tag}add(e){let n;Be(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new At(e.key,null):n=new At(e,null),fn(this.items,n.key)||this.items.push(n)}get(e,n){let r=fn(this.items,e);return!n&&Be(r)?ze(r.key)?r.key.value:r.key:r}set(e,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let r=fn(this.items,e);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new At(e))}toJSON(e,n){return super.toJSON(e,n,Set)}toString(e,n,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),n,r);throw new Error("Set items must all have null values")}static from(e,n,r){let{replacer:i}=r,o=new this(e);if(n&&Symbol.iterator in Object(n))for(let s of n)typeof i=="function"&&(s=i.call(n,s,s)),o.items.push(Yn(s,null,r));return o}};Wn.tag="tag:yaml.org,2002:set";var Lr={collection:"map",identify:t=>t instanceof Set,nodeClass:Wn,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>Wn.from(t,e,n),resolve(t,e){if(es(t)){if(t.hasAllNullValues(!0))return Object.assign(new Wn,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};function Sa(t,e){let n=t[0],r=n==="-"||n==="+"?t.substring(1):t,i=s=>e?BigInt(s):Number(s),o=r.replace(/_/g,"").split(":").reduce((s,a)=>s*i(60)+i(a),i(0));return n==="-"?i(-1)*o:o}function Sc(t){let{value:e}=t,n=s=>s;if(typeof e=="bigint")n=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return Ut(t);let r="";e<0&&(r="-",e*=n(-1));let i=n(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(s=>String(s).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Zi={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:n})=>Sa(t,n),stringify:Sc},Ui={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=>Sa(t,!1),stringify:Sc},Jn={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(Jn.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,r,i,o,s,a]=e.map(Number),d=e[7]?Number((e[7]+"00").substr(1,3)):0,c=Date.UTC(n,r-1,i,o||0,s||0,a||0,d),l=e[8];if(l&&l!=="Z"){let p=Sa(l,!1);Math.abs(p)<30&&(p*=60),c-=6e4*p}return new Date(c)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};var va=[Ms,Os,dn,Mn,wa,xa,bc,wc,xc,kc,hc,yc,gc,Rr,As,zr,Ir,Lr,Zi,Ui,Jn];var vc=new Map([["core",fc],["failsafe",[Ms,Os,dn]],["json",mc],["yaml11",va],["yaml-1.1",va]]),$c={binary:Rr,bool:Nr,float:ji,floatExp:Fi,floatNaN:_i,floatTime:Ui,int:Vi,intHex:Ki,intOct:Di,intTime:Zi,map:Ms,merge:As,null:Mn,omap:zr,pairs:Ir,seq:Os,set:Lr,timestamp:Jn},Pc={"tag:yaml.org,2002:binary":Rr,"tag:yaml.org,2002:merge":As,"tag:yaml.org,2002:omap":zr,"tag:yaml.org,2002:pairs":Ir,"tag:yaml.org,2002:set":Lr,"tag:yaml.org,2002:timestamp":Jn};function Yi(t,e,n){let r=vc.get(e);if(r&&!t)return n&&!r.includes(As)?r.concat(As):r.slice();let i=r;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(vc.keys()).filter(s=>s!=="yaml11").map(s=>JSON.stringify(s)).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 n&&(i=i.concat(As)),i.reduce((o,s)=>{let a=typeof s=="string"?$c[s]:s;if(!a){let d=JSON.stringify(s),c=Object.keys($c).map(l=>JSON.stringify(l)).join(", ");throw new Error(`Unknown custom tag ${d}; use one of ${c}`)}return o.includes(a)||o.push(a),o},[])}var Gf=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,_r=class t{constructor({compat:e,customTags:n,merge:r,resolveKnownTags:i,schema:o,sortMapEntries:s,toStringDefaults:a}){this.compat=Array.isArray(e)?Yi(e,"compat"):e?Yi(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?Pc:{},this.tags=Yi(n,this.name,r),this.toStringOptions=a??null,Object.defineProperty(this,$s,{value:Ms}),Object.defineProperty(this,as,{value:dn}),Object.defineProperty(this,Ws,{value:Os}),this.sortMapEntries=typeof s=="function"?s:s===!0?Gf:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};function Ac(t,e){let n=[],r=e.directives===!0;if(e.directives!==!1&&t.directives){let d=t.directives.toString(t);d?(n.push(d),r=!0):t.directives.docStart&&(r=!0)}r&&n.push("---");let i=Ti(t,e),{commentString:o}=i.options;if(t.commentBefore){n.length!==1&&n.unshift("");let d=o(t.commentBefore);n.unshift(us(d,""))}let s=!1,a=null;if(t.contents){if(Ze(t.contents)){if(t.contents.spaceBefore&&r&&n.push(""),t.contents.commentBefore){let l=o(t.contents.commentBefore);n.push(us(l,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let d=a?void 0:()=>s=!0,c=Qs(t.contents,i,()=>a=null,d);a&&(c+=js(c,"",o(a))),(c[0]==="|"||c[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(Qs(t.contents,i));if(t.directives?.docEnd)if(t.comment){let d=o(t.comment);d.includes(`
55
- `)?(n.push("..."),n.push(us(d,""))):n.push(`... ${d}`)}else n.push("...");else{let d=t.comment;d&&s&&(d=d.replace(/^\n+/,"")),d&&((!s||a)&&n[n.length-1]!==""&&n.push(""),n.push(us(o(d),"")))}return n.join(`
54
+ ${o.comment}`:r.comment}r=i}t.items[s]=Qe(r)?r:new Et(r)}}else e("Expected a sequence for this tag");return t}function $l(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,m;if(Array.isArray(n))if(n.length===2)a=n[0],m=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],m=n[a];else throw new TypeError(`Expected tuple with one key, not ${p.length} keys`)}else a=n;i.items.push(br(a,m,s))}return i}var yi={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:kl,createNode:$l};var wr=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(Qe(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=$l(e,s,r),o=new this;return o.items=i.items,o}};wr.tag="tag:yaml.org,2002:omap";var gi={collection:"seq",identify:t=>t instanceof Map,nodeClass:wr,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let s=kl(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 wr,s)},createNode:(t,e,s)=>wr.from(t,e,s)};function Ep({value:t,source:e},s){return e&&(t?Sl:vl).test.test(e)?e:t?s.options.trueStr:s.options.falseStr}var Sl={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 ze(!0),stringify:Ep},vl={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 ze(!1),stringify:Ep};var Np={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},Rp={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)}},Ip={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 ze(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 bi=t=>typeof t=="bigint"||Number.isInteger(t);function qo(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 Ml(t,e,s){let{value:r}=t;if(bi(r)){let i=r.toString(e);return r<0?"-"+s+i.substr(1):s+i}return en(t)}var zp={identify:bi,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,s)=>qo(t,2,2,s),stringify:t=>Ml(t,2,"0b")},Cp={identify:bi,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,s)=>qo(t,1,8,s),stringify:t=>Ml(t,8,"0")},jp={identify:bi,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,s)=>qo(t,0,10,s),stringify:en},Lp={identify:bi,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,s)=>qo(t,2,16,s),stringify:t=>Ml(t,16,"0x")};var xr=class t extends jt{constructor(e){super(e),this.tag=t.tag}add(e){let s;Qe(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),Es(this.items,s.key)||this.items.push(s)}get(e,s){let r=Es(this.items,e);return!s&&Qe(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=Es(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(br(n,null,r));return o}};xr.tag="tag:yaml.org,2002:set";var wi={collection:"map",identify:t=>t instanceof Set,nodeClass:xr,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,s)=>xr.from(t,e,s),resolve(t,e){if(cn(t)){if(t.hasAllNullValues(!0))return Object.assign(new xr,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};function Pl(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 _p(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 Vo={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})=>Pl(t,s),stringify:_p},Ko={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=>Pl(t,!1),stringify:_p},kr={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(kr.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),m=e[7]?Number((e[7]+"00").substr(1,3)):0,p=Date.UTC(s,r-1,i,o||0,n||0,a||0,m),c=e[8];if(c&&c!=="Z"){let l=Pl(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 Ol=[Bn,qn,Ns,Hs,Sl,vl,zp,Cp,jp,Lp,Np,Rp,Ip,hi,Dn,gi,yi,wi,Vo,Ko,kr];var Fp=new Map([["core",Op],["failsafe",[Bn,qn,Ns]],["json",Tp],["yaml11",Ol],["yaml-1.1",Ol]]),Dp={binary:hi,bool:ui,float:jo,floatExp:Co,floatNaN:zo,floatTime:Ko,int:Fo,intHex:Do,intOct:_o,intTime:Vo,map:Bn,merge:Dn,null:Hs,omap:gi,pairs:yi,seq:qn,set:wi,timestamp:kr},Bp={"tag:yaml.org,2002:binary":hi,"tag:yaml.org,2002:merge":Dn,"tag:yaml.org,2002:omap":gi,"tag:yaml.org,2002:pairs":yi,"tag:yaml.org,2002:set":wi,"tag:yaml.org,2002:timestamp":kr};function Go(t,e,s){let r=Fp.get(e);if(r&&!t)return s&&!r.includes(Dn)?r.concat(Dn):r.slice();let i=r;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(Fp.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(Dn)),i.reduce((o,n)=>{let a=typeof n=="string"?Dp[n]:n;if(!a){let m=JSON.stringify(n),p=Object.keys(Dp).map(c=>JSON.stringify(c)).join(", ");throw new Error(`Unknown custom tag ${m}; use one of ${p}`)}return o.includes(a)||o.push(a),o},[])}var zm=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,xi=class t{constructor({compat:e,customTags:s,merge:r,resolveKnownTags:i,schema:o,sortMapEntries:n,toStringDefaults:a}){this.compat=Array.isArray(e)?Go(e,"compat"):e?Go(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?Bp:{},this.tags=Go(s,this.name,r),this.toStringOptions=a??null,Object.defineProperty(this,_n,{value:Bn}),Object.defineProperty(this,gn,{value:Ns}),Object.defineProperty(this,hs,{value:qn}),this.sortMapEntries=typeof n=="function"?n:n===!0?zm:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};function qp(t,e){let s=[],r=e.directives===!0;if(e.directives!==!1&&t.directives){let m=t.directives.toString(t);m?(s.push(m),r=!0):t.directives.docStart&&(r=!0)}r&&s.push("---");let i=Oo(t,e),{commentString:o}=i.options;if(t.commentBefore){s.length!==1&&s.unshift("");let m=o(t.commentBefore);s.unshift(vn(m,""))}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(vn(c,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let m=a?void 0:()=>n=!0,p=bs(t.contents,i,()=>a=null,m);a&&(p+=rs(p,"",o(a))),(p[0]==="|"||p[0]===">")&&s[s.length-1]==="---"?s[s.length-1]=`--- ${p}`:s.push(p)}else s.push(bs(t.contents,i));if(t.directives?.docEnd)if(t.comment){let m=o(t.comment);m.includes(`
55
+ `)?(s.push("..."),s.push(vn(m,""))):s.push(`... ${m}`)}else s.push("...");else{let m=t.comment;m&&n&&(m=m.replace(/^\n+/,"")),m&&((!n||a)&&s[s.length-1]!==""&&s.push(""),s.push(vn(o(m),"")))}return s.join(`
56
56
  `)+`
57
- `}var mn=class t{constructor(e,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Jt,{value:xi});let i=null;typeof n=="function"||Array.isArray(n)?i=n:r===void 0&&n&&(r=n,n=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:s}=o;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(s=this.directives.yaml.version)):this.directives=new Fs({version:s}),this.setSchema(s,r),this.contents=e===void 0?null:this.createNode(e,i,r)}clone(){let e=Object.create(t.prototype,{[Jt]:{value:xi}});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=Ze(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Xn(this.contents)&&this.contents.add(e)}addIn(e,n){Xn(this.contents)&&this.contents.addIn(e,n)}createAlias(e,n){if(!e.anchor){let r=ca(this);e.anchor=!n||r.has(n)?pa(n||"a",r):n}return new Js(e.anchor)}createNode(e,n,r){let i;if(typeof n=="function")e=n.call({"":e},"",e),i=n;else if(Array.isArray(n)){let y=g=>typeof g=="number"||g instanceof String||g instanceof Number,v=n.filter(y).map(String);v.length>0&&(n=n.concat(v)),i=n}else r===void 0&&n&&(r=n,n=void 0);let{aliasDuplicateObjects:o,anchorPrefix:s,flow:a,keepUndefined:d,onTagObj:c,tag:l}=r??{},{onAnchor:p,setAnchors:f,sourceObjects:m}=rc(this,s||"a"),u={aliasDuplicateObjects:o??!0,keepUndefined:d??!1,onAnchor:p,onTagObj:c,replacer:i,schema:this.schema,sourceObjects:m},h=Xs(e,l,u);return a&&et(h)&&(h.flow=!0),f(),h}createPair(e,n,r={}){let i=this.createNode(e,null,r),o=this.createNode(n,null,r);return new At(i,o)}delete(e){return Xn(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Zn(e)?this.contents==null?!1:(this.contents=null,!0):Xn(this.contents)?this.contents.deleteIn(e):!1}get(e,n){return et(this.contents)?this.contents.get(e,n):void 0}getIn(e,n){return Zn(e)?!n&&ze(this.contents)?this.contents.value:this.contents:et(this.contents)?this.contents.getIn(e,n):void 0}has(e){return et(this.contents)?this.contents.has(e):!1}hasIn(e){return Zn(e)?this.contents!==void 0:et(this.contents)?this.contents.hasIn(e):!1}set(e,n){this.contents==null?this.contents=Mr(this.schema,[e],n):Xn(this.contents)&&this.contents.set(e,n)}setIn(e,n){Zn(e)?this.contents=n:this.contents==null?this.contents=Mr(this.schema,Array.from(e),n):Xn(this.contents)&&this.contents.setIn(e,n)}setSchema(e,n={}){typeof e=="number"&&(e=String(e));let r;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Fs({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 Fs({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(n.schema instanceof Object)this.schema=n.schema;else if(r)this.schema=new _r(Object.assign(r,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:n,mapAsMap:r,maxAliasCount:i,onAnchor:o,reviver:s}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},d=Ft(this.contents,n??"",a);if(typeof o=="function")for(let{count:c,res:l}of a.anchors.values())o(l,c);return typeof s=="function"?cn(s,{"":d},"",d):d}toJSON(e,n){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:n})}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 n=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return Ac(this,e)}};function Xn(t){if(et(t))return!0;throw new Error("Expected a YAML collection as document contents")}var Fr=class extends Error{constructor(e,n,r,i){super(),this.name=e,this.code=r,this.message=i,this.pos=n}},Es=class extends Fr{constructor(e,n,r){super("YAMLParseError",e,n,r)}},jr=class extends Fr{constructor(e,n,r){super("YAMLWarning",e,n,r)}},$a=(t,e)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(a=>e.linePos(a));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let o=i-1,s=t.substring(e.lineStarts[r-1],e.lineStarts[r]).replace(/[\n\r]+$/,"");if(o>=60&&s.length>80){let a=Math.min(o-39,s.length-79);s="\u2026"+s.substring(a),o-=a-1}if(s.length>80&&(s=s.substring(0,79)+"\u2026"),r>1&&/^ *$/.test(s.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
- `),s=a+s}if(/[^ ]/.test(s)){let a=1,d=n.linePos[1];d?.line===r&&d.col>i&&(a=Math.max(1,Math.min(d.col-i,80-o)));let c=" ".repeat(o)+"^".repeat(a);n.message+=`:
57
+ `}var Rs=class t{constructor(e,s,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,rn,{value:go});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 ss({version:n}),this.setSchema(n,r),this.contents=e===void 0?null:this.createNode(e,i,r)}clone(){let e=Object.create(t.prototype,{[rn]:{value:go}});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){$r(this.contents)&&this.contents.add(e)}addIn(e,s){$r(this.contents)&&this.contents.addIn(e,s)}createAlias(e,s){if(!e.anchor){let r=ml(this);e.anchor=!s||r.has(s)?ul(s||"a",r):s}return new ys(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=h=>typeof h=="number"||h instanceof String||h instanceof Number,x=s.filter(g).map(String);x.length>0&&(s=s.concat(x)),i=s}else r===void 0&&s&&(r=s,s=void 0);let{aliasDuplicateObjects:o,anchorPrefix:n,flow:a,keepUndefined:m,onTagObj:p,tag:c}=r??{},{onAnchor:l,setAnchors:f,sourceObjects:d}=xp(this,n||"a"),u={aliasDuplicateObjects:o??!0,keepUndefined:m??!1,onAnchor:l,onTagObj:p,replacer:i,schema:this.schema,sourceObjects:d},y=gs(e,c,u);return a&&ct(y)&&(y.flow=!0),f(),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 $r(this.contents)?this.contents.delete(e):!1}deleteIn(e){return yr(e)?this.contents==null?!1:(this.contents=null,!0):$r(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 yr(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 yr(e)?this.contents!==void 0:ct(this.contents)?this.contents.hasIn(e):!1}set(e,s){this.contents==null?this.contents=pi(this.schema,[e],s):$r(this.contents)&&this.contents.set(e,s)}setIn(e,s){yr(e)?this.contents=s:this.contents==null?this.contents=pi(this.schema,Array.from(e),s):$r(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 ss({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 ss({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 xi(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},m=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"?As(n,{"":m},"",m):m}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 qp(this,e)}};function $r(t){if(ct(t))return!0;throw new Error("Expected a YAML collection as document contents")}var ki=class extends Error{constructor(e,s,r,i){super(),this.name=e,this.code=r,this.message=i,this.pos=s}},Vn=class extends ki{constructor(e,s,r){super("YAMLParseError",e,s,r)}},$i=class extends ki{constructor(e,s,r){super("YAMLWarning",e,s,r)}},Al=(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
+ `),n=a+n}if(/[^ ]/.test(n)){let a=1,m=s.linePos[1];m?.line===r&&m.col>i&&(a=Math.max(1,Math.min(m.col-i,80-o)));let p=" ".repeat(o)+"^".repeat(a);s.message+=`:
59
59
 
60
- ${s}
61
- ${c}
62
- `}};function Bs(t,{flow:e,indicator:n,next:r,offset:i,onError:o,parentIndent:s,startOnNewline:a}){let d=!1,c=a,l=a,p="",f="",m=!1,u=!1,h=null,y=null,v=null,g=null,b=null,$=null,E=null;for(let T of t)switch(u&&(T.type!=="space"&&T.type!=="newline"&&T.type!=="comma"&&o(T.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),u=!1),h&&(c&&T.type!=="comment"&&T.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),T.type){case"space":!e&&(n!=="doc-start"||r?.type!=="flow-collection")&&T.source.includes(" ")&&(h=T),l=!0;break;case"comment":{l||o(T,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let z=T.source.substring(1)||" ";p?p+=f+z:p=z,f="",c=!1;break}case"newline":c?p?p+=T.source:(!$||n!=="seq-item-ind")&&(d=!0):f+=T.source,c=!0,m=!0,(y||v)&&(g=T),l=!0;break;case"anchor":y&&o(T,"MULTIPLE_ANCHORS","A node can have at most one anchor"),T.source.endsWith(":")&&o(T.offset+T.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),y=T,E??(E=T.offset),c=!1,l=!1,u=!0;break;case"tag":{v&&o(T,"MULTIPLE_TAGS","A node can have at most one tag"),v=T,E??(E=T.offset),c=!1,l=!1,u=!0;break}case n:(y||v)&&o(T,"BAD_PROP_ORDER",`Anchors and tags must be after the ${T.source} indicator`),$&&o(T,"UNEXPECTED_TOKEN",`Unexpected ${T.source} in ${e??"collection"}`),$=T,c=n==="seq-item-ind"||n==="explicit-key-ind",l=!1;break;case"comma":if(e){b&&o(T,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),b=T,c=!1,l=!1;break}default:o(T,"UNEXPECTED_TOKEN",`Unexpected ${T.type} token`),c=!1,l=!1}let S=t[t.length-1],k=S?S.offset+S.source.length:i;return u&&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"),h&&(c&&h.indent<=s||r?.type==="block-map"||r?.type==="block-seq")&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:b,found:$,spaceBefore:d,comment:p,hasNewline:m,anchor:y,tag:v,newlineAfterProp:g,end:k,start:E??k}}function un(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 n of e.start)if(n.type==="newline")return!0;if(e.sep){for(let n of e.sep)if(n.type==="newline")return!0}if(un(e.key)||un(e.value))return!0}return!1;default:return!0}}function Br(t,e,n){if(e?.type==="flow-collection"){let r=e.end[0];r.indent===t&&(r.source==="]"||r.source==="}")&&un(e)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function Hi(t,e,n){let{uniqueKeys:r}=t.options;if(r===!1)return!1;let i=typeof r=="function"?r:(o,s)=>o===s||ze(o)&&ze(s)&&o.value===s.value;return e.some(o=>i(o.key,n))}var Mc="All mapping items must start at the same column";function Oc({composeNode:t,composeEmptyNode:e},n,r,i,o){let s=o?.nodeClass??Tt,a=new s(n.schema);n.atRoot&&(n.atRoot=!1);let d=r.offset,c=null;for(let l of r.items){let{start:p,key:f,sep:m,value:u}=l,h=Bs(p,{indicator:"explicit-key-ind",next:f??m?.[0],offset:d,onError:i,parentIndent:r.indent,startOnNewline:!0}),y=!h.found;if(y){if(f&&(f.type==="block-seq"?i(d,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==r.indent&&i(d,"BAD_INDENT",Mc)),!h.anchor&&!h.tag&&!m){c=h.end,h.comment&&(a.comment?a.comment+=`
64
- `+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||un(f))&&i(f??p[p.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==r.indent&&i(d,"BAD_INDENT",Mc);n.atKey=!0;let v=h.end,g=f?t(n,f,h,i):e(n,v,p,null,h,i);n.schema.compat&&Br(r.indent,f,i),n.atKey=!1,Hi(n,a.items,g)&&i(v,"DUPLICATE_KEY","Map keys must be unique");let b=Bs(m??[],{indicator:"map-value-ind",next:u,offset:g.range[2],onError:i,parentIndent:r.indent,startOnNewline:!f||f.type==="block-scalar"});if(d=b.end,b.found){y&&(u?.type==="block-map"&&!b.hasNewline&&i(d,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&h.start<b.found.offset-1024&&i(g.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let $=u?t(n,u,b,i):e(n,d,m,null,b,i);n.schema.compat&&Br(r.indent,u,i),d=$.range[2];let E=new At(g,$);n.options.keepSourceTokens&&(E.srcToken=l),a.items.push(E)}else{y&&i(g.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),b.comment&&(g.comment?g.comment+=`
65
- `+b.comment:g.comment=b.comment);let $=new At(g);n.options.keepSourceTokens&&($.srcToken=l),a.items.push($)}}return c&&c<d&&i(c,"IMPOSSIBLE","Map comment with trailing content"),a.range=[r.offset,d,c??d],a}function Ec({composeNode:t,composeEmptyNode:e},n,r,i,o){let s=o?.nodeClass??Zt,a=new s(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let d=r.offset,c=null;for(let{start:l,value:p}of r.items){let f=Bs(l,{indicator:"seq-item-ind",next:p,offset:d,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||p)p?.type==="block-seq"?i(f.end,"BAD_INDENT","All sequence items must start at the same column"):i(d,"MISSING_CHAR","Sequence item without - indicator");else{c=f.end,f.comment&&(a.comment=f.comment);continue}let m=p?t(n,p,f,i):e(n,f.end,l,null,f,i);n.schema.compat&&Br(r.indent,p,i),d=m.range[2],a.items.push(m)}return a.range=[r.offset,d,c??d],a}function Ds(t,e,n,r){let i="";if(t){let o=!1,s="";for(let a of t){let{source:d,type:c}=a;switch(c){case"space":o=!0;break;case"comment":{n&&!o&&r(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let l=d.substring(1)||" ";i?i+=s+l:i=l,s="";break}case"newline":i&&(s+=d),o=!0;break;default:r(a,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}e+=d.length}}return{comment:i,offset:e}}var Pa="Block collections are not allowed within flow collections",Aa=t=>t&&(t.type==="block-map"||t.type==="block-seq");function Tc({composeNode:t,composeEmptyNode:e},n,r,i,o){let s=r.start.source==="{",a=s?"flow map":"flow sequence",d=o?.nodeClass??(s?Tt:Zt),c=new d(n.schema);c.flow=!0;let l=n.atRoot;l&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let p=r.offset+r.start.source.length;for(let y=0;y<r.items.length;++y){let v=r.items[y],{start:g,key:b,sep:$,value:E}=v,S=Bs(g,{flow:a,indicator:"explicit-key-ind",next:b??$?.[0],offset:p,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!S.found){if(!S.anchor&&!S.tag&&!$&&!E){y===0&&S.comma?i(S.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):y<r.items.length-1&&i(S.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),S.comment&&(c.comment?c.comment+=`
66
- `+S.comment:c.comment=S.comment),p=S.end;continue}!s&&n.options.strict&&un(b)&&i(b,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(y===0)S.comma&&i(S.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(S.comma||i(S.start,"MISSING_CHAR",`Missing , between ${a} items`),S.comment){let k="";e:for(let T of g)switch(T.type){case"comma":case"space":break;case"comment":k=T.source.substring(1);break e;default:break e}if(k){let T=c.items[c.items.length-1];Be(T)&&(T=T.value??T.key),T.comment?T.comment+=`
67
- `+k:T.comment=k,S.comment=S.comment.substring(k.length+1)}}if(!s&&!$&&!S.found){let k=E?t(n,E,S,i):e(n,S.end,$,null,S,i);c.items.push(k),p=k.range[2],Aa(E)&&i(k.range,"BLOCK_IN_FLOW",Pa)}else{n.atKey=!0;let k=S.end,T=b?t(n,b,S,i):e(n,k,g,null,S,i);Aa(b)&&i(T.range,"BLOCK_IN_FLOW",Pa),n.atKey=!1;let z=Bs($??[],{flow:a,indicator:"map-value-ind",next:E,offset:T.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(z.found){if(!s&&!S.found&&n.options.strict){if($)for(let x of $){if(x===z.found)break;if(x.type==="newline"){i(x,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}S.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 E&&("source"in E&&E.source?.[0]===":"?i(E,"MISSING_CHAR",`Missing space after : in ${a}`):i(z.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let A=E?t(n,E,z,i):z.found?e(n,z.end,$,null,z,i):null;A?Aa(E)&&i(A.range,"BLOCK_IN_FLOW",Pa):z.comment&&(T.comment?T.comment+=`
68
- `+z.comment:T.comment=z.comment);let R=new At(T,A);if(n.options.keepSourceTokens&&(R.srcToken=v),s){let x=c;Hi(n,x.items,T)&&i(k,"DUPLICATE_KEY","Map keys must be unique"),x.items.push(R)}else{let x=new Tt(n.schema);x.flow=!0,x.items.push(R);let P=(A??T).range;x.range=[T.range[0],P[1],P[2]],c.items.push(x)}p=A?A.range[2]:z.end}}let f=s?"}":"]",[m,...u]=r.end,h=p;if(m?.source===f)h=m.offset+m.source.length;else{let y=a[0].toUpperCase()+a.substring(1),v=l?`${y} must end with a ${f}`:`${y} in block collection must be sufficiently indented and end with a ${f}`;i(p,l?"MISSING_CHAR":"BAD_INDENT",v),m&&m.source.length!==1&&u.unshift(m)}if(u.length>0){let y=Ds(u,h,n.options.strict,i);y.comment&&(c.comment?c.comment+=`
69
- `+y.comment:c.comment=y.comment),c.range=[r.offset,h,y.offset]}else c.range=[r.offset,h,h];return c}function Ma(t,e,n,r,i,o){let s=n.type==="block-map"?Oc(t,e,n,r,o):n.type==="block-seq"?Ec(t,e,n,r,o):Tc(t,e,n,r,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function Nc(t,e,n,r,i){let o=r.tag,s=o?e.directives.tagName(o.source,f=>i(o,"TAG_RESOLVE_FAILED",f)):null;if(n.type==="block-seq"){let{anchor:f,newlineAfterProp:m}=r,u=f&&o?f.offset>o.offset?f:o:f??o;u&&(!m||m.offset<u.offset)&&i(u,"MISSING_CHAR","Missing newline after block sequence props")}let a=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!o||!s||s==="!"||s===Tt.tagName&&a==="map"||s===Zt.tagName&&a==="seq")return Ma(t,e,n,i,s);let d=e.schema.tags.find(f=>f.tag===s&&f.collection===a);if(!d){let f=e.schema.knownTags[s];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),d=f;else return f?i(o,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),Ma(t,e,n,i,s)}let c=Ma(t,e,n,i,s,d),l=d.resolve?.(c,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??c,p=Ze(l)?l:new be(l);return p.range=c.range,p.tag=s,d?.format&&(p.format=d.format),p}function Oa(t,e,n){let r=e.offset,i=Zf(e,t.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[r,r,r]};let o=i.mode===">"?be.BLOCK_FOLDED:be.BLOCK_LITERAL,s=e.source?Uf(e.source):[],a=s.length;for(let h=s.length-1;h>=0;--h){let y=s[h][1];if(y===""||y==="\r")a=h;else break}if(a===0){let h=i.chomp==="+"&&s.length>0?`
70
- `.repeat(Math.max(1,s.length-1)):"",y=r+i.length;return e.source&&(y+=e.source.length),{value:h,type:o,comment:i.comment,range:[r,y,y]}}let d=e.indent+i.indent,c=e.offset+i.length,l=0;for(let h=0;h<a;++h){let[y,v]=s[h];if(v===""||v==="\r")i.indent===0&&y.length>d&&(d=y.length);else{y.length<d&&n(c+y.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(d=y.length),l=h,d===0&&!t.atRoot&&n(c,"BAD_INDENT","Block scalar values in collections must be indented");break}c+=y.length+v.length+1}for(let h=s.length-1;h>=a;--h)s[h][0].length>d&&(a=h+1);let p="",f="",m=!1;for(let h=0;h<l;++h)p+=s[h][0].slice(d)+`
71
- `;for(let h=l;h<a;++h){let[y,v]=s[h];c+=y.length+v.length+1;let g=v[v.length-1]==="\r";if(g&&(v=v.slice(0,-1)),v&&y.length<d){let $=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;n(c-v.length-(g?2:1),"BAD_INDENT",$),y=""}o===be.BLOCK_LITERAL?(p+=f+y.slice(d)+v,f=`
72
- `):y.length>d||v[0]===" "?(f===" "?f=`
73
- `:!m&&f===`
60
+ ${n}
61
+ ${p}
62
+ `}};function is(t,{flow:e,indicator:s,next:r,offset:i,onError:o,parentIndent:n,startOnNewline:a}){let m=!1,p=a,c=a,l="",f="",d=!1,u=!1,y=null,g=null,x=null,h=null,b=null,w=null,k=null;for(let T of t)switch(u&&(T.type!=="space"&&T.type!=="newline"&&T.type!=="comma"&&o(T.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),u=!1),y&&(p&&T.type!=="comment"&&T.type!=="newline"&&o(y,"TAB_AS_INDENT","Tabs are not allowed as indentation"),y=null),T.type){case"space":!e&&(s!=="doc-start"||r?.type!=="flow-collection")&&T.source.includes(" ")&&(y=T),c=!0;break;case"comment":{c||o(T,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let R=T.source.substring(1)||" ";l?l+=f+R:l=R,f="",p=!1;break}case"newline":p?l?l+=T.source:(!w||s!=="seq-item-ind")&&(m=!0):f+=T.source,p=!0,d=!0,(g||x)&&(h=T),c=!0;break;case"anchor":g&&o(T,"MULTIPLE_ANCHORS","A node can have at most one anchor"),T.source.endsWith(":")&&o(T.offset+T.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=T,k??(k=T.offset),p=!1,c=!1,u=!0;break;case"tag":{x&&o(T,"MULTIPLE_TAGS","A node can have at most one tag"),x=T,k??(k=T.offset),p=!1,c=!1,u=!0;break}case s:(g||x)&&o(T,"BAD_PROP_ORDER",`Anchors and tags must be after the ${T.source} indicator`),w&&o(T,"UNEXPECTED_TOKEN",`Unexpected ${T.source} in ${e??"collection"}`),w=T,p=s==="seq-item-ind"||s==="explicit-key-ind",c=!1;break;case"comma":if(e){b&&o(T,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),b=T,p=!1,c=!1;break}default:o(T,"UNEXPECTED_TOKEN",`Unexpected ${T.type} token`),p=!1,c=!1}let $=t[t.length-1],v=$?$.offset+$.source.length:i;return u&&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:w,spaceBefore:m,comment:l,hasNewline:d,anchor:g,tag:x,newlineAfterProp:h,end:v,start:k??v}}function Is(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(Is(e.key)||Is(e.value))return!0}return!1;default:return!0}}function Si(t,e,s){if(e?.type==="flow-collection"){let r=e.end[0];r.indent===t&&(r.source==="]"||r.source==="}")&&Is(e)&&s(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function Zo(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 Vp="All mapping items must start at the same column";function Kp({composeNode:t,composeEmptyNode:e},s,r,i,o){let n=o?.nodeClass??jt,a=new n(s.schema);s.atRoot&&(s.atRoot=!1);let m=r.offset,p=null;for(let c of r.items){let{start:l,key:f,sep:d,value:u}=c,y=is(l,{indicator:"explicit-key-ind",next:f??d?.[0],offset:m,onError:i,parentIndent:r.indent,startOnNewline:!0}),g=!y.found;if(g){if(f&&(f.type==="block-seq"?i(m,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==r.indent&&i(m,"BAD_INDENT",Vp)),!y.anchor&&!y.tag&&!d){p=y.end,y.comment&&(a.comment?a.comment+=`
64
+ `+y.comment:a.comment=y.comment);continue}(y.newlineAfterProp||Is(f))&&i(f??l[l.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else y.found?.indent!==r.indent&&i(m,"BAD_INDENT",Vp);s.atKey=!0;let x=y.end,h=f?t(s,f,y,i):e(s,x,l,null,y,i);s.schema.compat&&Si(r.indent,f,i),s.atKey=!1,Zo(s,a.items,h)&&i(x,"DUPLICATE_KEY","Map keys must be unique");let b=is(d??[],{indicator:"map-value-ind",next:u,offset:h.range[2],onError:i,parentIndent:r.indent,startOnNewline:!f||f.type==="block-scalar"});if(m=b.end,b.found){g&&(u?.type==="block-map"&&!b.hasNewline&&i(m,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),s.options.strict&&y.start<b.found.offset-1024&&i(h.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let w=u?t(s,u,b,i):e(s,m,d,null,b,i);s.schema.compat&&Si(r.indent,u,i),m=w.range[2];let k=new Et(h,w);s.options.keepSourceTokens&&(k.srcToken=c),a.items.push(k)}else{g&&i(h.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),b.comment&&(h.comment?h.comment+=`
65
+ `+b.comment:h.comment=b.comment);let w=new Et(h);s.options.keepSourceTokens&&(w.srcToken=c),a.items.push(w)}}return p&&p<m&&i(p,"IMPOSSIBLE","Map comment with trailing content"),a.range=[r.offset,m,p??m],a}function Gp({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 m=r.offset,p=null;for(let{start:c,value:l}of r.items){let f=is(c,{indicator:"seq-item-ind",next:l,offset:m,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||l)l?.type==="block-seq"?i(f.end,"BAD_INDENT","All sequence items must start at the same column"):i(m,"MISSING_CHAR","Sequence item without - indicator");else{p=f.end,f.comment&&(a.comment=f.comment);continue}let d=l?t(s,l,f,i):e(s,f.end,c,null,f,i);s.schema.compat&&Si(r.indent,l,i),m=d.range[2],a.items.push(d)}return a.range=[r.offset,m,p??m],a}function os(t,e,s,r){let i="";if(t){let o=!1,n="";for(let a of t){let{source:m,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=m.substring(1)||" ";i?i+=n+c:i=c,n="";break}case"newline":i&&(n+=m),o=!0;break;default:r(a,"UNEXPECTED_TOKEN",`Unexpected ${p} at node end`)}e+=m.length}}return{comment:i,offset:e}}var Tl="Block collections are not allowed within flow collections",El=t=>t&&(t.type==="block-map"||t.type==="block-seq");function Zp({composeNode:t,composeEmptyNode:e},s,r,i,o){let n=r.start.source==="{",a=n?"flow map":"flow sequence",m=o?.nodeClass??(n?jt:Qt),p=new m(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 x=r.items[g],{start:h,key:b,sep:w,value:k}=x,$=is(h,{flow:a,indicator:"explicit-key-ind",next:b??w?.[0],offset:l,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!$.found){if(!$.anchor&&!$.tag&&!w&&!k){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&&Is(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 T of h)switch(T.type){case"comma":case"space":break;case"comment":v=T.source.substring(1);break e;default:break e}if(v){let T=p.items[p.items.length-1];Qe(T)&&(T=T.value??T.key),T.comment?T.comment+=`
67
+ `+v:T.comment=v,$.comment=$.comment.substring(v.length+1)}}if(!n&&!w&&!$.found){let v=k?t(s,k,$,i):e(s,$.end,w,null,$,i);p.items.push(v),l=v.range[2],El(k)&&i(v.range,"BLOCK_IN_FLOW",Tl)}else{s.atKey=!0;let v=$.end,T=b?t(s,b,$,i):e(s,v,h,null,$,i);El(b)&&i(T.range,"BLOCK_IN_FLOW",Tl),s.atKey=!1;let R=is(w??[],{flow:a,indicator:"map-value-ind",next:k,offset:T.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(R.found){if(!n&&!$.found&&s.options.strict){if(w)for(let M of w){if(M===R.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<R.found.offset-1024&&i(R.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else k&&("source"in k&&k.source?.[0]===":"?i(k,"MISSING_CHAR",`Missing space after : in ${a}`):i(R.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let O=k?t(s,k,R,i):R.found?e(s,R.end,w,null,R,i):null;O?El(k)&&i(O.range,"BLOCK_IN_FLOW",Tl):R.comment&&(T.comment?T.comment+=`
68
+ `+R.comment:T.comment=R.comment);let I=new Et(T,O);if(s.options.keepSourceTokens&&(I.srcToken=x),n){let M=p;Zo(s,M.items,T)&&i(v,"DUPLICATE_KEY","Map keys must be unique"),M.items.push(I)}else{let M=new jt(s.schema);M.flow=!0,M.items.push(I);let A=(O??T).range;M.range=[T.range[0],A[1],A[2]],p.items.push(M)}l=O?O.range[2]:R.end}}let f=n?"}":"]",[d,...u]=r.end,y=l;if(d?.source===f)y=d.offset+d.source.length;else{let g=a[0].toUpperCase()+a.substring(1),x=c?`${g} must end with a ${f}`:`${g} in block collection must be sufficiently indented and end with a ${f}`;i(l,c?"MISSING_CHAR":"BAD_INDENT",x),d&&d.source.length!==1&&u.unshift(d)}if(u.length>0){let g=os(u,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 Nl(t,e,s,r,i,o){let n=s.type==="block-map"?Kp(t,e,s,r,o):s.type==="block-seq"?Gp(t,e,s,r,o):Zp(t,e,s,r,o),a=n.constructor;return i==="!"||i===a.tagName?(n.tag=a.tagName,n):(i&&(n.tag=i),n)}function Up(t,e,s,r,i){let o=r.tag,n=o?e.directives.tagName(o.source,f=>i(o,"TAG_RESOLVE_FAILED",f)):null;if(s.type==="block-seq"){let{anchor:f,newlineAfterProp:d}=r,u=f&&o?f.offset>o.offset?f:o:f??o;u&&(!d||d.offset<u.offset)&&i(u,"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 Nl(t,e,s,i,n);let m=e.schema.tags.find(f=>f.tag===n&&f.collection===a);if(!m){let f=e.schema.knownTags[n];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),m=f;else return f?i(o,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,!0),Nl(t,e,s,i,n)}let p=Nl(t,e,s,i,n,m),c=m.resolve?.(p,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??p,l=nt(c)?c:new ze(c);return l.range=p.range,l.tag=n,m?.format&&(l.format=m.format),l}function Rl(t,e,s){let r=e.offset,i=Cm(e,t.options.strict,s);if(!i)return{value:"",type:null,comment:"",range:[r,r,r]};let o=i.mode===">"?ze.BLOCK_FOLDED:ze.BLOCK_LITERAL,n=e.source?jm(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
+ `.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 m=e.indent+i.indent,p=e.offset+i.length,c=0;for(let y=0;y<a;++y){let[g,x]=n[y];if(x===""||x==="\r")i.indent===0&&g.length>m&&(m=g.length);else{g.length<m&&s(p+g.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(m=g.length),c=y,m===0&&!t.atRoot&&s(p,"BAD_INDENT","Block scalar values in collections must be indented");break}p+=g.length+x.length+1}for(let y=n.length-1;y>=a;--y)n[y][0].length>m&&(a=y+1);let l="",f="",d=!1;for(let y=0;y<c;++y)l+=n[y][0].slice(m)+`
71
+ `;for(let y=c;y<a;++y){let[g,x]=n[y];p+=g.length+x.length+1;let h=x[x.length-1]==="\r";if(h&&(x=x.slice(0,-1)),x&&g.length<m){let w=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;s(p-x.length-(h?2:1),"BAD_INDENT",w),g=""}o===ze.BLOCK_LITERAL?(l+=f+g.slice(m)+x,f=`
72
+ `):g.length>m||x[0]===" "?(f===" "?f=`
73
+ `:!d&&f===`
74
74
  `&&(f=`
75
75
 
76
- `),p+=f+y.slice(d)+v,f=`
77
- `,m=!0):v===""?f===`
78
- `?p+=`
76
+ `),l+=f+g.slice(m)+x,f=`
77
+ `,d=!0):x===""?f===`
78
+ `?l+=`
79
79
  `:f=`
80
- `:(p+=f+v,f=" ",m=!1)}switch(i.chomp){case"-":break;case"+":for(let h=a;h<s.length;++h)p+=`
81
- `+s[h][0].slice(d);p[p.length-1]!==`
82
- `&&(p+=`
83
- `);break;default:p+=`
84
- `}let u=r+i.length+e.source.length;return{value:p,type:o,comment:i.comment,range:[r,u,u]}}function Zf({offset:t,props:e},n,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],s=0,a="",d=-1;for(let f=1;f<i.length;++f){let m=i[f];if(!a&&(m==="-"||m==="+"))a=m;else{let u=Number(m);!s&&u?s=u:d===-1&&(d=t+f)}}d!==-1&&r(d,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let c=!1,l="",p=i.length;for(let f=1;f<e.length;++f){let m=e[f];switch(m.type){case"space":c=!0;case"newline":p+=m.source.length;break;case"comment":n&&!c&&r(m,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),p+=m.source.length,l=m.source.substring(1);break;case"error":r(m,"UNEXPECTED_TOKEN",m.message),p+=m.source.length;break;default:{let u=`Unexpected token in block scalar header: ${m.type}`;r(m,"UNEXPECTED_TOKEN",u);let h=m.source;h&&typeof h=="string"&&(p+=h.length)}}}return{mode:o,indent:s,chomp:a,comment:l,length:p}}function Uf(t){let e=t.split(/\n( *)/),n=e[0],r=n.match(/^( *)/),o=[r?.[1]?[r[1],n.slice(r[1].length)]:["",n]];for(let s=1;s<e.length;s+=2)o.push([e[s],e[s+1]]);return o}function Ea(t,e,n){let{offset:r,type:i,source:o,end:s}=t,a,d,c=(f,m,u)=>n(r+f,m,u);switch(i){case"scalar":a=be.PLAIN,d=Yf(o,c);break;case"single-quoted-scalar":a=be.QUOTE_SINGLE,d=Hf(o,c);break;case"double-quoted-scalar":a=be.QUOTE_DOUBLE,d=Wf(o,c);break;default:return n(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[r,r+o.length,r+o.length]}}let l=r+o.length,p=Ds(s,l,e,n);return{value:d,type:a,comment:p.comment,range:[r,l,p.offset]}}function Yf(t,e){let n="";switch(t[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${t[0]}`;break}case"@":case"`":{n=`reserved character ${t[0]}`;break}}return n&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),Rc(t)}function Hf(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),Rc(t.slice(1,-1)).replace(/''/g,"'")}function Rc(t){let e=/(.*?)\r?\n/sy,n=e.exec(t);if(!n)return t;let r,i;try{r=new RegExp("(?<![ ])[ ]+$"),i=new RegExp("^[ ]+|(?<![ ])[ ]+$","g")}catch{r=/[ \t]+$/,i=/^[ \t]+|[ \t]+$/g}let o=n[1].replace(r,""),s=" ",a=e.lastIndex;for(;n=e.exec(t);){let c=n[1].replace(i,"");c===""?s===`
85
- `?o+=s:s=`
86
- `:(o+=s+c,s=" "),a=e.lastIndex}let d=/[ \t]*(.*)/sy;return d.lastIndex=a,n=d.exec(t),o+s+(n?.[1]??"")}function Wf(t,e){let n="";for(let r=1;r<t.length-1;++r){let i=t[r];if(!(i==="\r"&&t[r+1]===`
80
+ `:(l+=f+x,f=" ",d=!1)}switch(i.chomp){case"-":break;case"+":for(let y=a;y<n.length;++y)l+=`
81
+ `+n[y][0].slice(m);l[l.length-1]!==`
82
+ `&&(l+=`
83
+ `);break;default:l+=`
84
+ `}let u=r+i.length+e.source.length;return{value:l,type:o,comment:i.comment,range:[r,u,u]}}function Cm({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="",m=-1;for(let f=1;f<i.length;++f){let d=i[f];if(!a&&(d==="-"||d==="+"))a=d;else{let u=Number(d);!n&&u?n=u:m===-1&&(m=t+f)}}m!==-1&&r(m,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let p=!1,c="",l=i.length;for(let f=1;f<e.length;++f){let d=e[f];switch(d.type){case"space":p=!0;case"newline":l+=d.source.length;break;case"comment":s&&!p&&r(d,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),l+=d.source.length,c=d.source.substring(1);break;case"error":r(d,"UNEXPECTED_TOKEN",d.message),l+=d.source.length;break;default:{let u=`Unexpected token in block scalar header: ${d.type}`;r(d,"UNEXPECTED_TOKEN",u);let y=d.source;y&&typeof y=="string"&&(l+=y.length)}}}return{mode:o,indent:n,chomp:a,comment:c,length:l}}function jm(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 Il(t,e,s){let{offset:r,type:i,source:o,end:n}=t,a,m,p=(f,d,u)=>s(r+f,d,u);switch(i){case"scalar":a=ze.PLAIN,m=Lm(o,p);break;case"single-quoted-scalar":a=ze.QUOTE_SINGLE,m=_m(o,p);break;case"double-quoted-scalar":a=ze.QUOTE_DOUBLE,m=Fm(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=os(n,c,e,s);return{value:m,type:a,comment:l.comment,range:[r,c,l.offset]}}function Lm(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}`),Yp(t)}function _m(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),Yp(t.slice(1,-1)).replace(/''/g,"'")}function Yp(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
+ `?o+=n:n=`
86
+ `:(o+=n+p,n=" "),a=e.lastIndex}let m=/[ \t]*(.*)/sy;return m.lastIndex=a,s=m.exec(t),o+n+(s?.[1]??"")}function Fm(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:s}=Jf(t,r);n+=o,r=s}else if(i==="\\"){let o=t[++r],s=Xf[o];if(s)n+=s;else if(o===`
88
+ `){let{fold:o,offset:n}=Dm(t,r);s+=o,r=n}else if(i==="\\"){let o=t[++r],n=Bm[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;n+=Qf(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}`),n+=a}}else if(i===" "||i===" "){let o=r,s=t[r+1];for(;s===" "||s===" ";)s=t[++r+1];s!==`
91
- `&&!(s==="\r"&&t[r+2]===`
92
- `)&&(n+=r>o?t.slice(o,r+1):i)}else n+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),n}function Jf(t,e){let n="",r=t[e+1];for(;(r===" "||r===" "||r===`
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+=qm(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
+ `&&!(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 Dm(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
- `&&(n+=`
96
- `),e+=1,r=t[e+1];return n||(n=" "),{fold:n,offset:e}}var Xf={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 Qf(t,e,n,r){let i=t.substr(e,n),s=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(s)}catch{let a=t.substr(e-2,n+2);return r(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}function Ta(t,e,n,r){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?Oa(t,e,r):Ea(e,t.options.strict,r),d=n?t.directives.tagName(n.source,p=>r(n,"TAG_RESOLVE_FAILED",p)):null,c;t.options.stringKeys&&t.atKey?c=t.schema[as]:d?c=ed(t.schema,i,d,n,r):e.type==="scalar"?c=td(t,i,e,r):c=t.schema[as];let l;try{let p=c.resolve(i,f=>r(n??e,"TAG_RESOLVE_FAILED",f),t.options);l=ze(p)?p:new be(p)}catch(p){let f=p instanceof Error?p.message:String(p);r(n??e,"TAG_RESOLVE_FAILED",f),l=new be(i)}return l.range=a,l.source=i,o&&(l.type=o),d&&(l.tag=d),c.format&&(l.format=c.format),s&&(l.comment=s),l}function ed(t,e,n,r,i){if(n==="!")return t[as];let o=[];for(let a of t.tags)if(!a.collection&&a.tag===n)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let s=t.knownTags[n];return s&&!s.collection?(t.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),t[as])}function td({atKey:t,directives:e,schema:n},r,i,o){let s=n.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(r))||n[as];if(n.compat){let a=n.compat.find(d=>d.default&&d.test?.test(r))??n[as];if(s.tag!==a.tag){let d=e.tagString(s.tag),c=e.tagString(a.tag),l=`Value may be parsed as either ${d} or ${c}`;o(i,"TAG_RESOLVE_FAILED",l,!0)}}return s}function Ic(t,e,n){if(e){n??(n=e.length);for(let r=n-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 sd={composeNode:Na,composeEmptyNode:Wi};function Na(t,e,n,r){let i=t.atKey,{spaceBefore:o,comment:s,anchor:a,tag:d}=n,c,l=!0;switch(e.type){case"alias":c=nd(t,e,r),(a||d)&&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":c=Ta(t,e,d,r),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=Nc(sd,t,e,n,r),a&&(c.anchor=a.source.substring(1))}catch(p){let f=p instanceof Error?p.message:String(p);r(e,"RESOURCE_EXHAUSTION",f)}break;default:{let p=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;r(e,"UNEXPECTED_TOKEN",p),l=!1}}return c??(c=Wi(t,e.offset,void 0,null,n,r)),a&&c.anchor===""&&r(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!ze(c)||typeof c.value!="string"||c.tag&&c.tag!=="tag:yaml.org,2002:str")&&r(d??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(c.spaceBefore=!0),s&&(e.type==="scalar"&&e.source===""?c.comment=s:c.commentBefore=s),t.options.keepSourceTokens&&l&&(c.srcToken=e),c}function Wi(t,e,n,r,{spaceBefore:i,comment:o,anchor:s,tag:a,end:d},c){let l={type:"scalar",offset:Ic(e,n,r),indent:-1,source:""},p=Ta(t,l,a,c);return s&&(p.anchor=s.source.substring(1),p.anchor===""&&c(s,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(p.spaceBefore=!0),o&&(p.comment=o,p.range[2]=d),p}function nd({options:t},{offset:e,source:n,end:r},i){let o=new Js(n.substring(1));o.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let s=e+n.length,a=Ds(r,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}function zc(t,e,{offset:n,start:r,value:i,end:o},s){let a=Object.assign({_directives:e},t),d=new mn(void 0,a),c={atKey:!1,atRoot:!0,directives:d.directives,options:d.options,schema:d.schema},l=Bs(r,{indicator:"doc-start",next:i??o?.[0],offset:n,onError:s,parentIndent:0,startOnNewline:!0});l.found&&(d.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!l.hasNewline&&s(l.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),d.contents=i?Na(c,i,l,s):Wi(c,l.end,r,null,l,s);let p=d.contents.range[2],f=Ds(o,p,!1,s);return f.comment&&(d.comment=f.comment),d.range=[n,p,f.offset],d}function Dr(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:n}=t;return[e,e+(typeof n=="string"?n.length:1)]}function Cc(t){let e="",n=!1,r=!1;for(let i=0;i<t.length;++i){let o=t[i];switch(o[0]){case"#":e+=(e===""?"":r?`
95
+ `&&(s+=`
96
+ `),e+=1,r=t[e+1];return s||(s=" "),{fold:s,offset:e}}var Bm={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 qm(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 zl(t,e,s,r){let{value:i,type:o,comment:n,range:a}=e.type==="block-scalar"?Rl(t,e,r):Il(e,t.options.strict,r),m=s?t.directives.tagName(s.source,l=>r(s,"TAG_RESOLVE_FAILED",l)):null,p;t.options.stringKeys&&t.atKey?p=t.schema[gn]:m?p=Vm(t.schema,i,m,s,r):e.type==="scalar"?p=Km(t,i,e,r):p=t.schema[gn];let c;try{let l=p.resolve(i,f=>r(s??e,"TAG_RESOLVE_FAILED",f),t.options);c=Ge(l)?l:new ze(l)}catch(l){let f=l instanceof Error?l.message:String(l);r(s??e,"TAG_RESOLVE_FAILED",f),c=new ze(i)}return c.range=a,c.source=i,o&&(c.type=o),m&&(c.tag=m),p.format&&(c.format=p.format),n&&(c.comment=n),c}function Vm(t,e,s,r,i){if(s==="!")return t[gn];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[gn])}function Km({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[gn];if(s.compat){let a=s.compat.find(m=>m.default&&m.test?.test(r))??s[gn];if(n.tag!==a.tag){let m=e.tagString(n.tag),p=e.tagString(a.tag),c=`Value may be parsed as either ${m} or ${p}`;o(i,"TAG_RESOLVE_FAILED",c,!0)}}return n}function Hp(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 Gm={composeNode:Cl,composeEmptyNode:Uo};function Cl(t,e,s,r){let i=t.atKey,{spaceBefore:o,comment:n,anchor:a,tag:m}=s,p,c=!0;switch(e.type){case"alias":p=Zm(t,e,r),(a||m)&&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=zl(t,e,m,r),a&&(p.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{p=Up(Gm,t,e,s,r),a&&(p.anchor=a.source.substring(1))}catch(l){let f=l instanceof Error?l.message:String(l);r(e,"RESOURCE_EXHAUSTION",f)}break;default:{let l=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;r(e,"UNEXPECTED_TOKEN",l),c=!1}}return p??(p=Uo(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(m??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 Uo(t,e,s,r,{spaceBefore:i,comment:o,anchor:n,tag:a,end:m},p){let c={type:"scalar",offset:Hp(e,s,r),indent:-1,source:""},l=zl(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]=m),l}function Zm({options:t},{offset:e,source:s,end:r},i){let o=new ys(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=os(r,n,t.strict,i);return o.range=[e,n,a.offset],a.comment&&(o.comment=a.comment),o}function Wp(t,e,{offset:s,start:r,value:i,end:o},n){let a=Object.assign({_directives:e},t),m=new Rs(void 0,a),p={atKey:!1,atRoot:!0,directives:m.directives,options:m.options,schema:m.schema},c=is(r,{indicator:"doc-start",next:i??o?.[0],offset:s,onError:n,parentIndent:0,startOnNewline:!0});c.found&&(m.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")),m.contents=i?Cl(p,i,c,n):Uo(p,c.end,r,null,c,n);let l=m.contents.range[2],f=os(o,l,!1,n);return f.comment&&(m.comment=f.comment),m.range=[s,l,f.offset],m}function vi(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 Jp(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)||" "),n=!0,r=!1;break;case"%":t[i+1]?.[0]!=="#"&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:e,afterEmptyLine:r}}var Vr=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,r,i,o)=>{let s=Dr(n);o?this.warnings.push(new jr(s,r,i)):this.errors.push(new Es(s,r,i))},this.directives=new Fs({version:e.version||"1.2"}),this.options=e}decorate(e,n){let{comment:r,afterEmptyLine:i}=Cc(this.prelude);if(r){let o=e.contents;if(n)e.comment=e.comment?`${e.comment}
101
- ${r}`:r;else if(i||e.directives.docStart||!o)e.commentBefore=r;else if(et(o)&&!o.flow&&o.items.length>0){let s=o.items[0];Be(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${r}
102
- ${a}`:r}else{let s=o.commentBefore;o.commentBefore=s?`${r}
103
- ${s}`:r}}if(n){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:Cc(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,n=!1,r=-1){for(let i of e)yield*this.next(i);yield*this.end(n,r)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(n,r,i)=>{let o=Dr(e);o[0]+=n,this.onError(o,"BAD_DIRECTIVE",r,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let n=zc(this.options,this.directives,e,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let n=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,r=new Es(Dr(e),"UNEXPECTED_TOKEN",n);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 Es(Dr(e),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let n=Ds(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
104
- ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new Es(Dr(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,n=-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 mn(void 0,r);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,n,n],this.decorate(i,!1),yield i}}};var Ra=Symbol("break visit"),rd=Symbol("skip children"),Lc=Symbol("remove item");function On(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),_c(Object.freeze([]),t,e)}On.BREAK=Ra;On.SKIP=rd;On.REMOVE=Lc;On.itemAtPath=(t,e)=>{let n=t;for(let[r,i]of e){let o=n?.[r];if(o&&"items"in o)n=o.items[i];else return}return n};On.parentCollection=(t,e)=>{let n=On.itemAtPath(t,e.slice(0,-1)),r=e[e.length-1][0],i=n?.[r];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function _c(t,e,n){let r=n(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 s=0;s<o.items.length;++s){let a=_c(Object.freeze(t.concat([[i,s]])),o.items[s],n);if(typeof a=="number")s=a-1;else{if(a===Ra)return Ra;a===Lc&&(o.items.splice(s,1),s-=1)}}typeof r=="function"&&i==="key"&&(r=r(e,t))}}return typeof r=="function"?r(e,t):r}var Ia="\uFEFF",za="",Ca="",Ji="";function Fc(t){switch(t){case Ia:return"byte-order-mark";case za:return"doc-mode";case Ca:return"flow-error-end";case Ji:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
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 Mi=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(s,r,i,o)=>{let n=vi(s);o?this.warnings.push(new $i(n,r,i)):this.errors.push(new Vn(n,r,i))},this.directives=new ss({version:e.version||"1.2"}),this.options=e}decorate(e,s){let{comment:r,afterEmptyLine:i}=Jp(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];Qe(n)&&(n=n.key);let a=n.commentBefore;n.commentBefore=a?`${r}
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:Jp(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=vi(e);o[0]+=s,this.onError(o,"BAD_DIRECTIVE",r,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let s=Wp(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 Vn(vi(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 Vn(vi(e),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let s=os(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 Vn(vi(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 Rs(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"),Um=Symbol("skip children"),Xp=Symbol("remove item");function Ws(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),Qp(Object.freeze([]),t,e)}Ws.BREAK=jl;Ws.SKIP=Um;Ws.REMOVE=Xp;Ws.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};Ws.parentCollection=(t,e)=>{let s=Ws.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 Qp(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=Qp(Object.freeze(t.concat([[i,n]])),o.items[n],s);if(typeof a=="number")n=a-1;else{if(a===jl)return jl;a===Xp&&(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 Ll="\uFEFF",_l="",Fl="",Yo="";function ef(t){switch(t){case Ll:return"byte-order-mark";case _l:return"doc-mode";case Fl:return"flow-error-end";case Yo: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 Ts(t){switch(t){case void 0:case" ":case`
107
- `:case"\r":case" ":return!0;default:return!1}}var jc=new Set("0123456789ABCDEFabcdef"),od=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Xi=new Set(",[]{}"),ad=new Set(` ,[]{}
108
- \r `),La=t=>!t||ad.has(t),Kr=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,n=!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=!n;let r=this.next??"stream";for(;r&&(n||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let e=this.pos,n=this.buffer[e];for(;n===" "||n===" ";)n=this.buffer[++e];return!n||n==="#"||n===`
109
- `?!0:n==="\r"?this.buffer[e+1]===`
110
- `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let n=this.buffer[e];if(this.indentNext>0){let r=0;for(;n===" ";)n=this.buffer[++r+e];if(n==="\r"){let i=this.buffer[r+e+1];if(i===`
111
- `||!i&&!this.atEnd)return e+r+1}return n===`
112
- `||r>=this.indentNext||!n&&!this.atEnd?e+r:-1}if(n==="-"||n==="."){let r=this.buffer.substr(e,3);if((r==="---"||r==="...")&&Ts(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]===Ia&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let n=e.length,r=e.indexOf("#");for(;r!==-1;){let o=e[r-1];if(o===" "||o===" "){n=r-1;break}else r=e.indexOf("#",r+1)}for(;;){let o=e[n-1];if(o===" "||o===" ")n-=1;else break}let i=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-n),yield*this.pushNewline(),"stream"}return yield za,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 n=this.peek(3);if((n==="---"||n==="...")&&Ts(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Ts(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Ts(n)){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 n=yield*this.pushIndicators();switch(e[n]){case"#":yield*this.pushCount(e.length-n);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(La),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,n,r=-1;do e=yield*this.pushNewline(),e>0?(n=yield*this.pushSpaces(!1),this.indentValue=r=n):n=0,n+=yield*this.pushSpaces(!0);while(e+n>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("..."))&&Ts(i[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield Ca,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(La),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let s=this.charAt(1);if(this.flowKey||Ts(s)||s===",")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),n=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let o=0;for(;this.buffer[n-1-o]==="\\";)o+=1;if(o%2===0)break;n=this.buffer.indexOf('"',n+1)}let r=this.buffer.substring(0,n),i=r.indexOf(`
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 Kn(t){switch(t){case void 0:case" ":case`
107
+ `:case"\r":case" ":return!0;default:return!1}}var tf=new Set("0123456789ABCDEFabcdef"),Hm=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Ho=new Set(",[]{}"),Wm=new Set(` ,[]{}
108
+ \r `),Dl=t=>!t||Wm.has(t),Pi=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
+ `?!0:s==="\r"?this.buffer[e+1]===`
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
+ `||!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==="...")&&Kn(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]===Ll&&(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 _l,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==="...")&&Kn(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&&!Kn(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===":")&&Kn(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(Dl),"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("..."))&&Kn(i[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield Fl,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(Dl),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let n=this.charAt(1);if(this.flowKey||Kn(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&&(n=i-(r[i-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let n=this.buffer[++e];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>Ts(n)||n==="#")}*parseBlockScalar(){let e=this.pos-1,n=0,r;e:for(let o=this.pos;r=this.buffer[o];++o)switch(r){case" ":n+=1;break;case`
116
- `:e=o,n=0;break;case"\r":{let s=this.buffer[o+1];if(!s&&!this.atEnd)return this.setNext("block-scalar");if(s===`
117
- `)break}default:break e}if(!r&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n: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(`
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=>Kn(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
+ `: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
+ `)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
- `;)r=this.buffer[++i];e=i-1}else if(!this.blockScalarKeep)do{let o=e-1,s=this.buffer[o];s==="\r"&&(s=this.buffer[--o]);let a=o;for(;s===" ";)s=this.buffer[--o];if(s===`
120
- `&&o>=this.pos&&o+1+n>a)e=o;else break}while(!0);return yield Ji,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,n=this.pos-1,r=this.pos-1,i;for(;i=this.buffer[++r];)if(i===":"){let o=this.buffer[r+1];if(Ts(o)||e&&Xi.has(o))break;n=r}else if(Ts(i)){let o=this.buffer[r+1];if(i==="\r"&&(o===`
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 Yo,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(Kn(o)||e&&Ho.has(o))break;s=r}else if(Kn(i)){let o=this.buffer[r+1];if(i==="\r"&&(o===`
121
121
  `?(r+=1,i=`
122
- `,o=this.buffer[r+1]):n=r),o==="#"||e&&Xi.has(o))break;if(i===`
123
- `){let s=this.continueScalar(r+1);if(s===-1)break;r=Math.max(r,s-2)}}else{if(e&&Xi.has(i))break;n=r}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Ji,yield*this.pushToIndex(n+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,n){let r=this.buffer.slice(this.pos,e);return r?(yield r,this.pos+=r.length,r.length):(n&&(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(La),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,r=this.charAt(1);if(Ts(r)||n&&Xi.has(r)){n?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,n=this.buffer[e];for(;!Ts(n)&&n!==">";)n=this.buffer[++e];return yield*this.pushToIndex(n===">"?e+1:e,!1)}else{let e=this.pos+1,n=this.buffer[e];for(;n;)if(od.has(n))n=this.buffer[++e];else if(n==="%"&&jc.has(this.buffer[e+1])&&jc.has(this.buffer[e+2]))n=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&&Ho.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&&Ho.has(i))break;s=r}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Yo,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(Dl),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let s=this.flowLevel>0,r=this.charAt(1);if(Kn(r)||s&&Ho.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(;!Kn(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(Hm.has(s))s=this.buffer[++e];else if(s==="%"&&tf.has(this.buffer[e+1])&&tf.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 n=this.pos-1,r;do r=this.buffer[++n];while(r===" "||e&&r===" ");let i=n-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=n),i}*pushUntil(e){let n=this.pos,r=this.buffer[n];for(;!e(r);)r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};var En=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let n=0,r=this.lineStarts.length;for(;n<r;){let o=n+r>>1;this.lineStarts[o]<e?n=o+1:r=o}if(this.lineStarts[n]===e)return{line:n+1,col:1};if(n===0)return{line:0,col:e};let i=this.lineStarts[n-1];return{line:n,col:e-i+1}}}};function hn(t,e){for(let n=0;n<t.length;++n)if(t[n].type===e)return!0;return!1}function Bc(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 Vc(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 Qi(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 Qn(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 eo(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let n=0;n<e.length;++n)t.push(e[n])}function Dc(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!hn(e.start,"explicit-key-ind")&&!hn(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,Vc(e.value)?e.value.end?eo(e.value.end,e.sep):e.value.end=e.sep:eo(e.start,e.sep),delete e.sep)}var qr=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 Kr,this.onNewLine=e}*parse(e,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(e,n))yield*this.next(r);n||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let n=Fc(e);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){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 n=e??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{let r=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in r?r.indent:0:n.type==="flow-collection"&&r.type==="document"&&(n.indent=0),n.type==="flow-collection"&&Dc(n),r.type){case"document":r.value=n;break;case"block-scalar":r.props.push(n);break;case"block-map":{let i=r.items[r.items.length-1];if(i.value){r.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=n;else{Object.assign(i,{key:n,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:n}):i.value=n;break}case"flow-collection":{let i=r.items[r.items.length-1];!i||i.value?r.items.push({start:[],key:n,sep:[]}):i.sep?i.value=n:Object.assign(i,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let i=n.items[n.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&Bc(i.start)===-1&&(n.indent===0||i.start.every(o=>o.type!=="comment"||o.indent<n.indent))&&(r.type==="document"?r.end=i.start:r.items.push({start:i.start}),n.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":{Bc(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 n=this.startBlockValue(e);n?this.stack.push(n):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 n=Qi(this.peek(2)),r=Qn(n),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 n=this.source.indexOf(`
126
- `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
127
- `,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let r="end"in n.value?n.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 n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){eo(i,n.start),i.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let r=!this.onKeyLine&&this.indent===e.indent,i=r&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&n.sep&&!n.value){let s=[];for(let a=0;a<n.sep.length;++a){let d=n.sep[a];switch(d.type){case"newline":s.push(a);break;case"space":break;case"comment":d.indent>e.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(o=n.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":i||n.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):i||n.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(n.explicitKey)if(n.sep)if(n.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(hn(n.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(Vc(n.key)&&!hn(n.sep,"newline")){let s=Qn(n.start),a=n.key,d=n.sep;d.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:a,sep:d}]})}else o.length>0?n.sep=n.sep.concat(o,this.sourceToken):n.sep.push(this.sourceToken);else if(hn(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let s=Qn(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):hn(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);i||n.value?(e.items.push({start:o,key:s,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(s):(Object.assign(n,{key:s,sep:[]}),this.onKeyLine=!0);return}default:{let s=this.startBlockValue(e);if(s){if(s.type==="block-seq"){if(!n.explicitKey&&n.sep&&!hn(n.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(s);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(n.value){let r="end"in n.value?n.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 n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){eo(i,n.start),i.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=e.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;n.value||hn(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.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 n=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":!n||n.sep?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?e.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!n||n.value?e.items.push({start:[],key:i,sep:[]}):n.sep?this.stack.push(i):Object.assign(n,{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=Qi(r),o=Qn(i);Dc(e);let s=e.end.splice(1,e.end.length);s.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let n=this.source.indexOf(`
128
- `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
129
- `,n)+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 n=Qi(e),r=Qn(n);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 n=Qi(e),r=Qn(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!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 ld(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new En||null,prettyErrors:e}}function to(t,e={}){let{lineCounter:n,prettyErrors:r}=ld(e),i=new qr(n?.addNewLine),o=new Vr(e),s=null;for(let a of o.compose(i.parse(t),!0,t.length))if(!s)s=a;else if(s.options.logLevel!=="silent"){s.errors.push(new Es(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(s.errors.forEach($a(t,n)),s.warnings.forEach($a(t,n))),s}function _a(t,e,n){let r;typeof e=="function"?r=e:n===void 0&&e&&typeof e=="object"&&(n=e);let i=to(t,n);if(!i)return null;if(i.warnings.forEach(o=>Ni(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},n))}function er(t){let e=_a(t);for(let n of["light","dark","kinds","roles"])if(!e||typeof e[n]!="object")throw new Error(`theme: missing "${n}"`);return e}function tr(t,e={},n={}){let r={...t.kinds};for(let[i,o]of Object.entries(n)){let s=r[o.like??i]??r.control;r[i]={color:o.color??s.color,dash:o.dash??s.dash,legend:o.legend??s.legend}}return{...t,roles:{...t.roles,...e},kinds:r}}var Kc=t=>Object.entries(t).map(([e,n])=>`--${e}:${n}`).join(";");function Vs(t,e){return e in t.light?`var(--${e})`:e}function so(t){let{light:e,dark:n,rest:r}=Fa(t);return`:root{${e}}
130
- @media (prefers-color-scheme: dark){:root:not([data-theme="light"]){${n}}}
131
- :root[data-theme="dark"]{${n}}
132
- ${r}`}function Fa(t){let e="";for(let[n,r]of Object.entries(t.roles))e+=`.k-${n}{--h:${r.h};--s:${r.s}%}`,r.top?e+=`.k-${n} .top{fill:${r.top}}`:r.tint&&(e+=`.k-${n} .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[n,r]of Object.entries(t.kinds)){let i=Vs(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-${n}{stroke:${i}${o}} .t-${n}{fill:${i}} .c-${n}{--c:${i}}
134
- `}return{light:Kc(t.light),dark:Kc(t.dark),rest:e}}var no=class extends Error{diags;constructor(e){super(e.map(n=>`${n.line}:${n.col} ${n.message}`).join(`
135
- `)),this.diags=e}};function ja(t,e){let n=t.length,r=e.length;if(!n)return r;if(!r)return n;let i=Array.from({length:n+1},(o,s)=>[s,...Array(r).fill(0)]);for(let o=0;o<=r;o++)i[0][o]=o;for(let o=1;o<=n;o++)for(let s=1;s<=r;s++){let a=t[o-1]===e[s-1]?0:1;i[o][s]=Math.min(i[o-1][s]+1,i[o][s-1]+1,i[o-1][s-1]+a),o>1&&s>1&&t[o-1]===e[s-2]&&t[o-2]===e[s-1]&&(i[o][s]=Math.min(i[o][s],i[o-2][s-2]+1))}return i[n][r]}function Ns(t,e){let n,r=1/0,i=t.toLowerCase();for(let s of e){let a=ja(i,s.toLowerCase());a<r&&(r=a,n=s)}if(n===void 0)return;let o=Math.max(1,Math.min(3,Math.floor(Math.max(t.length,n.length)/3)));return r<=o?n:void 0}function Ba(t,e,n){t.file&&(e=t.file,n=t.source);let i=`${t.line?`${e}:${t.line}:${t.col}`:e} ${t.severity}: ${t.message}`;if(t.hint&&(i+=`
136
- ${t.hint}`),n&&t.line){let s=n.split(/\r?\n/)[t.line-1]??"",a=String(t.line).padStart(4);i+=`
137
- ${a} | ${s}
138
- ${" ".repeat(a.length)} | ${" ".repeat(Math.max(0,t.col-1))}^`}return i}function qc(t,e,n){return t.map(r=>Ba(r,e,n)).join(`
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 Js=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 zs(t,e){for(let s=0;s<t.length;++s)if(t[s].type===e)return!0;return!1}function nf(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 rf(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 Wo(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 Sr(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 Jo(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 sf(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!zs(e.start,"explicit-key-ind")&&!zs(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,rf(e.value)?e.value.end?Jo(e.value.end,e.sep):e.value.end=e.sep:Jo(e.start,e.sep),delete e.sep)}var Oi=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 Pi,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=ef(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"&&sf(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&&nf(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":{nf(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=Wo(this.peek(2)),r=Sr(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
+ `)+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)){Jo(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 m=s.sep[a];switch(m.type){case"newline":n.push(a);break;case"space":break;case"comment":m.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(zs(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(rf(s.key)&&!zs(s.sep,"newline")){let n=Sr(s.start),a=s.key,m=s.sep;m.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:m}]})}else o.length>0?s.sep=s.sep.concat(o,this.sourceToken):s.sep.push(this.sourceToken);else if(zs(s.start,"newline"))Object.assign(s,{key:null,sep:[this.sourceToken]});else{let n=Sr(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]}):zs(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&&!zs(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)){Jo(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||zs(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=Wo(r),o=Sr(i);sf(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
+ `)+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=Wo(e),r=Sr(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=Wo(e),r=Sr(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 Jm(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Js||null,prettyErrors:e}}function Xo(t,e={}){let{lineCounter:s,prettyErrors:r}=Jm(e),i=new Oi(s?.addNewLine),o=new Mi(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 Vn(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&s&&(n.errors.forEach(Al(t,s)),n.warnings.forEach(Al(t,s))),n}function Bl(t,e,s){let r;typeof e=="function"?r=e:s===void 0&&e&&typeof e=="object"&&(s=e);let i=Xo(t,s);if(!i)return null;if(i.warnings.forEach(o=>Ao(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 vr(t){let e=Bl(t);for(let s of["light","dark","kinds","roles"])if(!e||typeof e[s]!="object")throw new Error(`theme: missing "${s}"`);return e}function Mr(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 of=t=>Object.entries(t).map(([e,s])=>`--${e}:${s}`).join(";");function as(t,e){return e in t.light?`var(--${e})`:e}function Qo(t){let{light:e,dark:s,rest:r}=Ai(t);return`:root{${e}}
130
+ @media (prefers-color-scheme: dark){:root:not([data-theme="light"]){${s}}}
131
+ :root[data-theme="dark"]{${s}}
132
+ ${r}`}function Ai(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=as(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:of(t.light),dark:of(t.dark),rest:e}}var ea=class extends Error{diags;constructor(e){super(e.map(s=>`${s.line}:${s.col} ${s.message}`).join(`
135
+ `)),this.diags=e}};function ql(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=ql(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 Vl(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
+ ${t.hint}`),s&&t.line){let n=s.split(/\r?\n/)[t.line-1]??"",a=String(t.line).padStart(4);i+=`
137
+ ${a} | ${n}
138
+ ${" ".repeat(a.length)} | ${" ".repeat(Math.max(0,t.col-1))}^`}return i}function af(t,e,s){return t.map(r=>Vl(r,e,s)).join(`
139
139
 
140
- `)}function Gc(t){return t.split("/").slice(1).map(e=>{let n=e.replace(/~1/g,"/").replace(/~0/g,"~");return/^\d+$/.test(n)?Number(n):n})}function ro(t){let e=new En,n=to(t,{lineCounter:e,prettyErrors:!1,uniqueKeys:!0}),r=[],i=d=>{let c=e.linePos(d);return{line:c.line,col:c.col}};for(let d of n.errors){let c=i(d.pos[0]),l=d.message.split(`
141
- `)[0],p=/Nested mappings|Implicit keys|mapping values/i.test(l)?`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(l)?"a key is written twice in the same map":void 0;r.push({severity:"error",message:`YAML: ${l}`,line:c.line,col:c.col,path:"",hint:p})}for(let d of n.warnings){let c=i(d.pos[0]);r.push({severity:"warning",message:`YAML: ${d.message.split(`
142
- `)[0]}`,line:c.line,col:c.col,path:""})}function o(d,c={}){let l=Gc(d),p=n.contents,f={line:1,col:1},m=u=>{let h=u?.range;h&&(f=i(h[0]))};m(p);for(let u=0;u<l.length;u++){let h=l[u];if(es(p)){let y=p.items.find(v=>Be(v)&&ze(v.key)&&String(v.key.value)===String(h));if(!y)break;if(c.key&&u===l.length-1)return m(y.key),f;m(y.key),p=y.value,p&&m(p)}else if(ts(p)&&typeof h=="number"){if(p=p.items[h],!p)break;m(p)}else break}return f}function s(d){let c=n.contents;for(let m of Gc(d)){if(es(c)){let u=c.items.find(h=>Be(h)&&ze(h.key)&&String(h.key.value)===String(m));if(!u)return;c=u.value}else if(ts(c)&&typeof m=="number")c=c.items[m];else return;if(!c)return}let l=c.range;if(!l)return;let p=e.linePos(Math.max(l[0],l[1]-1)).line,f=t.split(/\r?\n/);for(;p>e.linePos(l[0]).line&&/^\s*(#.*)?$/.test(f[p-1]??"");)p--;return{start:e.linePos(l[0]).line,end:p}}let a=null;return n.errors.length||(a=n.toJS({maxAliasCount:100})),{data:a,locate:o,span:s,diags:r}}var pd=new Set(["svg","g","defs","marker","symbol","title","desc","path","polygon","polyline","line","rect","circle","ellipse","text","tspan","linearGradient","radialGradient","stop","clipPath"]),fd=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"]),dd=new Set(["fill","stroke","marker-start","marker-mid","marker-end","clip-path","style"]),md={amp:"&",lt:"<",gt:">",quot:'"',apos:"'","#39":"'"},Zc=t=>t.replace(/&(amp|lt|gt|quot|apos|#39);/g,(e,n)=>md[n]);function Da(t,e){return t.startsWith("data-")||t.startsWith("aria-")?/^[a-z][\w-]*$/.test(t):!(!fd.has(t)||dd.has(t)&&/url\(\s*(?!['"]?#)|javascript:|expression\(|@import/i.test(e))}function Va(t){let e={name:"#root",attrs:[],children:[]},n=[{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 s=n[n.length-1];if(i[0].charAt(1)!=="!"){if(i[1]){if(n.length<2||s.node.name!==i[1])throw new Error(`a stray </${i[1]}>`);n.pop();continue}if(i[2]){let a=i[2],d=[];for(let p of i[3].matchAll(/([\w:-]+)="([^"]*)"/g)){let f=p[1],m=Zc(p[2]);f==="xmlns"||f.startsWith("xmlns:")||Da(f,m)&&d.push([f,m])}let c={name:a,attrs:d,children:[]},l=s.dropped||!pd.has(a);l||s.node.children.push(c),i[4]||n.push({node:c,dropped:l});continue}!s.dropped&&i[5].trim()&&s.node.children.push(Zc(i[5]))}}if(o!==t.length)throw new Error(`not the renderer's SVG at ${o}`);if(n.length!==1)throw new Error(`<${n[n.length-1].node.name}> is never closed`);return e}var ud="http://www.w3.org/2000/svg",Uc=t=>t.replace(/var\(--([a-zA-Z][\w-]*)/g,"var(--iso-$1");function Yc(t,e=document){let n=i=>{let o=e.createElementNS(ud,i.name);for(let[s,a]of i.attrs)s==="style"?o.style.cssText=Uc(a):o.setAttribute(s,/var\(--/.test(a)?Uc(a):a);for(let s of i.children)o.append(typeof s=="string"?e.createTextNode(s):n(s));return o},r=Va(t).children.find(i=>typeof i!="string"&&i.name==="svg");if(!r)throw new Error("the drawing has no <svg>");return n(r)}var hd=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),Gr=class t{name;attrs=[];children=[];style={};constructor(e){this.name=e}setAttribute(e,n){let r=this.attrs.findIndex(i=>i[0]===e);r>=0?this.attrs[r][1]=String(n):this.attrs.push([e,String(n)])}getAttribute(e){return this.attrs.find(n=>n[0]===e)?.[1]??null}append(...e){for(let n of e)n!=null&&this.children.push(n)}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(([,n])=>n!==""&&n!==void 0).map(([n,r])=>`${hd(n)}:${r}`).join(";");return{name:this.name,attrs:e?[...this.attrs,["style",e]]:[...this.attrs],children:this.children.map(n=>n instanceof t?n.toNode():n)}}},Hc={createElementNS:(t,e)=>new Gr(e)},Wc=t=>t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),yd=t=>Wc(t).replace(/"/g,"&quot;");function io(t,e=new Set(["style"])){if(typeof t=="string")return Wc(t);let n=t.attrs.map(([i,o])=>` ${i}="${yd(o)}"`).join("");if(!t.children.length)return`<${t.name}${n}/>`;let r=e.has(t.name)?t.children.map(i=>typeof i=="string"?i.replace(/<\//g,"<\\/"):io(i,e)).join(""):t.children.map(i=>io(i,e)).join("");return`<${t.name}${n}>${r}</${t.name}>`}var gd=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 Ka(t){let e=new TextEncoder().encode(t),n=e.length,r=Math.ceil((n+9)/64),i=new Uint8Array(r*64);i.set(e),i[n]=128;let o=new DataView(i.buffer);o.setUint32(i.length-4,n*8>>>0),o.setUint32(i.length-8,Math.floor(n/536870912));let s=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),a=new Uint32Array(64),d=(c,l)=>c>>>l|c<<32-l;for(let c=0;c<r;c++){for(let g=0;g<16;g++)a[g]=o.getUint32(c*64+g*4);for(let g=16;g<64;g++){let b=d(a[g-15],7)^d(a[g-15],18)^a[g-15]>>>3,$=d(a[g-2],17)^d(a[g-2],19)^a[g-2]>>>10;a[g]=a[g-16]+b+a[g-7]+$>>>0}let[l,p,f,m,u,h,y,v]=s;for(let g=0;g<64;g++){let b=v+(d(u,6)^d(u,11)^d(u,25))+(u&h^~u&y)+gd[g]+a[g]>>>0,$=(d(l,2)^d(l,13)^d(l,22))+(l&p^l&f^p&f)>>>0;v=y,y=h,h=u,u=m+b>>>0,m=f,f=p,p=l,l=b+$>>>0}s[0]+=l,s[1]+=p,s[2]+=f,s[3]+=m,s[4]+=u,s[5]+=h,s[6]+=y,s[7]+=v}return[...s].map(c=>c.toString(16).padStart(8,"0")).join("")}function Jc(t){if(t!=="sha256")throw new Error(`only sha256 here, not ${t}`);let e="",n={update(r){return e+=r,n},digest(r){return Ka(e)}};return n}var kp={};mi(kp,{BOARD_3D:()=>gn,BOARD_CSS:()=>bp,FLAT_DEFAULTS:()=>fl,FLAT_FONTS:()=>dl,GRID_CSS:()=>ll,LABEL_BUDGET:()=>Oo,MARKS_CSS:()=>ol,Obstacles:()=>Rn,PAGE_CSS:()=>il,PLAYER_CSS:()=>No,PLAYER_UI_CSS:()=>al,ROUTE_BUDGET:()=>yo,WALL_T:()=>Ks,assembly:()=>$o,baseCss:()=>ar,boardCatalog:()=>wp,boardDiagram:()=>xp,boardErrors:()=>zo,boardOf:()=>Co,boxAsset:()=>Xt,boxSilhouette:()=>dp,calloutRect:()=>tl,cardAsset:()=>ml,cloudPath:()=>Ya,compileRaw:()=>Ro,convexOverlap:()=>Jr,defaultLabel:()=>ep,drawCloud:()=>sr,drawDecos:()=>Ua,drawingCss:()=>ei,durationFor:()=>nl,facePainter:()=>Nn,flatHit:()=>gp,floorAt:()=>rr,floorOf:()=>mp,focusView:()=>cp,gateBox:()=>Hr,iconPainter:()=>Zr,inConvex:()=>sl,kindsCss:()=>ao,labelRect:()=>Xr,layoutFlat:()=>lr,lineRectArea:()=>op,localAt:()=>fp,markCss:()=>lo,metricsMeasure:()=>yp,midpoint:()=>rl,noSource:()=>cl,nodeKind:()=>Tn,nodeKindOr:()=>hs,offscreen:()=>vo,openList:()=>Ja,overlap2:()=>po,overlaps:()=>Io,paddingOf:()=>up,parseEnd:()=>ls,place:()=>nr,placeBoard:()=>ti,placeCallout:()=>ko,placeNodeLabel:()=>Qr,placeholderIcon:()=>Za,plate:()=>Ur,polyBounds:()=>sn,polyRectArea:()=>or,rectArea:()=>el,regionKind:()=>vt,regionRole:()=>Eo,registerMarks:()=>Qc,renderScene:()=>To,resolveSteps:()=>Po,routeAll:()=>go,screenToGrid:()=>pp,silhouette:()=>cs,simplify:()=>Wr,snapMove:()=>hp,wallHeight:()=>oo,wallsOf:()=>Mo});var vt=(t,e)=>e!==void 0&&Object.hasOwn(t.regions,e)?t.regions[e]:void 0,Tn=(t,e)=>t.nodes[e??t.defaultNode],hs=(t,e)=>Tn(t,e)??t.nodes[t.defaultNode],oo=t=>Object.values(t.regions).find(e=>e.shape==="walled")?.z[1]??.8,ao=t=>Object.values(t.regions).map(e=>e.css??"").join("");var qa=Object.create(null),Ga=[];function Qc(t){Object.assign(qa,t.icons??{}),Object.assign(Vn,t.faces??{}),t.css&&!Ga.includes(t.css)&&Ga.push(t.css)}var lo=()=>Ga.join(""),Zr=t=>Object.hasOwn(qa,t)?qa[t]:void 0,Nn=t=>Object.hasOwn(Vn,t)?Vn[t]:void 0;function Za(t,e){let n=(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),s=[[n-o,r-o,i],[n+o,r-o,i],[n+o,r+o,i],[n-o,r+o,i]];return t.poly(s,"ico-unknown")+t.line3([n-o*.3,r-o*.35,i],[n+o*.3,r-o*.35,i],"ico-unknown-q")+t.line3([n+o*.3,r-o*.35,i],[n,r+o*.1,i],"ico-unknown-q")+t.line3([n,r+o*.45,i],[n,r+o*.5,i],"ico-unknown-q")}function Ua(t,e,n){let r="";for(let i of n??[])i==="terminal"?r+=vr(t,e,3):i==="envelope"?r+=ui(t,e):i==="bubble"?r+=hi(t,e):i==="file-lines"?r+=yi(t,e):typeof i=="object"&&(i.terminal&&(r+=vr(t,e,i.terminal)),i.icon&&(r+=(Zr(i.icon)??Za)(t,e)));return r}var bd=(t,e)=>(t.deco??e.deco??[]).filter(n=>n!=="ghost");function Xt(t,e,n,r,i,o){let s={name:t,description:e,size:n,role:r,deco:i,draw:(a,d,c)=>a.blockFaces(d)+Ua(a,d,bd(c,s))+(o?o(a,d):"")};return s}function Ur(t){let[e,n]=$n(t);return{x0:e-.75,y0:n-.75,x1:e+.75,y1:n+.75,z0:t.z0,z1:t.z0+.18}}function Ya(t,e){let n=Math.max(8,Math.min(t,e)*.18),r=n*.55,i=r,o=r,s=t-r,a=e-r,d=(c,l,p,f)=>{let m=Math.hypot(p-c,f-l),u=Math.max(1,Math.round(m/(n*1.7))),h="";for(let y=1;y<=u;y++){let v=c+(p-c)*y/u,g=l+(f-l)*y/u,b=m/u/2*1.08;h+=` A${b.toFixed(1)},${b.toFixed(1)} 0 0 1 ${v.toFixed(1)},${g.toFixed(1)}`}return h};return`M${i.toFixed(1)},${o.toFixed(1)}`+d(i,o,s,o)+d(s,o,s,a)+d(s,a,i,a)+d(i,a,i,o)+"Z"}function sr(t,e){let n={...e,z0:e.z1},r=a=>{let[d,c]=ke(e.x0,e.y0,a);return[Et,.5,-Et,.5,d,c]},i=(e.x1-e.x0)*Qe,o=(e.y1-e.y0)*Qe,s=Ya(i,o);return t.onMatrix(r(e.z0),i,o,()=>fe("path",{d:s,class:"lft cloud-side"}))+t.onMatrix(r(e.z1),i,o,()=>fe("path",{d:s,class:"top cloud-top"}))}function ep(t,e){let[n,r]=ke((t.x0+t.x1)/2,(t.y0+t.y1)/2,t.z1+.75);return{x:n,y:r-18+(e?0:6),anchor:"middle"}}var Ks=.16,Ha=["right-of","left-of","below","behind"];function nr(t,e,n,r,i,o={},s){let a=[],d=(x,P,w,I=!1,L="error")=>{let D=n.locate(x,{key:I});a.push({severity:L,message:P,line:D.line,col:D.col,path:x,hint:w})},c=[],l=new Map,p=[],f=new Map,m=new Set([...Object.keys(r.roles),...Object.keys(o)]);function u(x,P){let w=l.get(x.id);if(w){let I=n.locate(w.path+"/id");return d(x.path+"/id",`duplicate id "${x.id}" (first used on line ${I.line})`),!1}return l.set(x.id,x),c.push(x),x.parent=P,P?P.children.push(x):p.push(x),!0}let h=()=>({x0:0,y0:0,z0:0,x1:0,y1:0,z1:0});function y(x,P,w){let I={id:x.id,type:"node",path:P,children:[],box:h(),floor:0,node:x,appears:x.appears,disappears:x.disappears};u(I,w)&&(x.nodes??[]).forEach((L,D)=>y(L,`${P}/nodes/${D}`,I))}function v(x,P,w){let I={id:x.id,type:"region",path:P,children:[],box:h(),floor:0,region:x,appears:x.appears,disappears:x.disappears};u(I,w)&&((x.nodes??[]).forEach((L,D)=>y(L,`${P}/nodes/${D}`,I)),(x.regions??[]).forEach((L,D)=>v(L,`${P}/regions/${D}`,I)))}(t.regions??[]).forEach((x,P)=>v(x,`${e}/regions/${P}`,void 0)),(t.nodes??[]).forEach((x,P)=>y(x,`${e}/nodes/${P}`,void 0));let g=()=>l.keys(),b=()=>c.filter(x=>x.type==="region").map(x=>x.id);for(let x of[...c]){let P=x.node??x.region;if(P.in!==void 0){let I=l.get(P.in);if(!I){d(x.path+"/in",`unknown region "${P.in}"`+Yr(P.in,b()));continue}if(I.type!=="region"){d(x.path+"/in",`"${P.in}" is a node, not a region; put nodes on a node with its own "nodes:" list`);continue}if(x.parent&&x.parent!==I){d(x.path+"/in",`"${x.id}" is written inside "${x.parent.id}" but says in: ${P.in}; use one or the other`);continue}for(let L=I;L;L=L.parent)if(L===x){d(x.path+"/in",`"${x.id}" cannot be inside itself`);continue}x.parent||(p.splice(p.indexOf(x),1),x.parent=I,I.children.push(x))}if(x.node){let I=x.node.asset;I!==void 0&&!Tn(i,I)&&d(x.path+"/asset",`unknown asset "${I}"`+Yr(I,Object.keys(i.nodes)),`assets: ${Object.keys(i.nodes).join(", ")}`)}let w=(x.node??x.region).role;w!==void 0&&!m.has(w)&&d(x.path+"/role",`unknown colour role "${w}"`+Yr(w,m),`add it under "roles:" at the top of the file, or use one of: ${[...m].join(", ")}`)}for(let x of c){let P=x.region?.gate;if(!P?.node)continue;let w=l.get(P.node);if(!w){d(x.path+"/gate/node",`unknown node "${P.node}"`+Yr(P.node,g()));continue}if(w.type!=="node"){d(x.path+"/gate/node",`"${P.node}" is a region; a gate is a node`);continue}w.placedBy=x.id;let I=w.node;(I.at||Ha.some(L=>I[L]))&&d(w.path,`"${w.id}" is the gate of "${x.id}", which places it; its own placement is ignored`,void 0,!1,"warning")}let $=x=>x.gap??t.gap??2;function E(x){let P=x.node,w=hs(i,P.asset),I=P.size,L=w.size[0],D=w.size[1],G=w.size[2];if(I&&(L=I[0],D=I[1],I.length>2&&(G=I[2])),x.placedBy){let se=l.get(x.placedBy).region,_=se.gate,K=_.width??2,Z=I?Math.min(L,D):.3;G=I&&I.length>2?G:_.height??(se.height??oo(i))+.3,_.side==="e"||_.side==="w"?(L=Z,D=K):(L=K,D=Z)}return[L,D,G]}function S(x,P,w,I,L){for(let J of P)T(J);let D=P.filter(J=>!J.placedBy),G=new Set(D),se=new Set,_=[],K=new Set,Z=J=>{let te=J.node??J.region,Se=[];for(let Ve of Ha){let O=te[Ve];if(O===void 0)continue;let U=l.get(O);if(!U){d(`${J.path}/${Ve}`,`unknown id "${O}"`+Yr(O,g()));continue}if(U===J){d(`${J.path}/${Ve}`,`"${J.id}" cannot be placed ${Ve} itself`);continue}if(!G.has(U)){let ne=ce=>ce.parent?`"${ce.parent.id}"`:"the scene";d(`${J.path}/${Ve}`,`"${O}" is in ${ne(U)} but "${J.id}" is in ${ne(J)}; relative placement works between items in the same region`,U.placedBy?`"${O}" is a gate, placed by its ${l.get(U.placedBy)?.region?.kind??"region"}`:`place "${J.id}" relative to something in ${ne(J)}, or use "at:"`);continue}Se.push(U)}if(!Se.length&&!te.at){let Ve=D.indexOf(J);Ve>0&&Se.push(D[Ve-1])}return Se},Q=J=>{if(!se.has(J)){if(K.has(J)){d(J.path,`placement loop: "${J.id}" is placed relative to something placed relative to it`);return}K.add(J),Z(J).forEach(Q),K.delete(J),se.add(J),_.push(J)}};D.forEach(Q);for(let J of _){let te=J.node??J.region,Se=f.get(J),Ve=Ha.find(O=>te[O]!==void 0&&l.get(te[O])&&G.has(l.get(te[O])));if(te.at&&Ve&&d(`${J.path}/at`,`"${J.id}" has both "at" and "${Ve}"; "at" wins`,void 0,!0,"warning"),te.at)Se.x=te.at[0],Se.y=te.at[1];else if(Ve)k(Se,f.get(l.get(te[Ve])),Ve,$(te),te.align??"center");else{let O=D.indexOf(J);O>0?k(Se,f.get(D[O-1]),I==="row"?"right-of":"below",$(te),"center"):(Se.x=w,Se.y=w)}te.shift&&(Se.x+=te.shift[0],Se.y+=te.shift[1])}if(L||!D.length)return{w:0,d:0};let N=1/0,j=1/0,V=-1/0,H=-1/0;for(let J of D){let te=f.get(J);N=Math.min(N,te.x),j=Math.min(j,te.y),V=Math.max(V,te.x+te.w),H=Math.max(H,te.y+te.d)}let ae=Math.min(0,N-w),ue=Math.min(0,j-w);if(ae||ue)for(let J of D){let te=f.get(J);te.x-=ae,te.y-=ue}return{w:V-ae+w,d:H-ue+w}}function k(x,P,w,I,L){let D=()=>{x.y=L==="start"?P.y:L==="end"?P.y+P.d-x.d:P.y+(P.d-x.d)/2},G=()=>{x.x=L==="start"?P.x:L==="end"?P.x+P.w-x.w:P.x+(P.w-x.w)/2};w==="right-of"?(x.x=P.x+P.w+I,D()):w==="left-of"?(x.x=P.x-I-x.w,D()):w==="below"?(x.y=P.y+P.d+I,G()):(x.y=P.y-I-x.d,G())}function T(x){if(x.type==="node"){let[_,K,Z]=E(x);f.set(x,{x:0,y:0,w:_,d:K,h:Z,z:x.node.z??0}),x.children.length&&S(x,x.children,0,"row",!0);return}let P=x.region,w=P.padding??vt(i,P.kind)?.pad,I=!!P.size,L=S(x,x.children,w,P.flow??"row",I),D=P.size?P.size[0]:Math.max(L.w,w*2+.5),G=P.size?P.size[1]:Math.max(L.d,w*2+.5);if(!P.size&&P.gate){let _=(P.gate.width??2)+1;P.gate.side==="e"||P.gate.side==="w"?G=Math.max(G,_):D=Math.max(D,_)}let se=P.size&&P.size.length>2?P.size[2]:P.height??vt(i,P.kind).z[1];f.set(x,{x:0,y:0,w:D,d:G,h:se,z:0})}S(void 0,p,0,t.flow??"row",!0);function z(x,P,w,I){let L=f.get(x),D=P+L.x,G=w+L.y;if(x.type==="region"){let se=vt(i,x.region.kind),[_]=se.z,K=se.floor,Z=se.shape==="slab"&&vt(i,x.parent?.region?.kind)?.shape==="slab"?0:_,Q=x.region.z??0,N=I+Z+Q,j=I+L.h+Q;x.box={x0:D,y0:G,z0:N,x1:D+L.w,y1:G+L.d,z1:j},x.floor=K?j:I}else{let se=I+L.z;x.box={x0:D,y0:G,z0:se,x1:D+L.w,y1:G+L.d,z1:se+L.h},x.floor=x.box.z1}for(let se of x.children)se.placedBy||z(se,D,G,x.floor)}for(let x of p)x.placedBy||z(x,0,0,0);if(s){let x=w=>Math.round(w/s)*s,P=w=>Math.round(w*1e9)/1e9;for(let w of c){if(w.placedBy)continue;let I=w.box,L=x(I.x0),D=x(I.x1),G=x(I.y0),se=x(I.y1);D-L<s&&(D=L+s),se-G<s&&(se=G+s),w.box={...I,x0:P(L),x1:P(D),y0:P(G),y1:P(se)};let _=w.node??w.region;_.at&&_.at.forEach((K,Z)=>{let Q=K/s;Math.abs(Q-Math.round(Q))>1e-6&&d(`${w.path}/at/${Z}`,`${K} is not on the ${s} grid; it is drawn at ${P(x(K))}`,void 0,!1,"warning")})}}for(let x of c){let P=x.region?.gate;if(!P?.node)continue;let w=l.get(P.node);!w||w.placedBy!==x.id||(w.box=Hr(x,f.get(w).h,f.get(w).w,f.get(w).d),w.floor=w.box.z1)}for(let x of c){let P=x.children.filter(w=>!w.placedBy);for(let w=0;w<P.length;w++)for(let I=w+1;I<P.length;I++){let L=P[w],D=P[I];co(L,i)||co(D,i)||po(L.box,D.box)&&d(D.path,`"${D.id}" overlaps "${L.id}"`,'move one with "at", a relative placement, "gap" or "shift"',!1,"warning")}if(x.parent&&x.parent.type==="region"&&!x.placedBy){let w=x.parent.box,I=x.box,L=1e-6;(I.x0<w.x0-L||I.y0<w.y0-L||I.x1>w.x1+L||I.y1>w.y1+L)&&d(x.path,`"${x.id}" sticks out of region "${x.parent.id}"`,`make "${x.parent.id}" bigger, or leave out its "size" so it fits its contents`,!1,"warning")}}{let x=p.filter(P=>!P.placedBy);for(let P=0;P<x.length;P++)for(let w=P+1;w<x.length;w++){let I=x[P],L=x[w];po(I.box,L.box)&&!co(I,i)&&!co(L,i)&&d(L.path,`"${L.id}" overlaps "${I.id}"`,'move one with "at", a relative placement, "gap" or "shift"',!1,"warning")}}let A=new Set,R=a.filter(x=>{let P=x.path+x.message;return A.has(P)?!1:(A.add(P),!0)});return{items:c,byId:l,roots:p,diags:R,catalog:i}}var co=(t,e)=>t.type==="region"&&["zone","tunnel"].includes(vt(e,t.region.kind)?.shape??"");function Hr(t,e,n,r){let i=t.region.gate,o=t.box,s=t.box.z0,a=i.at??.5,d=i.width??2;if(i.side==="w"||i.side==="e"){let p=i.side==="w"?o.x0+Ks/2:o.x1-Ks/2,f=o.y0+(o.y1-o.y0)*a;return{x0:p-n/2,x1:p+n/2,y0:f-d/2,y1:f+d/2,z0:s,z1:s+e}}let c=i.side==="n"?o.y0+Ks/2:o.y1-Ks/2,l=o.x0+(o.x1-o.x0)*a;return{x0:l-d/2,x1:l+d/2,y0:c-r/2,y1:c+r/2,z0:s,z1:s+e}}function po(t,e,n=1e-6){return t.x0<e.x1-n&&e.x0<t.x1-n&&t.y0<e.y1-n&&e.y0<t.y1-n}function Yr(t,e){let n=Ns(t,e);return n?` (did you mean "${n}"?)`:""}var en=.2,fo=.05,wd=.6,mo=.25,uo={n:[0,-1],s:[0,1],e:[1,0],w:[-1,0]};function ls(t){let e=/^(.*?)(?:\.(n|e|s|w|top))?$/.exec(t);return{id:e[1],side:e[2]}}var tp=new WeakMap;function rr(t,e,n){let r=tp.get(t);if(!r){r=[];for(let s of t.items){if(s.type!=="region"||!vt(t.catalog,s.region.kind)?.floor)continue;let a=0;for(let d=s.parent;d;d=d.parent)a++;r.push({r:s,d:a})}tp.set(t,r)}let i=0,o=-1;for(let{r:s,d:a}of r){let d=s.box,c=1e-6;e>=d.x0-c&&e<=d.x1+c&&n>=d.y0-c&&n<=d.y1+c&&a>o&&(o=a,i=s.floor)}return i}function xd(t,e){let n=[(t.x0+t.x1)/2,(t.y0+t.y1)/2],r=[(e.x0+e.x1)/2,(e.y0+e.y1)/2],i=r[0]-n[0],o=r[1]-n[1],s=Math.max(e.x0-t.x1,t.x0-e.x1),a=Math.max(e.y0-t.y1,t.y0-e.y1);return s>0&&(a<=0||s>=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 yo=5e5;function go(t,e,n,r,i,o){let s=[],a=(b,$,E,S="error")=>{let k=r.locate(b);s.push({severity:S,message:$,line:k.line,col:k.col,path:b,hint:E})},d=t.routes??[],c={left:yo},l=0,p=()=>n.items.map(b=>b.id),f=new Map,m=[],u=[];d.forEach((b,$)=>{let E=`${e}/routes/${$}`;(f.has(b.id)||n.byId.has(b.id))&&a(E+"/id",`duplicate id "${b.id}"`),f.set(b.id,$);let S=b.kind??"send";i.has(S)||a(E+"/kind",`unknown flow kind "${S}"`+Wa(S,i),`kinds: ${[...i].join(", ")}; add one under "kinds:"`);let k={id:b.id,raw:b,path:E,kind:S,points:[]},T=(z,A)=>{let{id:R}=ls(z),x=n.byId.get(R);if(!x){a(`${E}/${A}`,`unknown node "${R}"`+Wa(R,p()));return}return x};k.from=T(b.from,"from"),k.to=T(b.to,"to"),m.push(k),u.push({r:k})});let h=new Map;for(let b of u){let{r:$}=b;if(!$.from||!$.to||$.raw.points)continue;let E=ls($.raw.from).side,S=ls($.raw.to).side,k=$.raw.via?.[0],T=$.raw.via?.[$.raw.via.length-1],z=(P,w)=>{if(Array.isArray(P))return{x0:P[0],x1:P[0],y0:P[1],y1:P[1],z0:0,z1:0};if(typeof P=="string"){let I=n.byId.get(ls(P).id);if(I)return I.box}return w.box},A=(P,w,I)=>{let L=w??xd(P.box,I);return{node:P,side:L,explicit:!!w,p:[0,0],z:0}};b.a=A($.from,E,z(k,$.to)),b.b=A($.to,S,z(T,$.from));let R=z(k,$.to),x=z(T,$.from);for(let[P,w]of[[b.a,R],[b.b,x]]){let I=`${P.node.id}.${P.side}`;h.has(I)||h.set(I,[]),h.get(I).push({e:P,other:[(w.x0+w.x1)/2,(w.y0+w.y1)/2]})}}for(let[,b]of h){let $=b[0].e,E=$.node.box,S=$.side,k=S==="e"||S==="w"?1:0;b.sort((P,w)=>P.other[k]-w.other[k]);let T=k?E.y0:E.x0,z=k?E.y1:E.x1,A=(T+z)/2,R=Math.max(0,z-T-.3),x=b.length>1?Math.min(wd,R/(b.length-1)):0;b.forEach((P,w)=>{let I=(w-(b.length-1)/2)*x,L=A+I,D=P.e.node.box.z0;if(S==="top"){P.e.p=[(E.x0+E.x1)/2,(E.y0+E.y1)/2],P.e.z=E.z1;return}let[G,se]=uo[S];P.e.p=k?[G>0?E.x1+fo:E.x0-fo,L]:[L,se>0?E.y1+fo:E.y0-fo],P.e.z=D})}let y=[];for(let b of n.items)b.type==="node"&&y.push(b.box);let v=[];for(let b of n.items.filter($=>vt(n.catalog,$.region?.kind)?.shape==="walled")){let{x0:$,y0:E,x1:S,y1:k}=b.box,T=Ks,z=b.region.gate,A=[[{x0:$,y0:E,x1:S,y1:E+T,z0:0,z1:0},"n"],[{x0:$,y0:k-T,x1:S,y1:k,z0:0,z1:0},"s"],[{x0:$,y0:E,x1:$+T,y1:k,z0:0,z1:0},"w"],[{x0:S-T,y0:E,x1:S,y1:k,z0:0,z1:0},"e"]];for(let[R,x]of A)if(z&&z.side===x){if(z.node)continue;let P=z.at??.5,w=z.width??2;if(x==="e"||x==="w"){let I=E+(k-E)*P;v.push({...R,y1:I-w/2},{...R,y0:I+w/2})}else{let I=$+(S-$)*P;v.push({...R,x1:I-w/2},{...R,x0:I+w/2})}}else v.push(R)}let g=new Map;for(let b of u){let{r:$,a:E,b:S}=b;if($.raw.points){$.points=$.raw.points.map(L=>[L[0],L[1],L.length>2?L[2]:rr(n,L[0],L[1])+.01]);continue}if(!E||!S)continue;let k=[];($.raw.via??[]).forEach((L,D)=>{if(Array.isArray(L))if(o){let G=se=>Math.round(Math.round(se/o)*o*1e9)/1e9;L.forEach((se,_)=>{Math.abs(se/o-Math.round(se/o))>1e-6&&a(`${$.path}/via/${D}/${_}`,`${se} is not on the ${o} grid; it is drawn at ${G(se)}`,void 0,"warning")}),k.push({p:[G(L[0]),G(L[1])]})}else k.push({p:[L[0],L[1]]});else{let{id:G,side:se}=ls(L),_=n.byId.get(G);if(!_){a(`${$.path}/via/${D}`,`unknown node "${G}"`+Wa(G,p()));return}let K=se&&se!=="top"?se:"n",[Z,Q]=uo[K],N=_.box;k.push({p:[Z?Z>0?N.x1+.4:N.x0-.4:(N.x0+N.x1)/2,Q?Q>0?N.y1+.4:N.y0-.4:(N.y0+N.y1)/2]})}});let z=y.filter(L=>L!==E.node.box&&L!==S.node.box).concat($.raw.cross?[]:v).filter(L=>!ho(E.node.box,L)&&!ho(S.node.box,L)&&!ho(L,E.node.box)&&!ho(L,S.node.box)),A=E.side==="top"?void 0:uo[E.side],R=S.side==="top"?void 0:uo[S.side],x=[E.p,...k.map(L=>L.p),S.p],P=[E.p],w=A,I=!0;for(let L=0;L+1<x.length;L++){let D=L+2===x.length,G=Sd(x[L],x[L+1],z,g,w,D&&R?[-R[0],-R[1]]:void 0,c);if(!G){I=!1;break}P.push(...G.slice(1));let se=P.length;if(se>=2){let _=Math.sign(P[se-1][0]-P[se-2][0]),K=Math.sign(P[se-1][1]-P[se-2][1]);w=[_,K]}}!I&&c.left<=0?(l++,P=[E.p,[S.p[0],E.p[1]],S.p]):I||(a($.path,`no path found for route "${$.id}" from "${E.node.id}" to "${S.node.id}"`,'add "via" points, or use "points" to draw it by hand',"warning"),P=[E.p,[S.p[0],E.p[1]],S.p]),P=Wr(P);for(let L=0;L+1<P.length;L++)kd(g,P[L],P[L+1]);$.points=Pd(n,P,E,S)}return l&&a(e,`${l} of ${m.length} routes were drawn as plain elbows: the scene is too large to route them all around what stands in the way (${yo.toLocaleString("en")} search steps)`,'split it into scenes, or give the busiest routes "via" points or "points"',"warning"),{routes:m,diags:s}}function ho(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 sp=(t,e)=>`${Math.round(t/en)},${Math.round(e/en)}`;function kd(t,e,n){let r=Math.max(1,Math.round(Math.hypot(n[0]-e[0],n[1]-e[1])/en));for(let i=0;i<=r;i++){let o=sp(e[0]+(n[0]-e[0])*i/r,e[1]+(n[1]-e[1])*i/r);t.set(o,(t.get(o)??0)+1)}}function np(t,e,n){for(let r of n)if(t>r.x0-mo&&t<r.x1+mo&&e>r.y0-mo&&e<r.y1+mo)return!0;return!1}function Sd(t,e,n,r,i,o,s={left:1/0}){if((Math.abs(t[0]-e[0])<1e-6||Math.abs(t[1]-e[1])<1e-6)&&$d(t,e,n)){let _=[Math.sign(e[0]-t[0]),Math.sign(e[1]-t[1])],K=!i||i[0]===_[0]&&i[1]===_[1],Z=!o||o[0]===_[0]&&o[1]===_[1];if(K&&Z)return[t,e]}if(s.left<=0)return null;let a=_=>Math.round((_-t[0])/en),d=_=>Math.round((_-t[1])/en),c=_=>t[0]+_*en,l=_=>t[1]+_*en,p=a(e[0]),f=d(e[1]),m=30,u=Math.min(0,p)-m,h=Math.max(0,p)+m,y=Math.min(0,f)-m,v=Math.max(0,f)+m,g=1.2,b=en,$=.06,E=[[1,0],[-1,0],[0,1],[0,-1]],S=h-u+1,k=v-y+1,T=(_,K)=>(_-u)*k+(K-y),z=new Int8Array(S*k).fill(-1),A=new Float64Array(S*k).fill(-1),R=new Float64Array(S*k*4).fill(1/0),x=(_,K)=>{let Z=T(_,K);return z[Z]<0&&(z[Z]=np(c(_),l(K),n)?1:0),z[Z]===1},P=(_,K)=>{let Z=T(_,K);return A[Z]<0&&(A[Z]=r.get(sp(c(_),l(K)))??0),A[Z]},w=Ja(),I=(_,K)=>(Math.abs(_-p)+Math.abs(K-f))*b,L=i?E.findIndex(_=>_[0]===i[0]&&_[1]===i[1]):-1;w.push({i:0,j:0,d:L,g:0,f:I(0,0),idx:0,hp:0});let D=(_,K)=>Math.abs(_)+Math.abs(K)<=2,G=(_,K)=>Math.abs(_-p)+Math.abs(K-f)<=2,se=0;for(;w.length()&&se++<2e5;){if(s.left--<=0)return null;let _=w.take();if(_.i===p&&_.j===f&&!(o&&_.d>=0&&(E[_.d][0]!==o[0]||E[_.d][1]!==o[1]))){let K=[];for(let Z=_;Z;Z=Z.prev)K.push([c(Z.i),l(Z.j)]);return K.reverse(),K[0]=t,vd(Wr(K),e)}for(let K=0;K<4;K++){let Z=E[K];if(_.d>=0&&Z[0]===-E[_.d][0]&&Z[1]===-E[_.d][1])continue;let Q=_.i+Z[0],N=_.j+Z[1];if(Q<u||Q>h||N<y||N>v||!D(Q,N)&&!G(Q,N)&&x(Q,N))continue;if((D(Q,N)||G(Q,N))&&x(Q,N)&&!(Q===p&&N===f)){let ae=D(Q,N)?i:o&&[-o[0],-o[1]];if(!ae||(D(Q,N)?Z[0]!==ae[0]||Z[1]!==ae[1]:Z[0]!==o[0]||Z[1]!==o[1]))continue}let j=_.d>=0&&_.d!==K?g:0,V=_.g+b+j+P(Q,N)*$,H=T(Q,N)*4+K;R[H]<=V||(R[H]=V,w.push({i:Q,j:N,d:K,g:V,f:V+I(Q,N),prev:_,idx:0,hp:0}))}}return null}function Ja(){let t=[],e=[],n=(s,a)=>s.f<a.f||s.f===a.f&&s.idx<a.idx,r=(s,a)=>{let d=e[s];e[s]=e[a],e[a]=d,e[s].hp=s,e[a].hp=a},i=s=>{for(;s>0;){let a=s-1>>1;if(!n(e[s],e[a]))break;r(s,a),s=a}},o=s=>{for(;;){let a=2*s+1,d=a+1,c=s;if(a<e.length&&n(e[a],e[c])&&(c=a),d<e.length&&n(e[d],e[c])&&(c=d),c===s)return;r(s,c),s=c}};return{length:()=>t.length,push(s){s.idx=t.length,t.push(s),s.hp=e.length,e.push(s),i(s.hp)},take(){let s=e[0],a=e.pop();e.length&&(e[0]=a,a.hp=0,o(0));let d=t.pop();return d!==s&&(t[s.idx]=d,d.idx=s.idx,i(d.hp)),s}}}function vd(t,e){let n=t.map(o=>[o[0],o[1]]),r=n.length,i=n[r-1];if(r>=2){let o=n[r-2];Math.abs(o[1]-i[1])<1e-9?(o[1]=e[1],r>=3&&Math.abs(n[r-3][1]-i[1])<1e-9&&(n[r-3][1]=e[1])):Math.abs(o[0]-i[0])<1e-9&&(o[0]=e[0],r>=3&&Math.abs(n[r-3][0]-i[0])<1e-9&&(n[r-3][0]=e[0]))}return n[r-1]=e,Wr(n)}function $d(t,e,n){let r=Math.max(1,Math.round(Math.hypot(e[0]-t[0],e[1]-t[1])/(en/2)));for(let i=2;i<r-1;i++)if(np(t[0]+(e[0]-t[0])*i/r,t[1]+(e[1]-t[1])*i/r,n))return!1;return!0}function Wr(t){let e=[];for(let n of t){let r=e.length;if(!(r&&Math.abs(e[r-1][0]-n[0])<1e-6&&Math.abs(e[r-1][1]-n[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]-n[0])<1e-6||Math.abs(i[1]-o[1])<1e-6&&Math.abs(o[1]-n[1])<1e-6){e[r-1]=n;continue}}e.push(n)}}return e}function Pd(t,e,n,r){let i=new Set,o=new Set;for(let c of t.items)c.type!=="region"||!vt(t.catalog,c.region.kind)?.floor||(i.add(c.box.x0),i.add(c.box.x1),o.add(c.box.y0),o.add(c.box.y1));let s=[],a=(c,l)=>rr(t,c,l)+.01;for(let c=0;c+1<e.length;c++){let[l,p]=e[c],[f,m]=e[c+1],u=[0,1];if(Math.abs(p-m)<1e-6)for(let h of i){let y=(h-l)/(f-l);y>1e-6&&y<1-1e-6&&u.push(y)}else for(let h of o){let y=(h-p)/(m-p);y>1e-6&&y<1-1e-6&&u.push(y)}u.sort((h,y)=>h-y);for(let h=0;h+1<u.length;h++){let y=u[h],v=u[h+1],g=(y+v)/2,b=a(l+(f-l)*g,p+(m-p)*g),$=[l+(f-l)*y,p+(m-p)*y,b],E=[l+(f-l)*v,p+(m-p)*v,b],S=s[s.length-1];S&&(Math.abs(S[0]-$[0])>1e-6||Math.abs(S[1]-$[1])>1e-6||Math.abs(S[2]-$[2])>1e-6)?s.push($):S||s.push($),s.push(E)}}s.length&&(s[0][2]=n.side==="top"?n.z:n.node.box.z0+.01,s[s.length-1][2]=r.side==="top"?r.z:r.node.box.z0+.01);let d=[];for(let c of s){let l=d.length;if(l>=2){let p=d[l-2],f=d[l-1],m=Math.abs(p[2]-f[2])<1e-9&&Math.abs(f[2]-c[2])<1e-9,u=Math.abs(p[0]-f[0])<1e-6&&Math.abs(f[0]-c[0])<1e-6||Math.abs(p[1]-f[1])<1e-6&&Math.abs(f[1]-c[1])<1e-6;if(m&&u){d[l-1]=c;continue}}d.push(c)}return d}function Wa(t,e){let n=Ns(t,e);return n?` (did you mean "${n}"?)`:""}function cs(t){return[ke(t.x0,t.y0,t.z1),ke(t.x1,t.y0,t.z1),ke(t.x1,t.y0,t.z0),ke(t.x1,t.y1,t.z0),ke(t.x0,t.y1,t.z0),ke(t.x0,t.y1,t.z1)]}function sn(t){let e=t.map(o=>o[0]),n=t.map(o=>o[1]),r=Math.min(...e),i=Math.min(...n);return{x:r,y:i,w:Math.max(...e)-r,h:Math.max(...n)-i}}function or(t,e){let n=t,r=(a,d)=>{let c=[];for(let l=0;l<n.length;l++){let p=n[l],f=n[(l+1)%n.length],m=a(p),u=a(f);m&&c.push(p),m!==u&&c.push(d(p,f))}n=c},i=a=>(d,c)=>[a,d[1]+(c[1]-d[1])*(a-d[0])/(c[0]-d[0])],o=a=>(d,c)=>[d[0]+(c[0]-d[0])*(a-d[1])/(c[1]-d[1]),a];if(r(a=>a[0]>=e.x,i(e.x)),!n.length||(r(a=>a[0]<=e.x+e.w,i(e.x+e.w)),!n.length)||(r(a=>a[1]>=e.y,o(e.y)),!n.length)||(r(a=>a[1]<=e.y+e.h,o(e.y+e.h)),!n.length))return 0;let s=0;for(let a=0;a<n.length;a++){let d=n[a],c=n[(a+1)%n.length];s+=d[0]*c[1]-c[0]*d[1]}return Math.abs(s)/2}function el(t,e){let n=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 n>0&&r>0?n*r:0}function op(t,e){let n=0;for(let r=0;r+1<t.length;r++){let i=t[r],o=t[r+1],s=Math.hypot(o[0]-i[0],o[1]-i[1]),a=Math.max(1,Math.ceil(s/4));for(let d=0;d<a;d++){let c=i[0]+(o[0]-i[0])*(d+.5)/a,l=i[1]+(o[1]-i[1])*(d+.5)/a;c>=e.x&&c<=e.x+e.w&&l>=e.y&&l<=e.y+e.h&&(n+=s/a*4)}}return n}var tn=64,wo=class{cells=new Map;n=0;add(e,n,r,i,o){for(let s=Math.floor(n/tn);s<=Math.floor(i/tn);s++)for(let a=Math.floor(r/tn);a<=Math.floor(o/tn);a++){let d=s*1048576+a,c=this.cells.get(d);c||this.cells.set(d,c=[]),c[c.length-1]!==e&&c.push(e)}}query(e,n,r,i){let o=new Set;for(let s=Math.floor(e/tn);s<=Math.floor(r/tn);s++)for(let a=Math.floor(n/tn);a<=Math.floor(i/tn);a++){let d=this.cells.get(s*1048576+a);if(d)for(let c of d)o.add(c)}return[...o].sort((s,a)=>s-a)}},Xa=t=>{let e=1/0,n=1/0,r=-1/0,i=-1/0;for(let[o,s]of t)o<e&&(e=o),o>r&&(r=o),s<n&&(n=s),s>i&&(i=s);return[e,n,r,i]},xo=new WeakMap;function yn(t,e){let n=xo.get(t);for((!n||n.n>t.length)&&xo.set(t,n=new wo);n.n<t.length;n.n++){let[r,i,o,s]=e(t[n.n]);n.add(n.n,r,i,o,s)}return n}function rp(t){let e=xo.get(t);for((!e||e.n>t.length)&&xo.set(t,e=new wo);e.n<t.length;e.n++){let n=t[e.n].pts;for(let r=0;r+1<n.length;r++){let i=n[r],o=n[r+1],s=e.n*65536+r,a=Math.max(1,Math.ceil(Math.hypot(o[0]-i[0],o[1]-i[1])/(tn/2)));for(let d=0;d<a;d++){let c=d/a,l=(d+1)/a,p=i[0]+(o[0]-i[0])*c,f=i[1]+(o[1]-i[1])*c,m=i[0]+(o[0]-i[0])*l,u=i[1]+(o[1]-i[1])*l;e.add(s,Math.min(p,m)-1,Math.min(f,u)-1,Math.max(p,m)+1,Math.max(f,u)+1)}}}return e}var qs=(t,e,n,r,i)=>t.query(e,n,r,i),ir=t=>Xa(t),bo=t=>[t.x,t.y,t.x+t.w,t.y+t.h];function ip(t,e,n,[r,i,o,s]){let a=0,d=n-1;for(let c of[0,1]){let l=e[c]-t[c],p=c?i:r,f=c?s:o;if(Math.abs(l)<1e-12){if(t[c]<p||t[c]>f)return[1,0];continue}let m=(p-t[c])/l*n-.5,u=(f-t[c])/l*n-.5;m>u&&([m,u]=[u,m]),a=Math.max(a,Math.floor(m)-1),d=Math.min(d,Math.ceil(u)+1)}return[a,d]}var Rn=class t{polys=[];rects=[];lines=[];solids=[];slants=[];budget={spots:1/0,over:!1,told:!1};hidden(e){let n=0;for(let r of qs(yn(this.solids,ir),...bo(e)))n+=or(this.solids[r],e);return n}hiddenPoly(e){let n=0;for(let r of qs(yn(this.solids,ir),...Xa(e)))n+=Jr(e,this.solids[r]);return n}costPoly(e,n=1/0){let r=Xa(e),i=0;for(let o of qs(yn(this.polys,s=>ir(s.poly)),...r))i+=Jr(e,this.polys[o].poly);for(let o of qs(yn(this.rects,s=>bo(s.r)),...r))i+=or(e,this.rects[o].r)*2;for(let o of qs(yn(this.slants,ir),...r))i+=Jr(e,this.slants[o])*2;if(i>=n)return i;for(let o of qs(rp(this.lines),...r)){if(i>=n)return i;let s=this.lines[Math.floor(o/65536)].pts,a=o%65536,d=s[a],c=s[a+1],l=Math.hypot(c[0]-d[0],c[1]-d[1]),p=Math.max(1,Math.ceil(l/4)),[f,m]=ip(d,c,p,r);for(let u=f;u<=m;u++)sl(e,[d[0]+(c[0]-d[0])*(u+.5)/p,d[1]+(c[1]-d[1])*(u+.5)/p])&&(i+=l/p*4*.6)}return i}cost(e,n,r=.6){let i=bo(e),o=0;for(let s of qs(yn(this.polys,a=>ir(a.poly)),...i)){let a=this.polys[s];o+=or(a.poly,e)*(a.owner===n?1.5:1)}for(let s of qs(yn(this.rects,a=>bo(a.r)),...i)){let a=this.rects[s];(a.owner!==n||!n)&&(o+=el(a.r,e)*2)}for(let s of qs(yn(this.slants,ir),...i))o+=or(this.slants[s],e)*2;if(r){let s=-1,a=0;for(let d of qs(rp(this.lines),...i)){let c=Math.floor(d/65536);c!==s&&(s>=0&&(o+=a*r),s=c,a=0);let l=this.lines[c].pts,p=d%65536,f=l[p],m=l[p+1],u=Math.hypot(m[0]-f[0],m[1]-f[1]),h=Math.max(1,Math.ceil(u/4)),[y,v]=ip(f,m,h,i);for(let g=y;g<=v;g++){let b=f[0]+(m[0]-f[0])*(g+.5)/h,$=f[1]+(m[1]-f[1])*(g+.5)/h;b>=e.x&&b<=e.x+e.w&&$>=e.y&&$<=e.y+e.h&&(a+=u/h*4)}}s>=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}},ap=14;function Xr(t,e,n,r){let i=Math.max(t.name?ms(t.name,yt.lbl):0,t.sub?ms(t.sub,yt.sub):0)+4,o=(t.name?1:0)+(t.sub?1:0),s=n-(t.name?11:9)-1,a=(o-1)*ap+(t.name?11:9)+4;return{x:r==="start"?e-2:r==="end"?e-i+2:e-i/2,y:s,w:i,h:a}}function Qr(t,e,n,r,i,o){let s=sn(n),a=ke((e.x0+e.x1)/2,(e.y0+e.y1)/2,e.z1)[0],c=((t.name?1:0)+(t.sub?1:0)-1)*ap+4,l=s.y-6-c,p=s.y+Math.min(s.h,60)*.45,f=[];o&&f.push({...o,pen:0}),f.push({x:a,y:l,anchor:"middle",pen:o?20:0});for(let h of[12,24,40])f.push({x:a,y:l-h,anchor:"middle",pen:20+h});for(let h of[-30,30,-60,60])f.push({x:a+h,y:l-4,anchor:"middle",pen:30+Math.abs(h)});f.push({x:s.x+s.w+8,y:p,anchor:"start",pen:120}),f.push({x:s.x-8,y:p,anchor:"end",pen:120}),f.push({x:a,y:s.y+s.h+14,anchor:"middle",pen:300});let m,u=1/0;for(let h of f){let y=Xr(t,h.x,h.y,h.anchor),v=r.cost(y,i,.15)*2+h.pen;v<u&&(u=v,m={x:h.x,y:h.y,anchor:h.anchor,rect:y})}return m}function tl(t,e,n,r){return{x:(r==="start"?e:r==="end"?e-t:e-t/2)-2,y:n-14,w:t+4,h:28}}function ko(t,e,n,r,i){let o=[{...r,pen:0}];for(let l of[-46,-66,-86,-106,-126,-146])for(let p of[0,-70,70,-140,140])o.push({x:e+p,y:n+l,anchor:"middle",pen:10+(-l-46)*.5+Math.abs(p)*.4});for(let l of[34,60,86])o.push({x:e,y:n+l,anchor:"middle",pen:60+l*.3});let s=r.x-e,a=r.y-n;for(let l of[-1,1])for(let p of[16,32,48])o.push({...r,y:n+a+l*p,x:e+s,pen:5+p});for(let l of[-1,1])for(let p of[30,60,90])for(let f of[0,16,-16])o.push({...r,x:e+s+l*p,y:n+a+f,pen:8+p*.6+Math.abs(f)});let d,c=1/0;for(let l of o){let p=tl(t,l.x,l.y,l.anchor),f=i.cost(p,void 0,.05)*3+l.pen;f<c&&(c=f,d={x:l.x,y:l.y,anchor:l.anchor,rect:p})}return d}var lp=t=>{let e=0;for(let n=0;n<t.length;n++){let r=t[n],i=t[(n+1)%t.length];e+=r[0]*i[1]-i[0]*r[1]}return e/2},Qa=t=>lp(t)<0?[...t].reverse():t;function sl(t,e){let n=Qa(t);for(let r=0;r<n.length;r++){let i=n[r],o=n[(r+1)%n.length];if((o[0]-i[0])*(e[1]-i[1])-(o[1]-i[1])*(e[0]-i[0])<0)return!1}return!0}function Jr(t,e){let n=Qa(t),r=Qa(e);for(let i=0;i<r.length&&n.length;i++){let o=r[i],s=r[(i+1)%r.length],a=c=>(s[0]-o[0])*(c[1]-o[1])-(s[1]-o[1])*(c[0]-o[0]),d=n;n=[];for(let c=0;c<d.length;c++){let l=d[c],p=d[(c+1)%d.length],f=a(l),m=a(p);if(f>=0&&n.push(l),f>=0!=m>=0){let u=f/(f-m);n.push([l[0]+(p[0]-l[0])*u,l[1]+(p[1]-l[1])*u])}}}return n.length>=3?Math.abs(lp(n)):0}var So=24;function vo(t,e){let[n,r,i,o]=e,s=t.x+t.w/2,a=t.y+t.h/2,d=[["left",s-n],["right",n+i-s],["top",a-r],["bottom",r+o-a]];d.sort((l,p)=>l[1]-p[1]);let c=d[0][0];return c==="left"?{edge:c,dx:-(t.x+t.w-n)-So,dy:0}:c==="right"?{edge:c,dx:n+i-t.x+So,dy:0}:c==="top"?{edge:c,dx:0,dy:-(t.y+t.h-r)-So}:{edge:c,dx:0,dy:r+o-t.y+So}}function $o(t,e,n){let r=$=>{let E=0;for(let S=$.parent;S;S=S.parent)E++;return E},i=$=>$.box.x0+$.box.y0+$.box.z0*.01,o=t.items.filter($=>$.type==="region").sort(($,E)=>r($)-r(E)||i($)-i(E)),s=t.items.filter($=>$.type==="node").sort(($,E)=>i($)-i(E)||$.box.z0-E.box.z0),a=[],d=Math.min(90,400/Math.max(1,o.length)),c=650;o.forEach(($,E)=>{let S=sn(cs($.box));a.push({id:$.id,kind:"region",...vo(S,n),delay:Math.round(E*d),dur:c,bbox:S})});let l=250+Math.round(d*o.length),p=Math.min(70,700/Math.max(1,s.length)),f=600;s.forEach(($,E)=>{let S=sn(cs($.box));a.push({id:$.id,kind:"node",...vo(S,n),delay:Math.round(l+E*p),dur:f,bbox:S})});let m=s.length?l+(s.length-1)*p:l,u=Math.round(m+300),h=Math.min(30,300/Math.max(1,e.length)),y=400,v=e.filter($=>$.points.length>=2).map(($,E)=>({id:$.id,delay:Math.round(u+E*h),dur:y})),g={delay:u+200,dur:400},b=Math.max(...a.map($=>$.delay+$.dur),...v.map($=>$.delay+$.dur),g.delay+g.dur);return{pieces:a,routes:v,labels:g,total:b}}function nl(t){return Math.max(5600,Math.min(12500,2600+t.length*40))}function Po(t,e,n,r,i,o){let s=[],a=(A,R,x,P="error")=>{let w=i.locate(A);s.push({severity:P,message:R,line:w.line,col:w.col,path:A,hint:x})},d=t.steps??[],c=new Set(Object.keys(o.kinds)),l=new Map(r.map(A=>[A.id,A])),p=()=>[...n.byId.keys(),...l.keys()],f=new Map;d.forEach((A,R)=>{A.id&&(f.has(A.id)&&a(`${e}/steps/${R}/id`,`duplicate step id "${A.id}"`),f.set(A.id,R+1))});let m=d.length,u=(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 x=f.get(A);return x===void 0&&a(R,`unknown step "${A}"`+ys(A,f.keys())),x},h=A=>Vs(o,o.kinds[A]?.color??"control"),y=[],v=A=>{y.includes(A)||y.push(A)};for(let A of r)v(A.kind);let g={},b=(A,R,x,P)=>{if(R===void 0&&x===void 0)return;let w=R!==void 0?u(R,P+"/appears"):1,I=x!==void 0?u(x,P+"/disappears"):m+1;g[A]=Array.from({length:m},(L,D)=>D+1>=(w??1)&&D+1<(I??m+1))};for(let A of n.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 $=[],E=[],S=[],k=[],T=()=>{for(let A of r){if(A.raw.appears!==void 0||A.raw.disappears!==void 0)continue;let R=[A.from,A.to].map(x=>x&&(g[x.id]??z(x)));R.some(Boolean)&&(g[A.id]=Array.from({length:m},(x,P)=>R.every(w=>!w||w[P])))}},z=A=>{for(let R=A.parent;R;R=R.parent)if(g[R.id])return g[R.id]};return d.forEach((A,R)=>{let x=R+1,P=`${e}/steps/${R}`,w=A.kind??"control";c.has(w)||a(P+"/kind",`unknown flow kind "${w}"`+ys(w,c)),v(w);let I=new Set,L=[];(A.animate??[]).forEach((_,K)=>{let Z=Array.isArray(_)?_:[_],Q=[];Z.forEach((N,j)=>{let V=Array.isArray(_)?`${P}/animate/${K}/${j}`:`${P}/animate/${K}`,H,ae;if(typeof N=="string"){let te=/^([^:\s]+)\s*(?::\s*(\S+))?$/.exec(N.trim());H=te?te[1]:N,ae=te?.[2]}else{let te=Object.entries(N)[0];H=te[0],ae=te[1]}let ue=l.get(H);if(!ue){a(V,`unknown route "${H}"`+ys(H,l.keys()));return}if(ae&&!c.has(ae)){a(V,`unknown flow kind "${ae}"`+ys(ae,c));return}let J=ae??ue.kind;v(J),Q.push({route:H,kind:J,color:h(J)}),I.add(H),ue.from&&I.add(ue.from.id),ue.to&&I.add(ue.to.id)}),Q.length&&L.push(Q)});let D=[];(A.pulse??[]).forEach((_,K)=>{let Z=n.byId.get(_);if(!Z){a(`${P}/pulse/${K}`,`unknown node "${_}"`+ys(_,n.byId.keys()));return}let Q,N,j,V,H=Z.node?Tn(n.catalog,Z.node.asset):void 0;if(H?.pulse)[Q,N,j,V]=H.pulse(Z.box);else{let J=Z.box;Q=(J.x0+J.x1)/2,N=(J.y0+J.y1)/2,j=J.z1,V=Math.max(22,Math.min(60,(J.x1-J.x0+J.y1-J.y0)*8.5))}let[ae,ue]=ke(Q,N,j);D.push([ae,ue,V*1.7,V*.98]),I.add(_)}),(A.highlight??[]).forEach((_,K)=>{!n.byId.has(_)&&!l.has(_)&&a(`${P}/highlight/${K}`,`unknown id "${_}"`+ys(_,p())),I.add(_)});for(let[_,K]of[["show",!0],["hide",!1]])(A[_]??[]).forEach((Z,Q)=>{if(!n.byId.has(Z)&&!l.has(Z)){a(`${P}/${_}/${Q}`,`unknown id "${Z}"`+ys(Z,p()));return}let N=g[Z]??(g[Z]=Array(m).fill(!K));for(let j=R;j<m;j++)N[j]=K});if((A.say??[]).forEach((_,K)=>{let Z,Q;if(Array.isArray(_.at))[Z,Q]=ke(_.at[0],_.at[1],_.at[2]??.36);else{let j=n.byId.get(_.at);if(!j){a(`${P}/say/${K}/at`,`unknown node "${_.at}"`+ys(_.at,n.byId.keys()));return}let V=j.box;[Z,Q]=ke((V.x0+V.x1)/2,(V.y0+V.y1)/2,V.z1+.75)}let N=_.kind??w;c.has(N)||a(`${P}/say/${K}/kind`,`unknown flow kind "${N}"`+ys(N,c)),E.push({step:x,x:Z+(_.dx??0),y:Q+(_.dy??(Array.isArray(_.at)?0:-46)),ax:Z,ay:Q,text:_.text,kind:N,anchor:_.anchor??"middle"})}),(A.mark??[]).forEach((_,K)=>{if(_.at){S.push({step:x,p:[_.at[0],_.at[1],_.at[2]??.36]});return}let Z=_.on?l.get(_.on):void 0;if(!Z){a(`${P}/mark/${K}`,_.on?`unknown route "${_.on}"`+ys(_.on,l.keys()):'a mark needs "on: ROUTE" or "at: [x, y]"');return}let Q=Z.points[Z.points.length-1];S.push({step:x,p:[Q[0],Q[1],Q[2]+.6],on:Z.id}),I.add(Z.id)}),t.badges&&A.badge!==!1){let _=Array.isArray(A.badge)?[A.badge[0],A.badge[1],A.badge[2]??.36]:void 0,K=typeof A.badge=="string"?A.badge:L[0]?.[0]?.route,Z=K?l.get(K):void 0;if(!_)if(Z)_=rl(Z.points);else if(K&&n.byId.get(K)){let Q=n.byId.get(K).box;_=[(Q.x0+Q.x1)/2,(Q.y0+Q.y1)/2,Q.z1+.3]}else typeof A.badge=="string"&&a(`${P}/badge`,`unknown id "${A.badge}"`+ys(A.badge,p()));_&&k.push({step:x,num:A.number??x,kind:w,p:_})}for(let _ of[...I])for(let K=n.byId.get(_)?.parent;K;K=K.parent)I.add(K.id);for(let _ of n.items)_.region?.kind==="tunnel"&&(_.region.around??[]).some(K=>I.has(K))&&I.add(_.id);let G;if(A.focus?.length){let _=1/0,K=1/0,Z=-1/0,Q=-1/0;A.focus.forEach((N,j)=>{let V=n.byId.get(N);if(!V){a(`${P}/focus/${j}`,`unknown node or region "${N}"`+ys(N,n.byId.keys()));return}let H=V.box;for(let[ae,ue,J]of[[H.x0,H.y0,H.z1],[H.x1,H.y0,H.z0],[H.x0,H.y1,H.z0],[H.x1,H.y1,H.z0],[H.x1,H.y0,H.z1],[H.x0,H.y1,H.z1]]){let[te,Se]=ke(ae,ue,J);_=Math.min(_,te),K=Math.min(K,Se),Z=Math.max(Z,te),Q=Math.max(Q,Se)}I.add(N)}),_<1/0&&(G=[Math.round(_-60),Math.round(K-70),Math.round(Z+60),Math.round(Q+40)])}let se=A.caption??"";$.push({n:x,num:A.number??x,kind:w,color:h(w),heading:A.heading,caption:se,command:A.command??"",phases:L,pulses:D,lit:[...I],duration:A.duration===void 0||A.duration==="auto"?nl(se):A.duration,...G?{focus:G}:{}})}),T(),{steps:$,says:E,marks:S,badges:k,vis:g,diags:s,kindsUsed:y}}function rl(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])),n=e.reduce((r,i)=>r+i,0)/2;for(let r=0;r<e.length;r++){if(n<=e[r]&&e[r]>0){let i=n/e[r],o=t[r],s=t[r+1];return[o[0]+(s[0]-o[0])*i,o[1]+(s[1]-o[1])*i,o[2]+(s[2]-o[2])*i]}n-=e[r]}return t[0]}function ys(t,e){let n=Ns(t,e);return n?` (did you mean "${n}"?)`:""}function cp(t,e){if(!e)return t;let[n,r,i,o]=e,s=t[2]/t[3],a=i-n,d=o-r;a/d<s?a=d*s:d=a/s,a=Math.min(a,t[2]),d=Math.min(d,t[3]);let c=(n+i)/2,l=(r+o)/2,p=Math.max(t[0],Math.min(t[0]+t[2]-a,c-a/2)),f=Math.max(t[1],Math.min(t[1]+t[3]-d,l-d/2));return[p,f,a,d]}var Eo=(t,e)=>e.role??vt(t,e.kind)?.role,Ao=(t,e)=>vt(t,e.region.kind)?.shape;function To({scene:t,layout:e,routes:n,steps:r,theme:i,id:o,gridStep:s=1}){let a=new Dn,d={base:"",floor:"",flows:"",blocks:[],air:"",labels:"",marks:"",badges:""},c=new Rn;c.budget.spots=Oo;let l=w=>r.vis[w]?{"data-vis":"1"}:{},p=e.items.filter(w=>w.type==="region"),f=w=>{let I=0;for(let L=w.parent;L;L=L.parent)I++;return I},m=e.catalog,u=p.filter(w=>Ao(m,w)!=="walled"&&Ao(m,w)!=="tunnel"),h=Ar(u.map(w=>({box:w.box,r:w}))).map(w=>w.r).sort((w,I)=>f(w)-f(I));for(let w of h)d.base+=Md(a,m,w,l(w.id),s);for(let w of p.filter(I=>Ao(m,I)==="walled")){for(let L of Mo(w))c.solids.push(cs(L));for(let L of Mo(w))d.blocks.push({box:L,svg:fe("g",{class:`blk k-${Eo(m,w.region)} wall${w.region.ghost?" ghost":""}`,"data-id":w.id,"data-dim":"1",...l(w.id)},a.blockFaces(L))});let I=w.region.gate;if(I&&!I.node){let L=Hr(w,I.height??(w.region.height??.8)+.3,.3,.3);c.solids.push(cs(L)),d.blocks.push({box:L,svg:fe("g",{class:"blk k-gate","data-id":w.id,...l(w.id)},a.blockFaces(L))})}w.region.label&&(w.region["label-style"]??"face")!=="none"&&(d.labels+=a.faceText(w.box.x0+.3,w.box.y1,w.box.z0+.13,w.region.label,"slabname sm fz",yt.sm,"left","start",{"data-id":w.id,...l(w.id)}))}for(let w of p.filter(I=>Ao(m,I)==="tunnel"))d.air+=Ed(a,w,l(w.id));let y=e.items.filter(w=>w.type==="node");for(let w of y){let I=w.node,L=hs(m,I.asset),D=I.ghost||(I.deco??[]).includes("ghost"),G=["blk",`k-${I.role??L.role}`,L.cls,D?"ghost":""].filter(Boolean).join(" ");d.blocks.push({box:w.box,svg:fe("g",{class:G,"data-id":w.id,"data-dim":"1",...l(w.id)},L.draw(a,w.box,I))}),c.polys.push({poly:cs(w.box),owner:w.id}),c.solids.push(cs(w.box))}let v=Ar(d.blocks).map(w=>w.svg).join(""),g=new Set,b={};for(let w of n){if(w.points.length<2)continue;let I=w.points.map(G=>ke(G[0],G[1],G[2]));I.forEach(G=>a.bounds.add(G));let L="M"+I.map(vn).join(" L");b[w.id]=L;let D=w.raw.arrow!==!1;D&&g.add(w.kind),d.flows+=fe("g",{"data-hl":w.id,"data-id":w.id,...l(w.id)},fe("path",{d:L,class:`flow f-${w.kind}`,"marker-end":D?`url(#ah-${o}-${w.kind})`:void 0})),c.lines.push({pts:I,owner:w.id})}for(let w of g)a.def(`ah-${o}-${w}`,fe("marker",{id:`ah-${o}-${w}`,viewBox:"0 0 10 10",refX:"7",refY:"5",markerWidth:"4.2",markerHeight:"4.2",orient:"auto-start-reverse"},fe("path",{d:"M0,0 L10,5 L0,10 z",style:`fill:${Vs(i,i.kinds[w]?.color??"control")}`})));for(let w of a.planePolys)c.slants.push(w);let $=y.filter(w=>w.node.label||w.node.sub).sort((w,I)=>(I.box.x1-I.box.x0)*(I.box.y1-I.box.y0)-(w.box.x1-w.box.x0)*(w.box.y1-w.box.y0));for(let w of $)d.labels+=Od(a,m,w,c,l(w.id));let E=[];for(let w of n)if(w.raw.label&&w.points.length>=2){let I=Td(a,w,c,l(w.id),e);d.floor+=I.svg,I.warning&&E.push({path:`${w.path}/label`,message:I.warning}),c.budget.over&&!c.budget.told&&(c.budget.told=!0,E.push({path:w.path,message:`from route "${w.id}" on, route labels were placed without weighing what other labels and lines cover: the scene is too large to search every spot (${Oo.toLocaleString("en")} spots); split it into scenes, or give the labels "along", "side" or "at"`}))}(t.notes??[]).forEach((w,I)=>{let L=Nd(a,w,e,n,`${o}-note-${I}`);w.floor?d.floor+=L:d.labels+=L});let S=[],k=new Map;for(let w of r.says){let I=k.get(w.step)??c.fork();k.set(w.step,I);let L=ms(w.text,yt.say)+18,D=ko(L,w.ax,w.ay,{x:w.x,y:w.y,anchor:w.anchor},I);I.rects.push({r:D.rect,owner:""}),S.push({step:w.step,...D.rect,text:w.text});let G=D.rect.x+2;a.bounds.addRect(D.rect.x,D.rect.y,D.rect.w,D.rect.h);let se=Vs(i,i.kinds[w.kind]?.color??"control");d.marks+=fe("g",{class:"say","data-step":w.step},fe("rect",{x:G,y:D.y-12,width:L,height:24,rx:12,style:`stroke:${se}`})+fe("text",{x:G+L/2,y:D.y+4,"text-anchor":"middle",style:`fill:${se}`},xt(w.text)))}for(let w of r.marks){let[I,L]=ke(...w.p);a.bounds.addRect(I-12,L-12,24,24),d.marks+=fe("g",{class:"xm","data-step":w.step,"data-hl":w.on},fe("circle",{cx:I,cy:L,r:10})+fe("path",{d:`M${ht(I-4.5)},${ht(L-4.5)} L${ht(I+4.5)},${ht(L+4.5)} M${ht(I+4.5)},${ht(L-4.5)} L${ht(I-4.5)},${ht(L+4.5)}`}))}for(let w of r.badges){let[I,L]=ke(...w.p);a.bounds.addRect(I-13,L-13,26,26),d.badges+=fe("g",{class:`badge c-${w.kind}`,"data-go":w.step,"data-badge":w.step,tabindex:"0",role:"button","aria-label":`Step ${w.num}`},fe("circle",{cx:I,cy:L,r:11.5})+fe("text",{x:I,y:L+.5},String(w.num)))}let T=a.bounds,z=22,A=T.empty?[0,0,100,100]:[Math.floor(T.x0-z),Math.floor(T.y0-z),Math.ceil(T.x1-T.x0+z*2),Math.ceil(T.y1-T.y0+z*2)],R=[...a.defs.values()].join(""),x=(w,I)=>fe("g",{class:"g-"+w},I);return{svg:fe("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:A.join(" "),role:"img","aria-label":t.aria??t.title,"data-scene":o},fe("defs",{},R)+x("base",d.base)+x("floor",d.floor)+x("flows",d.flows)+x("blocks",v)+x("air",d.air)+x("labels",d.labels)+x("marks",d.marks)+x("badges",d.badges)+x("anim","")),viewBox:A,texts:a.texts,paths:b,warnings:E,callouts:S,assembly:$o(e,n,A)}}function Ad(t,e){let n=t.z1+.002,r=1e-6,i=[],o=(s,a)=>{let d=ke(s[0],s[1],n),c=ke(a[0],a[1],n);i.push(`M${vn(d)}L${vn(c)}`)};for(let s=Math.ceil((t.x0+r)/e)*e;s<t.x1-r;s+=e)o([s,t.y0],[s,t.y1]);for(let s=Math.ceil((t.y0+r)/e)*e;s<t.y1-r;s+=e)o([t.x0,s],[t.x1,s]);return i.length?fe("path",{class:"grid",d:i.join("")}):""}function Md(t,e,n,r,i=1){let o=n.region,s=n.box,a=Eo(e,o),d=vt(e,o.kind),c=d?.shape,l={"data-id":n.id,"data-dim":"1",...r},p="";c==="cloud"?p=fe("g",{class:`blk k-${a} cloud`,...l},sr(t,s)):c==="zone"?p=fe("g",{class:`zone k-${a}`,...l},t.poly([[s.x0,s.y0,s.z1],[s.x1,s.y0,s.z1],[s.x1,s.y1,s.z1],[s.x0,s.y1,s.z1]])):p=fe("g",{class:`blk k-${a}${o.ghost?" ghost":""}`,...l},t.blockFaces(s)+Ad(s,i));let f=o["label-style"]??d?.labelStyle;if(o.label&&f!=="none")if(f==="face"){let m=s.z1-s.z0,u=g=>g.size*.73/Qe,h=c==="slab"&&.28+u(yt.slabname)+.08>m,y=c==="slab"&&!h,v=y?s.z0+.28:h?s.z0+Math.max(.02,(m-u(yt.sm))/2):s.z0+Math.min(.1,m*.25);p+=fe("g",l,t.faceText(s.x0+(y?.6:.3),s.y1,v,o.label,y?"slabname":"slabname sm",y?yt.slabname:yt.sm,"left","start"))}else if(f==="face-right")p+=fe("g",l,t.faceText(s.x1,s.y0+.6,s.z0+Math.max(.14,(s.z1-s.z0)*.2),o.label,"slabname",yt.slabname,"right","end"));else{let m=c==="cloud"?"middle":"start",u=c==="cloud"?(s.x0+s.x1)/2:s.x0+.35,h=c==="cloud"?(s.y0+s.y1)/2:s.y1-.35;p+=fe("g",l,t.floorText(u,h,s.z1+.01,o.label,"slabname sm","x",m))}return p}function Mo(t){let{x0:e,y0:n,x1:r,y1:i,z0:o,z1:s}=t.box,a=Ks,d=t.region.gate,c=[],l=f=>{f.x1-f.x0>1e-6&&f.y1-f.y0>1e-6&&c.push({...f,z0:o,z1:s})},p=(f,m,u)=>{if(!d||d.side!==u)return[[f,m]];let h=d.at??.5,y=d.width??2,v=u==="e"||u==="w"?n+(i-n)*h:e+(r-e)*h;return[[f,v-y/2],[v+y/2,m]]};for(let[f,m]of p(e,r,"n"))l({x0:f,y0:n,x1:m,y1:n+a});for(let[f,m]of p(n+a,i-a,"w"))l({x0:e,y0:f,x1:e+a,y1:m});for(let[f,m]of p(n+a,i-a,"e"))l({x0:r-a,y0:f,x1:r,y1:m});for(let[f,m]of p(e,r,"s"))l({x0:f,y0:i-a,x1:m,y1:i});return c}function Od(t,e,n,r,i){let o=n.node,s=hs(e,o.asset),a=n.box,d={name:o.label,sub:o.sub},c=o["label-at"],l;if(c){let f=sn(cs(a)),m=c.side??"above",u=f.y+Math.min(f.h,60)*.45;m==="right"?l={x:f.x+f.w+8,y:u,anchor:"start"}:m==="left"?l={x:f.x-8,y:u,anchor:"end"}:m==="below"?l={x:f.x+f.w/2,y:f.y+f.h+14,anchor:"middle"}:l=Qr(d,a,cs(a),new Rn,n.id),l={...l,x:l.x+(c.dx??0),y:l.y+(c.dy??0)}}else{let f=s.label?s.label(a,o,!!o.sub):void 0;l=Qr(d,a,cs(a),r,n.id,f)}r.rects.push({r:Xr(d,l.x,l.y,l.anchor),owner:""});let p="";return o.label&&(p+=t.text(l.x,l.y,o.label,"lbl",yt.lbl,l.anchor,{},n.id)),o.sub&&(p+=t.text(l.x,o.label?l.y+14:l.y,o.sub,"sub mono",yt.sub,l.anchor,{},n.id)),fe("g",{"data-id":n.id,"data-dim":"1",...i},p)}function Ed(t,e,n){let{x0:r,y0:i,x1:o,y1:s,z0:a,z1:d}=e.box,c=t.blockFaces(e.box),l=o-r>=s-i,p=Math.max(1,Math.round((l?o-r:s-i)/1.6));for(let m=1;m<p;m++){let u=l?r+(o-r)*m/p:i+(s-i)*m/p;c+=t.poly(l?[[u,i,d],[u,s,d],[u,s,a]]:[[r,u,d],[o,u,d],[o,u,a]],"rib")}let f=e.region.label;return f&&e.region["label-style"]!=="none"&&(c+=l?t.faceText(r+.35,s,a+.14,f,"tunname",yt.tunname,"left","start"):t.faceText(o,s-.35,a+.18,f,"tunname",yt.tunname,"right","start")),fe("g",{class:"tunnel","data-id":e.id,"data-dim":"1",...n},c)}var Oo=2e4;function Td(t,e,n,r,i){let o=typeof e.raw.label=="string"?{text:e.raw.label}:e.raw.label,s=`floor mono t-${e.kind}`,a={"data-hl":e.id,...r},d=yt.floor;if(o.at){let g=o.at.length>2?o.at[2]:e.points[0][2];return{svg:t.floorText(o.at[0],o.at[1],g,o.text,s,o.dir??"x",o.anchor??"start",a)}}let c=e.points,l=[];for(let g=0;g+1<c.length;g++){let b=c[g],$=c[g+1];Math.abs(b[2]-$[2])>1e-6||l.push({i:g,len:Math.hypot($[0]-b[0],$[1]-b[1])})}if(!l.length)return{svg:"",warning:`label "${o.text}" of route "${e.id}" was dropped: the route has no level segment`};let p=o.along?l.filter(g=>g.i===Math.min(o.along-1,c.length-2)):[...l].sort((g,b)=>b.len-g.len),f=.22,m=11/Qe,u=g=>{let b=ms(g,d)/Qe,$,E=1/0,S=0;e:for(let k of p.length?p:l){let T=c[k.i],z=c[k.i+1],A=T[2],R=Math.abs(T[1]-z[1])<1e-6,x=R?Math.min(T[0],z[0]):Math.min(T[1],z[1]),P=R?Math.max(T[0],z[0]):Math.max(T[1],z[1]),w=R?T[1]:T[0],I=o.side==="left"?[-1]:o.side==="right"?[1]:[-1,1],L=[];for(let D=x+.3;D<=Math.max(x+.3,P-b-.2)+1e-9;D+=.4)L.push(D);for(let D=P-b-.2+.4;D<P+.5&&P-x<b+.5;D+=.6)L.push(D);for(let D of I)for(let G of L){if(E<=S*.5)break e;let se=D<0?w-f:w+f+m,_,K,Z;if(R?(_=G,K=se,Z=[ke(_,K-m,A),ke(_+b,K-m,A),ke(_+b,K,A),ke(_,K,A)]):(_=se,K=G+b,Z=[ke(_-m,K,A),ke(_-m,K-b,A),ke(_,K-b,A),ke(_,K,A)]),(R?[[_,K-m],[_+b,K-m],[_+b,K],[_,K]]:[[_-m,K],[_-m,K-b],[_,K-b],[_,K]]).some(([ae,ue])=>Math.abs(rr(i,ae,ue)+.01-A)>.001)){S++;continue}let N=n.hiddenPoly(Z),j=N*50+S*.5,V=n.budget.spots-- >0;V||(n.budget.over=!0);let H=j>=E?1/0:V?j+n.costPoly(Z,E-j):j;S++,H<E&&(E=H,$={x:_,y:K,z:A,dir:R?"x":"y",rect:sn(Z),poly:Z,hidden:N})}}return $&&$.hidden<6?$:void 0},h=o.text,y=u(h),v;if(!y){let g=o.text.split(/(\s+)/);for(let b=g.length-1;b>0&&!y;b--){let $=g.slice(0,b).join("").trimEnd().replace(/[\s,;:·–-]+$/,"")+"\u2026";if($.length<6)break;let E=u($);E&&(y=E,h=$)}v=y?`label of route "${e.id}" shortened to "${h}": no clear floor for the whole text`:`label "${o.text}" of route "${e.id}" was dropped: blocks cover every spot beside it`,y?v+='; give it "along", "side" or "at", or move the nodes apart':v+='; give it "at: [x, y]", or move the nodes apart'}return y?(n.slants.push(y.poly),{svg:t.floorText(y.x,y.y,y.z+.01,h,s,y.dir,"start",a),warning:v}):{svg:"",warning:v}}function Nd(t,e,n,r,i){let o=e.on?r.find(l=>l.id===e.on):void 0,s=e.on&&!o?n.byId.get(e.on):void 0,a=e.at,d={"data-id":i,"data-hl":o?.id,"data-dim":o?void 0:"1"},c=e.kind??o?.kind??"control";if(e.floor){let l=a&&a.length>2?a[2]:o?o.points[0][2]:s?s.floor:.36,[p,f]=a?[a[0],a[1]]:o?[o.points[0][0]+.35,o.points[0][1]-.25]:s?[s.box.x0+.3,s.box.y1-.3]:[0,0];return t.floorText(p,f,l+.01,e.floor,`floor mono t-${c}`,e.dir??"x",e.anchor??"start",d)}if(e.face){let l=s?.box,[p,f,m]=a?[a[0],a[1],a[2]??.45]:l?[l.x0+.3,l.y1,l.z0+.13]:[0,0,0];return t.faceText(p,f,m,e.face,"slabname sm",yt.sm,"left",e.anchor??"start",d)}if(e.label||e.sub){let l=s?.box,p=a?[a[0],a[1],a[2]??.36]:l?[(l.x0+l.x1)/2,(l.y0+l.y1)/2,l.z1+.75]:[0,0,0],[f,m]=ke(p[0],p[1],p[2]),u=f+(e.dx??0),h=m-18+(e.dy??0),y=e.anchor??"middle",v="";return e.label&&(v+=t.text(u,h,e.label,"lbl",yt.lbl,y)),e.sub&&(v+=t.text(u,e.label?h+14:h,e.sub,"sub mono",yt.sub,y)),fe("g",d,v)}return""}var il=`
140
+ `)}function lf(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 ta(t){let e=new Js,s=Xo(t,{lineCounter:e,prettyErrors:!1,uniqueKeys:!0}),r=[],i=m=>{let p=e.linePos(m);return{line:p.line,col:p.col}};for(let m of s.errors){let p=i(m.pos[0]),c=m.message.split(`
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 m of s.warnings){let p=i(m.pos[0]);r.push({severity:"warning",message:`YAML: ${m.message.split(`
142
+ `)[0]}`,line:p.line,col:p.col,path:""})}function o(m,p={}){let c=lf(m),l=s.contents,f={line:1,col:1},d=u=>{let y=u?.range;y&&(f=i(y[0]))};d(l);for(let u=0;u<c.length;u++){let y=c[u];if(cn(l)){let g=l.items.find(x=>Qe(x)&&Ge(x.key)&&String(x.key.value)===String(y));if(!g)break;if(p.key&&u===c.length-1)return d(g.key),f;d(g.key),l=g.value,l&&d(l)}else if(pn(l)&&typeof y=="number"){if(l=l.items[y],!l)break;d(l)}else break}return f}function n(m){let p=s.contents;for(let d of lf(m)){if(cn(p)){let u=p.items.find(y=>Qe(y)&&Ge(y.key)&&String(y.key.value)===String(d));if(!u)return;p=u.value}else if(pn(p)&&typeof d=="number")p=p.items[d];else return;if(!p)return}let c=p.range;if(!c)return;let l=e.linePos(Math.max(c[0],c[1]-1)).line,f=t.split(/\r?\n/);for(;l>e.linePos(c[0]).line&&/^\s*(#.*)?$/.test(f[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 Qm=new Set(["svg","g","defs","marker","symbol","title","desc","path","polygon","polyline","line","rect","circle","ellipse","text","tspan","linearGradient","radialGradient","stop","clipPath"]),eu=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"]),tu=new Set(["fill","stroke","marker-start","marker-mid","marker-end","clip-path","style"]),nu={amp:"&",lt:"<",gt:">",quot:'"',apos:"'","#39":"'"},cf=t=>t.replace(/&(amp|lt|gt|quot|apos|#39);/g,(e,s)=>nu[s]);function Kl(t,e){return t.startsWith("data-")||t.startsWith("aria-")?/^[a-z][\w-]*$/.test(t):!(!eu.has(t)||tu.has(t)&&/url\(\s*(?!['"]?#)|javascript:|expression\(|@import/i.test(e))}function Gl(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],m=[];for(let l of i[3].matchAll(/([\w:-]+)="([^"]*)"/g)){let f=l[1],d=cf(l[2]);f==="xmlns"||f.startsWith("xmlns:")||Kl(f,d)&&m.push([f,d])}let p={name:a,attrs:m,children:[]},c=n.dropped||!Qm.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(cf(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 su="http://www.w3.org/2000/svg",pf=t=>t.replace(/var\(--([a-zA-Z][\w-]*)/g,"var(--iso-$1");function ff(t,e=document){let s=i=>{let o=e.createElementNS(su,i.name);for(let[n,a]of i.attrs)n==="style"?o.style.cssText=pf(a):o.setAttribute(n,/var\(--/.test(a)?pf(a):a);for(let n of i.children)o.append(typeof n=="string"?e.createTextNode(n):s(n));return o},r=Gl(t).children.find(i=>typeof i!="string"&&i.name==="svg");if(!r)throw new Error("the drawing has no <svg>");return s(r)}var ru=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),Ti=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])=>`${ru(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)}}},df={createElementNS:(t,e)=>new Ti(e)},mf=t=>t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),iu=t=>mf(t).replace(/"/g,"&quot;");function na(t,e=new Set(["style"])){if(typeof t=="string")return mf(t);let s=t.attrs.map(([i,o])=>` ${i}="${iu(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,"<\\/"):na(i,e)).join(""):t.children.map(i=>na(i,e)).join("");return`<${t.name}${s}>${r}</${t.name}>`}var ou=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 Zl(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),m=(p,c)=>p>>>c|p<<32-c;for(let p=0;p<r;p++){for(let h=0;h<16;h++)a[h]=o.getUint32(p*64+h*4);for(let h=16;h<64;h++){let b=m(a[h-15],7)^m(a[h-15],18)^a[h-15]>>>3,w=m(a[h-2],17)^m(a[h-2],19)^a[h-2]>>>10;a[h]=a[h-16]+b+a[h-7]+w>>>0}let[c,l,f,d,u,y,g,x]=n;for(let h=0;h<64;h++){let b=x+(m(u,6)^m(u,11)^m(u,25))+(u&y^~u&g)+ou[h]+a[h]>>>0,w=(m(c,2)^m(c,13)^m(c,22))+(c&l^c&f^l&f)>>>0;x=g,g=y,y=u,u=d+b>>>0,d=f,f=l,l=c,c=b+w>>>0}n[0]+=c,n[1]+=l,n[2]+=f,n[3]+=d,n[4]+=u,n[5]+=y,n[6]+=g,n[7]+=x}return[...n].map(p=>p.toString(16).padStart(8,"0")).join("")}function uf(t){if(t!=="sha256")throw new Error(`only sha256 here, not ${t}`);let e="",s={update(r){return e+=r,s},digest(r){return Zl(e)}};return s}var fd={};co(fd,{ANTS_CSS:()=>Bf,ANT_DASH:()=>hc,ANT_SPEED:()=>Bi,ANT_STILL:()=>yc,ASSEMBLE_STYLES:()=>_i,BOARD_3D:()=>Fs,BOARD_CSS:()=>ld,DISASSEMBLE_STYLES:()=>Fi,EASING_NAMES:()=>Ea,EXTRAPOLATE:()=>Lr,FLAT_DEFAULTS:()=>Ac,FLAT_FONTS:()=>Tc,FONT_STACKS:()=>kc,GRID_CSS:()=>Hi,LABEL_BUDGET:()=>Ma,MARKS_CSS:()=>Yi,MOTION_EASINGS:()=>Ef,MOTION_ORDERS:()=>Rr,MOTION_SCHEMA:()=>Zf,MotionBuilder:()=>Vi,NodesBuilder:()=>Cr,Obstacles:()=>er,PAGE_CSS:()=>vc,PLAYER_CSS:()=>za,PLAYER_UI_CSS:()=>Mc,ROUTE_BUDGET:()=>da,SeriesBuilder:()=>jr,WALL_T:()=>ls,alongPath:()=>$a,antDash:()=>qi,antsOf:()=>ks,assemble:()=>uc,assembly:()=>wa,baseCss:()=>Vr,bezier:()=>Ls,bindMotion:()=>Br,boardCatalog:()=>cd,boardDiagram:()=>pd,boardErrors:()=>La,boardOf:()=>_a,boxAsset:()=>on,boxSilhouette:()=>nd,calloutRect:()=>rc,cardAsset:()=>Ec,checkMotion:()=>Na,cloudPath:()=>Jl,compileRaw:()=>Ca,convexOverlap:()=>Ci,curveAt:()=>Fr,defaultLabel:()=>gf,disassemble:()=>Ff,drawCloud:()=>Pr,drawDecos:()=>Wl,drawLooks:()=>Oa,drawingCss:()=>nr,durationFor:()=>$c,easeOf:()=>Hn,facePainter:()=>Qs,flatHit:()=>ad,floorAt:()=>Ar,floorOf:()=>sd,focusView:()=>Qf,gateBox:()=>Ii,iconPainter:()=>Ei,inConvex:()=>ic,introSvg:()=>Df,kindsCss:()=>ra,labelRect:()=>ji,layoutFlat:()=>Kr,lineRectArea:()=>Sf,localAt:()=>td,markCss:()=>ia,metricsMeasure:()=>od,midpoint:()=>Sc,motion:()=>Vf,motionModel:()=>js,motionOfSteps:()=>Uf,motionOrder:()=>fc,msOf:()=>Yn,noSource:()=>Pc,nodeKind:()=>Xs,nodeKindOr:()=>Mn,offscreen:()=>Nr,openList:()=>ec,overlap2:()=>aa,overlaps:()=>ja,paddingOf:()=>rd,paint:()=>Lf,parseEnd:()=>bn,place:()=>Or,placeBoard:()=>Wi,placeCallout:()=>ga,placeNodeLabel:()=>Li,placeholderIcon:()=>Hl,planOf:()=>Ir,plate:()=>Ni,polyBounds:()=>Gn,polyRectArea:()=>Er,readMs:()=>Gi,rectArea:()=>sc,regionKind:()=>Pt,regionRole:()=>Pa,registerMarks:()=>yf,renderScene:()=>zr,resolveSteps:()=>Ia,resolveSvg:()=>Ui,routeAll:()=>ma,screenToGrid:()=>ed,silhouette:()=>Ht,simplify:()=>zi,snapMove:()=>id,springAt:()=>_r,svgAt:()=>Di,wallHeight:()=>sa,wallsOf:()=>va,withAnts:()=>Aa});var Pt=(t,e)=>e!==void 0&&Object.hasOwn(t.regions,e)?t.regions[e]:void 0,Xs=(t,e)=>t.nodes[e??t.defaultNode],Mn=(t,e)=>Xs(t,e)??t.nodes[t.defaultNode],sa=t=>Object.values(t.regions).find(e=>e.shape==="walled")?.z[1]??.8,ra=t=>Object.values(t.regions).map(e=>e.css??"").join("");var Ul=Object.create(null),Yl=[];function yf(t){Object.assign(Ul,t.icons??{}),Object.assign(dr,t.faces??{}),t.css&&!Yl.includes(t.css)&&Yl.push(t.css)}var ia=()=>Yl.join(""),Ei=t=>Object.hasOwn(Ul,t)?Ul[t]:void 0,Qs=t=>Object.hasOwn(dr,t)?dr[t]:void 0;function Hl(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 Wl(t,e,s){let r="";for(let i of s??[])i==="terminal"?r+=oi(t,e,3):i==="envelope"?r+=po(t,e):i==="bubble"?r+=fo(t,e):i==="file-lines"?r+=mo(t,e):typeof i=="object"&&(i.terminal&&(r+=oi(t,e,i.terminal)),i.icon&&(r+=(Ei(i.icon)??Hl)(t,e)));return r}var au=(t,e)=>(t.deco??e.deco??[]).filter(s=>s!=="ghost");function on(t,e,s,r,i,o){let n={name:t,description:e,size:s,role:r,deco:i,draw:(a,m,p)=>a.blockFaces(m)+Wl(a,m,au(p,n))+(o?o(a,m):"")};return n}function Ni(t){let[e,s]=Zs(t);return{x0:e-.75,y0:s-.75,x1:e+.75,y1:s+.75,z0:t.z0,z1:t.z0+.18}}function Jl(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,m=(p,c,l,f)=>{let d=Math.hypot(l-p,f-c),u=Math.max(1,Math.round(d/(s*1.7))),y="";for(let g=1;g<=u;g++){let x=p+(l-p)*g/u,h=c+(f-c)*g/u,b=d/u/2*1.08;y+=` A${b.toFixed(1)},${b.toFixed(1)} 0 0 1 ${x.toFixed(1)},${h.toFixed(1)}`}return y};return`M${i.toFixed(1)},${o.toFixed(1)}`+m(i,o,n,o)+m(n,o,n,a)+m(n,a,i,a)+m(i,a,i,o)+"Z"}function Pr(t,e){let s={...e,z0:e.z1},r=a=>{let[m,p]=Re(e.x0,e.y0,a);return[Ct,.5,-Ct,.5,m,p]},i=(e.x1-e.x0)*lt,o=(e.y1-e.y0)*lt,n=Jl(i,o);return t.onMatrix(r(e.z0),i,o,()=>ve("path",{d:n,class:"lft cloud-side"}))+t.onMatrix(r(e.z1),i,o,()=>ve("path",{d:n,class:"top cloud-top"}))}function gf(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 ls=.16,Xl=["right-of","left-of","below","behind"];function Or(t,e,s,r,i,o={},n){let a=[],m=(M,A,P,j=!1,F="error")=>{let Y=s.locate(M,{key:j});a.push({severity:F,message:A,line:Y.line,col:Y.col,path:M,hint:P})},p=[],c=new Map,l=[],f=new Map,d=new Set([...Object.keys(r.roles),...Object.keys(o)]);function u(M,A){let P=c.get(M.id);if(P){let j=s.locate(P.path+"/id");return m(M.path+"/id",`duplicate id "${M.id}" (first used on line ${j.line})`),!1}return c.set(M.id,M),p.push(M),M.parent=A,A?A.children.push(M):l.push(M),!0}let y=()=>({x0:0,y0:0,z0:0,x1:0,y1:0,z1:0});function g(M,A,P){let j={id:M.id,type:"node",path:A,children:[],box:y(),floor:0,node:M,appears:M.appears,disappears:M.disappears};u(j,P)&&(M.nodes??[]).forEach((F,Y)=>g(F,`${A}/nodes/${Y}`,j))}function x(M,A,P){let j={id:M.id,type:"region",path:A,children:[],box:y(),floor:0,region:M,appears:M.appears,disappears:M.disappears};u(j,P)&&((M.nodes??[]).forEach((F,Y)=>g(F,`${A}/nodes/${Y}`,j)),(M.regions??[]).forEach((F,Y)=>x(F,`${A}/regions/${Y}`,j)))}(t.regions??[]).forEach((M,A)=>x(M,`${e}/regions/${A}`,void 0)),(t.nodes??[]).forEach((M,A)=>g(M,`${e}/nodes/${A}`,void 0));let h=()=>c.keys(),b=()=>p.filter(M=>M.type==="region").map(M=>M.id);for(let M of[...p]){let A=M.node??M.region;if(A.in!==void 0){let j=c.get(A.in);if(!j){m(M.path+"/in",`unknown region "${A.in}"`+Ri(A.in,b()));continue}if(j.type!=="region"){m(M.path+"/in",`"${A.in}" is a node, not a region; put nodes on a node with its own "nodes:" list`);continue}if(M.parent&&M.parent!==j){m(M.path+"/in",`"${M.id}" is written inside "${M.parent.id}" but says in: ${A.in}; use one or the other`);continue}for(let F=j;F;F=F.parent)if(F===M){m(M.path+"/in",`"${M.id}" cannot be inside itself`);continue}M.parent||(l.splice(l.indexOf(M),1),M.parent=j,j.children.push(M))}if(M.node){let j=M.node.asset;j!==void 0&&!Xs(i,j)&&m(M.path+"/asset",`unknown asset "${j}"`+Ri(j,Object.keys(i.nodes)),`assets: ${Object.keys(i.nodes).join(", ")}`)}let P=(M.node??M.region).role;P!==void 0&&!d.has(P)&&m(M.path+"/role",`unknown colour role "${P}"`+Ri(P,d),`add it under "roles:" at the top of the file, or use one of: ${[...d].join(", ")}`)}for(let M of p){let A=M.region?.gate;if(!A?.node)continue;let P=c.get(A.node);if(!P){m(M.path+"/gate/node",`unknown node "${A.node}"`+Ri(A.node,h()));continue}if(P.type!=="node"){m(M.path+"/gate/node",`"${A.node}" is a region; a gate is a node`);continue}P.placedBy=M.id;let j=P.node;(j.at||Xl.some(F=>j[F]))&&m(P.path,`"${P.id}" is the gate of "${M.id}", which places it; its own placement is ignored`,void 0,!1,"warning")}let w=M=>M.gap??t.gap??2;function k(M){let A=M.node,P=Mn(i,A.asset),j=A.size,F=P.size[0],Y=P.size[1],J=P.size[2];if(j&&(F=j[0],Y=j[1],j.length>2&&(J=j[2])),M.placedBy){let U=c.get(M.placedBy).region,C=U.gate,G=C.width??2,Z=j?Math.min(F,Y):.3;J=j&&j.length>2?J:C.height??(U.height??sa(i))+.3,C.side==="e"||C.side==="w"?(F=Z,Y=G):(F=G,Y=Z)}return[F,Y,J]}function $(M,A,P,j,F){for(let H of A)T(H);let Y=A.filter(H=>!H.placedBy),J=new Set(Y),U=new Set,C=[],G=new Set,Z=H=>{let ne=H.node??H.region,Ee=[];for(let qe of Xl){let N=ne[qe];if(N===void 0)continue;let ee=c.get(N);if(!ee){m(`${H.path}/${qe}`,`unknown id "${N}"`+Ri(N,h()));continue}if(ee===H){m(`${H.path}/${qe}`,`"${H.id}" cannot be placed ${qe} itself`);continue}if(!J.has(ee)){let ye=ke=>ke.parent?`"${ke.parent.id}"`:"the scene";m(`${H.path}/${qe}`,`"${N}" is in ${ye(ee)} but "${H.id}" is in ${ye(H)}; relative placement works between items in the same region`,ee.placedBy?`"${N}" is a gate, placed by its ${c.get(ee.placedBy)?.region?.kind??"region"}`:`place "${H.id}" relative to something in ${ye(H)}, or use "at:"`);continue}Ee.push(ee)}if(!Ee.length&&!ne.at){let qe=Y.indexOf(H);qe>0&&Ee.push(Y[qe-1])}return Ee},Q=H=>{if(!U.has(H)){if(G.has(H)){m(H.path,`placement loop: "${H.id}" is placed relative to something placed relative to it`);return}G.add(H),Z(H).forEach(Q),G.delete(H),U.add(H),C.push(H)}};Y.forEach(Q);for(let H of C){let ne=H.node??H.region,Ee=f.get(H),qe=Xl.find(N=>ne[N]!==void 0&&c.get(ne[N])&&J.has(c.get(ne[N])));if(ne.at&&qe&&m(`${H.path}/at`,`"${H.id}" has both "at" and "${qe}"; "at" wins`,void 0,!0,"warning"),ne.at)Ee.x=ne.at[0],Ee.y=ne.at[1];else if(qe)v(Ee,f.get(c.get(ne[qe])),qe,w(ne),ne.align??"center");else{let N=Y.indexOf(H);N>0?v(Ee,f.get(Y[N-1]),j==="row"?"right-of":"below",w(ne),"center"):(Ee.x=P,Ee.y=P)}ne.shift&&(Ee.x+=ne.shift[0],Ee.y+=ne.shift[1])}if(F||!Y.length)return{w:0,d:0};let z=1/0,D=1/0,V=-1/0,W=-1/0;for(let H of Y){let ne=f.get(H);z=Math.min(z,ne.x),D=Math.min(D,ne.y),V=Math.max(V,ne.x+ne.w),W=Math.max(W,ne.y+ne.d)}let de=Math.min(0,z-P),ce=Math.min(0,D-P);if(de||ce)for(let H of Y){let ne=f.get(H);ne.x-=de,ne.y-=ce}return{w:V-de+P,d:W-ce+P}}function v(M,A,P,j,F){let Y=()=>{M.y=F==="start"?A.y:F==="end"?A.y+A.d-M.d:A.y+(A.d-M.d)/2},J=()=>{M.x=F==="start"?A.x:F==="end"?A.x+A.w-M.w:A.x+(A.w-M.w)/2};P==="right-of"?(M.x=A.x+A.w+j,Y()):P==="left-of"?(M.x=A.x-j-M.w,Y()):P==="below"?(M.y=A.y+A.d+j,J()):(M.y=A.y-j-M.d,J())}function T(M){if(M.type==="node"){let[C,G,Z]=k(M);f.set(M,{x:0,y:0,w:C,d:G,h:Z,z:M.node.z??0}),M.children.length&&$(M,M.children,0,"row",!0);return}let A=M.region,P=A.padding??Pt(i,A.kind)?.pad,j=!!A.size,F=$(M,M.children,P,A.flow??"row",j),Y=A.size?A.size[0]:Math.max(F.w,P*2+.5),J=A.size?A.size[1]:Math.max(F.d,P*2+.5);if(!A.size&&A.gate){let C=(A.gate.width??2)+1;A.gate.side==="e"||A.gate.side==="w"?J=Math.max(J,C):Y=Math.max(Y,C)}let U=A.size&&A.size.length>2?A.size[2]:A.height??Pt(i,A.kind).z[1];f.set(M,{x:0,y:0,w:Y,d:J,h:U,z:0})}$(void 0,l,0,t.flow??"row",!0);function R(M,A,P,j){let F=f.get(M),Y=A+F.x,J=P+F.y;if(M.type==="region"){let U=Pt(i,M.region.kind),[C]=U.z,G=U.floor,Z=U.shape==="slab"&&Pt(i,M.parent?.region?.kind)?.shape==="slab"?0:C,Q=M.region.z??0,z=j+Z+Q,D=j+F.h+Q;M.box={x0:Y,y0:J,z0:z,x1:Y+F.w,y1:J+F.d,z1:D},M.floor=G?D:j}else{let U=j+F.z;M.box={x0:Y,y0:J,z0:U,x1:Y+F.w,y1:J+F.d,z1:U+F.h},M.floor=M.box.z1}for(let U of M.children)U.placedBy||R(U,Y,J,M.floor)}for(let M of l)M.placedBy||R(M,0,0,0);if(n){let M=P=>Math.round(P/n)*n,A=P=>Math.round(P*1e9)/1e9;for(let P of p){if(P.placedBy)continue;let j=P.box,F=M(j.x0),Y=M(j.x1),J=M(j.y0),U=M(j.y1);Y-F<n&&(Y=F+n),U-J<n&&(U=J+n),P.box={...j,x0:A(F),x1:A(Y),y0:A(J),y1:A(U)};let C=P.node??P.region;C.at&&C.at.forEach((G,Z)=>{let Q=G/n;Math.abs(Q-Math.round(Q))>1e-6&&m(`${P.path}/at/${Z}`,`${G} is not on the ${n} grid; it is drawn at ${A(M(G))}`,void 0,!1,"warning")})}}for(let M of p){let A=M.region?.gate;if(!A?.node)continue;let P=c.get(A.node);!P||P.placedBy!==M.id||(P.box=Ii(M,f.get(P).h,f.get(P).w,f.get(P).d),P.floor=P.box.z1)}for(let M of p){let A=M.children.filter(P=>!P.placedBy);for(let P=0;P<A.length;P++)for(let j=P+1;j<A.length;j++){let F=A[P],Y=A[j];oa(F,i)||oa(Y,i)||aa(F.box,Y.box)&&m(Y.path,`"${Y.id}" overlaps "${F.id}"`,'move one with "at", a relative placement, "gap" or "shift"',!1,"warning")}if(M.parent&&M.parent.type==="region"&&!M.placedBy){let P=M.parent.box,j=M.box,F=1e-6;(j.x0<P.x0-F||j.y0<P.y0-F||j.x1>P.x1+F||j.y1>P.y1+F)&&m(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(A=>!A.placedBy);for(let A=0;A<M.length;A++)for(let P=A+1;P<M.length;P++){let j=M[A],F=M[P];aa(j.box,F.box)&&!oa(j,i)&&!oa(F,i)&&m(F.path,`"${F.id}" overlaps "${j.id}"`,'move one with "at", a relative placement, "gap" or "shift"',!1,"warning")}}let O=new Set,I=a.filter(M=>{let A=M.path+M.message;return O.has(A)?!1:(O.add(A),!0)});return{items:p,byId:c,roots:l,diags:I,catalog:i}}var oa=(t,e)=>t.type==="region"&&["zone","tunnel"].includes(Pt(e,t.region.kind)?.shape??"");function Ii(t,e,s,r){let i=t.region.gate,o=t.box,n=t.box.z0,a=i.at??.5,m=i.width??2;if(i.side==="w"||i.side==="e"){let l=i.side==="w"?o.x0+ls/2:o.x1-ls/2,f=o.y0+(o.y1-o.y0)*a;return{x0:l-s/2,x1:l+s/2,y0:f-m/2,y1:f+m/2,z0:n,z1:n+e}}let p=i.side==="n"?o.y0+ls/2:o.y1-ls/2,c=o.x0+(o.x1-o.x0)*a;return{x0:c-m/2,x1:c+m/2,y0:p-r/2,y1:p+r/2,z0:n,z1:n+e}}function aa(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 Ri(t,e){let s=Vt(t,e);return s?` (did you mean "${s}"?)`:""}var ws=.2,la=.05,lu=.6,ca=.25,pa={n:[0,-1],s:[0,1],e:[1,0],w:[-1,0]};function bn(t){let e=/^(.*?)(?:\.(n|e|s|w|top))?$/.exec(t);return{id:e[1],side:e[2]}}var bf=new WeakMap;function Ar(t,e,s){let r=bf.get(t);if(!r){r=[];for(let n of t.items){if(n.type!=="region"||!Pt(t.catalog,n.region.kind)?.floor)continue;let a=0;for(let m=n.parent;m;m=m.parent)a++;r.push({r:n,d:a})}bf.set(t,r)}let i=0,o=-1;for(let{r:n,d:a}of r){let m=n.box,p=1e-6;e>=m.x0-p&&e<=m.x1+p&&s>=m.y0-p&&s<=m.y1+p&&a>o&&(o=a,i=n.floor)}return i}function cu(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 da=5e5;function ma(t,e,s,r,i,o){let n=[],a=(b,w,k,$="error")=>{let v=r.locate(b);n.push({severity:$,message:w,line:v.line,col:v.col,path:b,hint:k})},m=t.routes??[],p={left:da},c=0,l=()=>s.items.map(b=>b.id),f=new Map,d=[],u=[];m.forEach((b,w)=>{let k=`${e}/routes/${w}`;(f.has(b.id)||s.byId.has(b.id))&&a(k+"/id",`duplicate id "${b.id}"`),f.set(b.id,w);let $=b.kind??"send";i.has($)||a(k+"/kind",`unknown flow kind "${$}"`+Ql($,i),`kinds: ${[...i].join(", ")}; add one under "kinds:"`);let v={id:b.id,raw:b,path:k,kind:$,points:[]},T=(R,O)=>{let{id:I}=bn(R),M=s.byId.get(I);if(!M){a(`${k}/${O}`,`unknown node "${I}"`+Ql(I,l()));return}return M};v.from=T(b.from,"from"),v.to=T(b.to,"to"),d.push(v),u.push({r:v})});let y=new Map;for(let b of u){let{r:w}=b;if(!w.from||!w.to||w.raw.points)continue;let k=bn(w.raw.from).side,$=bn(w.raw.to).side,v=w.raw.via?.[0],T=w.raw.via?.[w.raw.via.length-1],R=(A,P)=>{if(Array.isArray(A))return{x0:A[0],x1:A[0],y0:A[1],y1:A[1],z0:0,z1:0};if(typeof A=="string"){let j=s.byId.get(bn(A).id);if(j)return j.box}return P.box},O=(A,P,j)=>{let F=P??cu(A.box,j);return{node:A,side:F,explicit:!!P,p:[0,0],z:0}};b.a=O(w.from,k,R(v,w.to)),b.b=O(w.to,$,R(T,w.from));let I=R(v,w.to),M=R(T,w.from);for(let[A,P]of[[b.a,I],[b.b,M]]){let j=`${A.node.id}.${A.side}`;y.has(j)||y.set(j,[]),y.get(j).push({e:A,other:[(P.x0+P.x1)/2,(P.y0+P.y1)/2]})}}for(let[,b]of y){let w=b[0].e,k=w.node.box,$=w.side,v=$==="e"||$==="w"?1:0;b.sort((A,P)=>A.other[v]-P.other[v]);let T=v?k.y0:k.x0,R=v?k.y1:k.x1,O=(T+R)/2,I=Math.max(0,R-T-.3),M=b.length>1?Math.min(lu,I/(b.length-1)):0;b.forEach((A,P)=>{let j=(P-(b.length-1)/2)*M,F=O+j,Y=A.e.node.box.z0;if($==="top"){A.e.p=[(k.x0+k.x1)/2,(k.y0+k.y1)/2],A.e.z=k.z1;return}let[J,U]=pa[$];A.e.p=v?[J>0?k.x1+la:k.x0-la,F]:[F,U>0?k.y1+la:k.y0-la],A.e.z=Y})}let g=[];for(let b of s.items)b.type==="node"&&g.push(b.box);let x=[];for(let b of s.items.filter(w=>Pt(s.catalog,w.region?.kind)?.shape==="walled")){let{x0:w,y0:k,x1:$,y1:v}=b.box,T=ls,R=b.region.gate,O=[[{x0:w,y0:k,x1:$,y1:k+T,z0:0,z1:0},"n"],[{x0:w,y0:v-T,x1:$,y1:v,z0:0,z1:0},"s"],[{x0:w,y0:k,x1:w+T,y1:v,z0:0,z1:0},"w"],[{x0:$-T,y0:k,x1:$,y1:v,z0:0,z1:0},"e"]];for(let[I,M]of O)if(R&&R.side===M){if(R.node)continue;let A=R.at??.5,P=R.width??2;if(M==="e"||M==="w"){let j=k+(v-k)*A;x.push({...I,y1:j-P/2},{...I,y0:j+P/2})}else{let j=w+($-w)*A;x.push({...I,x1:j-P/2},{...I,x0:j+P/2})}}else x.push(I)}let h=new Map;for(let b of u){let{r:w,a:k,b:$}=b;if(w.raw.points){w.points=w.raw.points.map(F=>[F[0],F[1],F.length>2?F[2]:Ar(s,F[0],F[1])+.01]);continue}if(!k||!$)continue;let v=[];(w.raw.via??[]).forEach((F,Y)=>{if(Array.isArray(F))if(o){let J=U=>Math.round(Math.round(U/o)*o*1e9)/1e9;F.forEach((U,C)=>{Math.abs(U/o-Math.round(U/o))>1e-6&&a(`${w.path}/via/${Y}/${C}`,`${U} is not on the ${o} grid; it is drawn at ${J(U)}`,void 0,"warning")}),v.push({p:[J(F[0]),J(F[1])]})}else v.push({p:[F[0],F[1]]});else{let{id:J,side:U}=bn(F),C=s.byId.get(J);if(!C){a(`${w.path}/via/${Y}`,`unknown node "${J}"`+Ql(J,l()));return}let G=U&&U!=="top"?U:"n",[Z,Q]=pa[G],z=C.box;v.push({p:[Z?Z>0?z.x1+.4:z.x0-.4:(z.x0+z.x1)/2,Q?Q>0?z.y1+.4:z.y0-.4:(z.y0+z.y1)/2]})}});let R=g.filter(F=>F!==k.node.box&&F!==$.node.box).concat(w.raw.cross?[]:x).filter(F=>!fa(k.node.box,F)&&!fa($.node.box,F)&&!fa(F,k.node.box)&&!fa(F,$.node.box)),O=k.side==="top"?void 0:pa[k.side],I=$.side==="top"?void 0:pa[$.side],M=[k.p,...v.map(F=>F.p),$.p],A=[k.p],P=O,j=!0;for(let F=0;F+1<M.length;F++){let Y=F+2===M.length,J=fu(M[F],M[F+1],R,h,P,Y&&I?[-I[0],-I[1]]:void 0,p);if(!J){j=!1;break}A.push(...J.slice(1));let U=A.length;if(U>=2){let C=Math.sign(A[U-1][0]-A[U-2][0]),G=Math.sign(A[U-1][1]-A[U-2][1]);P=[C,G]}}!j&&p.left<=0?(c++,A=[k.p,[$.p[0],k.p[1]],$.p]):j||(a(w.path,`no path found for route "${w.id}" from "${k.node.id}" to "${$.node.id}"`,'add "via" points, or use "points" to draw it by hand',"warning"),A=[k.p,[$.p[0],k.p[1]],$.p]),A=zi(A);for(let F=0;F+1<A.length;F++)pu(h,A[F],A[F+1]);w.points=uu(s,A,k,$)}return c&&a(e,`${c} of ${d.length} routes were drawn as plain elbows: the scene is too large to route them all around what stands in the way (${da.toLocaleString("en")} search steps)`,'split it into scenes, or give the busiest routes "via" points or "points"',"warning"),{routes:d,diags:n}}function fa(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 wf=(t,e)=>`${Math.round(t/ws)},${Math.round(e/ws)}`;function pu(t,e,s){let r=Math.max(1,Math.round(Math.hypot(s[0]-e[0],s[1]-e[1])/ws));for(let i=0;i<=r;i++){let o=wf(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 xf(t,e,s){for(let r of s)if(t>r.x0-ca&&t<r.x1+ca&&e>r.y0-ca&&e<r.y1+ca)return!0;return!1}function fu(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)&&mu(t,e,s)){let C=[Math.sign(e[0]-t[0]),Math.sign(e[1]-t[1])],G=!i||i[0]===C[0]&&i[1]===C[1],Z=!o||o[0]===C[0]&&o[1]===C[1];if(G&&Z)return[t,e]}if(n.left<=0)return null;let a=C=>Math.round((C-t[0])/ws),m=C=>Math.round((C-t[1])/ws),p=C=>t[0]+C*ws,c=C=>t[1]+C*ws,l=a(e[0]),f=m(e[1]),d=30,u=Math.min(0,l)-d,y=Math.max(0,l)+d,g=Math.min(0,f)-d,x=Math.max(0,f)+d,h=1.2,b=ws,w=.06,k=[[1,0],[-1,0],[0,1],[0,-1]],$=y-u+1,v=x-g+1,T=(C,G)=>(C-u)*v+(G-g),R=new Int8Array($*v).fill(-1),O=new Float64Array($*v).fill(-1),I=new Float64Array($*v*4).fill(1/0),M=(C,G)=>{let Z=T(C,G);return R[Z]<0&&(R[Z]=xf(p(C),c(G),s)?1:0),R[Z]===1},A=(C,G)=>{let Z=T(C,G);return O[Z]<0&&(O[Z]=r.get(wf(p(C),c(G)))??0),O[Z]},P=ec(),j=(C,G)=>(Math.abs(C-l)+Math.abs(G-f))*b,F=i?k.findIndex(C=>C[0]===i[0]&&C[1]===i[1]):-1;P.push({i:0,j:0,d:F,g:0,f:j(0,0),idx:0,hp:0});let Y=(C,G)=>Math.abs(C)+Math.abs(G)<=2,J=(C,G)=>Math.abs(C-l)+Math.abs(G-f)<=2,U=0;for(;P.length()&&U++<2e5;){if(n.left--<=0)return null;let C=P.take();if(C.i===l&&C.j===f&&!(o&&C.d>=0&&(k[C.d][0]!==o[0]||k[C.d][1]!==o[1]))){let G=[];for(let Z=C;Z;Z=Z.prev)G.push([p(Z.i),c(Z.j)]);return G.reverse(),G[0]=t,du(zi(G),e)}for(let G=0;G<4;G++){let Z=k[G];if(C.d>=0&&Z[0]===-k[C.d][0]&&Z[1]===-k[C.d][1])continue;let Q=C.i+Z[0],z=C.j+Z[1];if(Q<u||Q>y||z<g||z>x||!Y(Q,z)&&!J(Q,z)&&M(Q,z))continue;if((Y(Q,z)||J(Q,z))&&M(Q,z)&&!(Q===l&&z===f)){let de=Y(Q,z)?i:o&&[-o[0],-o[1]];if(!de||(Y(Q,z)?Z[0]!==de[0]||Z[1]!==de[1]:Z[0]!==o[0]||Z[1]!==o[1]))continue}let D=C.d>=0&&C.d!==G?h:0,V=C.g+b+D+A(Q,z)*w,W=T(Q,z)*4+G;I[W]<=V||(I[W]=V,P.push({i:Q,j:z,d:G,g:V,f:V+j(Q,z),prev:C,idx:0,hp:0}))}}return null}function ec(){let t=[],e=[],s=(n,a)=>n.f<a.f||n.f===a.f&&n.idx<a.idx,r=(n,a)=>{let m=e[n];e[n]=e[a],e[a]=m,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,m=a+1,p=n;if(a<e.length&&s(e[a],e[p])&&(p=a),m<e.length&&s(e[m],e[p])&&(p=m),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 m=t.pop();return m!==n&&(t[n.idx]=m,m.idx=n.idx,i(m.hp)),n}}}function du(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,zi(s)}function mu(t,e,s){let r=Math.max(1,Math.round(Math.hypot(e[0]-t[0],e[1]-t[1])/(ws/2)));for(let i=2;i<r-1;i++)if(xf(t[0]+(e[0]-t[0])*i/r,t[1]+(e[1]-t[1])*i/r,s))return!1;return!0}function zi(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 uu(t,e,s,r){let i=new Set,o=new Set;for(let p of t.items)p.type!=="region"||!Pt(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)=>Ar(t,p,c)+.01;for(let p=0;p+1<e.length;p++){let[c,l]=e[p],[f,d]=e[p+1],u=[0,1];if(Math.abs(l-d)<1e-6)for(let y of i){let g=(y-c)/(f-c);g>1e-6&&g<1-1e-6&&u.push(g)}else for(let y of o){let g=(y-l)/(d-l);g>1e-6&&g<1-1e-6&&u.push(g)}u.sort((y,g)=>y-g);for(let y=0;y+1<u.length;y++){let g=u[y],x=u[y+1],h=(g+x)/2,b=a(c+(f-c)*h,l+(d-l)*h),w=[c+(f-c)*g,l+(d-l)*g,b],k=[c+(f-c)*x,l+(d-l)*x,b],$=n[n.length-1];$&&(Math.abs($[0]-w[0])>1e-6||Math.abs($[1]-w[1])>1e-6||Math.abs($[2]-w[2])>1e-6)?n.push(w):$||n.push(w),n.push(k)}}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 m=[];for(let p of n){let c=m.length;if(c>=2){let l=m[c-2],f=m[c-1],d=Math.abs(l[2]-f[2])<1e-9&&Math.abs(f[2]-p[2])<1e-9,u=Math.abs(l[0]-f[0])<1e-6&&Math.abs(f[0]-p[0])<1e-6||Math.abs(l[1]-f[1])<1e-6&&Math.abs(f[1]-p[1])<1e-6;if(d&&u){m[c-1]=p;continue}}m.push(p)}return m}function Ql(t,e){let s=Vt(t,e);return s?` (did you mean "${s}"?)`:""}function Ht(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 Gn(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 Er(t,e){let s=t,r=(a,m)=>{let p=[];for(let c=0;c<s.length;c++){let l=s[c],f=s[(c+1)%s.length],d=a(l),u=a(f);d&&p.push(l),d!==u&&p.push(m(l,f))}s=p},i=a=>(m,p)=>[a,m[1]+(p[1]-m[1])*(a-m[0])/(p[0]-m[0])],o=a=>(m,p)=>[m[0]+(p[0]-m[0])*(a-m[1])/(p[1]-m[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 m=s[a],p=s[(a+1)%s.length];n+=m[0]*p[1]-p[0]*m[1]}return Math.abs(n)/2}function sc(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 Sf(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 m=0;m<a;m++){let p=i[0]+(o[0]-i[0])*(m+.5)/a,c=i[1]+(o[1]-i[1])*(m+.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 xs=64,ha=class{cells=new Map;n=0;add(e,s,r,i,o){for(let n=Math.floor(s/xs);n<=Math.floor(i/xs);n++)for(let a=Math.floor(r/xs);a<=Math.floor(o/xs);a++){let m=n*1048576+a,p=this.cells.get(m);p||this.cells.set(m,p=[]),p[p.length-1]!==e&&p.push(e)}}query(e,s,r,i){let o=new Set;for(let n=Math.floor(e/xs);n<=Math.floor(r/xs);n++)for(let a=Math.floor(s/xs);a<=Math.floor(i/xs);a++){let m=this.cells.get(n*1048576+a);if(m)for(let p of m)o.add(p)}return[...o].sort((n,a)=>n-a)}},tc=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]},ya=new WeakMap;function Cs(t,e){let s=ya.get(t);for((!s||s.n>t.length)&&ya.set(t,s=new ha);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 kf(t){let e=ya.get(t);for((!e||e.n>t.length)&&ya.set(t,e=new ha);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])/(xs/2)));for(let m=0;m<a;m++){let p=m/a,c=(m+1)/a,l=i[0]+(o[0]-i[0])*p,f=i[1]+(o[1]-i[1])*p,d=i[0]+(o[0]-i[0])*c,u=i[1]+(o[1]-i[1])*c;e.add(n,Math.min(l,d)-1,Math.min(f,u)-1,Math.max(l,d)+1,Math.max(f,u)+1)}}}return e}var cs=(t,e,s,r,i)=>t.query(e,s,r,i),Tr=t=>tc(t),ua=t=>[t.x,t.y,t.x+t.w,t.y+t.h];function $f(t,e,s,[r,i,o,n]){let a=0,m=s-1;for(let p of[0,1]){let c=e[p]-t[p],l=p?i:r,f=p?n:o;if(Math.abs(c)<1e-12){if(t[p]<l||t[p]>f)return[1,0];continue}let d=(l-t[p])/c*s-.5,u=(f-t[p])/c*s-.5;d>u&&([d,u]=[u,d]),a=Math.max(a,Math.floor(d)-1),m=Math.min(m,Math.ceil(u)+1)}return[a,m]}var er=class t{polys=[];rects=[];lines=[];solids=[];slants=[];budget={spots:1/0,over:!1,told:!1};hidden(e){let s=0;for(let r of cs(Cs(this.solids,Tr),...ua(e)))s+=Er(this.solids[r],e);return s}hiddenPoly(e){let s=0;for(let r of cs(Cs(this.solids,Tr),...tc(e)))s+=Ci(e,this.solids[r]);return s}costPoly(e,s=1/0){let r=tc(e),i=0;for(let o of cs(Cs(this.polys,n=>Tr(n.poly)),...r))i+=Ci(e,this.polys[o].poly);for(let o of cs(Cs(this.rects,n=>ua(n.r)),...r))i+=Er(e,this.rects[o].r)*2;for(let o of cs(Cs(this.slants,Tr),...r))i+=Ci(e,this.slants[o])*2;if(i>=s)return i;for(let o of cs(kf(this.lines),...r)){if(i>=s)return i;let n=this.lines[Math.floor(o/65536)].pts,a=o%65536,m=n[a],p=n[a+1],c=Math.hypot(p[0]-m[0],p[1]-m[1]),l=Math.max(1,Math.ceil(c/4)),[f,d]=$f(m,p,l,r);for(let u=f;u<=d;u++)ic(e,[m[0]+(p[0]-m[0])*(u+.5)/l,m[1]+(p[1]-m[1])*(u+.5)/l])&&(i+=c/l*4*.6)}return i}cost(e,s,r=.6){let i=ua(e),o=0;for(let n of cs(Cs(this.polys,a=>Tr(a.poly)),...i)){let a=this.polys[n];o+=Er(a.poly,e)*(a.owner===s?1.5:1)}for(let n of cs(Cs(this.rects,a=>ua(a.r)),...i)){let a=this.rects[n];(a.owner!==s||!s)&&(o+=sc(a.r,e)*2)}for(let n of cs(Cs(this.slants,Tr),...i))o+=Er(this.slants[n],e)*2;if(r){let n=-1,a=0;for(let m of cs(kf(this.lines),...i)){let p=Math.floor(m/65536);p!==n&&(n>=0&&(o+=a*r),n=p,a=0);let c=this.lines[p].pts,l=m%65536,f=c[l],d=c[l+1],u=Math.hypot(d[0]-f[0],d[1]-f[1]),y=Math.max(1,Math.ceil(u/4)),[g,x]=$f(f,d,y,i);for(let h=g;h<=x;h++){let b=f[0]+(d[0]-f[0])*(h+.5)/y,w=f[1]+(d[1]-f[1])*(h+.5)/y;b>=e.x&&b<=e.x+e.w&&w>=e.y&&w<=e.y+e.h&&(a+=u/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}},vf=14;function ji(t,e,s,r){let i=Math.max(t.name?Sn(t.name,wt.lbl):0,t.sub?Sn(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)*vf+(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 Li(t,e,s,r,i,o){let n=Gn(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)*vf+4,c=n.y-6-p,l=n.y+Math.min(n.h,60)*.45,f=[];o&&f.push({...o,pen:0}),f.push({x:a,y:c,anchor:"middle",pen:o?20:0});for(let y of[12,24,40])f.push({x:a,y:c-y,anchor:"middle",pen:20+y});for(let y of[-30,30,-60,60])f.push({x:a+y,y:c-4,anchor:"middle",pen:30+Math.abs(y)});f.push({x:n.x+n.w+8,y:l,anchor:"start",pen:120}),f.push({x:n.x-8,y:l,anchor:"end",pen:120}),f.push({x:a,y:n.y+n.h+14,anchor:"middle",pen:300});let d,u=1/0;for(let y of f){let g=ji(t,y.x,y.y,y.anchor),x=r.cost(g,i,.15)*2+y.pen;x<u&&(u=x,d={x:y.x,y:y.y,anchor:y.anchor,rect:g})}return d}function rc(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 ga(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 f of[0,16,-16])o.push({...r,x:e+n+c*l,y:s+a+f,pen:8+l*.6+Math.abs(f)});let m,p=1/0;for(let c of o){let l=rc(t,c.x,c.y,c.anchor),f=i.cost(l,void 0,.05)*3+c.pen;f<p&&(p=f,m={x:c.x,y:c.y,anchor:c.anchor,rect:l})}return m}var Mf=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},nc=t=>Mf(t)<0?[...t].reverse():t;function ic(t,e){let s=nc(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 Ci(t,e){let s=nc(t),r=nc(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]),m=s;s=[];for(let p=0;p<m.length;p++){let c=m[p],l=m[(p+1)%m.length],f=a(c),d=a(l);if(f>=0&&s.push(c),f>=0!=d>=0){let u=f/(f-d);s.push([c[0]+(l[0]-c[0])*u,c[1]+(l[1]-c[1])*u])}}}return s.length>=3?Math.abs(Mf(s)):0}var ba=24;function Nr(t,e){let[s,r,i,o]=e,n=t.x+t.w/2,a=t.y+t.h/2,m=[["left",n-s],["right",s+i-n],["top",a-r],["bottom",r+o-a]];m.sort((c,l)=>c[1]-l[1]);let p=m[0][0];return p==="left"?{edge:p,dx:-(t.x+t.w-s)-ba,dy:0}:p==="right"?{edge:p,dx:s+i-t.x+ba,dy:0}:p==="top"?{edge:p,dx:0,dy:-(t.y+t.h-r)-ba}:{edge:p,dx:0,dy:r+o-t.y+ba}}function wa(t,e,s){let r=w=>{let k=0;for(let $=w.parent;$;$=$.parent)k++;return k},i=w=>w.box.x0+w.box.y0+w.box.z0*.01,o=t.items.filter(w=>w.type==="region").sort((w,k)=>r(w)-r(k)||i(w)-i(k)),n=t.items.filter(w=>w.type==="node").sort((w,k)=>i(w)-i(k)||w.box.z0-k.box.z0),a=[],m=Math.min(90,400/Math.max(1,o.length)),p=650;o.forEach((w,k)=>{let $=Gn(Ht(w.box));a.push({id:w.id,kind:"region",...Nr($,s),delay:Math.round(k*m),dur:p,bbox:$})});let c=250+Math.round(m*o.length),l=Math.min(70,700/Math.max(1,n.length)),f=600;n.forEach((w,k)=>{let $=Gn(Ht(w.box));a.push({id:w.id,kind:"node",...Nr($,s),delay:Math.round(c+k*l),dur:f,bbox:$})});let d=n.length?c+(n.length-1)*l:c,u=Math.round(d+300),y=Math.min(30,300/Math.max(1,e.length)),g=400,x=e.filter(w=>w.points.length>=2).map((w,k)=>({id:w.id,delay:Math.round(u+k*y),dur:g})),h={delay:u+200,dur:400},b=Math.max(...a.map(w=>w.delay+w.dur),...x.map(w=>w.delay+w.dur),h.delay+h.dur);return{pieces:a,routes:x,labels:h,total:b}}var _i=["edge","drop","rise","fly","pop","scatter","build","fade"],Fi=["explode","lift-off","sink","scatter","fly-out","collapse","fade","reverse"],Rr=["by-depth","by-layer","by-region","by-flow","as-listed","random"],Ef=["linear","ease","ease-in","ease-out","settle","spring","bounce"],Pn=t=>Math.round(t*100)/100||0,an=t=>Math.round(t*1e4)/1e4||0;function js(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:Pn(o.x0+o.y0+o.z0*.01),bbox:Gn(Ht(o)),foot:[Pn(n[0]),Pn(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(m=>[Pn(m[0]),Pn(m[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],...hu(i.raw)})),notes:Object.fromEntries((t.raw.notes??[]).map((i,o)=>[`${t.id}-note-${o}`,i.on])),intro:t.rendered.assembly}}var Pf=t=>typeof t=="string"?t.split(".")[0]:void 0,hu=t=>{let e=Pf(t.from),s=Pf(t.to);return{...e?{from:e}:{},...s?{to:s}:{}}},xa=(t,e,s,r)=>i=>{if(i<=0)return 0;if(i>=1)return 1;let o=(m,p,c)=>3*m*c*(1-c)**2+3*p*c*c*(1-c)+c**3,n=0,a=1;for(let m=0;m<40;m++){let p=(n+a)/2;o(t,s,p)<i?n=p:a=p}return o(e,r,(n+a)/2)},oc={linear:t=>t,ease:xa(.42,0,.58,1),"ease-in":xa(.42,0,1,1),"ease-out":xa(0,0,.58,1),settle:xa(.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 cc(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 Of=t=>{let e=2166136261;for(let s=0;s<t.length;s++)e^=t.charCodeAt(s),e=Math.imul(e,16777619);return e>>>0},Zn=t=>Math.max(0,Math.min(1,t)),ka=24;function ac(t,e,s){let[r,i,o,n]=e;return s==="left"?[-(t.x+t.w-r)-ka,0]:s==="right"?[r+o-t.x+ka,0]:s==="top"?[0,-(t.y+t.h-i)-ka]:[0,i+n-t.y+ka]}function fc(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=cc(s.seed??1);return r.map(g=>[y(),g]).sort((g,x)=>g[0]-x[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=[],m=new Set,p=y=>{if(m.has(y.id))return;let g=y.parent?i.get(y.parent):void 0;g&&p(g),m.add(y.id),a.push(y)};if(e==="by-region"){let y=g=>{for(let x of n.get(g)??[])p(x),y(x.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 f=s.source??t.routes.find(y=>y.from&&!l.has(y.from))?.from??t.routes[0]?.from,d=f?[f]:[],u=new Set(d);for(;d.length;){let y=d.shift(),g=i.get(y);g&&p(g);for(let x of c.get(y)??[])u.has(x)||(u.add(x),d.push(x))}for(let y of[...r].sort(o))p(y);return a}var yu={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"},gu={"lift-off":"lift",sink:"rise",scatter:"scatter","fly-out":"edge",fade:"fade",explode:"explode",collapse:"collapse"};function Ir(t,e,s={}){let r=s.seed??1,i=e==="disassemble",o=i&&s.style==="reverse",n=U=>{if(!i)return U.motion?.style??s.style??"edge";let C=U.motion?.out??s.style??"fly-out";return C==="reverse"?U.motion?.style??s.of??"edge":gu[C]},a=U=>i?U.motion?.out??s.style??"fly-out":n(U),m=!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,f,d=(U,C,G)=>{let Z=n(U),Q=U.motion?.easing??s.easing??yu[i&&a(U)!=="reverse"?a(U):Z]??"ease";return{p:U,delay:C+(U.motion?.delay??0),dur:Math.max(1,U.motion?.duration??G),style:Z,curve:oc[Q],from:U.motion?.from??s.from??"left"}};if(m){let U=new Map(t.pieces.map(C=>[C.id,C]));for(let C of t.intro.pieces){let G=U.get(C.id);G&&c.push(d(G,C.delay,C.dur))}l=t.intro.routes.map(C=>({...C})),f={...t.intro.labels}}else{let U=fc(t,p,{seed:r,source:s.source}),C=s.piece??600,G=s.stagger??Math.min(70,900/Math.max(1,U.length)),Z=Zn(s.overlap??.5),Q=o||i?[...U].reverse():U,z=Math.min(30,300/Math.max(1,t.routes.length)),D=400,V=400;if(i){f={delay:0,dur:V};let W=V*(1-Z);l=[...t.routes].reverse().map((H,ne)=>({id:H.id,delay:W+ne*z,dur:D}));let de=Math.max(W,...l.map(H=>H.delay+H.dur)),ce=Math.max(0,de-Z*D);Q.forEach((H,ne)=>c.push(d(H,ce+ne*G,C)))}else{Q.forEach((H,ne)=>c.push(d(H,ne*G,C)));let W=Math.max(0,...c.map(H=>H.delay+H.dur)),de=Math.max(0,W-Z*C);l=t.routes.map((H,ne)=>({id:H.id,delay:de+ne*z,dur:D}));let ce=Math.max(de,...l.map(H=>H.delay+H.dur));f={delay:Math.max(0,ce-Z*V),dur:V}}}let u=s.pulses&&t.routes.length?700:0;if(u&&i)for(let U of[...c,...l,f])U.delay+=u;let y=Math.max(1,...c.map(U=>U.delay+U.dur),...l.map(U=>U.delay+U.dur),f.delay+f.dur),g=i?0:y;u&&!i&&(y+=u);let x=s.duration!==void 0?Math.max(1,s.duration)/y:1;for(let U of[...c,...l,f])U.delay=Pn(U.delay*x),U.dur=Math.max(.01,Pn(U.dur*x));let h=s.duration!==void 0?Math.max(1,s.duration):Math.max(1,Pn(y)),b=new Map(c.map(U=>[U.p.id,U])),w=new Map(l.map(U=>[U.id,U])),[k,$,v,T]=t.viewBox,R=[k+v/2,$+T/2],O=U=>[U.x+U.w/2,U.y+U.h/2],I=(U,C)=>{let G=s.point;if(Array.isArray(G))return G;if(G==="region"||C==="collapse"&&G===void 0&&U.parent){let Z=t.pieces.find(Q=>Q.id===U.parent);return Z?Z.foot:R}if(typeof G=="string"){let Z=t.pieces.find(Q=>Q.id===G);if(Z)return Z.foot}return R};function M(U,C,G){let{p:Z}=U,Q=Z.bbox,z=1-C,D=(V,W)=>({dx:Pn(V*z),dy:Pn(W*z)});switch(U.style){case"drop":return D(...ac(Q,t.viewBox,"top"));case"lift":return D(...ac(Q,t.viewBox,"top"));case"fly":return D(...ac(Q,t.viewBox,U.from));case"rise":{let V=Q.h*z,[W,de,ce]=Z.base,H=Q.y-Q.h-4;return{...D(0,Q.h),clip:[[W[0],W[1]-V],[de[0],de[1]-V],[ce[0],ce[1]-V],[ce[0]+2,H-V],[W[0]-2,H-V]].map(ne=>[Pn(ne[0]),Pn(ne[1])])}}case"pop":return{scale:an(Math.max(0,C)),about:Z.foot,opacity:an(Zn(G*4))};case"scatter":{let V=cc((r^Of(Z.id))>>>0),W=V()*Math.PI*2,de=.35+V()*.65;return{...D(Math.cos(W)*v*de*.6,Math.sin(W)*T*de*.6),opacity:an(Zn(C*1.6))}}case"build":return{...D(0,-18),opacity:an(Zn(C))};case"fade":return{opacity:an(Zn(C))};case"explode":{let V=I(Z,"explode"),W=O(Q),de=W[0]-V[0],ce=W[1]-V[1],H=Math.hypot(de,ce),ne=cc((r^Of(Z.id))>>>0),Ee=ne()*Math.PI*2,qe=H>1?[de/H,ce/H]:[Math.cos(Ee),Math.sin(Ee)],N=Math.hypot(v,T)+Math.max(Q.w,Q.h);return D(qe[0]*N,qe[1]*N)}case"collapse":{let V=I(Z,"collapse");return{...D(V[0]-Z.foot[0],V[1]-Z.foot[1]),scale:an(Math.max(0,C)),about:Z.foot,opacity:an(Zn(C*3))}}default:{let V=Nr(Q,t.viewBox);return D(V.dx,V.dy)}}}let A=(U,C,G)=>{let Z=Zn((U-C)/G);return i?1-Z:Z},P={opacity:0},j=s.connectors??"draw",F=s.labels??"fade",Y=[...t.pieces.map(U=>U.id),...t.routes.map(U=>U.id),...Object.keys(t.notes)];function J(U){let C=Math.max(0,Math.min(h,Number.isFinite(U)?U:0));if(i?C<=0:C>=h)return{};let G=i?C>=h:C<=0,Z={},Q={},z={};for(let ce of c){let H=G?0:A(C,ce.delay,ce.dur);H<=0?Z[ce.p.id]=P:H<1&&(Z[ce.p.id]=M(ce,i?1-ce.curve(1-H):ce.curve(H),H))}for(let ce of t.routes){let H=w.get(ce.id),ne=G||!H?0:A(C,H.delay,H.dur);ne<=0?Q[ce.id]={opacity:0,drawn:0}:ne<1&&(Q[ce.id]=j==="fade"?{opacity:an(ne)}:j==="grow"?{drawn:an(ne),by:"grow"}:{drawn:an(oc["ease-out"](ne))})}let D=G?0:A(C,f.delay,f.dur),V=D<=0?P:D>=1?void 0:F==="type"?{typed:an(D)}:{opacity:an(D)};for(let ce of Y){let H=V;if(F==="with-piece"){let ne=Object.hasOwn(t.notes,ce)?t.notes[ce]:ce,Ee=ne===void 0?void 0:b.get(ne)??w.get(ne);if(Ee){let qe=G?0:A(C,Ee.delay,Ee.dur);H=qe<=0?P:qe>=1?void 0:{opacity:an(qe)}}}H&&(z[ce]=H)}let W=[];if(u&&!G){let ce=(C-g*x)/(u*x);if(ce>0&&ce<1)for(let H of t.routes)W.push({route:H.id,at:an(oc.ease(ce))})}let de=ce=>Object.keys(ce).length>0;return{...de(Z)?{items:Z}:{},...de(z)?{labels:z}:{},...de(Q)?{routes:Q}:{},...D<1?{marks:{opacity:an(Math.max(0,D))}}:{},...W.length?{tokens:W}:{}}}return{kind:e,duration:h,pieces:c.map(U=>({id:U.p.id,delay:U.delay,dur:U.dur,style:a(U.p)})),routes:l,labels:f,at:J}}var xt=t=>{let e=t.toFixed(2);return e==="-0.00"?"0":String(Number(e))},bu=(t,e)=>`translate(${xt(t[0])} ${xt(t[1])}) scale(${Number(e.toFixed(4))}) translate(${xt(-t[0])} ${xt(-t[1])})`,dc=t=>[...t.matchAll(/(-?[\d.]+),(-?[\d.]+)/g)].map(e=>[Number(e[1]),Number(e[2])]),mc=t=>t.slice(1).reduce((e,s,r)=>e+Math.hypot(s[0]-t[r][0],s[1]-t[r][1]),0);function $a(t,e){let s=dc(t),r=mc(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 wu(t,e){let s=dc(t),r=$a(t,e),i=[],o=mc(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 ps=t=>String(Number(t.toFixed(4)));function xu(t,e){let s=t.match(/&[^;\s]+;|[\s\S]/gu)??[];return s.slice(0,Math.round(s.length*e)).join("")}function ku(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(bu(t.about??[0,0],t.scale)),{attrs:{...t.opacity===void 0||t.opacity===1?{}:{opacity:ps(t.opacity)},...e.length?{transform:e.join(" ")}:{}},clip:t.clip}}function $u(t,e){let s={attrs:t.opacity===void 0||t.opacity===1?{}:{opacity:ps(t.opacity)}};if(t.drawn!==void 0&&t.drawn<1&&e!==void 0){let r=Zn(t.drawn),i=mc(dc(e));s.path=t.by==="grow"?{d:wu(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 Nf(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:ps(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&&$u(n,i(s))}let o=t.items&&Object.hasOwn(t.items,s)?t.items[s]:void 0;return o&&ku(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:ps(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:ps(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]=$a(o,Zn(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 If=t=>Object.keys(t).every(e=>e==="morph"||t[e]===void 0),zf=new Set(["marks","badges"]),Af=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:`${jf(i)}
143
+ ${o}`}:{},from:r.index+r[0].length})}return e}var Tf=new WeakMap;function Su(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=pc(t.svg);if(i!==void 0)for(let[n,[a,m]]of pc(i)){let p=o.get(n);p&&t.looks?.[n.split(`
144
+ `)[0]]?.includes(e)&&t.svg.slice(...p)!==i.slice(a,m)&&r.set(n,i.slice(a,m))}}return r}function Cf(t,e,s,r){let i=[];for(let o of t.looks?.[e]??[]){let n=Zn(r[o]??0),a=n>0?Su(t,o).get(`${e}
145
+ ${s}`):void 0;a!==void 0&&i.push([a,n])}return i.length?{own:Zn(1-i.reduce((o,[,n])=>o+n,0)),looks:i}:void 0}var vu=(t,e)=>(e.own>0?`<g opacity="${ps(e.own)}">${t}</g>`:"")+e.looks.map(([s,r])=>`<g opacity="${ps(r)}">${s}</g>`).join("");function Mu(t,e){let s="",r=0;for(let[i,[o,n]]of[...pc(t.svg)].sort((a,m)=>a[1][0]-m[1][0])){let[a,m]=i.split(`
146
+ `),p=Object.hasOwn(e,a)?Cf(t,a,m,e[a]):void 0;p&&(s+=t.svg.slice(r,o)+vu(t.svg.slice(o,n),p),r=n)}return s+t.svg.slice(r)}function Di(t,e){if(If(e))return t.rendered.svg;let s=e.variants?Mu(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,m,p=s.replace(/<(\/?)([a-zA-Z]+)((?:\s+[\w:-]+="[^"]*")*)\s*(\/?)>|([^<]+)/g,(l,f,d,u,y,g)=>{if(g!==void 0)return m?.w.typed===void 0?l:xu(g,m.w.typed);if(f)return i--,m&&i===m.at&&(m=void 0),i===1&&(o=""),l;let x=i;y||i++;let h={};for(let[,b,w]of u.matchAll(/([\w:-]+)="([^"]*)"/g))h[b]=w;if(x===0){if(!e.camera)return l;h.viewBox=e.camera.map(xt).join(" ")}else if(x===1)if(o=d==="g"&&h.class?.startsWith("g-")?h.class.slice(2):"",zf.has(o)&&e.marks&&e.marks.opacity!==1)h.opacity=ps(e.marks.opacity);else return l;else if(x===2&&h["data-part"]!==void 0){let b=h["data-route"]===void 0?"item":"route",w=jf(h["data-route"]??h["data-item"]??""),k=Nf(e,b,w,h["data-part"],r);if(!k)return l;for(let[$,v]of Object.entries(k.attrs))h[$]=Af(v);if(k.clip){let $=`${t.id}-mc${a++}`;n+=`<clipPath id="${$}"><polygon points="${k.clip.map(v=>v.join(",")).join(" ")}"/></clipPath>`,h["clip-path"]=`url(#${$})`}if(!y&&(k.path||k.typed!==void 0)&&(m={at:x,w:k}),!Object.keys(k.attrs).length&&!k.clip)return l}else if(m?.w.path&&d==="path"&&h.class?.split(" ")[0]==="flow"){let b=m.w.path;b.d!==void 0&&(h.d=b.d),b.style!==void 0&&(h.style=b.style),b.head||delete h["marker-end"]}else return l;return`<${d}${Object.entries(h).map(([b,w])=>` ${b}="${w}"`).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(([f,d])=>`<${f}${Object.entries(d).map(([u,y])=>` ${u}="${Af(y)}"`).join("")}/>`).join(""))),p}var jf=t=>t.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&amp;/g,"&"),lc=new WeakMap;function Lf(t,e,s){let r=lc.get(t);if(r){for(let[x,h]of r.mixed)x.replaceChildren(...h);for(let[x,h]of r.attrs)for(let[b,w]of h)w===null?x.removeAttribute(b):x.setAttribute(b,w);for(let[x,h,b]of r.gone.reverse())h.insertBefore(x,b);for(let[x,h]of r.texts)x.data=h;for(let x of r.made)x.remove();lc.delete(t)}if(If(e))return;let i={attrs:new Map,texts:new Map,gone:[],made:[],mixed:[]};lc.set(t,i);let o=(x,h,b)=>{let w=i.attrs.get(x)??new Map;w.has(h)||w.set(h,x.getAttribute(h)),i.attrs.set(x,w),b===null?x.removeAttribute(h):x.setAttribute(h,b)},n=t.ownerDocument,a=(x,h,b)=>{let w=n.createElementNS("http://www.w3.org/2000/svg",x);for(let[k,$]of Object.entries(h))w.setAttribute(k,$);return b.append(w),i.made.push(w),w},m=Array.from(t.children),p=x=>m.find(h=>h.getAttribute("class")===`g-${x}`),c=new Map;for(let x of Array.from(p("flows")?.children??[])){let h=x.getAttribute("data-route"),b=x.querySelector("path.flow")?.getAttribute("d");h!==null&&b&&c.set(h,b)}let l=x=>c.get(x);e.camera&&o(t,"viewBox",e.camera.map(xt).join(" "));for(let x of zf){let h=p(x);h&&e.marks&&e.marks.opacity!==1&&o(h,"opacity",ps(e.marks.opacity))}let f=0,d=m.find(x=>x.localName==="defs"),u=d?.firstChild??null,y=t.getAttribute("data-scene")??"scene";for(let x of m)for(let h of Array.from(x.children)){let b=h.getAttribute("data-part");if(b===null)continue;let w=h.getAttribute("data-route"),k=w===null?h.getAttribute("data-item")??"":"",$=s&&e.variants&&Object.hasOwn(e.variants,k)?Cf(s,k,b,e.variants[k]):void 0;if($){let R=Array.from(h.childNodes),O=(M,A)=>{let P=n.createElementNS("http://www.w3.org/2000/svg","g");return P.setAttribute("opacity",ps(M)),P.append(...A),P},I=M=>Array.from(n.importNode(new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg">${M}</svg>`,"image/svg+xml").documentElement,!0).childNodes);i.mixed.push([h,R]),h.replaceChildren(...$.own>0?[O($.own,R)]:[],...$.looks.map(([M,A])=>O(A,I(M))))}let v=Nf(e,w===null?"item":"route",w??h.getAttribute("data-item")??"",b,l);if(!v)continue;for(let[R,O]of Object.entries(v.attrs))o(h,R,O);if(v.clip&&d){let R=a("clipPath",{id:`${y}-mc${f++}`},d);d.insertBefore(R,u);let O=n.createElementNS("http://www.w3.org/2000/svg","polygon");O.setAttribute("points",v.clip.map(I=>I.join(",")).join(" ")),R.append(O),o(h,"clip-path",`url(#${R.id})`)}if(v.typed!==void 0){let R=[];for(let O=n.createTreeWalker(h,4);O.nextNode();)R.push(O.currentNode);for(let O of R)i.texts.set(O,O.data),O.data=Array.from(O.data).slice(0,Math.round(Array.from(O.data).length*v.typed)).join(""),O.data||(i.gone.push([O,O.parentNode,O.nextSibling]),O.remove())}let T=v.path&&h.querySelector("path.flow");T&&v.path&&(v.path.d!==void 0&&o(T,"d",v.path.d),v.path.style!==void 0&&o(T,"style",v.path.style),v.path.head||o(T,"marker-end",null))}let g=p("anim");if(g)for(let[x,h]of Rf(e,l))a(x,h,g)}var _f=(t,e)=>({...e,frame:s=>Di(t,e.at(s))}),uc=(t,e={})=>_f(t,Ir(js(t),"assemble",e)),Ff=(t,e={})=>_f(t,Ir(js(t),"disassemble",e)),Df=(t,e)=>uc(t).frame(e);var Pa=(t,e)=>e.role??Pt(t,e.kind)?.role,Sa=(t,e)=>Pt(t,e.region.kind)?.shape,wn=(t,e,s,r="item")=>s?ve("g",{[`data-${r}`]:t,"data-part":e},s):"";function zr({scene:t,layout:e,routes:s,steps:r,theme:i,id:o,gridStep:n=1}){let a=new fr,m={base:"",floor:"",flows:"",blocks:[],air:"",labels:"",marks:"",badges:""},p=new er;p.budget.spots=Ma;let c=P=>r.vis[P]?{"data-vis":"1"}:{},l=e.items.filter(P=>P.type==="region"),f=P=>{let j=0;for(let F=P.parent;F;F=F.parent)j++;return j},d=e.catalog,u=l.filter(P=>Sa(d,P)!=="walled"&&Sa(d,P)!=="tunnel"),y=ci(u.map(P=>({box:P.box,r:P}))).map(P=>P.r).sort((P,j)=>f(P)-f(j));for(let P of y)m.base+=Ou(a,d,P,c(P.id),n);for(let P of l.filter(j=>Sa(d,j)==="walled")){for(let F of va(P))p.solids.push(Ht(F));for(let[F,Y]of va(P).entries())m.blocks.push({box:Y,svg:wn(P.id,`wall-${F+1}`,ve("g",{class:`blk k-${Pa(d,P.region)} wall${P.region.ghost?" ghost":""}`,"data-id":P.id,"data-dim":"1",...c(P.id)},a.blockFaces(Y)))});let j=P.region.gate;if(j&&!j.node){let F=Ii(P,j.height??(P.region.height??.8)+.3,.3,.3);p.solids.push(Ht(F)),m.blocks.push({box:F,svg:wn(P.id,"gate",ve("g",{class:"blk k-gate","data-id":P.id,...c(P.id)},a.blockFaces(F)))})}P.region.label&&(P.region["label-style"]??"face")!=="none"&&(m.labels+=wn(P.id,"name",a.faceText(P.box.x0+.3,P.box.y1,P.box.z0+.13,P.region.label,"slabname sm fz",wt.sm,"left","start",{"data-id":P.id,...c(P.id)})))}for(let P of l.filter(j=>Sa(d,j)==="tunnel"))m.air+=wn(P.id,"block",Tu(a,P,c(P.id)));let g=e.items.filter(P=>P.type==="node");for(let P of g){let j=P.node,F=Mn(d,j.asset),Y=j.ghost||(j.deco??[]).includes("ghost"),J=["blk",`k-${j.role??F.role}`,F.cls,Y?"ghost":""].filter(Boolean).join(" ");m.blocks.push({box:P.box,svg:wn(P.id,"block",ve("g",{class:J,"data-id":P.id,"data-dim":"1",...c(P.id)},F.draw(a,P.box,j)))}),p.polys.push({poly:Ht(P.box),owner:P.id}),p.solids.push(Ht(P.box))}let x=ci(m.blocks).map(P=>P.svg).join(""),h=new Set,b={};for(let P of s){if(P.points.length<2)continue;let j=P.points.map(J=>Re(J[0],J[1],J[2]));j.forEach(J=>a.bounds.add(J));let F="M"+j.map(Gs).join(" L");b[P.id]=F;let Y=P.raw.arrow!==!1;Y&&h.add(P.kind),m.flows+=wn(P.id,"line",ve("g",{"data-hl":P.id,"data-id":P.id,...c(P.id)},ve("path",{d:F,class:`flow f-${P.kind}`,"marker-end":Y?`url(#ah-${o}-${P.kind})`:void 0})),"route"),p.lines.push({pts:j,owner:P.id})}for(let P of h)a.def(`ah-${o}-${P}`,ve("marker",{id:`ah-${o}-${P}`,viewBox:"0 0 10 10",refX:"7",refY:"5",markerWidth:"4.2",markerHeight:"4.2",orient:"auto-start-reverse"},ve("path",{d:"M0,0 L10,5 L0,10 z",style:`fill:${as(i,i.kinds[P]?.color??"control")}`})));for(let P of a.planePolys)p.slants.push(P);let w=g.filter(P=>P.node.label||P.node.sub).sort((P,j)=>(j.box.x1-j.box.x0)*(j.box.y1-j.box.y0)-(P.box.x1-P.box.x0)*(P.box.y1-P.box.y0));for(let P of w)m.labels+=wn(P.id,"label",Au(a,d,P,p,c(P.id)));let k=[];for(let P of s)if(P.raw.label&&P.points.length>=2){let j=Eu(a,P,p,c(P.id),e);m.floor+=wn(P.id,"label",j.svg,"route"),j.warning&&k.push({path:`${P.path}/label`,message:j.warning}),p.budget.over&&!p.budget.told&&(p.budget.told=!0,k.push({path:P.path,message:`from route "${P.id}" on, route labels were placed without weighing what other labels and lines cover: the scene is too large to search every spot (${Ma.toLocaleString("en")} spots); split it into scenes, or give the labels "along", "side" or "at"`}))}(t.notes??[]).forEach((P,j)=>{let F=wn(`${o}-note-${j}`,"note",Nu(a,P,e,s,`${o}-note-${j}`));P.floor?m.floor+=F:m.labels+=F});let $=[],v=new Map;for(let P of r.says){let j=v.get(P.step)??p.fork();v.set(P.step,j);let F=Sn(P.text,wt.say)+18,Y=ga(F,P.ax,P.ay,{x:P.x,y:P.y,anchor:P.anchor},j);j.rects.push({r:Y.rect,owner:""}),$.push({step:P.step,...Y.rect,text:P.text});let J=Y.rect.x+2;a.bounds.addRect(Y.rect.x,Y.rect.y,Y.rect.w,Y.rect.h);let U=as(i,i.kinds[P.kind]?.color??"control");m.marks+=ve("g",{class:"say","data-step":P.step},ve("rect",{x:J,y:Y.y-12,width:F,height:24,rx:12,style:`stroke:${U}`})+ve("text",{x:J+F/2,y:Y.y+4,"text-anchor":"middle",style:`fill:${U}`},St(P.text)))}for(let P of r.marks){let[j,F]=Re(...P.p);a.bounds.addRect(j-12,F-12,24,24),m.marks+=ve("g",{class:"xm","data-step":P.step,"data-hl":P.on},ve("circle",{cx:j,cy:F,r:10})+ve("path",{d:`M${bt(j-4.5)},${bt(F-4.5)} L${bt(j+4.5)},${bt(F+4.5)} M${bt(j+4.5)},${bt(F-4.5)} L${bt(j-4.5)},${bt(F+4.5)}`}))}for(let P of r.badges){let[j,F]=Re(...P.p);a.bounds.addRect(j-13,F-13,26,26),m.badges+=ve("g",{class:`badge c-${P.kind}`,"data-go":P.step,"data-badge":P.step,tabindex:"0",role:"button","aria-label":`Step ${P.num}`},ve("circle",{cx:j,cy:F,r:11.5})+ve("text",{x:j,y:F+.5},String(P.num)))}let T=a.bounds,R=22,O=T.empty?[0,0,100,100]:[Math.floor(T.x0-R),Math.floor(T.y0-R),Math.ceil(T.x1-T.x0+R*2),Math.ceil(T.y1-T.y0+R*2)],I=[...a.defs.values()].join(""),M=(P,j)=>ve("g",{class:"g-"+P},j);return{svg:ve("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:O.join(" "),role:"img","aria-label":t.aria??t.title,"data-scene":o},ve("defs",{},I)+M("base",m.base)+M("floor",m.floor)+M("flows",m.flows)+M("blocks",x)+M("air",m.air)+M("labels",m.labels)+M("marks",m.marks)+M("badges",m.badges)+M("anim","")),viewBox:O,texts:a.texts,paths:b,warnings:k,callouts:$,assembly:wa(e,s,O)}}function Pu(t,e){let s=t.z1+.002,r=1e-6,i=[],o=(n,a)=>{let m=Re(n[0],n[1],s),p=Re(a[0],a[1],s);i.push(`M${Gs(m)}L${Gs(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?ve("path",{class:"grid",d:i.join("")}):""}function Ou(t,e,s,r,i=1){let o=s.region,n=s.box,a=Pa(e,o),m=Pt(e,o.kind),p=m?.shape,c={"data-id":s.id,"data-dim":"1",...r},l="";p==="cloud"?l=ve("g",{class:`blk k-${a} cloud`,...c},Pr(t,n)):p==="zone"?l=ve("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=ve("g",{class:`blk k-${a}${o.ghost?" ghost":""}`,...c},t.blockFaces(n)+Pu(n,i)),l=wn(s.id,"block",l);let f=o["label-style"]??m?.labelStyle;if(o.label&&f!=="none")if(f==="face"){let d=n.z1-n.z0,u=h=>h.size*.73/lt,y=p==="slab"&&.28+u(wt.slabname)+.08>d,g=p==="slab"&&!y,x=g?n.z0+.28:y?n.z0+Math.max(.02,(d-u(wt.sm))/2):n.z0+Math.min(.1,d*.25);l+=wn(s.id,"name",ve("g",c,t.faceText(n.x0+(g?.6:.3),n.y1,x,o.label,g?"slabname":"slabname sm",g?wt.slabname:wt.sm,"left","start")))}else if(f==="face-right")l+=wn(s.id,"name",ve("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 d=p==="cloud"?"middle":"start",u=p==="cloud"?(n.x0+n.x1)/2:n.x0+.35,y=p==="cloud"?(n.y0+n.y1)/2:n.y1-.35;l+=wn(s.id,"name",ve("g",c,t.floorText(u,y,n.z1+.01,o.label,"slabname sm","x",d)))}return l}function va(t){let{x0:e,y0:s,x1:r,y1:i,z0:o,z1:n}=t.box,a=ls,m=t.region.gate,p=[],c=f=>{f.x1-f.x0>1e-6&&f.y1-f.y0>1e-6&&p.push({...f,z0:o,z1:n})},l=(f,d,u)=>{if(!m||m.side!==u)return[[f,d]];let y=m.at??.5,g=m.width??2,x=u==="e"||u==="w"?s+(i-s)*y:e+(r-e)*y;return[[f,x-g/2],[x+g/2,d]]};for(let[f,d]of l(e,r,"n"))c({x0:f,y0:s,x1:d,y1:s+a});for(let[f,d]of l(s+a,i-a,"w"))c({x0:e,y0:f,x1:e+a,y1:d});for(let[f,d]of l(s+a,i-a,"e"))c({x0:r-a,y0:f,x1:r,y1:d});for(let[f,d]of l(e,r,"s"))c({x0:f,y0:i-a,x1:d,y1:i});return p}function Au(t,e,s,r,i){let o=s.node,n=Mn(e,o.asset),a=s.box,m={name:o.label,sub:o.sub},p=o["label-at"],c;if(p){let f=Gn(Ht(a)),d=p.side??"above",u=f.y+Math.min(f.h,60)*.45;d==="right"?c={x:f.x+f.w+8,y:u,anchor:"start"}:d==="left"?c={x:f.x-8,y:u,anchor:"end"}:d==="below"?c={x:f.x+f.w/2,y:f.y+f.h+14,anchor:"middle"}:c=Li(m,a,Ht(a),new er,s.id),c={...c,x:c.x+(p.dx??0),y:c.y+(p.dy??0)}}else{let f=n.label?n.label(a,o,!!o.sub):void 0;c=Li(m,a,Ht(a),r,s.id,f)}r.rects.push({r:ji(m,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)),ve("g",{"data-id":s.id,"data-dim":"1",...i},l)}function Tu(t,e,s){let{x0:r,y0:i,x1:o,y1:n,z0:a,z1:m}=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 d=1;d<l;d++){let u=c?r+(o-r)*d/l:i+(n-i)*d/l;p+=t.poly(c?[[u,i,m],[u,n,m],[u,n,a]]:[[r,u,m],[o,u,m],[o,u,a]],"rib")}let f=e.region.label;return f&&e.region["label-style"]!=="none"&&(p+=c?t.faceText(r+.35,n,a+.14,f,"tunname",wt.tunname,"left","start"):t.faceText(o,n-.35,a+.18,f,"tunname",wt.tunname,"right","start")),ve("g",{class:"tunnel","data-id":e.id,"data-dim":"1",...s},p)}var Ma=2e4;function Eu(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},m=wt.floor;if(o.at){let h=o.at.length>2?o.at[2]:e.points[0][2];return{svg:t.floorText(o.at[0],o.at[1],h,o.text,n,o.dir??"x",o.anchor??"start",a)}}let p=e.points,c=[];for(let h=0;h+1<p.length;h++){let b=p[h],w=p[h+1];Math.abs(b[2]-w[2])>1e-6||c.push({i:h,len:Math.hypot(w[0]-b[0],w[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(h=>h.i===Math.min(o.along-1,p.length-2)):[...c].sort((h,b)=>b.len-h.len),f=.22,d=11/lt,u=h=>{let b=Sn(h,m)/lt,w,k=1/0,$=0;e:for(let v of l.length?l:c){let T=p[v.i],R=p[v.i+1],O=T[2],I=Math.abs(T[1]-R[1])<1e-6,M=I?Math.min(T[0],R[0]):Math.min(T[1],R[1]),A=I?Math.max(T[0],R[0]):Math.max(T[1],R[1]),P=I?T[1]:T[0],j=o.side==="left"?[-1]:o.side==="right"?[1]:[-1,1],F=[];for(let Y=M+.3;Y<=Math.max(M+.3,A-b-.2)+1e-9;Y+=.4)F.push(Y);for(let Y=A-b-.2+.4;Y<A+.5&&A-M<b+.5;Y+=.6)F.push(Y);for(let Y of j)for(let J of F){if(k<=$*.5)break e;let U=Y<0?P-f:P+f+d,C,G,Z;if(I?(C=J,G=U,Z=[Re(C,G-d,O),Re(C+b,G-d,O),Re(C+b,G,O),Re(C,G,O)]):(C=U,G=J+b,Z=[Re(C-d,G,O),Re(C-d,G-b,O),Re(C,G-b,O),Re(C,G,O)]),(I?[[C,G-d],[C+b,G-d],[C+b,G],[C,G]]:[[C-d,G],[C-d,G-b],[C,G-b],[C,G]]).some(([de,ce])=>Math.abs(Ar(i,de,ce)+.01-O)>.001)){$++;continue}let z=s.hiddenPoly(Z),D=z*50+$*.5,V=s.budget.spots-- >0;V||(s.budget.over=!0);let W=D>=k?1/0:V?D+s.costPoly(Z,k-D):D;$++,W<k&&(k=W,w={x:C,y:G,z:O,dir:I?"x":"y",rect:Gn(Z),poly:Z,hidden:z})}}return w&&w.hidden<6?w:void 0},y=o.text,g=u(y),x;if(!g){let h=o.text.split(/(\s+)/);for(let b=h.length-1;b>0&&!g;b--){let w=h.slice(0,b).join("").trimEnd().replace(/[\s,;:·–-]+$/,"")+"\u2026";if(w.length<6)break;let k=u(w);k&&(g=k,y=w)}x=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?x+='; give it "along", "side" or "at", or move the nodes apart':x+='; 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:x}):{svg:"",warning:x}}function Nu(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,m={"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,f]=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,f,c+.01,e.floor,`floor mono t-${p}`,e.dir??"x",e.anchor??"start",m)}if(e.face){let c=n?.box,[l,f,d]=a?[a[0],a[1],a[2]??.45]:c?[c.x0+.3,c.y1,c.z0+.13]:[0,0,0];return t.faceText(l,f,d,e.face,"slabname sm",wt.sm,"left",e.anchor??"start",m)}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],[f,d]=Re(l[0],l[1],l[2]),u=f+(e.dx??0),y=d-18+(e.dy??0),g=e.anchor??"middle",x="";return e.label&&(x+=t.text(u,y,e.label,"lbl",wt.lbl,g)),e.sub&&(x+=t.text(u,e.label?y+14:y,e.sub,"sub mono",wt.sub,g)),ve("g",m,x)}return""}function Oa(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,zr({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 Bi=29.09090909090909,hc={solid:[9,7],dashed:[7,6],dotted:[3,6]},yc=["blocked","planned"],Bf=`
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
+ @keyframes iso-ants{to{stroke-dashoffset:var(--ant-to)}}
149
+ `;function qi(t,e={}){return(e.still??yc).includes(t)?void 0:e.dash??hc[e.kinds?.[t]?.dash??"solid"]}function ks(t){let e=t?.ants;return e?e===!0?{}:Array.isArray(e)?{ids:e}:e:void 0}function Aa(t,e={}){let s=new Map(t.routes.map(n=>[n.id,n.kind])),r=e.ids&&new Set(e.ids),i=e.speed??Bi,o=n=>String(Number(n.toFixed(3)));return t.rendered.svg.replace(/(<g data-route="([^"]*)" data-part="line">(?:<g[^>]*>)*)<path ([^>]*?)\s*\/>/g,(n,a,m,p)=>{let c=m.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&"),l=r&&!r.has(c)?void 0:qi(s.get(c)??"",e);if(!l||!/class="flow\b/.test(p))return n;let f=l[0]+l[1],d=o(f/Math.max(1e-6,Math.abs(i))),u=o(i<0?f:-f);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:${u};--ant-turn:${d}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="${u}" dur="${d}s" repeatCount="indefinite"/></path>`})}var tr=t=>typeof t=="string"?[t]:[...t],Ta=t=>JSON.parse(JSON.stringify(t)),On=(t={})=>({...t.from===void 0?{}:{from:t.from},...t.over===void 0?{}:{duration:t.over},...t.easing===void 0?{}:{easing:t.easing}}),Cr=class t{nodes=[];add(e){return this.nodes.push(Ta(e)),this}assemble(e={},s={}){return this.add({assemble:e,...On(s)})}disassemble(e={},s={}){return this.add({disassemble:e,...On(s)})}travel(e,s={}){let{each:r,hold:i,loop:o}=s;return this.add({travel:e,...On(s),each:r,hold:i,loop:o})}pulse(e,s={}){return this.add({pulse:tr(e),...On(s),loop:s.loop})}ants(e=!0,s={}){return this.add({ants:e===!0?!0:tr(e),...On(s),speed:s.speed,dash:s.dash})}draw(e,s={}){return this.add({draw:tr(e),...On(s),by:s.by,stagger:s.stagger})}type(e,s={}){return this.add({type:tr(e),...On(s)})}move(e,s){return this.add({move:e,...s})}lift(e,s,r={}){return this.add({lift:tr(e),by:s,...On(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:tr(e),scope:r,level:i,always:o},...On(s),fade:s.fade})}highlight(e,s={}){return this.add({highlight:tr(e),...On(s),fade:s.fade})}get camera(){return{focus:(e,s={})=>this.add({camera:{focus:e,zoom:s.zoom,margin:s.margin},...On(s)}),fit:(e={})=>this.add({camera:"fit",...On(e)})}}sequence(e,s={},r){return this.add({sequence:qf(e,s,r)})}series(e){let s=new jr;return e(s),this.add({series:s.items})}layers(e){let s=new t;return e(s),this.add({layers:s.nodes})}};function qf(t,e,s){let{read:r,duration:i,...o}=e,n=new Cr;return s?.(n),Ta({...t===void 0?{}:{name:t},...o,...r!==void 0?{duration:{read:r}}:i!==void 0?{duration:i}:{},...n.nodes.length?{children:n.nodes}:{}})}var jr=class{items=[];sequence(e,s={},r){return this.items.push({sequence:qf(e,s,r)}),this}transition(e){return this.items.push({transition:Ta(e)}),this}},Vi=class extends jr{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 Cr;return e(s),this.over.push(...s.nodes),this}toJSON(){return Ta({isomotion:1,...this.head,...this.items.length?{series:this.items}:{},...this.over.length?{layers:this.over}:{},...Object.keys(this.marks).length?{markers:this.marks}:{}})}},Vf=(t={})=>new Vi(t);var Ea=["linear","ease","ease-in","ease-out","ease-in-out","settle","bounce"],Lr=["extend","clamp","wrap","identity"];function Yn(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 Gi(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 Ls=(t,e,s,r)=>i=>{if(i<=0)return 0;if(i>=1)return 1;let o=(m,p,c)=>3*m*c*(1-c)**2+3*p*c*c*(1-c)+c**3,n=0,a=1;for(let m=0;m<50;m++){let p=(n+a)/2;o(t,s,p)<i?n=p:a=p}return o(e,r,(n+a)/2)},Ru=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},Iu={linear:t=>t,ease:Ls(.25,.1,.25,1),"ease-in":Ls(.42,0,1,1),"ease-out":Ls(0,0,.58,1),"ease-in-out":Ls(.42,0,.58,1),settle:Ls(.16,.84,.3,1),bounce:Ru};function _r(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)),m;if(a<1){let p=n*Math.sqrt(1-a*a);m=1-Math.exp(-a*n*o)*(Math.cos(p*o)+a*n/p*Math.sin(p*o))}else m=1-Math.exp(-n*o)*(1+n*o);return e.overshootClamping?Math.min(1,m):m}function Hn(t,e,s="ease-in-out"){let r=t??s;return typeof r=="string"?Iu[r]:"bezier"in r?Ls(...r.bezier):i=>i<=0?0:i>=1?1:_r(i*e,r.spring)}function Fr(t,e,s){let r=t.times.map(l=>Yn(l,s)),i=t.values,o=r.length;if(o===1)return i[0];let n=(l,f)=>{if(l==="clamp")return f?i[0]:i[o-1];if(l==="identity")return e;if(l==="wrap"){let d=r[o-1]-r[0];return Fr({...t,extrapolateLeft:"clamp",extrapolateRight:"clamp"},r[0]+((e-r[0])%d+d)%d,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 m=r[a+1]-r[a],p=(e-r[a])/m,c=p<0||p>1?p:Hn(t.easing,m,"linear")(p);return i[a]+(i[a+1]-i[a])*c}var zu={anyOf:[{type:"number"},{type:"string",pattern:"^-?\\d+(\\.\\d+)?(ms|s|f)?$"}]},Cu={type:"array",items:{type:"string"}},ju={anyOf:[{enum:Ea},{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"}},dn=(t,e,s={},r=!0)=>({type:"object",required:[t],additionalProperties:!1,properties:{[t]:e,...r?Gf:{},...s}}),Zf={$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:zu,ids:Cu,ease:ju,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:Lr},extrapolateRight:{enum:Lr}}},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"},dn("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:dn("sequence",{$ref:"#/$defs/sequence"},{},!1),plan:{type:"object"},nodes:{type:"array",items:{anyOf:[{$ref:"#/$defs/seq"},dn("series",{$ref:"#/$defs/series"},{},!1),dn("layers",{$ref:"#/$defs/nodes"},{},!1),dn("assemble",{type:"object",properties:{style:{enum:_i},order:{enum:Rr}}}),dn("disassemble",{type:"object",properties:{style:{enum:Fi},order:{enum:Rr}}}),dn("travel",{type:"array",items:{anyOf:[{type:"string"},{$ref:"#/$defs/ids"}]},minItems:1},{each:{$ref:"#/$defs/time"},hold:{$ref:"#/$defs/time"},loop:{type:"boolean"}}),dn("pulse",{$ref:"#/$defs/ids"},{loop:{type:"boolean"}}),dn("ants",{anyOf:[{const:!0},{$ref:"#/$defs/ids"}]},{speed:{type:"number"},dash:{type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:2}}),dn("draw",{$ref:"#/$defs/ids"},{by:{enum:["stroke","grow"]},stagger:{$ref:"#/$defs/time"}}),dn("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}},dn("focus",{$ref:"#/$defs/focus"},{fade:{$ref:"#/$defs/time"}}),dn("highlight",{$ref:"#/$defs/ids"},{fade:{$ref:"#/$defs/time"}}),dn("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"}}}]})]}}}},gc=["sequence","series","layers","assemble","disassemble","travel","pulse","ants","draw","type","move","lift","focus","highlight","camera"],Kf={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"},Un=["from","duration","easing"],Ki={sequence:[],series:[],layers:[],assemble:Un,disassemble:Un,travel:[...Un,"each","hold","loop"],pulse:[...Un,"loop"],ants:[...Un,"speed","dash"],draw:[...Un,"by","stagger"],type:Un,move:["from","x","y","scale","opacity"],lift:[...Un,"by","stagger","to","opacity"],focus:[...Un,"fade"],highlight:[...Un,"fade"],camera:Un},Lu=["name","from","offset","duration","loop","playbackRate","trimBefore","say","show","hide","focus","highlight","levels","variants","enter","ants","children","layers","series"],Ot=t=>!!t&&typeof t=="object"&&!Array.isArray(t);function Na(t){let e=[],s=(h,b,w)=>{e.push({severity:"error",path:h,message:b,...w?{hint:w}:{}})},r=(h,b,w)=>{for(let k of Object.keys(h))if(!b.includes(k)){let $=Vt(k,b);s(`${w}/${k}`,`unknown key "${k}"`,$?`did you mean "${$}"?`:void 0)}};if(!Ot(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=(h,b,w={})=>{if(h===void 0)return;if(typeof h=="string"&&/f$/.test(h)&&i===void 0){s(b,`"${h}" is in frames: the document needs its fps`);return}let k=Yn(h,i);k===void 0?s(b,`${JSON.stringify(h)} isn't a time (ms, "1.2s", "450ms", "30f")`):k<0&&!w.negative&&s(b,"a time can't be negative")},n=(h,b,w)=>{if(h!==void 0&&!b.includes(h)){let k=typeof h=="string"?Vt(h,b):void 0;s(w,`${JSON.stringify(h)} isn't one of ${b.join(", ")}`,k?`did you mean "${k}"?`:void 0)}},a=(h,b,w={})=>{h!==void 0&&(typeof h!="number"||!Number.isFinite(h)||w.min!==void 0&&h<w.min||w.max!==void 0&&h>w.max||w.over!==void 0&&h<=w.over)&&s(b,`${JSON.stringify(h)} isn't a number${w.over!==void 0?` over ${w.over}`:w.min!==void 0?` from ${w.min}${w.max!==void 0?` to ${w.max}`:""}`:""}`)},m=(h,b)=>{if(h!==void 0){if(!Array.isArray(h)){s(b,"a list of ids");return}h.forEach((w,k)=>{typeof w!="string"&&s(`${b}/${k}`,"an id")})}},p=(h,b,w=[])=>{if(!Ot(h)){s(b,"a spring is a map");return}r(h,["mass","damping","stiffness","overshootClamping",...w],b);for(let k of["mass","damping","stiffness"])a(h[k],`${b}/${k}`,{over:0});h.overshootClamping!==void 0&&typeof h.overshootClamping!="boolean"&&s(`${b}/overshootClamping`,"true or false")},c=(h,b)=>{if(h!==void 0){if(typeof h=="string"){n(h,Ea,b);return}if(Ot(h)&&"bezier"in h){r(h,["bezier"],b),(!Array.isArray(h.bezier)||h.bezier.length!==4||h.bezier.some(w=>typeof w!="number"))&&s(`${b}/bezier`,"four numbers");return}if(Ot(h)&&"spring"in h){r(h,["spring"],b),p(h.spring,`${b}/spring`);return}s(b,"an easing is a name, { bezier: [a, b, c, d] } or { spring: { \u2026 } }")}},l=(h,b)=>{if(h===void 0)return;if(!Ot(h)){s(b,"a curve is { times, values }");return}r(h,["times","values","easing","extrapolateLeft","extrapolateRight"],b);let w=h.times,k=h.values;if(!Array.isArray(w)||!w.length)s(`${b}/times`,"a list of times");else{w.forEach((v,T)=>o(v,`${b}/times/${T}`,{negative:!0}));let $=w.map(v=>Yn(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(k)||k.some($=>typeof $!="number")?s(`${b}/values`,"a list of numbers"):Array.isArray(w)&&k.length!==w.length&&s(`${b}/values`,`${k.length} values for ${w.length} times`),c(h.easing,`${b}/easing`),n(h.extrapolateLeft,Lr,`${b}/extrapolateLeft`),n(h.extrapolateRight,Lr,`${b}/extrapolateRight`)},f=(h,b)=>{if(h!==void 0){if(!Ot(h)){s(b,"focus is { lit: [ids] }");return}r(h,["lit","scope","level","always"],b),h.lit===void 0&&s(`${b}/lit`,"what is lit"),m(h.lit,`${b}/lit`),m(h.always,`${b}/always`),n(h.scope,["all","links"],`${b}/scope`),a(h.level,`${b}/level`,{min:0,max:1})}},d=(h,b)=>{h!==void 0&&typeof h!="string"&&s(b,"text")},u=new Map;function y(h,b,w){if(!Ot(h)){s(b,"a sequence is a map");return}if(r(h,Lu,b),h.name!==void 0&&(typeof h.name!="string"||!/^[A-Za-z][\w-]*$/.test(h.name)?s(`${b}/name`,"a name is letters, digits, - and _, from a letter"):u.has(h.name)?s(`${b}/name`,`"${h.name}" is already a name (${u.get(h.name)})`):u.set(h.name,b)),w&&h.from!==void 0&&s(`${b}/from`,"in a series a sequence follows the one before","offset moves it"),!w&&h.offset!==void 0&&s(`${b}/offset`,"offset is for a series","use from"),o(h.from,`${b}/from`),o(h.offset,`${b}/offset`,{negative:!0}),o(h.trimBefore,`${b}/trimBefore`),Ot(h.duration)){r(h.duration,["read"],`${b}/duration`);let k=h.duration.read;if(k!==!0&&!Ot(k))s(`${b}/duration/read`,"true, or { base, perChar, min, max }");else if(Ot(k)){r(k,["base","perChar","min","max"],`${b}/duration/read`);for(let $ of["base","perChar","min","max"])a(k[$],`${b}/duration/read/${$}`,{min:0})}}else o(h.duration,`${b}/duration`);if(h.loop!==void 0&&typeof h.loop!="boolean"&&!(Number.isInteger(h.loop)&&h.loop>=1)&&s(`${b}/loop`,"true, false, or how many times"),a(h.playbackRate,`${b}/playbackRate`,{over:0}),h.say!==void 0)if(!Ot(h.say))s(`${b}/say`,"say is a map");else{let k=h.say;r(k,["chapter","title","text","code","facts","color"],`${b}/say`);for(let $ of["chapter","title","text","code","color"])d(k[$],`${b}/say/${$}`);k.facts!==void 0&&(!Array.isArray(k.facts)||k.facts.some($=>!Array.isArray($)||$.length!==2||$.some(v=>typeof v!="string")))&&s(`${b}/say/facts`,"a list of [name, value]")}for(let k of["show","hide","highlight"])m(h[k],`${b}/${k}`);if(f(h.focus,`${b}/focus`),h.levels!==void 0)if(!Ot(h.levels))s(`${b}/levels`,"levels is a map: an id, and how much of it");else for(let[k,$]of Object.entries(h.levels))a($,`${b}/levels/${k}`,{min:0,max:1});if(h.variants!==void 0)if(!Ot(h.variants))s(`${b}/variants`,"variants is a map: an id, and the name of its look");else for(let[k,$]of Object.entries(h.variants))typeof $!="string"&&s(`${b}/variants/${k}`,`a look's name, or "" for its own`);h.enter!==void 0&&(Ot(h.enter)?(r(h.enter,["fade","easing"],`${b}/enter`),h.enter.fade===void 0&&s(`${b}/enter/fade`,"how long the fade is"),o(h.enter.fade,`${b}/enter/fade`),c(h.enter.easing,`${b}/enter/easing`)):s(`${b}/enter`,"enter is { fade }")),h.ants!==void 0&&typeof h.ants!="boolean"&&m(h.ants,`${b}/ants`);for(let k of["children","layers"])h[k]!==void 0&&x(h[k],`${b}/${k}`);h.series!==void 0&&g(h.series,`${b}/series`)}function g(h,b){if(!Array.isArray(h)){s(b,"a series is a list");return}h.forEach((w,k)=>{let $=`${b}/${k}`;if(!Ot(w)||Object.keys(w).length!==1||!("sequence"in w||"transition"in w)){s($,"a series holds sequences and transitions");return}if("sequence"in w){y(w.sequence,`${$}/sequence`,!0);return}let v=w.transition,T=`${$}/transition`,R=O=>Ot(h[O])&&"sequence"in h[O];if((!R(k-1)||!R(k+1))&&s(T,"a transition is between two sequences"),!Ot(v)){s(T,"a transition is { presentation, timing }");return}r(v,["presentation","timing"],T),v.presentation===void 0?s(`${T}/presentation`,"a presentation"):n(v.presentation,["fade","none"],`${T}/presentation`),Ot(v.timing)?"linear"in v.timing?(r(v.timing,["linear"],`${T}/timing`),o(v.timing.linear,`${T}/timing/linear`)):"spring"in v.timing?(r(v.timing,["spring"],`${T}/timing`),p(v.timing.spring,`${T}/timing/spring`,["duration"]),Ot(v.timing.spring)&&o(v.timing.spring.duration,`${T}/timing/spring/duration`)):s(`${T}/timing`,"a timing is { linear } or { spring }"):s(`${T}/timing`,"a timing is { linear } or { spring }")})}function x(h,b){if(!Array.isArray(h)){s(b,"a list");return}h.forEach((w,k)=>{let $=`${b}/${k}`;if(!Ot(w)){s($,"a map");return}let v=gc.filter(I=>I in w);if(v.length!==1){let I=Object.keys(w).find(P=>P in Kf),M=Object.keys(w)[0],A=M?Vt(M,gc):void 0;s($,I?`${I}: ${Kf[I]}`:v.length?`one of ${v.join(", ")}, not several`:`one of ${gc.join(", ")}`,!I&&!v.length&&A?`did you mean "${A}"?`:void 0);return}let T=v[0],R=w[T],O=`${$}/${T}`;r(w,[T,...Ki[T]],$),Ki[T].includes("from")&&o(w.from,`${$}/from`),Ki[T].includes("duration")&&(o(w.duration,`${$}/duration`),c(w.easing,`${$}/easing`));for(let I of["each","hold","stagger","fade"])Ki[T].includes(I)&&o(w[I],`${$}/${I}`);if(Ki[T].includes("loop")&&w.loop!==void 0&&typeof w.loop!="boolean"&&s(`${$}/loop`,"true or false"),T==="sequence")y(R,O,!1);else if(T==="series")g(R,O);else if(T==="layers")x(R,O);else if(T==="assemble"||T==="disassemble")Ot(R)?(n(R.style,T==="assemble"?_i:Fi,`${O}/style`),n(R.order,Rr,`${O}/order`),R.duration!==void 0&&s(`${O}/duration`,"its length is beside it","duration is the node's")):s(O,`${T} is a map (its options)`);else if(T==="travel")!Array.isArray(R)||!R.length?s(O,"a list of connectors"):R.forEach((I,M)=>{Array.isArray(I)?m(I,`${O}/${M}`):typeof I!="string"&&s(`${O}/${M}`,"a connector, or a list of them at once")});else if(T==="ants")R!==!0&&m(R,O),a(w.speed,`${$}/speed`),w.dash!==void 0&&(!Array.isArray(w.dash)||w.dash.length!==2||w.dash.some(I=>typeof I!="number"||I<=0))&&s(`${$}/dash`,"two numbers over 0: on, off");else if(T==="move"){typeof R!="string"&&s(O,"an id");for(let I of["x","y","scale","opacity"])l(w[I],`${$}/${I}`)}else if(T==="focus")f(R,O);else if(T==="camera"){if(R!=="fit")if(!Ot(R))s(O,'"fit", or { focus, zoom, margin }');else{r(R,["focus","zoom","margin"],O),a(R.zoom,`${O}/zoom`,{over:0}),a(R.margin,`${O}/margin`);let I=R.focus;typeof I=="string"||Array.isArray(I)&&(I.every(M=>typeof M=="string")||I.length===4&&I.every(M=>typeof M=="number"))||s(`${O}/focus`,"an id, some ids, or a box [x, y, w, h]")}}else m(R,O);T==="draw"&&n(w.by,["stroke","grow"],`${$}/by`),T==="lift"&&(w.by===void 0&&s(`${$}/by`,"how far apart"),a(w.by,`${$}/by`),n(w.to,["up","down"],`${$}/to`),l(w.opacity,`${$}/opacity`))})}if(t.series!==void 0&&g(t.series,"/series"),t.layers!==void 0&&x(t.layers,"/layers"),t.markers!==void 0)if(!Ot(t.markers))s("/markers","markers is a map");else for(let[h,b]of Object.entries(t.markers))if(typeof b=="string"&&/^[A-Za-z][\w-]*([+-].+)?$/.test(b)){let w=/^([A-Za-z][\w-]*?)(?:([+-])(\d.*))?$/.exec(b);if(w&&(u.has(w[1])?w[1]:void 0))w[3]!==void 0&&o(w[3],`/markers/${h}`);else if(!u.has(b)){let v=Vt(w?.[1]??b,u.keys());s(`/markers/${h}`,`no sequence is named "${w?.[1]??b}"`,v?`did you mean "${v}"?`:void 0)}}else o(b,`/markers/${h}`);return e}var Tn=t=>Math.round(t*100)/100||0,Wt=t=>Math.round(t*1e4)/1e4||0,An=t=>Math.max(0,Math.min(1,t)),Dr=(t,e,s)=>t+(e-t)*s,_u=250,bc=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 f={};for(let[d,u]of c){let y=l(u);Object.keys(y).length&&(f[d]=y)}return f},i=c=>Object.keys(c).length>0,o=c=>c===void 0||Wt(c)>=1?{}:{opacity:Wt(Math.max(0,c))},n=c=>({...Tn(c.dx??0)?{dx:Tn(c.dx)}:{},...Tn(c.dy??0)?{dy:Tn(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}:{}})),m=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,f=c.drawn!==void 0&&c.drawn<1;return{...o(c.opacity),...f?{drawn:Wt(c.drawn),...c.by?{by:c.by}:{}}:{},...c.ants&&!l&&!f?{ants:c.ants}:{}}});return i(a)&&(s.items=a),i(m)&&(s.labels=m),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 Br(t,e,s={}){let r=Na(e),i=js(t),o=e.fps,n=ks(t.raw),a=()=>({ok:!1,diags:r,duration:0,beats:[],markers:{},at:()=>({}),cues:()=>{},beatAt:()=>{},startOf:()=>{}});if(r.length)return a();let m=(S,B,K)=>{r.push({severity:"error",path:S,message:B,...K?{hint:K}:{}})},p=(S,B)=>S===void 0?B:Yn(S,o),c=new Map(i.pieces.map(S=>[S.id,S])),l=new Set(i.routes.map(S=>S.id)),f=new Set(Object.keys(i.notes)),d=new Map(t.routes.map(S=>[S.id,S.kind])),u=[...c.keys(),...l,...f],y=new Set(u),g=new Map;for(let[S,B]of Object.entries(i.notes))B!==void 0&&g.set(B,[...g.get(B)??[],S]);let x={any:y,thing:new Set(c.keys()),route:l},h={any:"thing, connector or note",thing:"thing",route:"connector"},b=(S,B,K="any")=>{if(!x[K].has(S)){let ae=Vt(S,x[K]);m(B,`no ${h[K]} "${S}" in this drawing`,ae?`did you mean "${ae}"?`:void 0)}},w=(S,B,K="any")=>S?.forEach((ae,le)=>b(ae,`${B}/${le}`,K)),k=new Map(t.layout.items.map(S=>[S.id,Ht(S.box).map(B=>[Tn(B[0]),Tn(B[1])])])),$=new Map;function v(S,B){let K="from"in S?p(S.from,0):0,ae="duration"in S?p(S.duration,NaN):NaN,le=Number.isFinite(ae);if("sequence"in S){let fe=S.sequence;return p(fe.from,0)+I(fe,`${B}/sequence`)}if("series"in S)return M(S.series,`${B}/series`).end;if("layers"in S)return Math.max(0,...S.layers.map((fe,se)=>v(fe,`${B}/layers/${se}`)));if("assemble"in S||"disassemble"in S){let fe="assemble"in S?"assemble":"disassemble",se="assemble"in S?S.assemble:S.disassemble,ge=$.get(S);return ge||$.set(S,ge=Ir(i,fe,{seed:e.seed??1,...se,...le?{duration:ae}:{}})),K+ge.duration}return"draw"in S?K+(le?ae:400)+Math.max(0,S.draw.length-1)*p(S.stagger,0):"lift"in S?K+Math.max(le?ae:750,...S.opacity?.times.map(fe=>Yn(fe,o))??[])+Math.max(0,S.lift.length-1)*p(S.stagger,0):le?K+ae:"travel"in S?S.loop?K:K+S.travel.length*p(S.each,1150):"pulse"in S?S.loop?K:K+1500:"type"in S?K+400:"camera"in S?K+900:"move"in S?K+Math.max(0,...[S.x,S.y,S.scale,S.opacity].flatMap(fe=>fe?.times.map(se=>Yn(se,o))??[])):K}let T=(S,B)=>Math.max(0,...(S.children??[]).map((K,ae)=>v(K,`${B}/children/${ae}`)),...(S.layers??[]).map((K,ae)=>v(K,`${B}/layers/${ae}`)),S.series?M(S.series,`${B}/series`).end:0),R=new Map;function O(S,B){let K=R.get(S);if(K!==void 0)return K;let ae;return S.duration!==void 0&&typeof S.duration=="object"?ae=Gi(S.say,S.duration.read):ae=S.duration!==void 0?p(S.duration,0):T(S,B),S.duration===void 0&&ae<=0&&S.say&&(ae=Gi(S.say,!0)),ae<=0&&m(`${B}/duration`,"how long is it? (nothing in it says)"),R.set(S,ae),ae}let I=(S,B)=>{let K=O(S,B),ae=S.playbackRate??1;return S.loop===!0?K/ae:(typeof S.loop=="number"?K*S.loop:K)/ae};function M(S,B){let K=[],ae=0,le;return S.forEach((fe,se)=>{if("transition"in fe){let he=fe.transition,Ie=he.timing,E=he.presentation==="none"?0:"linear"in Ie?p(Ie.linear,0):p(Ie.spring.duration,Fu(Ie.spring));le={t:he,length:E};return}let ge=fe.sequence,Se=`${B}/${se}/sequence`,te=I(ge,Se),xe=Math.max(0,ae+p(ge.offset,0)-(le?.length??0));le&&K.length&&le.length>Math.min(K[K.length-1].end-K[K.length-1].start,te)&&m(`${B}/${se-1}/transition/timing`,"a transition is no longer than either side of it"),K.push({s:ge,path:Se,start:xe,end:xe+te,...le?{into:le}:{}}),ae=xe+te,le=void 0}),{list:K,end:Math.max(0,...K.map(fe=>fe.end))}}let A=M(e.series??[],"/series"),P=Math.max(0,...(e.layers??[]).map((S,B)=>v(S,`/layers/${B}`))),j=Math.max(A.end,P);j<=0&&!r.length&&m("","a motion document has a series, or layers, that last");let F=new Map,Y=[],J=i.viewBox,U=(S,B,K)=>{let ae=K!==void 0?1/K:Math.max((S.w+B*2)/J[2],(S.h+B*2)/J[3]);return[S.x+S.w/2-J[2]*ae/2,S.y+S.h/2-J[3]*ae/2,J[2]*ae,J[3]*ae]};function C(S,B,K){let ae=le=>K?{at:K.at+le/K.rate,rate:K.rate}:void 0;if("sequence"in S){Z(S.sequence,`${B}/sequence`,ae(p(S.sequence.from,0)),!1);return}if("series"in S){for(let le of M(S.series,`${B}/series`).list)Z(le.s,le.path,ae(le.start),!1);return}if("layers"in S){S.layers.forEach((le,fe)=>C(le,`${B}/layers/${fe}`,K));return}if("travel"in S)S.travel.forEach((le,fe)=>(Array.isArray(le)?le:[le]).forEach((se,ge)=>b(se.split(":")[0],`${B}/travel/${fe}${Array.isArray(le)?`/${ge}`:""}`,"route")));else if("pulse"in S)w(S.pulse,`${B}/pulse`,"thing");else if("ants"in S)S.ants!==!0&&w(S.ants,`${B}/ants`,"route");else if("draw"in S)w(S.draw,`${B}/draw`,"route");else if("type"in S)w(S.type,`${B}/type`);else if("move"in S)b(S.move,`${B}/move`,"thing");else if("lift"in S)w(S.lift,`${B}/lift`,"thing");else if("focus"in S)G(S.focus,`${B}/focus`);else if("highlight"in S)w(S.highlight,`${B}/highlight`,"thing");else if("camera"in S){let le=S.camera,fe=p(S.duration,900);if(!K){m(`${B}/camera`,"a camera can't be in a loop");return}let se=J;if(le!=="fit"){let ge=le.focus;if(Array.isArray(ge)&&typeof ge[0]=="number")se=U({x:ge[0],y:ge[1],w:ge[2],h:ge[3]},le.margin??0,le.zoom);else{let Se=typeof ge=="string"?[ge]:ge;Se.forEach((xe,he)=>b(xe,`${B}/camera/focus${typeof ge=="string"?"":`/${he}`}`,"thing"));let te=Se.map(xe=>c.get(xe)?.bbox).filter(xe=>!!xe);if(te.length){let xe=Math.min(...te.map(Ie=>Ie.x)),he=Math.min(...te.map(Ie=>Ie.y));se=U({x:xe,y:he,w:Math.max(...te.map(Ie=>Ie.x+Ie.w))-xe,h:Math.max(...te.map(Ie=>Ie.y+Ie.h))-he},le.margin??40,le.zoom)}}}Y.push({at:K.at+p(S.from,0)/K.rate,over:fe/K.rate,ease:Hn(S.easing,fe,"settle"),to:se})}}let G=(S,B)=>{S&&(w(S.lit,`${B}/lit`),w(S.always,`${B}/always`))};function Z(S,B,K,ae){if(S.name!==void 0&&K&&F.set(S.name,K.at),!ae)for(let se of["show","hide","say","enter","focus","highlight","levels","variants","ants"])S[se]!==void 0&&m(`${B}/${se}`,`${se} is for a sequence of the document's own series`,se==="focus"||se==="highlight"||se==="ants"?`here, a child: { ${se}: \u2026 }`:void 0);w(S.show,`${B}/show`),w(S.hide,`${B}/hide`),w(S.highlight,`${B}/highlight`,"thing"),G(S.focus,`${B}/focus`);for(let se of Object.keys(S.levels??{}))se!=="*"&&b(se,`${B}/levels/${se}`);for(let[se,ge]of Object.entries(S.variants??{})){b(se,`${B}/variants/${se}`,"thing");let Se=t.rendered.looks?.[se]??[];if(c.has(se)&&ge!==""&&!Se.includes(ge)){let te=Vt(ge,Se);m(`${B}/variants/${se}`,Se.length?`${se} has no look "${ge}" (it has ${Se.join(", ")})`:`${se} declares no looks (variants: in the diagram)`,te?`did you mean "${te}"?`:void 0)}}Array.isArray(S.ants)&&w(S.ants,`${B}/ants`,"route");let le=S.playbackRate??1,fe=K&&!S.loop?{at:K.at-p(S.trimBefore,0)/(K.rate*le),rate:K.rate*le}:void 0;if((S.children??[]).forEach((se,ge)=>C(se,`${B}/children/${ge}`,fe)),(S.layers??[]).forEach((se,ge)=>C(se,`${B}/layers/${ge}`,fe)),S.series)for(let se of M(S.series,`${B}/series`).list)Z(se.s,se.path,fe&&{at:fe.at+se.start/fe.rate,rate:fe.rate},!1)}for(let S of A.list)Z(S.s,S.path,{at:S.start,rate:1},!0);(e.layers??[]).forEach((S,B)=>C(S,`/layers/${B}`,{at:0,rate:1})),Y.sort((S,B)=>S.at-B.at);let Q={};for(let[S,B]of Object.entries(e.markers??{})){let K=Yn(B,o);if(K!==void 0){Q[S]=K;continue}let ae=String(B),le=[...F.keys()].filter(ge=>ae===ge||ae.startsWith(ge+"+")||ae.startsWith(ge+"-")).sort((ge,Se)=>Se.length-ge.length)[0];if(le===void 0){m(`/markers/${S}`,`"${ae}" isn't a moment of this document`);continue}let fe=ae.slice(le.length),se=fe?Yn(fe.slice(1),o):0;if(se===void 0){m(`/markers/${S}`,`"${fe}" isn't a time`);continue}Q[S]=F.get(le)+(fe[0]==="-"?-se:se)}if(r.length)return a();let z=A.list.map((S,B)=>({name:S.s.name??`beat-${B+1}`,index:B,start:S.start,end:S.end,...S.s.say?{say:S.s.say}:{}})),D=new Map;for(let S of A.list){for(let B of S.s.show??[])D.has(B)||D.set(B,!1);for(let B of S.s.hide??[])D.has(B)||D.set(B,!0)}let V=[new Map(D)];for(let S of A.list){let B=new Map(V[V.length-1]);for(let K of S.s.show??[])B.set(K,!0);for(let K of S.s.hide??[])B.set(K,!1);V.push(B)}let W=[new Map];for(let S of A.list){let B=new Map(W[W.length-1]);for(let[K,ae]of Object.entries(S.s.variants??{}))B.set(K,ae);W.push(B)}let de=(S,B)=>!S||S.lit.includes(B)||S.always?.includes(B)||S.scope==="links"&&c.has(B)?1:S.level??.12,ce=(S,B)=>{let K=S<0?void 0:A.list[S].s.levels;return K?K[B]??K["*"]??1:1},H=(S,B)=>(V[S+1].get(B)===!1?0:1)*(S<0?1:de(A.list[S].s.focus,B))*ce(S,B),ne=(S,B)=>{let K=i.notes[B];if(K===void 0)return H(S,B);let ae=S<0?void 0:A.list[S].s.levels?.[B];return H(S,K)*(V[S+1].get(B)===!1?0:1)*(ae??1)},Ee=S=>{let B=-1;for(let K=0;K<A.list.length;K++)A.list[K].start<=S&&(B=K);return B},qe=(S,B)=>{let K=A.list[S],ae=B-K.start;if(K.into&&K.into.length>0){let se=K.into.t.timing;return"spring"in se?ae>=K.into.length?1:An(_r(ae,{...se.spring,overshootClamping:!0})/_r(K.into.length,{...se.spring,overshootClamping:!0})):An(ae/K.into.length)}let le=K.s.enter;if(!le)return 1;let fe=p(le.fade,0);return fe<=0?1:Hn(le.easing,fe,"ease")(An(ae/fe))};function N(S,B,K,ae,le){if("sequence"in S){let Se=S.sequence,te=p(Se.from,0);Ue(Se,B-te,K-te,we(Se,ae-te),le);return}if("series"in S){for(let Se of M(S.series,"").list)Ue(Se.s,B-Se.start,K-Se.start,Se.end-Se.start,le);return}if("layers"in S){for(let Se of S.layers)N(Se,B,K,ae,le);return}let fe=p("from"in S?S.from:void 0,0),se=B-fe;if("assemble"in S||"disassemble"in S){le.sum.add($.get(S).at(se));return}if("draw"in S){let Se=Math.max(1,p(S.duration,400)),te=p(S.stagger,0),xe=Hn(S.easing,Se,"ease-out");S.draw.forEach((he,Ie)=>{let E=xe(An((se-Ie*te)/Se));E<=0?(le.sum.route(he,{opacity:0,drawn:0}),le.sum.label(he,{opacity:0})):E<1&&(le.sum.route(he,{drawn:E,...S.by?{by:S.by}:{}}),le.sum.label(he,{opacity:E}))});return}if("type"in S){let Se=p(S.duration,400),te=Hn(S.easing,Se,"linear")(An(se/Math.max(1,Se)));if(te<1)for(let xe of S.type)le.sum.label(xe,te<=0?{opacity:0}:{typed:te});return}if("move"in S){let Se=E=>E?Fr(E,se,o):void 0,te=Se(S.x)??0,xe=Se(S.y)??0,he=Se(S.scale),Ie=Se(S.opacity);le.sum.item(S.move,{dx:te,dy:xe,...he===void 0?{}:{scale:he,about:c.get(S.move).foot},...Ie===void 0?{}:{opacity:An(Ie)}});for(let E of[S.move,...g.get(S.move)??[]])le.sum.label(E,{dx:te,dy:xe,...Ie===void 0?{}:{opacity:An(Ie)}});return}if("lift"in S){let Se=p(S.stagger,0),te=Math.max(1,p(S.duration,750)),xe=Hn(S.easing,te,"ease-out"),he=S.to==="down",Ie=S.lift.length;S.lift.forEach((E,q)=>{let _=se-(he?Ie-1-q:q)*Se,re=xe(An(_/te)),pe=(q+1)*S.by*(he?re:-re),Te=S.opacity?An(Fr(S.opacity,_,o)):1;if(!(!pe&&Te>=1)){le.sum.item(E,{dy:pe,opacity:Te});for(let Pe of[E,...g.get(E)??[]])le.sum.label(Pe,{dy:pe,opacity:Te})}});return}if("camera"in S)return;let ge=S.duration===void 0?Math.max(0,ae-fe):p(S.duration,0);if(!(se<0||se>ge)){if("focus"in S||"highlight"in S){let Se=Math.max(1,p(S.fade,_u)),te=An(Math.min(se/Se,S.duration===void 0?1:(ge-se)/Se)),xe=Hn(S.easing,Se,"linear")(te);if("focus"in S)ke(S.focus,xe,le.sum);else for(let he of S.highlight)le.shown(he)&&ye(he,xe,le.sum);return}if("ants"in S){Ve(S.ants===!0?[...l]:S.ants,le,S.speed,S.dash);return}if("pulse"in S){let te=S.loop?ee(K-fe,1500,le)/1500:se/Math.max(1,S.duration===void 0?1500:ge);if(te<0||te>=1)return;for(let xe of S.pulse)if(le.shown(xe)){let he=c.get(xe),Ie=he.bbox.w*.5*(.7+te*.6);le.sum.pulses.push({x:Tn(he.foot[0]),y:Tn(he.foot[1]),rx:Tn(Ie),ry:Tn(Ie*.58),opacity:Wt(1-te)})}return}if("travel"in S){let Se=p(S.each,1150),te=p(S.hold,S.loop?700:0),xe=S.travel.length*Se+te,he=S.loop?ee(K-fe,xe,le):se,Ie=Math.floor(he/Se);if(Ie>=S.travel.length)return;let E=Hn(S.easing,Se,"ease-in-out")((he-Ie*Se)/Se),q=S.travel[Ie];for(let _ of Array.isArray(q)?q:[q]){let[re,pe]=_.split(":");le.shown(re)&&le.sum.tokens.push({route:re,at:Wt(E),...pe?{kind:pe}:{}})}}}}let ee=(S,B,K)=>K.off?0:(S%B+B)%B,ye=(S,B,K)=>{Wt(B)>0&&k.has(S)&&K.outlines.push({id:S,points:k.get(S),...Wt(B)<1?{opacity:Wt(B)}:{}})},ke=(S,B,K)=>{for(let ae of u){let le=f.has(ae)&&!S.lit.includes(ae)&&!S.always?.includes(ae)?i.notes[ae]:void 0,fe=Dr(1,de(S,le??ae),B);fe>=1||(c.has(ae)?(K.item(ae,{opacity:fe}),K.label(ae,{opacity:fe})):l.has(ae)?(K.route(ae,{opacity:fe}),K.label(ae,{opacity:fe})):K.label(ae,{opacity:fe}))}},Ve=(S,B,K=Bi,ae)=>{for(let le of S){let fe=qi(d.get(le)??"",{dash:ae,kinds:s.kinds,still:s.still});if(!fe)continue;let se=fe[0]+fe[1],ge=ee(K*B.A/1e3,se,B);B.sum.route(le,{ants:{dash:fe,offset:Tn(ge)}})}},we=(S,B)=>S.loop===!0?Math.max(0,B):I(S,"");function Ue(S,B,K,ae,le){if(B<0||B>ae||B===ae&&ae<j&&ae>0&&S.loop)return;let fe=S.playbackRate??1,se=O(S,""),ge=p(S.trimBefore,0),Se=S.loop&&se>0?B*fe%se:B*fe,te=Se+ge,xe=K*fe+ge;for(let he of S.children??[])N(he,te,xe,se+ge,le);for(let he of S.layers??[])N(he,te,xe,se+ge,le);if(S.series)for(let he of M(S.series,"").list)Ue(he.s,te-he.start,xe-he.start,he.end-he.start,le)}function Le(S,B={}){let K=Math.max(0,Math.min(j,Number.isFinite(S)?S:0)),ae=B.ambient==="off"||e.ambient==="off"&&B.ambient===void 0,le=typeof B.ambient=="number"?B.ambient:K,fe=new bc,se=Ee(K),ge=se<0?1:qe(se,K),Se=(_,re)=>se<0?re(-1,_):ge>=1?re(se,_):Dr(re(se-1,_),re(se,_),ge),te=_=>(se<0?V[0]:V[se+1]).get(_)!==!1;if(D.size||A.list.some(_=>_.s.focus||_.s.levels))for(let _ of u){let re=Se(_,f.has(_)?ne:H);re>=1||(c.has(_)&&fe.item(_,{opacity:re}),l.has(_)&&fe.route(_,{opacity:re}),fe.label(_,{opacity:re}))}if(se>=0)for(let _ of W[W.length-1].keys()){let re=W[se].get(_)??"",pe=W[se+1].get(_)??"",Te={};re&&ge<1&&(Te[re]=Wt(1-ge)),pe&&(Te[pe]=Wt((Te[pe]??0)+ge));for(let Pe of Object.keys(Te))Te[Pe]<=0&&delete Te[Pe];Object.keys(Te).length&&(fe.variants[_]=Te)}if(se>=0){let _=new Set(A.list[se].s.highlight??[]),re=new Set(se>0&&ge<1?A.list[se-1].s.highlight??[]:[]);for(let pe of new Set([...re,..._]))ye(pe,Dr(re.has(pe)?1:0,_.has(pe)?1:0,ge),fe)}let xe={sum:fe,shown:te,off:ae,A:le},he=se>=0?A.list[se].s.ants:void 0,Ie=he===void 0?n:void 0;he?Ve(he===!0?[...l]:he,xe):Ie&&Ve(Ie.ids??[...l],xe,Ie.speed,Ie.dash),A.list.forEach((_,re)=>{K>=_.start&&(K<_.end||re===se&&K<=_.end)&&Ue(_.s,K-_.start,le-_.start,_.end-_.start,xe)});for(let _ of e.layers??[])N(_,K,le,j,xe);let E;for(let _ of Y){if(_.at>K)break;let re=_.over<=0?1:_.ease(An((K-_.at)/_.over)),pe=E??J;if(re>=1){E=_.to;continue}let Te=pe[2],Pe=_.to[2],rt=Math.exp(Dr(Math.log(Te),Math.log(Pe),re)),Fe=Math.abs(Pe-Te)<1e-6?re:(rt-Te)/(Pe-Te),Ce=Dr(pe[0]+pe[2]/2,_.to[0]+_.to[2]/2,Fe),Ke=Dr(pe[1]+pe[3]/2,_.to[1]+_.to[3]/2,Fe),We=rt*J[3]/J[2];E=[Ce-rt/2,Ke-We/2,rt,We]}let q=E?.map(Tn);return fe.state(q&&q.some((_,re)=>Math.abs(_-J[re])>.005)?q:void 0)}let $e=S=>{let B=Ee(Math.max(0,Math.min(j,S)));return B<0?void 0:z[B]};return{ok:!0,diags:r,duration:j,beats:z,markers:Q,at:Le,beatAt:$e,startOf:S=>F.get(S)??z.find(B=>B.name===S)?.start,cues(S){let B=$e(S);if(!B)return;let K=Math.max(0,Math.min(j,S));return{beat:B.name,index:B.index,of:z.length,progress:Wt(An((K-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 Fu(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 Uf(t){let{steps:e,vis:s}=t.steps,r=e.map((i,o)=>{let n=[],a=[];for(let[l,f]of Object.entries(s))(o===0?!f.includes(!0):f[o-1]&&!f[o])?a.push(l):o>0&&f[o]&&!f[o-1]&&n.push(l);let m=[];i.phases.length&&m.push({travel:i.phases.map(l=>l.length===1?l[0].route:l.map(f=>f.route)),each:1150,hold:700,loop:!0});let p=(t.raw.steps??[])[o]?.pulse?.filter(l=>t.layout.byId.has(l))??[];p.length&&m.push({pulse:p,loop:!0});let c={name:`step-${i.n}`,duration:i.duration,say:{title:i.heading,...i.caption?{text:i.caption}:{},...i.command?{code:i.command}:{}}};return n.length&&(c.show=n),a.length&&(c.hide=a),m.length&&(c.children=m),{sequence:c}});return{isomotion:1,...r.length?{series:r}:{}}}var Wf=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"]),Du=new Set("cursor pointer-events transition animation transform-box transform-origin user-select".split(" "));function Bu(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 qu(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(),m=o.slice(n+1).trim();return[a,m.replace(/\s*!important$/,""),/!important$/.test(m)]});for(let o of i)if(!o[0].startsWith("--")&&!Wf.has(o[0])&&!Du.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=>Bu(p.replace(/^>/,""),p.startsWith(">"))),m=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:m,order:s.length,decls:i})}}return s}function Vu(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 Jf=t=>typeof t=="string"?t:`<${t.name}${t.attrs.map(([e,s])=>` ${e}="${s}"`).join("")}${t.children.length||t.name==="g"?`>${t.children.map(Jf).join("")}</${t.name}>`:"/>"}`,Zi=(t,e)=>t.attrs.find(s=>s[0]===e)?.[1],qr=(t,e,s)=>{let r=t.attrs.find(i=>i[0]===e);r?r[1]=s:t.attrs.push([e,s])},Ku=t=>(Zi(t,"class")??"").split(/\s+/).filter(Boolean);function Gu(t,e){if(e.tag&&e.tag!==t.name)return!1;let s=Ku(t);return e.classes.every(r=>s.includes(r))&&!e.not.some(r=>s.includes(r))&&e.attrs.every(([r,i])=>{let o=Zi(t,r);return o!==void 0&&(i===void 0||o===i)})}function wc(t,e,s=e.length-1){if(!Gu(t,e[s]))return!1;if(s===0)return!0;let r=t.parent;if(e[s].child)return!!r&&r.name!=="#root"&&wc(r,e,s-1);for(;r&&r.name!=="#root";r=r.parent)if(wc(r,e,s-1))return!0;return!1}var _s=t=>t.endsWith("%")?parseFloat(t)/100:parseFloat(t);function Zu(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,[m,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[(m+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 Ra(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,m]=r.split(/[\s,]+/);return Zu(parseFloat(o),_s(n),_s(a),i!==void 0?_s(i):m!==void 0?_s(m):1)}if(s=/^rgba?\((.*)\)$/.exec(e),s){let[r,i,o,n]=s[1].split(/[\s,/]+/).filter(Boolean);return[_s(r),_s(i),_s(o),n===void 0?1:_s(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:Ra(l[1]),p:Number(l[2])/100}:{c:Ra(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,m=(r.c[3]*o+i.c[3]*n)/a,p=c=>m===0?0:(r.c[c]*r.c[3]*o+i.c[c]*i.c[3]*n)/a/m;return[p(0),p(1),p(2),m*Math.min(1,a)]}}var Hf=t=>"#"+[t[0],t[1],t[2]].map(e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0")).join(""),Uu=t=>String(Math.round(t*1e4)/1e4);function xc(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),","),m=e.get(n)??(a.length?a.join(","):void 0);if(m===void 0)throw new Error(`resolve: no value for ${n}`);return xc(t.slice(0,r)+m+t.slice(o),e,s+1)}var Yu=t=>new Map(t.split(";").filter(Boolean).map(e=>{let s=e.indexOf(":");return[e.slice(0,s).trim(),e.slice(s+1).trim()]})),kc={sans:"system-ui, -apple-system, Segoe UI, Roboto, sans-serif",mono:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"};function Ui(t,e){let s=Ai(e.theme),r=e.fonts??kc,i=qu(`.mono{font-family:${r.mono.replace(/"/g,"")}}
150
+ ${s.rest}
151
+ ${e.css}`),o=Vu(t);qr(o,"font-family",r.sans.replace(/"/g,""));let n=(a,m)=>{let p=m,c=new Map,l=(u,y,g)=>{let x=c.get(u);(!x||g[0]>x.rank[0]||g[0]===x.rank[0]&&(g[1]>x.rank[1]||g[1]===x.rank[1]&&g[2]>=x.rank[2]))&&c.set(u,{v:y,rank:g})};for(let u of i)if(wc(a,u.parts))for(let[y,g,x]of u.decls)l(y,g,[x?1:0,u.spec,u.order]);let f=Zi(a,"style");if(f){for(let u of f.split(";").map(y=>y.trim()).filter(Boolean)){let y=u.indexOf(":");l(u.slice(0,y).trim(),u.slice(y+1).trim(),[0,1e6,0])}a.attrs=a.attrs.filter(u=>u[0]!=="style")}for(let[u,y]of c)u.startsWith("--")&&(p===m&&(p=new Map(m)),p.set(u,y.v));let d={};for(let[u,y]of c){if(!Wf.has(u))continue;let g=xc(y.v,p).trim();if(u==="fill"||u==="stroke"||u==="stop-color"){if(g==="none"||g==="currentColor"||g==="inherit"||g.startsWith("url(")){qr(a,u,g);continue}let x=Ra(g);if(!x)throw new Error(`resolve: a colour it doesn't know: ${g}`);qr(a,u,Hf(x)),x[3]!==1&&(d[u==="stop-color"?"stop":u]=x[3])}else qr(a,u,u==="letter-spacing"||u==="font-size"||u==="stroke-width"?g:g.replace(/"/g,""))}for(let[u,y]of Object.entries(d))qr(a,`${u}-opacity`,Uu(y*Number(Zi(a,`${u}-opacity`)??1)));Zi(a,"opacity")==="0"&&(qr(a,"display","none"),a.attrs=a.attrs.filter(u=>u[0]!=="opacity"));for(let u of a.attrs)if(/var\(|hsl\(|color-mix/.test(u[1])){let y=xc(u[1],p),g=Ra(y);u[1]=g?Hf(g):y}for(let u of a.children)typeof u!="string"&&n(u,p)};return n(o,Yu(e.mode==="dark"?`${s.light};${s.dark}`:s.light)),Jf(o)}function $c(t){return Math.max(5600,Math.min(12500,2600+t.length*40))}function Ia(t,e,s,r,i,o){let n=[],a=(O,I,M,A="error")=>{let P=i.locate(O);n.push({severity:A,message:I,line:P.line,col:P.col,path:O,hint:M})},m=t.steps??[],p=new Set(Object.keys(o.kinds)),c=new Map(r.map(O=>[O.id,O])),l=()=>[...s.byId.keys(),...c.keys()],f=new Map;m.forEach((O,I)=>{O.id&&(f.has(O.id)&&a(`${e}/steps/${I}/id`,`duplicate step id "${O.id}"`),f.set(O.id,I+1))});let d=m.length,u=(O,I)=>{if(typeof O=="number"){if(O<1||O>d){a(I,`there is no step ${O}; this scene has ${d} step(s)`);return}return O}let M=f.get(O);return M===void 0&&a(I,`unknown step "${O}"`+En(O,f.keys())),M},y=O=>as(o,o.kinds[O]?.color??"control"),g=[],x=O=>{g.includes(O)||g.push(O)};for(let O of r)x(O.kind);let h={},b=(O,I,M,A)=>{if(I===void 0&&M===void 0)return;let P=I!==void 0?u(I,A+"/appears"):1,j=M!==void 0?u(M,A+"/disappears"):d+1;h[O]=Array.from({length:d},(F,Y)=>Y+1>=(P??1)&&Y+1<(j??d+1))};for(let O of s.items)b(O.id,O.appears,O.disappears,O.path);for(let O of r)b(O.id,O.raw.appears,O.raw.disappears,O.path);let w=[],k=[],$=[],v=[],T=()=>{for(let O of r){if(O.raw.appears!==void 0||O.raw.disappears!==void 0)continue;let I=[O.from,O.to].map(M=>M&&(h[M.id]??R(M)));I.some(Boolean)&&(h[O.id]=Array.from({length:d},(M,A)=>I.every(P=>!P||P[A])))}},R=O=>{for(let I=O.parent;I;I=I.parent)if(h[I.id])return h[I.id]};return m.forEach((O,I)=>{let M=I+1,A=`${e}/steps/${I}`,P=O.kind??"control";p.has(P)||a(A+"/kind",`unknown flow kind "${P}"`+En(P,p)),x(P);let j=new Set,F=[];(O.animate??[]).forEach((C,G)=>{let Z=Array.isArray(C)?C:[C],Q=[];Z.forEach((z,D)=>{let V=Array.isArray(C)?`${A}/animate/${G}/${D}`:`${A}/animate/${G}`,W,de;if(typeof z=="string"){let ne=/^([^:\s]+)\s*(?::\s*(\S+))?$/.exec(z.trim());W=ne?ne[1]:z,de=ne?.[2]}else{let ne=Object.entries(z)[0];W=ne[0],de=ne[1]}let ce=c.get(W);if(!ce){a(V,`unknown route "${W}"`+En(W,c.keys()));return}if(de&&!p.has(de)){a(V,`unknown flow kind "${de}"`+En(de,p));return}let H=de??ce.kind;x(H),Q.push({route:W,kind:H,color:y(H)}),j.add(W),ce.from&&j.add(ce.from.id),ce.to&&j.add(ce.to.id)}),Q.length&&F.push(Q)});let Y=[];(O.pulse??[]).forEach((C,G)=>{let Z=s.byId.get(C);if(!Z){a(`${A}/pulse/${G}`,`unknown node "${C}"`+En(C,s.byId.keys()));return}let Q,z,D,V,W=Z.node?Xs(s.catalog,Z.node.asset):void 0;if(W?.pulse)[Q,z,D,V]=W.pulse(Z.box);else{let H=Z.box;Q=(H.x0+H.x1)/2,z=(H.y0+H.y1)/2,D=H.z1,V=Math.max(22,Math.min(60,(H.x1-H.x0+H.y1-H.y0)*8.5))}let[de,ce]=Re(Q,z,D);Y.push([de,ce,V*1.7,V*.98]),j.add(C)}),(O.highlight??[]).forEach((C,G)=>{!s.byId.has(C)&&!c.has(C)&&a(`${A}/highlight/${G}`,`unknown id "${C}"`+En(C,l())),j.add(C)});for(let[C,G]of[["show",!0],["hide",!1]])(O[C]??[]).forEach((Z,Q)=>{if(!s.byId.has(Z)&&!c.has(Z)){a(`${A}/${C}/${Q}`,`unknown id "${Z}"`+En(Z,l()));return}let z=h[Z]??(h[Z]=Array(d).fill(!G));for(let D=I;D<d;D++)z[D]=G});if((O.say??[]).forEach((C,G)=>{let Z,Q;if(Array.isArray(C.at))[Z,Q]=Re(C.at[0],C.at[1],C.at[2]??.36);else{let D=s.byId.get(C.at);if(!D){a(`${A}/say/${G}/at`,`unknown node "${C.at}"`+En(C.at,s.byId.keys()));return}let V=D.box;[Z,Q]=Re((V.x0+V.x1)/2,(V.y0+V.y1)/2,V.z1+.75)}let z=C.kind??P;p.has(z)||a(`${A}/say/${G}/kind`,`unknown flow kind "${z}"`+En(z,p)),k.push({step:M,x:Z+(C.dx??0),y:Q+(C.dy??(Array.isArray(C.at)?0:-46)),ax:Z,ay:Q,text:C.text,kind:z,anchor:C.anchor??"middle"})}),(O.mark??[]).forEach((C,G)=>{if(C.at){$.push({step:M,p:[C.at[0],C.at[1],C.at[2]??.36]});return}let Z=C.on?c.get(C.on):void 0;if(!Z){a(`${A}/mark/${G}`,C.on?`unknown route "${C.on}"`+En(C.on,c.keys()):'a mark needs "on: ROUTE" or "at: [x, y]"');return}let Q=Z.points[Z.points.length-1];$.push({step:M,p:[Q[0],Q[1],Q[2]+.6],on:Z.id}),j.add(Z.id)}),t.badges&&O.badge!==!1){let C=Array.isArray(O.badge)?[O.badge[0],O.badge[1],O.badge[2]??.36]:void 0,G=typeof O.badge=="string"?O.badge:F[0]?.[0]?.route,Z=G?c.get(G):void 0;if(!C)if(Z)C=Sc(Z.points);else if(G&&s.byId.get(G)){let Q=s.byId.get(G).box;C=[(Q.x0+Q.x1)/2,(Q.y0+Q.y1)/2,Q.z1+.3]}else typeof O.badge=="string"&&a(`${A}/badge`,`unknown id "${O.badge}"`+En(O.badge,l()));C&&v.push({step:M,num:O.number??M,kind:P,p:C})}for(let C of[...j])for(let G=s.byId.get(C)?.parent;G;G=G.parent)j.add(G.id);for(let C of s.items)C.region?.kind==="tunnel"&&(C.region.around??[]).some(G=>j.has(G))&&j.add(C.id);let J;if(O.focus?.length){let C=1/0,G=1/0,Z=-1/0,Q=-1/0;O.focus.forEach((z,D)=>{let V=s.byId.get(z);if(!V){a(`${A}/focus/${D}`,`unknown node or region "${z}"`+En(z,s.byId.keys()));return}let W=V.box;for(let[de,ce,H]of[[W.x0,W.y0,W.z1],[W.x1,W.y0,W.z0],[W.x0,W.y1,W.z0],[W.x1,W.y1,W.z0],[W.x1,W.y0,W.z1],[W.x0,W.y1,W.z1]]){let[ne,Ee]=Re(de,ce,H);C=Math.min(C,ne),G=Math.min(G,Ee),Z=Math.max(Z,ne),Q=Math.max(Q,Ee)}j.add(z)}),C<1/0&&(J=[Math.round(C-60),Math.round(G-70),Math.round(Z+60),Math.round(Q+40)])}let U=O.caption??"";w.push({n:M,num:O.number??M,kind:P,color:y(P),heading:O.heading,caption:U,command:O.command??"",phases:F,pulses:Y,lit:[...j],duration:O.duration===void 0||O.duration==="auto"?$c(U):O.duration,...J?{focus:J}:{}})}),T(),{steps:w,says:k,marks:$,badges:v,vis:h,diags:n,kindsUsed:g}}function Sc(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 En(t,e){let s=Vt(t,e);return s?` (did you mean "${s}"?)`:""}function Qf(t,e){if(!e)return t;let[s,r,i,o]=e,n=t[2]/t[3],a=i-s,m=o-r;a/m<n?a=m*n:m=a/n,a=Math.min(a,t[2]),m=Math.min(m,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)),f=Math.max(t[1],Math.min(t[1]+t[3]-m,c-m/2));return[l,f,a,m]}var vc=`
143
152
  *{box-sizing:border-box}
144
153
  html,body{margin:0}
145
154
  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}
@@ -163,7 +172,7 @@ h2{font-size:20px;margin:44px 0 4px;letter-spacing:-.005em;text-wrap:balance}
163
172
  .legend i{display:inline-block;width:26px;height:0;border-top:3px solid}
164
173
  .legend i.box{height:10px;border-width:1.5px;border-style:solid;border-radius:2px}
165
174
  footer{margin-top:40px;font-size:12.5px;color:var(--muted)}
166
- `,ei=t=>Rd+ao(t)+Id+lo(),Rd=`
175
+ `,nr=t=>Hu+ra(t)+Wu+ia(),Hu=`
167
176
  /* blocks: hue per role, lightness per face and theme */
168
177
  .blk .top{fill:hsl(var(--h) var(--s) var(--l-top))}
169
178
  .blk .lft{fill:hsl(var(--h) var(--s) var(--l-left))}
@@ -204,14 +213,14 @@ footer{margin-top:40px;font-size:12.5px;color:var(--muted)}
204
213
  .floor.t-control{fill:var(--muted)}
205
214
  .slabname{font-size:15px;font-weight:800;fill:var(--muted);letter-spacing:.12em;opacity:.8}
206
215
  .slabname.sm{font-size:10.5px;letter-spacing:.1em;opacity:1}
207
- `,Id=`.tunnel polygon{fill:hsl(205 85% 55% / .17);stroke:hsl(205 75% 45% / .8);stroke-width:1.3;stroke-linejoin:round}
216
+ `,Wu=`.tunnel polygon{fill:hsl(205 85% 55% / .17);stroke:hsl(205 75% 45% / .8);stroke-width:1.3;stroke-linejoin:round}
208
217
  .tunnel .top{fill:hsl(205 85% 65% / .22)}
209
218
  .tunnel .rib{fill:none;stroke:hsl(205 75% 45% / .5);stroke-width:1}
210
219
  .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}
211
220
 
212
221
  /* flows */
213
222
  .flow{fill:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:round}
214
- `,ar=t=>il+ei(t),ol=`
223
+ `,Vr=t=>vc+nr(t),Yi=`
215
224
  /* step marks */
216
225
  .xm circle{fill:var(--surface);stroke:var(--blocked);stroke-width:2.5}
217
226
  .xm path{stroke:var(--blocked);stroke-width:3;stroke-linecap:round}
@@ -234,7 +243,7 @@ svg.all .badge{opacity:1}
234
243
  svg.focus.all [data-hl]:not(.hl),svg.focus.all.dim-all [data-dim]:not(.hl){opacity:.9}
235
244
  svg [data-step]:not(.on),svg.all [data-step]{opacity:0!important;pointer-events:none}
236
245
  .pre{opacity:0!important;pointer-events:none}
237
- `,al=`
246
+ `,Mc=`
238
247
  /* player */
239
248
  .player{display:flex;align-items:flex-start;gap:10px 14px;padding:12px 16px;border-top:1px solid var(--line);flex-wrap:wrap}
240
249
  .ctrls{display:flex;gap:6px;flex:none}
@@ -269,57 +278,57 @@ details.steps li code{font-size:11.5px}
269
278
  .still .ctrls,.still .tools{display:none}
270
279
  .tools{display:flex;gap:6px;flex:none;order:3;margin-left:auto}
271
280
  .pbtn.small{font-size:12px;padding:4px 11px;font-weight:600;color:var(--muted)}
272
- .pbtn.small[aria-pressed="true"]{color:var(--ink);border-color:var(--muted);background:var(--surface)}`,ll=`
281
+ .pbtn.small[aria-pressed="true"]{color:var(--ink);border-color:var(--muted);background:var(--surface)}`,Hi=`
273
282
  .grid{display:none;fill:none;stroke:var(--ink);stroke-width:.6;opacity:.16;pointer-events:none}
274
283
  svg.show-grid .grid{display:inline}
275
284
  svg.pre-assemble > g:not(.g-anim){opacity:0}
276
- `,No=ol+al+ll;var cl=t=>({data:t,locate:()=>({line:0,col:0}),span:()=>{},diags:[]});function Ro(t,e,n,r=cl(t),i,o={},s=[]){let a=tr(er(e),t.roles,t.kinds),d=[],c=new Map;return t.scenes.forEach((l,p)=>{let f=`/scenes/${p}`;if(c.has(l.id)){let g=r.locate(f+"/id");s.push({severity:"error",message:`duplicate scene id "${l.id}"`,line:g.line,col:g.col,path:f+"/id"})}c.set(l.id,p);let m={...t.grid,...l.grid,...o.snap?{snap:o.snap}:{}},u=nr(l,f,r,a,n,t.roles,m.snap);s.push(...u.diags);let h=go(l,f,u,r,new Set(Object.keys(a.kinds)),m.snap);s.push(...h.diags);let y=Po(l,f,u,h.routes,r,a);s.push(...y.diags),s.push(...zd(l,f,n,r));let v=To({scene:l,layout:u,routes:h.routes,steps:y,theme:a,id:l.id,gridStep:m.step??m.snap??1});for(let g of v.warnings){let b=r.locate(g.path);s.push({severity:"warning",message:g.message,line:b.line,col:b.col,path:g.path})}d.push({id:l.id,raw:l,layout:u,routes:h.routes,steps:y,rendered:v,grid:m,assemble:l.assemble??t.assemble??!1})}),s.sort((l,p)=>l.line-p.line||l.col-p.col),{ok:!s.some(l=>l.severity==="error"),diags:s,doc:t,theme:a,catalog:n,scenes:d,parsed:r,source:i}}function zd(t,e,n,r){let i=[],o=(a,d)=>{let c=r.locate(a);i.push({severity:"warning",message:d,line:c.line,col:c.col,path:a})},s=(a,d)=>{a.nodes?.forEach((c,l)=>{let p=`${d}/nodes/${l}`;(c.deco??hs(n,c.asset).deco??[]).forEach((f,m)=>{typeof f=="object"&&f.icon&&!Zr(f.icon)&&o(c.deco?`${p}/deco/${m}/icon`:p,`node "${c.id}": no icon "${f.icon}" is registered here, so it is drawn as a placeholder`)}),c.face!==void 0&&!Nn(c.face)&&o(`${p}/face`,`node "${c.id}": no screen face "${c.face}" is registered here, so it is drawn as a placeholder`)}),a.regions?.forEach((c,l)=>s(c,`${d}/regions/${l}`))};return s(t,e),i}function pp(t,e){let n=t/(Et*Qe),r=2*e/Qe;return[(n+r)/2,(r-n)/2]}function fp(t,e){let n=t.layout.byId.get(e);if(!n)return;let r=n.parent?[n.parent.box.x0,n.parent.box.y0]:[0,0];return[n.box.x0-r[0],n.box.y0-r[1]]}function dp(t){let e=[];for(let n of[t.x0,t.x1])for(let r of[t.y0,t.y1])for(let i of[t.z0,t.z1])e.push(ke(n,r,i));return Cd(e)}function mp(t){return[[t.x0,t.y0],[t.x1,t.y0],[t.x1,t.y1],[t.x0,t.y1]].map(([e,n])=>ke(e,n,t.z0))}function Cd(t){let e=[...new Map(t.map(o=>[`${o[0].toFixed(3)},${o[1].toFixed(3)}`,o])).values()].sort((o,s)=>o[0]-s[0]||o[1]-s[1]);if(e.length<3)return e;let n=(o,s,a)=>(s[0]-o[0])*(a[1]-o[1])-(s[1]-o[1])*(a[0]-o[0]),r=[],i=[];for(let o of e){for(;r.length>=2&&n(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&&n(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 up=(t,e)=>e?.padding??vt(t,e?.kind)?.pad??0;function hp(t,e,n,r,i){let o=l=>Math.round(l/n)*n,s=o(t[0]+e[0]),a=o(t[1]+e[1]),d={left:!1,right:!1,top:!1,bottom:!1};if(i){let l=Math.ceil(i.pad/n-1e-9)*n,p=Math.floor((i.w-i.pad-r[0])/n+1e-9)*n,f=Math.floor((i.d-i.pad-r[1])/n+1e-9)*n;s<l&&(s=l,d.left=!0),p>=l&&s>p&&(s=p,d.right=!0),a<l&&(a=l,d.top=!0),f>=l&&a>f&&(a=f,d.bottom=!0)}let c=l=>Math.round(l*1e3)/1e3;return{at:[c(s),c(a)],delta:[c(s-t[0]),c(a-t[1])],clamped:d}}function Io(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 fl=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}),dl={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}},yp=(t,e)=>ms(t,dl[e]);function zo(t){let e=[],n=new Map,r=(d,c)=>{if(typeof c!="string"||!c){e.push(`${d} has no id`);return}let l=n.get(c);l?e.push(`duplicate id "${c}": a ${l} and a ${d} (cards and panels share one set of ids)`):n.set(c,d)};for(let d of t.cards)r("card",d.id),(!Array.isArray(d.cell)||d.cell.length!==2||!d.cell.every(c=>Number.isInteger(c)&&c>=0))&&e.push(`card "${d.id}": cell must be [column, row], whole numbers from 0`);for(let d of t.panels??[]){r("panel",d.id);let c=d.cells;(!Array.isArray(c)||c.length!==4||!c.every(l=>Number.isInteger(l)&&l>=0)||c[2]<c[0]||c[3]<c[1])&&e.push(`panel "${d.id}": cells must be [c0, r0, c1, r1] with c0 \u2264 c1 and r0 \u2264 r1`)}let i=new Map;for(let d of t.cards){let c=String(d.cell);i.has(c)?e.push(`cards "${i.get(c)}" and "${d.id}" are both at cell [${c}]`):i.set(c,d.id)}let o=(t.panels??[]).filter(d=>Array.isArray(d.cells)&&d.cells.length===4);for(let d=0;d<o.length;d++)for(let c=d+1;c<o.length;c++){let l=o[d].cells,p=o[c].cells;l[0]<=p[2]&&p[0]<=l[2]&&l[1]<=p[3]&&p[1]<=l[3]&&!pl(l,p)&&!pl(p,l)&&e.push(`panels "${o[d].id}" and "${o[c].id}" overlap without one holding the other`)}let s=new Set([...t.cards.map(d=>d.id),...o.map(d=>d.id)]),a=new Set(o.map(d=>d.id));return(t.links??[]).forEach((d,c)=>{let l=`link ${d.id?`"${d.id}"`:c}`;for(let p of["a","b"])s.has(d[p])||e.push(`${l}: ${p} "${d[p]}" is no card or panel`);for(let p of["aOn","bOn"])d[p]!==void 0&&!a.has(d[p])&&e.push(`${l}: ${p} "${d[p]}" is no panel`);d.id!==void 0&&r("link",d.id)}),e}var pl=(t,e)=>t[0]>=e[0]&&t[2]<=e[2]&&t[1]>=e[1]&&t[3]<=e[3];function ti(t,e){let{W:n,H:r,GX:i,GY:o,PAD:s,TITLE:a,CH:d}=e,c=t.panels??[],l=N=>(N[2]-N[0]+1)*(N[3]-N[1]+1),p=(N,j)=>{let V=c[N].cells,H=c[j].cells;return pl(H,V)?l(V)>l(H)||N<j:!1},f=c.map((N,j)=>{let V=-1;return c.forEach((H,ae)=>{ae!==j&&p(ae,j)&&(V<0||p(V,ae))&&(V=ae)}),V}),m=N=>f[N]<0?0:1+m(f[N]),u=(N,j)=>{let V=-1;c.forEach((ae,ue)=>{let J=ae.cells;N>=J[0]&&N<=J[2]&&j>=J[1]&&j<=J[3]&&(V<0||p(V,ue))&&(V=ue)});let H=[];for(let ae=V;ae>=0;ae=f[ae])H.unshift(ae);return H},h=Math.max(1,...t.cards.map(N=>N.cell[0]+1),...c.map(N=>N.cells[2]+1)),y=Math.max(1,...t.cards.map(N=>N.cell[1]+1),...c.map(N=>N.cells[3]+1)),v=[];for(let N=0;N<h;N++){v.push([]);for(let j=0;j<y;j++)v[N].push(u(N,j))}let g=(N,j,V)=>{let H=N.filter(ue=>!j.includes(ue)),ae=j.filter(ue=>!N.includes(ue));return!H.length&&!ae.length?0:H.length*(s+(V?a:0))+ae.length*s+d},b=new Array(h+1).fill(0),$=new Array(y+1).fill(0);for(let N=0;N<y;N++)for(let j=1;j<h;j++){let V=g(v[j-1][N],v[j][N],!1);V&&(b[j]=Math.max(b[j],V-i))}for(let N=0;N<h;N++)for(let j=1;j<y;j++){let V=g(v[N][j-1],v[N][j],!0);V&&($[j]=Math.max($[j],V-o))}let E=N=>{let j=N*(n+i);for(let V=1;V<=N;V++)j+=b[V];return j},S=N=>{let j=N*(r+o);for(let V=1;V<=N;V++)j+=$[V];return j},k=(N,j,V,H)=>V===j?N(j):N(j)+(H-j)*(N(V)-N(j))/(V-j),T=c.map(()=>new Set),z=(N,j)=>{for(let V=N;V>=0;V=f[V])T[V].add(j)};c.forEach((N,j)=>{z(j,N.cells[1]),z(j,N.cells[3])});for(let N of t.cards){let j=v[N.cell[0]][N.cell[1]];j.length&&z(j[j.length-1],N.cell[1])}let A=c.map(()=>new Map),R=(N,j)=>N.slice(N.indexOf(j)+1);for(let N of c.map((j,V)=>V).sort((j,V)=>m(j)-m(V)||j-V)){let j=c[N].cells,V=[...T[N]].sort((ae,ue)=>ae-ue),H=f[N]>=0?A[f[N]].get(V[0]):S(V[0]);A[N].set(V[0],H);for(let ae=1;ae<V.length;ae++){let ue=0;for(let J=j[0];J<=j[2];J++)ue=Math.max(ue,g(R(v[J][V[ae-1]],N),R(v[J][V[ae]],N),!0));H+=r+Math.max(o,ue),A[N].set(V[ae],H)}}let x=c.map(()=>new Set),P=(N,j)=>{for(let V=N;V>=0;V=f[V])x[V].add(j)};c.forEach((N,j)=>{P(j,N.cells[0]),P(j,N.cells[2])});for(let N of t.cards){let j=v[N.cell[0]][N.cell[1]];j.length&&P(j[j.length-1],N.cell[0])}let w=c.map(()=>new Map);for(let N of c.map((j,V)=>V).sort((j,V)=>m(j)-m(V)||j-V)){let j=c[N].cells,V=[...x[N]].sort((ae,ue)=>ae-ue);if(f[N]<0&&!f.includes(N)&&V.length===j[2]-j[0]+1){for(let ae of V)w[N].set(ae,k(E,j[0],j[2],ae));continue}let H=f[N]>=0?w[f[N]].get(V[0]):E(V[0]);w[N].set(V[0],H);for(let ae=1;ae<V.length;ae++){let ue=0;for(let J=j[1];J<=j[3];J++)ue=Math.max(ue,g(R(v[V[ae-1]][J],N),R(v[V[ae]][J],N),!1));H+=n+Math.max(i,ue),w[N].set(V[ae],H)}}let I=(N,j)=>{let V=v[N][j],H=V.length?V[V.length-1]:-1;return H>=0?[w[H].get(N),A[H].get(j)]:[E(N),S(j)]},L=c.map((N,j)=>j).sort((N,j)=>m(j)-m(N)||N-j),D=new Array(c.length);for(let N of L){let j=c[N].cells,V=[],H=[];for(let J of t.cards){let te=v[J.cell[0]][J.cell[1]];te[te.length-1]===N&&(V.push(w[N].get(J.cell[0])),H.push(A[N].get(J.cell[1])))}let ae=J=>J.cell[0]>=j[0]&&J.cell[0]<=j[2]&&J.cell[1]>=j[1]&&J.cell[1]<=j[3];for(let J of[j[1],j[3]])t.cards.some(te=>te.cell[1]===J&&ae(te))||H.push(A[N].get(J));for(let J of[j[0],j[2]])t.cards.some(te=>te.cell[0]===J&&ae(te))||V.push(w[N].get(J));let ue={l:V.length?Math.min(...V):1/0,t:H.length?Math.min(...H):1/0,r:V.length?Math.max(...V)+n:-1/0,b:H.length?Math.max(...H)+r:-1/0};c.forEach((J,te)=>{if(f[te]!==N)return;let Se=D[te];ue.l=Math.min(ue.l,Se.l),ue.t=Math.min(ue.t,Se.t),ue.r=Math.max(ue.r,Se.r),ue.b=Math.max(ue.b,Se.b)}),D[N]={l:ue.l-s,t:ue.t-s,r:ue.r+s,b:ue.b+s+a}}let G=t.cards.map(N=>I(N.cell[0],N.cell[1])),se=t.cards.map(N=>{let j=v[N.cell[0]][N.cell[1]];return j.length?j[j.length-1]:-1}),_=(N,j)=>{for(let V=N;V>=0;V=f[V])if(V===j)return!0;return!1},K=(N,j)=>{t.cards.forEach((V,H)=>{se[H]>=0&&_(se[H],N)&&(G[H]=[G[H][0]+j,G[H][1]])}),c.forEach((V,H)=>{_(H,N)&&(D[H]={...D[H],l:D[H].l+j,r:D[H].r+j})})},Z=N=>{let j=[],V=[],H=[],ae=[];t.cards.forEach((O,U)=>{se[U]===N&&(j.push(G[U][0]),H.push(G[U][0]+n),V.push(G[U][1]),ae.push(G[U][1]+r))}),c.forEach((O,U)=>{f[U]===N&&(j.push(D[U].l),H.push(D[U].r),V.push(D[U].t),ae.push(D[U].b))});let ue=D[N],J=Math.min(...j,ue.l+s),te=Math.max(...H,ue.r-s),Se=Math.min(...V,ue.t+s),Ve=Math.max(...ae,ue.b-s-a);D[N]={l:J-s,t:Se-s,r:te+s,b:Ve+s+a}};for(let N of L)if(f[N]<0&&!f.includes(N))Z(N);else{let V=[];t.cards.forEach((te,Se)=>{se[Se]===N&&V.push({l:G[Se][0],r:G[Se][0]+n,t:G[Se][1],b:G[Se][1]+r,card:Se})}),c.forEach((te,Se)=>{f[Se]===N&&V.push({...D[Se],panel:Se})}),V.sort((te,Se)=>te.l-Se.l||te.t-Se.t);let H=Math.min(...V.map(te=>te.l)),ae=[];for(let te of V){let Se=H;for(let O of ae)O.t<te.b&&te.t<O.b&&O.r<=te.l+1e-6&&(Se=Math.max(Se,O.r+(O.card!==void 0&&te.card!==void 0?i:d)));let Ve=Se-te.l;Ve<-1e-6&&(te.card!==void 0?G[te.card]=[G[te.card][0]+Ve,G[te.card][1]]:K(te.panel,Ve),te.l+=Ve,te.r+=Ve),ae.push(te)}let ue=V.map(te=>te.l),J=V.map(te=>te.r);D[N]={...D[N],l:Math.min(...ue)-s,r:Math.max(...J)+s}}return{prect:D,parentIx:f,depthOf:m,pos:I,cardAt:N=>G[N]}}function lr(t,e,n={}){if(n.wrap){let{wrap:M,...F}=n;return lr(Ld(t,e,M.aspect,F),e,F)}let r=zo(t);if(r.length)throw new Error(`the board has ${r.length} error${r.length>1?"s":""}:
285
+ `,za=Yi+Mc+Hi;var Pc=t=>({data:t,locate:()=>({line:0,col:0}),span:()=>{},diags:[]});function Ca(t,e,s,r=Pc(t),i,o={},n=[]){let a=Mr(vr(e),t.roles,t.kinds),m=[],p=new Map;return t.scenes.forEach((c,l)=>{let f=`/scenes/${l}`;if(p.has(c.id)){let h=r.locate(f+"/id");n.push({severity:"error",message:`duplicate scene id "${c.id}"`,line:h.line,col:h.col,path:f+"/id"})}p.set(c.id,l);let d={...t.grid,...c.grid,...o.snap?{snap:o.snap}:{}},u=Or(c,f,r,a,s,t.roles,d.snap);n.push(...u.diags);let y=ma(c,f,u,r,new Set(Object.keys(a.kinds)),d.snap);n.push(...y.diags);let g=Ia(c,f,u,y.routes,r,a);n.push(...g.diags),n.push(...Ju(c,f,s,r));let x=zr({scene:c,layout:u,routes:y.routes,steps:g,theme:a,id:c.id,gridStep:d.step??d.snap??1});for(let h of x.warnings){let b=r.locate(h.path);n.push({severity:"warning",message:h.message,line:b.line,col:b.col,path:h.path})}m.push({id:c.id,raw:c,layout:u,routes:y.routes,steps:g,rendered:x,grid:d,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:m,parsed:r,source:i}}function Ju(t,e,s,r){let i=[],o=(a,m)=>{let p=r.locate(a);i.push({severity:"warning",message:m,line:p.line,col:p.col,path:a})},n=(a,m)=>{a.nodes?.forEach((p,c)=>{let l=`${m}/nodes/${c}`;(p.deco??Mn(s,p.asset).deco??[]).forEach((f,d)=>{typeof f=="object"&&f.icon&&!Ei(f.icon)&&o(p.deco?`${l}/deco/${d}/icon`:l,`node "${p.id}": no icon "${f.icon}" is registered here, so it is drawn as a placeholder`)}),p.face!==void 0&&!Qs(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,`${m}/regions/${c}`))};return n(t,e),i}function ed(t,e){let s=t/(Ct*lt),r=2*e/lt;return[(s+r)/2,(r-s)/2]}function td(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 nd(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 Xu(e)}function sd(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 Xu(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 rd=(t,e)=>e?.padding??Pt(t,e?.kind)?.pad??0;function id(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]),m={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,f=Math.floor((i.d-i.pad-r[1])/s+1e-9)*s;n<c&&(n=c,m.left=!0),l>=c&&n>l&&(n=l,m.right=!0),a<c&&(a=c,m.top=!0),f>=c&&a>f&&(a=f,m.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:m}}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 Ac=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}),Tc={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}},od=(t,e)=>Sn(t,Tc[e]);function La(t){let e=[],s=new Map,r=(m,p)=>{if(typeof p!="string"||!p){e.push(`${m} has no id`);return}let c=s.get(p);c?e.push(`duplicate id "${p}": a ${c} and a ${m} (cards and panels share one set of ids)`):s.set(p,m)};for(let m of t.cards)r("card",m.id),(!Array.isArray(m.cell)||m.cell.length!==2||!m.cell.every(p=>Number.isInteger(p)&&p>=0))&&e.push(`card "${m.id}": cell must be [column, row], whole numbers from 0`);for(let m of t.panels??[]){r("panel",m.id);let p=m.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 "${m.id}": cells must be [c0, r0, c1, r1] with c0 \u2264 c1 and r0 \u2264 r1`)}let i=new Map;for(let m of t.cards){let p=String(m.cell);i.has(p)?e.push(`cards "${i.get(p)}" and "${m.id}" are both at cell [${p}]`):i.set(p,m.id)}let o=(t.panels??[]).filter(m=>Array.isArray(m.cells)&&m.cells.length===4);for(let m=0;m<o.length;m++)for(let p=m+1;p<o.length;p++){let c=o[m].cells,l=o[p].cells;c[0]<=l[2]&&l[0]<=c[2]&&c[1]<=l[3]&&l[1]<=c[3]&&!Oc(c,l)&&!Oc(l,c)&&e.push(`panels "${o[m].id}" and "${o[p].id}" overlap without one holding the other`)}let n=new Set([...t.cards.map(m=>m.id),...o.map(m=>m.id)]),a=new Set(o.map(m=>m.id));return(t.links??[]).forEach((m,p)=>{let c=`link ${m.id?`"${m.id}"`:p}`;for(let l of["a","b"])n.has(m[l])||e.push(`${c}: ${l} "${m[l]}" is no card or panel`);for(let l of["aOn","bOn"])m[l]!==void 0&&!a.has(m[l])&&e.push(`${c}: ${l} "${m[l]}" is no panel`);m.id!==void 0&&r("link",m.id)}),e}var Oc=(t,e)=>t[0]>=e[0]&&t[2]<=e[2]&&t[1]>=e[1]&&t[3]<=e[3];function Wi(t,e){let{W:s,H:r,GX:i,GY:o,PAD:n,TITLE:a,CH:m}=e,p=t.panels??[],c=z=>(z[2]-z[0]+1)*(z[3]-z[1]+1),l=(z,D)=>{let V=p[z].cells,W=p[D].cells;return Oc(W,V)?c(V)>c(W)||z<D:!1},f=p.map((z,D)=>{let V=-1;return p.forEach((W,de)=>{de!==D&&l(de,D)&&(V<0||l(V,de))&&(V=de)}),V}),d=z=>f[z]<0?0:1+d(f[z]),u=(z,D)=>{let V=-1;p.forEach((de,ce)=>{let H=de.cells;z>=H[0]&&z<=H[2]&&D>=H[1]&&D<=H[3]&&(V<0||l(V,ce))&&(V=ce)});let W=[];for(let de=V;de>=0;de=f[de])W.unshift(de);return W},y=Math.max(1,...t.cards.map(z=>z.cell[0]+1),...p.map(z=>z.cells[2]+1)),g=Math.max(1,...t.cards.map(z=>z.cell[1]+1),...p.map(z=>z.cells[3]+1)),x=[];for(let z=0;z<y;z++){x.push([]);for(let D=0;D<g;D++)x[z].push(u(z,D))}let h=(z,D,V)=>{let W=z.filter(ce=>!D.includes(ce)),de=D.filter(ce=>!z.includes(ce));return!W.length&&!de.length?0:W.length*(n+(V?a:0))+de.length*n+m},b=new Array(y+1).fill(0),w=new Array(g+1).fill(0);for(let z=0;z<g;z++)for(let D=1;D<y;D++){let V=h(x[D-1][z],x[D][z],!1);V&&(b[D]=Math.max(b[D],V-i))}for(let z=0;z<y;z++)for(let D=1;D<g;D++){let V=h(x[z][D-1],x[z][D],!0);V&&(w[D]=Math.max(w[D],V-o))}let k=z=>{let D=z*(s+i);for(let V=1;V<=z;V++)D+=b[V];return D},$=z=>{let D=z*(r+o);for(let V=1;V<=z;V++)D+=w[V];return D},v=(z,D,V,W)=>V===D?z(D):z(D)+(W-D)*(z(V)-z(D))/(V-D),T=p.map(()=>new Set),R=(z,D)=>{for(let V=z;V>=0;V=f[V])T[V].add(D)};p.forEach((z,D)=>{R(D,z.cells[1]),R(D,z.cells[3])});for(let z of t.cards){let D=x[z.cell[0]][z.cell[1]];D.length&&R(D[D.length-1],z.cell[1])}let O=p.map(()=>new Map),I=(z,D)=>z.slice(z.indexOf(D)+1);for(let z of p.map((D,V)=>V).sort((D,V)=>d(D)-d(V)||D-V)){let D=p[z].cells,V=[...T[z]].sort((de,ce)=>de-ce),W=f[z]>=0?O[f[z]].get(V[0]):$(V[0]);O[z].set(V[0],W);for(let de=1;de<V.length;de++){let ce=0;for(let H=D[0];H<=D[2];H++)ce=Math.max(ce,h(I(x[H][V[de-1]],z),I(x[H][V[de]],z),!0));W+=r+Math.max(o,ce),O[z].set(V[de],W)}}let M=p.map(()=>new Set),A=(z,D)=>{for(let V=z;V>=0;V=f[V])M[V].add(D)};p.forEach((z,D)=>{A(D,z.cells[0]),A(D,z.cells[2])});for(let z of t.cards){let D=x[z.cell[0]][z.cell[1]];D.length&&A(D[D.length-1],z.cell[0])}let P=p.map(()=>new Map);for(let z of p.map((D,V)=>V).sort((D,V)=>d(D)-d(V)||D-V)){let D=p[z].cells,V=[...M[z]].sort((de,ce)=>de-ce);if(f[z]<0&&!f.includes(z)&&V.length===D[2]-D[0]+1){for(let de of V)P[z].set(de,v(k,D[0],D[2],de));continue}let W=f[z]>=0?P[f[z]].get(V[0]):k(V[0]);P[z].set(V[0],W);for(let de=1;de<V.length;de++){let ce=0;for(let H=D[1];H<=D[3];H++)ce=Math.max(ce,h(I(x[V[de-1]][H],z),I(x[V[de]][H],z),!1));W+=s+Math.max(i,ce),P[z].set(V[de],W)}}let j=(z,D)=>{let V=x[z][D],W=V.length?V[V.length-1]:-1;return W>=0?[P[W].get(z),O[W].get(D)]:[k(z),$(D)]},F=p.map((z,D)=>D).sort((z,D)=>d(D)-d(z)||z-D),Y=new Array(p.length);for(let z of F){let D=p[z].cells,V=[],W=[];for(let H of t.cards){let ne=x[H.cell[0]][H.cell[1]];ne[ne.length-1]===z&&(V.push(P[z].get(H.cell[0])),W.push(O[z].get(H.cell[1])))}let de=H=>H.cell[0]>=D[0]&&H.cell[0]<=D[2]&&H.cell[1]>=D[1]&&H.cell[1]<=D[3];for(let H of[D[1],D[3]])t.cards.some(ne=>ne.cell[1]===H&&de(ne))||W.push(O[z].get(H));for(let H of[D[0],D[2]])t.cards.some(ne=>ne.cell[0]===H&&de(ne))||V.push(P[z].get(H));let ce={l:V.length?Math.min(...V):1/0,t:W.length?Math.min(...W):1/0,r:V.length?Math.max(...V)+s:-1/0,b:W.length?Math.max(...W)+r:-1/0};p.forEach((H,ne)=>{if(f[ne]!==z)return;let Ee=Y[ne];ce.l=Math.min(ce.l,Ee.l),ce.t=Math.min(ce.t,Ee.t),ce.r=Math.max(ce.r,Ee.r),ce.b=Math.max(ce.b,Ee.b)}),Y[z]={l:ce.l-n,t:ce.t-n,r:ce.r+n,b:ce.b+n+a}}let J=t.cards.map(z=>j(z.cell[0],z.cell[1])),U=t.cards.map(z=>{let D=x[z.cell[0]][z.cell[1]];return D.length?D[D.length-1]:-1}),C=(z,D)=>{for(let V=z;V>=0;V=f[V])if(V===D)return!0;return!1},G=(z,D)=>{t.cards.forEach((V,W)=>{U[W]>=0&&C(U[W],z)&&(J[W]=[J[W][0]+D,J[W][1]])}),p.forEach((V,W)=>{C(W,z)&&(Y[W]={...Y[W],l:Y[W].l+D,r:Y[W].r+D})})},Z=z=>{let D=[],V=[],W=[],de=[];t.cards.forEach((N,ee)=>{U[ee]===z&&(D.push(J[ee][0]),W.push(J[ee][0]+s),V.push(J[ee][1]),de.push(J[ee][1]+r))}),p.forEach((N,ee)=>{f[ee]===z&&(D.push(Y[ee].l),W.push(Y[ee].r),V.push(Y[ee].t),de.push(Y[ee].b))});let ce=Y[z],H=Math.min(...D,ce.l+n),ne=Math.max(...W,ce.r-n),Ee=Math.min(...V,ce.t+n),qe=Math.max(...de,ce.b-n-a);Y[z]={l:H-n,t:Ee-n,r:ne+n,b:qe+n+a}};for(let z of F)if(f[z]<0&&!f.includes(z))Z(z);else{let V=[];t.cards.forEach((ne,Ee)=>{U[Ee]===z&&V.push({l:J[Ee][0],r:J[Ee][0]+s,t:J[Ee][1],b:J[Ee][1]+r,card:Ee})}),p.forEach((ne,Ee)=>{f[Ee]===z&&V.push({...Y[Ee],panel:Ee})}),V.sort((ne,Ee)=>ne.l-Ee.l||ne.t-Ee.t);let W=Math.min(...V.map(ne=>ne.l)),de=[];for(let ne of V){let Ee=W;for(let N of de)N.t<ne.b&&ne.t<N.b&&N.r<=ne.l+1e-6&&(Ee=Math.max(Ee,N.r+(N.card!==void 0&&ne.card!==void 0?i:m)));let qe=Ee-ne.l;qe<-1e-6&&(ne.card!==void 0?J[ne.card]=[J[ne.card][0]+qe,J[ne.card][1]]:G(ne.panel,qe),ne.l+=qe,ne.r+=qe),de.push(ne)}let ce=V.map(ne=>ne.l),H=V.map(ne=>ne.r);Y[z]={...Y[z],l:Math.min(...ce)-n,r:Math.max(...H)+n}}return{prect:Y,parentIx:f,depthOf:d,pos:j,cardAt:z=>J[z]}}function Kr(t,e,s={}){if(s.wrap){let{wrap:E,...q}=s;return Kr(Qu(t,e,E.aspect,q),e,q)}let r=La(t);if(r.length)throw new Error(`the board has ${r.length} error${r.length>1?"s":""}:
277
286
  ${r.join(`
278
- `)}`);let i={...fl,...n},{W:o,H:s}=i,a=M=>Math.round(M*10)/10,d=[],c=t.panels??[],{prect:l,parentIx:p,depthOf:f,cardAt:m}=ti(t,i),u=c.map((M,F)=>{let B=l[F],oe=e(M.label??"","title")+(M.sub?e(M.sub,"titleSub"):0);return{...M,rect:B,titleAt:[a(B.l+16),a(B.b-15)],depth:f(F),parent:p[F]>=0?c[p[F]].id:void 0,title:{l:B.l+10,r:B.l+22+oe,t:B.b-30,b:B.b-6}}}),h=t.cards.map(M=>{let[F,B]=m(t.cards.indexOf(M));return{...M,rect:{l:F,t:B,r:F+o,b:B+s}}}),y=new Map;u.forEach(M=>y.set(M.id,M.rect)),h.forEach(M=>y.set(M.id,M.rect));let v=h.map(M=>M.rect),g=u.map(M=>M.rect),b=u.filter(M=>M.label).map(M=>M.title),$=(M,F)=>M.l>=F.l&&M.r<=F.r&&M.t>=F.t&&M.b<=F.b,E=(M,F,B,oe)=>Math.min(M[0],F[0])<B.r+oe&&Math.max(M[0],F[0])>B.l-oe&&Math.min(M[1],F[1])<B.b+oe&&Math.max(M[1],F[1])>B.t-oe,S=(M,F)=>g.reduce((B,oe)=>{if(M[0]===F[0]){let re=Math.min(M[1],F[1]),Ae=Math.max(M[1],F[1]);M[0]>oe.l&&M[0]<oe.r&&(B+=[oe.t,oe.b].filter(ye=>ye>re+1&&ye<Ae-1).length)}else{let re=Math.min(M[0],F[0]),Ae=Math.max(M[0],F[0]);M[1]>oe.t&&M[1]<oe.b&&(B+=[oe.l,oe.r].filter(ye=>ye>re+1&&ye<Ae-1).length)}return B},0),k=(M,F)=>g.some(B=>M[1]===F[1]?[B.t,B.b].some(oe=>Math.abs(M[1]-oe)<16&&Math.max(M[0],F[0])>B.l&&Math.min(M[0],F[0])<B.r):[B.l,B.r].some(oe=>Math.abs(M[0]-oe)<16&&Math.max(M[1],F[1])>B.t&&Math.min(M[1],F[1])<B.b)),T=(M,F,B,oe)=>g.filter(re=>re!==B&&re!==oe&&!$(B,re)&&!$(oe,re)&&E(M,F,{l:re.l+3,r:re.r-3,t:re.t+3,b:re.b-3},0)).length,z=[],A=new Map,R=new Map,x=(M,F)=>{z.push([M,F]);let[B,oe]=M[1]===F[1]?[A,M[1]]:M[0]===F[0]?[R,M[0]]:[void 0,0];if(!B)return;let re=Math.floor(oe/6);(B.get(re)??B.set(re,[]).get(re)).push([M,F])},P=(M,F)=>{let B=M[1]===F[1];if(!B&&M[0]!==F[0])return 0;let oe=B?1:0,re=B?0:1,Ae=B?A:R,ye=Math.floor(M[oe]/6),rt=Math.min(M[re],F[re]),Te=Math.max(M[re],F[re]),we=0;for(let Ie=ye-1;Ie<=ye+1;Ie++)for(let[De,ut]of Ae.get(Ie)??[])Math.abs(M[oe]-De[oe])<6&&Math.min(Te,Math.max(De[re],ut[re]))-Math.max(rt,Math.min(De[re],ut[re]))>0&&we++;return we},w=[...y.values()],I=Math.min(...w.map(M=>M.l)),L=Math.max(...w.map(M=>M.r)),D=Math.min(...w.map(M=>M.t)),G=Math.max(...w.map(M=>M.b)),se=(M,F)=>{let B=(M+F)/2;return[B,B-12,B+12,B-24,B+24]},_=(()=>{let M=[];return v.forEach(F=>v.forEach(B=>{B.t>F.b&&B.l<F.r+400&&B.r>F.l-400&&M.push(...se(F.b,B.t))})),M.push(D-22,D-34,G+22,G+34),[...new Set(M.map(Math.round))]})(),K=(()=>{let M=[];return v.forEach(F=>v.forEach(B=>{B.l>F.r&&M.push(...se(F.r,B.l))})),M.push(I-22,I-34,L+22,L+34),[...new Set(M.map(Math.round))]})(),Z=new Map,Q=new Map,N=M=>{let F=Z.get(M);return F||Z.set(M,F=v.filter(B=>M<B.b+6&&M>B.t-6)),F},j=M=>{let F=Q.get(M);return F||Q.set(M,F=v.filter(B=>M<B.r+6&&M>B.l-6)),F},V=i.crossPanel/i.overlap,H=i.border/i.overlap,ae=i.nearEdge/i.overlap;function ue(M,F,B,oe,re=!0){let Ae=0;for(let we=1;we<M.length;we++)Ae+=Math.abs(M[we-1][0]-M[we][0])+Math.abs(M[we-1][1]-M[we][1]);let ye=Ae+i.bend*(M.length-2);if(ye>=oe)return ye;let rt=0,Te=0;for(let we=1;we<M.length;we++){let Ie=M[we-1],De=M[we];if(re){if(ce(Ie,De,F,B)||k(Ie,De))return 1/0;continue}for(let ut of Ie[1]===De[1]?N(Ie[1]):j(Ie[0]))ut!==F&&ut!==B&&E(Ie,De,ut,6)&&rt++;for(let ut of b)E(Ie,De,ut,2)&&rt++}for(let we=1;we<M.length;we++){let Ie=M[we-1],De=M[we];if(Te+=P(Ie,De)+V*T(Ie,De,F,B)+H*S(Ie,De),k(Ie,De)&&(Te+=ae),ye+i.overlap*Te>=oe)return ye+i.overlap*Te}return ye+i.overlap*Te+rt*1e5}let J=M=>(M.l+M.r)/2,te=M=>(M.t+M.b)/2,Se=[0,-22,22,-44,44],Ve={bc:1/0},O=(M,F,B,oe)=>Math.abs(M-B)+Math.abs(F-oe),U=(M,F,B,oe,re,Ae,ye,rt)=>{let Te=0;return Te+=O(M,F,B,oe),Te+=O(B,oe,re,Ae),Te+=O(re,Ae,ye,rt),Te+i.bend*2},ne=(M,F,B,oe,re,Ae,ye,rt,Te,we)=>{let Ie=0;return Ie+=O(M,F,B,oe),Ie+=O(B,oe,re,Ae),Ie+=O(re,Ae,ye,rt),Ie+=O(ye,rt,Te,we),Ie+i.bend*3},ce=(M,F,B,oe)=>{for(let re of M[1]===F[1]?N(M[1]):j(M[0]))if(re!==B&&re!==oe&&E(M,F,re,6))return!0;for(let re of b)if(E(M,F,re,2))return!0;return k(M,F)};function Ce(M,F,B,oe){let re=Math.max(M.l,F.l),Ae=Math.min(M.r,F.r);if(Ae-re>24)for(let it of Se){let lt=(re+Ae)/2+it;lt>re+8&&lt<Ae-8&&B(F.t>=M.b?[[lt,M.b],[lt,F.t]]:[[lt,M.t],[lt,F.b]])}let ye=Math.max(M.t,F.t),rt=Math.min(M.b,F.b);if(rt-ye>16)for(let it of[0,-10,10]){let lt=(ye+rt)/2+it;B(F.l>=M.r?[[M.r,lt],[F.l,lt]]:[[M.l,lt],[F.r,lt]])}let Te=K.length,we=_.length,Ie=new Uint8Array(Se.length*we),De=new Uint8Array(Se.length*we),ut=new Uint8Array(Se.length*Te),kn=new Uint8Array(Se.length*Te),Pt=(it,lt,ks,jt)=>oe?(it[lt]||(it[lt]=ce(ks,jt,M,F)?2:1),it[lt]===1):!0;Se.forEach((it,lt)=>Se.forEach((ks,jt)=>{let It=J(M)+it,Lt=J(F)+ks,Bt=te(M)+it/3,bt=te(F)+ks/3;_.forEach((je,Ss)=>{let ct=je>M.b?M.b:je<M.t?M.t:null,Qt=je>F.b?F.b:je<F.t?F.t:null;ct!==null&&Qt!==null&&U(It,ct,It,je,Lt,je,Lt,Qt)<Ve.bc&&Pt(Ie,lt*we+Ss,[It,ct],[It,je])&&Pt(De,jt*we+Ss,[Lt,je],[Lt,Qt])&&B([[It,ct],[It,je],[Lt,je],[Lt,Qt]])}),K.forEach((je,Ss)=>{let ct=je>M.r?M.r:je<M.l?M.l:null,Qt=je>F.r?F.r:je<F.l?F.l:null;ct!==null&&Qt!==null&&U(ct,Bt,je,Bt,je,bt,Qt,bt)<Ve.bc&&Pt(ut,lt*Te+Ss,[ct,Bt],[je,Bt])&&Pt(kn,jt*Te+Ss,[je,bt],[Qt,bt])&&B([[ct,Bt],[je,Bt],[je,bt],[Qt,bt]])}),it===0&&ks===0&&K.forEach((je,Ss)=>_.forEach((ct,Qt)=>{let C=je>M.r?M.r:je<M.l?M.l:null,q=ct>F.b?F.b:ct<F.t?F.t:null;C!==null&&q!==null&&ne(C,Bt,je,Bt,je,ct,Lt,ct,Lt,q)<Ve.bc&&Pt(ut,lt*Te+Ss,[C,Bt],[je,Bt])&&Pt(De,jt*we+Qt,[Lt,ct],[Lt,q])&&B([[C,Bt],[je,Bt],[je,ct],[Lt,ct],[Lt,q]]);let W=ct>M.b?M.b:ct<M.t?M.t:null,ee=je>F.r?F.r:je<F.l?F.l:null;W!==null&&ee!==null&&ne(It,W,It,ct,je,ct,je,bt,ee,bt)<Ve.bc&&Pt(Ie,lt*we+Qt,[It,W],[It,ct])&&Pt(kn,jt*Te+Ss,[je,bt],[ee,bt])&&B([[It,W],[It,ct],[je,ct],[je,bt],[ee,bt]])}));let jn=J(M)<F.l?F.l:J(M)>F.r?F.r:null,Dt=bt<M.t?M.t:bt>M.b?M.b:null;jn!==null&&Dt!==null&&B([[It,Dt],[It,bt],[jn,bt]]);let Sn=te(M)<F.t?F.t:te(M)>F.b?F.b:null,Bn=Lt<M.l?M.l:Lt>M.r?M.r:null;Sn!==null&&Bn!==null&&B([[Bn,Bt],[Lt,Bt],[Lt,Sn]])}))}function le(M,F,B,oe){for(let re of Se){let Ae=J(M)+re,ye=te(M)+re/3,rt=[[[Ae,M.t],[Ae,F.t]],[[M.r,ye],[F.r,ye]],[[Ae,M.b],[Ae,F.b]],[[M.l,ye],[F.l,ye]]];for(let Te of rt)oe(B?[Te[1],Te[0]]:Te)}}let Ke=(M,F,B,oe)=>{let re=null;return Ve.bc=1/0,M(Ae=>{let ye=ue(Ae,F,B,Ve.bc,oe);ye<Ve.bc&&(Ve.bc=ye,re=Ae)},oe),re},ve=[],de=M=>g.some(F=>[F.l,F.r].some(B=>M.l<B+3&&M.r>B-3&&M.b>F.t&&M.t<F.b)||[F.t,F.b].some(B=>M.t<B+3&&M.b>B-3&&M.r>F.l&&M.l<F.r)),Oe=M=>z.filter(([F,B])=>E(F,B,M,1)).length,We=M=>b.some(F=>M.l<F.r&&M.r>F.l&&M.t<F.b&&M.b>F.t),Re=M=>v.filter(F=>M.l<F.r+3&&M.r>F.l-3&&M.t<F.b+3&&M.b>F.t-3).length,at=M=>ve.filter(F=>M.l<F.r+4&&M.r>F.l-4&&M.t<F.b+2&&M.b>F.t-2).length,gt=M=>50*mt(M)+3*Oe(M)+(de(M)?1:0)+(We(M)?5:0)+5*Re(M)+5*at(M),Ye=M=>Oe(M)>0||de(M)||We(M)||Re(M)>0||at(M)>0,dt=[];(t.links??[]).forEach((M,F)=>{let B=M.id??`link-${F}`,oe=y.get(M.aOn??M.a),re=y.get(M.bOn??M.b);if(oe===re){d.push(`link "${B}" joins "${M.aOn??M.a}" to itself: not drawn`),dt.push({...M,id:B,points:[],routed:!1});return}let Ae=$(oe,re)?Te=>le(oe,re,!1,Te):$(re,oe)?Te=>le(re,oe,!0,Te):(Te,we)=>Ce(oe,re,Te,we),ye=Ke(Ae,oe,re,!0),rt=!0;if(ye||(ye=Ke(Ae,oe,re,!1),rt=!1,d.push(`link "${B}": no clear route; drawn the least bad way`)),!ye){dt.push({...M,id:B,points:[],routed:!1});return}for(let Te=1;Te<ye.length;Te++)x(ye[Te-1],ye[Te]);dt.push({...M,id:B,points:ye,routed:rt})});let nt=[];for(let M=0;M<z.length;M++)for(let F=M+1;F<z.length;F++){let[B,oe]=z[M],[re,Ae]=z[F],ye=B[1]===oe[1],rt=re[1]===Ae[1];if(ye===rt)continue;let[Te,we]=ye?[[B,oe],[re,Ae]]:[[re,Ae],[B,oe]],Ie=we[0][0],De=Te[0][1];Ie>Math.min(Te[0][0],Te[1][0])&&Ie<Math.max(Te[0][0],Te[1][0])&&De>Math.min(we[0][1],we[1][1])&&De<Math.max(we[0][1],we[1][1])&&nt.push([Ie,De])}let mt=M=>nt.filter(([F,B])=>F>M.l-2&&F<M.r+2&&B>M.t-2&&B<M.b+2).length;for(let M of dt){let F=M,B=M.points;if(!F.label||!B.length)continue;let oe=[];for(let we=1;we<B.length;we++)oe.push([B[we-1],B[we]]);let re=we=>Math.abs(we[0][0]-we[1][0])+Math.abs(we[0][1]-we[1][1]);oe.sort((we,Ie)=>re(Ie)-re(we));let Ae=e(F.label,"label")+6,ye=null,rt=null,Te=1/0;for(let[we,Ie]of oe){let De=(we[0]+Ie[0])/2,ut=(we[1]+Ie[1])/2,kn=we[1]===Ie[1]?[0,-.3,.3,-.15,.15].flatMap(Pt=>{let it=De+Pt*Math.abs(we[0]-Ie[0]);return[[it,ut-6,"middle"],[it,ut+15,"middle"]]}):[0,-.3,.3].flatMap(Pt=>{let it=ut+4+Pt*Math.abs(we[1]-Ie[1]);return[[De+7,it,"start"],[De-7,it,"end"],[De+24,it,"start"],[De-24,it,"end"]]});for(let[Pt,it,lt]of kn){let ks=lt==="middle"?Pt-Ae/2:lt==="end"?Pt-Ae:Pt,jt={l:ks,r:ks+Ae,t:it-11,b:it+3};if(!Ye(jt)){ye=[Pt,it,lt,jt];break}let It=gt(jt);It<Te&&(Te=It,rt=[Pt,it,lt,jt])}if(ye)break}if(!ye&&rt&&(ye=rt),!ye){let[we,Ie]=oe[0],De=(we[0]+Ie[0])/2,ut=(we[1]+Ie[1])/2-6;ye=[De,ut,"middle",{l:De-Ae/2,r:De+Ae/2,t:ut-11,b:ut+3}]}ve.push(ye[3]),M.at={x:a(ye[0]),y:a(ye[1]),anchor:ye[2],box:ye[3],text:F.label}}let pe=[],Fe=[];for(let M of[...w,...ve,...u.map(F=>F.title)])pe.push(M.l,M.r),Fe.push(M.t,M.b);for(let M of dt)for(let F of M.points)pe.push(F[0]),Fe.push(F[1]);let Ne=i.margin,pt={l:Math.min(...pe)-Ne,t:Math.min(...Fe)-Ne,r:Math.max(...pe)+Ne,b:Math.max(...Fe)+Ne};return{cards:h,panels:u,links:dt,bounds:pt,options:i,warnings:d}}function gp(t,e,n){let r=o=>e>=o.l&&e<=o.r&&n>=o.t&&n<=o.b,i=t.cards.find(o=>r(o.rect));return i?i.id:[...t.panels].sort((o,s)=>s.depth-o.depth).find(o=>r(o.rect))?.id}function Ld(t,e,n,r={}){let i=a=>{let d=lr(a,e,r);return Math.max(d.bounds.r-d.bounds.l,(d.bounds.b-d.bounds.t)*n)},o=t,s=i(t);for(let a=0;a<12;a++){let d,c=s;for(let l of _d(o)){if(zo(l).length)continue;let p=i(l);p<c-.5&&(c=p,d=l)}if(!d)break;o=d,s=c}return o}function*_d(t){let e=t.panels??[],n=(s,a)=>s[0]>=a[0]&&s[2]<=a[2]&&s[1]>=a[1]&&s[3]<=a[3],r=(s,a)=>s.every((d,c)=>d===a[c]),i=(s,a=-1)=>{let d=-1;return e.forEach((c,l)=>{l===a||!n(s,c.cells)||a>=0&&l>a&&r(c.cells,e[a].cells)||(d<0||n(c.cells,e[d].cells)&&(!r(c.cells,e[d].cells)||l>d))&&(d=l)}),d},o=s=>{let a=[];return e.forEach((d,c)=>{i(d.cells,c)===s&&a.push({range:[...d.cells],panel:c})}),t.cards.forEach((d,c)=>{let l=[d.cell[0],d.cell[1],d.cell[0],d.cell[1]];i(l)===s&&a.push({range:l,card:c})}),a};for(let s of[-1,...e.map((a,d)=>d)]){let a=o(s);if(s>=0&&!a.some(p=>p.panel!==void 0))continue;let d=p=>[p.range[1],p.range[3]],c=[];for(let p of[...a].sort((f,m)=>f.range[1]-m.range[1]||f.range[0]-m.range[0])){let f=c.find(m=>m.some(u=>d(u)[0]<=d(p)[1]&&d(p)[0]<=d(u)[1]));f?f.push(p):c.push([p])}let l=Math.max(...a.map(p=>p.range[3]));for(let p of c){p.sort((f,m)=>f.range[0]-m.range[0]);for(let f=1;f<p.length;f++){let m=p.slice(f),u=p[0].range[0],h=l+1,y=Math.min(...m.map(S=>S.range[1])),v=Math.max(...m.map(S=>S.range[3]))-y+1,g=t.cards.map(S=>({...S,cell:[...S.cell]})),b=e.map(S=>({...S,cells:[...S.cells]}));for(let S of g)S.cell[1]>l&&(S.cell[1]+=v);let $=new Set;for(let S=s;S>=0&&!$.has(S);S=i(e[S].cells,S))$.add(S);b.forEach((S,k)=>{S.cells[1]>l?(S.cells[1]+=v,S.cells[3]+=v):($.has(k)||S.cells[1]<=l&&S.cells[3]>l)&&(S.cells[3]+=v)});let E=u;for(let S of m){let k=E-S.range[0],T=h+(S.range[1]-y)-S.range[1],z=A=>A[0]>=S.range[0]&&A[0]<=S.range[2]&&A[1]>=S.range[1]&&A[1]<=S.range[3];t.cards.forEach((A,R)=>{z([A.cell[0],A.cell[1]])&&(g[R].cell=[A.cell[0]+k,A.cell[1]+T])}),e.forEach((A,R)=>{n(A.cells,S.range)&&(b[R].cells=[A.cells[0]+k,A.cells[1]+T,A.cells[2]+k,A.cells[3]+T])}),E+=S.range[2]-S.range[0]+1}e.forEach((S,k)=>{let T=t.cards.map((z,A)=>n([z.cell[0],z.cell[1],z.cell[0],z.cell[1]],S.cells)?g[A].cell:void 0).filter(z=>!!z);T.length&&(b[k].cells=[Math.min(...T.map(z=>z[0])),Math.min(...T.map(z=>z[1])),Math.max(...T.map(z=>z[0])),Math.max(...T.map(z=>z[1]))])}),yield{cards:g,panels:b,links:t.links}}}}}function Co(t,e=()=>!0){let n=t.layout.items.filter(k=>e(k.id)),r=t.layout.catalog,i=!t.layout.items.some(k=>k.type==="node"),o=k=>i?!k.children.some(T=>e(T.id)):k.type==="node"&&!k.children.some(T=>T.type==="node"&&e(T.id)),s=n.filter(o),a=k=>{let T=[];for(let z=k;z;z=z.parent)T.unshift(z);return T},d=new Map(s.map(k=>[k.id,a(k)])),c=(k,T)=>{let z=d.get(k.id),A=d.get(T.id),R=0;for(;R<z.length&&R<A.length&&z[R]===A[R];)R++;return[z[R].box,A[R].box]},l=1e-6,p=(k,T)=>{let[z,A]=c(k,T);return z.y1<=A.y0+l&&z.x0<A.x1-l&&A.x0<z.x1-l},f=(k,T)=>{let[z,A]=c(k,T);return z.x1<=A.x0+l&&z.y0<A.y1-l&&A.y0<z.y1-l},m=(k,T)=>{let z=new Map,A=[];for(let R of[...s].sort((x,P)=>T(x)-T(P))){let x=0;for(let P of A)z.get(P.id)+1>x&&k(P,R)&&(x=z.get(P.id)+1);z.set(R.id,x),A.push(R)}return z},u=m(p,k=>k.box.y0),h=m(f,k=>k.box.x0),y=Math.min(...s.map(k=>k.box.x1-k.box.x0))/2;for(let k of s)if(!k.parent)for(let T of s)T.parent&&T.box.x0<=k.box.x0+y&&h.set(k.id,Math.max(h.get(k.id),h.get(T.id)));let v=new Map;for(let k of s)v.set(k.id,[h.get(k.id),u.get(k.id)]);let g=new Map;for(let k of s){let T=v.get(k.id),z=g.get(String(T));if(z!==void 0&&z!==k.id){for(let[,A]of v)A[0]>T[0]&&A!==T&&A[0]++;T[0]++,g.clear();for(let A of s)g.set(String(v.get(A.id)),A.id)}else g.set(String(T),k.id)}let b=s.map(k=>{if(k.region){let A=k.region;return{id:k.id,label:A.label??k.id,sub:void 0,role:A.role??vt(r,A.kind)?.role??"grey",ghost:A.ghost||void 0,cell:v.get(k.id)}}let T=k.node,z=hs(r,T.asset);return{id:k.id,label:T.label??k.id,sub:T.sub,role:T.role??z.role,ghost:T.ghost||void 0,cell:v.get(k.id)}}),$=[];for(let k of n){if(o(k))continue;let T=[],z=w=>{for(let I of w.children){let L=v.get(I.id);L&&T.push(L),z(I)}};if(z(k),!T.length)continue;let A=T.map(w=>w[0]),R=T.map(w=>w[1]),x=k.type==="region"?k.region.label:k.node.label??k.id,P=k.type==="region"?k.region.role??vt(r,k.region.kind)?.role:k.node.role??hs(r,k.node.asset).role;$.push({id:k.id,label:x,sub:k.type==="node"?k.node.sub:void 0,role:P,cells:[Math.min(...A),Math.min(...R),Math.max(...A),Math.max(...R)]})}let E=new Set([...b.map(k=>k.id),...$.map(k=>k.id)]),S=[];for(let k of t.routes){if(!e(k.id))continue;let T=ls(k.raw.from).id,z=ls(k.raw.to).id;if(!E.has(T)||!E.has(z))continue;let A=typeof k.raw.label=="string"?k.raw.label:k.raw.label?.text;S.push({id:k.id,a:T,b:z,kind:k.kind,label:A})}return{cards:b,panels:$,links:S}}var gn={W:4,D:2,H:.9,GX:2,GY:2.4,PAD:.6,CH:2.2,PANEL_H:.3},bp=`
287
+ `)}`);let i={...Ac,...s},{W:o,H:n}=i,a=E=>Math.round(E*10)/10,m=[],p=t.panels??[],{prect:c,parentIx:l,depthOf:f,cardAt:d}=Wi(t,i),u=p.map((E,q)=>{let _=c[q],re=e(E.label??"","title")+(E.sub?e(E.sub,"titleSub"):0);return{...E,rect:_,titleAt:[a(_.l+16),a(_.b-15)],depth:f(q),parent:l[q]>=0?p[l[q]].id:void 0,title:{l:_.l+10,r:_.l+22+re,t:_.b-30,b:_.b-6}}}),y=t.cards.map(E=>{let[q,_]=d(t.cards.indexOf(E));return{...E,rect:{l:q,t:_,r:q+o,b:_+n}}}),g=new Map;u.forEach(E=>g.set(E.id,E.rect)),y.forEach(E=>g.set(E.id,E.rect));let x=y.map(E=>E.rect),h=u.map(E=>E.rect),b=u.filter(E=>E.label).map(E=>E.title),w=(E,q)=>E.l>=q.l&&E.r<=q.r&&E.t>=q.t&&E.b<=q.b,k=(E,q,_,re)=>Math.min(E[0],q[0])<_.r+re&&Math.max(E[0],q[0])>_.l-re&&Math.min(E[1],q[1])<_.b+re&&Math.max(E[1],q[1])>_.t-re,$=(E,q)=>h.reduce((_,re)=>{if(E[0]===q[0]){let pe=Math.min(E[1],q[1]),Te=Math.max(E[1],q[1]);E[0]>re.l&&E[0]<re.r&&(_+=[re.t,re.b].filter(Pe=>Pe>pe+1&&Pe<Te-1).length)}else{let pe=Math.min(E[0],q[0]),Te=Math.max(E[0],q[0]);E[1]>re.t&&E[1]<re.b&&(_+=[re.l,re.r].filter(Pe=>Pe>pe+1&&Pe<Te-1).length)}return _},0),v=(E,q)=>h.some(_=>E[1]===q[1]?[_.t,_.b].some(re=>Math.abs(E[1]-re)<16&&Math.max(E[0],q[0])>_.l&&Math.min(E[0],q[0])<_.r):[_.l,_.r].some(re=>Math.abs(E[0]-re)<16&&Math.max(E[1],q[1])>_.t&&Math.min(E[1],q[1])<_.b)),T=(E,q,_,re)=>h.filter(pe=>pe!==_&&pe!==re&&!w(_,pe)&&!w(re,pe)&&k(E,q,{l:pe.l+3,r:pe.r-3,t:pe.t+3,b:pe.b-3},0)).length,R=[],O=new Map,I=new Map,M=(E,q)=>{R.push([E,q]);let[_,re]=E[1]===q[1]?[O,E[1]]:E[0]===q[0]?[I,E[0]]:[void 0,0];if(!_)return;let pe=Math.floor(re/6);(_.get(pe)??_.set(pe,[]).get(pe)).push([E,q])},A=(E,q)=>{let _=E[1]===q[1];if(!_&&E[0]!==q[0])return 0;let re=_?1:0,pe=_?0:1,Te=_?O:I,Pe=Math.floor(E[re]/6),rt=Math.min(E[pe],q[pe]),Fe=Math.max(E[pe],q[pe]),Ce=0;for(let Ke=Pe-1;Ke<=Pe+1;Ke++)for(let[We,gt]of Te.get(Ke)??[])Math.abs(E[re]-We[re])<6&&Math.min(Fe,Math.max(We[pe],gt[pe]))-Math.max(rt,Math.min(We[pe],gt[pe]))>0&&Ce++;return Ce},P=[...g.values()],j=Math.min(...P.map(E=>E.l)),F=Math.max(...P.map(E=>E.r)),Y=Math.min(...P.map(E=>E.t)),J=Math.max(...P.map(E=>E.b)),U=(E,q)=>{let _=(E+q)/2;return[_,_-12,_+12,_-24,_+24]},C=(()=>{let E=[];return x.forEach(q=>x.forEach(_=>{_.t>q.b&&_.l<q.r+400&&_.r>q.l-400&&E.push(...U(q.b,_.t))})),E.push(Y-22,Y-34,J+22,J+34),[...new Set(E.map(Math.round))]})(),G=(()=>{let E=[];return x.forEach(q=>x.forEach(_=>{_.l>q.r&&E.push(...U(q.r,_.l))})),E.push(j-22,j-34,F+22,F+34),[...new Set(E.map(Math.round))]})(),Z=new Map,Q=new Map,z=E=>{let q=Z.get(E);return q||Z.set(E,q=x.filter(_=>E<_.b+6&&E>_.t-6)),q},D=E=>{let q=Q.get(E);return q||Q.set(E,q=x.filter(_=>E<_.r+6&&E>_.l-6)),q},V=i.crossPanel/i.overlap,W=i.border/i.overlap,de=i.nearEdge/i.overlap;function ce(E,q,_,re,pe=!0){let Te=0;for(let Ce=1;Ce<E.length;Ce++)Te+=Math.abs(E[Ce-1][0]-E[Ce][0])+Math.abs(E[Ce-1][1]-E[Ce][1]);let Pe=Te+i.bend*(E.length-2);if(Pe>=re)return Pe;let rt=0,Fe=0;for(let Ce=1;Ce<E.length;Ce++){let Ke=E[Ce-1],We=E[Ce];if(pe){if(ke(Ke,We,q,_)||v(Ke,We))return 1/0;continue}for(let gt of Ke[1]===We[1]?z(Ke[1]):D(Ke[0]))gt!==q&&gt!==_&&k(Ke,We,gt,6)&&rt++;for(let gt of b)k(Ke,We,gt,2)&&rt++}for(let Ce=1;Ce<E.length;Ce++){let Ke=E[Ce-1],We=E[Ce];if(Fe+=A(Ke,We)+V*T(Ke,We,q,_)+W*$(Ke,We),v(Ke,We)&&(Fe+=de),Pe+i.overlap*Fe>=re)return Pe+i.overlap*Fe}return Pe+i.overlap*Fe+rt*1e5}let H=E=>(E.l+E.r)/2,ne=E=>(E.t+E.b)/2,Ee=[0,-22,22,-44,44],qe={bc:1/0},N=(E,q,_,re)=>Math.abs(E-_)+Math.abs(q-re),ee=(E,q,_,re,pe,Te,Pe,rt)=>{let Fe=0;return Fe+=N(E,q,_,re),Fe+=N(_,re,pe,Te),Fe+=N(pe,Te,Pe,rt),Fe+i.bend*2},ye=(E,q,_,re,pe,Te,Pe,rt,Fe,Ce)=>{let Ke=0;return Ke+=N(E,q,_,re),Ke+=N(_,re,pe,Te),Ke+=N(pe,Te,Pe,rt),Ke+=N(Pe,rt,Fe,Ce),Ke+i.bend*3},ke=(E,q,_,re)=>{for(let pe of E[1]===q[1]?z(E[1]):D(E[0]))if(pe!==_&&pe!==re&&k(E,q,pe,6))return!0;for(let pe of b)if(k(E,q,pe,2))return!0;return v(E,q)};function Ve(E,q,_,re){let pe=Math.max(E.l,q.l),Te=Math.min(E.r,q.r);if(Te-pe>24)for(let dt of Ee){let ut=(pe+Te)/2+dt;ut>pe+8&&ut<Te-8&&_(q.t>=E.b?[[ut,E.b],[ut,q.t]]:[[ut,E.t],[ut,q.b]])}let Pe=Math.max(E.t,q.t),rt=Math.min(E.b,q.b);if(rt-Pe>16)for(let dt of[0,-10,10]){let ut=(Pe+rt)/2+dt;_(q.l>=E.r?[[E.r,ut],[q.l,ut]]:[[E.l,ut],[q.r,ut]])}let Fe=G.length,Ce=C.length,Ke=new Uint8Array(Ee.length*Ce),We=new Uint8Array(Ee.length*Ce),gt=new Uint8Array(Ee.length*Fe),Vs=new Uint8Array(Ee.length*Fe),Tt=(dt,ut,Cn,Kt)=>re?(dt[ut]||(dt[ut]=ke(Cn,Kt,E,q)?2:1),dt[ut]===1):!0;Ee.forEach((dt,ut)=>Ee.forEach((Cn,Kt)=>{let _t=H(E)+dt,Dt=H(q)+Cn,Gt=ne(E)+dt/3,kt=ne(q)+Cn/3;C.forEach((Je,jn)=>{let ht=Je>E.b?E.b:Je<E.t?E.t:null,ln=Je>q.b?q.b:Je<q.t?q.t:null;ht!==null&&ln!==null&&ee(_t,ht,_t,Je,Dt,Je,Dt,ln)<qe.bc&&Tt(Ke,ut*Ce+jn,[_t,ht],[_t,Je])&&Tt(We,Kt*Ce+jn,[Dt,Je],[Dt,ln])&&_([[_t,ht],[_t,Je],[Dt,Je],[Dt,ln]])}),G.forEach((Je,jn)=>{let ht=Je>E.r?E.r:Je<E.l?E.l:null,ln=Je>q.r?q.r:Je<q.l?q.l:null;ht!==null&&ln!==null&&ee(ht,Gt,Je,Gt,Je,kt,ln,kt)<qe.bc&&Tt(gt,ut*Fe+jn,[ht,Gt],[Je,Gt])&&Tt(Vs,Kt*Fe+jn,[Je,kt],[ln,kt])&&_([[ht,Gt],[Je,Gt],[Je,kt],[ln,kt]])}),dt===0&&Cn===0&&G.forEach((Je,jn)=>C.forEach((ht,ln)=>{let L=Je>E.r?E.r:Je<E.l?E.l:null,X=ht>q.b?q.b:ht<q.t?q.t:null;L!==null&&X!==null&&ye(L,Gt,Je,Gt,Je,ht,Dt,ht,Dt,X)<qe.bc&&Tt(gt,ut*Fe+jn,[L,Gt],[Je,Gt])&&Tt(We,Kt*Ce+ln,[Dt,ht],[Dt,X])&&_([[L,Gt],[Je,Gt],[Je,ht],[Dt,ht],[Dt,X]]);let oe=ht>E.b?E.b:ht<E.t?E.t:null,ue=Je>q.r?q.r:Je<q.l?q.l:null;oe!==null&&ue!==null&&ye(_t,oe,_t,ht,Je,ht,Je,kt,ue,kt)<qe.bc&&Tt(Ke,ut*Ce+ln,[_t,oe],[_t,ht])&&Tt(Vs,Kt*Fe+jn,[Je,kt],[ue,kt])&&_([[_t,oe],[_t,ht],[Je,ht],[Je,kt],[ue,kt]])}));let cr=H(E)<q.l?q.l:H(E)>q.r?q.r:null,Zt=kt<E.t?E.t:kt>E.b?E.b:null;cr!==null&&Zt!==null&&_([[_t,Zt],[_t,kt],[cr,kt]]);let Ks=ne(E)<q.t?q.t:ne(E)>q.b?q.b:null,pr=Dt<E.l?E.l:Dt>E.r?E.r:null;Ks!==null&&pr!==null&&_([[pr,Gt],[Dt,Gt],[Dt,Ks]])}))}function we(E,q,_,re){for(let pe of Ee){let Te=H(E)+pe,Pe=ne(E)+pe/3,rt=[[[Te,E.t],[Te,q.t]],[[E.r,Pe],[q.r,Pe]],[[Te,E.b],[Te,q.b]],[[E.l,Pe],[q.l,Pe]]];for(let Fe of rt)re(_?[Fe[1],Fe[0]]:Fe)}}let Ue=(E,q,_,re)=>{let pe=null;return qe.bc=1/0,E(Te=>{let Pe=ce(Te,q,_,qe.bc,re);Pe<qe.bc&&(qe.bc=Pe,pe=Te)},re),pe},Le=[],$e=E=>h.some(q=>[q.l,q.r].some(_=>E.l<_+3&&E.r>_-3&&E.b>q.t&&E.t<q.b)||[q.t,q.b].some(_=>E.t<_+3&&E.b>_-3&&E.r>q.l&&E.l<q.r)),S=E=>R.filter(([q,_])=>k(q,_,E,1)).length,B=E=>b.some(q=>E.l<q.r&&E.r>q.l&&E.t<q.b&&E.b>q.t),K=E=>x.filter(q=>E.l<q.r+3&&E.r>q.l-3&&E.t<q.b+3&&E.b>q.t-3).length,ae=E=>Le.filter(q=>E.l<q.r+4&&E.r>q.l-4&&E.t<q.b+2&&E.b>q.t-2).length,le=E=>50*Se(E)+3*S(E)+($e(E)?1:0)+(B(E)?5:0)+5*K(E)+5*ae(E),fe=E=>S(E)>0||$e(E)||B(E)||K(E)>0||ae(E)>0,se=[];(t.links??[]).forEach((E,q)=>{let _=E.id??`link-${q}`,re=g.get(E.aOn??E.a),pe=g.get(E.bOn??E.b);if(re===pe){m.push(`link "${_}" joins "${E.aOn??E.a}" to itself: not drawn`),se.push({...E,id:_,points:[],routed:!1});return}let Te=w(re,pe)?Fe=>we(re,pe,!1,Fe):w(pe,re)?Fe=>we(pe,re,!0,Fe):(Fe,Ce)=>Ve(re,pe,Fe,Ce),Pe=Ue(Te,re,pe,!0),rt=!0;if(Pe||(Pe=Ue(Te,re,pe,!1),rt=!1,m.push(`link "${_}": no clear route; drawn the least bad way`)),!Pe){se.push({...E,id:_,points:[],routed:!1});return}for(let Fe=1;Fe<Pe.length;Fe++)M(Pe[Fe-1],Pe[Fe]);se.push({...E,id:_,points:Pe,routed:rt})});let ge=[];for(let E=0;E<R.length;E++)for(let q=E+1;q<R.length;q++){let[_,re]=R[E],[pe,Te]=R[q],Pe=_[1]===re[1],rt=pe[1]===Te[1];if(Pe===rt)continue;let[Fe,Ce]=Pe?[[_,re],[pe,Te]]:[[pe,Te],[_,re]],Ke=Ce[0][0],We=Fe[0][1];Ke>Math.min(Fe[0][0],Fe[1][0])&&Ke<Math.max(Fe[0][0],Fe[1][0])&&We>Math.min(Ce[0][1],Ce[1][1])&&We<Math.max(Ce[0][1],Ce[1][1])&&ge.push([Ke,We])}let Se=E=>ge.filter(([q,_])=>q>E.l-2&&q<E.r+2&&_>E.t-2&&_<E.b+2).length;for(let E of se){let q=E,_=E.points;if(!q.label||!_.length)continue;let re=[];for(let Ce=1;Ce<_.length;Ce++)re.push([_[Ce-1],_[Ce]]);let pe=Ce=>Math.abs(Ce[0][0]-Ce[1][0])+Math.abs(Ce[0][1]-Ce[1][1]);re.sort((Ce,Ke)=>pe(Ke)-pe(Ce));let Te=e(q.label,"label")+6,Pe=null,rt=null,Fe=1/0;for(let[Ce,Ke]of re){let We=(Ce[0]+Ke[0])/2,gt=(Ce[1]+Ke[1])/2,Vs=Ce[1]===Ke[1]?[0,-.3,.3,-.15,.15].flatMap(Tt=>{let dt=We+Tt*Math.abs(Ce[0]-Ke[0]);return[[dt,gt-6,"middle"],[dt,gt+15,"middle"]]}):[0,-.3,.3].flatMap(Tt=>{let dt=gt+4+Tt*Math.abs(Ce[1]-Ke[1]);return[[We+7,dt,"start"],[We-7,dt,"end"],[We+24,dt,"start"],[We-24,dt,"end"]]});for(let[Tt,dt,ut]of Vs){let Cn=ut==="middle"?Tt-Te/2:ut==="end"?Tt-Te:Tt,Kt={l:Cn,r:Cn+Te,t:dt-11,b:dt+3};if(!fe(Kt)){Pe=[Tt,dt,ut,Kt];break}let _t=le(Kt);_t<Fe&&(Fe=_t,rt=[Tt,dt,ut,Kt])}if(Pe)break}if(!Pe&&rt&&(Pe=rt),!Pe){let[Ce,Ke]=re[0],We=(Ce[0]+Ke[0])/2,gt=(Ce[1]+Ke[1])/2-6;Pe=[We,gt,"middle",{l:We-Te/2,r:We+Te/2,t:gt-11,b:gt+3}]}Le.push(Pe[3]),E.at={x:a(Pe[0]),y:a(Pe[1]),anchor:Pe[2],box:Pe[3],text:q.label}}let te=[],xe=[];for(let E of[...P,...Le,...u.map(q=>q.title)])te.push(E.l,E.r),xe.push(E.t,E.b);for(let E of se)for(let q of E.points)te.push(q[0]),xe.push(q[1]);let he=i.margin,Ie={l:Math.min(...te)-he,t:Math.min(...xe)-he,r:Math.max(...te)+he,b:Math.max(...xe)+he};return{cards:y,panels:u,links:se,bounds:Ie,options:i,warnings:m}}function ad(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 Qu(t,e,s,r={}){let i=a=>{let m=Kr(a,e,r);return Math.max(m.bounds.r-m.bounds.l,(m.bounds.b-m.bounds.t)*s)},o=t,n=i(t);for(let a=0;a<12;a++){let m,p=n;for(let c of eh(o)){if(La(c).length)continue;let l=i(c);l<p-.5&&(p=l,m=c)}if(!m)break;o=m,n=p}return o}function*eh(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((m,p)=>m===a[p]),i=(n,a=-1)=>{let m=-1;return e.forEach((p,c)=>{c===a||!s(n,p.cells)||a>=0&&c>a&&r(p.cells,e[a].cells)||(m<0||s(p.cells,e[m].cells)&&(!r(p.cells,e[m].cells)||c>m))&&(m=c)}),m},o=n=>{let a=[];return e.forEach((m,p)=>{i(m.cells,p)===n&&a.push({range:[...m.cells],panel:p})}),t.cards.forEach((m,p)=>{let c=[m.cell[0],m.cell[1],m.cell[0],m.cell[1]];i(c)===n&&a.push({range:c,card:p})}),a};for(let n of[-1,...e.map((a,m)=>m)]){let a=o(n);if(n>=0&&!a.some(l=>l.panel!==void 0))continue;let m=l=>[l.range[1],l.range[3]],p=[];for(let l of[...a].sort((f,d)=>f.range[1]-d.range[1]||f.range[0]-d.range[0])){let f=p.find(d=>d.some(u=>m(u)[0]<=m(l)[1]&&m(l)[0]<=m(u)[1]));f?f.push(l):p.push([l])}let c=Math.max(...a.map(l=>l.range[3]));for(let l of p){l.sort((f,d)=>f.range[0]-d.range[0]);for(let f=1;f<l.length;f++){let d=l.slice(f),u=l[0].range[0],y=c+1,g=Math.min(...d.map($=>$.range[1])),x=Math.max(...d.map($=>$.range[3]))-g+1,h=t.cards.map($=>({...$,cell:[...$.cell]})),b=e.map($=>({...$,cells:[...$.cells]}));for(let $ of h)$.cell[1]>c&&($.cell[1]+=x);let w=new Set;for(let $=n;$>=0&&!w.has($);$=i(e[$].cells,$))w.add($);b.forEach(($,v)=>{$.cells[1]>c?($.cells[1]+=x,$.cells[3]+=x):(w.has(v)||$.cells[1]<=c&&$.cells[3]>c)&&($.cells[3]+=x)});let k=u;for(let $ of d){let v=k-$.range[0],T=y+($.range[1]-g)-$.range[1],R=O=>O[0]>=$.range[0]&&O[0]<=$.range[2]&&O[1]>=$.range[1]&&O[1]<=$.range[3];t.cards.forEach((O,I)=>{R([O.cell[0],O.cell[1]])&&(h[I].cell=[O.cell[0]+v,O.cell[1]+T])}),e.forEach((O,I)=>{s(O.cells,$.range)&&(b[I].cells=[O.cells[0]+v,O.cells[1]+T,O.cells[2]+v,O.cells[3]+T])}),k+=$.range[2]-$.range[0]+1}e.forEach(($,v)=>{let T=t.cards.map((R,O)=>s([R.cell[0],R.cell[1],R.cell[0],R.cell[1]],$.cells)?h[O].cell:void 0).filter(R=>!!R);T.length&&(b[v].cells=[Math.min(...T.map(R=>R[0])),Math.min(...T.map(R=>R[1])),Math.max(...T.map(R=>R[0])),Math.max(...T.map(R=>R[1]))])}),yield{cards:h,panels:b,links:t.links}}}}}function _a(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(T=>e(T.id)):v.type==="node"&&!v.children.some(T=>T.type==="node"&&e(T.id)),n=s.filter(o),a=v=>{let T=[];for(let R=v;R;R=R.parent)T.unshift(R);return T},m=new Map(n.map(v=>[v.id,a(v)])),p=(v,T)=>{let R=m.get(v.id),O=m.get(T.id),I=0;for(;I<R.length&&I<O.length&&R[I]===O[I];)I++;return[R[I].box,O[I].box]},c=1e-6,l=(v,T)=>{let[R,O]=p(v,T);return R.y1<=O.y0+c&&R.x0<O.x1-c&&O.x0<R.x1-c},f=(v,T)=>{let[R,O]=p(v,T);return R.x1<=O.x0+c&&R.y0<O.y1-c&&O.y0<R.y1-c},d=(v,T)=>{let R=new Map,O=[];for(let I of[...n].sort((M,A)=>T(M)-T(A))){let M=0;for(let A of O)R.get(A.id)+1>M&&v(A,I)&&(M=R.get(A.id)+1);R.set(I.id,M),O.push(I)}return R},u=d(l,v=>v.box.y0),y=d(f,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 T of n)T.parent&&T.box.x0<=v.box.x0+g&&y.set(v.id,Math.max(y.get(v.id),y.get(T.id)));let x=new Map;for(let v of n)x.set(v.id,[y.get(v.id),u.get(v.id)]);let h=new Map;for(let v of n){let T=x.get(v.id),R=h.get(String(T));if(R!==void 0&&R!==v.id){for(let[,O]of x)O[0]>T[0]&&O!==T&&O[0]++;T[0]++,h.clear();for(let O of n)h.set(String(x.get(O.id)),O.id)}else h.set(String(T),v.id)}let b=n.map(v=>{if(v.region){let O=v.region;return{id:v.id,label:O.label??v.id,sub:void 0,role:O.role??Pt(r,O.kind)?.role??"grey",ghost:O.ghost||void 0,cell:x.get(v.id)}}let T=v.node,R=Mn(r,T.asset);return{id:v.id,label:T.label??v.id,sub:T.sub,role:T.role??R.role,ghost:T.ghost||void 0,cell:x.get(v.id)}}),w=[];for(let v of s){if(o(v))continue;let T=[],R=P=>{for(let j of P.children){let F=x.get(j.id);F&&T.push(F),R(j)}};if(R(v),!T.length)continue;let O=T.map(P=>P[0]),I=T.map(P=>P[1]),M=v.type==="region"?v.region.label:v.node.label??v.id,A=v.type==="region"?v.region.role??Pt(r,v.region.kind)?.role:v.node.role??Mn(r,v.node.asset).role;w.push({id:v.id,label:M,sub:v.type==="node"?v.node.sub:void 0,role:A,cells:[Math.min(...O),Math.min(...I),Math.max(...O),Math.max(...I)]})}let k=new Set([...b.map(v=>v.id),...w.map(v=>v.id)]),$=[];for(let v of t.routes){if(!e(v.id))continue;let T=bn(v.raw.from).id,R=bn(v.raw.to).id;if(!k.has(T)||!k.has(R))continue;let O=typeof v.raw.label=="string"?v.raw.label:v.raw.label?.text;$.push({id:v.id,a:T,b:R,kind:v.kind,label:O})}return{cards:b,panels:w,links:$}}var Fs={W:4,D:2,H:.9,GX:2,GY:2.4,PAD:.6,CH:2.2,PANEL_H:.3},ld=`
279
288
  .blk .card-name{font-size:13px;font-weight:600;fill:var(--ink)}
280
289
  .blk .card-sub{font-size:10px;fill:var(--ink);opacity:.75}
281
290
  .blk.ghost .card-name,.blk.ghost .card-sub{fill:var(--muted)}
282
- `;function ml(t){return{name:"card",description:"A card: a slab with its name on its front face",size:[gn.W,gn.D,gn.H],role:"grey",draw(e,n,r){let i=t(r.id),o=e.blockFaces(n);if(!i)return o;let s=n.z1-n.z0;return o+=e.faceText(n.x0+.2,n.y1,n.z0+(i.sub?s*.52:s*.34),i.label,"card-name",yt.lbl,"left","start"),i.sub&&(o+=e.faceText(n.x0+.2,n.y1,n.z0+s*.14,i.sub,"card-sub",yt.sub,"left","start")),o}}}function wp(t){let e=new Map(t.cards.map(n=>[n.id,{label:n.label,sub:n.sub}]));return{regions:{panel:{shape:"slab",pad:gn.PAD,z:[gn.PANEL_H,0],floor:!0,role:"grey",labelStyle:"floor"}},nodes:{card:ml(n=>e.get(n))},defaultNode:"card"}}function xp(t,e={}){let n=gn,{prect:r,parentIx:i,cardAt:o}=ti(t,{W:n.W,H:n.D,GX:n.GX,GY:n.GY,PAD:n.PAD,TITLE:0,CH:n.CH}),s=t.panels??[],a=u=>Math.round(u*1e3)/1e3,d=u=>(u.cells[2]-u.cells[0]+1)*(u.cells[3]-u.cells[1]+1),c=u=>{let h=-1;return s.forEach((y,v)=>{let g=y.cells;u.cell[0]>=g[0]&&u.cell[0]<=g[2]&&u.cell[1]>=g[1]&&u.cell[1]<=g[3]&&(h<0||d(y)<=d(s[h]))&&(h=v)}),h},l=s.map((u,h)=>{let y=r[h],v=i[h]>=0?r[i[h]]:{l:0,t:0};return{id:u.id,kind:"panel",label:u.label,role:u.role,at:[a(y.l-v.l),a(y.t-v.t)],size:[a(y.r-y.l),a(y.b-y.t)],regions:[],nodes:[]}}),p=[],f=[];l.forEach((u,h)=>i[h]>=0?l[i[h]].regions.push(u):p.push(u));for(let u of t.cards){let[h,y]=o(t.cards.indexOf(u)),v=c(u),g=v>=0?r[v]:{l:0,t:0},b={id:u.id,asset:"card",role:u.role,ghost:u.ghost||void 0,at:[a(h-g.l),a(y-g.t)],size:[n.W,n.D,n.H]};(v>=0?l[v].nodes:f).push(b)}for(let u of l)u.regions.length||delete u.regions,u.nodes.length||delete u.nodes;let m=(t.links??[]).map((u,h)=>({id:u.id??`link-${h}`,from:u.aOn??u.a,to:u.bOn??u.b,kind:u.kind,label:u.label}));return{isodiag:1,title:e.title,kinds:e.kinds,roles:e.roles,scenes:[{id:"board",title:e.title??"board",regions:p,nodes:f,routes:m}]}}var lf={};mi(lf,{APPEARS:()=>Pp,BASE_FIELDS:()=>Al,BINS:()=>zp,BIN_MS:()=>bs,CARD:()=>kt,DUAL_VIEW_CSS:()=>af,IDLES:()=>Ap,MAX_ZOOM:()=>_o,MIN_ZOOM:()=>Lo,P3:()=>Ue,SEGMENT_NAME:()=>Bo,SEVERITIES:()=>ns,TIMELINE_VERSION:()=>Ip,activityOf:()=>Rl,attr:()=>Rs,binNext:()=>Zo,binStart:()=>In,buildLayer:()=>ai,cardMotion:()=>Mp,clamp:()=>rn,cls:()=>Ep,crumbs:()=>fr,dualView:()=>nf,ease:()=>oi,escapeName:()=>Ko,extent:()=>Fo,findGaps:()=>Uo,fitWithOverlay:()=>Tp,flatCss:()=>Xp,flatSvg:()=>Qo,formatScope:()=>Cp,gapKey:()=>Cn,gapLabel:()=>zn,h:()=>X,hasSegment:()=>Fp,highlights:()=>ri,isZone:()=>Dp,isoVars:()=>Np,join:()=>Lp,kindOf:()=>cr,legend:()=>Pl,levelOf:()=>qt,markConnectors:()=>sa,md:()=>Gs,measureIn:()=>ea,memorySource:()=>Zp,modeFor:()=>Nl,morphSvgs:()=>sf,mountTimeline:()=>Wp,n:()=>gl,nameOf:()=>pr,node:()=>Op,offsetAt:()=>Yt,overlayPaint:()=>vp,parentOf:()=>_p,prefixAt:()=>nn,prune:()=>wl,pts:()=>si,rangeOf:()=>ni,readTime:()=>Ml,rectOf:()=>Qp,renderPage:()=>Rp,rewrite:()=>bl,scope:()=>kl,scopePattern:()=>Do,scopeRules:()=>Vo,scopeSelector:()=>xl,searchFor:()=>dr,severities:()=>jp,stepData:()=>$l,storedMode:()=>rf,ticks:()=>Yo,timeScale:()=>mr,toCSV:()=>Wo,toJSON:()=>Ho,unite:()=>jo,viewToggle:()=>of,viewport:()=>Sp,within:()=>rs});function Fd(t,e,n){let i=(a,d,c,l,p)=>Math.min((a-48)/(c-d),...l===void 0||p===void 0?[]:[[p-l,12],[p-d,30],[c-l,30]].map(([f,m])=>f>0?(a-m)/f:1/0)),o=Math.min(_o,Math.max(Lo,Math.min(i(t.w,e.x,e.x+e.w,n?.x,n&&n.x+n.w),i(t.h,e.y,e.y+e.h,n?.y,n&&n.y+n.h)))),s=(a,d,c,l,p)=>{let f=(d+c)/2;if(l===void 0||p===void 0)return f;let m=p-(a/2-6)/o,u=l+(a/2-6)/o;return m>u?(m+u)/2:Math.max(m,Math.min(u,f))};return{k:o,cx:s(t.w,e.x,e.x+e.w,n?.x,n&&n.x+n.w),cy:s(t.h,e.y,e.y+e.h,n?.y,n&&n.y+n.h)}}var Lo=.1,_o=8;function Sp(t,e){let n,r,i=!1,o=0,s=0,a=0,d=0,c=0,l=!1,p=()=>{let k=t.getBoundingClientRect();return{w:Math.max(1,k.width),h:Math.max(1,k.height)}},f=(k=n)=>{let T=p();return Math.min(T.w/k.w,T.h/k.h)},m=k=>{o++;try{k()}finally{o--}};function u(){let k=e.svg();if(!k||!n)return;o||(i=!0);let T=p(),z=f(),A=T.w/z,R=T.h/z;n={x:n.x+(n.w-A)/2,y:n.y+(n.h-R)/2,w:A,h:R},k.setAttribute("viewBox",`${n.x.toFixed(2)} ${n.y.toFixed(2)} ${n.w.toFixed(2)} ${n.h.toFixed(2)}`),s=z,e.onApply(z),a&&Math.abs(z/a-1)>.02&&(cancelAnimationFrame(d),d=requestAnimationFrame(()=>{d=0,e.onRezoom()}))}let h=(k,T)=>{let z=t.getBoundingClientRect(),A=f();return{x:n.x+(k-z.left)/A,y:n.y+(T-z.top)/A}};function y(k,T,z){if(!n)return;let A=f(),R=Math.min(_o,Math.max(Lo,A*k)),x=t.getBoundingClientRect(),P=T??x.left+x.width/2,w=z??x.top+x.height/2,I=h(P,w),L=p();n={x:I.x-(P-x.left)/R,y:I.y-(w-x.top)/R,w:L.w/R,h:L.h/R},u()}function v(k=r,T){if(!k)return;let z=p(),{k:A,cx:R,cy:x}=Fd(z,k,T),P={x:R-z.w/A/2,y:x-z.h/A/2,w:z.w/A,h:z.h/A};if(n&&Math.abs(P.w/n.w-1)<.001&&Math.abs(P.h/n.h-1)<.001&&Math.abs(P.x-n.x)<P.w*.001&&Math.abs(P.y-n.y)<P.h*.001){u();return}n=P,u()}function g(){for(let k=0,T="";k<4;k++){let z=e.itemsBox()??r;if(!z)return;let A=[z.x,z.y,z.w,z.h].map(x=>Math.round(x)).join();if(A===T)break;T=A;let R=Math.max(24,Math.min(z.w,z.h)*.06);if(m(()=>v({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(f()/a-1)<=.02)break;cancelAnimationFrame(d),d=0,e.onRezoom()}i=!1}function b(){if(i||!e.svg()||!n)return;let k=t.getBoundingClientRect();k.width<2||k.height<2||g()}function $(){if(!n)return;let k=f();y(1/k)}function E(){return new Promise(k=>{let T=0,z=s,A=()=>{if(l){k();return}let R=!!(d||c)||s!==z;z=s,T=R?0:T+1,T>=2?k():requestAnimationFrame(A)};requestAnimationFrame(A)})}let S=new ResizeObserver(()=>{if(!(!n||l)){if(i&&s){let k=p(),T=n.x+n.w/2,z=n.y+n.h/2;n={x:T-k.w/s/2,y:z-k.h/s/2,w:k.w/s,h:k.h/s}}i||(cancelAnimationFrame(c),c=requestAnimationFrame(()=>{c=0,l||b()})),m(u)}});return S.observe(t),{get view(){return n},set view(k){n=k},get full(){return r},set full(k){r=k},get moved(){return i},get zoom(){return s},painted(k){a=k},size:p,scale:f,quietly:m,applyView:u,toSvg:h,zoomAt:y,fit:v,fitItems:g,autoFit:b,actual:$,settled:E,dispose(){cancelAnimationFrame(c),cancelAnimationFrame(d),S.disconnect(),l=!0}}}var $t="http://www.w3.org/2000/svg",kt={half:2.4,h:3.2,t:.25,above:1.4,lift:3.8,fan:.32,gap:.3},Ue=(t,e,n)=>[(t-e)*Et*Qe,(t+e)*.5*Qe-n*Qe],si=t=>t.map(([e,n])=>`${e.toFixed(1)},${n.toFixed(1)}`).join(" ");function vp(t,e){function n(o,s,a){let d=t.k(),c=(p,f,m,u,h="")=>{let y=o.createElementNS($t,"g");y.setAttribute("class",`live-badge ${m.cls} ${h}`.trim());let v=8/d,g=o.createElementNS($t,"circle");if(g.setAttribute("cx",String(p)),g.setAttribute("cy",String(f)),g.setAttribute("r",String(v)),y.append(g),"g"in m){let $=o.createElementNS($t,"text");$.setAttribute("x",String(p)),$.setAttribute("y",String(f)),$.style.fontSize=`${(10/d).toFixed(2)}px`,$.textContent=m.g,y.append($)}else{let $=o.createElementNS($t,"use");$.setAttribute("href",t.iconHref(m.icon));let E=11/d;$.setAttribute("x",String(p-E/2)),$.setAttribute("y",String(f-E/2)),$.setAttribute("width",String(E)),$.setAttribute("height",String(E)),y.append($)}let b=o.createElementNS($t,"title");b.textContent=u,y.append(b),s(y)},l=(p,f)=>{for(let m of t.outlinesFor(p)){if(m.kind!=="poly")continue;let u=o.createElementNS($t,"polygon");u.setAttribute("class",f),u.setAttribute("points",m.points.map(([h,y])=>`${h.toFixed(1)},${y.toFixed(1)}`).join(" ")),s(u)}};for(let p of a){let f=t.boxOf(p.at);if(f){if(p.outline&&l(p.at,p.outline),p.badge)c(f.x,f.y,p.badge,p.title);else if(p.hit){let m=o.createElementNS($t,"title");m.textContent=p.title;let u=o.createElementNS($t,"rect");u.setAttribute("class","live-hit"),u.setAttribute("x",String(f.x)),u.setAttribute("y",String(f.y)),u.setAttribute("width",String(f.w)),u.setAttribute("height",String(f.h)),u.append(m),s(u)}if((p.beside??[]).forEach((m,u)=>c(f.x+18*(u+1)/d,f.y,m.glyph,m.title)),p.dot&&c(f.x,f.y+f.h,p.dot.glyph,p.dot.title),p.tag){let m=o.createElementNS($t,"text");m.setAttribute("class",`live-life ${p.tag.cls}`),m.setAttribute("x",String(f.x+f.w)),m.setAttribute("y",String(f.y+f.h)),m.style.fontSize=`${(9/d).toFixed(2)}px`,m.textContent=p.tag.text,s(m)}}}}function r(o,s,a){for(let d of a){let c=o.createElementNS($t,"g");c.setAttribute("class",`live-extra${d.cls}`);for(let[b,$]of d.data)c.setAttribute(b,$);let{x:l,y:p,w:f,hgt:m,k:u}=d.rect,h=o.createElementNS($t,"rect");h.setAttribute("x",String(l)),h.setAttribute("y",String(p)),h.setAttribute("width",String(f)),h.setAttribute("height",String(m)),h.setAttribute("rx",String(6/u));let y=o.createElementNS($t,"text");y.setAttribute("x",String(l+8/u)),y.setAttribute("y",String(p+13/u)),y.style.fontSize=`${(11/u).toFixed(2)}px`,y.textContent=d.line1;let v=o.createElementNS($t,"text");v.setAttribute("class","sub"),v.setAttribute("x",String(l+8/u)),v.setAttribute("y",String(p+27/u)),v.style.fontSize=`${(9/u).toFixed(2)}px`,v.textContent=d.line2;let g=o.createElementNS($t,"title");g.textContent=d.title,c.append(h,y,v,g),s(c)}}function i(o,s,a){let d=[];for(let c of a){let l=c.over,p=(l.x0+l.x1)/2,f=(l.y0+l.y1)/2,m=0,u={x0:0,y0:0,x1:0,y1:0};for(let _=0;_<6;_++){let K=l.z1+kt.above+m,Z=K+kt.h,Q=[Ue(p-kt.half,f+kt.t,K),Ue(p+kt.half,f+kt.t,K),Ue(p+kt.half,f-kt.t,Z),Ue(p-kt.half,f+kt.t,Z)];if(u={x0:Math.min(...Q.map(N=>N[0])),y0:Math.min(...Q.map(N=>N[1])),x1:Math.max(...Q.map(N=>N[0])),y1:Math.max(...Q.map(N=>N[1]))},!Io(u,d))break;m+=kt.lift}d.push(u);let h=l.z1+kt.above+m,y=h+kt.h,v=p-kt.half,g=p+kt.half,b=f+kt.t,$=f-kt.t,E=o.createElementNS($t,"g");E.setAttribute("class",`${e}-card${c.cls}`);for(let[_,K]of c.data)E.setAttribute(_,K);let[S,k]=Ue(p,f,l.z1+.15),T=`${S.toFixed(1)}px ${k.toFixed(1)}px`;E.style.transformOrigin=T;let z=o.createElementNS($t,"g");z.setAttribute("class",`${e}-float`),z.style.transformOrigin=T;let A=[];for(let _=Math.min(c.count-1,3);_>=1;_--){let K=_*kt.fan,Z=$-(_-1)*(2*kt.t+kt.gap)-kt.gap,Q=Z-2*kt.t,N=v+K,j=g+K,V=h+K,H=y+K,ae=(ue,J)=>{let te=o.createElementNS($t,"polygon");te.setAttribute("class",`${e}-face stacked ${ue}`),te.setAttribute("points",si(J)),z.append(te)};ae("s-top",[Ue(N,Q,H),Ue(j,Q,H),Ue(j,Z,H),Ue(N,Z,H)]),ae("s-side",[Ue(j,Q,V),Ue(j,Z,V),Ue(j,Z,H),Ue(j,Q,H)]),ae("s-front",[Ue(N,Z,V),Ue(j,Z,V),Ue(j,Z,H),Ue(N,Z,H)]),A.push({x0:N,x1:j,y0:Q,y1:Z,z0:V,z1:H})}let R=o.createElementNS($t,"polygon");R.setAttribute("class",`${e}-tail`),R.setAttribute("points",si([Ue(p-.5,b,h+.05),Ue(p+.5,b,h+.05),Ue(p,f,l.z1+.15)]));let x=(_,K)=>{let Z=o.createElementNS($t,"polygon");return Z.setAttribute("class",_),Z.setAttribute("points",si(K)),Z},P=x(`${e}-face front`,[Ue(v,b,h),Ue(g,b,h),Ue(g,b,y),Ue(v,b,y)]);z.append(R,x(`${e}-face top`,[Ue(v,$,y),Ue(g,$,y),Ue(g,b,y),Ue(v,b,y)]),x(`${e}-face side`,[Ue(g,$,h),Ue(g,b,h),Ue(g,b,y),Ue(g,$,y)]),P);let[w,I]=Ue(v,b,y),L=40,D=o.createElementNS($t,"g");D.setAttribute("transform",`matrix(${(Et*Qe/L).toFixed(4)} ${(.5*Qe/L).toFixed(4)} 0 ${(Qe/L).toFixed(4)} ${w.toFixed(1)} ${I.toFixed(1)})`);let G=(_,K,Z,Q)=>{let N=o.createElementNS($t,"text");return N.setAttribute("class",_),N.setAttribute("x",String(K)),N.setAttribute("y",String(Z)),N.textContent=Q,N};if(D.append(G(`${e}-mark`,34,98,c.mark),G(`${e}-who`,70,52,c.who),G(`${e}-age`,70,82,c.age)),c.line!==void 0&&D.append(G(`${e}-q`,12,118,c.line)),c.count>1){let _=o.createElementNS($t,"circle");_.setAttribute("class",`${e}-count-bg`),_.setAttribute("cx","178"),_.setAttribute("cy","14"),_.setAttribute("r","15"),D.append(_,G(`${e}-count`,178,14,String(c.count)))}z.append(D);let se=o.createElementNS($t,"title");se.textContent=c.title,E.append(z,se),t.onCard?.(E,{cx:p,cy:f,tipZ:l.z1+.15,card:{x0:v,x1:g,y0:$,y1:b,z0:h,z1:y},panes:A.reverse()}),s(E)}}return{paintMarks:n,paintGhosts:r,paintCards:i}}var Pp=[["scale","Scale"],["spin","Spin"],["dissolve","Dissolve"],["inflate","Inflate"]],Ap=[["none","None"],["jiggle","Jiggle"],["pirouette","Pirouette"],["glow","Glow"],["breathe","Breathe"]];function jd(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return(e>>>0)%1e3/1e3}var ul=t=>t<0?0:t>1?1:1-Math.pow(1-t,3),$p=t=>t<0?0:t>1?1:t*t*t,hl=Math.PI*2,yl={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}},gs={windup:220,turn:980,land:260};function Mp(t,e,{prefix:n,key:r,alt:i}){let o={...e},s=1,a=new Map,d=new WeakSet,c=0,l=0,p=new WeakMap,f=new WeakMap;function m(R){c=0;for(let[x,P]of a){if(!x.isConnected){a.delete(x);continue}let w;if(P.repeat){if(w=(R+(P.offset??0))%P.repeat/P.dur,w>1){d.has(x)&&(t.restore(x),d.delete(x),x.style.removeProperty("transform"));continue}}else if(w=(R-P.start)/P.dur,w>=1){u(x,P);continue}let I=P.frame(Math.max(0,w));t.spin(x,I.theta,I.lift),d.add(x),f.set(x,I),I.scale!==1?x.style.transform=`scale(${I.scale.toFixed(4)})`:x.style.removeProperty("transform"),l++}a.size&&(c=requestAnimationFrame(m))}function u(R,x){a.delete(R),d.has(R)&&(t.restore(R),d.delete(R)),R.style.removeProperty("transform"),x.done?.()}function h(R){let x=a.get(R.card);x&&u(R.card,x),a.set(R.card,R),c||(c=requestAnimationFrame(m))}let y=8,v=0,g=R=>(v++,R.finally(()=>{v--}));function b(R){return!o.enabled||v>=y?Promise.resolve():g(E(R))}function $(R){return!o.enabled||v>=y?Promise.resolve():g(S(R))}function E(R){let x=yl.appear[o.appear]/s;if(o.appear==="spin")return new Promise(I=>h({card:R,start:performance.now(),dur:x,frame:L=>({theta:(1-ul(L))*hl,lift:0,scale:Math.max(.001,ul(L))}),done:I}));let P=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(P,{duration:x,easing:o.appear==="inflate"?"linear":"ease-out"}).finished.then(()=>{},()=>{})}function S(R){let x=yl.disappear[o.appear]/s;if(o.appear==="spin")return new Promise(I=>h({card:R,start:performance.now(),dur:x,frame:L=>({theta:$p(L)*hl,lift:0,scale:Math.max(.001,1-$p(L))}),done:()=>{R.style.transform="scale(0)",I()}}));let P=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(P,{duration:x,easing:"ease-in",fill:"forwards"}).finished.then(()=>{},()=>{})}function k(R){p.get(R)?.cancel(),p.delete(R);let x=a.get(R);x?.repeat&&u(R,x)}function T(R,x){if(k(R),!o.enabled||o.idle==="none"||R.classList.contains("still"))return;let P=R.getAttribute(r)??R.getAttribute(i)??"",w=(x??yl.period[o.idle])/s,I=jd(P)*w;if(o.idle==="pirouette"){let _=(gs.windup+gs.turn+gs.land)/s,K=gs.windup/(gs.windup+gs.turn+gs.land),Z=(gs.windup+gs.turn)/(gs.windup+gs.turn+gs.land);h({card:R,start:0,dur:_,repeat:w,offset:I,frame:Q=>{if(Q<K)return{theta:-.35*Math.sin(Q/K*Math.PI/2),lift:0,scale:1};if(Q<Z){let j=(Q-K)/(Z-K);return{theta:-.35*(1-j)+ul(j)*hl,lift:.9*Math.sin(j*Math.PI),scale:1}}let N=(Q-Z)/(1-Z);return{theta:0,lift:0,scale:1-.04*Math.sin(N*Math.PI)}}});return}let L=R.querySelector(`.${n}-float`)??R,D=t.amber(),G=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 ${D})`},{filter:`drop-shadow(0 0 7px ${D})`},{filter:`drop-shadow(0 0 0px ${D})`}]:[{transform:"scale(1)"},{transform:"scale(1.035)"},{transform:"scale(1)"}],se=L.animate(G,{duration:w,iterations:1/0,easing:o.idle==="jiggle"?"linear":"ease-in-out"});se.startTime=(document.timeline.currentTime??0)-((document.timeline.currentTime??0)+I)%w,p.set(R,se)}function z(R,x,P,w,I=!1){I&&(w=!1);for(let[D,G]of x)!R.has(D)&&!I&&b(G),!p.has(G)&&!a.get(G)?.repeat&&T(G);if(!o.enabled||!w)return;let L=t.leavingLayer();if(L)for(let[D,G]of P){let se=R.get(D);!se||x.has(D)||(k(se),se.setAttribute("class",`${n}-leaving${G?" expired":""}`),se.removeAttribute(i),L.append(se),$(se).then(()=>se.remove()))}}function A(R){for(let[x,P]of[...a])u(x,P);c&&cancelAnimationFrame(c),c=0;for(let x of document.getAnimations())x.effect?.target?.closest?.(`.live-layer, .${n}-leaving-layer`)&&x.cancel();t.leavingLayer()?.replaceChildren()}return{get settings(){return{...o}},set(R,x){let P=o;if(o={...o,...R},(!o.enabled||P.idle!==o.idle||P.enabled!==o.enabled)&&(A(void 0),o.enabled))for(let w of x)T(w)},update:z,appear:b,disappear:$,startIdle:T,stopIdle:k,stopAll:A,async preview(R){o.enabled&&await Promise.all(R.map(async x=>{if(k(x),await b(x),o.idle!=="none"&&!x.classList.contains("still")){let P=o.idle==="pirouette"?1800:1400;T(x,P),await new Promise(w=>setTimeout(w,P*2.2/s)),k(x)}else await new Promise(P=>setTimeout(P,700/s));await $(x);for(let P of x.getAnimations())P.cancel();x.style.removeProperty("transform"),T(x)}))},get stats(){return{jobs:a.size,raf:!!c,frames:l,effects:v}},setSpeed(R){s=R},lastFrame:R=>f.get(R)}}var gl=t=>String(Math.round(t*100)/100),Op=(t,e={},...n)=>({name:t,attrs:Object.entries(e).map(([r,i])=>[r,typeof i=="number"?gl(i):i]),children:n});function bl(t,e){if(typeof t=="string")return t;let n=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,(s,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:n,children:t.children.map(r=>bl(r,e))}}function wl(t,e){if(typeof t=="string")return t;if(!e(t))return{...t,children:t.children.map(n=>wl(n,e)).filter(n=>n!==void 0)}}var Ep=t=>(t.attrs.find(e=>e[0]==="class")?.[1]??"").split(/\s+/),Rs=(t,e)=>t.attrs.find(n=>n[0]===e)?.[1];function Fo(t){let e=[],n=[],r=s=>{if(typeof s=="string")return;let a=Rs(s,"transform");if(a&&/matrix/.test(a))return;let d=Rs(s,"points");if(d)for(let c of d.trim().split(/\s+/)){let[l,p]=c.split(",").map(Number);Number.isFinite(l)&&Number.isFinite(p)&&(e.push(l),n.push(p))}if(s.name==="rect"){let c=Number(Rs(s,"x")),l=Number(Rs(s,"y")),p=Number(Rs(s,"width")),f=Number(Rs(s,"height"));[c,l,p,f].every(Number.isFinite)&&(e.push(c,c+p),n.push(l,l+f))}if(s.name==="circle"){let c=Number(Rs(s,"cx")),l=Number(Rs(s,"cy")),p=Number(Rs(s,"r"));[c,l,p].every(Number.isFinite)&&(e.push(c-p,c+p),n.push(l-p,l+p))}s.children.forEach(r)};if(t.forEach(r),!e.length)return;let i=Math.min(...e),o=Math.min(...n);return{x:i,y:o,w:Math.max(...e)-i,h:Math.max(...n)-o}}var jo=(t,e)=>{if(!e)return t;let n=Math.min(t.x,e.x),r=Math.min(t.y,e.y);return{x:n,y:r,w:Math.max(t.x+t.w,e.x+e.w)-n,h:Math.max(t.y+t.h,e.y+e.h)-r}};function Tp(t,e,n){let r=a=>Math.min((e.width-e.pad*2)/a.w,(e.height-e.pad*2)/a.h),i=r(t),o=n(i),s=jo(t,Fo(o));return i=r(s),o=n(i),s=jo(t,Fo(o)),i=r(s),{k:i,box:s,live:o}}var Np=t=>t.replace(/--([a-zA-Z][\w-]*)/g,"--iso-$1");function Bd(t){let e=[],n=0,r=t.replace(/\/\*[\s\S]*?\*\//g,"");for(;n<r.length;){let i=r.indexOf("{",n);if(i<0)break;let o=1,s=i+1;for(;s<r.length&&o;)r[s]==="{"?o++:r[s]==="}"&&o--,s++;e.push([r.slice(n,i).trim(),r.slice(i+1,s-1)]),n=s}return e}function Dd(t){let e=[],n=0,r=0;for(let i=0;i<t.length;i++){let o=t[i];o==="("||o==="["?n++:o===")"||o==="]"?n--:o===","&&!n&&(e.push(t.slice(r,i).trim()),r=i+1)}return e.push(t.slice(r).trim()),e.filter(Boolean)}function xl(t,e,n){let r=/^:root((?:\[[^\]]*\]|:not\([^)]*\))*)(.*)$/.exec(t),i=n.replace(/^\./,"");if(r){let o=r[1],s=r[2].trim();return`${o?`.${i}${o} `:""}${e}${s?" "+s:""}`}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 kl(t,e,n){let r="";for(let[i,o]of Bd(t)){if(i.startsWith("@keyframes")){r+=`@keyframes iso-${i.slice(10).trim()}{${o}}
283
- `;continue}if(i.startsWith("@media")||i.startsWith("@supports")){r+=`${i}{${kl(o,e,n)}}
284
- `;continue}if(i.startsWith("@"))throw new Error(`the canvas's CSS has an at-rule it can't scope: ${i}`);r+=`${Dd(i).map(s=>xl(s,e,n)).join(",")}{${o.replace(/\banimation:\s*([a-z][\w-]*)/g,"animation:iso-$1")}}
285
- `}return r}var Sl=["<","script"].join("");function Gs(t){return t?xt(t).replace(/`([^`]+)`/g,"<code>$1</code>").replace(/\*\*([^*]+)\*\*/g,"<b>$1</b>").replace(/(^|[^*])\*([^*\s][^*]*)\*/g,"$1<em>$2</em>").replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,(e,n,r)=>/^(https?:|#|\.{0,2}\/)/.test(r.replace(/&amp;/g,"&"))?`<a href="${r}">${n}</a>`:n):""}var vl=t=>(t??"").split(/\n\s*\n/).filter(Boolean).map(e=>`<p class="sec-sub">${Gs(e.trim())}</p>`).join("");function $l(t){return JSON.stringify({scenes:t.scenes.map(e=>({id:e.id,loop:e.raw.loop??!0,dim:e.raw.dim??"flows",vis:e.steps.vis,steps:e.steps.steps.map(n=>({...n,caption:Gs(n.caption)})),assemble:e.assemble,grid:!!e.grid.show,assembly:e.rendered.assembly}))})}function Pl(t,e){let n=t.theme,r=e.raw.legend;if(r===!1)return"";let i=Array.isArray(r)?r:e.steps.kindsUsed.filter(a=>e.routes.some(d=>d.kind===a)||e.steps.steps.some(d=>d.phases.some(c=>c.some(l=>l.kind===a)))),o=a=>`<span><i${a.box?' class="box"':""} style="${a.swatch}"></i>${a.label}</span>`,s=i.map(a=>{let d=vt(t.catalog,a)?.legend;if(d)return o(d);let c=n.kinds[a];return c?`<span><i style="${`border-color:${Vs(n,c.color)}${c.dash==="dashed"?";border-top-style:dashed":c.dash==="dotted"?";border-top-style:dotted":""}`}"></i>${Gs(c.legend)}</span>`:""});if(!Array.isArray(r)){let a=new Set(e.layout.items.map(d=>d.region?.kind));for(let[d,c]of Object.entries(t.catalog.regions))c.legend?.auto&&a.has(d)&&s.push(o(c.legend))}return s.join("")}function Vd(t){let e=t.steps.steps,n=`<div class="tools">
291
+ `;function Ec(t){return{name:"card",description:"A card: a slab with its name on its front face",size:[Fs.W,Fs.D,Fs.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 cd(t){let e=new Map(t.cards.map(s=>[s.id,{label:s.label,sub:s.sub}]));return{regions:{panel:{shape:"slab",pad:Fs.PAD,z:[Fs.PANEL_H,0],floor:!0,role:"grey",labelStyle:"floor"}},nodes:{card:Ec(s=>e.get(s))},defaultNode:"card"}}function pd(t,e={}){let s=Fs,{prect:r,parentIx:i,cardAt:o}=Wi(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=u=>Math.round(u*1e3)/1e3,m=u=>(u.cells[2]-u.cells[0]+1)*(u.cells[3]-u.cells[1]+1),p=u=>{let y=-1;return n.forEach((g,x)=>{let h=g.cells;u.cell[0]>=h[0]&&u.cell[0]<=h[2]&&u.cell[1]>=h[1]&&u.cell[1]<=h[3]&&(y<0||m(g)<=m(n[y]))&&(y=x)}),y},c=n.map((u,y)=>{let g=r[y],x=i[y]>=0?r[i[y]]:{l:0,t:0};return{id:u.id,kind:"panel",label:u.label,role:u.role,at:[a(g.l-x.l),a(g.t-x.t)],size:[a(g.r-g.l),a(g.b-g.t)],regions:[],nodes:[]}}),l=[],f=[];c.forEach((u,y)=>i[y]>=0?c[i[y]].regions.push(u):l.push(u));for(let u of t.cards){let[y,g]=o(t.cards.indexOf(u)),x=p(u),h=x>=0?r[x]:{l:0,t:0},b={id:u.id,asset:"card",role:u.role,ghost:u.ghost||void 0,at:[a(y-h.l),a(g-h.t)],size:[s.W,s.D,s.H]};(x>=0?c[x].nodes:f).push(b)}for(let u of c)u.regions.length||delete u.regions,u.nodes.length||delete u.nodes;let d=(t.links??[]).map((u,y)=>({id:u.id??`link-${y}`,from:u.aOn??u.a,to:u.bOn??u.b,kind:u.kind,label:u.label}));return{isodiag:1,title:e.title,kinds:e.kinds,roles:e.roles,scenes:[{id:"board",title:e.title??"board",regions:l,nodes:f,routes:d}]}}var Jd={};co(Jd,{APPEARS:()=>hd,BASE_FIELDS:()=>Vc,BINS:()=>vd,BIN_MS:()=>Rn,CARD:()=>vt,DUAL_VIEW_CSS:()=>Wd,IDLES:()=>yd,MAX_ZOOM:()=>Da,MIN_ZOOM:()=>Fa,P3:()=>st,SEGMENT_NAME:()=>Va,SEVERITIES:()=>mn,TIMELINE_VERSION:()=>Sd,activityOf:()=>Hc,attr:()=>Wn,binNext:()=>Ha,binStart:()=>sr,buildLayer:()=>no,cardMotion:()=>gd,clamp:()=>Ss,cls:()=>wd,crumbs:()=>Ur,dualView:()=>Ud,ease:()=>to,escapeName:()=>Za,extent:()=>Ba,findGaps:()=>Wa,fitWithOverlay:()=>xd,flatCss:()=>qd,flatSvg:()=>nl,formatScope:()=>Md,gapKey:()=>ir,gapLabel:()=>rr,h:()=>me,hasSegment:()=>Ad,highlights:()=>Qi,isZone:()=>Nd,isoVars:()=>kd,join:()=>Pd,kindOf:()=>Gr,legend:()=>qc,levelOf:()=>Jt,markConnectors:()=>il,md:()=>fs,measureIn:()=>sl,memorySource:()=>jd,modeFor:()=>Yc,morphSvgs:()=>Zd,mountTimeline:()=>Dd,n:()=>zc,nameOf:()=>Zr,node:()=>bd,offsetAt:()=>tn,overlayPaint:()=>md,parentOf:()=>Od,prefixAt:()=>$s,prune:()=>jc,pts:()=>Ji,rangeOf:()=>Xi,readTime:()=>Kc,rectOf:()=>Vd,renderPage:()=>$d,rewrite:()=>Cc,scope:()=>_c,scopePattern:()=>Ka,scopeRules:()=>Ga,scopeSelector:()=>Lc,searchFor:()=>Yr,severities:()=>Td,stepData:()=>Bc,storedMode:()=>Yd,ticks:()=>Ja,timeScale:()=>Hr,toCSV:()=>Qa,toJSON:()=>Xa,unite:()=>qa,viewToggle:()=>Hd,viewport:()=>dd,within:()=>un});function th(t,e,s){let i=(a,m,p,c,l)=>Math.min((a-48)/(p-m),...c===void 0||l===void 0?[]:[[l-c,12],[l-m,30],[p-c,30]].map(([f,d])=>f>0?(a-d)/f:1/0)),o=Math.min(Da,Math.max(Fa,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,m,p,c,l)=>{let f=(m+p)/2;if(c===void 0||l===void 0)return f;let d=l-(a/2-6)/o,u=c+(a/2-6)/o;return d>u?(d+u)/2:Math.max(d,Math.min(u,f))};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 Fa=.1,Da=8;function dd(t,e){let s,r,i=!1,o=0,n=0,a=0,m=0,p=0,c=!1,l=()=>{let v=t.getBoundingClientRect();return{w:Math.max(1,v.width),h:Math.max(1,v.height)}},f=(v=s)=>{let T=l();return Math.min(T.w/v.w,T.h/v.h)},d=v=>{o++;try{v()}finally{o--}};function u(){let v=e.svg();if(!v||!s)return;o||(i=!0);let T=l(),R=f(),O=T.w/R,I=T.h/R;s={x:s.x+(s.w-O)/2,y:s.y+(s.h-I)/2,w:O,h:I},v.setAttribute("viewBox",`${s.x.toFixed(2)} ${s.y.toFixed(2)} ${s.w.toFixed(2)} ${s.h.toFixed(2)}`),n=R,e.onApply(R),a&&Math.abs(R/a-1)>.02&&(cancelAnimationFrame(m),m=requestAnimationFrame(()=>{m=0,e.onRezoom()}))}let y=(v,T)=>{let R=t.getBoundingClientRect(),O=f();return{x:s.x+(v-R.left)/O,y:s.y+(T-R.top)/O}};function g(v,T,R){if(!s)return;let O=f(),I=Math.min(Da,Math.max(Fa,O*v)),M=t.getBoundingClientRect(),A=T??M.left+M.width/2,P=R??M.top+M.height/2,j=y(A,P),F=l();s={x:j.x-(A-M.left)/I,y:j.y-(P-M.top)/I,w:F.w/I,h:F.h/I},u()}function x(v=r,T){if(!v)return;let R=l(),{k:O,cx:I,cy:M}=th(R,v,T),A={x:I-R.w/O/2,y:M-R.h/O/2,w:R.w/O,h:R.h/O};if(s&&Math.abs(A.w/s.w-1)<.001&&Math.abs(A.h/s.h-1)<.001&&Math.abs(A.x-s.x)<A.w*.001&&Math.abs(A.y-s.y)<A.h*.001){u();return}s=A,u()}function h(){for(let v=0,T="";v<4;v++){let R=e.itemsBox()??r;if(!R)return;let O=[R.x,R.y,R.w,R.h].map(M=>Math.round(M)).join();if(O===T)break;T=O;let I=Math.max(24,Math.min(R.w,R.h)*.06);if(d(()=>x({x:R.x-I,y:R.y-I,w:R.w+I*2,h:R.h+I*2},e.alsoBox?.())),!e.marksShowing()||!a||Math.abs(f()/a-1)<=.02)break;cancelAnimationFrame(m),m=0,e.onRezoom()}i=!1}function b(){if(i||!e.svg()||!s)return;let v=t.getBoundingClientRect();v.width<2||v.height<2||h()}function w(){if(!s)return;let v=f();g(1/v)}function k(){return new Promise(v=>{let T=0,R=n,O=()=>{if(c){v();return}let I=!!(m||p)||n!==R;R=n,T=I?0:T+1,T>=2?v():requestAnimationFrame(O)};requestAnimationFrame(O)})}let $=new ResizeObserver(()=>{if(!(!s||c)){if(i&&n){let v=l(),T=s.x+s.w/2,R=s.y+s.h/2;s={x:T-v.w/n/2,y:R-v.h/n/2,w:v.w/n,h:v.h/n}}i||(cancelAnimationFrame(p),p=requestAnimationFrame(()=>{p=0,c||b()})),d(u)}});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:f,quietly:d,applyView:u,toSvg:y,zoomAt:g,fit:x,fitItems:h,autoFit:b,actual:w,settled:k,dispose(){cancelAnimationFrame(p),cancelAnimationFrame(m),$.disconnect(),c=!0}}}var At="http://www.w3.org/2000/svg",vt={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],Ji=t=>t.map(([e,s])=>`${e.toFixed(1)},${s.toFixed(1)}`).join(" ");function md(t,e){function s(o,n,a){let m=t.k(),p=(l,f,d,u,y="")=>{let g=o.createElementNS(At,"g");g.setAttribute("class",`live-badge ${d.cls} ${y}`.trim());let x=8/m,h=o.createElementNS(At,"circle");if(h.setAttribute("cx",String(l)),h.setAttribute("cy",String(f)),h.setAttribute("r",String(x)),g.append(h),"g"in d){let w=o.createElementNS(At,"text");w.setAttribute("x",String(l)),w.setAttribute("y",String(f)),w.style.fontSize=`${(10/m).toFixed(2)}px`,w.textContent=d.g,g.append(w)}else{let w=o.createElementNS(At,"use");w.setAttribute("href",t.iconHref(d.icon));let k=11/m;w.setAttribute("x",String(l-k/2)),w.setAttribute("y",String(f-k/2)),w.setAttribute("width",String(k)),w.setAttribute("height",String(k)),g.append(w)}let b=o.createElementNS(At,"title");b.textContent=u,g.append(b),n(g)},c=(l,f)=>{for(let d of t.outlinesFor(l)){if(d.kind!=="poly")continue;let u=o.createElementNS(At,"polygon");u.setAttribute("class",f),u.setAttribute("points",d.points.map(([y,g])=>`${y.toFixed(1)},${g.toFixed(1)}`).join(" ")),n(u)}};for(let l of a){let f=t.boxOf(l.at);if(f){if(l.outline&&c(l.at,l.outline),l.badge)p(f.x,f.y,l.badge,l.title);else if(l.hit){let d=o.createElementNS(At,"title");d.textContent=l.title;let u=o.createElementNS(At,"rect");u.setAttribute("class","live-hit"),u.setAttribute("x",String(f.x)),u.setAttribute("y",String(f.y)),u.setAttribute("width",String(f.w)),u.setAttribute("height",String(f.h)),u.append(d),n(u)}if((l.beside??[]).forEach((d,u)=>p(f.x+18*(u+1)/m,f.y,d.glyph,d.title)),l.dot&&p(f.x,f.y+f.h,l.dot.glyph,l.dot.title),l.tag){let d=o.createElementNS(At,"text");d.setAttribute("class",`live-life ${l.tag.cls}`),d.setAttribute("x",String(f.x+f.w)),d.setAttribute("y",String(f.y+f.h)),d.style.fontSize=`${(9/m).toFixed(2)}px`,d.textContent=l.tag.text,n(d)}}}}function r(o,n,a){for(let m of a){let p=o.createElementNS(At,"g");p.setAttribute("class",`live-extra${m.cls}`);for(let[b,w]of m.data)p.setAttribute(b,w);let{x:c,y:l,w:f,hgt:d,k:u}=m.rect,y=o.createElementNS(At,"rect");y.setAttribute("x",String(c)),y.setAttribute("y",String(l)),y.setAttribute("width",String(f)),y.setAttribute("height",String(d)),y.setAttribute("rx",String(6/u));let g=o.createElementNS(At,"text");g.setAttribute("x",String(c+8/u)),g.setAttribute("y",String(l+13/u)),g.style.fontSize=`${(11/u).toFixed(2)}px`,g.textContent=m.line1;let x=o.createElementNS(At,"text");x.setAttribute("class","sub"),x.setAttribute("x",String(c+8/u)),x.setAttribute("y",String(l+27/u)),x.style.fontSize=`${(9/u).toFixed(2)}px`,x.textContent=m.line2;let h=o.createElementNS(At,"title");h.textContent=m.title,p.append(y,g,x,h),n(p)}}function i(o,n,a){let m=[];for(let p of a){let c=p.over,l=(c.x0+c.x1)/2,f=(c.y0+c.y1)/2,d=0,u={x0:0,y0:0,x1:0,y1:0};for(let C=0;C<6;C++){let G=c.z1+vt.above+d,Z=G+vt.h,Q=[st(l-vt.half,f+vt.t,G),st(l+vt.half,f+vt.t,G),st(l+vt.half,f-vt.t,Z),st(l-vt.half,f+vt.t,Z)];if(u={x0:Math.min(...Q.map(z=>z[0])),y0:Math.min(...Q.map(z=>z[1])),x1:Math.max(...Q.map(z=>z[0])),y1:Math.max(...Q.map(z=>z[1]))},!ja(u,m))break;d+=vt.lift}m.push(u);let y=c.z1+vt.above+d,g=y+vt.h,x=l-vt.half,h=l+vt.half,b=f+vt.t,w=f-vt.t,k=o.createElementNS(At,"g");k.setAttribute("class",`${e}-card${p.cls}`);for(let[C,G]of p.data)k.setAttribute(C,G);let[$,v]=st(l,f,c.z1+.15),T=`${$.toFixed(1)}px ${v.toFixed(1)}px`;k.style.transformOrigin=T;let R=o.createElementNS(At,"g");R.setAttribute("class",`${e}-float`),R.style.transformOrigin=T;let O=[];for(let C=Math.min(p.count-1,3);C>=1;C--){let G=C*vt.fan,Z=w-(C-1)*(2*vt.t+vt.gap)-vt.gap,Q=Z-2*vt.t,z=x+G,D=h+G,V=y+G,W=g+G,de=(ce,H)=>{let ne=o.createElementNS(At,"polygon");ne.setAttribute("class",`${e}-face stacked ${ce}`),ne.setAttribute("points",Ji(H)),R.append(ne)};de("s-top",[st(z,Q,W),st(D,Q,W),st(D,Z,W),st(z,Z,W)]),de("s-side",[st(D,Q,V),st(D,Z,V),st(D,Z,W),st(D,Q,W)]),de("s-front",[st(z,Z,V),st(D,Z,V),st(D,Z,W),st(z,Z,W)]),O.push({x0:z,x1:D,y0:Q,y1:Z,z0:V,z1:W})}let I=o.createElementNS(At,"polygon");I.setAttribute("class",`${e}-tail`),I.setAttribute("points",Ji([st(l-.5,b,y+.05),st(l+.5,b,y+.05),st(l,f,c.z1+.15)]));let M=(C,G)=>{let Z=o.createElementNS(At,"polygon");return Z.setAttribute("class",C),Z.setAttribute("points",Ji(G)),Z},A=M(`${e}-face front`,[st(x,b,y),st(h,b,y),st(h,b,g),st(x,b,g)]);R.append(I,M(`${e}-face top`,[st(x,w,g),st(h,w,g),st(h,b,g),st(x,b,g)]),M(`${e}-face side`,[st(h,w,y),st(h,b,y),st(h,b,g),st(h,w,g)]),A);let[P,j]=st(x,b,g),F=40,Y=o.createElementNS(At,"g");Y.setAttribute("transform",`matrix(${(Ct*lt/F).toFixed(4)} ${(.5*lt/F).toFixed(4)} 0 ${(lt/F).toFixed(4)} ${P.toFixed(1)} ${j.toFixed(1)})`);let J=(C,G,Z,Q)=>{let z=o.createElementNS(At,"text");return z.setAttribute("class",C),z.setAttribute("x",String(G)),z.setAttribute("y",String(Z)),z.textContent=Q,z};if(Y.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&&Y.append(J(`${e}-q`,12,118,p.line)),p.count>1){let C=o.createElementNS(At,"circle");C.setAttribute("class",`${e}-count-bg`),C.setAttribute("cx","178"),C.setAttribute("cy","14"),C.setAttribute("r","15"),Y.append(C,J(`${e}-count`,178,14,String(p.count)))}R.append(Y);let U=o.createElementNS(At,"title");U.textContent=p.title,k.append(R,U),t.onCard?.(k,{cx:l,cy:f,tipZ:c.z1+.15,card:{x0:x,x1:h,y0:w,y1:b,z0:y,z1:g},panes:O.reverse()}),n(k)}}return{paintMarks:s,paintGhosts:r,paintCards:i}}var hd=[["scale","Scale"],["spin","Spin"],["dissolve","Dissolve"],["inflate","Inflate"]],yd=[["none","None"],["jiggle","Jiggle"],["pirouette","Pirouette"],["glow","Glow"],["breathe","Breathe"]];function nh(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 Nc=t=>t<0?0:t>1?1:1-Math.pow(1-t,3),ud=t=>t<0?0:t>1?1:t*t*t,Rc=Math.PI*2,Ic={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}},Nn={windup:220,turn:980,land:260};function gd(t,e,{prefix:s,key:r,alt:i}){let o={...e},n=1,a=new Map,m=new WeakSet,p=0,c=0,l=new WeakMap,f=new WeakMap;function d(I){p=0;for(let[M,A]of a){if(!M.isConnected){a.delete(M);continue}let P;if(A.repeat){if(P=(I+(A.offset??0))%A.repeat/A.dur,P>1){m.has(M)&&(t.restore(M),m.delete(M),M.style.removeProperty("transform"));continue}}else if(P=(I-A.start)/A.dur,P>=1){u(M,A);continue}let j=A.frame(Math.max(0,P));t.spin(M,j.theta,j.lift),m.add(M),f.set(M,j),j.scale!==1?M.style.transform=`scale(${j.scale.toFixed(4)})`:M.style.removeProperty("transform"),c++}a.size&&(p=requestAnimationFrame(d))}function u(I,M){a.delete(I),m.has(I)&&(t.restore(I),m.delete(I)),I.style.removeProperty("transform"),M.done?.()}function y(I){let M=a.get(I.card);M&&u(I.card,M),a.set(I.card,I),p||(p=requestAnimationFrame(d))}let g=8,x=0,h=I=>(x++,I.finally(()=>{x--}));function b(I){return!o.enabled||x>=g?Promise.resolve():h(k(I))}function w(I){return!o.enabled||x>=g?Promise.resolve():h($(I))}function k(I){let M=Ic.appear[o.appear]/n;if(o.appear==="spin")return new Promise(j=>y({card:I,start:performance.now(),dur:M,frame:F=>({theta:(1-Nc(F))*Rc,lift:0,scale:Math.max(.001,Nc(F))}),done:j}));let A=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 I.animate(A,{duration:M,easing:o.appear==="inflate"?"linear":"ease-out"}).finished.then(()=>{},()=>{})}function $(I){let M=Ic.disappear[o.appear]/n;if(o.appear==="spin")return new Promise(j=>y({card:I,start:performance.now(),dur:M,frame:F=>({theta:ud(F)*Rc,lift:0,scale:Math.max(.001,1-ud(F))}),done:()=>{I.style.transform="scale(0)",j()}}));let A=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 I.animate(A,{duration:M,easing:"ease-in",fill:"forwards"}).finished.then(()=>{},()=>{})}function v(I){l.get(I)?.cancel(),l.delete(I);let M=a.get(I);M?.repeat&&u(I,M)}function T(I,M){if(v(I),!o.enabled||o.idle==="none"||I.classList.contains("still"))return;let A=I.getAttribute(r)??I.getAttribute(i)??"",P=(M??Ic.period[o.idle])/n,j=nh(A)*P;if(o.idle==="pirouette"){let C=(Nn.windup+Nn.turn+Nn.land)/n,G=Nn.windup/(Nn.windup+Nn.turn+Nn.land),Z=(Nn.windup+Nn.turn)/(Nn.windup+Nn.turn+Nn.land);y({card:I,start:0,dur:C,repeat:P,offset:j,frame:Q=>{if(Q<G)return{theta:-.35*Math.sin(Q/G*Math.PI/2),lift:0,scale:1};if(Q<Z){let D=(Q-G)/(Z-G);return{theta:-.35*(1-D)+Nc(D)*Rc,lift:.9*Math.sin(D*Math.PI),scale:1}}let z=(Q-Z)/(1-Z);return{theta:0,lift:0,scale:1-.04*Math.sin(z*Math.PI)}}});return}let F=I.querySelector(`.${s}-float`)??I,Y=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 ${Y})`},{filter:`drop-shadow(0 0 7px ${Y})`},{filter:`drop-shadow(0 0 0px ${Y})`}]:[{transform:"scale(1)"},{transform:"scale(1.035)"},{transform:"scale(1)"}],U=F.animate(J,{duration:P,iterations:1/0,easing:o.idle==="jiggle"?"linear":"ease-in-out"});U.startTime=(document.timeline.currentTime??0)-((document.timeline.currentTime??0)+j)%P,l.set(I,U)}function R(I,M,A,P,j=!1){j&&(P=!1);for(let[Y,J]of M)!I.has(Y)&&!j&&b(J),!l.has(J)&&!a.get(J)?.repeat&&T(J);if(!o.enabled||!P)return;let F=t.leavingLayer();if(F)for(let[Y,J]of A){let U=I.get(Y);!U||M.has(Y)||(v(U),U.setAttribute("class",`${s}-leaving${J?" expired":""}`),U.removeAttribute(i),F.append(U),w(U).then(()=>U.remove()))}}function O(I){for(let[M,A]of[...a])u(M,A);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(I,M){let A=o;if(o={...o,...I},(!o.enabled||A.idle!==o.idle||A.enabled!==o.enabled)&&(O(void 0),o.enabled))for(let P of M)T(P)},update:R,appear:b,disappear:w,startIdle:T,stopIdle:v,stopAll:O,async preview(I){o.enabled&&await Promise.all(I.map(async M=>{if(v(M),await b(M),o.idle!=="none"&&!M.classList.contains("still")){let A=o.idle==="pirouette"?1800:1400;T(M,A),await new Promise(P=>setTimeout(P,A*2.2/n)),v(M)}else await new Promise(A=>setTimeout(A,700/n));await w(M);for(let A of M.getAnimations())A.cancel();M.style.removeProperty("transform"),T(M)}))},get stats(){return{jobs:a.size,raf:!!p,frames:c,effects:x}},setSpeed(I){n=I},lastFrame:I=>f.get(I)}}var zc=t=>String(Math.round(t*100)/100),bd=(t,e={},...s)=>({name:t,attrs:Object.entries(e).map(([r,i])=>[r,typeof i=="number"?zc(i):i]),children:s});function Cc(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=>Cc(r,e))}}function jc(t,e){if(typeof t=="string")return t;if(!e(t))return{...t,children:t.children.map(s=>jc(s,e)).filter(s=>s!==void 0)}}var wd=t=>(t.attrs.find(e=>e[0]==="class")?.[1]??"").split(/\s+/),Wn=(t,e)=>t.attrs.find(s=>s[0]===e)?.[1];function Ba(t){let e=[],s=[],r=n=>{if(typeof n=="string")return;let a=Wn(n,"transform");if(a&&/matrix/.test(a))return;let m=Wn(n,"points");if(m)for(let p of m.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(Wn(n,"x")),c=Number(Wn(n,"y")),l=Number(Wn(n,"width")),f=Number(Wn(n,"height"));[p,c,l,f].every(Number.isFinite)&&(e.push(p,p+l),s.push(c,c+f))}if(n.name==="circle"){let p=Number(Wn(n,"cx")),c=Number(Wn(n,"cy")),l=Number(Wn(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 qa=(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 xd(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=qa(t,Ba(o));return i=r(n),o=s(i),n=qa(t,Ba(o)),i=r(n),{k:i,box:n,live:o}}var kd=t=>t.replace(/--([a-zA-Z][\w-]*)/g,"--iso-$1");function sh(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 rh(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 Lc(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 _c(t,e,s){let r="";for(let[i,o]of sh(t)){if(i.startsWith("@keyframes")){r+=`@keyframes iso-${i.slice(10).trim()}{${o}}
292
+ `;continue}if(i.startsWith("@media")||i.startsWith("@supports")){r+=`${i}{${_c(o,e,s)}}
293
+ `;continue}if(i.startsWith("@"))throw new Error(`the canvas's CSS has an at-rule it can't scope: ${i}`);r+=`${rh(i).map(n=>Lc(n,e,s)).join(",")}{${o.replace(/\banimation:\s*([a-z][\w-]*)/g,"animation:iso-$1")}}
294
+ `}return r}var Fc=["<","script"].join("");function fs(t){return t?St(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 Dc=t=>(t??"").split(/\n\s*\n/).filter(Boolean).map(e=>`<p class="sec-sub">${fs(e.trim())}</p>`).join("");function Bc(t){return JSON.stringify({scenes:t.scenes.map(e=>({id:e.id,loop:e.raw.loop??!0,dim:e.raw.dim??"flows",vis:e.steps.vis,steps:e.steps.steps.map(s=>({...s,caption:fs(s.caption)})),assemble:e.assemble,grid:!!e.grid.show,motion:js(e)}))})}function qc(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(m=>m.kind===a)||e.steps.steps.some(m=>m.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 m=Pt(t.catalog,a)?.legend;if(m)return o(m);let p=s.kinds[a];return p?`<span><i style="${`border-color:${as(s,p.color)}${p.dash==="dashed"?";border-top-style:dashed":p.dash==="dotted"?";border-top-style:dotted":""}`}"></i>${fs(p.legend)}</span>`:""});if(!Array.isArray(r)){let a=new Set(e.layout.items.map(m=>m.region?.kind));for(let[m,p]of Object.entries(t.catalog.regions))p.legend?.auto&&a.has(m)&&n.push(o(p.legend))}return n.join("")}function ih(t){let e=t.steps.steps,s=`<div class="tools">
286
295
  <button class="pbtn small" type="button" data-a="grid" aria-pressed="${t.grid.show?"true":"false"}" title="Show the floor grid">Grid</button>
287
296
  <button class="pbtn small" type="button" data-a="assemble" title="Draw the diagram again, piece by piece">Assemble</button>
288
- </div>`;if(!e.length)return`<div class="player">${n}</div>`;let r=e[0];return`<div class="player">
297
+ </div>`;if(!e.length)return`<div class="player">${s}</div>`;let r=e[0];return`<div class="player">
289
298
  <div class="ctrls">
290
299
  <button class="pbtn icon" type="button" data-a="prev" aria-label="Previous step">\u2039</button>
291
300
  <button class="pbtn primary" type="button" data-a="play" aria-label="Play">\u25B6 Play</button>
292
301
  <button class="pbtn icon" type="button" data-a="next" aria-label="Next step">\u203A</button>
293
302
  </div>
294
- ${n}
303
+ ${s}
295
304
  <div class="cap" aria-live="polite">
296
- <div class="cap-h"><span class="num" style="background:${r.color}">${r.num}</span><span class="h">${xt(r.heading)}</span><span class="cnt">1 / ${e.length}</span></div>
297
- <p class="cap-t">${Gs(r.caption)}</p>
298
- <pre class="cap-c">${xt(r.command)}</pre>
305
+ <div class="cap-h"><span class="num" style="background:${r.color}">${r.num}</span><span class="h">${St(r.heading)}</span><span class="cnt">1 / ${e.length}</span></div>
306
+ <p class="cap-t">${fs(r.caption)}</p>
307
+ <pre class="cap-c">${St(r.command)}</pre>
299
308
  <div class="prog"><i></i></div>
300
309
  </div>
301
310
  <div class="dots"></div>
302
- </div>`}function Kd(t){let e=t.steps.steps;return e.length?`<details class="steps"><summary>All ${e.length} steps as text</summary><ol>${e.map(n=>`<li value="${n.num}"><b>${xt(n.heading)}.</b> ${Gs(n.caption)}${n.command?`<br><code>${xt(n.command)}</code>`:""}</li>`).join("")}</ol></details>`:""}function Rp(t,e={}){let n=t.doc,r=n.title??n.scenes[0]?.title??"Diagram",i=(n.pills??[]).map(s=>`<span class="pill">${Gs(s)}</span>`).join(""),o=t.scenes.map(s=>`
303
- <section class="scene" id="scene-${xt(s.id)}">
304
- <h2>${xt(s.raw.title)}</h2>
305
- ${vl(s.raw.caption)}
311
+ </div>`}function oh(t){let e=t.steps.steps;return e.length?`<details class="steps"><summary>All ${e.length} steps as text</summary><ol>${e.map(s=>`<li value="${s.num}"><b>${St(s.heading)}.</b> ${fs(s.caption)}${s.command?`<br><code>${St(s.command)}</code>`:""}</li>`).join("")}</ol></details>`:""}function $d(t,e={}){let s=t.doc,r=s.title??s.scenes[0]?.title??"Diagram",i=(s.pills??[]).map(n=>`<span class="pill">${fs(n)}</span>`).join(""),o=t.scenes.map(n=>`
312
+ <section class="scene" id="scene-${St(n.id)}">
313
+ <h2>${St(n.raw.title)}</h2>
314
+ ${Dc(n.raw.caption)}
306
315
  <div class="figure" tabindex="-1">
307
- <div class="scroller">${s.grid.show?s.rendered.svg.replace("<svg ",'<svg class="show-grid" '):s.rendered.svg}</div>
308
- ${Vd(s)}
309
- <div class="legend">${Pl(t,s)}</div>
316
+ <div class="scroller">${n.grid.show?n.rendered.svg.replace("<svg ",'<svg class="show-grid" '):n.rendered.svg}</div>
317
+ ${ih(n)}
318
+ <div class="legend">${qc(t,n)}</div>
310
319
  </div>
311
- ${Kd(s)}
312
- ${s.raw.after?`<div class="after">${vl(s.raw.after)}</div>`:""}
320
+ ${oh(n)}
321
+ ${n.raw.after?`<div class="after">${Dc(n.raw.after)}</div>`:""}
313
322
  </section>`).join(`
314
323
  `);return`<!doctype html>
315
324
  <html lang="en">
316
325
  <head>
317
326
  <meta charset="utf-8">
318
327
  <meta name="viewport" content="width=device-width, initial-scale=1">
319
- <title>${xt(r)}</title>
320
- ${n.lede?`<meta name="description" content="${xt(n.lede)}">`:""}
328
+ <title>${St(r)}</title>
329
+ ${s.lede?`<meta name="description" content="${St(s.lede)}">`:""}
321
330
  <style>
322
- ${so(t.theme)}${ar(t.catalog)}${No}
331
+ ${Qo(t.theme)}${Vr(t.catalog)}${za}
323
332
  </style>
324
333
  ${e.extraHead??""}
325
334
  </head>
@@ -327,17 +336,17 @@ ${e.extraHead??""}
327
336
  <div class="wrap">
328
337
  <header class="page">
329
338
  <div>
330
- <h1>${xt(r)}</h1>
331
- ${n.lede?`<p class="lede">${Gs(n.lede)}</p>`:""}
339
+ <h1>${St(r)}</h1>
340
+ ${s.lede?`<p class="lede">${fs(s.lede)}</p>`:""}
332
341
  </div>
333
342
  <div class="pills">${i}<button class="theme" id="themeBtn" type="button">Theme</button></div>
334
343
  </header>
335
344
  ${o}
336
- ${n.after?vl(n.after):""}
337
- ${n.footer?`<footer>${Gs(n.footer)}</footer>`:""}
345
+ ${s.after?Dc(s.after):""}
346
+ ${s.footer?`<footer>${fs(s.footer)}</footer>`:""}
338
347
  </div>
339
- ${Sl} type="application/json" id="diagram-steps">${$l(t).replace(/</g,"\\u003c")}<\/script>
340
- ${Sl}>
348
+ ${Fc} type="application/json" id="diagram-steps">${Bc(t).replace(/</g,"\\u003c")}<\/script>
349
+ ${Fc}>
341
350
  (function(){
342
351
  var root=document.documentElement, m=/theme=(light|dark)/.exec(location.hash);
343
352
  try{var t=localStorage.getItem('diagram-theme'); if(t) root.dataset.theme=t;}catch(e){}
@@ -349,14 +358,14 @@ ${Sl}>
349
358
  });
350
359
  })();
351
360
  <\/script>
352
- ${e.runtime?`${Sl}>${e.runtime}<\/script>`:""}
361
+ ${e.runtime?`${Fc}>${e.runtime}<\/script>`:""}
353
362
  ${e.extraBody??""}
354
363
  </body>
355
364
  </html>
356
- `}function X(t,e=null,...n){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[s,a]of Object.entries(o))r.addEventListener(s,a);else r.setAttribute(i,o===!0?"":String(o));for(let i of n)i!=null&&i!==!1&&r.append(i instanceof Node?i:document.createTextNode(String(i)));return r}var Ip=1,Bo="(?:[^/:%\\s]|%[0-9A-F]{2})+",ns=["debug","info","notice","warning","error"],zp=["1m","1h","1d"],bs={"1m":6e4,"1h":36e5,"1d":864e5},Do=t=>`^(?:(?:${t.kinds.join("|")}):(?:${Bo})(?:/(?:${t.kinds.join("|")}):(?:${Bo}))*)?$`;function Vo(t){let e=new RegExp(Do(t)),n=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(s=>{let a=s.indexOf(":");return{kind:s.slice(0,a),name:decodeURIComponent(s.slice(a+1))}})}function i(o){let s="";for(let a of r(o)){if(!t.parents[a.kind].includes(s))return!1;s=a.kind}return!0}return{isScope:n,parseScope:r,wellNested:i}}var Ko=t=>t.replace(/[%/:\s]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`),Cp=t=>t.map(e=>`${e.kind}:${Ko(e.name)}`).join("/"),Lp=(t,e,n)=>(t?`${t}/`:"")+`${e}:${Ko(n)}`,qt=t=>t===""?0:t.split("/").length;function nn(t,e){return e<=0?"":(t===""?[]:t.split("/")).slice(0,e).join("/")}var _p=t=>nn(t,qt(t)-1),rs=(t,e)=>e===""||t===e||t.startsWith(`${e}/`),Fp=(t,e)=>t!==""&&t.split("/").includes(e),cr=t=>t===""?"fleet":t.slice(t.lastIndexOf("/")+1).split(":")[0],pr=t=>t===""?"all hosts":decodeURIComponent(t.slice(t.lastIndexOf("/")+1).split(":").slice(1).join(":"));function fr(t){let e=[{scope:"",label:"all hosts",kind:"fleet"}];for(let n=1;n<=qt(t);n++){let r=nn(t,n);e.push({scope:r,label:pr(r),kind:cr(r)})}return e}var Al=["kind","source","severity","scope","since","before"];function qd(t){let e=[],n=0;for(;n<t.length;){for(;n<t.length&&/\s/.test(t[n]);)n++;if(n>=t.length)break;let r=!1;t[n]==="-"&&n+1<t.length&&!/\s/.test(t[n+1])&&(r=!0,n++);let i=/^(attr\.[a-z][a-z0-9_]*|[a-z]+):/.exec(t.slice(n)),o;i&&(o=i[1],n+=i[0].length);let s="",a=!1;if(t[n]==='"'){let d=t.indexOf('"',n+1);s=t.slice(n+1,d<0?t.length:d),a=!0,n=d<0?t.length:d+1}else{let d=n;for(;n<t.length&&!/\s/.test(t[n]);)n++;s=t.slice(d,n)}e.push({neg:r,raw:s,quoted:a,field:o})}return e}var Gd=/^(\d+)(s|m|h|d|w)$/,Zd={s:1e3,m:6e4,h:36e5,d:864e5,w:7*864e5};function Ml(t,e){let n=Gd.exec(t);if(n)return e-Number(n[1])*Zd[n[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,s,a="0",d="0",c="0",l="0",p]=r;if(p){let m=Date.parse(t.replace(" ","T"));return Number.isNaN(m)?void 0:m}let f=new Date(+i,+o-1,+s,+a,+d,+c,+l.padEnd(3,"0")).getTime();return Number.isNaN(f)?void 0:f}function Ud(t,e,n=Date.now()){let r=[],i=[];for(let o of qd(e??"")){let s=c=>{let l=o.field?`${o.field}:${o.raw}`:o.raw;c&&i.push(`${JSON.stringify(l)}: ${c}; searched as text`),l&&r.push({neg:o.neg,value:l})};if(!o.field){s();continue}if(!(t.includes(o.field)||o.field.startsWith("attr."))){s(`no field ${o.field}`);continue}if(!o.raw){s(`${o.field}: needs a value`);continue}let d=o.field;if(d==="severity"){let c=/^(>=|<=|>|<|=)?(.*)$/.exec(o.raw);if(!ns.includes(c[2])){s(`no severity ${c[2]} (${ns.join(", ")})`);continue}r.push({neg:o.neg,field:d,op:c[1]??"=",value:c[2]})}else if(d==="since"||d==="before"){let c=Ml(o.raw,n);if(c===void 0){s(`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){s(`-${d} isn't allowed (use ${d==="since"?"before":"since"})`);continue}r.push({neg:!1,field:d,value:o.raw,time:c})}else r.push({neg:o.neg,field:d,value:o.raw})}return{terms:r,warnings:i}}var qo=t=>ns.indexOf(t),Yd={"=":"eq",">=":"ge",">":"gt","<=":"le","<":"lt"};function Hd(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:Yd[t.op??"="],value:t.value};case"scope":return{field:"scope",value:t.value,from:e.topKinds.some(n=>t.value.startsWith(`${n}:`))?"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 Wd(t,e){let n=[],r=new Map;for(let i of e.terms){let o=Hd(i,t);if(!o)continue;if(i.neg){n.push({not:!0,any:[o]});continue}if(o.field==="text"||o.field==="severity"){n.push({any:[o]});continue}let s=o.field==="link"?`link.${o.link}`:o.field==="attr"?`attr.${o.key}`:o.field,a=r.get(s);if(a)a.any.push(o);else{let d={any:[o]};r.set(s,d),n.push(d)}}return{all:n}}function Jd(t,e,n,r){switch(e.field){case"text":{let i=e.value.toLowerCase();if(n.summary.toLowerCase().includes(i)||n.kind.toLowerCase().includes(i)||n.source.toLowerCase().includes(i)||n.scope.toLowerCase().includes(i))return!0;for(let[o,s]of Object.entries(n.attrs))if(typeof s=="string"&&!r.has(`${n.source}.${o}`)&&s.toLowerCase().includes(i))return!0;return!1}case"kind":case"source":{let i=n[e.field];return e.prefix?i.startsWith(e.value):i===e.value}case"severity":{let i=qo(n.severity),o=qo(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"?rs(n.scope,e.value):`/${n.scope}/`.includes(`/${e.value}/`);case"link":return t.linkMatch?.(String(e.link),e.value,n)??n.links[e.link]===e.value;case"attr":{let i=n.attrs[e.key];return i!=null&&String(i).toLowerCase()===e.value.toLowerCase()}}}function dr(t){let e=[...Al,...t.links],n=(a,d=Date.now())=>Ud(e,a,d),r=a=>Wd(t,a);function i(a,d,c,l){let p=n(a,d);return{where:r(p),...ni(p,c,l),warnings:p.warnings}}function o(a,d=[]){let c=new Set(d),l=a?.all??[];return l.length?p=>l.every(f=>f.any.some(m=>Jd(t,m,p,c))!==!!f.not):()=>!0}return{FIELDS:e,parseSearch:n,toAst:r,compileSearch:i,matchAst:o,matcher:(a,d=[])=>o(r(a),d)}}function ni(t,e,n){for(let r of t.terms)r.field==="since"&&(e=Math.max(e,r.time)),r.field==="before"&&(n=Math.min(n,r.time));return{from:e,to:Math.max(e,n)}}function ri(t,e){let n=e.toLowerCase(),r=[];for(let o of t.terms){if(o.neg||o.field||!o.value)continue;let s=o.value.toLowerCase();for(let a=n.indexOf(s);a>=0;a=n.indexOf(s,a+s.length))r.push([a,a+s.length])}r.sort((o,s)=>o[0]-s[0]);let i=[];for(let o of r){let s=i[i.length-1];s&&o[0]<=s[1]?s[1]=Math.max(s[1],o[1]):i.push([...o])}return i}var jp=t=>ns.filter(e=>qo(e)>=qo(t));var Bp=new Map,Go=new Map;function Yt(t,e){if(!t||t==="UTC")return 0;let n=`${t}|${Math.floor(e/(15*6e4))}`,r=Go.get(n);if(r!==void 0)return r;let i=Bp.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}Bp.set(t,i)}let o={};for(let d of i.formatToParts(new Date(e)))d.type!=="literal"&&(o[d.type]=Number(d.value));let s=Date.UTC(o.year,o.month-1,o.day,o.hour%24,o.minute,o.second),a=Math.round((s-Math.floor(e/1e3)*1e3)/6e4)*6e4;return Go.size>5e4&&Go.clear(),Go.set(n,a),a}var Dp=t=>{try{return new Intl.DateTimeFormat("en-US",{timeZone:t}),!0}catch{return!1}};function In(t,e,n){if(e==="1m")return Math.floor(t/6e4)*6e4;let r=Yt(n,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-Yt(n,i-r);return o>t?o=i-864e5-Yt(n,i-864e5-r):Zo(o,n)<=t&&(o=Zo(o,n)),o}function Zo(t,e,n="1d"){if(n==="1m")return t+6e4;if(n==="1h")return t+36e5;let r=Yt(e,t),i=Math.floor((t+r)/864e5)*864e5+864e5;return i-Yt(e,i-r)}var bn=6e4,wn=36e5,ws=864e5;function Uo(t,e,n,r={}){let i=Math.max((r.minFrac??.15)*(n-e),r.minMs??10*bn),o=t.filter(([d,c])=>c>=e&&d<n).map(([d,c])=>[Math.max(e,d),Math.min(n,Math.max(d,c))]).sort((d,c)=>d[0]-c[0]),s=[];if(!o.length)return s;let a=e;for(let[d,c]of o)d-a>i&&s.push({from:a,to:d}),a=Math.max(a,c);return n-a>i&&s.push({from:a,to:n}),s}function zn(t){if(t>=ws){let e=Math.floor(t/ws),n=Math.round((t-e*ws)/wn);return n?`${e} d ${n} h`:`${e} d`}if(t>=wn){let e=Math.floor(t/wn),n=Math.round((t-e*wn)/bn);return n&&e<10?`${e} h ${n} min`:`${e} h`}return`${Math.max(1,Math.round(t/bn))} min`}var Cn=t=>`${t.from}-${t.to}`;function mr(t,e,n,r=[],i={}){let o=i.cut??24,s=Math.max(1,n),a=Math.max(1,e-t),d=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(Cn(b))??0})).sort((b,$)=>b.from-$.from),c=d.reduce((b,$)=>b+($.to-$.from)*(1-$.w),0),l=d.reduce((b,$)=>b+(1-$.w)*o,0),p=(s-l)/Math.max(1,a-c);if(!(p>0)||l>s*.6)return mr(t,e,n,[],i);let f=[[t,0]],m=0,u=t,h=[];for(let b of d){m+=(b.from-u)*p,f.push([b.from,m]);let $=(1-b.w)*o+b.w*p*(b.to-b.from);h.push({from:b.from,to:b.to,x0:m,x1:m+$,weight:b.w}),m+=$,f.push([b.to,m]),u=b.to}f.push([e,m+(e-u)*p]);let y=b=>{if(b<=t)return(b-t)*p;if(b>=e)return f[f.length-1][1]+(b-e)*p;let $=0,E=f.length-1;for(;E-$>1;){let A=$+E>>1;f[A][0]<=b?$=A:E=A}let[S,k]=f[$],[T,z]=f[E];return T===S?k:k+(b-S)/(T-S)*(z-k)},v=b=>h.find($=>$.weight<1&&b>$.x0&&b<$.x1);return{t0:t,t1:e,width:s,cuts:h,x:y,t:b=>{let $=v(b);if($)return b-$.x0<$.x1-b?$.from:$.to;if(b<=0)return t+b/p;let E=0,S=f.length-1;if(b>=f[S][1])return e+(b-f[S][1])/p;for(;S-E>1;){let R=E+S>>1;f[R][1]<=b?E=R:S=R}let[k,T]=f[E],[z,A]=f[S];return A===T?k:k+(b-T)/(A-T)*(z-k)},cutAt:v,msPerPx:1/p}}var Ol=[1e3,5e3,15e3,3e4,bn,5*bn,15*bn,30*bn,wn,3*wn,6*wn,12*wn,ws,2*ws,7*ws,14*ws,28*ws];function Yo(t,e,n=80){let r=Ol.find(d=>d/t.msPerPx>=n)??Ol[Ol.length-1],i=[],o=d=>{let c=new Date(d+Yt(e,d)),l=String(c.getUTCHours()).padStart(2,"0"),p=String(c.getUTCMinutes()).padStart(2,"0"),f=String(c.getUTCSeconds()).padStart(2,"0"),m=`${c.getUTCDate()} ${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][c.getUTCMonth()]}`,u=l==="00"&&p==="00"&&f==="00";return r>=ws||u?{label:m,major:!0}:{label:r<bn?`${l}:${p}:${f}`:`${l}:${p}`,major:!1}},s=[],a=t.t0;for(let d of t.cuts)d.weight<1&&(s.push([a,d.from]),a=d.to);s.push([a,t.t1]);for(let[d,c]of s){let l=f=>f-Yt(e,f-Yt(e,f)),p=Math.ceil((d+Yt(e,d))/r)*r;r>=7*ws&&(p=Math.ceil((d+Yt(e,d))/ws)*ws);for(let f=0,m=l(p);m<c&&f<2e3;f++,p+=r,m=l(p)){if(m<d)continue;let u=t.x(m),h=i[i.length-1];(!h||u-h.x>=n*.6)&&i.push({t:m,x:u,...o(m)})}}return i}var Xd=["id","time","t","dur","scope","source","kind","severity","summary"],Qd=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},Vp=(t,e)=>e.size?{...t,attrs:Object.fromEntries(Object.entries(t.attrs).filter(([n])=>!e.has(`${t.source}.${n}`)))}:t;function Ho(t,e=[]){let n=new Set(e);return JSON.stringify(t.map(r=>Vp(r,n)),null,2)+`
357
- `}function Wo(t,e=[]){let n=new Set(e),r=t.map(d=>Vp(d,n)),i=[...new Set(r.flatMap(d=>Object.keys(d.attrs)))].sort(),o=[...new Set(r.flatMap(d=>Object.keys(d.links)))].sort(),s=[...Xd,...i.map(d=>`attr.${d}`),...o.map(d=>`link.${d}`)],a=r.map(d=>[d.id,new Date(d.t).toISOString(),d.t,d.dur,d.scope,d.source,d.kind,d.severity,d.summary,...i.map(c=>d.attrs[c]),...o.map(c=>d.links[c])].map(Qd).join(","));return[s.join(","),...a].join(`\r
365
+ `}function me(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 Sd=1,Va="(?:[^/:%\\s]|%[0-9A-F]{2})+",mn=["debug","info","notice","warning","error"],vd=["1m","1h","1d"],Rn={"1m":6e4,"1h":36e5,"1d":864e5},Ka=t=>`^(?:(?:${t.kinds.join("|")}):(?:${Va})(?:/(?:${t.kinds.join("|")}):(?:${Va}))*)?$`;function Ga(t){let e=new RegExp(Ka(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 Za=t=>t.replace(/[%/:\s]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`),Md=t=>t.map(e=>`${e.kind}:${Za(e.name)}`).join("/"),Pd=(t,e,s)=>(t?`${t}/`:"")+`${e}:${Za(s)}`,Jt=t=>t===""?0:t.split("/").length;function $s(t,e){return e<=0?"":(t===""?[]:t.split("/")).slice(0,e).join("/")}var Od=t=>$s(t,Jt(t)-1),un=(t,e)=>e===""||t===e||t.startsWith(`${e}/`),Ad=(t,e)=>t!==""&&t.split("/").includes(e),Gr=t=>t===""?"fleet":t.slice(t.lastIndexOf("/")+1).split(":")[0],Zr=t=>t===""?"all hosts":decodeURIComponent(t.slice(t.lastIndexOf("/")+1).split(":").slice(1).join(":"));function Ur(t){let e=[{scope:"",label:"all hosts",kind:"fleet"}];for(let s=1;s<=Jt(t);s++){let r=$s(t,s);e.push({scope:r,label:Zr(r),kind:Gr(r)})}return e}var Vc=["kind","source","severity","scope","since","before"];function ah(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 m=t.indexOf('"',s+1);n=t.slice(s+1,m<0?t.length:m),a=!0,s=m<0?t.length:m+1}else{let m=s;for(;s<t.length&&!/\s/.test(t[s]);)s++;n=t.slice(m,s)}e.push({neg:r,raw:n,quoted:a,field:o})}return e}var lh=/^(\d+)(s|m|h|d|w)$/,ch={s:1e3,m:6e4,h:36e5,d:864e5,w:7*864e5};function Kc(t,e){let s=lh.exec(t);if(s)return e-Number(s[1])*ch[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",m="0",p="0",c="0",l]=r;if(l){let d=Date.parse(t.replace(" ","T"));return Number.isNaN(d)?void 0:d}let f=new Date(+i,+o-1,+n,+a,+m,+p,+c.padEnd(3,"0")).getTime();return Number.isNaN(f)?void 0:f}function ph(t,e,s=Date.now()){let r=[],i=[];for(let o of ah(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 m=o.field;if(m==="severity"){let p=/^(>=|<=|>|<|=)?(.*)$/.exec(o.raw);if(!mn.includes(p[2])){n(`no severity ${p[2]} (${mn.join(", ")})`);continue}r.push({neg:o.neg,field:m,op:p[1]??"=",value:p[2]})}else if(m==="since"||m==="before"){let p=Kc(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(`-${m} isn't allowed (use ${m==="since"?"before":"since"})`);continue}r.push({neg:!1,field:m,value:o.raw,time:p})}else r.push({neg:o.neg,field:m,value:o.raw})}return{terms:r,warnings:i}}var Ua=t=>mn.indexOf(t),fh={"=":"eq",">=":"ge",">":"gt","<=":"le","<":"lt"};function dh(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:fh[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 mh(t,e){let s=[],r=new Map;for(let i of e.terms){let o=dh(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 m={any:[o]};r.set(n,m),s.push(m)}}return{all:s}}function uh(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=Ua(s.severity),o=Ua(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"?un(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 Yr(t){let e=[...Vc,...t.links],s=(a,m=Date.now())=>ph(e,a,m),r=a=>mh(t,a);function i(a,m,p,c){let l=s(a,m);return{where:r(l),...Xi(l,p,c),warnings:l.warnings}}function o(a,m=[]){let p=new Set(m),c=a?.all??[];return c.length?l=>c.every(f=>f.any.some(d=>uh(t,d,l,p))!==!!f.not):()=>!0}return{FIELDS:e,parseSearch:s,toAst:r,compileSearch:i,matchAst:o,matcher:(a,m=[])=>o(r(a),m)}}function Xi(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 Qi(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 Td=t=>mn.filter(e=>Ua(e)>=Ua(t));var Ed=new Map,Ya=new Map;function tn(t,e){if(!t||t==="UTC")return 0;let s=`${t}|${Math.floor(e/(15*6e4))}`,r=Ya.get(s);if(r!==void 0)return r;let i=Ed.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}Ed.set(t,i)}let o={};for(let m of i.formatToParts(new Date(e)))m.type!=="literal"&&(o[m.type]=Number(m.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 Ya.size>5e4&&Ya.clear(),Ya.set(s,a),a}var Nd=t=>{try{return new Intl.DateTimeFormat("en-US",{timeZone:t}),!0}catch{return!1}};function sr(t,e,s){if(e==="1m")return Math.floor(t/6e4)*6e4;let r=tn(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-tn(s,i-r);return o>t?o=i-864e5-tn(s,i-864e5-r):Ha(o,s)<=t&&(o=Ha(o,s)),o}function Ha(t,e,s="1d"){if(s==="1m")return t+6e4;if(s==="1h")return t+36e5;let r=tn(e,t),i=Math.floor((t+r)/864e5)*864e5+864e5;return i-tn(e,i-r)}var Ds=6e4,Bs=36e5,In=864e5;function Wa(t,e,s,r={}){let i=Math.max((r.minFrac??.15)*(s-e),r.minMs??10*Ds),o=t.filter(([m,p])=>p>=e&&m<s).map(([m,p])=>[Math.max(e,m),Math.min(s,Math.max(m,p))]).sort((m,p)=>m[0]-p[0]),n=[];if(!o.length)return n;let a=e;for(let[m,p]of o)m-a>i&&n.push({from:a,to:m}),a=Math.max(a,p);return s-a>i&&n.push({from:a,to:s}),n}function rr(t){if(t>=In){let e=Math.floor(t/In),s=Math.round((t-e*In)/Bs);return s?`${e} d ${s} h`:`${e} d`}if(t>=Bs){let e=Math.floor(t/Bs),s=Math.round((t-e*Bs)/Ds);return s&&e<10?`${e} h ${s} min`:`${e} h`}return`${Math.max(1,Math.round(t/Ds))} min`}var ir=t=>`${t.from}-${t.to}`;function Hr(t,e,s,r=[],i={}){let o=i.cut??24,n=Math.max(1,s),a=Math.max(1,e-t),m=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(ir(b))??0})).sort((b,w)=>b.from-w.from),p=m.reduce((b,w)=>b+(w.to-w.from)*(1-w.w),0),c=m.reduce((b,w)=>b+(1-w.w)*o,0),l=(n-c)/Math.max(1,a-p);if(!(l>0)||c>n*.6)return Hr(t,e,s,[],i);let f=[[t,0]],d=0,u=t,y=[];for(let b of m){d+=(b.from-u)*l,f.push([b.from,d]);let w=(1-b.w)*o+b.w*l*(b.to-b.from);y.push({from:b.from,to:b.to,x0:d,x1:d+w,weight:b.w}),d+=w,f.push([b.to,d]),u=b.to}f.push([e,d+(e-u)*l]);let g=b=>{if(b<=t)return(b-t)*l;if(b>=e)return f[f.length-1][1]+(b-e)*l;let w=0,k=f.length-1;for(;k-w>1;){let O=w+k>>1;f[O][0]<=b?w=O:k=O}let[$,v]=f[w],[T,R]=f[k];return T===$?v:v+(b-$)/(T-$)*(R-v)},x=b=>y.find(w=>w.weight<1&&b>w.x0&&b<w.x1);return{t0:t,t1:e,width:n,cuts:y,x:g,t:b=>{let w=x(b);if(w)return b-w.x0<w.x1-b?w.from:w.to;if(b<=0)return t+b/l;let k=0,$=f.length-1;if(b>=f[$][1])return e+(b-f[$][1])/l;for(;$-k>1;){let I=k+$>>1;f[I][1]<=b?k=I:$=I}let[v,T]=f[k],[R,O]=f[$];return O===T?v:v+(b-T)/(O-T)*(R-v)},cutAt:x,msPerPx:1/l}}var Gc=[1e3,5e3,15e3,3e4,Ds,5*Ds,15*Ds,30*Ds,Bs,3*Bs,6*Bs,12*Bs,In,2*In,7*In,14*In,28*In];function Ja(t,e,s=80){let r=Gc.find(m=>m/t.msPerPx>=s)??Gc[Gc.length-1],i=[],o=m=>{let p=new Date(m+tn(e,m)),c=String(p.getUTCHours()).padStart(2,"0"),l=String(p.getUTCMinutes()).padStart(2,"0"),f=String(p.getUTCSeconds()).padStart(2,"0"),d=`${p.getUTCDate()} ${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][p.getUTCMonth()]}`,u=c==="00"&&l==="00"&&f==="00";return r>=In||u?{label:d,major:!0}:{label:r<Ds?`${c}:${l}:${f}`:`${c}:${l}`,major:!1}},n=[],a=t.t0;for(let m of t.cuts)m.weight<1&&(n.push([a,m.from]),a=m.to);n.push([a,t.t1]);for(let[m,p]of n){let c=f=>f-tn(e,f-tn(e,f)),l=Math.ceil((m+tn(e,m))/r)*r;r>=7*In&&(l=Math.ceil((m+tn(e,m))/In)*In);for(let f=0,d=c(l);d<p&&f<2e3;f++,l+=r,d=c(l)){if(d<m)continue;let u=t.x(d),y=i[i.length-1];(!y||u-y.x>=s*.6)&&i.push({t:d,x:u,...o(d)})}}return i}var hh=["id","time","t","dur","scope","source","kind","severity","summary"],yh=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},Rd=(t,e)=>e.size?{...t,attrs:Object.fromEntries(Object.entries(t.attrs).filter(([s])=>!e.has(`${t.source}.${s}`)))}:t;function Xa(t,e=[]){let s=new Set(e);return JSON.stringify(t.map(r=>Rd(r,s)),null,2)+`
366
+ `}function Qa(t,e=[]){let s=new Set(e),r=t.map(m=>Rd(m,s)),i=[...new Set(r.flatMap(m=>Object.keys(m.attrs)))].sort(),o=[...new Set(r.flatMap(m=>Object.keys(m.links)))].sort(),n=[...hh,...i.map(m=>`attr.${m}`),...o.map(m=>`link.${m}`)],a=r.map(m=>[m.id,new Date(m.t).toISOString(),m.t,m.dur,m.scope,m.source,m.kind,m.severity,m.summary,...i.map(p=>m.attrs[p]),...o.map(p=>m.links[p])].map(yh).join(","));return[n.join(","),...a].join(`\r
358
367
  `)+`\r
359
- `}var em=864e5,Is=36e5,Jo=(t,e)=>t.t-e.t||(t.id<e.id?-1:t.id>e.id?1:0);function Zs(t,e){let n=0,r=t.length;for(;n<r;){let i=n+r>>1;t[i].t<e?n=i+1:r=i}return n}var Gp=(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 Kp(t,e,n){let r=[];for(let i of t){let o=In(i.t,e,n),s=r[r.length-1];s&&s.t===o?Gp(s,i):r.push({t:o,min:i.min,max:i.max,sum:i.sum,count:i.count})}return r}function El(t,e,n,r){for(let s=Zs(t,e.t);s<t.length&&t[s].t===e.t;s++)if(n(t[s])){t[s]=e;return}let i=t[t.length-1];if(!i||r(i,e)<=0){t.push(e);return}let o=Zs(t,e.t);for(;o<t.length&&r(t[o],e)<0;)o++;t.splice(o,0,e)}function qp(t,e,n){for(let r=Zs(t,e);r<t.length&&t[r].t===e;r++)if(n(t[r])){t.splice(r,1);return}}function Zp(t,e,n={}){let r=t.catalog,{isScope:i}=Vo(e),{parseSearch:o,matchAst:s,toAst:a}=dr(e),d=O=>Object.fromEntries(e.flags.filter(U=>O?.[U]).map(U=>[U,!0])),c=n.now??r.now,l=(r.names??[]).flatMap(O=>(O.aliases??[]).map(U=>[U,O.scope])).sort((O,U)=>U[0].length-O[0].length),p=new Map,f=O=>{if(!l.length)return O;let U=p.get(O);if(U===void 0){let ne=l.find(([ce])=>rs(O,ce));U=ne?ne[1]+O.slice(ne[0].length):O,p.set(O,U)}return U},m=new Map((r.names??[]).map(O=>[O.scope,O])),u=O=>l.length?{...O,scope:f(O.scope)}:O,h=O=>`${O.source}\0${O.id}`,y=t.events.map(u).sort(Jo),v=new Map;for(let O of y)v.set(h(O),O);let g=y.filter(O=>O.dur!==void 0&&!O.open),b=g.reduce((O,U)=>Math.max(O,U.dur),0),$=new Map;for(let O of y)O.open&&$.set(h(O),O);let E=new Map,S=new Set,k=O=>{for(let U=qt(O);U>=1;U--){let ne=nn(O,U);if(S.has(ne))break;S.add(ne)}},T=new Map;for(let O of r.sources)for(let U of O.series)T.set(U.name,U.type);let z=r.sources.flatMap(O=>(O.sensitive??[]).map(U=>`${O.name}.${U}`)),A=new Map;for(let O of r.sources)A.set(O.name,{events:O.defaultRetention.events,rollups:{...O.defaultRetention.rollups},setBy:"default"});for(let O of r.retention)A.set(O.source,{events:O.events,rollups:{...O.rollups},setBy:O.setBy});let R=new Map;for(let O of r.sources)for(let U of O.series)R.set(U.name,O.name);function x(O){let U=f(O.scope),ne=`${O.series}\0${U}`,ce=E.get(ne);ce||(ce={series:O.series,scope:U,fine:[],cache:new Map},E.set(ne,ce),k(U));let Ce="value"in O?{t:O.t,min:O.value,max:O.value,sum:O.value,count:1}:{t:O.t,min:O.min,max:O.max,sum:O.sum,count:O.count};El(ce.fine,Ce,le=>le.t===Ce.t,(le,Ke)=>le.t-Ke.t),ce.cache.clear()}for(let O of y)k(O.scope);for(let O of t.metrics)x(O);let P=new Map,w=new Set,I=(O,U)=>{w.add(O.source);let ne=P.get(O.scope);ne||P.set(O.scope,ne=new Map);let ce=ne.get(O.source);ce||ne.set(O.source,ce=new Map);let Ce=Math.floor(O.t/Is)*Is,le=ce.get(Ce);if(le||ce.set(Ce,le={t:Ce,count:0,severity:{},kinds:{},first:1/0,last:-1/0}),le.count+=U,U>0)le.first=Math.min(le.first,O.t),le.last=Math.max(le.last,O.t);else if(O.t===le.first||O.t===le.last){le.first=1/0,le.last=-1/0;for(let Ke=Zs(y,Ce);Ke<y.length&&y[Ke].t<Ce+Is;Ke++){let ve=y[Ke];ve.scope===O.scope&&ve.source===O.source&&(le.first=Math.min(le.first,ve.t),le.last=Math.max(le.last,ve.t))}}le.severity[O.severity]=(le.severity[O.severity]??0)+U,le.kinds[O.kind]=(le.kinds[O.kind]??0)+U,le.severity[O.severity]===0&&delete le.severity[O.severity],le.kinds[O.kind]===0&&delete le.kinds[O.kind],le.count||ce.delete(Ce)};for(let O of y)I(O,1);let L=(O,U,ne)=>{let ce=`${U}|${ne??""}`,Ce=O.cache.get(ce);return Ce||(Ce=U==="1d"?Kp(L(O,"1h",ne),"1d",ne):Kp(O.fine,U,ne),O.cache.set(ce,Ce)),Ce},D=O=>O===null?-1/0:c-O*em,G=O=>D(A.get(O)?.events??null),se=(O,U)=>{let ne=A.get(O);return D(ne?U?ne.rollups[U]:ne.events:null)};function _(O){let U=[];for(let ne of new Set(O)){let ce=A.get(ne);if(!ce)continue;let Ce=y.find(de=>de.source===ne&&de.t>=G(ne))?.t,le=de=>{let Oe=1/0;for(let We of E.values())if(R.get(We.series)===ne){let Re=(de?L(We,de):We.fine).find(at=>at.t>=se(ne,de));Re&&Re.t<Oe&&(Oe=Re.t)}return Oe===1/0?void 0:Oe},Ke=[Ce,le()].filter(de=>de!==void 0),ve={};for(let de of["1m","1h","1d"]){let Oe=le(de)??(Ce!==void 0&&Ce>=se(ne,de)?Ce:void 0);Oe!==void 0&&(ve[de]=Math.max(Oe,se(ne,de)))}U.push({source:ne,events:ce.events,rollups:{...ce.rollups},setBy:ce.setBy,keptFrom:{...Ke.length?{events:Math.min(...Ke)}:{},rollups:ve}})}return U}function K(O){let U=O.where,ne={from:O.from,to:O.to},ce=[];if(!U&&O.q){let Re=o(O.q,c);U=a(Re),ne=ni(Re,O.from,O.to),ce=Re.warnings}let Ce=s(U,z),le=O.filters??{},Ke=le.source?.length?new Set(le.source):void 0,ve=le.kind?.length?new Set(le.kind):void 0,de=le.severity?.length?new Set(le.severity):void 0,Oe=le.scope?.length?le.scope:void 0;return{test:Re=>rs(Re.scope,O.scope)&&(!Ke||Ke.has(Re.source))&&(!ve||ve.has(Re.kind))&&(!de||de.has(Re.severity))&&(!Oe||Oe.some(at=>rs(Re.scope,at)))&&Re.t>=G(Re.source)&&Ce(Re),range:ne,warnings:ce}}function Z(O){let U=qt(O.scope),ne=U+O.depth,ce=new Map,Ce=de=>{let Oe=ce.get(de);return Oe===void 0&&!ce.has(de)&&(Oe=rs(de,O.scope)?qt(de)>=ne?nn(de,ne):de:void 0,ce.set(de,Oe)),Oe},le=de=>{let Oe=0,We=qt(de)+1;for(let Re of S)qt(Re)===We&&rs(Re,de)&&Oe++;return Oe},Ke=new Map,ve=de=>{let Oe=Ke.get(de);if(!Oe){let We=qt(de)-U,Re=m.get(de);Oe={scope:de,label:Re?.label??pr(de),kind:cr(de),...d(Re),depth:We,...We<O.depth?{own:!0}:{},children:le(de),count:0},Ke.set(de,Oe)}return Oe};for(let de of S)qt(de)===ne&&rs(de,O.scope)&&ve(de);return ne===0&&ve(""),{at:Ce,add:ve,rows:Ke}}let Q=O=>[...O.values()].sort((U,ne)=>U.scope===ne.scope?0:U.scope<ne.scope?-1:1);function N(O,U){let ne=[];for(let ce=Zs(g,O-b);ce<g.length&&g[ce].t<O;ce++)g[ce].t+g[ce].dur>O&&ne.push(g[ce]);for(let ce of $.values())ce.t<O&&c>O&&ne.push(ce);for(let ce=Zs(y,O);ce<y.length&&y[ce].t<U;ce++)ne.push(y[ce]);return ne}function j(O,U,ne,ce){let Ce=O.series?new Set(O.series):void 0,le=new Map;for(let ve of E.values()){if(Ce&&!Ce.has(ve.series))continue;let de=U(ve.scope);if(de===void 0)continue;let Oe=R.get(ve.series)??"",We=se(Oe,O.bin),Re=O.bin?L(ve,O.bin,O.tz):ve.fine;for(let at=Zs(Re,O.bin?In(ne,O.bin,O.tz):ne);at<Re.length&&Re[at].t<ce;at++){let gt=Re[at];if(gt.t<We)continue;let Ye=`${ve.series}\0${de}\0${gt.t}`,dt=le.get(Ye);dt?Gp(dt,gt):le.set(Ye,{series:ve.series,scope:de,t:gt.t,bin:O.bin??"1m",min:gt.min,max:gt.max,sum:gt.sum,count:gt.count})}}let Ke=[...le.values()].sort((ve,de)=>ve.t-de.t||(ve.series<de.series?-1:1)||(ve.scope<de.scope?-1:1));return O.bin?Ke:Ke.map(ve=>({series:ve.series,scope:ve.scope,t:ve.t,value:ve.count===1||T.get(ve.series)!=="gauge"?ve.sum:ve.sum/ve.count}))}let V=O=>`${O.t}:${O.id}`,H=(O,U)=>{let ne=U.indexOf(":"),ce=Number(U.slice(0,ne)),Ce=U.slice(ne+1);return O.t>ce||O.t===ce&&O.id>Ce};function ae(O){if(O.bin!=="1h"&&O.bin!=="1d"||(O.where?.all.length??0)||O.q||O.filters?.kind?.length||O.filters?.severity?.length||O.filters?.scope?.length||Yt(O.tz,O.from)%Is||Yt(O.tz,O.to)%Is)return;let U=O.filters?.source?.length?new Set(O.filters.source):void 0,ne=pe=>Math.max(O.from,G(pe)),{at:ce,add:Ce,rows:le}=Z(O),Ke=new Set,ve=new Map,de=0,Oe=(pe,Fe)=>{let Ne=In(Fe,O.bin,O.tz),pt=`${pe}\0${Ne}`,M=ve.get(pt);return M||(M={scope:pe,t:Ne,bin:O.bin,count:0,severity:{},kinds:{}},ve.set(pt,M)),M},We=(pe,Fe,Ne)=>{let pt=Ce(pe);pt.count+=Ne,de+=Ne,(pt.first===void 0||Fe<pt.first)&&(pt.first=Fe),(pt.last===void 0||Fe>pt.last)&&(pt.last=Fe)},Re=Math.floor(O.to/Is)*Is;for(let[pe,Fe]of P){let Ne=ce(pe);if(Ne!==void 0)for(let[pt,M]of Fe){if(U&&!U.has(pt))continue;let F=Math.ceil(ne(pt)/Is)*Is;for(let[B,oe]of M){if(B<F||B>=Re)continue;We(Ne,oe.first,oe.count),oe.last>(le.get(Ne).last??-1/0)&&(le.get(Ne).last=oe.last),Ke.add(pt);let re=Oe(Ne,B);re.count+=oe.count;for(let[Ae,ye]of Object.entries(oe.severity))re.severity[Ae]=(re.severity[Ae]??0)+ye;for(let[Ae,ye]of Object.entries(oe.kinds))re.kinds[Ae]=(re.kinds[Ae]??0)+ye}}}let at=pe=>rs(pe.scope,O.scope)&&(!U||U.has(pe.source))&&pe.t>=G(pe.source)&&ce(pe.scope)!==void 0,gt=pe=>{let Fe=ce(pe.scope);We(Fe,pe.t,1),Ke.add(pe.source);let Ne=Oe(Fe,pe.t);Ne.count++,Ne.severity[pe.severity]=(Ne.severity[pe.severity]??0)+1,Ne.kinds[pe.kind]=(Ne.kinds[pe.kind]??0)+1};for(let pe of w){if(U&&!U.has(pe))continue;let Fe=ne(pe),Ne=Math.ceil(Fe/Is)*Is,pt=Ne>=Re?[[Fe,O.to]]:[[Fe,Ne],[Re,O.to]];for(let[M,F]of pt)for(let B=Zs(y,M);B<y.length&&y[B].t<F;B++){let oe=y[B];oe.source===pe&&at(oe)&&gt(oe)}}let Ye=bs[O.bin],dt=[];for(let pe=Zs(g,O.from-b);pe<g.length&&g[pe].t<O.from;pe++){let Fe=g[pe];Fe.t+Fe.dur>O.from&&at(Fe)&&(We(ce(Fe.scope),Fe.t,1),Ke.add(Fe.source),Fe.dur>=Ye&&dt.length<5e3&&dt.push(Fe))}for(let pe of $.values())pe.t<O.from&&c>O.from&&at(pe)&&(We(ce(pe.scope),pe.t,1),Ke.add(pe.source),dt.length<5e3&&dt.push(pe));for(let pe=Zs(g,O.from);pe<g.length&&g[pe].t<O.to&&dt.length<5e3;pe++)g[pe].dur>=Ye&&at(g[pe])&&dt.push(g[pe]);for(let pe of $.values())pe.t>=O.from&&pe.t<O.to&&dt.length<5e3&&at(pe)&&dt.push(pe);let nt=j(O,ce,O.from,O.to);for(let pe of nt){let Fe=R.get(pe.series);Fe&&Ke.add(Fe)}let mt=[...ve.values()].sort((pe,Fe)=>pe.t-Fe.t||(pe.scope<Fe.scope?-1:1));return{timeline:1,type:"result",rows:Q(le),bins:mt,spans:dt,metrics:nt,total:de,retention:_(Ke)}}async function ue(O){if(!i(O.scope))throw new Error(`not a scope path: ${JSON.stringify(O.scope)}`);let U=ae(O);if(U)return U;let{test:ne,range:ce,warnings:Ce}=K(O),{at:le,add:Ke,rows:ve}=Z(O),de=new Set,Oe=[];for(let nt of N(ce.from,ce.to)){if(!ne(nt))continue;let mt=le(nt.scope);if(mt===void 0)continue;let pe=Ke(mt);pe.count++,(pe.first===void 0||nt.t<pe.first)&&(pe.first=nt.t),(pe.last===void 0||nt.t>pe.last)&&(pe.last=nt.t),de.add(nt.source),Oe.push(nt)}Oe.sort(Jo);let We=j(O,le,ce.from,ce.to);for(let nt of We){let mt=R.get(nt.series);mt&&de.add(mt)}let Re={timeline:1,type:"result",total:Oe.length,...Ce.length?{warnings:Ce}:{}};if(O.bin){let nt=bs[O.bin],mt=new Map,pe=[];for(let Ne of Oe){if((Ne.open||Ne.dur!==void 0&&Ne.dur>=nt)&&pe.length<5e3&&pe.push(Ne),Ne.t<ce.from)continue;let pt=le(Ne.scope),M=In(Ne.t,O.bin,O.tz),F=`${pt}\0${M}`,B=mt.get(F);B||(B={scope:pt,t:M,bin:O.bin,count:0,severity:{},kinds:{}},mt.set(F,B)),B.count++,B.severity[Ne.severity]=(B.severity[Ne.severity]??0)+1,B.kinds[Ne.kind]=(B.kinds[Ne.kind]??0)+1}let Fe=[...mt.values()].sort((Ne,pt)=>Ne.t-pt.t||(Ne.scope<pt.scope?-1:1));return{...Re,rows:Q(ve),bins:Fe,spans:pe,metrics:We,retention:_(de)}}let at=Math.min(1e4,Math.max(1,O.limit??2e3)),gt=O.cursor?Oe.findIndex(nt=>H(nt,O.cursor)):0,Ye=gt<0?[]:Oe.slice(gt,gt+at),dt=gt>=0&&gt+at<Oe.length;return{...Re,rows:Q(ve),events:Ye,metrics:We,retention:_(de),...dt?{next:V(Ye[Ye.length-1])}:{}}}let J=new Set,te=O=>ns.includes(O),Se=0;function Ve(O){let U=h(O),ne=v.get(U);ne&&(qp(y,ne.t,ce=>ce===ne),I(ne,-1),ne.dur!==void 0&&!ne.open&&qp(g,ne.t,ce=>ce===ne),$.delete(U)),v.set(U,O),I(O,1),El(y,O,()=>!1,Jo),O.open?$.set(U,O):O.dur!==void 0&&(El(g,O,()=>!1,Jo),b=Math.max(b,O.dur)),k(O.scope)}return{async catalog(){return{...r,now:c,retention:_(r.sources.map(O=>O.name))}},query:ue,subscribe(O,U){let ne={q:O,on:U};return J.add(ne),()=>{J.delete(ne)}},...n.stateAt?{stateAt:(O,U)=>n.stateAt(O,U)}:{},append(O,U=[],ne){ne!==void 0&&(c=Math.max(c,ne));let ce=new Set(S),Ce=O.map(u);for(let le of Ce){if(!te(le.severity))throw new Error(`not a severity: ${le.severity}`);Ve(le)}for(let le of U)x(le);Se++;for(let le of J){let{test:Ke}=K(le.q),{at:ve}=Z(le.q),de=Ce.filter(Ye=>Ke(Ye)&&ve(Ye.scope)!==void 0),Oe=le.q.series?new Set(le.q.series):void 0,We=U.filter(Ye=>rs(f(Ye.scope),le.q.scope)&&(!Oe||Oe.has(Ye.series))).map(Ye=>({...Ye,scope:ve(f(Ye.scope))})),Re=[...S].filter(Ye=>!ce.has(Ye)),at=qt(le.q.scope)+le.q.depth,gt=Re.filter(Ye=>qt(Ye)===at&&rs(Ye,le.q.scope)).map(Ye=>({scope:Ye,label:m.get(Ye)?.label??pr(Ye),kind:cr(Ye),depth:le.q.depth,children:0,count:0}));le.on({timeline:1,type:"batch",events:de,metrics:We,...gt.length?{rows:gt}:{},now:c,resume:String(Se)})}},setRetention(O,U){A.set(O,{events:U.events,rollups:{...U.rollups},setBy:"user"})},get now(){return c},get size(){let O=0;for(let U of E.values())O+=U.fine.length;return{events:y.length,samples:O}}}}var Up="http://www.w3.org/2000/svg",Ln=22,Xo=38,Us=26,tm=210,sm=24,ii=6e4,_n=36e5,ps=864e5,Yp={"15m":15*ii,"1h":_n,"1d":ps,"1w":7*ps},Hp=t=>ns.indexOf(t),nm={debug:"dot",info:"circle",notice:"square",warning:"triangle",error:"diamond"},ft=(t,e,n)=>{let r=document.createElementNS(Up,t);for(let[i,o]of Object.entries(e))o!==void 0&&r.setAttribute(i,String(o));if(n){let i=document.createElementNS(Up,"title");i.textContent=n,r.append(i)}return r},Ht=(t,e)=>{try{return new Intl.DateTimeFormat(void 0,{timeZone:e,dateStyle:"medium",timeStyle:"medium"}).format(t)}catch{return new Date(t).toISOString()}},Tl=t=>t<1e3?`${Math.round(t)} ms`:t<ii?`${(t/1e3).toFixed(1)} s`:zn(t),rm=(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 Nl(t,e){if(t<=3*_n)return{kind:"single"};for(let n of["1m","1h","1d"])if(t/bs[n]<=e/2)return{kind:"binned",bin:n};return{kind:"binned",bin:"1d"}}function Rl(t,e,n){let r=[];for(let s of t.events??[])r.push([s.t,s.t]),s.dur!==void 0&&!s.open&&r.push([s.t+s.dur,s.t+s.dur]);for(let s of t.spans??[])r.push([s.t,s.t]),s.dur!==void 0&&!s.open&&r.push([s.t+s.dur,s.t+s.dur]);let i=e.kind==="binned"?bs[e.bin]:ii;for(let s of t.bins??[])s.count&&r.push([s.t,s.t+bs[s.bin]]);let o=new Map;for(let s of t.metrics){let a="value"in s?s.value:s.sum,d=`${s.series}|${s.scope}`,c=(n?.get(s.series)??"counter")==="counter"?a!==0:o.get(d)!==a;o.set(d,a),c&&r.push([s.t,s.t+i])}return r}function Wp(t,e){let n=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:s}=dr(e.catalog),a=(C="system")=>{t.style.colorScheme=C==="system"?"light dark":C,C==="system"?delete t.dataset.theme:t.dataset.theme=C};a(e.theme),t.setAttribute("role","region"),t.setAttribute("aria-label","Timeline");let d,c="",l=1,p="",f={},m=!1,u=e.collapseGaps??!0,h={t0:0,t1:ps},y,v="",g={from:0,to:0,mode:{kind:"single"},key:""},b,$,E,S,k=!0,T=0,z=0,A=!1,R,x=[],P=[],w=-1,I=new Set,L=new Map,D=[],G=mr(0,ps,800),se=new Map,_=[],K=X("nav",{class:"tlx-crumbs","aria-label":"Scope"}),Z=X("div",{class:"segmented tlx-quick",role:"group","aria-label":"Range"});for(let C of["15m","1h","1d","1w","run"]){let q=X("button",{type:"button",class:"seg","data-v":C,title:C==="run"?"The latest run":`The last ${C}`},C==="run"?"this run":C);q.addEventListener("click",()=>kn(C)),Z.append(q)}let Q=X("button",{type:"button",class:"btn sm tlx-live","aria-pressed":"false",title:"Follow what happens now"},"Live"),N=X("button",{type:"button",class:"btn sm quiet tlx-now",hidden:!0,title:"Back to the live edge"},"Back to now"),j=X("button",{type:"button",class:"btn sm quiet tlx-fit",title:"Everything in this scope"},"Fit"),V=X("input",{type:"checkbox",class:"tlx-gaps"});V.checked=u;let H=!0,ae=X("input",{type:"checkbox",class:"tlx-quiet"});ae.checked=H;let ue=X("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"}),J=X("span",{class:"tlx-hits",role:"status","aria-live":"polite"}),te=X("button",{type:"button",class:"btn sm quiet tlx-prev",title:"Previous hit (\u21E7N)","aria-label":"Previous hit"},"\u2039"),Se=X("button",{type:"button",class:"btn sm quiet tlx-next",title:"Next hit (N)","aria-label":"Next hit"},"\u203A"),Ve=X("div",{class:"tlx-facets",role:"group","aria-label":"Sources"}),O=X("select",{class:"input tlx-sev","aria-label":"Severity"},X("option",{value:""},"every severity"),...ns.slice(1).map(C=>X("option",{value:C},`${C} and above`))),U=X("select",{class:"input tlx-views","aria-label":"Saved views",hidden:!e.views},X("option",{value:""},"Saved views\u2026")),ne=X("button",{type:"button",class:"btn sm quiet tlx-save",hidden:!e.saveView,title:"Save this view"},"Save view"),ce=X("div",{class:"tlx-warn",role:"status",hidden:!0}),Ce=X("div",{class:"tlx-status",role:"status"}),le=X("span",{class:"tlx-canvas-note"}),Ke=X("div",{class:"tlx-labels"}),ve=X("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"}),de=ft("svg",{class:"tlx-svg"});ve.append(de);let Oe=X("div",{class:"tlx-scroll"},X("div",{class:"tlx-grid"},Ke,ve)),We=X("section",{class:"tlx-table",hidden:!0,"aria-label":"The events in the chosen range"}),Re=X("aside",{class:"tlx-detail",hidden:!0,"aria-label":"The event"});t.replaceChildren(X("div",{class:"tlx-bar"},K,X("span",{class:"spacer"}),Z,Q,N,j,X("label",{class:"tlx-gaps-label",title:"Draw long empty stretches as narrow breaks"},V,"Collapse gaps"),X("label",{class:"tlx-gaps-label",title:"Hide the rows with nothing in this range"},ae,"Hide quiet rows")),X("div",{class:"tlx-bar"},ue,J,te,Se,O,U,ne),Ve,ce,X("div",{class:"tlx-body"},Oe,Re),X("div",{class:"tlx-foot"},Ce,X("span",{class:"spacer"}),le),We);let at=()=>Math.max(200,ve.clientWidth||800),gt=()=>{let C=(me,Le)=>(me.own?-1:0)-(Le.own?-1:0)||me.scope.localeCompare(Le.scope,void 0,{numeric:!0}),W=(y?.rows??[]).filter(me=>!H||me.count>0||me.own||(y?.rows.length??0)<=1).sort(C).map(me=>({kind:"row",row:me})),ee=new Set(y?.metrics.map(me=>me.series)??[]);for(let me of[...ee].sort()){let Le=se.get(me);W.push({kind:"metric",series:me,unit:Le?.unit??"count",type:Le?.type??"counter",title:Le?.title??me})}return W},Ye=(C,q)=>d?.names?.find(W=>W.scope===C)?.label??q,dt=C=>C.kind==="metric"?Xo:Ln,nt=()=>Nl(h.t1-h.t0,at()),mt=()=>d?.now??Date.now();function pe(){return{timeline:1,type:"view",name:"",scope:c,depth:l,range:{from:Math.round(h.t0),to:Math.round(h.t1)},...p?{q:p}:{},...Object.keys(f).length?{filters:f}:{},...m?{live:m}:{},...u?{}:{collapseGaps:!1},...H?{}:{quietRows:!0}}}function Fe(C){C.scope!==void 0&&(c=C.scope),C.depth!==void 0&&(l=C.depth),p=C.q??"",ue.value=p,f=C.filters??{},O.value=f.severity?.length?f.severity[0]:"",u=C.collapseGaps??e.collapseGaps??!0,V.checked=u,H=!C.quietRows,ae.checked=H,I.clear(),L.clear();let q=C.range;q&&"last"in q?kn(q.last,!1):q&&(h={t0:q.from,t1:q.to}),Pt(!!C.live,!1)}let Ne=()=>{let C=pe();if(e.onViewChange?.(C),!!e.urlState)try{history.replaceState(null,"",`#timeline=${encodeURIComponent(JSON.stringify(C))}`)}catch{}},pt=()=>{if(!e.urlState)return;let C=/#timeline=(.+)$/.exec(location.hash);if(C)try{return JSON.parse(decodeURIComponent(C[1]))}catch{return}};function M(C,q,W,ee={}){let me=s(p,mt(),C,q);x=me.warnings;let Le=p?[]:f.source?[...se].filter(([,tt])=>f.source.includes(tt.source)).map(([tt])=>tt):void 0;return{timeline:1,type:"query",scope:c,depth:l,from:me.from,to:me.to,tz:n,...W.kind==="binned"?{bin:W.bin}:{},...p?{q:p,where:me.where}:{},...Object.keys(f).length?{filters:f}:{},...Le?{series:Le}:{},...ee}}let F=()=>JSON.stringify([c,l,p,f,nt()]);async function B(C=!1){let q=nt(),W=F(),ee=h.t1-h.t0;if(!C&&y&&W===g.key&&h.t0>=g.from&&h.t1<=g.to){re();return}if(z){A=!0;return}z++;let me=h.t0-ee/2,Le=Math.min(h.t1+ee/2,Math.max(h.t1,mt()+ee*.1));try{let tt=await e.source.query(M(me,Le,q,q.kind==="single"?{limit:1e4}:{}));q.kind==="single"&&tt.next&&(tt=await e.source.query(M(me,Le,{kind:"binned",bin:"1m"}))),y=tt,v=W,g={from:me,to:Le,mode:q,key:W}}catch(tt){Ce.textContent=`The history couldn't be read: ${String(tt?.message??tt)}`}finally{z--}re(),Ne(),A&&(A=!1,B())}function oe(){let C=at(),q=nt();if(D=[],u&&y){let W=new Map([...se].map(([ee,me])=>[ee,me.type]));D=Uo(Rl(y,q,W),h.t0,Math.min(h.t1,Math.max(h.t0,mt())),{minFrac:.15,minMs:10*ii}),q.kind==="binned"&&(D=D.filter(ee=>ee.to-ee.from>=2*bs[q.bin])),D=D.filter(ee=>!(I.has(Cn(ee))&&(L.get(Cn(ee))??1)>=1))}G=mr(h.t0,h.t1,C,D,{cut:sm,weights:L})}let re=()=>{T||(T=requestAnimationFrame(Ae))};function Ae(){T=0,oe();let C=at(),q=gt(),W=g.mode,ee=[],me=Us;for(let Y of q)ee.push(me),me+=dt(Y);let Le=Math.max(me,Us+Ln);de.setAttribute("width",String(C)),de.setAttribute("height",String(Le)),de.setAttribute("viewBox",`0 0 ${C} ${Le}`);let tt=Oe.scrollTop-200,zs=Oe.scrollTop+(Oe.clientHeight||600)+200,Ee=[],Me=G.x;Ee.push(ft("rect",{class:"tlx-axis",x:0,y:0,width:C,height:Us}));let Gt=(y?.retention??[]).map(Y=>({r:Y,from:W.kind==="binned"?Y.keptFrom.rollups[W.bin]??Y.keptFrom.events:Y.keptFrom.events,days:W.kind==="binned"?Y.rollups[W.bin]:Y.events})).filter(Y=>Y.from!==void 0);if(Gt.length){let Y=Math.min(...Gt.map(he=>he.from));Y>h.t0&&Ee.push(ft("rect",{class:"tlx-notkept",x:Math.max(0,Me(h.t0)),y:Us,width:Math.max(0,Me(Y)-Math.max(0,Me(h.t0))),height:Le-Us},`Nothing kept before ${Ht(Y,n)}: ${Gt.map(he=>`${he.r.source} ${he.days===null?"kept until deleted":`kept ${he.days} days`}`).join(", ")}`))}let os=mt();os<h.t1&&Ee.push(ft("rect",{class:"tlx-future",x:Me(os),y:Us,width:C-Me(os),height:Le-Us}));for(let Y of Yo(G,n,90)){Ee.push(ft("line",{class:`tlx-tick${Y.major?" major":""}`,x1:Y.x,x2:Y.x,y1:Us-6,y2:Le}));let he=ft("text",{class:"tlx-ticklabel",x:Y.x+3,y:16});he.textContent=Y.label,Ee.push(he)}S&&Ee.push(ft("rect",{class:"tlx-brush",x:Me(S.from),y:0,width:Math.max(1,Me(S.to)-Me(S.from)),height:Le}));let fi=W.kind==="single"?(y?.events??[]).filter(Y=>Y.dur!==void 0||Y.open):y?.spans??[],$f=W.kind==="single"?(y?.events??[]).filter(Y=>Y.dur===void 0&&!Y.open):[],Ul=new Map;q.forEach((Y,he)=>{Y.kind==="row"&&Ul.set(Y.row.scope,he)});let di=Y=>{let he=qt(c)+l,Ge=qt(Y)>=he?nn(Y,he):Y;return Ul.get(Ge)},wr=Y=>ee[Y]+dt(q[Y])>=tt&&ee[Y]<=zs;if(q.forEach((Y,he)=>{wr(he)&&Ee.push(ft("rect",{class:`tlx-lane${he%2?" odd":""}${Y.kind==="metric"?" metric":""}`,x:0,y:ee[he],width:C,height:dt(Y)}))}),W.kind==="binned"){let Y=new Map;for(let he of y?.bins??[]){let Ge=di(he.scope);Ge!==void 0&&Y.set(Ge,Math.max(Y.get(Ge)??0,he.count))}for(let he of y?.bins??[]){let Ge=di(he.scope);if(Ge===void 0||!wr(Ge))continue;let st=Me(he.t),He=Me(he.t+bs[he.bin]);if(He<0||st>C)continue;let wt=[...ns].reverse().find(fs=>(he.severity[fs]??0)>0)??"info",Vt=Math.max(2,(Ln-8)*Math.sqrt(he.count)/Math.sqrt(Y.get(Ge)||1));Ee.push(ft("rect",{class:"tlx-countbar",x:st,y:ee[Ge]+Ln-3-Vt,width:Math.max(1,He-st-.5),height:Vt,"data-t":he.t},`${Ht(he.t,n)}: ${he.count} event${he.count===1?"":"s"}${wt!=="info"&&wt!=="debug"?`, the worst ${wt}`:""}`)),(wt==="warning"||wt==="error")&&Ee.push(ft("rect",{class:`tlx-heat sev-${wt}`,x:st,y:ee[Ge]+Ln-(wt==="error"?4:3),width:Math.max(1,He-st-.5),height:wt==="error"?3:2}))}}for(let Y of fi){let he=di(Y.scope);if(he===void 0||!wr(he))continue;let Ge=Y.open?os:Y.t+(Y.dur??0),st=Me(Y.t),He=Me(Ge);if(He<-2||st>C+2)continue;let wt=`tlx-span sev-${Y.severity}${Y.open?" open":""}${E?.id===Y.id?" selected":""}`,Vt=`${Y.summary} \xB7 ${Ht(Y.t,n)}${Y.open?", still going":`, ${Tl(Ge-Y.t)}`}`,fs=ee[he]+5,ln=W.kind==="binned"?4:8,ds=st;for(let vs of G.cuts)vs.weight>=1||vs.x1<=st||vs.x0>=He||(vs.x0>ds&&Ee.push(ft("rect",{class:wt,x:ds,y:fs,width:Math.max(1,vs.x0-ds),height:ln,rx:2,"data-id":Y.id},Vt)),Ee.push(ft("path",{class:`${wt} through`,d:`M${vs.x0} ${fs+ln/2} H${vs.x1}`,"data-id":Y.id},`${Vt} (lasted through the break)`)),ds=vs.x1);He>ds&&Ee.push(ft("rect",{class:wt,x:Math.max(-2,ds),y:fs,width:Math.max(2,Math.min(C+2,He)-Math.max(-2,ds)),height:ln,rx:2,"data-id":Y.id},Vt))}let Yl=new Map;for(let Y of $f){let he=di(Y.scope);if(he===void 0||!wr(he))continue;let Ge=Me(Y.t);if(Ge<-6||Ge>C+6||Ge-(Yl.get(he)??-1/0)<3)continue;Yl.set(he,Ge);let st=ee[he]+Ln/2+2,He=4,wt=nm[Y.severity],Vt=wt==="diamond"?`M${Ge} ${st-He-1} l${He+1} ${He+1} l${-He-1} ${He+1} l${-He-1} ${-He-1} z`:wt==="triangle"?`M${Ge} ${st-He-1} l${He+1} ${2*He+1} h${-2*He-2} z`:wt==="square"?`M${Ge-He+.5} ${st-He+.5} h${2*He-1} v${2*He-1} h${-2*He+1} z`:"",fs=`${Ht(Y.t,n)} \xB7 ${Y.summary}`,ln=`tlx-mark sev-${Y.severity}${E?.id===Y.id?" selected":""}${w>=0&&P[w]?.id===Y.id?" hit":""}`;Ee.push(Vt?ft("path",{class:ln,d:Vt,"data-id":Y.id},fs):ft("circle",{class:ln,cx:Ge,cy:st,r:wt==="dot"?2.5:He,"data-id":Y.id},fs))}q.forEach((Y,he)=>{if(Y.kind!=="metric"||!wr(he))return;let Ge=new Map;for(let ot of y?.metrics??[]){if(ot.series!==Y.series)continue;let Kt="value"in ot?{min:ot.value,max:ot.value,sum:ot.value,count:1}:{min:ot.min,max:ot.max,sum:ot.sum,count:ot.count},_t=Ge.get(ot.t);_t?(_t.min=Math.min(_t.min,Kt.min),_t.max=Math.max(_t.max,Kt.max),_t.sum+=Kt.sum,_t.count+=Kt.count):Ge.set(ot.t,{...Kt})}let st=[...Ge].sort((ot,Kt)=>ot[0]-Kt[0]);if(!st.length)return;let He=W.kind==="binned"?bs[W.bin]:ii,wt=ot=>Y.type==="gauge"?ot.sum/Math.max(1,ot.count):ot.sum,Vt=Math.max(1e-9,...st.map(([,ot])=>Y.type==="gauge"?ot.max:wt(ot))),fs=ee[he]+Xo-4,ln=Xo-10,ds=ot=>fs-ot/Vt*ln;if(Y.type==="gauge"){let ot=st.map(([Kt,_t])=>`${Me(Kt)},${ds(_t.max)}`).join(" ")+" "+[...st].reverse().map(([Kt,_t])=>`${Me(Kt)},${ds(_t.min)}`).join(" ");Ee.push(ft("polygon",{class:"tlx-band",points:ot})),Ee.push(ft("polyline",{class:"tlx-line",points:st.map(([Kt,_t])=>`${Me(Kt+He/2)},${ds(wt(_t))}`).join(" ")}))}else{let ot="",Kt=-1/0;for(let[_t,Pf]of st){let Af=Me(_t),Hl=Me(_t+He),Wl=ds(wt(Pf));ot+=_t>Kt?`M${Af} ${fs} V${Wl} H${Hl}`:` V${Wl} H${Hl}`,Kt=_t+He;let Jl=st.find(([Mf])=>Mf>_t);(!Jl||Jl[0]>Kt)&&(ot+=` V${fs} Z`)}Ee.push(ft("path",{class:"tlx-area",d:ot}))}let vs=ft("text",{class:"tlx-peak",x:4,y:ee[he]+11});vs.textContent=`peak ${rm(Vt,Y.unit)}${Y.type==="counter"?` per ${W.kind==="binned"?W.bin:"1m"}`:""}`,Ee.push(vs)});for(let Y of G.cuts){if(Y.weight>=1)continue;let he=He=>{let wt=`M${He} 0`;for(let Vt=0;Vt<Le;Vt+=8)wt+=` L${He+(Vt/8%2?-3:3)} ${Vt+8}`;return wt},Ge=ft("g",{class:"tlx-cut",tabindex:0,role:"button","data-from":Y.from,"data-to":Y.to,"aria-label":`A break of ${zn(Y.to-Y.from)} with nothing shown, from ${Ht(Y.from,n)} to ${Ht(Y.to,n)}: press to open it`},`${zn(Y.to-Y.from)} with nothing here: ${Ht(Y.from,n)} to ${Ht(Y.to,n)} (click to open)`);Ge.append(ft("rect",{class:"tlx-cut-bg",x:Y.x0,y:0,width:Y.x1-Y.x0,height:Le})),Ge.append(ft("path",{class:"tlx-cut-edge",d:he(Y.x0+3)}),ft("path",{class:"tlx-cut-edge",d:he(Y.x1-3)}));let st=ft("text",{class:"tlx-cut-label",x:(Y.x0+Y.x1)/2,y:15,"text-anchor":"middle"});st.textContent=zn(Y.to-Y.from),Ge.append(st),Ee.push(Ge)}if(b!==void 0){let Y=Me(b);Ee.push(ft("line",{class:"tlx-playhead",x1:Y,x2:Y,y1:0,y2:Le})),Ee.push(ft("path",{class:"tlx-handle",d:`M${Y-6} 0 h12 v8 l-6 7 l-6 -7 z`},`the playhead: ${Ht(b,n)}`))}de.replaceChildren(...Ee),Ke.replaceChildren(X("div",{class:"tlx-labelhead",style:`height:${Us}px`},nt().kind==="single"?"single events":`per ${nt().kind==="binned"?nt().bin:""}`),...q.map(Y=>{if(Y.kind==="metric")return X("div",{class:"tlx-rowlabel metric",style:`height:${Xo}px`,title:`${Y.title} (${Y.type==="counter"?"sums":"min, max and mean"})`},Y.title);let he=Y.row,Ge=X("div",{class:`tlx-rowlabel${he.own?" own":""}`,style:`height:${Ln}px`,"data-scope":he.scope,title:`${he.scope||"all hosts"} \xB7 ${he.count} event${he.count===1?"":"s"}`},X("span",{class:"tlx-kind"},e.catalog.flags.find(st=>he[st])??he.kind),X("span",{class:"tlx-name"},he.own?`${he.label} (itself)`:he.label),X("span",{class:"tlx-count"},String(he.count)));if(!he.own&&he.scope!==c){let st=X("button",{type:"button",class:"tlx-drill",title:he.children?`Into ${he.label}: its ${he.children} part${he.children===1?"":"s"}`:`Into ${he.label}`,"aria-label":`Into ${he.label}`},"\u203A");st.addEventListener("click",()=>it(he.scope)),Ge.append(st)}return Ge})),Ke.style.width=`${tm}px`,ye()}function ye(){K.replaceChildren(...fr(c).flatMap((ee,me,Le)=>{let tt=X("button",{type:"button",class:`tlx-crumb${me===Le.length-1?" current":""}`,"aria-current":me===Le.length-1?"location":void 0},Ye(ee.scope,ee.label));return tt.addEventListener("click",()=>{ee.scope!==c&&(c=ee.scope,l=1,B(!0))}),me?[X("span",{class:"tlx-sep","aria-hidden":"true"},"/"),tt]:[tt]})),Q.setAttribute("aria-pressed",String(m)),Q.classList.toggle("on",m),N.hidden=!m||k;let C=nt(),q=y?.total??0,W=(y?.retention??[]).filter(ee=>ee.events!==null).map(ee=>`${ee.source} kept ${ee.events} d`);Ce.textContent=`${Ht(h.t0,n)} \u2013 ${Ht(h.t1,n)} \xB7 ${C.kind==="single"?"single events":`bins of ${C.bin}`} \xB7 ${q} event${q===1?"":"s"}${D.length?` \xB7 ${D.length} break${D.length===1?"":"s"}`:""}${W.length?` \xB7 ${W.slice(0,3).join(", ")}`:""}`,ce.hidden=!x.length,ce.textContent=x.join(" \xB7 "),J.textContent=p?P.length?`${w+1>0?`${w+1} of `:""}${P.length}${P.length>=2e3?"+":""} hit${P.length===1?"":"s"}`:`${q?`${q} hit${q===1?"":"s"}`:"no hits"}`:"";for(let ee of Z.querySelectorAll(".seg"))ee.classList.remove("on");le.textContent=b===void 0?"":$?(()=>{let ee=e.stamp?.($)??{};return`Canvas: the state recorded at ${Ht(Date.parse(ee.at??"")||b,n)}${ee.tag?` (${ee.tag})`:""}`})():"No state recorded here",le.classList.toggle("none",b!==void 0&&!$)}function rt(){Ve.replaceChildren();for(let C of d?.sources??[]){let q=!f.source?.length||f.source.includes(C.name),W=X("button",{type:"button",class:`tlx-chip${q?" on":""}${C.status==="not-yet"?" notyet":""}`,"aria-pressed":String(q&&C.status!=="not-yet"),disabled:C.status==="not-yet",title:C.status==="not-yet"?`${C.title}: not kept yet`:`${C.title}${Te(C)}`},C.name);C.status!=="not-yet"&&W.addEventListener("click",()=>we(C.name)),Ve.append(W)}}let Te=C=>{let q=d?.retention.find(W=>W.source===C.name);return q?` (kept ${q.events===null?"until deleted":`${q.events} days`})`:""};function we(C){let q=(d?.sources??[]).filter(ee=>ee.status==="kept").map(ee=>ee.name),W=f.source?.length?[...f.source]:[...q];W=W.includes(C)?W.filter(ee=>ee!==C):[...W,C],f={...f,...W.length===q.length?{source:void 0}:{source:W}},f.source||delete f.source,rt(),B(!0),De()}let Ie=0;ue.addEventListener("input",()=>{clearTimeout(Ie),Ie=setTimeout(()=>{p=ue.value.trim(),w=-1,B(!0),De()},250)}),ue.addEventListener("keydown",C=>{C.key==="Enter"&&(C.preventDefault(),clearTimeout(Ie),p=ue.value.trim(),B(!0).then(()=>De()).then(()=>ut(C.shiftKey?-1:1)))});async function De(){if(!p){P=[],w=-1,ye();return}let C=h.t1-h.t0;P=(await e.source.query(M(h.t0-C*4,Math.max(h.t1+C*4,mt()),{kind:"single"},{limit:2e3}))).events??[],w=Math.min(w,P.length-1),ye()}function ut(C){if(!P.length)return;let q=(h.t0+h.t1)/2;w<0?w=C>0?Math.max(0,P.findIndex(me=>me.t>=q)):Math.max(0,P.length-1-[...P].reverse().findIndex(me=>me.t<=q)):w=(w+C+P.length)%P.length;let W=P[w],ee=Math.min(h.t1-h.t0,2*_n);h={t0:W.t-ee/2,t1:W.t+ee/2},k=!1,bt(W),B()}te.addEventListener("click",()=>ut(-1)),Se.addEventListener("click",()=>ut(1)),O.addEventListener("change",()=>{let C=O.value;f={...f,...C?{severity:ns.filter(q=>Hp(q)>=Hp(C))}:{}},C||delete f.severity,B(!0),De()});async function kn(C,q=!0){let W=mt();if(C==="run"){let ee=await e.source.query({timeline:1,type:"query",scope:c,depth:0,from:W-30*ps,to:W+1,filters:{kind:["run"]},limit:1e4}).catch(()=>{}),me=ee?.events?.[ee.events.length-1];h=me?{t0:me.t-(me.dur??_n)*.02,t1:(me.open?W:me.t+(me.dur??_n))+(me.dur??_n)*.04}:{t0:W-ps,t1:W+ps*.02}}else h={t0:W-Yp[C],t1:W+Yp[C]*.02};k=!0,I.clear(),L.clear(),q&&B()}function Pt(C,q=!0){if(m=C,R?.(),R=void 0,C&&e.source.subscribe){let W=0,ee=0;R=e.source.subscribe(M(mt()-_n,mt()+365*ps,{kind:"single"}),me=>{if(d&&(d.now=Math.max(d.now,me.now)),k){let tt=h.t1-h.t0;h={t0:me.now-tt*.98,t1:me.now+tt*.02}}let Le=Date.now();Le-W>500?(W=Le,B(!0)):ee||(ee=setTimeout(()=>{ee=0,W=Date.now(),B(!0)},500))}),k=!0}q&&(ye(),Ne())}Q.addEventListener("click",()=>Pt(!m)),N.addEventListener("click",()=>{k=!0;let C=h.t1-h.t0,q=mt();h={t0:q-C*.98,t1:q+C*.02},B()}),j.addEventListener("click",()=>{lt()}),V.addEventListener("change",()=>{u=V.checked,I.clear(),L.clear(),re(),Ne()}),ae.addEventListener("change",()=>{H=ae.checked,re(),Ne()});function it(C){let q=y?.rows.find(W=>W.scope===C);c=C,l=q&&q.children===0?0:1,S=void 0,We.hidden=!0,B(!0)}async function lt(){let C=mt(),W=((await e.source.query({timeline:1,type:"query",scope:c,depth:0,from:C-400*ps,to:C+1,bin:"1d",tz:n}).catch(()=>{}))?.bins??[]).map(me=>me.t),ee=W.length?Math.min(...W):C-7*ps;h={t0:ee,t1:C+(C-ee)*.02},k=!0,B()}let ks=0;async function jt(C){if(b=C,re(),C===void 0){$=void 0;return}let q=++ks,W=e.source.stateAt?await e.source.stateAt(c,C).catch(()=>{}):void 0;q===ks&&($=W,e.onPlayhead?.(C,W),ye())}async function It(C,q){S={from:Math.min(C,q),to:Math.max(C,q)},re();let W=await e.source.query(M(S.from,S.to,{kind:"single"},{limit:500})),ee=o(p),me=Ee=>{let Me=[],Ot=0;for(let[Gt,os]of ri(ee,Ee))Me.push(Ee.slice(Ot,Gt),X("mark",null,Ee.slice(Gt,os))),Ot=os;return Me.push(Ee.slice(Ot)),Me},Le=(W.events??[]).map(Ee=>{let Me=X("tr",{"data-id":Ee.id,tabindex:"0"},X("td",null,Ht(Ee.t,n)),X("td",null,Ee.dur!==void 0?Tl(Ee.dur):Ee.open?"still going":""),X("td",null,Ee.source),X("td",null,Ee.kind),X("td",{class:`sev-${Ee.severity}`},Ee.severity),X("td",{class:"tlx-sum"},...me(Ee.summary)),X("td",{class:"tlx-scope"},Ee.scope));return Me.addEventListener("click",()=>bt(Ee)),Me.addEventListener("keydown",Ot=>{Ot.key==="Enter"&&bt(Ee)}),Me}),tt=X("button",{type:"button",class:"btn sm quiet","aria-label":"Close the table"},"Close");tt.addEventListener("click",()=>{S=void 0,We.hidden=!0,re()});let zs=Ee=>{let Me=X("button",{type:"button",class:"btn sm","data-export":Ee},Ee.toUpperCase());return Me.addEventListener("click",()=>{Bt(Ee)}),Me};We.replaceChildren(X("div",{class:"tlx-table-head"},X("strong",null,`${W.total} event${W.total===1?"":"s"}`),X("span",null,` ${Ht(S.from,n)} \u2013 ${Ht(S.to,n)}${W.total>500?" (the first 500 shown; the export has them all)":""}`),X("span",{class:"spacer"}),X("span",null,"Export: "),zs("json"),zs("csv"),tt),X("div",{class:"tlx-table-wrap"},X("table",null,X("thead",null,X("tr",null,...["When","Long","Source","Kind","Severity","What","Scope"].map(Ee=>X("th",{scope:"col"},Ee)))),X("tbody",null,...Le)))),We.hidden=!1}async function Lt(){if(!S)return[];let C=[],q;do{let W=await e.source.query(M(S.from,S.to,{kind:"single"},{limit:1e4,...q?{cursor:q}:{}}));C.push(...W.events??[]),q=W.next}while(q&&C.length<2e5);return C}async function Bt(C){let q=await Lt(),W=C==="json"?Ho(q,_):Wo(q,_),ee=`timeline-${new Date(S.from).toISOString().slice(0,16).replace(/:/g,"")}.${C}`,me=C==="json"?"application/json":"text/csv";if(e.onExport){e.onExport(ee,W,me);return}let Le=X("a",{href:`data:${me};charset=utf-8,${encodeURIComponent(W)}`,download:ee});document.body.append(Le),Le.click(),Le.remove()}function bt(C){if(E=C,re(),!C){Re.hidden=!0;return}let q=d?.sources.find(Me=>Me.name===C.source),W=new Set(q?.sensitive??[]),ee=o(p),me=Me=>{let Ot=[],Gt=0;for(let[os,fi]of ri(ee,Me))Ot.push(Me.slice(Gt,os),X("mark",null,Me.slice(os,fi))),Gt=fi;return Ot.push(Me.slice(Gt)),Ot},Le=(Me,Ot)=>{if(!Ot)return null;let Gt=X("button",{type:"button",class:"btn sm"},Me);return Gt.addEventListener("click",Ot),Gt},tt=Object.entries(C.attrs).map(([Me,Ot])=>{if(!W.has(Me))return X("tr",null,X("th",{scope:"row"},Me),X("td",null,...me(String(Ot))));let Gt=X("button",{type:"button",class:"btn sm quiet",title:"This can name a remote host, a folder or free text"},"Show"),os=X("td",{class:"tlx-sensitive"},"hidden ",Gt);return Gt.addEventListener("click",()=>os.replaceChildren(String(Ot))),X("tr",null,X("th",{scope:"row"},Me),os)}),zs=X("button",{type:"button",class:"btn sm quiet tlx-close","aria-label":"Close"},"\xD7");zs.addEventListener("click",()=>bt(void 0));let Ee=fr(C.scope).slice(1).map(Me=>{let Ot=X("button",{type:"button",class:"tlx-crumb"},Ye(Me.scope,Me.label));return Ot.addEventListener("click",()=>it(Me.scope)),Ot});Re.replaceChildren(X("div",{class:"tlx-detail-head"},X("strong",null,C.kind),zs),X("p",{class:`tlx-sev sev-${C.severity}`},`${C.severity} \xB7 ${q?.title??C.source}`),X("p",{class:"tlx-sum"},...me(C.summary)),X("p",null,Ht(C.t,n),C.dur!==void 0?` \xB7 ${Tl(C.dur)}${C.open?" so far":""}`:C.open?" \xB7 still going":""),X("p",{class:"tlx-crumbs small"},...Ee),...tt.length?[X("table",{class:"tlx-attrs"},X("tbody",null,...tt))]:[],X("div",{class:"tlx-links"},...(e.actions?.(C)??[]).map(([Me,Ot])=>Le(Me,Ot)))),Re.hidden=!1}function jn(C,q){let W=Cn({from:C,to:q});if(!D.find(tt=>tt.from===C&&tt.to===q))return;if(I.add(W),!i){L.set(W,1),re();return}let me=performance.now(),Le=tt=>{let zs=Math.min(1,(tt-me)/260);L.set(W,1-(1-zs)**3),Ae(),zs<1&&requestAnimationFrame(Le)};requestAnimationFrame(Le)}let Dt,Sn=C=>C.clientX-de.getBoundingClientRect().left;de.addEventListener("pointerdown",C=>{let q=Sn(C),W=C.clientY-de.getBoundingClientRect().top,ee=C.target.closest?.(".tlx-cut");if(ee){C.preventDefault(),jn(Number(ee.getAttribute("data-from")),Number(ee.getAttribute("data-to")));return}de.setPointerCapture(C.pointerId),Dt={kind:W<Us||C.shiftKey?"brush":C.target.classList.contains("tlx-handle")?"scrub":"pan",x0:q,t0:G.t(q),v0:h,moved:!1},C.preventDefault(),ve.focus({preventScroll:!0})}),de.addEventListener("pointermove",C=>{if(!Dt)return;let q=Sn(C);if(Math.abs(q-Dt.x0)>3&&(Dt.moved=!0),!!Dt.moved)if(Dt.kind==="pan"){let W=(Dt.x0-q)*G.msPerPx;h={t0:Dt.v0.t0+W,t1:Dt.v0.t1+W},k=!1,B()}else Dt.kind==="scrub"?jt(G.t(q)):(S={from:Math.min(Dt.t0,G.t(q)),to:Math.max(Dt.t0,G.t(q))},re())}),de.addEventListener("pointerup",C=>{let q=Dt;if(Dt=void 0,!q)return;let W=Sn(C);if(q.kind==="brush"&&q.moved){It(q.t0,G.t(W));return}if(q.kind==="brush"&&!q.moved){jt(G.t(W));return}if(q.kind==="pan"&&!q.moved){let ee=C.target.closest?.("[data-id]")?.getAttribute("data-id"),me=ee?[...y?.events??[],...y?.spans??[]].find(Le=>Le.id===ee):void 0;me?(bt(me),jt(me.t)):jt(G.t(W))}}),de.addEventListener("keydown",C=>{let q=C.target.closest?.(".tlx-cut");q&&(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),jn(Number(q.getAttribute("data-from")),Number(q.getAttribute("data-to"))))}),de.addEventListener("wheel",C=>{C.preventDefault();let q=Sn(C);if(C.shiftKey||Math.abs(C.deltaX)>Math.abs(C.deltaY)){let W=(C.shiftKey?C.deltaY:C.deltaX)*G.msPerPx;h={t0:h.t0+W,t1:h.t1+W},k=!1}else Bn(G.t(q),Math.exp(C.deltaY*.0015),q/at());B()},{passive:!1});function Bn(C,q,W=.5){let ee=Math.min(400*ps,Math.max(1e4,(h.t1-h.t0)*q));h={t0:C-W*ee,t1:C+(1-W)*ee},I.clear(),L.clear(),q<1&&(k=m&&h.t1>=mt())}ve.addEventListener("keydown",C=>{let q=h.t1-h.t0;if(C.key==="ArrowLeft"||C.key==="ArrowRight"){let W=q*.15*(C.key==="ArrowLeft"?-1:1);h={t0:h.t0+W,t1:h.t1+W},k=!1}else if(C.key==="+"||C.key==="=")Bn((h.t0+h.t1)/2,.6);else if(C.key==="-"||C.key==="_")Bn((h.t0+h.t1)/2,1/.6);else if(C.key==="n"||C.key==="N"){ut(C.shiftKey?-1:1),C.preventDefault();return}else if(C.key==="Escape")bt(void 0),S=void 0,We.hidden=!0;else return;C.preventDefault(),B()}),t.addEventListener("keydown",C=>{C.key==="/"&&document.activeElement!==ue&&!C.target.closest("input, select, textarea")&&(C.preventDefault(),ue.focus())}),Oe.addEventListener("scroll",()=>re(),{passive:!0}),ne.addEventListener("click",async()=>{let C=`${fr(c).slice(-1)[0].label}${p?`: ${p}`:""}`.slice(0,80);await e.saveView?.({...pe(),name:C}),await Ss()});let je=[];async function Ss(){e.views&&(je=await e.views(),U.replaceChildren(X("option",{value:""},"Saved views\u2026"),...je.map((C,q)=>X("option",{value:String(q)},C.name))))}U.addEventListener("change",()=>{let C=je[Number(U.value)];C&&(Fe(C),rt(),B(!0)),U.value=""});let ct=typeof ResizeObserver=="function"?new ResizeObserver(()=>re()):void 0;ct?.observe(ve);let Qt=(async()=>{d=await e.source.catalog(),_=d.sources.flatMap(ee=>(ee.sensitive??[]).map(me=>`${ee.name}.${me}`));for(let ee of d.sources)for(let me of ee.series)se.set(me.name,{unit:me.unit,type:me.type,title:me.title,source:ee.name});c=d.hosts.length===1?`host:${d.hosts[0].replace(/[%/:\s]/g,ee=>`%${ee.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`)}`:"";let q=d.now;h={t0:q-ps,t1:q+ps*.02};let W=pt()??e.view;W&&Fe(W),rt(),await Ss(),await B(!0),p&&await De()})();return{el:t,ready:Qt,get view(){return pe()},setView(C){return Fe(C),rt(),B(!0)},setRange(C,q){return h={t0:C,t1:q},k=!1,B()},setPlayhead:jt,setLive:Pt,setTheme:a,refresh:()=>B(!0),internal:{get result(){return y},get mode(){return nt()},get scale(){return G},get gaps(){return D},get playState(){return $},get hits(){return P},get selected(){return E},get follow(){return k},openCut:jn,showTable:It,rangeEvents:Lt,exportRange:Bt,select:bt,stepHit:ut,drill:it,findHits:De,paint:Ae,lines:gt},dispose(){R?.(),ct?.disconnect(),T&&cancelAnimationFrame(T),t.replaceChildren()}}}var im={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}},Wt=t=>(Math.round(t*10)/10).toString(),Jp=t=>(t??"link").replace(/[^\w-]/g,"_");function Qo(t,e){let{id:n}=e,r=e.styles??{},i=t.options,o=t.bounds,s=new Map,a=(m,u)=>{let h=r[m]??{},y=u==="start"?h.start??"none":h.end??"arrow";if(y!=="none")return(s.get(m)??s.set(m,new Set).get(m)).add(y),`url(#${n}-mk-${m}-${y})`},d="",c="",l="",p="";for(let m of[...t.panels].sort((u,h)=>u.depth-h.depth)){let u=m.rect,h=m.label?fe("text",{class:"pl",x:m.titleAt[0],y:m.titleAt[1]},xt(m.label)+(m.sub?fe("tspan",{class:"pls",dx:10},xt(m.sub)):"")):"";d+=fe("g",{class:`panel k-${m.role??"grey"}`,"data-id":m.id},fe("rect",{class:"face",x:Wt(u.l),y:Wt(u.t),width:Wt(u.r-u.l),height:Wt(u.b-u.t),rx:i.panelRx})+h)}for(let m of t.links){if(!m.points.length)continue;let u=Jp(m.kind);c+=fe("path",{class:`conn k-${u}`,d:"M"+m.points.map(h=>`${Wt(h[0])},${Wt(h[1])}`).join(" L"),"data-id":m.id,"data-a":m.a,"data-b":m.b,"marker-start":a(u,"start"),"marker-end":a(u,"end")}),m.at&&(p+=fe("text",{class:`cl k-${u}`,x:m.at.x,y:m.at.y,"text-anchor":m.at.anchor==="start"?void 0:m.at.anchor,"data-for":m.id},xt(m.at.text)))}for(let m of t.cards){let u=m.rect;l+=fe("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},fe("rect",{class:"face",x:Wt(u.l),y:Wt(u.t),width:i.W,height:i.H,rx:i.cardRx})+fe("text",{class:"lt",x:Wt(u.l+14),y:Wt(u.t+24)},xt(m.label))+(m.sub?fe("text",{class:"st",x:Wt(u.l+14),y:Wt(u.t+42)},xt(m.sub)):""))}let f="";for(let[m,u]of s)for(let h of u){let y=im[h];f+=fe("marker",{id:`${n}-mk-${m}-${h}`,viewBox:"0 0 10 10",refX:y.refX,refY:5,markerWidth:5.4,markerHeight:5.4,orient:"auto-start-reverse"},fe("path",{d:y.d,class:`mk k-${m}`}))}return fe("svg",{xmlns:"http://www.w3.org/2000/svg",class:"flat",viewBox:`${Wt(o.l)} ${Wt(o.t)} ${Wt(o.r-o.l)} ${Wt(o.b-o.t)}`,role:"img","aria-label":e.title??"drawing, flat view","data-view":"2d"},(f?fe("defs",{},f):"")+fe("g",{class:"panels"},d)+fe("g",{class:"conns"},c)+fe("g",{class:"cards"},l)+fe("g",{class:"labels"},p))}function Xp(t={}){let e=r=>r?r.startsWith("#")||r.includes("(")?r:`var(--${r})`:"var(--ink)",n=`
368
+ `}var gh=864e5,Jn=36e5,el=(t,e)=>t.t-e.t||(t.id<e.id?-1:t.id>e.id?1:0);function ds(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 Cd=(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 Id(t,e,s){let r=[];for(let i of t){let o=sr(i.t,e,s),n=r[r.length-1];n&&n.t===o?Cd(n,i):r.push({t:o,min:i.min,max:i.max,sum:i.sum,count:i.count})}return r}function Zc(t,e,s,r){for(let n=ds(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=ds(t,e.t);for(;o<t.length&&r(t[o],e)<0;)o++;t.splice(o,0,e)}function zd(t,e,s){for(let r=ds(t,e);r<t.length&&t[r].t===e;r++)if(s(t[r])){t.splice(r,1);return}}function jd(t,e,s={}){let r=t.catalog,{isScope:i}=Ga(e),{parseSearch:o,matchAst:n,toAst:a}=Yr(e),m=N=>Object.fromEntries(e.flags.filter(ee=>N?.[ee]).map(ee=>[ee,!0])),p=s.now??r.now,c=(r.names??[]).flatMap(N=>(N.aliases??[]).map(ee=>[ee,N.scope])).sort((N,ee)=>ee[0].length-N[0].length),l=new Map,f=N=>{if(!c.length)return N;let ee=l.get(N);if(ee===void 0){let ye=c.find(([ke])=>un(N,ke));ee=ye?ye[1]+N.slice(ye[0].length):N,l.set(N,ee)}return ee},d=new Map((r.names??[]).map(N=>[N.scope,N])),u=N=>c.length?{...N,scope:f(N.scope)}:N,y=N=>`${N.source}\0${N.id}`,g=t.events.map(u).sort(el),x=new Map;for(let N of g)x.set(y(N),N);let h=g.filter(N=>N.dur!==void 0&&!N.open),b=h.reduce((N,ee)=>Math.max(N,ee.dur),0),w=new Map;for(let N of g)N.open&&w.set(y(N),N);let k=new Map,$=new Set,v=N=>{for(let ee=Jt(N);ee>=1;ee--){let ye=$s(N,ee);if($.has(ye))break;$.add(ye)}},T=new Map;for(let N of r.sources)for(let ee of N.series)T.set(ee.name,ee.type);let R=r.sources.flatMap(N=>(N.sensitive??[]).map(ee=>`${N.name}.${ee}`)),O=new Map;for(let N of r.sources)O.set(N.name,{events:N.defaultRetention.events,rollups:{...N.defaultRetention.rollups},setBy:"default"});for(let N of r.retention)O.set(N.source,{events:N.events,rollups:{...N.rollups},setBy:N.setBy});let I=new Map;for(let N of r.sources)for(let ee of N.series)I.set(ee.name,N.name);function M(N){let ee=f(N.scope),ye=`${N.series}\0${ee}`,ke=k.get(ye);ke||(ke={series:N.series,scope:ee,fine:[],cache:new Map},k.set(ye,ke),v(ee));let Ve="value"in N?{t:N.t,min:N.value,max:N.value,sum:N.value,count:1}:{t:N.t,min:N.min,max:N.max,sum:N.sum,count:N.count};Zc(ke.fine,Ve,we=>we.t===Ve.t,(we,Ue)=>we.t-Ue.t),ke.cache.clear()}for(let N of g)v(N.scope);for(let N of t.metrics)M(N);let A=new Map,P=new Set,j=(N,ee)=>{P.add(N.source);let ye=A.get(N.scope);ye||A.set(N.scope,ye=new Map);let ke=ye.get(N.source);ke||ye.set(N.source,ke=new Map);let Ve=Math.floor(N.t/Jn)*Jn,we=ke.get(Ve);if(we||ke.set(Ve,we={t:Ve,count:0,severity:{},kinds:{},first:1/0,last:-1/0}),we.count+=ee,ee>0)we.first=Math.min(we.first,N.t),we.last=Math.max(we.last,N.t);else if(N.t===we.first||N.t===we.last){we.first=1/0,we.last=-1/0;for(let Ue=ds(g,Ve);Ue<g.length&&g[Ue].t<Ve+Jn;Ue++){let Le=g[Ue];Le.scope===N.scope&&Le.source===N.source&&(we.first=Math.min(we.first,Le.t),we.last=Math.max(we.last,Le.t))}}we.severity[N.severity]=(we.severity[N.severity]??0)+ee,we.kinds[N.kind]=(we.kinds[N.kind]??0)+ee,we.severity[N.severity]===0&&delete we.severity[N.severity],we.kinds[N.kind]===0&&delete we.kinds[N.kind],we.count||ke.delete(Ve)};for(let N of g)j(N,1);let F=(N,ee,ye)=>{let ke=`${ee}|${ye??""}`,Ve=N.cache.get(ke);return Ve||(Ve=ee==="1d"?Id(F(N,"1h",ye),"1d",ye):Id(N.fine,ee,ye),N.cache.set(ke,Ve)),Ve},Y=N=>N===null?-1/0:p-N*gh,J=N=>Y(O.get(N)?.events??null),U=(N,ee)=>{let ye=O.get(N);return Y(ye?ee?ye.rollups[ee]:ye.events:null)};function C(N){let ee=[];for(let ye of new Set(N)){let ke=O.get(ye);if(!ke)continue;let Ve=g.find($e=>$e.source===ye&&$e.t>=J(ye))?.t,we=$e=>{let S=1/0;for(let B of k.values())if(I.get(B.series)===ye){let K=($e?F(B,$e):B.fine).find(ae=>ae.t>=U(ye,$e));K&&K.t<S&&(S=K.t)}return S===1/0?void 0:S},Ue=[Ve,we()].filter($e=>$e!==void 0),Le={};for(let $e of["1m","1h","1d"]){let S=we($e)??(Ve!==void 0&&Ve>=U(ye,$e)?Ve:void 0);S!==void 0&&(Le[$e]=Math.max(S,U(ye,$e)))}ee.push({source:ye,events:ke.events,rollups:{...ke.rollups},setBy:ke.setBy,keptFrom:{...Ue.length?{events:Math.min(...Ue)}:{},rollups:Le}})}return ee}function G(N){let ee=N.where,ye={from:N.from,to:N.to},ke=[];if(!ee&&N.q){let K=o(N.q,p);ee=a(K),ye=Xi(K,N.from,N.to),ke=K.warnings}let Ve=n(ee,R),we=N.filters??{},Ue=we.source?.length?new Set(we.source):void 0,Le=we.kind?.length?new Set(we.kind):void 0,$e=we.severity?.length?new Set(we.severity):void 0,S=we.scope?.length?we.scope:void 0;return{test:K=>un(K.scope,N.scope)&&(!Ue||Ue.has(K.source))&&(!Le||Le.has(K.kind))&&(!$e||$e.has(K.severity))&&(!S||S.some(ae=>un(K.scope,ae)))&&K.t>=J(K.source)&&Ve(K),range:ye,warnings:ke}}function Z(N){let ee=Jt(N.scope),ye=ee+N.depth,ke=new Map,Ve=$e=>{let S=ke.get($e);return S===void 0&&!ke.has($e)&&(S=un($e,N.scope)?Jt($e)>=ye?$s($e,ye):$e:void 0,ke.set($e,S)),S},we=$e=>{let S=0,B=Jt($e)+1;for(let K of $)Jt(K)===B&&un(K,$e)&&S++;return S},Ue=new Map,Le=$e=>{let S=Ue.get($e);if(!S){let B=Jt($e)-ee,K=d.get($e);S={scope:$e,label:K?.label??Zr($e),kind:Gr($e),...m(K),depth:B,...B<N.depth?{own:!0}:{},children:we($e),count:0},Ue.set($e,S)}return S};for(let $e of $)Jt($e)===ye&&un($e,N.scope)&&Le($e);return ye===0&&Le(""),{at:Ve,add:Le,rows:Ue}}let Q=N=>[...N.values()].sort((ee,ye)=>ee.scope===ye.scope?0:ee.scope<ye.scope?-1:1);function z(N,ee){let ye=[];for(let ke=ds(h,N-b);ke<h.length&&h[ke].t<N;ke++)h[ke].t+h[ke].dur>N&&ye.push(h[ke]);for(let ke of w.values())ke.t<N&&p>N&&ye.push(ke);for(let ke=ds(g,N);ke<g.length&&g[ke].t<ee;ke++)ye.push(g[ke]);return ye}function D(N,ee,ye,ke){let Ve=N.series?new Set(N.series):void 0,we=new Map;for(let Le of k.values()){if(Ve&&!Ve.has(Le.series))continue;let $e=ee(Le.scope);if($e===void 0)continue;let S=I.get(Le.series)??"",B=U(S,N.bin),K=N.bin?F(Le,N.bin,N.tz):Le.fine;for(let ae=ds(K,N.bin?sr(ye,N.bin,N.tz):ye);ae<K.length&&K[ae].t<ke;ae++){let le=K[ae];if(le.t<B)continue;let fe=`${Le.series}\0${$e}\0${le.t}`,se=we.get(fe);se?Cd(se,le):we.set(fe,{series:Le.series,scope:$e,t:le.t,bin:N.bin??"1m",min:le.min,max:le.max,sum:le.sum,count:le.count})}}let Ue=[...we.values()].sort((Le,$e)=>Le.t-$e.t||(Le.series<$e.series?-1:1)||(Le.scope<$e.scope?-1:1));return N.bin?Ue:Ue.map(Le=>({series:Le.series,scope:Le.scope,t:Le.t,value:Le.count===1||T.get(Le.series)!=="gauge"?Le.sum:Le.sum/Le.count}))}let V=N=>`${N.t}:${N.id}`,W=(N,ee)=>{let ye=ee.indexOf(":"),ke=Number(ee.slice(0,ye)),Ve=ee.slice(ye+1);return N.t>ke||N.t===ke&&N.id>Ve};function de(N){if(N.bin!=="1h"&&N.bin!=="1d"||(N.where?.all.length??0)||N.q||N.filters?.kind?.length||N.filters?.severity?.length||N.filters?.scope?.length||tn(N.tz,N.from)%Jn||tn(N.tz,N.to)%Jn)return;let ee=N.filters?.source?.length?new Set(N.filters.source):void 0,ye=te=>Math.max(N.from,J(te)),{at:ke,add:Ve,rows:we}=Z(N),Ue=new Set,Le=new Map,$e=0,S=(te,xe)=>{let he=sr(xe,N.bin,N.tz),Ie=`${te}\0${he}`,E=Le.get(Ie);return E||(E={scope:te,t:he,bin:N.bin,count:0,severity:{},kinds:{}},Le.set(Ie,E)),E},B=(te,xe,he)=>{let Ie=Ve(te);Ie.count+=he,$e+=he,(Ie.first===void 0||xe<Ie.first)&&(Ie.first=xe),(Ie.last===void 0||xe>Ie.last)&&(Ie.last=xe)},K=Math.floor(N.to/Jn)*Jn;for(let[te,xe]of A){let he=ke(te);if(he!==void 0)for(let[Ie,E]of xe){if(ee&&!ee.has(Ie))continue;let q=Math.ceil(ye(Ie)/Jn)*Jn;for(let[_,re]of E){if(_<q||_>=K)continue;B(he,re.first,re.count),re.last>(we.get(he).last??-1/0)&&(we.get(he).last=re.last),Ue.add(Ie);let pe=S(he,_);pe.count+=re.count;for(let[Te,Pe]of Object.entries(re.severity))pe.severity[Te]=(pe.severity[Te]??0)+Pe;for(let[Te,Pe]of Object.entries(re.kinds))pe.kinds[Te]=(pe.kinds[Te]??0)+Pe}}}let ae=te=>un(te.scope,N.scope)&&(!ee||ee.has(te.source))&&te.t>=J(te.source)&&ke(te.scope)!==void 0,le=te=>{let xe=ke(te.scope);B(xe,te.t,1),Ue.add(te.source);let he=S(xe,te.t);he.count++,he.severity[te.severity]=(he.severity[te.severity]??0)+1,he.kinds[te.kind]=(he.kinds[te.kind]??0)+1};for(let te of P){if(ee&&!ee.has(te))continue;let xe=ye(te),he=Math.ceil(xe/Jn)*Jn,Ie=he>=K?[[xe,N.to]]:[[xe,he],[K,N.to]];for(let[E,q]of Ie)for(let _=ds(g,E);_<g.length&&g[_].t<q;_++){let re=g[_];re.source===te&&ae(re)&&le(re)}}let fe=Rn[N.bin],se=[];for(let te=ds(h,N.from-b);te<h.length&&h[te].t<N.from;te++){let xe=h[te];xe.t+xe.dur>N.from&&ae(xe)&&(B(ke(xe.scope),xe.t,1),Ue.add(xe.source),xe.dur>=fe&&se.length<5e3&&se.push(xe))}for(let te of w.values())te.t<N.from&&p>N.from&&ae(te)&&(B(ke(te.scope),te.t,1),Ue.add(te.source),se.length<5e3&&se.push(te));for(let te=ds(h,N.from);te<h.length&&h[te].t<N.to&&se.length<5e3;te++)h[te].dur>=fe&&ae(h[te])&&se.push(h[te]);for(let te of w.values())te.t>=N.from&&te.t<N.to&&se.length<5e3&&ae(te)&&se.push(te);let ge=D(N,ke,N.from,N.to);for(let te of ge){let xe=I.get(te.series);xe&&Ue.add(xe)}let Se=[...Le.values()].sort((te,xe)=>te.t-xe.t||(te.scope<xe.scope?-1:1));return{timeline:1,type:"result",rows:Q(we),bins:Se,spans:se,metrics:ge,total:$e,retention:C(Ue)}}async function ce(N){if(!i(N.scope))throw new Error(`not a scope path: ${JSON.stringify(N.scope)}`);let ee=de(N);if(ee)return ee;let{test:ye,range:ke,warnings:Ve}=G(N),{at:we,add:Ue,rows:Le}=Z(N),$e=new Set,S=[];for(let ge of z(ke.from,ke.to)){if(!ye(ge))continue;let Se=we(ge.scope);if(Se===void 0)continue;let te=Ue(Se);te.count++,(te.first===void 0||ge.t<te.first)&&(te.first=ge.t),(te.last===void 0||ge.t>te.last)&&(te.last=ge.t),$e.add(ge.source),S.push(ge)}S.sort(el);let B=D(N,we,ke.from,ke.to);for(let ge of B){let Se=I.get(ge.series);Se&&$e.add(Se)}let K={timeline:1,type:"result",total:S.length,...Ve.length?{warnings:Ve}:{}};if(N.bin){let ge=Rn[N.bin],Se=new Map,te=[];for(let he of S){if((he.open||he.dur!==void 0&&he.dur>=ge)&&te.length<5e3&&te.push(he),he.t<ke.from)continue;let Ie=we(he.scope),E=sr(he.t,N.bin,N.tz),q=`${Ie}\0${E}`,_=Se.get(q);_||(_={scope:Ie,t:E,bin:N.bin,count:0,severity:{},kinds:{}},Se.set(q,_)),_.count++,_.severity[he.severity]=(_.severity[he.severity]??0)+1,_.kinds[he.kind]=(_.kinds[he.kind]??0)+1}let xe=[...Se.values()].sort((he,Ie)=>he.t-Ie.t||(he.scope<Ie.scope?-1:1));return{...K,rows:Q(Le),bins:xe,spans:te,metrics:B,retention:C($e)}}let ae=Math.min(1e4,Math.max(1,N.limit??2e3)),le=N.cursor?S.findIndex(ge=>W(ge,N.cursor)):0,fe=le<0?[]:S.slice(le,le+ae),se=le>=0&&le+ae<S.length;return{...K,rows:Q(Le),events:fe,metrics:B,retention:C($e),...se?{next:V(fe[fe.length-1])}:{}}}let H=new Set,ne=N=>mn.includes(N),Ee=0;function qe(N){let ee=y(N),ye=x.get(ee);ye&&(zd(g,ye.t,ke=>ke===ye),j(ye,-1),ye.dur!==void 0&&!ye.open&&zd(h,ye.t,ke=>ke===ye),w.delete(ee)),x.set(ee,N),j(N,1),Zc(g,N,()=>!1,el),N.open?w.set(ee,N):N.dur!==void 0&&(Zc(h,N,()=>!1,el),b=Math.max(b,N.dur)),v(N.scope)}return{async catalog(){return{...r,now:p,retention:C(r.sources.map(N=>N.name))}},query:ce,subscribe(N,ee){let ye={q:N,on:ee};return H.add(ye),()=>{H.delete(ye)}},...s.stateAt?{stateAt:(N,ee)=>s.stateAt(N,ee)}:{},append(N,ee=[],ye){ye!==void 0&&(p=Math.max(p,ye));let ke=new Set($),Ve=N.map(u);for(let we of Ve){if(!ne(we.severity))throw new Error(`not a severity: ${we.severity}`);qe(we)}for(let we of ee)M(we);Ee++;for(let we of H){let{test:Ue}=G(we.q),{at:Le}=Z(we.q),$e=Ve.filter(fe=>Ue(fe)&&Le(fe.scope)!==void 0),S=we.q.series?new Set(we.q.series):void 0,B=ee.filter(fe=>un(f(fe.scope),we.q.scope)&&(!S||S.has(fe.series))).map(fe=>({...fe,scope:Le(f(fe.scope))})),K=[...$].filter(fe=>!ke.has(fe)),ae=Jt(we.q.scope)+we.q.depth,le=K.filter(fe=>Jt(fe)===ae&&un(fe,we.q.scope)).map(fe=>({scope:fe,label:d.get(fe)?.label??Zr(fe),kind:Gr(fe),depth:we.q.depth,children:0,count:0}));we.on({timeline:1,type:"batch",events:$e,metrics:B,...le.length?{rows:le}:{},now:p,resume:String(Ee)})}},setRetention(N,ee){O.set(N,{events:ee.events,rollups:{...ee.rollups},setBy:"user"})},get now(){return p},get size(){let N=0;for(let ee of k.values())N+=ee.fine.length;return{events:g.length,samples:N}}}}var Ld="http://www.w3.org/2000/svg",or=22,tl=38,ms=26,bh=210,wh=24,eo=6e4,ar=36e5,xn=864e5,_d={"15m":15*eo,"1h":ar,"1d":xn,"1w":7*xn},Fd=t=>mn.indexOf(t),xh={debug:"dot",info:"circle",notice:"square",warning:"triangle",error:"diamond"},yt=(t,e,s)=>{let r=document.createElementNS(Ld,t);for(let[i,o]of Object.entries(e))o!==void 0&&r.setAttribute(i,String(o));if(s){let i=document.createElementNS(Ld,"title");i.textContent=s,r.append(i)}return r},nn=(t,e)=>{try{return new Intl.DateTimeFormat(void 0,{timeZone:e,dateStyle:"medium",timeStyle:"medium"}).format(t)}catch{return new Date(t).toISOString()}},Uc=t=>t<1e3?`${Math.round(t)} ms`:t<eo?`${(t/1e3).toFixed(1)} s`:rr(t),kh=(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 Yc(t,e){if(t<=3*ar)return{kind:"single"};for(let s of["1m","1h","1d"])if(t/Rn[s]<=e/2)return{kind:"binned",bin:s};return{kind:"binned",bin:"1d"}}function Hc(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"?Rn[e.bin]:eo;for(let n of t.bins??[])n.count&&r.push([n.t,n.t+Rn[n.bin]]);let o=new Map;for(let n of t.metrics){let a="value"in n?n.value:n.sum,m=`${n.series}|${n.scope}`,p=(s?.get(n.series)??"counter")==="counter"?a!==0:o.get(m)!==a;o.set(m,a),p&&r.push([n.t,n.t+i])}return r}function Dd(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}=Yr(e.catalog),a=(L="system")=>{t.style.colorScheme=L==="system"?"light dark":L,L==="system"?delete t.dataset.theme:t.dataset.theme=L};a(e.theme),t.setAttribute("role","region"),t.setAttribute("aria-label","Timeline");let m,p="",c=1,l="",f={},d=!1,u=e.collapseGaps??!0,y={t0:0,t1:xn},g,x="",h={from:0,to:0,mode:{kind:"single"},key:""},b,w,k,$,v=!0,T=0,R=0,O=!1,I,M=[],A=[],P=-1,j=new Set,F=new Map,Y=[],J=Hr(0,xn,800),U=new Map,C=[],G=me("nav",{class:"tlx-crumbs","aria-label":"Scope"}),Z=me("div",{class:"segmented tlx-quick",role:"group","aria-label":"Range"});for(let L of["15m","1h","1d","1w","run"]){let X=me("button",{type:"button",class:"seg","data-v":L,title:L==="run"?"The latest run":`The last ${L}`},L==="run"?"this run":L);X.addEventListener("click",()=>Vs(L)),Z.append(X)}let Q=me("button",{type:"button",class:"btn sm tlx-live","aria-pressed":"false",title:"Follow what happens now"},"Live"),z=me("button",{type:"button",class:"btn sm quiet tlx-now",hidden:!0,title:"Back to the live edge"},"Back to now"),D=me("button",{type:"button",class:"btn sm quiet tlx-fit",title:"Everything in this scope"},"Fit"),V=me("input",{type:"checkbox",class:"tlx-gaps"});V.checked=u;let W=!0,de=me("input",{type:"checkbox",class:"tlx-quiet"});de.checked=W;let ce=me("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=me("span",{class:"tlx-hits",role:"status","aria-live":"polite"}),ne=me("button",{type:"button",class:"btn sm quiet tlx-prev",title:"Previous hit (\u21E7N)","aria-label":"Previous hit"},"\u2039"),Ee=me("button",{type:"button",class:"btn sm quiet tlx-next",title:"Next hit (N)","aria-label":"Next hit"},"\u203A"),qe=me("div",{class:"tlx-facets",role:"group","aria-label":"Sources"}),N=me("select",{class:"input tlx-sev","aria-label":"Severity"},me("option",{value:""},"every severity"),...mn.slice(1).map(L=>me("option",{value:L},`${L} and above`))),ee=me("select",{class:"input tlx-views","aria-label":"Saved views",hidden:!e.views},me("option",{value:""},"Saved views\u2026")),ye=me("button",{type:"button",class:"btn sm quiet tlx-save",hidden:!e.saveView,title:"Save this view"},"Save view"),ke=me("div",{class:"tlx-warn",role:"status",hidden:!0}),Ve=me("div",{class:"tlx-status",role:"status"}),we=me("span",{class:"tlx-canvas-note"}),Ue=me("div",{class:"tlx-labels"}),Le=me("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"}),$e=yt("svg",{class:"tlx-svg"});Le.append($e);let S=me("div",{class:"tlx-scroll"},me("div",{class:"tlx-grid"},Ue,Le)),B=me("section",{class:"tlx-table",hidden:!0,"aria-label":"The events in the chosen range"}),K=me("aside",{class:"tlx-detail",hidden:!0,"aria-label":"The event"});t.replaceChildren(me("div",{class:"tlx-bar"},G,me("span",{class:"spacer"}),Z,Q,z,D,me("label",{class:"tlx-gaps-label",title:"Draw long empty stretches as narrow breaks"},V,"Collapse gaps"),me("label",{class:"tlx-gaps-label",title:"Hide the rows with nothing in this range"},de,"Hide quiet rows")),me("div",{class:"tlx-bar"},ce,H,ne,Ee,N,ee,ye),qe,ke,me("div",{class:"tlx-body"},S,K),me("div",{class:"tlx-foot"},Ve,me("span",{class:"spacer"}),we),B);let ae=()=>Math.max(200,Le.clientWidth||800),le=()=>{let L=(Oe,Ye)=>(Oe.own?-1:0)-(Ye.own?-1:0)||Oe.scope.localeCompare(Ye.scope,void 0,{numeric:!0}),oe=(g?.rows??[]).filter(Oe=>!W||Oe.count>0||Oe.own||(g?.rows.length??0)<=1).sort(L).map(Oe=>({kind:"row",row:Oe})),ue=new Set(g?.metrics.map(Oe=>Oe.series)??[]);for(let Oe of[...ue].sort()){let Ye=U.get(Oe);oe.push({kind:"metric",series:Oe,unit:Ye?.unit??"count",type:Ye?.type??"counter",title:Ye?.title??Oe})}return oe},fe=(L,X)=>m?.names?.find(oe=>oe.scope===L)?.label??X,se=L=>L.kind==="metric"?tl:or,ge=()=>Yc(y.t1-y.t0,ae()),Se=()=>m?.now??Date.now();function te(){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(f).length?{filters:f}:{},...d?{live:d}:{},...u?{}:{collapseGaps:!1},...W?{}:{quietRows:!0}}}function xe(L){L.scope!==void 0&&(p=L.scope),L.depth!==void 0&&(c=L.depth),l=L.q??"",ce.value=l,f=L.filters??{},N.value=f.severity?.length?f.severity[0]:"",u=L.collapseGaps??e.collapseGaps??!0,V.checked=u,W=!L.quietRows,de.checked=W,j.clear(),F.clear();let X=L.range;X&&"last"in X?Vs(X.last,!1):X&&(y={t0:X.from,t1:X.to}),Tt(!!L.live,!1)}let he=()=>{let L=te();if(e.onViewChange?.(L),!!e.urlState)try{history.replaceState(null,"",`#timeline=${encodeURIComponent(JSON.stringify(L))}`)}catch{}},Ie=()=>{if(!e.urlState)return;let L=/#timeline=(.+)$/.exec(location.hash);if(L)try{return JSON.parse(decodeURIComponent(L[1]))}catch{return}};function E(L,X,oe,ue={}){let Oe=n(l,Se(),L,X);M=Oe.warnings;let Ye=l?[]:f.source?[...U].filter(([,pt])=>f.source.includes(pt.source)).map(([pt])=>pt):void 0;return{timeline:1,type:"query",scope:p,depth:c,from:Oe.from,to:Oe.to,tz:s,...oe.kind==="binned"?{bin:oe.bin}:{},...l?{q:l,where:Oe.where}:{},...Object.keys(f).length?{filters:f}:{},...Ye?{series:Ye}:{},...ue}}let q=()=>JSON.stringify([p,c,l,f,ge()]);async function _(L=!1){let X=ge(),oe=q(),ue=y.t1-y.t0;if(!L&&g&&oe===h.key&&y.t0>=h.from&&y.t1<=h.to){pe();return}if(R){O=!0;return}R++;let Oe=y.t0-ue/2,Ye=Math.min(y.t1+ue/2,Math.max(y.t1,Se()+ue*.1));try{let pt=await e.source.query(E(Oe,Ye,X,X.kind==="single"?{limit:1e4}:{}));X.kind==="single"&&pt.next&&(pt=await e.source.query(E(Oe,Ye,{kind:"binned",bin:"1m"}))),g=pt,x=oe,h={from:Oe,to:Ye,mode:X,key:oe}}catch(pt){Ve.textContent=`The history couldn't be read: ${String(pt?.message??pt)}`}finally{R--}pe(),he(),O&&(O=!1,_())}function re(){let L=ae(),X=ge();if(Y=[],u&&g){let oe=new Map([...U].map(([ue,Oe])=>[ue,Oe.type]));Y=Wa(Hc(g,X,oe),y.t0,Math.min(y.t1,Math.max(y.t0,Se())),{minFrac:.15,minMs:10*eo}),X.kind==="binned"&&(Y=Y.filter(ue=>ue.to-ue.from>=2*Rn[X.bin])),Y=Y.filter(ue=>!(j.has(ir(ue))&&(F.get(ir(ue))??1)>=1))}J=Hr(y.t0,y.t1,L,Y,{cut:wh,weights:F})}let pe=()=>{T||(T=requestAnimationFrame(Te))};function Te(){T=0,re();let L=ae(),X=le(),oe=h.mode,ue=[],Oe=ms;for(let ie of X)ue.push(Oe),Oe+=se(ie);let Ye=Math.max(Oe,ms+or);$e.setAttribute("width",String(L)),$e.setAttribute("height",String(Ye)),$e.setAttribute("viewBox",`0 0 ${L} ${Ye}`);let pt=S.scrollTop-200,Qn=S.scrollTop+(S.clientHeight||600)+200,Be=[],De=J.x;Be.push(yt("rect",{class:"tlx-axis",x:0,y:0,width:L,height:ms}));let Xt=(g?.retention??[]).map(ie=>({r:ie,from:oe.kind==="binned"?ie.keptFrom.rollups[oe.bin]??ie.keptFrom.events:ie.keptFrom.events,days:oe.kind==="binned"?ie.rollups[oe.bin]:ie.events})).filter(ie=>ie.from!==void 0);if(Xt.length){let ie=Math.min(...Xt.map(Ae=>Ae.from));ie>y.t0&&Be.push(yt("rect",{class:"tlx-notkept",x:Math.max(0,De(y.t0)),y:ms,width:Math.max(0,De(ie)-Math.max(0,De(y.t0))),height:Ye-ms},`Nothing kept before ${nn(ie,s)}: ${Xt.map(Ae=>`${Ae.r.source} ${Ae.days===null?"kept until deleted":`kept ${Ae.days} days`}`).join(", ")}`))}let yn=Se();yn<y.t1&&Be.push(yt("rect",{class:"tlx-future",x:De(yn),y:ms,width:L-De(yn),height:Ye-ms}));for(let ie of Ja(J,s,90)){Be.push(yt("line",{class:`tlx-tick${ie.major?" major":""}`,x1:ie.x,x2:ie.x,y1:ms-6,y2:Ye}));let Ae=yt("text",{class:"tlx-ticklabel",x:ie.x+3,y:16});Ae.textContent=ie.label,Be.push(Ae)}$&&Be.push(yt("rect",{class:"tlx-brush",x:De($.from),y:0,width:Math.max(1,De($.to)-De($.from)),height:Ye}));let ao=oe.kind==="single"?(g?.events??[]).filter(ie=>ie.dur!==void 0||ie.open):g?.spans??[],mm=oe.kind==="single"?(g?.events??[]).filter(ie=>ie.dur===void 0&&!ie.open):[],cp=new Map;X.forEach((ie,Ae)=>{ie.kind==="row"&&cp.set(ie.row.scope,Ae)});let lo=ie=>{let Ae=Jt(p)+c,tt=Jt(ie)>=Ae?$s(ie,Ae):ie;return cp.get(tt)},ni=ie=>ue[ie]+se(X[ie])>=pt&&ue[ie]<=Qn;if(X.forEach((ie,Ae)=>{ni(Ae)&&Be.push(yt("rect",{class:`tlx-lane${Ae%2?" odd":""}${ie.kind==="metric"?" metric":""}`,x:0,y:ue[Ae],width:L,height:se(ie)}))}),oe.kind==="binned"){let ie=new Map;for(let Ae of g?.bins??[]){let tt=lo(Ae.scope);tt!==void 0&&ie.set(tt,Math.max(ie.get(tt)??0,Ae.count))}for(let Ae of g?.bins??[]){let tt=lo(Ae.scope);if(tt===void 0||!ni(tt))continue;let ft=De(Ae.t),it=De(Ae.t+Rn[Ae.bin]);if(it<0||ft>L)continue;let $t=[...mn].reverse().find(kn=>(Ae.severity[kn]??0)>0)??"info",Ut=Math.max(2,(or-8)*Math.sqrt(Ae.count)/Math.sqrt(ie.get(tt)||1));Be.push(yt("rect",{class:"tlx-countbar",x:ft,y:ue[tt]+or-3-Ut,width:Math.max(1,it-ft-.5),height:Ut,"data-t":Ae.t},`${nn(Ae.t,s)}: ${Ae.count} event${Ae.count===1?"":"s"}${$t!=="info"&&$t!=="debug"?`, the worst ${$t}`:""}`)),($t==="warning"||$t==="error")&&Be.push(yt("rect",{class:`tlx-heat sev-${$t}`,x:ft,y:ue[tt]+or-($t==="error"?4:3),width:Math.max(1,it-ft-.5),height:$t==="error"?3:2}))}}for(let ie of ao){let Ae=lo(ie.scope);if(Ae===void 0||!ni(Ae))continue;let tt=ie.open?yn:ie.t+(ie.dur??0),ft=De(ie.t),it=De(tt);if(it<-2||ft>L+2)continue;let $t=`tlx-span sev-${ie.severity}${ie.open?" open":""}${k?.id===ie.id?" selected":""}`,Ut=`${ie.summary} \xB7 ${nn(ie.t,s)}${ie.open?", still going":`, ${Uc(tt-ie.t)}`}`,kn=ue[Ae]+5,Os=oe.kind==="binned"?4:8,$n=ft;for(let Ln of J.cuts)Ln.weight>=1||Ln.x1<=ft||Ln.x0>=it||(Ln.x0>$n&&Be.push(yt("rect",{class:$t,x:$n,y:kn,width:Math.max(1,Ln.x0-$n),height:Os,rx:2,"data-id":ie.id},Ut)),Be.push(yt("path",{class:`${$t} through`,d:`M${Ln.x0} ${kn+Os/2} H${Ln.x1}`,"data-id":ie.id},`${Ut} (lasted through the break)`)),$n=Ln.x1);it>$n&&Be.push(yt("rect",{class:$t,x:Math.max(-2,$n),y:kn,width:Math.max(2,Math.min(L+2,it)-Math.max(-2,$n)),height:Os,rx:2,"data-id":ie.id},Ut))}let pp=new Map;for(let ie of mm){let Ae=lo(ie.scope);if(Ae===void 0||!ni(Ae))continue;let tt=De(ie.t);if(tt<-6||tt>L+6||tt-(pp.get(Ae)??-1/0)<3)continue;pp.set(Ae,tt);let ft=ue[Ae]+or/2+2,it=4,$t=xh[ie.severity],Ut=$t==="diamond"?`M${tt} ${ft-it-1} l${it+1} ${it+1} l${-it-1} ${it+1} l${-it-1} ${-it-1} z`:$t==="triangle"?`M${tt} ${ft-it-1} l${it+1} ${2*it+1} h${-2*it-2} z`:$t==="square"?`M${tt-it+.5} ${ft-it+.5} h${2*it-1} v${2*it-1} h${-2*it+1} z`:"",kn=`${nn(ie.t,s)} \xB7 ${ie.summary}`,Os=`tlx-mark sev-${ie.severity}${k?.id===ie.id?" selected":""}${P>=0&&A[P]?.id===ie.id?" hit":""}`;Be.push(Ut?yt("path",{class:Os,d:Ut,"data-id":ie.id},kn):yt("circle",{class:Os,cx:tt,cy:ft,r:$t==="dot"?2.5:it,"data-id":ie.id},kn))}X.forEach((ie,Ae)=>{if(ie.kind!=="metric"||!ni(Ae))return;let tt=new Map;for(let mt of g?.metrics??[]){if(mt.series!==ie.series)continue;let Yt="value"in mt?{min:mt.value,max:mt.value,sum:mt.value,count:1}:{min:mt.min,max:mt.max,sum:mt.sum,count:mt.count},Bt=tt.get(mt.t);Bt?(Bt.min=Math.min(Bt.min,Yt.min),Bt.max=Math.max(Bt.max,Yt.max),Bt.sum+=Yt.sum,Bt.count+=Yt.count):tt.set(mt.t,{...Yt})}let ft=[...tt].sort((mt,Yt)=>mt[0]-Yt[0]);if(!ft.length)return;let it=oe.kind==="binned"?Rn[oe.bin]:eo,$t=mt=>ie.type==="gauge"?mt.sum/Math.max(1,mt.count):mt.sum,Ut=Math.max(1e-9,...ft.map(([,mt])=>ie.type==="gauge"?mt.max:$t(mt))),kn=ue[Ae]+tl-4,Os=tl-10,$n=mt=>kn-mt/Ut*Os;if(ie.type==="gauge"){let mt=ft.map(([Yt,Bt])=>`${De(Yt)},${$n(Bt.max)}`).join(" ")+" "+[...ft].reverse().map(([Yt,Bt])=>`${De(Yt)},${$n(Bt.min)}`).join(" ");Be.push(yt("polygon",{class:"tlx-band",points:mt})),Be.push(yt("polyline",{class:"tlx-line",points:ft.map(([Yt,Bt])=>`${De(Yt+it/2)},${$n($t(Bt))}`).join(" ")}))}else{let mt="",Yt=-1/0;for(let[Bt,um]of ft){let hm=De(Bt),fp=De(Bt+it),dp=$n($t(um));mt+=Bt>Yt?`M${hm} ${kn} V${dp} H${fp}`:` V${dp} H${fp}`,Yt=Bt+it;let mp=ft.find(([ym])=>ym>Bt);(!mp||mp[0]>Yt)&&(mt+=` V${kn} Z`)}Be.push(yt("path",{class:"tlx-area",d:mt}))}let Ln=yt("text",{class:"tlx-peak",x:4,y:ue[Ae]+11});Ln.textContent=`peak ${kh(Ut,ie.unit)}${ie.type==="counter"?` per ${oe.kind==="binned"?oe.bin:"1m"}`:""}`,Be.push(Ln)});for(let ie of J.cuts){if(ie.weight>=1)continue;let Ae=it=>{let $t=`M${it} 0`;for(let Ut=0;Ut<Ye;Ut+=8)$t+=` L${it+(Ut/8%2?-3:3)} ${Ut+8}`;return $t},tt=yt("g",{class:"tlx-cut",tabindex:0,role:"button","data-from":ie.from,"data-to":ie.to,"aria-label":`A break of ${rr(ie.to-ie.from)} with nothing shown, from ${nn(ie.from,s)} to ${nn(ie.to,s)}: press to open it`},`${rr(ie.to-ie.from)} with nothing here: ${nn(ie.from,s)} to ${nn(ie.to,s)} (click to open)`);tt.append(yt("rect",{class:"tlx-cut-bg",x:ie.x0,y:0,width:ie.x1-ie.x0,height:Ye})),tt.append(yt("path",{class:"tlx-cut-edge",d:Ae(ie.x0+3)}),yt("path",{class:"tlx-cut-edge",d:Ae(ie.x1-3)}));let ft=yt("text",{class:"tlx-cut-label",x:(ie.x0+ie.x1)/2,y:15,"text-anchor":"middle"});ft.textContent=rr(ie.to-ie.from),tt.append(ft),Be.push(tt)}if(b!==void 0){let ie=De(b);Be.push(yt("line",{class:"tlx-playhead",x1:ie,x2:ie,y1:0,y2:Ye})),Be.push(yt("path",{class:"tlx-handle",d:`M${ie-6} 0 h12 v8 l-6 7 l-6 -7 z`},`the playhead: ${nn(b,s)}`))}$e.replaceChildren(...Be),Ue.replaceChildren(me("div",{class:"tlx-labelhead",style:`height:${ms}px`},ge().kind==="single"?"single events":`per ${ge().kind==="binned"?ge().bin:""}`),...X.map(ie=>{if(ie.kind==="metric")return me("div",{class:"tlx-rowlabel metric",style:`height:${tl}px`,title:`${ie.title} (${ie.type==="counter"?"sums":"min, max and mean"})`},ie.title);let Ae=ie.row,tt=me("div",{class:`tlx-rowlabel${Ae.own?" own":""}`,style:`height:${or}px`,"data-scope":Ae.scope,title:`${Ae.scope||"all hosts"} \xB7 ${Ae.count} event${Ae.count===1?"":"s"}`},me("span",{class:"tlx-kind"},e.catalog.flags.find(ft=>Ae[ft])??Ae.kind),me("span",{class:"tlx-name"},Ae.own?`${Ae.label} (itself)`:Ae.label),me("span",{class:"tlx-count"},String(Ae.count)));if(!Ae.own&&Ae.scope!==p){let ft=me("button",{type:"button",class:"tlx-drill",title:Ae.children?`Into ${Ae.label}: its ${Ae.children} part${Ae.children===1?"":"s"}`:`Into ${Ae.label}`,"aria-label":`Into ${Ae.label}`},"\u203A");ft.addEventListener("click",()=>dt(Ae.scope)),tt.append(ft)}return tt})),Ue.style.width=`${bh}px`,Pe()}function Pe(){G.replaceChildren(...Ur(p).flatMap((ue,Oe,Ye)=>{let pt=me("button",{type:"button",class:`tlx-crumb${Oe===Ye.length-1?" current":""}`,"aria-current":Oe===Ye.length-1?"location":void 0},fe(ue.scope,ue.label));return pt.addEventListener("click",()=>{ue.scope!==p&&(p=ue.scope,c=1,_(!0))}),Oe?[me("span",{class:"tlx-sep","aria-hidden":"true"},"/"),pt]:[pt]})),Q.setAttribute("aria-pressed",String(d)),Q.classList.toggle("on",d),z.hidden=!d||v;let L=ge(),X=g?.total??0,oe=(g?.retention??[]).filter(ue=>ue.events!==null).map(ue=>`${ue.source} kept ${ue.events} d`);Ve.textContent=`${nn(y.t0,s)} \u2013 ${nn(y.t1,s)} \xB7 ${L.kind==="single"?"single events":`bins of ${L.bin}`} \xB7 ${X} event${X===1?"":"s"}${Y.length?` \xB7 ${Y.length} break${Y.length===1?"":"s"}`:""}${oe.length?` \xB7 ${oe.slice(0,3).join(", ")}`:""}`,ke.hidden=!M.length,ke.textContent=M.join(" \xB7 "),H.textContent=l?A.length?`${P+1>0?`${P+1} of `:""}${A.length}${A.length>=2e3?"+":""} hit${A.length===1?"":"s"}`:`${X?`${X} hit${X===1?"":"s"}`:"no hits"}`:"";for(let ue of Z.querySelectorAll(".seg"))ue.classList.remove("on");we.textContent=b===void 0?"":w?(()=>{let ue=e.stamp?.(w)??{};return`Canvas: the state recorded at ${nn(Date.parse(ue.at??"")||b,s)}${ue.tag?` (${ue.tag})`:""}`})():"No state recorded here",we.classList.toggle("none",b!==void 0&&!w)}function rt(){qe.replaceChildren();for(let L of m?.sources??[]){let X=!f.source?.length||f.source.includes(L.name),oe=me("button",{type:"button",class:`tlx-chip${X?" on":""}${L.status==="not-yet"?" notyet":""}`,"aria-pressed":String(X&&L.status!=="not-yet"),disabled:L.status==="not-yet",title:L.status==="not-yet"?`${L.title}: not kept yet`:`${L.title}${Fe(L)}`},L.name);L.status!=="not-yet"&&oe.addEventListener("click",()=>Ce(L.name)),qe.append(oe)}}let Fe=L=>{let X=m?.retention.find(oe=>oe.source===L.name);return X?` (kept ${X.events===null?"until deleted":`${X.events} days`})`:""};function Ce(L){let X=(m?.sources??[]).filter(ue=>ue.status==="kept").map(ue=>ue.name),oe=f.source?.length?[...f.source]:[...X];oe=oe.includes(L)?oe.filter(ue=>ue!==L):[...oe,L],f={...f,...oe.length===X.length?{source:void 0}:{source:oe}},f.source||delete f.source,rt(),_(!0),We()}let Ke=0;ce.addEventListener("input",()=>{clearTimeout(Ke),Ke=setTimeout(()=>{l=ce.value.trim(),P=-1,_(!0),We()},250)}),ce.addEventListener("keydown",L=>{L.key==="Enter"&&(L.preventDefault(),clearTimeout(Ke),l=ce.value.trim(),_(!0).then(()=>We()).then(()=>gt(L.shiftKey?-1:1)))});async function We(){if(!l){A=[],P=-1,Pe();return}let L=y.t1-y.t0;A=(await e.source.query(E(y.t0-L*4,Math.max(y.t1+L*4,Se()),{kind:"single"},{limit:2e3}))).events??[],P=Math.min(P,A.length-1),Pe()}function gt(L){if(!A.length)return;let X=(y.t0+y.t1)/2;P<0?P=L>0?Math.max(0,A.findIndex(Oe=>Oe.t>=X)):Math.max(0,A.length-1-[...A].reverse().findIndex(Oe=>Oe.t<=X)):P=(P+L+A.length)%A.length;let oe=A[P],ue=Math.min(y.t1-y.t0,2*ar);y={t0:oe.t-ue/2,t1:oe.t+ue/2},v=!1,kt(oe),_()}ne.addEventListener("click",()=>gt(-1)),Ee.addEventListener("click",()=>gt(1)),N.addEventListener("change",()=>{let L=N.value;f={...f,...L?{severity:mn.filter(X=>Fd(X)>=Fd(L))}:{}},L||delete f.severity,_(!0),We()});async function Vs(L,X=!0){let oe=Se();if(L==="run"){let ue=await e.source.query({timeline:1,type:"query",scope:p,depth:0,from:oe-30*xn,to:oe+1,filters:{kind:["run"]},limit:1e4}).catch(()=>{}),Oe=ue?.events?.[ue.events.length-1];y=Oe?{t0:Oe.t-(Oe.dur??ar)*.02,t1:(Oe.open?oe:Oe.t+(Oe.dur??ar))+(Oe.dur??ar)*.04}:{t0:oe-xn,t1:oe+xn*.02}}else y={t0:oe-_d[L],t1:oe+_d[L]*.02};v=!0,j.clear(),F.clear(),X&&_()}function Tt(L,X=!0){if(d=L,I?.(),I=void 0,L&&e.source.subscribe){let oe=0,ue=0;I=e.source.subscribe(E(Se()-ar,Se()+365*xn,{kind:"single"}),Oe=>{if(m&&(m.now=Math.max(m.now,Oe.now)),v){let pt=y.t1-y.t0;y={t0:Oe.now-pt*.98,t1:Oe.now+pt*.02}}let Ye=Date.now();Ye-oe>500?(oe=Ye,_(!0)):ue||(ue=setTimeout(()=>{ue=0,oe=Date.now(),_(!0)},500))}),v=!0}X&&(Pe(),he())}Q.addEventListener("click",()=>Tt(!d)),z.addEventListener("click",()=>{v=!0;let L=y.t1-y.t0,X=Se();y={t0:X-L*.98,t1:X+L*.02},_()}),D.addEventListener("click",()=>{ut()}),V.addEventListener("change",()=>{u=V.checked,j.clear(),F.clear(),pe(),he()}),de.addEventListener("change",()=>{W=de.checked,pe(),he()});function dt(L){let X=g?.rows.find(oe=>oe.scope===L);p=L,c=X&&X.children===0?0:1,$=void 0,B.hidden=!0,_(!0)}async function ut(){let L=Se(),oe=((await e.source.query({timeline:1,type:"query",scope:p,depth:0,from:L-400*xn,to:L+1,bin:"1d",tz:s}).catch(()=>{}))?.bins??[]).map(Oe=>Oe.t),ue=oe.length?Math.min(...oe):L-7*xn;y={t0:ue,t1:L+(L-ue)*.02},v=!0,_()}let Cn=0;async function Kt(L){if(b=L,pe(),L===void 0){w=void 0;return}let X=++Cn,oe=e.source.stateAt?await e.source.stateAt(p,L).catch(()=>{}):void 0;X===Cn&&(w=oe,e.onPlayhead?.(L,oe),Pe())}async function _t(L,X){$={from:Math.min(L,X),to:Math.max(L,X)},pe();let oe=await e.source.query(E($.from,$.to,{kind:"single"},{limit:500})),ue=o(l),Oe=Be=>{let De=[],zt=0;for(let[Xt,yn]of Qi(ue,Be))De.push(Be.slice(zt,Xt),me("mark",null,Be.slice(Xt,yn))),zt=yn;return De.push(Be.slice(zt)),De},Ye=(oe.events??[]).map(Be=>{let De=me("tr",{"data-id":Be.id,tabindex:"0"},me("td",null,nn(Be.t,s)),me("td",null,Be.dur!==void 0?Uc(Be.dur):Be.open?"still going":""),me("td",null,Be.source),me("td",null,Be.kind),me("td",{class:`sev-${Be.severity}`},Be.severity),me("td",{class:"tlx-sum"},...Oe(Be.summary)),me("td",{class:"tlx-scope"},Be.scope));return De.addEventListener("click",()=>kt(Be)),De.addEventListener("keydown",zt=>{zt.key==="Enter"&&kt(Be)}),De}),pt=me("button",{type:"button",class:"btn sm quiet","aria-label":"Close the table"},"Close");pt.addEventListener("click",()=>{$=void 0,B.hidden=!0,pe()});let Qn=Be=>{let De=me("button",{type:"button",class:"btn sm","data-export":Be},Be.toUpperCase());return De.addEventListener("click",()=>{Gt(Be)}),De};B.replaceChildren(me("div",{class:"tlx-table-head"},me("strong",null,`${oe.total} event${oe.total===1?"":"s"}`),me("span",null,` ${nn($.from,s)} \u2013 ${nn($.to,s)}${oe.total>500?" (the first 500 shown; the export has them all)":""}`),me("span",{class:"spacer"}),me("span",null,"Export: "),Qn("json"),Qn("csv"),pt),me("div",{class:"tlx-table-wrap"},me("table",null,me("thead",null,me("tr",null,...["When","Long","Source","Kind","Severity","What","Scope"].map(Be=>me("th",{scope:"col"},Be)))),me("tbody",null,...Ye)))),B.hidden=!1}async function Dt(){if(!$)return[];let L=[],X;do{let oe=await e.source.query(E($.from,$.to,{kind:"single"},{limit:1e4,...X?{cursor:X}:{}}));L.push(...oe.events??[]),X=oe.next}while(X&&L.length<2e5);return L}async function Gt(L){let X=await Dt(),oe=L==="json"?Xa(X,C):Qa(X,C),ue=`timeline-${new Date($.from).toISOString().slice(0,16).replace(/:/g,"")}.${L}`,Oe=L==="json"?"application/json":"text/csv";if(e.onExport){e.onExport(ue,oe,Oe);return}let Ye=me("a",{href:`data:${Oe};charset=utf-8,${encodeURIComponent(oe)}`,download:ue});document.body.append(Ye),Ye.click(),Ye.remove()}function kt(L){if(k=L,pe(),!L){K.hidden=!0;return}let X=m?.sources.find(De=>De.name===L.source),oe=new Set(X?.sensitive??[]),ue=o(l),Oe=De=>{let zt=[],Xt=0;for(let[yn,ao]of Qi(ue,De))zt.push(De.slice(Xt,yn),me("mark",null,De.slice(yn,ao))),Xt=ao;return zt.push(De.slice(Xt)),zt},Ye=(De,zt)=>{if(!zt)return null;let Xt=me("button",{type:"button",class:"btn sm"},De);return Xt.addEventListener("click",zt),Xt},pt=Object.entries(L.attrs).map(([De,zt])=>{if(!oe.has(De))return me("tr",null,me("th",{scope:"row"},De),me("td",null,...Oe(String(zt))));let Xt=me("button",{type:"button",class:"btn sm quiet",title:"This can name a remote host, a folder or free text"},"Show"),yn=me("td",{class:"tlx-sensitive"},"hidden ",Xt);return Xt.addEventListener("click",()=>yn.replaceChildren(String(zt))),me("tr",null,me("th",{scope:"row"},De),yn)}),Qn=me("button",{type:"button",class:"btn sm quiet tlx-close","aria-label":"Close"},"\xD7");Qn.addEventListener("click",()=>kt(void 0));let Be=Ur(L.scope).slice(1).map(De=>{let zt=me("button",{type:"button",class:"tlx-crumb"},fe(De.scope,De.label));return zt.addEventListener("click",()=>dt(De.scope)),zt});K.replaceChildren(me("div",{class:"tlx-detail-head"},me("strong",null,L.kind),Qn),me("p",{class:`tlx-sev sev-${L.severity}`},`${L.severity} \xB7 ${X?.title??L.source}`),me("p",{class:"tlx-sum"},...Oe(L.summary)),me("p",null,nn(L.t,s),L.dur!==void 0?` \xB7 ${Uc(L.dur)}${L.open?" so far":""}`:L.open?" \xB7 still going":""),me("p",{class:"tlx-crumbs small"},...Be),...pt.length?[me("table",{class:"tlx-attrs"},me("tbody",null,...pt))]:[],me("div",{class:"tlx-links"},...(e.actions?.(L)??[]).map(([De,zt])=>Ye(De,zt)))),K.hidden=!1}function cr(L,X){let oe=ir({from:L,to:X});if(!Y.find(pt=>pt.from===L&&pt.to===X))return;if(j.add(oe),!i){F.set(oe,1),pe();return}let Oe=performance.now(),Ye=pt=>{let Qn=Math.min(1,(pt-Oe)/260);F.set(oe,1-(1-Qn)**3),Te(),Qn<1&&requestAnimationFrame(Ye)};requestAnimationFrame(Ye)}let Zt,Ks=L=>L.clientX-$e.getBoundingClientRect().left;$e.addEventListener("pointerdown",L=>{let X=Ks(L),oe=L.clientY-$e.getBoundingClientRect().top,ue=L.target.closest?.(".tlx-cut");if(ue){L.preventDefault(),cr(Number(ue.getAttribute("data-from")),Number(ue.getAttribute("data-to")));return}$e.setPointerCapture(L.pointerId),Zt={kind:oe<ms||L.shiftKey?"brush":L.target.classList.contains("tlx-handle")?"scrub":"pan",x0:X,t0:J.t(X),v0:y,moved:!1},L.preventDefault(),Le.focus({preventScroll:!0})}),$e.addEventListener("pointermove",L=>{if(!Zt)return;let X=Ks(L);if(Math.abs(X-Zt.x0)>3&&(Zt.moved=!0),!!Zt.moved)if(Zt.kind==="pan"){let oe=(Zt.x0-X)*J.msPerPx;y={t0:Zt.v0.t0+oe,t1:Zt.v0.t1+oe},v=!1,_()}else Zt.kind==="scrub"?Kt(J.t(X)):($={from:Math.min(Zt.t0,J.t(X)),to:Math.max(Zt.t0,J.t(X))},pe())}),$e.addEventListener("pointerup",L=>{let X=Zt;if(Zt=void 0,!X)return;let oe=Ks(L);if(X.kind==="brush"&&X.moved){_t(X.t0,J.t(oe));return}if(X.kind==="brush"&&!X.moved){Kt(J.t(oe));return}if(X.kind==="pan"&&!X.moved){let ue=L.target.closest?.("[data-id]")?.getAttribute("data-id"),Oe=ue?[...g?.events??[],...g?.spans??[]].find(Ye=>Ye.id===ue):void 0;Oe?(kt(Oe),Kt(Oe.t)):Kt(J.t(oe))}}),$e.addEventListener("keydown",L=>{let X=L.target.closest?.(".tlx-cut");X&&(L.key==="Enter"||L.key===" ")&&(L.preventDefault(),cr(Number(X.getAttribute("data-from")),Number(X.getAttribute("data-to"))))}),$e.addEventListener("wheel",L=>{L.preventDefault();let X=Ks(L);if(L.shiftKey||Math.abs(L.deltaX)>Math.abs(L.deltaY)){let oe=(L.shiftKey?L.deltaY:L.deltaX)*J.msPerPx;y={t0:y.t0+oe,t1:y.t1+oe},v=!1}else pr(J.t(X),Math.exp(L.deltaY*.0015),X/ae());_()},{passive:!1});function pr(L,X,oe=.5){let ue=Math.min(400*xn,Math.max(1e4,(y.t1-y.t0)*X));y={t0:L-oe*ue,t1:L+(1-oe)*ue},j.clear(),F.clear(),X<1&&(v=d&&y.t1>=Se())}Le.addEventListener("keydown",L=>{let X=y.t1-y.t0;if(L.key==="ArrowLeft"||L.key==="ArrowRight"){let oe=X*.15*(L.key==="ArrowLeft"?-1:1);y={t0:y.t0+oe,t1:y.t1+oe},v=!1}else if(L.key==="+"||L.key==="=")pr((y.t0+y.t1)/2,.6);else if(L.key==="-"||L.key==="_")pr((y.t0+y.t1)/2,1/.6);else if(L.key==="n"||L.key==="N"){gt(L.shiftKey?-1:1),L.preventDefault();return}else if(L.key==="Escape")kt(void 0),$=void 0,B.hidden=!0;else return;L.preventDefault(),_()}),t.addEventListener("keydown",L=>{L.key==="/"&&document.activeElement!==ce&&!L.target.closest("input, select, textarea")&&(L.preventDefault(),ce.focus())}),S.addEventListener("scroll",()=>pe(),{passive:!0}),ye.addEventListener("click",async()=>{let L=`${Ur(p).slice(-1)[0].label}${l?`: ${l}`:""}`.slice(0,80);await e.saveView?.({...te(),name:L}),await jn()});let Je=[];async function jn(){e.views&&(Je=await e.views(),ee.replaceChildren(me("option",{value:""},"Saved views\u2026"),...Je.map((L,X)=>me("option",{value:String(X)},L.name))))}ee.addEventListener("change",()=>{let L=Je[Number(ee.value)];L&&(xe(L),rt(),_(!0)),ee.value=""});let ht=typeof ResizeObserver=="function"?new ResizeObserver(()=>pe()):void 0;ht?.observe(Le);let ln=(async()=>{m=await e.source.catalog(),C=m.sources.flatMap(ue=>(ue.sensitive??[]).map(Oe=>`${ue.name}.${Oe}`));for(let ue of m.sources)for(let Oe of ue.series)U.set(Oe.name,{unit:Oe.unit,type:Oe.type,title:Oe.title,source:ue.name});p=m.hosts.length===1?`host:${m.hosts[0].replace(/[%/:\s]/g,ue=>`%${ue.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`)}`:"";let X=m.now;y={t0:X-xn,t1:X+xn*.02};let oe=Ie()??e.view;oe&&xe(oe),rt(),await jn(),await _(!0),l&&await We()})();return{el:t,ready:ln,get view(){return te()},setView(L){return xe(L),rt(),_(!0)},setRange(L,X){return y={t0:L,t1:X},v=!1,_()},setPlayhead:Kt,setLive:Tt,setTheme:a,refresh:()=>_(!0),internal:{get result(){return g},get mode(){return ge()},get scale(){return J},get gaps(){return Y},get playState(){return w},get hits(){return A},get selected(){return k},get follow(){return v},openCut:cr,showTable:_t,rangeEvents:Dt,exportRange:Gt,select:kt,stepHit:gt,drill:dt,findHits:We,paint:Te,lines:le},dispose(){I?.(),ht?.disconnect(),T&&cancelAnimationFrame(T),t.replaceChildren()}}}var $h={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}},sn=t=>(Math.round(t*10)/10).toString(),Bd=t=>(t??"link").replace(/[^\w-]/g,"_");function nl(t,e){let{id:s}=e,r=e.styles??{},i=t.options,o=t.bounds,n=new Map,a=(d,u)=>{let y=r[d]??{},g=u==="start"?y.start??"none":y.end??"arrow";if(g!=="none")return(n.get(d)??n.set(d,new Set).get(d)).add(g),`url(#${s}-mk-${d}-${g})`},m="",p="",c="",l="";for(let d of[...t.panels].sort((u,y)=>u.depth-y.depth)){let u=d.rect,y=d.label?ve("text",{class:"pl",x:d.titleAt[0],y:d.titleAt[1]},St(d.label)+(d.sub?ve("tspan",{class:"pls",dx:10},St(d.sub)):"")):"";m+=ve("g",{class:`panel k-${d.role??"grey"}`,"data-id":d.id},ve("rect",{class:"face",x:sn(u.l),y:sn(u.t),width:sn(u.r-u.l),height:sn(u.b-u.t),rx:i.panelRx})+y)}for(let d of t.links){if(!d.points.length)continue;let u=Bd(d.kind);p+=ve("path",{class:`conn k-${u}`,d:"M"+d.points.map(y=>`${sn(y[0])},${sn(y[1])}`).join(" L"),"data-id":d.id,"data-a":d.a,"data-b":d.b,"marker-start":a(u,"start"),"marker-end":a(u,"end")}),d.at&&(l+=ve("text",{class:`cl k-${u}`,x:d.at.x,y:d.at.y,"text-anchor":d.at.anchor==="start"?void 0:d.at.anchor,"data-for":d.id},St(d.at.text)))}for(let d of t.cards){let u=d.rect;c+=ve("g",{class:`card k-${d.role??"grey"}${d.ghost?" ghost":""}`,"data-id":d.id,tabindex:0,role:"button","aria-label":d.sub?`${d.label}: ${d.sub}`:d.label},ve("rect",{class:"face",x:sn(u.l),y:sn(u.t),width:i.W,height:i.H,rx:i.cardRx})+ve("text",{class:"lt",x:sn(u.l+14),y:sn(u.t+24)},St(d.label))+(d.sub?ve("text",{class:"st",x:sn(u.l+14),y:sn(u.t+42)},St(d.sub)):""))}let f="";for(let[d,u]of n)for(let y of u){let g=$h[y];f+=ve("marker",{id:`${s}-mk-${d}-${y}`,viewBox:"0 0 10 10",refX:g.refX,refY:5,markerWidth:5.4,markerHeight:5.4,orient:"auto-start-reverse"},ve("path",{d:g.d,class:`mk k-${d}`}))}return ve("svg",{xmlns:"http://www.w3.org/2000/svg",class:"flat",viewBox:`${sn(o.l)} ${sn(o.t)} ${sn(o.r-o.l)} ${sn(o.b-o.t)}`,role:"img","aria-label":e.title??"drawing, flat view","data-view":"2d"},(f?ve("defs",{},f):"")+ve("g",{class:"panels"},m)+ve("g",{class:"conns"},p)+ve("g",{class:"cards"},c)+ve("g",{class:"labels"},l))}function qd(t={}){let e=r=>r?r.startsWith("#")||r.includes("(")?r:`var(--${r})`:"var(--ink)",s=`
360
369
  .flat{font-family:inherit}
361
370
  .flat .card{cursor:pointer;outline:none}
362
371
  .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}
@@ -374,8 +383,8 @@ ${e.extraBody??""}
374
383
  .flat .panel.sel .face{stroke:var(--accent,#2f6fd6);stroke-width:2}
375
384
  .flat .conn.hot{stroke-width:3}
376
385
  .flat .conn.dim,.flat .cl.dim{opacity:.3}
377
- `;for(let[r,i]of Object.entries(t)){let o=Jp(r),s=e(i.color);n+=`.flat .conn.k-${o}{stroke:${s}${i.dash?`;stroke-dasharray:${i.dash}`:""}${i.width?`;stroke-width:${i.width}`:""}} .flat .mk.k-${o}{fill:${s}} .flat .cl.k-${o}{fill:${s}}
378
- `}return n}var om={name:["card","lt"],sub:["card","st"],title:["panel","pl"],titleSub:["panel","pls"],label:["","cl"]};function ea(t){let e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"svg");n.setAttribute("class","flat"),n.setAttribute("aria-hidden","true"),n.style.cssText="position:absolute;left:-10000px;top:0;width:10px;height:10px;visibility:hidden",t.appendChild(n);let r={};for(let[s,[a,d]]of Object.entries(om)){let c=document.createElementNS(e,"g");a&&c.setAttribute("class",a);let l=document.createElementNS(e,"text");l.setAttribute("class",d),c.appendChild(l),n.appendChild(c),r[s]=l}let i=new Map,o=((s,a)=>{let d=a+"\0"+s,c=i.get(d);return c===void 0&&(r[a].textContent=s,c=r[a].getComputedTextLength(),i.set(d,c)),c});return o.dispose=()=>n.remove(),o}var Qp=(t,e)=>t.cards.find(n=>n.id===e)?.rect??t.panels.find(n=>n.id===e)?.rect;var xn="http://www.w3.org/2000/svg";function sa(t,e,n){let r=new Map((n?.links??[]).map((i,o)=>[i.id??`link-${o}`,i]));for(let i of e.routes){let o=r.get(i.id),s=o?.a??ls(i.raw.from).id,a=o?.b??ls(i.raw.to).id;for(let d of t.querySelectorAll(`[data-id="${CSS.escape(i.id)}"]`))d.setAttribute("data-a",s),d.setAttribute("data-b",a)}}var am=(t="auto")=>t==="always"||t==="auto"&&!(typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches);function sf(t,e,n,r,i={}){let o=i.duration??600;if(!o||!am(i.motion))return;let s=ai(t,e,n,r);t.appendChild(s.svg),s.at(0);let a=0,d=!1,c,l=new Promise(u=>c=u),p=()=>{d||(d=!0,cancelAnimationFrame(a),s.svg.remove(),c())},f=performance.now(),m=u=>{if(d)return;let h=Math.min(1,(u-f)/o);s.at(h),h<1?a=requestAnimationFrame(m):p()};return a=requestAnimationFrame(m),{done:l,finish:p}}var rn=t=>Math.max(0,Math.min(1,t)),oi=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2;function ta(t){let e=t.cloneNode(!0),n=[t,...t.querySelectorAll("*")],r=[e,...e.querySelectorAll("*")];return n.forEach((i,o)=>{let s=getComputedStyle(i),a=r[o];a.removeAttribute("class"),a.removeAttribute("tabindex");for(let d 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(d,s.getPropertyValue(d))}),e}var Il=(t,e)=>{let n=t.getBoundingClientRect();return{x:n.left-e.left,y:n.top-e.top,w:n.width,h:n.height}},ef=t=>{let e=Math.min(...t.map(o=>o.x)),n=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:n,w:r-e,h:i-n}},lm=(t,e)=>{let n=t.getScreenCTM();return`matrix(${n.a} ${n.b} ${n.c} ${n.d} ${n.e-e.left} ${n.f-e.top})`},tf=(t,e,n)=>{let r=1+(e.w/Math.max(t.w,1e-6)-1)*n,i=1+(e.h/Math.max(t.h,1e-6)-1)*n,o=(e.x-t.x*(e.w/Math.max(t.w,1e-6)))*n,s=(e.y-t.y*(e.h/Math.max(t.h,1e-6)))*n;return`matrix(${r} 0 0 ${i} ${o} ${s})`};function cm(t,e){let n=t.querySelector("polygon.top");if(!n)return;let r=n.getScreenCTM(),i=[];for(let o=0;o<n.points.numberOfItems;o++){let s=n.points.getItem(o);i.push([r.a*s.x+r.c*s.y+r.e-e.left,r.b*s.x+r.d*s.y+r.f-e.top])}return i.length===4?{pts:i,fill:getComputedStyle(n).fill}:void 0}function ai(t,e,n,r){let i=t.getBoundingClientRect(),o=document.createElementNS(xn,"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,n.getBoundingClientRect().height)}px;overflow:visible;pointer-events:none`;let s=E=>{let S=document.createElementNS(xn,"g");return S.setAttribute("transform",lm(E,i)),S},a=E=>E.hasAttribute("data-a")||E.hasAttribute("data-for"),d=E=>{let S=new Map;for(let k of E.querySelectorAll("[data-id]")){if(a(k)||k.parentElement?.closest("[data-id]")||k.closest(".overlay"))continue;let T=k.getAttribute("data-id");(S.get(T)??S.set(T,[]).get(T)).push(k)}return S},c=d(e),l=d(n),p=document.createElementNS(xn,"g"),f=document.createElementNS(xn,"g"),m=s(e),u=s(n);for(let E of e.querySelectorAll("[data-a],[data-for]"))E.closest(".overlay")||m.appendChild(ta(E));for(let E of n.querySelectorAll("[data-a],[data-for]"))E.closest(".overlay")||u.appendChild(ta(E));p.appendChild(m),f.appendChild(u);let h=[...u.querySelectorAll("path")].map(E=>{let S=E.getTotalLength?.()??0;return{p:E,len:S}}),y=[...u.children].filter(E=>E.tagName.toLowerCase()==="text"),v=[...(r==="2d"?c:l).keys()],g=[],b=document.createElementNS(xn,"g");for(let E of new Set([...v,...c.keys(),...l.keys()])){let S=c.get(E),k=l.get(E),T={};if(S){T.a=ef(S.map(I=>Il(I,i)));let P=document.createElementNS(xn,"g"),w=s(e);for(let I of S)w.appendChild(ta(I));P.appendChild(w),T.src=P}if(k){T.b=ef(k.map(I=>Il(I,i)));let P=document.createElementNS(xn,"g"),w=s(n);for(let I of k)w.appendChild(ta(I));P.appendChild(w),T.dst=P}let z=r==="3d"?S?.[0]:k?.[0],A=r==="3d"?k?.[0]:S?.[0],R=z?cm(z,i):void 0,x=A?.querySelector("rect.face");if(R&&x){let P=Il(x,i),w=[[P.x,P.y],[P.x+P.w,P.y],[P.x+P.w,P.y+P.h],[P.x,P.y+P.h]],I=R.pts.reduce((_,K,Z)=>K[0]<R.pts[_][0]?Z:_,0),L=[...R.pts.slice(I),...R.pts.slice(0,I)],D=[L[0],L[1],L[2],L[3]],G=getComputedStyle(x).fill,se=document.createElementNS(xn,"polygon");T.face=se,T.faceFrom=r==="3d"?D:w,T.faceTo=r==="3d"?w:D,T.faceFill=r==="3d"?[R.fill,G]:[G,R.fill]}T.src&&b.appendChild(T.src),T.face&&b.appendChild(T.face),T.dst&&b.appendChild(T.dst),g.push(T)}o.append(p,b,f);let $=(E,S,k)=>`color-mix(in srgb, ${E} ${Math.round((1-k)*100)}%, ${S})`;return{svg:o,at(E){let S=rn(E/.2),k=oi(rn((E-.2)/.6)),T=rn((E-.8)/.2);p.setAttribute("opacity",String(1-S));for(let{p:z,len:A}of h)z.style.strokeDasharray=`${A} ${A}`,z.style.strokeDashoffset=String(A*(1-T));f.setAttribute("opacity",String(T>0?1:0));for(let z of y)z.style.opacity=String(T);for(let z of g)if(z.src&&(z.src.setAttribute("transform",z.a&&z.b?tf(z.a,z.b,k):""),z.src.setAttribute("opacity",String(z.b?1-rn(k/(z.face?.35:.6)):1-k))),z.dst&&(z.dst.setAttribute("transform",z.a&&z.b?tf(z.b,z.a,1-k):""),z.dst.setAttribute("opacity",String(z.a?rn((k-(z.face?.65:.4))/(z.face?.35:.6)):k))),z.face){let A=z.faceFrom.map((R,x)=>[R[0]+(z.faceTo[x][0]-R[0])*k,R[1]+(z.faceTo[x][1]-R[1])*k]);z.face.setAttribute("points",A.map(R=>R.join(",")).join(" ")),z.face.style.fill=$(z.faceFill[0],z.faceFill[1],k),z.face.setAttribute("opacity",String(k<.08?k/.08:k>.92?(1-k)/.08:1))}}}}var pm=0;function nf(t,e,n={}){let r=`dv${++pm}`,i=document.createElement("div");i.className="dual-view",i.style.position="relative",t.appendChild(i);let o=document.createElement("div"),s=document.createElement("div");o.className="dual-3d",s.className="dual-2d",i.append(o,s),o.innerHTML=e.rendered.svg;let a=o.querySelector("svg");a.setAttribute("data-view","3d");let d=n.board??Co(e);sa(a,e,d);let c=new Set(e.routes.map(A=>A.id));for(let A of a.querySelectorAll("g[data-id]")){let R=A.getAttribute("data-id");c.has(R)||A.hasAttribute("tabindex")||!A.querySelector("polygon")||(A.setAttribute("tabindex","0"),A.setAttribute("role","button"),A.setAttribute("aria-label",R))}let l=ea(s),p=lr(d,l,n.flat);l.dispose(),s.innerHTML=Qo(p,{id:r,title:n.title,styles:n.styles});let f=s.querySelector("svg");for(let A of[a,f])A.style.display="block",A.style.width="100%",A.style.height="auto";n.title&&a.setAttribute("aria-label",n.title);let m=n.mode??"3d",u,h=A=>A==="3d"?o:s,y=A=>A==="3d"?a:f,v=A=>{o.hidden=A!=="3d",s.hidden=A!=="2d";for(let R of[o,s])R.style.cssText="";i.style.height="",i.dataset.mode=A};v(m);let g=()=>{for(let A of[a,f]){for(let R of A.querySelectorAll("[data-id]"))R.classList.toggle("sel",!!u&&R.getAttribute("data-id")===u);for(let R of A.querySelectorAll("[data-a]")){let x=!!u&&(R.getAttribute("data-a")===u||R.getAttribute("data-b")===u);R.classList.toggle("hot",x),R.classList.toggle("dim",!!u&&!x),A.querySelector(`[data-for="${CSS.escape(R.getAttribute("data-id")??"")}"]`)?.classList.toggle("dim",!!u&&!x)}}},b=A=>{u=A,g()},$=A=>{let R=A.target.closest?.("[data-id]");if(!R||!i.contains(R)||R.hasAttribute("data-a"))return;let x=R.getAttribute("data-id");b(x),n.onSelect?.(x)},E=A=>{(A.key==="Enter"||A.key===" ")&&A.target.matches?.("[data-id][tabindex]")&&(A.preventDefault(),$(A))};i.addEventListener("click",$),i.addEventListener("keydown",E);let S,k=()=>{if(!S)return;cancelAnimationFrame(S.frame),S.layer.remove();let A=S;S=void 0,m=A.to,v(m),g(),A.done()},T=A=>{!A||!u||y(m).querySelector(`[data-id="${CSS.escape(u)}"][tabindex]`)?.focus({preventScroll:!0})};return{get mode(){return S?S.to:m},layout:p,root:i,morph:A=>{let R=i.contains(document.activeElement);if(S&&k(),A===m)return T(R),Promise.resolve();let x=n.motion??"auto";return x==="never"||x==="auto"&&typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches||!(n.duration??600)?(m=A,v(m),g(),T(R),Promise.resolve()):new Promise(w=>{let I=m,L=i.getBoundingClientRect().height;o.hidden=!1,s.hidden=!1;for(let Q of[o,s])Q.style.cssText="position:absolute;left:0;top:0;right:0;visibility:hidden";let D=h(A).getBoundingClientRect().height;i.style.height=`${L}px`;let G=ai(i,y(I),y(A),I);i.appendChild(G.svg);let se=n.duration??600,_=performance.now(),K={frame:0,layer:G.svg,to:A,done:()=>{T(R),w()}},Z=Q=>{if(S!==K)return;let N=Math.min(1,(Q-_)/se);G.at(N),i.style.height=`${L+(D-L)*oi(rn((N-.2)/.6))}px`,N<1?K.frame=requestAnimationFrame(Z):k()};S=K,K.frame=requestAnimationFrame(Z)})},select:b,get selected(){return u},svgOf:y,destroy(){S&&k(),i.removeEventListener("click",$),i.removeEventListener("keydown",E),i.remove()}}}function rf(t="iso-view"){try{let e=localStorage.getItem(t);return e==="2d"||e==="3d"?e:void 0}catch{return}}function of(t,e,n={}){let r=n.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 s=["3d","2d"].map((d,c)=>{let l=document.createElement("button");return l.type="button",l.dataset.mode=d,l.textContent=(n.labels??["3D","2D"])[c],l.addEventListener("click",()=>{try{localStorage.setItem(r,d)}catch{}a(d);for(let p of i)p.morph(d)}),o.appendChild(l),l}),a=d=>s.forEach(c=>c.setAttribute("aria-pressed",String(c.dataset.mode===d)));return a(i[0]?.mode??"3d"),t.appendChild(o),o}var af=`
386
+ `;for(let[r,i]of Object.entries(t)){let o=Bd(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}}
387
+ `}return s}var Sh={name:["card","lt"],sub:["card","st"],title:["panel","pl"],titleSub:["panel","pls"],label:["","cl"]};function sl(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,m]]of Object.entries(Sh)){let p=document.createElementNS(e,"g");a&&p.setAttribute("class",a);let c=document.createElementNS(e,"text");c.setAttribute("class",m),p.appendChild(c),s.appendChild(p),r[n]=c}let i=new Map,o=((n,a)=>{let m=a+"\0"+n,p=i.get(m);return p===void 0&&(r[a].textContent=n,p=r[a].getComputedTextLength(),i.set(m,p)),p});return o.dispose=()=>s.remove(),o}var Vd=(t,e)=>t.cards.find(s=>s.id===e)?.rect??t.panels.find(s=>s.id===e)?.rect;var qs="http://www.w3.org/2000/svg";function il(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??bn(i.raw.from).id,a=o?.b??bn(i.raw.to).id;for(let m of t.querySelectorAll(`[data-id="${CSS.escape(i.id)}"]`))m.setAttribute("data-a",n),m.setAttribute("data-b",a)}}var vh=(t="auto")=>t==="always"||t==="auto"&&!(typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches);function Zd(t,e,s,r,i={}){let o=i.duration??600;if(!o||!vh(i.motion))return;let n=no(t,e,s,r);t.appendChild(n.svg),n.at(0);let a=0,m=!1,p,c=new Promise(u=>p=u),l=()=>{m||(m=!0,cancelAnimationFrame(a),n.svg.remove(),p())},f=performance.now(),d=u=>{if(m)return;let y=Math.min(1,(u-f)/o);n.at(y),y<1?a=requestAnimationFrame(d):l()};return a=requestAnimationFrame(d),{done:c,finish:l}}var Ss=t=>Math.max(0,Math.min(1,t)),to=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2;function rl(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 m 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(m,n.getPropertyValue(m))}),e}var Wc=(t,e)=>{let s=t.getBoundingClientRect();return{x:s.left-e.left,y:s.top-e.top,w:s.width,h:s.height}},Kd=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}},Mh=(t,e)=>{let s=t.getScreenCTM();return`matrix(${s.a} ${s.b} ${s.c} ${s.d} ${s.e-e.left} ${s.f-e.top})`},Gd=(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 Ph(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 no(t,e,s,r){let i=t.getBoundingClientRect(),o=document.createElementNS(qs,"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=k=>{let $=document.createElementNS(qs,"g");return $.setAttribute("transform",Mh(k,i)),$},a=k=>k.hasAttribute("data-a")||k.hasAttribute("data-for"),m=k=>{let $=new Map;for(let v of k.querySelectorAll("[data-id]")){if(a(v)||v.parentElement?.closest("[data-id]")||v.closest(".overlay"))continue;let T=v.getAttribute("data-id");($.get(T)??$.set(T,[]).get(T)).push(v)}return $},p=m(e),c=m(s),l=document.createElementNS(qs,"g"),f=document.createElementNS(qs,"g"),d=n(e),u=n(s);for(let k of e.querySelectorAll("[data-a],[data-for]"))k.closest(".overlay")||d.appendChild(rl(k));for(let k of s.querySelectorAll("[data-a],[data-for]"))k.closest(".overlay")||u.appendChild(rl(k));l.appendChild(d),f.appendChild(u);let y=[...u.querySelectorAll("path")].map(k=>{let $=k.getTotalLength?.()??0;return{p:k,len:$}}),g=[...u.children].filter(k=>k.tagName.toLowerCase()==="text"),x=[...(r==="2d"?p:c).keys()],h=[],b=document.createElementNS(qs,"g");for(let k of new Set([...x,...p.keys(),...c.keys()])){let $=p.get(k),v=c.get(k),T={};if($){T.a=Kd($.map(j=>Wc(j,i)));let A=document.createElementNS(qs,"g"),P=n(e);for(let j of $)P.appendChild(rl(j));A.appendChild(P),T.src=A}if(v){T.b=Kd(v.map(j=>Wc(j,i)));let A=document.createElementNS(qs,"g"),P=n(s);for(let j of v)P.appendChild(rl(j));A.appendChild(P),T.dst=A}let R=r==="3d"?$?.[0]:v?.[0],O=r==="3d"?v?.[0]:$?.[0],I=R?Ph(R,i):void 0,M=O?.querySelector("rect.face");if(I&&M){let A=Wc(M,i),P=[[A.x,A.y],[A.x+A.w,A.y],[A.x+A.w,A.y+A.h],[A.x,A.y+A.h]],j=I.pts.reduce((C,G,Z)=>G[0]<I.pts[C][0]?Z:C,0),F=[...I.pts.slice(j),...I.pts.slice(0,j)],Y=[F[0],F[1],F[2],F[3]],J=getComputedStyle(M).fill,U=document.createElementNS(qs,"polygon");T.face=U,T.faceFrom=r==="3d"?Y:P,T.faceTo=r==="3d"?P:Y,T.faceFill=r==="3d"?[I.fill,J]:[J,I.fill]}T.src&&b.appendChild(T.src),T.face&&b.appendChild(T.face),T.dst&&b.appendChild(T.dst),h.push(T)}o.append(l,b,f);let w=(k,$,v)=>`color-mix(in srgb, ${k} ${Math.round((1-v)*100)}%, ${$})`;return{svg:o,at(k){let $=Ss(k/.2),v=to(Ss((k-.2)/.6)),T=Ss((k-.8)/.2);l.setAttribute("opacity",String(1-$));for(let{p:R,len:O}of y)R.style.strokeDasharray=`${O} ${O}`,R.style.strokeDashoffset=String(O*(1-T));f.setAttribute("opacity",String(T>0?1:0));for(let R of g)R.style.opacity=String(T);for(let R of h)if(R.src&&(R.src.setAttribute("transform",R.a&&R.b?Gd(R.a,R.b,v):""),R.src.setAttribute("opacity",String(R.b?1-Ss(v/(R.face?.35:.6)):1-v))),R.dst&&(R.dst.setAttribute("transform",R.a&&R.b?Gd(R.b,R.a,1-v):""),R.dst.setAttribute("opacity",String(R.a?Ss((v-(R.face?.65:.4))/(R.face?.35:.6)):v))),R.face){let O=R.faceFrom.map((I,M)=>[I[0]+(R.faceTo[M][0]-I[0])*v,I[1]+(R.faceTo[M][1]-I[1])*v]);R.face.setAttribute("points",O.map(I=>I.join(",")).join(" ")),R.face.style.fill=w(R.faceFill[0],R.faceFill[1],v),R.face.setAttribute("opacity",String(v<.08?v/.08:v>.92?(1-v)/.08:1))}}}}var Oh=0;function Ud(t,e,s={}){let r=`dv${++Oh}`,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 m=s.board??_a(e);il(a,e,m);let p=new Set(e.routes.map(O=>O.id));for(let O of a.querySelectorAll("g[data-id]")){let I=O.getAttribute("data-id");p.has(I)||O.hasAttribute("tabindex")||!O.querySelector("polygon")||(O.setAttribute("tabindex","0"),O.setAttribute("role","button"),O.setAttribute("aria-label",I))}let c=sl(n),l=Kr(m,c,s.flat);c.dispose(),n.innerHTML=nl(l,{id:r,title:s.title,styles:s.styles});let f=n.querySelector("svg");for(let O of[a,f])O.style.display="block",O.style.width="100%",O.style.height="auto";s.title&&a.setAttribute("aria-label",s.title);let d=s.mode??"3d",u,y=O=>O==="3d"?o:n,g=O=>O==="3d"?a:f,x=O=>{o.hidden=O!=="3d",n.hidden=O!=="2d";for(let I of[o,n])I.style.cssText="";i.style.height="",i.dataset.mode=O};x(d);let h=()=>{for(let O of[a,f]){for(let I of O.querySelectorAll("[data-id]"))I.classList.toggle("sel",!!u&&I.getAttribute("data-id")===u);for(let I of O.querySelectorAll("[data-a]")){let M=!!u&&(I.getAttribute("data-a")===u||I.getAttribute("data-b")===u);I.classList.toggle("hot",M),I.classList.toggle("dim",!!u&&!M),O.querySelector(`[data-for="${CSS.escape(I.getAttribute("data-id")??"")}"]`)?.classList.toggle("dim",!!u&&!M)}}},b=O=>{u=O,h()},w=O=>{let I=O.target.closest?.("[data-id]");if(!I||!i.contains(I)||I.hasAttribute("data-a"))return;let M=I.getAttribute("data-id");b(M),s.onSelect?.(M)},k=O=>{(O.key==="Enter"||O.key===" ")&&O.target.matches?.("[data-id][tabindex]")&&(O.preventDefault(),w(O))};i.addEventListener("click",w),i.addEventListener("keydown",k);let $,v=()=>{if(!$)return;cancelAnimationFrame($.frame),$.layer.remove();let O=$;$=void 0,d=O.to,x(d),h(),O.done()},T=O=>{!O||!u||g(d).querySelector(`[data-id="${CSS.escape(u)}"][tabindex]`)?.focus({preventScroll:!0})};return{get mode(){return $?$.to:d},layout:l,root:i,morph:O=>{let I=i.contains(document.activeElement);if($&&v(),O===d)return T(I),Promise.resolve();let M=s.motion??"auto";return M==="never"||M==="auto"&&typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches||!(s.duration??600)?(d=O,x(d),h(),T(I),Promise.resolve()):new Promise(P=>{let j=d,F=i.getBoundingClientRect().height;o.hidden=!1,n.hidden=!1;for(let Q of[o,n])Q.style.cssText="position:absolute;left:0;top:0;right:0;visibility:hidden";let Y=y(O).getBoundingClientRect().height;i.style.height=`${F}px`;let J=no(i,g(j),g(O),j);i.appendChild(J.svg);let U=s.duration??600,C=performance.now(),G={frame:0,layer:J.svg,to:O,done:()=>{T(I),P()}},Z=Q=>{if($!==G)return;let z=Math.min(1,(Q-C)/U);J.at(z),i.style.height=`${F+(Y-F)*to(Ss((z-.2)/.6))}px`,z<1?G.frame=requestAnimationFrame(Z):v()};$=G,G.frame=requestAnimationFrame(Z)})},select:b,get selected(){return u},svgOf:g,destroy(){$&&v(),i.removeEventListener("click",w),i.removeEventListener("keydown",k),i.remove()}}}function Yd(t="iso-view"){try{let e=localStorage.getItem(t);return e==="2d"||e==="3d"?e:void 0}catch{return}}function Hd(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((m,p)=>{let c=document.createElement("button");return c.type="button",c.dataset.mode=m,c.textContent=(s.labels??["3D","2D"])[p],c.addEventListener("click",()=>{try{localStorage.setItem(r,m)}catch{}a(m);for(let l of i)l.morph(m)}),o.appendChild(c),c}),a=m=>n.forEach(p=>p.setAttribute("aria-pressed",String(p.dataset.mode===m)));return a(i[0]?.mode??"3d"),t.appendChild(o),o}var Wd=`
379
388
  .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)}
380
389
  .view-switch button{font:inherit;border:0;background:none;color:var(--ink);padding:6px 10px;cursor:pointer}
381
390
  .view-switch button+button{border-left:1px solid var(--line)}
@@ -385,5 +394,7 @@ ${e.extraBody??""}
385
394
  .dual-view .blk.sel polygon{stroke:var(--accent,#2f6fd6);stroke-width:2.4}
386
395
  .dual-view [data-a].dim{opacity:.3}
387
396
  .dual-view [data-a].hot path{stroke-width:3.4}
388
- `;var vf={};mi(vf,{BASE_CSS:()=>ff,DRAWING_CSS:()=>pf,NODE_ASSETS:()=>li,REGION_KINDS:()=>zl,compile:()=>Sf,getAsset:()=>cf,systems:()=>Ys});var fm={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[n,r]=$n(e),i=Math.min(e.x1-e.x0,e.y1-e.y0)/2,o=(l,p)=>[n+i*Math.cos(l*Math.PI/180),r+i*Math.sin(l*Math.PI/180),p],s=(l,p,f)=>Array.from({length:13},(m,u)=>o(l+(p-l)*u/12,f)),a=(l,p,f)=>t.poly([...s(l,p,e.z0),...s(l,p,e.z1).reverse()],f),d=e.z1-e.z0,c=l=>s(-45,135,l).slice(1).map((p,f,m)=>t.line3(f?m[f-1]:o(-45,l),p,"det")).join("");return a(45,135,"lft")+a(-45,45,"rgt")+c(e.z0+d*.36)+c(e.z0+d*.68)+t.poly(Array.from({length:32},(l,p)=>o(p*360/32,e.z1)),"top")}},dm={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",fe("radialGradient",{id:"orbG",cx:"0.36",cy:"0.30",r:"0.80"},fe("stop",{offset:"0",style:"stop-color:#ffffff"})+fe("stop",{offset:"0.62",style:"stop-color:#f6f6f4"})+fe("stop",{offset:"1",style:"stop-color:#cfd0d6"})));let n=Ur(e),[r,i]=ke((e.x0+e.x1)/2,(e.y0+e.y1)/2,n.z1),o=23,s=i-o+3;t.bounds.add([r-o,s-o]),t.bounds.add([r+o,s+o]);let a=(d,c,l,p)=>fe("rect",{class:"eye",x:r+d-l/2,y:s+c-p/2,width:l,height:p,rx:l/2,transform:`rotate(-24 ${(r+d).toFixed(1)} ${(s+c).toFixed(1)})`});return t.blockFaces(n)+fe("ellipse",{class:"shade",cx:r,cy:i+1,rx:o*.8,ry:o*.3})+fe("circle",{class:"ball",cx:r,cy:s,r:o})+a(3,-7,6.4,13.5)+a(14,-12,5.4,10.5)},label(t,e,n){let[r,i]=ke((t.x0+t.x1)/2,(t.y0+t.y1)/2,t.z0+1.95);return{x:r,y:i-26+(n?0:14),anchor:"middle"}},pulse:t=>[(t.x0+t.x1)/2,(t.y0+t.y1)/2,t.z0+.8,26]},mm={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 n=Ur(e),[r,i]=ke((e.x0+e.x1)/2,(e.y0+e.y1)/2,n.z1);t.bounds.add([r-13,i-50]);let o=s=>s.toFixed(1);return t.blockFaces(n)+fe("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`})+fe("circle",{class:"head",cx:r,cy:i-40,r:10})},label(t){let[e,n]=ke((t.x0+t.x1)/2,(t.y0+t.y1)/2,t.z0);return{x:e+30,y:n+2,anchor:"start"}},pulse:t=>[(t.x0+t.x1)/2,(t.y0+t.y1)/2,t.z0+.9,26]},um={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,n){let[r,i]=$n(e),o=(e.x1-e.x0)/2,s=e.z1-e.z0,a=.14,d=(n.facing??0)*Math.PI/180,c=Math.cos(d),l=Math.sin(d),p=Math.sin(d)*a,f=-Math.cos(d)*a,m=[r-c*o,i-l*o],u=[r+c*o,i+l*o],h=e.z0,y=e.z1,v=t.poly([[u[0],u[1],h],[u[0]+p,u[1]+f,h],[u[0]+p,u[1]+f,y],[u[0],u[1],y]],"rgt")+t.poly([[m[0],m[1],y],[u[0],u[1],y],[u[0]+p,u[1]+f,y],[m[0]+p,m[1]+f,y]],"top")+t.poly([[m[0],m[1],h],[u[0],u[1],h],[u[0],u[1],y],[m[0],m[1],y]],"lft"),g=ke(m[0],m[1],y),b=ke(u[0],u[1],y),$=2*o*Qe,E=s*Qe,S=[(b[0]-g[0])/$,(b[1]-g[1])/$,0,1,g[0],g[1]],k=Nn(n.face??"terminal")??$r;return v+=t.onMatrix(S,$,E,(T,z)=>Pr(T,z)+k(T,z),"scr"),v}},hm={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,n){let r=Nn(n.face??"terminal")??$r;return t.blockFaces(e)+t.onFace(e,"left",(i,o)=>Pr(i,o)+r(i,o),"scr")}},ym={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)=>sr(t,e)},li={block:Xt("block","A box. Size and colour role are free; add decorations with `deco`.",[2.4,2.4,1.6],"grey"),session:Xt("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:Xt("terminal","A box with terminal lines on its front.",[1.6,1.2,.8],"term",[{terminal:2}]),server:Xt("server","A service or daemon: a low box with two terminal lines.",[3,2.2,.9],"doz",[{terminal:2}]),chat:Xt("chat","A chat server or room: a box with a chat bubble on top.",[3.6,4.4,1.3],"chat",["bubble"]),mailbox:Xt("mailbox","A room or inbox: terminal lines and an envelope on top.",[2.4,2.4,1.6],"mail",[{terminal:3},"envelope"]),file:Xt("file","A file or document: a low box with lines on top.",[1.6,1.6,.6],"file",["file-lines"]),folder:Xt("folder","A folder or directory: a flat box.",[1.6,1.6,.5],"folder"),key:Xt("key","A secret: a low box with a key on top.",[1.6,1.6,.6],"key",[],(t,e)=>gi(t,e)),socket:Xt("socket","A socket: a small box with a round opening on top.",[1.2,1.2,.5],"socket",[],(t,e)=>bi(t,e)),gate:Xt("gate","A gate or proxy: a narrow upright slab, usually set in a fence wall.",[.3,2,1.1],"gate"),placeholder:Xt("placeholder","A placeholder value: a small low box with lines.",[1.2,1,.45],"placeholder",["file-lines"]),orb:dm,person:mm,screen:um,monitor:hm,cloud:ym,volume:fm};function cf(t){return li[t??"block"]}var gm="border-color:hsl(38 80% 45%);background:hsl(38 80% 55% / .2)",zl={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:gm,box:!0,auto:!0},css:`.fz{fill:var(--fence-text)!important;opacity:1!important}
389
- `},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}}},Ys={regions:zl,nodes:li,defaultNode:"block"};var pf=ei(Ys),ff=ar(Ys);var mf=ra,Je={$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"},scenes:{type:"array",minItems:1,items:{$ref:"#/$defs/scene"}}},$defs:{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"},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"}},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"}}},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}]}}}}},Nt={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"}}},xs={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"]}}},Mt={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"}}},ci=Object.prototype.hasOwnProperty,$e={type:"object",required:["id","title"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},title:{type:"string"},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"}}},ge={type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},Rt=new RegExp("^[A-Za-z][A-Za-z0-9_-]*$","u"),Pe={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"}},nodes:{type:"array",items:{$ref:"#/$defs/node"}}}},is={type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:3},Cl={enum:["n","e","s","w"]},df={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"}}},St={type:"array",items:{type:"number"},minItems:2,maxItems:2},Ll={enum:["start","center","end"]},_e={anyOf:[{type:"string"},{type:"integer",minimum:1}]};function an(t,{instancePath:e="",parentData:n,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=an.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(t.in!==void 0){let p=t.in;if(typeof p=="string"){if(!Rt.test(p)){let f={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:ge,data:p};s===null?s=[f]:s.push(f),a++}}else{let f={instancePath:e+"/in",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ge.type,parentSchema:ge,data:p};s===null?s=[f]:s.push(f),a++}}if(t.at!==void 0){let p=t.at;if(Array.isArray(p)){if(p.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:St,data:p};s===null?s=[m]:s.push(m),a++}if(p.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:St,data:p};s===null?s=[m]:s.push(m),a++}let f=p.length;for(let m=0;m<f;m++){let u=p[m];if(typeof u!="number"){let h={instancePath:e+"/at/"+m,schemaPath:"#/$defs/point2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:St.items.type,parentSchema:St.items,data:u};s===null?s=[h]:s.push(h),a++}}}else{let f={instancePath:e+"/at",schemaPath:"#/$defs/point2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:St.type,parentSchema:St,data:p};s===null?s=[f]:s.push(f),a++}}if(t["right-of"]!==void 0){let p=t["right-of"];if(typeof p=="string"){if(!Rt.test(p)){let f={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:ge,data:p};s===null?s=[f]:s.push(f),a++}}else{let f={instancePath:e+"/right-of",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ge.type,parentSchema:ge,data:p};s===null?s=[f]:s.push(f),a++}}if(t["left-of"]!==void 0){let p=t["left-of"];if(typeof p=="string"){if(!Rt.test(p)){let f={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:ge,data:p};s===null?s=[f]:s.push(f),a++}}else{let f={instancePath:e+"/left-of",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ge.type,parentSchema:ge,data:p};s===null?s=[f]:s.push(f),a++}}if(t.below!==void 0){let p=t.below;if(typeof p=="string"){if(!Rt.test(p)){let f={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:ge,data:p};s===null?s=[f]:s.push(f),a++}}else{let f={instancePath:e+"/below",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ge.type,parentSchema:ge,data:p};s===null?s=[f]:s.push(f),a++}}if(t.behind!==void 0){let p=t.behind;if(typeof p=="string"){if(!Rt.test(p)){let f={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:ge,data:p};s===null?s=[f]:s.push(f),a++}}else{let f={instancePath:e+"/behind",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ge.type,parentSchema:ge,data:p};s===null?s=[f]:s.push(f),a++}}if(t.gap!==void 0){let p=t.gap;if(typeof p!="number"){let f={instancePath:e+"/gap",schemaPath:"#/properties/gap/type",keyword:"type",params:{type:"number"},message:"must be number",schema:df.properties.gap.type,parentSchema:df.properties.gap,data:p};s===null?s=[f]:s.push(f),a++}}if(t.align!==void 0){let p=t.align;if(!(p==="start"||p==="center"||p==="end")){let f={instancePath:e+"/align",schemaPath:"#/$defs/align/enum",keyword:"enum",params:{allowedValues:Ll.enum},message:"must be equal to one of the allowed values",schema:Ll.enum,parentSchema:Ll,data:p};s===null?s=[f]:s.push(f),a++}}if(t.shift!==void 0){let p=t.shift;if(Array.isArray(p)){if(p.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:St,data:p};s===null?s=[m]:s.push(m),a++}if(p.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:St,data:p};s===null?s=[m]:s.push(m),a++}let f=p.length;for(let m=0;m<f;m++){let u=p[m];if(typeof u!="number"){let h={instancePath:e+"/shift/"+m,schemaPath:"#/$defs/point2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:St.items.type,parentSchema:St.items,data:u};s===null?s=[h]:s.push(h),a++}}}else{let f={instancePath:e+"/shift",schemaPath:"#/$defs/point2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:St.type,parentSchema:St,data:p};s===null?s=[f]:s.push(f),a++}}if(t.appears!==void 0){let p=t.appears,f=a,m=!1,u=a;if(typeof p!="string"){let y={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:_e.anyOf[0].type,parentSchema:_e.anyOf[0],data:p};s===null?s=[y]:s.push(y),a++}var c=u===a;m=m||c;let h=a;if(!(typeof p=="number"&&!(p%1)&&!isNaN(p))){let y={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:_e.anyOf[1].type,parentSchema:_e.anyOf[1],data:p};s===null?s=[y]:s.push(y),a++}if(typeof p=="number"&&(p<1||isNaN(p))){let y={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:_e.anyOf[1],data:p};s===null?s=[y]:s.push(y),a++}var c=h===a;if(m=m||c,m)a=f,s!==null&&(f?s.length=f:s=null);else{let y={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:_e.anyOf,parentSchema:_e,data:p};s===null?s=[y]:s.push(y),a++}}if(t.disappears!==void 0){let p=t.disappears,f=a,m=!1,u=a;if(typeof p!="string"){let y={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:_e.anyOf[0].type,parentSchema:_e.anyOf[0],data:p};s===null?s=[y]:s.push(y),a++}var l=u===a;m=m||l;let h=a;if(!(typeof p=="number"&&!(p%1)&&!isNaN(p))){let y={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:_e.anyOf[1].type,parentSchema:_e.anyOf[1],data:p};s===null?s=[y]:s.push(y),a++}if(typeof p=="number"&&(p<1||isNaN(p))){let y={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:_e.anyOf[1],data:p};s===null?s=[y]:s.push(y),a++}var l=h===a;if(m=m||l,m)a=f,s!==null&&(f?s.length=f:s=null);else{let y={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:_e.anyOf,parentSchema:_e,data:p};s===null?s=[y]:s.push(y),a++}}}return an.errors=s,a===0}an.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 qe={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"}}},nodes:{type:"array",items:{$ref:"#/$defs/node"},description:"nodes standing on top of this one"}}},zt={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"}}}]},_l=new RegExp("^[a-z][a-z0-9-]*$","u"),Fl={validate:Hs};function Hs(t,{instancePath:e="",parentData:n,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=Hs.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),an(t,{instancePath:e,parentData:n,parentDataProperty:r,rootData:i,dynamicAnchors:o})||(s=s===null?an.errors:s.concat(an.errors),a=s.length),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:qe.required,parentSchema:qe,data:t};s===null?s=[l]:s.push(l),a++}if(t.id!==void 0){let l=t.id;if(typeof l=="string"){if(!Rt.test(l)){let p={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:ge,data:l};s===null?s=[p]:s.push(p),a++}}else{let p={instancePath:e+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ge.type,parentSchema:ge,data:l};s===null?s=[p]:s.push(p),a++}}if(t.asset!==void 0){let l=t.asset;if(typeof l!="string"){let p={instancePath:e+"/asset",schemaPath:"#/properties/asset/type",keyword:"type",params:{type:"string"},message:"must be string",schema:qe.properties.asset.type,parentSchema:qe.properties.asset,data:l};s===null?s=[p]:s.push(p),a++}}if(t.role!==void 0){let l=t.role;if(typeof l!="string"){let p={instancePath:e+"/role",schemaPath:"#/properties/role/type",keyword:"type",params:{type:"string"},message:"must be string",schema:qe.properties.role.type,parentSchema:qe.properties.role,data:l};s===null?s=[p]:s.push(p),a++}}if(t.label!==void 0){let l=t.label;if(typeof l!="string"){let p={instancePath:e+"/label",schemaPath:"#/properties/label/type",keyword:"type",params:{type:"string"},message:"must be string",schema:qe.properties.label.type,parentSchema:qe.properties.label,data:l};s===null?s=[p]:s.push(p),a++}}if(t.sub!==void 0){let l=t.sub;if(typeof l!="string"){let p={instancePath:e+"/sub",schemaPath:"#/properties/sub/type",keyword:"type",params:{type:"string"},message:"must be string",schema:qe.properties.sub.type,parentSchema:qe.properties.sub,data:l};s===null?s=[p]:s.push(p),a++}}if(t.size!==void 0){let l=t.size;if(Array.isArray(l)){if(l.length>3){let f={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:is,data:l};s===null?s=[f]:s.push(f),a++}if(l.length<2){let f={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:is,data:l};s===null?s=[f]:s.push(f),a++}let p=l.length;for(let f=0;f<p;f++){let m=l[f];if(typeof m=="number"){if(m<=0||isNaN(m)){let u={instancePath:e+"/size/"+f,schemaPath:"#/$defs/size2or3/items/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:is.items,data:m};s===null?s=[u]:s.push(u),a++}}else{let u={instancePath:e+"/size/"+f,schemaPath:"#/$defs/size2or3/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:is.items.type,parentSchema:is.items,data:m};s===null?s=[u]:s.push(u),a++}}}else{let p={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/type",keyword:"type",params:{type:"array"},message:"must be array",schema:is.type,parentSchema:is,data:l};s===null?s=[p]:s.push(p),a++}}if(t.z!==void 0){let l=t.z;if(typeof l!="number"){let p={instancePath:e+"/z",schemaPath:"#/properties/z/type",keyword:"type",params:{type:"number"},message:"must be number",schema:qe.properties.z.type,parentSchema:qe.properties.z,data:l};s===null?s=[p]:s.push(p),a++}}if(t.deco!==void 0){let l=t.deco;if(Array.isArray(l)){let p=l.length;for(let f=0;f<p;f++){let m=l[f],u=a,h=!1,y=a;if(!(m==="envelope"||m==="bubble"||m==="file-lines"||m==="ghost"||m==="terminal")){let g={instancePath:e+"/deco/"+f,schemaPath:"#/$defs/deco/anyOf/0/enum",keyword:"enum",params:{allowedValues:zt.anyOf[0].enum},message:"must be equal to one of the allowed values",schema:zt.anyOf[0].enum,parentSchema:zt.anyOf[0],data:m};s===null?s=[g]:s.push(g),a++}var c=y===a;h=h||c;let v=a;if(m&&typeof m=="object"&&!Array.isArray(m)){if(Object.keys(m).length>1){let g={instancePath:e+"/deco/"+f,schemaPath:"#/$defs/deco/anyOf/1/maxProperties",keyword:"maxProperties",params:{limit:1},message:"must NOT have more than 1 properties",schema:1,parentSchema:zt.anyOf[1],data:m};s===null?s=[g]:s.push(g),a++}if(Object.keys(m).length<1){let g={instancePath:e+"/deco/"+f,schemaPath:"#/$defs/deco/anyOf/1/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:zt.anyOf[1],data:m};s===null?s=[g]:s.push(g),a++}for(let g in m)if(!(g==="terminal"||g==="icon"||g==="screen")){let b={instancePath:e+"/deco/"+f,schemaPath:"#/$defs/deco/anyOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:g},message:"must NOT have additional properties",schema:!1,parentSchema:zt.anyOf[1],data:m};s===null?s=[b]:s.push(b),a++}if(m.terminal!==void 0){let g=m.terminal;if(!(typeof g=="number"&&!(g%1)&&!isNaN(g))){let b={instancePath:e+"/deco/"+f+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:zt.anyOf[1].properties.terminal.type,parentSchema:zt.anyOf[1].properties.terminal,data:g};s===null?s=[b]:s.push(b),a++}if(typeof g=="number"){if(g>8||isNaN(g)){let b={instancePath:e+"/deco/"+f+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/maximum",keyword:"maximum",params:{comparison:"<=",limit:8},message:"must be <= 8",schema:8,parentSchema:zt.anyOf[1].properties.terminal,data:g};s===null?s=[b]:s.push(b),a++}if(g<1||isNaN(g)){let b={instancePath:e+"/deco/"+f+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:zt.anyOf[1].properties.terminal,data:g};s===null?s=[b]:s.push(b),a++}}}if(m.icon!==void 0){let g=m.icon;if(typeof g=="string"){if(!_l.test(g)){let b={instancePath:e+"/deco/"+f+"/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:zt.anyOf[1].properties.icon,data:g};s===null?s=[b]:s.push(b),a++}}else{let b={instancePath:e+"/deco/"+f+"/icon",schemaPath:"#/$defs/deco/anyOf/1/properties/icon/type",keyword:"type",params:{type:"string"},message:"must be string",schema:zt.anyOf[1].properties.icon.type,parentSchema:zt.anyOf[1].properties.icon,data:g};s===null?s=[b]:s.push(b),a++}}if(m.screen!==void 0){let g=m.screen;if(typeof g=="string"){if(!_l.test(g)){let b={instancePath:e+"/deco/"+f+"/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:zt.anyOf[1].properties.screen,data:g};s===null?s=[b]:s.push(b),a++}}else{let b={instancePath:e+"/deco/"+f+"/screen",schemaPath:"#/$defs/deco/anyOf/1/properties/screen/type",keyword:"type",params:{type:"string"},message:"must be string",schema:zt.anyOf[1].properties.screen.type,parentSchema:zt.anyOf[1].properties.screen,data:g};s===null?s=[b]:s.push(b),a++}}}else{let g={instancePath:e+"/deco/"+f,schemaPath:"#/$defs/deco/anyOf/1/type",keyword:"type",params:{type:"object"},message:"must be object",schema:zt.anyOf[1].type,parentSchema:zt.anyOf[1],data:m};s===null?s=[g]:s.push(g),a++}var c=v===a;if(h=h||c,h)a=u,s!==null&&(u?s.length=u:s=null);else{let g={instancePath:e+"/deco/"+f,schemaPath:"#/$defs/deco/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:zt.anyOf,parentSchema:zt,data:m};s===null?s=[g]:s.push(g),a++}}}else{let p={instancePath:e+"/deco",schemaPath:"#/properties/deco/type",keyword:"type",params:{type:"array"},message:"must be array",schema:qe.properties.deco.type,parentSchema:qe.properties.deco,data:l};s===null?s=[p]:s.push(p),a++}}if(t.ghost!==void 0){let l=t.ghost;if(typeof l!="boolean"){let p={instancePath:e+"/ghost",schemaPath:"#/properties/ghost/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:qe.properties.ghost.type,parentSchema:qe.properties.ghost,data:l};s===null?s=[p]:s.push(p),a++}}if(t.face!==void 0){let l=t.face;if(typeof l=="string"){if(!_l.test(l)){let p={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:qe.properties.face,data:l};s===null?s=[p]:s.push(p),a++}}else{let p={instancePath:e+"/face",schemaPath:"#/properties/face/type",keyword:"type",params:{type:"string"},message:"must be string",schema:qe.properties.face.type,parentSchema:qe.properties.face,data:l};s===null?s=[p]:s.push(p),a++}}if(t.facing!==void 0){let l=t.facing;if(typeof l!="number"){let p={instancePath:e+"/facing",schemaPath:"#/properties/facing/type",keyword:"type",params:{type:"number"},message:"must be number",schema:qe.properties.facing.type,parentSchema:qe.properties.facing,data:l};s===null?s=[p]:s.push(p),a++}}if(t["label-at"]!==void 0){let l=t["label-at"];if(l&&typeof l=="object"&&!Array.isArray(l)){for(let p in l)if(!(p==="side"||p==="dx"||p==="dy")){let f={instancePath:e+"/label-at",schemaPath:"#/properties/label-at/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:p},message:"must NOT have additional properties",schema:!1,parentSchema:qe.properties["label-at"],data:l};s===null?s=[f]:s.push(f),a++}if(l.side!==void 0){let p=l.side;if(!(p==="above"||p==="right"||p==="left"||p==="below")){let f={instancePath:e+"/label-at/side",schemaPath:"#/properties/label-at/properties/side/enum",keyword:"enum",params:{allowedValues:qe.properties["label-at"].properties.side.enum},message:"must be equal to one of the allowed values",schema:qe.properties["label-at"].properties.side.enum,parentSchema:qe.properties["label-at"].properties.side,data:p};s===null?s=[f]:s.push(f),a++}}if(l.dx!==void 0){let p=l.dx;if(typeof p!="number"){let f={instancePath:e+"/label-at/dx",schemaPath:"#/properties/label-at/properties/dx/type",keyword:"type",params:{type:"number"},message:"must be number",schema:qe.properties["label-at"].properties.dx.type,parentSchema:qe.properties["label-at"].properties.dx,data:p};s===null?s=[f]:s.push(f),a++}}if(l.dy!==void 0){let p=l.dy;if(typeof p!="number"){let f={instancePath:e+"/label-at/dy",schemaPath:"#/properties/label-at/properties/dy/type",keyword:"type",params:{type:"number"},message:"must be number",schema:qe.properties["label-at"].properties.dy.type,parentSchema:qe.properties["label-at"].properties.dy,data:p};s===null?s=[f]:s.push(f),a++}}}else{let p={instancePath:e+"/label-at",schemaPath:"#/properties/label-at/type",keyword:"type",params:{type:"object"},message:"must be object",schema:qe.properties["label-at"].type,parentSchema:qe.properties["label-at"],data:l};s===null?s=[p]:s.push(p),a++}}if(t.nodes!==void 0){let l=t.nodes;if(Array.isArray(l)){let p=l.length;for(let f=0;f<p;f++)Fl.validate(l[f],{instancePath:e+"/nodes/"+f,parentData:l,parentDataProperty:f,rootData:i,dynamicAnchors:o})||(s=s===null?Fl.validate.errors:s.concat(Fl.validate.errors),a=s.length)}else{let p={instancePath:e+"/nodes",schemaPath:"#/properties/nodes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:qe.properties.nodes.type,parentSchema:qe.properties.nodes,data:l};s===null?s=[p]:s.push(p),a++}}for(let l in t)if(l!=="id"&&l!=="asset"&&l!=="role"&&l!=="label"&&l!=="sub"&&l!=="size"&&l!=="z"&&l!=="deco"&&l!=="ghost"&&l!=="face"&&l!=="facing"&&l!=="label-at"&&l!=="nodes"&&l!=="in"&&l!=="at"&&l!=="right-of"&&l!=="left-of"&&l!=="below"&&l!=="behind"&&l!=="gap"&&l!=="align"&&l!=="shift"&&l!=="appears"&&l!=="disappears"){let p={instancePath:e,schemaPath:"#/unevaluatedProperties",keyword:"unevaluatedProperties",params:{unevaluatedProperty:l},message:"must NOT have unevaluated properties",schema:!1,parentSchema:qe,data:t};s===null?s=[p]:s.push(p),a++}}else{let l={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:qe.type,parentSchema:qe,data:t};s===null?s=[l]:s.push(l),a++}return Hs.errors=s,a===0}Hs.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var jl={validate:Fn};function Fn(t,{instancePath:e="",parentData:n,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=Fn.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),an(t,{instancePath:e,parentData:n,parentDataProperty:r,rootData:i,dynamicAnchors:o})||(s=s===null?an.errors:s.concat(an.errors),a=s.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:Pe.required,parentSchema:Pe,data:t};s===null?s=[c]:s.push(c),a++}if(t.kind===void 0){let c={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"kind"},message:"must have required property 'kind'",schema:Pe.required,parentSchema:Pe,data:t};s===null?s=[c]:s.push(c),a++}if(t.id!==void 0){let c=t.id;if(typeof c=="string"){if(!Rt.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:ge,data:c};s===null?s=[l]:s.push(l),a++}}else{let l={instancePath:e+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ge.type,parentSchema:ge,data:c};s===null?s=[l]:s.push(l),a++}}if(t.kind!==void 0){let c=t.kind;if(!(c==="slab"||c==="pad"||c==="fence"||c==="vm"||c==="cloud"||c==="zone"||c==="platform"||c==="tunnel")){let l={instancePath:e+"/kind",schemaPath:"#/properties/kind/enum",keyword:"enum",params:{allowedValues:Pe.properties.kind.enum},message:"must be equal to one of the allowed values",schema:Pe.properties.kind.enum,parentSchema:Pe.properties.kind,data:c};s===null?s=[l]:s.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:Pe.properties.label.type,parentSchema:Pe.properties.label,data:c};s===null?s=[l]:s.push(l),a++}}if(t["label-style"]!==void 0){let c=t["label-style"];if(!(c==="face"||c==="face-right"||c==="floor"||c==="none")){let l={instancePath:e+"/label-style",schemaPath:"#/properties/label-style/enum",keyword:"enum",params:{allowedValues:Pe.properties["label-style"].enum},message:"must be equal to one of the allowed values",schema:Pe.properties["label-style"].enum,parentSchema:Pe.properties["label-style"],data:c};s===null?s=[l]:s.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:Pe.properties.ghost.type,parentSchema:Pe.properties.ghost,data:c};s===null?s=[l]:s.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:Pe.properties.role.type,parentSchema:Pe.properties.role,data:c};s===null?s=[l]:s.push(l),a++}}if(t.size!==void 0){let c=t.size;if(Array.isArray(c)){if(c.length>3){let p={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:is,data:c};s===null?s=[p]:s.push(p),a++}if(c.length<2){let p={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:is,data:c};s===null?s=[p]:s.push(p),a++}let l=c.length;for(let p=0;p<l;p++){let f=c[p];if(typeof f=="number"){if(f<=0||isNaN(f)){let m={instancePath:e+"/size/"+p,schemaPath:"#/$defs/size2or3/items/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:is.items,data:f};s===null?s=[m]:s.push(m),a++}}else{let m={instancePath:e+"/size/"+p,schemaPath:"#/$defs/size2or3/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:is.items.type,parentSchema:is.items,data:f};s===null?s=[m]:s.push(m),a++}}}else{let l={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/type",keyword:"type",params:{type:"array"},message:"must be array",schema:is.type,parentSchema:is,data:c};s===null?s=[l]:s.push(l),a++}}if(t.padding!==void 0){let c=t.padding;if(typeof c=="number"){if(c<0||isNaN(c)){let l={instancePath:e+"/padding",schemaPath:"#/properties/padding/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:Pe.properties.padding,data:c};s===null?s=[l]:s.push(l),a++}}else{let l={instancePath:e+"/padding",schemaPath:"#/properties/padding/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Pe.properties.padding.type,parentSchema:Pe.properties.padding,data:c};s===null?s=[l]:s.push(l),a++}}if(t.height!==void 0){let c=t.height;if(typeof c=="number"){if(c<=0||isNaN(c)){let l={instancePath:e+"/height",schemaPath:"#/properties/height/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Pe.properties.height,data:c};s===null?s=[l]:s.push(l),a++}}else{let l={instancePath:e+"/height",schemaPath:"#/properties/height/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Pe.properties.height.type,parentSchema:Pe.properties.height,data:c};s===null?s=[l]:s.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:Pe.properties.z.type,parentSchema:Pe.properties.z,data:c};s===null?s=[l]:s.push(l),a++}}if(t.flow!==void 0){let c=t.flow;if(!(c==="row"||c==="column")){let l={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:c};s===null?s=[l]:s.push(l),a++}}if(t.gate!==void 0){let c=t.gate;if(c&&typeof c=="object"&&!Array.isArray(c)){if(c.side===void 0){let l={instancePath:e+"/gate",schemaPath:"#/properties/gate/required",keyword:"required",params:{missingProperty:"side"},message:"must have required property 'side'",schema:Pe.properties.gate.required,parentSchema:Pe.properties.gate,data:c};s===null?s=[l]:s.push(l),a++}for(let l in c)if(!(l==="side"||l==="at"||l==="width"||l==="height"||l==="node")){let p={instancePath:e+"/gate",schemaPath:"#/properties/gate/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:l},message:"must NOT have additional properties",schema:!1,parentSchema:Pe.properties.gate,data:c};s===null?s=[p]:s.push(p),a++}if(c.side!==void 0){let l=c.side;if(!(l==="n"||l==="e"||l==="s"||l==="w")){let p={instancePath:e+"/gate/side",schemaPath:"#/$defs/side/enum",keyword:"enum",params:{allowedValues:Cl.enum},message:"must be equal to one of the allowed values",schema:Cl.enum,parentSchema:Cl,data:l};s===null?s=[p]:s.push(p),a++}}if(c.at!==void 0){let l=c.at;if(typeof l=="number"){if(l>1||isNaN(l)){let p={instancePath:e+"/gate/at",schemaPath:"#/properties/gate/properties/at/maximum",keyword:"maximum",params:{comparison:"<=",limit:1},message:"must be <= 1",schema:1,parentSchema:Pe.properties.gate.properties.at,data:l};s===null?s=[p]:s.push(p),a++}if(l<0||isNaN(l)){let p={instancePath:e+"/gate/at",schemaPath:"#/properties/gate/properties/at/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:Pe.properties.gate.properties.at,data:l};s===null?s=[p]:s.push(p),a++}}else{let p={instancePath:e+"/gate/at",schemaPath:"#/properties/gate/properties/at/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Pe.properties.gate.properties.at.type,parentSchema:Pe.properties.gate.properties.at,data:l};s===null?s=[p]:s.push(p),a++}}if(c.width!==void 0){let l=c.width;if(typeof l=="number"){if(l<=0||isNaN(l)){let p={instancePath:e+"/gate/width",schemaPath:"#/properties/gate/properties/width/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Pe.properties.gate.properties.width,data:l};s===null?s=[p]:s.push(p),a++}}else{let p={instancePath:e+"/gate/width",schemaPath:"#/properties/gate/properties/width/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Pe.properties.gate.properties.width.type,parentSchema:Pe.properties.gate.properties.width,data:l};s===null?s=[p]:s.push(p),a++}}if(c.height!==void 0){let l=c.height;if(typeof l=="number"){if(l<=0||isNaN(l)){let p={instancePath:e+"/gate/height",schemaPath:"#/properties/gate/properties/height/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Pe.properties.gate.properties.height,data:l};s===null?s=[p]:s.push(p),a++}}else{let p={instancePath:e+"/gate/height",schemaPath:"#/properties/gate/properties/height/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Pe.properties.gate.properties.height.type,parentSchema:Pe.properties.gate.properties.height,data:l};s===null?s=[p]:s.push(p),a++}}if(c.node!==void 0){let l=c.node;if(typeof l=="string"){if(!Rt.test(l)){let p={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:ge,data:l};s===null?s=[p]:s.push(p),a++}}else{let p={instancePath:e+"/gate/node",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ge.type,parentSchema:ge,data:l};s===null?s=[p]:s.push(p),a++}}}else{let l={instancePath:e+"/gate",schemaPath:"#/properties/gate/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Pe.properties.gate.type,parentSchema:Pe.properties.gate,data:c};s===null?s=[l]:s.push(l),a++}}if(t.around!==void 0){let c=t.around;if(Array.isArray(c)){let l=c.length;for(let p=0;p<l;p++){let f=c[p];if(typeof f=="string"){if(!Rt.test(f)){let m={instancePath:e+"/around/"+p,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:ge,data:f};s===null?s=[m]:s.push(m),a++}}else{let m={instancePath:e+"/around/"+p,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ge.type,parentSchema:ge,data:f};s===null?s=[m]:s.push(m),a++}}}else{let l={instancePath:e+"/around",schemaPath:"#/properties/around/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Pe.properties.around.type,parentSchema:Pe.properties.around,data:c};s===null?s=[l]:s.push(l),a++}}if(t.regions!==void 0){let c=t.regions;if(Array.isArray(c)){let l=c.length;for(let p=0;p<l;p++)jl.validate(c[p],{instancePath:e+"/regions/"+p,parentData:c,parentDataProperty:p,rootData:i,dynamicAnchors:o})||(s=s===null?jl.validate.errors:s.concat(jl.validate.errors),a=s.length)}else{let l={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:c};s===null?s=[l]:s.push(l),a++}}if(t.nodes!==void 0){let c=t.nodes;if(Array.isArray(c)){let l=c.length;for(let p=0;p<l;p++)Hs(c[p],{instancePath:e+"/nodes/"+p,parentData:c,parentDataProperty:p,rootData:i,dynamicAnchors:o})||(s=s===null?Hs.errors:s.concat(Hs.errors),a=s.length)}else{let l={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:c};s===null?s=[l]:s.push(l),a++}}for(let c in t)if(c!=="id"&&c!=="kind"&&c!=="label"&&c!=="label-style"&&c!=="ghost"&&c!=="role"&&c!=="size"&&c!=="padding"&&c!=="height"&&c!=="z"&&c!=="flow"&&c!=="gate"&&c!=="around"&&c!=="regions"&&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:Pe,data:t};s===null?s=[l]:s.push(l),a++}}else{let c={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Pe.type,parentSchema:Pe,data:t};s===null?s=[c]:s.push(c),a++}return Fn.errors=s,a===0}Fn.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var xe={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"}}},on={type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"},Bl=new RegExp("^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$","u");function ur(t,{instancePath:e="",parentData:n,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=ur.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.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:xe.required,parentSchema:xe,data:t};s===null?s=[m]:s.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:xe.required,parentSchema:xe,data:t};s===null?s=[m]:s.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:xe.required,parentSchema:xe,data:t};s===null?s=[m]:s.push(m),a++}for(let m in t)if(!ci.call(xe.properties,m)){let u={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:m},message:"must NOT have additional properties",schema:!1,parentSchema:xe,data:t};s===null?s=[u]:s.push(u),a++}if(t.id!==void 0){let m=t.id;if(typeof m=="string"){if(!Rt.test(m)){let u={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:ge,data:m};s===null?s=[u]:s.push(u),a++}}else{let u={instancePath:e+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ge.type,parentSchema:ge,data:m};s===null?s=[u]:s.push(u),a++}}if(t.from!==void 0){let m=t.from;if(typeof m=="string"){if(!Bl.test(m)){let u={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:on,data:m};s===null?s=[u]:s.push(u),a++}}else{let u={instancePath:e+"/from",schemaPath:"#/$defs/endpoint/type",keyword:"type",params:{type:"string"},message:"must be string",schema:on.type,parentSchema:on,data:m};s===null?s=[u]:s.push(u),a++}}if(t.to!==void 0){let m=t.to;if(typeof m=="string"){if(!Bl.test(m)){let u={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:on,data:m};s===null?s=[u]:s.push(u),a++}}else{let u={instancePath:e+"/to",schemaPath:"#/$defs/endpoint/type",keyword:"type",params:{type:"string"},message:"must be string",schema:on.type,parentSchema:on,data:m};s===null?s=[u]:s.push(u),a++}}if(t.kind!==void 0){let m=t.kind;if(typeof m!="string"){let u={instancePath:e+"/kind",schemaPath:"#/properties/kind/type",keyword:"type",params:{type:"string"},message:"must be string",schema:xe.properties.kind.type,parentSchema:xe.properties.kind,data:m};s===null?s=[u]:s.push(u),a++}}if(t.via!==void 0){let m=t.via;if(Array.isArray(m)){let u=m.length;for(let h=0;h<u;h++){let y=m[h],v=a,g=!1,b=a;if(Array.isArray(y)){if(y.length>2){let S={instancePath:e+"/via/"+h,schemaPath:"#/$defs/point2/maxItems",keyword:"maxItems",params:{limit:2},message:"must NOT have more than 2 items",schema:2,parentSchema:St,data:y};s===null?s=[S]:s.push(S),a++}if(y.length<2){let S={instancePath:e+"/via/"+h,schemaPath:"#/$defs/point2/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:St,data:y};s===null?s=[S]:s.push(S),a++}let E=y.length;for(let S=0;S<E;S++){let k=y[S];if(typeof k!="number"){let T={instancePath:e+"/via/"+h+"/"+S,schemaPath:"#/$defs/point2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:St.items.type,parentSchema:St.items,data:k};s===null?s=[T]:s.push(T),a++}}}else{let E={instancePath:e+"/via/"+h,schemaPath:"#/$defs/point2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:St.type,parentSchema:St,data:y};s===null?s=[E]:s.push(E),a++}var c=b===a;g=g||c;let $=a;if(typeof y=="string"){if(!Bl.test(y)){let E={instancePath:e+"/via/"+h,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:on,data:y};s===null?s=[E]:s.push(E),a++}}else{let E={instancePath:e+"/via/"+h,schemaPath:"#/$defs/endpoint/type",keyword:"type",params:{type:"string"},message:"must be string",schema:on.type,parentSchema:on,data:y};s===null?s=[E]:s.push(E),a++}var c=$===a;if(g=g||c,g)a=v,s!==null&&(v?s.length=v:s=null);else{let E={instancePath:e+"/via/"+h,schemaPath:"#/properties/via/items/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:xe.properties.via.items.anyOf,parentSchema:xe.properties.via.items,data:y};s===null?s=[E]:s.push(E),a++}}}else{let u={instancePath:e+"/via",schemaPath:"#/properties/via/type",keyword:"type",params:{type:"array"},message:"must be array",schema:xe.properties.via.type,parentSchema:xe.properties.via,data:m};s===null?s=[u]:s.push(u),a++}}if(t.points!==void 0){let m=t.points;if(Array.isArray(m)){let u=m.length;for(let h=0;h<u;h++){let y=m[h];if(Array.isArray(y)){if(y.length>3){let g={instancePath:e+"/points/"+h,schemaPath:"#/properties/points/items/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:xe.properties.points.items,data:y};s===null?s=[g]:s.push(g),a++}if(y.length<2){let g={instancePath:e+"/points/"+h,schemaPath:"#/properties/points/items/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:xe.properties.points.items,data:y};s===null?s=[g]:s.push(g),a++}let v=y.length;for(let g=0;g<v;g++){let b=y[g];if(typeof b!="number"){let $={instancePath:e+"/points/"+h+"/"+g,schemaPath:"#/properties/points/items/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:xe.properties.points.items.items.type,parentSchema:xe.properties.points.items.items,data:b};s===null?s=[$]:s.push($),a++}}}else{let v={instancePath:e+"/points/"+h,schemaPath:"#/properties/points/items/type",keyword:"type",params:{type:"array"},message:"must be array",schema:xe.properties.points.items.type,parentSchema:xe.properties.points.items,data:y};s===null?s=[v]:s.push(v),a++}}}else{let u={instancePath:e+"/points",schemaPath:"#/properties/points/type",keyword:"type",params:{type:"array"},message:"must be array",schema:xe.properties.points.type,parentSchema:xe.properties.points,data:m};s===null?s=[u]:s.push(u),a++}}if(t.lane!==void 0){let m=t.lane;if(typeof m!="number"){let u={instancePath:e+"/lane",schemaPath:"#/properties/lane/type",keyword:"type",params:{type:"number"},message:"must be number",schema:xe.properties.lane.type,parentSchema:xe.properties.lane,data:m};s===null?s=[u]:s.push(u),a++}}if(t.arrow!==void 0){let m=t.arrow;if(typeof m!="boolean"){let u={instancePath:e+"/arrow",schemaPath:"#/properties/arrow/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:xe.properties.arrow.type,parentSchema:xe.properties.arrow,data:m};s===null?s=[u]:s.push(u),a++}}if(t.cross!==void 0){let m=t.cross;if(typeof m!="boolean"){let u={instancePath:e+"/cross",schemaPath:"#/properties/cross/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:xe.properties.cross.type,parentSchema:xe.properties.cross,data:m};s===null?s=[u]:s.push(u),a++}}if(t.label!==void 0){let m=t.label,u=a,h=!1,y=a;if(typeof m!="string"){let g={instancePath:e+"/label",schemaPath:"#/properties/label/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:xe.properties.label.anyOf[0].type,parentSchema:xe.properties.label.anyOf[0],data:m};s===null?s=[g]:s.push(g),a++}var l=y===a;h=h||l;let v=a;if(m&&typeof m=="object"&&!Array.isArray(m)){if(m.text===void 0){let g={instancePath:e+"/label",schemaPath:"#/properties/label/anyOf/1/required",keyword:"required",params:{missingProperty:"text"},message:"must have required property 'text'",schema:xe.properties.label.anyOf[1].required,parentSchema:xe.properties.label.anyOf[1],data:m};s===null?s=[g]:s.push(g),a++}for(let g in m)if(!(g==="text"||g==="along"||g==="side"||g==="at"||g==="dir"||g==="anchor")){let b={instancePath:e+"/label",schemaPath:"#/properties/label/anyOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:g},message:"must NOT have additional properties",schema:!1,parentSchema:xe.properties.label.anyOf[1],data:m};s===null?s=[b]:s.push(b),a++}if(m.text!==void 0){let g=m.text;if(typeof g!="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:xe.properties.label.anyOf[1].properties.text.type,parentSchema:xe.properties.label.anyOf[1].properties.text,data:g};s===null?s=[b]:s.push(b),a++}}if(m.along!==void 0){let g=m.along;if(!(typeof g=="number"&&!(g%1)&&!isNaN(g))){let b={instancePath:e+"/label/along",schemaPath:"#/properties/label/anyOf/1/properties/along/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:xe.properties.label.anyOf[1].properties.along.type,parentSchema:xe.properties.label.anyOf[1].properties.along,data:g};s===null?s=[b]:s.push(b),a++}if(typeof g=="number"&&(g<1||isNaN(g))){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:xe.properties.label.anyOf[1].properties.along,data:g};s===null?s=[b]:s.push(b),a++}}if(m.side!==void 0){let g=m.side;if(!(g==="left"||g==="right")){let b={instancePath:e+"/label/side",schemaPath:"#/properties/label/anyOf/1/properties/side/enum",keyword:"enum",params:{allowedValues:xe.properties.label.anyOf[1].properties.side.enum},message:"must be equal to one of the allowed values",schema:xe.properties.label.anyOf[1].properties.side.enum,parentSchema:xe.properties.label.anyOf[1].properties.side,data:g};s===null?s=[b]:s.push(b),a++}}if(m.at!==void 0){let g=m.at;if(Array.isArray(g)){if(g.length>3){let $={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:xe.properties.label.anyOf[1].properties.at,data:g};s===null?s=[$]:s.push($),a++}if(g.length<2){let $={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:xe.properties.label.anyOf[1].properties.at,data:g};s===null?s=[$]:s.push($),a++}let b=g.length;for(let $=0;$<b;$++){let E=g[$];if(typeof E!="number"){let S={instancePath:e+"/label/at/"+$,schemaPath:"#/properties/label/anyOf/1/properties/at/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:xe.properties.label.anyOf[1].properties.at.items.type,parentSchema:xe.properties.label.anyOf[1].properties.at.items,data:E};s===null?s=[S]:s.push(S),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:xe.properties.label.anyOf[1].properties.at.type,parentSchema:xe.properties.label.anyOf[1].properties.at,data:g};s===null?s=[b]:s.push(b),a++}}if(m.dir!==void 0){let g=m.dir;if(!(g==="x"||g==="y")){let b={instancePath:e+"/label/dir",schemaPath:"#/properties/label/anyOf/1/properties/dir/enum",keyword:"enum",params:{allowedValues:xe.properties.label.anyOf[1].properties.dir.enum},message:"must be equal to one of the allowed values",schema:xe.properties.label.anyOf[1].properties.dir.enum,parentSchema:xe.properties.label.anyOf[1].properties.dir,data:g};s===null?s=[b]:s.push(b),a++}}if(m.anchor!==void 0){let g=m.anchor;if(!(g==="start"||g==="middle"||g==="end")){let b={instancePath:e+"/label/anchor",schemaPath:"#/properties/label/anyOf/1/properties/anchor/enum",keyword:"enum",params:{allowedValues:xe.properties.label.anyOf[1].properties.anchor.enum},message:"must be equal to one of the allowed values",schema:xe.properties.label.anyOf[1].properties.anchor.enum,parentSchema:xe.properties.label.anyOf[1].properties.anchor,data:g};s===null?s=[b]:s.push(b),a++}}}else{let g={instancePath:e+"/label",schemaPath:"#/properties/label/anyOf/1/type",keyword:"type",params:{type:"object"},message:"must be object",schema:xe.properties.label.anyOf[1].type,parentSchema:xe.properties.label.anyOf[1],data:m};s===null?s=[g]:s.push(g),a++}var l=v===a;if(h=h||l,h)a=u,s!==null&&(u?s.length=u:s=null);else{let g={instancePath:e+"/label",schemaPath:"#/properties/label/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:xe.properties.label.anyOf,parentSchema:xe.properties.label,data:m};s===null?s=[g]:s.push(g),a++}}if(t.appears!==void 0){let m=t.appears,u=a,h=!1,y=a;if(typeof m!="string"){let g={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:_e.anyOf[0].type,parentSchema:_e.anyOf[0],data:m};s===null?s=[g]:s.push(g),a++}var p=y===a;h=h||p;let v=a;if(!(typeof m=="number"&&!(m%1)&&!isNaN(m))){let g={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:_e.anyOf[1].type,parentSchema:_e.anyOf[1],data:m};s===null?s=[g]:s.push(g),a++}if(typeof m=="number"&&(m<1||isNaN(m))){let g={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:_e.anyOf[1],data:m};s===null?s=[g]:s.push(g),a++}var p=v===a;if(h=h||p,h)a=u,s!==null&&(u?s.length=u:s=null);else{let g={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:_e.anyOf,parentSchema:_e,data:m};s===null?s=[g]:s.push(g),a++}}if(t.disappears!==void 0){let m=t.disappears,u=a,h=!1,y=a;if(typeof m!="string"){let g={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:_e.anyOf[0].type,parentSchema:_e.anyOf[0],data:m};s===null?s=[g]:s.push(g),a++}var f=y===a;h=h||f;let v=a;if(!(typeof m=="number"&&!(m%1)&&!isNaN(m))){let g={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:_e.anyOf[1].type,parentSchema:_e.anyOf[1],data:m};s===null?s=[g]:s.push(g),a++}if(typeof m=="number"&&(m<1||isNaN(m))){let g={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:_e.anyOf[1],data:m};s===null?s=[g]:s.push(g),a++}var f=v===a;if(h=h||f,h)a=u,s!==null&&(u?s.length=u:s=null);else{let g={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:_e.anyOf,parentSchema:_e,data:m};s===null?s=[g]:s.push(g),a++}}}else{let m={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:xe.type,parentSchema:xe,data:t};s===null?s=[m]:s.push(m),a++}return ur.errors=s,a===0}ur.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var Xe={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 hr(t,{instancePath:e="",parentData:n,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=hr.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){for(let m in t)if(!ci.call(Xe.properties,m)){let u={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:m},message:"must NOT have additional properties",schema:!1,parentSchema:Xe,data:t};s===null?s=[u]:s.push(u),a++}if(t.floor!==void 0){let m=t.floor;if(typeof m!="string"){let u={instancePath:e+"/floor",schemaPath:"#/properties/floor/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Xe.properties.floor.type,parentSchema:Xe.properties.floor,data:m};s===null?s=[u]:s.push(u),a++}}if(t.face!==void 0){let m=t.face;if(typeof m!="string"){let u={instancePath:e+"/face",schemaPath:"#/properties/face/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Xe.properties.face.type,parentSchema:Xe.properties.face,data:m};s===null?s=[u]:s.push(u),a++}}if(t.label!==void 0){let m=t.label;if(typeof m!="string"){let u={instancePath:e+"/label",schemaPath:"#/properties/label/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Xe.properties.label.type,parentSchema:Xe.properties.label,data:m};s===null?s=[u]:s.push(u),a++}}if(t.sub!==void 0){let m=t.sub;if(typeof m!="string"){let u={instancePath:e+"/sub",schemaPath:"#/properties/sub/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Xe.properties.sub.type,parentSchema:Xe.properties.sub,data:m};s===null?s=[u]:s.push(u),a++}}if(t.at!==void 0){let m=t.at,u=a,h=!1,y=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:St,data:m};s===null?s=[b]:s.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:St,data:m};s===null?s=[b]:s.push(b),a++}let g=m.length;for(let b=0;b<g;b++){let $=m[b];if(typeof $!="number"){let E={instancePath:e+"/at/"+b,schemaPath:"#/$defs/point2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:St.items.type,parentSchema:St.items,data:$};s===null?s=[E]:s.push(E),a++}}}else{let g={instancePath:e+"/at",schemaPath:"#/$defs/point2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:St.type,parentSchema:St,data:m};s===null?s=[g]:s.push(g),a++}var l=y===a;if(h=h||l,l)var c=!0;let v=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:Xe.properties.at.anyOf[1],data:m};s===null?s=[b]:s.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:Xe.properties.at.anyOf[1],data:m};s===null?s=[b]:s.push(b),a++}let g=m.length;for(let b=0;b<g;b++){let $=m[b];if(typeof $!="number"){let E={instancePath:e+"/at/"+b,schemaPath:"#/properties/at/anyOf/1/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Xe.properties.at.anyOf[1].items.type,parentSchema:Xe.properties.at.anyOf[1].items,data:$};s===null?s=[E]:s.push(E),a++}}}else{let g={instancePath:e+"/at",schemaPath:"#/properties/at/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Xe.properties.at.anyOf[1].type,parentSchema:Xe.properties.at.anyOf[1],data:m};s===null?s=[g]:s.push(g),a++}var l=v===a;if(h=h||l,l&&c!==!0&&(c=!0),h)a=u,s!==null&&(u?s.length=u:s=null);else{let g={instancePath:e+"/at",schemaPath:"#/properties/at/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Xe.properties.at.anyOf,parentSchema:Xe.properties.at,data:m};s===null?s=[g]:s.push(g),a++}}if(t.on!==void 0){let m=t.on;if(typeof m=="string"){if(!Rt.test(m)){let u={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:ge,data:m};s===null?s=[u]:s.push(u),a++}}else{let u={instancePath:e+"/on",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ge.type,parentSchema:ge,data:m};s===null?s=[u]:s.push(u),a++}}if(t.kind!==void 0){let m=t.kind;if(typeof m!="string"){let u={instancePath:e+"/kind",schemaPath:"#/properties/kind/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Xe.properties.kind.type,parentSchema:Xe.properties.kind,data:m};s===null?s=[u]:s.push(u),a++}}if(t.dir!==void 0){let m=t.dir;if(!(m==="x"||m==="y")){let u={instancePath:e+"/dir",schemaPath:"#/properties/dir/enum",keyword:"enum",params:{allowedValues:Xe.properties.dir.enum},message:"must be equal to one of the allowed values",schema:Xe.properties.dir.enum,parentSchema:Xe.properties.dir,data:m};s===null?s=[u]:s.push(u),a++}}if(t.anchor!==void 0){let m=t.anchor;if(!(m==="start"||m==="middle"||m==="end")){let u={instancePath:e+"/anchor",schemaPath:"#/properties/anchor/enum",keyword:"enum",params:{allowedValues:Xe.properties.anchor.enum},message:"must be equal to one of the allowed values",schema:Xe.properties.anchor.enum,parentSchema:Xe.properties.anchor,data:m};s===null?s=[u]:s.push(u),a++}}if(t.dx!==void 0){let m=t.dx;if(typeof m!="number"){let u={instancePath:e+"/dx",schemaPath:"#/properties/dx/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Xe.properties.dx.type,parentSchema:Xe.properties.dx,data:m};s===null?s=[u]:s.push(u),a++}}if(t.dy!==void 0){let m=t.dy;if(typeof m!="number"){let u={instancePath:e+"/dy",schemaPath:"#/properties/dy/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Xe.properties.dy.type,parentSchema:Xe.properties.dy,data:m};s===null?s=[u]:s.push(u),a++}}if(t.appears!==void 0){let m=t.appears,u=a,h=!1,y=a;if(typeof m!="string"){let g={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:_e.anyOf[0].type,parentSchema:_e.anyOf[0],data:m};s===null?s=[g]:s.push(g),a++}var p=y===a;h=h||p;let v=a;if(!(typeof m=="number"&&!(m%1)&&!isNaN(m))){let g={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:_e.anyOf[1].type,parentSchema:_e.anyOf[1],data:m};s===null?s=[g]:s.push(g),a++}if(typeof m=="number"&&(m<1||isNaN(m))){let g={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:_e.anyOf[1],data:m};s===null?s=[g]:s.push(g),a++}var p=v===a;if(h=h||p,h)a=u,s!==null&&(u?s.length=u:s=null);else{let g={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:_e.anyOf,parentSchema:_e,data:m};s===null?s=[g]:s.push(g),a++}}if(t.disappears!==void 0){let m=t.disappears,u=a,h=!1,y=a;if(typeof m!="string"){let g={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:_e.anyOf[0].type,parentSchema:_e.anyOf[0],data:m};s===null?s=[g]:s.push(g),a++}var f=y===a;h=h||f;let v=a;if(!(typeof m=="number"&&!(m%1)&&!isNaN(m))){let g={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:_e.anyOf[1].type,parentSchema:_e.anyOf[1],data:m};s===null?s=[g]:s.push(g),a++}if(typeof m=="number"&&(m<1||isNaN(m))){let g={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:_e.anyOf[1],data:m};s===null?s=[g]:s.push(g),a++}var f=v===a;if(h=h||f,h)a=u,s!==null&&(u?s.length=u:s=null);else{let g={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:_e.anyOf,parentSchema:_e,data:m};s===null?s=[g]:s.push(g),a++}}}else{let m={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Xe.type,parentSchema:Xe,data:t};s===null?s=[m]:s.push(m),a++}return hr.errors=s,a===0}hr.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var ie={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}]}}},na={anyOf:[{$ref:"#/$defs/routeRef"},{type:"array",items:{$ref:"#/$defs/routeRef"}}]},Ct={anyOf:[{type:"string"},{type:"object",minProperties:1,maxProperties:1,additionalProperties:{type:"string"}}]};function yr(t,{instancePath:e="",parentData:n,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=yr.evaluated;d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0);let c=a,l=!1,p=a,f=a,m=!1,u=a;if(typeof t!="string"){let S={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ct.anyOf[0].type,parentSchema:Ct.anyOf[0],data:t};s===null?s=[S]:s.push(S),a++}var y=u===a;m=m||y;let h=a;if(t&&typeof t=="object"&&!Array.isArray(t)){if(Object.keys(t).length>1){let S={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf/1/maxProperties",keyword:"maxProperties",params:{limit:1},message:"must NOT have more than 1 properties",schema:1,parentSchema:Ct.anyOf[1],data:t};s===null?s=[S]:s.push(S),a++}if(Object.keys(t).length<1){let S={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf/1/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Ct.anyOf[1],data:t};s===null?s=[S]:s.push(S),a++}for(let S in t){let k=t[S];if(typeof k!="string"){let T={instancePath:e+"/"+S.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/routeRef/anyOf/1/additionalProperties/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ct.anyOf[1].additionalProperties.type,parentSchema:Ct.anyOf[1].additionalProperties,data:k};s===null?s=[T]:s.push(T),a++}}}else{let S={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf/1/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Ct.anyOf[1].type,parentSchema:Ct.anyOf[1],data:t};s===null?s=[S]:s.push(S),a++}var y=h===a;if(m=m||y,y)var v=!0;if(m)a=f,s!==null&&(f?s.length=f:s=null);else{let S={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Ct.anyOf,parentSchema:Ct,data:t};s===null?s=[S]:s.push(S),a++}var $=p===a;l=l||$;let g=a;if(Array.isArray(t)){let S=t.length;for(let k=0;k<S;k++){let T=t[k],z=a,A=!1,R=a;if(typeof T!="string"){let P={instancePath:e+"/"+k,schemaPath:"#/$defs/routeRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ct.anyOf[0].type,parentSchema:Ct.anyOf[0],data:T};s===null?s=[P]:s.push(P),a++}var b=R===a;A=A||b;let x=a;if(T&&typeof T=="object"&&!Array.isArray(T)){if(Object.keys(T).length>1){let P={instancePath:e+"/"+k,schemaPath:"#/$defs/routeRef/anyOf/1/maxProperties",keyword:"maxProperties",params:{limit:1},message:"must NOT have more than 1 properties",schema:1,parentSchema:Ct.anyOf[1],data:T};s===null?s=[P]:s.push(P),a++}if(Object.keys(T).length<1){let P={instancePath:e+"/"+k,schemaPath:"#/$defs/routeRef/anyOf/1/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Ct.anyOf[1],data:T};s===null?s=[P]:s.push(P),a++}for(let P in T){let w=T[P];if(typeof w!="string"){let I={instancePath:e+"/"+k+"/"+P.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/routeRef/anyOf/1/additionalProperties/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ct.anyOf[1].additionalProperties.type,parentSchema:Ct.anyOf[1].additionalProperties,data:w};s===null?s=[I]:s.push(I),a++}}}else{let P={instancePath:e+"/"+k,schemaPath:"#/$defs/routeRef/anyOf/1/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Ct.anyOf[1].type,parentSchema:Ct.anyOf[1],data:T};s===null?s=[P]:s.push(P),a++}var b=x===a;if(A=A||b,A)a=z,s!==null&&(z?s.length=z:s=null);else{let P={instancePath:e+"/"+k,schemaPath:"#/$defs/routeRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Ct.anyOf,parentSchema:Ct,data:T};s===null?s=[P]:s.push(P),a++}}}else{let S={instancePath:e,schemaPath:"#/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array",schema:na.anyOf[1].type,parentSchema:na.anyOf[1],data:t};s===null?s=[S]:s.push(S),a++}var $=g===a;if(l=l||$,$)var E=!0;if(l)a=c,s!==null&&(c?s.length=c:s=null);else{let S={instancePath:e,schemaPath:"#/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:na.anyOf,parentSchema:na,data:t};s===null?s=[S]:s.push(S),a++}return yr.errors=s,d.props=v,d.items=E,a===0}yr.evaluated={dynamicProps:!0,dynamicItems:!0};function gr(t,{instancePath:e="",parentData:n,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=gr.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(t.heading===void 0){let f={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"heading"},message:"must have required property 'heading'",schema:ie.required,parentSchema:ie,data:t};s===null?s=[f]:s.push(f),a++}for(let f in t)if(!ci.call(ie.properties,f)){let m={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:f},message:"must NOT have additional properties",schema:!1,parentSchema:ie,data:t};s===null?s=[m]:s.push(m),a++}if(t.id!==void 0){let f=t.id;if(typeof f=="string"){if(!Rt.test(f)){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:ge,data:f};s===null?s=[m]:s.push(m),a++}}else{let m={instancePath:e+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ge.type,parentSchema:ge,data:f};s===null?s=[m]:s.push(m),a++}}if(t.number!==void 0){let f=t.number;if(!(typeof f=="number"&&!(f%1)&&!isNaN(f))){let m={instancePath:e+"/number",schemaPath:"#/properties/number/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:ie.properties.number.type,parentSchema:ie.properties.number,data:f};s===null?s=[m]:s.push(m),a++}if(typeof f=="number"&&(f<1||isNaN(f))){let m={instancePath:e+"/number",schemaPath:"#/properties/number/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:ie.properties.number,data:f};s===null?s=[m]:s.push(m),a++}}if(t.kind!==void 0){let f=t.kind;if(typeof f!="string"){let m={instancePath:e+"/kind",schemaPath:"#/properties/kind/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ie.properties.kind.type,parentSchema:ie.properties.kind,data:f};s===null?s=[m]:s.push(m),a++}}if(t.heading!==void 0){let f=t.heading;if(typeof f!="string"){let m={instancePath:e+"/heading",schemaPath:"#/properties/heading/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ie.properties.heading.type,parentSchema:ie.properties.heading,data:f};s===null?s=[m]:s.push(m),a++}}if(t.caption!==void 0){let f=t.caption;if(typeof f!="string"){let m={instancePath:e+"/caption",schemaPath:"#/properties/caption/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ie.properties.caption.type,parentSchema:ie.properties.caption,data:f};s===null?s=[m]:s.push(m),a++}}if(t.command!==void 0){let f=t.command;if(typeof f!="string"){let m={instancePath:e+"/command",schemaPath:"#/properties/command/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ie.properties.command.type,parentSchema:ie.properties.command,data:f};s===null?s=[m]:s.push(m),a++}}if(t.animate!==void 0){let f=t.animate;if(Array.isArray(f)){let m=f.length;for(let u=0;u<m;u++)yr(f[u],{instancePath:e+"/animate/"+u,parentData:f,parentDataProperty:u,rootData:i,dynamicAnchors:o})||(s=s===null?yr.errors:s.concat(yr.errors),a=s.length)}else{let m={instancePath:e+"/animate",schemaPath:"#/properties/animate/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ie.properties.animate.type,parentSchema:ie.properties.animate,data:f};s===null?s=[m]:s.push(m),a++}}if(t.pulse!==void 0){let f=t.pulse;if(Array.isArray(f)){let m=f.length;for(let u=0;u<m;u++){let h=f[u];if(typeof h=="string"){if(!Rt.test(h)){let y={instancePath:e+"/pulse/"+u,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:ge,data:h};s===null?s=[y]:s.push(y),a++}}else{let y={instancePath:e+"/pulse/"+u,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ge.type,parentSchema:ge,data:h};s===null?s=[y]:s.push(y),a++}}}else{let m={instancePath:e+"/pulse",schemaPath:"#/properties/pulse/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ie.properties.pulse.type,parentSchema:ie.properties.pulse,data:f};s===null?s=[m]:s.push(m),a++}}if(t.highlight!==void 0){let f=t.highlight;if(Array.isArray(f)){let m=f.length;for(let u=0;u<m;u++){let h=f[u];if(typeof h=="string"){if(!Rt.test(h)){let y={instancePath:e+"/highlight/"+u,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:ge,data:h};s===null?s=[y]:s.push(y),a++}}else{let y={instancePath:e+"/highlight/"+u,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ge.type,parentSchema:ge,data:h};s===null?s=[y]:s.push(y),a++}}}else{let m={instancePath:e+"/highlight",schemaPath:"#/properties/highlight/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ie.properties.highlight.type,parentSchema:ie.properties.highlight,data:f};s===null?s=[m]:s.push(m),a++}}if(t.focus!==void 0){let f=t.focus;if(Array.isArray(f)){let m=f.length;for(let u=0;u<m;u++){let h=f[u];if(typeof h=="string"){if(!Rt.test(h)){let y={instancePath:e+"/focus/"+u,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:ge,data:h};s===null?s=[y]:s.push(y),a++}}else{let y={instancePath:e+"/focus/"+u,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ge.type,parentSchema:ge,data:h};s===null?s=[y]:s.push(y),a++}}}else{let m={instancePath:e+"/focus",schemaPath:"#/properties/focus/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ie.properties.focus.type,parentSchema:ie.properties.focus,data:f};s===null?s=[m]:s.push(m),a++}}if(t.show!==void 0){let f=t.show;if(Array.isArray(f)){let m=f.length;for(let u=0;u<m;u++){let h=f[u];if(typeof h=="string"){if(!Rt.test(h)){let y={instancePath:e+"/show/"+u,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:ge,data:h};s===null?s=[y]:s.push(y),a++}}else{let y={instancePath:e+"/show/"+u,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ge.type,parentSchema:ge,data:h};s===null?s=[y]:s.push(y),a++}}}else{let m={instancePath:e+"/show",schemaPath:"#/properties/show/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ie.properties.show.type,parentSchema:ie.properties.show,data:f};s===null?s=[m]:s.push(m),a++}}if(t.hide!==void 0){let f=t.hide;if(Array.isArray(f)){let m=f.length;for(let u=0;u<m;u++){let h=f[u];if(typeof h=="string"){if(!Rt.test(h)){let y={instancePath:e+"/hide/"+u,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:ge,data:h};s===null?s=[y]:s.push(y),a++}}else{let y={instancePath:e+"/hide/"+u,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ge.type,parentSchema:ge,data:h};s===null?s=[y]:s.push(y),a++}}}else{let m={instancePath:e+"/hide",schemaPath:"#/properties/hide/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ie.properties.hide.type,parentSchema:ie.properties.hide,data:f};s===null?s=[m]:s.push(m),a++}}if(t.say!==void 0){let f=t.say;if(Array.isArray(f)){let m=f.length;for(let u=0;u<m;u++){let h=f[u];if(h&&typeof h=="object"&&!Array.isArray(h)){if(h.at===void 0){let y={instancePath:e+"/say/"+u,schemaPath:"#/properties/say/items/required",keyword:"required",params:{missingProperty:"at"},message:"must have required property 'at'",schema:ie.properties.say.items.required,parentSchema:ie.properties.say.items,data:h};s===null?s=[y]:s.push(y),a++}if(h.text===void 0){let y={instancePath:e+"/say/"+u,schemaPath:"#/properties/say/items/required",keyword:"required",params:{missingProperty:"text"},message:"must have required property 'text'",schema:ie.properties.say.items.required,parentSchema:ie.properties.say.items,data:h};s===null?s=[y]:s.push(y),a++}for(let y in h)if(!(y==="at"||y==="text"||y==="kind"||y==="dx"||y==="dy"||y==="anchor")){let v={instancePath:e+"/say/"+u,schemaPath:"#/properties/say/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:y},message:"must NOT have additional properties",schema:!1,parentSchema:ie.properties.say.items,data:h};s===null?s=[v]:s.push(v),a++}if(h.at!==void 0){let y=h.at,v=a,g=!1,b=a;if(typeof y=="string"){if(!Rt.test(y)){let E={instancePath:e+"/say/"+u+"/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:ge,data:y};s===null?s=[E]:s.push(E),a++}}else{let E={instancePath:e+"/say/"+u+"/at",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ge.type,parentSchema:ge,data:y};s===null?s=[E]:s.push(E),a++}var c=b===a;g=g||c;let $=a;if(Array.isArray(y)){if(y.length>3){let S={instancePath:e+"/say/"+u+"/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:ie.properties.say.items.properties.at.anyOf[1],data:y};s===null?s=[S]:s.push(S),a++}if(y.length<2){let S={instancePath:e+"/say/"+u+"/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:ie.properties.say.items.properties.at.anyOf[1],data:y};s===null?s=[S]:s.push(S),a++}let E=y.length;for(let S=0;S<E;S++){let k=y[S];if(typeof k!="number"){let T={instancePath:e+"/say/"+u+"/at/"+S,schemaPath:"#/properties/say/items/properties/at/anyOf/1/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:ie.properties.say.items.properties.at.anyOf[1].items.type,parentSchema:ie.properties.say.items.properties.at.anyOf[1].items,data:k};s===null?s=[T]:s.push(T),a++}}}else{let E={instancePath:e+"/say/"+u+"/at",schemaPath:"#/properties/say/items/properties/at/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ie.properties.say.items.properties.at.anyOf[1].type,parentSchema:ie.properties.say.items.properties.at.anyOf[1],data:y};s===null?s=[E]:s.push(E),a++}var c=$===a;if(g=g||c,g)a=v,s!==null&&(v?s.length=v:s=null);else{let E={instancePath:e+"/say/"+u+"/at",schemaPath:"#/properties/say/items/properties/at/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:ie.properties.say.items.properties.at.anyOf,parentSchema:ie.properties.say.items.properties.at,data:y};s===null?s=[E]:s.push(E),a++}}if(h.text!==void 0){let y=h.text;if(typeof y!="string"){let v={instancePath:e+"/say/"+u+"/text",schemaPath:"#/properties/say/items/properties/text/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ie.properties.say.items.properties.text.type,parentSchema:ie.properties.say.items.properties.text,data:y};s===null?s=[v]:s.push(v),a++}}if(h.kind!==void 0){let y=h.kind;if(typeof y!="string"){let v={instancePath:e+"/say/"+u+"/kind",schemaPath:"#/properties/say/items/properties/kind/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ie.properties.say.items.properties.kind.type,parentSchema:ie.properties.say.items.properties.kind,data:y};s===null?s=[v]:s.push(v),a++}}if(h.dx!==void 0){let y=h.dx;if(typeof y!="number"){let v={instancePath:e+"/say/"+u+"/dx",schemaPath:"#/properties/say/items/properties/dx/type",keyword:"type",params:{type:"number"},message:"must be number",schema:ie.properties.say.items.properties.dx.type,parentSchema:ie.properties.say.items.properties.dx,data:y};s===null?s=[v]:s.push(v),a++}}if(h.dy!==void 0){let y=h.dy;if(typeof y!="number"){let v={instancePath:e+"/say/"+u+"/dy",schemaPath:"#/properties/say/items/properties/dy/type",keyword:"type",params:{type:"number"},message:"must be number",schema:ie.properties.say.items.properties.dy.type,parentSchema:ie.properties.say.items.properties.dy,data:y};s===null?s=[v]:s.push(v),a++}}if(h.anchor!==void 0){let y=h.anchor;if(!(y==="start"||y==="middle"||y==="end")){let v={instancePath:e+"/say/"+u+"/anchor",schemaPath:"#/properties/say/items/properties/anchor/enum",keyword:"enum",params:{allowedValues:ie.properties.say.items.properties.anchor.enum},message:"must be equal to one of the allowed values",schema:ie.properties.say.items.properties.anchor.enum,parentSchema:ie.properties.say.items.properties.anchor,data:y};s===null?s=[v]:s.push(v),a++}}}else{let y={instancePath:e+"/say/"+u,schemaPath:"#/properties/say/items/type",keyword:"type",params:{type:"object"},message:"must be object",schema:ie.properties.say.items.type,parentSchema:ie.properties.say.items,data:h};s===null?s=[y]:s.push(y),a++}}}else{let m={instancePath:e+"/say",schemaPath:"#/properties/say/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ie.properties.say.type,parentSchema:ie.properties.say,data:f};s===null?s=[m]:s.push(m),a++}}if(t.mark!==void 0){let f=t.mark;if(Array.isArray(f)){let m=f.length;for(let u=0;u<m;u++){let h=f[u];if(h&&typeof h=="object"&&!Array.isArray(h)){for(let y in h)if(!(y==="on"||y==="at")){let v={instancePath:e+"/mark/"+u,schemaPath:"#/properties/mark/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:y},message:"must NOT have additional properties",schema:!1,parentSchema:ie.properties.mark.items,data:h};s===null?s=[v]:s.push(v),a++}if(h.on!==void 0){let y=h.on;if(typeof y=="string"){if(!Rt.test(y)){let v={instancePath:e+"/mark/"+u+"/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:ge,data:y};s===null?s=[v]:s.push(v),a++}}else{let v={instancePath:e+"/mark/"+u+"/on",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ge.type,parentSchema:ge,data:y};s===null?s=[v]:s.push(v),a++}}if(h.at!==void 0){let y=h.at;if(Array.isArray(y)){if(y.length>3){let g={instancePath:e+"/mark/"+u+"/at",schemaPath:"#/properties/mark/items/properties/at/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:ie.properties.mark.items.properties.at,data:y};s===null?s=[g]:s.push(g),a++}if(y.length<2){let g={instancePath:e+"/mark/"+u+"/at",schemaPath:"#/properties/mark/items/properties/at/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:ie.properties.mark.items.properties.at,data:y};s===null?s=[g]:s.push(g),a++}let v=y.length;for(let g=0;g<v;g++){let b=y[g];if(typeof b!="number"){let $={instancePath:e+"/mark/"+u+"/at/"+g,schemaPath:"#/properties/mark/items/properties/at/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:ie.properties.mark.items.properties.at.items.type,parentSchema:ie.properties.mark.items.properties.at.items,data:b};s===null?s=[$]:s.push($),a++}}}else{let v={instancePath:e+"/mark/"+u+"/at",schemaPath:"#/properties/mark/items/properties/at/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ie.properties.mark.items.properties.at.type,parentSchema:ie.properties.mark.items.properties.at,data:y};s===null?s=[v]:s.push(v),a++}}}else{let y={instancePath:e+"/mark/"+u,schemaPath:"#/properties/mark/items/type",keyword:"type",params:{type:"object"},message:"must be object",schema:ie.properties.mark.items.type,parentSchema:ie.properties.mark.items,data:h};s===null?s=[y]:s.push(y),a++}}}else{let m={instancePath:e+"/mark",schemaPath:"#/properties/mark/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ie.properties.mark.type,parentSchema:ie.properties.mark,data:f};s===null?s=[m]:s.push(m),a++}}if(t.badge!==void 0){let f=t.badge,m=a,u=!1,h=a;if(typeof f!="boolean"){let g={instancePath:e+"/badge",schemaPath:"#/properties/badge/anyOf/0/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:ie.properties.badge.anyOf[0].type,parentSchema:ie.properties.badge.anyOf[0],data:f};s===null?s=[g]:s.push(g),a++}var l=h===a;u=u||l;let y=a;if(typeof f=="string"){if(!Rt.test(f)){let g={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:ge,data:f};s===null?s=[g]:s.push(g),a++}}else{let g={instancePath:e+"/badge",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ge.type,parentSchema:ge,data:f};s===null?s=[g]:s.push(g),a++}var l=y===a;u=u||l;let v=a;if(Array.isArray(f)){if(f.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:ie.properties.badge.anyOf[2],data:f};s===null?s=[b]:s.push(b),a++}if(f.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:ie.properties.badge.anyOf[2],data:f};s===null?s=[b]:s.push(b),a++}let g=f.length;for(let b=0;b<g;b++){let $=f[b];if(typeof $!="number"){let E={instancePath:e+"/badge/"+b,schemaPath:"#/properties/badge/anyOf/2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:ie.properties.badge.anyOf[2].items.type,parentSchema:ie.properties.badge.anyOf[2].items,data:$};s===null?s=[E]:s.push(E),a++}}}else{let g={instancePath:e+"/badge",schemaPath:"#/properties/badge/anyOf/2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ie.properties.badge.anyOf[2].type,parentSchema:ie.properties.badge.anyOf[2],data:f};s===null?s=[g]:s.push(g),a++}var l=v===a;if(u=u||l,u)a=m,s!==null&&(m?s.length=m:s=null);else{let g={instancePath:e+"/badge",schemaPath:"#/properties/badge/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:ie.properties.badge.anyOf,parentSchema:ie.properties.badge,data:f};s===null?s=[g]:s.push(g),a++}}if(t.duration!==void 0){let f=t.duration,m=a,u=!1,h=a;if(f!=="auto"){let v={instancePath:e+"/duration",schemaPath:"#/properties/duration/anyOf/0/const",keyword:"const",params:{allowedValue:"auto"},message:"must be equal to constant",schema:"auto",parentSchema:ie.properties.duration.anyOf[0],data:f};s===null?s=[v]:s.push(v),a++}var p=h===a;u=u||p;let y=a;if(!(typeof f=="number"&&!(f%1)&&!isNaN(f))){let v={instancePath:e+"/duration",schemaPath:"#/properties/duration/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:ie.properties.duration.anyOf[1].type,parentSchema:ie.properties.duration.anyOf[1],data:f};s===null?s=[v]:s.push(v),a++}if(typeof f=="number"&&(f<500||isNaN(f))){let v={instancePath:e+"/duration",schemaPath:"#/properties/duration/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:500},message:"must be >= 500",schema:500,parentSchema:ie.properties.duration.anyOf[1],data:f};s===null?s=[v]:s.push(v),a++}var p=y===a;if(u=u||p,u)a=m,s!==null&&(m?s.length=m:s=null);else{let v={instancePath:e+"/duration",schemaPath:"#/properties/duration/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:ie.properties.duration.anyOf,parentSchema:ie.properties.duration,data:f};s===null?s=[v]:s.push(v),a++}}}else{let f={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:ie.type,parentSchema:ie,data:t};s===null?s=[f]:s.push(f),a++}return gr.errors=s,a===0}gr.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function br(t,{instancePath:e="",parentData:n,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=br.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.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:$e.required,parentSchema:$e,data:t};s===null?s=[l]:s.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:$e.required,parentSchema:$e,data:t};s===null?s=[l]:s.push(l),a++}for(let l in t)if(!ci.call($e.properties,l)){let p={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:l},message:"must NOT have additional properties",schema:!1,parentSchema:$e,data:t};s===null?s=[p]:s.push(p),a++}if(t.id!==void 0){let l=t.id;if(typeof l=="string"){if(!Rt.test(l)){let p={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:ge,data:l};s===null?s=[p]:s.push(p),a++}}else{let p={instancePath:e+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ge.type,parentSchema:ge,data:l};s===null?s=[p]:s.push(p),a++}}if(t.title!==void 0){let l=t.title;if(typeof l!="string"){let p={instancePath:e+"/title",schemaPath:"#/properties/title/type",keyword:"type",params:{type:"string"},message:"must be string",schema:$e.properties.title.type,parentSchema:$e.properties.title,data:l};s===null?s=[p]:s.push(p),a++}}if(t.caption!==void 0){let l=t.caption;if(typeof l!="string"){let p={instancePath:e+"/caption",schemaPath:"#/properties/caption/type",keyword:"type",params:{type:"string"},message:"must be string",schema:$e.properties.caption.type,parentSchema:$e.properties.caption,data:l};s===null?s=[p]:s.push(p),a++}}if(t.aria!==void 0){let l=t.aria;if(typeof l!="string"){let p={instancePath:e+"/aria",schemaPath:"#/properties/aria/type",keyword:"type",params:{type:"string"},message:"must be string",schema:$e.properties.aria.type,parentSchema:$e.properties.aria,data:l};s===null?s=[p]:s.push(p),a++}}if(t.gap!==void 0){let l=t.gap;if(typeof l=="number"){if(l<=0||isNaN(l)){let p={instancePath:e+"/gap",schemaPath:"#/properties/gap/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:$e.properties.gap,data:l};s===null?s=[p]:s.push(p),a++}}else{let p={instancePath:e+"/gap",schemaPath:"#/properties/gap/type",keyword:"type",params:{type:"number"},message:"must be number",schema:$e.properties.gap.type,parentSchema:$e.properties.gap,data:l};s===null?s=[p]:s.push(p),a++}}if(t.flow!==void 0){let l=t.flow;if(!(l==="row"||l==="column")){let p={instancePath:e+"/flow",schemaPath:"#/properties/flow/enum",keyword:"enum",params:{allowedValues:$e.properties.flow.enum},message:"must be equal to one of the allowed values",schema:$e.properties.flow.enum,parentSchema:$e.properties.flow,data:l};s===null?s=[p]:s.push(p),a++}}if(t.regions!==void 0){let l=t.regions;if(Array.isArray(l)){let p=l.length;for(let f=0;f<p;f++)Fn(l[f],{instancePath:e+"/regions/"+f,parentData:l,parentDataProperty:f,rootData:i,dynamicAnchors:o})||(s=s===null?Fn.errors:s.concat(Fn.errors),a=s.length)}else{let p={instancePath:e+"/regions",schemaPath:"#/properties/regions/type",keyword:"type",params:{type:"array"},message:"must be array",schema:$e.properties.regions.type,parentSchema:$e.properties.regions,data:l};s===null?s=[p]:s.push(p),a++}}if(t.nodes!==void 0){let l=t.nodes;if(Array.isArray(l)){let p=l.length;for(let f=0;f<p;f++)Hs(l[f],{instancePath:e+"/nodes/"+f,parentData:l,parentDataProperty:f,rootData:i,dynamicAnchors:o})||(s=s===null?Hs.errors:s.concat(Hs.errors),a=s.length)}else{let p={instancePath:e+"/nodes",schemaPath:"#/properties/nodes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:$e.properties.nodes.type,parentSchema:$e.properties.nodes,data:l};s===null?s=[p]:s.push(p),a++}}if(t.routes!==void 0){let l=t.routes;if(Array.isArray(l)){let p=l.length;for(let f=0;f<p;f++)ur(l[f],{instancePath:e+"/routes/"+f,parentData:l,parentDataProperty:f,rootData:i,dynamicAnchors:o})||(s=s===null?ur.errors:s.concat(ur.errors),a=s.length)}else{let p={instancePath:e+"/routes",schemaPath:"#/properties/routes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:$e.properties.routes.type,parentSchema:$e.properties.routes,data:l};s===null?s=[p]:s.push(p),a++}}if(t.notes!==void 0){let l=t.notes;if(Array.isArray(l)){let p=l.length;for(let f=0;f<p;f++)hr(l[f],{instancePath:e+"/notes/"+f,parentData:l,parentDataProperty:f,rootData:i,dynamicAnchors:o})||(s=s===null?hr.errors:s.concat(hr.errors),a=s.length)}else{let p={instancePath:e+"/notes",schemaPath:"#/properties/notes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:$e.properties.notes.type,parentSchema:$e.properties.notes,data:l};s===null?s=[p]:s.push(p),a++}}if(t.steps!==void 0){let l=t.steps;if(Array.isArray(l)){let p=l.length;for(let f=0;f<p;f++)gr(l[f],{instancePath:e+"/steps/"+f,parentData:l,parentDataProperty:f,rootData:i,dynamicAnchors:o})||(s=s===null?gr.errors:s.concat(gr.errors),a=s.length)}else{let p={instancePath:e+"/steps",schemaPath:"#/properties/steps/type",keyword:"type",params:{type:"array"},message:"must be array",schema:$e.properties.steps.type,parentSchema:$e.properties.steps,data:l};s===null?s=[p]:s.push(p),a++}}if(t.legend!==void 0){let l=t.legend,p=a,f=!1,m=a;if(l!=="auto"){let y={instancePath:e+"/legend",schemaPath:"#/properties/legend/anyOf/0/enum",keyword:"enum",params:{allowedValues:$e.properties.legend.anyOf[0].enum},message:"must be equal to one of the allowed values",schema:$e.properties.legend.anyOf[0].enum,parentSchema:$e.properties.legend.anyOf[0],data:l};s===null?s=[y]:s.push(y),a++}var c=m===a;f=f||c;let u=a;if(l!==!1){let y={instancePath:e+"/legend",schemaPath:"#/properties/legend/anyOf/1/const",keyword:"const",params:{allowedValue:!1},message:"must be equal to constant",schema:!1,parentSchema:$e.properties.legend.anyOf[1],data:l};s===null?s=[y]:s.push(y),a++}var c=u===a;f=f||c;let h=a;if(Array.isArray(l)){let y=l.length;for(let v=0;v<y;v++){let g=l[v];if(typeof g!="string"){let b={instancePath:e+"/legend/"+v,schemaPath:"#/properties/legend/anyOf/2/items/type",keyword:"type",params:{type:"string"},message:"must be string",schema:$e.properties.legend.anyOf[2].items.type,parentSchema:$e.properties.legend.anyOf[2].items,data:g};s===null?s=[b]:s.push(b),a++}}}else{let y={instancePath:e+"/legend",schemaPath:"#/properties/legend/anyOf/2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:$e.properties.legend.anyOf[2].type,parentSchema:$e.properties.legend.anyOf[2],data:l};s===null?s=[y]:s.push(y),a++}var c=h===a;if(f=f||c,f)a=p,s!==null&&(p?s.length=p:s=null);else{let y={instancePath:e+"/legend",schemaPath:"#/properties/legend/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:$e.properties.legend.anyOf,parentSchema:$e.properties.legend,data:l};s===null?s=[y]:s.push(y),a++}}if(t.badges!==void 0){let l=t.badges;if(typeof l!="boolean"){let p={instancePath:e+"/badges",schemaPath:"#/properties/badges/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:$e.properties.badges.type,parentSchema:$e.properties.badges,data:l};s===null?s=[p]:s.push(p),a++}}if(t.grid!==void 0){let l=t.grid;if(l&&typeof l=="object"&&!Array.isArray(l)){for(let p in l)if(!(p==="snap"||p==="show"||p==="step")){let f={instancePath:e+"/grid",schemaPath:"#/$defs/grid/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:p},message:"must NOT have additional properties",schema:!1,parentSchema:Mt,data:l};s===null?s=[f]:s.push(f),a++}if(l.snap!==void 0){let p=l.snap;if(typeof p=="number"){if(p<=0||isNaN(p)){let f={instancePath:e+"/grid/snap",schemaPath:"#/$defs/grid/properties/snap/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Mt.properties.snap,data:p};s===null?s=[f]:s.push(f),a++}}else{let f={instancePath:e+"/grid/snap",schemaPath:"#/$defs/grid/properties/snap/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Mt.properties.snap.type,parentSchema:Mt.properties.snap,data:p};s===null?s=[f]:s.push(f),a++}}if(l.show!==void 0){let p=l.show;if(typeof p!="boolean"){let f={instancePath:e+"/grid/show",schemaPath:"#/$defs/grid/properties/show/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Mt.properties.show.type,parentSchema:Mt.properties.show,data:p};s===null?s=[f]:s.push(f),a++}}if(l.step!==void 0){let p=l.step;if(typeof p=="number"){if(p<=0||isNaN(p)){let f={instancePath:e+"/grid/step",schemaPath:"#/$defs/grid/properties/step/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Mt.properties.step,data:p};s===null?s=[f]:s.push(f),a++}}else{let f={instancePath:e+"/grid/step",schemaPath:"#/$defs/grid/properties/step/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Mt.properties.step.type,parentSchema:Mt.properties.step,data:p};s===null?s=[f]:s.push(f),a++}}}else{let p={instancePath:e+"/grid",schemaPath:"#/$defs/grid/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Mt.type,parentSchema:Mt,data:l};s===null?s=[p]:s.push(p),a++}}if(t.assemble!==void 0){let l=t.assemble;if(typeof l!="boolean"){let p={instancePath:e+"/assemble",schemaPath:"#/properties/assemble/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:$e.properties.assemble.type,parentSchema:$e.properties.assemble,data:l};s===null?s=[p]:s.push(p),a++}}if(t.loop!==void 0){let l=t.loop;if(typeof l!="boolean"){let p={instancePath:e+"/loop",schemaPath:"#/properties/loop/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:$e.properties.loop.type,parentSchema:$e.properties.loop,data:l};s===null?s=[p]:s.push(p),a++}}if(t.dim!==void 0){let l=t.dim;if(!(l==="flows"||l==="all")){let p={instancePath:e+"/dim",schemaPath:"#/properties/dim/enum",keyword:"enum",params:{allowedValues:$e.properties.dim.enum},message:"must be equal to one of the allowed values",schema:$e.properties.dim.enum,parentSchema:$e.properties.dim,data:l};s===null?s=[p]:s.push(p),a++}}if(t.after!==void 0){let l=t.after;if(typeof l!="string"){let p={instancePath:e+"/after",schemaPath:"#/properties/after/type",keyword:"type",params:{type:"string"},message:"must be string",schema:$e.properties.after.type,parentSchema:$e.properties.after,data:l};s===null?s=[p]:s.push(p),a++}}}else{let l={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:$e.type,parentSchema:$e,data:t};s===null?s=[l]:s.push(l),a++}return br.errors=s,a===0}br.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function ra(t,{instancePath:e="",parentData:n,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=ra.evaluated;if(d.dynamicProps&&(d.props=void 0),d.dynamicItems&&(d.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(t.isodiag===void 0){let c={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"isodiag"},message:"must have required property 'isodiag'",schema:Je.required,parentSchema:Je,data:t};s===null?s=[c]:s.push(c),a++}if(t.scenes===void 0){let c={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"scenes"},message:"must have required property 'scenes'",schema:Je.required,parentSchema:Je,data:t};s===null?s=[c]:s.push(c),a++}for(let c in t)if(!ci.call(Je.properties,c)){let l={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:c},message:"must NOT have additional properties",schema:!1,parentSchema:Je,data:t};s===null?s=[l]:s.push(l),a++}if(t.isodiag!==void 0){let c=t.isodiag;if(c!==1){let l={instancePath:e+"/isodiag",schemaPath:"#/properties/isodiag/const",keyword:"const",params:{allowedValue:1},message:"must be equal to constant",schema:1,parentSchema:Je.properties.isodiag,data:c};s===null?s=[l]:s.push(l),a++}}if(t.title!==void 0){let c=t.title;if(typeof c!="string"){let l={instancePath:e+"/title",schemaPath:"#/properties/title/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Je.properties.title.type,parentSchema:Je.properties.title,data:c};s===null?s=[l]:s.push(l),a++}}if(t.lede!==void 0){let c=t.lede;if(typeof c!="string"){let l={instancePath:e+"/lede",schemaPath:"#/properties/lede/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Je.properties.lede.type,parentSchema:Je.properties.lede,data:c};s===null?s=[l]:s.push(l),a++}}if(t.pills!==void 0){let c=t.pills;if(Array.isArray(c)){let l=c.length;for(let p=0;p<l;p++){let f=c[p];if(typeof f!="string"){let m={instancePath:e+"/pills/"+p,schemaPath:"#/properties/pills/items/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Je.properties.pills.items.type,parentSchema:Je.properties.pills.items,data:f};s===null?s=[m]:s.push(m),a++}}}else{let l={instancePath:e+"/pills",schemaPath:"#/properties/pills/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Je.properties.pills.type,parentSchema:Je.properties.pills,data:c};s===null?s=[l]:s.push(l),a++}}if(t.theme!==void 0){let c=t.theme;if(typeof c!="string"){let l={instancePath:e+"/theme",schemaPath:"#/properties/theme/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Je.properties.theme.type,parentSchema:Je.properties.theme,data:c};s===null?s=[l]:s.push(l),a++}}if(t.roles!==void 0){let c=t.roles;if(c&&typeof c=="object"&&!Array.isArray(c))for(let l in c){let p=c[l];if(p&&typeof p=="object"&&!Array.isArray(p)){if(p.h===void 0){let f={instancePath:e+"/roles/"+l.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/role/required",keyword:"required",params:{missingProperty:"h"},message:"must have required property 'h'",schema:Nt.required,parentSchema:Nt,data:p};s===null?s=[f]:s.push(f),a++}if(p.s===void 0){let f={instancePath:e+"/roles/"+l.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/role/required",keyword:"required",params:{missingProperty:"s"},message:"must have required property 's'",schema:Nt.required,parentSchema:Nt,data:p};s===null?s=[f]:s.push(f),a++}for(let f in p)if(!(f==="h"||f==="s"||f==="top"||f==="tint")){let m={instancePath:e+"/roles/"+l.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/role/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:f},message:"must NOT have additional properties",schema:!1,parentSchema:Nt,data:p};s===null?s=[m]:s.push(m),a++}if(p.h!==void 0){let f=p.h;if(typeof f=="number"){if(f>360||isNaN(f)){let m={instancePath:e+"/roles/"+l.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:Nt.properties.h,data:f};s===null?s=[m]:s.push(m),a++}if(f<0||isNaN(f)){let m={instancePath:e+"/roles/"+l.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:Nt.properties.h,data:f};s===null?s=[m]:s.push(m),a++}}else{let m={instancePath:e+"/roles/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/h",schemaPath:"#/$defs/role/properties/h/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Nt.properties.h.type,parentSchema:Nt.properties.h,data:f};s===null?s=[m]:s.push(m),a++}}if(p.s!==void 0){let f=p.s;if(typeof f=="number"){if(f>100||isNaN(f)){let m={instancePath:e+"/roles/"+l.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:Nt.properties.s,data:f};s===null?s=[m]:s.push(m),a++}if(f<0||isNaN(f)){let m={instancePath:e+"/roles/"+l.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:Nt.properties.s,data:f};s===null?s=[m]:s.push(m),a++}}else{let m={instancePath:e+"/roles/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/s",schemaPath:"#/$defs/role/properties/s/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Nt.properties.s.type,parentSchema:Nt.properties.s,data:f};s===null?s=[m]:s.push(m),a++}}if(p.top!==void 0){let f=p.top;if(typeof f!="string"){let m={instancePath:e+"/roles/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/top",schemaPath:"#/$defs/role/properties/top/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Nt.properties.top.type,parentSchema:Nt.properties.top,data:f};s===null?s=[m]:s.push(m),a++}}if(p.tint!==void 0){let f=p.tint;if(typeof f=="number"){if(f>100||isNaN(f)){let m={instancePath:e+"/roles/"+l.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:Nt.properties.tint,data:f};s===null?s=[m]:s.push(m),a++}if(f<0||isNaN(f)){let m={instancePath:e+"/roles/"+l.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:Nt.properties.tint,data:f};s===null?s=[m]:s.push(m),a++}}else{let m={instancePath:e+"/roles/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/tint",schemaPath:"#/$defs/role/properties/tint/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Nt.properties.tint.type,parentSchema:Nt.properties.tint,data:f};s===null?s=[m]:s.push(m),a++}}}else{let f={instancePath:e+"/roles/"+l.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/role/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Nt.type,parentSchema:Nt,data:p};s===null?s=[f]:s.push(f),a++}}else{let l={instancePath:e+"/roles",schemaPath:"#/properties/roles/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Je.properties.roles.type,parentSchema:Je.properties.roles,data:c};s===null?s=[l]:s.push(l),a++}}if(t.kinds!==void 0){let c=t.kinds;if(c&&typeof c=="object"&&!Array.isArray(c))for(let l in c){let p=c[l];if(p&&typeof p=="object"&&!Array.isArray(p)){for(let f in p)if(!(f==="legend"||f==="like"||f==="color"||f==="dash")){let m={instancePath:e+"/kinds/"+l.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/kindDef/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:f},message:"must NOT have additional properties",schema:!1,parentSchema:xs,data:p};s===null?s=[m]:s.push(m),a++}if(p.legend!==void 0){let f=p.legend;if(typeof f!="string"){let m={instancePath:e+"/kinds/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/legend",schemaPath:"#/$defs/kindDef/properties/legend/type",keyword:"type",params:{type:"string"},message:"must be string",schema:xs.properties.legend.type,parentSchema:xs.properties.legend,data:f};s===null?s=[m]:s.push(m),a++}}if(p.like!==void 0){let f=p.like;if(typeof f!="string"){let m={instancePath:e+"/kinds/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/like",schemaPath:"#/$defs/kindDef/properties/like/type",keyword:"type",params:{type:"string"},message:"must be string",schema:xs.properties.like.type,parentSchema:xs.properties.like,data:f};s===null?s=[m]:s.push(m),a++}}if(p.color!==void 0){let f=p.color;if(typeof f!="string"){let m={instancePath:e+"/kinds/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/color",schemaPath:"#/$defs/kindDef/properties/color/type",keyword:"type",params:{type:"string"},message:"must be string",schema:xs.properties.color.type,parentSchema:xs.properties.color,data:f};s===null?s=[m]:s.push(m),a++}}if(p.dash!==void 0){let f=p.dash;if(!(f==="solid"||f==="dashed"||f==="dotted")){let m={instancePath:e+"/kinds/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/dash",schemaPath:"#/$defs/kindDef/properties/dash/enum",keyword:"enum",params:{allowedValues:xs.properties.dash.enum},message:"must be equal to one of the allowed values",schema:xs.properties.dash.enum,parentSchema:xs.properties.dash,data:f};s===null?s=[m]:s.push(m),a++}}}else{let f={instancePath:e+"/kinds/"+l.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/kindDef/type",keyword:"type",params:{type:"object"},message:"must be object",schema:xs.type,parentSchema:xs,data:p};s===null?s=[f]:s.push(f),a++}}else{let l={instancePath:e+"/kinds",schemaPath:"#/properties/kinds/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Je.properties.kinds.type,parentSchema:Je.properties.kinds,data:c};s===null?s=[l]:s.push(l),a++}}if(t.after!==void 0){let c=t.after;if(typeof c!="string"){let l={instancePath:e+"/after",schemaPath:"#/properties/after/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Je.properties.after.type,parentSchema:Je.properties.after,data:c};s===null?s=[l]:s.push(l),a++}}if(t.grid!==void 0){let c=t.grid;if(c&&typeof c=="object"&&!Array.isArray(c)){for(let l in c)if(!(l==="snap"||l==="show"||l==="step")){let p={instancePath:e+"/grid",schemaPath:"#/$defs/grid/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:l},message:"must NOT have additional properties",schema:!1,parentSchema:Mt,data:c};s===null?s=[p]:s.push(p),a++}if(c.snap!==void 0){let l=c.snap;if(typeof l=="number"){if(l<=0||isNaN(l)){let p={instancePath:e+"/grid/snap",schemaPath:"#/$defs/grid/properties/snap/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Mt.properties.snap,data:l};s===null?s=[p]:s.push(p),a++}}else{let p={instancePath:e+"/grid/snap",schemaPath:"#/$defs/grid/properties/snap/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Mt.properties.snap.type,parentSchema:Mt.properties.snap,data:l};s===null?s=[p]:s.push(p),a++}}if(c.show!==void 0){let l=c.show;if(typeof l!="boolean"){let p={instancePath:e+"/grid/show",schemaPath:"#/$defs/grid/properties/show/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Mt.properties.show.type,parentSchema:Mt.properties.show,data:l};s===null?s=[p]:s.push(p),a++}}if(c.step!==void 0){let l=c.step;if(typeof l=="number"){if(l<=0||isNaN(l)){let p={instancePath:e+"/grid/step",schemaPath:"#/$defs/grid/properties/step/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Mt.properties.step,data:l};s===null?s=[p]:s.push(p),a++}}else{let p={instancePath:e+"/grid/step",schemaPath:"#/$defs/grid/properties/step/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Mt.properties.step.type,parentSchema:Mt.properties.step,data:l};s===null?s=[p]:s.push(p),a++}}}else{let l={instancePath:e+"/grid",schemaPath:"#/$defs/grid/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Mt.type,parentSchema:Mt,data:c};s===null?s=[l]:s.push(l),a++}}if(t.assemble!==void 0){let c=t.assemble;if(typeof c!="boolean"){let l={instancePath:e+"/assemble",schemaPath:"#/properties/assemble/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Je.properties.assemble.type,parentSchema:Je.properties.assemble,data:c};s===null?s=[l]:s.push(l),a++}}if(t.footer!==void 0){let c=t.footer;if(typeof c!="string"){let l={instancePath:e+"/footer",schemaPath:"#/properties/footer/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Je.properties.footer.type,parentSchema:Je.properties.footer,data:c};s===null?s=[l]:s.push(l),a++}}if(t.scenes!==void 0){let c=t.scenes;if(Array.isArray(c)){if(c.length<1){let p={instancePath:e+"/scenes",schemaPath:"#/properties/scenes/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items",schema:1,parentSchema:Je.properties.scenes,data:c};s===null?s=[p]:s.push(p),a++}let l=c.length;for(let p=0;p<l;p++)br(c[p],{instancePath:e+"/scenes/"+p,parentData:c,parentDataProperty:p,rootData:i,dynamicAnchors:o})||(s=s===null?br.errors:s.concat(br.errors),a=s.length)}else{let l={instancePath:e+"/scenes",schemaPath:"#/properties/scenes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Je.properties.scenes.type,parentSchema:Je.properties.scenes,data:c};s===null?s=[l]:s.push(l),a++}}}else{let c={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Je.type,parentSchema:Je,data:t};s===null?s=[c]:s.push(c),a++}return ra.errors=s,a===0}ra.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function bm(t){let e=JSON.stringify(t),n=2166136261;for(let r=0;r<e.length;r++)n^=e.charCodeAt(r),n=Math.imul(n,16777619)>>>0;return n.toString(16)+":"+e.length}var wm=new Map([["ab60a1c5:10916",mf]]);function Dl(t){let e=wm.get(bm(t));if(!e)throw new Error(`schema not precompiled into the page: ${t.$id??t.title??"?"}`);return e}var Vl={$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"},scenes:{type:"array",minItems:1,items:{$ref:"#/$defs/scene"}}},$defs:{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"},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"}},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"}}},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 ql=[];function uf(t){ql.includes(t)||ql.push(t)}function Kl(t){for(let e of ql){let n=e(t);if(n!==void 0)return n}return t?"this item":"the file"}function oa(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 hf={string:"text",number:"a number",integer:"a whole number",boolean:"true or false",array:"a list",object:"a map"},pi=new Map;function yf(t,e){pi.set(t,e)}var Gl=new Map;function gf(t,e){Gl.set(t,(n,r)=>e(oa(n),r))}var Zl=[];function bf(t,e){Zl.some(([n])=>n===t)||Zl.push([t,e])}function km(t){let e=t.parentSchema,n=Object.keys(e?.properties??{});e?.$ref&&pi.has(e.$ref)&&n.push(...pi.get(e.$ref).filter(r=>!n.includes(r)));for(let r of e?.allOf??[])r.$ref&&pi.has(r.$ref)&&n.push(...pi.get(r.$ref));return n}function ia(t,e){let n=t.propertyName??(t.keyword==="propertyNames"?t.params.propertyName:void 0);if(n!==void 0){let d=`${t.instancePath}/${n.replace(/~/g,"~0").replace(/\//g,"~1")}`,c=e.locate(d,{key:!0});return{severity:"error",message:`"${n}" can't be a name`,line:c.line,col:c.col,path:d,hint:"names are a lower-case letter, then lower-case letters, digits and -"}}let r=t.instancePath,i=t.message??"is not valid",o,s=e.locate(r),a=t.params;switch(t.keyword){case"required":i=`${Kl(r)} is missing "${a.missingProperty}"`;break;case"additionalProperties":case"unevaluatedProperties":{let c=String(a.additionalProperty??a.unevaluatedProperty),l=km(t),p=Ns(c,l);return i=`unknown key "${c}" in ${Kl(r)}`+(p?` (did you mean "${p}"?)`:""),!p&&l.length&&(o=`known keys: ${l.join(", ")}`),/\s/.test(c)&&(o='inside { \u2026 } a comma starts a new key: put text with commas in quotes, e.g. label: "read once, at launch"'),s=e.locate(`${r}/${c}`,{key:!0}),{severity:"error",message:i,line:s.line,col:s.col,path:`${r}/${c}`,hint:o}}case"enum":{let c=a.allowedValues.map(String),l=typeof t.data=="string"?Ns(t.data,c):void 0,p=r.split("/").pop();i=`${oa(t.data)} is not a valid ${p&&!/^\d+$/.test(p)?`"${p}"`:"value"}`+(l?` (did you mean "${l}"?)`:""),o=`expected one of: ${c.join(", ")}`;break}case"const":i=Gl.has(r)?Gl.get(r)(t.data,a.allowedValue):`must be ${JSON.stringify(a.allowedValue)}`;break;case"type":i=`expected ${hf[String(a.type)]??a.type}, got ${oa(t.data)}`;break;case"pattern":let d=Zl.find(([c])=>String(a.pattern).startsWith(c));d?{message:i,hint:o}=d[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 c=r.split("/").pop()??"",l=r.split("/").slice(0,-1).join("/");i=`"${c.replace(/~1/g,"/").replace(/~0/g,"~")}" can't be set on ${Kl(l)}`,s=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:s.line,col:s.col,path:r,hint:o}}function wf(t,e){let n=t.filter(s=>s.keyword==="anyOf"),r=new Set,i=[];for(let s of n){let a=s.schemaPath.replace(/\/anyOf$/,"/anyOf/"),d=t.filter(p=>p!==s&&p.schemaPath.startsWith(a)&&p.instancePath.startsWith(s.instancePath));if(d.forEach(p=>r.add(p)),r.add(s),n.some(p=>p!==s&&s.schemaPath.startsWith(p.schemaPath.replace(/\/anyOf$/,"/anyOf/"))&&p.instancePath===s.instancePath))continue;let c=d.filter(p=>p.instancePath.length>s.instancePath.length&&p.keyword!=="anyOf"),l=d.find(p=>p.keyword==="enum"&&p.instancePath===s.instancePath&&typeof s.data=="string");if(l)i.push(ia(l,e));else if(c.length)i.push(...c.map(p=>ia(p,e)));else{let p=d.filter(f=>f.instancePath===s.instancePath&&f.keyword!=="type"&&f.keyword!=="anyOf");if(p.length&&typeof s.data=="object"&&s.data!==null)i.push(...p.map(f=>ia(f,e)));else{let f=[...new Set(d.filter(u=>u.keyword==="type").map(u=>hf[String(u.params.type)]??""))].filter(Boolean),m=e.locate(s.instancePath);i.push({severity:"error",message:`${oa(s.data)} is not allowed here`+(f.length?`; expected ${f.join(" or ")}`:""),line:m.line,col:m.col,path:s.instancePath})}}}for(let s of t)r.has(s)||i.push(ia(s,e));let o=new Set;return i.filter(s=>{let a=`${s.path}|${s.message}`;return o.has(a)?!1:(o.add(a),!0)}).sort((s,a)=>s.line-a.line||s.col-a.col)}var xf=Dl(Vl),Sm=Object.keys(Vl.$defs.placement.properties);yf("#/$defs/placement",Sm);gf("/isodiag",t=>`"isodiag" must be 1 (the format version), got ${t}`);var vm={scene:"a scene",region:"a region",node:"a node",route:"a route",note:"a note",step:"a step"};uf(t=>{let e=/\/(scenes|regions|nodes|routes|notes|steps)\/\d+$/.exec(t);return e?vm[e[1].replace(/s$/,"")]??"this item":void 0});bf("^[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 kf(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:""}]:xf(t.data)?[]:wf(xf.errors??[],t)}function Sf(t,e,n={}){let r=ro(t),i=[...r.diags];if(i.some(a=>a.severity==="error"))return{ok:!1,diags:i,catalog:Ys,scenes:[]};let o=kf(r);i.push(...o);let s=r.data;if(o.length){try{let a=tr(er(e),s.roles??{},s.kinds??{}),d=o.map(c=>c.path);(Array.isArray(s.scenes)?s.scenes:[]).forEach((c,l)=>{try{let p=nr(c,`/scenes/${l}`,r,a,Ys,s.roles??{});i.push(...p.diags.filter(f=>!d.some(m=>f.path===m||f.path.startsWith(m+"/"))))}catch{}})}catch{}return i.sort((a,d)=>a.line-d.line||a.col-d.col),{ok:!1,diags:i,catalog:Ys,scenes:[]}}return Ro(s,e,Ys,r,t,n,i)}export{Xc as core,kp as objects,vf as systems,lf as viewer};
397
+ `;var dm={};co(dm,{BASE_CSS:()=>em,CompileError:()=>oo,DRAWING_CSS:()=>Qd,NODE_ASSETS:()=>so,REGION_KINDS:()=>Jc,compile:()=>pl,getAsset:()=>Xd,renderSvg:()=>fm,systems:()=>Xn});var Ah={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]=Zs(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,f)=>Array.from({length:13},(d,u)=>o(c+(l-c)*u/12,f)),a=(c,l,f)=>t.poly([...n(c,l,e.z0),...n(c,l,e.z1).reverse()],f),m=e.z1-e.z0,p=c=>n(-45,135,c).slice(1).map((l,f,d)=>t.line3(f?d[f-1]:o(-45,c),l,"det")).join("");return a(45,135,"lft")+a(-45,45,"rgt")+p(e.z0+m*.36)+p(e.z0+m*.68)+t.poly(Array.from({length:32},(c,l)=>o(l*360/32,e.z1)),"top")}},Th={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",ve("radialGradient",{id:"orbG",cx:"0.36",cy:"0.30",r:"0.80"},ve("stop",{offset:"0",style:"stop-color:#ffffff"})+ve("stop",{offset:"0.62",style:"stop-color:#f6f6f4"})+ve("stop",{offset:"1",style:"stop-color:#cfd0d6"})));let s=Ni(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=(m,p,c,l)=>ve("rect",{class:"eye",x:r+m-c/2,y:n+p-l/2,width:c,height:l,rx:c/2,transform:`rotate(-24 ${(r+m).toFixed(1)} ${(n+p).toFixed(1)})`});return t.blockFaces(s)+ve("ellipse",{class:"shade",cx:r,cy:i+1,rx:o*.8,ry:o*.3})+ve("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]},Eh={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=Ni(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)+ve("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`})+ve("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]},Nh={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]=Zs(e),o=(e.x1-e.x0)/2,n=e.z1-e.z0,a=.14,m=(s.facing??0)*Math.PI/180,p=Math.cos(m),c=Math.sin(m),l=Math.sin(m)*a,f=-Math.cos(m)*a,d=[r-p*o,i-c*o],u=[r+p*o,i+c*o],y=e.z0,g=e.z1,x=t.poly([[u[0],u[1],y],[u[0]+l,u[1]+f,y],[u[0]+l,u[1]+f,g],[u[0],u[1],g]],"rgt")+t.poly([[d[0],d[1],g],[u[0],u[1],g],[u[0]+l,u[1]+f,g],[d[0]+l,d[1]+f,g]],"top")+t.poly([[d[0],d[1],y],[u[0],u[1],y],[u[0],u[1],g],[d[0],d[1],g]],"lft"),h=Re(d[0],d[1],g),b=Re(u[0],u[1],g),w=2*o*lt,k=n*lt,$=[(b[0]-h[0])/w,(b[1]-h[1])/w,0,1,h[0],h[1]],v=Qs(s.face??"terminal")??ai;return x+=t.onMatrix($,w,k,(T,R)=>li(T,R)+v(T,R),"scr"),x}},Rh={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=Qs(s.face??"terminal")??ai;return t.blockFaces(e)+t.onFace(e,"left",(i,o)=>li(i,o)+r(i,o),"scr")}},Ih={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)=>Pr(t,e)},so={block:on("block","A box. Size and colour role are free; add decorations with `deco`.",[2.4,2.4,1.6],"grey"),session:on("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:on("terminal","A box with terminal lines on its front.",[1.6,1.2,.8],"term",[{terminal:2}]),server:on("server","A service or daemon: a low box with two terminal lines.",[3,2.2,.9],"doz",[{terminal:2}]),chat:on("chat","A chat server or room: a box with a chat bubble on top.",[3.6,4.4,1.3],"chat",["bubble"]),mailbox:on("mailbox","A room or inbox: terminal lines and an envelope on top.",[2.4,2.4,1.6],"mail",[{terminal:3},"envelope"]),file:on("file","A file or document: a low box with lines on top.",[1.6,1.6,.6],"file",["file-lines"]),folder:on("folder","A folder or directory: a flat box.",[1.6,1.6,.5],"folder"),key:on("key","A secret: a low box with a key on top.",[1.6,1.6,.6],"key",[],(t,e)=>uo(t,e)),socket:on("socket","A socket: a small box with a round opening on top.",[1.2,1.2,.5],"socket",[],(t,e)=>ho(t,e)),gate:on("gate","A gate or proxy: a narrow upright slab, usually set in a fence wall.",[.3,2,1.1],"gate"),placeholder:on("placeholder","A placeholder value: a small low box with lines.",[1.2,1,.45],"placeholder",["file-lines"]),orb:Th,person:Eh,screen:Nh,monitor:Rh,cloud:Ih,volume:Ah};function Xd(t){return so[t??"block"]}var zh="border-color:hsl(38 80% 45%);background:hsl(38 80% 55% / .2)",Jc={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:zh,box:!0,auto:!0},css:`.fz{fill:var(--fence-text)!important;opacity:1!important}
398
+ `},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}}},Xn={regions:Jc,nodes:so,defaultNode:"block"};var Qd=nr(Xn),em=Vr(Xn);var nm=al,ot={$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"},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"}}},zn={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"}}},ro=Object.prototype.hasOwnProperty,Me={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"),_e={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"}}}},hn={type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:3},Xc={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"}}},tm={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"}}},Mt={type:"array",items:{type:"number"},minItems:2,maxItems:2},Qc={enum:["start","center","end"]},He={anyOf:[{type:"string"},{type:"integer",minimum:1}]};function Ms(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,m=Ms.evaluated;if(m.dynamicProps&&(m.props=void 0),m.dynamicItems&&(m.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 f={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=[f]:n.push(f),a++}}else{let f={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=[f]:n.push(f),a++}}if(t.at!==void 0){let l=t.at;if(Array.isArray(l)){if(l.length>2){let d={instancePath:e+"/at",schemaPath:"#/$defs/point2/maxItems",keyword:"maxItems",params:{limit:2},message:"must NOT have more than 2 items",schema:2,parentSchema:Mt,data:l};n===null?n=[d]:n.push(d),a++}if(l.length<2){let d={instancePath:e+"/at",schemaPath:"#/$defs/point2/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:Mt,data:l};n===null?n=[d]:n.push(d),a++}let f=l.length;for(let d=0;d<f;d++){let u=l[d];if(typeof u!="number"){let y={instancePath:e+"/at/"+d,schemaPath:"#/$defs/point2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Mt.items.type,parentSchema:Mt.items,data:u};n===null?n=[y]:n.push(y),a++}}}else{let f={instancePath:e+"/at",schemaPath:"#/$defs/point2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Mt.type,parentSchema:Mt,data:l};n===null?n=[f]:n.push(f),a++}}if(t["right-of"]!==void 0){let l=t["right-of"];if(typeof l=="string"){if(!It.test(l)){let f={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=[f]:n.push(f),a++}}else{let f={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=[f]:n.push(f),a++}}if(t["left-of"]!==void 0){let l=t["left-of"];if(typeof l=="string"){if(!It.test(l)){let f={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=[f]:n.push(f),a++}}else{let f={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=[f]:n.push(f),a++}}if(t.below!==void 0){let l=t.below;if(typeof l=="string"){if(!It.test(l)){let f={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=[f]:n.push(f),a++}}else{let f={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=[f]:n.push(f),a++}}if(t.behind!==void 0){let l=t.behind;if(typeof l=="string"){if(!It.test(l)){let f={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=[f]:n.push(f),a++}}else{let f={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=[f]:n.push(f),a++}}if(t.gap!==void 0){let l=t.gap;if(typeof l!="number"){let f={instancePath:e+"/gap",schemaPath:"#/properties/gap/type",keyword:"type",params:{type:"number"},message:"must be number",schema:tm.properties.gap.type,parentSchema:tm.properties.gap,data:l};n===null?n=[f]:n.push(f),a++}}if(t.align!==void 0){let l=t.align;if(!(l==="start"||l==="center"||l==="end")){let f={instancePath:e+"/align",schemaPath:"#/$defs/align/enum",keyword:"enum",params:{allowedValues:Qc.enum},message:"must be equal to one of the allowed values",schema:Qc.enum,parentSchema:Qc,data:l};n===null?n=[f]:n.push(f),a++}}if(t.shift!==void 0){let l=t.shift;if(Array.isArray(l)){if(l.length>2){let d={instancePath:e+"/shift",schemaPath:"#/$defs/point2/maxItems",keyword:"maxItems",params:{limit:2},message:"must NOT have more than 2 items",schema:2,parentSchema:Mt,data:l};n===null?n=[d]:n.push(d),a++}if(l.length<2){let d={instancePath:e+"/shift",schemaPath:"#/$defs/point2/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:Mt,data:l};n===null?n=[d]:n.push(d),a++}let f=l.length;for(let d=0;d<f;d++){let u=l[d];if(typeof u!="number"){let y={instancePath:e+"/shift/"+d,schemaPath:"#/$defs/point2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Mt.items.type,parentSchema:Mt.items,data:u};n===null?n=[y]:n.push(y),a++}}}else{let f={instancePath:e+"/shift",schemaPath:"#/$defs/point2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Mt.type,parentSchema:Mt,data:l};n===null?n=[f]:n.push(f),a++}}if(t.appears!==void 0){let l=t.appears,f=a,d=!1,u=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:He.anyOf[0].type,parentSchema:He.anyOf[0],data:l};n===null?n=[g]:n.push(g),a++}var p=u===a;d=d||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:He.anyOf[1].type,parentSchema:He.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:He.anyOf[1],data:l};n===null?n=[g]:n.push(g),a++}var p=y===a;if(d=d||p,d)a=f,n!==null&&(f?n.length=f:n=null);else{let g={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:He.anyOf,parentSchema:He,data:l};n===null?n=[g]:n.push(g),a++}}if(t.disappears!==void 0){let l=t.disappears,f=a,d=!1,u=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:He.anyOf[0].type,parentSchema:He.anyOf[0],data:l};n===null?n=[g]:n.push(g),a++}var c=u===a;d=d||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:He.anyOf[1].type,parentSchema:He.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:He.anyOf[1],data:l};n===null?n=[g]:n.push(g),a++}var c=y===a;if(d=d||c,d)a=f,n!==null&&(f?n.length=f:n=null);else{let g={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:He.anyOf,parentSchema:He,data:l};n===null?n=[g]:n.push(g),a++}}}return Ms.errors=n,a===0}Ms.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"}}}}},Xe={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"}}}]},Wr=new RegExp("^[a-z][a-z0-9-]*$","u");function Ps(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,m=Ps.evaluated;if(m.dynamicProps&&(m.props=void 0),m.dynamicItems&&(m.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 f=a;if(typeof l=="string"){if(!It.test(l)){let d={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=[d]:n.push(d),a++}}else{let d={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=[d]:n.push(d),a++}var p=f===a;if(!p){let d={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=[d]:n.push(d),a++}}for(let l in t){let f=t[l];if(f&&typeof f=="object"&&!Array.isArray(f)){if(Object.keys(f).length<1){let d={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:f};n===null?n=[d]:n.push(d),a++}for(let d in f)if(!(d==="role"||d==="ghost"||d==="label"||d==="sub"||d==="face"||d==="deco")){let u={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/additionalProperties/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:d},message:"must NOT have additional properties",schema:!1,parentSchema:Nt.additionalProperties,data:f};n===null?n=[u]:n.push(u),a++}if(f.role!==void 0){let d=f.role;if(typeof d!="string"){let u={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:d};n===null?n=[u]:n.push(u),a++}}if(f.ghost!==void 0){let d=f.ghost;if(typeof d!="boolean"){let u={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:d};n===null?n=[u]:n.push(u),a++}}if(f.label!==void 0){let d=f.label;if(typeof d!="string"){let u={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:d};n===null?n=[u]:n.push(u),a++}}if(f.sub!==void 0){let d=f.sub;if(typeof d!="string"){let u={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:d};n===null?n=[u]:n.push(u),a++}}if(f.face!==void 0){let d=f.face;if(typeof d=="string"){if(!Wr.test(d)){let u={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:d};n===null?n=[u]:n.push(u),a++}}else{let u={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:d};n===null?n=[u]:n.push(u),a++}}if(f.deco!==void 0){let d=f.deco;if(Array.isArray(d)){let u=d.length;for(let y=0;y<u;y++){let g=d[y],x=a,h=!1,b=a;if(!(g==="envelope"||g==="bubble"||g==="file-lines"||g==="ghost"||g==="terminal")){let k={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y,schemaPath:"#/$defs/deco/anyOf/0/enum",keyword:"enum",params:{allowedValues:Xe.anyOf[0].enum},message:"must be equal to one of the allowed values",schema:Xe.anyOf[0].enum,parentSchema:Xe.anyOf[0],data:g};n===null?n=[k]:n.push(k),a++}var c=b===a;h=h||c;let w=a;if(g&&typeof g=="object"&&!Array.isArray(g)){if(Object.keys(g).length>1){let k={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:Xe.anyOf[1],data:g};n===null?n=[k]:n.push(k),a++}if(Object.keys(g).length<1){let k={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:Xe.anyOf[1],data:g};n===null?n=[k]:n.push(k),a++}for(let k in g)if(!(k==="terminal"||k==="icon"||k==="screen")){let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y,schemaPath:"#/$defs/deco/anyOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:k},message:"must NOT have additional properties",schema:!1,parentSchema:Xe.anyOf[1],data:g};n===null?n=[$]:n.push($),a++}if(g.terminal!==void 0){let k=g.terminal;if(!(typeof k=="number"&&!(k%1)&&!isNaN(k))){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:Xe.anyOf[1].properties.terminal.type,parentSchema:Xe.anyOf[1].properties.terminal,data:k};n===null?n=[$]:n.push($),a++}if(typeof k=="number"){if(k>8||isNaN(k)){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:Xe.anyOf[1].properties.terminal,data:k};n===null?n=[$]:n.push($),a++}if(k<1||isNaN(k)){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:Xe.anyOf[1].properties.terminal,data:k};n===null?n=[$]:n.push($),a++}}}if(g.icon!==void 0){let k=g.icon;if(typeof k=="string"){if(!Wr.test(k)){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:Xe.anyOf[1].properties.icon,data:k};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:Xe.anyOf[1].properties.icon.type,parentSchema:Xe.anyOf[1].properties.icon,data:k};n===null?n=[$]:n.push($),a++}}if(g.screen!==void 0){let k=g.screen;if(typeof k=="string"){if(!Wr.test(k)){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:Xe.anyOf[1].properties.screen,data:k};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:Xe.anyOf[1].properties.screen.type,parentSchema:Xe.anyOf[1].properties.screen,data:k};n===null?n=[$]:n.push($),a++}}}else{let k={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:Xe.anyOf[1].type,parentSchema:Xe.anyOf[1],data:g};n===null?n=[k]:n.push(k),a++}var c=w===a;if(h=h||c,h)a=x,n!==null&&(x?n.length=x:n=null);else{let k={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:Xe.anyOf,parentSchema:Xe,data:g};n===null?n=[k]:n.push(k),a++}}}else{let u={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:d};n===null?n=[u]:n.push(u),a++}}}else{let d={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:f};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:Nt.type,parentSchema:Nt,data:t};n===null?n=[l]:n.push(l),a++}return Ps.errors=n,a===0}Ps.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"}}},ep={validate:us};function us(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,m=us.evaluated;if(m.dynamicProps&&(m.props=void 0),m.dynamicItems&&(m.items=void 0),Ms(t,{instancePath:e,parentData:s,parentDataProperty:r,rootData:i,dynamicAnchors:o})||(n=n===null?Ms.errors:n.concat(Ms.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: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: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 f={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:hn,data:c};n===null?n=[f]:n.push(f),a++}if(c.length<2){let f={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:hn,data:c};n===null?n=[f]:n.push(f),a++}let l=c.length;for(let f=0;f<l;f++){let d=c[f];if(typeof d=="number"){if(d<=0||isNaN(d)){let u={instancePath:e+"/size/"+f,schemaPath:"#/$defs/size2or3/items/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:hn.items,data:d};n===null?n=[u]:n.push(u),a++}}else{let u={instancePath:e+"/size/"+f,schemaPath:"#/$defs/size2or3/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:hn.items.type,parentSchema:hn.items,data:d};n===null?n=[u]:n.push(u),a++}}}else{let l={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/type",keyword:"type",params:{type:"array"},message:"must be array",schema:hn.type,parentSchema:hn,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 f=0;f<l;f++){let d=c[f],u=a,y=!1,g=a;if(!(d==="envelope"||d==="bubble"||d==="file-lines"||d==="ghost"||d==="terminal")){let h={instancePath:e+"/deco/"+f,schemaPath:"#/$defs/deco/anyOf/0/enum",keyword:"enum",params:{allowedValues:Xe.anyOf[0].enum},message:"must be equal to one of the allowed values",schema:Xe.anyOf[0].enum,parentSchema:Xe.anyOf[0],data:d};n===null?n=[h]:n.push(h),a++}var p=g===a;y=y||p;let x=a;if(d&&typeof d=="object"&&!Array.isArray(d)){if(Object.keys(d).length>1){let h={instancePath:e+"/deco/"+f,schemaPath:"#/$defs/deco/anyOf/1/maxProperties",keyword:"maxProperties",params:{limit:1},message:"must NOT have more than 1 properties",schema:1,parentSchema:Xe.anyOf[1],data:d};n===null?n=[h]:n.push(h),a++}if(Object.keys(d).length<1){let h={instancePath:e+"/deco/"+f,schemaPath:"#/$defs/deco/anyOf/1/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Xe.anyOf[1],data:d};n===null?n=[h]:n.push(h),a++}for(let h in d)if(!(h==="terminal"||h==="icon"||h==="screen")){let b={instancePath:e+"/deco/"+f,schemaPath:"#/$defs/deco/anyOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:h},message:"must NOT have additional properties",schema:!1,parentSchema:Xe.anyOf[1],data:d};n===null?n=[b]:n.push(b),a++}if(d.terminal!==void 0){let h=d.terminal;if(!(typeof h=="number"&&!(h%1)&&!isNaN(h))){let b={instancePath:e+"/deco/"+f+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Xe.anyOf[1].properties.terminal.type,parentSchema:Xe.anyOf[1].properties.terminal,data:h};n===null?n=[b]:n.push(b),a++}if(typeof h=="number"){if(h>8||isNaN(h)){let b={instancePath:e+"/deco/"+f+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/maximum",keyword:"maximum",params:{comparison:"<=",limit:8},message:"must be <= 8",schema:8,parentSchema:Xe.anyOf[1].properties.terminal,data:h};n===null?n=[b]:n.push(b),a++}if(h<1||isNaN(h)){let b={instancePath:e+"/deco/"+f+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Xe.anyOf[1].properties.terminal,data:h};n===null?n=[b]:n.push(b),a++}}}if(d.icon!==void 0){let h=d.icon;if(typeof h=="string"){if(!Wr.test(h)){let b={instancePath:e+"/deco/"+f+"/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:Xe.anyOf[1].properties.icon,data:h};n===null?n=[b]:n.push(b),a++}}else{let b={instancePath:e+"/deco/"+f+"/icon",schemaPath:"#/$defs/deco/anyOf/1/properties/icon/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Xe.anyOf[1].properties.icon.type,parentSchema:Xe.anyOf[1].properties.icon,data:h};n===null?n=[b]:n.push(b),a++}}if(d.screen!==void 0){let h=d.screen;if(typeof h=="string"){if(!Wr.test(h)){let b={instancePath:e+"/deco/"+f+"/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:Xe.anyOf[1].properties.screen,data:h};n===null?n=[b]:n.push(b),a++}}else{let b={instancePath:e+"/deco/"+f+"/screen",schemaPath:"#/$defs/deco/anyOf/1/properties/screen/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Xe.anyOf[1].properties.screen.type,parentSchema:Xe.anyOf[1].properties.screen,data:h};n===null?n=[b]:n.push(b),a++}}}else{let h={instancePath:e+"/deco/"+f,schemaPath:"#/$defs/deco/anyOf/1/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Xe.anyOf[1].type,parentSchema:Xe.anyOf[1],data:d};n===null?n=[h]:n.push(h),a++}var p=x===a;if(y=y||p,y)a=u,n!==null&&(u?n.length=u:n=null);else{let h={instancePath:e+"/deco/"+f,schemaPath:"#/$defs/deco/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Xe.anyOf,parentSchema:Xe,data:d};n===null?n=[h]:n.push(h),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(!Wr.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 f={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=[f]:n.push(f),a++}if(c.side!==void 0){let l=c.side;if(!(l==="above"||l==="right"||l==="left"||l==="below")){let f={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=[f]:n.push(f),a++}}if(c.dx!==void 0){let l=c.dx;if(typeof l!="number"){let f={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=[f]:n.push(f),a++}}if(c.dy!==void 0){let l=c.dy;if(typeof l!="number"){let f={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=[f]:n.push(f),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 f={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=[f]:n.push(f),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 f={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=[f]:n.push(f),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 f={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=[f]:n.push(f),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 f={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=[f]:n.push(f),a++}}if(c.from!==void 0){let l=c.from;if(!(l==="left"||l==="right"||l==="top"||l==="bottom")){let f={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=[f]:n.push(f),a++}}if(c.delay!==void 0){let l=c.delay;if(typeof l=="number"){if(l<0||isNaN(l)){let f={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=[f]:n.push(f),a++}}else{let f={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=[f]:n.push(f),a++}}if(c.duration!==void 0){let l=c.duration;if(typeof l=="number"){if(l<=0||isNaN(l)){let f={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=[f]:n.push(f),a++}}else{let f={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=[f]:n.push(f),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&&(Ps(t.variants,{instancePath:e+"/variants",parentData:t,parentDataProperty:"variants",rootData:i,dynamicAnchors:o})||(n=n===null?Ps.errors:n.concat(Ps.errors),a=n.length)),t.nodes!==void 0){let c=t.nodes;if(Array.isArray(c)){let l=c.length;for(let f=0;f<l;f++)ep.validate(c[f],{instancePath:e+"/nodes/"+f,parentData:c,parentDataProperty:f,rootData:i,dynamicAnchors:o})||(n=n===null?ep.validate.errors:n.concat(ep.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 us.errors=n,a===0}us.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var tp={validate:lr};function lr(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,m=lr.evaluated;if(m.dynamicProps&&(m.props=void 0),m.dynamicItems&&(m.items=void 0),Ms(t,{instancePath:e,parentData:s,parentDataProperty:r,rootData:i,dynamicAnchors:o})||(n=n===null?Ms.errors:n.concat(Ms.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:_e.required,parentSchema:_e,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:_e.required,parentSchema:_e,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:_e.properties.kind.enum},message:"must be equal to one of the allowed values",schema:_e.properties.kind.enum,parentSchema:_e.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:_e.properties.label.type,parentSchema:_e.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:_e.properties["label-style"].enum},message:"must be equal to one of the allowed values",schema:_e.properties["label-style"].enum,parentSchema:_e.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:_e.properties.ghost.type,parentSchema:_e.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:_e.properties.role.type,parentSchema:_e.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:hn,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:hn,data:p};n===null?n=[l]:n.push(l),a++}let c=p.length;for(let l=0;l<c;l++){let f=p[l];if(typeof f=="number"){if(f<=0||isNaN(f)){let d={instancePath:e+"/size/"+l,schemaPath:"#/$defs/size2or3/items/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:hn.items,data:f};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/size/"+l,schemaPath:"#/$defs/size2or3/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:hn.items.type,parentSchema:hn.items,data:f};n===null?n=[d]:n.push(d),a++}}}else{let c={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/type",keyword:"type",params:{type:"array"},message:"must be array",schema:hn.type,parentSchema:hn,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:_e.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:_e.properties.padding.type,parentSchema:_e.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:_e.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:_e.properties.height.type,parentSchema:_e.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:_e.properties.z.type,parentSchema:_e.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:_e.properties.flow.enum},message:"must be equal to one of the allowed values",schema:_e.properties.flow.enum,parentSchema:_e.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:_e.properties.gate.required,parentSchema:_e.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:_e.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:Xc.enum},message:"must be equal to one of the allowed values",schema:Xc.enum,parentSchema:Xc,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:_e.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:_e.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:_e.properties.gate.properties.at.type,parentSchema:_e.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:_e.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:_e.properties.gate.properties.width.type,parentSchema:_e.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:_e.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:_e.properties.gate.properties.height.type,parentSchema:_e.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:_e.properties.gate.type,parentSchema:_e.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 f=p[l];if(typeof f=="string"){if(!It.test(f)){let d={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:f};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/around/"+l,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:f};n===null?n=[d]:n.push(d),a++}}}else{let c={instancePath:e+"/around",schemaPath:"#/properties/around/type",keyword:"type",params:{type:"array"},message:"must be array",schema:_e.properties.around.type,parentSchema:_e.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++)tp.validate(p[l],{instancePath:e+"/regions/"+l,parentData:p,parentDataProperty:l,rootData:i,dynamicAnchors:o})||(n=n===null?tp.validate.errors:n.concat(tp.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:_e.properties.regions.type,parentSchema:_e.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&&(Ps(t.variants,{instancePath:e+"/variants",parentData:t,parentDataProperty:"variants",rootData:i,dynamicAnchors:o})||(n=n===null?Ps.errors:n.concat(Ps.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++)us(p[l],{instancePath:e+"/nodes/"+l,parentData:p,parentDataProperty:l,rootData:i,dynamicAnchors:o})||(n=n===null?us.errors:n.concat(us.errors),a=n.length)}else{let c={instancePath:e+"/nodes",schemaPath:"#/properties/nodes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:_e.properties.nodes.type,parentSchema:_e.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:_e,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:_e.type,parentSchema:_e,data:t};n===null?n=[p]:n.push(p),a++}return lr.errors=n,a===0}lr.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"}}},vs={type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"},np=new RegExp("^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$","u");function Jr(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,m=Jr.evaluated;if(m.dynamicProps&&(m.props=void 0),m.dynamicItems&&(m.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let d={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=[d]:n.push(d),a++}if(t.from===void 0){let d={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=[d]:n.push(d),a++}if(t.to===void 0){let d={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=[d]:n.push(d),a++}for(let d in t)if(!ro.call(je.properties,d)){let u={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:d},message:"must NOT have additional properties",schema:!1,parentSchema:je,data:t};n===null?n=[u]:n.push(u),a++}if(t.id!==void 0){let d=t.id;if(typeof d=="string"){if(!It.test(d)){let u={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=[u]:n.push(u),a++}}else{let u={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=[u]:n.push(u),a++}}if(t.from!==void 0){let d=t.from;if(typeof d=="string"){if(!np.test(d)){let u={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:vs,data:d};n===null?n=[u]:n.push(u),a++}}else{let u={instancePath:e+"/from",schemaPath:"#/$defs/endpoint/type",keyword:"type",params:{type:"string"},message:"must be string",schema:vs.type,parentSchema:vs,data:d};n===null?n=[u]:n.push(u),a++}}if(t.to!==void 0){let d=t.to;if(typeof d=="string"){if(!np.test(d)){let u={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:vs,data:d};n===null?n=[u]:n.push(u),a++}}else{let u={instancePath:e+"/to",schemaPath:"#/$defs/endpoint/type",keyword:"type",params:{type:"string"},message:"must be string",schema:vs.type,parentSchema:vs,data:d};n===null?n=[u]:n.push(u),a++}}if(t.kind!==void 0){let d=t.kind;if(typeof d!="string"){let u={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:d};n===null?n=[u]:n.push(u),a++}}if(t.via!==void 0){let d=t.via;if(Array.isArray(d)){let u=d.length;for(let y=0;y<u;y++){let g=d[y],x=a,h=!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:Mt,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:Mt,data:g};n===null?n=[$]:n.push($),a++}let k=g.length;for(let $=0;$<k;$++){let v=g[$];if(typeof v!="number"){let T={instancePath:e+"/via/"+y+"/"+$,schemaPath:"#/$defs/point2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Mt.items.type,parentSchema:Mt.items,data:v};n===null?n=[T]:n.push(T),a++}}}else{let k={instancePath:e+"/via/"+y,schemaPath:"#/$defs/point2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Mt.type,parentSchema:Mt,data:g};n===null?n=[k]:n.push(k),a++}var p=b===a;h=h||p;let w=a;if(typeof g=="string"){if(!np.test(g)){let k={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:vs,data:g};n===null?n=[k]:n.push(k),a++}}else{let k={instancePath:e+"/via/"+y,schemaPath:"#/$defs/endpoint/type",keyword:"type",params:{type:"string"},message:"must be string",schema:vs.type,parentSchema:vs,data:g};n===null?n=[k]:n.push(k),a++}var p=w===a;if(h=h||p,h)a=x,n!==null&&(x?n.length=x:n=null);else{let k={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=[k]:n.push(k),a++}}}else{let u={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:d};n===null?n=[u]:n.push(u),a++}}if(t.points!==void 0){let d=t.points;if(Array.isArray(d)){let u=d.length;for(let y=0;y<u;y++){let g=d[y];if(Array.isArray(g)){if(g.length>3){let h={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=[h]:n.push(h),a++}if(g.length<2){let h={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=[h]:n.push(h),a++}let x=g.length;for(let h=0;h<x;h++){let b=g[h];if(typeof b!="number"){let w={instancePath:e+"/points/"+y+"/"+h,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=[w]:n.push(w),a++}}}else{let x={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=[x]:n.push(x),a++}}}else{let u={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:d};n===null?n=[u]:n.push(u),a++}}if(t.lane!==void 0){let d=t.lane;if(typeof d!="number"){let u={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:d};n===null?n=[u]:n.push(u),a++}}if(t.arrow!==void 0){let d=t.arrow;if(typeof d!="boolean"){let u={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:d};n===null?n=[u]:n.push(u),a++}}if(t.cross!==void 0){let d=t.cross;if(typeof d!="boolean"){let u={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:d};n===null?n=[u]:n.push(u),a++}}if(t.label!==void 0){let d=t.label,u=a,y=!1,g=a;if(typeof d!="string"){let h={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:d};n===null?n=[h]:n.push(h),a++}var c=g===a;y=y||c;let x=a;if(d&&typeof d=="object"&&!Array.isArray(d)){if(d.text===void 0){let h={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:d};n===null?n=[h]:n.push(h),a++}for(let h in d)if(!(h==="text"||h==="along"||h==="side"||h==="at"||h==="dir"||h==="anchor")){let b={instancePath:e+"/label",schemaPath:"#/properties/label/anyOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:h},message:"must NOT have additional properties",schema:!1,parentSchema:je.properties.label.anyOf[1],data:d};n===null?n=[b]:n.push(b),a++}if(d.text!==void 0){let h=d.text;if(typeof h!="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:h};n===null?n=[b]:n.push(b),a++}}if(d.along!==void 0){let h=d.along;if(!(typeof h=="number"&&!(h%1)&&!isNaN(h))){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:h};n===null?n=[b]:n.push(b),a++}if(typeof h=="number"&&(h<1||isNaN(h))){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:h};n===null?n=[b]:n.push(b),a++}}if(d.side!==void 0){let h=d.side;if(!(h==="left"||h==="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:h};n===null?n=[b]:n.push(b),a++}}if(d.at!==void 0){let h=d.at;if(Array.isArray(h)){if(h.length>3){let w={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:h};n===null?n=[w]:n.push(w),a++}if(h.length<2){let w={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:h};n===null?n=[w]:n.push(w),a++}let b=h.length;for(let w=0;w<b;w++){let k=h[w];if(typeof k!="number"){let $={instancePath:e+"/label/at/"+w,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:k};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:h};n===null?n=[b]:n.push(b),a++}}if(d.dir!==void 0){let h=d.dir;if(!(h==="x"||h==="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:h};n===null?n=[b]:n.push(b),a++}}if(d.anchor!==void 0){let h=d.anchor;if(!(h==="start"||h==="middle"||h==="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:h};n===null?n=[b]:n.push(b),a++}}}else{let h={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:d};n===null?n=[h]:n.push(h),a++}var c=x===a;if(y=y||c,y)a=u,n!==null&&(u?n.length=u:n=null);else{let h={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:d};n===null?n=[h]:n.push(h),a++}}if(t.appears!==void 0){let d=t.appears,u=a,y=!1,g=a;if(typeof d!="string"){let h={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:He.anyOf[0].type,parentSchema:He.anyOf[0],data:d};n===null?n=[h]:n.push(h),a++}var l=g===a;y=y||l;let x=a;if(!(typeof d=="number"&&!(d%1)&&!isNaN(d))){let h={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:He.anyOf[1].type,parentSchema:He.anyOf[1],data:d};n===null?n=[h]:n.push(h),a++}if(typeof d=="number"&&(d<1||isNaN(d))){let h={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:He.anyOf[1],data:d};n===null?n=[h]:n.push(h),a++}var l=x===a;if(y=y||l,y)a=u,n!==null&&(u?n.length=u:n=null);else{let h={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:He.anyOf,parentSchema:He,data:d};n===null?n=[h]:n.push(h),a++}}if(t.disappears!==void 0){let d=t.disappears,u=a,y=!1,g=a;if(typeof d!="string"){let h={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:He.anyOf[0].type,parentSchema:He.anyOf[0],data:d};n===null?n=[h]:n.push(h),a++}var f=g===a;y=y||f;let x=a;if(!(typeof d=="number"&&!(d%1)&&!isNaN(d))){let h={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:He.anyOf[1].type,parentSchema:He.anyOf[1],data:d};n===null?n=[h]:n.push(h),a++}if(typeof d=="number"&&(d<1||isNaN(d))){let h={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:He.anyOf[1],data:d};n===null?n=[h]:n.push(h),a++}var f=x===a;if(y=y||f,y)a=u,n!==null&&(u?n.length=u:n=null);else{let h={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:He.anyOf,parentSchema:He,data:d};n===null?n=[h]:n.push(h),a++}}}else{let d={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:je.type,parentSchema:je,data:t};n===null?n=[d]:n.push(d),a++}return Jr.errors=n,a===0}Jr.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 Xr(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,m=Xr.evaluated;if(m.dynamicProps&&(m.props=void 0),m.dynamicItems&&(m.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){for(let d in t)if(!ro.call(at.properties,d)){let u={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:d},message:"must NOT have additional properties",schema:!1,parentSchema:at,data:t};n===null?n=[u]:n.push(u),a++}if(t.floor!==void 0){let d=t.floor;if(typeof d!="string"){let u={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:d};n===null?n=[u]:n.push(u),a++}}if(t.face!==void 0){let d=t.face;if(typeof d!="string"){let u={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:d};n===null?n=[u]:n.push(u),a++}}if(t.label!==void 0){let d=t.label;if(typeof d!="string"){let u={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:d};n===null?n=[u]:n.push(u),a++}}if(t.sub!==void 0){let d=t.sub;if(typeof d!="string"){let u={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:d};n===null?n=[u]:n.push(u),a++}}if(t.at!==void 0){let d=t.at,u=a,y=!1,g=a;if(Array.isArray(d)){if(d.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:Mt,data:d};n===null?n=[b]:n.push(b),a++}if(d.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:Mt,data:d};n===null?n=[b]:n.push(b),a++}let h=d.length;for(let b=0;b<h;b++){let w=d[b];if(typeof w!="number"){let k={instancePath:e+"/at/"+b,schemaPath:"#/$defs/point2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Mt.items.type,parentSchema:Mt.items,data:w};n===null?n=[k]:n.push(k),a++}}}else{let h={instancePath:e+"/at",schemaPath:"#/$defs/point2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Mt.type,parentSchema:Mt,data:d};n===null?n=[h]:n.push(h),a++}var c=g===a;if(y=y||c,c)var p=!0;let x=a;if(Array.isArray(d)){if(d.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:d};n===null?n=[b]:n.push(b),a++}if(d.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:d};n===null?n=[b]:n.push(b),a++}let h=d.length;for(let b=0;b<h;b++){let w=d[b];if(typeof w!="number"){let k={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:w};n===null?n=[k]:n.push(k),a++}}}else{let h={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:d};n===null?n=[h]:n.push(h),a++}var c=x===a;if(y=y||c,c&&p!==!0&&(p=!0),y)a=u,n!==null&&(u?n.length=u:n=null);else{let h={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:d};n===null?n=[h]:n.push(h),a++}}if(t.on!==void 0){let d=t.on;if(typeof d=="string"){if(!It.test(d)){let u={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:d};n===null?n=[u]:n.push(u),a++}}else{let u={instancePath:e+"/on",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++}}if(t.kind!==void 0){let d=t.kind;if(typeof d!="string"){let u={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:d};n===null?n=[u]:n.push(u),a++}}if(t.dir!==void 0){let d=t.dir;if(!(d==="x"||d==="y")){let u={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:d};n===null?n=[u]:n.push(u),a++}}if(t.anchor!==void 0){let d=t.anchor;if(!(d==="start"||d==="middle"||d==="end")){let u={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:d};n===null?n=[u]:n.push(u),a++}}if(t.dx!==void 0){let d=t.dx;if(typeof d!="number"){let u={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:d};n===null?n=[u]:n.push(u),a++}}if(t.dy!==void 0){let d=t.dy;if(typeof d!="number"){let u={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:d};n===null?n=[u]:n.push(u),a++}}if(t.appears!==void 0){let d=t.appears,u=a,y=!1,g=a;if(typeof d!="string"){let h={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:He.anyOf[0].type,parentSchema:He.anyOf[0],data:d};n===null?n=[h]:n.push(h),a++}var l=g===a;y=y||l;let x=a;if(!(typeof d=="number"&&!(d%1)&&!isNaN(d))){let h={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:He.anyOf[1].type,parentSchema:He.anyOf[1],data:d};n===null?n=[h]:n.push(h),a++}if(typeof d=="number"&&(d<1||isNaN(d))){let h={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:He.anyOf[1],data:d};n===null?n=[h]:n.push(h),a++}var l=x===a;if(y=y||l,y)a=u,n!==null&&(u?n.length=u:n=null);else{let h={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:He.anyOf,parentSchema:He,data:d};n===null?n=[h]:n.push(h),a++}}if(t.disappears!==void 0){let d=t.disappears,u=a,y=!1,g=a;if(typeof d!="string"){let h={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:He.anyOf[0].type,parentSchema:He.anyOf[0],data:d};n===null?n=[h]:n.push(h),a++}var f=g===a;y=y||f;let x=a;if(!(typeof d=="number"&&!(d%1)&&!isNaN(d))){let h={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:He.anyOf[1].type,parentSchema:He.anyOf[1],data:d};n===null?n=[h]:n.push(h),a++}if(typeof d=="number"&&(d<1||isNaN(d))){let h={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:He.anyOf[1],data:d};n===null?n=[h]:n.push(h),a++}var f=x===a;if(y=y||f,y)a=u,n!==null&&(u?n.length=u:n=null);else{let h={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:He.anyOf,parentSchema:He,data:d};n===null?n=[h]:n.push(h),a++}}}else{let d={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:at.type,parentSchema:at,data:t};n===null?n=[d]:n.push(d),a++}return Xr.errors=n,a===0}Xr.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var be={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}]}}},ol={anyOf:[{$ref:"#/$defs/routeRef"},{type:"array",items:{$ref:"#/$defs/routeRef"}}]},Ft={anyOf:[{type:"string"},{type:"object",minProperties:1,maxProperties:1,additionalProperties:{type:"string"}}]};function Qr(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,m=Qr.evaluated;m.dynamicProps&&(m.props=void 0),m.dynamicItems&&(m.items=void 0);let p=a,c=!1,l=a,f=a,d=!1,u=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=u===a;d=d||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 T={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=[T]:n.push(T),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(d=d||g,g)var x=!0;if(d)a=f,n!==null&&(f?n.length=f: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 w=l===a;c=c||w;let h=a;if(Array.isArray(t)){let $=t.length;for(let v=0;v<$;v++){let T=t[v],R=a,O=!1,I=a;if(typeof T!="string"){let A={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:T};n===null?n=[A]:n.push(A),a++}var b=I===a;O=O||b;let M=a;if(T&&typeof T=="object"&&!Array.isArray(T)){if(Object.keys(T).length>1){let A={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:T};n===null?n=[A]:n.push(A),a++}if(Object.keys(T).length<1){let A={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:T};n===null?n=[A]:n.push(A),a++}for(let A in T){let P=T[A];if(typeof P!="string"){let j={instancePath:e+"/"+v+"/"+A.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:P};n===null?n=[j]:n.push(j),a++}}}else{let A={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:T};n===null?n=[A]:n.push(A),a++}var b=M===a;if(O=O||b,O)a=R,n!==null&&(R?n.length=R:n=null);else{let A={instancePath:e+"/"+v,schemaPath:"#/$defs/routeRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Ft.anyOf,parentSchema:Ft,data:T};n===null?n=[A]:n.push(A),a++}}}else{let $={instancePath:e,schemaPath:"#/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ol.anyOf[1].type,parentSchema:ol.anyOf[1],data:t};n===null?n=[$]:n.push($),a++}var w=h===a;if(c=c||w,w)var k=!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:ol.anyOf,parentSchema:ol,data:t};n===null?n=[$]:n.push($),a++}return Qr.errors=n,m.props=x,m.items=k,a===0}Qr.evaluated={dynamicProps:!0,dynamicItems:!0};function ei(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,m=ei.evaluated;if(m.dynamicProps&&(m.props=void 0),m.dynamicItems&&(m.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(t.heading===void 0){let f={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"heading"},message:"must have required property 'heading'",schema:be.required,parentSchema:be,data:t};n===null?n=[f]:n.push(f),a++}for(let f in t)if(!ro.call(be.properties,f)){let d={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:f},message:"must NOT have additional properties",schema:!1,parentSchema:be,data:t};n===null?n=[d]:n.push(d),a++}if(t.id!==void 0){let f=t.id;if(typeof f=="string"){if(!It.test(f)){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:f};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:f};n===null?n=[d]:n.push(d),a++}}if(t.number!==void 0){let f=t.number;if(!(typeof f=="number"&&!(f%1)&&!isNaN(f))){let d={instancePath:e+"/number",schemaPath:"#/properties/number/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:be.properties.number.type,parentSchema:be.properties.number,data:f};n===null?n=[d]:n.push(d),a++}if(typeof f=="number"&&(f<1||isNaN(f))){let d={instancePath:e+"/number",schemaPath:"#/properties/number/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:be.properties.number,data:f};n===null?n=[d]:n.push(d),a++}}if(t.kind!==void 0){let f=t.kind;if(typeof f!="string"){let d={instancePath:e+"/kind",schemaPath:"#/properties/kind/type",keyword:"type",params:{type:"string"},message:"must be string",schema:be.properties.kind.type,parentSchema:be.properties.kind,data:f};n===null?n=[d]:n.push(d),a++}}if(t.heading!==void 0){let f=t.heading;if(typeof f!="string"){let d={instancePath:e+"/heading",schemaPath:"#/properties/heading/type",keyword:"type",params:{type:"string"},message:"must be string",schema:be.properties.heading.type,parentSchema:be.properties.heading,data:f};n===null?n=[d]:n.push(d),a++}}if(t.caption!==void 0){let f=t.caption;if(typeof f!="string"){let d={instancePath:e+"/caption",schemaPath:"#/properties/caption/type",keyword:"type",params:{type:"string"},message:"must be string",schema:be.properties.caption.type,parentSchema:be.properties.caption,data:f};n===null?n=[d]:n.push(d),a++}}if(t.command!==void 0){let f=t.command;if(typeof f!="string"){let d={instancePath:e+"/command",schemaPath:"#/properties/command/type",keyword:"type",params:{type:"string"},message:"must be string",schema:be.properties.command.type,parentSchema:be.properties.command,data:f};n===null?n=[d]:n.push(d),a++}}if(t.animate!==void 0){let f=t.animate;if(Array.isArray(f)){let d=f.length;for(let u=0;u<d;u++)Qr(f[u],{instancePath:e+"/animate/"+u,parentData:f,parentDataProperty:u,rootData:i,dynamicAnchors:o})||(n=n===null?Qr.errors:n.concat(Qr.errors),a=n.length)}else{let d={instancePath:e+"/animate",schemaPath:"#/properties/animate/type",keyword:"type",params:{type:"array"},message:"must be array",schema:be.properties.animate.type,parentSchema:be.properties.animate,data:f};n===null?n=[d]:n.push(d),a++}}if(t.pulse!==void 0){let f=t.pulse;if(Array.isArray(f)){let d=f.length;for(let u=0;u<d;u++){let y=f[u];if(typeof y=="string"){if(!It.test(y)){let g={instancePath:e+"/pulse/"+u,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/"+u,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 d={instancePath:e+"/pulse",schemaPath:"#/properties/pulse/type",keyword:"type",params:{type:"array"},message:"must be array",schema:be.properties.pulse.type,parentSchema:be.properties.pulse,data:f};n===null?n=[d]:n.push(d),a++}}if(t.highlight!==void 0){let f=t.highlight;if(Array.isArray(f)){let d=f.length;for(let u=0;u<d;u++){let y=f[u];if(typeof y=="string"){if(!It.test(y)){let g={instancePath:e+"/highlight/"+u,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/"+u,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 d={instancePath:e+"/highlight",schemaPath:"#/properties/highlight/type",keyword:"type",params:{type:"array"},message:"must be array",schema:be.properties.highlight.type,parentSchema:be.properties.highlight,data:f};n===null?n=[d]:n.push(d),a++}}if(t.focus!==void 0){let f=t.focus;if(Array.isArray(f)){let d=f.length;for(let u=0;u<d;u++){let y=f[u];if(typeof y=="string"){if(!It.test(y)){let g={instancePath:e+"/focus/"+u,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/"+u,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 d={instancePath:e+"/focus",schemaPath:"#/properties/focus/type",keyword:"type",params:{type:"array"},message:"must be array",schema:be.properties.focus.type,parentSchema:be.properties.focus,data:f};n===null?n=[d]:n.push(d),a++}}if(t.show!==void 0){let f=t.show;if(Array.isArray(f)){let d=f.length;for(let u=0;u<d;u++){let y=f[u];if(typeof y=="string"){if(!It.test(y)){let g={instancePath:e+"/show/"+u,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/"+u,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 d={instancePath:e+"/show",schemaPath:"#/properties/show/type",keyword:"type",params:{type:"array"},message:"must be array",schema:be.properties.show.type,parentSchema:be.properties.show,data:f};n===null?n=[d]:n.push(d),a++}}if(t.hide!==void 0){let f=t.hide;if(Array.isArray(f)){let d=f.length;for(let u=0;u<d;u++){let y=f[u];if(typeof y=="string"){if(!It.test(y)){let g={instancePath:e+"/hide/"+u,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/"+u,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 d={instancePath:e+"/hide",schemaPath:"#/properties/hide/type",keyword:"type",params:{type:"array"},message:"must be array",schema:be.properties.hide.type,parentSchema:be.properties.hide,data:f};n===null?n=[d]:n.push(d),a++}}if(t.say!==void 0){let f=t.say;if(Array.isArray(f)){let d=f.length;for(let u=0;u<d;u++){let y=f[u];if(y&&typeof y=="object"&&!Array.isArray(y)){if(y.at===void 0){let g={instancePath:e+"/say/"+u,schemaPath:"#/properties/say/items/required",keyword:"required",params:{missingProperty:"at"},message:"must have required property 'at'",schema:be.properties.say.items.required,parentSchema:be.properties.say.items,data:y};n===null?n=[g]:n.push(g),a++}if(y.text===void 0){let g={instancePath:e+"/say/"+u,schemaPath:"#/properties/say/items/required",keyword:"required",params:{missingProperty:"text"},message:"must have required property 'text'",schema:be.properties.say.items.required,parentSchema:be.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 x={instancePath:e+"/say/"+u,schemaPath:"#/properties/say/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:g},message:"must NOT have additional properties",schema:!1,parentSchema:be.properties.say.items,data:y};n===null?n=[x]:n.push(x),a++}if(y.at!==void 0){let g=y.at,x=a,h=!1,b=a;if(typeof g=="string"){if(!It.test(g)){let k={instancePath:e+"/say/"+u+"/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=[k]:n.push(k),a++}}else{let k={instancePath:e+"/say/"+u+"/at",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++}var p=b===a;h=h||p;let w=a;if(Array.isArray(g)){if(g.length>3){let $={instancePath:e+"/say/"+u+"/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:be.properties.say.items.properties.at.anyOf[1],data:g};n===null?n=[$]:n.push($),a++}if(g.length<2){let $={instancePath:e+"/say/"+u+"/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:be.properties.say.items.properties.at.anyOf[1],data:g};n===null?n=[$]:n.push($),a++}let k=g.length;for(let $=0;$<k;$++){let v=g[$];if(typeof v!="number"){let T={instancePath:e+"/say/"+u+"/at/"+$,schemaPath:"#/properties/say/items/properties/at/anyOf/1/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:be.properties.say.items.properties.at.anyOf[1].items.type,parentSchema:be.properties.say.items.properties.at.anyOf[1].items,data:v};n===null?n=[T]:n.push(T),a++}}}else{let k={instancePath:e+"/say/"+u+"/at",schemaPath:"#/properties/say/items/properties/at/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array",schema:be.properties.say.items.properties.at.anyOf[1].type,parentSchema:be.properties.say.items.properties.at.anyOf[1],data:g};n===null?n=[k]:n.push(k),a++}var p=w===a;if(h=h||p,h)a=x,n!==null&&(x?n.length=x:n=null);else{let k={instancePath:e+"/say/"+u+"/at",schemaPath:"#/properties/say/items/properties/at/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:be.properties.say.items.properties.at.anyOf,parentSchema:be.properties.say.items.properties.at,data:g};n===null?n=[k]:n.push(k),a++}}if(y.text!==void 0){let g=y.text;if(typeof g!="string"){let x={instancePath:e+"/say/"+u+"/text",schemaPath:"#/properties/say/items/properties/text/type",keyword:"type",params:{type:"string"},message:"must be string",schema:be.properties.say.items.properties.text.type,parentSchema:be.properties.say.items.properties.text,data:g};n===null?n=[x]:n.push(x),a++}}if(y.kind!==void 0){let g=y.kind;if(typeof g!="string"){let x={instancePath:e+"/say/"+u+"/kind",schemaPath:"#/properties/say/items/properties/kind/type",keyword:"type",params:{type:"string"},message:"must be string",schema:be.properties.say.items.properties.kind.type,parentSchema:be.properties.say.items.properties.kind,data:g};n===null?n=[x]:n.push(x),a++}}if(y.dx!==void 0){let g=y.dx;if(typeof g!="number"){let x={instancePath:e+"/say/"+u+"/dx",schemaPath:"#/properties/say/items/properties/dx/type",keyword:"type",params:{type:"number"},message:"must be number",schema:be.properties.say.items.properties.dx.type,parentSchema:be.properties.say.items.properties.dx,data:g};n===null?n=[x]:n.push(x),a++}}if(y.dy!==void 0){let g=y.dy;if(typeof g!="number"){let x={instancePath:e+"/say/"+u+"/dy",schemaPath:"#/properties/say/items/properties/dy/type",keyword:"type",params:{type:"number"},message:"must be number",schema:be.properties.say.items.properties.dy.type,parentSchema:be.properties.say.items.properties.dy,data:g};n===null?n=[x]:n.push(x),a++}}if(y.anchor!==void 0){let g=y.anchor;if(!(g==="start"||g==="middle"||g==="end")){let x={instancePath:e+"/say/"+u+"/anchor",schemaPath:"#/properties/say/items/properties/anchor/enum",keyword:"enum",params:{allowedValues:be.properties.say.items.properties.anchor.enum},message:"must be equal to one of the allowed values",schema:be.properties.say.items.properties.anchor.enum,parentSchema:be.properties.say.items.properties.anchor,data:g};n===null?n=[x]:n.push(x),a++}}}else{let g={instancePath:e+"/say/"+u,schemaPath:"#/properties/say/items/type",keyword:"type",params:{type:"object"},message:"must be object",schema:be.properties.say.items.type,parentSchema:be.properties.say.items,data:y};n===null?n=[g]:n.push(g),a++}}}else{let d={instancePath:e+"/say",schemaPath:"#/properties/say/type",keyword:"type",params:{type:"array"},message:"must be array",schema:be.properties.say.type,parentSchema:be.properties.say,data:f};n===null?n=[d]:n.push(d),a++}}if(t.mark!==void 0){let f=t.mark;if(Array.isArray(f)){let d=f.length;for(let u=0;u<d;u++){let y=f[u];if(y&&typeof y=="object"&&!Array.isArray(y)){for(let g in y)if(!(g==="on"||g==="at")){let x={instancePath:e+"/mark/"+u,schemaPath:"#/properties/mark/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:g},message:"must NOT have additional properties",schema:!1,parentSchema:be.properties.mark.items,data:y};n===null?n=[x]:n.push(x),a++}if(y.on!==void 0){let g=y.on;if(typeof g=="string"){if(!It.test(g)){let x={instancePath:e+"/mark/"+u+"/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=[x]:n.push(x),a++}}else{let x={instancePath:e+"/mark/"+u+"/on",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:g};n===null?n=[x]:n.push(x),a++}}if(y.at!==void 0){let g=y.at;if(Array.isArray(g)){if(g.length>3){let h={instancePath:e+"/mark/"+u+"/at",schemaPath:"#/properties/mark/items/properties/at/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:be.properties.mark.items.properties.at,data:g};n===null?n=[h]:n.push(h),a++}if(g.length<2){let h={instancePath:e+"/mark/"+u+"/at",schemaPath:"#/properties/mark/items/properties/at/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:be.properties.mark.items.properties.at,data:g};n===null?n=[h]:n.push(h),a++}let x=g.length;for(let h=0;h<x;h++){let b=g[h];if(typeof b!="number"){let w={instancePath:e+"/mark/"+u+"/at/"+h,schemaPath:"#/properties/mark/items/properties/at/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:be.properties.mark.items.properties.at.items.type,parentSchema:be.properties.mark.items.properties.at.items,data:b};n===null?n=[w]:n.push(w),a++}}}else{let x={instancePath:e+"/mark/"+u+"/at",schemaPath:"#/properties/mark/items/properties/at/type",keyword:"type",params:{type:"array"},message:"must be array",schema:be.properties.mark.items.properties.at.type,parentSchema:be.properties.mark.items.properties.at,data:g};n===null?n=[x]:n.push(x),a++}}}else{let g={instancePath:e+"/mark/"+u,schemaPath:"#/properties/mark/items/type",keyword:"type",params:{type:"object"},message:"must be object",schema:be.properties.mark.items.type,parentSchema:be.properties.mark.items,data:y};n===null?n=[g]:n.push(g),a++}}}else{let d={instancePath:e+"/mark",schemaPath:"#/properties/mark/type",keyword:"type",params:{type:"array"},message:"must be array",schema:be.properties.mark.type,parentSchema:be.properties.mark,data:f};n===null?n=[d]:n.push(d),a++}}if(t.badge!==void 0){let f=t.badge,d=a,u=!1,y=a;if(typeof f!="boolean"){let h={instancePath:e+"/badge",schemaPath:"#/properties/badge/anyOf/0/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:be.properties.badge.anyOf[0].type,parentSchema:be.properties.badge.anyOf[0],data:f};n===null?n=[h]:n.push(h),a++}var c=y===a;u=u||c;let g=a;if(typeof f=="string"){if(!It.test(f)){let h={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:f};n===null?n=[h]:n.push(h),a++}}else{let h={instancePath:e+"/badge",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ne.type,parentSchema:Ne,data:f};n===null?n=[h]:n.push(h),a++}var c=g===a;u=u||c;let x=a;if(Array.isArray(f)){if(f.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:be.properties.badge.anyOf[2],data:f};n===null?n=[b]:n.push(b),a++}if(f.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:be.properties.badge.anyOf[2],data:f};n===null?n=[b]:n.push(b),a++}let h=f.length;for(let b=0;b<h;b++){let w=f[b];if(typeof w!="number"){let k={instancePath:e+"/badge/"+b,schemaPath:"#/properties/badge/anyOf/2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:be.properties.badge.anyOf[2].items.type,parentSchema:be.properties.badge.anyOf[2].items,data:w};n===null?n=[k]:n.push(k),a++}}}else{let h={instancePath:e+"/badge",schemaPath:"#/properties/badge/anyOf/2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:be.properties.badge.anyOf[2].type,parentSchema:be.properties.badge.anyOf[2],data:f};n===null?n=[h]:n.push(h),a++}var c=x===a;if(u=u||c,u)a=d,n!==null&&(d?n.length=d:n=null);else{let h={instancePath:e+"/badge",schemaPath:"#/properties/badge/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:be.properties.badge.anyOf,parentSchema:be.properties.badge,data:f};n===null?n=[h]:n.push(h),a++}}if(t.duration!==void 0){let f=t.duration,d=a,u=!1,y=a;if(f!=="auto"){let x={instancePath:e+"/duration",schemaPath:"#/properties/duration/anyOf/0/const",keyword:"const",params:{allowedValue:"auto"},message:"must be equal to constant",schema:"auto",parentSchema:be.properties.duration.anyOf[0],data:f};n===null?n=[x]:n.push(x),a++}var l=y===a;u=u||l;let g=a;if(!(typeof f=="number"&&!(f%1)&&!isNaN(f))){let x={instancePath:e+"/duration",schemaPath:"#/properties/duration/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:be.properties.duration.anyOf[1].type,parentSchema:be.properties.duration.anyOf[1],data:f};n===null?n=[x]:n.push(x),a++}if(typeof f=="number"&&(f<500||isNaN(f))){let x={instancePath:e+"/duration",schemaPath:"#/properties/duration/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:500},message:"must be >= 500",schema:500,parentSchema:be.properties.duration.anyOf[1],data:f};n===null?n=[x]:n.push(x),a++}var l=g===a;if(u=u||l,u)a=d,n!==null&&(d?n.length=d:n=null);else{let x={instancePath:e+"/duration",schemaPath:"#/properties/duration/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:be.properties.duration.anyOf,parentSchema:be.properties.duration,data:f};n===null?n=[x]:n.push(x),a++}}}else{let f={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:be.type,parentSchema:be,data:t};n===null?n=[f]:n.push(f),a++}return ei.errors=n,a===0}ei.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function ti(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,m=ti.evaluated;if(m.dynamicProps&&(m.props=void 0),m.dynamicItems&&(m.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:Me.required,parentSchema:Me,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:Me.required,parentSchema:Me,data:t};n===null?n=[l]:n.push(l),a++}for(let l in t)if(!ro.call(Me.properties,l)){let f={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:l},message:"must NOT have additional properties",schema:!1,parentSchema:Me,data:t};n===null?n=[f]:n.push(f),a++}if(t.id!==void 0){let l=t.id;if(typeof l=="string"){if(!It.test(l)){let f={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=[f]:n.push(f),a++}}else{let f={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=[f]:n.push(f),a++}}if(t.title!==void 0){let l=t.title;if(typeof l!="string"){let f={instancePath:e+"/title",schemaPath:"#/properties/title/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Me.properties.title.type,parentSchema:Me.properties.title,data:l};n===null?n=[f]:n.push(f),a++}}if(t.ants!==void 0){let l=t.ants,f=a,d=!1,u=a;if(typeof l!="boolean"){let x={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf/0/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Me.properties.ants.anyOf[0].type,parentSchema:Me.properties.ants.anyOf[0],data:l};n===null?n=[x]:n.push(x),a++}var p=u===a;d=d||p;let y=a;if(Array.isArray(l)){let x=l.length;for(let h=0;h<x;h++){let b=l[h];if(typeof b!="string"){let w={instancePath:e+"/ants/"+h,schemaPath:"#/properties/ants/anyOf/1/items/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Me.properties.ants.anyOf[1].items.type,parentSchema:Me.properties.ants.anyOf[1].items,data:b};n===null?n=[w]:n.push(w),a++}}}else{let x={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Me.properties.ants.anyOf[1].type,parentSchema:Me.properties.ants.anyOf[1],data:l};n===null?n=[x]:n.push(x),a++}var p=y===a;d=d||p;let g=a;if(l&&typeof l=="object"&&!Array.isArray(l)){for(let x in l)if(!(x==="ids"||x==="speed"||x==="dash")){let h={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf/2/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:x},message:"must NOT have additional properties",schema:!1,parentSchema:Me.properties.ants.anyOf[2],data:l};n===null?n=[h]:n.push(h),a++}if(l.ids!==void 0){let x=l.ids;if(Array.isArray(x)){let h=x.length;for(let b=0;b<h;b++){let w=x[b];if(typeof w!="string"){let k={instancePath:e+"/ants/ids/"+b,schemaPath:"#/properties/ants/anyOf/2/properties/ids/items/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Me.properties.ants.anyOf[2].properties.ids.items.type,parentSchema:Me.properties.ants.anyOf[2].properties.ids.items,data:w};n===null?n=[k]:n.push(k),a++}}}else{let h={instancePath:e+"/ants/ids",schemaPath:"#/properties/ants/anyOf/2/properties/ids/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Me.properties.ants.anyOf[2].properties.ids.type,parentSchema:Me.properties.ants.anyOf[2].properties.ids,data:x};n===null?n=[h]:n.push(h),a++}}if(l.speed!==void 0){let x=l.speed;if(typeof x!="number"){let h={instancePath:e+"/ants/speed",schemaPath:"#/properties/ants/anyOf/2/properties/speed/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Me.properties.ants.anyOf[2].properties.speed.type,parentSchema:Me.properties.ants.anyOf[2].properties.speed,data:x};n===null?n=[h]:n.push(h),a++}}if(l.dash!==void 0){let x=l.dash;if(Array.isArray(x)){if(x.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:Me.properties.ants.anyOf[2].properties.dash,data:x};n===null?n=[b]:n.push(b),a++}if(x.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:Me.properties.ants.anyOf[2].properties.dash,data:x};n===null?n=[b]:n.push(b),a++}let h=x.length;for(let b=0;b<h;b++){let w=x[b];if(typeof w=="number"){if(w<=0||isNaN(w)){let k={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:Me.properties.ants.anyOf[2].properties.dash.items,data:w};n===null?n=[k]:n.push(k),a++}}else{let k={instancePath:e+"/ants/dash/"+b,schemaPath:"#/properties/ants/anyOf/2/properties/dash/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Me.properties.ants.anyOf[2].properties.dash.items.type,parentSchema:Me.properties.ants.anyOf[2].properties.dash.items,data:w};n===null?n=[k]:n.push(k),a++}}}else{let h={instancePath:e+"/ants/dash",schemaPath:"#/properties/ants/anyOf/2/properties/dash/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Me.properties.ants.anyOf[2].properties.dash.type,parentSchema:Me.properties.ants.anyOf[2].properties.dash,data:x};n===null?n=[h]:n.push(h),a++}}}else{let x={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf/2/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Me.properties.ants.anyOf[2].type,parentSchema:Me.properties.ants.anyOf[2],data:l};n===null?n=[x]:n.push(x),a++}var p=g===a;if(d=d||p,d)a=f,n!==null&&(f?n.length=f:n=null);else{let x={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Me.properties.ants.anyOf,parentSchema:Me.properties.ants,data:l};n===null?n=[x]:n.push(x),a++}}if(t.motion!==void 0){let l=t.motion;if(!(l&&typeof l=="object"&&!Array.isArray(l))){let f={instancePath:e+"/motion",schemaPath:"#/properties/motion/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Me.properties.motion.type,parentSchema:Me.properties.motion,data:l};n===null?n=[f]:n.push(f),a++}}if(t.caption!==void 0){let l=t.caption;if(typeof l!="string"){let f={instancePath:e+"/caption",schemaPath:"#/properties/caption/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Me.properties.caption.type,parentSchema:Me.properties.caption,data:l};n===null?n=[f]:n.push(f),a++}}if(t.aria!==void 0){let l=t.aria;if(typeof l!="string"){let f={instancePath:e+"/aria",schemaPath:"#/properties/aria/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Me.properties.aria.type,parentSchema:Me.properties.aria,data:l};n===null?n=[f]:n.push(f),a++}}if(t.gap!==void 0){let l=t.gap;if(typeof l=="number"){if(l<=0||isNaN(l)){let f={instancePath:e+"/gap",schemaPath:"#/properties/gap/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Me.properties.gap,data:l};n===null?n=[f]:n.push(f),a++}}else{let f={instancePath:e+"/gap",schemaPath:"#/properties/gap/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Me.properties.gap.type,parentSchema:Me.properties.gap,data:l};n===null?n=[f]:n.push(f),a++}}if(t.flow!==void 0){let l=t.flow;if(!(l==="row"||l==="column")){let f={instancePath:e+"/flow",schemaPath:"#/properties/flow/enum",keyword:"enum",params:{allowedValues:Me.properties.flow.enum},message:"must be equal to one of the allowed values",schema:Me.properties.flow.enum,parentSchema:Me.properties.flow,data:l};n===null?n=[f]:n.push(f),a++}}if(t.regions!==void 0){let l=t.regions;if(Array.isArray(l)){let f=l.length;for(let d=0;d<f;d++)lr(l[d],{instancePath:e+"/regions/"+d,parentData:l,parentDataProperty:d,rootData:i,dynamicAnchors:o})||(n=n===null?lr.errors:n.concat(lr.errors),a=n.length)}else{let f={instancePath:e+"/regions",schemaPath:"#/properties/regions/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Me.properties.regions.type,parentSchema:Me.properties.regions,data:l};n===null?n=[f]:n.push(f),a++}}if(t.nodes!==void 0){let l=t.nodes;if(Array.isArray(l)){let f=l.length;for(let d=0;d<f;d++)us(l[d],{instancePath:e+"/nodes/"+d,parentData:l,parentDataProperty:d,rootData:i,dynamicAnchors:o})||(n=n===null?us.errors:n.concat(us.errors),a=n.length)}else{let f={instancePath:e+"/nodes",schemaPath:"#/properties/nodes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Me.properties.nodes.type,parentSchema:Me.properties.nodes,data:l};n===null?n=[f]:n.push(f),a++}}if(t.routes!==void 0){let l=t.routes;if(Array.isArray(l)){let f=l.length;for(let d=0;d<f;d++)Jr(l[d],{instancePath:e+"/routes/"+d,parentData:l,parentDataProperty:d,rootData:i,dynamicAnchors:o})||(n=n===null?Jr.errors:n.concat(Jr.errors),a=n.length)}else{let f={instancePath:e+"/routes",schemaPath:"#/properties/routes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Me.properties.routes.type,parentSchema:Me.properties.routes,data:l};n===null?n=[f]:n.push(f),a++}}if(t.notes!==void 0){let l=t.notes;if(Array.isArray(l)){let f=l.length;for(let d=0;d<f;d++)Xr(l[d],{instancePath:e+"/notes/"+d,parentData:l,parentDataProperty:d,rootData:i,dynamicAnchors:o})||(n=n===null?Xr.errors:n.concat(Xr.errors),a=n.length)}else{let f={instancePath:e+"/notes",schemaPath:"#/properties/notes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Me.properties.notes.type,parentSchema:Me.properties.notes,data:l};n===null?n=[f]:n.push(f),a++}}if(t.steps!==void 0){let l=t.steps;if(Array.isArray(l)){let f=l.length;for(let d=0;d<f;d++)ei(l[d],{instancePath:e+"/steps/"+d,parentData:l,parentDataProperty:d,rootData:i,dynamicAnchors:o})||(n=n===null?ei.errors:n.concat(ei.errors),a=n.length)}else{let f={instancePath:e+"/steps",schemaPath:"#/properties/steps/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Me.properties.steps.type,parentSchema:Me.properties.steps,data:l};n===null?n=[f]:n.push(f),a++}}if(t.legend!==void 0){let l=t.legend,f=a,d=!1,u=a;if(l!=="auto"){let x={instancePath:e+"/legend",schemaPath:"#/properties/legend/anyOf/0/enum",keyword:"enum",params:{allowedValues:Me.properties.legend.anyOf[0].enum},message:"must be equal to one of the allowed values",schema:Me.properties.legend.anyOf[0].enum,parentSchema:Me.properties.legend.anyOf[0],data:l};n===null?n=[x]:n.push(x),a++}var c=u===a;d=d||c;let y=a;if(l!==!1){let x={instancePath:e+"/legend",schemaPath:"#/properties/legend/anyOf/1/const",keyword:"const",params:{allowedValue:!1},message:"must be equal to constant",schema:!1,parentSchema:Me.properties.legend.anyOf[1],data:l};n===null?n=[x]:n.push(x),a++}var c=y===a;d=d||c;let g=a;if(Array.isArray(l)){let x=l.length;for(let h=0;h<x;h++){let b=l[h];if(typeof b!="string"){let w={instancePath:e+"/legend/"+h,schemaPath:"#/properties/legend/anyOf/2/items/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Me.properties.legend.anyOf[2].items.type,parentSchema:Me.properties.legend.anyOf[2].items,data:b};n===null?n=[w]:n.push(w),a++}}}else{let x={instancePath:e+"/legend",schemaPath:"#/properties/legend/anyOf/2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Me.properties.legend.anyOf[2].type,parentSchema:Me.properties.legend.anyOf[2],data:l};n===null?n=[x]:n.push(x),a++}var c=g===a;if(d=d||c,d)a=f,n!==null&&(f?n.length=f:n=null);else{let x={instancePath:e+"/legend",schemaPath:"#/properties/legend/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Me.properties.legend.anyOf,parentSchema:Me.properties.legend,data:l};n===null?n=[x]:n.push(x),a++}}if(t.badges!==void 0){let l=t.badges;if(typeof l!="boolean"){let f={instancePath:e+"/badges",schemaPath:"#/properties/badges/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Me.properties.badges.type,parentSchema:Me.properties.badges,data:l};n===null?n=[f]:n.push(f),a++}}if(t.grid!==void 0){let l=t.grid;if(l&&typeof l=="object"&&!Array.isArray(l)){for(let f in l)if(!(f==="snap"||f==="show"||f==="step")){let d={instancePath:e+"/grid",schemaPath:"#/$defs/grid/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:f},message:"must NOT have additional properties",schema:!1,parentSchema:Rt,data:l};n===null?n=[d]:n.push(d),a++}if(l.snap!==void 0){let f=l.snap;if(typeof f=="number"){if(f<=0||isNaN(f)){let d={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:f};n===null?n=[d]:n.push(d),a++}}else{let d={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:f};n===null?n=[d]:n.push(d),a++}}if(l.show!==void 0){let f=l.show;if(typeof f!="boolean"){let d={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:f};n===null?n=[d]:n.push(d),a++}}if(l.step!==void 0){let f=l.step;if(typeof f=="number"){if(f<=0||isNaN(f)){let d={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:f};n===null?n=[d]:n.push(d),a++}}else{let d={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:f};n===null?n=[d]:n.push(d),a++}}}else{let f={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=[f]:n.push(f),a++}}if(t.assemble!==void 0){let l=t.assemble;if(typeof l!="boolean"){let f={instancePath:e+"/assemble",schemaPath:"#/properties/assemble/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Me.properties.assemble.type,parentSchema:Me.properties.assemble,data:l};n===null?n=[f]:n.push(f),a++}}if(t.loop!==void 0){let l=t.loop;if(typeof l!="boolean"){let f={instancePath:e+"/loop",schemaPath:"#/properties/loop/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Me.properties.loop.type,parentSchema:Me.properties.loop,data:l};n===null?n=[f]:n.push(f),a++}}if(t.dim!==void 0){let l=t.dim;if(!(l==="flows"||l==="all")){let f={instancePath:e+"/dim",schemaPath:"#/properties/dim/enum",keyword:"enum",params:{allowedValues:Me.properties.dim.enum},message:"must be equal to one of the allowed values",schema:Me.properties.dim.enum,parentSchema:Me.properties.dim,data:l};n===null?n=[f]:n.push(f),a++}}if(t.after!==void 0){let l=t.after;if(typeof l!="string"){let f={instancePath:e+"/after",schemaPath:"#/properties/after/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Me.properties.after.type,parentSchema:Me.properties.after,data:l};n===null?n=[f]:n.push(f),a++}}}else{let l={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Me.type,parentSchema:Me,data:t};n===null?n=[l]:n.push(l),a++}return ti.errors=n,a===0}ti.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function al(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,m=al.evaluated;if(m.dynamicProps&&(m.props=void 0),m.dynamicItems&&(m.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:ot.required,parentSchema:ot,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:ot.required,parentSchema:ot,data:t};n===null?n=[p]:n.push(p),a++}for(let p in t)if(!ro.call(ot.properties,p)){let c={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:p},message:"must NOT have additional properties",schema:!1,parentSchema:ot,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:ot.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:ot.properties.title.type,parentSchema:ot.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:ot.properties.lede.type,parentSchema:ot.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 f=p[l];if(typeof f!="string"){let d={instancePath:e+"/pills/"+l,schemaPath:"#/properties/pills/items/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ot.properties.pills.items.type,parentSchema:ot.properties.pills.items,data:f};n===null?n=[d]:n.push(d),a++}}}else{let c={instancePath:e+"/pills",schemaPath:"#/properties/pills/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ot.properties.pills.type,parentSchema:ot.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:ot.properties.theme.type,parentSchema:ot.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 f={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=[f]:n.push(f),a++}if(l.s===void 0){let f={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=[f]:n.push(f),a++}for(let f in l)if(!(f==="h"||f==="s"||f==="top"||f==="tint")){let d={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/role/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:f},message:"must NOT have additional properties",schema:!1,parentSchema:Lt,data:l};n===null?n=[d]:n.push(d),a++}if(l.h!==void 0){let f=l.h;if(typeof f=="number"){if(f>360||isNaN(f)){let d={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:f};n===null?n=[d]:n.push(d),a++}if(f<0||isNaN(f)){let d={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:f};n===null?n=[d]:n.push(d),a++}}else{let d={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:f};n===null?n=[d]:n.push(d),a++}}if(l.s!==void 0){let f=l.s;if(typeof f=="number"){if(f>100||isNaN(f)){let d={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:f};n===null?n=[d]:n.push(d),a++}if(f<0||isNaN(f)){let d={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:f};n===null?n=[d]:n.push(d),a++}}else{let d={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:f};n===null?n=[d]:n.push(d),a++}}if(l.top!==void 0){let f=l.top;if(typeof f!="string"){let d={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:f};n===null?n=[d]:n.push(d),a++}}if(l.tint!==void 0){let f=l.tint;if(typeof f=="number"){if(f>100||isNaN(f)){let d={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:f};n===null?n=[d]:n.push(d),a++}if(f<0||isNaN(f)){let d={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:f};n===null?n=[d]:n.push(d),a++}}else{let d={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:f};n===null?n=[d]:n.push(d),a++}}}else{let f={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=[f]:n.push(f),a++}}else{let c={instancePath:e+"/roles",schemaPath:"#/properties/roles/type",keyword:"type",params:{type:"object"},message:"must be object",schema:ot.properties.roles.type,parentSchema:ot.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 f in l)if(!(f==="legend"||f==="like"||f==="color"||f==="dash")){let d={instancePath:e+"/kinds/"+c.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/kindDef/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:f},message:"must NOT have additional properties",schema:!1,parentSchema:zn,data:l};n===null?n=[d]:n.push(d),a++}if(l.legend!==void 0){let f=l.legend;if(typeof f!="string"){let d={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:zn.properties.legend.type,parentSchema:zn.properties.legend,data:f};n===null?n=[d]:n.push(d),a++}}if(l.like!==void 0){let f=l.like;if(typeof f!="string"){let d={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:zn.properties.like.type,parentSchema:zn.properties.like,data:f};n===null?n=[d]:n.push(d),a++}}if(l.color!==void 0){let f=l.color;if(typeof f!="string"){let d={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:zn.properties.color.type,parentSchema:zn.properties.color,data:f};n===null?n=[d]:n.push(d),a++}}if(l.dash!==void 0){let f=l.dash;if(!(f==="solid"||f==="dashed"||f==="dotted")){let d={instancePath:e+"/kinds/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/dash",schemaPath:"#/$defs/kindDef/properties/dash/enum",keyword:"enum",params:{allowedValues:zn.properties.dash.enum},message:"must be equal to one of the allowed values",schema:zn.properties.dash.enum,parentSchema:zn.properties.dash,data:f};n===null?n=[d]:n.push(d),a++}}}else{let f={instancePath:e+"/kinds/"+c.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/kindDef/type",keyword:"type",params:{type:"object"},message:"must be object",schema:zn.type,parentSchema:zn,data:l};n===null?n=[f]:n.push(f),a++}}else{let c={instancePath:e+"/kinds",schemaPath:"#/properties/kinds/type",keyword:"type",params:{type:"object"},message:"must be object",schema:ot.properties.kinds.type,parentSchema:ot.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:ot.properties.after.type,parentSchema:ot.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:ot.properties.assemble.type,parentSchema:ot.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:ot.properties.footer.type,parentSchema:ot.properties.footer,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:ot.properties.scenes,data:p};n===null?n=[l]:n.push(l),a++}let c=p.length;for(let l=0;l<c;l++)ti(p[l],{instancePath:e+"/scenes/"+l,parentData:p,parentDataProperty:l,rootData:i,dynamicAnchors:o})||(n=n===null?ti.errors:n.concat(ti.errors),a=n.length)}else{let c={instancePath:e+"/scenes",schemaPath:"#/properties/scenes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ot.properties.scenes.type,parentSchema:ot.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:ot.type,parentSchema:ot,data:t};n===null?n=[p]:n.push(p),a++}return al.errors=n,a===0}al.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function Ch(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 jh=new Map([["2893d8cc:12893",nm]]);function sp(t){let e=jh.get(Ch(t));if(!e)throw new Error(`schema not precompiled into the page: ${t.$id??t.title??"?"}`);return e}var rp={$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"},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 op=[];function sm(t){op.includes(t)||op.push(t)}function ip(t){for(let e of op){let s=e(t);if(s!==void 0)return s}return t?"this item":"the file"}function cl(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 rm={string:"text",number:"a number",integer:"a whole number",boolean:"true or false",array:"a list",object:"a map"},io=new Map;function im(t,e){io.set(t,e)}var ap=new Map;function om(t,e){ap.set(t,(s,r)=>e(cl(s),r))}var lp=[];function am(t,e){lp.some(([s])=>s===t)||lp.push([t,e])}function _h(t){let e=t.parentSchema,s=Object.keys(e?.properties??{});e?.$ref&&io.has(e.$ref)&&s.push(...io.get(e.$ref).filter(r=>!s.includes(r)));for(let r of e?.allOf??[])r.$ref&&io.has(r.$ref)&&s.push(...io.get(r.$ref));return s}function ll(t,e){let s=t.propertyName??(t.keyword==="propertyNames"?t.params.propertyName:void 0);if(s!==void 0){let m=`${t.instancePath}/${s.replace(/~/g,"~0").replace(/\//g,"~1")}`,p=e.locate(m,{key:!0});return{severity:"error",message:`"${s}" can't be a name`,line:p.line,col:p.col,path:m,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=`${ip(r)} is missing "${a.missingProperty}"`;break;case"additionalProperties":case"unevaluatedProperties":{let p=String(a.additionalProperty??a.unevaluatedProperty),c=_h(t),l=Vt(p,c);return i=`unknown key "${p}" in ${ip(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=`${cl(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=ap.has(r)?ap.get(r)(t.data,a.allowedValue):`must be ${JSON.stringify(a.allowedValue)}`;break;case"type":i=`expected ${rm[String(a.type)]??a.type}, got ${cl(t.data)}`;break;case"pattern":let m=lp.find(([p])=>String(a.pattern).startsWith(p));m?{message:i,hint:o}=m[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 ${ip(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/"),m=t.filter(l=>l!==n&&l.schemaPath.startsWith(a)&&l.instancePath.startsWith(n.instancePath));if(m.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=m.filter(l=>l.instancePath.length>n.instancePath.length&&l.keyword!=="anyOf"),c=m.find(l=>l.keyword==="enum"&&l.instancePath===n.instancePath&&typeof n.data=="string");if(c)i.push(ll(c,e));else if(p.length)i.push(...p.map(l=>ll(l,e)));else{let l=m.filter(f=>f.instancePath===n.instancePath&&f.keyword!=="type"&&f.keyword!=="anyOf");if(l.length&&typeof n.data=="object"&&n.data!==null)i.push(...l.map(f=>ll(f,e)));else{let f=[...new Set(m.filter(u=>u.keyword==="type").map(u=>rm[String(u.params.type)]??""))].filter(Boolean),d=e.locate(n.instancePath);i.push({severity:"error",message:`${cl(n.data)} is not allowed here`+(f.length?`; expected ${f.join(" or ")}`:""),line:d.line,col:d.col,path:n.instancePath})}}}for(let n of t)r.has(n)||i.push(ll(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 cm=sp(rp),Fh=Object.keys(rp.$defs.placement.properties);im("#/$defs/placement",Fh);om("/isodiag",t=>`"isodiag" must be 1 (the format version), got ${t}`);var Dh={scene:"a scene",region:"a region",node:"a node",route:"a route",note:"a note",step:"a step"};sm(t=>{let e=/\/(scenes|regions|nodes|routes|notes|steps)\/\d+$/.exec(t);return e?Dh[e[1].replace(/s$/,"")]??"this item":void 0});am("^[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 pm(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:""}]:cm(t.data)?[]:lm(cm.errors??[],t)}var oo=class extends Error{diags;constructor(e){super(e.filter(s=>s.severity==="error").map(s=>`line ${s.line}: ${s.message}`).join(`
399
+ `)),this.name="CompileError",this.diags=e}};function pl(t,e,s={}){let r=Bh(t,e,s);if(!r.ok&&s.strict==="throw")throw new oo(r.diags);if(!r.ok&&s.strict&&(r.scenes=[]),s.stepMs!==void 0)for(let i of r.scenes)for(let o of i.steps.steps)o.duration=s.stepMs;if(s.resolveVars)for(let i of r.scenes){let o={mode:s.mode??"light",theme:r.theme,css:nr(Xn)+Yi+Hi};i.rendered.svg=Ui(i.rendered.svg,o),i.rendered.variants&&(i.rendered.variants=Object.fromEntries(Object.entries(i.rendered.variants).map(([n,a])=>[n,Ui(a,o)]))),i.rendered.inks={surface:r.theme[o.mode].surface??r.theme.light.surface,control:r.theme[o.mode].control??r.theme.light.control,kinds:Object.fromEntries(Object.entries(r.theme.kinds).map(([n,a])=>[n,r.theme[o.mode][a.color]??a.color]))}}return r}function Bh(t,e,s){let r=ta(t),i=[...r.diags];if(i.some(c=>c.severity==="error"))return{ok:!1,diags:i,catalog:Xn,scenes:[]};let o=pm(r);i.push(...o);let n=r.data;if(o.length){try{let c=Mr(vr(e),n.roles??{},n.kinds??{}),l=o.map(f=>f.path);(Array.isArray(n.scenes)?n.scenes:[]).forEach((f,d)=>{try{let u=Or(f,`/scenes/${d}`,r,c,Xn,n.roles??{});i.push(...u.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:Xn,scenes:[]}}let a=Ca(n,e,Xn,r,t,{snap:s.snap},i),m=0,p=(c,l,f)=>{let d=r.locate(c);a.diags.push({severity:"error",message:l,line:d.line,col:d.col,path:c,...f?{hint:f}:{}}),m++};return a.scenes.forEach((c,l)=>{Oa(c,a.theme);let f=c.raw.ants,d=ks(c.raw)?.ids,u=c.routes.map(h=>h.id);if((d??[]).forEach((h,b)=>{u.includes(h)||p(`/scenes/${l}/ants${Array.isArray(f)?"":"/ids"}/${b}`,`no connector "${h}" in this scene`,u.length?`its connectors: ${u.slice(0,8).join(", ")}${u.length>8?", \u2026":""}`:void 0)}),!c.raw.motion)return;let y={isomotion:1,...c.raw.motion},g=`/scenes/${l}/motion`,x=Br(c,y,{kinds:a.theme.kinds}).diags;for(let h of x){let b=r.locate(g+h.path);a.diags.push({severity:h.severity,message:h.message,line:b.line,col:b.col,path:g+h.path,...h.hint?{hint:h.hint}:{}})}m+=x.length,x.length||(c.motion=y)}),m&&(a.ok=!1,a.diags.sort((c,l)=>c.line-l.line||c.col-l.col)),a}function fm(t,e){let s=pl(t,e.theme,{mode:e.mode??"light",resolveVars:!0,strict:"throw"}),r=s.theme.kinds,i=e.scene===void 0?s.scenes[0]:typeof e.scene=="number"?s.scenes[e.scene]:s.scenes.find(m=>m.id===e.scene);if(!i)throw new Error(`no scene ${JSON.stringify(e.scene)} (there ${s.scenes.length===1?"is":"are"} ${s.scenes.map(m=>m.id).join(", ")})`);let o=e.ants===void 0?ks(i.raw):e.ants===!0?ks(i.raw)??{}:e.ants||void 0;if(e.t===void 0)return o?Aa(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=Br(i,n,{kinds:r});if(!a.ok)throw new Error(a.diags.map(m=>`${m.path}: ${m.message}${m.hint?` (${m.hint})`:""}`).join(`
400
+ `));return Di(i,a.at(e.t,e.ambient===void 0?{}:{ambient:e.ambient}))}export{hf as core,fd as objects,dm as systems,Jd as viewer};