@johnoscott/isometric-engine 0.14.1 → 0.16.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 (81) hide show
  1. package/README.md +1 -1
  2. package/iso-editor.js +249 -203
  3. package/iso-render.js +200 -154
  4. package/iso-systems.js +210 -162
  5. package/isometric-diagram.js +389 -0
  6. package/js/iso-core/index.js +5 -0
  7. package/js/iso-core/mono.js +242 -0
  8. package/js/iso-editor/ui/canvas.js +23 -1
  9. package/js/iso-objects/ants.js +36 -0
  10. package/js/iso-objects/index.js +55 -1
  11. package/js/iso-objects/looks.js +25 -0
  12. package/js/iso-objects/mono-paint.js +96 -0
  13. package/js/iso-objects/motion-builder.js +130 -0
  14. package/js/iso-objects/motion-doc.js +421 -0
  15. package/js/iso-objects/motion-entry.js +34 -0
  16. package/js/iso-objects/motion-schema.js +83 -0
  17. package/js/iso-objects/motion.js +640 -0
  18. package/js/iso-objects/resolve.js +238 -0
  19. package/js/iso-objects/scene.js +15 -13
  20. package/js/iso-objects/timeline.js +593 -0
  21. package/js/iso-systems/compile.js +83 -1
  22. package/js/iso-systems/index.js +4 -1
  23. package/js/iso-systems/render.js +20 -0
  24. package/js/iso-systems/schema.json +40 -0
  25. package/js/iso-viewer/index.js +6 -0
  26. package/js/iso-viewer/page.js +40 -16
  27. package/js/iso-viewer/play.js +340 -0
  28. package/js/iso-viewer/player.js +149 -175
  29. package/js/iso-viewer/transport.js +289 -0
  30. package/package.json +84 -2
  31. package/src/iso-core/index.ts +1 -0
  32. package/src/iso-core/mono.ts +306 -0
  33. package/src/iso-core/theme.ts +2 -1
  34. package/src/iso-editor/ui/canvas.ts +14 -1
  35. package/src/iso-objects/ants.ts +53 -0
  36. package/src/iso-objects/compile.ts +4 -1
  37. package/src/iso-objects/index.ts +16 -1
  38. package/src/iso-objects/looks.ts +21 -0
  39. package/src/iso-objects/mono-paint.ts +97 -0
  40. package/src/iso-objects/motion-builder.ts +79 -0
  41. package/src/iso-objects/motion-doc.ts +309 -0
  42. package/src/iso-objects/motion-entry.ts +13 -0
  43. package/src/iso-objects/motion-schema.ts +55 -0
  44. package/src/iso-objects/motion.ts +617 -0
  45. package/src/iso-objects/resolve.ts +196 -0
  46. package/src/iso-objects/scene.ts +32 -13
  47. package/src/iso-objects/timeline.ts +493 -0
  48. package/src/iso-objects/types.ts +22 -2
  49. package/src/iso-systems/compile.ts +86 -4
  50. package/src/iso-systems/index.ts +4 -1
  51. package/src/iso-systems/render.ts +45 -0
  52. package/src/iso-systems/schema.json +40 -0
  53. package/src/iso-viewer/index.ts +4 -0
  54. package/src/iso-viewer/page.ts +28 -11
  55. package/src/iso-viewer/play.ts +280 -0
  56. package/src/iso-viewer/player.ts +132 -150
  57. package/src/iso-viewer/transport.ts +272 -0
  58. package/types/iso-core/index.d.ts +1 -0
  59. package/types/iso-core/mono.d.ts +61 -0
  60. package/types/iso-core/theme.d.ts +2 -0
  61. package/types/iso-objects/ants.d.ts +34 -0
  62. package/types/iso-objects/compile.d.ts +3 -0
  63. package/types/iso-objects/index.d.ts +16 -1
  64. package/types/iso-objects/looks.d.ts +4 -0
  65. package/types/iso-objects/mono-paint.d.ts +20 -0
  66. package/types/iso-objects/motion-builder.d.ts +105 -0
  67. package/types/iso-objects/motion-doc.d.ts +193 -0
  68. package/types/iso-objects/motion-entry.d.ts +11 -0
  69. package/types/iso-objects/motion-schema.d.ts +594 -0
  70. package/types/iso-objects/motion.d.ts +202 -0
  71. package/types/iso-objects/resolve.d.ts +20 -0
  72. package/types/iso-objects/scene.d.ts +14 -0
  73. package/types/iso-objects/timeline.d.ts +66 -0
  74. package/types/iso-objects/types.d.ts +34 -0
  75. package/types/iso-systems/compile.d.ts +25 -3
  76. package/types/iso-systems/index.d.ts +4 -1
  77. package/types/iso-systems/render.d.ts +25 -0
  78. package/types/iso-viewer/index.d.ts +4 -0
  79. package/types/iso-viewer/play.d.ts +37 -0
  80. package/types/iso-viewer/transport.d.ts +73 -0
  81. package/types/player/isometric-diagram.d.ts +24 -0
package/iso-systems.js CHANGED
@@ -1,145 +1,156 @@
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 Km=Object.defineProperty;var ho=(t,e)=>{for(var s in e)Km(t,s,{get:e[s],enumerable:!0})};var _d={};ho(_d,{Bounds:()=>ci,C:()=>Ct,DiagError:()=>ia,FONTS:()=>wt,Kernel:()=>yr,MONO:()=>tn,S:()=>lt,VEl:()=>Ii,allowed:()=>ic,apply:()=>ai,bubble:()=>go,buildSvg:()=>Rd,center:()=>Hs,colorRef:()=>Un,contrast:()=>Ci,createHash:()=>Cd,depthSort:()=>mi,didYouMean:()=>Vt,distance:()=>sc,envelope:()=>yo,esc:()=>vt,extendTheme:()=>_s,faceFrame:()=>Pl,fileLines:()=>bo,formatDiag:()=>rc,formatDiags:()=>Ad,greyOf:()=>zi,iso:()=>Ne,keyGlyph:()=>wo,loadTheme:()=>Tr,matStr:()=>li,monoOf:()=>ca,n1:()=>bt,parse:()=>oa,parseSvg:()=>oc,placeholderFace:()=>di,pt:()=>Us,screenFaces:()=>gr,screenGlass:()=>fi,serialize:()=>aa,sha256Hex:()=>ac,socketGlyph:()=>xo,tag:()=>Se,termLines:()=>pi,textWidth:()=>Pn,themeCss:()=>ra,themeParts:()=>Ri,vdoc:()=>Id});var jp={sans700_13:{"0":.6787,"1":.5059,"2":.6372,"3":.6631,"4":.6812,"5":.6577,"6":.6777,"7":.6172,"8":.688,"9":.6777," ":.252,"!":.3506,'"':.563,"#":.6655,$:.6655,"%":1.0298,"&":.7388,"'":.3418,"(":.4229,")":.4229,"*":.4785,"+":.6655,",":.3418,"-":.4785,".":.3418,"/":.3286,":":.3418,";":.3418,"<":.6655,"=":.6655,">":.6655,"?":.5513,"@":.9214,A:.7266,B:.6875,C:.7354,D:.7417,E:.6162,F:.5918,G:.7544,H:.7773,I:.3125,J:.5952,K:.7036,L:.5889,M:.9009,N:.7622,O:.7808,P:.668,Q:.7808,R:.6885,S:.6694,T:.6543,U:.7544,V:.7153,W:1.0034,X:.7236,Y:.7021,Z:.6699,"[":.4229,"\\":.3286,"]":.4229,"^":.6655,_:.5845,"`":.4941,a:.584,b:.6455,c:.5815,d:.6455,e:.5952,f:.407,g:.6396,h:.6265,i:.2813,j:.2813,k:.5957,l:.2891,m:.9263,n:.6216,o:.6138,p:.6411,q:.6416,r:.4338,s:.5513,t:.4114,u:.6216,v:.5771,w:.8413,x:.5747,y:.5913,z:.5605,"{":.4229,"|":.2935,"}":.4229,"~":.6655,"\xB7":.3418,"\u2192":.9375,"\u2190":.9375,"\u2191":.8096,"\u2193":.8096,"\u2019":.3418,"\u2018":.3418,"\u201C":.5474,"\u201D":.5474,"\u2026":.9482,"\u2013":.6216,"\u2014":.9045,"\u2715":.7622,"\xD7":.6655,"\u2248":.6655,"\u2264":.6655,"\u2265":.6655,\u00E9:.5952},sans800_15:{"0":.687,"1":.5122,"2":.6406,"3":.6675,"4":.686,"5":.6626,"6":.6836,"7":.6191,"8":.6968,"9":.6836," ":.2344,"!":.3555,'"':.5835,"#":.6694,$:.6694,"%":1.0566,"&":.7397,"'":.3491,"(":.4287,")":.4287,"*":.4731,"+":.6694,",":.3491,"-":.4731,".":.3491,"/":.3286,":":.3491,";":.3491,"<":.6694,"=":.6694,">":.6694,"?":.5562,"@":.9146,A:.7363,B:.6899,C:.7339,D:.7388,E:.6147,F:.5903,G:.749,H:.7813,I:.3198,J:.6064,K:.7104,L:.5879,M:.9019,N:.7612,O:.7759,P:.6709,Q:.7759,R:.6924,S:.6719,T:.6533,U:.7524,V:.7212,W:1.0073,X:.731,Y:.71,Z:.6646,"[":.4287,"\\":.3286,"]":.4287,"^":.6694,_:.5889,"`":.4844,a:.5864,b:.6479,c:.5811,d:.6479,e:.5952,f:.4139,g:.6416,h:.6309,i:.2847,j:.2847,k:.605,l:.2935,m:.937,n:.626,o:.6138,p:.6436,q:.6445,r:.4406,s:.5557,t:.4198,u:.626,v:.5806,w:.856,x:.5835,y:.5996,z:.5601,"{":.4287,"|":.2974,"}":.4287,"~":.6694,"\xB7":.3491,"\u2192":.9404,"\u2190":.9404,"\u2191":.811,"\u2193":.811,"\u2019":.3491,"\u2018":.3491,"\u201C":.5688,"\u201D":.5688,"\u2026":.9883,"\u2013":.626,"\u2014":.9118,"\u2715":.7622,"\xD7":.6694,"\u2248":.6694,"\u2264":.6694,"\u2265":.6694,\u00E9:.5952},sans800_10_5:{"0":.7114,"1":.5366,"2":.665,"3":.6919,"4":.7104,"5":.687,"6":.708,"7":.6436,"8":.7212,"9":.708," ":.2588,"!":.3799,'"':.6079,"#":.6938,$:.6938,"%":1.0811,"&":.7642,"'":.3735,"(":.4531,")":.4531,"*":.4976,"+":.6938,",":.3735,"-":.4976,".":.3735,"/":.353,":":.3735,";":.3735,"<":.6938,"=":.6938,">":.6938,"?":.5806,"@":.939,A:.7607,B:.7144,C:.7583,D:.7632,E:.6392,F:.6147,G:.7734,H:.8057,I:.3442,J:.6309,K:.7349,L:.6123,M:.9263,N:.7856,O:.8003,P:.6953,Q:.8003,R:.7168,S:.6963,T:.6777,U:.7769,V:.7456,W:1.0317,X:.7554,Y:.7344,Z:.689,"[":.4531,"\\":.353,"]":.4531,"^":.6938,_:.6133,"`":.5088,a:.6108,b:.6724,c:.6055,d:.6724,e:.6196,f:.4383,g:.666,h:.6553,i:.3091,j:.3091,k:.6294,l:.3179,m:.9614,n:.6504,o:.6382,p:.668,q:.6689,r:.465,s:.5801,t:.4442,u:.6504,v:.605,w:.8804,x:.6079,y:.624,z:.5845,"{":.4531,"|":.3218,"}":.4531,"~":.6938,"\xB7":.3735,"\u2192":.9648,"\u2190":.9648,"\u2191":.8354,"\u2193":.8354,"\u2019":.3735,"\u2018":.3735,"\u201C":.5933,"\u201D":.5933,"\u2026":1.0127,"\u2013":.6504,"\u2014":.9204,"\u2715":.7622,"\xD7":.6938,"\u2248":.6938,"\u2264":.6938,"\u2265":.6938,\u00E9:.6196},sans600_12:{"0":.6665,"1":.4956,"2":.6299,"3":.6548,"4":.6724,"5":.6484,"6":.668,"7":.6113,"8":.6753,"9":.668," ":.2656,"!":.3413,'"':.5386,"#":.6577,$:.6577,"%":.999,"&":.7334,"'":.3306,"(":.4131,")":.4131,"*":.48,"+":.6577,",":.3306,"-":.48,".":.3306,"/":.3247,":":.3306,";":.3306,"<":.6577,"=":.6577,">":.6577,"?":.5425,"@":.9238,A:.7129,B:.6812,C:.7329,D:.7402,E:.6133,F:.5889,G:.7559,H:.7695,I:.3013,J:.5801,K:.6924,L:.5859,M:.8955,N:.7593,O:.7813,P:.6606,Q:.7813,R:.6807,S:.6626,T:.6514,U:.7524,V:.7056,W:.9956,X:.7124,Y:.6904,Z:.6709,"[":.4131,"\\":.3247,"]":.4131,"^":.6577,_:.5757,"`":.5,a:.5771,b:.6392,c:.5781,d:.6392,e:.5908,f:.3957,g:.6333,h:.6177,i:.2739,j:.2734,k:.582,l:.2808,m:.9116,n:.6128,o:.6099,p:.6348,q:.6348,r:.4232,s:.543,t:.3991,u:.6128,v:.5693,w:.8228,x:.562,y:.5791,z:.5571,"{":.4131,"|":.2856,"}":.4131,"~":.6577,"\xB7":.3306,"\u2192":.9307,"\u2190":.9307,"\u2191":.8037,"\u2193":.8037,"\u2019":.3306,"\u2018":.3306,"\u201C":.522,"\u201D":.522,"\u2026":.9043,"\u2013":.6128,"\u2014":.8957,"\u2715":.7622,"\xD7":.6577,"\u2248":.6577,"\u2264":.6577,"\u2265":.6577,\u00E9:.5908},sans800_12:{"0":.7026,"1":.5278,"2":.6563,"3":.6831,"4":.7017,"5":.6782,"6":.6992,"7":.6348,"8":.7124,"9":.6992," ":.25,"!":.3711,'"':.5991,"#":.6851,$:.6851,"%":1.0723,"&":.7554,"'":.3647,"(":.4443,")":.4443,"*":.4888,"+":.6851,",":.3647,"-":.4888,".":.3647,"/":.3442,":":.3647,";":.3647,"<":.6851,"=":.6851,">":.6851,"?":.5718,"@":.9302,A:.752,B:.7056,C:.7495,D:.7544,E:.6304,F:.606,G:.7646,H:.7969,I:.3354,J:.6221,K:.7261,L:.6035,M:.9175,N:.7769,O:.7915,P:.6865,Q:.7915,R:.708,S:.6875,T:.6689,U:.7681,V:.7368,W:1.0229,X:.7466,Y:.7256,Z:.6802,"[":.4443,"\\":.3442,"]":.4443,"^":.6851,_:.6045,"`":.5,a:.6021,b:.6636,c:.5967,d:.6636,e:.6108,f:.4295,g:.6572,h:.6465,i:.3003,j:.3003,k:.6206,l:.3091,m:.9526,n:.6416,o:.6294,p:.6592,q:.6602,r:.4562,s:.5713,t:.4354,u:.6416,v:.5962,w:.8716,x:.5991,y:.6152,z:.5757,"{":.4443,"|":.313,"}":.4443,"~":.6851,"\xB7":.3647,"\u2192":.9561,"\u2190":.9561,"\u2191":.8267,"\u2193":.8267,"\u2019":.3647,"\u2018":.3647,"\u201C":.5845,"\u201D":.5845,"\u2026":1.0039,"\u2013":.6416,"\u2014":.9173,"\u2715":.7622,"\xD7":.6851,"\u2248":.6851,"\u2264":.6851,"\u2265":.6851,\u00E9:.6108},sans800_11_5:{"0":.7056,"1":.5308,"2":.6592,"3":.686,"4":.7046,"5":.6812,"6":.7021,"7":.6377,"8":.7153,"9":.7021," ":.2529,"!":.374,'"':.6021,"#":.688,$:.688,"%":1.0752,"&":.7583,"'":.3677,"(":.4473,")":.4473,"*":.4917,"+":.688,",":.3677,"-":.4917,".":.3677,"/":.3472,":":.3677,";":.3677,"<":.688,"=":.688,">":.688,"?":.5747,"@":.9331,A:.7549,B:.7085,C:.7524,D:.7573,E:.6333,F:.6089,G:.7676,H:.7998,I:.3384,J:.625,K:.729,L:.6064,M:.9204,N:.7798,O:.7944,P:.6895,Q:.7944,R:.7109,S:.6904,T:.6719,U:.771,V:.7397,W:1.0259,X:.7495,Y:.7285,Z:.6831,"[":.4473,"\\":.3472,"]":.4473,"^":.688,_:.6074,"`":.5029,a:.605,b:.6665,c:.5996,d:.6665,e:.6138,f:.4325,g:.6602,h:.6494,i:.3032,j:.3032,k:.6235,l:.312,m:.9556,n:.6445,o:.6323,p:.6621,q:.6631,r:.4591,s:.5742,t:.4383,u:.6445,v:.5991,w:.8745,x:.6021,y:.6182,z:.5786,"{":.4473,"|":.3159,"}":.4473,"~":.688,"\xB7":.3677,"\u2192":.959,"\u2190":.959,"\u2191":.8296,"\u2193":.8296,"\u2019":.3677,"\u2018":.3677,"\u201C":.5874,"\u201D":.5874,"\u2026":1.0068,"\u2013":.6445,"\u2014":.9183,"\u2715":.7622,"\xD7":.688,"\u2248":.688,"\u2264":.688,"\u2265":.688,\u00E9:.6138},sans400_13:{"0":.624,"1":.458,"2":.5977,"3":.6211,"4":.6377,"5":.6123,"6":.6309,"7":.582,"8":.6328,"9":.6309," ":.2754,"!":.3052,'"':.4717,"#":.624,$:.624,"%":.9194,"&":.7056,"'":.291,"(":.376,")":.376,"*":.4658,"+":.624,",":.291,"-":.4658,".":.291,"/":.2988,":":.291,";":.291,"<":.624,"=":.624,">":.624,"?":.5068,"@":.9121,A:.668,B:.6514,C:.71,D:.7207,E:.5898,F:.5664,G:.7407,H:.7363,I:.2617,J:.5322,K:.6528,L:.562,M:.8682,N:.7363,O:.7656,P:.6294,Q:.7656,R:.6475,S:.6313,T:.6279,U:.7314,V:.668,W:.9619,X:.6729,Y:.6494,Z:.6558,"[":.376,"\\":.2988,"]":.376,"^":.624,_:.5405,"`":.4941,a:.5459,b:.6084,c:.5537,d:.6084,e:.5654,f:.356,g:.6035,h:.5825,i:.2412,j:.2407,k:.5371,l:.2471,m:.8643,n:.5776,o:.585,p:.6045,q:.6035,r:.3843,s:.5083,t:.3574,u:.5776,v:.5361,w:.7686,x:.5186,y:.5371,z:.5332,"{":.376,"|":.2529,"}":.376,"~":.624,"\xB7":.291,"\u2192":.8999,"\u2190":.8999,"\u2191":.7754,"\u2193":.7754,"\u2019":.291,"\u2018":.291,"\u201C":.4531,"\u201D":.4531,"\u2026":.7988,"\u2013":.5776,"\u2014":.872,"\u2715":.7622,"\xD7":.624,"\u2248":.624,"\u2264":.624,"\u2265":.624,\u00E9:.5654},mono400_11:{"0":.6021,"1":.6021,"2":.6021,"3":.6021,"4":.6021,"5":.6021,"6":.6021,"7":.6021,"8":.6021,"9":.6021," ":.6021,"!":.6021,'"':.6021,"#":.6021,$:.6021,"%":.6021,"&":.6021,"'":.6021,"(":.6021,")":.6021,"*":.6021,"+":.6021,",":.6021,"-":.6021,".":.6021,"/":.6021,":":.6021,";":.6021,"<":.6021,"=":.6021,">":.6021,"?":.6021,"@":.6021,A:.6021,B:.6021,C:.6021,D:.6021,E:.6021,F:.6021,G:.6021,H:.6021,I:.6021,J:.6021,K:.6021,L:.6021,M:.6021,N:.6021,O:.6021,P:.6021,Q:.6021,R:.6021,S:.6021,T:.6021,U:.6021,V:.6021,W:.6021,X:.6021,Y:.6021,Z:.6021,"[":.6021,"\\":.6021,"]":.6021,"^":.6021,_:.6021,"`":.6021,a:.6021,b:.6021,c:.6021,d:.6021,e:.6021,f:.6021,g:.6021,h:.6021,i:.6021,j:.6021,k:.6021,l:.6021,m:.6021,n:.6021,o:.6021,p:.6021,q:.6021,r:.6021,s:.6021,t:.6021,u:.6021,v:.6021,w:.6021,x:.6021,y:.6021,z:.6021,"{":.6021,"|":.6021,"}":.6021,"~":.6021,"\xB7":.6021,"\u2192":.6021,"\u2190":.6021,"\u2191":.6021,"\u2193":.6021,"\u2019":.6021,"\u2018":.6021,"\u201C":.6021,"\u201D":.6021,"\u2026":.6021,"\u2013":.6021,"\u2014":.6021,"\u2715":.6021,"\xD7":.6021,"\u2248":.6021,"\u2264":.6021,"\u2265":.6021,\u00E9:.6021},mono600_11:{"0":.6021,"1":.6021,"2":.6021,"3":.6021,"4":.6021,"5":.6021,"6":.6021,"7":.6021,"8":.6021,"9":.6021," ":.6021,"!":.6021,'"':.6021,"#":.6021,$:.6021,"%":.6021,"&":.6021,"'":.6021,"(":.6021,")":.6021,"*":.6021,"+":.6021,",":.6021,"-":.6021,".":.6021,"/":.6021,":":.6021,";":.6021,"<":.6021,"=":.6021,">":.6021,"?":.6021,"@":.6021,A:.6021,B:.6021,C:.6021,D:.6021,E:.6021,F:.6021,G:.6021,H:.6021,I:.6021,J:.6021,K:.6021,L:.6021,M:.6021,N:.6021,O:.6021,P:.6021,Q:.6021,R:.6021,S:.6021,T:.6021,U:.6021,V:.6021,W:.6021,X:.6021,Y:.6021,Z:.6021,"[":.6021,"\\":.6021,"]":.6021,"^":.6021,_:.6021,"`":.6021,a:.6021,b:.6021,c:.6021,d:.6021,e:.6021,f:.6021,g:.6021,h:.6021,i:.6021,j:.6021,k:.6021,l:.6021,m:.6021,n:.6021,o:.6021,p:.6021,q:.6021,r:.6021,s:.6021,t:.6021,u:.6021,v:.6021,w:.6021,x:.6021,y:.6021,z:.6021,"{":.6021,"|":.6021,"}":.6021,"~":.6021,"\xB7":.6021,"\u2192":.6021,"\u2190":.6021,"\u2191":.6021,"\u2193":.6021,"\u2019":.6021,"\u2018":.6021,"\u201C":.6021,"\u201D":.6021,"\u2026":.6021,"\u2013":.6021,"\u2014":.6021,"\u2715":.6021,"\xD7":.6021,"\u2248":.6021,"\u2264":.6021,"\u2265":.6021,\u00E9:.6021}};var lt=34,Ct=Math.cos(Math.PI/6),Ne=(t,e,s=0)=>[(t-e)*Ct*lt,(t+e)*.5*lt-s*lt],bt=t=>{let e=Math.round(t*10)/10;return Object.is(e,-0)?"0":String(e)},Us=t=>`${bt(t[0])},${bt(t[1])}`,vt=t=>t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");function Se(t,e={},s){let r="";for(let i in e){let o=e[i];o==null||o===!1||o===""||(r+=` ${i}="${vt(typeof o=="number"?bt(o):o)}"`)}return s===void 0?`<${t}${r}/>`:`<${t}${r}>${s}</${t}>`}var wt={lbl:{key:"sans700_13",size:13},sub:{key:"mono400_11",size:11},slabname:{key:"sans800_15",size:15,spacing:.12},sm:{key:"sans800_10_5",size:10.5,spacing:.1},floor:{key:"mono600_11",size:11,spacing:.01},say:{key:"sans600_12",size:12},tunname:{key:"sans800_12",size:12,spacing:.14},badge:{key:"sans800_11_5",size:11.5}};function Pn(t,e){let s=jp[e.key],r=e.key.startsWith("mono")?.6:.58,i=0;for(let o of t)i+=s[o]??r;return(i+(e.spacing??0)*[...t].length)*e.size}var ai=(t,e,s)=>[t[0]*e+t[2]*s+t[4],t[1]*e+t[3]*s+t[5]],li=t=>`matrix(${t.map(e=>Math.round(e*1e4)/1e4).join(" ")})`;function Pl(t,e){if(e==="left"){let[i,o]=Ne(t.x0,t.y1,t.z1);return{m:[Ct,.5,0,1,i,o],w:(t.x1-t.x0)*lt,h:(t.z1-t.z0)*lt}}if(e==="right"){let[i,o]=Ne(t.x1,t.y1,t.z1);return{m:[Ct,-.5,0,1,i,o],w:(t.y1-t.y0)*lt,h:(t.z1-t.z0)*lt}}let[s,r]=Ne(t.x0,t.y0,t.z1);return{m:[Ct,.5,-Ct,.5,s,r],w:(t.x1-t.x0)*lt,h:(t.y1-t.y0)*lt}}var ci=class{x0=1/0;y0=1/0;x1=-1/0;y1=-1/0;add(e){e[0]<this.x0&&(this.x0=e[0]),e[0]>this.x1&&(this.x1=e[0]),e[1]<this.y0&&(this.y0=e[1]),e[1]>this.y1&&(this.y1=e[1])}addRect(e,s,r,i){this.add([e,s]),this.add([e+r,s+i])}get empty(){return this.x0===1/0}},yr=class{bounds=new ci;texts=[];planes=[];planePolys=[];defs=new Map;poly(e,s,r={}){let i=e.map(o=>Ne(o[0],o[1],o[2]));return i.forEach(o=>this.bounds.add(o)),Se("polygon",{points:i.map(Us).join(" "),class:s,...r})}line3(e,s,r,i={}){let o=Ne(...e),n=Ne(...s);return this.bounds.add(o),this.bounds.add(n),Se("line",{x1:o[0],y1:o[1],x2:n[0],y2:n[1],class:r,...i})}blockFaces(e){let{x0:s,y0:r,x1:i,y1:o,z0:n,z1:a}=e;return this.poly([[s,o,n],[i,o,n],[i,o,a],[s,o,a]],"lft")+this.poly([[i,r,n],[i,o,n],[i,o,a],[i,r,a]],"rgt")+this.poly([[s,r,a],[i,r,a],[i,o,a],[s,o,a]],"top")}onFace(e,s,r,i){let o=Pl(e,s);for(let[n,a]of[[0,0],[o.w,0],[0,o.h],[o.w,o.h]])this.bounds.add(ai(o.m,n,a));return Se("g",{class:i,transform:li(o.m)},r(o.w,o.h))}onMatrix(e,s,r,i,o){for(let[n,a]of[[0,0],[s,0],[0,r],[s,r]])this.bounds.add(ai(e,n,a));return Se("g",{class:o,transform:li(e)},i(s,r))}text(e,s,r,i,o,n="middle",a={},f){let p=Pn(r,o),l={x:n==="start"?e:n==="end"?e-p:e-p/2,y:s-o.size*.8,w:p,h:o.size*1.05,text:r,owner:f};return this.bounds.addRect(l.x-2,l.y-2,l.w+4,l.h+4),this.texts.push(l),Se("text",{x:e,y:s,class:i,"text-anchor":n==="start"?void 0:n,...a},vt(r))}planeText(e,s,r,i,o="start",n={}){let a=Pn(s,i),f=o==="start"?0:o==="end"?-a:-a/2,p=[[f,-i.size*.8],[f+a,-i.size*.8],[f,i.size*.25],[f+a,i.size*.25]].map(([d,m])=>ai(e,d,m));p.forEach(d=>this.bounds.add(d));let c=p.map(d=>d[0]),l=p.map(d=>d[1]);return this.planePolys.push([p[0],p[1],p[3],p[2]]),this.planes.push({x:Math.min(...c),y:Math.min(...l),w:Math.max(...c)-Math.min(...c),h:Math.max(...l)-Math.min(...l)}),Se("text",{transform:li(e),class:r,"text-anchor":o==="start"?void 0:o,...n},vt(s))}floorText(e,s,r,i,o,n="x",a="start",f={}){let[p,c]=Ne(e,s,r),l=n==="x"?[Ct,.5,-Ct,.5,p,c]:[Ct,-.5,Ct,.5,p,c];return this.planeText(l,i,o,wt.floor,a,f)}faceText(e,s,r,i,o,n,a="left",f="start",p={}){let[c,l]=Ne(e,s,r),d=a==="left"?[Ct,.5,0,1,c,l]:[Ct,-.5,0,1,c,l];return this.planeText(d,i,o,n,f,p)}def(e,s){this.defs.set(e,s)}},Hs=t=>[(t.x0+t.x1)/2,(t.y0+t.y1)/2,t.z1];function pi(t,e,s){let r="";for(let i=0;i<s;i++){let o=e.z1-(e.z1-e.z0)*(.28+i*.2),n=(e.x1-e.x0)*(i===s-1?.35:.62-i*.1);r+=t.line3([e.x0+.35,e.y1,o],[e.x0+.35+n,e.y1,o],"det")}return r}function yo(t,e){let r=e.z1,i=[e.x0+.55,e.y0+.55,r],o=[e.x1-.55,e.y0+.55,r],n=[e.x1-.55,e.y1-.55,r],a=[e.x0+.55,e.y1-.55,r],f=[(e.x0+e.x1)/2,(e.y0+e.y1)/2,r];return t.poly([i,o,n,a],"det")+t.line3(i,f,"det")+t.line3(f,o,"det")}function go(t,e){let r=e.z1,i=t.poly([[e.x0+.55,e.y0+.55,r],[e.x1-.55,e.y0+.55,r],[e.x1-.55,e.y1-.55,r],[e.x0+.55,e.y1-.55,r]],"det");for(let o=1;o<=2;o++){let n=e.y0+.55+(e.y1-e.y0-1.1)*o/3;i+=t.line3([e.x0+.55+.3,n,r],[e.x1-.55-.3-(o===2?.5:0),n,r],"det")}return i}function bo(t,e){let r=e.z1,i=(e.y0+e.y1)/2;return t.line3([e.x0+.3,i-.2,r],[e.x1-.3,i-.2,r],"det")+t.line3([e.x0+.3,i+.2,r],[e.x1-.3-.3,i+.2,r],"det")}function wo(t,e){let s=(e.x0+e.x1)/2,r=(e.y0+e.y1)/2,i=e.z1+.005,o=Math.min(e.x1-e.x0,e.y1-e.y0)*.16,n=[];for(let a=0;a<20;a++){let f=a/20*Math.PI*2;n.push([s-o*1.4+Math.cos(f)*o,r+Math.sin(f)*o,i])}return t.poly(n,"det")+t.line3([s-o*.4,r,i],[s+o*2.2,r,i],"det")+t.line3([s+o*1.7,r,i],[s+o*1.7,r+o*.8,i],"det")}function xo(t,e){let s=(e.x0+e.x1)/2,r=(e.y0+e.y1)/2,i=e.z1+.005,o=Math.min(e.x1-e.x0,e.y1-e.y0)*.28,n=[];for(let a=0;a<24;a++){let f=a/24*Math.PI*2;n.push([s+Math.cos(f)*o,r+Math.sin(f)*o,i])}return t.poly(n,"det sock-hole")}var Ys=(t,e,s,r,i,o=0)=>Se("rect",{class:t,x:e,y:s,width:r,height:i,rx:o||void 0}),gr={terminal(t,e){let s="",r=Math.max(2,Math.floor((e-12)/9));for(let i=0;i<r;i++){let o=10+i*9,n=(t-18)*[.7,.45,.6,.3,.55][i%5];s+=Se("line",{class:"ln",x1:8,y1:o,x2:8+n,y2:o})}return s},chat(t,e){return[[6,.62,"w"],[.3,.58,"m"],[6,.46,"w"],[.42,.5,"m"]].map((r,i)=>{let o=(t-14)*r[1],n=r[0]===6?7:t-7-o;return Ys(r[2],n,8+i*(e-18)/4,o,(e-18)/4-4,3)}).join("")},desktop(t,e){return Ys("wall",5,5,t-10,e-10,2)+Ys("bar",5,5,t-10,6)+Ys("win",t*.5,13,t*.38,e*.42,2)},tiles(t,e){let n=(t-12-5)/3,a=(e-12-2.5*1)/2,f="";for(let p=0;p<2;p++)for(let c=0;c<3;c++){let l=6+c*(n+2.5),d=6+p*(a+2.5);f+=Ys("t",l,d,n,a,1.5),[.3,.52,.74].forEach((m,h)=>{f+=Se("line",{class:"ln",x1:l+2.5,y1:d+a*m,x2:l+2.5+(n-5)*[.8,.5,.65][(h+p+c)%3],y2:d+a*m})})}return f}};function di(t,e){let s=t/2,r=e/2,i=Math.min(t,e)*.22;return Ys("unk",t*.2,e*.2,t*.6,e*.6,2)+Se("path",{class:"unk-q",d:`M${bt(s-i*.5)},${bt(r-i*.45)}a${bt(i*.5)},${bt(i*.5)} 0 1 1 ${bt(i*.5)},${bt(i*.55)}v${bt(i*.3)}`})+Se("circle",{class:"unk-dot",cx:bt(s),cy:bt(r+i*.75),r:bt(Math.max(.8,i*.1))})}function fi(t,e){return Ys("glass",3,3,t-6,e-6,3)}function Zm(t){let e=[Ne(t.x0,t.y0,t.z1),Ne(t.x1,t.y0,t.z0),Ne(t.x0,t.y1,t.z0),Ne(t.x1,t.y1,t.z0),Ne(t.x1,t.y1,t.z1),Ne(t.x0,t.y0,t.z0)],s=e.map(i=>i[0]),r=e.map(i=>i[1]);return[Math.min(...s),Math.min(...r),Math.max(...s),Math.max(...r)]}function Um(t,e){let r=t.x1<=e.x0+1e-6,i=e.x1<=t.x0+1e-6,o=t.y1<=e.y0+1e-6,n=e.y1<=t.y0+1e-6,a=t.z1<=e.z0+1e-6,f=e.z1<=t.z0+1e-6,p=r||o||a,c=i||n||f;return p&&!c?-1:c&&!p?1:0}function mi(t){let e=t.length,s=t.map(p=>Zm(p.box)),r=p=>p.box.x0+p.box.y0+p.box.z0*.01,i=t.map(()=>[]),o=new Array(e).fill(0);for(let p=0;p<e;p++)for(let c=p+1;c<e;c++){let l=s[p],d=s[c];if(l[2]<=d[0]||d[2]<=l[0]||l[3]<=d[1]||d[3]<=l[1])continue;let m=Um(t[p].box,t[c].box);m<0?(i[p].push(c),o[c]++):m>0&&(i[c].push(p),o[p]++)}let n=[],a=t.map((p,c)=>c).filter(p=>!o[p]),f=new Array(e).fill(!1);for(;n.length<e;){if(!a.length){let c=t.map((l,d)=>d).filter(l=>!f[l]).sort((l,d)=>r(t[l])-r(t[d]));a.push(c[0]),o[c[0]]=0}a.sort((c,l)=>r(t[c])-r(t[l])||c-l);let p=a.shift();if(!f[p]){f[p]=!0,n.push(t[p]);for(let c of i[p])!f[c]&&--o[c]===0&&a.push(c)}}return n}var ko=Symbol.for("yaml.alias"),$o=Symbol.for("yaml.document"),Dn=Symbol.for("yaml.map"),Ol=Symbol.for("yaml.pair"),bn=Symbol.for("yaml.scalar"),gs=Symbol.for("yaml.seq"),on=Symbol.for("yaml.node.type"),Bn=t=>!!t&&typeof t=="object"&&t[on]===ko,ss=t=>!!t&&typeof t=="object"&&t[on]===$o,pn=t=>!!t&&typeof t=="object"&&t[on]===Dn,Xe=t=>!!t&&typeof t=="object"&&t[on]===Ol,Ge=t=>!!t&&typeof t=="object"&&t[on]===bn,dn=t=>!!t&&typeof t=="object"&&t[on]===gs;function ct(t){if(t&&typeof t=="object")switch(t[on]){case Dn:case gs:return!0}return!1}function nt(t){if(t&&typeof t=="object")switch(t[on]){case ko:case Dn:case bn:case gs:return!0}return!1}var So=t=>(Ge(t)||ct(t))&&!!t.anchor;var fn=Symbol("break visit"),_p=Symbol("skip children"),rs=Symbol("remove node");function is(t,e){let s=Fp(e);ss(t)?br(null,t.contents,s,Object.freeze([t]))===rs&&(t.contents=null):br(null,t,s,Object.freeze([]))}is.BREAK=fn;is.SKIP=_p;is.REMOVE=rs;function br(t,e,s,r){let i=Dp(t,e,s,r);if(nt(i)||Xe(i))return Bp(t,r,i),br(t,i,s,r);if(typeof i!="symbol"){if(ct(e)){r=Object.freeze(r.concat(e));for(let o=0;o<e.items.length;++o){let n=br(o,e.items[o],s,r);if(typeof n=="number")o=n-1;else{if(n===fn)return fn;n===rs&&(e.items.splice(o,1),o-=1)}}}else if(Xe(e)){r=Object.freeze(r.concat(e));let o=br("key",e.key,s,r);if(o===fn)return fn;o===rs&&(e.key=null);let n=br("value",e.value,s,r);if(n===fn)return fn;n===rs&&(e.value=null)}}return i}async function vo(t,e){let s=Fp(e);ss(t)?await wr(null,t.contents,s,Object.freeze([t]))===rs&&(t.contents=null):await wr(null,t,s,Object.freeze([]))}vo.BREAK=fn;vo.SKIP=_p;vo.REMOVE=rs;async function wr(t,e,s,r){let i=await Dp(t,e,s,r);if(nt(i)||Xe(i))return Bp(t,r,i),wr(t,i,s,r);if(typeof i!="symbol"){if(ct(e)){r=Object.freeze(r.concat(e));for(let o=0;o<e.items.length;++o){let n=await wr(o,e.items[o],s,r);if(typeof n=="number")o=n-1;else{if(n===fn)return fn;n===rs&&(e.items.splice(o,1),o-=1)}}}else if(Xe(e)){r=Object.freeze(r.concat(e));let o=await wr("key",e.key,s,r);if(o===fn)return fn;o===rs&&(e.key=null);let n=await wr("value",e.value,s,r);if(n===fn)return fn;n===rs&&(e.value=null)}}return i}function Fp(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function Dp(t,e,s,r){if(typeof s=="function")return s(t,e,r);if(pn(e))return s.Map?.(t,e,r);if(dn(e))return s.Seq?.(t,e,r);if(Xe(e))return s.Pair?.(t,e,r);if(Ge(e))return s.Scalar?.(t,e,r);if(Bn(e))return s.Alias?.(t,e,r)}function Bp(t,e,s){let r=e[e.length-1];if(ct(r))r.items[t]=s;else if(Xe(r))t==="key"?r.key=s:r.value=s;else if(ss(r))r.contents=s;else{let i=Bn(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}var Hm={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Ym=t=>t.replace(/[!,[\]{}]/g,e=>Hm[e]),os=class t{constructor(e,s){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,s)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,s){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let r=e.trim().split(/[ \t]+/),i=r.shift();switch(i){case"%TAG":{if(r.length!==2&&(s(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[o,n]=r;return this.tags[o]=n,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return s(0,"%YAML directive should contain exactly one part"),!1;let[o]=r;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let n=/^\d+\.\d+$/.test(o);return s(6,`Unsupported YAML version ${o}`,n),!1}}default:return s(0,`Unknown directive ${i}`,!0),!1}}tagName(e,s){if(e==="!")return"!";if(e[0]!=="!")return s(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let n=e.slice(2,-1);return n==="!"||n==="!!"?(s(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&s("Verbatim tags must end with a >"),n)}let[,r,i]=e.match(/^(.*!)([^!]*)$/s);i||s(`The ${e} tag has no suffix`);let o=this.tags[r];if(o)try{return o+decodeURIComponent(i)}catch(n){return s(String(n)),null}return r==="!"?e:(s(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[s,r]of Object.entries(this.tags))if(e.startsWith(r))return s+Ym(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let s=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),i;if(e&&r.length>0&&nt(e.contents)){let o={};is(e.contents,(n,a)=>{nt(a)&&a.tag&&(o[a.tag]=!0)}),i=Object.keys(o)}else i=[];for(let[o,n]of r)o==="!!"&&n==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(n)))&&s.push(`%TAG ${o} ${n}`);return s.join(`
2
+ `)}};os.defaultYaml={explicit:!1,version:"1.2"};os.defaultTags={"!!":"tag:yaml.org,2002:"};function Mo(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let s=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(s)}return!0}function Al(t){let e=new Set;return is(t,{Value(s,r){r.anchor&&e.add(r.anchor)}}),e}function Tl(t,e){for(let s=1;;++s){let r=`${t}${s}`;if(!e.has(r))return r}}function qp(t,e){let s=[],r=new Map,i=null;return{onAnchor:o=>{s.push(o),i??(i=Al(t));let n=Tl(e,i);return i.add(n),n},setAnchors:()=>{for(let o of s){let n=r.get(o);if(typeof n=="object"&&n.anchor&&(Ge(n.node)||ct(n.node)))n.node.anchor=n.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:r}}function Ns(t,e,s,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let i=0,o=r.length;i<o;++i){let n=r[i],a=Ns(t,r,String(i),n);a===void 0?delete r[i]:a!==n&&(r[i]=a)}else if(r instanceof Map)for(let i of Array.from(r.keys())){let o=r.get(i),n=Ns(t,r,i,o);n===void 0?r.delete(i):n!==o&&r.set(i,n)}else if(r instanceof Set)for(let i of Array.from(r)){let o=Ns(t,r,i,i);o===void 0?r.delete(i):o!==i&&(r.delete(i),r.add(o))}else for(let[i,o]of Object.entries(r)){let n=Ns(t,r,i,o);n===void 0?delete r[i]:n!==o&&(r[i]=n)}return t.call(e,s,r)}function qt(t,e,s){if(Array.isArray(t))return t.map((r,i)=>qt(r,String(i),s));if(t&&typeof t.toJSON=="function"){if(!s||!So(t))return t.toJSON(e,s);let r={aliasCount:0,count:1,res:void 0};s.anchors.set(t,r),s.onCreate=o=>{r.res=o,delete s.onCreate};let i=t.toJSON(e,s);return s.onCreate&&s.onCreate(i),i}return typeof t=="bigint"&&!s?.keep?Number(t):t}var Rs=class{constructor(e){Object.defineProperty(this,on,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:s,maxAliasCount:r,onAnchor:i,reviver:o}={}){if(!ss(e))throw new TypeError("A document argument is required");let n={anchors:new Map,doc:e,keep:!0,mapAsMap:s===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},a=qt(this,"",n);if(typeof i=="function")for(let{count:f,res:p}of n.anchors.values())i(p,f);return typeof o=="function"?Ns(o,{"":a},"",a):a}};var bs=class extends Rs{constructor(e){super(ko),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,s){if(s?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let r;s?.aliasResolveCache?r=s.aliasResolveCache:(r=[],is(e,{Node:(o,n)=>{(Bn(n)||So(n))&&r.push(n)}}),s&&(s.aliasResolveCache=r));let i;for(let o of r){if(o===this)break;o.anchor===this.source&&(i=o)}if(i&&s){let{anchors:o,doc:n,maxAliasCount:a}=s,f=o.get(i);if(f||(qt(i,null,s),f=o.get(i)),f?.res===void 0){let p="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(p)}if(a>=0&&(f.count+=1,f.aliasCount===0&&(f.aliasCount=Po(n,i,o)),f.count*f.aliasCount>a)){let p="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(p)}}return i}toJSON(e,s){if(!s)return{source:this.source};let r=this.resolve(s.doc,s);if(!r){let i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(i)}return s.anchors.get(r).res}toString(e,s,r){let i=`*${this.source}`;if(e){if(Mo(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(e.implicitKey)return`${i} `}return i}};function Po(t,e,s){if(Bn(e)){let r=e.resolve(t),i=s&&r&&s.get(r);return i?i.count*i.aliasCount:0}else if(ct(e)){let r=0;for(let i of e.items){let o=Po(t,i,s);o>r&&(r=o)}return r}else if(Xe(e)){let r=Po(t,e.key,s),i=Po(t,e.value,s);return Math.max(r,i)}return 1}var Oo=t=>!t||typeof t!="function"&&typeof t!="object",Re=class extends Rs{constructor(e){super(bn),this.value=e}toJSON(e,s){return s?.keep?this.value:qt(this.value,e,s)}toString(){return String(this.value)}};Re.BLOCK_FOLDED="BLOCK_FOLDED";Re.BLOCK_LITERAL="BLOCK_LITERAL";Re.PLAIN="PLAIN";Re.QUOTE_DOUBLE="QUOTE_DOUBLE";Re.QUOTE_SINGLE="QUOTE_SINGLE";var Wm="tag:yaml.org,2002:";function Jm(t,e,s){if(e){let r=s.filter(o=>o.tag===e),i=r.find(o=>!o.format)??r[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return s.find(r=>r.identify?.(t)&&!r.format)}function ws(t,e,s){if(ss(t)&&(t=t.contents),nt(t))return t;if(Xe(t)){let l=s.schema[Dn].createNode?.(s.schema,null,s);return l.items.push(t),l}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:o,schema:n,sourceObjects:a}=s,f;if(r&&t&&typeof t=="object"){if(f=a.get(t),f)return f.anchor??(f.anchor=i(t)),new bs(f.anchor);f={anchor:null,node:null},a.set(t,f)}e?.startsWith("!!")&&(e=Wm+e.slice(2));let p=Jm(t,e,n.tags);if(!p){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let l=new Re(t);return f&&(f.node=l),l}p=t instanceof Map?n[Dn]:Symbol.iterator in Object(t)?n[gs]:n[Dn]}o&&(o(p),delete s.onTagObj);let c=p?.createNode?p.createNode(s.schema,t,s):typeof p?.nodeClass?.from=="function"?p.nodeClass.from(s.schema,t,s):new Re(t);return e?c.tag=e:p.default||(c.tag=p.tag),f&&(f.node=c),c}function ui(t,e,s){let r=s;for(let i=e.length-1;i>=0;--i){let o=e[i];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let n=[];n[o]=r,r=n}else r=new Map([[o,r]])}return ws(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var kr=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,xr=class extends Rs{constructor(e,s){super(e),Object.defineProperty(this,"schema",{value:s,configurable:!0,enumerable:!1,writable:!0})}clone(e){let s=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(s.schema=e),s.items=s.items.map(r=>nt(r)||Xe(r)?r.clone(e):r),this.range&&(s.range=this.range.slice()),s}addIn(e,s){if(kr(e))this.add(s);else{let[r,...i]=e,o=this.get(r,!0);if(ct(o))o.addIn(i,s);else if(o===void 0&&this.schema)this.set(r,ui(this.schema,i,s));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(e){let[s,...r]=e;if(r.length===0)return this.delete(s);let i=this.get(s,!0);if(ct(i))return i.deleteIn(r);throw new Error(`Expected YAML collection at ${s}. Remaining path: ${r}`)}getIn(e,s){let[r,...i]=e,o=this.get(r,!0);return i.length===0?!s&&Ge(o)?o.value:o:ct(o)?o.getIn(i,s):void 0}hasAllNullValues(e){return this.items.every(s=>{if(!Xe(s))return!1;let r=s.value;return r==null||e&&Ge(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[s,...r]=e;if(r.length===0)return this.has(s);let i=this.get(s,!0);return ct(i)?i.hasIn(r):!1}setIn(e,s){let[r,...i]=e;if(i.length===0)this.set(r,s);else{let o=this.get(r,!0);if(ct(o))o.setIn(i,s);else if(o===void 0&&this.schema)this.set(r,ui(this.schema,i,s));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}};var Vp=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function On(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var as=(t,e,s)=>t.endsWith(`
3
+ `)?On(s,e):s.includes(`
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
+ `+On(s,e):(t.endsWith(" ")?"":" ")+s;var El="flow",Ao="block",hi="quoted";function yi(t,e,s="flow",{indentAtStart:r,lineWidth:i=80,minContentWidth:o=20,onFold:n,onOverflow:a}={}){if(!i||i<0)return t;i<o&&(o=0);let f=Math.max(1+o,1+i-e.length);if(t.length<=f)return t;let p=[],c={},l=i-e.length;typeof r=="number"&&(r>i-Math.max(2,o)?p.push(0):l=i-r);let d,m,h=!1,y=-1,g=-1,k=-1;s===Ao&&(y=Kp(t,y,e.length),y!==-1&&(l=y+f));for(let b;b=t[y+=1];){if(s===hi&&b==="\\"){switch(g=y,t[y+1]){case"x":y+=3;break;case"u":y+=5;break;case"U":y+=9;break;default:y+=1}k=y}if(b===`
6
+ `)s===Ao&&(y=Kp(t,y,e.length)),l=y+e.length+f,d=void 0;else{if(b===" "&&m&&m!==" "&&m!==`
7
+ `&&m!==" "){let x=t[y+1];x&&x!==" "&&x!==`
8
+ `&&x!==" "&&(d=y)}if(y>=l)if(d)p.push(d),l=d+f,d=void 0;else if(s===hi){for(;m===" "||m===" ";)m=b,b=t[y+=1],h=!0;let x=y>k+1?y-2:g-1;if(c[x])return t;p.push(x),c[x]=!0,l=x+f,d=void 0}else h=!0}m=b}if(h&&a&&a(),p.length===0)return t;n&&n();let u=t.slice(0,p[0]);for(let b=0;b<p.length;++b){let x=p[b],w=p[b+1]||t.length;x===0?u=`
9
+ ${e}${t.slice(0,w)}`:(s===hi&&c[x]&&(u+=`${t[x]}\\`),u+=`
10
+ ${e}${t.slice(x+1,w)}`)}return u}function Kp(t,e,s){let r=e,i=e+1,o=t[i];for(;o===" "||o===" ";)if(e<i+s)o=t[++e];else{do o=t[++e];while(o&&o!==`
11
+ `);r=e,i=e+1,o=t[i]}return r}var Eo=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),No=t=>/^(%|---|\.\.\.)/m.test(t);function Xm(t,e,s){if(!e||e<0)return!1;let r=e-s,i=t.length;if(i<=r)return!1;for(let o=0,n=0;o<i;++o)if(t[o]===`
12
+ `){if(o-n>r)return!0;if(n=o+1,i-n<=r)return!1}return!0}function gi(t,e){let s=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return s;let{implicitKey:r}=e,i=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(No(t)?" ":""),n="",a=0;for(let f=0,p=s[f];p;p=s[++f])if(p===" "&&s[f+1]==="\\"&&s[f+2]==="n"&&(n+=s.slice(a,f)+"\\ ",f+=1,a=f,p="\\"),p==="\\")switch(s[f+1]){case"u":{n+=s.slice(a,f);let c=s.substr(f+2,4);switch(c){case"0000":n+="\\0";break;case"0007":n+="\\a";break;case"000b":n+="\\v";break;case"001b":n+="\\e";break;case"0085":n+="\\N";break;case"00a0":n+="\\_";break;case"2028":n+="\\L";break;case"2029":n+="\\P";break;default:c.substr(0,2)==="00"?n+="\\x"+c.substr(2):n+=s.substr(f,6)}f+=5,a=f+1}break;case"n":if(r||s[f+2]==='"'||s.length<i)f+=1;else{for(n+=s.slice(a,f)+`
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[f+2]==="\\"&&s[f+3]==="n"&&s[f+4]!=='"';)n+=`
15
+ `,f+=2;n+=o,s[f+2]===" "&&(n+="\\"),f+=1,a=f+1}break;default:f+=1}return n=a?n+s.slice(a):s,r?n:yi(n,o,hi,Eo(e,!1))}function Nl(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
16
+ `)||/[ \t]\n|\n[ \t]/.test(t))return gi(t,e);let s=e.indent||(No(t)?" ":""),r="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
17
+ ${s}`)+"'";return e.implicitKey?r:yi(r,s,El,Eo(e,!1))}function $r(t,e){let{singleQuote:s}=e.options,r;if(s===!1)r=gi;else{let i=t.includes('"'),o=t.includes("'");i&&!o?r=Nl:o&&!i?r=gi:r=s?Nl:gi}return r(t,e)}var Rl;try{Rl=new RegExp(`(^|(?<!
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{Rl=/\n+(?!\n|$)/g}function To({comment:t,type:e,value:s},r,i,o){let{blockQuote:n,commentString:a,lineWidth:f}=r.options;if(!n||/\n[\t ]+$/.test(s))return $r(s,r);let p=r.indent||(r.forceBlockIndent||No(s)?" ":""),c=n==="literal"?!0:n==="folded"||e===Re.BLOCK_FOLDED?!1:e===Re.BLOCK_LITERAL?!0:!Xm(s,f,p.length);if(!s)return c?`|
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,d;for(d=s.length;d>0;--d){let w=s[d-1];if(w!==`
23
+ `&&w!==" "&&w!==" ")break}let m=s.substring(d),h=m.indexOf(`
24
+ `);h===-1?l="-":s===m||h!==m.length-1?(l="+",o&&o()):l="",m&&(s=s.slice(0,-m.length),m[m.length-1]===`
25
+ `&&(m=m.slice(0,-1)),m=m.replace(Rl,`$&${p}`));let y=!1,g,k=-1;for(g=0;g<s.length;++g){let w=s[g];if(w===" ")y=!0;else if(w===`
26
+ `)k=g;else break}let u=s.substring(0,k<g?k+1:g);u&&(s=s.substring(u.length),u=u.replace(/\n+/g,`$&${p}`));let x=(y?p?"2":"1":"")+l;if(t&&(x+=" "+a(t.replace(/ ?[\r\n]+/g," ")),i&&i()),!c){let w=s.replace(/\n+/g,`
27
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${p}`),$=!1,v=Eo(r,!0);n!=="folded"&&e!==Re.BLOCK_FOLDED&&(v.onOverflow=()=>{$=!0});let O=yi(`${u}${w}${m}`,p,Ao,v);if(!$)return`>${x}
28
+ ${p}${O}`}return s=s.replace(/\n+/g,`$&${p}`),`|${x}
29
+ ${p}${u}${s}${m}`}function Qm(t,e,s,r){let{type:i,value:o}=t,{actualString:n,implicitKey:a,indent:f,indentStep:p,inFlow:c}=e;if(a&&o.includes(`
30
+ `)||c&&/[[\]{},]/.test(o))return $r(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||c||!o.includes(`
31
+ `)?$r(o,e):To(t,e,s,r);if(!a&&!c&&i!==Re.PLAIN&&o.includes(`
32
+ `))return To(t,e,s,r);if(No(o)){if(f==="")return e.forceBlockIndent=!0,To(t,e,s,r);if(a&&f===p)return $r(o,e)}let l=o.replace(/\n+/g,`$&
33
+ ${f}`);if(n){let d=y=>y.default&&y.tag!=="tag:yaml.org,2002:str"&&y.test?.test(l),{compat:m,tags:h}=e.doc.schema;if(h.some(d)||m?.some(d))return $r(o,e)}return a?l:yi(l,f,El,Eo(e,!1))}function Ws(t,e,s,r){let{implicitKey:i,inFlow:o}=e,n=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==Re.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(n.value)&&(a=Re.QUOTE_DOUBLE);let f=c=>{switch(c){case Re.BLOCK_FOLDED:case Re.BLOCK_LITERAL:return i||o?$r(n.value,e):To(n,e,s,r);case Re.QUOTE_DOUBLE:return gi(n.value,e);case Re.QUOTE_SINGLE:return Nl(n.value,e);case Re.PLAIN:return Qm(n,e,s,r);default:return null}},p=f(a);if(p===null){let{defaultKeyType:c,defaultStringType:l}=e.options,d=i&&c||l;if(p=f(d),p===null)throw new Error(`Unsupported default string type ${d}`)}return p}function Ro(t,e){let s=Object.assign({blockQuote:!0,commentString:Vp,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),r;switch(s.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:t,flowCollectionPadding:s.flowCollectionPadding?" ":"",indent:"",indentStep:typeof s.indent=="number"?" ".repeat(s.indent):" ",inFlow:r,options:s}}function eu(t,e){if(e.tag){let i=t.filter(o=>o.tag===e.tag);if(i.length>0)return i.find(o=>o.format===e.format)??i[0]}let s,r;if(Ge(e)){r=e.value;let i=t.filter(o=>o.identify?.(r));if(i.length>1){let o=i.filter(n=>n.test);o.length>0&&(i=o)}s=i.find(o=>o.format===e.format)??i.find(o=>!o.format)}else r=e,s=t.find(i=>i.nodeClass&&r instanceof i.nodeClass);if(!s){let i=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${i} value`)}return s}function tu(t,e,{anchors:s,doc:r}){if(!r.directives)return"";let i=[],o=(Ge(t)||ct(t))&&t.anchor;o&&Mo(o)&&(s.add(o),i.push(`&${o}`));let n=t.tag??(e.default?null:e.tag);return n&&i.push(r.directives.tagString(n)),i.join(" ")}function xs(t,e,s,r){if(Xe(t))return t.toString(e,s,r);if(Bn(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i,o=nt(t)?t:e.doc.createNode(t,{onTagObj:f=>i=f});i??(i=eu(e.doc.schema.tags,o));let n=tu(o,i,e);n.length>0&&(e.indentAtStart=(e.indentAtStart??0)+n.length+1);let a=typeof i.stringify=="function"?i.stringify(o,e,s,r):Ge(o)?Ws(o,e,s,r):o.toString(e,s,r);return n?Ge(o)||a[0]==="{"||a[0]==="["?`${n} ${a}`:`${n}
34
+ ${e.indent}${a}`:a}function Gp({key:t,value:e},s,r,i){let{allNullValues:o,doc:n,indent:a,indentStep:f,options:{commentString:p,indentSeq:c,simpleKeys:l}}=s,d=nt(t)&&t.comment||null;if(l){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(ct(t)||!nt(t)&&typeof t=="object"){let v="With simple keys, collection cannot be used as a key value";throw new Error(v)}}let m=!l&&(!t||d&&e==null&&!s.inFlow||ct(t)||(Ge(t)?t.type===Re.BLOCK_FOLDED||t.type===Re.BLOCK_LITERAL:typeof t=="object"));s=Object.assign({},s,{allNullValues:!1,implicitKey:!m&&(l||!o),indent:a+f});let h=!1,y=!1,g=xs(t,s,()=>h=!0,()=>y=!0);if(!m&&!s.inFlow&&g.length>1024){if(l)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");m=!0}if(s.inFlow){if(o||e==null)return h&&r&&r(),g===""?"?":m?`? ${g}`:g}else if(o&&!l||e==null&&m)return g=`? ${g}`,d&&!h?g+=as(g,s.indent,p(d)):y&&i&&i(),g;h&&(d=null),m?(d&&(g+=as(g,s.indent,p(d))),g=`? ${g}
35
+ ${a}:`):(g=`${g}:`,d&&(g+=as(g,s.indent,p(d))));let k,u,b;nt(e)?(k=!!e.spaceBefore,u=e.commentBefore,b=e.comment):(k=!1,u=null,b=null,e&&typeof e=="object"&&(e=n.createNode(e))),s.implicitKey=!1,!m&&!d&&Ge(e)&&(s.indentAtStart=g.length+1),y=!1,!c&&f.length>=2&&!s.inFlow&&!m&&dn(e)&&!e.flow&&!e.tag&&!e.anchor&&(s.indent=s.indent.substring(2));let x=!1,w=xs(e,s,()=>x=!0,()=>y=!0),$=" ";if(d||k||u){if($=k?`
36
+ `:"",u){let v=p(u);$+=`
37
+ ${On(v,s.indent)}`}w===""&&!s.inFlow?$===`
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}`:`
40
+ `):$+=`
41
+ ${s.indent}`}else if(!m&&ct(e)){let v=w[0],O=w.indexOf(`
42
+ `),C=O!==-1,A=s.inFlow??e.flow??e.items.length===0;if(C||!A){let R=!1;if(C&&(v==="&"||v==="!")){let M=w.indexOf(" ");v==="&"&&M!==-1&&M<O&&w[M+1]==="!"&&(M=w.indexOf(" ",M+1)),(M===-1||O<M)&&(R=!0)}R||($=`
43
+ ${s.indent}`)}}else(w===""||w[0]===`
44
+ `)&&($="");return g+=$+w,s.inFlow?x&&r&&r():b&&!x?g+=as(g,s.indent,p(b)):y&&i&&i(),g}function Io(t,e){(t==="debug"||t==="warn")&&console.warn(e)}var zo="<<",qn={identify:t=>t===zo||typeof t=="symbol"&&t.description===zo,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Re(Symbol(zo)),{addToJSMap:zl}),stringify:()=>zo},Zp=(t,e)=>(qn.identify(e)||Ge(e)&&(!e.type||e.type===Re.PLAIN)&&qn.identify(e.value))&&t?.doc.schema.tags.some(s=>s.tag===qn.tag&&s.default);function zl(t,e,s){let r=Up(t,s);if(dn(r))for(let i of r.items)Il(t,e,i);else if(Array.isArray(r))for(let i of r)Il(t,e,i);else Il(t,e,r)}function Il(t,e,s){let r=Up(t,s);if(!pn(r))throw new Error("Merge sources must be maps or map aliases");let i=r.toJSON(null,t,Map);for(let[o,n]of i)e instanceof Map?e.has(o)||e.set(o,n):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:n,writable:!0,enumerable:!0,configurable:!0});return e}function Up(t,e){return t&&Bn(e)?e.resolve(t.doc,t):e}function Co(t,e,{key:s,value:r}){if(nt(s)&&s.addToJSMap)s.addToJSMap(t,e,r);else if(Zp(t,s))zl(t,e,r);else{let i=qt(s,"",t);if(e instanceof Map)e.set(i,qt(r,i,t));else if(e instanceof Set)e.add(i);else{let o=nu(s,i,t),n=qt(r,o,t);o in e?Object.defineProperty(e,o,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[o]=n}}return e}function nu(t,e,s){if(e===null)return"";if(typeof e!="object")return String(e);if(nt(t)&&s?.doc){let r=Ro(s.doc,{});r.anchors=new Set;for(let o of s.anchors.keys())r.anchors.add(o.anchor);r.inFlow=!0,r.inStringifyKey=!0;let i=t.toString(r);if(!s.mapKeyWarned){let o=JSON.stringify(i);o.length>40&&(o=o.substring(0,36)+'..."'),Io(s.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),s.mapKeyWarned=!0}return i}return JSON.stringify(e)}function Sr(t,e,s){let r=ws(t,void 0,s),i=ws(e,void 0,s);return new Et(r,i)}var Et=class t{constructor(e,s=null){Object.defineProperty(this,on,{value:Ol}),this.key=e,this.value=s}clone(e){let{key:s,value:r}=this;return nt(s)&&(s=s.clone(e)),nt(r)&&(r=r.clone(e)),new t(s,r)}toJSON(e,s){let r=s?.mapAsMap?new Map:{};return Co(s,r,this)}toString(e,s,r){return e?.doc?Gp(this,e,s,r):JSON.stringify(this)}};function Lo(t,e,s){return(e.inFlow??t.flow?ru:su)(t,e,s)}function su({comment:t,items:e},s,{blockItemPrefix:r,flowChars:i,itemIndent:o,onChompKeep:n,onComment:a}){let{indent:f,options:{commentString:p}}=s,c=Object.assign({},s,{indent:o,type:null}),l=!1,d=[];for(let h=0;h<e.length;++h){let y=e[h],g=null;if(nt(y))!l&&y.spaceBefore&&d.push(""),jo(s,d,y.commentBefore,l),y.comment&&(g=y.comment);else if(Xe(y)){let u=nt(y.key)?y.key:null;u&&(!l&&u.spaceBefore&&d.push(""),jo(s,d,u.commentBefore,l))}l=!1;let k=xs(y,c,()=>g=null,()=>l=!0);g&&(k+=as(k,o,p(g))),l&&g&&(l=!1),d.push(r+k)}let m;if(d.length===0)m=i.start+i.end;else{m=d[0];for(let h=1;h<d.length;++h){let y=d[h];m+=y?`
45
+ ${f}${y}`:`
46
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}`:`
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}
47
+ `+On(p(t),f),a&&a()):l&&n&&n(),m}function ru({items:t},e,{flowChars:s,itemIndent:r}){let{indent:i,indentStep:o,flowCollectionPadding:n,options:{commentString:a}}=e;r+=o;let f=Object.assign({},e,{indent:r,inFlow:!0,type:null}),p=!1,c=0,l=[];for(let h=0;h<t.length;++h){let y=t[h],g=null;if(nt(y))y.spaceBefore&&l.push(""),jo(e,l,y.commentBefore,!1),y.comment&&(g=y.comment);else if(Xe(y)){let u=nt(y.key)?y.key:null;u&&(u.spaceBefore&&l.push(""),jo(e,l,u.commentBefore,!1),u.comment&&(p=!0));let b=nt(y.value)?y.value:null;b?(b.comment&&(g=b.comment),b.commentBefore&&(p=!0)):y.value==null&&u?.comment&&(g=u.comment)}g&&(p=!0);let k=xs(y,f,()=>g=null);p||(p=l.length>c||k.includes(`
48
+ `)),h<t.length-1?k+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(p||(p=l.reduce((u,b)=>u+b.length+2,2)+(k.length+2)>e.options.lineWidth)),p&&(k+=",")),g&&(k+=as(k,r,a(g))),l.push(k),c=l.length}let{start:d,end:m}=s;if(l.length===0)return d+m;if(!p){let h=l.reduce((y,g)=>y+g.length+2,2);p=e.options.lineWidth>0&&h>e.options.lineWidth}if(p){let h=d;for(let y of l)h+=y?`
49
+ ${o}${i}${y}`:`
50
+ `;return`${h}
51
+ ${i}${m}`}else return`${d}${n}${l.join(" ")}${n}${m}`}function jo({indent:t,options:{commentString:e}},s,r,i){if(r&&i&&(r=r.replace(/^\n+/,"")),r){let o=On(e(r),t);s.push(o.trimStart())}}function Is(t,e){let s=Ge(e)?e.value:e;for(let r of t)if(Xe(r)&&(r.key===e||r.key===s||Ge(r.key)&&r.key.value===s))return r}var jt=class extends xr{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Dn,e),this.items=[]}static from(e,s,r){let{keepUndefined:i,replacer:o}=r,n=new this(e),a=(f,p)=>{if(typeof o=="function")p=o.call(s,f,p);else if(Array.isArray(o)&&!o.includes(f))return;(p!==void 0||i)&&n.items.push(Sr(f,p,r))};if(s instanceof Map)for(let[f,p]of s)a(f,p);else if(s&&typeof s=="object")for(let f of Object.keys(s))a(f,s[f]);return typeof e.sortMapEntries=="function"&&n.items.sort(e.sortMapEntries),n}add(e,s){let r;Xe(e)?r=e:!e||typeof e!="object"||!("key"in e)?r=new Et(e,e?.value):r=new Et(e.key,e.value);let i=Is(this.items,r.key),o=this.schema?.sortMapEntries;if(i){if(!s)throw new Error(`Key ${r.key} already set`);Ge(i.value)&&Oo(r.value)?i.value.value=r.value:i.value=r.value}else if(o){let n=this.items.findIndex(a=>o(r,a)<0);n===-1?this.items.push(r):this.items.splice(n,0,r)}else this.items.push(r)}delete(e){let s=Is(this.items,e);return s?this.items.splice(this.items.indexOf(s),1).length>0:!1}get(e,s){let i=Is(this.items,e)?.value;return(!s&&Ge(i)?i.value:i)??void 0}has(e){return!!Is(this.items,e)}set(e,s){this.add(new Et(e,s),!0)}toJSON(e,s,r){let i=r?new r:s?.mapAsMap?new Map:{};s?.onCreate&&s.onCreate(i);for(let o of this.items)Co(s,i,o);return i}toString(e,s,r){if(!e)return JSON.stringify(this);for(let i of this.items)if(!Xe(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Lo(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:s})}};var Vn={collection:"map",default:!0,nodeClass:jt,tag:"tag:yaml.org,2002:map",resolve(t,e){return pn(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,s)=>jt.from(t,e,s)};var Qt=class extends xr{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(gs,e),this.items=[]}add(e){this.items.push(e)}delete(e){let s=_o(e);return typeof s!="number"?!1:this.items.splice(s,1).length>0}get(e,s){let r=_o(e);if(typeof r!="number")return;let i=this.items[r];return!s&&Ge(i)?i.value:i}has(e){let s=_o(e);return typeof s=="number"&&s<this.items.length}set(e,s){let r=_o(e);if(typeof r!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[r];Ge(i)&&Oo(s)?i.value=s:this.items[r]=s}toJSON(e,s){let r=[];s?.onCreate&&s.onCreate(r);let i=0;for(let o of this.items)r.push(qt(o,String(i++),s));return r}toString(e,s,r){return e?Lo(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:r,onComment:s}):JSON.stringify(this)}static from(e,s,r){let{replacer:i}=r,o=new this(e);if(s&&Symbol.iterator in Object(s)){let n=0;for(let a of s){if(typeof i=="function"){let f=s instanceof Set?a:String(n++);a=i.call(s,f,a)}o.items.push(ws(a,void 0,r))}}return o}};function _o(t){let e=Ge(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}var Kn={collection:"seq",default:!0,nodeClass:Qt,tag:"tag:yaml.org,2002:seq",resolve(t,e){return dn(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,s)=>Qt.from(t,e,s)};var zs={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,s,r){return e=Object.assign({actualString:!0},e),Ws(t,e,s,r)}};var Js={identify:t=>t==null,createNode:()=>new Re(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Re(null),stringify:({source:t},e)=>typeof t=="string"&&Js.test.test(t)?t:e.options.nullStr};var bi={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Re(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},s){if(t&&bi.test.test(t)){let r=t[0]==="t"||t[0]==="T";if(e===r)return t}return e?s.options.trueStr:s.options.falseStr}};function en({format:t,minFractionDigits:e,tag:s,value:r}){if(typeof r=="bigint")return String(r);let i=typeof r=="number"?r:Number(r);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(r,-0)?"-0":JSON.stringify(r);if(!t&&e&&(!s||s==="tag:yaml.org,2002:float")&&/^-?\d/.test(o)&&!o.includes("e")){let n=o.indexOf(".");n<0&&(n=o.length,o+=".");let a=e-(o.length-n-1);for(;a-- >0;)o+="0"}return o}var Fo={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:en},Do={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():en(t)}},Bo={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new Re(parseFloat(t)),s=t.indexOf(".");return s!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-s-1),e},stringify:en};var qo=t=>typeof t=="bigint"||Number.isInteger(t),Cl=(t,e,s,{intAsBigInt:r})=>r?BigInt(t):parseInt(t.substring(e),s);function Hp(t,e,s){let{value:r}=t;return qo(r)&&r>=0?s+r.toString(e):en(t)}var Vo={identify:t=>qo(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,s)=>Cl(t,2,8,s),stringify:t=>Hp(t,8,"0o")},Ko={identify:qo,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,s)=>Cl(t,0,10,s),stringify:en},Go={identify:t=>qo(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,s)=>Cl(t,2,16,s),stringify:t=>Hp(t,16,"0x")};var Yp=[Vn,Kn,zs,Js,bi,Vo,Ko,Go,Fo,Do,Bo];function Wp(t){return typeof t=="bigint"||Number.isInteger(t)}var Zo=({value:t})=>JSON.stringify(t),iu=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Zo},{identify:t=>t==null,createNode:()=>new Re(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Zo},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Zo},{identify:Wp,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:s})=>s?BigInt(t):parseInt(t,10),stringify:({value:t})=>Wp(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:Zo}],ou={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Jp=[Vn,Kn].concat(iu,ou);var wi={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof atob=="function"){let s=atob(t.replace(/[\n\r]/g,"")),r=new Uint8Array(s.length);for(let i=0;i<s.length;++i)r[i]=s.charCodeAt(i);return r}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:s},r,i,o){if(!s)return"";let n=s,a;if(typeof btoa=="function"){let f="";for(let p=0;p<n.length;++p)f+=String.fromCharCode(n[p]);a=btoa(f)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=Re.BLOCK_LITERAL),e!==Re.QUOTE_DOUBLE){let f=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),p=Math.ceil(a.length/f),c=new Array(p);for(let l=0,d=0;l<p;++l,d+=f)c[l]=a.substr(d,f);a=c.join(e===Re.BLOCK_LITERAL?`
52
+ `:" ")}return Ws({comment:t,type:e,value:a},r,i,o)}};function jl(t,e){if(dn(t))for(let s=0;s<t.items.length;++s){let r=t.items[s];if(!Xe(r)){if(pn(r)){r.items.length>1&&e("Each pair must have its own sequence indicator");let i=r.items[0]||new Et(new Re(null));if(r.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${r.commentBefore}
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]=Xe(r)?r:new Et(r)}}else e("Expected a sequence for this tag");return t}function Ll(t,e,s){let{replacer:r}=s,i=new Qt(t);i.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let n of e){typeof r=="function"&&(n=r.call(e,String(o++),n));let a,f;if(Array.isArray(n))if(n.length===2)a=n[0],f=n[1];else throw new TypeError(`Expected [key, value] tuple: ${n}`);else if(n&&n instanceof Object){let p=Object.keys(n);if(p.length===1)a=p[0],f=n[a];else throw new TypeError(`Expected tuple with one key, not ${p.length} keys`)}else a=n;i.items.push(Sr(a,f,s))}return i}var xi={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:jl,createNode:Ll};var vr=class t extends Qt{constructor(){super(),this.add=jt.prototype.add.bind(this),this.delete=jt.prototype.delete.bind(this),this.get=jt.prototype.get.bind(this),this.has=jt.prototype.has.bind(this),this.set=jt.prototype.set.bind(this),this.tag=t.tag}toJSON(e,s){if(!s)return super.toJSON(e);let r=new Map;s?.onCreate&&s.onCreate(r);for(let i of this.items){let o,n;if(Xe(i)?(o=qt(i.key,"",s),n=qt(i.value,o,s)):o=qt(i,"",s),r.has(o))throw new Error("Ordered maps must not include duplicate keys");r.set(o,n)}return r}static from(e,s,r){let i=Ll(e,s,r),o=new this;return o.items=i.items,o}};vr.tag="tag:yaml.org,2002:omap";var ki={collection:"seq",identify:t=>t instanceof Map,nodeClass:vr,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let s=jl(t,e),r=[];for(let{key:i}of s.items)Ge(i)&&(r.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):r.push(i.value));return Object.assign(new vr,s)},createNode:(t,e,s)=>vr.from(t,e,s)};function Xp({value:t,source:e},s){return e&&(t?_l:Fl).test.test(e)?e:t?s.options.trueStr:s.options.falseStr}var _l={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Re(!0),stringify:Xp},Fl={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Re(!1),stringify:Xp};var Qp={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:en},ed={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():en(t)}},td={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new Re(parseFloat(t.replace(/_/g,""))),s=t.indexOf(".");if(s!==-1){let r=t.substring(s+1).replace(/_/g,"");r[r.length-1]==="0"&&(e.minFractionDigits=r.length)}return e},stringify:en};var $i=t=>typeof t=="bigint"||Number.isInteger(t);function Uo(t,e,s,{intAsBigInt:r}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),r){switch(s){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let n=BigInt(t);return i==="-"?BigInt(-1)*n:n}let o=parseInt(t,s);return i==="-"?-1*o:o}function Dl(t,e,s){let{value:r}=t;if($i(r)){let i=r.toString(e);return r<0?"-"+s+i.substr(1):s+i}return en(t)}var nd={identify:$i,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,s)=>Uo(t,2,2,s),stringify:t=>Dl(t,2,"0b")},sd={identify:$i,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,s)=>Uo(t,1,8,s),stringify:t=>Dl(t,8,"0")},rd={identify:$i,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,s)=>Uo(t,0,10,s),stringify:en},id={identify:$i,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,s)=>Uo(t,2,16,s),stringify:t=>Dl(t,16,"0x")};var Mr=class t extends jt{constructor(e){super(e),this.tag=t.tag}add(e){let s;Xe(e)?s=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?s=new Et(e.key,null):s=new Et(e,null),Is(this.items,s.key)||this.items.push(s)}get(e,s){let r=Is(this.items,e);return!s&&Xe(r)?Ge(r.key)?r.key.value:r.key:r}set(e,s){if(typeof s!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof s}`);let r=Is(this.items,e);r&&!s?this.items.splice(this.items.indexOf(r),1):!r&&s&&this.items.push(new Et(e))}toJSON(e,s){return super.toJSON(e,s,Set)}toString(e,s,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),s,r);throw new Error("Set items must all have null values")}static from(e,s,r){let{replacer:i}=r,o=new this(e);if(s&&Symbol.iterator in Object(s))for(let n of s)typeof i=="function"&&(n=i.call(s,n,n)),o.items.push(Sr(n,null,r));return o}};Mr.tag="tag:yaml.org,2002:set";var Si={collection:"map",identify:t=>t instanceof Set,nodeClass:Mr,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,s)=>Mr.from(t,e,s),resolve(t,e){if(pn(t)){if(t.hasAllNullValues(!0))return Object.assign(new Mr,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};function Bl(t,e){let s=t[0],r=s==="-"||s==="+"?t.substring(1):t,i=n=>e?BigInt(n):Number(n),o=r.replace(/_/g,"").split(":").reduce((n,a)=>n*i(60)+i(a),i(0));return s==="-"?i(-1)*o:o}function od(t){let{value:e}=t,s=n=>n;if(typeof e=="bigint")s=n=>BigInt(n);else if(isNaN(e)||!isFinite(e))return en(t);let r="";e<0&&(r="-",e*=s(-1));let i=s(60),o=[e%i];return e<60?o.unshift(0):(e=(e-o[0])/i,o.unshift(e%i),e>=60&&(e=(e-o[0])/i,o.unshift(e))),r+o.map(n=>String(n).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Ho={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:s})=>Bl(t,s),stringify:od},Yo={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>Bl(t,!1),stringify:od},Pr={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(Pr.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,s,r,i,o,n,a]=e.map(Number),f=e[7]?Number((e[7]+"00").substr(1,3)):0,p=Date.UTC(s,r-1,i,o||0,n||0,a||0,f),c=e[8];if(c&&c!=="Z"){let l=Bl(c,!1);Math.abs(l)<30&&(l*=60),p-=6e4*l}return new Date(p)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};var ql=[Vn,Kn,zs,Js,_l,Fl,nd,sd,rd,id,Qp,ed,td,wi,qn,ki,xi,Si,Ho,Yo,Pr];var ad=new Map([["core",Yp],["failsafe",[Vn,Kn,zs]],["json",Jp],["yaml11",ql],["yaml-1.1",ql]]),ld={binary:wi,bool:bi,float:Bo,floatExp:Do,floatNaN:Fo,floatTime:Yo,int:Ko,intHex:Go,intOct:Vo,intTime:Ho,map:Vn,merge:qn,null:Js,omap:ki,pairs:xi,seq:Kn,set:Si,timestamp:Pr},cd={"tag:yaml.org,2002:binary":wi,"tag:yaml.org,2002:merge":qn,"tag:yaml.org,2002:omap":ki,"tag:yaml.org,2002:pairs":xi,"tag:yaml.org,2002:set":Si,"tag:yaml.org,2002:timestamp":Pr};function Wo(t,e,s){let r=ad.get(e);if(r&&!t)return s&&!r.includes(qn)?r.concat(qn):r.slice();let i=r;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(ad.keys()).filter(n=>n!=="yaml11").map(n=>JSON.stringify(n)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)i=i.concat(o);else typeof t=="function"&&(i=t(i.slice()));return s&&(i=i.concat(qn)),i.reduce((o,n)=>{let a=typeof n=="string"?ld[n]:n;if(!a){let f=JSON.stringify(n),p=Object.keys(ld).map(c=>JSON.stringify(c)).join(", ");throw new Error(`Unknown custom tag ${f}; use one of ${p}`)}return o.includes(a)||o.push(a),o},[])}var au=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,vi=class t{constructor({compat:e,customTags:s,merge:r,resolveKnownTags:i,schema:o,sortMapEntries:n,toStringDefaults:a}){this.compat=Array.isArray(e)?Wo(e,"compat"):e?Wo(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?cd:{},this.tags=Wo(s,this.name,r),this.toStringOptions=a??null,Object.defineProperty(this,Dn,{value:Vn}),Object.defineProperty(this,bn,{value:zs}),Object.defineProperty(this,gs,{value:Kn}),this.sortMapEntries=typeof n=="function"?n:n===!0?au:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};function pd(t,e){let s=[],r=e.directives===!0;if(e.directives!==!1&&t.directives){let f=t.directives.toString(t);f?(s.push(f),r=!0):t.directives.docStart&&(r=!0)}r&&s.push("---");let i=Ro(t,e),{commentString:o}=i.options;if(t.commentBefore){s.length!==1&&s.unshift("");let f=o(t.commentBefore);s.unshift(On(f,""))}let n=!1,a=null;if(t.contents){if(nt(t.contents)){if(t.contents.spaceBefore&&r&&s.push(""),t.contents.commentBefore){let c=o(t.contents.commentBefore);s.push(On(c,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let f=a?void 0:()=>n=!0,p=xs(t.contents,i,()=>a=null,f);a&&(p+=as(p,"",o(a))),(p[0]==="|"||p[0]===">")&&s[s.length-1]==="---"?s[s.length-1]=`--- ${p}`:s.push(p)}else s.push(xs(t.contents,i));if(t.directives?.docEnd)if(t.comment){let f=o(t.comment);f.includes(`
55
+ `)?(s.push("..."),s.push(On(f,""))):s.push(`... ${f}`)}else s.push("...");else{let f=t.comment;f&&n&&(f=f.replace(/^\n+/,"")),f&&((!n||a)&&s[s.length-1]!==""&&s.push(""),s.push(On(o(f),"")))}return s.join(`
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 Cs=class t{constructor(e,s,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,on,{value:$o});let i=null;typeof s=="function"||Array.isArray(s)?i=s:r===void 0&&s&&(r=s,s=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=o;let{version:n}=o;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(n=this.directives.yaml.version)):this.directives=new os({version:n}),this.setSchema(n,r),this.contents=e===void 0?null:this.createNode(e,i,r)}clone(){let e=Object.create(t.prototype,{[on]:{value:$o}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=nt(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Or(this.contents)&&this.contents.add(e)}addIn(e,s){Or(this.contents)&&this.contents.addIn(e,s)}createAlias(e,s){if(!e.anchor){let r=Al(this);e.anchor=!s||r.has(s)?Tl(s||"a",r):s}return new bs(e.anchor)}createNode(e,s,r){let i;if(typeof s=="function")e=s.call({"":e},"",e),i=s;else if(Array.isArray(s)){let g=u=>typeof u=="number"||u instanceof String||u instanceof Number,k=s.filter(g).map(String);k.length>0&&(s=s.concat(k)),i=s}else r===void 0&&s&&(r=s,s=void 0);let{aliasDuplicateObjects:o,anchorPrefix:n,flow:a,keepUndefined:f,onTagObj:p,tag:c}=r??{},{onAnchor:l,setAnchors:d,sourceObjects:m}=qp(this,n||"a"),h={aliasDuplicateObjects:o??!0,keepUndefined:f??!1,onAnchor:l,onTagObj:p,replacer:i,schema:this.schema,sourceObjects:m},y=ws(e,c,h);return a&&ct(y)&&(y.flow=!0),d(),y}createPair(e,s,r={}){let i=this.createNode(e,null,r),o=this.createNode(s,null,r);return new Et(i,o)}delete(e){return Or(this.contents)?this.contents.delete(e):!1}deleteIn(e){return kr(e)?this.contents==null?!1:(this.contents=null,!0):Or(this.contents)?this.contents.deleteIn(e):!1}get(e,s){return ct(this.contents)?this.contents.get(e,s):void 0}getIn(e,s){return kr(e)?!s&&Ge(this.contents)?this.contents.value:this.contents:ct(this.contents)?this.contents.getIn(e,s):void 0}has(e){return ct(this.contents)?this.contents.has(e):!1}hasIn(e){return kr(e)?this.contents!==void 0:ct(this.contents)?this.contents.hasIn(e):!1}set(e,s){this.contents==null?this.contents=ui(this.schema,[e],s):Or(this.contents)&&this.contents.set(e,s)}setIn(e,s){kr(e)?this.contents=s:this.contents==null?this.contents=ui(this.schema,Array.from(e),s):Or(this.contents)&&this.contents.setIn(e,s)}setSchema(e,s={}){typeof e=="number"&&(e=String(e));let r;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new os({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new os({version:e}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(s.schema instanceof Object)this.schema=s.schema;else if(r)this.schema=new vi(Object.assign(r,s));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:s,mapAsMap:r,maxAliasCount:i,onAnchor:o,reviver:n}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},f=qt(this.contents,s??"",a);if(typeof o=="function")for(let{count:p,res:c}of a.anchors.values())o(c,p);return typeof n=="function"?Ns(n,{"":f},"",f):f}toJSON(e,s){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:s})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let s=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${s}`)}return pd(this,e)}};function Or(t){if(ct(t))return!0;throw new Error("Expected a YAML collection as document contents")}var Mi=class extends Error{constructor(e,s,r,i){super(),this.name=e,this.code=r,this.message=i,this.pos=s}},Gn=class extends Mi{constructor(e,s,r){super("YAMLParseError",e,s,r)}},Pi=class extends Mi{constructor(e,s,r){super("YAMLWarning",e,s,r)}},Vl=(t,e)=>s=>{if(s.pos[0]===-1)return;s.linePos=s.pos.map(a=>e.linePos(a));let{line:r,col:i}=s.linePos[0];s.message+=` at line ${r}, column ${i}`;let o=i-1,n=t.substring(e.lineStarts[r-1],e.lineStarts[r]).replace(/[\n\r]+$/,"");if(o>=60&&n.length>80){let a=Math.min(o-39,n.length-79);n="\u2026"+n.substring(a),o-=a-1}if(n.length>80&&(n=n.substring(0,79)+"\u2026"),r>1&&/^ *$/.test(n.substring(0,o))){let a=t.substring(e.lineStarts[r-2],e.lineStarts[r-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
58
+ `),n=a+n}if(/[^ ]/.test(n)){let a=1,f=s.linePos[1];f?.line===r&&f.col>i&&(a=Math.max(1,Math.min(f.col-i,80-o)));let p=" ".repeat(o)+"^".repeat(a);s.message+=`:
59
59
 
60
- ${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===`
74
- `&&(f=`
60
+ ${n}
61
+ ${p}
62
+ `}};function ls(t,{flow:e,indicator:s,next:r,offset:i,onError:o,parentIndent:n,startOnNewline:a}){let f=!1,p=a,c=a,l="",d="",m=!1,h=!1,y=null,g=null,k=null,u=null,b=null,x=null,w=null;for(let O of t)switch(h&&(O.type!=="space"&&O.type!=="newline"&&O.type!=="comma"&&o(O.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h=!1),y&&(p&&O.type!=="comment"&&O.type!=="newline"&&o(y,"TAB_AS_INDENT","Tabs are not allowed as indentation"),y=null),O.type){case"space":!e&&(s!=="doc-start"||r?.type!=="flow-collection")&&O.source.includes(" ")&&(y=O),c=!0;break;case"comment":{c||o(O,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let C=O.source.substring(1)||" ";l?l+=d+C:l=C,d="",p=!1;break}case"newline":p?l?l+=O.source:(!x||s!=="seq-item-ind")&&(f=!0):d+=O.source,p=!0,m=!0,(g||k)&&(u=O),c=!0;break;case"anchor":g&&o(O,"MULTIPLE_ANCHORS","A node can have at most one anchor"),O.source.endsWith(":")&&o(O.offset+O.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=O,w??(w=O.offset),p=!1,c=!1,h=!0;break;case"tag":{k&&o(O,"MULTIPLE_TAGS","A node can have at most one tag"),k=O,w??(w=O.offset),p=!1,c=!1,h=!0;break}case s:(g||k)&&o(O,"BAD_PROP_ORDER",`Anchors and tags must be after the ${O.source} indicator`),x&&o(O,"UNEXPECTED_TOKEN",`Unexpected ${O.source} in ${e??"collection"}`),x=O,p=s==="seq-item-ind"||s==="explicit-key-ind",c=!1;break;case"comma":if(e){b&&o(O,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),b=O,p=!1,c=!1;break}default:o(O,"UNEXPECTED_TOKEN",`Unexpected ${O.type} token`),p=!1,c=!1}let $=t[t.length-1],v=$?$.offset+$.source.length:i;return h&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&o(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),y&&(p&&y.indent<=n||r?.type==="block-map"||r?.type==="block-seq")&&o(y,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:b,found:x,spaceBefore:f,comment:l,hasNewline:m,anchor:g,tag:k,newlineAfterProp:u,end:v,start:w??v}}function js(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
63
+ `))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let s of e.start)if(s.type==="newline")return!0;if(e.sep){for(let s of e.sep)if(s.type==="newline")return!0}if(js(e.key)||js(e.value))return!0}return!1;default:return!0}}function Oi(t,e,s){if(e?.type==="flow-collection"){let r=e.end[0];r.indent===t&&(r.source==="]"||r.source==="}")&&js(e)&&s(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function Jo(t,e,s){let{uniqueKeys:r}=t.options;if(r===!1)return!1;let i=typeof r=="function"?r:(o,n)=>o===n||Ge(o)&&Ge(n)&&o.value===n.value;return e.some(o=>i(o.key,s))}var dd="All mapping items must start at the same column";function fd({composeNode:t,composeEmptyNode:e},s,r,i,o){let n=o?.nodeClass??jt,a=new n(s.schema);s.atRoot&&(s.atRoot=!1);let f=r.offset,p=null;for(let c of r.items){let{start:l,key:d,sep:m,value:h}=c,y=ls(l,{indicator:"explicit-key-ind",next:d??m?.[0],offset:f,onError:i,parentIndent:r.indent,startOnNewline:!0}),g=!y.found;if(g){if(d&&(d.type==="block-seq"?i(f,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in d&&d.indent!==r.indent&&i(f,"BAD_INDENT",dd)),!y.anchor&&!y.tag&&!m){p=y.end,y.comment&&(a.comment?a.comment+=`
64
+ `+y.comment:a.comment=y.comment);continue}(y.newlineAfterProp||js(d))&&i(d??l[l.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else y.found?.indent!==r.indent&&i(f,"BAD_INDENT",dd);s.atKey=!0;let k=y.end,u=d?t(s,d,y,i):e(s,k,l,null,y,i);s.schema.compat&&Oi(r.indent,d,i),s.atKey=!1,Jo(s,a.items,u)&&i(k,"DUPLICATE_KEY","Map keys must be unique");let b=ls(m??[],{indicator:"map-value-ind",next:h,offset:u.range[2],onError:i,parentIndent:r.indent,startOnNewline:!d||d.type==="block-scalar"});if(f=b.end,b.found){g&&(h?.type==="block-map"&&!b.hasNewline&&i(f,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),s.options.strict&&y.start<b.found.offset-1024&&i(u.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let x=h?t(s,h,b,i):e(s,f,m,null,b,i);s.schema.compat&&Oi(r.indent,h,i),f=x.range[2];let w=new Et(u,x);s.options.keepSourceTokens&&(w.srcToken=c),a.items.push(w)}else{g&&i(u.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),b.comment&&(u.comment?u.comment+=`
65
+ `+b.comment:u.comment=b.comment);let x=new Et(u);s.options.keepSourceTokens&&(x.srcToken=c),a.items.push(x)}}return p&&p<f&&i(p,"IMPOSSIBLE","Map comment with trailing content"),a.range=[r.offset,f,p??f],a}function md({composeNode:t,composeEmptyNode:e},s,r,i,o){let n=o?.nodeClass??Qt,a=new n(s.schema);s.atRoot&&(s.atRoot=!1),s.atKey&&(s.atKey=!1);let f=r.offset,p=null;for(let{start:c,value:l}of r.items){let d=ls(c,{indicator:"seq-item-ind",next:l,offset:f,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!d.found)if(d.anchor||d.tag||l)l?.type==="block-seq"?i(d.end,"BAD_INDENT","All sequence items must start at the same column"):i(f,"MISSING_CHAR","Sequence item without - indicator");else{p=d.end,d.comment&&(a.comment=d.comment);continue}let m=l?t(s,l,d,i):e(s,d.end,c,null,d,i);s.schema.compat&&Oi(r.indent,l,i),f=m.range[2],a.items.push(m)}return a.range=[r.offset,f,p??f],a}function cs(t,e,s,r){let i="";if(t){let o=!1,n="";for(let a of t){let{source:f,type:p}=a;switch(p){case"space":o=!0;break;case"comment":{s&&!o&&r(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let c=f.substring(1)||" ";i?i+=n+c:i=c,n="";break}case"newline":i&&(n+=f),o=!0;break;default:r(a,"UNEXPECTED_TOKEN",`Unexpected ${p} at node end`)}e+=f.length}}return{comment:i,offset:e}}var Kl="Block collections are not allowed within flow collections",Gl=t=>t&&(t.type==="block-map"||t.type==="block-seq");function ud({composeNode:t,composeEmptyNode:e},s,r,i,o){let n=r.start.source==="{",a=n?"flow map":"flow sequence",f=o?.nodeClass??(n?jt:Qt),p=new f(s.schema);p.flow=!0;let c=s.atRoot;c&&(s.atRoot=!1),s.atKey&&(s.atKey=!1);let l=r.offset+r.start.source.length;for(let g=0;g<r.items.length;++g){let k=r.items[g],{start:u,key:b,sep:x,value:w}=k,$=ls(u,{flow:a,indicator:"explicit-key-ind",next:b??x?.[0],offset:l,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!$.found){if(!$.anchor&&!$.tag&&!x&&!w){g===0&&$.comma?i($.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):g<r.items.length-1&&i($.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),$.comment&&(p.comment?p.comment+=`
66
+ `+$.comment:p.comment=$.comment),l=$.end;continue}!n&&s.options.strict&&js(b)&&i(b,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(g===0)$.comma&&i($.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if($.comma||i($.start,"MISSING_CHAR",`Missing , between ${a} items`),$.comment){let v="";e:for(let O of u)switch(O.type){case"comma":case"space":break;case"comment":v=O.source.substring(1);break e;default:break e}if(v){let O=p.items[p.items.length-1];Xe(O)&&(O=O.value??O.key),O.comment?O.comment+=`
67
+ `+v:O.comment=v,$.comment=$.comment.substring(v.length+1)}}if(!n&&!x&&!$.found){let v=w?t(s,w,$,i):e(s,$.end,x,null,$,i);p.items.push(v),l=v.range[2],Gl(w)&&i(v.range,"BLOCK_IN_FLOW",Kl)}else{s.atKey=!0;let v=$.end,O=b?t(s,b,$,i):e(s,v,u,null,$,i);Gl(b)&&i(O.range,"BLOCK_IN_FLOW",Kl),s.atKey=!1;let C=ls(x??[],{flow:a,indicator:"map-value-ind",next:w,offset:O.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(C.found){if(!n&&!$.found&&s.options.strict){if(x)for(let M of x){if(M===C.found)break;if(M.type==="newline"){i(M,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}$.start<C.found.offset-1024&&i(C.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else w&&("source"in w&&w.source?.[0]===":"?i(w,"MISSING_CHAR",`Missing space after : in ${a}`):i(C.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let A=w?t(s,w,C,i):C.found?e(s,C.end,x,null,C,i):null;A?Gl(w)&&i(A.range,"BLOCK_IN_FLOW",Kl):C.comment&&(O.comment?O.comment+=`
68
+ `+C.comment:O.comment=C.comment);let R=new Et(O,A);if(s.options.keepSourceTokens&&(R.srcToken=k),n){let M=p;Jo(s,M.items,O)&&i(v,"DUPLICATE_KEY","Map keys must be unique"),M.items.push(R)}else{let M=new jt(s.schema);M.flow=!0,M.items.push(R);let T=(A??O).range;M.range=[O.range[0],T[1],T[2]],p.items.push(M)}l=A?A.range[2]:C.end}}let d=n?"}":"]",[m,...h]=r.end,y=l;if(m?.source===d)y=m.offset+m.source.length;else{let g=a[0].toUpperCase()+a.substring(1),k=c?`${g} must end with a ${d}`:`${g} in block collection must be sufficiently indented and end with a ${d}`;i(l,c?"MISSING_CHAR":"BAD_INDENT",k),m&&m.source.length!==1&&h.unshift(m)}if(h.length>0){let g=cs(h,y,s.options.strict,i);g.comment&&(p.comment?p.comment+=`
69
+ `+g.comment:p.comment=g.comment),p.range=[r.offset,y,g.offset]}else p.range=[r.offset,y,y];return p}function Zl(t,e,s,r,i,o){let n=s.type==="block-map"?fd(t,e,s,r,o):s.type==="block-seq"?md(t,e,s,r,o):ud(t,e,s,r,o),a=n.constructor;return i==="!"||i===a.tagName?(n.tag=a.tagName,n):(i&&(n.tag=i),n)}function hd(t,e,s,r,i){let o=r.tag,n=o?e.directives.tagName(o.source,d=>i(o,"TAG_RESOLVE_FAILED",d)):null;if(s.type==="block-seq"){let{anchor:d,newlineAfterProp:m}=r,h=d&&o?d.offset>o.offset?d:o:d??o;h&&(!m||m.offset<h.offset)&&i(h,"MISSING_CHAR","Missing newline after block sequence props")}let a=s.type==="block-map"?"map":s.type==="block-seq"?"seq":s.start.source==="{"?"map":"seq";if(!o||!n||n==="!"||n===jt.tagName&&a==="map"||n===Qt.tagName&&a==="seq")return Zl(t,e,s,i,n);let f=e.schema.tags.find(d=>d.tag===n&&d.collection===a);if(!f){let d=e.schema.knownTags[n];if(d?.collection===a)e.schema.tags.push(Object.assign({},d,{default:!1})),f=d;else return d?i(o,"BAD_COLLECTION_TYPE",`${d.tag} used for ${a} collection, but expects ${d.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,!0),Zl(t,e,s,i,n)}let p=Zl(t,e,s,i,n,f),c=f.resolve?.(p,d=>i(o,"TAG_RESOLVE_FAILED",d),e.options)??p,l=nt(c)?c:new Re(c);return l.range=p.range,l.tag=n,f?.format&&(l.format=f.format),l}function Ul(t,e,s){let r=e.offset,i=lu(e,t.options.strict,s);if(!i)return{value:"",type:null,comment:"",range:[r,r,r]};let o=i.mode===">"?Re.BLOCK_FOLDED:Re.BLOCK_LITERAL,n=e.source?cu(e.source):[],a=n.length;for(let y=n.length-1;y>=0;--y){let g=n[y][1];if(g===""||g==="\r")a=y;else break}if(a===0){let y=i.chomp==="+"&&n.length>0?`
70
+ `.repeat(Math.max(1,n.length-1)):"",g=r+i.length;return e.source&&(g+=e.source.length),{value:y,type:o,comment:i.comment,range:[r,g,g]}}let f=e.indent+i.indent,p=e.offset+i.length,c=0;for(let y=0;y<a;++y){let[g,k]=n[y];if(k===""||k==="\r")i.indent===0&&g.length>f&&(f=g.length);else{g.length<f&&s(p+g.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(f=g.length),c=y,f===0&&!t.atRoot&&s(p,"BAD_INDENT","Block scalar values in collections must be indented");break}p+=g.length+k.length+1}for(let y=n.length-1;y>=a;--y)n[y][0].length>f&&(a=y+1);let l="",d="",m=!1;for(let y=0;y<c;++y)l+=n[y][0].slice(f)+`
71
+ `;for(let y=c;y<a;++y){let[g,k]=n[y];p+=g.length+k.length+1;let u=k[k.length-1]==="\r";if(u&&(k=k.slice(0,-1)),k&&g.length<f){let x=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;s(p-k.length-(u?2:1),"BAD_INDENT",x),g=""}o===Re.BLOCK_LITERAL?(l+=d+g.slice(f)+k,d=`
72
+ `):g.length>f||k[0]===" "?(d===" "?d=`
73
+ `:!m&&d===`
74
+ `&&(d=`
75
75
 
76
- `),p+=f+y.slice(d)+v,f=`
77
- `,m=!0):v===""?f===`
78
- `?p+=`
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]===`
76
+ `),l+=d+g.slice(f)+k,d=`
77
+ `,m=!0):k===""?d===`
78
+ `?l+=`
79
+ `:d=`
80
+ `:(l+=d+k,d=" ",m=!1)}switch(i.chomp){case"-":break;case"+":for(let y=a;y<n.length;++y)l+=`
81
+ `+n[y][0].slice(f);l[l.length-1]!==`
82
+ `&&(l+=`
83
+ `);break;default:l+=`
84
+ `}let h=r+i.length+e.source.length;return{value:l,type:o,comment:i.comment,range:[r,h,h]}}function lu({offset:t,props:e},s,r){if(e[0].type!=="block-scalar-header")return r(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=e[0],o=i[0],n=0,a="",f=-1;for(let d=1;d<i.length;++d){let m=i[d];if(!a&&(m==="-"||m==="+"))a=m;else{let h=Number(m);!n&&h?n=h:f===-1&&(f=t+d)}}f!==-1&&r(f,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let p=!1,c="",l=i.length;for(let d=1;d<e.length;++d){let m=e[d];switch(m.type){case"space":p=!0;case"newline":l+=m.source.length;break;case"comment":s&&!p&&r(m,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),l+=m.source.length,c=m.source.substring(1);break;case"error":r(m,"UNEXPECTED_TOKEN",m.message),l+=m.source.length;break;default:{let h=`Unexpected token in block scalar header: ${m.type}`;r(m,"UNEXPECTED_TOKEN",h);let y=m.source;y&&typeof y=="string"&&(l+=y.length)}}}return{mode:o,indent:n,chomp:a,comment:c,length:l}}function cu(t){let e=t.split(/\n( *)/),s=e[0],r=s.match(/^( *)/),o=[r?.[1]?[r[1],s.slice(r[1].length)]:["",s]];for(let n=1;n<e.length;n+=2)o.push([e[n],e[n+1]]);return o}function Hl(t,e,s){let{offset:r,type:i,source:o,end:n}=t,a,f,p=(d,m,h)=>s(r+d,m,h);switch(i){case"scalar":a=Re.PLAIN,f=pu(o,p);break;case"single-quoted-scalar":a=Re.QUOTE_SINGLE,f=du(o,p);break;case"double-quoted-scalar":a=Re.QUOTE_DOUBLE,f=fu(o,p);break;default:return s(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[r,r+o.length,r+o.length]}}let c=r+o.length,l=cs(n,c,e,s);return{value:f,type:a,comment:l.comment,range:[r,c,l.offset]}}function pu(t,e){let s="";switch(t[0]){case" ":s="a tab character";break;case",":s="flow indicator character ,";break;case"%":s="directive indicator character %";break;case"|":case">":{s=`block scalar indicator ${t[0]}`;break}case"@":case"`":{s=`reserved character ${t[0]}`;break}}return s&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${s}`),yd(t)}function du(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),yd(t.slice(1,-1)).replace(/''/g,"'")}function yd(t){let e=/(.*?)\r?\n/sy,s=e.exec(t);if(!s)return t;let r,i;try{r=new RegExp("(?<![ ])[ ]+$"),i=new RegExp("^[ ]+|(?<![ ])[ ]+$","g")}catch{r=/[ \t]+$/,i=/^[ \t]+|[ \t]+$/g}let o=s[1].replace(r,""),n=" ",a=e.lastIndex;for(;s=e.exec(t);){let p=s[1].replace(i,"");p===""?n===`
85
+ `?o+=n:n=`
86
+ `:(o+=n+p,n=" "),a=e.lastIndex}let f=/[ \t]*(.*)/sy;return f.lastIndex=a,s=f.exec(t),o+n+(s?.[1]??"")}function fu(t,e){let s="";for(let r=1;r<t.length-1;++r){let i=t[r];if(!(i==="\r"&&t[r+1]===`
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}=mu(t,r);s+=o,r=n}else if(i==="\\"){let o=t[++r],n=uu[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+=hu(t,r+1,a,e),r+=a}else{let a=t.substr(r-1,2);e(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),s+=a}}else if(i===" "||i===" "){let o=r,n=t[r+1];for(;n===" "||n===" ";)n=t[++r+1];n!==`
91
+ `&&!(n==="\r"&&t[r+2]===`
92
+ `)&&(s+=r>o?t.slice(o,r+1):i)}else s+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),s}function mu(t,e){let s="",r=t[e+1];for(;(r===" "||r===" "||r===`
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 uu={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
97
+ `,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function hu(t,e,s,r){let i=t.substr(e,s),n=i.length===s&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(n)}catch{let a=t.substr(e-2,s+2);return r(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}function Yl(t,e,s,r){let{value:i,type:o,comment:n,range:a}=e.type==="block-scalar"?Ul(t,e,r):Hl(e,t.options.strict,r),f=s?t.directives.tagName(s.source,l=>r(s,"TAG_RESOLVE_FAILED",l)):null,p;t.options.stringKeys&&t.atKey?p=t.schema[bn]:f?p=yu(t.schema,i,f,s,r):e.type==="scalar"?p=gu(t,i,e,r):p=t.schema[bn];let c;try{let l=p.resolve(i,d=>r(s??e,"TAG_RESOLVE_FAILED",d),t.options);c=Ge(l)?l:new Re(l)}catch(l){let d=l instanceof Error?l.message:String(l);r(s??e,"TAG_RESOLVE_FAILED",d),c=new Re(i)}return c.range=a,c.source=i,o&&(c.type=o),f&&(c.tag=f),p.format&&(c.format=p.format),n&&(c.comment=n),c}function yu(t,e,s,r,i){if(s==="!")return t[bn];let o=[];for(let a of t.tags)if(!a.collection&&a.tag===s)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let n=t.knownTags[s];return n&&!n.collection?(t.tags.push(Object.assign({},n,{default:!1,test:void 0})),n):(i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,s!=="tag:yaml.org,2002:str"),t[bn])}function gu({atKey:t,directives:e,schema:s},r,i,o){let n=s.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(r))||s[bn];if(s.compat){let a=s.compat.find(f=>f.default&&f.test?.test(r))??s[bn];if(n.tag!==a.tag){let f=e.tagString(n.tag),p=e.tagString(a.tag),c=`Value may be parsed as either ${f} or ${p}`;o(i,"TAG_RESOLVE_FAILED",c,!0)}}return n}function gd(t,e,s){if(e){s??(s=e.length);for(let r=s-1;r>=0;--r){let i=e[r];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++r];i?.type==="space";)t+=i.source.length,i=e[++r];break}}return t}var bu={composeNode:Wl,composeEmptyNode:Xo};function Wl(t,e,s,r){let i=t.atKey,{spaceBefore:o,comment:n,anchor:a,tag:f}=s,p,c=!0;switch(e.type){case"alias":p=wu(t,e,r),(a||f)&&r(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":p=Yl(t,e,f,r),a&&(p.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{p=hd(bu,t,e,s,r),a&&(p.anchor=a.source.substring(1))}catch(l){let d=l instanceof Error?l.message:String(l);r(e,"RESOURCE_EXHAUSTION",d)}break;default:{let l=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;r(e,"UNEXPECTED_TOKEN",l),c=!1}}return p??(p=Xo(t,e.offset,void 0,null,s,r)),a&&p.anchor===""&&r(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!Ge(p)||typeof p.value!="string"||p.tag&&p.tag!=="tag:yaml.org,2002:str")&&r(f??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(p.spaceBefore=!0),n&&(e.type==="scalar"&&e.source===""?p.comment=n:p.commentBefore=n),t.options.keepSourceTokens&&c&&(p.srcToken=e),p}function Xo(t,e,s,r,{spaceBefore:i,comment:o,anchor:n,tag:a,end:f},p){let c={type:"scalar",offset:gd(e,s,r),indent:-1,source:""},l=Yl(t,c,a,p);return n&&(l.anchor=n.source.substring(1),l.anchor===""&&p(n,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(l.spaceBefore=!0),o&&(l.comment=o,l.range[2]=f),l}function wu({options:t},{offset:e,source:s,end:r},i){let o=new bs(s.substring(1));o.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&i(e+s.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let n=e+s.length,a=cs(r,n,t.strict,i);return o.range=[e,n,a.offset],a.comment&&(o.comment=a.comment),o}function bd(t,e,{offset:s,start:r,value:i,end:o},n){let a=Object.assign({_directives:e},t),f=new Cs(void 0,a),p={atKey:!1,atRoot:!0,directives:f.directives,options:f.options,schema:f.schema},c=ls(r,{indicator:"doc-start",next:i??o?.[0],offset:s,onError:n,parentIndent:0,startOnNewline:!0});c.found&&(f.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!c.hasNewline&&n(c.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),f.contents=i?Wl(p,i,c,n):Xo(p,c.end,r,null,c,n);let l=f.contents.range[2],d=cs(o,l,!1,n);return d.comment&&(f.comment=d.comment),f.range=[s,l,d.offset],f}function Ai(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:s}=t;return[e,e+(typeof s=="string"?s.length:1)]}function wd(t){let e="",s=!1,r=!1;for(let i=0;i<t.length;++i){let o=t[i];switch(o[0]){case"#":e+=(e===""?"":r?`
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 Ti=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(s,r,i,o)=>{let n=Ai(s);o?this.warnings.push(new Pi(n,r,i)):this.errors.push(new Gn(n,r,i))},this.directives=new os({version:e.version||"1.2"}),this.options=e}decorate(e,s){let{comment:r,afterEmptyLine:i}=wd(this.prelude);if(r){let o=e.contents;if(s)e.comment=e.comment?`${e.comment}
101
+ ${r}`:r;else if(i||e.directives.docStart||!o)e.commentBefore=r;else if(ct(o)&&!o.flow&&o.items.length>0){let n=o.items[0];Xe(n)&&(n=n.key);let a=n.commentBefore;n.commentBefore=a?`${r}
102
+ ${a}`:r}else{let n=o.commentBefore;o.commentBefore=n?`${r}
103
+ ${n}`:r}}if(s){for(let o=0;o<this.errors.length;++o)e.errors.push(this.errors[o]);for(let o=0;o<this.warnings.length;++o)e.warnings.push(this.warnings[o])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:wd(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,s=!1,r=-1){for(let i of e)yield*this.next(i);yield*this.end(s,r)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(s,r,i)=>{let o=Ai(e);o[0]+=s,this.onError(o,"BAD_DIRECTIVE",r,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let s=bd(this.options,this.directives,e,this.onError);this.atDirectives&&!s.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(s,!1),this.doc&&(yield this.doc),this.doc=s,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let s=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,r=new Gn(Ai(e),"UNEXPECTED_TOKEN",s);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){let r="Unexpected doc-end without preceding document";this.errors.push(new Gn(Ai(e),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let s=cs(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),s.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
104
+ ${s.comment}`:s.comment}this.doc.range[2]=s.offset;break}default:this.errors.push(new Gn(Ai(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,s=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let r=Object.assign({_directives:this.directives},this.options),i=new Cs(void 0,r);this.atDirectives&&this.onError(s,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,s,s],this.decorate(i,!1),yield i}}};var Jl=Symbol("break visit"),xu=Symbol("skip children"),xd=Symbol("remove item");function Xs(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),kd(Object.freeze([]),t,e)}Xs.BREAK=Jl;Xs.SKIP=xu;Xs.REMOVE=xd;Xs.itemAtPath=(t,e)=>{let s=t;for(let[r,i]of e){let o=s?.[r];if(o&&"items"in o)s=o.items[i];else return}return s};Xs.parentCollection=(t,e)=>{let s=Xs.itemAtPath(t,e.slice(0,-1)),r=e[e.length-1][0],i=s?.[r];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function kd(t,e,s){let r=s(e,t);if(typeof r=="symbol")return r;for(let i of["key","value"]){let o=e[i];if(o&&"items"in o){for(let n=0;n<o.items.length;++n){let a=kd(Object.freeze(t.concat([[i,n]])),o.items[n],s);if(typeof a=="number")n=a-1;else{if(a===Jl)return Jl;a===xd&&(o.items.splice(n,1),n-=1)}}typeof r=="function"&&i==="key"&&(r=r(e,t))}}return typeof r=="function"?r(e,t):r}var Xl="\uFEFF",Ql="",ec="",Qo="";function $d(t){switch(t){case Xl:return"byte-order-mark";case Ql:return"doc-mode";case ec:return"flow-error-end";case Qo:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
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 Zn(t){switch(t){case void 0:case" ":case`
107
+ `:case"\r":case" ":return!0;default:return!1}}var Sd=new Set("0123456789ABCDEFabcdef"),$u=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),ea=new Set(",[]{}"),Su=new Set(` ,[]{}
108
+ \r `),tc=t=>!t||Su.has(t),Ei=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,s=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!s;let r=this.next??"stream";for(;r&&(s||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let e=this.pos,s=this.buffer[e];for(;s===" "||s===" ";)s=this.buffer[++e];return!s||s==="#"||s===`
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==="...")&&Zn(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
113
+ `,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===Xl&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let s=e.length,r=e.indexOf("#");for(;r!==-1;){let o=e[r-1];if(o===" "||o===" "){s=r-1;break}else r=e.indexOf("#",r+1)}for(;;){let o=e[s-1];if(o===" "||o===" ")s-=1;else break}let i=(yield*this.pushCount(s))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){let s=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-s),yield*this.pushNewline(),"stream"}return yield Ql,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let s=this.peek(3);if((s==="---"||s==="...")&&Zn(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,s==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Zn(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,s]=this.peek(2);if(!s&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Zn(s)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let s=yield*this.pushIndicators();switch(e[s]){case"#":yield*this.pushCount(e.length-s);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(tc),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return s+=yield*this.parseBlockScalarHeader(),s+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-s),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,s,r=-1;do e=yield*this.pushNewline(),e>0?(s=yield*this.pushSpaces(!1),this.indentValue=r=s):s=0,s+=yield*this.pushSpaces(!0);while(e+s>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&i[0]!=="#"||r===0&&(i.startsWith("---")||i.startsWith("..."))&&Zn(i[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield ec,yield*this.parseLineStart();let o=0;for(;i[o]===",";)o+=yield*this.pushCount(1),o+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(o+=yield*this.pushIndicators(),i[o]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-o),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(tc),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let n=this.charAt(1);if(this.flowKey||Zn(n)||n===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),s=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;s!==-1&&this.buffer[s+1]==="'";)s=this.buffer.indexOf("'",s+2);else for(;s!==-1;){let o=0;for(;this.buffer[s-1-o]==="\\";)o+=1;if(o%2===0)break;s=this.buffer.indexOf('"',s+1)}let r=this.buffer.substring(0,s),i=r.indexOf(`
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=>Zn(s)||s==="#")}*parseBlockScalar(){let e=this.pos-1,s=0,r;e:for(let o=this.pos;r=this.buffer[o];++o)switch(r){case" ":s+=1;break;case`
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 Qo,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,s=this.pos-1,r=this.pos-1,i;for(;i=this.buffer[++r];)if(i===":"){let o=this.buffer[r+1];if(Zn(o)||e&&ea.has(o))break;s=r}else if(Zn(i)){let o=this.buffer[r+1];if(i==="\r"&&(o===`
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&&ea.has(o))break;if(i===`
123
+ `){let n=this.continueScalar(r+1);if(n===-1)break;r=Math.max(r,n-2)}}else{if(e&&ea.has(i))break;s=r}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Qo,yield*this.pushToIndex(s+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,s){let r=this.buffer.slice(this.pos,e);return r?(yield r,this.pos+=r.length,r.length):(s&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(tc),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let s=this.flowLevel>0,r=this.charAt(1);if(Zn(r)||s&&ea.has(r)){s?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,s=this.buffer[e];for(;!Zn(s)&&s!==">";)s=this.buffer[++e];return yield*this.pushToIndex(s===">"?e+1:e,!1)}else{let e=this.pos+1,s=this.buffer[e];for(;s;)if($u.has(s))s=this.buffer[++e];else if(s==="%"&&Sd.has(this.buffer[e+1])&&Sd.has(this.buffer[e+2]))s=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
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 Qs=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let s=0,r=this.lineStarts.length;for(;s<r;){let o=s+r>>1;this.lineStarts[o]<e?s=o+1:r=o}if(this.lineStarts[s]===e)return{line:s+1,col:1};if(s===0)return{line:0,col:e};let i=this.lineStarts[s-1];return{line:s,col:e-i+1}}}};function Ls(t,e){for(let s=0;s<t.length;++s)if(t[s].type===e)return!0;return!1}function vd(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function Pd(t){switch(t?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function ta(t){switch(t.type){case"document":return t.start;case"block-map":{let e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function Ar(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function na(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let s=0;s<e.length;++s)t.push(e[s])}function Md(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!Ls(e.start,"explicit-key-ind")&&!Ls(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,Pd(e.value)?e.value.end?na(e.value.end,e.sep):e.value.end=e.sep:na(e.start,e.sep),delete e.sep)}var Ni=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Ei,this.onNewLine=e}*parse(e,s=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(e,s))yield*this.next(r);s||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let s=$d(e);if(s)if(s==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=s,yield*this.step(),s){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let r=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let s=e??this.stack.pop();if(!s)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield s;else{let r=this.peek(1);switch(s.type==="block-scalar"?s.indent="indent"in r?r.indent:0:s.type==="flow-collection"&&r.type==="document"&&(s.indent=0),s.type==="flow-collection"&&Md(s),r.type){case"document":r.value=s;break;case"block-scalar":r.props.push(s);break;case"block-map":{let i=r.items[r.items.length-1];if(i.value){r.items.push({start:[],key:s,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=s;else{Object.assign(i,{key:s,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=r.items[r.items.length-1];i.value?r.items.push({start:[],value:s}):i.value=s;break}case"flow-collection":{let i=r.items[r.items.length-1];!i||i.value?r.items.push({start:[],key:s,sep:[]}):i.sep?i.value=s:Object.assign(i,{key:s,sep:[]});return}default:yield*this.pop(),yield*this.pop(s)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(s.type==="block-map"||s.type==="block-seq")){let i=s.items[s.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&vd(i.start)===-1&&(s.indent===0||i.start.every(o=>o.type!=="comment"||o.indent<s.indent))&&(r.type==="document"?r.end=i.start:r.items.push({start:i.start}),s.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{vd(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let s=this.startBlockValue(e);s?this.stack.push(s):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let s=ta(this.peek(2)),r=Ar(s),i;e.end?(i=e.end,i.push(this.sourceToken),delete e.end):i=[this.sourceToken];let o={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let s=this.source.indexOf(`
126
+ `)+1;for(;s!==0;)this.onNewLine(this.offset+s),s=this.source.indexOf(`
127
+ `,s)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let s=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,s.value){let r="end"in s.value?s.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else s.sep?s.sep.push(this.sourceToken):s.start.push(this.sourceToken);return;case"space":case"comment":if(s.value)e.items.push({start:[this.sourceToken]});else if(s.sep)s.sep.push(this.sourceToken);else{if(this.atIndentedComment(s.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){na(i,s.start),i.push(this.sourceToken),e.items.pop();return}}s.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let r=!this.onKeyLine&&this.indent===e.indent,i=r&&(s.sep||s.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&s.sep&&!s.value){let n=[];for(let a=0;a<s.sep.length;++a){let f=s.sep[a];switch(f.type){case"newline":n.push(a);break;case"space":break;case"comment":f.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(o=s.sep.splice(n[1]))}switch(this.type){case"anchor":case"tag":i||s.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):s.sep?s.sep.push(this.sourceToken):s.start.push(this.sourceToken);return;case"explicit-key-ind":!s.sep&&!s.explicitKey?(s.start.push(this.sourceToken),s.explicitKey=!0):i||s.value?(o.push(this.sourceToken),e.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(s.explicitKey)if(s.sep)if(s.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ls(s.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(Pd(s.key)&&!Ls(s.sep,"newline")){let n=Ar(s.start),a=s.key,f=s.sep;f.push(this.sourceToken),delete s.key,delete s.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:a,sep:f}]})}else o.length>0?s.sep=s.sep.concat(o,this.sourceToken):s.sep.push(this.sourceToken);else if(Ls(s.start,"newline"))Object.assign(s,{key:null,sep:[this.sourceToken]});else{let n=Ar(s.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]})}else s.sep?s.value||i?e.items.push({start:o,key:null,sep:[this.sourceToken]}):Ls(s.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):s.sep.push(this.sourceToken):Object.assign(s,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let n=this.flowScalar(this.type);i||s.value?(e.items.push({start:o,key:n,sep:[]}),this.onKeyLine=!0):s.sep?this.stack.push(n):(Object.assign(s,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let n=this.startBlockValue(e);if(n){if(n.type==="block-seq"){if(!s.explicitKey&&s.sep&&!Ls(s.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&e.items.push({start:o});this.stack.push(n);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let s=e.items[e.items.length-1];switch(this.type){case"newline":if(s.value){let r="end"in s.value?s.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else s.start.push(this.sourceToken);return;case"space":case"comment":if(s.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(s.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){na(i,s.start),i.push(this.sourceToken),e.items.pop();return}}s.start.push(this.sourceToken)}return;case"anchor":case"tag":if(s.value||this.indent<=e.indent)break;s.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;s.value||Ls(s.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):s.start.push(this.sourceToken);return}if(this.indent>e.indent){let r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let s=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!s||s.sep?e.items.push({start:[this.sourceToken]}):s.start.push(this.sourceToken);return;case"map-value-ind":!s||s.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):s.sep?s.sep.push(this.sourceToken):Object.assign(s,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!s||s.value?e.items.push({start:[this.sourceToken]}):s.sep?s.sep.push(this.sourceToken):s.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!s||s.value?e.items.push({start:[],key:i,sep:[]}):s.sep?this.stack.push(i):Object.assign(s,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let r=this.startBlockValue(e);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let i=ta(r),o=Ar(i);Md(e);let n=e.end.splice(1,e.end.length);n.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let s=this.source.indexOf(`
128
+ `)+1;for(;s!==0;)this.onNewLine(this.offset+s),s=this.source.indexOf(`
129
+ `,s)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let s=ta(e),r=Ar(s);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let s=ta(e),r=Ar(s);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,s){return this.type!=="comment"||this.indent<=s?!1:e.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};function vu(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new Qs||null,prettyErrors:e}}function sa(t,e={}){let{lineCounter:s,prettyErrors:r}=vu(e),i=new Ni(s?.addNewLine),o=new Ti(e),n=null;for(let a of o.compose(i.parse(t),!0,t.length))if(!n)n=a;else if(n.options.logLevel!=="silent"){n.errors.push(new Gn(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&s&&(n.errors.forEach(Vl(t,s)),n.warnings.forEach(Vl(t,s))),n}function nc(t,e,s){let r;typeof e=="function"?r=e:s===void 0&&e&&typeof e=="object"&&(s=e);let i=sa(t,s);if(!i)return null;if(i.warnings.forEach(o=>Io(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},s))}function Tr(t){let e=nc(t);for(let s of["light","dark","kinds","roles"])if(!e||typeof e[s]!="object")throw new Error(`theme: missing "${s}"`);return e}function _s(t,e={},s={}){let r={...t.kinds};for(let[i,o]of Object.entries(s)){let n=r[o.like??i]??r.control;r[i]={color:o.color??n.color,dash:o.dash??n.dash,legend:o.legend??n.legend}}return{...t,roles:{...t.roles,...e},kinds:r}}var Od=t=>Object.entries(t).map(([e,s])=>`--${e}:${s}`).join(";");function Un(t,e){return e in t.light?`var(--${e})`:e}function ra(t){let{light:e,dark:s,rest:r}=Ri(t);return`:root{${e}}
130
+ @media (prefers-color-scheme: dark){:root:not([data-theme="light"]){${s}}}
131
+ :root[data-theme="dark"]{${s}}
132
+ ${r}`}function Ri(t){let e="";for(let[s,r]of Object.entries(t.roles))e+=`.k-${s}{--h:${r.h};--s:${r.s}%}`,r.top?e+=`.k-${s} .top{fill:${r.top}}`:r.tint&&(e+=`.k-${s} .top{fill:color-mix(in srgb,hsl(${r.h} ${Math.min(100,r.s+15)}% 50%) ${r.tint}%,var(--pad-top))}`),e+=`
133
+ `;for(let[s,r]of Object.entries(t.kinds)){let i=Un(t,r.color),o=r.dash==="dashed"?";stroke-dasharray:7 6;stroke-width:2.4":r.dash==="dotted"?";stroke-dasharray:3 6;stroke-width:2.4":"";e+=`.f-${s}{stroke:${i}${o}} .t-${s}{fill:${i}} .c-${s}{--c:${i}}
134
+ `}return{light:Od(t.light),dark:Od(t.dark),rest:e}}var ia=class extends Error{diags;constructor(e){super(e.map(s=>`${s.line}:${s.col} ${s.message}`).join(`
135
+ `)),this.diags=e}};function sc(t,e){let s=t.length,r=e.length;if(!s)return r;if(!r)return s;let i=Array.from({length:s+1},(o,n)=>[n,...Array(r).fill(0)]);for(let o=0;o<=r;o++)i[0][o]=o;for(let o=1;o<=s;o++)for(let n=1;n<=r;n++){let a=t[o-1]===e[n-1]?0:1;i[o][n]=Math.min(i[o-1][n]+1,i[o][n-1]+1,i[o-1][n-1]+a),o>1&&n>1&&t[o-1]===e[n-2]&&t[o-2]===e[n-1]&&(i[o][n]=Math.min(i[o][n],i[o-2][n-2]+1))}return i[s][r]}function Vt(t,e){let s,r=1/0,i=t.toLowerCase();for(let n of e){let a=sc(i,n.toLowerCase());a<r&&(r=a,s=n)}if(s===void 0)return;let o=Math.max(1,Math.min(3,Math.floor(Math.max(t.length,s.length)/3)));return r<=o?s:void 0}function rc(t,e,s){t.file&&(e=t.file,s=t.source);let i=`${t.line?`${e}:${t.line}:${t.col}`:e} ${t.severity}: ${t.message}`;if(t.hint&&(i+=`
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 Ad(t,e,s){return t.map(r=>rc(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 Td(t){return t.split("/").slice(1).map(e=>{let s=e.replace(/~1/g,"/").replace(/~0/g,"~");return/^\d+$/.test(s)?Number(s):s})}function oa(t){let e=new Qs,s=sa(t,{lineCounter:e,prettyErrors:!1,uniqueKeys:!0}),r=[],i=f=>{let p=e.linePos(f);return{line:p.line,col:p.col}};for(let f of s.errors){let p=i(f.pos[0]),c=f.message.split(`
141
+ `)[0],l=/Nested mappings|Implicit keys|mapping values/i.test(c)?`text that contains ": " (a colon followed by a blank) must be in quotes, e.g. command: 'send "a: b"'`:/Map keys must be unique/i.test(c)?"a key is written twice in the same map":void 0;r.push({severity:"error",message:`YAML: ${c}`,line:p.line,col:p.col,path:"",hint:l})}for(let f of s.warnings){let p=i(f.pos[0]);r.push({severity:"warning",message:`YAML: ${f.message.split(`
142
+ `)[0]}`,line:p.line,col:p.col,path:""})}function o(f,p={}){let c=Td(f),l=s.contents,d={line:1,col:1},m=h=>{let y=h?.range;y&&(d=i(y[0]))};m(l);for(let h=0;h<c.length;h++){let y=c[h];if(pn(l)){let g=l.items.find(k=>Xe(k)&&Ge(k.key)&&String(k.key.value)===String(y));if(!g)break;if(p.key&&h===c.length-1)return m(g.key),d;m(g.key),l=g.value,l&&m(l)}else if(dn(l)&&typeof y=="number"){if(l=l.items[y],!l)break;m(l)}else break}return d}function n(f){let p=s.contents;for(let m of Td(f)){if(pn(p)){let h=p.items.find(y=>Xe(y)&&Ge(y.key)&&String(y.key.value)===String(m));if(!h)return;p=h.value}else if(dn(p)&&typeof m=="number")p=p.items[m];else return;if(!p)return}let c=p.range;if(!c)return;let l=e.linePos(Math.max(c[0],c[1]-1)).line,d=t.split(/\r?\n/);for(;l>e.linePos(c[0]).line&&/^\s*(#.*)?$/.test(d[l-1]??"");)l--;return{start:e.linePos(c[0]).line,end:l}}let a=null;return s.errors.length||(a=s.toJS({maxAliasCount:100})),{data:a,locate:o,span:n,diags:r}}var Pu=new Set(["svg","g","defs","marker","symbol","title","desc","path","polygon","polyline","line","rect","circle","ellipse","text","tspan","linearGradient","radialGradient","stop","clipPath"]),Ou=new Set(["id","class","role","transform","viewBox","width","height","x","y","x1","y1","x2","y2","cx","cy","r","rx","ry","fx","fy","d","points","offset","gradientUnits","gradientTransform","markerWidth","markerHeight","refX","refY","orient","markerUnits","text-anchor","dominant-baseline","font-size","font-weight","letter-spacing","fill","stroke","stroke-width","stroke-dasharray","stroke-linecap","stroke-linejoin","opacity","fill-opacity","stroke-opacity","stop-color","stop-opacity","marker-start","marker-mid","marker-end","clip-path","preserveAspectRatio","vector-effect","paint-order","style"]),Au=new Set(["fill","stroke","marker-start","marker-mid","marker-end","clip-path","style"]),Tu={amp:"&",lt:"<",gt:">",quot:'"',apos:"'","#39":"'"},Ed=t=>t.replace(/&(amp|lt|gt|quot|apos|#39);/g,(e,s)=>Tu[s]);function ic(t,e){return t.startsWith("data-")||t.startsWith("aria-")?/^[a-z][\w-]*$/.test(t):!(!Ou.has(t)||Au.has(t)&&/url\(\s*(?!['"]?#)|javascript:|expression\(|@import/i.test(e))}function oc(t){let e={name:"#root",attrs:[],children:[]},s=[{node:e,dropped:!1}],r=/<(?:!--)[\s\S]*?-->|<\/([a-zA-Z][\w:-]*)\s*>|<([a-zA-Z][\w:-]*)((?:\s+[\w:-]+="[^"]*")*)\s*(\/?)>|([^<]+)/g,i,o=0;for(;i=r.exec(t);){if(i.index!==o)throw new Error(`not the renderer's SVG at ${o}: ${JSON.stringify(t.slice(o,o+40))}`);o=r.lastIndex;let n=s[s.length-1];if(i[0].charAt(1)!=="!"){if(i[1]){if(s.length<2||n.node.name!==i[1])throw new Error(`a stray </${i[1]}>`);s.pop();continue}if(i[2]){let a=i[2],f=[];for(let l of i[3].matchAll(/([\w:-]+)="([^"]*)"/g)){let d=l[1],m=Ed(l[2]);d==="xmlns"||d.startsWith("xmlns:")||ic(d,m)&&f.push([d,m])}let p={name:a,attrs:f,children:[]},c=n.dropped||!Pu.has(a);c||n.node.children.push(p),i[4]||s.push({node:p,dropped:c});continue}!n.dropped&&i[5].trim()&&n.node.children.push(Ed(i[5]))}}if(o!==t.length)throw new Error(`not the renderer's SVG at ${o}`);if(s.length!==1)throw new Error(`<${s[s.length-1].node.name}> is never closed`);return e}var Eu="http://www.w3.org/2000/svg",Nd=t=>t.replace(/var\(--([a-zA-Z][\w-]*)/g,"var(--iso-$1");function Rd(t,e=document){let s=i=>{let o=e.createElementNS(Eu,i.name);for(let[n,a]of i.attrs)n==="style"?o.style.cssText=Nd(a):o.setAttribute(n,/var\(--/.test(a)?Nd(a):a);for(let n of i.children)o.append(typeof n=="string"?e.createTextNode(n):s(n));return o},r=oc(t).children.find(i=>typeof i!="string"&&i.name==="svg");if(!r)throw new Error("the drawing has no <svg>");return s(r)}var Nu=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),Ii=class t{name;attrs=[];children=[];style={};constructor(e){this.name=e}setAttribute(e,s){let r=this.attrs.findIndex(i=>i[0]===e);r>=0?this.attrs[r][1]=String(s):this.attrs.push([e,String(s)])}getAttribute(e){return this.attrs.find(s=>s[0]===e)?.[1]??null}append(...e){for(let s of e)s!=null&&this.children.push(s)}set textContent(e){this.children=[String(e)]}get textContent(){return this.children.map(e=>typeof e=="string"?e:e.textContent).join("")}toNode(){let e=Object.entries(this.style).filter(([,s])=>s!==""&&s!==void 0).map(([s,r])=>`${Nu(s)}:${r}`).join(";");return{name:this.name,attrs:e?[...this.attrs,["style",e]]:[...this.attrs],children:this.children.map(s=>s instanceof t?s.toNode():s)}}},Id={createElementNS:(t,e)=>new Ii(e)},zd=t=>t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),Ru=t=>zd(t).replace(/"/g,"&quot;");function aa(t,e=new Set(["style"])){if(typeof t=="string")return zd(t);let s=t.attrs.map(([i,o])=>` ${i}="${Ru(o)}"`).join("");if(!t.children.length)return`<${t.name}${s}/>`;let r=e.has(t.name)?t.children.map(i=>typeof i=="string"?i.replace(/<\//g,"<\\/"):aa(i,e)).join(""):t.children.map(i=>aa(i,e)).join("");return`<${t.name}${s}>${r}</${t.name}>`}var Iu=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function ac(t){let e=new TextEncoder().encode(t),s=e.length,r=Math.ceil((s+9)/64),i=new Uint8Array(r*64);i.set(e),i[s]=128;let o=new DataView(i.buffer);o.setUint32(i.length-4,s*8>>>0),o.setUint32(i.length-8,Math.floor(s/536870912));let n=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),a=new Uint32Array(64),f=(p,c)=>p>>>c|p<<32-c;for(let p=0;p<r;p++){for(let u=0;u<16;u++)a[u]=o.getUint32(p*64+u*4);for(let u=16;u<64;u++){let b=f(a[u-15],7)^f(a[u-15],18)^a[u-15]>>>3,x=f(a[u-2],17)^f(a[u-2],19)^a[u-2]>>>10;a[u]=a[u-16]+b+a[u-7]+x>>>0}let[c,l,d,m,h,y,g,k]=n;for(let u=0;u<64;u++){let b=k+(f(h,6)^f(h,11)^f(h,25))+(h&y^~h&g)+Iu[u]+a[u]>>>0,x=(f(c,2)^f(c,13)^f(c,22))+(c&l^c&d^l&d)>>>0;k=g,g=y,y=h,h=m+b>>>0,m=d,d=l,l=c,c=b+x>>>0}n[0]+=c,n[1]+=l,n[2]+=d,n[3]+=m,n[4]+=h,n[5]+=y,n[6]+=g,n[7]+=k}return[...n].map(p=>p.toString(16).padStart(8,"0")).join("")}function Cd(t){if(t!=="sha256")throw new Error(`only sha256 here, not ${t}`);let e="",s={update(r){return e+=r,s},digest(r){return ac(e)}};return s}var Ld=t=>{if(t&&typeof t=="object"){Object.freeze(t);for(let e of Object.values(t))Ld(e)}return t},la=[86,81,76],zu=["send","reply","token","blocked","user","event","control","planned"],tn=Ld({light:{paper:"#ffffff",ink:"#141414",steps:[{top:"#f4f4f4",left:"#dcdcdc",right:"#c4c4c4",edge:"#3a3a3a"},{top:"#dedede",left:"#bfbfbf",right:"#a2a2a2",edge:"#2e2e2e"},{top:"#bcbcbc",left:"#9a9a9a",right:"#7e7e7e",edge:"#222222"},{top:"#8f8f8f",left:"#707070",right:"#565656",edge:"#141414"}]},dark:{paper:"#161616",ink:"#f2f2f2",steps:[{top:"#2a2a2a",left:"#222222",right:"#1b1b1b",edge:"#b8b8b8"},{top:"#454545",left:"#383838",right:"#2c2c2c",edge:"#c8c8c8"},{top:"#6a6a6a",left:"#565656",right:"#444444",edge:"#dadada"},{top:"#9c9c9c",left:"#808080",right:"#686868",edge:"#141414"}]},patterns:["none","hatch","hatch-wide","dots"],rhythms:[{dash:[],width:2.6},{dash:[9,4],width:2.4},{dash:[7,6],width:2.4},{dash:[3,6],width:2.4},{dash:[1.5,3.5],width:2.6},{dash:[10,3,2,3],width:2.4},{dash:[],width:1.4},{dash:[7,6],width:1.4},{dash:[3,3],width:1.6},{dash:[14,4],width:1.8}],kindOrder:zu,thresholds:la,darkWidthAdd:.4}),Cu=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i,ju=/^hsl\(\s*([+-]?(?:\d+\.?\d*|\.\d+))\s+([+-]?(?:\d+\.?\d*|\.\d+))%\s+([+-]?(?:\d+\.?\d*|\.\d+))%\s*\)$/i;function Lu(t){if(typeof t!="string")throw new Error(`mono: invalid colour "${String(t)}"`);let e=t.trim(),s=Cu.exec(e);if(s){let i=s[1];return i.length===3?[parseInt(i[0]+i[0],16)/255,parseInt(i[1]+i[1],16)/255,parseInt(i[2]+i[2],16)/255]:[parseInt(i.slice(0,2),16)/255,parseInt(i.slice(2,4),16)/255,parseInt(i.slice(4,6),16)/255]}let r=ju.exec(e);if(r){let i=Number(r[1]),o=Number(r[2]),n=Number(r[3]);if(!Number.isFinite(i)||o<0||o>100||n<0||n>100)throw new Error(`mono: invalid colour "${t}"`);let a=(i%360+360)%360,f=o/100,p=n/100,c=f*Math.min(p,1-p),l=d=>{let m=(d+a/30)%12;return p-c*Math.max(-1,Math.min(m-3,9-m,1))};return[l(0),l(8),l(4)]}throw new Error(`mono: invalid colour "${t}"`)}function lc(t){let[e,s,r]=Lu(t),i=o=>o<=.04045?o/12.92:((o+.055)/1.055)**2.4;return .2126*i(e)+.7152*i(s)+.0722*i(r)}function zi(t){let e=lc(t);return e>216/24389?116*Math.cbrt(e)-16:24389/27*e}function Ci(t,e){let s=lc(t),r=lc(e);return(Math.max(s,r)+.05)/(Math.min(s,r)+.05)}var _u=new Set(tn.patterns),Fu=new Map(tn.kindOrder.map((t,e)=>[t,e])),Du=(t,e)=>t<e?-1:t>e?1:0,jd=t=>[...new Set(t)].sort(Du),Bu=t=>Math.round(t*100)/100;function qu(t){return t>=la[0]?0:t>=la[1]?1:t>=la[2]?2:3}function Vu(t){if(t.roles)for(let[e,s]of Object.entries(t.roles)){if(s.step!==void 0&&(typeof s.step!="number"||!Number.isInteger(s.step)||s.step<0||s.step>3))throw new Error(`mono: invalid step "${String(s.step)}" for role "${e}"`);if(s.pattern!==void 0&&(typeof s.pattern!="string"||!_u.has(s.pattern)))throw new Error(`mono: invalid pattern "${String(s.pattern)}" for role "${e}"`)}if(t.kinds)for(let[e,s]of Object.entries(t.kinds)){if(s.dash!==void 0&&(!Array.isArray(s.dash)||!s.dash.every(r=>typeof r=="number"&&Number.isFinite(r)&&r>=0)))throw new Error(`mono: invalid dash "${String(s.dash)}" for kind "${e}"`);if(s.width!==void 0&&(typeof s.width!="number"||!Number.isFinite(s.width)||s.width<=0))throw new Error(`mono: invalid width "${String(s.width)}" for kind "${e}"`)}}function ca(t,e,s,r){if(e!=="light"&&e!=="dark")throw new Error(`mono: invalid mode "${String(e)}"`);r&&Vu(r);let i=tn[e],o=[],n=t.light["l-top"],a=jd(s?.roles??Object.keys(t.roles)),f=new Map,p=[[],[],[],[]];for(let g of a){let k=r?.roles?.[g]?.step,u;if(k!==void 0)u=k;else{let b=t.roles[g];if(!b)throw new Error(`mono: unknown role "${g}"`);if(typeof n!="string")throw new Error('mono: theme.light is missing "l-top"');u=qu(zi(`hsl(${b.h} ${b.s}% ${n})`))}f.set(g,u),p[u].push(g)}let c=new Map;for(let g=0;g<p.length;g++){let k=p[g];for(let u=0;u<k.length;u++){let b=k[u],x=r?.roles?.[b]?.pattern;if(x!==void 0)c.set(b,x);else{let w=u%tn.patterns.length,$=tn.patterns[w];if(c.set(b,$),u>=tn.patterns.length){let v=k.slice(0,u).find(O=>c.get(O)===$);v!==void 0&&o.push(`role "${b}" wraps on step ${g} to pattern "${$}", matching "${v}"`)}}}}let l={};for(let g of a){let k=f.get(g),u=c.get(g),b=i.steps[k];l[g]={step:k,pattern:u,top:b.top,left:b.left,right:b.right,edge:b.edge}}let d=jd(s?.kinds??Object.keys(t.kinds)),m=e==="dark"?tn.darkWidthAdd:0,h={},y=0;for(let g of d){let k=r?.kinds?.[g],u=Fu.get(g),b;if(u!==void 0)b=u;else if(b=tn.kindOrder.length+y,y++,b>=tn.rhythms.length){let v=b%tn.rhythms.length;(!k||k.dash===void 0||k.width===void 0)&&o.push(`kind "${g}" exceeds the ${tn.rhythms.length} line rhythms; reusing rhythm ${v}`),b=v}let x=tn.rhythms[b],w=k?.dash!==void 0?[...k.dash]:[...x.dash],$=k?.width!==void 0?k.width:Bu(x.width+m);h[g]={dash:w,width:$}}return{mode:e,paper:i.paper,ink:i.ink,roles:l,kinds:h,warnings:o}}var Rf={};ho(Rf,{ANTS_CSS:()=>pf,ANT_DASH:()=>Nc,ANT_SPEED:()=>Gi,ANT_STILL:()=>Rc,ASSEMBLE_STYLES:()=>jr,BOARD_3D:()=>qs,BOARD_CSS:()=>Tf,DISASSEMBLE_STYLES:()=>Lr,EASING_NAMES:()=>Yi,EXTRAPOLATE:()=>or,FLAT_DEFAULTS:()=>Hc,FLAT_FONTS:()=>Yc,FONT_STACKS:()=>Lc,GRID_CSS:()=>eo,LABEL_BUDGET:()=>Ia,MARKS_CSS:()=>Qi,MOTION_EASINGS:()=>Qd,MOTION_ORDERS:()=>sr,MOTION_SCHEMA:()=>hf,MotionBuilder:()=>Ui,NodesBuilder:()=>Dr,Obstacles:()=>nr,PAGE_CSS:()=>Kc,PLAYER_CSS:()=>Za,PLAYER_UI_CSS:()=>Gc,ROUTE_BUDGET:()=>wa,SeriesBuilder:()=>Br,WALL_T:()=>ps,alongPath:()=>Ta,antDash:()=>Zi,antsOf:()=>Ss,assemble:()=>Ec,assembly:()=>Pa,baseCss:()=>Ur,bezier:()=>Ds,bindMotion:()=>vs,boardCatalog:()=>Ef,boardDiagram:()=>Nf,boardErrors:()=>Ya,boardOf:()=>Wa,boxAsset:()=>an,boxSilhouette:()=>Sf,calloutRect:()=>xc,cardAsset:()=>Wc,checkMotion:()=>Fa,cloudPath:()=>mc,compileRaw:()=>Ua,convexOverlap:()=>Bi,curveAt:()=>Vr,defaultLabel:()=>Dd,disassemble:()=>lf,drawCloud:()=>Er,drawDecos:()=>fc,drawLooks:()=>Ca,drawingCss:()=>ar,durationFor:()=>qc,easeOf:()=>Xn,facePainter:()=>tr,flatHit:()=>Af,floorAt:()=>Rr,floorOf:()=>vf,focusView:()=>_a,gateBox:()=>Fi,iconPainter:()=>ji,inConvex:()=>kc,introSvg:()=>cf,kindsCss:()=>da,labelRect:()=>qi,layoutFlat:()=>Hr,lineRectArea:()=>Zd,localAt:()=>$f,markCss:()=>fa,metricsMeasure:()=>Of,midpoint:()=>Vc,monoCss:()=>Bc,monoOfDrawing:()=>Ka,monoTheme:()=>Dc,motion:()=>ff,motionModel:()=>rr,motionOfSteps:()=>Da,motionOrder:()=>Oc,motionSource:()=>Ji,msOf:()=>Jn,noSource:()=>Zc,nodeKind:()=>er,nodeKindOr:()=>An,offscreen:()=>Cr,openList:()=>yc,overlap2:()=>ua,overlaps:()=>Ha,paddingOf:()=>Mf,paint:()=>Ea,paintMono:()=>Va,parseEnd:()=>wn,place:()=>Nr,placeBoard:()=>to,placeCallout:()=>va,placeNodeLabel:()=>Vi,placeholderIcon:()=>dc,planOf:()=>_r,plate:()=>Li,polyBounds:()=>Hn,polyRectArea:()=>zr,readMs:()=>Wi,rectArea:()=>wc,regionKind:()=>Ot,regionRole:()=>za,registerMarks:()=>Fd,renderScene:()=>Fr,resolveSteps:()=>Ga,resolveSvg:()=>Zr,routeAll:()=>xa,screenToGrid:()=>kf,silhouette:()=>Yt,simplify:()=>Di,snapMove:()=>Pf,springAt:()=>qr,svgAt:()=>Ki,usedIn:()=>Fc,wallHeight:()=>pa,wallsOf:()=>Ra,withAnts:()=>ja});var Ot=(t,e)=>e!==void 0&&Object.hasOwn(t.regions,e)?t.regions[e]:void 0,er=(t,e)=>t.nodes[e??t.defaultNode],An=(t,e)=>er(t,e)??t.nodes[t.defaultNode],pa=t=>Object.values(t.regions).find(e=>e.shape==="walled")?.z[1]??.8,da=t=>Object.values(t.regions).map(e=>e.css??"").join("");var cc=Object.create(null),pc=[];function Fd(t){Object.assign(cc,t.icons??{}),Object.assign(gr,t.faces??{}),t.css&&!pc.includes(t.css)&&pc.push(t.css)}var fa=()=>pc.join(""),ji=t=>Object.hasOwn(cc,t)?cc[t]:void 0,tr=t=>Object.hasOwn(gr,t)?gr[t]:void 0;function dc(t,e){let s=(e.x0+e.x1)/2,r=(e.y0+e.y1)/2,i=e.z1+.005,o=Math.min(.6,(e.x1-e.x0)*.24,(e.y1-e.y0)*.24),n=[[s-o,r-o,i],[s+o,r-o,i],[s+o,r+o,i],[s-o,r+o,i]];return t.poly(n,"ico-unknown")+t.line3([s-o*.3,r-o*.35,i],[s+o*.3,r-o*.35,i],"ico-unknown-q")+t.line3([s+o*.3,r-o*.35,i],[s,r+o*.1,i],"ico-unknown-q")+t.line3([s,r+o*.45,i],[s,r+o*.5,i],"ico-unknown-q")}function fc(t,e,s){let r="";for(let i of s??[])i==="terminal"?r+=pi(t,e,3):i==="envelope"?r+=yo(t,e):i==="bubble"?r+=go(t,e):i==="file-lines"?r+=bo(t,e):typeof i=="object"&&(i.terminal&&(r+=pi(t,e,i.terminal)),i.icon&&(r+=(ji(i.icon)??dc)(t,e)));return r}var Ku=(t,e)=>(t.deco??e.deco??[]).filter(s=>s!=="ghost");function an(t,e,s,r,i,o){let n={name:t,description:e,size:s,role:r,deco:i,draw:(a,f,p)=>a.blockFaces(f)+fc(a,f,Ku(p,n))+(o?o(a,f):"")};return n}function Li(t){let[e,s]=Hs(t);return{x0:e-.75,y0:s-.75,x1:e+.75,y1:s+.75,z0:t.z0,z1:t.z0+.18}}function mc(t,e){let s=Math.max(8,Math.min(t,e)*.18),r=s*.55,i=r,o=r,n=t-r,a=e-r,f=(p,c,l,d)=>{let m=Math.hypot(l-p,d-c),h=Math.max(1,Math.round(m/(s*1.7))),y="";for(let g=1;g<=h;g++){let k=p+(l-p)*g/h,u=c+(d-c)*g/h,b=m/h/2*1.08;y+=` A${b.toFixed(1)},${b.toFixed(1)} 0 0 1 ${k.toFixed(1)},${u.toFixed(1)}`}return y};return`M${i.toFixed(1)},${o.toFixed(1)}`+f(i,o,n,o)+f(n,o,n,a)+f(n,a,i,a)+f(i,a,i,o)+"Z"}function Er(t,e){let s={...e,z0:e.z1},r=a=>{let[f,p]=Ne(e.x0,e.y0,a);return[Ct,.5,-Ct,.5,f,p]},i=(e.x1-e.x0)*lt,o=(e.y1-e.y0)*lt,n=mc(i,o);return t.onMatrix(r(e.z0),i,o,()=>Se("path",{d:n,class:"lft cloud-side"}))+t.onMatrix(r(e.z1),i,o,()=>Se("path",{d:n,class:"top cloud-top"}))}function Dd(t,e){let[s,r]=Ne((t.x0+t.x1)/2,(t.y0+t.y1)/2,t.z1+.75);return{x:s,y:r-18+(e?0:6),anchor:"middle"}}var ps=.16,uc=["right-of","left-of","below","behind"];function Nr(t,e,s,r,i,o={},n){let a=[],f=(M,T,S,N=!1,z="error")=>{let K=s.locate(M,{key:N});a.push({severity:z,message:T,line:K.line,col:K.col,path:M,hint:S})},p=[],c=new Map,l=[],d=new Map,m=new Set([...Object.keys(r.roles),...Object.keys(o)]);function h(M,T){let S=c.get(M.id);if(S){let N=s.locate(S.path+"/id");return f(M.path+"/id",`duplicate id "${M.id}" (first used on line ${N.line})`),!1}return c.set(M.id,M),p.push(M),M.parent=T,T?T.children.push(M):l.push(M),!0}let y=()=>({x0:0,y0:0,z0:0,x1:0,y1:0,z1:0});function g(M,T,S){let N={id:M.id,type:"node",path:T,children:[],box:y(),floor:0,node:M,appears:M.appears,disappears:M.disappears};h(N,S)&&(M.nodes??[]).forEach((z,K)=>g(z,`${T}/nodes/${K}`,N))}function k(M,T,S){let N={id:M.id,type:"region",path:T,children:[],box:y(),floor:0,region:M,appears:M.appears,disappears:M.disappears};h(N,S)&&((M.nodes??[]).forEach((z,K)=>g(z,`${T}/nodes/${K}`,N)),(M.regions??[]).forEach((z,K)=>k(z,`${T}/regions/${K}`,N)))}(t.regions??[]).forEach((M,T)=>k(M,`${e}/regions/${T}`,void 0)),(t.nodes??[]).forEach((M,T)=>g(M,`${e}/nodes/${T}`,void 0));let u=()=>c.keys(),b=()=>p.filter(M=>M.type==="region").map(M=>M.id);for(let M of[...p]){let T=M.node??M.region;if(T.in!==void 0){let N=c.get(T.in);if(!N){f(M.path+"/in",`unknown region "${T.in}"`+_i(T.in,b()));continue}if(N.type!=="region"){f(M.path+"/in",`"${T.in}" is a node, not a region; put nodes on a node with its own "nodes:" list`);continue}if(M.parent&&M.parent!==N){f(M.path+"/in",`"${M.id}" is written inside "${M.parent.id}" but says in: ${T.in}; use one or the other`);continue}for(let z=N;z;z=z.parent)if(z===M){f(M.path+"/in",`"${M.id}" cannot be inside itself`);continue}M.parent||(l.splice(l.indexOf(M),1),M.parent=N,N.children.push(M))}if(M.node){let N=M.node.asset;N!==void 0&&!er(i,N)&&f(M.path+"/asset",`unknown asset "${N}"`+_i(N,Object.keys(i.nodes)),`assets: ${Object.keys(i.nodes).join(", ")}`)}let S=(M.node??M.region).role;S!==void 0&&!m.has(S)&&f(M.path+"/role",`unknown colour role "${S}"`+_i(S,m),`add it under "roles:" at the top of the file, or use one of: ${[...m].join(", ")}`)}for(let M of p){let T=M.region?.gate;if(!T?.node)continue;let S=c.get(T.node);if(!S){f(M.path+"/gate/node",`unknown node "${T.node}"`+_i(T.node,u()));continue}if(S.type!=="node"){f(M.path+"/gate/node",`"${T.node}" is a region; a gate is a node`);continue}S.placedBy=M.id;let N=S.node;(N.at||uc.some(z=>N[z]))&&f(S.path,`"${S.id}" is the gate of "${M.id}", which places it; its own placement is ignored`,void 0,!1,"warning")}let x=M=>M.gap??t.gap??2;function w(M){let T=M.node,S=An(i,T.asset),N=T.size,z=S.size[0],K=S.size[1],J=S.size[2];if(N&&(z=N[0],K=N[1],N.length>2&&(J=N[2])),M.placedBy){let Z=c.get(M.placedBy).region,L=Z.gate,U=L.width??2,H=N?Math.min(z,K):.3;J=N&&N.length>2?J:L.height??(Z.height??pa(i))+.3,L.side==="e"||L.side==="w"?(z=H,K=U):(z=U,K=H)}return[z,K,J]}function $(M,T,S,N,z){for(let Y of T)O(Y);let K=T.filter(Y=>!Y.placedBy),J=new Set(K),Z=new Set,L=[],U=new Set,H=Y=>{let ie=Y.node??Y.region,Ae=[];for(let De of uc){let I=ie[De];if(I===void 0)continue;let V=c.get(I);if(!V){f(`${Y.path}/${De}`,`unknown id "${I}"`+_i(I,u()));continue}if(V===Y){f(`${Y.path}/${De}`,`"${Y.id}" cannot be placed ${De} itself`);continue}if(!J.has(V)){let te=ae=>ae.parent?`"${ae.parent.id}"`:"the scene";f(`${Y.path}/${De}`,`"${I}" is in ${te(V)} but "${Y.id}" is in ${te(Y)}; relative placement works between items in the same region`,V.placedBy?`"${I}" is a gate, placed by its ${c.get(V.placedBy)?.region?.kind??"region"}`:`place "${Y.id}" relative to something in ${te(Y)}, or use "at:"`);continue}Ae.push(V)}if(!Ae.length&&!ie.at){let De=K.indexOf(Y);De>0&&Ae.push(K[De-1])}return Ae},ee=Y=>{if(!Z.has(Y)){if(U.has(Y)){f(Y.path,`placement loop: "${Y.id}" is placed relative to something placed relative to it`);return}U.add(Y),H(Y).forEach(ee),U.delete(Y),Z.add(Y),L.push(Y)}};K.forEach(ee);for(let Y of L){let ie=Y.node??Y.region,Ae=d.get(Y),De=uc.find(I=>ie[I]!==void 0&&c.get(ie[I])&&J.has(c.get(ie[I])));if(ie.at&&De&&f(`${Y.path}/at`,`"${Y.id}" has both "at" and "${De}"; "at" wins`,void 0,!0,"warning"),ie.at)Ae.x=ie.at[0],Ae.y=ie.at[1];else if(De)v(Ae,d.get(c.get(ie[De])),De,x(ie),ie.align??"center");else{let I=K.indexOf(Y);I>0?v(Ae,d.get(K[I-1]),N==="row"?"right-of":"below",x(ie),"center"):(Ae.x=S,Ae.y=S)}ie.shift&&(Ae.x+=ie.shift[0],Ae.y+=ie.shift[1])}if(z||!K.length)return{w:0,d:0};let j=1/0,q=1/0,G=-1/0,Q=-1/0;for(let Y of K){let ie=d.get(Y);j=Math.min(j,ie.x),q=Math.min(q,ie.y),G=Math.max(G,ie.x+ie.w),Q=Math.max(Q,ie.y+ie.d)}let ce=Math.min(0,j-S),pe=Math.min(0,q-S);if(ce||pe)for(let Y of K){let ie=d.get(Y);ie.x-=ce,ie.y-=pe}return{w:G-ce+S,d:Q-pe+S}}function v(M,T,S,N,z){let K=()=>{M.y=z==="start"?T.y:z==="end"?T.y+T.d-M.d:T.y+(T.d-M.d)/2},J=()=>{M.x=z==="start"?T.x:z==="end"?T.x+T.w-M.w:T.x+(T.w-M.w)/2};S==="right-of"?(M.x=T.x+T.w+N,K()):S==="left-of"?(M.x=T.x-N-M.w,K()):S==="below"?(M.y=T.y+T.d+N,J()):(M.y=T.y-N-M.d,J())}function O(M){if(M.type==="node"){let[L,U,H]=w(M);d.set(M,{x:0,y:0,w:L,d:U,h:H,z:M.node.z??0}),M.children.length&&$(M,M.children,0,"row",!0);return}let T=M.region,S=T.padding??Ot(i,T.kind)?.pad,N=!!T.size,z=$(M,M.children,S,T.flow??"row",N),K=T.size?T.size[0]:Math.max(z.w,S*2+.5),J=T.size?T.size[1]:Math.max(z.d,S*2+.5);if(!T.size&&T.gate){let L=(T.gate.width??2)+1;T.gate.side==="e"||T.gate.side==="w"?J=Math.max(J,L):K=Math.max(K,L)}let Z=T.size&&T.size.length>2?T.size[2]:T.height??Ot(i,T.kind).z[1];d.set(M,{x:0,y:0,w:K,d:J,h:Z,z:0})}$(void 0,l,0,t.flow??"row",!0);function C(M,T,S,N){let z=d.get(M),K=T+z.x,J=S+z.y;if(M.type==="region"){let Z=Ot(i,M.region.kind),[L]=Z.z,U=Z.floor,H=Z.shape==="slab"&&Ot(i,M.parent?.region?.kind)?.shape==="slab"?0:L,ee=M.region.z??0,j=N+H+ee,q=N+z.h+ee;M.box={x0:K,y0:J,z0:j,x1:K+z.w,y1:J+z.d,z1:q},M.floor=U?q:N}else{let Z=N+z.z;M.box={x0:K,y0:J,z0:Z,x1:K+z.w,y1:J+z.d,z1:Z+z.h},M.floor=M.box.z1}for(let Z of M.children)Z.placedBy||C(Z,K,J,M.floor)}for(let M of l)M.placedBy||C(M,0,0,0);if(n){let M=S=>Math.round(S/n)*n,T=S=>Math.round(S*1e9)/1e9;for(let S of p){if(S.placedBy)continue;let N=S.box,z=M(N.x0),K=M(N.x1),J=M(N.y0),Z=M(N.y1);K-z<n&&(K=z+n),Z-J<n&&(Z=J+n),S.box={...N,x0:T(z),x1:T(K),y0:T(J),y1:T(Z)};let L=S.node??S.region;L.at&&L.at.forEach((U,H)=>{let ee=U/n;Math.abs(ee-Math.round(ee))>1e-6&&f(`${S.path}/at/${H}`,`${U} is not on the ${n} grid; it is drawn at ${T(M(U))}`,void 0,!1,"warning")})}}for(let M of p){let T=M.region?.gate;if(!T?.node)continue;let S=c.get(T.node);!S||S.placedBy!==M.id||(S.box=Fi(M,d.get(S).h,d.get(S).w,d.get(S).d),S.floor=S.box.z1)}for(let M of p){let T=M.children.filter(S=>!S.placedBy);for(let S=0;S<T.length;S++)for(let N=S+1;N<T.length;N++){let z=T[S],K=T[N];ma(z,i)||ma(K,i)||ua(z.box,K.box)&&f(K.path,`"${K.id}" overlaps "${z.id}"`,'move one with "at", a relative placement, "gap" or "shift"',!1,"warning")}if(M.parent&&M.parent.type==="region"&&!M.placedBy){let S=M.parent.box,N=M.box,z=1e-6;(N.x0<S.x0-z||N.y0<S.y0-z||N.x1>S.x1+z||N.y1>S.y1+z)&&f(M.path,`"${M.id}" sticks out of region "${M.parent.id}"`,`make "${M.parent.id}" bigger, or leave out its "size" so it fits its contents`,!1,"warning")}}{let M=l.filter(T=>!T.placedBy);for(let T=0;T<M.length;T++)for(let S=T+1;S<M.length;S++){let N=M[T],z=M[S];ua(N.box,z.box)&&!ma(N,i)&&!ma(z,i)&&f(z.path,`"${z.id}" overlaps "${N.id}"`,'move one with "at", a relative placement, "gap" or "shift"',!1,"warning")}}let A=new Set,R=a.filter(M=>{let T=M.path+M.message;return A.has(T)?!1:(A.add(T),!0)});return{items:p,byId:c,roots:l,diags:R,catalog:i}}var ma=(t,e)=>t.type==="region"&&["zone","tunnel"].includes(Ot(e,t.region.kind)?.shape??"");function Fi(t,e,s,r){let i=t.region.gate,o=t.box,n=t.box.z0,a=i.at??.5,f=i.width??2;if(i.side==="w"||i.side==="e"){let l=i.side==="w"?o.x0+ps/2:o.x1-ps/2,d=o.y0+(o.y1-o.y0)*a;return{x0:l-s/2,x1:l+s/2,y0:d-f/2,y1:d+f/2,z0:n,z1:n+e}}let p=i.side==="n"?o.y0+ps/2:o.y1-ps/2,c=o.x0+(o.x1-o.x0)*a;return{x0:c-f/2,x1:c+f/2,y0:p-r/2,y1:p+r/2,z0:n,z1:n+e}}function ua(t,e,s=1e-6){return t.x0<e.x1-s&&e.x0<t.x1-s&&t.y0<e.y1-s&&e.y0<t.y1-s}function _i(t,e){let s=Vt(t,e);return s?` (did you mean "${s}"?)`:""}var ks=.2,ha=.05,Gu=.6,ya=.25,ga={n:[0,-1],s:[0,1],e:[1,0],w:[-1,0]};function wn(t){let e=/^(.*?)(?:\.(n|e|s|w|top))?$/.exec(t);return{id:e[1],side:e[2]}}var Bd=new WeakMap;function Rr(t,e,s){let r=Bd.get(t);if(!r){r=[];for(let n of t.items){if(n.type!=="region"||!Ot(t.catalog,n.region.kind)?.floor)continue;let a=0;for(let f=n.parent;f;f=f.parent)a++;r.push({r:n,d:a})}Bd.set(t,r)}let i=0,o=-1;for(let{r:n,d:a}of r){let f=n.box,p=1e-6;e>=f.x0-p&&e<=f.x1+p&&s>=f.y0-p&&s<=f.y1+p&&a>o&&(o=a,i=n.floor)}return i}function Zu(t,e){let s=[(t.x0+t.x1)/2,(t.y0+t.y1)/2],r=[(e.x0+e.x1)/2,(e.y0+e.y1)/2],i=r[0]-s[0],o=r[1]-s[1],n=Math.max(e.x0-t.x1,t.x0-e.x1),a=Math.max(e.y0-t.y1,t.y0-e.y1);return n>0&&(a<=0||n>=a)?i>0?"e":"w":a>0?o>0?"s":"n":Math.abs(i)>=Math.abs(o)?i>0?"e":"w":o>0?"s":"n"}var wa=5e5;function xa(t,e,s,r,i,o){let n=[],a=(b,x,w,$="error")=>{let v=r.locate(b);n.push({severity:$,message:x,line:v.line,col:v.col,path:b,hint:w})},f=t.routes??[],p={left:wa},c=0,l=()=>s.items.map(b=>b.id),d=new Map,m=[],h=[];f.forEach((b,x)=>{let w=`${e}/routes/${x}`;(d.has(b.id)||s.byId.has(b.id))&&a(w+"/id",`duplicate id "${b.id}"`),d.set(b.id,x);let $=b.kind??"send";i.has($)||a(w+"/kind",`unknown flow kind "${$}"`+hc($,i),`kinds: ${[...i].join(", ")}; add one under "kinds:"`);let v={id:b.id,raw:b,path:w,kind:$,points:[]},O=(C,A)=>{let{id:R}=wn(C),M=s.byId.get(R);if(!M){a(`${w}/${A}`,`unknown node "${R}"`+hc(R,l()));return}return M};v.from=O(b.from,"from"),v.to=O(b.to,"to"),m.push(v),h.push({r:v})});let y=new Map;for(let b of h){let{r:x}=b;if(!x.from||!x.to||x.raw.points)continue;let w=wn(x.raw.from).side,$=wn(x.raw.to).side,v=x.raw.via?.[0],O=x.raw.via?.[x.raw.via.length-1],C=(T,S)=>{if(Array.isArray(T))return{x0:T[0],x1:T[0],y0:T[1],y1:T[1],z0:0,z1:0};if(typeof T=="string"){let N=s.byId.get(wn(T).id);if(N)return N.box}return S.box},A=(T,S,N)=>{let z=S??Zu(T.box,N);return{node:T,side:z,explicit:!!S,p:[0,0],z:0}};b.a=A(x.from,w,C(v,x.to)),b.b=A(x.to,$,C(O,x.from));let R=C(v,x.to),M=C(O,x.from);for(let[T,S]of[[b.a,R],[b.b,M]]){let N=`${T.node.id}.${T.side}`;y.has(N)||y.set(N,[]),y.get(N).push({e:T,other:[(S.x0+S.x1)/2,(S.y0+S.y1)/2]})}}for(let[,b]of y){let x=b[0].e,w=x.node.box,$=x.side,v=$==="e"||$==="w"?1:0;b.sort((T,S)=>T.other[v]-S.other[v]);let O=v?w.y0:w.x0,C=v?w.y1:w.x1,A=(O+C)/2,R=Math.max(0,C-O-.3),M=b.length>1?Math.min(Gu,R/(b.length-1)):0;b.forEach((T,S)=>{let N=(S-(b.length-1)/2)*M,z=A+N,K=T.e.node.box.z0;if($==="top"){T.e.p=[(w.x0+w.x1)/2,(w.y0+w.y1)/2],T.e.z=w.z1;return}let[J,Z]=ga[$];T.e.p=v?[J>0?w.x1+ha:w.x0-ha,z]:[z,Z>0?w.y1+ha:w.y0-ha],T.e.z=K})}let g=[];for(let b of s.items)b.type==="node"&&g.push(b.box);let k=[];for(let b of s.items.filter(x=>Ot(s.catalog,x.region?.kind)?.shape==="walled")){let{x0:x,y0:w,x1:$,y1:v}=b.box,O=ps,C=b.region.gate,A=[[{x0:x,y0:w,x1:$,y1:w+O,z0:0,z1:0},"n"],[{x0:x,y0:v-O,x1:$,y1:v,z0:0,z1:0},"s"],[{x0:x,y0:w,x1:x+O,y1:v,z0:0,z1:0},"w"],[{x0:$-O,y0:w,x1:$,y1:v,z0:0,z1:0},"e"]];for(let[R,M]of A)if(C&&C.side===M){if(C.node)continue;let T=C.at??.5,S=C.width??2;if(M==="e"||M==="w"){let N=w+(v-w)*T;k.push({...R,y1:N-S/2},{...R,y0:N+S/2})}else{let N=x+($-x)*T;k.push({...R,x1:N-S/2},{...R,x0:N+S/2})}}else k.push(R)}let u=new Map;for(let b of h){let{r:x,a:w,b:$}=b;if(x.raw.points){x.points=x.raw.points.map(z=>[z[0],z[1],z.length>2?z[2]:Rr(s,z[0],z[1])+.01]);continue}if(!w||!$)continue;let v=[];(x.raw.via??[]).forEach((z,K)=>{if(Array.isArray(z))if(o){let J=Z=>Math.round(Math.round(Z/o)*o*1e9)/1e9;z.forEach((Z,L)=>{Math.abs(Z/o-Math.round(Z/o))>1e-6&&a(`${x.path}/via/${K}/${L}`,`${Z} is not on the ${o} grid; it is drawn at ${J(Z)}`,void 0,"warning")}),v.push({p:[J(z[0]),J(z[1])]})}else v.push({p:[z[0],z[1]]});else{let{id:J,side:Z}=wn(z),L=s.byId.get(J);if(!L){a(`${x.path}/via/${K}`,`unknown node "${J}"`+hc(J,l()));return}let U=Z&&Z!=="top"?Z:"n",[H,ee]=ga[U],j=L.box;v.push({p:[H?H>0?j.x1+.4:j.x0-.4:(j.x0+j.x1)/2,ee?ee>0?j.y1+.4:j.y0-.4:(j.y0+j.y1)/2]})}});let C=g.filter(z=>z!==w.node.box&&z!==$.node.box).concat(x.raw.cross?[]:k).filter(z=>!ba(w.node.box,z)&&!ba($.node.box,z)&&!ba(z,w.node.box)&&!ba(z,$.node.box)),A=w.side==="top"?void 0:ga[w.side],R=$.side==="top"?void 0:ga[$.side],M=[w.p,...v.map(z=>z.p),$.p],T=[w.p],S=A,N=!0;for(let z=0;z+1<M.length;z++){let K=z+2===M.length,J=Hu(M[z],M[z+1],C,u,S,K&&R?[-R[0],-R[1]]:void 0,p);if(!J){N=!1;break}T.push(...J.slice(1));let Z=T.length;if(Z>=2){let L=Math.sign(T[Z-1][0]-T[Z-2][0]),U=Math.sign(T[Z-1][1]-T[Z-2][1]);S=[L,U]}}!N&&p.left<=0?(c++,T=[w.p,[$.p[0],w.p[1]],$.p]):N||(a(x.path,`no path found for route "${x.id}" from "${w.node.id}" to "${$.node.id}"`,'add "via" points, or use "points" to draw it by hand',"warning"),T=[w.p,[$.p[0],w.p[1]],$.p]),T=Di(T);for(let z=0;z+1<T.length;z++)Uu(u,T[z],T[z+1]);x.points=Ju(s,T,w,$)}return c&&a(e,`${c} of ${m.length} routes were drawn as plain elbows: the scene is too large to route them all around what stands in the way (${wa.toLocaleString("en")} search steps)`,'split it into scenes, or give the busiest routes "via" points or "points"',"warning"),{routes:m,diags:n}}function ba(t,e){return e.x0>=t.x0-1e-6&&e.x1<=t.x1+1e-6&&e.y0>=t.y0-1e-6&&e.y1<=t.y1+1e-6&&e.z0>=t.z1-1e-6}var qd=(t,e)=>`${Math.round(t/ks)},${Math.round(e/ks)}`;function Uu(t,e,s){let r=Math.max(1,Math.round(Math.hypot(s[0]-e[0],s[1]-e[1])/ks));for(let i=0;i<=r;i++){let o=qd(e[0]+(s[0]-e[0])*i/r,e[1]+(s[1]-e[1])*i/r);t.set(o,(t.get(o)??0)+1)}}function Vd(t,e,s){for(let r of s)if(t>r.x0-ya&&t<r.x1+ya&&e>r.y0-ya&&e<r.y1+ya)return!0;return!1}function Hu(t,e,s,r,i,o,n={left:1/0}){if((Math.abs(t[0]-e[0])<1e-6||Math.abs(t[1]-e[1])<1e-6)&&Wu(t,e,s)){let L=[Math.sign(e[0]-t[0]),Math.sign(e[1]-t[1])],U=!i||i[0]===L[0]&&i[1]===L[1],H=!o||o[0]===L[0]&&o[1]===L[1];if(U&&H)return[t,e]}if(n.left<=0)return null;let a=L=>Math.round((L-t[0])/ks),f=L=>Math.round((L-t[1])/ks),p=L=>t[0]+L*ks,c=L=>t[1]+L*ks,l=a(e[0]),d=f(e[1]),m=30,h=Math.min(0,l)-m,y=Math.max(0,l)+m,g=Math.min(0,d)-m,k=Math.max(0,d)+m,u=1.2,b=ks,x=.06,w=[[1,0],[-1,0],[0,1],[0,-1]],$=y-h+1,v=k-g+1,O=(L,U)=>(L-h)*v+(U-g),C=new Int8Array($*v).fill(-1),A=new Float64Array($*v).fill(-1),R=new Float64Array($*v*4).fill(1/0),M=(L,U)=>{let H=O(L,U);return C[H]<0&&(C[H]=Vd(p(L),c(U),s)?1:0),C[H]===1},T=(L,U)=>{let H=O(L,U);return A[H]<0&&(A[H]=r.get(qd(p(L),c(U)))??0),A[H]},S=yc(),N=(L,U)=>(Math.abs(L-l)+Math.abs(U-d))*b,z=i?w.findIndex(L=>L[0]===i[0]&&L[1]===i[1]):-1;S.push({i:0,j:0,d:z,g:0,f:N(0,0),idx:0,hp:0});let K=(L,U)=>Math.abs(L)+Math.abs(U)<=2,J=(L,U)=>Math.abs(L-l)+Math.abs(U-d)<=2,Z=0;for(;S.length()&&Z++<2e5;){if(n.left--<=0)return null;let L=S.take();if(L.i===l&&L.j===d&&!(o&&L.d>=0&&(w[L.d][0]!==o[0]||w[L.d][1]!==o[1]))){let U=[];for(let H=L;H;H=H.prev)U.push([p(H.i),c(H.j)]);return U.reverse(),U[0]=t,Yu(Di(U),e)}for(let U=0;U<4;U++){let H=w[U];if(L.d>=0&&H[0]===-w[L.d][0]&&H[1]===-w[L.d][1])continue;let ee=L.i+H[0],j=L.j+H[1];if(ee<h||ee>y||j<g||j>k||!K(ee,j)&&!J(ee,j)&&M(ee,j))continue;if((K(ee,j)||J(ee,j))&&M(ee,j)&&!(ee===l&&j===d)){let ce=K(ee,j)?i:o&&[-o[0],-o[1]];if(!ce||(K(ee,j)?H[0]!==ce[0]||H[1]!==ce[1]:H[0]!==o[0]||H[1]!==o[1]))continue}let q=L.d>=0&&L.d!==U?u:0,G=L.g+b+q+T(ee,j)*x,Q=O(ee,j)*4+U;R[Q]<=G||(R[Q]=G,S.push({i:ee,j,d:U,g:G,f:G+N(ee,j),prev:L,idx:0,hp:0}))}}return null}function yc(){let t=[],e=[],s=(n,a)=>n.f<a.f||n.f===a.f&&n.idx<a.idx,r=(n,a)=>{let f=e[n];e[n]=e[a],e[a]=f,e[n].hp=n,e[a].hp=a},i=n=>{for(;n>0;){let a=n-1>>1;if(!s(e[n],e[a]))break;r(n,a),n=a}},o=n=>{for(;;){let a=2*n+1,f=a+1,p=n;if(a<e.length&&s(e[a],e[p])&&(p=a),f<e.length&&s(e[f],e[p])&&(p=f),p===n)return;r(n,p),n=p}};return{length:()=>t.length,push(n){n.idx=t.length,t.push(n),n.hp=e.length,e.push(n),i(n.hp)},take(){let n=e[0],a=e.pop();e.length&&(e[0]=a,a.hp=0,o(0));let f=t.pop();return f!==n&&(t[n.idx]=f,f.idx=n.idx,i(f.hp)),n}}}function Yu(t,e){let s=t.map(o=>[o[0],o[1]]),r=s.length,i=s[r-1];if(r>=2){let o=s[r-2];Math.abs(o[1]-i[1])<1e-9?(o[1]=e[1],r>=3&&Math.abs(s[r-3][1]-i[1])<1e-9&&(s[r-3][1]=e[1])):Math.abs(o[0]-i[0])<1e-9&&(o[0]=e[0],r>=3&&Math.abs(s[r-3][0]-i[0])<1e-9&&(s[r-3][0]=e[0]))}return s[r-1]=e,Di(s)}function Wu(t,e,s){let r=Math.max(1,Math.round(Math.hypot(e[0]-t[0],e[1]-t[1])/(ks/2)));for(let i=2;i<r-1;i++)if(Vd(t[0]+(e[0]-t[0])*i/r,t[1]+(e[1]-t[1])*i/r,s))return!1;return!0}function Di(t){let e=[];for(let s of t){let r=e.length;if(!(r&&Math.abs(e[r-1][0]-s[0])<1e-6&&Math.abs(e[r-1][1]-s[1])<1e-6)){if(r>=2){let i=e[r-2],o=e[r-1];if(Math.abs(i[0]-o[0])<1e-6&&Math.abs(o[0]-s[0])<1e-6||Math.abs(i[1]-o[1])<1e-6&&Math.abs(o[1]-s[1])<1e-6){e[r-1]=s;continue}}e.push(s)}}return e}function Ju(t,e,s,r){let i=new Set,o=new Set;for(let p of t.items)p.type!=="region"||!Ot(t.catalog,p.region.kind)?.floor||(i.add(p.box.x0),i.add(p.box.x1),o.add(p.box.y0),o.add(p.box.y1));let n=[],a=(p,c)=>Rr(t,p,c)+.01;for(let p=0;p+1<e.length;p++){let[c,l]=e[p],[d,m]=e[p+1],h=[0,1];if(Math.abs(l-m)<1e-6)for(let y of i){let g=(y-c)/(d-c);g>1e-6&&g<1-1e-6&&h.push(g)}else for(let y of o){let g=(y-l)/(m-l);g>1e-6&&g<1-1e-6&&h.push(g)}h.sort((y,g)=>y-g);for(let y=0;y+1<h.length;y++){let g=h[y],k=h[y+1],u=(g+k)/2,b=a(c+(d-c)*u,l+(m-l)*u),x=[c+(d-c)*g,l+(m-l)*g,b],w=[c+(d-c)*k,l+(m-l)*k,b],$=n[n.length-1];$&&(Math.abs($[0]-x[0])>1e-6||Math.abs($[1]-x[1])>1e-6||Math.abs($[2]-x[2])>1e-6)?n.push(x):$||n.push(x),n.push(w)}}n.length&&(n[0][2]=s.side==="top"?s.z:s.node.box.z0+.01,n[n.length-1][2]=r.side==="top"?r.z:r.node.box.z0+.01);let f=[];for(let p of n){let c=f.length;if(c>=2){let l=f[c-2],d=f[c-1],m=Math.abs(l[2]-d[2])<1e-9&&Math.abs(d[2]-p[2])<1e-9,h=Math.abs(l[0]-d[0])<1e-6&&Math.abs(d[0]-p[0])<1e-6||Math.abs(l[1]-d[1])<1e-6&&Math.abs(d[1]-p[1])<1e-6;if(m&&h){f[c-1]=p;continue}}f.push(p)}return f}function hc(t,e){let s=Vt(t,e);return s?` (did you mean "${s}"?)`:""}function Yt(t){return[Ne(t.x0,t.y0,t.z1),Ne(t.x1,t.y0,t.z1),Ne(t.x1,t.y0,t.z0),Ne(t.x1,t.y1,t.z0),Ne(t.x0,t.y1,t.z0),Ne(t.x0,t.y1,t.z1)]}function Hn(t){let e=t.map(o=>o[0]),s=t.map(o=>o[1]),r=Math.min(...e),i=Math.min(...s);return{x:r,y:i,w:Math.max(...e)-r,h:Math.max(...s)-i}}function zr(t,e){let s=t,r=(a,f)=>{let p=[];for(let c=0;c<s.length;c++){let l=s[c],d=s[(c+1)%s.length],m=a(l),h=a(d);m&&p.push(l),m!==h&&p.push(f(l,d))}s=p},i=a=>(f,p)=>[a,f[1]+(p[1]-f[1])*(a-f[0])/(p[0]-f[0])],o=a=>(f,p)=>[f[0]+(p[0]-f[0])*(a-f[1])/(p[1]-f[1]),a];if(r(a=>a[0]>=e.x,i(e.x)),!s.length||(r(a=>a[0]<=e.x+e.w,i(e.x+e.w)),!s.length)||(r(a=>a[1]>=e.y,o(e.y)),!s.length)||(r(a=>a[1]<=e.y+e.h,o(e.y+e.h)),!s.length))return 0;let n=0;for(let a=0;a<s.length;a++){let f=s[a],p=s[(a+1)%s.length];n+=f[0]*p[1]-p[0]*f[1]}return Math.abs(n)/2}function wc(t,e){let s=Math.min(t.x+t.w,e.x+e.w)-Math.max(t.x,e.x),r=Math.min(t.y+t.h,e.y+e.h)-Math.max(t.y,e.y);return s>0&&r>0?s*r:0}function Zd(t,e){let s=0;for(let r=0;r+1<t.length;r++){let i=t[r],o=t[r+1],n=Math.hypot(o[0]-i[0],o[1]-i[1]),a=Math.max(1,Math.ceil(n/4));for(let f=0;f<a;f++){let p=i[0]+(o[0]-i[0])*(f+.5)/a,c=i[1]+(o[1]-i[1])*(f+.5)/a;p>=e.x&&p<=e.x+e.w&&c>=e.y&&c<=e.y+e.h&&(s+=n/a*4)}}return s}var $s=64,$a=class{cells=new Map;n=0;add(e,s,r,i,o){for(let n=Math.floor(s/$s);n<=Math.floor(i/$s);n++)for(let a=Math.floor(r/$s);a<=Math.floor(o/$s);a++){let f=n*1048576+a,p=this.cells.get(f);p||this.cells.set(f,p=[]),p[p.length-1]!==e&&p.push(e)}}query(e,s,r,i){let o=new Set;for(let n=Math.floor(e/$s);n<=Math.floor(r/$s);n++)for(let a=Math.floor(s/$s);a<=Math.floor(i/$s);a++){let f=this.cells.get(n*1048576+a);if(f)for(let p of f)o.add(p)}return[...o].sort((n,a)=>n-a)}},gc=t=>{let e=1/0,s=1/0,r=-1/0,i=-1/0;for(let[o,n]of t)o<e&&(e=o),o>r&&(r=o),n<s&&(s=n),n>i&&(i=n);return[e,s,r,i]},Sa=new WeakMap;function Fs(t,e){let s=Sa.get(t);for((!s||s.n>t.length)&&Sa.set(t,s=new $a);s.n<t.length;s.n++){let[r,i,o,n]=e(t[s.n]);s.add(s.n,r,i,o,n)}return s}function Kd(t){let e=Sa.get(t);for((!e||e.n>t.length)&&Sa.set(t,e=new $a);e.n<t.length;e.n++){let s=t[e.n].pts;for(let r=0;r+1<s.length;r++){let i=s[r],o=s[r+1],n=e.n*65536+r,a=Math.max(1,Math.ceil(Math.hypot(o[0]-i[0],o[1]-i[1])/($s/2)));for(let f=0;f<a;f++){let p=f/a,c=(f+1)/a,l=i[0]+(o[0]-i[0])*p,d=i[1]+(o[1]-i[1])*p,m=i[0]+(o[0]-i[0])*c,h=i[1]+(o[1]-i[1])*c;e.add(n,Math.min(l,m)-1,Math.min(d,h)-1,Math.max(l,m)+1,Math.max(d,h)+1)}}}return e}var ds=(t,e,s,r,i)=>t.query(e,s,r,i),Ir=t=>gc(t),ka=t=>[t.x,t.y,t.x+t.w,t.y+t.h];function Gd(t,e,s,[r,i,o,n]){let a=0,f=s-1;for(let p of[0,1]){let c=e[p]-t[p],l=p?i:r,d=p?n:o;if(Math.abs(c)<1e-12){if(t[p]<l||t[p]>d)return[1,0];continue}let m=(l-t[p])/c*s-.5,h=(d-t[p])/c*s-.5;m>h&&([m,h]=[h,m]),a=Math.max(a,Math.floor(m)-1),f=Math.min(f,Math.ceil(h)+1)}return[a,f]}var nr=class t{polys=[];rects=[];lines=[];solids=[];slants=[];budget={spots:1/0,over:!1,told:!1};hidden(e){let s=0;for(let r of ds(Fs(this.solids,Ir),...ka(e)))s+=zr(this.solids[r],e);return s}hiddenPoly(e){let s=0;for(let r of ds(Fs(this.solids,Ir),...gc(e)))s+=Bi(e,this.solids[r]);return s}costPoly(e,s=1/0){let r=gc(e),i=0;for(let o of ds(Fs(this.polys,n=>Ir(n.poly)),...r))i+=Bi(e,this.polys[o].poly);for(let o of ds(Fs(this.rects,n=>ka(n.r)),...r))i+=zr(e,this.rects[o].r)*2;for(let o of ds(Fs(this.slants,Ir),...r))i+=Bi(e,this.slants[o])*2;if(i>=s)return i;for(let o of ds(Kd(this.lines),...r)){if(i>=s)return i;let n=this.lines[Math.floor(o/65536)].pts,a=o%65536,f=n[a],p=n[a+1],c=Math.hypot(p[0]-f[0],p[1]-f[1]),l=Math.max(1,Math.ceil(c/4)),[d,m]=Gd(f,p,l,r);for(let h=d;h<=m;h++)kc(e,[f[0]+(p[0]-f[0])*(h+.5)/l,f[1]+(p[1]-f[1])*(h+.5)/l])&&(i+=c/l*4*.6)}return i}cost(e,s,r=.6){let i=ka(e),o=0;for(let n of ds(Fs(this.polys,a=>Ir(a.poly)),...i)){let a=this.polys[n];o+=zr(a.poly,e)*(a.owner===s?1.5:1)}for(let n of ds(Fs(this.rects,a=>ka(a.r)),...i)){let a=this.rects[n];(a.owner!==s||!s)&&(o+=wc(a.r,e)*2)}for(let n of ds(Fs(this.slants,Ir),...i))o+=zr(this.slants[n],e)*2;if(r){let n=-1,a=0;for(let f of ds(Kd(this.lines),...i)){let p=Math.floor(f/65536);p!==n&&(n>=0&&(o+=a*r),n=p,a=0);let c=this.lines[p].pts,l=f%65536,d=c[l],m=c[l+1],h=Math.hypot(m[0]-d[0],m[1]-d[1]),y=Math.max(1,Math.ceil(h/4)),[g,k]=Gd(d,m,y,i);for(let u=g;u<=k;u++){let b=d[0]+(m[0]-d[0])*(u+.5)/y,x=d[1]+(m[1]-d[1])*(u+.5)/y;b>=e.x&&b<=e.x+e.w&&x>=e.y&&x<=e.y+e.h&&(a+=h/y*4)}}n>=0&&(o+=a*r)}return o}fork(){let e=new t;return e.budget=this.budget,e.polys=this.polys,e.lines=this.lines,e.solids=this.solids,e.rects=[...this.rects],e.slants=this.slants,e}},Ud=14;function qi(t,e,s,r){let i=Math.max(t.name?Pn(t.name,wt.lbl):0,t.sub?Pn(t.sub,wt.sub):0)+4,o=(t.name?1:0)+(t.sub?1:0),n=s-(t.name?11:9)-1,a=(o-1)*Ud+(t.name?11:9)+4;return{x:r==="start"?e-2:r==="end"?e-i+2:e-i/2,y:n,w:i,h:a}}function Vi(t,e,s,r,i,o){let n=Hn(s),a=Ne((e.x0+e.x1)/2,(e.y0+e.y1)/2,e.z1)[0],p=((t.name?1:0)+(t.sub?1:0)-1)*Ud+4,c=n.y-6-p,l=n.y+Math.min(n.h,60)*.45,d=[];o&&d.push({...o,pen:0}),d.push({x:a,y:c,anchor:"middle",pen:o?20:0});for(let y of[12,24,40])d.push({x:a,y:c-y,anchor:"middle",pen:20+y});for(let y of[-30,30,-60,60])d.push({x:a+y,y:c-4,anchor:"middle",pen:30+Math.abs(y)});d.push({x:n.x+n.w+8,y:l,anchor:"start",pen:120}),d.push({x:n.x-8,y:l,anchor:"end",pen:120}),d.push({x:a,y:n.y+n.h+14,anchor:"middle",pen:300});let m,h=1/0;for(let y of d){let g=qi(t,y.x,y.y,y.anchor),k=r.cost(g,i,.15)*2+y.pen;k<h&&(h=k,m={x:y.x,y:y.y,anchor:y.anchor,rect:g})}return m}function xc(t,e,s,r){return{x:(r==="start"?e:r==="end"?e-t:e-t/2)-2,y:s-14,w:t+4,h:28}}function va(t,e,s,r,i){let o=[{...r,pen:0}];for(let c of[-46,-66,-86,-106,-126,-146])for(let l of[0,-70,70,-140,140])o.push({x:e+l,y:s+c,anchor:"middle",pen:10+(-c-46)*.5+Math.abs(l)*.4});for(let c of[34,60,86])o.push({x:e,y:s+c,anchor:"middle",pen:60+c*.3});let n=r.x-e,a=r.y-s;for(let c of[-1,1])for(let l of[16,32,48])o.push({...r,y:s+a+c*l,x:e+n,pen:5+l});for(let c of[-1,1])for(let l of[30,60,90])for(let d of[0,16,-16])o.push({...r,x:e+n+c*l,y:s+a+d,pen:8+l*.6+Math.abs(d)});let f,p=1/0;for(let c of o){let l=xc(t,c.x,c.y,c.anchor),d=i.cost(l,void 0,.05)*3+c.pen;d<p&&(p=d,f={x:c.x,y:c.y,anchor:c.anchor,rect:l})}return f}var Hd=t=>{let e=0;for(let s=0;s<t.length;s++){let r=t[s],i=t[(s+1)%t.length];e+=r[0]*i[1]-i[0]*r[1]}return e/2},bc=t=>Hd(t)<0?[...t].reverse():t;function kc(t,e){let s=bc(t);for(let r=0;r<s.length;r++){let i=s[r],o=s[(r+1)%s.length];if((o[0]-i[0])*(e[1]-i[1])-(o[1]-i[1])*(e[0]-i[0])<0)return!1}return!0}function Bi(t,e){let s=bc(t),r=bc(e);for(let i=0;i<r.length&&s.length;i++){let o=r[i],n=r[(i+1)%r.length],a=p=>(n[0]-o[0])*(p[1]-o[1])-(n[1]-o[1])*(p[0]-o[0]),f=s;s=[];for(let p=0;p<f.length;p++){let c=f[p],l=f[(p+1)%f.length],d=a(c),m=a(l);if(d>=0&&s.push(c),d>=0!=m>=0){let h=d/(d-m);s.push([c[0]+(l[0]-c[0])*h,c[1]+(l[1]-c[1])*h])}}}return s.length>=3?Math.abs(Hd(s)):0}var Ma=24;function Cr(t,e){let[s,r,i,o]=e,n=t.x+t.w/2,a=t.y+t.h/2,f=[["left",n-s],["right",s+i-n],["top",a-r],["bottom",r+o-a]];f.sort((c,l)=>c[1]-l[1]);let p=f[0][0];return p==="left"?{edge:p,dx:-(t.x+t.w-s)-Ma,dy:0}:p==="right"?{edge:p,dx:s+i-t.x+Ma,dy:0}:p==="top"?{edge:p,dx:0,dy:-(t.y+t.h-r)-Ma}:{edge:p,dx:0,dy:r+o-t.y+Ma}}function Pa(t,e,s){let r=x=>{let w=0;for(let $=x.parent;$;$=$.parent)w++;return w},i=x=>x.box.x0+x.box.y0+x.box.z0*.01,o=t.items.filter(x=>x.type==="region").sort((x,w)=>r(x)-r(w)||i(x)-i(w)),n=t.items.filter(x=>x.type==="node").sort((x,w)=>i(x)-i(w)||x.box.z0-w.box.z0),a=[],f=Math.min(90,400/Math.max(1,o.length)),p=650;o.forEach((x,w)=>{let $=Hn(Yt(x.box));a.push({id:x.id,kind:"region",...Cr($,s),delay:Math.round(w*f),dur:p,bbox:$})});let c=250+Math.round(f*o.length),l=Math.min(70,700/Math.max(1,n.length)),d=600;n.forEach((x,w)=>{let $=Hn(Yt(x.box));a.push({id:x.id,kind:"node",...Cr($,s),delay:Math.round(c+w*l),dur:d,bbox:$})});let m=n.length?c+(n.length-1)*l:c,h=Math.round(m+300),y=Math.min(30,300/Math.max(1,e.length)),g=400,k=e.filter(x=>x.points.length>=2).map((x,w)=>({id:x.id,delay:Math.round(h+w*y),dur:g})),u={delay:h+200,dur:400},b=Math.max(...a.map(x=>x.delay+x.dur),...k.map(x=>x.delay+x.dur),u.delay+u.dur);return{pieces:a,routes:k,labels:u,total:b}}var jr=["edge","drop","rise","fly","pop","scatter","build","fade"],Lr=["explode","lift-off","sink","scatter","fly-out","collapse","fade","reverse"],sr=["by-depth","by-layer","by-region","by-flow","as-listed","random"],Qd=["linear","ease","ease-in","ease-out","settle","spring","bounce"],Tn=t=>Math.round(t*100)/100||0,ln=t=>Math.round(t*1e4)/1e4||0;function rr(t){let e=i=>{let o=0;for(let n=i.parent;n;n=n.parent)o++;return o},s=i=>{let o=[];for(let n=i;n;n=n.parent){let a=(n.region??n.node)?.motion;a&&o.unshift(a)}return o.length?Object.assign({},...o):void 0},r=new Set(t.layout.items.filter(i=>i.region&&t.layout.catalog&&t.rendered.svg.includes(`class="tunnel" data-id="${i.id}"`)).map(i=>i.id));return{viewBox:t.rendered.viewBox,pieces:t.layout.items.map(i=>{let o=i.box,n=Ne((o.x0+o.x1)/2,(o.y0+o.y1)/2,o.z0),a=s(i);return{id:i.id,kind:i.type,...i.parent?{parent:i.parent.id}:{},depth:e(i),layer:r.has(i.id)?2:i.type==="region"?0:1,key:Tn(o.x0+o.y0+o.z0*.01),bbox:Hn(Yt(o)),foot:[Tn(n[0]),Tn(n[1])],base:[Ne(o.x0,o.y1,o.z0),Ne(o.x1,o.y1,o.z0),Ne(o.x1,o.y0,o.z0)].map(f=>[Tn(f[0]),Tn(f[1])]),...a?{motion:a}:{}}}),routes:t.routes.filter(i=>t.rendered.paths[i.id]).map(i=>({id:i.id,path:t.rendered.paths[i.id],...Xu(i.raw)})),notes:Object.fromEntries((t.raw.notes??[]).map((i,o)=>[`${t.id}-note-${o}`,i.on])),intro:t.rendered.assembly}}var Yd=t=>typeof t=="string"?t.split(".")[0]:void 0,Xu=t=>{let e=Yd(t.from),s=Yd(t.to);return{...e?{from:e}:{},...s?{to:s}:{}}},Oa=(t,e,s,r)=>i=>{if(i<=0)return 0;if(i>=1)return 1;let o=(f,p,c)=>3*f*c*(1-c)**2+3*p*c*c*(1-c)+c**3,n=0,a=1;for(let f=0;f<40;f++){let p=(n+a)/2;o(t,s,p)<i?n=p:a=p}return o(e,r,(n+a)/2)},$c={linear:t=>t,ease:Oa(.42,0,.58,1),"ease-in":Oa(.42,0,1,1),"ease-out":Oa(0,0,.58,1),settle:Oa(.16,.84,.3,1),spring:t=>t<=0?0:t>=1?1:1-Math.exp(-6*t)*Math.cos(9.5*t)*(1-t),bounce:t=>{if(t<=0)return 0;if(t>=1)return 1;let e=7.5625,s=2.75;return t<1/s?e*t*t:t<2/s?e*(t-1.5/s)**2+.75:t<2.5/s?e*(t-2.25/s)**2+.9375:e*(t-2.625/s)**2+.984375}};function Mc(t){let e=t>>>0;return()=>{e=e+1831565813>>>0;let s=e;return s=Math.imul(s^s>>>15,s|1),s^=s+Math.imul(s^s>>>7,s|61),((s^s>>>14)>>>0)/4294967296}}var Wd=t=>{let e=2166136261;for(let s=0;s<t.length;s++)e^=t.charCodeAt(s),e=Math.imul(e,16777619);return e>>>0},Yn=t=>Math.max(0,Math.min(1,t)),Aa=24;function Sc(t,e,s){let[r,i,o,n]=e;return s==="left"?[-(t.x+t.w-r)-Aa,0]:s==="right"?[r+o-t.x+Aa,0]:s==="top"?[0,-(t.y+t.h-i)-Aa]:[0,i+n-t.y+Aa]}function Oc(t,e,s={}){let r=t.pieces,i=new Map(r.map(y=>[y.id,y])),o=(y,g)=>y.depth-g.depth||y.key-g.key;if(e==="as-listed")return[...r];if(e==="random"){let y=Mc(s.seed??1);return r.map(g=>[y(),g]).sort((g,k)=>g[0]-k[0]).map(g=>g[1])}if(e==="by-layer")return[...r].sort((y,g)=>y.layer-g.layer||o(y,g));if(e==="by-depth")return[...r].sort((y,g)=>y.key-g.key||y.depth-g.depth);let n=new Map;for(let y of[...r].sort(o)){let g=n.get(y.parent)??[];g.push(y),n.set(y.parent,g)}let a=[],f=new Set,p=y=>{if(f.has(y.id))return;let g=y.parent?i.get(y.parent):void 0;g&&p(g),f.add(y.id),a.push(y)};if(e==="by-region"){let y=g=>{for(let k of n.get(g)??[])p(k),y(k.id)};return y(),a}let c=new Map,l=new Set;for(let y of t.routes)y.from&&y.to&&(c.set(y.from,[...c.get(y.from)??[],y.to]),l.add(y.to));let d=s.source??t.routes.find(y=>y.from&&!l.has(y.from))?.from??t.routes[0]?.from,m=d?[d]:[],h=new Set(m);for(;m.length;){let y=m.shift(),g=i.get(y);g&&p(g);for(let k of c.get(y)??[])h.has(k)||(h.add(k),m.push(k))}for(let y of[...r].sort(o))p(y);return a}var Qu={edge:"settle",drop:"settle",rise:"ease-out",fly:"settle",pop:"spring",scatter:"settle",build:"ease-out",fade:"linear",explode:"ease-in","lift-off":"ease-in",sink:"ease-in","fly-out":"ease-in",collapse:"ease-in"},eh={"lift-off":"lift",sink:"rise",scatter:"scatter","fly-out":"edge",fade:"fade",explode:"explode",collapse:"collapse"};function _r(t,e,s={}){let r=s.seed??1,i=e==="disassemble",o=i&&s.style==="reverse",n=Z=>{if(!i)return Z.motion?.style??s.style??"edge";let L=Z.motion?.out??s.style??"fly-out";return L==="reverse"?Z.motion?.style??s.of??"edge":eh[L]},a=Z=>i?Z.motion?.out??s.style??"fly-out":n(Z),f=!i&&!s.order&&s.stagger===void 0&&s.piece===void 0&&s.overlap===void 0&&(s.style??"edge")==="edge",p=s.order??(s.style==="build"?"by-layer":"by-depth"),c=[],l,d,m=(Z,L,U)=>{let H=n(Z),ee=Z.motion?.easing??s.easing??Qu[i&&a(Z)!=="reverse"?a(Z):H]??"ease";return{p:Z,delay:L+(Z.motion?.delay??0),dur:Math.max(1,Z.motion?.duration??U),style:H,curve:$c[ee],from:Z.motion?.from??s.from??"left"}};if(f){let Z=new Map(t.pieces.map(L=>[L.id,L]));for(let L of t.intro.pieces){let U=Z.get(L.id);U&&c.push(m(U,L.delay,L.dur))}l=t.intro.routes.map(L=>({...L})),d={...t.intro.labels}}else{let Z=Oc(t,p,{seed:r,source:s.source}),L=s.piece??600,U=s.stagger??Math.min(70,900/Math.max(1,Z.length)),H=Yn(s.overlap??.5),ee=o||i?[...Z].reverse():Z,j=Math.min(30,300/Math.max(1,t.routes.length)),q=400,G=400;if(i){d={delay:0,dur:G};let Q=G*(1-H);l=[...t.routes].reverse().map((Y,ie)=>({id:Y.id,delay:Q+ie*j,dur:q}));let ce=Math.max(Q,...l.map(Y=>Y.delay+Y.dur)),pe=Math.max(0,ce-H*q);ee.forEach((Y,ie)=>c.push(m(Y,pe+ie*U,L)))}else{ee.forEach((Y,ie)=>c.push(m(Y,ie*U,L)));let Q=Math.max(0,...c.map(Y=>Y.delay+Y.dur)),ce=Math.max(0,Q-H*L);l=t.routes.map((Y,ie)=>({id:Y.id,delay:ce+ie*j,dur:q}));let pe=Math.max(ce,...l.map(Y=>Y.delay+Y.dur));d={delay:Math.max(0,pe-H*G),dur:G}}}let h=s.pulses&&t.routes.length?700:0;if(h&&i)for(let Z of[...c,...l,d])Z.delay+=h;let y=Math.max(1,...c.map(Z=>Z.delay+Z.dur),...l.map(Z=>Z.delay+Z.dur),d.delay+d.dur),g=i?0:y;h&&!i&&(y+=h);let k=s.duration!==void 0?Math.max(1,s.duration)/y:1;for(let Z of[...c,...l,d])Z.delay=Tn(Z.delay*k),Z.dur=Math.max(.01,Tn(Z.dur*k));let u=s.duration!==void 0?Math.max(1,s.duration):Math.max(1,Tn(y)),b=new Map(c.map(Z=>[Z.p.id,Z])),x=new Map(l.map(Z=>[Z.id,Z])),[w,$,v,O]=t.viewBox,C=[w+v/2,$+O/2],A=Z=>[Z.x+Z.w/2,Z.y+Z.h/2],R=(Z,L)=>{let U=s.point;if(Array.isArray(U))return U;if(U==="region"||L==="collapse"&&U===void 0&&Z.parent){let H=t.pieces.find(ee=>ee.id===Z.parent);return H?H.foot:C}if(typeof U=="string"){let H=t.pieces.find(ee=>ee.id===U);if(H)return H.foot}return C};function M(Z,L,U){let{p:H}=Z,ee=H.bbox,j=1-L,q=(G,Q)=>({dx:Tn(G*j),dy:Tn(Q*j)});switch(Z.style){case"drop":return q(...Sc(ee,t.viewBox,"top"));case"lift":return q(...Sc(ee,t.viewBox,"top"));case"fly":return q(...Sc(ee,t.viewBox,Z.from));case"rise":{let G=ee.h*j,[Q,ce,pe]=H.base,Y=ee.y-ee.h-4;return{...q(0,ee.h),clip:[[Q[0],Q[1]-G],[ce[0],ce[1]-G],[pe[0],pe[1]-G],[pe[0]+2,Y-G],[Q[0]-2,Y-G]].map(ie=>[Tn(ie[0]),Tn(ie[1])])}}case"pop":return{scale:ln(Math.max(0,L)),about:H.foot,opacity:ln(Yn(U*4))};case"scatter":{let G=Mc((r^Wd(H.id))>>>0),Q=G()*Math.PI*2,ce=.35+G()*.65;return{...q(Math.cos(Q)*v*ce*.6,Math.sin(Q)*O*ce*.6),opacity:ln(Yn(L*1.6))}}case"build":return{...q(0,-18),opacity:ln(Yn(L))};case"fade":return{opacity:ln(Yn(L))};case"explode":{let G=R(H,"explode"),Q=A(ee),ce=Q[0]-G[0],pe=Q[1]-G[1],Y=Math.hypot(ce,pe),ie=Mc((r^Wd(H.id))>>>0),Ae=ie()*Math.PI*2,De=Y>1?[ce/Y,pe/Y]:[Math.cos(Ae),Math.sin(Ae)],I=Math.hypot(v,O)+Math.max(ee.w,ee.h);return q(De[0]*I,De[1]*I)}case"collapse":{let G=R(H,"collapse");return{...q(G[0]-H.foot[0],G[1]-H.foot[1]),scale:ln(Math.max(0,L)),about:H.foot,opacity:ln(Yn(L*3))}}default:{let G=Cr(ee,t.viewBox);return q(G.dx,G.dy)}}}let T=(Z,L,U)=>{let H=Yn((Z-L)/U);return i?1-H:H},S={opacity:0},N=s.connectors??"draw",z=s.labels??"fade",K=[...t.pieces.map(Z=>Z.id),...t.routes.map(Z=>Z.id),...Object.keys(t.notes)];function J(Z){let L=Math.max(0,Math.min(u,Number.isFinite(Z)?Z:0));if(i?L<=0:L>=u)return{};let U=i?L>=u:L<=0,H={},ee={},j={};for(let pe of c){let Y=U?0:T(L,pe.delay,pe.dur);Y<=0?H[pe.p.id]=S:Y<1&&(H[pe.p.id]=M(pe,i?1-pe.curve(1-Y):pe.curve(Y),Y))}for(let pe of t.routes){let Y=x.get(pe.id),ie=U||!Y?0:T(L,Y.delay,Y.dur);ie<=0?ee[pe.id]={opacity:0,drawn:0}:ie<1&&(ee[pe.id]=N==="fade"?{opacity:ln(ie)}:N==="grow"?{drawn:ln(ie),by:"grow"}:{drawn:ln($c["ease-out"](ie))})}let q=U?0:T(L,d.delay,d.dur),G=q<=0?S:q>=1?void 0:z==="type"?{typed:ln(q)}:{opacity:ln(q)};for(let pe of K){let Y=G;if(z==="with-piece"){let ie=Object.hasOwn(t.notes,pe)?t.notes[pe]:pe,Ae=ie===void 0?void 0:b.get(ie)??x.get(ie);if(Ae){let De=U?0:T(L,Ae.delay,Ae.dur);Y=De<=0?S:De>=1?void 0:{opacity:ln(De)}}}Y&&(j[pe]=Y)}let Q=[];if(h&&!U){let pe=(L-g*k)/(h*k);if(pe>0&&pe<1)for(let Y of t.routes)Q.push({route:Y.id,at:ln($c.ease(pe))})}let ce=pe=>Object.keys(pe).length>0;return{...ce(H)?{items:H}:{},...ce(j)?{labels:j}:{},...ce(ee)?{routes:ee}:{},...q<1?{marks:{opacity:ln(Math.max(0,q))}}:{},...Q.length?{tokens:Q}:{}}}return{kind:e,duration:u,pieces:c.map(Z=>({id:Z.p.id,delay:Z.delay,dur:Z.dur,style:a(Z.p)})),routes:l,labels:d,at:J}}var xt=t=>{let e=t.toFixed(2);return e==="-0.00"?"0":String(Number(e))},th=(t,e)=>`translate(${xt(t[0])} ${xt(t[1])}) scale(${Number(e.toFixed(4))}) translate(${xt(-t[0])} ${xt(-t[1])})`,Ac=t=>[...t.matchAll(/(-?[\d.]+),(-?[\d.]+)/g)].map(e=>[Number(e[1]),Number(e[2])]),Tc=t=>t.slice(1).reduce((e,s,r)=>e+Math.hypot(s[0]-t[r][0],s[1]-t[r][1]),0);function Ta(t,e){let s=Ac(t),r=Tc(s)*e;for(let i=0;i+1<s.length;i++){let o=Math.hypot(s[i+1][0]-s[i][0],s[i+1][1]-s[i][1]);if(r<=o&&o>0){let n=r/o;return[s[i][0]+(s[i+1][0]-s[i][0])*n,s[i][1]+(s[i+1][1]-s[i][1])*n]}r-=o}return s[s.length-1]??[0,0]}function nh(t,e){let s=Ac(t),r=Ta(t,e),i=[],o=Tc(s)*e;for(let n=0;n<s.length;n++){i.push(s[n]);let a=n+1<s.length?Math.hypot(s[n+1][0]-s[n][0],s[n+1][1]-s[n][1]):1/0;if(o<=a)break;o-=a}return"M"+[...i,r].map(n=>`${xt(n[0])},${xt(n[1])}`).join(" L")}var fs=t=>String(Number(t.toFixed(4)));function sh(t,e){let s=t.match(/&[^;\s]+;|[\s\S]/gu)??[];return s.slice(0,Math.round(s.length*e)).join("")}function rh(t){let e=[];return(t.dx||t.dy)&&e.push(`translate(${xt(t.dx??0)} ${xt(t.dy??0)})`),t.scale!==void 0&&t.scale!==1&&e.push(th(t.about??[0,0],t.scale)),{attrs:{...t.opacity===void 0||t.opacity===1?{}:{opacity:fs(t.opacity)},...e.length?{transform:e.join(" ")}:{}},clip:t.clip}}function ih(t,e){let s={attrs:t.opacity===void 0||t.opacity===1?{}:{opacity:fs(t.opacity)}};if(t.drawn!==void 0&&t.drawn<1&&e!==void 0){let r=Yn(t.drawn),i=Tc(Ac(e));s.path=t.by==="grow"?{d:nh(e,r),head:!1}:{style:`stroke-dasharray:${xt(i)} ${xt(i)};stroke-dashoffset:${xt(i*(1-r))}`,head:!1}}else t.ants&&(s.path={style:`stroke-dasharray:${xt(t.ants.dash[0])} ${xt(t.ants.dash[1])};stroke-dashoffset:${xt(-t.ants.offset)}`,head:!0});return s}function ef(t,e,s,r,i){if(r==="label"||r==="note"){let n=t.labels&&Object.hasOwn(t.labels,s)?t.labels[s]:void 0;return n&&{attrs:{...n.opacity===void 0||n.opacity===1?{}:{opacity:fs(n.opacity)},...n.dx||n.dy?{transform:`translate(${xt(n.dx??0)} ${xt(n.dy??0)})`}:{}},...n.typed===void 0||n.typed>=1?{}:{typed:n.typed}}}if(e==="route"){let n=t.routes&&Object.hasOwn(t.routes,s)?t.routes[s]:void 0;return n&&ih(n,i(s))}let o=t.items&&Object.hasOwn(t.items,s)?t.items[s]:void 0;return o&&rh(o)}function tf(t,e,s){let r=[];for(let i of t.outlines??[])r.push(["polygon",{points:i.points.map(o=>o.map(xt).join(",")).join(" "),class:"ring",fill:"none","stroke-width":"2.5","stroke-linejoin":"round",...i.opacity===void 0?{}:{opacity:fs(i.opacity)},...s?{stroke:i.color??s.control}:{style:`stroke:${i.color??"var(--ring,var(--control,currentColor))"}`}}]);for(let i of t.pulses??[])r.push(["ellipse",{cx:xt(i.x),cy:xt(i.y),rx:xt(i.rx),ry:xt(i.ry),class:"ring",fill:"none","stroke-width":"2.5",...i.opacity===void 0?{}:{opacity:fs(i.opacity)},...s?{stroke:i.color??s.control}:{style:`stroke:${i.color??"currentColor"}`}}]);for(let i of t.tokens??[]){let o=e(i.route);if(o===void 0)continue;let[n,a]=Ta(o,Yn(i.at));r.push(["circle",{cx:xt(n),cy:xt(a),r:"7",class:"tok",...s?{fill:i.color??(i.kind!==void 0?s.kinds?.[i.kind]:void 0)??s.control,stroke:s.surface,"stroke-width":"2.5"}:{style:`fill:${i.color??(i.kind!==void 0?`var(--${i.kind},var(--control,currentColor))`:"var(--control,currentColor)")}`}}])}return r}var nf=t=>Object.keys(t).every(e=>e==="morph"||t[e]===void 0),sf=new Set(["marks","badges"]),Jd=t=>t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;");function Pc(t){let e=new Map,s=[];for(let r of t.matchAll(/<(\/?)([a-zA-Z]+)((?:\s+[\w:-]+="[^"]*")*)\s*(\/?)>/g)){if(r[1]){let n=s.pop();n?.key!==void 0&&e.set(n.key,[n.from,r.index]);continue}if(r[4])continue;let i=/\sdata-item="([^"]*)"/.exec(r[3])?.[1],o=/\sdata-part="([^"]*)"/.exec(r[3])?.[1];s.push({...s.length===2&&i!==void 0&&o!==void 0?{key:`${of(i)}
143
+ ${o}`}:{},from:r.index+r[0].length})}return e}var Xd=new WeakMap;function oh(t,e){let s=Xd.get(t)??new Map;Xd.set(t,s);let r=s.get(e);if(!r){s.set(e,r=new Map);let i=t.variants?.[e],o=Pc(t.svg);if(i!==void 0)for(let[n,[a,f]]of Pc(i)){let p=o.get(n);p&&t.looks?.[n.split(`
144
+ `)[0]]?.includes(e)&&t.svg.slice(...p)!==i.slice(a,f)&&r.set(n,i.slice(a,f))}}return r}function rf(t,e,s,r){let i=[];for(let o of t.looks?.[e]??[]){let n=Yn(r[o]??0),a=n>0?oh(t,o).get(`${e}
145
+ ${s}`):void 0;a!==void 0&&i.push([a,n])}return i.length?{own:Yn(1-i.reduce((o,[,n])=>o+n,0)),looks:i}:void 0}var ah=(t,e)=>(e.own>0?`<g opacity="${fs(e.own)}">${t}</g>`:"")+e.looks.map(([s,r])=>`<g opacity="${fs(r)}">${s}</g>`).join("");function lh(t,e){let s="",r=0;for(let[i,[o,n]]of[...Pc(t.svg)].sort((a,f)=>a[1][0]-f[1][0])){let[a,f]=i.split(`
146
+ `),p=Object.hasOwn(e,a)?rf(t,a,f,e[a]):void 0;p&&(s+=t.svg.slice(r,o)+ah(t.svg.slice(o,n),p),r=n)}return s+t.svg.slice(r)}function Ki(t,e){if(nf(e))return t.rendered.svg;let s=e.variants?lh(t.rendered,e.variants):t.rendered.svg,r=l=>Object.hasOwn(t.rendered.paths,l)?t.rendered.paths[l]:void 0,i=0,o="",n="",a=0,f,p=s.replace(/<(\/?)([a-zA-Z]+)((?:\s+[\w:-]+="[^"]*")*)\s*(\/?)>|([^<]+)/g,(l,d,m,h,y,g)=>{if(g!==void 0)return f?.w.typed===void 0?l:sh(g,f.w.typed);if(d)return i--,f&&i===f.at&&(f=void 0),i===1&&(o=""),l;let k=i;y||i++;let u={};for(let[,b,x]of h.matchAll(/([\w:-]+)="([^"]*)"/g))u[b]=x;if(k===0){if(!e.camera)return l;u.viewBox=e.camera.map(xt).join(" ")}else if(k===1)if(o=m==="g"&&u.class?.startsWith("g-")?u.class.slice(2):"",sf.has(o)&&e.marks&&e.marks.opacity!==1)u.opacity=fs(e.marks.opacity);else return l;else if(k===2&&u["data-part"]!==void 0){let b=u["data-route"]===void 0?"item":"route",x=of(u["data-route"]??u["data-item"]??""),w=ef(e,b,x,u["data-part"],r);if(!w)return l;for(let[$,v]of Object.entries(w.attrs))u[$]=Jd(v);if(w.clip){let $=`${t.id}-mc${a++}`;n+=`<clipPath id="${$}"><polygon points="${w.clip.map(v=>v.join(",")).join(" ")}"/></clipPath>`,u["clip-path"]=`url(#${$})`}if(!y&&(w.path||w.typed!==void 0)&&(f={at:k,w}),!Object.keys(w.attrs).length&&!w.clip)return l}else if(f?.w.path&&m==="path"&&u.class?.split(" ")[0]==="flow"){let b=f.w.path;b.d!==void 0&&(u.d=b.d),b.style!==void 0&&(u.style=b.style),b.head||delete u["marker-end"]}else return l;return`<${m}${Object.entries(u).map(([b,x])=>` ${b}="${x}"`).join("")}${y?"/":""}>`});n&&(p=p.replace(/<defs>|<defs\/>/,l=>l==="<defs/>"?`<defs>${n}</defs>`:l+n));let c=tf(e,r,t.rendered.inks);return c.length&&(p=p.replace('<g class="g-anim">',l=>l+c.map(([d,m])=>`<${d}${Object.entries(m).map(([h,y])=>` ${h}="${Jd(y)}"`).join("")}/>`).join(""))),p}var of=t=>t.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&amp;/g,"&"),vc=new WeakMap;function Ea(t,e,s,r={}){let i=vc.get(t);if(i){for(let[u,b]of i.mixed)u.replaceChildren(...b);for(let[u,b]of i.attrs)for(let[x,w]of b)w===null?u.removeAttribute(x):u.setAttribute(x,w);for(let[u,b,x]of i.gone.reverse())b.insertBefore(u,x);for(let[u,b]of i.texts)u.data=b;for(let u of i.made)u.remove();vc.delete(t)}if(nf(e))return;let o={attrs:new Map,texts:new Map,gone:[],made:[],mixed:[]};vc.set(t,o);let n=(u,b,x)=>{let w=o.attrs.get(u)??new Map;w.has(b)||w.set(b,b==="style"?u.getAttribute(b)||null:u.getAttribute(b)),o.attrs.set(u,w),x===null?u.removeAttribute(b):u.setAttribute(b,x)},a=t.ownerDocument,f=(u,b,x)=>{let w=a.createElementNS("http://www.w3.org/2000/svg",u);for(let[$,v]of Object.entries(b))w.setAttribute($,v);return x.append(w),o.made.push(w),w},p=Array.from(t.children),c=u=>p.find(b=>b.getAttribute("class")===`g-${u}`),l=new Map;for(let u of Array.from(c("flows")?.children??[])){let b=u.getAttribute("data-route"),x=u.querySelector("path.flow")?.getAttribute("d");b!==null&&x&&l.set(b,x)}let d=u=>l.get(u);e.camera&&n(t,"viewBox",e.camera.map(xt).join(" "));for(let u of sf){let b=c(u);b&&e.marks&&e.marks.opacity!==1&&n(b,"opacity",fs(e.marks.opacity))}let m=0,h=p.find(u=>u.localName==="defs"),y=h?.firstChild??null,g=t.getAttribute("data-scene")??"scene";for(let u of p)for(let b of Array.from(u.children)){let x=b.getAttribute("data-part");if(x===null)continue;let w=b.getAttribute("data-route"),$=w===null?b.getAttribute("data-item")??"":"",v=s&&e.variants&&Object.hasOwn(e.variants,$)?rf(s,$,x,e.variants[$]):void 0;if(v){let A=Array.from(b.childNodes),R=(T,S)=>{let N=a.createElementNS("http://www.w3.org/2000/svg","g");return N.setAttribute("opacity",fs(T)),N.append(...S),N},M=T=>Array.from(a.importNode(new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg">${T}</svg>`,"image/svg+xml").documentElement,!0).childNodes);o.mixed.push([b,A]),b.replaceChildren(...v.own>0?[R(v.own,A)]:[],...v.looks.map(([T,S])=>R(S,M(T))))}let O=ef(e,w===null?"item":"route",w??b.getAttribute("data-item")??"",x,d);if(!O)continue;for(let[A,R]of Object.entries(O.attrs))n(b,A,R);if(O.clip&&h){let A=f("clipPath",{id:`${g}-mc${m++}`},h);h.insertBefore(A,y);let R=a.createElementNS("http://www.w3.org/2000/svg","polygon");R.setAttribute("points",O.clip.map(M=>M.join(",")).join(" ")),A.append(R),n(b,"clip-path",`url(#${A.id})`)}if(O.typed!==void 0){let A=[];for(let R=a.createTreeWalker(b,4);R.nextNode();)A.push(R.currentNode);for(let R of A)o.texts.set(R,R.data),R.data=Array.from(R.data).slice(0,Math.round(Array.from(R.data).length*O.typed)).join(""),R.data||(o.gone.push([R,R.parentNode,R.nextSibling]),R.remove())}let C=O.path&&b.querySelector("path.flow");C&&O.path&&(O.path.d!==void 0&&n(C,"d",O.path.d),O.path.style!==void 0&&(r.styles==="cssom"?(n(C,"style",null),C.style.cssText=O.path.style):n(C,"style",O.path.style)),O.path.head||n(C,"marker-end",null))}let k=c("anim");if(k)for(let[u,b]of tf(e,d,s?.inks))f(u,b,k)}var af=(t,e)=>({...e,frame:s=>Ki(t,e.at(s))}),Ec=(t,e={})=>af(t,_r(rr(t),"assemble",e)),lf=(t,e={})=>af(t,_r(rr(t),"disassemble",e)),cf=(t,e)=>Ec(t).frame(e);var za=(t,e)=>e.role??Ot(t,e.kind)?.role,Na=(t,e)=>Ot(t,e.region.kind)?.shape,xn=(t,e,s,r="item")=>s?Se("g",{[`data-${r}`]:t,"data-part":e},s):"";function Fr({scene:t,layout:e,routes:s,steps:r,theme:i,id:o,gridStep:n=1}){let a=new yr,f={base:"",floor:"",flows:"",blocks:[],air:"",labels:"",marks:"",badges:""},p=new nr;p.budget.spots=Ia;let c=S=>r.vis[S]?{"data-vis":"1"}:{},l=e.items.filter(S=>S.type==="region"),d=S=>{let N=0;for(let z=S.parent;z;z=z.parent)N++;return N},m=e.catalog,h=l.filter(S=>Na(m,S)!=="walled"&&Na(m,S)!=="tunnel"),y=mi(h.map(S=>({box:S.box,r:S}))).map(S=>S.r).sort((S,N)=>d(S)-d(N));for(let S of y)f.base+=ph(a,m,S,c(S.id),n);for(let S of l.filter(N=>Na(m,N)==="walled")){for(let z of Ra(S))p.solids.push(Yt(z));for(let[z,K]of Ra(S).entries())f.blocks.push({box:K,svg:xn(S.id,`wall-${z+1}`,Se("g",{class:`blk k-${za(m,S.region)} wall${S.region.ghost?" ghost":""}`,"data-id":S.id,"data-dim":"1",...c(S.id)},a.blockFaces(K)))});let N=S.region.gate;if(N&&!N.node){let z=Fi(S,N.height??(S.region.height??.8)+.3,.3,.3);p.solids.push(Yt(z)),f.blocks.push({box:z,svg:xn(S.id,"gate",Se("g",{class:"blk k-gate","data-id":S.id,...c(S.id)},a.blockFaces(z)))})}S.region.label&&(S.region["label-style"]??"face")!=="none"&&(f.labels+=xn(S.id,"name",a.faceText(S.box.x0+.3,S.box.y1,S.box.z0+.13,S.region.label,"slabname sm fz",wt.sm,"left","start",{"data-id":S.id,...c(S.id)})))}for(let S of l.filter(N=>Na(m,N)==="tunnel"))f.air+=xn(S.id,"block",fh(a,S,c(S.id)));let g=e.items.filter(S=>S.type==="node");for(let S of g){let N=S.node,z=An(m,N.asset),K=N.ghost||(N.deco??[]).includes("ghost"),J=["blk",`k-${N.role??z.role}`,z.cls,K?"ghost":""].filter(Boolean).join(" ");f.blocks.push({box:S.box,svg:xn(S.id,"block",Se("g",{class:J,"data-id":S.id,"data-dim":"1",...c(S.id)},z.draw(a,S.box,N)))}),p.polys.push({poly:Yt(S.box),owner:S.id}),p.solids.push(Yt(S.box))}let k=mi(f.blocks).map(S=>S.svg).join(""),u=new Set,b={};for(let S of s){if(S.points.length<2)continue;let N=S.points.map(J=>Ne(J[0],J[1],J[2]));N.forEach(J=>a.bounds.add(J));let z="M"+N.map(Us).join(" L");b[S.id]=z;let K=S.raw.arrow!==!1;K&&u.add(S.kind),f.flows+=xn(S.id,"line",Se("g",{"data-hl":S.id,"data-id":S.id,...c(S.id)},Se("path",{d:z,class:`flow f-${S.kind}`,"marker-end":K?`url(#ah-${o}-${S.kind})`:void 0})),"route"),p.lines.push({pts:N,owner:S.id})}for(let S of u)a.def(`ah-${o}-${S}`,Se("marker",{id:`ah-${o}-${S}`,viewBox:"0 0 10 10",refX:"7",refY:"5",markerWidth:"4.2",markerHeight:"4.2",orient:"auto-start-reverse"},Se("path",{d:"M0,0 L10,5 L0,10 z",style:`fill:${Un(i,i.kinds[S]?.color??"control")}`})));for(let S of a.planePolys)p.slants.push(S);let x=g.filter(S=>S.node.label||S.node.sub).sort((S,N)=>(N.box.x1-N.box.x0)*(N.box.y1-N.box.y0)-(S.box.x1-S.box.x0)*(S.box.y1-S.box.y0));for(let S of x)f.labels+=xn(S.id,"label",dh(a,m,S,p,c(S.id)));let w=[];for(let S of s)if(S.raw.label&&S.points.length>=2){let N=mh(a,S,p,c(S.id),e);f.floor+=xn(S.id,"label",N.svg,"route"),N.warning&&w.push({path:`${S.path}/label`,message:N.warning}),p.budget.over&&!p.budget.told&&(p.budget.told=!0,w.push({path:S.path,message:`from route "${S.id}" on, route labels were placed without weighing what other labels and lines cover: the scene is too large to search every spot (${Ia.toLocaleString("en")} spots); split it into scenes, or give the labels "along", "side" or "at"`}))}(t.notes??[]).forEach((S,N)=>{let z=xn(`${o}-note-${N}`,"note",uh(a,S,e,s,`${o}-note-${N}`));S.floor?f.floor+=z:f.labels+=z});let $=[],v=new Map;for(let S of r.says){let N=v.get(S.step)??p.fork();v.set(S.step,N);let z=Pn(S.text,wt.say)+18,K=va(z,S.ax,S.ay,{x:S.x,y:S.y,anchor:S.anchor},N);N.rects.push({r:K.rect,owner:""}),$.push({step:S.step,...K.rect,text:S.text});let J=K.rect.x+2;a.bounds.addRect(K.rect.x,K.rect.y,K.rect.w,K.rect.h);let Z=Un(i,i.kinds[S.kind]?.color??"control");f.marks+=Se("g",{class:"say","data-step":S.step},Se("rect",{x:J,y:K.y-12,width:z,height:24,rx:12,style:`stroke:${Z}`})+Se("text",{x:J+z/2,y:K.y+4,"text-anchor":"middle",style:`fill:${Z}`},vt(S.text)))}for(let S of r.marks){let[N,z]=Ne(...S.p);a.bounds.addRect(N-12,z-12,24,24),f.marks+=Se("g",{class:"xm","data-step":S.step,"data-hl":S.on},Se("circle",{cx:N,cy:z,r:10})+Se("path",{d:`M${bt(N-4.5)},${bt(z-4.5)} L${bt(N+4.5)},${bt(z+4.5)} M${bt(N+4.5)},${bt(z-4.5)} L${bt(N-4.5)},${bt(z+4.5)}`}))}for(let S of r.badges){let[N,z]=Ne(...S.p);a.bounds.addRect(N-13,z-13,26,26),f.badges+=Se("g",{class:`badge c-${S.kind}`,"data-go":S.step,"data-badge":S.step,tabindex:"0",role:"button","aria-label":`Step ${S.num}`},Se("circle",{cx:N,cy:z,r:11.5})+Se("text",{x:N,y:z+.5},String(S.num)))}let O=a.bounds,C=22,A=O.empty?[0,0,100,100]:[Math.floor(O.x0-C),Math.floor(O.y0-C),Math.ceil(O.x1-O.x0+C*2),Math.ceil(O.y1-O.y0+C*2)],R=[...a.defs.values()].join(""),M=(S,N)=>Se("g",{class:"g-"+S},N);return{svg:Se("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:A.join(" "),role:"img","aria-label":t.aria??t.title,"data-scene":o},Se("defs",{},R)+M("base",f.base)+M("floor",f.floor)+M("flows",f.flows)+M("blocks",k)+M("air",f.air)+M("labels",f.labels)+M("marks",f.marks)+M("badges",f.badges)+M("anim","")),viewBox:A,texts:a.texts,paths:b,warnings:w,callouts:$,assembly:Pa(e,s,A)}}function ch(t,e){let s=t.z1+.002,r=1e-6,i=[],o=(n,a)=>{let f=Ne(n[0],n[1],s),p=Ne(a[0],a[1],s);i.push(`M${Us(f)}L${Us(p)}`)};for(let n=Math.ceil((t.x0+r)/e)*e;n<t.x1-r;n+=e)o([n,t.y0],[n,t.y1]);for(let n=Math.ceil((t.y0+r)/e)*e;n<t.y1-r;n+=e)o([t.x0,n],[t.x1,n]);return i.length?Se("path",{class:"grid",d:i.join("")}):""}function ph(t,e,s,r,i=1){let o=s.region,n=s.box,a=za(e,o),f=Ot(e,o.kind),p=f?.shape,c={"data-id":s.id,"data-dim":"1",...r},l="";p==="cloud"?l=Se("g",{class:`blk k-${a} cloud`,...c},Er(t,n)):p==="zone"?l=Se("g",{class:`zone k-${a}`,...c},t.poly([[n.x0,n.y0,n.z1],[n.x1,n.y0,n.z1],[n.x1,n.y1,n.z1],[n.x0,n.y1,n.z1]])):l=Se("g",{class:`blk k-${a}${o.ghost?" ghost":""}`,...c},t.blockFaces(n)+ch(n,i)),l=xn(s.id,"block",l);let d=o["label-style"]??f?.labelStyle;if(o.label&&d!=="none")if(d==="face"){let m=n.z1-n.z0,h=u=>u.size*.73/lt,y=p==="slab"&&.28+h(wt.slabname)+.08>m,g=p==="slab"&&!y,k=g?n.z0+.28:y?n.z0+Math.max(.02,(m-h(wt.sm))/2):n.z0+Math.min(.1,m*.25);l+=xn(s.id,"name",Se("g",c,t.faceText(n.x0+(g?.6:.3),n.y1,k,o.label,g?"slabname":"slabname sm",g?wt.slabname:wt.sm,"left","start")))}else if(d==="face-right")l+=xn(s.id,"name",Se("g",c,t.faceText(n.x1,n.y0+.6,n.z0+Math.max(.14,(n.z1-n.z0)*.2),o.label,"slabname",wt.slabname,"right","end")));else{let m=p==="cloud"?"middle":"start",h=p==="cloud"?(n.x0+n.x1)/2:n.x0+.35,y=p==="cloud"?(n.y0+n.y1)/2:n.y1-.35;l+=xn(s.id,"name",Se("g",c,t.floorText(h,y,n.z1+.01,o.label,"slabname sm","x",m)))}return l}function Ra(t){let{x0:e,y0:s,x1:r,y1:i,z0:o,z1:n}=t.box,a=ps,f=t.region.gate,p=[],c=d=>{d.x1-d.x0>1e-6&&d.y1-d.y0>1e-6&&p.push({...d,z0:o,z1:n})},l=(d,m,h)=>{if(!f||f.side!==h)return[[d,m]];let y=f.at??.5,g=f.width??2,k=h==="e"||h==="w"?s+(i-s)*y:e+(r-e)*y;return[[d,k-g/2],[k+g/2,m]]};for(let[d,m]of l(e,r,"n"))c({x0:d,y0:s,x1:m,y1:s+a});for(let[d,m]of l(s+a,i-a,"w"))c({x0:e,y0:d,x1:e+a,y1:m});for(let[d,m]of l(s+a,i-a,"e"))c({x0:r-a,y0:d,x1:r,y1:m});for(let[d,m]of l(e,r,"s"))c({x0:d,y0:i-a,x1:m,y1:i});return p}function dh(t,e,s,r,i){let o=s.node,n=An(e,o.asset),a=s.box,f={name:o.label,sub:o.sub},p=o["label-at"],c;if(p){let d=Hn(Yt(a)),m=p.side??"above",h=d.y+Math.min(d.h,60)*.45;m==="right"?c={x:d.x+d.w+8,y:h,anchor:"start"}:m==="left"?c={x:d.x-8,y:h,anchor:"end"}:m==="below"?c={x:d.x+d.w/2,y:d.y+d.h+14,anchor:"middle"}:c=Vi(f,a,Yt(a),new nr,s.id),c={...c,x:c.x+(p.dx??0),y:c.y+(p.dy??0)}}else{let d=n.label?n.label(a,o,!!o.sub):void 0;c=Vi(f,a,Yt(a),r,s.id,d)}r.rects.push({r:qi(f,c.x,c.y,c.anchor),owner:""});let l="";return o.label&&(l+=t.text(c.x,c.y,o.label,"lbl",wt.lbl,c.anchor,{},s.id)),o.sub&&(l+=t.text(c.x,o.label?c.y+14:c.y,o.sub,"sub mono",wt.sub,c.anchor,{},s.id)),Se("g",{"data-id":s.id,"data-dim":"1",...i},l)}function fh(t,e,s){let{x0:r,y0:i,x1:o,y1:n,z0:a,z1:f}=e.box,p=t.blockFaces(e.box),c=o-r>=n-i,l=Math.max(1,Math.round((c?o-r:n-i)/1.6));for(let m=1;m<l;m++){let h=c?r+(o-r)*m/l:i+(n-i)*m/l;p+=t.poly(c?[[h,i,f],[h,n,f],[h,n,a]]:[[r,h,f],[o,h,f],[o,h,a]],"rib")}let d=e.region.label;return d&&e.region["label-style"]!=="none"&&(p+=c?t.faceText(r+.35,n,a+.14,d,"tunname",wt.tunname,"left","start"):t.faceText(o,n-.35,a+.18,d,"tunname",wt.tunname,"right","start")),Se("g",{class:"tunnel","data-id":e.id,"data-dim":"1",...s},p)}var Ia=2e4;function mh(t,e,s,r,i){let o=typeof e.raw.label=="string"?{text:e.raw.label}:e.raw.label,n=`floor mono t-${e.kind}`,a={"data-hl":e.id,...r},f=wt.floor;if(o.at){let u=o.at.length>2?o.at[2]:e.points[0][2];return{svg:t.floorText(o.at[0],o.at[1],u,o.text,n,o.dir??"x",o.anchor??"start",a)}}let p=e.points,c=[];for(let u=0;u+1<p.length;u++){let b=p[u],x=p[u+1];Math.abs(b[2]-x[2])>1e-6||c.push({i:u,len:Math.hypot(x[0]-b[0],x[1]-b[1])})}if(!c.length)return{svg:"",warning:`label "${o.text}" of route "${e.id}" was dropped: the route has no level segment`};let l=o.along?c.filter(u=>u.i===Math.min(o.along-1,p.length-2)):[...c].sort((u,b)=>b.len-u.len),d=.22,m=11/lt,h=u=>{let b=Pn(u,f)/lt,x,w=1/0,$=0;e:for(let v of l.length?l:c){let O=p[v.i],C=p[v.i+1],A=O[2],R=Math.abs(O[1]-C[1])<1e-6,M=R?Math.min(O[0],C[0]):Math.min(O[1],C[1]),T=R?Math.max(O[0],C[0]):Math.max(O[1],C[1]),S=R?O[1]:O[0],N=o.side==="left"?[-1]:o.side==="right"?[1]:[-1,1],z=[];for(let K=M+.3;K<=Math.max(M+.3,T-b-.2)+1e-9;K+=.4)z.push(K);for(let K=T-b-.2+.4;K<T+.5&&T-M<b+.5;K+=.6)z.push(K);for(let K of N)for(let J of z){if(w<=$*.5)break e;let Z=K<0?S-d:S+d+m,L,U,H;if(R?(L=J,U=Z,H=[Ne(L,U-m,A),Ne(L+b,U-m,A),Ne(L+b,U,A),Ne(L,U,A)]):(L=Z,U=J+b,H=[Ne(L-m,U,A),Ne(L-m,U-b,A),Ne(L,U-b,A),Ne(L,U,A)]),(R?[[L,U-m],[L+b,U-m],[L+b,U],[L,U]]:[[L-m,U],[L-m,U-b],[L,U-b],[L,U]]).some(([ce,pe])=>Math.abs(Rr(i,ce,pe)+.01-A)>.001)){$++;continue}let j=s.hiddenPoly(H),q=j*50+$*.5,G=s.budget.spots-- >0;G||(s.budget.over=!0);let Q=q>=w?1/0:G?q+s.costPoly(H,w-q):q;$++,Q<w&&(w=Q,x={x:L,y:U,z:A,dir:R?"x":"y",rect:Hn(H),poly:H,hidden:j})}}return x&&x.hidden<6?x:void 0},y=o.text,g=h(y),k;if(!g){let u=o.text.split(/(\s+)/);for(let b=u.length-1;b>0&&!g;b--){let x=u.slice(0,b).join("").trimEnd().replace(/[\s,;:·–-]+$/,"")+"\u2026";if(x.length<6)break;let w=h(x);w&&(g=w,y=x)}k=g?`label of route "${e.id}" shortened to "${y}": no clear floor for the whole text`:`label "${o.text}" of route "${e.id}" was dropped: blocks cover every spot beside it`,g?k+='; give it "along", "side" or "at", or move the nodes apart':k+='; give it "at: [x, y]", or move the nodes apart'}return g?(s.slants.push(g.poly),{svg:t.floorText(g.x,g.y,g.z+.01,y,n,g.dir,"start",a),warning:k}):{svg:"",warning:k}}function uh(t,e,s,r,i){let o=e.on?r.find(c=>c.id===e.on):void 0,n=e.on&&!o?s.byId.get(e.on):void 0,a=e.at,f={"data-id":i,"data-hl":o?.id,"data-dim":o?void 0:"1"},p=e.kind??o?.kind??"control";if(e.floor){let c=a&&a.length>2?a[2]:o?o.points[0][2]:n?n.floor:.36,[l,d]=a?[a[0],a[1]]:o?[o.points[0][0]+.35,o.points[0][1]-.25]:n?[n.box.x0+.3,n.box.y1-.3]:[0,0];return t.floorText(l,d,c+.01,e.floor,`floor mono t-${p}`,e.dir??"x",e.anchor??"start",f)}if(e.face){let c=n?.box,[l,d,m]=a?[a[0],a[1],a[2]??.45]:c?[c.x0+.3,c.y1,c.z0+.13]:[0,0,0];return t.faceText(l,d,m,e.face,"slabname sm",wt.sm,"left",e.anchor??"start",f)}if(e.label||e.sub){let c=n?.box,l=a?[a[0],a[1],a[2]??.36]:c?[(c.x0+c.x1)/2,(c.y0+c.y1)/2,c.z1+.75]:[0,0,0],[d,m]=Ne(l[0],l[1],l[2]),h=d+(e.dx??0),y=m-18+(e.dy??0),g=e.anchor??"middle",k="";return e.label&&(k+=t.text(h,y,e.label,"lbl",wt.lbl,g)),e.sub&&(k+=t.text(h,e.label?y+14:y,e.sub,"sub mono",wt.sub,g)),Se("g",f,k)}return""}function Ca(t,e){let s={};for(let r of t.layout.items){let i=(r.region??r.node)?.variants;i&&(s[r.id]=Object.keys(i))}Object.keys(s).length&&(t.rendered.looks=s,t.rendered.variants=Object.fromEntries([...new Set(Object.values(s).flat())].map(r=>[r,Fr({scene:t.raw,routes:t.routes,steps:t.steps,theme:e,id:t.raw.id,gridStep:t.grid.step??t.grid.snap??1,layout:{...t.layout,items:t.layout.items.map(i=>{let o=(i.region??i.node)?.variants?.[r];return o?i.region?{...i,region:{...i.region,...o,deco:void 0}}:{...i,node:{...i.node,...o}}:i})}}).svg])))}var Gi=29.09090909090909,Nc={solid:[9,7],dashed:[7,6],dotted:[3,6]},Rc=["blocked","planned"],pf=`
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 Zi(t,e={}){return(e.still??Rc).includes(t)?void 0:e.dash??e.kinds?.[t]?.ants??Nc[e.kinds?.[t]?.dash??"solid"]}function Ss(t){let e=t?.ants;return e?e===!0?{}:Array.isArray(e)?{ids:e}:e:void 0}function ja(t,e={}){let s=new Map(t.routes.map(n=>[n.id,n.kind])),r=e.ids&&new Set(e.ids),i=e.speed??Gi,o=n=>String(Number(n.toFixed(3)));return t.rendered.svg.replace(/(<g data-route="([^"]*)" data-part="line">(?:<g[^>]*>)*)<path ([^>]*?)\s*\/>/g,(n,a,f,p)=>{let c=f.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&"),l=r&&!r.has(c)?void 0:Zi(s.get(c)??"",e);if(!l||!/class="flow\b/.test(p))return n;let d=l[0]+l[1],m=o(d/Math.max(1e-6,Math.abs(i))),h=o(i<0?d:-d);return e.by==="css"?`${a}<path ${p.replace(/class="flow\b/,'class="flow iso-ants')} style="--ant-on:${o(l[0])};--ant-off:${o(l[1])};--ant-to:${h};--ant-turn:${m}s"/>`:e.by==="none"?`${a}<path ${p.replace(/ ?stroke-dasharray="[^"]*"/,"")} style="stroke-dasharray:${o(l[0])} ${o(l[1])}"/>`:`${a}<path ${p.replace(/ ?stroke-dasharray="[^"]*"/,"")} style="stroke-dasharray:${o(l[0])} ${o(l[1])}"><animate attributeName="stroke-dashoffset" from="0" to="${h}" dur="${m}s" repeatCount="indefinite"/></path>`})}var ir=t=>typeof t=="string"?[t]:[...t],La=t=>JSON.parse(JSON.stringify(t)),En=(t={})=>({...t.from===void 0?{}:{from:t.from},...t.over===void 0?{}:{duration:t.over},...t.easing===void 0?{}:{easing:t.easing}}),Dr=class t{nodes=[];add(e){return this.nodes.push(La(e)),this}assemble(e={},s={}){return this.add({assemble:e,...En(s)})}disassemble(e={},s={}){return this.add({disassemble:e,...En(s)})}travel(e,s={}){let{each:r,hold:i,loop:o}=s;return this.add({travel:e,...En(s),each:r,hold:i,loop:o})}pulse(e,s={}){return this.add({pulse:ir(e),...En(s),loop:s.loop})}ants(e=!0,s={}){return this.add({ants:e===!0?!0:ir(e),...En(s),speed:s.speed,dash:s.dash})}draw(e,s={}){return this.add({draw:ir(e),...En(s),by:s.by,stagger:s.stagger})}type(e,s={}){return this.add({type:ir(e),...En(s)})}move(e,s){return this.add({move:e,...s})}lift(e,s,r={}){return this.add({lift:ir(e),by:s,...En(r),stagger:r.stagger,to:r.to,opacity:r.opacity})}focus(e,s={}){let{scope:r,level:i,always:o}=s;return this.add({focus:{lit:ir(e),scope:r,level:i,always:o},...En(s),fade:s.fade})}highlight(e,s={}){return this.add({highlight:ir(e),...En(s),fade:s.fade})}get camera(){return{focus:(e,s={})=>this.add({camera:{focus:e,zoom:s.zoom,margin:s.margin},...En(s)}),fit:(e={})=>this.add({camera:"fit",...En(e)})}}sequence(e,s={},r){return this.add({sequence:df(e,s,r)})}series(e){let s=new Br;return e(s),this.add({series:s.items})}layers(e){let s=new t;return e(s),this.add({layers:s.nodes})}};function df(t,e,s){let{read:r,duration:i,...o}=e,n=new Dr;return s?.(n),La({...t===void 0?{}:{name:t},...o,...r!==void 0?{duration:{read:r}}:i!==void 0?{duration:i}:{},...n.nodes.length?{children:n.nodes}:{}})}var Br=class{items=[];sequence(e,s={},r){return this.items.push({sequence:df(e,s,r)}),this}transition(e){return this.items.push({transition:La(e)}),this}},Ui=class extends Br{over=[];marks={};head;constructor(e={}){super(),this.head=e}beat(e,s,r={},i){return this.sequence(e,{...r,say:s},i)}assemble(e={},s={}){return this.sequence(void 0,{},r=>r.assemble(e,s))}disassemble(e={},s={}){return this.sequence(void 0,{},r=>r.disassemble(e,s))}mark(e,s){return this.marks[e]=s,this}layers(e){let s=new Dr;return e(s),this.over.push(...s.nodes),this}toJSON(){return La({isomotion:1,...this.head,...this.items.length?{series:this.items}:{},...this.over.length?{layers:this.over}:{},...Object.keys(this.marks).length?{markers:this.marks}:{}})}},ff=(t={})=>new Ui(t);function _a(t,e){if(!e)return t;let[s,r,i,o]=e,n=t[2]/t[3],a=i-s,f=o-r;a/f<n?a=f*n:f=a/n,a=Math.min(a,t[2]),f=Math.min(f,t[3]);let p=(s+i)/2,c=(r+o)/2,l=Math.max(t[0],Math.min(t[0]+t[2]-a,p-a/2)),d=Math.max(t[1],Math.min(t[1]+t[3]-f,c-f/2));return[l,d,a,f]}var Yi=["linear","ease","ease-in","ease-out","ease-in-out","settle","bounce"],or=["extend","clamp","wrap","identity"];function Jn(t,e){if(typeof t=="number")return Number.isFinite(t)?t:void 0;if(typeof t!="string")return;let s=/^(-?\d+(?:\.\d+)?)(ms|s|f)?$/.exec(t.trim());if(!s)return;let r=Number(s[1]);return s[2]==="s"?r*1e3:s[2]==="f"?e?r/e*1e3:void 0:r}function Wi(t,e){let s=e===!0?{}:e,r=s.base??2600,i=s.perChar??40,o=s.min??5600,n=s.max??12500;return Math.max(o,Math.min(n,r+(t?.text??"").length*i))}var Ds=(t,e,s,r)=>i=>{if(i<=0)return 0;if(i>=1)return 1;let o=(f,p,c)=>3*f*c*(1-c)**2+3*p*c*c*(1-c)+c**3,n=0,a=1;for(let f=0;f<50;f++){let p=(n+a)/2;o(t,s,p)<i?n=p:a=p}return o(e,r,(n+a)/2)},hh=t=>{if(t<=0)return 0;if(t>=1)return 1;let e=7.5625,s=2.75;return t<1/s?e*t*t:t<2/s?e*(t-1.5/s)**2+.75:t<2.5/s?e*(t-2.25/s)**2+.9375:e*(t-2.625/s)**2+.984375},yh={linear:t=>t,ease:Ds(.25,.1,.25,1),"ease-in":Ds(.42,0,1,1),"ease-out":Ds(0,0,.58,1),"ease-in-out":Ds(.42,0,.58,1),settle:Ds(.16,.84,.3,1),bounce:hh};function qr(t,e={}){let s=e.mass??1,r=e.stiffness??100,i=e.damping??10,o=Math.max(0,t)/1e3,n=Math.sqrt(r/s),a=i/(2*Math.sqrt(r*s)),f;if(a<1){let p=n*Math.sqrt(1-a*a);f=1-Math.exp(-a*n*o)*(Math.cos(p*o)+a*n/p*Math.sin(p*o))}else f=1-Math.exp(-n*o)*(1+n*o);return e.overshootClamping?Math.min(1,f):f}function Xn(t,e,s="ease-in-out"){let r=t??s;return typeof r=="string"?yh[r]:"bezier"in r?Ds(...r.bezier):i=>i<=0?0:i>=1?1:qr(i*e,r.spring)}function Vr(t,e,s){let r=t.times.map(l=>Jn(l,s)),i=t.values,o=r.length;if(o===1)return i[0];let n=(l,d)=>{if(l==="clamp")return d?i[0]:i[o-1];if(l==="identity")return e;if(l==="wrap"){let m=r[o-1]-r[0];return Vr({...t,extrapolateLeft:"clamp",extrapolateRight:"clamp"},r[0]+((e-r[0])%m+m)%m,s)}};if(e<r[0]){let l=n(t.extrapolateLeft??"extend",!0);if(l!==void 0)return l}if(e>r[o-1]){let l=n(t.extrapolateRight??"extend",!1);if(l!==void 0)return l}let a=0;for(;a<o-2&&e>=r[a+1];)a++;let f=r[a+1]-r[a],p=(e-r[a])/f,c=p<0||p>1?p:Xn(t.easing,f,"linear")(p);return i[a]+(i[a+1]-i[a])*c}var Ic=["sequence","series","layers","assemble","disassemble","travel","pulse","ants","draw","type","move","lift","focus","highlight","camera"],mf={morph:"the 2D morph is a later version's",diff:"diffs are a later version's",switch:"a look is a beat's: its variants"},Wn=["from","duration","easing"],Hi={sequence:[],series:[],layers:[],assemble:Wn,disassemble:Wn,travel:[...Wn,"each","hold","loop"],pulse:[...Wn,"loop"],ants:[...Wn,"speed","dash"],draw:[...Wn,"by","stagger"],type:Wn,move:["from","x","y","scale","opacity"],lift:[...Wn,"by","stagger","to","opacity"],focus:[...Wn,"fade"],highlight:[...Wn,"fade"],camera:Wn},gh=["name","from","offset","duration","loop","playbackRate","trimBefore","say","show","hide","focus","highlight","levels","variants","enter","ants","children","layers","series"],At=t=>!!t&&typeof t=="object"&&!Array.isArray(t);function Fa(t){let e=[],s=(u,b,x)=>{e.push({severity:"error",path:u,message:b,...x?{hint:x}:{}})},r=(u,b,x)=>{for(let w of Object.keys(u))if(!b.includes(w)){let $=Vt(w,b);s(`${x}/${w}`,`unknown key "${w}"`,$?`did you mean "${$}"?`:void 0)}};if(!At(t))return s("","a motion document is a map"),e;r(t,["isomotion","fps","seed","ambient","series","layers","markers"],""),t.isomotion!==1&&s("/isomotion","isomotion is 1");let i=typeof t.fps=="number"&&t.fps>0?t.fps:void 0;t.fps!==void 0&&i===void 0&&s("/fps","fps is a number over 0"),t.seed!==void 0&&!Number.isInteger(t.seed)&&s("/seed","seed is a whole number"),t.ambient!==void 0&&t.ambient!=="on"&&t.ambient!=="off"&&s("/ambient",'ambient is "on" or "off"');let o=(u,b,x={})=>{if(u===void 0)return;if(typeof u=="string"&&/f$/.test(u)&&i===void 0){s(b,`"${u}" is in frames: the document needs its fps`);return}let w=Jn(u,i);w===void 0?s(b,`${JSON.stringify(u)} isn't a time (ms, "1.2s", "450ms", "30f")`):w<0&&!x.negative&&s(b,"a time can't be negative")},n=(u,b,x)=>{if(u!==void 0&&!b.includes(u)){let w=typeof u=="string"?Vt(u,b):void 0;s(x,`${JSON.stringify(u)} isn't one of ${b.join(", ")}`,w?`did you mean "${w}"?`:void 0)}},a=(u,b,x={})=>{u!==void 0&&(typeof u!="number"||!Number.isFinite(u)||x.min!==void 0&&u<x.min||x.max!==void 0&&u>x.max||x.over!==void 0&&u<=x.over)&&s(b,`${JSON.stringify(u)} isn't a number${x.over!==void 0?` over ${x.over}`:x.min!==void 0?` from ${x.min}${x.max!==void 0?` to ${x.max}`:""}`:""}`)},f=(u,b)=>{if(u!==void 0){if(!Array.isArray(u)){s(b,"a list of ids");return}u.forEach((x,w)=>{typeof x!="string"&&s(`${b}/${w}`,"an id")})}},p=(u,b,x=[])=>{if(!At(u)){s(b,"a spring is a map");return}r(u,["mass","damping","stiffness","overshootClamping",...x],b);for(let w of["mass","damping","stiffness"])a(u[w],`${b}/${w}`,{over:0});u.overshootClamping!==void 0&&typeof u.overshootClamping!="boolean"&&s(`${b}/overshootClamping`,"true or false")},c=(u,b)=>{if(u!==void 0){if(typeof u=="string"){n(u,Yi,b);return}if(At(u)&&"bezier"in u){r(u,["bezier"],b),(!Array.isArray(u.bezier)||u.bezier.length!==4||u.bezier.some(x=>typeof x!="number"))&&s(`${b}/bezier`,"four numbers");return}if(At(u)&&"spring"in u){r(u,["spring"],b),p(u.spring,`${b}/spring`);return}s(b,"an easing is a name, { bezier: [a, b, c, d] } or { spring: { \u2026 } }")}},l=(u,b)=>{if(u===void 0)return;if(!At(u)){s(b,"a curve is { times, values }");return}r(u,["times","values","easing","extrapolateLeft","extrapolateRight"],b);let x=u.times,w=u.values;if(!Array.isArray(x)||!x.length)s(`${b}/times`,"a list of times");else{x.forEach((v,O)=>o(v,`${b}/times/${O}`,{negative:!0}));let $=x.map(v=>Jn(v,i));for(let v=1;v<$.length;v++)$[v]!==void 0&&$[v-1]!==void 0&&$[v]<=$[v-1]&&s(`${b}/times/${v}`,"times go up")}!Array.isArray(w)||w.some($=>typeof $!="number")?s(`${b}/values`,"a list of numbers"):Array.isArray(x)&&w.length!==x.length&&s(`${b}/values`,`${w.length} values for ${x.length} times`),c(u.easing,`${b}/easing`),n(u.extrapolateLeft,or,`${b}/extrapolateLeft`),n(u.extrapolateRight,or,`${b}/extrapolateRight`)},d=(u,b)=>{if(u!==void 0){if(!At(u)){s(b,"focus is { lit: [ids] }");return}r(u,["lit","scope","level","always"],b),u.lit===void 0&&s(`${b}/lit`,"what is lit"),f(u.lit,`${b}/lit`),f(u.always,`${b}/always`),n(u.scope,["all","links"],`${b}/scope`),a(u.level,`${b}/level`,{min:0,max:1})}},m=(u,b)=>{u!==void 0&&typeof u!="string"&&s(b,"text")},h=new Map;function y(u,b,x){if(!At(u)){s(b,"a sequence is a map");return}if(r(u,gh,b),u.name!==void 0&&(typeof u.name!="string"||!/^[A-Za-z][\w-]*$/.test(u.name)?s(`${b}/name`,"a name is letters, digits, - and _, from a letter"):h.has(u.name)?s(`${b}/name`,`"${u.name}" is already a name (${h.get(u.name)})`):h.set(u.name,b)),x&&u.from!==void 0&&s(`${b}/from`,"in a series a sequence follows the one before","offset moves it"),!x&&u.offset!==void 0&&s(`${b}/offset`,"offset is for a series","use from"),o(u.from,`${b}/from`),o(u.offset,`${b}/offset`,{negative:!0}),o(u.trimBefore,`${b}/trimBefore`),At(u.duration)){r(u.duration,["read"],`${b}/duration`);let w=u.duration.read;if(w!==!0&&!At(w))s(`${b}/duration/read`,"true, or { base, perChar, min, max }");else if(At(w)){r(w,["base","perChar","min","max"],`${b}/duration/read`);for(let $ of["base","perChar","min","max"])a(w[$],`${b}/duration/read/${$}`,{min:0})}}else o(u.duration,`${b}/duration`);if(u.loop!==void 0&&typeof u.loop!="boolean"&&!(Number.isInteger(u.loop)&&u.loop>=1)&&s(`${b}/loop`,"true, false, or how many times"),a(u.playbackRate,`${b}/playbackRate`,{over:0}),u.say!==void 0)if(!At(u.say))s(`${b}/say`,"say is a map");else{let w=u.say;r(w,["chapter","title","text","code","facts","color"],`${b}/say`);for(let $ of["chapter","title","text","code","color"])m(w[$],`${b}/say/${$}`);w.facts!==void 0&&(!Array.isArray(w.facts)||w.facts.some($=>!Array.isArray($)||$.length!==2||$.some(v=>typeof v!="string")))&&s(`${b}/say/facts`,"a list of [name, value]")}for(let w of["show","hide","highlight"])f(u[w],`${b}/${w}`);if(d(u.focus,`${b}/focus`),u.levels!==void 0)if(!At(u.levels))s(`${b}/levels`,"levels is a map: an id, and how much of it");else for(let[w,$]of Object.entries(u.levels))a($,`${b}/levels/${w}`,{min:0,max:1});if(u.variants!==void 0)if(!At(u.variants))s(`${b}/variants`,"variants is a map: an id, and the name of its look");else for(let[w,$]of Object.entries(u.variants))typeof $!="string"&&s(`${b}/variants/${w}`,`a look's name, or "" for its own`);u.enter!==void 0&&(At(u.enter)?(r(u.enter,["fade","easing"],`${b}/enter`),u.enter.fade===void 0&&s(`${b}/enter/fade`,"how long the fade is"),o(u.enter.fade,`${b}/enter/fade`),c(u.enter.easing,`${b}/enter/easing`)):s(`${b}/enter`,"enter is { fade }")),u.ants!==void 0&&typeof u.ants!="boolean"&&f(u.ants,`${b}/ants`);for(let w of["children","layers"])u[w]!==void 0&&k(u[w],`${b}/${w}`);u.series!==void 0&&g(u.series,`${b}/series`)}function g(u,b){if(!Array.isArray(u)){s(b,"a series is a list");return}u.forEach((x,w)=>{let $=`${b}/${w}`;if(!At(x)||Object.keys(x).length!==1||!("sequence"in x||"transition"in x)){s($,"a series holds sequences and transitions");return}if("sequence"in x){y(x.sequence,`${$}/sequence`,!0);return}let v=x.transition,O=`${$}/transition`,C=A=>At(u[A])&&"sequence"in u[A];if((!C(w-1)||!C(w+1))&&s(O,"a transition is between two sequences"),!At(v)){s(O,"a transition is { presentation, timing }");return}r(v,["presentation","timing"],O),v.presentation===void 0?s(`${O}/presentation`,"a presentation"):n(v.presentation,["fade","none"],`${O}/presentation`),At(v.timing)?"linear"in v.timing?(r(v.timing,["linear"],`${O}/timing`),o(v.timing.linear,`${O}/timing/linear`)):"spring"in v.timing?(r(v.timing,["spring"],`${O}/timing`),p(v.timing.spring,`${O}/timing/spring`,["duration"]),At(v.timing.spring)&&o(v.timing.spring.duration,`${O}/timing/spring/duration`)):s(`${O}/timing`,"a timing is { linear } or { spring }"):s(`${O}/timing`,"a timing is { linear } or { spring }")})}function k(u,b){if(!Array.isArray(u)){s(b,"a list");return}u.forEach((x,w)=>{let $=`${b}/${w}`;if(!At(x)){s($,"a map");return}let v=Ic.filter(R=>R in x);if(v.length!==1){let R=Object.keys(x).find(S=>S in mf),M=Object.keys(x)[0],T=M?Vt(M,Ic):void 0;s($,R?`${R}: ${mf[R]}`:v.length?`one of ${v.join(", ")}, not several`:`one of ${Ic.join(", ")}`,!R&&!v.length&&T?`did you mean "${T}"?`:void 0);return}let O=v[0],C=x[O],A=`${$}/${O}`;r(x,[O,...Hi[O]],$),Hi[O].includes("from")&&o(x.from,`${$}/from`),Hi[O].includes("duration")&&(o(x.duration,`${$}/duration`),c(x.easing,`${$}/easing`));for(let R of["each","hold","stagger","fade"])Hi[O].includes(R)&&o(x[R],`${$}/${R}`);if(Hi[O].includes("loop")&&x.loop!==void 0&&typeof x.loop!="boolean"&&s(`${$}/loop`,"true or false"),O==="sequence")y(C,A,!1);else if(O==="series")g(C,A);else if(O==="layers")k(C,A);else if(O==="assemble"||O==="disassemble")At(C)?(n(C.style,O==="assemble"?jr:Lr,`${A}/style`),n(C.order,sr,`${A}/order`),C.duration!==void 0&&s(`${A}/duration`,"its length is beside it","duration is the node's")):s(A,`${O} is a map (its options)`);else if(O==="travel")!Array.isArray(C)||!C.length?s(A,"a list of connectors"):C.forEach((R,M)=>{Array.isArray(R)?f(R,`${A}/${M}`):typeof R!="string"&&s(`${A}/${M}`,"a connector, or a list of them at once")});else if(O==="ants")C!==!0&&f(C,A),a(x.speed,`${$}/speed`),x.dash!==void 0&&(!Array.isArray(x.dash)||x.dash.length!==2||x.dash.some(R=>typeof R!="number"||R<=0))&&s(`${$}/dash`,"two numbers over 0: on, off");else if(O==="move"){typeof C!="string"&&s(A,"an id");for(let R of["x","y","scale","opacity"])l(x[R],`${$}/${R}`)}else if(O==="focus")d(C,A);else if(O==="camera"){if(C!=="fit")if(!At(C))s(A,'"fit", or { focus, zoom, margin }');else{r(C,["focus","zoom","margin"],A),a(C.zoom,`${A}/zoom`,{over:0}),a(C.margin,`${A}/margin`);let R=C.focus;typeof R=="string"||Array.isArray(R)&&(R.every(M=>typeof M=="string")||R.length===4&&R.every(M=>typeof M=="number"))||s(`${A}/focus`,"an id, some ids, or a box [x, y, w, h]")}}else f(C,A);O==="draw"&&n(x.by,["stroke","grow"],`${$}/by`),O==="lift"&&(x.by===void 0&&s(`${$}/by`,"how far apart"),a(x.by,`${$}/by`),n(x.to,["up","down"],`${$}/to`),l(x.opacity,`${$}/opacity`))})}if(t.series!==void 0&&g(t.series,"/series"),t.layers!==void 0&&k(t.layers,"/layers"),t.markers!==void 0)if(!At(t.markers))s("/markers","markers is a map");else for(let[u,b]of Object.entries(t.markers))if(typeof b=="string"&&/^[A-Za-z][\w-]*([+-].+)?$/.test(b)){let x=/^([A-Za-z][\w-]*?)(?:([+-])(\d.*))?$/.exec(b);if(x&&(h.has(x[1])?x[1]:void 0))x[3]!==void 0&&o(x[3],`/markers/${u}`);else if(!h.has(b)){let v=Vt(x?.[1]??b,h.keys());s(`/markers/${u}`,`no sequence is named "${x?.[1]??b}"`,v?`did you mean "${v}"?`:void 0)}}else o(b,`/markers/${u}`);return e}var kn=t=>Math.round(t*100)/100||0,Wt=t=>Math.round(t*1e4)/1e4||0,Nn=t=>Math.max(0,Math.min(1,t)),Kr=(t,e,s)=>t+(e-t)*s,bh=250,zc=class{items=new Map;labels=new Map;routes=new Map;tokens=[];pulses=[];outlines=[];variants={};marks=1;at(e,s){let r=e.get(s);return r||e.set(s,r={}),r}item(e,s){let r=this.at(this.items,e);s.opacity!==void 0&&(r.opacity=(r.opacity??1)*s.opacity),s.dx&&(r.dx=(r.dx??0)+s.dx),s.dy&&(r.dy=(r.dy??0)+s.dy),s.scale!==void 0&&(r.scale=(r.scale??1)*s.scale,r.about=s.about??r.about),s.clip&&(r.clip=s.clip)}label(e,s){let r=this.at(this.labels,e);s.opacity!==void 0&&(r.opacity=(r.opacity??1)*s.opacity),s.dx&&(r.dx=(r.dx??0)+s.dx),s.dy&&(r.dy=(r.dy??0)+s.dy),s.typed!==void 0&&(r.typed=Math.min(r.typed??1,s.typed))}route(e,s){let r=this.at(this.routes,e);s.opacity!==void 0&&(r.opacity=(r.opacity??1)*s.opacity),s.drawn!==void 0&&s.drawn<(r.drawn??1)&&(r.drawn=s.drawn,r.by=s.by),s.ants&&(r.ants=s.ants)}add(e){for(let[s,r]of Object.entries(e.items??{}))this.item(s,r);for(let[s,r]of Object.entries(e.labels??{}))this.label(s,r);for(let[s,r]of Object.entries(e.routes??{}))this.route(s,r);e.marks&&(this.marks*=e.marks.opacity),this.tokens.push(...e.tokens??[]),this.pulses.push(...e.pulses??[])}state(e){let s={},r=(c,l)=>{let d={};for(let[m,h]of c){let y=l(h);Object.keys(y).length&&(d[m]=y)}return d},i=c=>Object.keys(c).length>0,o=c=>c===void 0||Wt(c)>=1?{}:{opacity:Wt(Math.max(0,c))},n=c=>({...kn(c.dx??0)?{dx:kn(c.dx)}:{},...kn(c.dy??0)?{dy:kn(c.dy)}:{}}),a=r(this.items,c=>({...o(c.opacity),...n(c),...c.scale!==void 0&&Wt(c.scale)!==1?{scale:Wt(c.scale),...c.about?{about:c.about}:{}}:{},...c.clip?{clip:c.clip}:{}})),f=r(this.labels,c=>({...o(c.opacity),...c.typed!==void 0&&c.typed<1?{typed:Wt(c.typed)}:{},...n(c)})),p=r(this.routes,c=>{let l=c.opacity!==void 0&&Wt(c.opacity)<=0,d=c.drawn!==void 0&&c.drawn<1;return{...o(c.opacity),...d?{drawn:Wt(c.drawn),...c.by?{by:c.by}:{}}:{},...c.ants&&!l&&!d?{ants:c.ants}:{}}});return i(a)&&(s.items=a),i(f)&&(s.labels=f),i(p)&&(s.routes=p),Wt(this.marks)<1&&(s.marks={opacity:Wt(this.marks)}),this.tokens.length&&(s.tokens=this.tokens),this.pulses.length&&(s.pulses=this.pulses),this.outlines.length&&(s.outlines=this.outlines),i(this.variants)&&(s.variants=this.variants),e&&(s.camera=e),s}};function Ji(t){let e=Ss(t.raw),s=t.rendered.looks,r=rr(t),i=Object.keys(r.notes).filter(o=>r.notes[o]===void 0);return{model:r,kinds:Object.fromEntries(t.routes.map(o=>[o.id,o.kind])),outlines:Object.fromEntries(t.layout.items.map(o=>[o.id,Yt(o.box).map(n=>[kn(n[0]),kn(n[1])])])),...s&&Object.keys(s).length?{looks:s}:{},...e?{ants:e}:{},...i.length?{free:i}:{}}}function vs(t,e,s={}){let r="model"in t?t:Ji(t),i=r.free?{...r.model,notes:{...r.model.notes,...Object.fromEntries(r.free.map(P=>[P,void 0]))}}:r.model,o=Fa(e),n=e.fps,a=r.ants,f=()=>({ok:!1,diags:o,duration:0,beats:[],markers:{},ambient:"on",loops:!1,at:()=>({}),cues:()=>{},beatAt:()=>{},startOf:()=>{}});if(o.length)return f();let p=(P,B,W)=>{o.push({severity:"error",path:P,message:B,...W?{hint:W}:{}})},c=(P,B)=>P===void 0?B:Jn(P,n),l=new Map(i.pieces.map(P=>[P.id,P])),d=new Set(i.routes.map(P=>P.id)),m=new Set(Object.keys(i.notes)),h=new Map(Object.entries(r.kinds)),y=[...l.keys(),...d,...m],g=new Set(y),k=new Map;for(let[P,B]of Object.entries(i.notes))B!==void 0&&k.set(B,[...k.get(B)??[],P]);let u={any:g,thing:new Set(l.keys()),route:d},b={any:"thing, connector or note",thing:"thing",route:"connector"},x=(P,B,W="any")=>{if(!u[W].has(P)){let fe=Vt(P,u[W]);p(B,`no ${b[W]} "${P}" in this drawing`,fe?`did you mean "${fe}"?`:void 0)}},w=(P,B,W="any")=>P?.forEach((fe,me)=>x(fe,`${B}/${me}`,W)),$=new Map(Object.entries(r.outlines)),v=new Map;function O(P,B){let W="from"in P?c(P.from,0):0,fe="duration"in P?c(P.duration,NaN):NaN,me=Number.isFinite(fe);if("sequence"in P){let X=P.sequence;return c(X.from,0)+M(X,`${B}/sequence`)}if("series"in P)return T(P.series,`${B}/series`).end;if("layers"in P)return Math.max(0,...P.layers.map((X,ne)=>O(X,`${B}/layers/${ne}`)));if("assemble"in P||"disassemble"in P){let X="assemble"in P?"assemble":"disassemble",ne="assemble"in P?P.assemble:P.disassemble,ye=v.get(P);return ye||v.set(P,ye=_r(i,X,{seed:e.seed??1,...ne,...me?{duration:fe}:{}})),W+ye.duration}return"draw"in P?W+(me?fe:400)+Math.max(0,P.draw.length-1)*c(P.stagger,0):"lift"in P?W+Math.max(me?fe:750,...P.opacity?.times.map(X=>Jn(X,n))??[])+Math.max(0,P.lift.length-1)*c(P.stagger,0):me?W+fe:"travel"in P?P.loop?W:W+P.travel.length*c(P.each,1150):"pulse"in P?P.loop?W:W+1500:"type"in P?W+400:"camera"in P?W+900:"move"in P?W+Math.max(0,...[P.x,P.y,P.scale,P.opacity].flatMap(X=>X?.times.map(ne=>Jn(ne,n))??[])):W}let C=(P,B)=>Math.max(0,...(P.children??[]).map((W,fe)=>O(W,`${B}/children/${fe}`)),...(P.layers??[]).map((W,fe)=>O(W,`${B}/layers/${fe}`)),P.series?T(P.series,`${B}/series`).end:0),A=new Map;function R(P,B){let W=A.get(P);if(W!==void 0)return W;let fe;return P.duration!==void 0&&typeof P.duration=="object"?fe=Wi(P.say,P.duration.read):fe=P.duration!==void 0?c(P.duration,0):C(P,B),P.duration===void 0&&fe<=0&&P.say&&(fe=Wi(P.say,!0)),fe<=0&&p(`${B}/duration`,"how long is it? (nothing in it says)"),A.set(P,fe),fe}let M=(P,B)=>{let W=R(P,B),fe=P.playbackRate??1;return P.loop===!0?W/fe:(typeof P.loop=="number"?W*P.loop:W)/fe};function T(P,B){let W=[],fe=0,me;return P.forEach((X,ne)=>{if("transition"in X){let D=X.transition,le=D.timing,ue=D.presentation==="none"?0:"linear"in le?c(le.linear,0):c(le.spring.duration,wh(le.spring));me={t:D,length:ue};return}let ye=X.sequence,$e=`${B}/${ne}/sequence`,E=M(ye,$e),_=Math.max(0,fe+c(ye.offset,0)-(me?.length??0));me&&W.length&&me.length>Math.min(W[W.length-1].end-W[W.length-1].start,E)&&p(`${B}/${ne-1}/transition/timing`,"a transition is no longer than either side of it"),W.push({s:ye,path:$e,start:_,end:_+E,...me?{into:me}:{}}),fe=_+E,me=void 0}),{list:W,end:Math.max(0,...W.map(X=>X.end))}}let S=T(e.series??[],"/series"),N=Math.max(0,...(e.layers??[]).map((P,B)=>O(P,`/layers/${B}`))),z=Math.max(S.end,N);z<=0&&!o.length&&p("","a motion document has a series, or layers, that last");let K=new Map,J=[],Z=i.viewBox,L=(P,B,W)=>{let fe=W!==void 0?1/W:Math.max((P.w+B*2)/Z[2],(P.h+B*2)/Z[3]);return[P.x+P.w/2-Z[2]*fe/2,P.y+P.h/2-Z[3]*fe/2,Z[2]*fe,Z[3]*fe]};function U(P,B,W){let fe=me=>W?{at:W.at+me/W.rate,rate:W.rate}:void 0;if("sequence"in P){ee(P.sequence,`${B}/sequence`,fe(c(P.sequence.from,0)),!1);return}if("series"in P){for(let me of T(P.series,`${B}/series`).list)ee(me.s,me.path,fe(me.start),!1);return}if("layers"in P){P.layers.forEach((me,X)=>U(me,`${B}/layers/${X}`,W));return}if("travel"in P)P.travel.forEach((me,X)=>(Array.isArray(me)?me:[me]).forEach((ne,ye)=>x(ne.split(":")[0],`${B}/travel/${X}${Array.isArray(me)?`/${ye}`:""}`,"route")));else if("pulse"in P)w(P.pulse,`${B}/pulse`,"thing");else if("ants"in P)P.ants!==!0&&w(P.ants,`${B}/ants`,"route");else if("draw"in P)w(P.draw,`${B}/draw`,"route");else if("type"in P)w(P.type,`${B}/type`);else if("move"in P)x(P.move,`${B}/move`,"thing");else if("lift"in P)w(P.lift,`${B}/lift`,"thing");else if("focus"in P)H(P.focus,`${B}/focus`);else if("highlight"in P)w(P.highlight,`${B}/highlight`,"thing");else if("camera"in P){let me=P.camera,X=c(P.duration,900);if(!W){p(`${B}/camera`,"a camera can't be in a loop");return}let ne=Z;if(me!=="fit"){let ye=me.focus;if(Array.isArray(ye)&&typeof ye[0]=="number")ne=L({x:ye[0],y:ye[1],w:ye[2],h:ye[3]},me.margin??0,me.zoom);else{let $e=typeof ye=="string"?[ye]:ye;$e.forEach((_,D)=>x(_,`${B}/camera/focus${typeof ye=="string"?"":`/${D}`}`,"thing"));let E=$e.map(_=>l.get(_)?.bbox).filter(_=>!!_);if(E.length){let _=Math.min(...E.map(le=>le.x)),D=Math.min(...E.map(le=>le.y));ne=L({x:_,y:D,w:Math.max(...E.map(le=>le.x+le.w))-_,h:Math.max(...E.map(le=>le.y+le.h))-D},me.margin??40,me.zoom)}}}J.push({at:W.at+c(P.from,0)/W.rate,over:X/W.rate,ease:Xn(P.easing,X,"settle"),to:ne})}}let H=(P,B)=>{P&&(w(P.lit,`${B}/lit`),w(P.always,`${B}/always`))};function ee(P,B,W,fe){if(P.name!==void 0&&W&&K.set(P.name,W.at),!fe)for(let ne of["show","hide","say","enter","focus","highlight","levels","variants","ants"])P[ne]!==void 0&&p(`${B}/${ne}`,`${ne} is for a sequence of the document's own series`,ne==="focus"||ne==="highlight"||ne==="ants"?`here, a child: { ${ne}: \u2026 }`:void 0);w(P.show,`${B}/show`),w(P.hide,`${B}/hide`),w(P.highlight,`${B}/highlight`,"thing"),H(P.focus,`${B}/focus`);for(let ne of Object.keys(P.levels??{}))ne!=="*"&&x(ne,`${B}/levels/${ne}`);for(let[ne,ye]of Object.entries(P.variants??{})){x(ne,`${B}/variants/${ne}`,"thing");let $e=r.looks?.[ne]??[];if(l.has(ne)&&ye!==""&&!$e.includes(ye)){let E=Vt(ye,$e);p(`${B}/variants/${ne}`,$e.length?`${ne} has no look "${ye}" (it has ${$e.join(", ")})`:`${ne} declares no looks (variants: in the diagram)`,E?`did you mean "${E}"?`:void 0)}}Array.isArray(P.ants)&&w(P.ants,`${B}/ants`,"route");let me=P.playbackRate??1,X=W&&!P.loop?{at:W.at-c(P.trimBefore,0)/(W.rate*me),rate:W.rate*me}:void 0;if((P.children??[]).forEach((ne,ye)=>U(ne,`${B}/children/${ye}`,X)),(P.layers??[]).forEach((ne,ye)=>U(ne,`${B}/layers/${ye}`,X)),P.series)for(let ne of T(P.series,`${B}/series`).list)ee(ne.s,ne.path,X&&{at:X.at+ne.start/X.rate,rate:X.rate},!1)}for(let P of S.list)ee(P.s,P.path,{at:P.start,rate:1},!0);(e.layers??[]).forEach((P,B)=>U(P,`/layers/${B}`,{at:0,rate:1})),J.sort((P,B)=>P.at-B.at);let j={};for(let[P,B]of Object.entries(e.markers??{})){let W=Jn(B,n);if(W!==void 0){j[P]=W;continue}let fe=String(B),me=[...K.keys()].filter(ye=>fe===ye||fe.startsWith(ye+"+")||fe.startsWith(ye+"-")).sort((ye,$e)=>$e.length-ye.length)[0];if(me===void 0){p(`/markers/${P}`,`"${fe}" isn't a moment of this document`);continue}let X=fe.slice(me.length),ne=X?Jn(X.slice(1),n):0;if(ne===void 0){p(`/markers/${P}`,`"${X}" isn't a time`);continue}j[P]=K.get(me)+(X[0]==="-"?-ne:ne)}if(o.length)return f();let q=S.list.map((P,B)=>({name:P.s.name??`beat-${B+1}`,index:B,start:P.start,end:P.end,...P.s.say?{say:P.s.say}:{}})),G=new Map;for(let P of S.list){for(let B of P.s.show??[])G.has(B)||G.set(B,!1);for(let B of P.s.hide??[])G.has(B)||G.set(B,!0)}let Q=[new Map(G)];for(let P of S.list){let B=new Map(Q[Q.length-1]);for(let W of P.s.show??[])B.set(W,!0);for(let W of P.s.hide??[])B.set(W,!1);Q.push(B)}let ce=[new Map];for(let P of S.list){let B=new Map(ce[ce.length-1]);for(let[W,fe]of Object.entries(P.s.variants??{}))B.set(W,fe);ce.push(B)}let pe=(P,B)=>!P||P.lit.includes(B)||P.always?.includes(B)||P.scope==="links"&&l.has(B)?1:P.level??.12,Y=(P,B)=>{let W=P<0?void 0:S.list[P].s.levels;return W?W[B]??W["*"]??1:1},ie=(P,B)=>(Q[P+1].get(B)===!1?0:1)*(P<0?1:pe(S.list[P].s.focus,B))*Y(P,B),Ae=(P,B)=>{let W=i.notes[B];if(W===void 0)return ie(P,B);let fe=P<0?void 0:S.list[P].s.levels?.[B];return ie(P,W)*(Q[P+1].get(B)===!1?0:1)*(fe??1)},De=P=>{let B=-1;for(let W=0;W<S.list.length;W++)S.list[W].start<=P&&(B=W);return B},I=(P,B)=>{let W=S.list[P],fe=B-W.start;if(W.into&&W.into.length>0){let ne=W.into.t.timing;return"spring"in ne?fe>=W.into.length?1:Nn(qr(fe,{...ne.spring,overshootClamping:!0})/qr(W.into.length,{...ne.spring,overshootClamping:!0})):Nn(fe/W.into.length)}let me=W.s.enter;if(!me)return 1;let X=c(me.fade,0);return X<=0?1:Xn(me.easing,X,"ease")(Nn(fe/X))};function V(P,B,W,fe,me){if("sequence"in P){let $e=P.sequence,E=c($e.from,0);ke($e,B-E,W-E,Ie($e,fe-E),me);return}if("series"in P){for(let $e of T(P.series,"").list)ke($e.s,B-$e.start,W-$e.start,$e.end-$e.start,me);return}if("layers"in P){for(let $e of P.layers)V($e,B,W,fe,me);return}let X=c("from"in P?P.from:void 0,0),ne=B-X;if("assemble"in P||"disassemble"in P){me.sum.add(v.get(P).at(ne));return}if("draw"in P){let $e=Math.max(1,c(P.duration,400)),E=c(P.stagger,0),_=Xn(P.easing,$e,"ease-out");P.draw.forEach((D,le)=>{let ue=_(Nn((ne-le*E)/$e));ue<=0?(me.sum.route(D,{opacity:0,drawn:0}),me.sum.label(D,{opacity:0})):ue<1&&(me.sum.route(D,{drawn:ue,...P.by?{by:P.by}:{}}),me.sum.label(D,{opacity:ue}))});return}if("type"in P){let $e=c(P.duration,400),E=Xn(P.easing,$e,"linear")(Nn(ne/Math.max(1,$e)));if(E<1)for(let _ of P.type)me.sum.label(_,E<=0?{opacity:0}:{typed:E});return}if("move"in P){let $e=ue=>ue?Vr(ue,ne,n):void 0,E=$e(P.x)??0,_=$e(P.y)??0,D=$e(P.scale),le=$e(P.opacity);me.sum.item(P.move,{dx:E,dy:_,...D===void 0?{}:{scale:D,about:l.get(P.move).foot},...le===void 0?{}:{opacity:Nn(le)}});for(let ue of[P.move,...k.get(P.move)??[]])me.sum.label(ue,{dx:E,dy:_,...le===void 0?{}:{opacity:Nn(le)}});return}if("lift"in P){let $e=c(P.stagger,0),E=Math.max(1,c(P.duration,750)),_=Xn(P.easing,E,"ease-out"),D=P.to==="down",le=P.lift.length;P.lift.forEach((ue,Ce)=>{let oe=ne-(D?le-1-Ce:Ce)*$e,Le=_(Nn(oe/E)),Pe=(Ce+1)*P.by*(D?Le:-Le),xe=P.opacity?Nn(Vr(P.opacity,oe,n)):1;if(!(!Pe&&xe>=1)){me.sum.item(ue,{dy:Pe,opacity:xe});for(let _e of[ue,...k.get(ue)??[]])me.sum.label(_e,{dy:Pe,opacity:xe})}});return}if("camera"in P)return;let ye=P.duration===void 0?Math.max(0,fe-X):c(P.duration,0);if(!(ne<0||ne>ye)){if("focus"in P||"highlight"in P){let $e=Math.max(1,c(P.fade,bh)),E=Nn(Math.min(ne/$e,P.duration===void 0?1:(ye-ne)/$e)),_=Xn(P.easing,$e,"linear")(E);if("focus"in P)be(P.focus,_,me.sum);else for(let D of P.highlight)me.shown(D)&&Te(D,_,me.sum);return}if("ants"in P){ze(P.ants===!0?[...d]:P.ants,me,P.speed,P.dash);return}if("pulse"in P){let E=P.loop?ae(W-X,1500,me)/1500:ne/Math.max(1,P.duration===void 0?1500:ye);if(E<0||E>=1)return;for(let _ of P.pulse)if(me.shown(_)){let D=l.get(_),le=D.bbox.w*.5*(.7+E*.6);me.sum.pulses.push({x:kn(D.foot[0]),y:kn(D.foot[1]),rx:kn(le),ry:kn(le*.58),opacity:Wt(1-E)})}return}if("travel"in P){let $e=c(P.each,1150),E=c(P.hold,P.loop?700:0),_=P.travel.length*$e+E,D=P.loop?ae(W-X,_,me):ne,le=Math.floor(D/$e);if(le>=P.travel.length)return;let ue=(D-le*$e)/$e,Ce=Xn(P.easing,$e,"ease-in-out")(ue),oe=P.travel[le];for(let Le of Array.isArray(oe)?oe:[oe]){let[Pe,xe]=Le.split(":");me.shown(Pe)&&me.sum.tokens.push({route:Pe,at:Wt((xe??h.get(Pe))==="blocked"?te(ue):Ce),...xe?{kind:xe}:{}})}}}}let te=P=>P<.7?P/.7:1-(P-.7)/.3*.25,ae=(P,B,W)=>W.off?0:(P%B+B)%B,Te=(P,B,W)=>{Wt(B)>0&&$.has(P)&&W.outlines.push({id:P,points:$.get(P),...Wt(B)<1?{opacity:Wt(B)}:{}})},be=(P,B,W)=>{for(let fe of y){let me=m.has(fe)&&!P.lit.includes(fe)&&!P.always?.includes(fe)?i.notes[fe]:void 0,X=Kr(1,pe(P,me??fe),B);X>=1||(l.has(fe)?(W.item(fe,{opacity:X}),W.label(fe,{opacity:X})):d.has(fe)?(W.route(fe,{opacity:X}),W.label(fe,{opacity:X})):W.label(fe,{opacity:X}))}},ze=(P,B,W=Gi,fe)=>{for(let me of P){let X=Zi(h.get(me)??"",{dash:fe,kinds:s.kinds,still:s.still});if(!X)continue;let ne=X[0]+X[1],ye=ae(W*B.A/1e3,ne,B);B.sum.route(me,{ants:{dash:X,offset:kn(ye)}})}},Ie=(P,B)=>P.loop===!0?Math.max(0,B):M(P,"");function ke(P,B,W,fe,me){if(B<0||B>fe||B===fe&&fe<z&&fe>0&&P.loop)return;let X=P.playbackRate??1,ne=R(P,""),ye=c(P.trimBefore,0),$e=P.loop&&ne>0?B*X%ne:B*X,E=$e+ye,_=W*X+ye;for(let D of P.children??[])V(D,E,_,ne+ye,me);for(let D of P.layers??[])V(D,E,_,ne+ye,me);if(P.series)for(let D of T(P.series,"").list)ke(D.s,E-D.start,_-D.start,D.end-D.start,me)}function Be(P,B={}){let W=Math.max(0,Math.min(z,Number.isFinite(P)?P:0)),fe=B.ambient==="off"||e.ambient==="off"&&B.ambient===void 0,me=typeof B.ambient=="number"?B.ambient:W,X=new zc,ne=De(W),ye=ne<0?1:I(ne,W),$e=(oe,Le)=>ne<0?Le(-1,oe):ye>=1?Le(ne,oe):Kr(Le(ne-1,oe),Le(ne,oe),ye),E=oe=>(ne<0?Q[0]:Q[ne+1]).get(oe)!==!1;if(G.size||S.list.some(oe=>oe.s.focus||oe.s.levels))for(let oe of y){let Le=$e(oe,m.has(oe)?Ae:ie);Le>=1||(l.has(oe)&&X.item(oe,{opacity:Le}),d.has(oe)&&X.route(oe,{opacity:Le}),X.label(oe,{opacity:Le}))}if(ne>=0)for(let oe of ce[ce.length-1].keys()){let Le=ce[ne].get(oe)??"",Pe=ce[ne+1].get(oe)??"",xe={};Le&&ye<1&&(xe[Le]=Wt(1-ye)),Pe&&(xe[Pe]=Wt((xe[Pe]??0)+ye));for(let _e of Object.keys(xe))xe[_e]<=0&&delete xe[_e];Object.keys(xe).length&&(X.variants[oe]=xe)}if(ne>=0){let oe=new Set(S.list[ne].s.highlight??[]),Le=new Set(ne>0&&ye<1?S.list[ne-1].s.highlight??[]:[]);for(let Pe of new Set([...Le,...oe]))Te(Pe,Kr(Le.has(Pe)?1:0,oe.has(Pe)?1:0,ye),X)}let _={sum:X,shown:E,off:fe,A:me},D=ne>=0?S.list[ne].s.ants:void 0,le=D===void 0?a:void 0;D?ze(D===!0?[...d]:D,_):le&&ze(le.ids??[...d],_,le.speed,le.dash),S.list.forEach((oe,Le)=>{W>=oe.start&&(W<oe.end||Le===ne&&W<=oe.end)&&ke(oe.s,W-oe.start,me-oe.start,oe.end-oe.start,_)});for(let oe of e.layers??[])V(oe,W,me,z,_);let ue;for(let oe of J){if(oe.at>W)break;let Le=oe.over<=0?1:oe.ease(Nn((W-oe.at)/oe.over)),Pe=ue??Z;if(Le>=1){ue=oe.to;continue}let xe=Pe[2],_e=oe.to[2],Ue=Math.exp(Kr(Math.log(xe),Math.log(_e),Le)),mt=Math.abs(_e-xe)<1e-6?Le:(Ue-xe)/(_e-xe),ys=Kr(Pe[0]+Pe[2]/2,oe.to[0]+oe.to[2]/2,mt),kt=Kr(Pe[1]+Pe[3]/2,oe.to[1]+oe.to[3]/2,mt),at=Ue*Z[3]/Z[2];ue=[ys-Ue/2,kt-at/2,Ue,at]}let Ce=ue?.map(kn);return X.state(Ce&&Ce.some((oe,Le)=>Math.abs(oe-Z[Le])>.005)?Ce:void 0)}let Qe=P=>{if(!P||typeof P!="object")return!1;if(Array.isArray(P))return P.some(Qe);let B=P;return B.ants!==void 0&&B.ants!==!1||B.loop===!0&&("travel"in B||"pulse"in B)?!0:Object.values(B).some(Qe)},Ke=a!==void 0||Qe(e.series)||Qe(e.layers),pt=P=>{let B=De(Math.max(0,Math.min(z,P)));return B<0?void 0:q[B]};return{ok:!0,diags:o,duration:z,beats:q,markers:j,ambient:e.ambient??"on",loops:Ke,at:Be,beatAt:pt,startOf:P=>K.get(P)??q.find(B=>B.name===P)?.start,cues(P){let B=pt(P);if(!B)return;let W=Math.max(0,Math.min(z,P));return{beat:B.name,index:B.index,of:q.length,progress:Wt(Nn((W-B.start)/Math.max(1,B.end-B.start))),...B.say?{say:B.say,...B.say.chapter!==void 0?{chapter:B.say.chapter}:{},...B.say.color!==void 0?{color:B.say.color}:{}}:{}}}}}function wh(t){let e=t.mass??1,s=t.stiffness??100,r=t.damping??10,i=Math.sqrt(s/e),o=Math.min(1,r/(2*Math.sqrt(s*e)));return Math.ceil(Math.log(200)/(o*i)*1e3*(o>=1?1.6:1))}function Da(t){let{steps:e,vis:s}=t.steps,r=t.rendered.viewBox,i=!1,o=rr(t),n=new Set([...o.pieces.map(c=>c.id),...o.routes.map(c=>c.id),...Object.keys(o.notes)]),a=c=>n.has(c),f=Object.keys(o.notes).filter(c=>o.notes[c]===void 0),p=e.map((c,l)=>{let d=[],m=[];for(let[u,b]of Object.entries(s))(l===0?!b.includes(!0):b[l-1]&&!b[l])?m.push(u):l>0&&b[l]&&!b[l-1]&&d.push(u);let h=[],y=u=>`${u.route}:${u.kind}`;c.phases.length&&h.push({travel:c.phases.map(u=>u.length===1?y(u[0]):u.map(y)),each:1150,hold:700,loop:!0});let g=(t.raw.steps??[])[l]?.pulse?.filter(u=>t.layout.byId.has(u))??[];if(g.length&&h.push({pulse:g,loop:!0}),c.focus){let[u,b,x,w]=_a(r,c.focus).map(kn);h.push({camera:{focus:[u,b,x,w]},duration:900,easing:"ease-in-out"}),i=!0}else i&&(h.push({camera:"fit",duration:900,easing:"ease-in-out"}),i=!1);let k={name:`step-${c.n}`,duration:c.duration,say:{title:c.heading,...c.caption?{text:c.caption}:{},...c.command?{code:c.command}:{}}};return d.length&&(k.show=d),m.length&&(k.hide=m),k.focus=t.raw.dim==="all"?{lit:c.lit.filter(a),scope:"all",level:.14}:{lit:c.lit.filter(a),scope:"links",level:.12,...f.length?{always:f}:{}},h.length&&(k.children=h),{sequence:k}});return{isomotion:1,...p.length?{series:p}:{}}}var xh={anyOf:[{type:"number"},{type:"string",pattern:"^-?\\d+(\\.\\d+)?(ms|s|f)?$"}]},kh={type:"array",items:{type:"string"}},$h={anyOf:[{enum:Yi},{type:"object",required:["bezier"],additionalProperties:!1,properties:{bezier:{type:"array",items:{type:"number"},minItems:4,maxItems:4}}},{type:"object",required:["spring"],additionalProperties:!1,properties:{spring:{$ref:"#/$defs/spring"}}}]},uf={from:{$ref:"#/$defs/time"},duration:{$ref:"#/$defs/time"},easing:{$ref:"#/$defs/ease"}},mn=(t,e,s={},r=!0)=>({type:"object",required:[t],additionalProperties:!1,properties:{[t]:e,...r?uf:{},...s}}),hf={$schema:"https://json-schema.org/draft/2020-12/schema",title:"isomotion/1",type:"object",required:["isomotion"],additionalProperties:!1,properties:{isomotion:{const:1},fps:{type:"number",exclusiveMinimum:0,description:'Frames a second, for lengths written "30f".'},seed:{type:"integer"},ambient:{enum:["on","off"],description:"Off: the ants and the looping tokens and pulses stand still, each at its start."},series:{$ref:"#/$defs/series"},layers:{$ref:"#/$defs/nodes"},markers:{type:"object",additionalProperties:{anyOf:[{type:"number"},{type:"string"}]}}},$defs:{time:xh,ids:kh,ease:$h,spring:{type:"object",additionalProperties:!1,properties:{mass:{type:"number",exclusiveMinimum:0},damping:{type:"number",exclusiveMinimum:0},stiffness:{type:"number",exclusiveMinimum:0},overshootClamping:{type:"boolean"}}},curve:{type:"object",required:["times","values"],additionalProperties:!1,properties:{times:{type:"array",items:{$ref:"#/$defs/time"},minItems:1},values:{type:"array",items:{type:"number"},minItems:1},easing:{$ref:"#/$defs/ease"},extrapolateLeft:{enum:or},extrapolateRight:{enum:or}}},say:{type:"object",additionalProperties:!1,properties:{chapter:{type:"string"},title:{type:"string"},text:{type:"string"},code:{type:"string"},color:{type:"string"},facts:{type:"array",items:{type:"array",items:{type:"string"},minItems:2,maxItems:2}}}},focus:{type:"object",required:["lit"],additionalProperties:!1,properties:{lit:{$ref:"#/$defs/ids"},scope:{enum:["all","links"]},level:{type:"number",minimum:0,maximum:1},always:{$ref:"#/$defs/ids"}}},sequence:{type:"object",additionalProperties:!1,properties:{name:{type:"string",pattern:"^[A-Za-z][\\w-]*$"},from:{$ref:"#/$defs/time"},offset:{$ref:"#/$defs/time"},trimBefore:{$ref:"#/$defs/time"},duration:{anyOf:[{$ref:"#/$defs/time"},{type:"object",required:["read"],additionalProperties:!1,properties:{read:{anyOf:[{const:!0},{type:"object",additionalProperties:!1,properties:{base:{type:"number"},perChar:{type:"number"},min:{type:"number"},max:{type:"number"}}}]}}}]},loop:{anyOf:[{type:"boolean"},{type:"integer",minimum:1}]},playbackRate:{type:"number",exclusiveMinimum:0},say:{$ref:"#/$defs/say"},show:{$ref:"#/$defs/ids"},hide:{$ref:"#/$defs/ids"},focus:{$ref:"#/$defs/focus"},highlight:{$ref:"#/$defs/ids"},levels:{type:"object",additionalProperties:{type:"number",minimum:0,maximum:1}},variants:{type:"object",additionalProperties:{type:"string"}},enter:{type:"object",required:["fade"],additionalProperties:!1,properties:{fade:{$ref:"#/$defs/time"},easing:{$ref:"#/$defs/ease"}}},ants:{anyOf:[{type:"boolean"},{$ref:"#/$defs/ids"}]},children:{$ref:"#/$defs/nodes"},layers:{$ref:"#/$defs/nodes"},series:{$ref:"#/$defs/series"}}},series:{type:"array",items:{anyOf:[{$ref:"#/$defs/seq"},mn("transition",{type:"object",required:["presentation","timing"],additionalProperties:!1,properties:{presentation:{enum:["fade","none"]},timing:{anyOf:[{type:"object",required:["linear"],additionalProperties:!1,properties:{linear:{$ref:"#/$defs/time"}}},{type:"object",required:["spring"],additionalProperties:!1,properties:{spring:{type:"object",additionalProperties:!1,properties:{mass:{type:"number",exclusiveMinimum:0},damping:{type:"number",exclusiveMinimum:0},stiffness:{type:"number",exclusiveMinimum:0},overshootClamping:{type:"boolean"},duration:{$ref:"#/$defs/time"}}}}}]}}},{},!1)]}},seq:mn("sequence",{$ref:"#/$defs/sequence"},{},!1),plan:{type:"object"},nodes:{type:"array",items:{anyOf:[{$ref:"#/$defs/seq"},mn("series",{$ref:"#/$defs/series"},{},!1),mn("layers",{$ref:"#/$defs/nodes"},{},!1),mn("assemble",{type:"object",properties:{style:{enum:jr},order:{enum:sr}}}),mn("disassemble",{type:"object",properties:{style:{enum:Lr},order:{enum:sr}}}),mn("travel",{type:"array",items:{anyOf:[{type:"string"},{$ref:"#/$defs/ids"}]},minItems:1},{each:{$ref:"#/$defs/time"},hold:{$ref:"#/$defs/time"},loop:{type:"boolean"}}),mn("pulse",{$ref:"#/$defs/ids"},{loop:{type:"boolean"}}),mn("ants",{anyOf:[{const:!0},{$ref:"#/$defs/ids"}]},{speed:{type:"number"},dash:{type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:2}}),mn("draw",{$ref:"#/$defs/ids"},{by:{enum:["stroke","grow"]},stagger:{$ref:"#/$defs/time"}}),mn("type",{$ref:"#/$defs/ids"}),{type:"object",required:["move"],additionalProperties:!1,properties:{move:{type:"string"},from:{$ref:"#/$defs/time"},x:{$ref:"#/$defs/curve"},y:{$ref:"#/$defs/curve"},scale:{$ref:"#/$defs/curve"},opacity:{$ref:"#/$defs/curve"}}},{type:"object",required:["lift","by"],additionalProperties:!1,properties:{lift:{$ref:"#/$defs/ids"},by:{type:"number"},stagger:{$ref:"#/$defs/time"},to:{enum:["up","down"]},opacity:{$ref:"#/$defs/curve"},...uf}},mn("focus",{$ref:"#/$defs/focus"},{fade:{$ref:"#/$defs/time"}}),mn("highlight",{$ref:"#/$defs/ids"},{fade:{$ref:"#/$defs/time"}}),mn("camera",{anyOf:[{const:"fit"},{type:"object",required:["focus"],additionalProperties:!1,properties:{focus:{anyOf:[{type:"string"},{$ref:"#/$defs/ids"},{type:"array",items:{type:"number"},minItems:4,maxItems:4}]},zoom:{type:"number",exclusiveMinimum:0},margin:{type:"number"}}}]})]}}}};var bf=new Set(["fill","stroke","stroke-width","stroke-dasharray","stroke-linecap","stroke-linejoin","opacity","fill-opacity","stroke-opacity","font-size","font-weight","font-family","letter-spacing","text-anchor","dominant-baseline","paint-order","display","stop-color","stop-opacity"]),Sh=new Set("cursor pointer-events transition animation transform-box transform-origin user-select".split(" "));function vh(t,e){let s={classes:[],not:[],attrs:[],child:e},r=t,i=n=>{let a=n.exec(r);return a&&(r=r.slice(a[0].length)),a},o=i(/^[a-zA-Z][\w-]*/);for(o?s.tag=o[0]:i(/^\*/);r;){let n;if(n=i(/^\.([\w-]+)/))s.classes.push(n[1]);else if(n=i(/^:not\(\.([\w-]+)\)/))s.not.push(n[1]);else if(n=i(/^\[([\w-]+)(?:="([^"]*)")?\]/))s.attrs.push([n[1],n[2]]);else throw new Error(`resolve: a selector it doesn't know: ${t}`)}return s}function Mh(t){let e=t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/@keyframes[^{]*\{(?:[^{}]*\{[^}]*\})*[^{}]*\}/g,"").replace(/@media[^{]*\{(?:[^{}]*\{[^}]*\})*[^{}]*\}/g,"");if(/@/.test(e.replace(/"[^"]*"/g,"")))throw new Error("resolve: an at-rule it doesn't know");let s=[];for(let r of e.matchAll(/([^{}]+)\{([^{}]*)\}/g)){let i=r[2].split(";").map(o=>o.trim()).filter(Boolean).map(o=>{let n=o.indexOf(":"),a=o.slice(0,n).trim(),f=o.slice(n+1).trim();return[a,f.replace(/\s*!important$/,""),/!important$/.test(f)]});for(let o of i)if(!o[0].startsWith("--")&&!bf.has(o[0])&&!Sh.has(o[0]))throw new Error(`resolve: a property it doesn't know: ${o[0]}`);for(let o of r[1].split(",").map(n=>n.trim()).filter(Boolean)){if(o.includes(":root")||o.includes("::")||/^(html|body)\b/.test(o))continue;let a=o.replace(/\s*>\s*/g," >").split(/\s+/).map(p=>vh(p.replace(/^>/,""),p.startsWith(">"))),f=a.reduce((p,c)=>p+10*(c.classes.length+c.not.length+c.attrs.length)+(c.tag?1:0),0);s.push({parts:a,spec:f,order:s.length,decls:i})}}return s}function Ph(t){let e={name:"#root",attrs:[],children:[]},s=e;for(let r of t.matchAll(/<\/[a-zA-Z][\w:-]*>|<([a-zA-Z][\w:-]*)((?:\s+[\w:-]+="[^"]*")*)\s*(\/?)>|([^<]+)/g)){if(r[4]!==void 0){s.children.push(r[4]);continue}if(r[1]===void 0){s=s.parent;continue}let i={name:r[1],attrs:[...r[2].matchAll(/([\w:-]+)="([^"]*)"/g)].map(o=>[o[1],o[2]]),children:[],parent:s};s.children.push(i),r[3]||(s=i)}return e.children[0]}var wf=t=>typeof t=="string"?t:`<${t.name}${t.attrs.map(([e,s])=>` ${e}="${s}"`).join("")}${t.children.length||t.name==="g"?`>${t.children.map(wf).join("")}</${t.name}>`:"/>"}`,Xi=(t,e)=>t.attrs.find(s=>s[0]===e)?.[1],Gr=(t,e,s)=>{let r=t.attrs.find(i=>i[0]===e);r?r[1]=s:t.attrs.push([e,s])},Oh=t=>(Xi(t,"class")??"").split(/\s+/).filter(Boolean);function Ah(t,e){if(e.tag&&e.tag!==t.name)return!1;let s=Oh(t);return e.classes.every(r=>s.includes(r))&&!e.not.some(r=>s.includes(r))&&e.attrs.every(([r,i])=>{let o=Xi(t,r);return o!==void 0&&(i===void 0||o===i)})}function Cc(t,e,s=e.length-1){if(!Ah(t,e[s]))return!1;if(s===0)return!0;let r=t.parent;if(e[s].child)return!!r&&r.name!=="#root"&&Cc(r,e,s-1);for(;r&&r.name!=="#root";r=r.parent)if(Cc(r,e,s-1))return!0;return!1}var Bs=t=>t.endsWith("%")?parseFloat(t)/100:parseFloat(t);function Th(t,e,s,r){let i=(1-Math.abs(2*s-1))*e,o=(t%360+360)%360/60,n=i*(1-Math.abs(o%2-1)),a=s-i/2,[f,p,c]=o<1?[i,n,0]:o<2?[n,i,0]:o<3?[0,i,n]:o<4?[0,n,i]:o<5?[n,0,i]:[i,0,n];return[(f+a)*255,(p+a)*255,(c+a)*255,r]}function xf(t,e){let s=[],r=0,i="";for(let o of t)o==="("&&r++,o===")"&&r--,o===e&&r===0?(s.push(i.trim()),i=""):i+=o;return[...s,i.trim()].filter(Boolean)}var yf={transparent:[0,0,0,0],black:[0,0,0,1],white:[255,255,255,1]};function Ba(t){let e=t.trim();if(Object.hasOwn(yf,e))return yf[e];let s=/^#([0-9a-f]{3,8})$/i.exec(e);if(s){let r=s[1].length<6?[...s[1]].map(i=>i+i).join(""):s[1];return[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16),r.length===8?parseInt(r.slice(6),16)/255:1]}if(s=/^hsla?\((.*)\)$/.exec(e),s){let[r,i]=s[1].split("/").map(p=>p.trim()),[o,n,a,f]=r.split(/[\s,]+/);return Th(parseFloat(o),Bs(n),Bs(a),i!==void 0?Bs(i):f!==void 0?Bs(f):1)}if(s=/^rgba?\((.*)\)$/.exec(e),s){let[r,i,o,n]=s[1].split(/[\s,/]+/).filter(Boolean);return[Bs(r),Bs(i),Bs(o),n===void 0?1:Bs(n)]}if(s=/^color-mix\(in srgb\s*,(.*)\)$/.exec(e),s){let[r,i]=xf(s[1],",").map(c=>{let l=/^(.*?)\s+([\d.]+)%$/.exec(c);return l?{c:Ba(l[1]),p:Number(l[2])/100}:{c:Ba(c),p:void 0}});if(!r?.c||!i?.c)return;let o=r.p??(i.p===void 0?.5:1-i.p),n=i.p??1-o,a=o+n,f=(r.c[3]*o+i.c[3]*n)/a,p=c=>f===0?0:(r.c[c]*r.c[3]*o+i.c[c]*i.c[3]*n)/a/f;return[p(0),p(1),p(2),f*Math.min(1,a)]}}var gf=t=>"#"+[t[0],t[1],t[2]].map(e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,"0")).join(""),Eh=t=>String(Math.round(t*1e4)/1e4);function jc(t,e,s=0){if(s>20)throw new Error(`resolve: a custom property in a loop: ${t}`);let r=t.indexOf("var(");if(r<0)return t;let i=0,o=r+3;do t[o]==="("&&i++,t[o]===")"&&i--,o++;while(i>0&&o<t.length);let[n,...a]=xf(t.slice(r+4,o-1),","),f=e.get(n)??(a.length?a.join(","):void 0);if(f===void 0)throw new Error(`resolve: no value for ${n}`);return jc(t.slice(0,r)+f+t.slice(o),e,s+1)}var Nh=t=>new Map(t.split(";").filter(Boolean).map(e=>{let s=e.indexOf(":");return[e.slice(0,s).trim(),e.slice(s+1).trim()]})),Lc={sans:"system-ui, -apple-system, Segoe UI, Roboto, sans-serif",mono:"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"};function Zr(t,e){let s=Ri(e.theme),r=e.fonts??Lc,i=Mh(`.mono{font-family:${r.mono.replace(/"/g,"")}}
150
+ ${s.rest}
151
+ ${e.css}`),o=Ph(t);Gr(o,"font-family",r.sans.replace(/"/g,""));let n=(a,f)=>{let p=f,c=new Map,l=(h,y,g)=>{let k=c.get(h);(!k||g[0]>k.rank[0]||g[0]===k.rank[0]&&(g[1]>k.rank[1]||g[1]===k.rank[1]&&g[2]>=k.rank[2]))&&c.set(h,{v:y,rank:g})};for(let h of i)if(Cc(a,h.parts))for(let[y,g,k]of h.decls)l(y,g,[k?1:0,h.spec,h.order]);let d=Xi(a,"style");if(d){for(let h of d.split(";").map(y=>y.trim()).filter(Boolean)){let y=h.indexOf(":");l(h.slice(0,y).trim(),h.slice(y+1).trim(),[0,1e6,0])}a.attrs=a.attrs.filter(h=>h[0]!=="style")}for(let[h,y]of c)h.startsWith("--")&&(p===f&&(p=new Map(f)),p.set(h,y.v));let m={};for(let[h,y]of c){if(!bf.has(h))continue;let g=jc(y.v,p).trim();if(h==="fill"||h==="stroke"||h==="stop-color"){if(g==="none"||g==="currentColor"||g==="inherit"||g.startsWith("url(")){Gr(a,h,g);continue}let k=Ba(g);if(!k)throw new Error(`resolve: a colour it doesn't know: ${g}`);Gr(a,h,gf(k)),k[3]!==1&&(m[h==="stop-color"?"stop":h]=k[3])}else Gr(a,h,h==="letter-spacing"||h==="font-size"||h==="stroke-width"?g:g.replace(/"/g,""))}for(let[h,y]of Object.entries(m))Gr(a,`${h}-opacity`,Eh(y*Number(Xi(a,`${h}-opacity`)??1)));Xi(a,"opacity")==="0"&&(Gr(a,"display","none"),a.attrs=a.attrs.filter(h=>h[0]!=="opacity"));for(let h of a.attrs)if(/var\(|hsl\(|color-mix/.test(h[1])){let y=jc(h[1],p),g=Ba(y);h[1]=g?gf(g):y}for(let h of a.children)typeof h!="string"&&n(h,p)};return n(o,Nh(e.mode==="dark"?`${s.light};${s.dark}`:s.light)),wf(o)}var qa=t=>`${Math.round(parseInt(t.slice(1,3),16)/255*1e4)/100}%`,_c=(t,e,s)=>{let[r,i]=[t,e].map(n=>parseInt(n.slice(1,3),16)),o=Math.round(r+(i-r)*s).toString(16).padStart(2,"0");return`#${o}${o}${o}`};function Fc(t,e,s){let r=new Set([...t.matchAll(/\sclass="([^"]*)"/g)].flatMap(i=>i[1].split(/\s+/)).filter(i=>i.startsWith("k-")).map(i=>i.slice(2)));return{roles:Object.keys(e.roles).filter(i=>r.has(i)),kinds:[...new Set(s)].filter(i=>i in e.kinds)}}function Dc(t,e){let s=tn[e.mode].steps,r=(p,c)=>e.roles[p]??s[c],i={};for(let[p,c]of Object.entries(t.light))i[p]=/%$/.test(c)?c:e.ink;let o=r("slab",0),n=r("pad",0);Object.assign(i,{bg:e.paper,surface:e.paper,on:e.paper,ink:e.ink,muted:_c(e.paper,e.ink,.72),line:_c(e.paper,e.ink,.3),"code-bg":_c(e.paper,e.ink,.06),"slab-top":o.top,"slab-l":o.left,"slab-r":o.right,"pad-top":n.top});let a=Object.fromEntries(Object.entries(t.roles).map(([p])=>[p,{h:0,s:0}])),f=Object.fromEntries(Object.entries(t.kinds).map(([p,c])=>[p,{...c,color:e.ink}]));return _s({...t,light:i,dark:i,roles:a,kinds:f})}function Bc(t){let e="";for(let[s,r]of Object.entries(t.roles))e+=`.k-${s}{--s:0%;--l-top:${qa(r.top)};--l-left:${qa(r.left)};--l-right:${qa(r.right)};--l-edge:${qa(r.edge)}}
152
+ `;for(let[s,r]of Object.entries(t.kinds))e+=`.flow.f-${s}{stroke-width:${r.width}${r.dash.length?`;stroke-dasharray:${r.dash.join(" ")}`:";stroke-dasharray:none"}}
153
+ `;return e}var Rh={hatch:{size:6,draw:(t,e)=>`<path d="M0,6L6,0M-1.5,1.5L1.5,-1.5M4.5,7.5L7.5,4.5" stroke="${t}" stroke-width="${e}" fill="none"/>`},"hatch-wide":{size:12,draw:(t,e)=>`<path d="M0,0L12,12M-3,9L3,15M9,-3L15,3" stroke="${t}" stroke-width="${e}" fill="none"/>`},dots:{size:8,draw:(t,e)=>`<circle cx="2" cy="2" r="${e+.2}" fill="${t}"/><circle cx="6" cy="6" r="${e+.2}" fill="${t}"/>`}},Ih=t=>Math.round(t*100)/100,zh=(t,e)=>Ci(t,e.ink)>=Ci(t,e.paper)?e.ink:e.paper;function Va(t,e,s){let r=new Map,i=(f,p)=>{let c=`${s}-mono-${f}-${p.slice(1)}`,l=Rh[f],d=e.mode==="dark"?1.2:.9;return r.has(c)||r.set(c,`<pattern id="${c}" width="${l.size}" height="${l.size}" patternUnits="userSpaceOnUse">${l.draw(p,Ih(d))}</pattern>`),c},o=[],n="",a="";for(let f of t.matchAll(/<\/[a-zA-Z][\w:-]*>|<([a-zA-Z][\w:-]*)((?:\s+[\w:-]+="[^"]*")*)\s*(\/?)>|[^<]+/g)){if(n+=f[0],f[0].startsWith("</")){o.pop();continue}if(f[1]===void 0)continue;let p=(/\sclass="([^"]*)"/.exec(f[2])?.[1]??"").split(/\s+/);o.length===1&&(a=p.find(y=>y.startsWith("g-"))??"");let c=p.find(y=>y.startsWith("k-"))?.slice(2)??o.at(-1);if(f[3]||o.push(p.includes("ghost")?"":c),!f[3]||f[1]!=="polygon"&&f[1]!=="path"||!c||!p.some(y=>y==="top"||y==="lft"||y==="rgt")||a==="g-base"&&!p.includes("rgt"))continue;let l=Object.hasOwn(e.roles,c)?e.roles[c].pattern:"none",d=/\sfill="(#[0-9a-f]{6})"/.exec(f[2])?.[1],m=/\s(points|d)="[^"]*"/.exec(f[2])?.[0];if(l==="none"||!d||!m)continue;let h=/\sfill-opacity="[^"]*"/.exec(f[2])?.[0]??"";n+=`<${f[1]}${m} class="mono-pattern" fill="url(#${i(l,zh(d,e))})" stroke="none"${h}/>`}return n=n.replace(/#([0-9a-f]{6})\b/g,(f,p)=>p.slice(0,2)===p.slice(2,4)&&p.slice(2,4)===p.slice(4,6)?f:Ch(f)),r.size&&(n=n.replace(/<defs\/>|<defs>/,f=>f==="<defs/>"?`<defs>${[...r.values()].join("")}</defs>`:f+[...r.values()].join(""))),n}function Ch(t){let e=zi(t),s=e>8?((e+16)/116)**3:e/(24389/27),r=s<=.0031308?s*12.92:1.055*s**(1/2.4)-.055,i=Math.max(0,Math.min(255,Math.round(r*255))).toString(16).padStart(2,"0");return`#${i}${i}${i}`}function Ka(t,e,s,r,i){let o=ca(e,s,Fc(t,e,r),i);return{look:o,theme:Dc(e,o),css:Bc(o)}}function qc(t){return Math.max(5600,Math.min(12500,2600+t.length*40))}function Ga(t,e,s,r,i,o){let n=[],a=(A,R,M,T="error")=>{let S=i.locate(A);n.push({severity:T,message:R,line:S.line,col:S.col,path:A,hint:M})},f=t.steps??[],p=new Set(Object.keys(o.kinds)),c=new Map(r.map(A=>[A.id,A])),l=()=>[...s.byId.keys(),...c.keys()],d=new Map;f.forEach((A,R)=>{A.id&&(d.has(A.id)&&a(`${e}/steps/${R}/id`,`duplicate step id "${A.id}"`),d.set(A.id,R+1))});let m=f.length,h=(A,R)=>{if(typeof A=="number"){if(A<1||A>m){a(R,`there is no step ${A}; this scene has ${m} step(s)`);return}return A}let M=d.get(A);return M===void 0&&a(R,`unknown step "${A}"`+Rn(A,d.keys())),M},y=A=>Un(o,o.kinds[A]?.color??"control"),g=[],k=A=>{g.includes(A)||g.push(A)};for(let A of r)k(A.kind);let u={},b=(A,R,M,T)=>{if(R===void 0&&M===void 0)return;let S=R!==void 0?h(R,T+"/appears"):1,N=M!==void 0?h(M,T+"/disappears"):m+1;u[A]=Array.from({length:m},(z,K)=>K+1>=(S??1)&&K+1<(N??m+1))};for(let A of s.items)b(A.id,A.appears,A.disappears,A.path);for(let A of r)b(A.id,A.raw.appears,A.raw.disappears,A.path);let x=[],w=[],$=[],v=[],O=()=>{for(let A of r){if(A.raw.appears!==void 0||A.raw.disappears!==void 0)continue;let R=[A.from,A.to].map(M=>M&&(u[M.id]??C(M)));R.some(Boolean)&&(u[A.id]=Array.from({length:m},(M,T)=>R.every(S=>!S||S[T])))}},C=A=>{for(let R=A.parent;R;R=R.parent)if(u[R.id])return u[R.id]};return f.forEach((A,R)=>{let M=R+1,T=`${e}/steps/${R}`,S=A.kind??"control";p.has(S)||a(T+"/kind",`unknown flow kind "${S}"`+Rn(S,p)),k(S);let N=new Set,z=[];(A.animate??[]).forEach((L,U)=>{let H=Array.isArray(L)?L:[L],ee=[];H.forEach((j,q)=>{let G=Array.isArray(L)?`${T}/animate/${U}/${q}`:`${T}/animate/${U}`,Q,ce;if(typeof j=="string"){let ie=/^([^:\s]+)\s*(?::\s*(\S+))?$/.exec(j.trim());Q=ie?ie[1]:j,ce=ie?.[2]}else{let ie=Object.entries(j)[0];Q=ie[0],ce=ie[1]}let pe=c.get(Q);if(!pe){a(G,`unknown route "${Q}"`+Rn(Q,c.keys()));return}if(ce&&!p.has(ce)){a(G,`unknown flow kind "${ce}"`+Rn(ce,p));return}let Y=ce??pe.kind;k(Y),ee.push({route:Q,kind:Y,color:y(Y)}),N.add(Q),pe.from&&N.add(pe.from.id),pe.to&&N.add(pe.to.id)}),ee.length&&z.push(ee)});let K=[];(A.pulse??[]).forEach((L,U)=>{let H=s.byId.get(L);if(!H){a(`${T}/pulse/${U}`,`unknown node "${L}"`+Rn(L,s.byId.keys()));return}let ee,j,q,G,Q=H.node?er(s.catalog,H.node.asset):void 0;if(Q?.pulse)[ee,j,q,G]=Q.pulse(H.box);else{let Y=H.box;ee=(Y.x0+Y.x1)/2,j=(Y.y0+Y.y1)/2,q=Y.z1,G=Math.max(22,Math.min(60,(Y.x1-Y.x0+Y.y1-Y.y0)*8.5))}let[ce,pe]=Ne(ee,j,q);K.push([ce,pe,G*1.7,G*.98]),N.add(L)}),(A.highlight??[]).forEach((L,U)=>{!s.byId.has(L)&&!c.has(L)&&a(`${T}/highlight/${U}`,`unknown id "${L}"`+Rn(L,l())),N.add(L)});for(let[L,U]of[["show",!0],["hide",!1]])(A[L]??[]).forEach((H,ee)=>{if(!s.byId.has(H)&&!c.has(H)){a(`${T}/${L}/${ee}`,`unknown id "${H}"`+Rn(H,l()));return}let j=u[H]??(u[H]=Array(m).fill(!U));for(let q=R;q<m;q++)j[q]=U});if((A.say??[]).forEach((L,U)=>{let H,ee;if(Array.isArray(L.at))[H,ee]=Ne(L.at[0],L.at[1],L.at[2]??.36);else{let q=s.byId.get(L.at);if(!q){a(`${T}/say/${U}/at`,`unknown node "${L.at}"`+Rn(L.at,s.byId.keys()));return}let G=q.box;[H,ee]=Ne((G.x0+G.x1)/2,(G.y0+G.y1)/2,G.z1+.75)}let j=L.kind??S;p.has(j)||a(`${T}/say/${U}/kind`,`unknown flow kind "${j}"`+Rn(j,p)),w.push({step:M,x:H+(L.dx??0),y:ee+(L.dy??(Array.isArray(L.at)?0:-46)),ax:H,ay:ee,text:L.text,kind:j,anchor:L.anchor??"middle"})}),(A.mark??[]).forEach((L,U)=>{if(L.at){$.push({step:M,p:[L.at[0],L.at[1],L.at[2]??.36]});return}let H=L.on?c.get(L.on):void 0;if(!H){a(`${T}/mark/${U}`,L.on?`unknown route "${L.on}"`+Rn(L.on,c.keys()):'a mark needs "on: ROUTE" or "at: [x, y]"');return}let ee=H.points[H.points.length-1];$.push({step:M,p:[ee[0],ee[1],ee[2]+.6],on:H.id}),N.add(H.id)}),t.badges&&A.badge!==!1){let L=Array.isArray(A.badge)?[A.badge[0],A.badge[1],A.badge[2]??.36]:void 0,U=typeof A.badge=="string"?A.badge:z[0]?.[0]?.route,H=U?c.get(U):void 0;if(!L)if(H)L=Vc(H.points);else if(U&&s.byId.get(U)){let ee=s.byId.get(U).box;L=[(ee.x0+ee.x1)/2,(ee.y0+ee.y1)/2,ee.z1+.3]}else typeof A.badge=="string"&&a(`${T}/badge`,`unknown id "${A.badge}"`+Rn(A.badge,l()));L&&v.push({step:M,num:A.number??M,kind:S,p:L})}for(let L of[...N])for(let U=s.byId.get(L)?.parent;U;U=U.parent)N.add(U.id);for(let L of s.items)L.region?.kind==="tunnel"&&(L.region.around??[]).some(U=>N.has(U))&&N.add(L.id);let J;if(A.focus?.length){let L=1/0,U=1/0,H=-1/0,ee=-1/0;A.focus.forEach((j,q)=>{let G=s.byId.get(j);if(!G){a(`${T}/focus/${q}`,`unknown node or region "${j}"`+Rn(j,s.byId.keys()));return}let Q=G.box;for(let[ce,pe,Y]of[[Q.x0,Q.y0,Q.z1],[Q.x1,Q.y0,Q.z0],[Q.x0,Q.y1,Q.z0],[Q.x1,Q.y1,Q.z0],[Q.x1,Q.y0,Q.z1],[Q.x0,Q.y1,Q.z1]]){let[ie,Ae]=Ne(ce,pe,Y);L=Math.min(L,ie),U=Math.min(U,Ae),H=Math.max(H,ie),ee=Math.max(ee,Ae)}N.add(j)}),L<1/0&&(J=[Math.round(L-60),Math.round(U-70),Math.round(H+60),Math.round(ee+40)])}let Z=A.caption??"";x.push({n:M,num:A.number??M,kind:S,color:y(S),heading:A.heading,caption:Z,command:A.command??"",phases:z,pulses:K,lit:[...N],duration:A.duration===void 0||A.duration==="auto"?qc(Z):A.duration,...J?{focus:J}:{}})}),O(),{steps:x,says:w,marks:$,badges:v,vis:u,diags:n,kindsUsed:g}}function Vc(t){let e=t.slice(1).map((r,i)=>Math.hypot(r[0]-t[i][0],r[1]-t[i][1],r[2]-t[i][2])),s=e.reduce((r,i)=>r+i,0)/2;for(let r=0;r<e.length;r++){if(s<=e[r]&&e[r]>0){let i=s/e[r],o=t[r],n=t[r+1];return[o[0]+(n[0]-o[0])*i,o[1]+(n[1]-o[1])*i,o[2]+(n[2]-o[2])*i]}s-=e[r]}return t[0]}function Rn(t,e){let s=Vt(t,e);return s?` (did you mean "${s}"?)`:""}var Kc=`
143
154
  *{box-sizing:border-box}
144
155
  html,body{margin:0}
145
156
  body{background:var(--bg);color:var(--ink);font:15px/1.55 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;-webkit-font-smoothing:antialiased;overflow-x:hidden}
@@ -163,7 +174,7 @@ h2{font-size:20px;margin:44px 0 4px;letter-spacing:-.005em;text-wrap:balance}
163
174
  .legend i{display:inline-block;width:26px;height:0;border-top:3px solid}
164
175
  .legend i.box{height:10px;border-width:1.5px;border-style:solid;border-radius:2px}
165
176
  footer{margin-top:40px;font-size:12.5px;color:var(--muted)}
166
- `,ei=t=>Rd+ao(t)+Id+lo(),Rd=`
177
+ `,ar=t=>jh+da(t)+Lh+fa(),jh=`
167
178
  /* blocks: hue per role, lightness per face and theme */
168
179
  .blk .top{fill:hsl(var(--h) var(--s) var(--l-top))}
169
180
  .blk .lft{fill:hsl(var(--h) var(--s) var(--l-left))}
@@ -204,14 +215,14 @@ footer{margin-top:40px;font-size:12.5px;color:var(--muted)}
204
215
  .floor.t-control{fill:var(--muted)}
205
216
  .slabname{font-size:15px;font-weight:800;fill:var(--muted);letter-spacing:.12em;opacity:.8}
206
217
  .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}
218
+ `,Lh=`.tunnel polygon{fill:hsl(205 85% 55% / .17);stroke:hsl(205 75% 45% / .8);stroke-width:1.3;stroke-linejoin:round}
208
219
  .tunnel .top{fill:hsl(205 85% 65% / .22)}
209
220
  .tunnel .rib{fill:none;stroke:hsl(205 75% 45% / .5);stroke-width:1}
210
221
  .tunname{font-size:12px;font-weight:800;letter-spacing:.14em;fill:var(--tunnel-text);paint-order:stroke;stroke:var(--surface);stroke-width:3px;stroke-linejoin:round}
211
222
 
212
223
  /* flows */
213
224
  .flow{fill:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:round}
214
- `,ar=t=>il+ei(t),ol=`
225
+ `,Ur=t=>Kc+ar(t),Qi=`
215
226
  /* step marks */
216
227
  .xm circle{fill:var(--surface);stroke:var(--blocked);stroke-width:2.5}
217
228
  .xm path{stroke:var(--blocked);stroke-width:3;stroke-linecap:round}
@@ -234,7 +245,7 @@ svg.all .badge{opacity:1}
234
245
  svg.focus.all [data-hl]:not(.hl),svg.focus.all.dim-all [data-dim]:not(.hl){opacity:.9}
235
246
  svg [data-step]:not(.on),svg.all [data-step]{opacity:0!important;pointer-events:none}
236
247
  .pre{opacity:0!important;pointer-events:none}
237
- `,al=`
248
+ `,Gc=`
238
249
  /* player */
239
250
  .player{display:flex;align-items:flex-start;gap:10px 14px;padding:12px 16px;border-top:1px solid var(--line);flex-wrap:wrap}
240
251
  .ctrls{display:flex;gap:6px;flex:none}
@@ -269,57 +280,57 @@ details.steps li code{font-size:11.5px}
269
280
  .still .ctrls,.still .tools{display:none}
270
281
  .tools{display:flex;gap:6px;flex:none;order:3;margin-left:auto}
271
282
  .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=`
283
+ .pbtn.small[aria-pressed="true"]{color:var(--ink);border-color:var(--muted);background:var(--surface)}`,eo=`
273
284
  .grid{display:none;fill:none;stroke:var(--ink);stroke-width:.6;opacity:.16;pointer-events:none}
274
285
  svg.show-grid .grid{display:inline}
275
286
  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":""}:
287
+ `,Za=Qi+Gc+eo;var Zc=t=>({data:t,locate:()=>({line:0,col:0}),span:()=>{},diags:[]});function Ua(t,e,s,r=Zc(t),i,o={},n=[]){let a=_s(Tr(e),t.roles,t.kinds),f=[],p=new Map;return t.scenes.forEach((c,l)=>{let d=`/scenes/${l}`;if(p.has(c.id)){let u=r.locate(d+"/id");n.push({severity:"error",message:`duplicate scene id "${c.id}"`,line:u.line,col:u.col,path:d+"/id"})}p.set(c.id,l);let m={...t.grid,...c.grid,...o.snap?{snap:o.snap}:{}},h=Nr(c,d,r,a,s,t.roles,m.snap);n.push(...h.diags);let y=xa(c,d,h,r,new Set(Object.keys(a.kinds)),m.snap);n.push(...y.diags);let g=Ga(c,d,h,y.routes,r,a);n.push(...g.diags),n.push(..._h(c,d,s,r));let k=Fr({scene:c,layout:h,routes:y.routes,steps:g,theme:a,id:c.id,gridStep:m.step??m.snap??1});for(let u of k.warnings){let b=r.locate(u.path);n.push({severity:"warning",message:u.message,line:b.line,col:b.col,path:u.path})}f.push({id:c.id,raw:c,layout:h,routes:y.routes,steps:g,rendered:k,grid:m,assemble:c.assemble??t.assemble??!1})}),n.sort((c,l)=>c.line-l.line||c.col-l.col),{ok:!n.some(c=>c.severity==="error"),diags:n,doc:t,theme:a,catalog:s,scenes:f,parsed:r,source:i}}function _h(t,e,s,r){let i=[],o=(a,f)=>{let p=r.locate(a);i.push({severity:"warning",message:f,line:p.line,col:p.col,path:a})},n=(a,f)=>{a.nodes?.forEach((p,c)=>{let l=`${f}/nodes/${c}`;(p.deco??An(s,p.asset).deco??[]).forEach((d,m)=>{typeof d=="object"&&d.icon&&!ji(d.icon)&&o(p.deco?`${l}/deco/${m}/icon`:l,`node "${p.id}": no icon "${d.icon}" is registered here, so it is drawn as a placeholder`)}),p.face!==void 0&&!tr(p.face)&&o(`${l}/face`,`node "${p.id}": no screen face "${p.face}" is registered here, so it is drawn as a placeholder`)}),a.regions?.forEach((p,c)=>n(p,`${f}/regions/${c}`))};return n(t,e),i}function kf(t,e){let s=t/(Ct*lt),r=2*e/lt;return[(s+r)/2,(r-s)/2]}function $f(t,e){let s=t.layout.byId.get(e);if(!s)return;let r=s.parent?[s.parent.box.x0,s.parent.box.y0]:[0,0];return[s.box.x0-r[0],s.box.y0-r[1]]}function Sf(t){let e=[];for(let s of[t.x0,t.x1])for(let r of[t.y0,t.y1])for(let i of[t.z0,t.z1])e.push(Ne(s,r,i));return Fh(e)}function vf(t){return[[t.x0,t.y0],[t.x1,t.y0],[t.x1,t.y1],[t.x0,t.y1]].map(([e,s])=>Ne(e,s,t.z0))}function Fh(t){let e=[...new Map(t.map(o=>[`${o[0].toFixed(3)},${o[1].toFixed(3)}`,o])).values()].sort((o,n)=>o[0]-n[0]||o[1]-n[1]);if(e.length<3)return e;let s=(o,n,a)=>(n[0]-o[0])*(a[1]-o[1])-(n[1]-o[1])*(a[0]-o[0]),r=[],i=[];for(let o of e){for(;r.length>=2&&s(r[r.length-2],r[r.length-1],o)<=1e-9;)r.pop();r.push(o)}for(let o of[...e].reverse()){for(;i.length>=2&&s(i[i.length-2],i[i.length-1],o)<=1e-9;)i.pop();i.push(o)}return[...r.slice(0,-1),...i.slice(0,-1)]}var Mf=(t,e)=>e?.padding??Ot(t,e?.kind)?.pad??0;function Pf(t,e,s,r,i){let o=c=>Math.round(c/s)*s,n=o(t[0]+e[0]),a=o(t[1]+e[1]),f={left:!1,right:!1,top:!1,bottom:!1};if(i){let c=Math.ceil(i.pad/s-1e-9)*s,l=Math.floor((i.w-i.pad-r[0])/s+1e-9)*s,d=Math.floor((i.d-i.pad-r[1])/s+1e-9)*s;n<c&&(n=c,f.left=!0),l>=c&&n>l&&(n=l,f.right=!0),a<c&&(a=c,f.top=!0),d>=c&&a>d&&(a=d,f.bottom=!0)}let p=c=>Math.round(c*1e3)/1e3;return{at:[p(n),p(a)],delta:[p(n-t[0]),p(a-t[1])],clamped:f}}function Ha(t,e){return e.some(r=>t.x0<r.x1-1e-6&&t.x1>r.x0+1e-6&&t.y0<r.y1-1e-6&&t.y1>r.y0+1e-6)}var Hc=Object.freeze({W:178,H:58,GX:44,GY:44,PAD:22,TITLE:30,CH:96,cardRx:9,panelRx:14,bend:70,overlap:400,crossPanel:300,border:120,nearEdge:200,margin:16}),Yc={name:{key:"sans600_12",size:13},sub:{key:"sans400_13",size:10},title:{key:"sans700_13",size:12,spacing:.02},titleSub:{key:"sans400_13",size:10.5},label:{key:"sans600_12",size:10.5}},Of=(t,e)=>Pn(t,Yc[e]);function Ya(t){let e=[],s=new Map,r=(f,p)=>{if(typeof p!="string"||!p){e.push(`${f} has no id`);return}let c=s.get(p);c?e.push(`duplicate id "${p}": a ${c} and a ${f} (cards and panels share one set of ids)`):s.set(p,f)};for(let f of t.cards)r("card",f.id),(!Array.isArray(f.cell)||f.cell.length!==2||!f.cell.every(p=>Number.isInteger(p)&&p>=0))&&e.push(`card "${f.id}": cell must be [column, row], whole numbers from 0`);for(let f of t.panels??[]){r("panel",f.id);let p=f.cells;(!Array.isArray(p)||p.length!==4||!p.every(c=>Number.isInteger(c)&&c>=0)||p[2]<p[0]||p[3]<p[1])&&e.push(`panel "${f.id}": cells must be [c0, r0, c1, r1] with c0 \u2264 c1 and r0 \u2264 r1`)}let i=new Map;for(let f of t.cards){let p=String(f.cell);i.has(p)?e.push(`cards "${i.get(p)}" and "${f.id}" are both at cell [${p}]`):i.set(p,f.id)}let o=(t.panels??[]).filter(f=>Array.isArray(f.cells)&&f.cells.length===4);for(let f=0;f<o.length;f++)for(let p=f+1;p<o.length;p++){let c=o[f].cells,l=o[p].cells;c[0]<=l[2]&&l[0]<=c[2]&&c[1]<=l[3]&&l[1]<=c[3]&&!Uc(c,l)&&!Uc(l,c)&&e.push(`panels "${o[f].id}" and "${o[p].id}" overlap without one holding the other`)}let n=new Set([...t.cards.map(f=>f.id),...o.map(f=>f.id)]),a=new Set(o.map(f=>f.id));return(t.links??[]).forEach((f,p)=>{let c=`link ${f.id?`"${f.id}"`:p}`;for(let l of["a","b"])n.has(f[l])||e.push(`${c}: ${l} "${f[l]}" is no card or panel`);for(let l of["aOn","bOn"])f[l]!==void 0&&!a.has(f[l])&&e.push(`${c}: ${l} "${f[l]}" is no panel`);f.id!==void 0&&r("link",f.id)}),e}var Uc=(t,e)=>t[0]>=e[0]&&t[2]<=e[2]&&t[1]>=e[1]&&t[3]<=e[3];function to(t,e){let{W:s,H:r,GX:i,GY:o,PAD:n,TITLE:a,CH:f}=e,p=t.panels??[],c=j=>(j[2]-j[0]+1)*(j[3]-j[1]+1),l=(j,q)=>{let G=p[j].cells,Q=p[q].cells;return Uc(Q,G)?c(G)>c(Q)||j<q:!1},d=p.map((j,q)=>{let G=-1;return p.forEach((Q,ce)=>{ce!==q&&l(ce,q)&&(G<0||l(G,ce))&&(G=ce)}),G}),m=j=>d[j]<0?0:1+m(d[j]),h=(j,q)=>{let G=-1;p.forEach((ce,pe)=>{let Y=ce.cells;j>=Y[0]&&j<=Y[2]&&q>=Y[1]&&q<=Y[3]&&(G<0||l(G,pe))&&(G=pe)});let Q=[];for(let ce=G;ce>=0;ce=d[ce])Q.unshift(ce);return Q},y=Math.max(1,...t.cards.map(j=>j.cell[0]+1),...p.map(j=>j.cells[2]+1)),g=Math.max(1,...t.cards.map(j=>j.cell[1]+1),...p.map(j=>j.cells[3]+1)),k=[];for(let j=0;j<y;j++){k.push([]);for(let q=0;q<g;q++)k[j].push(h(j,q))}let u=(j,q,G)=>{let Q=j.filter(pe=>!q.includes(pe)),ce=q.filter(pe=>!j.includes(pe));return!Q.length&&!ce.length?0:Q.length*(n+(G?a:0))+ce.length*n+f},b=new Array(y+1).fill(0),x=new Array(g+1).fill(0);for(let j=0;j<g;j++)for(let q=1;q<y;q++){let G=u(k[q-1][j],k[q][j],!1);G&&(b[q]=Math.max(b[q],G-i))}for(let j=0;j<y;j++)for(let q=1;q<g;q++){let G=u(k[j][q-1],k[j][q],!0);G&&(x[q]=Math.max(x[q],G-o))}let w=j=>{let q=j*(s+i);for(let G=1;G<=j;G++)q+=b[G];return q},$=j=>{let q=j*(r+o);for(let G=1;G<=j;G++)q+=x[G];return q},v=(j,q,G,Q)=>G===q?j(q):j(q)+(Q-q)*(j(G)-j(q))/(G-q),O=p.map(()=>new Set),C=(j,q)=>{for(let G=j;G>=0;G=d[G])O[G].add(q)};p.forEach((j,q)=>{C(q,j.cells[1]),C(q,j.cells[3])});for(let j of t.cards){let q=k[j.cell[0]][j.cell[1]];q.length&&C(q[q.length-1],j.cell[1])}let A=p.map(()=>new Map),R=(j,q)=>j.slice(j.indexOf(q)+1);for(let j of p.map((q,G)=>G).sort((q,G)=>m(q)-m(G)||q-G)){let q=p[j].cells,G=[...O[j]].sort((ce,pe)=>ce-pe),Q=d[j]>=0?A[d[j]].get(G[0]):$(G[0]);A[j].set(G[0],Q);for(let ce=1;ce<G.length;ce++){let pe=0;for(let Y=q[0];Y<=q[2];Y++)pe=Math.max(pe,u(R(k[Y][G[ce-1]],j),R(k[Y][G[ce]],j),!0));Q+=r+Math.max(o,pe),A[j].set(G[ce],Q)}}let M=p.map(()=>new Set),T=(j,q)=>{for(let G=j;G>=0;G=d[G])M[G].add(q)};p.forEach((j,q)=>{T(q,j.cells[0]),T(q,j.cells[2])});for(let j of t.cards){let q=k[j.cell[0]][j.cell[1]];q.length&&T(q[q.length-1],j.cell[0])}let S=p.map(()=>new Map);for(let j of p.map((q,G)=>G).sort((q,G)=>m(q)-m(G)||q-G)){let q=p[j].cells,G=[...M[j]].sort((ce,pe)=>ce-pe);if(d[j]<0&&!d.includes(j)&&G.length===q[2]-q[0]+1){for(let ce of G)S[j].set(ce,v(w,q[0],q[2],ce));continue}let Q=d[j]>=0?S[d[j]].get(G[0]):w(G[0]);S[j].set(G[0],Q);for(let ce=1;ce<G.length;ce++){let pe=0;for(let Y=q[1];Y<=q[3];Y++)pe=Math.max(pe,u(R(k[G[ce-1]][Y],j),R(k[G[ce]][Y],j),!1));Q+=s+Math.max(i,pe),S[j].set(G[ce],Q)}}let N=(j,q)=>{let G=k[j][q],Q=G.length?G[G.length-1]:-1;return Q>=0?[S[Q].get(j),A[Q].get(q)]:[w(j),$(q)]},z=p.map((j,q)=>q).sort((j,q)=>m(q)-m(j)||j-q),K=new Array(p.length);for(let j of z){let q=p[j].cells,G=[],Q=[];for(let Y of t.cards){let ie=k[Y.cell[0]][Y.cell[1]];ie[ie.length-1]===j&&(G.push(S[j].get(Y.cell[0])),Q.push(A[j].get(Y.cell[1])))}let ce=Y=>Y.cell[0]>=q[0]&&Y.cell[0]<=q[2]&&Y.cell[1]>=q[1]&&Y.cell[1]<=q[3];for(let Y of[q[1],q[3]])t.cards.some(ie=>ie.cell[1]===Y&&ce(ie))||Q.push(A[j].get(Y));for(let Y of[q[0],q[2]])t.cards.some(ie=>ie.cell[0]===Y&&ce(ie))||G.push(S[j].get(Y));let pe={l:G.length?Math.min(...G):1/0,t:Q.length?Math.min(...Q):1/0,r:G.length?Math.max(...G)+s:-1/0,b:Q.length?Math.max(...Q)+r:-1/0};p.forEach((Y,ie)=>{if(d[ie]!==j)return;let Ae=K[ie];pe.l=Math.min(pe.l,Ae.l),pe.t=Math.min(pe.t,Ae.t),pe.r=Math.max(pe.r,Ae.r),pe.b=Math.max(pe.b,Ae.b)}),K[j]={l:pe.l-n,t:pe.t-n,r:pe.r+n,b:pe.b+n+a}}let J=t.cards.map(j=>N(j.cell[0],j.cell[1])),Z=t.cards.map(j=>{let q=k[j.cell[0]][j.cell[1]];return q.length?q[q.length-1]:-1}),L=(j,q)=>{for(let G=j;G>=0;G=d[G])if(G===q)return!0;return!1},U=(j,q)=>{t.cards.forEach((G,Q)=>{Z[Q]>=0&&L(Z[Q],j)&&(J[Q]=[J[Q][0]+q,J[Q][1]])}),p.forEach((G,Q)=>{L(Q,j)&&(K[Q]={...K[Q],l:K[Q].l+q,r:K[Q].r+q})})},H=j=>{let q=[],G=[],Q=[],ce=[];t.cards.forEach((I,V)=>{Z[V]===j&&(q.push(J[V][0]),Q.push(J[V][0]+s),G.push(J[V][1]),ce.push(J[V][1]+r))}),p.forEach((I,V)=>{d[V]===j&&(q.push(K[V].l),Q.push(K[V].r),G.push(K[V].t),ce.push(K[V].b))});let pe=K[j],Y=Math.min(...q,pe.l+n),ie=Math.max(...Q,pe.r-n),Ae=Math.min(...G,pe.t+n),De=Math.max(...ce,pe.b-n-a);K[j]={l:Y-n,t:Ae-n,r:ie+n,b:De+n+a}};for(let j of z)if(d[j]<0&&!d.includes(j))H(j);else{let G=[];t.cards.forEach((ie,Ae)=>{Z[Ae]===j&&G.push({l:J[Ae][0],r:J[Ae][0]+s,t:J[Ae][1],b:J[Ae][1]+r,card:Ae})}),p.forEach((ie,Ae)=>{d[Ae]===j&&G.push({...K[Ae],panel:Ae})}),G.sort((ie,Ae)=>ie.l-Ae.l||ie.t-Ae.t);let Q=Math.min(...G.map(ie=>ie.l)),ce=[];for(let ie of G){let Ae=Q;for(let I of ce)I.t<ie.b&&ie.t<I.b&&I.r<=ie.l+1e-6&&(Ae=Math.max(Ae,I.r+(I.card!==void 0&&ie.card!==void 0?i:f)));let De=Ae-ie.l;De<-1e-6&&(ie.card!==void 0?J[ie.card]=[J[ie.card][0]+De,J[ie.card][1]]:U(ie.panel,De),ie.l+=De,ie.r+=De),ce.push(ie)}let pe=G.map(ie=>ie.l),Y=G.map(ie=>ie.r);K[j]={...K[j],l:Math.min(...pe)-n,r:Math.max(...Y)+n}}return{prect:K,parentIx:d,depthOf:m,pos:N,cardAt:j=>J[j]}}function Hr(t,e,s={}){if(s.wrap){let{wrap:E,..._}=s;return Hr(Dh(t,e,E.aspect,_),e,_)}let r=Ya(t);if(r.length)throw new Error(`the board has ${r.length} error${r.length>1?"s":""}:
277
288
  ${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=`
289
+ `)}`);let i={...Hc,...s},{W:o,H:n}=i,a=E=>Math.round(E*10)/10,f=[],p=t.panels??[],{prect:c,parentIx:l,depthOf:d,cardAt:m}=to(t,i),h=p.map((E,_)=>{let D=c[_],le=e(E.label??"","title")+(E.sub?e(E.sub,"titleSub"):0);return{...E,rect:D,titleAt:[a(D.l+16),a(D.b-15)],depth:d(_),parent:l[_]>=0?p[l[_]].id:void 0,title:{l:D.l+10,r:D.l+22+le,t:D.b-30,b:D.b-6}}}),y=t.cards.map(E=>{let[_,D]=m(t.cards.indexOf(E));return{...E,rect:{l:_,t:D,r:_+o,b:D+n}}}),g=new Map;h.forEach(E=>g.set(E.id,E.rect)),y.forEach(E=>g.set(E.id,E.rect));let k=y.map(E=>E.rect),u=h.map(E=>E.rect),b=h.filter(E=>E.label).map(E=>E.title),x=(E,_)=>E.l>=_.l&&E.r<=_.r&&E.t>=_.t&&E.b<=_.b,w=(E,_,D,le)=>Math.min(E[0],_[0])<D.r+le&&Math.max(E[0],_[0])>D.l-le&&Math.min(E[1],_[1])<D.b+le&&Math.max(E[1],_[1])>D.t-le,$=(E,_)=>u.reduce((D,le)=>{if(E[0]===_[0]){let ue=Math.min(E[1],_[1]),Ce=Math.max(E[1],_[1]);E[0]>le.l&&E[0]<le.r&&(D+=[le.t,le.b].filter(oe=>oe>ue+1&&oe<Ce-1).length)}else{let ue=Math.min(E[0],_[0]),Ce=Math.max(E[0],_[0]);E[1]>le.t&&E[1]<le.b&&(D+=[le.l,le.r].filter(oe=>oe>ue+1&&oe<Ce-1).length)}return D},0),v=(E,_)=>u.some(D=>E[1]===_[1]?[D.t,D.b].some(le=>Math.abs(E[1]-le)<16&&Math.max(E[0],_[0])>D.l&&Math.min(E[0],_[0])<D.r):[D.l,D.r].some(le=>Math.abs(E[0]-le)<16&&Math.max(E[1],_[1])>D.t&&Math.min(E[1],_[1])<D.b)),O=(E,_,D,le)=>u.filter(ue=>ue!==D&&ue!==le&&!x(D,ue)&&!x(le,ue)&&w(E,_,{l:ue.l+3,r:ue.r-3,t:ue.t+3,b:ue.b-3},0)).length,C=[],A=new Map,R=new Map,M=(E,_)=>{C.push([E,_]);let[D,le]=E[1]===_[1]?[A,E[1]]:E[0]===_[0]?[R,E[0]]:[void 0,0];if(!D)return;let ue=Math.floor(le/6);(D.get(ue)??D.set(ue,[]).get(ue)).push([E,_])},T=(E,_)=>{let D=E[1]===_[1];if(!D&&E[0]!==_[0])return 0;let le=D?1:0,ue=D?0:1,Ce=D?A:R,oe=Math.floor(E[le]/6),Le=Math.min(E[ue],_[ue]),Pe=Math.max(E[ue],_[ue]),xe=0;for(let _e=oe-1;_e<=oe+1;_e++)for(let[Ue,mt]of Ce.get(_e)??[])Math.abs(E[le]-Ue[le])<6&&Math.min(Pe,Math.max(Ue[ue],mt[ue]))-Math.max(Le,Math.min(Ue[ue],mt[ue]))>0&&xe++;return xe},S=[...g.values()],N=Math.min(...S.map(E=>E.l)),z=Math.max(...S.map(E=>E.r)),K=Math.min(...S.map(E=>E.t)),J=Math.max(...S.map(E=>E.b)),Z=(E,_)=>{let D=(E+_)/2;return[D,D-12,D+12,D-24,D+24]},L=(()=>{let E=[];return k.forEach(_=>k.forEach(D=>{D.t>_.b&&D.l<_.r+400&&D.r>_.l-400&&E.push(...Z(_.b,D.t))})),E.push(K-22,K-34,J+22,J+34),[...new Set(E.map(Math.round))]})(),U=(()=>{let E=[];return k.forEach(_=>k.forEach(D=>{D.l>_.r&&E.push(...Z(_.r,D.l))})),E.push(N-22,N-34,z+22,z+34),[...new Set(E.map(Math.round))]})(),H=new Map,ee=new Map,j=E=>{let _=H.get(E);return _||H.set(E,_=k.filter(D=>E<D.b+6&&E>D.t-6)),_},q=E=>{let _=ee.get(E);return _||ee.set(E,_=k.filter(D=>E<D.r+6&&E>D.l-6)),_},G=i.crossPanel/i.overlap,Q=i.border/i.overlap,ce=i.nearEdge/i.overlap;function pe(E,_,D,le,ue=!0){let Ce=0;for(let xe=1;xe<E.length;xe++)Ce+=Math.abs(E[xe-1][0]-E[xe][0])+Math.abs(E[xe-1][1]-E[xe][1]);let oe=Ce+i.bend*(E.length-2);if(oe>=le)return oe;let Le=0,Pe=0;for(let xe=1;xe<E.length;xe++){let _e=E[xe-1],Ue=E[xe];if(ue){if(ae(_e,Ue,_,D)||v(_e,Ue))return 1/0;continue}for(let mt of _e[1]===Ue[1]?j(_e[1]):q(_e[0]))mt!==_&&mt!==D&&w(_e,Ue,mt,6)&&Le++;for(let mt of b)w(_e,Ue,mt,2)&&Le++}for(let xe=1;xe<E.length;xe++){let _e=E[xe-1],Ue=E[xe];if(Pe+=T(_e,Ue)+G*O(_e,Ue,_,D)+Q*$(_e,Ue),v(_e,Ue)&&(Pe+=ce),oe+i.overlap*Pe>=le)return oe+i.overlap*Pe}return oe+i.overlap*Pe+Le*1e5}let Y=E=>(E.l+E.r)/2,ie=E=>(E.t+E.b)/2,Ae=[0,-22,22,-44,44],De={bc:1/0},I=(E,_,D,le)=>Math.abs(E-D)+Math.abs(_-le),V=(E,_,D,le,ue,Ce,oe,Le)=>{let Pe=0;return Pe+=I(E,_,D,le),Pe+=I(D,le,ue,Ce),Pe+=I(ue,Ce,oe,Le),Pe+i.bend*2},te=(E,_,D,le,ue,Ce,oe,Le,Pe,xe)=>{let _e=0;return _e+=I(E,_,D,le),_e+=I(D,le,ue,Ce),_e+=I(ue,Ce,oe,Le),_e+=I(oe,Le,Pe,xe),_e+i.bend*3},ae=(E,_,D,le)=>{for(let ue of E[1]===_[1]?j(E[1]):q(E[0]))if(ue!==D&&ue!==le&&w(E,_,ue,6))return!0;for(let ue of b)if(w(E,_,ue,2))return!0;return v(E,_)};function Te(E,_,D,le){let ue=Math.max(E.l,_.l),Ce=Math.min(E.r,_.r);if(Ce-ue>24)for(let at of Ae){let ht=(ue+Ce)/2+at;ht>ue+8&&ht<Ce-8&&D(_.t>=E.b?[[ht,E.b],[ht,_.t]]:[[ht,E.t],[ht,_.b]])}let oe=Math.max(E.t,_.t),Le=Math.min(E.b,_.b);if(Le-oe>16)for(let at of[0,-10,10]){let ht=(oe+Le)/2+at;D(_.l>=E.r?[[E.r,ht],[_.l,ht]]:[[E.l,ht],[_.r,ht]])}let Pe=U.length,xe=L.length,_e=new Uint8Array(Ae.length*xe),Ue=new Uint8Array(Ae.length*xe),mt=new Uint8Array(Ae.length*Pe),ys=new Uint8Array(Ae.length*Pe),kt=(at,ht,Ln,Kt)=>le?(at[ht]||(at[ht]=ae(Ln,Kt,E,_)?2:1),at[ht]===1):!0;Ae.forEach((at,ht)=>Ae.forEach((Ln,Kt)=>{let _t=Y(E)+at,Dt=Y(_)+Ln,Gt=ie(E)+at/3,$t=ie(_)+Ln/3;L.forEach((We,_n)=>{let yt=We>E.b?E.b:We<E.t?E.t:null,cn=We>_.b?_.b:We<_.t?_.t:null;yt!==null&&cn!==null&&V(_t,yt,_t,We,Dt,We,Dt,cn)<De.bc&&kt(_e,ht*xe+_n,[_t,yt],[_t,We])&&kt(Ue,Kt*xe+_n,[Dt,We],[Dt,cn])&&D([[_t,yt],[_t,We],[Dt,We],[Dt,cn]])}),U.forEach((We,_n)=>{let yt=We>E.r?E.r:We<E.l?E.l:null,cn=We>_.r?_.r:We<_.l?_.l:null;yt!==null&&cn!==null&&V(yt,Gt,We,Gt,We,$t,cn,$t)<De.bc&&kt(mt,ht*Pe+_n,[yt,Gt],[We,Gt])&&kt(ys,Kt*Pe+_n,[We,$t],[cn,$t])&&D([[yt,Gt],[We,Gt],[We,$t],[cn,$t]])}),at===0&&Ln===0&&U.forEach((We,_n)=>L.forEach((yt,cn)=>{let F=We>E.r?E.r:We<E.l?E.l:null,se=yt>_.b?_.b:yt<_.t?_.t:null;F!==null&&se!==null&&te(F,Gt,We,Gt,We,yt,Dt,yt,Dt,se)<De.bc&&kt(mt,ht*Pe+_n,[F,Gt],[We,Gt])&&kt(Ue,Kt*xe+cn,[Dt,yt],[Dt,se])&&D([[F,Gt],[We,Gt],[We,yt],[Dt,yt],[Dt,se]]);let he=yt>E.b?E.b:yt<E.t?E.t:null,ge=We>_.r?_.r:We<_.l?_.l:null;he!==null&&ge!==null&&te(_t,he,_t,yt,We,yt,We,$t,ge,$t)<De.bc&&kt(_e,ht*xe+cn,[_t,he],[_t,yt])&&kt(ys,Kt*Pe+_n,[We,$t],[ge,$t])&&D([[_t,he],[_t,yt],[We,yt],[We,$t],[ge,$t]])}));let ur=Y(E)<_.l?_.l:Y(E)>_.r?_.r:null,Zt=$t<E.t?E.t:$t>E.b?E.b:null;ur!==null&&Zt!==null&&D([[_t,Zt],[_t,$t],[ur,$t]]);let Zs=ie(E)<_.t?_.t:ie(E)>_.b?_.b:null,hr=Dt<E.l?E.l:Dt>E.r?E.r:null;Zs!==null&&hr!==null&&D([[hr,Gt],[Dt,Gt],[Dt,Zs]])}))}function be(E,_,D,le){for(let ue of Ae){let Ce=Y(E)+ue,oe=ie(E)+ue/3,Le=[[[Ce,E.t],[Ce,_.t]],[[E.r,oe],[_.r,oe]],[[Ce,E.b],[Ce,_.b]],[[E.l,oe],[_.l,oe]]];for(let Pe of Le)le(D?[Pe[1],Pe[0]]:Pe)}}let ze=(E,_,D,le)=>{let ue=null;return De.bc=1/0,E(Ce=>{let oe=pe(Ce,_,D,De.bc,le);oe<De.bc&&(De.bc=oe,ue=Ce)},le),ue},Ie=[],ke=E=>u.some(_=>[_.l,_.r].some(D=>E.l<D+3&&E.r>D-3&&E.b>_.t&&E.t<_.b)||[_.t,_.b].some(D=>E.t<D+3&&E.b>D-3&&E.r>_.l&&E.l<_.r)),Be=E=>C.filter(([_,D])=>w(_,D,E,1)).length,Qe=E=>b.some(_=>E.l<_.r&&E.r>_.l&&E.t<_.b&&E.b>_.t),Ke=E=>k.filter(_=>E.l<_.r+3&&E.r>_.l-3&&E.t<_.b+3&&E.b>_.t-3).length,pt=E=>Ie.filter(_=>E.l<_.r+4&&E.r>_.l-4&&E.t<_.b+2&&E.b>_.t-2).length,P=E=>50*me(E)+3*Be(E)+(ke(E)?1:0)+(Qe(E)?5:0)+5*Ke(E)+5*pt(E),B=E=>Be(E)>0||ke(E)||Qe(E)||Ke(E)>0||pt(E)>0,W=[];(t.links??[]).forEach((E,_)=>{let D=E.id??`link-${_}`,le=g.get(E.aOn??E.a),ue=g.get(E.bOn??E.b);if(le===ue){f.push(`link "${D}" joins "${E.aOn??E.a}" to itself: not drawn`),W.push({...E,id:D,points:[],routed:!1});return}let Ce=x(le,ue)?Pe=>be(le,ue,!1,Pe):x(ue,le)?Pe=>be(ue,le,!0,Pe):(Pe,xe)=>Te(le,ue,Pe,xe),oe=ze(Ce,le,ue,!0),Le=!0;if(oe||(oe=ze(Ce,le,ue,!1),Le=!1,f.push(`link "${D}": no clear route; drawn the least bad way`)),!oe){W.push({...E,id:D,points:[],routed:!1});return}for(let Pe=1;Pe<oe.length;Pe++)M(oe[Pe-1],oe[Pe]);W.push({...E,id:D,points:oe,routed:Le})});let fe=[];for(let E=0;E<C.length;E++)for(let _=E+1;_<C.length;_++){let[D,le]=C[E],[ue,Ce]=C[_],oe=D[1]===le[1],Le=ue[1]===Ce[1];if(oe===Le)continue;let[Pe,xe]=oe?[[D,le],[ue,Ce]]:[[ue,Ce],[D,le]],_e=xe[0][0],Ue=Pe[0][1];_e>Math.min(Pe[0][0],Pe[1][0])&&_e<Math.max(Pe[0][0],Pe[1][0])&&Ue>Math.min(xe[0][1],xe[1][1])&&Ue<Math.max(xe[0][1],xe[1][1])&&fe.push([_e,Ue])}let me=E=>fe.filter(([_,D])=>_>E.l-2&&_<E.r+2&&D>E.t-2&&D<E.b+2).length;for(let E of W){let _=E,D=E.points;if(!_.label||!D.length)continue;let le=[];for(let xe=1;xe<D.length;xe++)le.push([D[xe-1],D[xe]]);let ue=xe=>Math.abs(xe[0][0]-xe[1][0])+Math.abs(xe[0][1]-xe[1][1]);le.sort((xe,_e)=>ue(_e)-ue(xe));let Ce=e(_.label,"label")+6,oe=null,Le=null,Pe=1/0;for(let[xe,_e]of le){let Ue=(xe[0]+_e[0])/2,mt=(xe[1]+_e[1])/2,ys=xe[1]===_e[1]?[0,-.3,.3,-.15,.15].flatMap(kt=>{let at=Ue+kt*Math.abs(xe[0]-_e[0]);return[[at,mt-6,"middle"],[at,mt+15,"middle"]]}):[0,-.3,.3].flatMap(kt=>{let at=mt+4+kt*Math.abs(xe[1]-_e[1]);return[[Ue+7,at,"start"],[Ue-7,at,"end"],[Ue+24,at,"start"],[Ue-24,at,"end"]]});for(let[kt,at,ht]of ys){let Ln=ht==="middle"?kt-Ce/2:ht==="end"?kt-Ce:kt,Kt={l:Ln,r:Ln+Ce,t:at-11,b:at+3};if(!B(Kt)){oe=[kt,at,ht,Kt];break}let _t=P(Kt);_t<Pe&&(Pe=_t,Le=[kt,at,ht,Kt])}if(oe)break}if(!oe&&Le&&(oe=Le),!oe){let[xe,_e]=le[0],Ue=(xe[0]+_e[0])/2,mt=(xe[1]+_e[1])/2-6;oe=[Ue,mt,"middle",{l:Ue-Ce/2,r:Ue+Ce/2,t:mt-11,b:mt+3}]}Ie.push(oe[3]),E.at={x:a(oe[0]),y:a(oe[1]),anchor:oe[2],box:oe[3],text:_.label}}let X=[],ne=[];for(let E of[...S,...Ie,...h.map(_=>_.title)])X.push(E.l,E.r),ne.push(E.t,E.b);for(let E of W)for(let _ of E.points)X.push(_[0]),ne.push(_[1]);let ye=i.margin,$e={l:Math.min(...X)-ye,t:Math.min(...ne)-ye,r:Math.max(...X)+ye,b:Math.max(...ne)+ye};return{cards:y,panels:h,links:W,bounds:$e,options:i,warnings:f}}function Af(t,e,s){let r=o=>e>=o.l&&e<=o.r&&s>=o.t&&s<=o.b,i=t.cards.find(o=>r(o.rect));return i?i.id:[...t.panels].sort((o,n)=>n.depth-o.depth).find(o=>r(o.rect))?.id}function Dh(t,e,s,r={}){let i=a=>{let f=Hr(a,e,r);return Math.max(f.bounds.r-f.bounds.l,(f.bounds.b-f.bounds.t)*s)},o=t,n=i(t);for(let a=0;a<12;a++){let f,p=n;for(let c of Bh(o)){if(Ya(c).length)continue;let l=i(c);l<p-.5&&(p=l,f=c)}if(!f)break;o=f,n=p}return o}function*Bh(t){let e=t.panels??[],s=(n,a)=>n[0]>=a[0]&&n[2]<=a[2]&&n[1]>=a[1]&&n[3]<=a[3],r=(n,a)=>n.every((f,p)=>f===a[p]),i=(n,a=-1)=>{let f=-1;return e.forEach((p,c)=>{c===a||!s(n,p.cells)||a>=0&&c>a&&r(p.cells,e[a].cells)||(f<0||s(p.cells,e[f].cells)&&(!r(p.cells,e[f].cells)||c>f))&&(f=c)}),f},o=n=>{let a=[];return e.forEach((f,p)=>{i(f.cells,p)===n&&a.push({range:[...f.cells],panel:p})}),t.cards.forEach((f,p)=>{let c=[f.cell[0],f.cell[1],f.cell[0],f.cell[1]];i(c)===n&&a.push({range:c,card:p})}),a};for(let n of[-1,...e.map((a,f)=>f)]){let a=o(n);if(n>=0&&!a.some(l=>l.panel!==void 0))continue;let f=l=>[l.range[1],l.range[3]],p=[];for(let l of[...a].sort((d,m)=>d.range[1]-m.range[1]||d.range[0]-m.range[0])){let d=p.find(m=>m.some(h=>f(h)[0]<=f(l)[1]&&f(l)[0]<=f(h)[1]));d?d.push(l):p.push([l])}let c=Math.max(...a.map(l=>l.range[3]));for(let l of p){l.sort((d,m)=>d.range[0]-m.range[0]);for(let d=1;d<l.length;d++){let m=l.slice(d),h=l[0].range[0],y=c+1,g=Math.min(...m.map($=>$.range[1])),k=Math.max(...m.map($=>$.range[3]))-g+1,u=t.cards.map($=>({...$,cell:[...$.cell]})),b=e.map($=>({...$,cells:[...$.cells]}));for(let $ of u)$.cell[1]>c&&($.cell[1]+=k);let x=new Set;for(let $=n;$>=0&&!x.has($);$=i(e[$].cells,$))x.add($);b.forEach(($,v)=>{$.cells[1]>c?($.cells[1]+=k,$.cells[3]+=k):(x.has(v)||$.cells[1]<=c&&$.cells[3]>c)&&($.cells[3]+=k)});let w=h;for(let $ of m){let v=w-$.range[0],O=y+($.range[1]-g)-$.range[1],C=A=>A[0]>=$.range[0]&&A[0]<=$.range[2]&&A[1]>=$.range[1]&&A[1]<=$.range[3];t.cards.forEach((A,R)=>{C([A.cell[0],A.cell[1]])&&(u[R].cell=[A.cell[0]+v,A.cell[1]+O])}),e.forEach((A,R)=>{s(A.cells,$.range)&&(b[R].cells=[A.cells[0]+v,A.cells[1]+O,A.cells[2]+v,A.cells[3]+O])}),w+=$.range[2]-$.range[0]+1}e.forEach(($,v)=>{let O=t.cards.map((C,A)=>s([C.cell[0],C.cell[1],C.cell[0],C.cell[1]],$.cells)?u[A].cell:void 0).filter(C=>!!C);O.length&&(b[v].cells=[Math.min(...O.map(C=>C[0])),Math.min(...O.map(C=>C[1])),Math.max(...O.map(C=>C[0])),Math.max(...O.map(C=>C[1]))])}),yield{cards:u,panels:b,links:t.links}}}}}function Wa(t,e=()=>!0){let s=t.layout.items.filter(v=>e(v.id)),r=t.layout.catalog,i=!t.layout.items.some(v=>v.type==="node"),o=v=>i?!v.children.some(O=>e(O.id)):v.type==="node"&&!v.children.some(O=>O.type==="node"&&e(O.id)),n=s.filter(o),a=v=>{let O=[];for(let C=v;C;C=C.parent)O.unshift(C);return O},f=new Map(n.map(v=>[v.id,a(v)])),p=(v,O)=>{let C=f.get(v.id),A=f.get(O.id),R=0;for(;R<C.length&&R<A.length&&C[R]===A[R];)R++;return[C[R].box,A[R].box]},c=1e-6,l=(v,O)=>{let[C,A]=p(v,O);return C.y1<=A.y0+c&&C.x0<A.x1-c&&A.x0<C.x1-c},d=(v,O)=>{let[C,A]=p(v,O);return C.x1<=A.x0+c&&C.y0<A.y1-c&&A.y0<C.y1-c},m=(v,O)=>{let C=new Map,A=[];for(let R of[...n].sort((M,T)=>O(M)-O(T))){let M=0;for(let T of A)C.get(T.id)+1>M&&v(T,R)&&(M=C.get(T.id)+1);C.set(R.id,M),A.push(R)}return C},h=m(l,v=>v.box.y0),y=m(d,v=>v.box.x0),g=Math.min(...n.map(v=>v.box.x1-v.box.x0))/2;for(let v of n)if(!v.parent)for(let O of n)O.parent&&O.box.x0<=v.box.x0+g&&y.set(v.id,Math.max(y.get(v.id),y.get(O.id)));let k=new Map;for(let v of n)k.set(v.id,[y.get(v.id),h.get(v.id)]);let u=new Map;for(let v of n){let O=k.get(v.id),C=u.get(String(O));if(C!==void 0&&C!==v.id){for(let[,A]of k)A[0]>O[0]&&A!==O&&A[0]++;O[0]++,u.clear();for(let A of n)u.set(String(k.get(A.id)),A.id)}else u.set(String(O),v.id)}let b=n.map(v=>{if(v.region){let A=v.region;return{id:v.id,label:A.label??v.id,sub:void 0,role:A.role??Ot(r,A.kind)?.role??"grey",ghost:A.ghost||void 0,cell:k.get(v.id)}}let O=v.node,C=An(r,O.asset);return{id:v.id,label:O.label??v.id,sub:O.sub,role:O.role??C.role,ghost:O.ghost||void 0,cell:k.get(v.id)}}),x=[];for(let v of s){if(o(v))continue;let O=[],C=S=>{for(let N of S.children){let z=k.get(N.id);z&&O.push(z),C(N)}};if(C(v),!O.length)continue;let A=O.map(S=>S[0]),R=O.map(S=>S[1]),M=v.type==="region"?v.region.label:v.node.label??v.id,T=v.type==="region"?v.region.role??Ot(r,v.region.kind)?.role:v.node.role??An(r,v.node.asset).role;x.push({id:v.id,label:M,sub:v.type==="node"?v.node.sub:void 0,role:T,cells:[Math.min(...A),Math.min(...R),Math.max(...A),Math.max(...R)]})}let w=new Set([...b.map(v=>v.id),...x.map(v=>v.id)]),$=[];for(let v of t.routes){if(!e(v.id))continue;let O=wn(v.raw.from).id,C=wn(v.raw.to).id;if(!w.has(O)||!w.has(C))continue;let A=typeof v.raw.label=="string"?v.raw.label:v.raw.label?.text;$.push({id:v.id,a:O,b:C,kind:v.kind,label:A})}return{cards:b,panels:x,links:$}}var qs={W:4,D:2,H:.9,GX:2,GY:2.4,PAD:.6,CH:2.2,PANEL_H:.3},Tf=`
279
290
  .blk .card-name{font-size:13px;font-weight:600;fill:var(--ink)}
280
291
  .blk .card-sub{font-size:10px;fill:var(--ink);opacity:.75}
281
292
  .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">
286
- <button class="pbtn small" type="button" data-a="grid" aria-pressed="${t.grid.show?"true":"false"}" title="Show the floor grid">Grid</button>
293
+ `;function Wc(t){return{name:"card",description:"A card: a slab with its name on its front face",size:[qs.W,qs.D,qs.H],role:"grey",draw(e,s,r){let i=t(r.id),o=e.blockFaces(s);if(!i)return o;let n=s.z1-s.z0;return o+=e.faceText(s.x0+.2,s.y1,s.z0+(i.sub?n*.52:n*.34),i.label,"card-name",wt.lbl,"left","start"),i.sub&&(o+=e.faceText(s.x0+.2,s.y1,s.z0+n*.14,i.sub,"card-sub",wt.sub,"left","start")),o}}}function Ef(t){let e=new Map(t.cards.map(s=>[s.id,{label:s.label,sub:s.sub}]));return{regions:{panel:{shape:"slab",pad:qs.PAD,z:[qs.PANEL_H,0],floor:!0,role:"grey",labelStyle:"floor"}},nodes:{card:Wc(s=>e.get(s))},defaultNode:"card"}}function Nf(t,e={}){let s=qs,{prect:r,parentIx:i,cardAt:o}=to(t,{W:s.W,H:s.D,GX:s.GX,GY:s.GY,PAD:s.PAD,TITLE:0,CH:s.CH}),n=t.panels??[],a=h=>Math.round(h*1e3)/1e3,f=h=>(h.cells[2]-h.cells[0]+1)*(h.cells[3]-h.cells[1]+1),p=h=>{let y=-1;return n.forEach((g,k)=>{let u=g.cells;h.cell[0]>=u[0]&&h.cell[0]<=u[2]&&h.cell[1]>=u[1]&&h.cell[1]<=u[3]&&(y<0||f(g)<=f(n[y]))&&(y=k)}),y},c=n.map((h,y)=>{let g=r[y],k=i[y]>=0?r[i[y]]:{l:0,t:0};return{id:h.id,kind:"panel",label:h.label,role:h.role,at:[a(g.l-k.l),a(g.t-k.t)],size:[a(g.r-g.l),a(g.b-g.t)],regions:[],nodes:[]}}),l=[],d=[];c.forEach((h,y)=>i[y]>=0?c[i[y]].regions.push(h):l.push(h));for(let h of t.cards){let[y,g]=o(t.cards.indexOf(h)),k=p(h),u=k>=0?r[k]:{l:0,t:0},b={id:h.id,asset:"card",role:h.role,ghost:h.ghost||void 0,at:[a(y-u.l),a(g-u.t)],size:[s.W,s.D,s.H]};(k>=0?c[k].nodes:d).push(b)}for(let h of c)h.regions.length||delete h.regions,h.nodes.length||delete h.nodes;let m=(t.links??[]).map((h,y)=>({id:h.id??`link-${y}`,from:h.aOn??h.a,to:h.bOn??h.b,kind:h.kind,label:h.label}));return{isodiag:1,title:e.title,kinds:e.kinds,roles:e.roles,scenes:[{id:"board",title:e.title??"board",regions:l,nodes:d,routes:m}]}}var vm={};ho(vm,{APPEARS:()=>jf,BASE_FIELDS:()=>dp,BINS:()=>Jf,BIN_MS:()=>zn,CARD:()=>Mt,DUAL_VIEW_CSS:()=>Sm,IDLES:()=>Lf,MAX_ZOOM:()=>Xa,MIN_ZOOM:()=>Ja,P3:()=>st,PLAY_CSS:()=>Yf,SEGMENT_NAME:()=>rl,SEVERITIES:()=>un,TIMELINE_VERSION:()=>Wf,activityOf:()=>gp,attr:()=>Qn,binNext:()=>pl,binStart:()=>lr,buildLayer:()=>ao,cardMotion:()=>_f,clamp:()=>Ps,cls:()=>Df,crumbs:()=>Jr,dualView:()=>xm,ease:()=>oo,escapeName:()=>al,extent:()=>Qa,findGaps:()=>dl,fitWithOverlay:()=>Bf,flatCss:()=>hm,flatSvg:()=>gl,formatScope:()=>Xf,gapKey:()=>pr,gapLabel:()=>cr,h:()=>re,hasSegment:()=>tm,highlights:()=>ro,isZone:()=>rm,isoVars:()=>qf,join:()=>Qf,kindOf:()=>Yr,legend:()=>cp,levelOf:()=>Jt,markConnectors:()=>xl,md:()=>$n,measureIn:()=>bl,memorySource:()=>cm,modeFor:()=>yp,morphSvgs:()=>wm,mountPlayer:()=>Hf,mountTimeline:()=>mm,n:()=>ep,nameOf:()=>Wr,node:()=>Ff,offsetAt:()=>nn,overlayPaint:()=>zf,pageClock:()=>pp,parentOf:()=>em,prefixAt:()=>Ms,prune:()=>np,pts:()=>no,rangeOf:()=>so,readTime:()=>fp,rectOf:()=>ym,renderPage:()=>Kf,rewrite:()=>tp,scope:()=>rp,scopePattern:()=>il,scopeRules:()=>ol,scopeSelector:()=>sp,searchFor:()=>Xr,severities:()=>nm,stepData:()=>lp,storedMode:()=>km,ticks:()=>fl,timeScale:()=>Qr,toCSV:()=>ul,toJSON:()=>ml,transport:()=>tl,unite:()=>el,viewToggle:()=>$m,viewport:()=>If,within:()=>hn});function qh(t,e,s){let i=(a,f,p,c,l)=>Math.min((a-48)/(p-f),...c===void 0||l===void 0?[]:[[l-c,12],[l-f,30],[p-c,30]].map(([d,m])=>d>0?(a-m)/d:1/0)),o=Math.min(Xa,Math.max(Ja,Math.min(i(t.w,e.x,e.x+e.w,s?.x,s&&s.x+s.w),i(t.h,e.y,e.y+e.h,s?.y,s&&s.y+s.h)))),n=(a,f,p,c,l)=>{let d=(f+p)/2;if(c===void 0||l===void 0)return d;let m=l-(a/2-6)/o,h=c+(a/2-6)/o;return m>h?(m+h)/2:Math.max(m,Math.min(h,d))};return{k:o,cx:n(t.w,e.x,e.x+e.w,s?.x,s&&s.x+s.w),cy:n(t.h,e.y,e.y+e.h,s?.y,s&&s.y+s.h)}}var Ja=.1,Xa=8;function If(t,e){let s,r,i=!1,o=0,n=0,a=0,f=0,p=0,c=!1,l=()=>{let v=t.getBoundingClientRect();return{w:Math.max(1,v.width),h:Math.max(1,v.height)}},d=(v=s)=>{let O=l();return Math.min(O.w/v.w,O.h/v.h)},m=v=>{o++;try{v()}finally{o--}};function h(){let v=e.svg();if(!v||!s)return;o||(i=!0);let O=l(),C=d(),A=O.w/C,R=O.h/C;s={x:s.x+(s.w-A)/2,y:s.y+(s.h-R)/2,w:A,h:R},v.setAttribute("viewBox",`${s.x.toFixed(2)} ${s.y.toFixed(2)} ${s.w.toFixed(2)} ${s.h.toFixed(2)}`),n=C,e.onApply(C),a&&Math.abs(C/a-1)>.02&&(cancelAnimationFrame(f),f=requestAnimationFrame(()=>{f=0,e.onRezoom()}))}let y=(v,O)=>{let C=t.getBoundingClientRect(),A=d();return{x:s.x+(v-C.left)/A,y:s.y+(O-C.top)/A}};function g(v,O,C){if(!s)return;let A=d(),R=Math.min(Xa,Math.max(Ja,A*v)),M=t.getBoundingClientRect(),T=O??M.left+M.width/2,S=C??M.top+M.height/2,N=y(T,S),z=l();s={x:N.x-(T-M.left)/R,y:N.y-(S-M.top)/R,w:z.w/R,h:z.h/R},h()}function k(v=r,O){if(!v)return;let C=l(),{k:A,cx:R,cy:M}=qh(C,v,O),T={x:R-C.w/A/2,y:M-C.h/A/2,w:C.w/A,h:C.h/A};if(s&&Math.abs(T.w/s.w-1)<.001&&Math.abs(T.h/s.h-1)<.001&&Math.abs(T.x-s.x)<T.w*.001&&Math.abs(T.y-s.y)<T.h*.001){h();return}s=T,h()}function u(){for(let v=0,O="";v<4;v++){let C=e.itemsBox()??r;if(!C)return;let A=[C.x,C.y,C.w,C.h].map(M=>Math.round(M)).join();if(A===O)break;O=A;let R=Math.max(24,Math.min(C.w,C.h)*.06);if(m(()=>k({x:C.x-R,y:C.y-R,w:C.w+R*2,h:C.h+R*2},e.alsoBox?.())),!e.marksShowing()||!a||Math.abs(d()/a-1)<=.02)break;cancelAnimationFrame(f),f=0,e.onRezoom()}i=!1}function b(){if(i||!e.svg()||!s)return;let v=t.getBoundingClientRect();v.width<2||v.height<2||u()}function x(){if(!s)return;let v=d();g(1/v)}function w(){return new Promise(v=>{let O=0,C=n,A=()=>{if(c){v();return}let R=!!(f||p)||n!==C;C=n,O=R?0:O+1,O>=2?v():requestAnimationFrame(A)};requestAnimationFrame(A)})}let $=new ResizeObserver(()=>{if(!(!s||c)){if(i&&n){let v=l(),O=s.x+s.w/2,C=s.y+s.h/2;s={x:O-v.w/n/2,y:C-v.h/n/2,w:v.w/n,h:v.h/n}}i||(cancelAnimationFrame(p),p=requestAnimationFrame(()=>{p=0,c||b()})),m(h)}});return $.observe(t),{get view(){return s},set view(v){s=v},get full(){return r},set full(v){r=v},get moved(){return i},get zoom(){return n},painted(v){a=v},size:l,scale:d,quietly:m,applyView:h,toSvg:y,zoomAt:g,fit:k,fitItems:u,autoFit:b,actual:x,settled:w,dispose(){cancelAnimationFrame(p),cancelAnimationFrame(f),$.disconnect(),c=!0}}}var Tt="http://www.w3.org/2000/svg",Mt={half:2.4,h:3.2,t:.25,above:1.4,lift:3.8,fan:.32,gap:.3},st=(t,e,s)=>[(t-e)*Ct*lt,(t+e)*.5*lt-s*lt],no=t=>t.map(([e,s])=>`${e.toFixed(1)},${s.toFixed(1)}`).join(" ");function zf(t,e){function s(o,n,a){let f=t.k(),p=(l,d,m,h,y="")=>{let g=o.createElementNS(Tt,"g");g.setAttribute("class",`live-badge ${m.cls} ${y}`.trim());let k=8/f,u=o.createElementNS(Tt,"circle");if(u.setAttribute("cx",String(l)),u.setAttribute("cy",String(d)),u.setAttribute("r",String(k)),g.append(u),"g"in m){let x=o.createElementNS(Tt,"text");x.setAttribute("x",String(l)),x.setAttribute("y",String(d)),x.style.fontSize=`${(10/f).toFixed(2)}px`,x.textContent=m.g,g.append(x)}else{let x=o.createElementNS(Tt,"use");x.setAttribute("href",t.iconHref(m.icon));let w=11/f;x.setAttribute("x",String(l-w/2)),x.setAttribute("y",String(d-w/2)),x.setAttribute("width",String(w)),x.setAttribute("height",String(w)),g.append(x)}let b=o.createElementNS(Tt,"title");b.textContent=h,g.append(b),n(g)},c=(l,d)=>{for(let m of t.outlinesFor(l)){if(m.kind!=="poly")continue;let h=o.createElementNS(Tt,"polygon");h.setAttribute("class",d),h.setAttribute("points",m.points.map(([y,g])=>`${y.toFixed(1)},${g.toFixed(1)}`).join(" ")),n(h)}};for(let l of a){let d=t.boxOf(l.at);if(d){if(l.outline&&c(l.at,l.outline),l.badge)p(d.x,d.y,l.badge,l.title);else if(l.hit){let m=o.createElementNS(Tt,"title");m.textContent=l.title;let h=o.createElementNS(Tt,"rect");h.setAttribute("class","live-hit"),h.setAttribute("x",String(d.x)),h.setAttribute("y",String(d.y)),h.setAttribute("width",String(d.w)),h.setAttribute("height",String(d.h)),h.append(m),n(h)}if((l.beside??[]).forEach((m,h)=>p(d.x+18*(h+1)/f,d.y,m.glyph,m.title)),l.dot&&p(d.x,d.y+d.h,l.dot.glyph,l.dot.title),l.tag){let m=o.createElementNS(Tt,"text");m.setAttribute("class",`live-life ${l.tag.cls}`),m.setAttribute("x",String(d.x+d.w)),m.setAttribute("y",String(d.y+d.h)),m.style.fontSize=`${(9/f).toFixed(2)}px`,m.textContent=l.tag.text,n(m)}}}}function r(o,n,a){for(let f of a){let p=o.createElementNS(Tt,"g");p.setAttribute("class",`live-extra${f.cls}`);for(let[b,x]of f.data)p.setAttribute(b,x);let{x:c,y:l,w:d,hgt:m,k:h}=f.rect,y=o.createElementNS(Tt,"rect");y.setAttribute("x",String(c)),y.setAttribute("y",String(l)),y.setAttribute("width",String(d)),y.setAttribute("height",String(m)),y.setAttribute("rx",String(6/h));let g=o.createElementNS(Tt,"text");g.setAttribute("x",String(c+8/h)),g.setAttribute("y",String(l+13/h)),g.style.fontSize=`${(11/h).toFixed(2)}px`,g.textContent=f.line1;let k=o.createElementNS(Tt,"text");k.setAttribute("class","sub"),k.setAttribute("x",String(c+8/h)),k.setAttribute("y",String(l+27/h)),k.style.fontSize=`${(9/h).toFixed(2)}px`,k.textContent=f.line2;let u=o.createElementNS(Tt,"title");u.textContent=f.title,p.append(y,g,k,u),n(p)}}function i(o,n,a){let f=[];for(let p of a){let c=p.over,l=(c.x0+c.x1)/2,d=(c.y0+c.y1)/2,m=0,h={x0:0,y0:0,x1:0,y1:0};for(let L=0;L<6;L++){let U=c.z1+Mt.above+m,H=U+Mt.h,ee=[st(l-Mt.half,d+Mt.t,U),st(l+Mt.half,d+Mt.t,U),st(l+Mt.half,d-Mt.t,H),st(l-Mt.half,d+Mt.t,H)];if(h={x0:Math.min(...ee.map(j=>j[0])),y0:Math.min(...ee.map(j=>j[1])),x1:Math.max(...ee.map(j=>j[0])),y1:Math.max(...ee.map(j=>j[1]))},!Ha(h,f))break;m+=Mt.lift}f.push(h);let y=c.z1+Mt.above+m,g=y+Mt.h,k=l-Mt.half,u=l+Mt.half,b=d+Mt.t,x=d-Mt.t,w=o.createElementNS(Tt,"g");w.setAttribute("class",`${e}-card${p.cls}`);for(let[L,U]of p.data)w.setAttribute(L,U);let[$,v]=st(l,d,c.z1+.15),O=`${$.toFixed(1)}px ${v.toFixed(1)}px`;w.style.transformOrigin=O;let C=o.createElementNS(Tt,"g");C.setAttribute("class",`${e}-float`),C.style.transformOrigin=O;let A=[];for(let L=Math.min(p.count-1,3);L>=1;L--){let U=L*Mt.fan,H=x-(L-1)*(2*Mt.t+Mt.gap)-Mt.gap,ee=H-2*Mt.t,j=k+U,q=u+U,G=y+U,Q=g+U,ce=(pe,Y)=>{let ie=o.createElementNS(Tt,"polygon");ie.setAttribute("class",`${e}-face stacked ${pe}`),ie.setAttribute("points",no(Y)),C.append(ie)};ce("s-top",[st(j,ee,Q),st(q,ee,Q),st(q,H,Q),st(j,H,Q)]),ce("s-side",[st(q,ee,G),st(q,H,G),st(q,H,Q),st(q,ee,Q)]),ce("s-front",[st(j,H,G),st(q,H,G),st(q,H,Q),st(j,H,Q)]),A.push({x0:j,x1:q,y0:ee,y1:H,z0:G,z1:Q})}let R=o.createElementNS(Tt,"polygon");R.setAttribute("class",`${e}-tail`),R.setAttribute("points",no([st(l-.5,b,y+.05),st(l+.5,b,y+.05),st(l,d,c.z1+.15)]));let M=(L,U)=>{let H=o.createElementNS(Tt,"polygon");return H.setAttribute("class",L),H.setAttribute("points",no(U)),H},T=M(`${e}-face front`,[st(k,b,y),st(u,b,y),st(u,b,g),st(k,b,g)]);C.append(R,M(`${e}-face top`,[st(k,x,g),st(u,x,g),st(u,b,g),st(k,b,g)]),M(`${e}-face side`,[st(u,x,y),st(u,b,y),st(u,b,g),st(u,x,g)]),T);let[S,N]=st(k,b,g),z=40,K=o.createElementNS(Tt,"g");K.setAttribute("transform",`matrix(${(Ct*lt/z).toFixed(4)} ${(.5*lt/z).toFixed(4)} 0 ${(lt/z).toFixed(4)} ${S.toFixed(1)} ${N.toFixed(1)})`);let J=(L,U,H,ee)=>{let j=o.createElementNS(Tt,"text");return j.setAttribute("class",L),j.setAttribute("x",String(U)),j.setAttribute("y",String(H)),j.textContent=ee,j};if(K.append(J(`${e}-mark`,34,98,p.mark),J(`${e}-who`,70,52,p.who),J(`${e}-age`,70,82,p.age)),p.line!==void 0&&K.append(J(`${e}-q`,12,118,p.line)),p.count>1){let L=o.createElementNS(Tt,"circle");L.setAttribute("class",`${e}-count-bg`),L.setAttribute("cx","178"),L.setAttribute("cy","14"),L.setAttribute("r","15"),K.append(L,J(`${e}-count`,178,14,String(p.count)))}C.append(K);let Z=o.createElementNS(Tt,"title");Z.textContent=p.title,w.append(C,Z),t.onCard?.(w,{cx:l,cy:d,tipZ:c.z1+.15,card:{x0:k,x1:u,y0:x,y1:b,z0:y,z1:g},panes:A.reverse()}),n(w)}}return{paintMarks:s,paintGhosts:r,paintCards:i}}var jf=[["scale","Scale"],["spin","Spin"],["dissolve","Dissolve"],["inflate","Inflate"]],Lf=[["none","None"],["jiggle","Jiggle"],["pirouette","Pirouette"],["glow","Glow"],["breathe","Breathe"]];function Vh(t){let e=2166136261;for(let s=0;s<t.length;s++)e^=t.charCodeAt(s),e=Math.imul(e,16777619);return(e>>>0)%1e3/1e3}var Jc=t=>t<0?0:t>1?1:1-Math.pow(1-t,3),Cf=t=>t<0?0:t>1?1:t*t*t,Xc=Math.PI*2,Qc={appear:{scale:420,spin:760,dissolve:520,inflate:640},disappear:{scale:320,spin:600,dissolve:420,inflate:420},period:{jiggle:4200,pirouette:6400,glow:3200,breathe:4400}},In={windup:220,turn:980,land:260};function _f(t,e,{prefix:s,key:r,alt:i}){let o={...e},n=1,a=new Map,f=new WeakSet,p=0,c=0,l=new WeakMap,d=new WeakMap;function m(R){p=0;for(let[M,T]of a){if(!M.isConnected){a.delete(M);continue}let S;if(T.repeat){if(S=(R+(T.offset??0))%T.repeat/T.dur,S>1){f.has(M)&&(t.restore(M),f.delete(M),M.style.removeProperty("transform"));continue}}else if(S=(R-T.start)/T.dur,S>=1){h(M,T);continue}let N=T.frame(Math.max(0,S));t.spin(M,N.theta,N.lift),f.add(M),d.set(M,N),N.scale!==1?M.style.transform=`scale(${N.scale.toFixed(4)})`:M.style.removeProperty("transform"),c++}a.size&&(p=requestAnimationFrame(m))}function h(R,M){a.delete(R),f.has(R)&&(t.restore(R),f.delete(R)),R.style.removeProperty("transform"),M.done?.()}function y(R){let M=a.get(R.card);M&&h(R.card,M),a.set(R.card,R),p||(p=requestAnimationFrame(m))}let g=8,k=0,u=R=>(k++,R.finally(()=>{k--}));function b(R){return!o.enabled||k>=g?Promise.resolve():u(w(R))}function x(R){return!o.enabled||k>=g?Promise.resolve():u($(R))}function w(R){let M=Qc.appear[o.appear]/n;if(o.appear==="spin")return new Promise(N=>y({card:R,start:performance.now(),dur:M,frame:z=>({theta:(1-Jc(z))*Xc,lift:0,scale:Math.max(.001,Jc(z))}),done:N}));let T=o.appear==="scale"?[{transform:"scale(0)"},{transform:"scale(1)"}]:o.appear==="dissolve"?[{opacity:0,filter:"blur(4px)"},{opacity:1,filter:"blur(0px)"}]:[{transform:"scale(0)",easing:"cubic-bezier(.3,0,.4,1)"},{transform:"scale(1.16)",offset:.55,easing:"ease-in-out"},{transform:"scale(.95)",offset:.78,easing:"ease-in-out"},{transform:"scale(1)"}];return R.animate(T,{duration:M,easing:o.appear==="inflate"?"linear":"ease-out"}).finished.then(()=>{},()=>{})}function $(R){let M=Qc.disappear[o.appear]/n;if(o.appear==="spin")return new Promise(N=>y({card:R,start:performance.now(),dur:M,frame:z=>({theta:Cf(z)*Xc,lift:0,scale:Math.max(.001,1-Cf(z))}),done:()=>{R.style.transform="scale(0)",N()}}));let T=o.appear==="scale"?[{transform:"scale(1)"},{transform:"scale(0)"}]:o.appear==="dissolve"?[{opacity:1,filter:"blur(0px)"},{opacity:0,filter:"blur(4px)"}]:[{transform:"scale(1)"},{transform:"scale(1.08)",offset:.3},{transform:"scale(0)"}];return R.animate(T,{duration:M,easing:"ease-in",fill:"forwards"}).finished.then(()=>{},()=>{})}function v(R){l.get(R)?.cancel(),l.delete(R);let M=a.get(R);M?.repeat&&h(R,M)}function O(R,M){if(v(R),!o.enabled||o.idle==="none"||R.classList.contains("still"))return;let T=R.getAttribute(r)??R.getAttribute(i)??"",S=(M??Qc.period[o.idle])/n,N=Vh(T)*S;if(o.idle==="pirouette"){let L=(In.windup+In.turn+In.land)/n,U=In.windup/(In.windup+In.turn+In.land),H=(In.windup+In.turn)/(In.windup+In.turn+In.land);y({card:R,start:0,dur:L,repeat:S,offset:N,frame:ee=>{if(ee<U)return{theta:-.35*Math.sin(ee/U*Math.PI/2),lift:0,scale:1};if(ee<H){let q=(ee-U)/(H-U);return{theta:-.35*(1-q)+Jc(q)*Xc,lift:.9*Math.sin(q*Math.PI),scale:1}}let j=(ee-H)/(1-H);return{theta:0,lift:0,scale:1-.04*Math.sin(j*Math.PI)}}});return}let z=R.querySelector(`.${s}-float`)??R,K=t.amber(),J=o.idle==="jiggle"?[{transform:"scale(1)",offset:0},{transform:"scale(1.07)",offset:.04},{transform:"scale(.97)",offset:.08},{transform:"scale(1.02)",offset:.11},{transform:"scale(1)",offset:.14},{transform:"scale(1)",offset:1}]:o.idle==="glow"?[{filter:`drop-shadow(0 0 0px ${K})`},{filter:`drop-shadow(0 0 7px ${K})`},{filter:`drop-shadow(0 0 0px ${K})`}]:[{transform:"scale(1)"},{transform:"scale(1.035)"},{transform:"scale(1)"}],Z=z.animate(J,{duration:S,iterations:1/0,easing:o.idle==="jiggle"?"linear":"ease-in-out"});Z.startTime=(document.timeline.currentTime??0)-((document.timeline.currentTime??0)+N)%S,l.set(R,Z)}function C(R,M,T,S,N=!1){N&&(S=!1);for(let[K,J]of M)!R.has(K)&&!N&&b(J),!l.has(J)&&!a.get(J)?.repeat&&O(J);if(!o.enabled||!S)return;let z=t.leavingLayer();if(z)for(let[K,J]of T){let Z=R.get(K);!Z||M.has(K)||(v(Z),Z.setAttribute("class",`${s}-leaving${J?" expired":""}`),Z.removeAttribute(i),z.append(Z),x(Z).then(()=>Z.remove()))}}function A(R){for(let[M,T]of[...a])h(M,T);p&&cancelAnimationFrame(p),p=0;for(let M of document.getAnimations())M.effect?.target?.closest?.(`.live-layer, .${s}-leaving-layer`)&&M.cancel();t.leavingLayer()?.replaceChildren()}return{get settings(){return{...o}},set(R,M){let T=o;if(o={...o,...R},(!o.enabled||T.idle!==o.idle||T.enabled!==o.enabled)&&(A(void 0),o.enabled))for(let S of M)O(S)},update:C,appear:b,disappear:x,startIdle:O,stopIdle:v,stopAll:A,async preview(R){o.enabled&&await Promise.all(R.map(async M=>{if(v(M),await b(M),o.idle!=="none"&&!M.classList.contains("still")){let T=o.idle==="pirouette"?1800:1400;O(M,T),await new Promise(S=>setTimeout(S,T*2.2/n)),v(M)}else await new Promise(T=>setTimeout(T,700/n));await x(M);for(let T of M.getAnimations())T.cancel();M.style.removeProperty("transform"),O(M)}))},get stats(){return{jobs:a.size,raf:!!p,frames:c,effects:k}},setSpeed(R){n=R},lastFrame:R=>d.get(R)}}var ep=t=>String(Math.round(t*100)/100),Ff=(t,e={},...s)=>({name:t,attrs:Object.entries(e).map(([r,i])=>[r,typeof i=="number"?ep(i):i]),children:s});function tp(t,e){if(typeof t=="string")return t;let s=t.attrs.map(([r,i])=>{if(r==="id")return[r,e+i];let o=i.replace(/var\(--([a-zA-Z][\w-]*)/g,"var(--iso-$1").replace(/url\(\s*(['"]?)#/g,(n,a)=>`url(${a}#${e}`);return(r==="href"||r==="xlink:href")&&o.startsWith("#")&&!o.startsWith(`#${e}`)&&(o=`#${e}${o.slice(1)}`),[r,o]});return{name:t.name,attrs:s,children:t.children.map(r=>tp(r,e))}}function np(t,e){if(typeof t=="string")return t;if(!e(t))return{...t,children:t.children.map(s=>np(s,e)).filter(s=>s!==void 0)}}var Df=t=>(t.attrs.find(e=>e[0]==="class")?.[1]??"").split(/\s+/),Qn=(t,e)=>t.attrs.find(s=>s[0]===e)?.[1];function Qa(t){let e=[],s=[],r=n=>{if(typeof n=="string")return;let a=Qn(n,"transform");if(a&&/matrix/.test(a))return;let f=Qn(n,"points");if(f)for(let p of f.trim().split(/\s+/)){let[c,l]=p.split(",").map(Number);Number.isFinite(c)&&Number.isFinite(l)&&(e.push(c),s.push(l))}if(n.name==="rect"){let p=Number(Qn(n,"x")),c=Number(Qn(n,"y")),l=Number(Qn(n,"width")),d=Number(Qn(n,"height"));[p,c,l,d].every(Number.isFinite)&&(e.push(p,p+l),s.push(c,c+d))}if(n.name==="circle"){let p=Number(Qn(n,"cx")),c=Number(Qn(n,"cy")),l=Number(Qn(n,"r"));[p,c,l].every(Number.isFinite)&&(e.push(p-l,p+l),s.push(c-l,c+l))}n.children.forEach(r)};if(t.forEach(r),!e.length)return;let i=Math.min(...e),o=Math.min(...s);return{x:i,y:o,w:Math.max(...e)-i,h:Math.max(...s)-o}}var el=(t,e)=>{if(!e)return t;let s=Math.min(t.x,e.x),r=Math.min(t.y,e.y);return{x:s,y:r,w:Math.max(t.x+t.w,e.x+e.w)-s,h:Math.max(t.y+t.h,e.y+e.h)-r}};function Bf(t,e,s){let r=a=>Math.min((e.width-e.pad*2)/a.w,(e.height-e.pad*2)/a.h),i=r(t),o=s(i),n=el(t,Qa(o));return i=r(n),o=s(i),n=el(t,Qa(o)),i=r(n),{k:i,box:n,live:o}}var qf=t=>t.replace(/--([a-zA-Z][\w-]*)/g,"--iso-$1");function Kh(t){let e=[],s=0,r=t.replace(/\/\*[\s\S]*?\*\//g,"");for(;s<r.length;){let i=r.indexOf("{",s);if(i<0)break;let o=1,n=i+1;for(;n<r.length&&o;)r[n]==="{"?o++:r[n]==="}"&&o--,n++;e.push([r.slice(s,i).trim(),r.slice(i+1,n-1)]),s=n}return e}function Gh(t){let e=[],s=0,r=0;for(let i=0;i<t.length;i++){let o=t[i];o==="("||o==="["?s++:o===")"||o==="]"?s--:o===","&&!s&&(e.push(t.slice(r,i).trim()),r=i+1)}return e.push(t.slice(r).trim()),e.filter(Boolean)}function sp(t,e,s){let r=/^:root((?:\[[^\]]*\]|:not\([^)]*\))*)(.*)$/.exec(t),i=s.replace(/^\./,"");if(r){let o=r[1],n=r[2].trim();return`${o?`.${i}${o} `:""}${e}${n?" "+n:""}`}if(/^(html|body|\*)\b/.test(t)||/^[a-z]+$/.test(t)&&!/^(svg|g|text|path|polygon|rect|circle|line)$/.test(t))throw new Error(`the canvas's CSS can't style the page: "${t}"`);return`${e} ${t}`}function rp(t,e,s){let r="";for(let[i,o]of Kh(t)){if(i.startsWith("@keyframes")){r+=`@keyframes iso-${i.slice(10).trim()}{${o}}
294
+ `;continue}if(i.startsWith("@media")||i.startsWith("@supports")){r+=`${i}{${rp(o,e,s)}}
295
+ `;continue}if(i.startsWith("@"))throw new Error(`the canvas's CSS has an at-rule it can't scope: ${i}`);r+=`${Gh(i).map(n=>sp(n,e,s)).join(",")}{${o.replace(/\banimation:\s*([a-z][\w-]*)/g,"animation:iso-$1")}}
296
+ `}return r}var ip=["<","script"].join("");function $n(t){return t?vt(t).replace(/`([^`]+)`/g,"<code>$1</code>").replace(/\*\*([^*]+)\*\*/g,"<b>$1</b>").replace(/(^|[^*])\*([^*\s][^*]*)\*/g,"$1<em>$2</em>").replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,(e,s,r)=>/^(https?:|#|\.{0,2}\/)/.test(r.replace(/&amp;/g,"&"))?`<a href="${r}">${s}</a>`:s):""}var op=t=>(t??"").split(/\n\s*\n/).filter(Boolean).map(e=>`<p class="sec-sub">${$n(e.trim())}</p>`).join(""),Vf=(t,e)=>!!e.motion&&vs(e,e.motion,{kinds:t.theme.kinds}).ok;function ap(t,e){return Vf(t,e)?vs(e,e.motion,{kinds:t.theme.kinds}).beats.map(s=>({n:s.index+1,num:s.index+1,kind:"control",color:s.say?.color??Un(t.theme,t.theme.kinds.control?.color??"control"),heading:s.say?.title??s.name,caption:s.say?.text??"",command:s.say?.code??"",phases:[],pulses:[],lit:[],duration:s.end-s.start})):e.steps.steps}function lp(t){return JSON.stringify({scenes:t.scenes.map(e=>{let s=Vf(t,e),r=ap(t,e),i=s?e.motion:e.steps.steps.length?Da(e):void 0;return{id:e.id,loop:e.raw.loop??!0,dim:e.raw.dim??"flows",vis:e.steps.vis,steps:r.map(({focus:o,...n})=>({...n,caption:$n(n.caption)})),assemble:e.assemble,grid:!!e.grid.show,source:Ji(e),...i?{doc:i}:{},...s?{own:s}:{}}})})}function cp(t,e){let s=t.theme,r=e.raw.legend;if(r===!1)return"";let i=Array.isArray(r)?r:e.steps.kindsUsed.filter(a=>e.routes.some(f=>f.kind===a)||e.steps.steps.some(f=>f.phases.some(p=>p.some(c=>c.kind===a)))),o=a=>`<span><i${a.box?' class="box"':""} style="${a.swatch}"></i>${a.label}</span>`,n=i.map(a=>{let f=Ot(t.catalog,a)?.legend;if(f)return o(f);let p=s.kinds[a];return p?`<span><i style="${`border-color:${Un(s,p.color)}${p.dash==="dashed"?";border-top-style:dashed":p.dash==="dotted"?";border-top-style:dotted":""}`}"></i>${$n(p.legend)}</span>`:""});if(!Array.isArray(r)){let a=new Set(e.layout.items.map(f=>f.region?.kind));for(let[f,p]of Object.entries(t.catalog.regions))p.legend?.auto&&a.has(f)&&n.push(o(p.legend))}return n.join("")}function Zh(t,e){let s=ap(t,e),r=`<div class="tools">
297
+ <button class="pbtn small" type="button" data-a="grid" aria-pressed="${e.grid.show?"true":"false"}" title="Show the floor grid">Grid</button>
287
298
  <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">
299
+ </div>`;if(!s.length)return`<div class="player">${r}</div>`;let i=s[0];return`<div class="player">
289
300
  <div class="ctrls">
290
301
  <button class="pbtn icon" type="button" data-a="prev" aria-label="Previous step">\u2039</button>
291
302
  <button class="pbtn primary" type="button" data-a="play" aria-label="Play">\u25B6 Play</button>
292
303
  <button class="pbtn icon" type="button" data-a="next" aria-label="Next step">\u203A</button>
293
304
  </div>
294
- ${n}
305
+ ${r}
295
306
  <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>
307
+ <div class="cap-h"><span class="num" style="background:${i.color}">${i.num}</span><span class="h">${vt(i.heading)}</span><span class="cnt">1 / ${s.length}</span></div>
308
+ <p class="cap-t">${$n(i.caption)}</p>
309
+ <pre class="cap-c">${vt(i.command)}</pre>
299
310
  <div class="prog"><i></i></div>
300
311
  </div>
301
312
  <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)}
313
+ </div>`}function Uh(t,e){let s=ap(t,e);return s.length?`<details class="steps"><summary>All ${s.length} steps as text</summary><ol>${s.map(r=>`<li value="${r.num}"><b>${vt(r.heading)}.</b> ${$n(r.caption)}${r.command?`<br><code>${vt(r.command)}</code>`:""}</li>`).join("")}</ol></details>`:""}function Kf(t,e={}){let s=t.doc,r=s.title??s.scenes[0]?.title??"Diagram",i=(s.pills??[]).map(n=>`<span class="pill">${$n(n)}</span>`).join(""),o=t.scenes.map(n=>`
314
+ <section class="scene" id="scene-${vt(n.id)}">
315
+ <h2>${vt(n.raw.title)}</h2>
316
+ ${op(n.raw.caption)}
306
317
  <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>
318
+ <div class="scroller">${n.grid.show?n.rendered.svg.replace("<svg ",'<svg class="show-grid" '):n.rendered.svg}</div>
319
+ ${Zh(t,n)}
320
+ <div class="legend">${cp(t,n)}</div>
310
321
  </div>
311
- ${Kd(s)}
312
- ${s.raw.after?`<div class="after">${vl(s.raw.after)}</div>`:""}
322
+ ${Uh(t,n)}
323
+ ${n.raw.after?`<div class="after">${op(n.raw.after)}</div>`:""}
313
324
  </section>`).join(`
314
325
  `);return`<!doctype html>
315
326
  <html lang="en">
316
327
  <head>
317
328
  <meta charset="utf-8">
318
329
  <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)}">`:""}
330
+ <title>${vt(r)}</title>
331
+ ${s.lede?`<meta name="description" content="${vt(s.lede)}">`:""}
321
332
  <style>
322
- ${so(t.theme)}${ar(t.catalog)}${No}
333
+ ${ra(t.theme)}${Ur(t.catalog)}${Za}
323
334
  </style>
324
335
  ${e.extraHead??""}
325
336
  </head>
@@ -327,17 +338,17 @@ ${e.extraHead??""}
327
338
  <div class="wrap">
328
339
  <header class="page">
329
340
  <div>
330
- <h1>${xt(r)}</h1>
331
- ${n.lede?`<p class="lede">${Gs(n.lede)}</p>`:""}
341
+ <h1>${vt(r)}</h1>
342
+ ${s.lede?`<p class="lede">${$n(s.lede)}</p>`:""}
332
343
  </div>
333
344
  <div class="pills">${i}<button class="theme" id="themeBtn" type="button">Theme</button></div>
334
345
  </header>
335
346
  ${o}
336
- ${n.after?vl(n.after):""}
337
- ${n.footer?`<footer>${Gs(n.footer)}</footer>`:""}
347
+ ${s.after?op(s.after):""}
348
+ ${s.footer?`<footer>${$n(s.footer)}</footer>`:""}
338
349
  </div>
339
- ${Sl} type="application/json" id="diagram-steps">${$l(t).replace(/</g,"\\u003c")}<\/script>
340
- ${Sl}>
350
+ ${ip} type="application/json" id="diagram-steps">${lp(t).replace(/</g,"\\u003c")}<\/script>
351
+ ${ip}>
341
352
  (function(){
342
353
  var root=document.documentElement, m=/theme=(light|dark)/.exec(location.hash);
343
354
  try{var t=localStorage.getItem('diagram-theme'); if(t) root.dataset.theme=t;}catch(e){}
@@ -349,14 +360,49 @@ ${Sl}>
349
360
  });
350
361
  })();
351
362
  <\/script>
352
- ${e.runtime?`${Sl}>${e.runtime}<\/script>`:""}
363
+ ${e.runtime?`${ip}>${e.runtime}<\/script>`:""}
353
364
  ${e.extraBody??""}
354
365
  </body>
355
366
  </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
367
+ `}function pp(){let t=globalThis;return{now:()=>performance.now(),next(e){let s={},r=()=>{s.raf!==void 0&&t.cancelAnimationFrame?.(s.raf),clearTimeout(s.timer),e()};return s.raf=t.requestAnimationFrame?.(r),s.timer=setTimeout(r,s.raf===void 0?16:100),s},cancel(e){let s=e;s.raf!==void 0&&t.cancelAnimationFrame?.(s.raf),clearTimeout(s.timer)}}}var Hh=400;function tl(t,e={}){let s=e.clock??pp(),r=t,i=0,o=b(e.rate??1),n=e.loop??!1,a=!1,f=!0,p=!1,c=(e.ambient??r.ambient)==="on",l=c?0:"off",d,m=0,h=r.beatAt(0),y=!1,g=0,k,u={};function b(N){if(!(Number.isFinite(N)&&N>0))throw new Error("rate is a number over 0");return N}let x=N=>Math.max(0,Math.min(r.duration,N));function w(N,...z){for(let K of[...u[N]??[]])K(...z)}let $=()=>f&&!p&&(a||c&&r.loops);function v(){$()?d===void 0&&(m=s.now(),d=s.next(A)):d!==void 0&&(s.cancel(d),d=void 0)}function O(N,z){let K=g;for(let J of r.beats)if(!(J.start<=N||J.start>z||J.index===h?.index)&&(h=J,y=!0,w("beat",J,"play"),g!==K))return!1;return!0}function C(N){if(!a){w("time",i,"ambient");return}let z=i,K=i+N,J=g;if(k!==void 0&&K>=k){if(i=k,!O(z,i))return;k=void 0,a=!1,w("time",i,"play"),g===J&&w("pause");return}if(K<r.duration){i=K,O(z,i)&&w("time",i,"play");return}if(n){if(!O(z,r.duration)||(i=K%r.duration,c&&(l=i),h=void 0,w("loop"),g!==J))return;let Z=r.beatAt(0);if(Z&&(h=Z,w("beat",Z,"play"),g!==J||!O(Z.start,i)))return;w("time",i,"play");return}i=r.duration,O(z,i)&&(a=!1,w("time",i,"play"),g===J&&(w("pause"),g===J&&w("end")))}function A(){d=void 0;let N=s.now(),z=Math.max(0,N-m)*o;m=N,c&&l!=="off"&&(l+=z),C(z),d===void 0&&$()&&(d=s.next(A))}function R(N,z=!1){let K=r.beatAt(i);g++;let J=g,Z=K?.name!==h?.name||K?.index!==h?.index;h=K,!(K&&(Z||z)&&(y=!0,w("beat",K,N),g!==J))&&w("time",i,N)}function M(N,z={}){if(p||!Number.isFinite(N))return;let K=x(N);c&&l!=="off"&&(l=z.join?K:l+K-i),i=K,m=s.now(),k!==void 0&&i>=k&&(k=void 0),R("seek"),v()}function T(){p||(i=0,c&&(l=0),k=void 0,m=s.now(),R("seek",!0),v())}let S={get timeline(){return r},get duration(){return r.duration},get time(){return i},get ambientTime(){return l},get playing(){return a},get beat(){return h},get cue(){return r.cues(i)},get rate(){return o},set rate(N){let z=b(N);z!==o&&(o=z,w("rate",z))},get loop(){return n},set loop(N){n=N},get ambient(){return c},set ambient(N){p||N===c||(c=N,c&&l==="off"&&(l=h?.start??0),v(),w("ambient",c),w("time",i,"ambient"))},get active(){return f},set active(N){N!==f&&(f=N,v())},state:()=>r.at(i,{ambient:l}),play(N={}){p||a||r.duration<=0||(i>=r.duration&&N.until===void 0&&T(),k=N.until!==void 0&&N.until>i&&N.until<=r.duration?N.until:void 0,!(N.until!==void 0&&k===void 0)&&(a=!0,m=s.now(),v(),w("play"),a&&!y&&h&&(y=!0,w("beat",h,"play"))))},pause(){a&&(a=!1,k=void 0,g++,v(),w("pause"))},toggle(){a?S.pause():S.play()},seek:M,seekBeat(N){let z=typeof N=="number"?r.beats[N]?.start:r.beats.find(K=>K.name===N)?.start;return z===void 0?!1:(M(z),!0)},next(){let N=r.beats.find(z=>z.start>i);M(N?N.start:r.duration)},prev(){let N=[...r.beats].reverse().find(z=>z.start<i-Hh);M(N?N.start:0)},restart:T,rebind(N){if(p||!N.ok)return!1;k=void 0;let z=r.beatAt(i),K=z?(i-z.start)/Math.max(1,z.end-z.start):0,J=l==="off"?0:l-i,Z=r;if(r=N,z){let L=N.beats.find(U=>U.name===z.name);if(L)i=L.start+K*(L.end-L.start);else{let U=Z.beats.filter(H=>H.index<z.index).reverse().map(H=>N.beats.find(ee=>ee.name===H.name)).find(Boolean);i=U?U.start:0}}return i=x(i),c&&l!=="off"&&(l=i+J),m=s.now(),R("rebind"),v(),!0},on(N,z){let K=u[N]??=new Set;return K.add(z),()=>{K.delete(z)}},dispose(){p=!0,g++,a=!1,d!==void 0&&s.cancel(d),d=void 0;for(let N of Object.keys(u))u[N].clear()}};return v(),S}function re(t,e=null,...s){let r=document.createElement(t);for(let[i,o]of Object.entries(e??{}))if(!(o==null||o===!1))if(i==="class")r.className=String(o);else if(i==="on")for(let[n,a]of Object.entries(o))r.addEventListener(n,a);else r.setAttribute(i,o===!0?"":String(o));for(let i of s)i!=null&&i!==!1&&r.append(i instanceof Node?i:document.createTextNode(String(i)));return r}var sl=new Map;function Gf(){let t,e=.35;for(let[s,r]of sl)r.wants&&r.seen>=e&&(r.seen>e||!t)&&(t=s,e=r.seen);for(let[s,r]of sl)r.wants&&r.auto(s===t)}var Zf=t=>{let e=new DOMParser().parseFromString(t,"image/svg+xml");if(e.documentElement.localName!=="svg")throw new Error("the drawing is not SVG");return document.importNode(e.documentElement,!0)},nl=t=>{let e=Math.round(t/1e3);return`${Math.floor(e/60)}:${String(e%60).padStart(2,"0")}`},Uf={ok:!0,diags:[],duration:0,beats:[],markers:{},ambient:"on",loops:!1,at:()=>({}),cues:()=>{},beatAt:()=>{},startOf:()=>{}};function Yh(t){let e={...t.camera?{camera:t.camera}:{},...t.variants?{variants:t.variants}:{}};for(let s of["items","labels","routes"]){let r=Object.entries(t[s]??{}).filter(([,i])=>i.opacity===0).map(([i])=>[i,{opacity:0}]);r.length&&(e[s]=Object.fromEntries(r))}return e}function Hf(t,e){if(e.timeline&&!e.timeline.ok)throw new Error(`the motion has faults: ${e.timeline.diags.map(V=>`${V.path}: ${V.message}`).join("; ")}`);let s=e.scene,r=Zf(s.rendered.svg),i,o,n=!1,a=!1,f=tl(e.timeline??Uf,{loop:e.loop,rate:e.rate,ambient:e.ambient,clock:e.clock}),p=e.controls??!0,c=e.reducedMotion==="respect"&&typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches,l=c,d=(V,te,ae,Te)=>re("button",{type:"button",class:`iso-play-btn ${V}`,"aria-label":te,title:te,on:{click:Te}},ae),m=re("div",{class:"iso-play-stage"},r),h=d("back","Back","\u2039",()=>ce(()=>Y(Math.max(0,G()-1)))),y=d("play","Play","\u25B6",()=>ie()),g=d("next","Next","\u203A",()=>ce(()=>Y(Math.min(f.timeline.beats.length-1,G()+1)))),k=d("again","Reset","\u21BA",()=>ce(()=>{pe(),f.restart()})),u=d("ambient","Ambient motion","\u223F",()=>{Q(),f.ambient=!f.ambient,ee()}),b=re("input",{type:"range",class:"iso-play-bar",min:0,step:1,"aria-label":"Time",on:{input:(()=>ce(()=>{pe(),f.seek(Number(b.value))}))}}),x=re("span",{class:"iso-play-time"}),w=re("div",{class:"iso-play-dots"}),$=re("span",{class:"iso-play-num"}),v=re("span",{class:"iso-play-title"}),O=re("span",{class:"iso-play-chapter"}),C=re("span",{class:"iso-play-count"}),A=re("div",{class:"iso-play-text"}),R=re("pre",{class:"iso-play-code"}),M=re("dl",{class:"iso-play-facts"}),T=re("div",{class:"iso-play-say","aria-live":"polite"},re("div",{class:"iso-play-head"},$,v,O,C),A,R,M),S=re("details",{class:"iso-play-list"}),N=re("div",{class:"iso-play-row"},h,y,g,k,u,b,x),z=re("div",{class:"iso-play",role:"group","aria-roledescription":"animated diagram","aria-label":e.label??"Diagram",tabindex:p?0:void 0,"data-mode":e.mode??"light"},m,p&&N,p&&w,p&&T,p&&S);t.append(z);let K=[];function J(){let V=f.timeline.beats,te=V.length>0,ae=V.some(ze=>ze.say);K=[],w.replaceChildren();let Te,be;for(let ze of V){(!Te||ze.say?.chapter!==be)&&(Te=re("span",{class:"iso-play-group",role:"group","aria-label":ze.say?.chapter,title:ze.say?.chapter}),w.append(Te),be=ze.say?.chapter);let Ie=re("button",{type:"button",class:"iso-play-dot","aria-label":`Step ${ze.index+1}: ${ze.say?.title??ze.name}`,title:ze.say?.title??ze.name,on:{click:(()=>ce(()=>Y(ze.index)))}});Te.append(Ie),K.push(Ie)}S.replaceChildren(re("summary",null,`All ${V.length} steps as text`),re("ol",null,...V.map(ze=>re("li",null,...Z(ze)))));for(let ze of[h,g,w])ze.hidden=!te;T.hidden=!ae,S.hidden=!ae,u.hidden=!f.timeline.loops,b.max=String(Math.round(f.duration));for(let ze of[y,k,b,x])ze.hidden=f.duration<=0;L=void 0}function Z(V){let te=V.say,ae=[re("b",null,te?.title??V.name)];if(te?.text){let Te=re("div",null);Te.innerHTML=$n(te.text),ae.push(Te)}return te?.code&&ae.push(re("code",null,te.code)),te?.facts?.length&&ae.push(re("span",null,te.facts.map(([Te,be])=>`${Te}: ${be}`).join(" \xB7 "))),ae}let L;function U(V){let te=String((V?.index??-1)+1);for(let ae of r.querySelectorAll("[data-badge]"))ae.classList.toggle("on",ae.getAttribute("data-badge")===te),e.steps&&(ae.getAttribute("data-badge")===te||l?ae.removeAttribute("opacity"):ae.setAttribute("opacity","0.14"));if(e.steps)for(let ae of r.querySelectorAll("[data-step]"))ae.setAttribute("visibility",ae.getAttribute("data-step")===te&&!l?"visible":"hidden")}function H(){let V=f.beat;if(V===L||(L=V,U(V),!p))return;let te=V?.say;$.textContent=V?String(V.index+1):"",$.style.backgroundColor=te?.color??"",v.textContent=te?.title??V?.name??"",O.textContent=te?.chapter??"",C.textContent=V?`${V.index+1} / ${f.timeline.beats.length}`:"",A.innerHTML=$n(te?.text),R.textContent=te?.code??"",M.replaceChildren(...(te?.facts??[]).flatMap(([ae,Te])=>[re("dt",null,ae),re("dd",null,Te)])),R.hidden=!te?.code,M.hidden=!te?.facts?.length,K.forEach((ae,Te)=>{ae.classList.toggle("on",Te===V?.index),ae.classList.toggle("done",V!==void 0&&Te<V.index),Te===V?.index?ae.setAttribute("aria-current","step"):ae.removeAttribute("aria-current")})}function ee(){let V=i!==void 0?f.timeline.at(i,{ambient:i}):l?Yh(f.timeline.at(f.duration,{ambient:"off"})):f.state();Ea(r,V,s.rendered,{styles:"cssom"}),z.dataset.time=String(Math.round(i??f.time)),i!==void 0?U(f.timeline.beatAt(i)):H(),p&&(b.value=String(Math.round(f.time)),b.setAttribute("aria-valuetext",`${nl(f.time)} of ${nl(f.duration)}${f.beat?`, ${f.beat.say?.title??f.beat.name}`:""}`),x.textContent=`${nl(f.time)} / ${nl(f.duration)}`)}function j(){let V=q();y.textContent=V?"\u275A\u275A":"\u25B6",y.setAttribute("aria-label",V?"Pause":"Play"),y.title=V?"Pause":"Play",u.setAttribute("aria-pressed",String(f.ambient)),T.setAttribute("aria-live",V?"off":"polite"),z.dataset.playing=String(V)}let q=()=>f.playing&&o===void 0,G=()=>f.beat?.index??0;function Q(){l&&(l=!1,L=void 0)}function ce(V){Q(),n=!0,V(),j(),ee()}function pe(){o=void 0,f.pause()}function Y(V){let te=f.timeline.beats[V];if(!te||a)return;f.pause(),f.seek(te.start,{join:!0});let ae=f.timeline.beats[V+1]?.start??1/0;o=Math.max(te.start,Math.min(te.end,ae,f.duration)-1),f.play({until:o})}function ie(){Q(),q()?(n=!0,pe()):(n=!1,o=void 0,f.pause(),f.play()),j(),ee()}f.on("time",ee),f.on("play",j),f.on("ambient",j),f.on("pause",()=>{o=void 0,j()}),z.addEventListener("keydown",V=>{let te=V.key,ae=V.target;V.altKey||V.ctrlKey||V.metaKey||ae===b||(te==="ArrowRight"||te==="ArrowLeft"?(V.preventDefault(),(te==="ArrowRight"?g:h).click()):te==="Home"?(V.preventDefault(),k.click()):(te===" "||te==="k")&&ae===z&&(V.preventDefault(),ie()))});let Ae=V=>{let te=V.target.closest?.("[data-go]"),ae=V.key;!te||V.type==="keydown"&&ae!=="Enter"&&ae!==" "||(V.preventDefault(),V.stopPropagation(),ce(()=>Y(Number(te.getAttribute("data-go"))-1)))};m.addEventListener("click",Ae),m.addEventListener("keydown",Ae);let De={seen:0,wants:e.autoplay==="visible"&&!c,auto(V){V?!n&&!q()&&(o=void 0,f.play()):q()&&(o=void 0,f.pause())}};sl.set(z,De);let I=typeof IntersectionObserver=="function"?new IntersectionObserver(V=>{for(let te of V)De.seen=te.isIntersecting?te.intersectionRatio:0,i===void 0&&(f.active=te.isIntersecting);Gf()},{threshold:[0,.2,.35,.5,.7,.9,1]}):void 0;return I?.observe(z),J(),j(),ee(),e.autoplay===!0&&!c&&f.play(),{root:z,transport:f,step:V=>ce(()=>Y(V)),set(V,te=Uf,ae){if(a||!te.ok)return!1;let Te=Zf(V.rendered.svg);return s=V,r.replaceWith(Te),r=Te,ae&&(z.dataset.mode=ae),o!==void 0&&pe(),f.rebind(te),J(),j(),ee(),!0},freeze(V){i=V,f.pause(),f.active=!1,z.classList.add("frozen"),ee()},dispose(){a=!0,I?.disconnect(),sl.delete(z),f.dispose(),z.remove(),Gf()}}}var Yf=`
368
+ .iso-play{--ip-ink:#1c2026;--ip-muted:#68707c;--ip-line:#dfe3e8;--ip-bg:#fff;--ip-code:#f2f4f7;--ip-focus:#2a64d6;container:iso-play/inline-size;display:block;color:var(--ip-ink);background:var(--ip-bg);font:14px/1.5 system-ui,-apple-system,"Segoe UI",sans-serif;border-radius:10px}
369
+ .iso-play[data-mode="dark"]{--ip-ink:#e6e9ee;--ip-muted:#98a1ae;--ip-line:#333a44;--ip-bg:#15181d;--ip-code:#1f242b;--ip-focus:#7aa7ff;color-scheme:dark}
370
+ .iso-play:focus-visible,.iso-play button:focus-visible,.iso-play input:focus-visible,.iso-play summary:focus-visible{outline:2px solid var(--ip-focus);outline-offset:2px}
371
+ .iso-play [hidden]{display:none}
372
+ .iso-play-stage svg{display:block;width:100%;height:auto}
373
+ .iso-play-stage [data-go]{cursor:pointer}
374
+ .iso-play-row{display:flex;align-items:center;gap:6px;padding:8px 12px 4px}
375
+ .iso-play-btn{font:inherit;min-width:32px;height:32px;padding:0 8px;border:1px solid var(--ip-line);border-radius:8px;background:none;color:inherit;cursor:pointer}
376
+ .iso-play-btn:hover{border-color:var(--ip-muted)}
377
+ .iso-play-btn.play{background:var(--ip-ink);color:var(--ip-bg);border-color:var(--ip-ink);min-width:44px}
378
+ .iso-play-btn.ambient[aria-pressed="false"]{color:var(--ip-muted);text-decoration:line-through}
379
+ .iso-play-bar{flex:1 1 60px;min-width:0;accent-color:var(--ip-ink)}
380
+ .iso-play-time{color:var(--ip-muted);font-size:12px;font-variant-numeric:tabular-nums;white-space:nowrap}
381
+ .iso-play-dots{display:flex;flex-wrap:wrap;gap:4px 12px;padding:2px 12px}
382
+ .iso-play-group{display:inline-flex;gap:0}
383
+ .iso-play-dot{width:24px;height:24px;padding:0;border:0;background:none;cursor:pointer;display:grid;place-items:center}
384
+ .iso-play-dot::before{content:"";width:9px;height:9px;border-radius:50%;background:var(--ip-line)}
385
+ .iso-play-dot.done::before{background:var(--ip-muted)}
386
+ .iso-play-dot.on::before{background:var(--ip-ink);width:11px;height:11px}
387
+ .iso-play-say{padding:4px 12px 10px;min-height:5.2em}
388
+ .iso-play-head{display:flex;align-items:baseline;gap:8px;font-weight:700}
389
+ .iso-play-num{flex:none;display:inline-grid;place-items:center;min-width:22px;height:22px;border-radius:11px;background:var(--ip-ink);color:var(--ip-bg);font-size:11px;align-self:center}
390
+ .iso-play-chapter,.iso-play-count{color:var(--ip-muted);font-size:12px;font-weight:500}
391
+ .iso-play-count{margin-left:auto;white-space:nowrap}
392
+ .iso-play-text{max-width:80ch}
393
+ .iso-play-text a{color:inherit}
394
+ .iso-play-code{margin:6px 0 0;padding:6px 10px;border-radius:8px;background:var(--ip-code);font:12px/1.5 ui-monospace,Menlo,monospace;white-space:pre-wrap;overflow-wrap:anywhere}
395
+ .iso-play-facts{display:flex;flex-wrap:wrap;gap:2px 16px;margin:6px 0 0;font-size:12px}
396
+ .iso-play-facts dt{color:var(--ip-muted)}
397
+ .iso-play-facts dd{margin:0 8px 0 -10px;font-weight:600}
398
+ .iso-play-list{padding:0 12px 10px;font-size:13px}
399
+ .iso-play-list summary{color:var(--ip-muted);cursor:pointer}
400
+ .iso-play.frozen>:not(.iso-play-stage){display:none}
401
+ @container iso-play (max-width:420px){.iso-play-time{display:none}.iso-play-row{flex-wrap:wrap}.iso-play-bar{flex-basis:100%;order:9}}
402
+ `;var Wf=1,rl="(?:[^/:%\\s]|%[0-9A-F]{2})+",un=["debug","info","notice","warning","error"],Jf=["1m","1h","1d"],zn={"1m":6e4,"1h":36e5,"1d":864e5},il=t=>`^(?:(?:${t.kinds.join("|")}):(?:${rl})(?:/(?:${t.kinds.join("|")}):(?:${rl}))*)?$`;function ol(t){let e=new RegExp(il(t)),s=o=>e.test(o);function r(o){if(!e.test(o))throw new Error(`not a scope path: ${JSON.stringify(o)}`);return o===""?[]:o.split("/").map(n=>{let a=n.indexOf(":");return{kind:n.slice(0,a),name:decodeURIComponent(n.slice(a+1))}})}function i(o){let n="";for(let a of r(o)){if(!t.parents[a.kind].includes(n))return!1;n=a.kind}return!0}return{isScope:s,parseScope:r,wellNested:i}}var al=t=>t.replace(/[%/:\s]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`),Xf=t=>t.map(e=>`${e.kind}:${al(e.name)}`).join("/"),Qf=(t,e,s)=>(t?`${t}/`:"")+`${e}:${al(s)}`,Jt=t=>t===""?0:t.split("/").length;function Ms(t,e){return e<=0?"":(t===""?[]:t.split("/")).slice(0,e).join("/")}var em=t=>Ms(t,Jt(t)-1),hn=(t,e)=>e===""||t===e||t.startsWith(`${e}/`),tm=(t,e)=>t!==""&&t.split("/").includes(e),Yr=t=>t===""?"fleet":t.slice(t.lastIndexOf("/")+1).split(":")[0],Wr=t=>t===""?"all hosts":decodeURIComponent(t.slice(t.lastIndexOf("/")+1).split(":").slice(1).join(":"));function Jr(t){let e=[{scope:"",label:"all hosts",kind:"fleet"}];for(let s=1;s<=Jt(t);s++){let r=Ms(t,s);e.push({scope:r,label:Wr(r),kind:Yr(r)})}return e}var dp=["kind","source","severity","scope","since","before"];function Wh(t){let e=[],s=0;for(;s<t.length;){for(;s<t.length&&/\s/.test(t[s]);)s++;if(s>=t.length)break;let r=!1;t[s]==="-"&&s+1<t.length&&!/\s/.test(t[s+1])&&(r=!0,s++);let i=/^(attr\.[a-z][a-z0-9_]*|[a-z]+):/.exec(t.slice(s)),o;i&&(o=i[1],s+=i[0].length);let n="",a=!1;if(t[s]==='"'){let f=t.indexOf('"',s+1);n=t.slice(s+1,f<0?t.length:f),a=!0,s=f<0?t.length:f+1}else{let f=s;for(;s<t.length&&!/\s/.test(t[s]);)s++;n=t.slice(f,s)}e.push({neg:r,raw:n,quoted:a,field:o})}return e}var Jh=/^(\d+)(s|m|h|d|w)$/,Xh={s:1e3,m:6e4,h:36e5,d:864e5,w:7*864e5};function fp(t,e){let s=Jh.exec(t);if(s)return e-Number(s[1])*Xh[s[2]];let r=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3}))?)?)?(Z|[+-]\d{2}:?\d{2})?$/.exec(t);if(!r)return;let[,i,o,n,a="0",f="0",p="0",c="0",l]=r;if(l){let m=Date.parse(t.replace(" ","T"));return Number.isNaN(m)?void 0:m}let d=new Date(+i,+o-1,+n,+a,+f,+p,+c.padEnd(3,"0")).getTime();return Number.isNaN(d)?void 0:d}function Qh(t,e,s=Date.now()){let r=[],i=[];for(let o of Wh(e??"")){let n=p=>{let c=o.field?`${o.field}:${o.raw}`:o.raw;p&&i.push(`${JSON.stringify(c)}: ${p}; searched as text`),c&&r.push({neg:o.neg,value:c})};if(!o.field){n();continue}if(!(t.includes(o.field)||o.field.startsWith("attr."))){n(`no field ${o.field}`);continue}if(!o.raw){n(`${o.field}: needs a value`);continue}let f=o.field;if(f==="severity"){let p=/^(>=|<=|>|<|=)?(.*)$/.exec(o.raw);if(!un.includes(p[2])){n(`no severity ${p[2]} (${un.join(", ")})`);continue}r.push({neg:o.neg,field:f,op:p[1]??"=",value:p[2]})}else if(f==="since"||f==="before"){let p=fp(o.raw,s);if(p===void 0){n(`can't read the time ${o.raw} (15m, 2h, 3d, 1w, or a date like 2026-11-20 or 2026-11-20T09:30)`);continue}if(o.neg){n(`-${f} isn't allowed (use ${f==="since"?"before":"since"})`);continue}r.push({neg:!1,field:f,value:o.raw,time:p})}else r.push({neg:o.neg,field:f,value:o.raw})}return{terms:r,warnings:i}}var ll=t=>un.indexOf(t),ey={"=":"eq",">=":"ge",">":"gt","<=":"le","<":"lt"};function ty(t,e){switch(t.field){case void 0:return{field:"text",value:t.value};case"kind":case"source":return t.value.endsWith("*")?{field:t.field,value:t.value.slice(0,-1),prefix:!0}:{field:t.field,value:t.value};case"severity":return{field:"severity",op:ey[t.op??"="],value:t.value};case"scope":return{field:"scope",value:t.value,from:e.topKinds.some(s=>t.value.startsWith(`${s}:`))?"top":"segments"};case"since":case"before":return;default:return e.links.includes(t.field)?{field:"link",link:t.field,value:t.value}:{field:"attr",key:t.field.slice(5),value:t.value}}}function ny(t,e){let s=[],r=new Map;for(let i of e.terms){let o=ty(i,t);if(!o)continue;if(i.neg){s.push({not:!0,any:[o]});continue}if(o.field==="text"||o.field==="severity"){s.push({any:[o]});continue}let n=o.field==="link"?`link.${o.link}`:o.field==="attr"?`attr.${o.key}`:o.field,a=r.get(n);if(a)a.any.push(o);else{let f={any:[o]};r.set(n,f),s.push(f)}}return{all:s}}function sy(t,e,s,r){switch(e.field){case"text":{let i=e.value.toLowerCase();if(s.summary.toLowerCase().includes(i)||s.kind.toLowerCase().includes(i)||s.source.toLowerCase().includes(i)||s.scope.toLowerCase().includes(i))return!0;for(let[o,n]of Object.entries(s.attrs))if(typeof n=="string"&&!r.has(`${s.source}.${o}`)&&n.toLowerCase().includes(i))return!0;return!1}case"kind":case"source":{let i=s[e.field];return e.prefix?i.startsWith(e.value):i===e.value}case"severity":{let i=ll(s.severity),o=ll(e.value);return e.op==="ge"?i>=o:e.op==="gt"?i>o:e.op==="le"?i<=o:e.op==="lt"?i<o:i===o}case"scope":return e.from==="top"?hn(s.scope,e.value):`/${s.scope}/`.includes(`/${e.value}/`);case"link":return t.linkMatch?.(String(e.link),e.value,s)??s.links[e.link]===e.value;case"attr":{let i=s.attrs[e.key];return i!=null&&String(i).toLowerCase()===e.value.toLowerCase()}}}function Xr(t){let e=[...dp,...t.links],s=(a,f=Date.now())=>Qh(e,a,f),r=a=>ny(t,a);function i(a,f,p,c){let l=s(a,f);return{where:r(l),...so(l,p,c),warnings:l.warnings}}function o(a,f=[]){let p=new Set(f),c=a?.all??[];return c.length?l=>c.every(d=>d.any.some(m=>sy(t,m,l,p))!==!!d.not):()=>!0}return{FIELDS:e,parseSearch:s,toAst:r,compileSearch:i,matchAst:o,matcher:(a,f=[])=>o(r(a),f)}}function so(t,e,s){for(let r of t.terms)r.field==="since"&&(e=Math.max(e,r.time)),r.field==="before"&&(s=Math.min(s,r.time));return{from:e,to:Math.max(e,s)}}function ro(t,e){let s=e.toLowerCase(),r=[];for(let o of t.terms){if(o.neg||o.field||!o.value)continue;let n=o.value.toLowerCase();for(let a=s.indexOf(n);a>=0;a=s.indexOf(n,a+n.length))r.push([a,a+n.length])}r.sort((o,n)=>o[0]-n[0]);let i=[];for(let o of r){let n=i[i.length-1];n&&o[0]<=n[1]?n[1]=Math.max(n[1],o[1]):i.push([...o])}return i}var nm=t=>un.filter(e=>ll(e)>=ll(t));var sm=new Map,cl=new Map;function nn(t,e){if(!t||t==="UTC")return 0;let s=`${t}|${Math.floor(e/(15*6e4))}`,r=cl.get(s);if(r!==void 0)return r;let i=sm.get(t);if(!i){try{i=new Intl.DateTimeFormat("en-US",{timeZone:t,hourCycle:"h23",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"})}catch{return 0}sm.set(t,i)}let o={};for(let f of i.formatToParts(new Date(e)))f.type!=="literal"&&(o[f.type]=Number(f.value));let n=Date.UTC(o.year,o.month-1,o.day,o.hour%24,o.minute,o.second),a=Math.round((n-Math.floor(e/1e3)*1e3)/6e4)*6e4;return cl.size>5e4&&cl.clear(),cl.set(s,a),a}var rm=t=>{try{return new Intl.DateTimeFormat("en-US",{timeZone:t}),!0}catch{return!1}};function lr(t,e,s){if(e==="1m")return Math.floor(t/6e4)*6e4;let r=nn(s,t);if(e==="1h")return r%36e5===0?Math.floor(t/36e5)*36e5:Math.floor((t+r)/36e5)*36e5-r;let i=Math.floor((t+r)/864e5)*864e5,o=i-nn(s,i-r);return o>t?o=i-864e5-nn(s,i-864e5-r):pl(o,s)<=t&&(o=pl(o,s)),o}function pl(t,e,s="1d"){if(s==="1m")return t+6e4;if(s==="1h")return t+36e5;let r=nn(e,t),i=Math.floor((t+r)/864e5)*864e5+864e5;return i-nn(e,i-r)}var Vs=6e4,Ks=36e5,Cn=864e5;function dl(t,e,s,r={}){let i=Math.max((r.minFrac??.15)*(s-e),r.minMs??10*Vs),o=t.filter(([f,p])=>p>=e&&f<s).map(([f,p])=>[Math.max(e,f),Math.min(s,Math.max(f,p))]).sort((f,p)=>f[0]-p[0]),n=[];if(!o.length)return n;let a=e;for(let[f,p]of o)f-a>i&&n.push({from:a,to:f}),a=Math.max(a,p);return s-a>i&&n.push({from:a,to:s}),n}function cr(t){if(t>=Cn){let e=Math.floor(t/Cn),s=Math.round((t-e*Cn)/Ks);return s?`${e} d ${s} h`:`${e} d`}if(t>=Ks){let e=Math.floor(t/Ks),s=Math.round((t-e*Ks)/Vs);return s&&e<10?`${e} h ${s} min`:`${e} h`}return`${Math.max(1,Math.round(t/Vs))} min`}var pr=t=>`${t.from}-${t.to}`;function Qr(t,e,s,r=[],i={}){let o=i.cut??24,n=Math.max(1,s),a=Math.max(1,e-t),f=r.filter(b=>b.to>t&&b.from<e).map(b=>({from:Math.max(t,b.from),to:Math.min(e,b.to),w:i.weights?.get(pr(b))??0})).sort((b,x)=>b.from-x.from),p=f.reduce((b,x)=>b+(x.to-x.from)*(1-x.w),0),c=f.reduce((b,x)=>b+(1-x.w)*o,0),l=(n-c)/Math.max(1,a-p);if(!(l>0)||c>n*.6)return Qr(t,e,s,[],i);let d=[[t,0]],m=0,h=t,y=[];for(let b of f){m+=(b.from-h)*l,d.push([b.from,m]);let x=(1-b.w)*o+b.w*l*(b.to-b.from);y.push({from:b.from,to:b.to,x0:m,x1:m+x,weight:b.w}),m+=x,d.push([b.to,m]),h=b.to}d.push([e,m+(e-h)*l]);let g=b=>{if(b<=t)return(b-t)*l;if(b>=e)return d[d.length-1][1]+(b-e)*l;let x=0,w=d.length-1;for(;w-x>1;){let A=x+w>>1;d[A][0]<=b?x=A:w=A}let[$,v]=d[x],[O,C]=d[w];return O===$?v:v+(b-$)/(O-$)*(C-v)},k=b=>y.find(x=>x.weight<1&&b>x.x0&&b<x.x1);return{t0:t,t1:e,width:n,cuts:y,x:g,t:b=>{let x=k(b);if(x)return b-x.x0<x.x1-b?x.from:x.to;if(b<=0)return t+b/l;let w=0,$=d.length-1;if(b>=d[$][1])return e+(b-d[$][1])/l;for(;$-w>1;){let R=w+$>>1;d[R][1]<=b?w=R:$=R}let[v,O]=d[w],[C,A]=d[$];return A===O?v:v+(b-O)/(A-O)*(C-v)},cutAt:k,msPerPx:1/l}}var mp=[1e3,5e3,15e3,3e4,Vs,5*Vs,15*Vs,30*Vs,Ks,3*Ks,6*Ks,12*Ks,Cn,2*Cn,7*Cn,14*Cn,28*Cn];function fl(t,e,s=80){let r=mp.find(f=>f/t.msPerPx>=s)??mp[mp.length-1],i=[],o=f=>{let p=new Date(f+nn(e,f)),c=String(p.getUTCHours()).padStart(2,"0"),l=String(p.getUTCMinutes()).padStart(2,"0"),d=String(p.getUTCSeconds()).padStart(2,"0"),m=`${p.getUTCDate()} ${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][p.getUTCMonth()]}`,h=c==="00"&&l==="00"&&d==="00";return r>=Cn||h?{label:m,major:!0}:{label:r<Vs?`${c}:${l}:${d}`:`${c}:${l}`,major:!1}},n=[],a=t.t0;for(let f of t.cuts)f.weight<1&&(n.push([a,f.from]),a=f.to);n.push([a,t.t1]);for(let[f,p]of n){let c=d=>d-nn(e,d-nn(e,d)),l=Math.ceil((f+nn(e,f))/r)*r;r>=7*Cn&&(l=Math.ceil((f+nn(e,f))/Cn)*Cn);for(let d=0,m=c(l);m<p&&d<2e3;d++,l+=r,m=c(l)){if(m<f)continue;let h=t.x(m),y=i[i.length-1];(!y||h-y.x>=s*.6)&&i.push({t:m,x:h,...o(m)})}}return i}var ry=["id","time","t","dur","scope","source","kind","severity","summary"],iy=t=>{if(t==null)return"";let e=typeof t=="string"&&/^[=+\-@\t\r]/.test(t)?`'${t}`:String(t);return/[",\n\r]/.test(e)?`"${e.replace(/"/g,'""')}"`:e},im=(t,e)=>e.size?{...t,attrs:Object.fromEntries(Object.entries(t.attrs).filter(([s])=>!e.has(`${t.source}.${s}`)))}:t;function ml(t,e=[]){let s=new Set(e);return JSON.stringify(t.map(r=>im(r,s)),null,2)+`
403
+ `}function ul(t,e=[]){let s=new Set(e),r=t.map(f=>im(f,s)),i=[...new Set(r.flatMap(f=>Object.keys(f.attrs)))].sort(),o=[...new Set(r.flatMap(f=>Object.keys(f.links)))].sort(),n=[...ry,...i.map(f=>`attr.${f}`),...o.map(f=>`link.${f}`)],a=r.map(f=>[f.id,new Date(f.t).toISOString(),f.t,f.dur,f.scope,f.source,f.kind,f.severity,f.summary,...i.map(p=>f.attrs[p]),...o.map(p=>f.links[p])].map(iy).join(","));return[n.join(","),...a].join(`\r
358
404
  `)+`\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=`
405
+ `}var oy=864e5,es=36e5,hl=(t,e)=>t.t-e.t||(t.id<e.id?-1:t.id>e.id?1:0);function ms(t,e){let s=0,r=t.length;for(;s<r;){let i=s+r>>1;t[i].t<e?s=i+1:r=i}return s}var lm=(t,e)=>{t.min=Math.min(t.min,e.min),t.max=Math.max(t.max,e.max),t.sum+=e.sum,t.count+=e.count};function om(t,e,s){let r=[];for(let i of t){let o=lr(i.t,e,s),n=r[r.length-1];n&&n.t===o?lm(n,i):r.push({t:o,min:i.min,max:i.max,sum:i.sum,count:i.count})}return r}function up(t,e,s,r){for(let n=ms(t,e.t);n<t.length&&t[n].t===e.t;n++)if(s(t[n])){t[n]=e;return}let i=t[t.length-1];if(!i||r(i,e)<=0){t.push(e);return}let o=ms(t,e.t);for(;o<t.length&&r(t[o],e)<0;)o++;t.splice(o,0,e)}function am(t,e,s){for(let r=ms(t,e);r<t.length&&t[r].t===e;r++)if(s(t[r])){t.splice(r,1);return}}function cm(t,e,s={}){let r=t.catalog,{isScope:i}=ol(e),{parseSearch:o,matchAst:n,toAst:a}=Xr(e),f=I=>Object.fromEntries(e.flags.filter(V=>I?.[V]).map(V=>[V,!0])),p=s.now??r.now,c=(r.names??[]).flatMap(I=>(I.aliases??[]).map(V=>[V,I.scope])).sort((I,V)=>V[0].length-I[0].length),l=new Map,d=I=>{if(!c.length)return I;let V=l.get(I);if(V===void 0){let te=c.find(([ae])=>hn(I,ae));V=te?te[1]+I.slice(te[0].length):I,l.set(I,V)}return V},m=new Map((r.names??[]).map(I=>[I.scope,I])),h=I=>c.length?{...I,scope:d(I.scope)}:I,y=I=>`${I.source}\0${I.id}`,g=t.events.map(h).sort(hl),k=new Map;for(let I of g)k.set(y(I),I);let u=g.filter(I=>I.dur!==void 0&&!I.open),b=u.reduce((I,V)=>Math.max(I,V.dur),0),x=new Map;for(let I of g)I.open&&x.set(y(I),I);let w=new Map,$=new Set,v=I=>{for(let V=Jt(I);V>=1;V--){let te=Ms(I,V);if($.has(te))break;$.add(te)}},O=new Map;for(let I of r.sources)for(let V of I.series)O.set(V.name,V.type);let C=r.sources.flatMap(I=>(I.sensitive??[]).map(V=>`${I.name}.${V}`)),A=new Map;for(let I of r.sources)A.set(I.name,{events:I.defaultRetention.events,rollups:{...I.defaultRetention.rollups},setBy:"default"});for(let I of r.retention)A.set(I.source,{events:I.events,rollups:{...I.rollups},setBy:I.setBy});let R=new Map;for(let I of r.sources)for(let V of I.series)R.set(V.name,I.name);function M(I){let V=d(I.scope),te=`${I.series}\0${V}`,ae=w.get(te);ae||(ae={series:I.series,scope:V,fine:[],cache:new Map},w.set(te,ae),v(V));let Te="value"in I?{t:I.t,min:I.value,max:I.value,sum:I.value,count:1}:{t:I.t,min:I.min,max:I.max,sum:I.sum,count:I.count};up(ae.fine,Te,be=>be.t===Te.t,(be,ze)=>be.t-ze.t),ae.cache.clear()}for(let I of g)v(I.scope);for(let I of t.metrics)M(I);let T=new Map,S=new Set,N=(I,V)=>{S.add(I.source);let te=T.get(I.scope);te||T.set(I.scope,te=new Map);let ae=te.get(I.source);ae||te.set(I.source,ae=new Map);let Te=Math.floor(I.t/es)*es,be=ae.get(Te);if(be||ae.set(Te,be={t:Te,count:0,severity:{},kinds:{},first:1/0,last:-1/0}),be.count+=V,V>0)be.first=Math.min(be.first,I.t),be.last=Math.max(be.last,I.t);else if(I.t===be.first||I.t===be.last){be.first=1/0,be.last=-1/0;for(let ze=ms(g,Te);ze<g.length&&g[ze].t<Te+es;ze++){let Ie=g[ze];Ie.scope===I.scope&&Ie.source===I.source&&(be.first=Math.min(be.first,Ie.t),be.last=Math.max(be.last,Ie.t))}}be.severity[I.severity]=(be.severity[I.severity]??0)+V,be.kinds[I.kind]=(be.kinds[I.kind]??0)+V,be.severity[I.severity]===0&&delete be.severity[I.severity],be.kinds[I.kind]===0&&delete be.kinds[I.kind],be.count||ae.delete(Te)};for(let I of g)N(I,1);let z=(I,V,te)=>{let ae=`${V}|${te??""}`,Te=I.cache.get(ae);return Te||(Te=V==="1d"?om(z(I,"1h",te),"1d",te):om(I.fine,V,te),I.cache.set(ae,Te)),Te},K=I=>I===null?-1/0:p-I*oy,J=I=>K(A.get(I)?.events??null),Z=(I,V)=>{let te=A.get(I);return K(te?V?te.rollups[V]:te.events:null)};function L(I){let V=[];for(let te of new Set(I)){let ae=A.get(te);if(!ae)continue;let Te=g.find(ke=>ke.source===te&&ke.t>=J(te))?.t,be=ke=>{let Be=1/0;for(let Qe of w.values())if(R.get(Qe.series)===te){let Ke=(ke?z(Qe,ke):Qe.fine).find(pt=>pt.t>=Z(te,ke));Ke&&Ke.t<Be&&(Be=Ke.t)}return Be===1/0?void 0:Be},ze=[Te,be()].filter(ke=>ke!==void 0),Ie={};for(let ke of["1m","1h","1d"]){let Be=be(ke)??(Te!==void 0&&Te>=Z(te,ke)?Te:void 0);Be!==void 0&&(Ie[ke]=Math.max(Be,Z(te,ke)))}V.push({source:te,events:ae.events,rollups:{...ae.rollups},setBy:ae.setBy,keptFrom:{...ze.length?{events:Math.min(...ze)}:{},rollups:Ie}})}return V}function U(I){let V=I.where,te={from:I.from,to:I.to},ae=[];if(!V&&I.q){let Ke=o(I.q,p);V=a(Ke),te=so(Ke,I.from,I.to),ae=Ke.warnings}let Te=n(V,C),be=I.filters??{},ze=be.source?.length?new Set(be.source):void 0,Ie=be.kind?.length?new Set(be.kind):void 0,ke=be.severity?.length?new Set(be.severity):void 0,Be=be.scope?.length?be.scope:void 0;return{test:Ke=>hn(Ke.scope,I.scope)&&(!ze||ze.has(Ke.source))&&(!Ie||Ie.has(Ke.kind))&&(!ke||ke.has(Ke.severity))&&(!Be||Be.some(pt=>hn(Ke.scope,pt)))&&Ke.t>=J(Ke.source)&&Te(Ke),range:te,warnings:ae}}function H(I){let V=Jt(I.scope),te=V+I.depth,ae=new Map,Te=ke=>{let Be=ae.get(ke);return Be===void 0&&!ae.has(ke)&&(Be=hn(ke,I.scope)?Jt(ke)>=te?Ms(ke,te):ke:void 0,ae.set(ke,Be)),Be},be=ke=>{let Be=0,Qe=Jt(ke)+1;for(let Ke of $)Jt(Ke)===Qe&&hn(Ke,ke)&&Be++;return Be},ze=new Map,Ie=ke=>{let Be=ze.get(ke);if(!Be){let Qe=Jt(ke)-V,Ke=m.get(ke);Be={scope:ke,label:Ke?.label??Wr(ke),kind:Yr(ke),...f(Ke),depth:Qe,...Qe<I.depth?{own:!0}:{},children:be(ke),count:0},ze.set(ke,Be)}return Be};for(let ke of $)Jt(ke)===te&&hn(ke,I.scope)&&Ie(ke);return te===0&&Ie(""),{at:Te,add:Ie,rows:ze}}let ee=I=>[...I.values()].sort((V,te)=>V.scope===te.scope?0:V.scope<te.scope?-1:1);function j(I,V){let te=[];for(let ae=ms(u,I-b);ae<u.length&&u[ae].t<I;ae++)u[ae].t+u[ae].dur>I&&te.push(u[ae]);for(let ae of x.values())ae.t<I&&p>I&&te.push(ae);for(let ae=ms(g,I);ae<g.length&&g[ae].t<V;ae++)te.push(g[ae]);return te}function q(I,V,te,ae){let Te=I.series?new Set(I.series):void 0,be=new Map;for(let Ie of w.values()){if(Te&&!Te.has(Ie.series))continue;let ke=V(Ie.scope);if(ke===void 0)continue;let Be=R.get(Ie.series)??"",Qe=Z(Be,I.bin),Ke=I.bin?z(Ie,I.bin,I.tz):Ie.fine;for(let pt=ms(Ke,I.bin?lr(te,I.bin,I.tz):te);pt<Ke.length&&Ke[pt].t<ae;pt++){let P=Ke[pt];if(P.t<Qe)continue;let B=`${Ie.series}\0${ke}\0${P.t}`,W=be.get(B);W?lm(W,P):be.set(B,{series:Ie.series,scope:ke,t:P.t,bin:I.bin??"1m",min:P.min,max:P.max,sum:P.sum,count:P.count})}}let ze=[...be.values()].sort((Ie,ke)=>Ie.t-ke.t||(Ie.series<ke.series?-1:1)||(Ie.scope<ke.scope?-1:1));return I.bin?ze:ze.map(Ie=>({series:Ie.series,scope:Ie.scope,t:Ie.t,value:Ie.count===1||O.get(Ie.series)!=="gauge"?Ie.sum:Ie.sum/Ie.count}))}let G=I=>`${I.t}:${I.id}`,Q=(I,V)=>{let te=V.indexOf(":"),ae=Number(V.slice(0,te)),Te=V.slice(te+1);return I.t>ae||I.t===ae&&I.id>Te};function ce(I){if(I.bin!=="1h"&&I.bin!=="1d"||(I.where?.all.length??0)||I.q||I.filters?.kind?.length||I.filters?.severity?.length||I.filters?.scope?.length||nn(I.tz,I.from)%es||nn(I.tz,I.to)%es)return;let V=I.filters?.source?.length?new Set(I.filters.source):void 0,te=X=>Math.max(I.from,J(X)),{at:ae,add:Te,rows:be}=H(I),ze=new Set,Ie=new Map,ke=0,Be=(X,ne)=>{let ye=lr(ne,I.bin,I.tz),$e=`${X}\0${ye}`,E=Ie.get($e);return E||(E={scope:X,t:ye,bin:I.bin,count:0,severity:{},kinds:{}},Ie.set($e,E)),E},Qe=(X,ne,ye)=>{let $e=Te(X);$e.count+=ye,ke+=ye,($e.first===void 0||ne<$e.first)&&($e.first=ne),($e.last===void 0||ne>$e.last)&&($e.last=ne)},Ke=Math.floor(I.to/es)*es;for(let[X,ne]of T){let ye=ae(X);if(ye!==void 0)for(let[$e,E]of ne){if(V&&!V.has($e))continue;let _=Math.ceil(te($e)/es)*es;for(let[D,le]of E){if(D<_||D>=Ke)continue;Qe(ye,le.first,le.count),le.last>(be.get(ye).last??-1/0)&&(be.get(ye).last=le.last),ze.add($e);let ue=Be(ye,D);ue.count+=le.count;for(let[Ce,oe]of Object.entries(le.severity))ue.severity[Ce]=(ue.severity[Ce]??0)+oe;for(let[Ce,oe]of Object.entries(le.kinds))ue.kinds[Ce]=(ue.kinds[Ce]??0)+oe}}}let pt=X=>hn(X.scope,I.scope)&&(!V||V.has(X.source))&&X.t>=J(X.source)&&ae(X.scope)!==void 0,P=X=>{let ne=ae(X.scope);Qe(ne,X.t,1),ze.add(X.source);let ye=Be(ne,X.t);ye.count++,ye.severity[X.severity]=(ye.severity[X.severity]??0)+1,ye.kinds[X.kind]=(ye.kinds[X.kind]??0)+1};for(let X of S){if(V&&!V.has(X))continue;let ne=te(X),ye=Math.ceil(ne/es)*es,$e=ye>=Ke?[[ne,I.to]]:[[ne,ye],[Ke,I.to]];for(let[E,_]of $e)for(let D=ms(g,E);D<g.length&&g[D].t<_;D++){let le=g[D];le.source===X&&pt(le)&&P(le)}}let B=zn[I.bin],W=[];for(let X=ms(u,I.from-b);X<u.length&&u[X].t<I.from;X++){let ne=u[X];ne.t+ne.dur>I.from&&pt(ne)&&(Qe(ae(ne.scope),ne.t,1),ze.add(ne.source),ne.dur>=B&&W.length<5e3&&W.push(ne))}for(let X of x.values())X.t<I.from&&p>I.from&&pt(X)&&(Qe(ae(X.scope),X.t,1),ze.add(X.source),W.length<5e3&&W.push(X));for(let X=ms(u,I.from);X<u.length&&u[X].t<I.to&&W.length<5e3;X++)u[X].dur>=B&&pt(u[X])&&W.push(u[X]);for(let X of x.values())X.t>=I.from&&X.t<I.to&&W.length<5e3&&pt(X)&&W.push(X);let fe=q(I,ae,I.from,I.to);for(let X of fe){let ne=R.get(X.series);ne&&ze.add(ne)}let me=[...Ie.values()].sort((X,ne)=>X.t-ne.t||(X.scope<ne.scope?-1:1));return{timeline:1,type:"result",rows:ee(be),bins:me,spans:W,metrics:fe,total:ke,retention:L(ze)}}async function pe(I){if(!i(I.scope))throw new Error(`not a scope path: ${JSON.stringify(I.scope)}`);let V=ce(I);if(V)return V;let{test:te,range:ae,warnings:Te}=U(I),{at:be,add:ze,rows:Ie}=H(I),ke=new Set,Be=[];for(let fe of j(ae.from,ae.to)){if(!te(fe))continue;let me=be(fe.scope);if(me===void 0)continue;let X=ze(me);X.count++,(X.first===void 0||fe.t<X.first)&&(X.first=fe.t),(X.last===void 0||fe.t>X.last)&&(X.last=fe.t),ke.add(fe.source),Be.push(fe)}Be.sort(hl);let Qe=q(I,be,ae.from,ae.to);for(let fe of Qe){let me=R.get(fe.series);me&&ke.add(me)}let Ke={timeline:1,type:"result",total:Be.length,...Te.length?{warnings:Te}:{}};if(I.bin){let fe=zn[I.bin],me=new Map,X=[];for(let ye of Be){if((ye.open||ye.dur!==void 0&&ye.dur>=fe)&&X.length<5e3&&X.push(ye),ye.t<ae.from)continue;let $e=be(ye.scope),E=lr(ye.t,I.bin,I.tz),_=`${$e}\0${E}`,D=me.get(_);D||(D={scope:$e,t:E,bin:I.bin,count:0,severity:{},kinds:{}},me.set(_,D)),D.count++,D.severity[ye.severity]=(D.severity[ye.severity]??0)+1,D.kinds[ye.kind]=(D.kinds[ye.kind]??0)+1}let ne=[...me.values()].sort((ye,$e)=>ye.t-$e.t||(ye.scope<$e.scope?-1:1));return{...Ke,rows:ee(Ie),bins:ne,spans:X,metrics:Qe,retention:L(ke)}}let pt=Math.min(1e4,Math.max(1,I.limit??2e3)),P=I.cursor?Be.findIndex(fe=>Q(fe,I.cursor)):0,B=P<0?[]:Be.slice(P,P+pt),W=P>=0&&P+pt<Be.length;return{...Ke,rows:ee(Ie),events:B,metrics:Qe,retention:L(ke),...W?{next:G(B[B.length-1])}:{}}}let Y=new Set,ie=I=>un.includes(I),Ae=0;function De(I){let V=y(I),te=k.get(V);te&&(am(g,te.t,ae=>ae===te),N(te,-1),te.dur!==void 0&&!te.open&&am(u,te.t,ae=>ae===te),x.delete(V)),k.set(V,I),N(I,1),up(g,I,()=>!1,hl),I.open?x.set(V,I):I.dur!==void 0&&(up(u,I,()=>!1,hl),b=Math.max(b,I.dur)),v(I.scope)}return{async catalog(){return{...r,now:p,retention:L(r.sources.map(I=>I.name))}},query:pe,subscribe(I,V){let te={q:I,on:V};return Y.add(te),()=>{Y.delete(te)}},...s.stateAt?{stateAt:(I,V)=>s.stateAt(I,V)}:{},append(I,V=[],te){te!==void 0&&(p=Math.max(p,te));let ae=new Set($),Te=I.map(h);for(let be of Te){if(!ie(be.severity))throw new Error(`not a severity: ${be.severity}`);De(be)}for(let be of V)M(be);Ae++;for(let be of Y){let{test:ze}=U(be.q),{at:Ie}=H(be.q),ke=Te.filter(B=>ze(B)&&Ie(B.scope)!==void 0),Be=be.q.series?new Set(be.q.series):void 0,Qe=V.filter(B=>hn(d(B.scope),be.q.scope)&&(!Be||Be.has(B.series))).map(B=>({...B,scope:Ie(d(B.scope))})),Ke=[...$].filter(B=>!ae.has(B)),pt=Jt(be.q.scope)+be.q.depth,P=Ke.filter(B=>Jt(B)===pt&&hn(B,be.q.scope)).map(B=>({scope:B,label:m.get(B)?.label??Wr(B),kind:Yr(B),depth:be.q.depth,children:0,count:0}));be.on({timeline:1,type:"batch",events:ke,metrics:Qe,...P.length?{rows:P}:{},now:p,resume:String(Ae)})}},setRetention(I,V){A.set(I,{events:V.events,rollups:{...V.rollups},setBy:"user"})},get now(){return p},get size(){let I=0;for(let V of w.values())I+=V.fine.length;return{events:g.length,samples:I}}}}var pm="http://www.w3.org/2000/svg",dr=22,yl=38,us=26,ay=210,ly=24,io=6e4,fr=36e5,Sn=864e5,dm={"15m":15*io,"1h":fr,"1d":Sn,"1w":7*Sn},fm=t=>un.indexOf(t),cy={debug:"dot",info:"circle",notice:"square",warning:"triangle",error:"diamond"},gt=(t,e,s)=>{let r=document.createElementNS(pm,t);for(let[i,o]of Object.entries(e))o!==void 0&&r.setAttribute(i,String(o));if(s){let i=document.createElementNS(pm,"title");i.textContent=s,r.append(i)}return r},sn=(t,e)=>{try{return new Intl.DateTimeFormat(void 0,{timeZone:e,dateStyle:"medium",timeStyle:"medium"}).format(t)}catch{return new Date(t).toISOString()}},hp=t=>t<1e3?`${Math.round(t)} ms`:t<io?`${(t/1e3).toFixed(1)} s`:cr(t),py=(t,e)=>e==="bytes"?t>=1e9?`${(t/1e9).toFixed(1)} GB`:t>=1e6?`${(t/1e6).toFixed(1)} MB`:t>=1e3?`${(t/1e3).toFixed(1)} kB`:`${Math.round(t)} B`:`${Math.round(t*10)/10}${e==="count"?"":` ${e}`}`;function yp(t,e){if(t<=3*fr)return{kind:"single"};for(let s of["1m","1h","1d"])if(t/zn[s]<=e/2)return{kind:"binned",bin:s};return{kind:"binned",bin:"1d"}}function gp(t,e,s){let r=[];for(let n of t.events??[])r.push([n.t,n.t]),n.dur!==void 0&&!n.open&&r.push([n.t+n.dur,n.t+n.dur]);for(let n of t.spans??[])r.push([n.t,n.t]),n.dur!==void 0&&!n.open&&r.push([n.t+n.dur,n.t+n.dur]);let i=e.kind==="binned"?zn[e.bin]:io;for(let n of t.bins??[])n.count&&r.push([n.t,n.t+zn[n.bin]]);let o=new Map;for(let n of t.metrics){let a="value"in n?n.value:n.sum,f=`${n.series}|${n.scope}`,p=(s?.get(n.series)??"counter")==="counter"?a!==0:o.get(f)!==a;o.set(f,a),p&&r.push([n.t,n.t+i])}return r}function mm(t,e){let s=e.tz??Intl.DateTimeFormat().resolvedOptions().timeZone,r=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches,i=e.motion??!r;t.classList.add(...e.rootClass??[],"tlx");let{parseSearch:o,compileSearch:n}=Xr(e.catalog),a=(F="system")=>{t.style.colorScheme=F==="system"?"light dark":F,F==="system"?delete t.dataset.theme:t.dataset.theme=F};a(e.theme),t.setAttribute("role","region"),t.setAttribute("aria-label","Timeline");let f,p="",c=1,l="",d={},m=!1,h=e.collapseGaps??!0,y={t0:0,t1:Sn},g,k="",u={from:0,to:0,mode:{kind:"single"},key:""},b,x,w,$,v=!0,O=0,C=0,A=!1,R,M=[],T=[],S=-1,N=new Set,z=new Map,K=[],J=Qr(0,Sn,800),Z=new Map,L=[],U=re("nav",{class:"tlx-crumbs","aria-label":"Scope"}),H=re("div",{class:"segmented tlx-quick",role:"group","aria-label":"Range"});for(let F of["15m","1h","1d","1w","run"]){let se=re("button",{type:"button",class:"seg","data-v":F,title:F==="run"?"The latest run":`The last ${F}`},F==="run"?"this run":F);se.addEventListener("click",()=>ys(F)),H.append(se)}let ee=re("button",{type:"button",class:"btn sm tlx-live","aria-pressed":"false",title:"Follow what happens now"},"Live"),j=re("button",{type:"button",class:"btn sm quiet tlx-now",hidden:!0,title:"Back to the live edge"},"Back to now"),q=re("button",{type:"button",class:"btn sm quiet tlx-fit",title:"Everything in this scope"},"Fit"),G=re("input",{type:"checkbox",class:"tlx-gaps"});G.checked=h;let Q=!0,ce=re("input",{type:"checkbox",class:"tlx-quiet"});ce.checked=Q;let pe=re("input",{type:"search",class:"input tlx-q",placeholder:"Search: words, kind:\u2026, source:\u2026, severity:>=warning, -kind:\u2026","aria-label":"Search the timeline",spellcheck:"false"}),Y=re("span",{class:"tlx-hits",role:"status","aria-live":"polite"}),ie=re("button",{type:"button",class:"btn sm quiet tlx-prev",title:"Previous hit (\u21E7N)","aria-label":"Previous hit"},"\u2039"),Ae=re("button",{type:"button",class:"btn sm quiet tlx-next",title:"Next hit (N)","aria-label":"Next hit"},"\u203A"),De=re("div",{class:"tlx-facets",role:"group","aria-label":"Sources"}),I=re("select",{class:"input tlx-sev","aria-label":"Severity"},re("option",{value:""},"every severity"),...un.slice(1).map(F=>re("option",{value:F},`${F} and above`))),V=re("select",{class:"input tlx-views","aria-label":"Saved views",hidden:!e.views},re("option",{value:""},"Saved views\u2026")),te=re("button",{type:"button",class:"btn sm quiet tlx-save",hidden:!e.saveView,title:"Save this view"},"Save view"),ae=re("div",{class:"tlx-warn",role:"status",hidden:!0}),Te=re("div",{class:"tlx-status",role:"status"}),be=re("span",{class:"tlx-canvas-note"}),ze=re("div",{class:"tlx-labels"}),Ie=re("div",{class:"tlx-lanes",tabindex:"0",role:"application","aria-label":"Timeline lanes: drag to pan, wheel to zoom, drag the axis to choose a range, click it to move the playhead. Keys: \u2190 \u2192 pan, + \u2212 zoom, N next hit"}),ke=gt("svg",{class:"tlx-svg"});Ie.append(ke);let Be=re("div",{class:"tlx-scroll"},re("div",{class:"tlx-grid"},ze,Ie)),Qe=re("section",{class:"tlx-table",hidden:!0,"aria-label":"The events in the chosen range"}),Ke=re("aside",{class:"tlx-detail",hidden:!0,"aria-label":"The event"});t.replaceChildren(re("div",{class:"tlx-bar"},U,re("span",{class:"spacer"}),H,ee,j,q,re("label",{class:"tlx-gaps-label",title:"Draw long empty stretches as narrow breaks"},G,"Collapse gaps"),re("label",{class:"tlx-gaps-label",title:"Hide the rows with nothing in this range"},ce,"Hide quiet rows")),re("div",{class:"tlx-bar"},pe,Y,ie,Ae,I,V,te),De,ae,re("div",{class:"tlx-body"},Be,Ke),re("div",{class:"tlx-foot"},Te,re("span",{class:"spacer"}),be),Qe);let pt=()=>Math.max(200,Ie.clientWidth||800),P=()=>{let F=(Me,He)=>(Me.own?-1:0)-(He.own?-1:0)||Me.scope.localeCompare(He.scope,void 0,{numeric:!0}),he=(g?.rows??[]).filter(Me=>!Q||Me.count>0||Me.own||(g?.rows.length??0)<=1).sort(F).map(Me=>({kind:"row",row:Me})),ge=new Set(g?.metrics.map(Me=>Me.series)??[]);for(let Me of[...ge].sort()){let He=Z.get(Me);he.push({kind:"metric",series:Me,unit:He?.unit??"count",type:He?.type??"counter",title:He?.title??Me})}return he},B=(F,se)=>f?.names?.find(he=>he.scope===F)?.label??se,W=F=>F.kind==="metric"?yl:dr,fe=()=>yp(y.t1-y.t0,pt()),me=()=>f?.now??Date.now();function X(){return{timeline:1,type:"view",name:"",scope:p,depth:c,range:{from:Math.round(y.t0),to:Math.round(y.t1)},...l?{q:l}:{},...Object.keys(d).length?{filters:d}:{},...m?{live:m}:{},...h?{}:{collapseGaps:!1},...Q?{}:{quietRows:!0}}}function ne(F){F.scope!==void 0&&(p=F.scope),F.depth!==void 0&&(c=F.depth),l=F.q??"",pe.value=l,d=F.filters??{},I.value=d.severity?.length?d.severity[0]:"",h=F.collapseGaps??e.collapseGaps??!0,G.checked=h,Q=!F.quietRows,ce.checked=Q,N.clear(),z.clear();let se=F.range;se&&"last"in se?ys(se.last,!1):se&&(y={t0:se.from,t1:se.to}),kt(!!F.live,!1)}let ye=()=>{let F=X();if(e.onViewChange?.(F),!!e.urlState)try{history.replaceState(null,"",`#timeline=${encodeURIComponent(JSON.stringify(F))}`)}catch{}},$e=()=>{if(!e.urlState)return;let F=/#timeline=(.+)$/.exec(location.hash);if(F)try{return JSON.parse(decodeURIComponent(F[1]))}catch{return}};function E(F,se,he,ge={}){let Me=n(l,me(),F,se);M=Me.warnings;let He=l?[]:d.source?[...Z].filter(([,dt])=>d.source.includes(dt.source)).map(([dt])=>dt):void 0;return{timeline:1,type:"query",scope:p,depth:c,from:Me.from,to:Me.to,tz:s,...he.kind==="binned"?{bin:he.bin}:{},...l?{q:l,where:Me.where}:{},...Object.keys(d).length?{filters:d}:{},...He?{series:He}:{},...ge}}let _=()=>JSON.stringify([p,c,l,d,fe()]);async function D(F=!1){let se=fe(),he=_(),ge=y.t1-y.t0;if(!F&&g&&he===u.key&&y.t0>=u.from&&y.t1<=u.to){ue();return}if(C){A=!0;return}C++;let Me=y.t0-ge/2,He=Math.min(y.t1+ge/2,Math.max(y.t1,me()+ge*.1));try{let dt=await e.source.query(E(Me,He,se,se.kind==="single"?{limit:1e4}:{}));se.kind==="single"&&dt.next&&(dt=await e.source.query(E(Me,He,{kind:"binned",bin:"1m"}))),g=dt,k=he,u={from:Me,to:He,mode:se,key:he}}catch(dt){Te.textContent=`The history couldn't be read: ${String(dt?.message??dt)}`}finally{C--}ue(),ye(),A&&(A=!1,D())}function le(){let F=pt(),se=fe();if(K=[],h&&g){let he=new Map([...Z].map(([ge,Me])=>[ge,Me.type]));K=dl(gp(g,se,he),y.t0,Math.min(y.t1,Math.max(y.t0,me())),{minFrac:.15,minMs:10*io}),se.kind==="binned"&&(K=K.filter(ge=>ge.to-ge.from>=2*zn[se.bin])),K=K.filter(ge=>!(N.has(pr(ge))&&(z.get(pr(ge))??1)>=1))}J=Qr(y.t0,y.t1,F,K,{cut:ly,weights:z})}let ue=()=>{O||(O=requestAnimationFrame(Ce))};function Ce(){O=0,le();let F=pt(),se=P(),he=u.mode,ge=[],Me=us;for(let de of se)ge.push(Me),Me+=W(de);let He=Math.max(Me,us+dr);ke.setAttribute("width",String(F)),ke.setAttribute("height",String(He)),ke.setAttribute("viewBox",`0 0 ${F} ${He}`);let dt=Be.scrollTop-200,ns=Be.scrollTop+(Be.clientHeight||600)+200,Ve=[],qe=J.x;Ve.push(gt("rect",{class:"tlx-axis",x:0,y:0,width:F,height:us}));let Xt=(g?.retention??[]).map(de=>({r:de,from:he.kind==="binned"?de.keptFrom.rollups[he.bin]??de.keptFrom.events:de.keptFrom.events,days:he.kind==="binned"?de.rollups[he.bin]:de.events})).filter(de=>de.from!==void 0);if(Xt.length){let de=Math.min(...Xt.map(Oe=>Oe.from));de>y.t0&&Ve.push(gt("rect",{class:"tlx-notkept",x:Math.max(0,qe(y.t0)),y:us,width:Math.max(0,qe(de)-Math.max(0,qe(y.t0))),height:He-us},`Nothing kept before ${sn(de,s)}: ${Xt.map(Oe=>`${Oe.r.source} ${Oe.days===null?"kept until deleted":`kept ${Oe.days} days`}`).join(", ")}`))}let gn=me();gn<y.t1&&Ve.push(gt("rect",{class:"tlx-future",x:qe(gn),y:us,width:F-qe(gn),height:He-us}));for(let de of fl(J,s,90)){Ve.push(gt("line",{class:`tlx-tick${de.major?" major":""}`,x1:de.x,x2:de.x,y1:us-6,y2:He}));let Oe=gt("text",{class:"tlx-ticklabel",x:de.x+3,y:16});Oe.textContent=de.label,Ve.push(Oe)}$&&Ve.push(gt("rect",{class:"tlx-brush",x:qe($.from),y:0,width:Math.max(1,qe($.to)-qe($.from)),height:He}));let mo=he.kind==="single"?(g?.events??[]).filter(de=>de.dur!==void 0||de.open):g?.spans??[],Dm=he.kind==="single"?(g?.events??[]).filter(de=>de.dur===void 0&&!de.open):[],Np=new Map;se.forEach((de,Oe)=>{de.kind==="row"&&Np.set(de.row.scope,Oe)});let uo=de=>{let Oe=Jt(p)+c,tt=Jt(de)>=Oe?Ms(de,Oe):de;return Np.get(tt)},oi=de=>ge[de]+W(se[de])>=dt&&ge[de]<=ns;if(se.forEach((de,Oe)=>{oi(Oe)&&Ve.push(gt("rect",{class:`tlx-lane${Oe%2?" odd":""}${de.kind==="metric"?" metric":""}`,x:0,y:ge[Oe],width:F,height:W(de)}))}),he.kind==="binned"){let de=new Map;for(let Oe of g?.bins??[]){let tt=uo(Oe.scope);tt!==void 0&&de.set(tt,Math.max(de.get(tt)??0,Oe.count))}for(let Oe of g?.bins??[]){let tt=uo(Oe.scope);if(tt===void 0||!oi(tt))continue;let ft=qe(Oe.t),it=qe(Oe.t+zn[Oe.bin]);if(it<0||ft>F)continue;let St=[...un].reverse().find(vn=>(Oe.severity[vn]??0)>0)??"info",Ut=Math.max(2,(dr-8)*Math.sqrt(Oe.count)/Math.sqrt(de.get(tt)||1));Ve.push(gt("rect",{class:"tlx-countbar",x:ft,y:ge[tt]+dr-3-Ut,width:Math.max(1,it-ft-.5),height:Ut,"data-t":Oe.t},`${sn(Oe.t,s)}: ${Oe.count} event${Oe.count===1?"":"s"}${St!=="info"&&St!=="debug"?`, the worst ${St}`:""}`)),(St==="warning"||St==="error")&&Ve.push(gt("rect",{class:`tlx-heat sev-${St}`,x:ft,y:ge[tt]+dr-(St==="error"?4:3),width:Math.max(1,it-ft-.5),height:St==="error"?3:2}))}}for(let de of mo){let Oe=uo(de.scope);if(Oe===void 0||!oi(Oe))continue;let tt=de.open?gn:de.t+(de.dur??0),ft=qe(de.t),it=qe(tt);if(it<-2||ft>F+2)continue;let St=`tlx-span sev-${de.severity}${de.open?" open":""}${w?.id===de.id?" selected":""}`,Ut=`${de.summary} \xB7 ${sn(de.t,s)}${de.open?", still going":`, ${hp(tt-de.t)}`}`,vn=ge[Oe]+5,Es=he.kind==="binned"?4:8,Mn=ft;for(let Fn of J.cuts)Fn.weight>=1||Fn.x1<=ft||Fn.x0>=it||(Fn.x0>Mn&&Ve.push(gt("rect",{class:St,x:Mn,y:vn,width:Math.max(1,Fn.x0-Mn),height:Es,rx:2,"data-id":de.id},Ut)),Ve.push(gt("path",{class:`${St} through`,d:`M${Fn.x0} ${vn+Es/2} H${Fn.x1}`,"data-id":de.id},`${Ut} (lasted through the break)`)),Mn=Fn.x1);it>Mn&&Ve.push(gt("rect",{class:St,x:Math.max(-2,Mn),y:vn,width:Math.max(2,Math.min(F+2,it)-Math.max(-2,Mn)),height:Es,rx:2,"data-id":de.id},Ut))}let Rp=new Map;for(let de of Dm){let Oe=uo(de.scope);if(Oe===void 0||!oi(Oe))continue;let tt=qe(de.t);if(tt<-6||tt>F+6||tt-(Rp.get(Oe)??-1/0)<3)continue;Rp.set(Oe,tt);let ft=ge[Oe]+dr/2+2,it=4,St=cy[de.severity],Ut=St==="diamond"?`M${tt} ${ft-it-1} l${it+1} ${it+1} l${-it-1} ${it+1} l${-it-1} ${-it-1} z`:St==="triangle"?`M${tt} ${ft-it-1} l${it+1} ${2*it+1} h${-2*it-2} z`:St==="square"?`M${tt-it+.5} ${ft-it+.5} h${2*it-1} v${2*it-1} h${-2*it+1} z`:"",vn=`${sn(de.t,s)} \xB7 ${de.summary}`,Es=`tlx-mark sev-${de.severity}${w?.id===de.id?" selected":""}${S>=0&&T[S]?.id===de.id?" hit":""}`;Ve.push(Ut?gt("path",{class:Es,d:Ut,"data-id":de.id},vn):gt("circle",{class:Es,cx:tt,cy:ft,r:St==="dot"?2.5:it,"data-id":de.id},vn))}se.forEach((de,Oe)=>{if(de.kind!=="metric"||!oi(Oe))return;let tt=new Map;for(let ut of g?.metrics??[]){if(ut.series!==de.series)continue;let Ht="value"in ut?{min:ut.value,max:ut.value,sum:ut.value,count:1}:{min:ut.min,max:ut.max,sum:ut.sum,count:ut.count},Bt=tt.get(ut.t);Bt?(Bt.min=Math.min(Bt.min,Ht.min),Bt.max=Math.max(Bt.max,Ht.max),Bt.sum+=Ht.sum,Bt.count+=Ht.count):tt.set(ut.t,{...Ht})}let ft=[...tt].sort((ut,Ht)=>ut[0]-Ht[0]);if(!ft.length)return;let it=he.kind==="binned"?zn[he.bin]:io,St=ut=>de.type==="gauge"?ut.sum/Math.max(1,ut.count):ut.sum,Ut=Math.max(1e-9,...ft.map(([,ut])=>de.type==="gauge"?ut.max:St(ut))),vn=ge[Oe]+yl-4,Es=yl-10,Mn=ut=>vn-ut/Ut*Es;if(de.type==="gauge"){let ut=ft.map(([Ht,Bt])=>`${qe(Ht)},${Mn(Bt.max)}`).join(" ")+" "+[...ft].reverse().map(([Ht,Bt])=>`${qe(Ht)},${Mn(Bt.min)}`).join(" ");Ve.push(gt("polygon",{class:"tlx-band",points:ut})),Ve.push(gt("polyline",{class:"tlx-line",points:ft.map(([Ht,Bt])=>`${qe(Ht+it/2)},${Mn(St(Bt))}`).join(" ")}))}else{let ut="",Ht=-1/0;for(let[Bt,Bm]of ft){let qm=qe(Bt),Ip=qe(Bt+it),zp=Mn(St(Bm));ut+=Bt>Ht?`M${qm} ${vn} V${zp} H${Ip}`:` V${zp} H${Ip}`,Ht=Bt+it;let Cp=ft.find(([Vm])=>Vm>Bt);(!Cp||Cp[0]>Ht)&&(ut+=` V${vn} Z`)}Ve.push(gt("path",{class:"tlx-area",d:ut}))}let Fn=gt("text",{class:"tlx-peak",x:4,y:ge[Oe]+11});Fn.textContent=`peak ${py(Ut,de.unit)}${de.type==="counter"?` per ${he.kind==="binned"?he.bin:"1m"}`:""}`,Ve.push(Fn)});for(let de of J.cuts){if(de.weight>=1)continue;let Oe=it=>{let St=`M${it} 0`;for(let Ut=0;Ut<He;Ut+=8)St+=` L${it+(Ut/8%2?-3:3)} ${Ut+8}`;return St},tt=gt("g",{class:"tlx-cut",tabindex:0,role:"button","data-from":de.from,"data-to":de.to,"aria-label":`A break of ${cr(de.to-de.from)} with nothing shown, from ${sn(de.from,s)} to ${sn(de.to,s)}: press to open it`},`${cr(de.to-de.from)} with nothing here: ${sn(de.from,s)} to ${sn(de.to,s)} (click to open)`);tt.append(gt("rect",{class:"tlx-cut-bg",x:de.x0,y:0,width:de.x1-de.x0,height:He})),tt.append(gt("path",{class:"tlx-cut-edge",d:Oe(de.x0+3)}),gt("path",{class:"tlx-cut-edge",d:Oe(de.x1-3)}));let ft=gt("text",{class:"tlx-cut-label",x:(de.x0+de.x1)/2,y:15,"text-anchor":"middle"});ft.textContent=cr(de.to-de.from),tt.append(ft),Ve.push(tt)}if(b!==void 0){let de=qe(b);Ve.push(gt("line",{class:"tlx-playhead",x1:de,x2:de,y1:0,y2:He})),Ve.push(gt("path",{class:"tlx-handle",d:`M${de-6} 0 h12 v8 l-6 7 l-6 -7 z`},`the playhead: ${sn(b,s)}`))}ke.replaceChildren(...Ve),ze.replaceChildren(re("div",{class:"tlx-labelhead",style:`height:${us}px`},fe().kind==="single"?"single events":`per ${fe().kind==="binned"?fe().bin:""}`),...se.map(de=>{if(de.kind==="metric")return re("div",{class:"tlx-rowlabel metric",style:`height:${yl}px`,title:`${de.title} (${de.type==="counter"?"sums":"min, max and mean"})`},de.title);let Oe=de.row,tt=re("div",{class:`tlx-rowlabel${Oe.own?" own":""}`,style:`height:${dr}px`,"data-scope":Oe.scope,title:`${Oe.scope||"all hosts"} \xB7 ${Oe.count} event${Oe.count===1?"":"s"}`},re("span",{class:"tlx-kind"},e.catalog.flags.find(ft=>Oe[ft])??Oe.kind),re("span",{class:"tlx-name"},Oe.own?`${Oe.label} (itself)`:Oe.label),re("span",{class:"tlx-count"},String(Oe.count)));if(!Oe.own&&Oe.scope!==p){let ft=re("button",{type:"button",class:"tlx-drill",title:Oe.children?`Into ${Oe.label}: its ${Oe.children} part${Oe.children===1?"":"s"}`:`Into ${Oe.label}`,"aria-label":`Into ${Oe.label}`},"\u203A");ft.addEventListener("click",()=>at(Oe.scope)),tt.append(ft)}return tt})),ze.style.width=`${ay}px`,oe()}function oe(){U.replaceChildren(...Jr(p).flatMap((ge,Me,He)=>{let dt=re("button",{type:"button",class:`tlx-crumb${Me===He.length-1?" current":""}`,"aria-current":Me===He.length-1?"location":void 0},B(ge.scope,ge.label));return dt.addEventListener("click",()=>{ge.scope!==p&&(p=ge.scope,c=1,D(!0))}),Me?[re("span",{class:"tlx-sep","aria-hidden":"true"},"/"),dt]:[dt]})),ee.setAttribute("aria-pressed",String(m)),ee.classList.toggle("on",m),j.hidden=!m||v;let F=fe(),se=g?.total??0,he=(g?.retention??[]).filter(ge=>ge.events!==null).map(ge=>`${ge.source} kept ${ge.events} d`);Te.textContent=`${sn(y.t0,s)} \u2013 ${sn(y.t1,s)} \xB7 ${F.kind==="single"?"single events":`bins of ${F.bin}`} \xB7 ${se} event${se===1?"":"s"}${K.length?` \xB7 ${K.length} break${K.length===1?"":"s"}`:""}${he.length?` \xB7 ${he.slice(0,3).join(", ")}`:""}`,ae.hidden=!M.length,ae.textContent=M.join(" \xB7 "),Y.textContent=l?T.length?`${S+1>0?`${S+1} of `:""}${T.length}${T.length>=2e3?"+":""} hit${T.length===1?"":"s"}`:`${se?`${se} hit${se===1?"":"s"}`:"no hits"}`:"";for(let ge of H.querySelectorAll(".seg"))ge.classList.remove("on");be.textContent=b===void 0?"":x?(()=>{let ge=e.stamp?.(x)??{};return`Canvas: the state recorded at ${sn(Date.parse(ge.at??"")||b,s)}${ge.tag?` (${ge.tag})`:""}`})():"No state recorded here",be.classList.toggle("none",b!==void 0&&!x)}function Le(){De.replaceChildren();for(let F of f?.sources??[]){let se=!d.source?.length||d.source.includes(F.name),he=re("button",{type:"button",class:`tlx-chip${se?" on":""}${F.status==="not-yet"?" notyet":""}`,"aria-pressed":String(se&&F.status!=="not-yet"),disabled:F.status==="not-yet",title:F.status==="not-yet"?`${F.title}: not kept yet`:`${F.title}${Pe(F)}`},F.name);F.status!=="not-yet"&&he.addEventListener("click",()=>xe(F.name)),De.append(he)}}let Pe=F=>{let se=f?.retention.find(he=>he.source===F.name);return se?` (kept ${se.events===null?"until deleted":`${se.events} days`})`:""};function xe(F){let se=(f?.sources??[]).filter(ge=>ge.status==="kept").map(ge=>ge.name),he=d.source?.length?[...d.source]:[...se];he=he.includes(F)?he.filter(ge=>ge!==F):[...he,F],d={...d,...he.length===se.length?{source:void 0}:{source:he}},d.source||delete d.source,Le(),D(!0),Ue()}let _e=0;pe.addEventListener("input",()=>{clearTimeout(_e),_e=setTimeout(()=>{l=pe.value.trim(),S=-1,D(!0),Ue()},250)}),pe.addEventListener("keydown",F=>{F.key==="Enter"&&(F.preventDefault(),clearTimeout(_e),l=pe.value.trim(),D(!0).then(()=>Ue()).then(()=>mt(F.shiftKey?-1:1)))});async function Ue(){if(!l){T=[],S=-1,oe();return}let F=y.t1-y.t0;T=(await e.source.query(E(y.t0-F*4,Math.max(y.t1+F*4,me()),{kind:"single"},{limit:2e3}))).events??[],S=Math.min(S,T.length-1),oe()}function mt(F){if(!T.length)return;let se=(y.t0+y.t1)/2;S<0?S=F>0?Math.max(0,T.findIndex(Me=>Me.t>=se)):Math.max(0,T.length-1-[...T].reverse().findIndex(Me=>Me.t<=se)):S=(S+F+T.length)%T.length;let he=T[S],ge=Math.min(y.t1-y.t0,2*fr);y={t0:he.t-ge/2,t1:he.t+ge/2},v=!1,$t(he),D()}ie.addEventListener("click",()=>mt(-1)),Ae.addEventListener("click",()=>mt(1)),I.addEventListener("change",()=>{let F=I.value;d={...d,...F?{severity:un.filter(se=>fm(se)>=fm(F))}:{}},F||delete d.severity,D(!0),Ue()});async function ys(F,se=!0){let he=me();if(F==="run"){let ge=await e.source.query({timeline:1,type:"query",scope:p,depth:0,from:he-30*Sn,to:he+1,filters:{kind:["run"]},limit:1e4}).catch(()=>{}),Me=ge?.events?.[ge.events.length-1];y=Me?{t0:Me.t-(Me.dur??fr)*.02,t1:(Me.open?he:Me.t+(Me.dur??fr))+(Me.dur??fr)*.04}:{t0:he-Sn,t1:he+Sn*.02}}else y={t0:he-dm[F],t1:he+dm[F]*.02};v=!0,N.clear(),z.clear(),se&&D()}function kt(F,se=!0){if(m=F,R?.(),R=void 0,F&&e.source.subscribe){let he=0,ge=0;R=e.source.subscribe(E(me()-fr,me()+365*Sn,{kind:"single"}),Me=>{if(f&&(f.now=Math.max(f.now,Me.now)),v){let dt=y.t1-y.t0;y={t0:Me.now-dt*.98,t1:Me.now+dt*.02}}let He=Date.now();He-he>500?(he=He,D(!0)):ge||(ge=setTimeout(()=>{ge=0,he=Date.now(),D(!0)},500))}),v=!0}se&&(oe(),ye())}ee.addEventListener("click",()=>kt(!m)),j.addEventListener("click",()=>{v=!0;let F=y.t1-y.t0,se=me();y={t0:se-F*.98,t1:se+F*.02},D()}),q.addEventListener("click",()=>{ht()}),G.addEventListener("change",()=>{h=G.checked,N.clear(),z.clear(),ue(),ye()}),ce.addEventListener("change",()=>{Q=ce.checked,ue(),ye()});function at(F){let se=g?.rows.find(he=>he.scope===F);p=F,c=se&&se.children===0?0:1,$=void 0,Qe.hidden=!0,D(!0)}async function ht(){let F=me(),he=((await e.source.query({timeline:1,type:"query",scope:p,depth:0,from:F-400*Sn,to:F+1,bin:"1d",tz:s}).catch(()=>{}))?.bins??[]).map(Me=>Me.t),ge=he.length?Math.min(...he):F-7*Sn;y={t0:ge,t1:F+(F-ge)*.02},v=!0,D()}let Ln=0;async function Kt(F){if(b=F,ue(),F===void 0){x=void 0;return}let se=++Ln,he=e.source.stateAt?await e.source.stateAt(p,F).catch(()=>{}):void 0;se===Ln&&(x=he,e.onPlayhead?.(F,he),oe())}async function _t(F,se){$={from:Math.min(F,se),to:Math.max(F,se)},ue();let he=await e.source.query(E($.from,$.to,{kind:"single"},{limit:500})),ge=o(l),Me=Ve=>{let qe=[],zt=0;for(let[Xt,gn]of ro(ge,Ve))qe.push(Ve.slice(zt,Xt),re("mark",null,Ve.slice(Xt,gn))),zt=gn;return qe.push(Ve.slice(zt)),qe},He=(he.events??[]).map(Ve=>{let qe=re("tr",{"data-id":Ve.id,tabindex:"0"},re("td",null,sn(Ve.t,s)),re("td",null,Ve.dur!==void 0?hp(Ve.dur):Ve.open?"still going":""),re("td",null,Ve.source),re("td",null,Ve.kind),re("td",{class:`sev-${Ve.severity}`},Ve.severity),re("td",{class:"tlx-sum"},...Me(Ve.summary)),re("td",{class:"tlx-scope"},Ve.scope));return qe.addEventListener("click",()=>$t(Ve)),qe.addEventListener("keydown",zt=>{zt.key==="Enter"&&$t(Ve)}),qe}),dt=re("button",{type:"button",class:"btn sm quiet","aria-label":"Close the table"},"Close");dt.addEventListener("click",()=>{$=void 0,Qe.hidden=!0,ue()});let ns=Ve=>{let qe=re("button",{type:"button",class:"btn sm","data-export":Ve},Ve.toUpperCase());return qe.addEventListener("click",()=>{Gt(Ve)}),qe};Qe.replaceChildren(re("div",{class:"tlx-table-head"},re("strong",null,`${he.total} event${he.total===1?"":"s"}`),re("span",null,` ${sn($.from,s)} \u2013 ${sn($.to,s)}${he.total>500?" (the first 500 shown; the export has them all)":""}`),re("span",{class:"spacer"}),re("span",null,"Export: "),ns("json"),ns("csv"),dt),re("div",{class:"tlx-table-wrap"},re("table",null,re("thead",null,re("tr",null,...["When","Long","Source","Kind","Severity","What","Scope"].map(Ve=>re("th",{scope:"col"},Ve)))),re("tbody",null,...He)))),Qe.hidden=!1}async function Dt(){if(!$)return[];let F=[],se;do{let he=await e.source.query(E($.from,$.to,{kind:"single"},{limit:1e4,...se?{cursor:se}:{}}));F.push(...he.events??[]),se=he.next}while(se&&F.length<2e5);return F}async function Gt(F){let se=await Dt(),he=F==="json"?ml(se,L):ul(se,L),ge=`timeline-${new Date($.from).toISOString().slice(0,16).replace(/:/g,"")}.${F}`,Me=F==="json"?"application/json":"text/csv";if(e.onExport){e.onExport(ge,he,Me);return}let He=re("a",{href:`data:${Me};charset=utf-8,${encodeURIComponent(he)}`,download:ge});document.body.append(He),He.click(),He.remove()}function $t(F){if(w=F,ue(),!F){Ke.hidden=!0;return}let se=f?.sources.find(qe=>qe.name===F.source),he=new Set(se?.sensitive??[]),ge=o(l),Me=qe=>{let zt=[],Xt=0;for(let[gn,mo]of ro(ge,qe))zt.push(qe.slice(Xt,gn),re("mark",null,qe.slice(gn,mo))),Xt=mo;return zt.push(qe.slice(Xt)),zt},He=(qe,zt)=>{if(!zt)return null;let Xt=re("button",{type:"button",class:"btn sm"},qe);return Xt.addEventListener("click",zt),Xt},dt=Object.entries(F.attrs).map(([qe,zt])=>{if(!he.has(qe))return re("tr",null,re("th",{scope:"row"},qe),re("td",null,...Me(String(zt))));let Xt=re("button",{type:"button",class:"btn sm quiet",title:"This can name a remote host, a folder or free text"},"Show"),gn=re("td",{class:"tlx-sensitive"},"hidden ",Xt);return Xt.addEventListener("click",()=>gn.replaceChildren(String(zt))),re("tr",null,re("th",{scope:"row"},qe),gn)}),ns=re("button",{type:"button",class:"btn sm quiet tlx-close","aria-label":"Close"},"\xD7");ns.addEventListener("click",()=>$t(void 0));let Ve=Jr(F.scope).slice(1).map(qe=>{let zt=re("button",{type:"button",class:"tlx-crumb"},B(qe.scope,qe.label));return zt.addEventListener("click",()=>at(qe.scope)),zt});Ke.replaceChildren(re("div",{class:"tlx-detail-head"},re("strong",null,F.kind),ns),re("p",{class:`tlx-sev sev-${F.severity}`},`${F.severity} \xB7 ${se?.title??F.source}`),re("p",{class:"tlx-sum"},...Me(F.summary)),re("p",null,sn(F.t,s),F.dur!==void 0?` \xB7 ${hp(F.dur)}${F.open?" so far":""}`:F.open?" \xB7 still going":""),re("p",{class:"tlx-crumbs small"},...Ve),...dt.length?[re("table",{class:"tlx-attrs"},re("tbody",null,...dt))]:[],re("div",{class:"tlx-links"},...(e.actions?.(F)??[]).map(([qe,zt])=>He(qe,zt)))),Ke.hidden=!1}function ur(F,se){let he=pr({from:F,to:se});if(!K.find(dt=>dt.from===F&&dt.to===se))return;if(N.add(he),!i){z.set(he,1),ue();return}let Me=performance.now(),He=dt=>{let ns=Math.min(1,(dt-Me)/260);z.set(he,1-(1-ns)**3),Ce(),ns<1&&requestAnimationFrame(He)};requestAnimationFrame(He)}let Zt,Zs=F=>F.clientX-ke.getBoundingClientRect().left;ke.addEventListener("pointerdown",F=>{let se=Zs(F),he=F.clientY-ke.getBoundingClientRect().top,ge=F.target.closest?.(".tlx-cut");if(ge){F.preventDefault(),ur(Number(ge.getAttribute("data-from")),Number(ge.getAttribute("data-to")));return}ke.setPointerCapture(F.pointerId),Zt={kind:he<us||F.shiftKey?"brush":F.target.classList.contains("tlx-handle")?"scrub":"pan",x0:se,t0:J.t(se),v0:y,moved:!1},F.preventDefault(),Ie.focus({preventScroll:!0})}),ke.addEventListener("pointermove",F=>{if(!Zt)return;let se=Zs(F);if(Math.abs(se-Zt.x0)>3&&(Zt.moved=!0),!!Zt.moved)if(Zt.kind==="pan"){let he=(Zt.x0-se)*J.msPerPx;y={t0:Zt.v0.t0+he,t1:Zt.v0.t1+he},v=!1,D()}else Zt.kind==="scrub"?Kt(J.t(se)):($={from:Math.min(Zt.t0,J.t(se)),to:Math.max(Zt.t0,J.t(se))},ue())}),ke.addEventListener("pointerup",F=>{let se=Zt;if(Zt=void 0,!se)return;let he=Zs(F);if(se.kind==="brush"&&se.moved){_t(se.t0,J.t(he));return}if(se.kind==="brush"&&!se.moved){Kt(J.t(he));return}if(se.kind==="pan"&&!se.moved){let ge=F.target.closest?.("[data-id]")?.getAttribute("data-id"),Me=ge?[...g?.events??[],...g?.spans??[]].find(He=>He.id===ge):void 0;Me?($t(Me),Kt(Me.t)):Kt(J.t(he))}}),ke.addEventListener("keydown",F=>{let se=F.target.closest?.(".tlx-cut");se&&(F.key==="Enter"||F.key===" ")&&(F.preventDefault(),ur(Number(se.getAttribute("data-from")),Number(se.getAttribute("data-to"))))}),ke.addEventListener("wheel",F=>{F.preventDefault();let se=Zs(F);if(F.shiftKey||Math.abs(F.deltaX)>Math.abs(F.deltaY)){let he=(F.shiftKey?F.deltaY:F.deltaX)*J.msPerPx;y={t0:y.t0+he,t1:y.t1+he},v=!1}else hr(J.t(se),Math.exp(F.deltaY*.0015),se/pt());D()},{passive:!1});function hr(F,se,he=.5){let ge=Math.min(400*Sn,Math.max(1e4,(y.t1-y.t0)*se));y={t0:F-he*ge,t1:F+(1-he)*ge},N.clear(),z.clear(),se<1&&(v=m&&y.t1>=me())}Ie.addEventListener("keydown",F=>{let se=y.t1-y.t0;if(F.key==="ArrowLeft"||F.key==="ArrowRight"){let he=se*.15*(F.key==="ArrowLeft"?-1:1);y={t0:y.t0+he,t1:y.t1+he},v=!1}else if(F.key==="+"||F.key==="=")hr((y.t0+y.t1)/2,.6);else if(F.key==="-"||F.key==="_")hr((y.t0+y.t1)/2,1/.6);else if(F.key==="n"||F.key==="N"){mt(F.shiftKey?-1:1),F.preventDefault();return}else if(F.key==="Escape")$t(void 0),$=void 0,Qe.hidden=!0;else return;F.preventDefault(),D()}),t.addEventListener("keydown",F=>{F.key==="/"&&document.activeElement!==pe&&!F.target.closest("input, select, textarea")&&(F.preventDefault(),pe.focus())}),Be.addEventListener("scroll",()=>ue(),{passive:!0}),te.addEventListener("click",async()=>{let F=`${Jr(p).slice(-1)[0].label}${l?`: ${l}`:""}`.slice(0,80);await e.saveView?.({...X(),name:F}),await _n()});let We=[];async function _n(){e.views&&(We=await e.views(),V.replaceChildren(re("option",{value:""},"Saved views\u2026"),...We.map((F,se)=>re("option",{value:String(se)},F.name))))}V.addEventListener("change",()=>{let F=We[Number(V.value)];F&&(ne(F),Le(),D(!0)),V.value=""});let yt=typeof ResizeObserver=="function"?new ResizeObserver(()=>ue()):void 0;yt?.observe(Ie);let cn=(async()=>{f=await e.source.catalog(),L=f.sources.flatMap(ge=>(ge.sensitive??[]).map(Me=>`${ge.name}.${Me}`));for(let ge of f.sources)for(let Me of ge.series)Z.set(Me.name,{unit:Me.unit,type:Me.type,title:Me.title,source:ge.name});p=f.hosts.length===1?`host:${f.hosts[0].replace(/[%/:\s]/g,ge=>`%${ge.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`)}`:"";let se=f.now;y={t0:se-Sn,t1:se+Sn*.02};let he=$e()??e.view;he&&ne(he),Le(),await _n(),await D(!0),l&&await Ue()})();return{el:t,ready:cn,get view(){return X()},setView(F){return ne(F),Le(),D(!0)},setRange(F,se){return y={t0:F,t1:se},v=!1,D()},setPlayhead:Kt,setLive:kt,setTheme:a,refresh:()=>D(!0),internal:{get result(){return g},get mode(){return fe()},get scale(){return J},get gaps(){return K},get playState(){return x},get hits(){return T},get selected(){return w},get follow(){return v},openCut:ur,showTable:_t,rangeEvents:Dt,exportRange:Gt,select:$t,stepHit:mt,drill:at,findHits:Ue,paint:Ce,lines:P},dispose(){R?.(),yt?.disconnect(),O&&cancelAnimationFrame(O),t.replaceChildren()}}}var dy={arrow:{d:"M0,0 L10,5 L0,10 z",refX:9},open:{d:"M0,0 L10,5 L0,10 L3,5 z",refX:9},diamond:{d:"M0,5 L5,1.5 L10,5 L5,8.5 z",refX:1}},rn=t=>(Math.round(t*10)/10).toString(),um=t=>(t??"link").replace(/[^\w-]/g,"_");function gl(t,e){let{id:s}=e,r=e.styles??{},i=t.options,o=t.bounds,n=new Map,a=(m,h)=>{let y=r[m]??{},g=h==="start"?y.start??"none":y.end??"arrow";if(g!=="none")return(n.get(m)??n.set(m,new Set).get(m)).add(g),`url(#${s}-mk-${m}-${g})`},f="",p="",c="",l="";for(let m of[...t.panels].sort((h,y)=>h.depth-y.depth)){let h=m.rect,y=m.label?Se("text",{class:"pl",x:m.titleAt[0],y:m.titleAt[1]},vt(m.label)+(m.sub?Se("tspan",{class:"pls",dx:10},vt(m.sub)):"")):"";f+=Se("g",{class:`panel k-${m.role??"grey"}`,"data-id":m.id},Se("rect",{class:"face",x:rn(h.l),y:rn(h.t),width:rn(h.r-h.l),height:rn(h.b-h.t),rx:i.panelRx})+y)}for(let m of t.links){if(!m.points.length)continue;let h=um(m.kind);p+=Se("path",{class:`conn k-${h}`,d:"M"+m.points.map(y=>`${rn(y[0])},${rn(y[1])}`).join(" L"),"data-id":m.id,"data-a":m.a,"data-b":m.b,"marker-start":a(h,"start"),"marker-end":a(h,"end")}),m.at&&(l+=Se("text",{class:`cl k-${h}`,x:m.at.x,y:m.at.y,"text-anchor":m.at.anchor==="start"?void 0:m.at.anchor,"data-for":m.id},vt(m.at.text)))}for(let m of t.cards){let h=m.rect;c+=Se("g",{class:`card k-${m.role??"grey"}${m.ghost?" ghost":""}`,"data-id":m.id,tabindex:0,role:"button","aria-label":m.sub?`${m.label}: ${m.sub}`:m.label},Se("rect",{class:"face",x:rn(h.l),y:rn(h.t),width:i.W,height:i.H,rx:i.cardRx})+Se("text",{class:"lt",x:rn(h.l+14),y:rn(h.t+24)},vt(m.label))+(m.sub?Se("text",{class:"st",x:rn(h.l+14),y:rn(h.t+42)},vt(m.sub)):""))}let d="";for(let[m,h]of n)for(let y of h){let g=dy[y];d+=Se("marker",{id:`${s}-mk-${m}-${y}`,viewBox:"0 0 10 10",refX:g.refX,refY:5,markerWidth:5.4,markerHeight:5.4,orient:"auto-start-reverse"},Se("path",{d:g.d,class:`mk k-${m}`}))}return Se("svg",{xmlns:"http://www.w3.org/2000/svg",class:"flat",viewBox:`${rn(o.l)} ${rn(o.t)} ${rn(o.r-o.l)} ${rn(o.b-o.t)}`,role:"img","aria-label":e.title??"drawing, flat view","data-view":"2d"},(d?Se("defs",{},d):"")+Se("g",{class:"panels"},f)+Se("g",{class:"conns"},p)+Se("g",{class:"cards"},c)+Se("g",{class:"labels"},l))}function hm(t={}){let e=r=>r?r.startsWith("#")||r.includes("(")?r:`var(--${r})`:"var(--ink)",s=`
360
406
  .flat{font-family:inherit}
361
407
  .flat .card{cursor:pointer;outline:none}
362
408
  .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 +420,8 @@ ${e.extraBody??""}
374
420
  .flat .panel.sel .face{stroke:var(--accent,#2f6fd6);stroke-width:2}
375
421
  .flat .conn.hot{stroke-width:3}
376
422
  .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=`
423
+ `;for(let[r,i]of Object.entries(t)){let o=um(r),n=e(i.color);s+=`.flat .conn.k-${o}{stroke:${n}${i.dash?`;stroke-dasharray:${i.dash}`:""}${i.width?`;stroke-width:${i.width}`:""}} .flat .mk.k-${o}{fill:${n}} .flat .cl.k-${o}{fill:${n}}
424
+ `}return s}var fy={name:["card","lt"],sub:["card","st"],title:["panel","pl"],titleSub:["panel","pls"],label:["","cl"]};function bl(t){let e="http://www.w3.org/2000/svg",s=document.createElementNS(e,"svg");s.setAttribute("class","flat"),s.setAttribute("aria-hidden","true"),s.style.cssText="position:absolute;left:-10000px;top:0;width:10px;height:10px;visibility:hidden",t.appendChild(s);let r={};for(let[n,[a,f]]of Object.entries(fy)){let p=document.createElementNS(e,"g");a&&p.setAttribute("class",a);let c=document.createElementNS(e,"text");c.setAttribute("class",f),p.appendChild(c),s.appendChild(p),r[n]=c}let i=new Map,o=((n,a)=>{let f=a+"\0"+n,p=i.get(f);return p===void 0&&(r[a].textContent=n,p=r[a].getComputedTextLength(),i.set(f,p)),p});return o.dispose=()=>s.remove(),o}var ym=(t,e)=>t.cards.find(s=>s.id===e)?.rect??t.panels.find(s=>s.id===e)?.rect;var Gs="http://www.w3.org/2000/svg";function xl(t,e,s){let r=new Map((s?.links??[]).map((i,o)=>[i.id??`link-${o}`,i]));for(let i of e.routes){let o=r.get(i.id),n=o?.a??wn(i.raw.from).id,a=o?.b??wn(i.raw.to).id;for(let f of t.querySelectorAll(`[data-id="${CSS.escape(i.id)}"]`))f.setAttribute("data-a",n),f.setAttribute("data-b",a)}}var my=(t="auto")=>t==="always"||t==="auto"&&!(typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches);function wm(t,e,s,r,i={}){let o=i.duration??600;if(!o||!my(i.motion))return;let n=ao(t,e,s,r);t.appendChild(n.svg),n.at(0);let a=0,f=!1,p,c=new Promise(h=>p=h),l=()=>{f||(f=!0,cancelAnimationFrame(a),n.svg.remove(),p())},d=performance.now(),m=h=>{if(f)return;let y=Math.min(1,(h-d)/o);n.at(y),y<1?a=requestAnimationFrame(m):l()};return a=requestAnimationFrame(m),{done:c,finish:l}}var Ps=t=>Math.max(0,Math.min(1,t)),oo=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2;function wl(t){let e=t.cloneNode(!0),s=[t,...t.querySelectorAll("*")],r=[e,...e.querySelectorAll("*")];return s.forEach((i,o)=>{let n=getComputedStyle(i),a=r[o];a.removeAttribute("class"),a.removeAttribute("tabindex");for(let f of["fill","fill-opacity","stroke","stroke-width","stroke-dasharray","stroke-opacity","opacity","font-size","font-weight","font-family","letter-spacing","paint-order","stroke-linejoin","text-anchor"])a.style.setProperty(f,n.getPropertyValue(f))}),e}var bp=(t,e)=>{let s=t.getBoundingClientRect();return{x:s.left-e.left,y:s.top-e.top,w:s.width,h:s.height}},gm=t=>{let e=Math.min(...t.map(o=>o.x)),s=Math.min(...t.map(o=>o.y)),r=Math.max(...t.map(o=>o.x+o.w)),i=Math.max(...t.map(o=>o.y+o.h));return{x:e,y:s,w:r-e,h:i-s}},uy=(t,e)=>{let s=t.getScreenCTM();return`matrix(${s.a} ${s.b} ${s.c} ${s.d} ${s.e-e.left} ${s.f-e.top})`},bm=(t,e,s)=>{let r=1+(e.w/Math.max(t.w,1e-6)-1)*s,i=1+(e.h/Math.max(t.h,1e-6)-1)*s,o=(e.x-t.x*(e.w/Math.max(t.w,1e-6)))*s,n=(e.y-t.y*(e.h/Math.max(t.h,1e-6)))*s;return`matrix(${r} 0 0 ${i} ${o} ${n})`};function hy(t,e){let s=t.querySelector("polygon.top");if(!s)return;let r=s.getScreenCTM(),i=[];for(let o=0;o<s.points.numberOfItems;o++){let n=s.points.getItem(o);i.push([r.a*n.x+r.c*n.y+r.e-e.left,r.b*n.x+r.d*n.y+r.f-e.top])}return i.length===4?{pts:i,fill:getComputedStyle(s).fill}:void 0}function ao(t,e,s,r){let i=t.getBoundingClientRect(),o=document.createElementNS(Gs,"svg");o.setAttribute("class","dual-morph"),o.setAttribute("aria-hidden","true"),o.style.cssText=`position:absolute;left:0;top:0;width:${i.width}px;height:${Math.max(i.height,e.getBoundingClientRect().height,s.getBoundingClientRect().height)}px;overflow:visible;pointer-events:none`;let n=w=>{let $=document.createElementNS(Gs,"g");return $.setAttribute("transform",uy(w,i)),$},a=w=>w.hasAttribute("data-a")||w.hasAttribute("data-for"),f=w=>{let $=new Map;for(let v of w.querySelectorAll("[data-id]")){if(a(v)||v.parentElement?.closest("[data-id]")||v.closest(".overlay"))continue;let O=v.getAttribute("data-id");($.get(O)??$.set(O,[]).get(O)).push(v)}return $},p=f(e),c=f(s),l=document.createElementNS(Gs,"g"),d=document.createElementNS(Gs,"g"),m=n(e),h=n(s);for(let w of e.querySelectorAll("[data-a],[data-for]"))w.closest(".overlay")||m.appendChild(wl(w));for(let w of s.querySelectorAll("[data-a],[data-for]"))w.closest(".overlay")||h.appendChild(wl(w));l.appendChild(m),d.appendChild(h);let y=[...h.querySelectorAll("path")].map(w=>{let $=w.getTotalLength?.()??0;return{p:w,len:$}}),g=[...h.children].filter(w=>w.tagName.toLowerCase()==="text"),k=[...(r==="2d"?p:c).keys()],u=[],b=document.createElementNS(Gs,"g");for(let w of new Set([...k,...p.keys(),...c.keys()])){let $=p.get(w),v=c.get(w),O={};if($){O.a=gm($.map(N=>bp(N,i)));let T=document.createElementNS(Gs,"g"),S=n(e);for(let N of $)S.appendChild(wl(N));T.appendChild(S),O.src=T}if(v){O.b=gm(v.map(N=>bp(N,i)));let T=document.createElementNS(Gs,"g"),S=n(s);for(let N of v)S.appendChild(wl(N));T.appendChild(S),O.dst=T}let C=r==="3d"?$?.[0]:v?.[0],A=r==="3d"?v?.[0]:$?.[0],R=C?hy(C,i):void 0,M=A?.querySelector("rect.face");if(R&&M){let T=bp(M,i),S=[[T.x,T.y],[T.x+T.w,T.y],[T.x+T.w,T.y+T.h],[T.x,T.y+T.h]],N=R.pts.reduce((L,U,H)=>U[0]<R.pts[L][0]?H:L,0),z=[...R.pts.slice(N),...R.pts.slice(0,N)],K=[z[0],z[1],z[2],z[3]],J=getComputedStyle(M).fill,Z=document.createElementNS(Gs,"polygon");O.face=Z,O.faceFrom=r==="3d"?K:S,O.faceTo=r==="3d"?S:K,O.faceFill=r==="3d"?[R.fill,J]:[J,R.fill]}O.src&&b.appendChild(O.src),O.face&&b.appendChild(O.face),O.dst&&b.appendChild(O.dst),u.push(O)}o.append(l,b,d);let x=(w,$,v)=>`color-mix(in srgb, ${w} ${Math.round((1-v)*100)}%, ${$})`;return{svg:o,at(w){let $=Ps(w/.2),v=oo(Ps((w-.2)/.6)),O=Ps((w-.8)/.2);l.setAttribute("opacity",String(1-$));for(let{p:C,len:A}of y)C.style.strokeDasharray=`${A} ${A}`,C.style.strokeDashoffset=String(A*(1-O));d.setAttribute("opacity",String(O>0?1:0));for(let C of g)C.style.opacity=String(O);for(let C of u)if(C.src&&(C.src.setAttribute("transform",C.a&&C.b?bm(C.a,C.b,v):""),C.src.setAttribute("opacity",String(C.b?1-Ps(v/(C.face?.35:.6)):1-v))),C.dst&&(C.dst.setAttribute("transform",C.a&&C.b?bm(C.b,C.a,1-v):""),C.dst.setAttribute("opacity",String(C.a?Ps((v-(C.face?.65:.4))/(C.face?.35:.6)):v))),C.face){let A=C.faceFrom.map((R,M)=>[R[0]+(C.faceTo[M][0]-R[0])*v,R[1]+(C.faceTo[M][1]-R[1])*v]);C.face.setAttribute("points",A.map(R=>R.join(",")).join(" ")),C.face.style.fill=x(C.faceFill[0],C.faceFill[1],v),C.face.setAttribute("opacity",String(v<.08?v/.08:v>.92?(1-v)/.08:1))}}}}var yy=0;function xm(t,e,s={}){let r=`dv${++yy}`,i=document.createElement("div");i.className="dual-view",i.style.position="relative",t.appendChild(i);let o=document.createElement("div"),n=document.createElement("div");o.className="dual-3d",n.className="dual-2d",i.append(o,n),o.innerHTML=e.rendered.svg;let a=o.querySelector("svg");a.setAttribute("data-view","3d");let f=s.board??Wa(e);xl(a,e,f);let p=new Set(e.routes.map(A=>A.id));for(let A of a.querySelectorAll("g[data-id]")){let R=A.getAttribute("data-id");p.has(R)||A.hasAttribute("tabindex")||!A.querySelector("polygon")||(A.setAttribute("tabindex","0"),A.setAttribute("role","button"),A.setAttribute("aria-label",R))}let c=bl(n),l=Hr(f,c,s.flat);c.dispose(),n.innerHTML=gl(l,{id:r,title:s.title,styles:s.styles});let d=n.querySelector("svg");for(let A of[a,d])A.style.display="block",A.style.width="100%",A.style.height="auto";s.title&&a.setAttribute("aria-label",s.title);let m=s.mode??"3d",h,y=A=>A==="3d"?o:n,g=A=>A==="3d"?a:d,k=A=>{o.hidden=A!=="3d",n.hidden=A!=="2d";for(let R of[o,n])R.style.cssText="";i.style.height="",i.dataset.mode=A};k(m);let u=()=>{for(let A of[a,d]){for(let R of A.querySelectorAll("[data-id]"))R.classList.toggle("sel",!!h&&R.getAttribute("data-id")===h);for(let R of A.querySelectorAll("[data-a]")){let M=!!h&&(R.getAttribute("data-a")===h||R.getAttribute("data-b")===h);R.classList.toggle("hot",M),R.classList.toggle("dim",!!h&&!M),A.querySelector(`[data-for="${CSS.escape(R.getAttribute("data-id")??"")}"]`)?.classList.toggle("dim",!!h&&!M)}}},b=A=>{h=A,u()},x=A=>{let R=A.target.closest?.("[data-id]");if(!R||!i.contains(R)||R.hasAttribute("data-a"))return;let M=R.getAttribute("data-id");b(M),s.onSelect?.(M)},w=A=>{(A.key==="Enter"||A.key===" ")&&A.target.matches?.("[data-id][tabindex]")&&(A.preventDefault(),x(A))};i.addEventListener("click",x),i.addEventListener("keydown",w);let $,v=()=>{if(!$)return;cancelAnimationFrame($.frame),$.layer.remove();let A=$;$=void 0,m=A.to,k(m),u(),A.done()},O=A=>{!A||!h||g(m).querySelector(`[data-id="${CSS.escape(h)}"][tabindex]`)?.focus({preventScroll:!0})};return{get mode(){return $?$.to:m},layout:l,root:i,morph:A=>{let R=i.contains(document.activeElement);if($&&v(),A===m)return O(R),Promise.resolve();let M=s.motion??"auto";return M==="never"||M==="auto"&&typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches||!(s.duration??600)?(m=A,k(m),u(),O(R),Promise.resolve()):new Promise(S=>{let N=m,z=i.getBoundingClientRect().height;o.hidden=!1,n.hidden=!1;for(let ee of[o,n])ee.style.cssText="position:absolute;left:0;top:0;right:0;visibility:hidden";let K=y(A).getBoundingClientRect().height;i.style.height=`${z}px`;let J=ao(i,g(N),g(A),N);i.appendChild(J.svg);let Z=s.duration??600,L=performance.now(),U={frame:0,layer:J.svg,to:A,done:()=>{O(R),S()}},H=ee=>{if($!==U)return;let j=Math.min(1,(ee-L)/Z);J.at(j),i.style.height=`${z+(K-z)*oo(Ps((j-.2)/.6))}px`,j<1?U.frame=requestAnimationFrame(H):v()};$=U,U.frame=requestAnimationFrame(H)})},select:b,get selected(){return h},svgOf:g,destroy(){$&&v(),i.removeEventListener("click",x),i.removeEventListener("keydown",w),i.remove()}}}function km(t="iso-view"){try{let e=localStorage.getItem(t);return e==="2d"||e==="3d"?e:void 0}catch{return}}function $m(t,e,s={}){let r=s.storageKey??"iso-view",i=Array.isArray(e)?e:[e],o=document.createElement("div");o.className="view-switch",o.setAttribute("role","group"),o.setAttribute("aria-label","Drawing view");let n=["3d","2d"].map((f,p)=>{let c=document.createElement("button");return c.type="button",c.dataset.mode=f,c.textContent=(s.labels??["3D","2D"])[p],c.addEventListener("click",()=>{try{localStorage.setItem(r,f)}catch{}a(f);for(let l of i)l.morph(f)}),o.appendChild(c),c}),a=f=>n.forEach(p=>p.setAttribute("aria-pressed",String(p.dataset.mode===f)));return a(i[0]?.mode??"3d"),t.appendChild(o),o}var Sm=`
379
425
  .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
426
  .view-switch button{font:inherit;border:0;background:none;color:var(--ink);padding:6px 10px;cursor:pointer}
381
427
  .view-switch button+button{border-left:1px solid var(--line)}
@@ -385,5 +431,7 @@ ${e.extraBody??""}
385
431
  .dual-view .blk.sel polygon{stroke:var(--accent,#2f6fd6);stroke-width:2.4}
386
432
  .dual-view [data-a].dim{opacity:.3}
387
433
  .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};
434
+ `;var Fm={};ho(Fm,{BASE_CSS:()=>Om,CompileError:()=>fo,DRAWING_CSS:()=>Pm,NODE_ASSETS:()=>lo,REGION_KINDS:()=>wp,compile:()=>Ml,getAsset:()=>Mm,renderSvg:()=>_m,systems:()=>ts});var gy={name:"volume",description:"Stored data that is kept: a drum with two bands (a volume, a room's history, an archive).",size:[1.8,1.8,1.3],role:"folder",draw(t,e){let[s,r]=Hs(e),i=Math.min(e.x1-e.x0,e.y1-e.y0)/2,o=(c,l)=>[s+i*Math.cos(c*Math.PI/180),r+i*Math.sin(c*Math.PI/180),l],n=(c,l,d)=>Array.from({length:13},(m,h)=>o(c+(l-c)*h/12,d)),a=(c,l,d)=>t.poly([...n(c,l,e.z0),...n(c,l,e.z1).reverse()],d),f=e.z1-e.z0,p=c=>n(-45,135,c).slice(1).map((l,d,m)=>t.line3(d?m[d-1]:o(-45,c),l,"det")).join("");return a(45,135,"lft")+a(-45,45,"rgt")+p(e.z0+f*.36)+p(e.z0+f*.68)+t.poly(Array.from({length:32},(c,l)=>o(l*360/32,e.z1)),"top")}},by={name:"orb",description:"An agent: a white sphere with two eyes, on a small plate.",size:[1.5,1.5,1.6],role:"lead",cls:"orb",draw(t,e){t.def("orbG",Se("radialGradient",{id:"orbG",cx:"0.36",cy:"0.30",r:"0.80"},Se("stop",{offset:"0",style:"stop-color:#ffffff"})+Se("stop",{offset:"0.62",style:"stop-color:#f6f6f4"})+Se("stop",{offset:"1",style:"stop-color:#cfd0d6"})));let s=Li(e),[r,i]=Ne((e.x0+e.x1)/2,(e.y0+e.y1)/2,s.z1),o=23,n=i-o+3;t.bounds.add([r-o,n-o]),t.bounds.add([r+o,n+o]);let a=(f,p,c,l)=>Se("rect",{class:"eye",x:r+f-c/2,y:n+p-l/2,width:c,height:l,rx:c/2,transform:`rotate(-24 ${(r+f).toFixed(1)} ${(n+p).toFixed(1)})`});return t.blockFaces(s)+Se("ellipse",{class:"shade",cx:r,cy:i+1,rx:o*.8,ry:o*.3})+Se("circle",{class:"ball",cx:r,cy:n,r:o})+a(3,-7,6.4,13.5)+a(14,-12,5.4,10.5)},label(t,e,s){let[r,i]=Ne((t.x0+t.x1)/2,(t.y0+t.y1)/2,t.z0+1.95);return{x:r,y:i-26+(s?0:14),anchor:"middle"}},pulse:t=>[(t.x0+t.x1)/2,(t.y0+t.y1)/2,t.z0+.8,26]},wy={name:"person",description:"A human: body and head on a small plate. The label sits to the right.",size:[1.5,1.5,1.6],role:"person",cls:"person",draw(t,e){let s=Li(e),[r,i]=Ne((e.x0+e.x1)/2,(e.y0+e.y1)/2,s.z1);t.bounds.add([r-13,i-50]);let o=n=>n.toFixed(1);return t.blockFaces(s)+Se("path",{class:"body",d:`M${o(r-13)},${o(i-4)} C${o(r-13)},${o(i-34)} ${o(r+13)},${o(i-34)} ${o(r+13)},${o(i-4)} Q${o(r)},${o(i+4)} ${o(r-13)},${o(i-4)}z`})+Se("circle",{class:"head",cx:r,cy:i-40,r:10})},label(t){let[e,s]=Ne((t.x0+t.x1)/2,(t.y0+t.y1)/2,t.z0);return{x:e+30,y:s+2,anchor:"start"}},pulse:t=>[(t.x0+t.x1)/2,(t.y0+t.y1)/2,t.z0+.9,26]},xy={name:"screen",description:"An upright screen or terminal panel. `face`: terminal, chat, desktop, tiles, or one the host registers. `facing`: turn in degrees.",size:[1.64,.3,1.75],role:"term",draw(t,e,s){let[r,i]=Hs(e),o=(e.x1-e.x0)/2,n=e.z1-e.z0,a=.14,f=(s.facing??0)*Math.PI/180,p=Math.cos(f),c=Math.sin(f),l=Math.sin(f)*a,d=-Math.cos(f)*a,m=[r-p*o,i-c*o],h=[r+p*o,i+c*o],y=e.z0,g=e.z1,k=t.poly([[h[0],h[1],y],[h[0]+l,h[1]+d,y],[h[0]+l,h[1]+d,g],[h[0],h[1],g]],"rgt")+t.poly([[m[0],m[1],g],[h[0],h[1],g],[h[0]+l,h[1]+d,g],[m[0]+l,m[1]+d,g]],"top")+t.poly([[m[0],m[1],y],[h[0],h[1],y],[h[0],h[1],g],[m[0],m[1],g]],"lft"),u=Ne(m[0],m[1],g),b=Ne(h[0],h[1],g),x=2*o*lt,w=n*lt,$=[(b[0]-u[0])/x,(b[1]-u[1])/x,0,1,u[0],u[1]],v=tr(s.face??"terminal")??di;return k+=t.onMatrix($,x,w,(O,C)=>fi(O,C)+v(O,C),"scr"),k}},ky={name:"monitor",description:"A block with a screen painted on its front-left face. `face` as for screen.",size:[2.4,.8,1.8],role:"term",draw(t,e,s){let r=tr(s.face??"terminal")??di;return t.blockFaces(e)+t.onFace(e,"left",(i,o)=>fi(i,o)+r(i,o),"scr")}},$y={name:"cloud",description:"A cloud lying on the floor: the internet, or a hosted service.",size:[3,2.4,.3],role:"cloud",draw:(t,e)=>Er(t,e)},lo={block:an("block","A box. Size and colour role are free; add decorations with `deco`.",[2.4,2.4,1.6],"grey"),session:an("session","An agent session: a box with terminal lines (`deco: [terminal: 4]`; add an icon the host registers with `icon: NAME`).",[2.6,2.6,1.8],"work",[{terminal:4}]),terminal:an("terminal","A box with terminal lines on its front.",[1.6,1.2,.8],"term",[{terminal:2}]),server:an("server","A service or daemon: a low box with two terminal lines.",[3,2.2,.9],"doz",[{terminal:2}]),chat:an("chat","A chat server or room: a box with a chat bubble on top.",[3.6,4.4,1.3],"chat",["bubble"]),mailbox:an("mailbox","A room or inbox: terminal lines and an envelope on top.",[2.4,2.4,1.6],"mail",[{terminal:3},"envelope"]),file:an("file","A file or document: a low box with lines on top.",[1.6,1.6,.6],"file",["file-lines"]),folder:an("folder","A folder or directory: a flat box.",[1.6,1.6,.5],"folder"),key:an("key","A secret: a low box with a key on top.",[1.6,1.6,.6],"key",[],(t,e)=>wo(t,e)),socket:an("socket","A socket: a small box with a round opening on top.",[1.2,1.2,.5],"socket",[],(t,e)=>xo(t,e)),gate:an("gate","A gate or proxy: a narrow upright slab, usually set in a fence wall.",[.3,2,1.1],"gate"),placeholder:an("placeholder","A placeholder value: a small low box with lines.",[1.2,1,.45],"placeholder",["file-lines"]),orb:by,person:wy,screen:xy,monitor:ky,cloud:$y,volume:gy};function Mm(t){return lo[t??"block"]}var Sy="border-color:hsl(38 80% 45%);background:hsl(38 80% 55% / .2)",wp={slab:{shape:"slab",pad:1.2,z:[-.8,.35],floor:!0,role:"slab",labelStyle:"face"},pad:{shape:"block",pad:.6,z:[0,.2],floor:!0,role:"pad",labelStyle:"floor"},fence:{shape:"walled",pad:.7,z:[0,.8],floor:!1,role:"fence",labelStyle:"face",legend:{label:"Fence",swatch:Sy,box:!0,auto:!0},css:`.fz{fill:var(--fence-text)!important;opacity:1!important}
435
+ `},vm:{shape:"block",pad:.6,z:[0,.45],floor:!0,role:"sandbox",labelStyle:"face",legend:{label:"Sandbox VM",swatch:"border-color:hsl(170 35% 40%);background:hsl(170 40% 50% / .2)",box:!0,auto:!0}},platform:{shape:"block",pad:.6,z:[0,.7],floor:!0,role:"server",labelStyle:"face-right"},cloud:{shape:"cloud",pad:.8,z:[0,.2],floor:!0,role:"cloud",labelStyle:"floor"},zone:{shape:"zone",pad:.5,z:[0,.005],floor:!1,role:"grey",labelStyle:"floor"},tunnel:{shape:"tunnel",pad:0,z:[0,.8],floor:!1,role:"socket",labelStyle:"none",legend:{label:"Tailscale tunnel",swatch:"border-color:hsl(205 70% 50%);border-top-width:9px;opacity:.35",box:!1,auto:!1}}},ts={regions:wp,nodes:lo,defaultNode:"block"};var Pm=ar(ts),Om=Ur(ts);var Tm=$l,rt={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://isodiag.local/schema/isodiag-1.json",title:"isodiag diagram",description:"A page of isometric, animated diagrams. See docs/FORMAT.md.",type:"object",required:["isodiag","scenes"],additionalProperties:!1,properties:{isodiag:{const:1,description:"Format version. Always 1."},title:{type:"string"},lede:{type:"string"},pills:{type:"array",items:{type:"string"}},theme:{type:"string",description:"'default' or a path to a theme file"},roles:{type:"object",description:"Extra or changed colour roles for nodes and regions",additionalProperties:{$ref:"#/$defs/role"}},kinds:{type:"object",description:"Extra flow kinds, or new legend text for the standard ones",additionalProperties:{$ref:"#/$defs/kindDef"}},after:{type:"string",description:"Markdown shown after all scenes"},grid:{$ref:"#/$defs/grid"},assemble:{type:"boolean",description:"draw each scene by flying its parts in from the nearest edge, then play"},footer:{type:"string"},treatment:{enum:["mono"],description:"How a self-contained drawing (renderSvg, <isometric-diagram>) is painted: mono, black and white. A host may say otherwise. The page isodiag build writes is in colour."},scenes:{type:"array",minItems:1,items:{$ref:"#/$defs/scene"}}},$defs:{motion:{type:"object",additionalProperties:!1,minProperties:1,description:"how this piece (a region: its contents too) moves when the drawing assembles or disassembles",properties:{style:{enum:["edge","drop","rise","fly","pop","scatter","build","fade"],description:"how it arrives"},out:{enum:["explode","lift-off","sink","scatter","fly-out","collapse","fade","reverse"],description:"how it leaves"},easing:{enum:["linear","ease","ease-in","ease-out","settle","spring","bounce"]},from:{enum:["left","right","top","bottom"],description:"fly: the side it comes from"},delay:{type:"number",minimum:0,description:"ms after its turn"},duration:{type:"number",exclusiveMinimum:0,description:"ms its own move takes"}}},variants:{type:"object",minProperties:1,propertyNames:{$ref:"#/$defs/id"},description:"other looks of it, by name, for a motion to switch to (its box stays as it is)",additionalProperties:{type:"object",additionalProperties:!1,minProperties:1,properties:{role:{type:"string"},ghost:{type:"boolean"},label:{type:"string"},sub:{type:"string"},face:{type:"string",pattern:"^[a-z][a-z0-9-]*$"},deco:{type:"array",items:{$ref:"#/$defs/deco"}}}}},id:{type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},grid:{type:"object",additionalProperties:!1,properties:{snap:{type:"number",exclusiveMinimum:0,description:"round every placed edge and route waypoint to this step, in grid units"},show:{type:"boolean",description:"draw the floor grid when the page opens (the Grid button toggles it)"},step:{type:"number",exclusiveMinimum:0,description:"spacing of the drawn grid lines; default the snap step, or 1"}}},num:{type:"number"},point2:{type:"array",items:{type:"number"},minItems:2,maxItems:2},size2or3:{type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:3},stepRef:{anyOf:[{type:"string"},{type:"integer",minimum:1}]},side:{enum:["n","e","s","w"]},align:{enum:["start","center","end"]},role:{type:"object",additionalProperties:!1,required:["h","s"],properties:{h:{type:"number",minimum:0,maximum:360,description:"hue"},s:{type:"number",minimum:0,maximum:100,description:"saturation, percent"},top:{type:"string",description:"CSS colour for the top face, overriding the computed one"},tint:{type:"number",minimum:0,maximum:100,description:"percent of the role colour mixed into the pad colour for the top face"}}},kindDef:{type:"object",additionalProperties:!1,properties:{legend:{type:"string"},like:{type:"string",description:"a standard kind whose colour and line style this one uses"},color:{type:"string"},dash:{enum:["solid","dashed","dotted"]}}},placement:{properties:{in:{$ref:"#/$defs/id"},at:{$ref:"#/$defs/point2"},"right-of":{$ref:"#/$defs/id"},"left-of":{$ref:"#/$defs/id"},below:{$ref:"#/$defs/id"},behind:{$ref:"#/$defs/id"},gap:{type:"number"},align:{$ref:"#/$defs/align"},shift:{$ref:"#/$defs/point2",description:"nudge after placement, grid units [dx, dy]"},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},scene:{type:"object",required:["id","title"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},title:{type:"string"},ants:{description:"its connectors march, showing which way they flow: all that may, these, or with a speed (units a second) and a dash",anyOf:[{type:"boolean"},{type:"array",items:{type:"string"}},{type:"object",additionalProperties:!1,properties:{ids:{type:"array",items:{type:"string"}},speed:{type:"number"},dash:{type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:2}}}]},motion:{type:"object",description:"the scene's motion document (isomotion/1; its `isomotion: 1` may be left out)"},caption:{type:"string"},aria:{type:"string"},gap:{type:"number",exclusiveMinimum:0},flow:{enum:["row","column"]},regions:{type:"array",items:{$ref:"#/$defs/region"}},nodes:{type:"array",items:{$ref:"#/$defs/node"}},routes:{type:"array",items:{$ref:"#/$defs/route"}},notes:{type:"array",items:{$ref:"#/$defs/note"}},steps:{type:"array",items:{$ref:"#/$defs/step"}},legend:{anyOf:[{enum:["auto"]},{const:!1},{type:"array",items:{type:"string"}}]},badges:{type:"boolean"},grid:{$ref:"#/$defs/grid"},assemble:{type:"boolean",description:"draw the scene by flying its parts in from the nearest edge, then play"},loop:{type:"boolean",description:"the player wraps from the last step to the first (default true)"},dim:{enum:["flows","all"],description:"what a step dims: only flows, their labels and marks (default), or nodes too"},after:{type:"string"}}},region:{type:"object",required:["id","kind"],unevaluatedProperties:!1,allOf:[{$ref:"#/$defs/placement"}],properties:{id:{$ref:"#/$defs/id"},kind:{enum:["slab","pad","fence","vm","cloud","zone","platform","tunnel"]},label:{type:"string"},"label-style":{enum:["face","face-right","floor","none"]},ghost:{type:"boolean",description:"drawn as a dashed outline: not there yet, out of reach, or stopped"},role:{type:"string"},size:{$ref:"#/$defs/size2or3"},padding:{type:"number",minimum:0},height:{type:"number",exclusiveMinimum:0},z:{type:"number",description:"lift above the floor it stands on (tunnels)"},flow:{enum:["row","column"]},gate:{type:"object",additionalProperties:!1,required:["side"],properties:{side:{$ref:"#/$defs/side"},at:{type:"number",minimum:0,maximum:1,description:"centre of the gate along the wall, 0..1"},width:{type:"number",exclusiveMinimum:0},height:{type:"number",exclusiveMinimum:0},node:{$ref:"#/$defs/id"}}},around:{type:"array",items:{$ref:"#/$defs/id"},description:"tunnel: routes it wraps"},regions:{type:"array",items:{$ref:"#/$defs/region"}},motion:{$ref:"#/$defs/motion"},variants:{$ref:"#/$defs/variants"},nodes:{type:"array",items:{$ref:"#/$defs/node"}}}},deco:{anyOf:[{enum:["envelope","bubble","file-lines","ghost","terminal"]},{type:"object",additionalProperties:!1,minProperties:1,maxProperties:1,properties:{terminal:{type:"integer",minimum:1,maximum:8},icon:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"an icon the host registers (none by default); one nothing registers is drawn as a placeholder, with a warning"},screen:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"terminal, chat, desktop, tiles, or a face the host registers"}}}]},node:{type:"object",required:["id"],unevaluatedProperties:!1,allOf:[{$ref:"#/$defs/placement"}],properties:{id:{$ref:"#/$defs/id"},asset:{type:"string",description:"asset name from the library; default 'block'"},role:{type:"string",description:"colour role"},label:{type:"string"},sub:{type:"string"},size:{$ref:"#/$defs/size2or3"},z:{type:"number",description:"lift above the floor it stands on"},deco:{type:"array",items:{$ref:"#/$defs/deco"}},ghost:{type:"boolean"},face:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"screen asset: what the screen shows: terminal, chat, desktop, tiles, or a face the host registers"},facing:{type:"number",description:"screen asset: rotation in degrees"},"label-at":{type:"object",additionalProperties:!1,properties:{side:{enum:["above","right","left","below"]},dx:{type:"number"},dy:{type:"number"}}},motion:{$ref:"#/$defs/motion"},variants:{$ref:"#/$defs/variants"},nodes:{type:"array",items:{$ref:"#/$defs/node"},description:"nodes standing on top of this one"}}},endpoint:{type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"},route:{type:"object",required:["id","from","to"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},from:{$ref:"#/$defs/endpoint"},to:{$ref:"#/$defs/endpoint"},kind:{type:"string"},via:{type:"array",items:{anyOf:[{$ref:"#/$defs/point2"},{$ref:"#/$defs/endpoint"}]}},points:{type:"array",items:{type:"array",items:{type:"number"},minItems:2,maxItems:3},description:"exact polyline in grid units; skips the router"},lane:{type:"number"},arrow:{type:"boolean"},cross:{type:"boolean",description:"the route may pass through fence walls (it crosses a boundary)"},label:{anyOf:[{type:"string"},{type:"object",additionalProperties:!1,required:["text"],properties:{text:{type:"string"},along:{type:"integer",minimum:1},side:{enum:["left","right"]},at:{type:"array",items:{type:"number"},minItems:2,maxItems:3,description:"exact place [x, y] or [x, y, z]; skips placement"},dir:{enum:["x","y"]},anchor:{enum:["start","middle","end"]}}}]},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},note:{type:"object",additionalProperties:!1,properties:{floor:{type:"string"},face:{type:"string"},label:{type:"string"},sub:{type:"string"},at:{anyOf:[{$ref:"#/$defs/point2"},{type:"array",items:{type:"number"},minItems:3,maxItems:3}]},on:{$ref:"#/$defs/id",description:"a node, region or route; a note on a route dims and lights with it"},kind:{type:"string"},dir:{enum:["x","y"]},anchor:{enum:["start","middle","end"]},dx:{type:"number"},dy:{type:"number"},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},routeRef:{anyOf:[{type:"string"},{type:"object",minProperties:1,maxProperties:1,additionalProperties:{type:"string"}}]},phase:{anyOf:[{$ref:"#/$defs/routeRef"},{type:"array",items:{$ref:"#/$defs/routeRef"}}]},step:{type:"object",required:["heading"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},number:{type:"integer",minimum:1,description:"the number shown; defaults to the position"},kind:{type:"string"},heading:{type:"string"},caption:{type:"string"},command:{type:"string"},animate:{type:"array",items:{$ref:"#/$defs/phase"}},pulse:{type:"array",items:{$ref:"#/$defs/id"}},highlight:{type:"array",items:{$ref:"#/$defs/id"}},focus:{type:"array",items:{$ref:"#/$defs/id"},description:"nodes or regions to zoom to for this step; the view eases back on steps without focus"},show:{type:"array",items:{$ref:"#/$defs/id"}},hide:{type:"array",items:{$ref:"#/$defs/id"}},say:{type:"array",items:{type:"object",additionalProperties:!1,required:["at","text"],properties:{at:{anyOf:[{$ref:"#/$defs/id"},{type:"array",items:{type:"number"},minItems:2,maxItems:3}],description:"a node (the callout sits above it) or a grid point [x, y, z]"},text:{type:"string"},kind:{type:"string"},dx:{type:"number"},dy:{type:"number"},anchor:{enum:["start","middle","end"]}}}},mark:{type:"array",items:{type:"object",additionalProperties:!1,properties:{on:{$ref:"#/$defs/id"},at:{type:"array",items:{type:"number"},minItems:2,maxItems:3}}}},badge:{anyOf:[{type:"boolean"},{$ref:"#/$defs/id"},{type:"array",items:{type:"number"},minItems:2,maxItems:3}],description:"false, a route or node id, or a grid point [x, y, z]"},duration:{anyOf:[{const:"auto"},{type:"integer",minimum:500}]}}}}},Lt={type:"object",additionalProperties:!1,required:["h","s"],properties:{h:{type:"number",minimum:0,maximum:360,description:"hue"},s:{type:"number",minimum:0,maximum:100,description:"saturation, percent"},top:{type:"string",description:"CSS colour for the top face, overriding the computed one"},tint:{type:"number",minimum:0,maximum:100,description:"percent of the role colour mixed into the pad colour for the top face"}}},jn={type:"object",additionalProperties:!1,properties:{legend:{type:"string"},like:{type:"string",description:"a standard kind whose colour and line style this one uses"},color:{type:"string"},dash:{enum:["solid","dashed","dotted"]}}},Rt={type:"object",additionalProperties:!1,properties:{snap:{type:"number",exclusiveMinimum:0,description:"round every placed edge and route waypoint to this step, in grid units"},show:{type:"boolean",description:"draw the floor grid when the page opens (the Grid button toggles it)"},step:{type:"number",exclusiveMinimum:0,description:"spacing of the drawn grid lines; default the snap step, or 1"}}},co=Object.prototype.hasOwnProperty,ve={type:"object",required:["id","title"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},title:{type:"string"},ants:{description:"its connectors march, showing which way they flow: all that may, these, or with a speed (units a second) and a dash",anyOf:[{type:"boolean"},{type:"array",items:{type:"string"}},{type:"object",additionalProperties:!1,properties:{ids:{type:"array",items:{type:"string"}},speed:{type:"number"},dash:{type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:2}}}]},motion:{type:"object",description:"the scene's motion document (isomotion/1; its `isomotion: 1` may be left out)"},caption:{type:"string"},aria:{type:"string"},gap:{type:"number",exclusiveMinimum:0},flow:{enum:["row","column"]},regions:{type:"array",items:{$ref:"#/$defs/region"}},nodes:{type:"array",items:{$ref:"#/$defs/node"}},routes:{type:"array",items:{$ref:"#/$defs/route"}},notes:{type:"array",items:{$ref:"#/$defs/note"}},steps:{type:"array",items:{$ref:"#/$defs/step"}},legend:{anyOf:[{enum:["auto"]},{const:!1},{type:"array",items:{type:"string"}}]},badges:{type:"boolean"},grid:{$ref:"#/$defs/grid"},assemble:{type:"boolean",description:"draw the scene by flying its parts in from the nearest edge, then play"},loop:{type:"boolean",description:"the player wraps from the last step to the first (default true)"},dim:{enum:["flows","all"],description:"what a step dims: only flows, their labels and marks (default), or nodes too"},after:{type:"string"}}},Ee={type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},It=new RegExp("^[A-Za-z][A-Za-z0-9_-]*$","u"),Fe={type:"object",required:["id","kind"],unevaluatedProperties:!1,allOf:[{$ref:"#/$defs/placement"}],properties:{id:{$ref:"#/$defs/id"},kind:{enum:["slab","pad","fence","vm","cloud","zone","platform","tunnel"]},label:{type:"string"},"label-style":{enum:["face","face-right","floor","none"]},ghost:{type:"boolean",description:"drawn as a dashed outline: not there yet, out of reach, or stopped"},role:{type:"string"},size:{$ref:"#/$defs/size2or3"},padding:{type:"number",minimum:0},height:{type:"number",exclusiveMinimum:0},z:{type:"number",description:"lift above the floor it stands on (tunnels)"},flow:{enum:["row","column"]},gate:{type:"object",additionalProperties:!1,required:["side"],properties:{side:{$ref:"#/$defs/side"},at:{type:"number",minimum:0,maximum:1,description:"centre of the gate along the wall, 0..1"},width:{type:"number",exclusiveMinimum:0},height:{type:"number",exclusiveMinimum:0},node:{$ref:"#/$defs/id"}}},around:{type:"array",items:{$ref:"#/$defs/id"},description:"tunnel: routes it wraps"},regions:{type:"array",items:{$ref:"#/$defs/region"}},motion:{$ref:"#/$defs/motion"},variants:{$ref:"#/$defs/variants"},nodes:{type:"array",items:{$ref:"#/$defs/node"}}}},yn={type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:3},xp={enum:["n","e","s","w"]},Ze={type:"object",additionalProperties:!1,minProperties:1,description:"how this piece (a region: its contents too) moves when the drawing assembles or disassembles",properties:{style:{enum:["edge","drop","rise","fly","pop","scatter","build","fade"],description:"how it arrives"},out:{enum:["explode","lift-off","sink","scatter","fly-out","collapse","fade","reverse"],description:"how it leaves"},easing:{enum:["linear","ease","ease-in","ease-out","settle","spring","bounce"]},from:{enum:["left","right","top","bottom"],description:"fly: the side it comes from"},delay:{type:"number",minimum:0,description:"ms after its turn"},duration:{type:"number",exclusiveMinimum:0,description:"ms its own move takes"}}},Am={properties:{in:{$ref:"#/$defs/id"},at:{$ref:"#/$defs/point2"},"right-of":{$ref:"#/$defs/id"},"left-of":{$ref:"#/$defs/id"},below:{$ref:"#/$defs/id"},behind:{$ref:"#/$defs/id"},gap:{type:"number"},align:{$ref:"#/$defs/align"},shift:{$ref:"#/$defs/point2",description:"nudge after placement, grid units [dx, dy]"},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},Pt={type:"array",items:{type:"number"},minItems:2,maxItems:2},kp={enum:["start","center","end"]},Ye={anyOf:[{type:"string"},{type:"integer",minimum:1}]};function As(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=As.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(t.in!==void 0){let l=t.in;if(typeof l=="string"){if(!It.test(l)){let d={instancePath:e+"/in",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/in",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}if(t.at!==void 0){let l=t.at;if(Array.isArray(l)){if(l.length>2){let m={instancePath:e+"/at",schemaPath:"#/$defs/point2/maxItems",keyword:"maxItems",params:{limit:2},message:"must NOT have more than 2 items",schema:2,parentSchema:Pt,data:l};n===null?n=[m]:n.push(m),a++}if(l.length<2){let m={instancePath:e+"/at",schemaPath:"#/$defs/point2/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:Pt,data:l};n===null?n=[m]:n.push(m),a++}let d=l.length;for(let m=0;m<d;m++){let h=l[m];if(typeof h!="number"){let y={instancePath:e+"/at/"+m,schemaPath:"#/$defs/point2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Pt.items.type,parentSchema:Pt.items,data:h};n===null?n=[y]:n.push(y),a++}}}else{let d={instancePath:e+"/at",schemaPath:"#/$defs/point2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Pt.type,parentSchema:Pt,data:l};n===null?n=[d]:n.push(d),a++}}if(t["right-of"]!==void 0){let l=t["right-of"];if(typeof l=="string"){if(!It.test(l)){let d={instancePath:e+"/right-of",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/right-of",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}if(t["left-of"]!==void 0){let l=t["left-of"];if(typeof l=="string"){if(!It.test(l)){let d={instancePath:e+"/left-of",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/left-of",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}if(t.below!==void 0){let l=t.below;if(typeof l=="string"){if(!It.test(l)){let d={instancePath:e+"/below",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/below",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}if(t.behind!==void 0){let l=t.behind;if(typeof l=="string"){if(!It.test(l)){let d={instancePath:e+"/behind",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/behind",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}if(t.gap!==void 0){let l=t.gap;if(typeof l!="number"){let d={instancePath:e+"/gap",schemaPath:"#/properties/gap/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Am.properties.gap.type,parentSchema:Am.properties.gap,data:l};n===null?n=[d]:n.push(d),a++}}if(t.align!==void 0){let l=t.align;if(!(l==="start"||l==="center"||l==="end")){let d={instancePath:e+"/align",schemaPath:"#/$defs/align/enum",keyword:"enum",params:{allowedValues:kp.enum},message:"must be equal to one of the allowed values",schema:kp.enum,parentSchema:kp,data:l};n===null?n=[d]:n.push(d),a++}}if(t.shift!==void 0){let l=t.shift;if(Array.isArray(l)){if(l.length>2){let m={instancePath:e+"/shift",schemaPath:"#/$defs/point2/maxItems",keyword:"maxItems",params:{limit:2},message:"must NOT have more than 2 items",schema:2,parentSchema:Pt,data:l};n===null?n=[m]:n.push(m),a++}if(l.length<2){let m={instancePath:e+"/shift",schemaPath:"#/$defs/point2/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:Pt,data:l};n===null?n=[m]:n.push(m),a++}let d=l.length;for(let m=0;m<d;m++){let h=l[m];if(typeof h!="number"){let y={instancePath:e+"/shift/"+m,schemaPath:"#/$defs/point2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Pt.items.type,parentSchema:Pt.items,data:h};n===null?n=[y]:n.push(y),a++}}}else{let d={instancePath:e+"/shift",schemaPath:"#/$defs/point2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Pt.type,parentSchema:Pt,data:l};n===null?n=[d]:n.push(d),a++}}if(t.appears!==void 0){let l=t.appears,d=a,m=!1,h=a;if(typeof l!="string"){let g={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ye.anyOf[0].type,parentSchema:Ye.anyOf[0],data:l};n===null?n=[g]:n.push(g),a++}var p=h===a;m=m||p;let y=a;if(!(typeof l=="number"&&!(l%1)&&!isNaN(l))){let g={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Ye.anyOf[1].type,parentSchema:Ye.anyOf[1],data:l};n===null?n=[g]:n.push(g),a++}if(typeof l=="number"&&(l<1||isNaN(l))){let g={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Ye.anyOf[1],data:l};n===null?n=[g]:n.push(g),a++}var p=y===a;if(m=m||p,m)a=d,n!==null&&(d?n.length=d:n=null);else{let g={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Ye.anyOf,parentSchema:Ye,data:l};n===null?n=[g]:n.push(g),a++}}if(t.disappears!==void 0){let l=t.disappears,d=a,m=!1,h=a;if(typeof l!="string"){let g={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ye.anyOf[0].type,parentSchema:Ye.anyOf[0],data:l};n===null?n=[g]:n.push(g),a++}var c=h===a;m=m||c;let y=a;if(!(typeof l=="number"&&!(l%1)&&!isNaN(l))){let g={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Ye.anyOf[1].type,parentSchema:Ye.anyOf[1],data:l};n===null?n=[g]:n.push(g),a++}if(typeof l=="number"&&(l<1||isNaN(l))){let g={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Ye.anyOf[1],data:l};n===null?n=[g]:n.push(g),a++}var c=y===a;if(m=m||c,m)a=d,n!==null&&(d?n.length=d:n=null);else{let g={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Ye.anyOf,parentSchema:Ye,data:l};n===null?n=[g]:n.push(g),a++}}}return As.errors=n,a===0}As.evaluated={props:{in:!0,at:!0,"right-of":!0,"left-of":!0,below:!0,behind:!0,gap:!0,align:!0,shift:!0,appears:!0,disappears:!0},dynamicProps:!1,dynamicItems:!1};var Nt={type:"object",minProperties:1,propertyNames:{$ref:"#/$defs/id"},description:"other looks of it, by name, for a motion to switch to (its box stays as it is)",additionalProperties:{type:"object",additionalProperties:!1,minProperties:1,properties:{role:{type:"string"},ghost:{type:"boolean"},label:{type:"string"},sub:{type:"string"},face:{type:"string",pattern:"^[a-z][a-z0-9-]*$"},deco:{type:"array",items:{$ref:"#/$defs/deco"}}}}},Je={anyOf:[{enum:["envelope","bubble","file-lines","ghost","terminal"]},{type:"object",additionalProperties:!1,minProperties:1,maxProperties:1,properties:{terminal:{type:"integer",minimum:1,maximum:8},icon:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"an icon the host registers (none by default); one nothing registers is drawn as a placeholder, with a warning"},screen:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"terminal, chat, desktop, tiles, or a face the host registers"}}}]},ei=new RegExp("^[a-z][a-z0-9-]*$","u");function Ts(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=Ts.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(Object.keys(t).length<1){let l={instancePath:e,schemaPath:"#/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Nt,data:t};n===null?n=[l]:n.push(l),a++}for(let l in t){let d=a;if(typeof l=="string"){if(!It.test(l)){let m={instancePath:e,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:l,propertyName:l};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:l,propertyName:l};n===null?n=[m]:n.push(m),a++}var p=d===a;if(!p){let m={instancePath:e,schemaPath:"#/propertyNames",keyword:"propertyNames",params:{propertyName:l},message:"property name must be valid",schema:Nt.propertyNames,parentSchema:Nt,data:t};n===null?n=[m]:n.push(m),a++}}for(let l in t){let d=t[l];if(d&&typeof d=="object"&&!Array.isArray(d)){if(Object.keys(d).length<1){let m={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/additionalProperties/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Nt.additionalProperties,data:d};n===null?n=[m]:n.push(m),a++}for(let m in d)if(!(m==="role"||m==="ghost"||m==="label"||m==="sub"||m==="face"||m==="deco")){let h={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/additionalProperties/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:m},message:"must NOT have additional properties",schema:!1,parentSchema:Nt.additionalProperties,data:d};n===null?n=[h]:n.push(h),a++}if(d.role!==void 0){let m=d.role;if(typeof m!="string"){let h={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/role",schemaPath:"#/additionalProperties/properties/role/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Nt.additionalProperties.properties.role.type,parentSchema:Nt.additionalProperties.properties.role,data:m};n===null?n=[h]:n.push(h),a++}}if(d.ghost!==void 0){let m=d.ghost;if(typeof m!="boolean"){let h={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/ghost",schemaPath:"#/additionalProperties/properties/ghost/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Nt.additionalProperties.properties.ghost.type,parentSchema:Nt.additionalProperties.properties.ghost,data:m};n===null?n=[h]:n.push(h),a++}}if(d.label!==void 0){let m=d.label;if(typeof m!="string"){let h={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/label",schemaPath:"#/additionalProperties/properties/label/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Nt.additionalProperties.properties.label.type,parentSchema:Nt.additionalProperties.properties.label,data:m};n===null?n=[h]:n.push(h),a++}}if(d.sub!==void 0){let m=d.sub;if(typeof m!="string"){let h={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/sub",schemaPath:"#/additionalProperties/properties/sub/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Nt.additionalProperties.properties.sub.type,parentSchema:Nt.additionalProperties.properties.sub,data:m};n===null?n=[h]:n.push(h),a++}}if(d.face!==void 0){let m=d.face;if(typeof m=="string"){if(!ei.test(m)){let h={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/face",schemaPath:"#/additionalProperties/properties/face/pattern",keyword:"pattern",params:{pattern:"^[a-z][a-z0-9-]*$"},message:'must match pattern "^[a-z][a-z0-9-]*$"',schema:"^[a-z][a-z0-9-]*$",parentSchema:Nt.additionalProperties.properties.face,data:m};n===null?n=[h]:n.push(h),a++}}else{let h={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/face",schemaPath:"#/additionalProperties/properties/face/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Nt.additionalProperties.properties.face.type,parentSchema:Nt.additionalProperties.properties.face,data:m};n===null?n=[h]:n.push(h),a++}}if(d.deco!==void 0){let m=d.deco;if(Array.isArray(m)){let h=m.length;for(let y=0;y<h;y++){let g=m[y],k=a,u=!1,b=a;if(!(g==="envelope"||g==="bubble"||g==="file-lines"||g==="ghost"||g==="terminal")){let w={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y,schemaPath:"#/$defs/deco/anyOf/0/enum",keyword:"enum",params:{allowedValues:Je.anyOf[0].enum},message:"must be equal to one of the allowed values",schema:Je.anyOf[0].enum,parentSchema:Je.anyOf[0],data:g};n===null?n=[w]:n.push(w),a++}var c=b===a;u=u||c;let x=a;if(g&&typeof g=="object"&&!Array.isArray(g)){if(Object.keys(g).length>1){let w={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y,schemaPath:"#/$defs/deco/anyOf/1/maxProperties",keyword:"maxProperties",params:{limit:1},message:"must NOT have more than 1 properties",schema:1,parentSchema:Je.anyOf[1],data:g};n===null?n=[w]:n.push(w),a++}if(Object.keys(g).length<1){let w={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y,schemaPath:"#/$defs/deco/anyOf/1/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Je.anyOf[1],data:g};n===null?n=[w]:n.push(w),a++}for(let w in g)if(!(w==="terminal"||w==="icon"||w==="screen")){let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y,schemaPath:"#/$defs/deco/anyOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:w},message:"must NOT have additional properties",schema:!1,parentSchema:Je.anyOf[1],data:g};n===null?n=[$]:n.push($),a++}if(g.terminal!==void 0){let w=g.terminal;if(!(typeof w=="number"&&!(w%1)&&!isNaN(w))){let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Je.anyOf[1].properties.terminal.type,parentSchema:Je.anyOf[1].properties.terminal,data:w};n===null?n=[$]:n.push($),a++}if(typeof w=="number"){if(w>8||isNaN(w)){let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/maximum",keyword:"maximum",params:{comparison:"<=",limit:8},message:"must be <= 8",schema:8,parentSchema:Je.anyOf[1].properties.terminal,data:w};n===null?n=[$]:n.push($),a++}if(w<1||isNaN(w)){let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Je.anyOf[1].properties.terminal,data:w};n===null?n=[$]:n.push($),a++}}}if(g.icon!==void 0){let w=g.icon;if(typeof w=="string"){if(!ei.test(w)){let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/icon",schemaPath:"#/$defs/deco/anyOf/1/properties/icon/pattern",keyword:"pattern",params:{pattern:"^[a-z][a-z0-9-]*$"},message:'must match pattern "^[a-z][a-z0-9-]*$"',schema:"^[a-z][a-z0-9-]*$",parentSchema:Je.anyOf[1].properties.icon,data:w};n===null?n=[$]:n.push($),a++}}else{let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/icon",schemaPath:"#/$defs/deco/anyOf/1/properties/icon/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Je.anyOf[1].properties.icon.type,parentSchema:Je.anyOf[1].properties.icon,data:w};n===null?n=[$]:n.push($),a++}}if(g.screen!==void 0){let w=g.screen;if(typeof w=="string"){if(!ei.test(w)){let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/screen",schemaPath:"#/$defs/deco/anyOf/1/properties/screen/pattern",keyword:"pattern",params:{pattern:"^[a-z][a-z0-9-]*$"},message:'must match pattern "^[a-z][a-z0-9-]*$"',schema:"^[a-z][a-z0-9-]*$",parentSchema:Je.anyOf[1].properties.screen,data:w};n===null?n=[$]:n.push($),a++}}else{let $={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y+"/screen",schemaPath:"#/$defs/deco/anyOf/1/properties/screen/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Je.anyOf[1].properties.screen.type,parentSchema:Je.anyOf[1].properties.screen,data:w};n===null?n=[$]:n.push($),a++}}}else{let w={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y,schemaPath:"#/$defs/deco/anyOf/1/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Je.anyOf[1].type,parentSchema:Je.anyOf[1],data:g};n===null?n=[w]:n.push(w),a++}var c=x===a;if(u=u||c,u)a=k,n!==null&&(k?n.length=k:n=null);else{let w={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco/"+y,schemaPath:"#/$defs/deco/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Je.anyOf,parentSchema:Je,data:g};n===null?n=[w]:n.push(w),a++}}}else{let h={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1")+"/deco",schemaPath:"#/additionalProperties/properties/deco/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Nt.additionalProperties.properties.deco.type,parentSchema:Nt.additionalProperties.properties.deco,data:m};n===null?n=[h]:n.push(h),a++}}}else{let m={instancePath:e+"/"+l.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/additionalProperties/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Nt.additionalProperties.type,parentSchema:Nt.additionalProperties,data:d};n===null?n=[m]:n.push(m),a++}}}else{let l={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Nt.type,parentSchema:Nt,data:t};n===null?n=[l]:n.push(l),a++}return Ts.errors=n,a===0}Ts.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var et={type:"object",required:["id"],unevaluatedProperties:!1,allOf:[{$ref:"#/$defs/placement"}],properties:{id:{$ref:"#/$defs/id"},asset:{type:"string",description:"asset name from the library; default 'block'"},role:{type:"string",description:"colour role"},label:{type:"string"},sub:{type:"string"},size:{$ref:"#/$defs/size2or3"},z:{type:"number",description:"lift above the floor it stands on"},deco:{type:"array",items:{$ref:"#/$defs/deco"}},ghost:{type:"boolean"},face:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"screen asset: what the screen shows: terminal, chat, desktop, tiles, or a face the host registers"},facing:{type:"number",description:"screen asset: rotation in degrees"},"label-at":{type:"object",additionalProperties:!1,properties:{side:{enum:["above","right","left","below"]},dx:{type:"number"},dy:{type:"number"}}},motion:{$ref:"#/$defs/motion"},variants:{$ref:"#/$defs/variants"},nodes:{type:"array",items:{$ref:"#/$defs/node"},description:"nodes standing on top of this one"}}},$p={validate:hs};function hs(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=hs.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),As(t,{instancePath:e,parentData:s,parentDataProperty:r,rootData:i,dynamicAnchors:o})||(n=n===null?As.errors:n.concat(As.errors),a=n.length),t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let c={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'",schema:et.required,parentSchema:et,data:t};n===null?n=[c]:n.push(c),a++}if(t.id!==void 0){let c=t.id;if(typeof c=="string"){if(!It.test(c)){let l={instancePath:e+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:c};n===null?n=[l]:n.push(l),a++}}if(t.asset!==void 0){let c=t.asset;if(typeof c!="string"){let l={instancePath:e+"/asset",schemaPath:"#/properties/asset/type",keyword:"type",params:{type:"string"},message:"must be string",schema:et.properties.asset.type,parentSchema:et.properties.asset,data:c};n===null?n=[l]:n.push(l),a++}}if(t.role!==void 0){let c=t.role;if(typeof c!="string"){let l={instancePath:e+"/role",schemaPath:"#/properties/role/type",keyword:"type",params:{type:"string"},message:"must be string",schema:et.properties.role.type,parentSchema:et.properties.role,data:c};n===null?n=[l]:n.push(l),a++}}if(t.label!==void 0){let c=t.label;if(typeof c!="string"){let l={instancePath:e+"/label",schemaPath:"#/properties/label/type",keyword:"type",params:{type:"string"},message:"must be string",schema:et.properties.label.type,parentSchema:et.properties.label,data:c};n===null?n=[l]:n.push(l),a++}}if(t.sub!==void 0){let c=t.sub;if(typeof c!="string"){let l={instancePath:e+"/sub",schemaPath:"#/properties/sub/type",keyword:"type",params:{type:"string"},message:"must be string",schema:et.properties.sub.type,parentSchema:et.properties.sub,data:c};n===null?n=[l]:n.push(l),a++}}if(t.size!==void 0){let c=t.size;if(Array.isArray(c)){if(c.length>3){let d={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:yn,data:c};n===null?n=[d]:n.push(d),a++}if(c.length<2){let d={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:yn,data:c};n===null?n=[d]:n.push(d),a++}let l=c.length;for(let d=0;d<l;d++){let m=c[d];if(typeof m=="number"){if(m<=0||isNaN(m)){let h={instancePath:e+"/size/"+d,schemaPath:"#/$defs/size2or3/items/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:yn.items,data:m};n===null?n=[h]:n.push(h),a++}}else{let h={instancePath:e+"/size/"+d,schemaPath:"#/$defs/size2or3/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:yn.items.type,parentSchema:yn.items,data:m};n===null?n=[h]:n.push(h),a++}}}else{let l={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/type",keyword:"type",params:{type:"array"},message:"must be array",schema:yn.type,parentSchema:yn,data:c};n===null?n=[l]:n.push(l),a++}}if(t.z!==void 0){let c=t.z;if(typeof c!="number"){let l={instancePath:e+"/z",schemaPath:"#/properties/z/type",keyword:"type",params:{type:"number"},message:"must be number",schema:et.properties.z.type,parentSchema:et.properties.z,data:c};n===null?n=[l]:n.push(l),a++}}if(t.deco!==void 0){let c=t.deco;if(Array.isArray(c)){let l=c.length;for(let d=0;d<l;d++){let m=c[d],h=a,y=!1,g=a;if(!(m==="envelope"||m==="bubble"||m==="file-lines"||m==="ghost"||m==="terminal")){let u={instancePath:e+"/deco/"+d,schemaPath:"#/$defs/deco/anyOf/0/enum",keyword:"enum",params:{allowedValues:Je.anyOf[0].enum},message:"must be equal to one of the allowed values",schema:Je.anyOf[0].enum,parentSchema:Je.anyOf[0],data:m};n===null?n=[u]:n.push(u),a++}var p=g===a;y=y||p;let k=a;if(m&&typeof m=="object"&&!Array.isArray(m)){if(Object.keys(m).length>1){let u={instancePath:e+"/deco/"+d,schemaPath:"#/$defs/deco/anyOf/1/maxProperties",keyword:"maxProperties",params:{limit:1},message:"must NOT have more than 1 properties",schema:1,parentSchema:Je.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}if(Object.keys(m).length<1){let u={instancePath:e+"/deco/"+d,schemaPath:"#/$defs/deco/anyOf/1/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Je.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}for(let u in m)if(!(u==="terminal"||u==="icon"||u==="screen")){let b={instancePath:e+"/deco/"+d,schemaPath:"#/$defs/deco/anyOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:u},message:"must NOT have additional properties",schema:!1,parentSchema:Je.anyOf[1],data:m};n===null?n=[b]:n.push(b),a++}if(m.terminal!==void 0){let u=m.terminal;if(!(typeof u=="number"&&!(u%1)&&!isNaN(u))){let b={instancePath:e+"/deco/"+d+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Je.anyOf[1].properties.terminal.type,parentSchema:Je.anyOf[1].properties.terminal,data:u};n===null?n=[b]:n.push(b),a++}if(typeof u=="number"){if(u>8||isNaN(u)){let b={instancePath:e+"/deco/"+d+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/maximum",keyword:"maximum",params:{comparison:"<=",limit:8},message:"must be <= 8",schema:8,parentSchema:Je.anyOf[1].properties.terminal,data:u};n===null?n=[b]:n.push(b),a++}if(u<1||isNaN(u)){let b={instancePath:e+"/deco/"+d+"/terminal",schemaPath:"#/$defs/deco/anyOf/1/properties/terminal/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Je.anyOf[1].properties.terminal,data:u};n===null?n=[b]:n.push(b),a++}}}if(m.icon!==void 0){let u=m.icon;if(typeof u=="string"){if(!ei.test(u)){let b={instancePath:e+"/deco/"+d+"/icon",schemaPath:"#/$defs/deco/anyOf/1/properties/icon/pattern",keyword:"pattern",params:{pattern:"^[a-z][a-z0-9-]*$"},message:'must match pattern "^[a-z][a-z0-9-]*$"',schema:"^[a-z][a-z0-9-]*$",parentSchema:Je.anyOf[1].properties.icon,data:u};n===null?n=[b]:n.push(b),a++}}else{let b={instancePath:e+"/deco/"+d+"/icon",schemaPath:"#/$defs/deco/anyOf/1/properties/icon/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Je.anyOf[1].properties.icon.type,parentSchema:Je.anyOf[1].properties.icon,data:u};n===null?n=[b]:n.push(b),a++}}if(m.screen!==void 0){let u=m.screen;if(typeof u=="string"){if(!ei.test(u)){let b={instancePath:e+"/deco/"+d+"/screen",schemaPath:"#/$defs/deco/anyOf/1/properties/screen/pattern",keyword:"pattern",params:{pattern:"^[a-z][a-z0-9-]*$"},message:'must match pattern "^[a-z][a-z0-9-]*$"',schema:"^[a-z][a-z0-9-]*$",parentSchema:Je.anyOf[1].properties.screen,data:u};n===null?n=[b]:n.push(b),a++}}else{let b={instancePath:e+"/deco/"+d+"/screen",schemaPath:"#/$defs/deco/anyOf/1/properties/screen/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Je.anyOf[1].properties.screen.type,parentSchema:Je.anyOf[1].properties.screen,data:u};n===null?n=[b]:n.push(b),a++}}}else{let u={instancePath:e+"/deco/"+d,schemaPath:"#/$defs/deco/anyOf/1/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Je.anyOf[1].type,parentSchema:Je.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}var p=k===a;if(y=y||p,y)a=h,n!==null&&(h?n.length=h:n=null);else{let u={instancePath:e+"/deco/"+d,schemaPath:"#/$defs/deco/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Je.anyOf,parentSchema:Je,data:m};n===null?n=[u]:n.push(u),a++}}}else{let l={instancePath:e+"/deco",schemaPath:"#/properties/deco/type",keyword:"type",params:{type:"array"},message:"must be array",schema:et.properties.deco.type,parentSchema:et.properties.deco,data:c};n===null?n=[l]:n.push(l),a++}}if(t.ghost!==void 0){let c=t.ghost;if(typeof c!="boolean"){let l={instancePath:e+"/ghost",schemaPath:"#/properties/ghost/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:et.properties.ghost.type,parentSchema:et.properties.ghost,data:c};n===null?n=[l]:n.push(l),a++}}if(t.face!==void 0){let c=t.face;if(typeof c=="string"){if(!ei.test(c)){let l={instancePath:e+"/face",schemaPath:"#/properties/face/pattern",keyword:"pattern",params:{pattern:"^[a-z][a-z0-9-]*$"},message:'must match pattern "^[a-z][a-z0-9-]*$"',schema:"^[a-z][a-z0-9-]*$",parentSchema:et.properties.face,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/face",schemaPath:"#/properties/face/type",keyword:"type",params:{type:"string"},message:"must be string",schema:et.properties.face.type,parentSchema:et.properties.face,data:c};n===null?n=[l]:n.push(l),a++}}if(t.facing!==void 0){let c=t.facing;if(typeof c!="number"){let l={instancePath:e+"/facing",schemaPath:"#/properties/facing/type",keyword:"type",params:{type:"number"},message:"must be number",schema:et.properties.facing.type,parentSchema:et.properties.facing,data:c};n===null?n=[l]:n.push(l),a++}}if(t["label-at"]!==void 0){let c=t["label-at"];if(c&&typeof c=="object"&&!Array.isArray(c)){for(let l in c)if(!(l==="side"||l==="dx"||l==="dy")){let d={instancePath:e+"/label-at",schemaPath:"#/properties/label-at/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:l},message:"must NOT have additional properties",schema:!1,parentSchema:et.properties["label-at"],data:c};n===null?n=[d]:n.push(d),a++}if(c.side!==void 0){let l=c.side;if(!(l==="above"||l==="right"||l==="left"||l==="below")){let d={instancePath:e+"/label-at/side",schemaPath:"#/properties/label-at/properties/side/enum",keyword:"enum",params:{allowedValues:et.properties["label-at"].properties.side.enum},message:"must be equal to one of the allowed values",schema:et.properties["label-at"].properties.side.enum,parentSchema:et.properties["label-at"].properties.side,data:l};n===null?n=[d]:n.push(d),a++}}if(c.dx!==void 0){let l=c.dx;if(typeof l!="number"){let d={instancePath:e+"/label-at/dx",schemaPath:"#/properties/label-at/properties/dx/type",keyword:"type",params:{type:"number"},message:"must be number",schema:et.properties["label-at"].properties.dx.type,parentSchema:et.properties["label-at"].properties.dx,data:l};n===null?n=[d]:n.push(d),a++}}if(c.dy!==void 0){let l=c.dy;if(typeof l!="number"){let d={instancePath:e+"/label-at/dy",schemaPath:"#/properties/label-at/properties/dy/type",keyword:"type",params:{type:"number"},message:"must be number",schema:et.properties["label-at"].properties.dy.type,parentSchema:et.properties["label-at"].properties.dy,data:l};n===null?n=[d]:n.push(d),a++}}}else{let l={instancePath:e+"/label-at",schemaPath:"#/properties/label-at/type",keyword:"type",params:{type:"object"},message:"must be object",schema:et.properties["label-at"].type,parentSchema:et.properties["label-at"],data:c};n===null?n=[l]:n.push(l),a++}}if(t.motion!==void 0){let c=t.motion;if(c&&typeof c=="object"&&!Array.isArray(c)){if(Object.keys(c).length<1){let l={instancePath:e+"/motion",schemaPath:"#/$defs/motion/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Ze,data:c};n===null?n=[l]:n.push(l),a++}for(let l in c)if(!(l==="style"||l==="out"||l==="easing"||l==="from"||l==="delay"||l==="duration")){let d={instancePath:e+"/motion",schemaPath:"#/$defs/motion/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:l},message:"must NOT have additional properties",schema:!1,parentSchema:Ze,data:c};n===null?n=[d]:n.push(d),a++}if(c.style!==void 0){let l=c.style;if(!(l==="edge"||l==="drop"||l==="rise"||l==="fly"||l==="pop"||l==="scatter"||l==="build"||l==="fade")){let d={instancePath:e+"/motion/style",schemaPath:"#/$defs/motion/properties/style/enum",keyword:"enum",params:{allowedValues:Ze.properties.style.enum},message:"must be equal to one of the allowed values",schema:Ze.properties.style.enum,parentSchema:Ze.properties.style,data:l};n===null?n=[d]:n.push(d),a++}}if(c.out!==void 0){let l=c.out;if(!(l==="explode"||l==="lift-off"||l==="sink"||l==="scatter"||l==="fly-out"||l==="collapse"||l==="fade"||l==="reverse")){let d={instancePath:e+"/motion/out",schemaPath:"#/$defs/motion/properties/out/enum",keyword:"enum",params:{allowedValues:Ze.properties.out.enum},message:"must be equal to one of the allowed values",schema:Ze.properties.out.enum,parentSchema:Ze.properties.out,data:l};n===null?n=[d]:n.push(d),a++}}if(c.easing!==void 0){let l=c.easing;if(!(l==="linear"||l==="ease"||l==="ease-in"||l==="ease-out"||l==="settle"||l==="spring"||l==="bounce")){let d={instancePath:e+"/motion/easing",schemaPath:"#/$defs/motion/properties/easing/enum",keyword:"enum",params:{allowedValues:Ze.properties.easing.enum},message:"must be equal to one of the allowed values",schema:Ze.properties.easing.enum,parentSchema:Ze.properties.easing,data:l};n===null?n=[d]:n.push(d),a++}}if(c.from!==void 0){let l=c.from;if(!(l==="left"||l==="right"||l==="top"||l==="bottom")){let d={instancePath:e+"/motion/from",schemaPath:"#/$defs/motion/properties/from/enum",keyword:"enum",params:{allowedValues:Ze.properties.from.enum},message:"must be equal to one of the allowed values",schema:Ze.properties.from.enum,parentSchema:Ze.properties.from,data:l};n===null?n=[d]:n.push(d),a++}}if(c.delay!==void 0){let l=c.delay;if(typeof l=="number"){if(l<0||isNaN(l)){let d={instancePath:e+"/motion/delay",schemaPath:"#/$defs/motion/properties/delay/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:Ze.properties.delay,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/motion/delay",schemaPath:"#/$defs/motion/properties/delay/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Ze.properties.delay.type,parentSchema:Ze.properties.delay,data:l};n===null?n=[d]:n.push(d),a++}}if(c.duration!==void 0){let l=c.duration;if(typeof l=="number"){if(l<=0||isNaN(l)){let d={instancePath:e+"/motion/duration",schemaPath:"#/$defs/motion/properties/duration/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Ze.properties.duration,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/motion/duration",schemaPath:"#/$defs/motion/properties/duration/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Ze.properties.duration.type,parentSchema:Ze.properties.duration,data:l};n===null?n=[d]:n.push(d),a++}}}else{let l={instancePath:e+"/motion",schemaPath:"#/$defs/motion/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Ze.type,parentSchema:Ze,data:c};n===null?n=[l]:n.push(l),a++}}if(t.variants!==void 0&&(Ts(t.variants,{instancePath:e+"/variants",parentData:t,parentDataProperty:"variants",rootData:i,dynamicAnchors:o})||(n=n===null?Ts.errors:n.concat(Ts.errors),a=n.length)),t.nodes!==void 0){let c=t.nodes;if(Array.isArray(c)){let l=c.length;for(let d=0;d<l;d++)$p.validate(c[d],{instancePath:e+"/nodes/"+d,parentData:c,parentDataProperty:d,rootData:i,dynamicAnchors:o})||(n=n===null?$p.validate.errors:n.concat($p.validate.errors),a=n.length)}else{let l={instancePath:e+"/nodes",schemaPath:"#/properties/nodes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:et.properties.nodes.type,parentSchema:et.properties.nodes,data:c};n===null?n=[l]:n.push(l),a++}}for(let c in t)if(c!=="id"&&c!=="asset"&&c!=="role"&&c!=="label"&&c!=="sub"&&c!=="size"&&c!=="z"&&c!=="deco"&&c!=="ghost"&&c!=="face"&&c!=="facing"&&c!=="label-at"&&c!=="motion"&&c!=="variants"&&c!=="nodes"&&c!=="in"&&c!=="at"&&c!=="right-of"&&c!=="left-of"&&c!=="below"&&c!=="behind"&&c!=="gap"&&c!=="align"&&c!=="shift"&&c!=="appears"&&c!=="disappears"){let l={instancePath:e,schemaPath:"#/unevaluatedProperties",keyword:"unevaluatedProperties",params:{unevaluatedProperty:c},message:"must NOT have unevaluated properties",schema:!1,parentSchema:et,data:t};n===null?n=[l]:n.push(l),a++}}else{let c={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:et.type,parentSchema:et,data:t};n===null?n=[c]:n.push(c),a++}return hs.errors=n,a===0}hs.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var Sp={validate:mr};function mr(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=mr.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),As(t,{instancePath:e,parentData:s,parentDataProperty:r,rootData:i,dynamicAnchors:o})||(n=n===null?As.errors:n.concat(As.errors),a=n.length),t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let p={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'",schema:Fe.required,parentSchema:Fe,data:t};n===null?n=[p]:n.push(p),a++}if(t.kind===void 0){let p={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"kind"},message:"must have required property 'kind'",schema:Fe.required,parentSchema:Fe,data:t};n===null?n=[p]:n.push(p),a++}if(t.id!==void 0){let p=t.id;if(typeof p=="string"){if(!It.test(p)){let c={instancePath:e+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:p};n===null?n=[c]:n.push(c),a++}}else{let c={instancePath:e+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:p};n===null?n=[c]:n.push(c),a++}}if(t.kind!==void 0){let p=t.kind;if(!(p==="slab"||p==="pad"||p==="fence"||p==="vm"||p==="cloud"||p==="zone"||p==="platform"||p==="tunnel")){let c={instancePath:e+"/kind",schemaPath:"#/properties/kind/enum",keyword:"enum",params:{allowedValues:Fe.properties.kind.enum},message:"must be equal to one of the allowed values",schema:Fe.properties.kind.enum,parentSchema:Fe.properties.kind,data:p};n===null?n=[c]:n.push(c),a++}}if(t.label!==void 0){let p=t.label;if(typeof p!="string"){let c={instancePath:e+"/label",schemaPath:"#/properties/label/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Fe.properties.label.type,parentSchema:Fe.properties.label,data:p};n===null?n=[c]:n.push(c),a++}}if(t["label-style"]!==void 0){let p=t["label-style"];if(!(p==="face"||p==="face-right"||p==="floor"||p==="none")){let c={instancePath:e+"/label-style",schemaPath:"#/properties/label-style/enum",keyword:"enum",params:{allowedValues:Fe.properties["label-style"].enum},message:"must be equal to one of the allowed values",schema:Fe.properties["label-style"].enum,parentSchema:Fe.properties["label-style"],data:p};n===null?n=[c]:n.push(c),a++}}if(t.ghost!==void 0){let p=t.ghost;if(typeof p!="boolean"){let c={instancePath:e+"/ghost",schemaPath:"#/properties/ghost/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Fe.properties.ghost.type,parentSchema:Fe.properties.ghost,data:p};n===null?n=[c]:n.push(c),a++}}if(t.role!==void 0){let p=t.role;if(typeof p!="string"){let c={instancePath:e+"/role",schemaPath:"#/properties/role/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Fe.properties.role.type,parentSchema:Fe.properties.role,data:p};n===null?n=[c]:n.push(c),a++}}if(t.size!==void 0){let p=t.size;if(Array.isArray(p)){if(p.length>3){let l={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:yn,data:p};n===null?n=[l]:n.push(l),a++}if(p.length<2){let l={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:yn,data:p};n===null?n=[l]:n.push(l),a++}let c=p.length;for(let l=0;l<c;l++){let d=p[l];if(typeof d=="number"){if(d<=0||isNaN(d)){let m={instancePath:e+"/size/"+l,schemaPath:"#/$defs/size2or3/items/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:yn.items,data:d};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e+"/size/"+l,schemaPath:"#/$defs/size2or3/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:yn.items.type,parentSchema:yn.items,data:d};n===null?n=[m]:n.push(m),a++}}}else{let c={instancePath:e+"/size",schemaPath:"#/$defs/size2or3/type",keyword:"type",params:{type:"array"},message:"must be array",schema:yn.type,parentSchema:yn,data:p};n===null?n=[c]:n.push(c),a++}}if(t.padding!==void 0){let p=t.padding;if(typeof p=="number"){if(p<0||isNaN(p)){let c={instancePath:e+"/padding",schemaPath:"#/properties/padding/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:Fe.properties.padding,data:p};n===null?n=[c]:n.push(c),a++}}else{let c={instancePath:e+"/padding",schemaPath:"#/properties/padding/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Fe.properties.padding.type,parentSchema:Fe.properties.padding,data:p};n===null?n=[c]:n.push(c),a++}}if(t.height!==void 0){let p=t.height;if(typeof p=="number"){if(p<=0||isNaN(p)){let c={instancePath:e+"/height",schemaPath:"#/properties/height/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Fe.properties.height,data:p};n===null?n=[c]:n.push(c),a++}}else{let c={instancePath:e+"/height",schemaPath:"#/properties/height/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Fe.properties.height.type,parentSchema:Fe.properties.height,data:p};n===null?n=[c]:n.push(c),a++}}if(t.z!==void 0){let p=t.z;if(typeof p!="number"){let c={instancePath:e+"/z",schemaPath:"#/properties/z/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Fe.properties.z.type,parentSchema:Fe.properties.z,data:p};n===null?n=[c]:n.push(c),a++}}if(t.flow!==void 0){let p=t.flow;if(!(p==="row"||p==="column")){let c={instancePath:e+"/flow",schemaPath:"#/properties/flow/enum",keyword:"enum",params:{allowedValues:Fe.properties.flow.enum},message:"must be equal to one of the allowed values",schema:Fe.properties.flow.enum,parentSchema:Fe.properties.flow,data:p};n===null?n=[c]:n.push(c),a++}}if(t.gate!==void 0){let p=t.gate;if(p&&typeof p=="object"&&!Array.isArray(p)){if(p.side===void 0){let c={instancePath:e+"/gate",schemaPath:"#/properties/gate/required",keyword:"required",params:{missingProperty:"side"},message:"must have required property 'side'",schema:Fe.properties.gate.required,parentSchema:Fe.properties.gate,data:p};n===null?n=[c]:n.push(c),a++}for(let c in p)if(!(c==="side"||c==="at"||c==="width"||c==="height"||c==="node")){let l={instancePath:e+"/gate",schemaPath:"#/properties/gate/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:c},message:"must NOT have additional properties",schema:!1,parentSchema:Fe.properties.gate,data:p};n===null?n=[l]:n.push(l),a++}if(p.side!==void 0){let c=p.side;if(!(c==="n"||c==="e"||c==="s"||c==="w")){let l={instancePath:e+"/gate/side",schemaPath:"#/$defs/side/enum",keyword:"enum",params:{allowedValues:xp.enum},message:"must be equal to one of the allowed values",schema:xp.enum,parentSchema:xp,data:c};n===null?n=[l]:n.push(l),a++}}if(p.at!==void 0){let c=p.at;if(typeof c=="number"){if(c>1||isNaN(c)){let l={instancePath:e+"/gate/at",schemaPath:"#/properties/gate/properties/at/maximum",keyword:"maximum",params:{comparison:"<=",limit:1},message:"must be <= 1",schema:1,parentSchema:Fe.properties.gate.properties.at,data:c};n===null?n=[l]:n.push(l),a++}if(c<0||isNaN(c)){let l={instancePath:e+"/gate/at",schemaPath:"#/properties/gate/properties/at/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:Fe.properties.gate.properties.at,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/gate/at",schemaPath:"#/properties/gate/properties/at/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Fe.properties.gate.properties.at.type,parentSchema:Fe.properties.gate.properties.at,data:c};n===null?n=[l]:n.push(l),a++}}if(p.width!==void 0){let c=p.width;if(typeof c=="number"){if(c<=0||isNaN(c)){let l={instancePath:e+"/gate/width",schemaPath:"#/properties/gate/properties/width/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Fe.properties.gate.properties.width,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/gate/width",schemaPath:"#/properties/gate/properties/width/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Fe.properties.gate.properties.width.type,parentSchema:Fe.properties.gate.properties.width,data:c};n===null?n=[l]:n.push(l),a++}}if(p.height!==void 0){let c=p.height;if(typeof c=="number"){if(c<=0||isNaN(c)){let l={instancePath:e+"/gate/height",schemaPath:"#/properties/gate/properties/height/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Fe.properties.gate.properties.height,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/gate/height",schemaPath:"#/properties/gate/properties/height/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Fe.properties.gate.properties.height.type,parentSchema:Fe.properties.gate.properties.height,data:c};n===null?n=[l]:n.push(l),a++}}if(p.node!==void 0){let c=p.node;if(typeof c=="string"){if(!It.test(c)){let l={instancePath:e+"/gate/node",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/gate/node",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:c};n===null?n=[l]:n.push(l),a++}}}else{let c={instancePath:e+"/gate",schemaPath:"#/properties/gate/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Fe.properties.gate.type,parentSchema:Fe.properties.gate,data:p};n===null?n=[c]:n.push(c),a++}}if(t.around!==void 0){let p=t.around;if(Array.isArray(p)){let c=p.length;for(let l=0;l<c;l++){let d=p[l];if(typeof d=="string"){if(!It.test(d)){let m={instancePath:e+"/around/"+l,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:d};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e+"/around/"+l,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:d};n===null?n=[m]:n.push(m),a++}}}else{let c={instancePath:e+"/around",schemaPath:"#/properties/around/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Fe.properties.around.type,parentSchema:Fe.properties.around,data:p};n===null?n=[c]:n.push(c),a++}}if(t.regions!==void 0){let p=t.regions;if(Array.isArray(p)){let c=p.length;for(let l=0;l<c;l++)Sp.validate(p[l],{instancePath:e+"/regions/"+l,parentData:p,parentDataProperty:l,rootData:i,dynamicAnchors:o})||(n=n===null?Sp.validate.errors:n.concat(Sp.validate.errors),a=n.length)}else{let c={instancePath:e+"/regions",schemaPath:"#/properties/regions/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Fe.properties.regions.type,parentSchema:Fe.properties.regions,data:p};n===null?n=[c]:n.push(c),a++}}if(t.motion!==void 0){let p=t.motion;if(p&&typeof p=="object"&&!Array.isArray(p)){if(Object.keys(p).length<1){let c={instancePath:e+"/motion",schemaPath:"#/$defs/motion/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Ze,data:p};n===null?n=[c]:n.push(c),a++}for(let c in p)if(!(c==="style"||c==="out"||c==="easing"||c==="from"||c==="delay"||c==="duration")){let l={instancePath:e+"/motion",schemaPath:"#/$defs/motion/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:c},message:"must NOT have additional properties",schema:!1,parentSchema:Ze,data:p};n===null?n=[l]:n.push(l),a++}if(p.style!==void 0){let c=p.style;if(!(c==="edge"||c==="drop"||c==="rise"||c==="fly"||c==="pop"||c==="scatter"||c==="build"||c==="fade")){let l={instancePath:e+"/motion/style",schemaPath:"#/$defs/motion/properties/style/enum",keyword:"enum",params:{allowedValues:Ze.properties.style.enum},message:"must be equal to one of the allowed values",schema:Ze.properties.style.enum,parentSchema:Ze.properties.style,data:c};n===null?n=[l]:n.push(l),a++}}if(p.out!==void 0){let c=p.out;if(!(c==="explode"||c==="lift-off"||c==="sink"||c==="scatter"||c==="fly-out"||c==="collapse"||c==="fade"||c==="reverse")){let l={instancePath:e+"/motion/out",schemaPath:"#/$defs/motion/properties/out/enum",keyword:"enum",params:{allowedValues:Ze.properties.out.enum},message:"must be equal to one of the allowed values",schema:Ze.properties.out.enum,parentSchema:Ze.properties.out,data:c};n===null?n=[l]:n.push(l),a++}}if(p.easing!==void 0){let c=p.easing;if(!(c==="linear"||c==="ease"||c==="ease-in"||c==="ease-out"||c==="settle"||c==="spring"||c==="bounce")){let l={instancePath:e+"/motion/easing",schemaPath:"#/$defs/motion/properties/easing/enum",keyword:"enum",params:{allowedValues:Ze.properties.easing.enum},message:"must be equal to one of the allowed values",schema:Ze.properties.easing.enum,parentSchema:Ze.properties.easing,data:c};n===null?n=[l]:n.push(l),a++}}if(p.from!==void 0){let c=p.from;if(!(c==="left"||c==="right"||c==="top"||c==="bottom")){let l={instancePath:e+"/motion/from",schemaPath:"#/$defs/motion/properties/from/enum",keyword:"enum",params:{allowedValues:Ze.properties.from.enum},message:"must be equal to one of the allowed values",schema:Ze.properties.from.enum,parentSchema:Ze.properties.from,data:c};n===null?n=[l]:n.push(l),a++}}if(p.delay!==void 0){let c=p.delay;if(typeof c=="number"){if(c<0||isNaN(c)){let l={instancePath:e+"/motion/delay",schemaPath:"#/$defs/motion/properties/delay/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:Ze.properties.delay,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/motion/delay",schemaPath:"#/$defs/motion/properties/delay/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Ze.properties.delay.type,parentSchema:Ze.properties.delay,data:c};n===null?n=[l]:n.push(l),a++}}if(p.duration!==void 0){let c=p.duration;if(typeof c=="number"){if(c<=0||isNaN(c)){let l={instancePath:e+"/motion/duration",schemaPath:"#/$defs/motion/properties/duration/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Ze.properties.duration,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/motion/duration",schemaPath:"#/$defs/motion/properties/duration/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Ze.properties.duration.type,parentSchema:Ze.properties.duration,data:c};n===null?n=[l]:n.push(l),a++}}}else{let c={instancePath:e+"/motion",schemaPath:"#/$defs/motion/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Ze.type,parentSchema:Ze,data:p};n===null?n=[c]:n.push(c),a++}}if(t.variants!==void 0&&(Ts(t.variants,{instancePath:e+"/variants",parentData:t,parentDataProperty:"variants",rootData:i,dynamicAnchors:o})||(n=n===null?Ts.errors:n.concat(Ts.errors),a=n.length)),t.nodes!==void 0){let p=t.nodes;if(Array.isArray(p)){let c=p.length;for(let l=0;l<c;l++)hs(p[l],{instancePath:e+"/nodes/"+l,parentData:p,parentDataProperty:l,rootData:i,dynamicAnchors:o})||(n=n===null?hs.errors:n.concat(hs.errors),a=n.length)}else{let c={instancePath:e+"/nodes",schemaPath:"#/properties/nodes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Fe.properties.nodes.type,parentSchema:Fe.properties.nodes,data:p};n===null?n=[c]:n.push(c),a++}}for(let p in t)if(p!=="id"&&p!=="kind"&&p!=="label"&&p!=="label-style"&&p!=="ghost"&&p!=="role"&&p!=="size"&&p!=="padding"&&p!=="height"&&p!=="z"&&p!=="flow"&&p!=="gate"&&p!=="around"&&p!=="regions"&&p!=="motion"&&p!=="variants"&&p!=="nodes"&&p!=="in"&&p!=="at"&&p!=="right-of"&&p!=="left-of"&&p!=="below"&&p!=="behind"&&p!=="gap"&&p!=="align"&&p!=="shift"&&p!=="appears"&&p!=="disappears"){let c={instancePath:e,schemaPath:"#/unevaluatedProperties",keyword:"unevaluatedProperties",params:{unevaluatedProperty:p},message:"must NOT have unevaluated properties",schema:!1,parentSchema:Fe,data:t};n===null?n=[c]:n.push(c),a++}}else{let p={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Fe.type,parentSchema:Fe,data:t};n===null?n=[p]:n.push(p),a++}return mr.errors=n,a===0}mr.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var je={type:"object",required:["id","from","to"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},from:{$ref:"#/$defs/endpoint"},to:{$ref:"#/$defs/endpoint"},kind:{type:"string"},via:{type:"array",items:{anyOf:[{$ref:"#/$defs/point2"},{$ref:"#/$defs/endpoint"}]}},points:{type:"array",items:{type:"array",items:{type:"number"},minItems:2,maxItems:3},description:"exact polyline in grid units; skips the router"},lane:{type:"number"},arrow:{type:"boolean"},cross:{type:"boolean",description:"the route may pass through fence walls (it crosses a boundary)"},label:{anyOf:[{type:"string"},{type:"object",additionalProperties:!1,required:["text"],properties:{text:{type:"string"},along:{type:"integer",minimum:1},side:{enum:["left","right"]},at:{type:"array",items:{type:"number"},minItems:2,maxItems:3,description:"exact place [x, y] or [x, y, z]; skips placement"},dir:{enum:["x","y"]},anchor:{enum:["start","middle","end"]}}}]},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},Os={type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"},vp=new RegExp("^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$","u");function ti(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=ti.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let m={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'",schema:je.required,parentSchema:je,data:t};n===null?n=[m]:n.push(m),a++}if(t.from===void 0){let m={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"from"},message:"must have required property 'from'",schema:je.required,parentSchema:je,data:t};n===null?n=[m]:n.push(m),a++}if(t.to===void 0){let m={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"to"},message:"must have required property 'to'",schema:je.required,parentSchema:je,data:t};n===null?n=[m]:n.push(m),a++}for(let m in t)if(!co.call(je.properties,m)){let h={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:m},message:"must NOT have additional properties",schema:!1,parentSchema:je,data:t};n===null?n=[h]:n.push(h),a++}if(t.id!==void 0){let m=t.id;if(typeof m=="string"){if(!It.test(m)){let h={instancePath:e+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:m};n===null?n=[h]:n.push(h),a++}}else{let h={instancePath:e+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:m};n===null?n=[h]:n.push(h),a++}}if(t.from!==void 0){let m=t.from;if(typeof m=="string"){if(!vp.test(m)){let h={instancePath:e+"/from",schemaPath:"#/$defs/endpoint/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"',schema:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$",parentSchema:Os,data:m};n===null?n=[h]:n.push(h),a++}}else{let h={instancePath:e+"/from",schemaPath:"#/$defs/endpoint/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Os.type,parentSchema:Os,data:m};n===null?n=[h]:n.push(h),a++}}if(t.to!==void 0){let m=t.to;if(typeof m=="string"){if(!vp.test(m)){let h={instancePath:e+"/to",schemaPath:"#/$defs/endpoint/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"',schema:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$",parentSchema:Os,data:m};n===null?n=[h]:n.push(h),a++}}else{let h={instancePath:e+"/to",schemaPath:"#/$defs/endpoint/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Os.type,parentSchema:Os,data:m};n===null?n=[h]:n.push(h),a++}}if(t.kind!==void 0){let m=t.kind;if(typeof m!="string"){let h={instancePath:e+"/kind",schemaPath:"#/properties/kind/type",keyword:"type",params:{type:"string"},message:"must be string",schema:je.properties.kind.type,parentSchema:je.properties.kind,data:m};n===null?n=[h]:n.push(h),a++}}if(t.via!==void 0){let m=t.via;if(Array.isArray(m)){let h=m.length;for(let y=0;y<h;y++){let g=m[y],k=a,u=!1,b=a;if(Array.isArray(g)){if(g.length>2){let $={instancePath:e+"/via/"+y,schemaPath:"#/$defs/point2/maxItems",keyword:"maxItems",params:{limit:2},message:"must NOT have more than 2 items",schema:2,parentSchema:Pt,data:g};n===null?n=[$]:n.push($),a++}if(g.length<2){let $={instancePath:e+"/via/"+y,schemaPath:"#/$defs/point2/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:Pt,data:g};n===null?n=[$]:n.push($),a++}let w=g.length;for(let $=0;$<w;$++){let v=g[$];if(typeof v!="number"){let O={instancePath:e+"/via/"+y+"/"+$,schemaPath:"#/$defs/point2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Pt.items.type,parentSchema:Pt.items,data:v};n===null?n=[O]:n.push(O),a++}}}else{let w={instancePath:e+"/via/"+y,schemaPath:"#/$defs/point2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Pt.type,parentSchema:Pt,data:g};n===null?n=[w]:n.push(w),a++}var p=b===a;u=u||p;let x=a;if(typeof g=="string"){if(!vp.test(g)){let w={instancePath:e+"/via/"+y,schemaPath:"#/$defs/endpoint/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"',schema:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$",parentSchema:Os,data:g};n===null?n=[w]:n.push(w),a++}}else{let w={instancePath:e+"/via/"+y,schemaPath:"#/$defs/endpoint/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Os.type,parentSchema:Os,data:g};n===null?n=[w]:n.push(w),a++}var p=x===a;if(u=u||p,u)a=k,n!==null&&(k?n.length=k:n=null);else{let w={instancePath:e+"/via/"+y,schemaPath:"#/properties/via/items/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:je.properties.via.items.anyOf,parentSchema:je.properties.via.items,data:g};n===null?n=[w]:n.push(w),a++}}}else{let h={instancePath:e+"/via",schemaPath:"#/properties/via/type",keyword:"type",params:{type:"array"},message:"must be array",schema:je.properties.via.type,parentSchema:je.properties.via,data:m};n===null?n=[h]:n.push(h),a++}}if(t.points!==void 0){let m=t.points;if(Array.isArray(m)){let h=m.length;for(let y=0;y<h;y++){let g=m[y];if(Array.isArray(g)){if(g.length>3){let u={instancePath:e+"/points/"+y,schemaPath:"#/properties/points/items/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:je.properties.points.items,data:g};n===null?n=[u]:n.push(u),a++}if(g.length<2){let u={instancePath:e+"/points/"+y,schemaPath:"#/properties/points/items/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:je.properties.points.items,data:g};n===null?n=[u]:n.push(u),a++}let k=g.length;for(let u=0;u<k;u++){let b=g[u];if(typeof b!="number"){let x={instancePath:e+"/points/"+y+"/"+u,schemaPath:"#/properties/points/items/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:je.properties.points.items.items.type,parentSchema:je.properties.points.items.items,data:b};n===null?n=[x]:n.push(x),a++}}}else{let k={instancePath:e+"/points/"+y,schemaPath:"#/properties/points/items/type",keyword:"type",params:{type:"array"},message:"must be array",schema:je.properties.points.items.type,parentSchema:je.properties.points.items,data:g};n===null?n=[k]:n.push(k),a++}}}else{let h={instancePath:e+"/points",schemaPath:"#/properties/points/type",keyword:"type",params:{type:"array"},message:"must be array",schema:je.properties.points.type,parentSchema:je.properties.points,data:m};n===null?n=[h]:n.push(h),a++}}if(t.lane!==void 0){let m=t.lane;if(typeof m!="number"){let h={instancePath:e+"/lane",schemaPath:"#/properties/lane/type",keyword:"type",params:{type:"number"},message:"must be number",schema:je.properties.lane.type,parentSchema:je.properties.lane,data:m};n===null?n=[h]:n.push(h),a++}}if(t.arrow!==void 0){let m=t.arrow;if(typeof m!="boolean"){let h={instancePath:e+"/arrow",schemaPath:"#/properties/arrow/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:je.properties.arrow.type,parentSchema:je.properties.arrow,data:m};n===null?n=[h]:n.push(h),a++}}if(t.cross!==void 0){let m=t.cross;if(typeof m!="boolean"){let h={instancePath:e+"/cross",schemaPath:"#/properties/cross/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:je.properties.cross.type,parentSchema:je.properties.cross,data:m};n===null?n=[h]:n.push(h),a++}}if(t.label!==void 0){let m=t.label,h=a,y=!1,g=a;if(typeof m!="string"){let u={instancePath:e+"/label",schemaPath:"#/properties/label/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:je.properties.label.anyOf[0].type,parentSchema:je.properties.label.anyOf[0],data:m};n===null?n=[u]:n.push(u),a++}var c=g===a;y=y||c;let k=a;if(m&&typeof m=="object"&&!Array.isArray(m)){if(m.text===void 0){let u={instancePath:e+"/label",schemaPath:"#/properties/label/anyOf/1/required",keyword:"required",params:{missingProperty:"text"},message:"must have required property 'text'",schema:je.properties.label.anyOf[1].required,parentSchema:je.properties.label.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}for(let u in m)if(!(u==="text"||u==="along"||u==="side"||u==="at"||u==="dir"||u==="anchor")){let b={instancePath:e+"/label",schemaPath:"#/properties/label/anyOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:u},message:"must NOT have additional properties",schema:!1,parentSchema:je.properties.label.anyOf[1],data:m};n===null?n=[b]:n.push(b),a++}if(m.text!==void 0){let u=m.text;if(typeof u!="string"){let b={instancePath:e+"/label/text",schemaPath:"#/properties/label/anyOf/1/properties/text/type",keyword:"type",params:{type:"string"},message:"must be string",schema:je.properties.label.anyOf[1].properties.text.type,parentSchema:je.properties.label.anyOf[1].properties.text,data:u};n===null?n=[b]:n.push(b),a++}}if(m.along!==void 0){let u=m.along;if(!(typeof u=="number"&&!(u%1)&&!isNaN(u))){let b={instancePath:e+"/label/along",schemaPath:"#/properties/label/anyOf/1/properties/along/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:je.properties.label.anyOf[1].properties.along.type,parentSchema:je.properties.label.anyOf[1].properties.along,data:u};n===null?n=[b]:n.push(b),a++}if(typeof u=="number"&&(u<1||isNaN(u))){let b={instancePath:e+"/label/along",schemaPath:"#/properties/label/anyOf/1/properties/along/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:je.properties.label.anyOf[1].properties.along,data:u};n===null?n=[b]:n.push(b),a++}}if(m.side!==void 0){let u=m.side;if(!(u==="left"||u==="right")){let b={instancePath:e+"/label/side",schemaPath:"#/properties/label/anyOf/1/properties/side/enum",keyword:"enum",params:{allowedValues:je.properties.label.anyOf[1].properties.side.enum},message:"must be equal to one of the allowed values",schema:je.properties.label.anyOf[1].properties.side.enum,parentSchema:je.properties.label.anyOf[1].properties.side,data:u};n===null?n=[b]:n.push(b),a++}}if(m.at!==void 0){let u=m.at;if(Array.isArray(u)){if(u.length>3){let x={instancePath:e+"/label/at",schemaPath:"#/properties/label/anyOf/1/properties/at/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:je.properties.label.anyOf[1].properties.at,data:u};n===null?n=[x]:n.push(x),a++}if(u.length<2){let x={instancePath:e+"/label/at",schemaPath:"#/properties/label/anyOf/1/properties/at/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:je.properties.label.anyOf[1].properties.at,data:u};n===null?n=[x]:n.push(x),a++}let b=u.length;for(let x=0;x<b;x++){let w=u[x];if(typeof w!="number"){let $={instancePath:e+"/label/at/"+x,schemaPath:"#/properties/label/anyOf/1/properties/at/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:je.properties.label.anyOf[1].properties.at.items.type,parentSchema:je.properties.label.anyOf[1].properties.at.items,data:w};n===null?n=[$]:n.push($),a++}}}else{let b={instancePath:e+"/label/at",schemaPath:"#/properties/label/anyOf/1/properties/at/type",keyword:"type",params:{type:"array"},message:"must be array",schema:je.properties.label.anyOf[1].properties.at.type,parentSchema:je.properties.label.anyOf[1].properties.at,data:u};n===null?n=[b]:n.push(b),a++}}if(m.dir!==void 0){let u=m.dir;if(!(u==="x"||u==="y")){let b={instancePath:e+"/label/dir",schemaPath:"#/properties/label/anyOf/1/properties/dir/enum",keyword:"enum",params:{allowedValues:je.properties.label.anyOf[1].properties.dir.enum},message:"must be equal to one of the allowed values",schema:je.properties.label.anyOf[1].properties.dir.enum,parentSchema:je.properties.label.anyOf[1].properties.dir,data:u};n===null?n=[b]:n.push(b),a++}}if(m.anchor!==void 0){let u=m.anchor;if(!(u==="start"||u==="middle"||u==="end")){let b={instancePath:e+"/label/anchor",schemaPath:"#/properties/label/anyOf/1/properties/anchor/enum",keyword:"enum",params:{allowedValues:je.properties.label.anyOf[1].properties.anchor.enum},message:"must be equal to one of the allowed values",schema:je.properties.label.anyOf[1].properties.anchor.enum,parentSchema:je.properties.label.anyOf[1].properties.anchor,data:u};n===null?n=[b]:n.push(b),a++}}}else{let u={instancePath:e+"/label",schemaPath:"#/properties/label/anyOf/1/type",keyword:"type",params:{type:"object"},message:"must be object",schema:je.properties.label.anyOf[1].type,parentSchema:je.properties.label.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}var c=k===a;if(y=y||c,y)a=h,n!==null&&(h?n.length=h:n=null);else{let u={instancePath:e+"/label",schemaPath:"#/properties/label/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:je.properties.label.anyOf,parentSchema:je.properties.label,data:m};n===null?n=[u]:n.push(u),a++}}if(t.appears!==void 0){let m=t.appears,h=a,y=!1,g=a;if(typeof m!="string"){let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ye.anyOf[0].type,parentSchema:Ye.anyOf[0],data:m};n===null?n=[u]:n.push(u),a++}var l=g===a;y=y||l;let k=a;if(!(typeof m=="number"&&!(m%1)&&!isNaN(m))){let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Ye.anyOf[1].type,parentSchema:Ye.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}if(typeof m=="number"&&(m<1||isNaN(m))){let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Ye.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}var l=k===a;if(y=y||l,y)a=h,n!==null&&(h?n.length=h:n=null);else{let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Ye.anyOf,parentSchema:Ye,data:m};n===null?n=[u]:n.push(u),a++}}if(t.disappears!==void 0){let m=t.disappears,h=a,y=!1,g=a;if(typeof m!="string"){let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ye.anyOf[0].type,parentSchema:Ye.anyOf[0],data:m};n===null?n=[u]:n.push(u),a++}var d=g===a;y=y||d;let k=a;if(!(typeof m=="number"&&!(m%1)&&!isNaN(m))){let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Ye.anyOf[1].type,parentSchema:Ye.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}if(typeof m=="number"&&(m<1||isNaN(m))){let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Ye.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}var d=k===a;if(y=y||d,y)a=h,n!==null&&(h?n.length=h:n=null);else{let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Ye.anyOf,parentSchema:Ye,data:m};n===null?n=[u]:n.push(u),a++}}}else{let m={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:je.type,parentSchema:je,data:t};n===null?n=[m]:n.push(m),a++}return ti.errors=n,a===0}ti.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var ot={type:"object",additionalProperties:!1,properties:{floor:{type:"string"},face:{type:"string"},label:{type:"string"},sub:{type:"string"},at:{anyOf:[{$ref:"#/$defs/point2"},{type:"array",items:{type:"number"},minItems:3,maxItems:3}]},on:{$ref:"#/$defs/id",description:"a node, region or route; a note on a route dims and lights with it"},kind:{type:"string"},dir:{enum:["x","y"]},anchor:{enum:["start","middle","end"]},dx:{type:"number"},dy:{type:"number"},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}};function ni(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=ni.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){for(let m in t)if(!co.call(ot.properties,m)){let h={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:m},message:"must NOT have additional properties",schema:!1,parentSchema:ot,data:t};n===null?n=[h]:n.push(h),a++}if(t.floor!==void 0){let m=t.floor;if(typeof m!="string"){let h={instancePath:e+"/floor",schemaPath:"#/properties/floor/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ot.properties.floor.type,parentSchema:ot.properties.floor,data:m};n===null?n=[h]:n.push(h),a++}}if(t.face!==void 0){let m=t.face;if(typeof m!="string"){let h={instancePath:e+"/face",schemaPath:"#/properties/face/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ot.properties.face.type,parentSchema:ot.properties.face,data:m};n===null?n=[h]:n.push(h),a++}}if(t.label!==void 0){let m=t.label;if(typeof m!="string"){let h={instancePath:e+"/label",schemaPath:"#/properties/label/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ot.properties.label.type,parentSchema:ot.properties.label,data:m};n===null?n=[h]:n.push(h),a++}}if(t.sub!==void 0){let m=t.sub;if(typeof m!="string"){let h={instancePath:e+"/sub",schemaPath:"#/properties/sub/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ot.properties.sub.type,parentSchema:ot.properties.sub,data:m};n===null?n=[h]:n.push(h),a++}}if(t.at!==void 0){let m=t.at,h=a,y=!1,g=a;if(Array.isArray(m)){if(m.length>2){let b={instancePath:e+"/at",schemaPath:"#/$defs/point2/maxItems",keyword:"maxItems",params:{limit:2},message:"must NOT have more than 2 items",schema:2,parentSchema:Pt,data:m};n===null?n=[b]:n.push(b),a++}if(m.length<2){let b={instancePath:e+"/at",schemaPath:"#/$defs/point2/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:Pt,data:m};n===null?n=[b]:n.push(b),a++}let u=m.length;for(let b=0;b<u;b++){let x=m[b];if(typeof x!="number"){let w={instancePath:e+"/at/"+b,schemaPath:"#/$defs/point2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Pt.items.type,parentSchema:Pt.items,data:x};n===null?n=[w]:n.push(w),a++}}}else{let u={instancePath:e+"/at",schemaPath:"#/$defs/point2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Pt.type,parentSchema:Pt,data:m};n===null?n=[u]:n.push(u),a++}var c=g===a;if(y=y||c,c)var p=!0;let k=a;if(Array.isArray(m)){if(m.length>3){let b={instancePath:e+"/at",schemaPath:"#/properties/at/anyOf/1/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:ot.properties.at.anyOf[1],data:m};n===null?n=[b]:n.push(b),a++}if(m.length<3){let b={instancePath:e+"/at",schemaPath:"#/properties/at/anyOf/1/minItems",keyword:"minItems",params:{limit:3},message:"must NOT have fewer than 3 items",schema:3,parentSchema:ot.properties.at.anyOf[1],data:m};n===null?n=[b]:n.push(b),a++}let u=m.length;for(let b=0;b<u;b++){let x=m[b];if(typeof x!="number"){let w={instancePath:e+"/at/"+b,schemaPath:"#/properties/at/anyOf/1/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:ot.properties.at.anyOf[1].items.type,parentSchema:ot.properties.at.anyOf[1].items,data:x};n===null?n=[w]:n.push(w),a++}}}else{let u={instancePath:e+"/at",schemaPath:"#/properties/at/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ot.properties.at.anyOf[1].type,parentSchema:ot.properties.at.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}var c=k===a;if(y=y||c,c&&p!==!0&&(p=!0),y)a=h,n!==null&&(h?n.length=h:n=null);else{let u={instancePath:e+"/at",schemaPath:"#/properties/at/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:ot.properties.at.anyOf,parentSchema:ot.properties.at,data:m};n===null?n=[u]:n.push(u),a++}}if(t.on!==void 0){let m=t.on;if(typeof m=="string"){if(!It.test(m)){let h={instancePath:e+"/on",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:m};n===null?n=[h]:n.push(h),a++}}else{let h={instancePath:e+"/on",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:m};n===null?n=[h]:n.push(h),a++}}if(t.kind!==void 0){let m=t.kind;if(typeof m!="string"){let h={instancePath:e+"/kind",schemaPath:"#/properties/kind/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ot.properties.kind.type,parentSchema:ot.properties.kind,data:m};n===null?n=[h]:n.push(h),a++}}if(t.dir!==void 0){let m=t.dir;if(!(m==="x"||m==="y")){let h={instancePath:e+"/dir",schemaPath:"#/properties/dir/enum",keyword:"enum",params:{allowedValues:ot.properties.dir.enum},message:"must be equal to one of the allowed values",schema:ot.properties.dir.enum,parentSchema:ot.properties.dir,data:m};n===null?n=[h]:n.push(h),a++}}if(t.anchor!==void 0){let m=t.anchor;if(!(m==="start"||m==="middle"||m==="end")){let h={instancePath:e+"/anchor",schemaPath:"#/properties/anchor/enum",keyword:"enum",params:{allowedValues:ot.properties.anchor.enum},message:"must be equal to one of the allowed values",schema:ot.properties.anchor.enum,parentSchema:ot.properties.anchor,data:m};n===null?n=[h]:n.push(h),a++}}if(t.dx!==void 0){let m=t.dx;if(typeof m!="number"){let h={instancePath:e+"/dx",schemaPath:"#/properties/dx/type",keyword:"type",params:{type:"number"},message:"must be number",schema:ot.properties.dx.type,parentSchema:ot.properties.dx,data:m};n===null?n=[h]:n.push(h),a++}}if(t.dy!==void 0){let m=t.dy;if(typeof m!="number"){let h={instancePath:e+"/dy",schemaPath:"#/properties/dy/type",keyword:"type",params:{type:"number"},message:"must be number",schema:ot.properties.dy.type,parentSchema:ot.properties.dy,data:m};n===null?n=[h]:n.push(h),a++}}if(t.appears!==void 0){let m=t.appears,h=a,y=!1,g=a;if(typeof m!="string"){let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ye.anyOf[0].type,parentSchema:Ye.anyOf[0],data:m};n===null?n=[u]:n.push(u),a++}var l=g===a;y=y||l;let k=a;if(!(typeof m=="number"&&!(m%1)&&!isNaN(m))){let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Ye.anyOf[1].type,parentSchema:Ye.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}if(typeof m=="number"&&(m<1||isNaN(m))){let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Ye.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}var l=k===a;if(y=y||l,y)a=h,n!==null&&(h?n.length=h:n=null);else{let u={instancePath:e+"/appears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Ye.anyOf,parentSchema:Ye,data:m};n===null?n=[u]:n.push(u),a++}}if(t.disappears!==void 0){let m=t.disappears,h=a,y=!1,g=a;if(typeof m!="string"){let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ye.anyOf[0].type,parentSchema:Ye.anyOf[0],data:m};n===null?n=[u]:n.push(u),a++}var d=g===a;y=y||d;let k=a;if(!(typeof m=="number"&&!(m%1)&&!isNaN(m))){let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:Ye.anyOf[1].type,parentSchema:Ye.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}if(typeof m=="number"&&(m<1||isNaN(m))){let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:Ye.anyOf[1],data:m};n===null?n=[u]:n.push(u),a++}var d=k===a;if(y=y||d,y)a=h,n!==null&&(h?n.length=h:n=null);else{let u={instancePath:e+"/disappears",schemaPath:"#/$defs/stepRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Ye.anyOf,parentSchema:Ye,data:m};n===null?n=[u]:n.push(u),a++}}}else{let m={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:ot.type,parentSchema:ot,data:t};n===null?n=[m]:n.push(m),a++}return ni.errors=n,a===0}ni.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};var we={type:"object",required:["heading"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},number:{type:"integer",minimum:1,description:"the number shown; defaults to the position"},kind:{type:"string"},heading:{type:"string"},caption:{type:"string"},command:{type:"string"},animate:{type:"array",items:{$ref:"#/$defs/phase"}},pulse:{type:"array",items:{$ref:"#/$defs/id"}},highlight:{type:"array",items:{$ref:"#/$defs/id"}},focus:{type:"array",items:{$ref:"#/$defs/id"},description:"nodes or regions to zoom to for this step; the view eases back on steps without focus"},show:{type:"array",items:{$ref:"#/$defs/id"}},hide:{type:"array",items:{$ref:"#/$defs/id"}},say:{type:"array",items:{type:"object",additionalProperties:!1,required:["at","text"],properties:{at:{anyOf:[{$ref:"#/$defs/id"},{type:"array",items:{type:"number"},minItems:2,maxItems:3}],description:"a node (the callout sits above it) or a grid point [x, y, z]"},text:{type:"string"},kind:{type:"string"},dx:{type:"number"},dy:{type:"number"},anchor:{enum:["start","middle","end"]}}}},mark:{type:"array",items:{type:"object",additionalProperties:!1,properties:{on:{$ref:"#/$defs/id"},at:{type:"array",items:{type:"number"},minItems:2,maxItems:3}}}},badge:{anyOf:[{type:"boolean"},{$ref:"#/$defs/id"},{type:"array",items:{type:"number"},minItems:2,maxItems:3}],description:"false, a route or node id, or a grid point [x, y, z]"},duration:{anyOf:[{const:"auto"},{type:"integer",minimum:500}]}}},kl={anyOf:[{$ref:"#/$defs/routeRef"},{type:"array",items:{$ref:"#/$defs/routeRef"}}]},Ft={anyOf:[{type:"string"},{type:"object",minProperties:1,maxProperties:1,additionalProperties:{type:"string"}}]};function si(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=si.evaluated;f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0);let p=a,c=!1,l=a,d=a,m=!1,h=a;if(typeof t!="string"){let $={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ft.anyOf[0].type,parentSchema:Ft.anyOf[0],data:t};n===null?n=[$]:n.push($),a++}var g=h===a;m=m||g;let y=a;if(t&&typeof t=="object"&&!Array.isArray(t)){if(Object.keys(t).length>1){let $={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf/1/maxProperties",keyword:"maxProperties",params:{limit:1},message:"must NOT have more than 1 properties",schema:1,parentSchema:Ft.anyOf[1],data:t};n===null?n=[$]:n.push($),a++}if(Object.keys(t).length<1){let $={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf/1/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Ft.anyOf[1],data:t};n===null?n=[$]:n.push($),a++}for(let $ in t){let v=t[$];if(typeof v!="string"){let O={instancePath:e+"/"+$.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/routeRef/anyOf/1/additionalProperties/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ft.anyOf[1].additionalProperties.type,parentSchema:Ft.anyOf[1].additionalProperties,data:v};n===null?n=[O]:n.push(O),a++}}}else{let $={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf/1/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Ft.anyOf[1].type,parentSchema:Ft.anyOf[1],data:t};n===null?n=[$]:n.push($),a++}var g=y===a;if(m=m||g,g)var k=!0;if(m)a=d,n!==null&&(d?n.length=d:n=null);else{let $={instancePath:e,schemaPath:"#/$defs/routeRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Ft.anyOf,parentSchema:Ft,data:t};n===null?n=[$]:n.push($),a++}var x=l===a;c=c||x;let u=a;if(Array.isArray(t)){let $=t.length;for(let v=0;v<$;v++){let O=t[v],C=a,A=!1,R=a;if(typeof O!="string"){let T={instancePath:e+"/"+v,schemaPath:"#/$defs/routeRef/anyOf/0/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ft.anyOf[0].type,parentSchema:Ft.anyOf[0],data:O};n===null?n=[T]:n.push(T),a++}var b=R===a;A=A||b;let M=a;if(O&&typeof O=="object"&&!Array.isArray(O)){if(Object.keys(O).length>1){let T={instancePath:e+"/"+v,schemaPath:"#/$defs/routeRef/anyOf/1/maxProperties",keyword:"maxProperties",params:{limit:1},message:"must NOT have more than 1 properties",schema:1,parentSchema:Ft.anyOf[1],data:O};n===null?n=[T]:n.push(T),a++}if(Object.keys(O).length<1){let T={instancePath:e+"/"+v,schemaPath:"#/$defs/routeRef/anyOf/1/minProperties",keyword:"minProperties",params:{limit:1},message:"must NOT have fewer than 1 properties",schema:1,parentSchema:Ft.anyOf[1],data:O};n===null?n=[T]:n.push(T),a++}for(let T in O){let S=O[T];if(typeof S!="string"){let N={instancePath:e+"/"+v+"/"+T.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/routeRef/anyOf/1/additionalProperties/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ft.anyOf[1].additionalProperties.type,parentSchema:Ft.anyOf[1].additionalProperties,data:S};n===null?n=[N]:n.push(N),a++}}}else{let T={instancePath:e+"/"+v,schemaPath:"#/$defs/routeRef/anyOf/1/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Ft.anyOf[1].type,parentSchema:Ft.anyOf[1],data:O};n===null?n=[T]:n.push(T),a++}var b=M===a;if(A=A||b,A)a=C,n!==null&&(C?n.length=C:n=null);else{let T={instancePath:e+"/"+v,schemaPath:"#/$defs/routeRef/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Ft.anyOf,parentSchema:Ft,data:O};n===null?n=[T]:n.push(T),a++}}}else{let $={instancePath:e,schemaPath:"#/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array",schema:kl.anyOf[1].type,parentSchema:kl.anyOf[1],data:t};n===null?n=[$]:n.push($),a++}var x=u===a;if(c=c||x,x)var w=!0;if(c)a=p,n!==null&&(p?n.length=p:n=null);else{let $={instancePath:e,schemaPath:"#/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:kl.anyOf,parentSchema:kl,data:t};n===null?n=[$]:n.push($),a++}return si.errors=n,f.props=k,f.items=w,a===0}si.evaluated={dynamicProps:!0,dynamicItems:!0};function ri(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=ri.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(t.heading===void 0){let d={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"heading"},message:"must have required property 'heading'",schema:we.required,parentSchema:we,data:t};n===null?n=[d]:n.push(d),a++}for(let d in t)if(!co.call(we.properties,d)){let m={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:d},message:"must NOT have additional properties",schema:!1,parentSchema:we,data:t};n===null?n=[m]:n.push(m),a++}if(t.id!==void 0){let d=t.id;if(typeof d=="string"){if(!It.test(d)){let m={instancePath:e+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:d};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:d};n===null?n=[m]:n.push(m),a++}}if(t.number!==void 0){let d=t.number;if(!(typeof d=="number"&&!(d%1)&&!isNaN(d))){let m={instancePath:e+"/number",schemaPath:"#/properties/number/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:we.properties.number.type,parentSchema:we.properties.number,data:d};n===null?n=[m]:n.push(m),a++}if(typeof d=="number"&&(d<1||isNaN(d))){let m={instancePath:e+"/number",schemaPath:"#/properties/number/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1",schema:1,parentSchema:we.properties.number,data:d};n===null?n=[m]:n.push(m),a++}}if(t.kind!==void 0){let d=t.kind;if(typeof d!="string"){let m={instancePath:e+"/kind",schemaPath:"#/properties/kind/type",keyword:"type",params:{type:"string"},message:"must be string",schema:we.properties.kind.type,parentSchema:we.properties.kind,data:d};n===null?n=[m]:n.push(m),a++}}if(t.heading!==void 0){let d=t.heading;if(typeof d!="string"){let m={instancePath:e+"/heading",schemaPath:"#/properties/heading/type",keyword:"type",params:{type:"string"},message:"must be string",schema:we.properties.heading.type,parentSchema:we.properties.heading,data:d};n===null?n=[m]:n.push(m),a++}}if(t.caption!==void 0){let d=t.caption;if(typeof d!="string"){let m={instancePath:e+"/caption",schemaPath:"#/properties/caption/type",keyword:"type",params:{type:"string"},message:"must be string",schema:we.properties.caption.type,parentSchema:we.properties.caption,data:d};n===null?n=[m]:n.push(m),a++}}if(t.command!==void 0){let d=t.command;if(typeof d!="string"){let m={instancePath:e+"/command",schemaPath:"#/properties/command/type",keyword:"type",params:{type:"string"},message:"must be string",schema:we.properties.command.type,parentSchema:we.properties.command,data:d};n===null?n=[m]:n.push(m),a++}}if(t.animate!==void 0){let d=t.animate;if(Array.isArray(d)){let m=d.length;for(let h=0;h<m;h++)si(d[h],{instancePath:e+"/animate/"+h,parentData:d,parentDataProperty:h,rootData:i,dynamicAnchors:o})||(n=n===null?si.errors:n.concat(si.errors),a=n.length)}else{let m={instancePath:e+"/animate",schemaPath:"#/properties/animate/type",keyword:"type",params:{type:"array"},message:"must be array",schema:we.properties.animate.type,parentSchema:we.properties.animate,data:d};n===null?n=[m]:n.push(m),a++}}if(t.pulse!==void 0){let d=t.pulse;if(Array.isArray(d)){let m=d.length;for(let h=0;h<m;h++){let y=d[h];if(typeof y=="string"){if(!It.test(y)){let g={instancePath:e+"/pulse/"+h,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:y};n===null?n=[g]:n.push(g),a++}}else{let g={instancePath:e+"/pulse/"+h,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:y};n===null?n=[g]:n.push(g),a++}}}else{let m={instancePath:e+"/pulse",schemaPath:"#/properties/pulse/type",keyword:"type",params:{type:"array"},message:"must be array",schema:we.properties.pulse.type,parentSchema:we.properties.pulse,data:d};n===null?n=[m]:n.push(m),a++}}if(t.highlight!==void 0){let d=t.highlight;if(Array.isArray(d)){let m=d.length;for(let h=0;h<m;h++){let y=d[h];if(typeof y=="string"){if(!It.test(y)){let g={instancePath:e+"/highlight/"+h,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:y};n===null?n=[g]:n.push(g),a++}}else{let g={instancePath:e+"/highlight/"+h,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:y};n===null?n=[g]:n.push(g),a++}}}else{let m={instancePath:e+"/highlight",schemaPath:"#/properties/highlight/type",keyword:"type",params:{type:"array"},message:"must be array",schema:we.properties.highlight.type,parentSchema:we.properties.highlight,data:d};n===null?n=[m]:n.push(m),a++}}if(t.focus!==void 0){let d=t.focus;if(Array.isArray(d)){let m=d.length;for(let h=0;h<m;h++){let y=d[h];if(typeof y=="string"){if(!It.test(y)){let g={instancePath:e+"/focus/"+h,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:y};n===null?n=[g]:n.push(g),a++}}else{let g={instancePath:e+"/focus/"+h,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:y};n===null?n=[g]:n.push(g),a++}}}else{let m={instancePath:e+"/focus",schemaPath:"#/properties/focus/type",keyword:"type",params:{type:"array"},message:"must be array",schema:we.properties.focus.type,parentSchema:we.properties.focus,data:d};n===null?n=[m]:n.push(m),a++}}if(t.show!==void 0){let d=t.show;if(Array.isArray(d)){let m=d.length;for(let h=0;h<m;h++){let y=d[h];if(typeof y=="string"){if(!It.test(y)){let g={instancePath:e+"/show/"+h,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:y};n===null?n=[g]:n.push(g),a++}}else{let g={instancePath:e+"/show/"+h,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:y};n===null?n=[g]:n.push(g),a++}}}else{let m={instancePath:e+"/show",schemaPath:"#/properties/show/type",keyword:"type",params:{type:"array"},message:"must be array",schema:we.properties.show.type,parentSchema:we.properties.show,data:d};n===null?n=[m]:n.push(m),a++}}if(t.hide!==void 0){let d=t.hide;if(Array.isArray(d)){let m=d.length;for(let h=0;h<m;h++){let y=d[h];if(typeof y=="string"){if(!It.test(y)){let g={instancePath:e+"/hide/"+h,schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:y};n===null?n=[g]:n.push(g),a++}}else{let g={instancePath:e+"/hide/"+h,schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:y};n===null?n=[g]:n.push(g),a++}}}else{let m={instancePath:e+"/hide",schemaPath:"#/properties/hide/type",keyword:"type",params:{type:"array"},message:"must be array",schema:we.properties.hide.type,parentSchema:we.properties.hide,data:d};n===null?n=[m]:n.push(m),a++}}if(t.say!==void 0){let d=t.say;if(Array.isArray(d)){let m=d.length;for(let h=0;h<m;h++){let y=d[h];if(y&&typeof y=="object"&&!Array.isArray(y)){if(y.at===void 0){let g={instancePath:e+"/say/"+h,schemaPath:"#/properties/say/items/required",keyword:"required",params:{missingProperty:"at"},message:"must have required property 'at'",schema:we.properties.say.items.required,parentSchema:we.properties.say.items,data:y};n===null?n=[g]:n.push(g),a++}if(y.text===void 0){let g={instancePath:e+"/say/"+h,schemaPath:"#/properties/say/items/required",keyword:"required",params:{missingProperty:"text"},message:"must have required property 'text'",schema:we.properties.say.items.required,parentSchema:we.properties.say.items,data:y};n===null?n=[g]:n.push(g),a++}for(let g in y)if(!(g==="at"||g==="text"||g==="kind"||g==="dx"||g==="dy"||g==="anchor")){let k={instancePath:e+"/say/"+h,schemaPath:"#/properties/say/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:g},message:"must NOT have additional properties",schema:!1,parentSchema:we.properties.say.items,data:y};n===null?n=[k]:n.push(k),a++}if(y.at!==void 0){let g=y.at,k=a,u=!1,b=a;if(typeof g=="string"){if(!It.test(g)){let w={instancePath:e+"/say/"+h+"/at",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:g};n===null?n=[w]:n.push(w),a++}}else{let w={instancePath:e+"/say/"+h+"/at",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:g};n===null?n=[w]:n.push(w),a++}var p=b===a;u=u||p;let x=a;if(Array.isArray(g)){if(g.length>3){let $={instancePath:e+"/say/"+h+"/at",schemaPath:"#/properties/say/items/properties/at/anyOf/1/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:we.properties.say.items.properties.at.anyOf[1],data:g};n===null?n=[$]:n.push($),a++}if(g.length<2){let $={instancePath:e+"/say/"+h+"/at",schemaPath:"#/properties/say/items/properties/at/anyOf/1/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:we.properties.say.items.properties.at.anyOf[1],data:g};n===null?n=[$]:n.push($),a++}let w=g.length;for(let $=0;$<w;$++){let v=g[$];if(typeof v!="number"){let O={instancePath:e+"/say/"+h+"/at/"+$,schemaPath:"#/properties/say/items/properties/at/anyOf/1/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:we.properties.say.items.properties.at.anyOf[1].items.type,parentSchema:we.properties.say.items.properties.at.anyOf[1].items,data:v};n===null?n=[O]:n.push(O),a++}}}else{let w={instancePath:e+"/say/"+h+"/at",schemaPath:"#/properties/say/items/properties/at/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array",schema:we.properties.say.items.properties.at.anyOf[1].type,parentSchema:we.properties.say.items.properties.at.anyOf[1],data:g};n===null?n=[w]:n.push(w),a++}var p=x===a;if(u=u||p,u)a=k,n!==null&&(k?n.length=k:n=null);else{let w={instancePath:e+"/say/"+h+"/at",schemaPath:"#/properties/say/items/properties/at/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:we.properties.say.items.properties.at.anyOf,parentSchema:we.properties.say.items.properties.at,data:g};n===null?n=[w]:n.push(w),a++}}if(y.text!==void 0){let g=y.text;if(typeof g!="string"){let k={instancePath:e+"/say/"+h+"/text",schemaPath:"#/properties/say/items/properties/text/type",keyword:"type",params:{type:"string"},message:"must be string",schema:we.properties.say.items.properties.text.type,parentSchema:we.properties.say.items.properties.text,data:g};n===null?n=[k]:n.push(k),a++}}if(y.kind!==void 0){let g=y.kind;if(typeof g!="string"){let k={instancePath:e+"/say/"+h+"/kind",schemaPath:"#/properties/say/items/properties/kind/type",keyword:"type",params:{type:"string"},message:"must be string",schema:we.properties.say.items.properties.kind.type,parentSchema:we.properties.say.items.properties.kind,data:g};n===null?n=[k]:n.push(k),a++}}if(y.dx!==void 0){let g=y.dx;if(typeof g!="number"){let k={instancePath:e+"/say/"+h+"/dx",schemaPath:"#/properties/say/items/properties/dx/type",keyword:"type",params:{type:"number"},message:"must be number",schema:we.properties.say.items.properties.dx.type,parentSchema:we.properties.say.items.properties.dx,data:g};n===null?n=[k]:n.push(k),a++}}if(y.dy!==void 0){let g=y.dy;if(typeof g!="number"){let k={instancePath:e+"/say/"+h+"/dy",schemaPath:"#/properties/say/items/properties/dy/type",keyword:"type",params:{type:"number"},message:"must be number",schema:we.properties.say.items.properties.dy.type,parentSchema:we.properties.say.items.properties.dy,data:g};n===null?n=[k]:n.push(k),a++}}if(y.anchor!==void 0){let g=y.anchor;if(!(g==="start"||g==="middle"||g==="end")){let k={instancePath:e+"/say/"+h+"/anchor",schemaPath:"#/properties/say/items/properties/anchor/enum",keyword:"enum",params:{allowedValues:we.properties.say.items.properties.anchor.enum},message:"must be equal to one of the allowed values",schema:we.properties.say.items.properties.anchor.enum,parentSchema:we.properties.say.items.properties.anchor,data:g};n===null?n=[k]:n.push(k),a++}}}else{let g={instancePath:e+"/say/"+h,schemaPath:"#/properties/say/items/type",keyword:"type",params:{type:"object"},message:"must be object",schema:we.properties.say.items.type,parentSchema:we.properties.say.items,data:y};n===null?n=[g]:n.push(g),a++}}}else{let m={instancePath:e+"/say",schemaPath:"#/properties/say/type",keyword:"type",params:{type:"array"},message:"must be array",schema:we.properties.say.type,parentSchema:we.properties.say,data:d};n===null?n=[m]:n.push(m),a++}}if(t.mark!==void 0){let d=t.mark;if(Array.isArray(d)){let m=d.length;for(let h=0;h<m;h++){let y=d[h];if(y&&typeof y=="object"&&!Array.isArray(y)){for(let g in y)if(!(g==="on"||g==="at")){let k={instancePath:e+"/mark/"+h,schemaPath:"#/properties/mark/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:g},message:"must NOT have additional properties",schema:!1,parentSchema:we.properties.mark.items,data:y};n===null?n=[k]:n.push(k),a++}if(y.on!==void 0){let g=y.on;if(typeof g=="string"){if(!It.test(g)){let k={instancePath:e+"/mark/"+h+"/on",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:g};n===null?n=[k]:n.push(k),a++}}else{let k={instancePath:e+"/mark/"+h+"/on",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:g};n===null?n=[k]:n.push(k),a++}}if(y.at!==void 0){let g=y.at;if(Array.isArray(g)){if(g.length>3){let u={instancePath:e+"/mark/"+h+"/at",schemaPath:"#/properties/mark/items/properties/at/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:we.properties.mark.items.properties.at,data:g};n===null?n=[u]:n.push(u),a++}if(g.length<2){let u={instancePath:e+"/mark/"+h+"/at",schemaPath:"#/properties/mark/items/properties/at/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:we.properties.mark.items.properties.at,data:g};n===null?n=[u]:n.push(u),a++}let k=g.length;for(let u=0;u<k;u++){let b=g[u];if(typeof b!="number"){let x={instancePath:e+"/mark/"+h+"/at/"+u,schemaPath:"#/properties/mark/items/properties/at/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:we.properties.mark.items.properties.at.items.type,parentSchema:we.properties.mark.items.properties.at.items,data:b};n===null?n=[x]:n.push(x),a++}}}else{let k={instancePath:e+"/mark/"+h+"/at",schemaPath:"#/properties/mark/items/properties/at/type",keyword:"type",params:{type:"array"},message:"must be array",schema:we.properties.mark.items.properties.at.type,parentSchema:we.properties.mark.items.properties.at,data:g};n===null?n=[k]:n.push(k),a++}}}else{let g={instancePath:e+"/mark/"+h,schemaPath:"#/properties/mark/items/type",keyword:"type",params:{type:"object"},message:"must be object",schema:we.properties.mark.items.type,parentSchema:we.properties.mark.items,data:y};n===null?n=[g]:n.push(g),a++}}}else{let m={instancePath:e+"/mark",schemaPath:"#/properties/mark/type",keyword:"type",params:{type:"array"},message:"must be array",schema:we.properties.mark.type,parentSchema:we.properties.mark,data:d};n===null?n=[m]:n.push(m),a++}}if(t.badge!==void 0){let d=t.badge,m=a,h=!1,y=a;if(typeof d!="boolean"){let u={instancePath:e+"/badge",schemaPath:"#/properties/badge/anyOf/0/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:we.properties.badge.anyOf[0].type,parentSchema:we.properties.badge.anyOf[0],data:d};n===null?n=[u]:n.push(u),a++}var c=y===a;h=h||c;let g=a;if(typeof d=="string"){if(!It.test(d)){let u={instancePath:e+"/badge",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:d};n===null?n=[u]:n.push(u),a++}}else{let u={instancePath:e+"/badge",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:d};n===null?n=[u]:n.push(u),a++}var c=g===a;h=h||c;let k=a;if(Array.isArray(d)){if(d.length>3){let b={instancePath:e+"/badge",schemaPath:"#/properties/badge/anyOf/2/maxItems",keyword:"maxItems",params:{limit:3},message:"must NOT have more than 3 items",schema:3,parentSchema:we.properties.badge.anyOf[2],data:d};n===null?n=[b]:n.push(b),a++}if(d.length<2){let b={instancePath:e+"/badge",schemaPath:"#/properties/badge/anyOf/2/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:we.properties.badge.anyOf[2],data:d};n===null?n=[b]:n.push(b),a++}let u=d.length;for(let b=0;b<u;b++){let x=d[b];if(typeof x!="number"){let w={instancePath:e+"/badge/"+b,schemaPath:"#/properties/badge/anyOf/2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:we.properties.badge.anyOf[2].items.type,parentSchema:we.properties.badge.anyOf[2].items,data:x};n===null?n=[w]:n.push(w),a++}}}else{let u={instancePath:e+"/badge",schemaPath:"#/properties/badge/anyOf/2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:we.properties.badge.anyOf[2].type,parentSchema:we.properties.badge.anyOf[2],data:d};n===null?n=[u]:n.push(u),a++}var c=k===a;if(h=h||c,h)a=m,n!==null&&(m?n.length=m:n=null);else{let u={instancePath:e+"/badge",schemaPath:"#/properties/badge/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:we.properties.badge.anyOf,parentSchema:we.properties.badge,data:d};n===null?n=[u]:n.push(u),a++}}if(t.duration!==void 0){let d=t.duration,m=a,h=!1,y=a;if(d!=="auto"){let k={instancePath:e+"/duration",schemaPath:"#/properties/duration/anyOf/0/const",keyword:"const",params:{allowedValue:"auto"},message:"must be equal to constant",schema:"auto",parentSchema:we.properties.duration.anyOf[0],data:d};n===null?n=[k]:n.push(k),a++}var l=y===a;h=h||l;let g=a;if(!(typeof d=="number"&&!(d%1)&&!isNaN(d))){let k={instancePath:e+"/duration",schemaPath:"#/properties/duration/anyOf/1/type",keyword:"type",params:{type:"integer"},message:"must be integer",schema:we.properties.duration.anyOf[1].type,parentSchema:we.properties.duration.anyOf[1],data:d};n===null?n=[k]:n.push(k),a++}if(typeof d=="number"&&(d<500||isNaN(d))){let k={instancePath:e+"/duration",schemaPath:"#/properties/duration/anyOf/1/minimum",keyword:"minimum",params:{comparison:">=",limit:500},message:"must be >= 500",schema:500,parentSchema:we.properties.duration.anyOf[1],data:d};n===null?n=[k]:n.push(k),a++}var l=g===a;if(h=h||l,h)a=m,n!==null&&(m?n.length=m:n=null);else{let k={instancePath:e+"/duration",schemaPath:"#/properties/duration/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:we.properties.duration.anyOf,parentSchema:we.properties.duration,data:d};n===null?n=[k]:n.push(k),a++}}}else{let d={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:we.type,parentSchema:we,data:t};n===null?n=[d]:n.push(d),a++}return ri.errors=n,a===0}ri.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function ii(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=ii.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(t.id===void 0){let l={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"id"},message:"must have required property 'id'",schema:ve.required,parentSchema:ve,data:t};n===null?n=[l]:n.push(l),a++}if(t.title===void 0){let l={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"title"},message:"must have required property 'title'",schema:ve.required,parentSchema:ve,data:t};n===null?n=[l]:n.push(l),a++}for(let l in t)if(!co.call(ve.properties,l)){let d={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:l},message:"must NOT have additional properties",schema:!1,parentSchema:ve,data:t};n===null?n=[d]:n.push(d),a++}if(t.id!==void 0){let l=t.id;if(typeof l=="string"){if(!It.test(l)){let d={instancePath:e+"/id",schemaPath:"#/$defs/id/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},message:'must match pattern "^[A-Za-z][A-Za-z0-9_-]*$"',schema:"^[A-Za-z][A-Za-z0-9_-]*$",parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/id",schemaPath:"#/$defs/id/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Ee.type,parentSchema:Ee,data:l};n===null?n=[d]:n.push(d),a++}}if(t.title!==void 0){let l=t.title;if(typeof l!="string"){let d={instancePath:e+"/title",schemaPath:"#/properties/title/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ve.properties.title.type,parentSchema:ve.properties.title,data:l};n===null?n=[d]:n.push(d),a++}}if(t.ants!==void 0){let l=t.ants,d=a,m=!1,h=a;if(typeof l!="boolean"){let k={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf/0/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:ve.properties.ants.anyOf[0].type,parentSchema:ve.properties.ants.anyOf[0],data:l};n===null?n=[k]:n.push(k),a++}var p=h===a;m=m||p;let y=a;if(Array.isArray(l)){let k=l.length;for(let u=0;u<k;u++){let b=l[u];if(typeof b!="string"){let x={instancePath:e+"/ants/"+u,schemaPath:"#/properties/ants/anyOf/1/items/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ve.properties.ants.anyOf[1].items.type,parentSchema:ve.properties.ants.anyOf[1].items,data:b};n===null?n=[x]:n.push(x),a++}}}else{let k={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ve.properties.ants.anyOf[1].type,parentSchema:ve.properties.ants.anyOf[1],data:l};n===null?n=[k]:n.push(k),a++}var p=y===a;m=m||p;let g=a;if(l&&typeof l=="object"&&!Array.isArray(l)){for(let k in l)if(!(k==="ids"||k==="speed"||k==="dash")){let u={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf/2/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:k},message:"must NOT have additional properties",schema:!1,parentSchema:ve.properties.ants.anyOf[2],data:l};n===null?n=[u]:n.push(u),a++}if(l.ids!==void 0){let k=l.ids;if(Array.isArray(k)){let u=k.length;for(let b=0;b<u;b++){let x=k[b];if(typeof x!="string"){let w={instancePath:e+"/ants/ids/"+b,schemaPath:"#/properties/ants/anyOf/2/properties/ids/items/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ve.properties.ants.anyOf[2].properties.ids.items.type,parentSchema:ve.properties.ants.anyOf[2].properties.ids.items,data:x};n===null?n=[w]:n.push(w),a++}}}else{let u={instancePath:e+"/ants/ids",schemaPath:"#/properties/ants/anyOf/2/properties/ids/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ve.properties.ants.anyOf[2].properties.ids.type,parentSchema:ve.properties.ants.anyOf[2].properties.ids,data:k};n===null?n=[u]:n.push(u),a++}}if(l.speed!==void 0){let k=l.speed;if(typeof k!="number"){let u={instancePath:e+"/ants/speed",schemaPath:"#/properties/ants/anyOf/2/properties/speed/type",keyword:"type",params:{type:"number"},message:"must be number",schema:ve.properties.ants.anyOf[2].properties.speed.type,parentSchema:ve.properties.ants.anyOf[2].properties.speed,data:k};n===null?n=[u]:n.push(u),a++}}if(l.dash!==void 0){let k=l.dash;if(Array.isArray(k)){if(k.length>2){let b={instancePath:e+"/ants/dash",schemaPath:"#/properties/ants/anyOf/2/properties/dash/maxItems",keyword:"maxItems",params:{limit:2},message:"must NOT have more than 2 items",schema:2,parentSchema:ve.properties.ants.anyOf[2].properties.dash,data:k};n===null?n=[b]:n.push(b),a++}if(k.length<2){let b={instancePath:e+"/ants/dash",schemaPath:"#/properties/ants/anyOf/2/properties/dash/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:ve.properties.ants.anyOf[2].properties.dash,data:k};n===null?n=[b]:n.push(b),a++}let u=k.length;for(let b=0;b<u;b++){let x=k[b];if(typeof x=="number"){if(x<=0||isNaN(x)){let w={instancePath:e+"/ants/dash/"+b,schemaPath:"#/properties/ants/anyOf/2/properties/dash/items/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:ve.properties.ants.anyOf[2].properties.dash.items,data:x};n===null?n=[w]:n.push(w),a++}}else{let w={instancePath:e+"/ants/dash/"+b,schemaPath:"#/properties/ants/anyOf/2/properties/dash/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:ve.properties.ants.anyOf[2].properties.dash.items.type,parentSchema:ve.properties.ants.anyOf[2].properties.dash.items,data:x};n===null?n=[w]:n.push(w),a++}}}else{let u={instancePath:e+"/ants/dash",schemaPath:"#/properties/ants/anyOf/2/properties/dash/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ve.properties.ants.anyOf[2].properties.dash.type,parentSchema:ve.properties.ants.anyOf[2].properties.dash,data:k};n===null?n=[u]:n.push(u),a++}}}else{let k={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf/2/type",keyword:"type",params:{type:"object"},message:"must be object",schema:ve.properties.ants.anyOf[2].type,parentSchema:ve.properties.ants.anyOf[2],data:l};n===null?n=[k]:n.push(k),a++}var p=g===a;if(m=m||p,m)a=d,n!==null&&(d?n.length=d:n=null);else{let k={instancePath:e+"/ants",schemaPath:"#/properties/ants/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:ve.properties.ants.anyOf,parentSchema:ve.properties.ants,data:l};n===null?n=[k]:n.push(k),a++}}if(t.motion!==void 0){let l=t.motion;if(!(l&&typeof l=="object"&&!Array.isArray(l))){let d={instancePath:e+"/motion",schemaPath:"#/properties/motion/type",keyword:"type",params:{type:"object"},message:"must be object",schema:ve.properties.motion.type,parentSchema:ve.properties.motion,data:l};n===null?n=[d]:n.push(d),a++}}if(t.caption!==void 0){let l=t.caption;if(typeof l!="string"){let d={instancePath:e+"/caption",schemaPath:"#/properties/caption/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ve.properties.caption.type,parentSchema:ve.properties.caption,data:l};n===null?n=[d]:n.push(d),a++}}if(t.aria!==void 0){let l=t.aria;if(typeof l!="string"){let d={instancePath:e+"/aria",schemaPath:"#/properties/aria/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ve.properties.aria.type,parentSchema:ve.properties.aria,data:l};n===null?n=[d]:n.push(d),a++}}if(t.gap!==void 0){let l=t.gap;if(typeof l=="number"){if(l<=0||isNaN(l)){let d={instancePath:e+"/gap",schemaPath:"#/properties/gap/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:ve.properties.gap,data:l};n===null?n=[d]:n.push(d),a++}}else{let d={instancePath:e+"/gap",schemaPath:"#/properties/gap/type",keyword:"type",params:{type:"number"},message:"must be number",schema:ve.properties.gap.type,parentSchema:ve.properties.gap,data:l};n===null?n=[d]:n.push(d),a++}}if(t.flow!==void 0){let l=t.flow;if(!(l==="row"||l==="column")){let d={instancePath:e+"/flow",schemaPath:"#/properties/flow/enum",keyword:"enum",params:{allowedValues:ve.properties.flow.enum},message:"must be equal to one of the allowed values",schema:ve.properties.flow.enum,parentSchema:ve.properties.flow,data:l};n===null?n=[d]:n.push(d),a++}}if(t.regions!==void 0){let l=t.regions;if(Array.isArray(l)){let d=l.length;for(let m=0;m<d;m++)mr(l[m],{instancePath:e+"/regions/"+m,parentData:l,parentDataProperty:m,rootData:i,dynamicAnchors:o})||(n=n===null?mr.errors:n.concat(mr.errors),a=n.length)}else{let d={instancePath:e+"/regions",schemaPath:"#/properties/regions/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ve.properties.regions.type,parentSchema:ve.properties.regions,data:l};n===null?n=[d]:n.push(d),a++}}if(t.nodes!==void 0){let l=t.nodes;if(Array.isArray(l)){let d=l.length;for(let m=0;m<d;m++)hs(l[m],{instancePath:e+"/nodes/"+m,parentData:l,parentDataProperty:m,rootData:i,dynamicAnchors:o})||(n=n===null?hs.errors:n.concat(hs.errors),a=n.length)}else{let d={instancePath:e+"/nodes",schemaPath:"#/properties/nodes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ve.properties.nodes.type,parentSchema:ve.properties.nodes,data:l};n===null?n=[d]:n.push(d),a++}}if(t.routes!==void 0){let l=t.routes;if(Array.isArray(l)){let d=l.length;for(let m=0;m<d;m++)ti(l[m],{instancePath:e+"/routes/"+m,parentData:l,parentDataProperty:m,rootData:i,dynamicAnchors:o})||(n=n===null?ti.errors:n.concat(ti.errors),a=n.length)}else{let d={instancePath:e+"/routes",schemaPath:"#/properties/routes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ve.properties.routes.type,parentSchema:ve.properties.routes,data:l};n===null?n=[d]:n.push(d),a++}}if(t.notes!==void 0){let l=t.notes;if(Array.isArray(l)){let d=l.length;for(let m=0;m<d;m++)ni(l[m],{instancePath:e+"/notes/"+m,parentData:l,parentDataProperty:m,rootData:i,dynamicAnchors:o})||(n=n===null?ni.errors:n.concat(ni.errors),a=n.length)}else{let d={instancePath:e+"/notes",schemaPath:"#/properties/notes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ve.properties.notes.type,parentSchema:ve.properties.notes,data:l};n===null?n=[d]:n.push(d),a++}}if(t.steps!==void 0){let l=t.steps;if(Array.isArray(l)){let d=l.length;for(let m=0;m<d;m++)ri(l[m],{instancePath:e+"/steps/"+m,parentData:l,parentDataProperty:m,rootData:i,dynamicAnchors:o})||(n=n===null?ri.errors:n.concat(ri.errors),a=n.length)}else{let d={instancePath:e+"/steps",schemaPath:"#/properties/steps/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ve.properties.steps.type,parentSchema:ve.properties.steps,data:l};n===null?n=[d]:n.push(d),a++}}if(t.legend!==void 0){let l=t.legend,d=a,m=!1,h=a;if(l!=="auto"){let k={instancePath:e+"/legend",schemaPath:"#/properties/legend/anyOf/0/enum",keyword:"enum",params:{allowedValues:ve.properties.legend.anyOf[0].enum},message:"must be equal to one of the allowed values",schema:ve.properties.legend.anyOf[0].enum,parentSchema:ve.properties.legend.anyOf[0],data:l};n===null?n=[k]:n.push(k),a++}var c=h===a;m=m||c;let y=a;if(l!==!1){let k={instancePath:e+"/legend",schemaPath:"#/properties/legend/anyOf/1/const",keyword:"const",params:{allowedValue:!1},message:"must be equal to constant",schema:!1,parentSchema:ve.properties.legend.anyOf[1],data:l};n===null?n=[k]:n.push(k),a++}var c=y===a;m=m||c;let g=a;if(Array.isArray(l)){let k=l.length;for(let u=0;u<k;u++){let b=l[u];if(typeof b!="string"){let x={instancePath:e+"/legend/"+u,schemaPath:"#/properties/legend/anyOf/2/items/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ve.properties.legend.anyOf[2].items.type,parentSchema:ve.properties.legend.anyOf[2].items,data:b};n===null?n=[x]:n.push(x),a++}}}else{let k={instancePath:e+"/legend",schemaPath:"#/properties/legend/anyOf/2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:ve.properties.legend.anyOf[2].type,parentSchema:ve.properties.legend.anyOf[2],data:l};n===null?n=[k]:n.push(k),a++}var c=g===a;if(m=m||c,m)a=d,n!==null&&(d?n.length=d:n=null);else{let k={instancePath:e+"/legend",schemaPath:"#/properties/legend/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:ve.properties.legend.anyOf,parentSchema:ve.properties.legend,data:l};n===null?n=[k]:n.push(k),a++}}if(t.badges!==void 0){let l=t.badges;if(typeof l!="boolean"){let d={instancePath:e+"/badges",schemaPath:"#/properties/badges/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:ve.properties.badges.type,parentSchema:ve.properties.badges,data:l};n===null?n=[d]:n.push(d),a++}}if(t.grid!==void 0){let l=t.grid;if(l&&typeof l=="object"&&!Array.isArray(l)){for(let d in l)if(!(d==="snap"||d==="show"||d==="step")){let m={instancePath:e+"/grid",schemaPath:"#/$defs/grid/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:d},message:"must NOT have additional properties",schema:!1,parentSchema:Rt,data:l};n===null?n=[m]:n.push(m),a++}if(l.snap!==void 0){let d=l.snap;if(typeof d=="number"){if(d<=0||isNaN(d)){let m={instancePath:e+"/grid/snap",schemaPath:"#/$defs/grid/properties/snap/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Rt.properties.snap,data:d};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e+"/grid/snap",schemaPath:"#/$defs/grid/properties/snap/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Rt.properties.snap.type,parentSchema:Rt.properties.snap,data:d};n===null?n=[m]:n.push(m),a++}}if(l.show!==void 0){let d=l.show;if(typeof d!="boolean"){let m={instancePath:e+"/grid/show",schemaPath:"#/$defs/grid/properties/show/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Rt.properties.show.type,parentSchema:Rt.properties.show,data:d};n===null?n=[m]:n.push(m),a++}}if(l.step!==void 0){let d=l.step;if(typeof d=="number"){if(d<=0||isNaN(d)){let m={instancePath:e+"/grid/step",schemaPath:"#/$defs/grid/properties/step/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Rt.properties.step,data:d};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e+"/grid/step",schemaPath:"#/$defs/grid/properties/step/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Rt.properties.step.type,parentSchema:Rt.properties.step,data:d};n===null?n=[m]:n.push(m),a++}}}else{let d={instancePath:e+"/grid",schemaPath:"#/$defs/grid/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Rt.type,parentSchema:Rt,data:l};n===null?n=[d]:n.push(d),a++}}if(t.assemble!==void 0){let l=t.assemble;if(typeof l!="boolean"){let d={instancePath:e+"/assemble",schemaPath:"#/properties/assemble/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:ve.properties.assemble.type,parentSchema:ve.properties.assemble,data:l};n===null?n=[d]:n.push(d),a++}}if(t.loop!==void 0){let l=t.loop;if(typeof l!="boolean"){let d={instancePath:e+"/loop",schemaPath:"#/properties/loop/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:ve.properties.loop.type,parentSchema:ve.properties.loop,data:l};n===null?n=[d]:n.push(d),a++}}if(t.dim!==void 0){let l=t.dim;if(!(l==="flows"||l==="all")){let d={instancePath:e+"/dim",schemaPath:"#/properties/dim/enum",keyword:"enum",params:{allowedValues:ve.properties.dim.enum},message:"must be equal to one of the allowed values",schema:ve.properties.dim.enum,parentSchema:ve.properties.dim,data:l};n===null?n=[d]:n.push(d),a++}}if(t.after!==void 0){let l=t.after;if(typeof l!="string"){let d={instancePath:e+"/after",schemaPath:"#/properties/after/type",keyword:"type",params:{type:"string"},message:"must be string",schema:ve.properties.after.type,parentSchema:ve.properties.after,data:l};n===null?n=[d]:n.push(d),a++}}}else{let l={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:ve.type,parentSchema:ve,data:t};n===null?n=[l]:n.push(l),a++}return ii.errors=n,a===0}ii.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function $l(t,{instancePath:e="",parentData:s,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let n=null,a=0,f=$l.evaluated;if(f.dynamicProps&&(f.props=void 0),f.dynamicItems&&(f.items=void 0),t&&typeof t=="object"&&!Array.isArray(t)){if(t.isodiag===void 0){let p={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"isodiag"},message:"must have required property 'isodiag'",schema:rt.required,parentSchema:rt,data:t};n===null?n=[p]:n.push(p),a++}if(t.scenes===void 0){let p={instancePath:e,schemaPath:"#/required",keyword:"required",params:{missingProperty:"scenes"},message:"must have required property 'scenes'",schema:rt.required,parentSchema:rt,data:t};n===null?n=[p]:n.push(p),a++}for(let p in t)if(!co.call(rt.properties,p)){let c={instancePath:e,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:p},message:"must NOT have additional properties",schema:!1,parentSchema:rt,data:t};n===null?n=[c]:n.push(c),a++}if(t.isodiag!==void 0){let p=t.isodiag;if(p!==1){let c={instancePath:e+"/isodiag",schemaPath:"#/properties/isodiag/const",keyword:"const",params:{allowedValue:1},message:"must be equal to constant",schema:1,parentSchema:rt.properties.isodiag,data:p};n===null?n=[c]:n.push(c),a++}}if(t.title!==void 0){let p=t.title;if(typeof p!="string"){let c={instancePath:e+"/title",schemaPath:"#/properties/title/type",keyword:"type",params:{type:"string"},message:"must be string",schema:rt.properties.title.type,parentSchema:rt.properties.title,data:p};n===null?n=[c]:n.push(c),a++}}if(t.lede!==void 0){let p=t.lede;if(typeof p!="string"){let c={instancePath:e+"/lede",schemaPath:"#/properties/lede/type",keyword:"type",params:{type:"string"},message:"must be string",schema:rt.properties.lede.type,parentSchema:rt.properties.lede,data:p};n===null?n=[c]:n.push(c),a++}}if(t.pills!==void 0){let p=t.pills;if(Array.isArray(p)){let c=p.length;for(let l=0;l<c;l++){let d=p[l];if(typeof d!="string"){let m={instancePath:e+"/pills/"+l,schemaPath:"#/properties/pills/items/type",keyword:"type",params:{type:"string"},message:"must be string",schema:rt.properties.pills.items.type,parentSchema:rt.properties.pills.items,data:d};n===null?n=[m]:n.push(m),a++}}}else{let c={instancePath:e+"/pills",schemaPath:"#/properties/pills/type",keyword:"type",params:{type:"array"},message:"must be array",schema:rt.properties.pills.type,parentSchema:rt.properties.pills,data:p};n===null?n=[c]:n.push(c),a++}}if(t.theme!==void 0){let p=t.theme;if(typeof p!="string"){let c={instancePath:e+"/theme",schemaPath:"#/properties/theme/type",keyword:"type",params:{type:"string"},message:"must be string",schema:rt.properties.theme.type,parentSchema:rt.properties.theme,data:p};n===null?n=[c]:n.push(c),a++}}if(t.roles!==void 0){let p=t.roles;if(p&&typeof p=="object"&&!Array.isArray(p))for(let c in p){let l=p[c];if(l&&typeof l=="object"&&!Array.isArray(l)){if(l.h===void 0){let d={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/role/required",keyword:"required",params:{missingProperty:"h"},message:"must have required property 'h'",schema:Lt.required,parentSchema:Lt,data:l};n===null?n=[d]:n.push(d),a++}if(l.s===void 0){let d={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/role/required",keyword:"required",params:{missingProperty:"s"},message:"must have required property 's'",schema:Lt.required,parentSchema:Lt,data:l};n===null?n=[d]:n.push(d),a++}for(let d in l)if(!(d==="h"||d==="s"||d==="top"||d==="tint")){let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/role/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:d},message:"must NOT have additional properties",schema:!1,parentSchema:Lt,data:l};n===null?n=[m]:n.push(m),a++}if(l.h!==void 0){let d=l.h;if(typeof d=="number"){if(d>360||isNaN(d)){let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/h",schemaPath:"#/$defs/role/properties/h/maximum",keyword:"maximum",params:{comparison:"<=",limit:360},message:"must be <= 360",schema:360,parentSchema:Lt.properties.h,data:d};n===null?n=[m]:n.push(m),a++}if(d<0||isNaN(d)){let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/h",schemaPath:"#/$defs/role/properties/h/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:Lt.properties.h,data:d};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/h",schemaPath:"#/$defs/role/properties/h/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Lt.properties.h.type,parentSchema:Lt.properties.h,data:d};n===null?n=[m]:n.push(m),a++}}if(l.s!==void 0){let d=l.s;if(typeof d=="number"){if(d>100||isNaN(d)){let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/s",schemaPath:"#/$defs/role/properties/s/maximum",keyword:"maximum",params:{comparison:"<=",limit:100},message:"must be <= 100",schema:100,parentSchema:Lt.properties.s,data:d};n===null?n=[m]:n.push(m),a++}if(d<0||isNaN(d)){let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/s",schemaPath:"#/$defs/role/properties/s/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:Lt.properties.s,data:d};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/s",schemaPath:"#/$defs/role/properties/s/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Lt.properties.s.type,parentSchema:Lt.properties.s,data:d};n===null?n=[m]:n.push(m),a++}}if(l.top!==void 0){let d=l.top;if(typeof d!="string"){let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/top",schemaPath:"#/$defs/role/properties/top/type",keyword:"type",params:{type:"string"},message:"must be string",schema:Lt.properties.top.type,parentSchema:Lt.properties.top,data:d};n===null?n=[m]:n.push(m),a++}}if(l.tint!==void 0){let d=l.tint;if(typeof d=="number"){if(d>100||isNaN(d)){let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/tint",schemaPath:"#/$defs/role/properties/tint/maximum",keyword:"maximum",params:{comparison:"<=",limit:100},message:"must be <= 100",schema:100,parentSchema:Lt.properties.tint,data:d};n===null?n=[m]:n.push(m),a++}if(d<0||isNaN(d)){let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/tint",schemaPath:"#/$defs/role/properties/tint/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0",schema:0,parentSchema:Lt.properties.tint,data:d};n===null?n=[m]:n.push(m),a++}}else{let m={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/tint",schemaPath:"#/$defs/role/properties/tint/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Lt.properties.tint.type,parentSchema:Lt.properties.tint,data:d};n===null?n=[m]:n.push(m),a++}}}else{let d={instancePath:e+"/roles/"+c.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/role/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Lt.type,parentSchema:Lt,data:l};n===null?n=[d]:n.push(d),a++}}else{let c={instancePath:e+"/roles",schemaPath:"#/properties/roles/type",keyword:"type",params:{type:"object"},message:"must be object",schema:rt.properties.roles.type,parentSchema:rt.properties.roles,data:p};n===null?n=[c]:n.push(c),a++}}if(t.kinds!==void 0){let p=t.kinds;if(p&&typeof p=="object"&&!Array.isArray(p))for(let c in p){let l=p[c];if(l&&typeof l=="object"&&!Array.isArray(l)){for(let d in l)if(!(d==="legend"||d==="like"||d==="color"||d==="dash")){let m={instancePath:e+"/kinds/"+c.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/kindDef/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:d},message:"must NOT have additional properties",schema:!1,parentSchema:jn,data:l};n===null?n=[m]:n.push(m),a++}if(l.legend!==void 0){let d=l.legend;if(typeof d!="string"){let m={instancePath:e+"/kinds/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/legend",schemaPath:"#/$defs/kindDef/properties/legend/type",keyword:"type",params:{type:"string"},message:"must be string",schema:jn.properties.legend.type,parentSchema:jn.properties.legend,data:d};n===null?n=[m]:n.push(m),a++}}if(l.like!==void 0){let d=l.like;if(typeof d!="string"){let m={instancePath:e+"/kinds/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/like",schemaPath:"#/$defs/kindDef/properties/like/type",keyword:"type",params:{type:"string"},message:"must be string",schema:jn.properties.like.type,parentSchema:jn.properties.like,data:d};n===null?n=[m]:n.push(m),a++}}if(l.color!==void 0){let d=l.color;if(typeof d!="string"){let m={instancePath:e+"/kinds/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/color",schemaPath:"#/$defs/kindDef/properties/color/type",keyword:"type",params:{type:"string"},message:"must be string",schema:jn.properties.color.type,parentSchema:jn.properties.color,data:d};n===null?n=[m]:n.push(m),a++}}if(l.dash!==void 0){let d=l.dash;if(!(d==="solid"||d==="dashed"||d==="dotted")){let m={instancePath:e+"/kinds/"+c.replace(/~/g,"~0").replace(/\//g,"~1")+"/dash",schemaPath:"#/$defs/kindDef/properties/dash/enum",keyword:"enum",params:{allowedValues:jn.properties.dash.enum},message:"must be equal to one of the allowed values",schema:jn.properties.dash.enum,parentSchema:jn.properties.dash,data:d};n===null?n=[m]:n.push(m),a++}}}else{let d={instancePath:e+"/kinds/"+c.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/$defs/kindDef/type",keyword:"type",params:{type:"object"},message:"must be object",schema:jn.type,parentSchema:jn,data:l};n===null?n=[d]:n.push(d),a++}}else{let c={instancePath:e+"/kinds",schemaPath:"#/properties/kinds/type",keyword:"type",params:{type:"object"},message:"must be object",schema:rt.properties.kinds.type,parentSchema:rt.properties.kinds,data:p};n===null?n=[c]:n.push(c),a++}}if(t.after!==void 0){let p=t.after;if(typeof p!="string"){let c={instancePath:e+"/after",schemaPath:"#/properties/after/type",keyword:"type",params:{type:"string"},message:"must be string",schema:rt.properties.after.type,parentSchema:rt.properties.after,data:p};n===null?n=[c]:n.push(c),a++}}if(t.grid!==void 0){let p=t.grid;if(p&&typeof p=="object"&&!Array.isArray(p)){for(let c in p)if(!(c==="snap"||c==="show"||c==="step")){let l={instancePath:e+"/grid",schemaPath:"#/$defs/grid/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:c},message:"must NOT have additional properties",schema:!1,parentSchema:Rt,data:p};n===null?n=[l]:n.push(l),a++}if(p.snap!==void 0){let c=p.snap;if(typeof c=="number"){if(c<=0||isNaN(c)){let l={instancePath:e+"/grid/snap",schemaPath:"#/$defs/grid/properties/snap/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Rt.properties.snap,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/grid/snap",schemaPath:"#/$defs/grid/properties/snap/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Rt.properties.snap.type,parentSchema:Rt.properties.snap,data:c};n===null?n=[l]:n.push(l),a++}}if(p.show!==void 0){let c=p.show;if(typeof c!="boolean"){let l={instancePath:e+"/grid/show",schemaPath:"#/$defs/grid/properties/show/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:Rt.properties.show.type,parentSchema:Rt.properties.show,data:c};n===null?n=[l]:n.push(l),a++}}if(p.step!==void 0){let c=p.step;if(typeof c=="number"){if(c<=0||isNaN(c)){let l={instancePath:e+"/grid/step",schemaPath:"#/$defs/grid/properties/step/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0",schema:0,parentSchema:Rt.properties.step,data:c};n===null?n=[l]:n.push(l),a++}}else{let l={instancePath:e+"/grid/step",schemaPath:"#/$defs/grid/properties/step/type",keyword:"type",params:{type:"number"},message:"must be number",schema:Rt.properties.step.type,parentSchema:Rt.properties.step,data:c};n===null?n=[l]:n.push(l),a++}}}else{let c={instancePath:e+"/grid",schemaPath:"#/$defs/grid/type",keyword:"type",params:{type:"object"},message:"must be object",schema:Rt.type,parentSchema:Rt,data:p};n===null?n=[c]:n.push(c),a++}}if(t.assemble!==void 0){let p=t.assemble;if(typeof p!="boolean"){let c={instancePath:e+"/assemble",schemaPath:"#/properties/assemble/type",keyword:"type",params:{type:"boolean"},message:"must be boolean",schema:rt.properties.assemble.type,parentSchema:rt.properties.assemble,data:p};n===null?n=[c]:n.push(c),a++}}if(t.footer!==void 0){let p=t.footer;if(typeof p!="string"){let c={instancePath:e+"/footer",schemaPath:"#/properties/footer/type",keyword:"type",params:{type:"string"},message:"must be string",schema:rt.properties.footer.type,parentSchema:rt.properties.footer,data:p};n===null?n=[c]:n.push(c),a++}}if(t.treatment!==void 0){let p=t.treatment;if(p!=="mono"){let c={instancePath:e+"/treatment",schemaPath:"#/properties/treatment/enum",keyword:"enum",params:{allowedValues:rt.properties.treatment.enum},message:"must be equal to one of the allowed values",schema:rt.properties.treatment.enum,parentSchema:rt.properties.treatment,data:p};n===null?n=[c]:n.push(c),a++}}if(t.scenes!==void 0){let p=t.scenes;if(Array.isArray(p)){if(p.length<1){let l={instancePath:e+"/scenes",schemaPath:"#/properties/scenes/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items",schema:1,parentSchema:rt.properties.scenes,data:p};n===null?n=[l]:n.push(l),a++}let c=p.length;for(let l=0;l<c;l++)ii(p[l],{instancePath:e+"/scenes/"+l,parentData:p,parentDataProperty:l,rootData:i,dynamicAnchors:o})||(n=n===null?ii.errors:n.concat(ii.errors),a=n.length)}else{let c={instancePath:e+"/scenes",schemaPath:"#/properties/scenes/type",keyword:"type",params:{type:"array"},message:"must be array",schema:rt.properties.scenes.type,parentSchema:rt.properties.scenes,data:p};n===null?n=[c]:n.push(c),a++}}}else{let p={instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object",schema:rt.type,parentSchema:rt,data:t};n===null?n=[p]:n.push(p),a++}return $l.errors=n,a===0}$l.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function vy(t){let e=JSON.stringify(t),s=2166136261;for(let r=0;r<e.length;r++)s^=e.charCodeAt(r),s=Math.imul(s,16777619)>>>0;return s.toString(16)+":"+e.length}var My=new Map([["28016100:13106",Tm]]);function Mp(t){let e=My.get(vy(t));if(!e)throw new Error(`schema not precompiled into the page: ${t.$id??t.title??"?"}`);return e}var Pp={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://isodiag.local/schema/isodiag-1.json",title:"isodiag diagram",description:"A page of isometric, animated diagrams. See docs/FORMAT.md.",type:"object",required:["isodiag","scenes"],additionalProperties:!1,properties:{isodiag:{const:1,description:"Format version. Always 1."},title:{type:"string"},lede:{type:"string"},pills:{type:"array",items:{type:"string"}},theme:{type:"string",description:"'default' or a path to a theme file"},roles:{type:"object",description:"Extra or changed colour roles for nodes and regions",additionalProperties:{$ref:"#/$defs/role"}},kinds:{type:"object",description:"Extra flow kinds, or new legend text for the standard ones",additionalProperties:{$ref:"#/$defs/kindDef"}},after:{type:"string",description:"Markdown shown after all scenes"},grid:{$ref:"#/$defs/grid"},assemble:{type:"boolean",description:"draw each scene by flying its parts in from the nearest edge, then play"},footer:{type:"string"},treatment:{enum:["mono"],description:"How a self-contained drawing (renderSvg, <isometric-diagram>) is painted: mono, black and white. A host may say otherwise. The page isodiag build writes is in colour."},scenes:{type:"array",minItems:1,items:{$ref:"#/$defs/scene"}}},$defs:{motion:{type:"object",additionalProperties:!1,minProperties:1,description:"how this piece (a region: its contents too) moves when the drawing assembles or disassembles",properties:{style:{enum:["edge","drop","rise","fly","pop","scatter","build","fade"],description:"how it arrives"},out:{enum:["explode","lift-off","sink","scatter","fly-out","collapse","fade","reverse"],description:"how it leaves"},easing:{enum:["linear","ease","ease-in","ease-out","settle","spring","bounce"]},from:{enum:["left","right","top","bottom"],description:"fly: the side it comes from"},delay:{type:"number",minimum:0,description:"ms after its turn"},duration:{type:"number",exclusiveMinimum:0,description:"ms its own move takes"}}},variants:{type:"object",minProperties:1,propertyNames:{$ref:"#/$defs/id"},description:"other looks of it, by name, for a motion to switch to (its box stays as it is)",additionalProperties:{type:"object",additionalProperties:!1,minProperties:1,properties:{role:{type:"string"},ghost:{type:"boolean"},label:{type:"string"},sub:{type:"string"},face:{type:"string",pattern:"^[a-z][a-z0-9-]*$"},deco:{type:"array",items:{$ref:"#/$defs/deco"}}}}},id:{type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*$"},grid:{type:"object",additionalProperties:!1,properties:{snap:{type:"number",exclusiveMinimum:0,description:"round every placed edge and route waypoint to this step, in grid units"},show:{type:"boolean",description:"draw the floor grid when the page opens (the Grid button toggles it)"},step:{type:"number",exclusiveMinimum:0,description:"spacing of the drawn grid lines; default the snap step, or 1"}}},num:{type:"number"},point2:{type:"array",items:{type:"number"},minItems:2,maxItems:2},size2or3:{type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:3},stepRef:{anyOf:[{type:"string"},{type:"integer",minimum:1}]},side:{enum:["n","e","s","w"]},align:{enum:["start","center","end"]},role:{type:"object",additionalProperties:!1,required:["h","s"],properties:{h:{type:"number",minimum:0,maximum:360,description:"hue"},s:{type:"number",minimum:0,maximum:100,description:"saturation, percent"},top:{type:"string",description:"CSS colour for the top face, overriding the computed one"},tint:{type:"number",minimum:0,maximum:100,description:"percent of the role colour mixed into the pad colour for the top face"}}},kindDef:{type:"object",additionalProperties:!1,properties:{legend:{type:"string"},like:{type:"string",description:"a standard kind whose colour and line style this one uses"},color:{type:"string"},dash:{enum:["solid","dashed","dotted"]}}},placement:{properties:{in:{$ref:"#/$defs/id"},at:{$ref:"#/$defs/point2"},"right-of":{$ref:"#/$defs/id"},"left-of":{$ref:"#/$defs/id"},below:{$ref:"#/$defs/id"},behind:{$ref:"#/$defs/id"},gap:{type:"number"},align:{$ref:"#/$defs/align"},shift:{$ref:"#/$defs/point2",description:"nudge after placement, grid units [dx, dy]"},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},scene:{type:"object",required:["id","title"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},title:{type:"string"},ants:{description:"its connectors march, showing which way they flow: all that may, these, or with a speed (units a second) and a dash",anyOf:[{type:"boolean"},{type:"array",items:{type:"string"}},{type:"object",additionalProperties:!1,properties:{ids:{type:"array",items:{type:"string"}},speed:{type:"number"},dash:{type:"array",items:{type:"number",exclusiveMinimum:0},minItems:2,maxItems:2}}}]},motion:{type:"object",description:"the scene's motion document (isomotion/1; its `isomotion: 1` may be left out)"},caption:{type:"string"},aria:{type:"string"},gap:{type:"number",exclusiveMinimum:0},flow:{enum:["row","column"]},regions:{type:"array",items:{$ref:"#/$defs/region"}},nodes:{type:"array",items:{$ref:"#/$defs/node"}},routes:{type:"array",items:{$ref:"#/$defs/route"}},notes:{type:"array",items:{$ref:"#/$defs/note"}},steps:{type:"array",items:{$ref:"#/$defs/step"}},legend:{anyOf:[{enum:["auto"]},{const:!1},{type:"array",items:{type:"string"}}]},badges:{type:"boolean"},grid:{$ref:"#/$defs/grid"},assemble:{type:"boolean",description:"draw the scene by flying its parts in from the nearest edge, then play"},loop:{type:"boolean",description:"the player wraps from the last step to the first (default true)"},dim:{enum:["flows","all"],description:"what a step dims: only flows, their labels and marks (default), or nodes too"},after:{type:"string"}}},region:{type:"object",required:["id","kind"],unevaluatedProperties:!1,allOf:[{$ref:"#/$defs/placement"}],properties:{id:{$ref:"#/$defs/id"},kind:{enum:["slab","pad","fence","vm","cloud","zone","platform","tunnel"]},label:{type:"string"},"label-style":{enum:["face","face-right","floor","none"]},ghost:{type:"boolean",description:"drawn as a dashed outline: not there yet, out of reach, or stopped"},role:{type:"string"},size:{$ref:"#/$defs/size2or3"},padding:{type:"number",minimum:0},height:{type:"number",exclusiveMinimum:0},z:{type:"number",description:"lift above the floor it stands on (tunnels)"},flow:{enum:["row","column"]},gate:{type:"object",additionalProperties:!1,required:["side"],properties:{side:{$ref:"#/$defs/side"},at:{type:"number",minimum:0,maximum:1,description:"centre of the gate along the wall, 0..1"},width:{type:"number",exclusiveMinimum:0},height:{type:"number",exclusiveMinimum:0},node:{$ref:"#/$defs/id"}}},around:{type:"array",items:{$ref:"#/$defs/id"},description:"tunnel: routes it wraps"},regions:{type:"array",items:{$ref:"#/$defs/region"}},motion:{$ref:"#/$defs/motion"},variants:{$ref:"#/$defs/variants"},nodes:{type:"array",items:{$ref:"#/$defs/node"}}}},deco:{anyOf:[{enum:["envelope","bubble","file-lines","ghost","terminal"]},{type:"object",additionalProperties:!1,minProperties:1,maxProperties:1,properties:{terminal:{type:"integer",minimum:1,maximum:8},icon:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"an icon the host registers (none by default); one nothing registers is drawn as a placeholder, with a warning"},screen:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"terminal, chat, desktop, tiles, or a face the host registers"}}}]},node:{type:"object",required:["id"],unevaluatedProperties:!1,allOf:[{$ref:"#/$defs/placement"}],properties:{id:{$ref:"#/$defs/id"},asset:{type:"string",description:"asset name from the library; default 'block'"},role:{type:"string",description:"colour role"},label:{type:"string"},sub:{type:"string"},size:{$ref:"#/$defs/size2or3"},z:{type:"number",description:"lift above the floor it stands on"},deco:{type:"array",items:{$ref:"#/$defs/deco"}},ghost:{type:"boolean"},face:{type:"string",pattern:"^[a-z][a-z0-9-]*$",description:"screen asset: what the screen shows: terminal, chat, desktop, tiles, or a face the host registers"},facing:{type:"number",description:"screen asset: rotation in degrees"},"label-at":{type:"object",additionalProperties:!1,properties:{side:{enum:["above","right","left","below"]},dx:{type:"number"},dy:{type:"number"}}},motion:{$ref:"#/$defs/motion"},variants:{$ref:"#/$defs/variants"},nodes:{type:"array",items:{$ref:"#/$defs/node"},description:"nodes standing on top of this one"}}},endpoint:{type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"},route:{type:"object",required:["id","from","to"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},from:{$ref:"#/$defs/endpoint"},to:{$ref:"#/$defs/endpoint"},kind:{type:"string"},via:{type:"array",items:{anyOf:[{$ref:"#/$defs/point2"},{$ref:"#/$defs/endpoint"}]}},points:{type:"array",items:{type:"array",items:{type:"number"},minItems:2,maxItems:3},description:"exact polyline in grid units; skips the router"},lane:{type:"number"},arrow:{type:"boolean"},cross:{type:"boolean",description:"the route may pass through fence walls (it crosses a boundary)"},label:{anyOf:[{type:"string"},{type:"object",additionalProperties:!1,required:["text"],properties:{text:{type:"string"},along:{type:"integer",minimum:1},side:{enum:["left","right"]},at:{type:"array",items:{type:"number"},minItems:2,maxItems:3,description:"exact place [x, y] or [x, y, z]; skips placement"},dir:{enum:["x","y"]},anchor:{enum:["start","middle","end"]}}}]},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},note:{type:"object",additionalProperties:!1,properties:{floor:{type:"string"},face:{type:"string"},label:{type:"string"},sub:{type:"string"},at:{anyOf:[{$ref:"#/$defs/point2"},{type:"array",items:{type:"number"},minItems:3,maxItems:3}]},on:{$ref:"#/$defs/id",description:"a node, region or route; a note on a route dims and lights with it"},kind:{type:"string"},dir:{enum:["x","y"]},anchor:{enum:["start","middle","end"]},dx:{type:"number"},dy:{type:"number"},appears:{$ref:"#/$defs/stepRef"},disappears:{$ref:"#/$defs/stepRef"}}},routeRef:{anyOf:[{type:"string"},{type:"object",minProperties:1,maxProperties:1,additionalProperties:{type:"string"}}]},phase:{anyOf:[{$ref:"#/$defs/routeRef"},{type:"array",items:{$ref:"#/$defs/routeRef"}}]},step:{type:"object",required:["heading"],additionalProperties:!1,properties:{id:{$ref:"#/$defs/id"},number:{type:"integer",minimum:1,description:"the number shown; defaults to the position"},kind:{type:"string"},heading:{type:"string"},caption:{type:"string"},command:{type:"string"},animate:{type:"array",items:{$ref:"#/$defs/phase"}},pulse:{type:"array",items:{$ref:"#/$defs/id"}},highlight:{type:"array",items:{$ref:"#/$defs/id"}},focus:{type:"array",items:{$ref:"#/$defs/id"},description:"nodes or regions to zoom to for this step; the view eases back on steps without focus"},show:{type:"array",items:{$ref:"#/$defs/id"}},hide:{type:"array",items:{$ref:"#/$defs/id"}},say:{type:"array",items:{type:"object",additionalProperties:!1,required:["at","text"],properties:{at:{anyOf:[{$ref:"#/$defs/id"},{type:"array",items:{type:"number"},minItems:2,maxItems:3}],description:"a node (the callout sits above it) or a grid point [x, y, z]"},text:{type:"string"},kind:{type:"string"},dx:{type:"number"},dy:{type:"number"},anchor:{enum:["start","middle","end"]}}}},mark:{type:"array",items:{type:"object",additionalProperties:!1,properties:{on:{$ref:"#/$defs/id"},at:{type:"array",items:{type:"number"},minItems:2,maxItems:3}}}},badge:{anyOf:[{type:"boolean"},{$ref:"#/$defs/id"},{type:"array",items:{type:"number"},minItems:2,maxItems:3}],description:"false, a route or node id, or a grid point [x, y, z]"},duration:{anyOf:[{const:"auto"},{type:"integer",minimum:500}]}}}}};var Ap=[];function Em(t){Ap.includes(t)||Ap.push(t)}function Op(t){for(let e of Ap){let s=e(t);if(s!==void 0)return s}return t?"this item":"the file"}function vl(t){return t===null?"nothing":Array.isArray(t)?"a list":typeof t=="object"?"a map":typeof t=="string"?`the text "${t}"`:`${typeof t} ${String(t)}`}var Nm={string:"text",number:"a number",integer:"a whole number",boolean:"true or false",array:"a list",object:"a map"},po=new Map;function Rm(t,e){po.set(t,e)}var Tp=new Map;function Im(t,e){Tp.set(t,(s,r)=>e(vl(s),r))}var Ep=[];function zm(t,e){Ep.some(([s])=>s===t)||Ep.push([t,e])}function Oy(t){let e=t.parentSchema,s=Object.keys(e?.properties??{});e?.$ref&&po.has(e.$ref)&&s.push(...po.get(e.$ref).filter(r=>!s.includes(r)));for(let r of e?.allOf??[])r.$ref&&po.has(r.$ref)&&s.push(...po.get(r.$ref));return s}function Sl(t,e){let s=t.propertyName??(t.keyword==="propertyNames"?t.params.propertyName:void 0);if(s!==void 0){let f=`${t.instancePath}/${s.replace(/~/g,"~0").replace(/\//g,"~1")}`,p=e.locate(f,{key:!0});return{severity:"error",message:`"${s}" can't be a name`,line:p.line,col:p.col,path:f,hint:"names are a lower-case letter, then lower-case letters, digits and -"}}let r=t.instancePath,i=t.message??"is not valid",o,n=e.locate(r),a=t.params;switch(t.keyword){case"required":i=`${Op(r)} is missing "${a.missingProperty}"`;break;case"additionalProperties":case"unevaluatedProperties":{let p=String(a.additionalProperty??a.unevaluatedProperty),c=Oy(t),l=Vt(p,c);return i=`unknown key "${p}" in ${Op(r)}`+(l?` (did you mean "${l}"?)`:""),!l&&c.length&&(o=`known keys: ${c.join(", ")}`),/\s/.test(p)&&(o='inside { \u2026 } a comma starts a new key: put text with commas in quotes, e.g. label: "read once, at launch"'),n=e.locate(`${r}/${p}`,{key:!0}),{severity:"error",message:i,line:n.line,col:n.col,path:`${r}/${p}`,hint:o}}case"enum":{let p=a.allowedValues.map(String),c=typeof t.data=="string"?Vt(t.data,p):void 0,l=r.split("/").pop();i=`${vl(t.data)} is not a valid ${l&&!/^\d+$/.test(l)?`"${l}"`:"value"}`+(c?` (did you mean "${c}"?)`:""),o=`expected one of: ${p.join(", ")}`;break}case"const":i=Tp.has(r)?Tp.get(r)(t.data,a.allowedValue):`must be ${JSON.stringify(a.allowedValue)}`;break;case"type":i=`expected ${Nm[String(a.type)]??a.type}, got ${vl(t.data)}`;break;case"pattern":let f=Ep.find(([p])=>String(a.pattern).startsWith(p));f?{message:i,hint:o}=f[1](t.data):(i=`"${t.data}" is not a valid id`,o="ids start with a letter and use only letters, digits, - and _");break;case"minItems":case"maxItems":t.schema===2||t.parentSchema?.minItems===2?i=`expected a list of ${t.parentSchema.minItems===t.parentSchema.maxItems?t.parentSchema.minItems:`${t.parentSchema.minItems} to ${t.parentSchema.maxItems}`} numbers, got ${t.data.length}`:i=`list ${t.message}`;break;case"false schema":{let p=r.split("/").pop()??"",c=r.split("/").slice(0,-1).join("/");i=`"${p.replace(/~1/g,"/").replace(/~0/g,"~")}" can't be set on ${Op(c)}`,n=e.locate(r,{key:!0});break}case"minimum":case"maximum":case"exclusiveMinimum":case"exclusiveMaximum":i=`${t.data} is out of range: ${t.message}`;break}return{severity:"error",message:i,line:n.line,col:n.col,path:r,hint:o}}function Cm(t,e){let s=t.filter(n=>n.keyword==="anyOf"),r=new Set,i=[];for(let n of s){let a=n.schemaPath.replace(/\/anyOf$/,"/anyOf/"),f=t.filter(l=>l!==n&&l.schemaPath.startsWith(a)&&l.instancePath.startsWith(n.instancePath));if(f.forEach(l=>r.add(l)),r.add(n),s.some(l=>l!==n&&n.schemaPath.startsWith(l.schemaPath.replace(/\/anyOf$/,"/anyOf/"))&&l.instancePath===n.instancePath))continue;let p=f.filter(l=>l.instancePath.length>n.instancePath.length&&l.keyword!=="anyOf"),c=f.find(l=>l.keyword==="enum"&&l.instancePath===n.instancePath&&typeof n.data=="string");if(c)i.push(Sl(c,e));else if(p.length)i.push(...p.map(l=>Sl(l,e)));else{let l=f.filter(d=>d.instancePath===n.instancePath&&d.keyword!=="type"&&d.keyword!=="anyOf");if(l.length&&typeof n.data=="object"&&n.data!==null)i.push(...l.map(d=>Sl(d,e)));else{let d=[...new Set(f.filter(h=>h.keyword==="type").map(h=>Nm[String(h.params.type)]??""))].filter(Boolean),m=e.locate(n.instancePath);i.push({severity:"error",message:`${vl(n.data)} is not allowed here`+(d.length?`; expected ${d.join(" or ")}`:""),line:m.line,col:m.col,path:n.instancePath})}}}for(let n of t)r.has(n)||i.push(Sl(n,e));let o=new Set;return i.filter(n=>{let a=`${n.path}|${n.message}`;return o.has(a)?!1:(o.add(a),!0)}).sort((n,a)=>n.line-a.line||n.col-a.col)}var jm=Mp(Pp),Ay=Object.keys(Pp.$defs.placement.properties);Rm("#/$defs/placement",Ay);Im("/isodiag",t=>`"isodiag" must be 1 (the format version), got ${t}`);var Ty={scene:"a scene",region:"a region",node:"a node",route:"a route",note:"a note",step:"a step"};Em(t=>{let e=/\/(scenes|regions|nodes|routes|notes|steps)\/\d+$/.exec(t);return e?Ty[e[1].replace(/s$/,"")]??"this item":void 0});zm("^[A-Za-z][A-Za-z0-9_-]*(",t=>({message:`"${t}" is not a node reference`,hint:"write an id, optionally with a side: worker, worker.e (sides: n, e, s, w, top)"}));function Lm(t){return t.data==null||typeof t.data!="object"||Array.isArray(t.data)?[{severity:"error",message:'the file must be a YAML map with "isodiag: 1" and "scenes:"',line:1,col:1,path:""}]:jm(t.data)?[]:Cm(jm.errors??[],t)}var fo=class extends Error{diags;constructor(e){super(e.filter(s=>s.severity==="error").map(s=>`line ${s.line}: ${s.message}`).join(`
436
+ `)),this.name="CompileError",this.diags=e}};function Ml(t,e,s={}){let r=Ny(t,e,s);if(!r.ok&&s.strict==="throw")throw new fo(r.diags);if(!r.ok&&s.strict&&(r.scenes=[]),s.stepMs!==void 0)for(let n of r.scenes)for(let a of n.steps.steps)a.duration=s.stepMs;if(s.treatment!==void 0&&s.treatment!=="mono"&&s.treatment!=="none")throw new Error(`treatment: there is "mono" (and "none"), and no ${JSON.stringify(s.treatment)}`);let i=(s.treatment??r.doc?.treatment)==="mono";if(s.treatment==="mono"&&!s.resolveVars)throw new Error("treatment: a self-contained drawing's (resolveVars)");let o=r.theme;if(s.resolveVars)for(let n of r.scenes){let a=s.mode??"light",f=ar(ts)+Qi+eo;if(i){Ey(n,o,a,f,s.mono);continue}let p={mode:a,theme:r.theme,css:f};n.rendered.svg=Zr(n.rendered.svg,p),n.rendered.variants&&(n.rendered.variants=Object.fromEntries(Object.entries(n.rendered.variants).map(([c,l])=>[c,Zr(l,p)]))),n.rendered.inks={surface:r.theme[p.mode].surface??r.theme.light.surface,control:r.theme[p.mode].control??r.theme.light.control,kinds:Object.fromEntries(Object.entries(r.theme.kinds).map(([c,l])=>[c,r.theme[p.mode][l.color]??l.color]))}}return s.resolveVars&&i&&o&&(r.theme={...o,kinds:Object.fromEntries(Object.entries(o.kinds).map(([n,a])=>{let f=r.scenes.map(p=>p.rendered.mono?.kinds[n]?.dash).find(p=>p&&p.length>1);return[n,f?{...a,ants:[f[0],f[1]]}:a]}))}),r}function Ey(t,e,s,r,i){let o=[t.rendered.svg,...Object.values(t.rendered.variants??{})],n=Ka(o.join(""),e,s,[...t.routes.map(f=>f.kind),...t.steps.kindsUsed],i),a=f=>Va(Zr(f,{mode:s,theme:n.theme,css:r+n.css}),n.look,t.id);t.rendered.svg=a(t.rendered.svg),t.rendered.variants&&(t.rendered.variants=Object.fromEntries(Object.entries(t.rendered.variants).map(([f,p])=>[f,a(p)]))),t.rendered.inks={surface:n.look.paper,control:n.look.ink,kinds:Object.fromEntries(Object.keys(e.kinds).map(f=>[f,n.look.ink]))},t.rendered.mono=n.look;for(let f of n.look.warnings)t.rendered.warnings.push({path:"",message:`black and white: ${f}`})}function Ny(t,e,s){let r=oa(t),i=[...r.diags];if(i.some(c=>c.severity==="error"))return{ok:!1,diags:i,catalog:ts,scenes:[]};let o=Lm(r);i.push(...o);let n=r.data;if(o.length){try{let c=_s(Tr(e),n.roles??{},n.kinds??{}),l=o.map(d=>d.path);(Array.isArray(n.scenes)?n.scenes:[]).forEach((d,m)=>{try{let h=Nr(d,`/scenes/${m}`,r,c,ts,n.roles??{});i.push(...h.diags.filter(y=>!l.some(g=>y.path===g||y.path.startsWith(g+"/"))))}catch{}})}catch{}return i.sort((c,l)=>c.line-l.line||c.col-l.col),{ok:!1,diags:i,catalog:ts,scenes:[]}}let a=Ua(n,e,ts,r,t,{snap:s.snap},i),f=0,p=(c,l,d)=>{let m=r.locate(c);a.diags.push({severity:"error",message:l,line:m.line,col:m.col,path:c,...d?{hint:d}:{}}),f++};return a.scenes.forEach((c,l)=>{Ca(c,a.theme);let d=c.raw.ants,m=Ss(c.raw)?.ids,h=c.routes.map(u=>u.id);if((m??[]).forEach((u,b)=>{h.includes(u)||p(`/scenes/${l}/ants${Array.isArray(d)?"":"/ids"}/${b}`,`no connector "${u}" in this scene`,h.length?`its connectors: ${h.slice(0,8).join(", ")}${h.length>8?", \u2026":""}`:void 0)}),!c.raw.motion)return;let y={isomotion:1,...c.raw.motion},g=`/scenes/${l}/motion`,k=vs(c,y,{kinds:a.theme.kinds}).diags;for(let u of k){let b=r.locate(g+u.path);a.diags.push({severity:u.severity,message:u.message,line:b.line,col:b.col,path:g+u.path,...u.hint?{hint:u.hint}:{}})}f+=k.length,k.length||(c.motion=y)}),f&&(a.ok=!1,a.diags.sort((c,l)=>c.line-l.line||c.col-l.col)),a}function _m(t,e){let s=Ml(t,e.theme,{mode:e.mode??"light",resolveVars:!0,strict:"throw",treatment:e.treatment,mono:e.mono}),r=s.theme.kinds,i=e.scene===void 0?s.scenes[0]:typeof e.scene=="number"?s.scenes[e.scene]:s.scenes.find(f=>f.id===e.scene);if(!i)throw new Error(`no scene ${JSON.stringify(e.scene)} (there ${s.scenes.length===1?"is":"are"} ${s.scenes.map(f=>f.id).join(", ")})`);let o=e.ants===void 0?Ss(i.raw):e.ants===!0?Ss(i.raw)??{}:e.ants||void 0;if(e.t===void 0)return o?ja(i,{...o,by:e.ambient==="off"?"none":"smil",kinds:r}):i.rendered.svg;if(e.ants)throw new Error("ants: at a moment they are its motion document's");let n=e.motion??i.motion;if(!n)throw new Error("t: this scene has no motion");let a=vs(i,n,{kinds:r});if(!a.ok)throw new Error(a.diags.map(f=>`${f.path}: ${f.message}${f.hint?` (${f.hint})`:""}`).join(`
437
+ `));return Ki(i,a.at(e.t,e.ambient===void 0?{}:{ambient:e.ambient}))}export{_d as core,Rf as objects,Fm as systems,vm as viewer};