@johnoscott/isometric-engine 0.0.0-stage → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/EDITOR-GUIDE.md +355 -0
- package/LICENSE +21 -0
- package/LICENSES/ajv.txt +22 -0
- package/LICENSES/lucide-static.txt +43 -0
- package/LICENSES/yaml.txt +13 -0
- package/README.md +62 -2
- package/assets/app.css +269 -0
- package/assets/default-theme.yaml +99 -0
- package/assets/icons.svg +1 -0
- package/assets/marks.css +39 -0
- package/assets/skin.css +181 -0
- package/iso-editor.d.ts +4 -0
- package/iso-editor.js +550 -0
- package/iso-render.d.ts +3 -0
- package/iso-render.js +388 -0
- package/iso-systems.d.ts +4 -0
- package/iso-systems.js +389 -0
- package/js/iso-core/compile-schema.js +22 -0
- package/js/iso-core/depth.js +55 -0
- package/js/iso-core/errors.js +65 -0
- package/js/iso-core/glyphs.js +100 -0
- package/js/iso-core/index.js +55 -0
- package/js/iso-core/kernel.js +158 -0
- package/js/iso-core/metrics.json +1 -0
- package/js/iso-core/package.json +6 -0
- package/js/iso-core/parse.js +79 -0
- package/js/iso-core/schema-errors.js +170 -0
- package/js/iso-core/shims/crypto.js +125 -0
- package/js/iso-core/shims/path.js +49 -0
- package/js/iso-core/svg-dom.js +144 -0
- package/js/iso-core/theme.js +48 -0
- package/js/iso-core/vdom.js +48 -0
- package/js/iso-editor/adapter.js +0 -0
- package/js/iso-editor/clipboard.js +152 -0
- package/js/iso-editor/commands.js +173 -0
- package/js/iso-editor/complete.js +55 -0
- package/js/iso-editor/doc.js +182 -0
- package/js/iso-editor/index.js +105 -0
- package/js/iso-editor/model.js +210 -0
- package/js/iso-editor/outline.js +111 -0
- package/js/iso-editor/package.json +6 -0
- package/js/iso-editor/path.js +19 -0
- package/js/iso-editor/providers.js +96 -0
- package/js/iso-editor/schema-nav.js +117 -0
- package/js/iso-editor/splice.js +443 -0
- package/js/iso-editor/storage-keys.js +6 -0
- package/js/iso-editor/ui/actions.js +116 -0
- package/js/iso-editor/ui/canvas-layer.js +0 -0
- package/js/iso-editor/ui/canvas.js +1403 -0
- package/js/iso-editor/ui/clip.js +133 -0
- package/js/iso-editor/ui/dialog.js +26 -0
- package/js/iso-editor/ui/flat-canvas.js +54 -0
- package/js/iso-editor/ui/icons.js +15 -0
- package/js/iso-editor/ui/keys.js +26 -0
- package/js/iso-editor/ui/later.js +28 -0
- package/js/iso-editor/ui/layer.js +11 -0
- package/js/iso-editor/ui/menu.js +105 -0
- package/js/iso-editor/ui/monaco-entry.js +2 -0
- package/js/iso-editor/ui/mount-kit.js +0 -0
- package/js/iso-editor/ui/mount.js +767 -0
- package/js/iso-editor/ui/pane.js +0 -0
- package/js/iso-editor/ui/part.js +0 -0
- package/js/iso-editor/ui/plain-icons.js +34 -0
- package/js/iso-editor/ui/props.js +314 -0
- package/js/iso-editor/ui/scope-css.js +81 -0
- package/js/iso-editor/ui/setup.js +149 -0
- package/js/iso-editor/ui/text.js +323 -0
- package/js/iso-editor/ui/tree.js +728 -0
- package/js/iso-editor/validate.js +33 -0
- package/js/iso-editor/window/protocol.js +8 -0
- package/js/iso-objects/assemble.js +43 -0
- package/js/iso-objects/assets.js +88 -0
- package/js/iso-objects/board.js +162 -0
- package/js/iso-objects/compile.js +60 -0
- package/js/iso-objects/css.js +154 -0
- package/js/iso-objects/flat.js +696 -0
- package/js/iso-objects/focus.js +16 -0
- package/js/iso-objects/geometry.js +76 -0
- package/js/iso-objects/index.js +93 -0
- package/js/iso-objects/kinds.js +12 -0
- package/js/iso-objects/labels.js +325 -0
- package/js/iso-objects/package.json +6 -0
- package/js/iso-objects/place.js +347 -0
- package/js/iso-objects/route.js +461 -0
- package/js/iso-objects/scene.js +350 -0
- package/js/iso-objects/steps.js +246 -0
- package/js/iso-objects/types.js +0 -0
- package/js/iso-systems/catalog.js +42 -0
- package/js/iso-systems/compile.js +34 -0
- package/js/iso-systems/css.js +8 -0
- package/js/iso-systems/index.js +16 -0
- package/js/iso-systems/nodes.js +124 -0
- package/js/iso-systems/package.json +6 -0
- package/js/iso-systems/schema.json +311 -0
- package/js/iso-systems/validate.js +35 -0
- package/js/iso-viewer/bundle.js +20 -0
- package/js/iso-viewer/card-motion.js +228 -0
- package/js/iso-viewer/dom.js +14 -0
- package/js/iso-viewer/dual-view.js +212 -0
- package/js/iso-viewer/flat-view.js +124 -0
- package/js/iso-viewer/history.js +990 -0
- package/js/iso-viewer/index.js +98 -0
- package/js/iso-viewer/morph.js +192 -0
- package/js/iso-viewer/overlay.js +199 -0
- package/js/iso-viewer/package.json +6 -0
- package/js/iso-viewer/page.js +138 -0
- package/js/iso-viewer/player.js +409 -0
- package/js/iso-viewer/still.js +81 -0
- package/js/iso-viewer/timeline-contract.js +14 -0
- package/js/iso-viewer/timeline-engine.js +475 -0
- package/js/iso-viewer/timeline-export.js +36 -0
- package/js/iso-viewer/timeline-scale.js +116 -0
- package/js/iso-viewer/timeline-scope.js +58 -0
- package/js/iso-viewer/timeline-search.js +216 -0
- package/js/iso-viewer/timeline-time.js +55 -0
- package/js/iso-viewer/view-css.js +68 -0
- package/js/iso-viewer/viewport.js +177 -0
- package/package.json +511 -4
- package/src/iso-core/compile-schema.ts +23 -0
- package/src/iso-core/depth.ts +56 -0
- package/src/iso-core/errors.ts +73 -0
- package/src/iso-core/glyphs.ts +108 -0
- package/src/iso-core/index.ts +27 -0
- package/src/iso-core/kernel.ts +163 -0
- package/src/iso-core/metrics.json +1 -0
- package/src/iso-core/package.json +6 -0
- package/src/iso-core/parse.ts +91 -0
- package/src/iso-core/schema-errors.ts +163 -0
- package/src/iso-core/shims/crypto.ts +37 -0
- package/src/iso-core/shims/path.ts +24 -0
- package/src/iso-core/svg-dom.ts +103 -0
- package/src/iso-core/theme.ts +64 -0
- package/src/iso-core/vdom.ts +41 -0
- package/src/iso-editor/adapter.ts +147 -0
- package/src/iso-editor/clipboard.ts +163 -0
- package/src/iso-editor/commands.ts +191 -0
- package/src/iso-editor/complete.ts +73 -0
- package/src/iso-editor/doc.ts +207 -0
- package/src/iso-editor/index.ts +67 -0
- package/src/iso-editor/model.ts +234 -0
- package/src/iso-editor/outline.ts +126 -0
- package/src/iso-editor/package.json +6 -0
- package/src/iso-editor/path.ts +18 -0
- package/src/iso-editor/providers.ts +113 -0
- package/src/iso-editor/schema-nav.ts +129 -0
- package/src/iso-editor/splice.ts +477 -0
- package/src/iso-editor/storage-keys.ts +6 -0
- package/src/iso-editor/ui/actions.ts +119 -0
- package/src/iso-editor/ui/app.css +230 -0
- package/src/iso-editor/ui/canvas-layer.ts +56 -0
- package/src/iso-editor/ui/canvas.ts +1227 -0
- package/src/iso-editor/ui/clip.ts +97 -0
- package/src/iso-editor/ui/dialog.ts +25 -0
- package/src/iso-editor/ui/flat-canvas.ts +51 -0
- package/src/iso-editor/ui/icons.ts +21 -0
- package/src/iso-editor/ui/keys.ts +30 -0
- package/src/iso-editor/ui/later.ts +22 -0
- package/src/iso-editor/ui/layer.ts +7 -0
- package/src/iso-editor/ui/marks.css +39 -0
- package/src/iso-editor/ui/menu.ts +67 -0
- package/src/iso-editor/ui/monaco-entry.ts +6 -0
- package/src/iso-editor/ui/mount-kit.ts +35 -0
- package/src/iso-editor/ui/mount.ts +684 -0
- package/src/iso-editor/ui/pane.ts +45 -0
- package/src/iso-editor/ui/part.ts +45 -0
- package/src/iso-editor/ui/plain-icons.ts +83 -0
- package/src/iso-editor/ui/props.ts +347 -0
- package/src/iso-editor/ui/scope-css.ts +65 -0
- package/src/iso-editor/ui/setup.ts +153 -0
- package/src/iso-editor/ui/skin.css +181 -0
- package/src/iso-editor/ui/text.ts +262 -0
- package/src/iso-editor/ui/tree.ts +657 -0
- package/src/iso-editor/validate.ts +62 -0
- package/src/iso-editor/window/protocol.ts +33 -0
- package/src/iso-objects/assemble.ts +57 -0
- package/src/iso-objects/assets.ts +122 -0
- package/src/iso-objects/board.ts +169 -0
- package/src/iso-objects/compile.ts +76 -0
- package/src/iso-objects/css.ts +163 -0
- package/src/iso-objects/flat.ts +653 -0
- package/src/iso-objects/focus.ts +14 -0
- package/src/iso-objects/geometry.ts +86 -0
- package/src/iso-objects/index.ts +33 -0
- package/src/iso-objects/kinds.ts +56 -0
- package/src/iso-objects/labels.ts +310 -0
- package/src/iso-objects/package.json +6 -0
- package/src/iso-objects/place.ts +318 -0
- package/src/iso-objects/route.ts +444 -0
- package/src/iso-objects/scene.ts +376 -0
- package/src/iso-objects/steps.ts +234 -0
- package/src/iso-objects/types.ts +68 -0
- package/src/iso-systems/catalog.ts +31 -0
- package/src/iso-systems/compile.ts +39 -0
- package/src/iso-systems/css.ts +9 -0
- package/src/iso-systems/index.ts +12 -0
- package/src/iso-systems/nodes.ts +126 -0
- package/src/iso-systems/package.json +6 -0
- package/src/iso-systems/schema.json +311 -0
- package/src/iso-systems/validate.ts +34 -0
- package/src/iso-viewer/bundle.ts +15 -0
- package/src/iso-viewer/card-motion.ts +237 -0
- package/src/iso-viewer/dom.ts +13 -0
- package/src/iso-viewer/dual-view.ts +212 -0
- package/src/iso-viewer/flat-view.ts +127 -0
- package/src/iso-viewer/history.ts +781 -0
- package/src/iso-viewer/index.ts +40 -0
- package/src/iso-viewer/morph.ts +191 -0
- package/src/iso-viewer/overlay.ts +212 -0
- package/src/iso-viewer/package.json +6 -0
- package/src/iso-viewer/page.ts +150 -0
- package/src/iso-viewer/player.ts +321 -0
- package/src/iso-viewer/still.ts +74 -0
- package/src/iso-viewer/timeline-contract.ts +342 -0
- package/src/iso-viewer/timeline-engine.ts +420 -0
- package/src/iso-viewer/timeline-export.ts +31 -0
- package/src/iso-viewer/timeline-scale.ts +129 -0
- package/src/iso-viewer/timeline-scope.ts +56 -0
- package/src/iso-viewer/timeline-search.ts +198 -0
- package/src/iso-viewer/timeline-time.ts +54 -0
- package/src/iso-viewer/view-css.ts +59 -0
- package/src/iso-viewer/viewport.ts +142 -0
- package/types/iso-core/compile-schema.d.ts +11 -0
- package/types/iso-core/depth.d.ts +6 -0
- package/types/iso-core/errors.d.ts +24 -0
- package/types/iso-core/glyphs.d.ts +19 -0
- package/types/iso-core/index.d.ts +17 -0
- package/types/iso-core/kernel.d.ts +130 -0
- package/types/iso-core/metrics.json +1 -0
- package/types/iso-core/parse.d.ts +18 -0
- package/types/iso-core/schema-errors.d.ts +14 -0
- package/types/iso-core/shims/crypto.d.ts +9 -0
- package/types/iso-core/svg-dom.d.ts +15 -0
- package/types/iso-core/theme.d.ts +38 -0
- package/types/iso-core/vdom.d.ts +26 -0
- package/types/iso-editor/adapter.d.ts +178 -0
- package/types/iso-editor/clipboard.d.ts +23 -0
- package/types/iso-editor/commands.d.ts +32 -0
- package/types/iso-editor/complete.d.ts +25 -0
- package/types/iso-editor/doc.d.ts +50 -0
- package/types/iso-editor/index.d.ts +57 -0
- package/types/iso-editor/model.d.ts +96 -0
- package/types/iso-editor/outline.d.ts +28 -0
- package/types/iso-editor/path.d.ts +7 -0
- package/types/iso-editor/providers.d.ts +43 -0
- package/types/iso-editor/schema-nav.d.ts +34 -0
- package/types/iso-editor/splice.d.ts +53 -0
- package/types/iso-editor/storage-keys.d.ts +5 -0
- package/types/iso-editor/ui/actions.d.ts +23 -0
- package/types/iso-editor/ui/canvas-layer.d.ts +65 -0
- package/types/iso-editor/ui/canvas.d.ts +307 -0
- package/types/iso-editor/ui/clip.d.ts +14 -0
- package/types/iso-editor/ui/dialog.d.ts +7 -0
- package/types/iso-editor/ui/flat-canvas.d.ts +2 -0
- package/types/iso-editor/ui/icons.d.ts +5 -0
- package/types/iso-editor/ui/keys.d.ts +7 -0
- package/types/iso-editor/ui/later.d.ts +12 -0
- package/types/iso-editor/ui/layer.d.ts +2 -0
- package/types/iso-editor/ui/menu.d.ts +21 -0
- package/types/iso-editor/ui/mount-kit.d.ts +31 -0
- package/types/iso-editor/ui/mount.d.ts +146 -0
- package/types/iso-editor/ui/pane.d.ts +60 -0
- package/types/iso-editor/ui/part.d.ts +40 -0
- package/types/iso-editor/ui/plain-icons.d.ts +10 -0
- package/types/iso-editor/ui/props.d.ts +57 -0
- package/types/iso-editor/ui/scope-css.d.ts +5 -0
- package/types/iso-editor/ui/setup.d.ts +49 -0
- package/types/iso-editor/ui/text.d.ts +19 -0
- package/types/iso-editor/ui/tree.d.ts +100 -0
- package/types/iso-editor/validate.d.ts +36 -0
- package/types/iso-editor/window/protocol.d.ts +60 -0
- package/types/iso-objects/assemble.d.ts +35 -0
- package/types/iso-objects/assets.d.ts +49 -0
- package/types/iso-objects/board.d.ts +36 -0
- package/types/iso-objects/compile.d.ts +35 -0
- package/types/iso-objects/css.d.ts +16 -0
- package/types/iso-objects/flat.d.ts +130 -0
- package/types/iso-objects/focus.d.ts +1 -0
- package/types/iso-objects/geometry.d.ts +59 -0
- package/types/iso-objects/index.d.ts +26 -0
- package/types/iso-objects/kinds.d.ts +53 -0
- package/types/iso-objects/labels.d.ts +92 -0
- package/types/iso-objects/place.d.ts +25 -0
- package/types/iso-objects/route.d.ts +67 -0
- package/types/iso-objects/scene.d.ts +63 -0
- package/types/iso-objects/steps.d.ts +90 -0
- package/types/iso-objects/types.d.ts +140 -0
- package/types/iso-systems/catalog.d.ts +4 -0
- package/types/iso-systems/compile.d.ts +6 -0
- package/types/iso-systems/css.d.ts +3 -0
- package/types/iso-systems/index.d.ts +5 -0
- package/types/iso-systems/nodes.d.ts +3 -0
- package/types/iso-viewer/card-motion.d.ts +56 -0
- package/types/iso-viewer/dom.d.ts +1 -0
- package/types/iso-viewer/dual-view.d.ts +44 -0
- package/types/iso-viewer/flat-view.d.ts +25 -0
- package/types/iso-viewer/history.d.ts +91 -0
- package/types/iso-viewer/index.d.ts +31 -0
- package/types/iso-viewer/morph.d.ts +28 -0
- package/types/iso-viewer/overlay.d.ts +135 -0
- package/types/iso-viewer/page.d.ts +13 -0
- package/types/iso-viewer/still.d.ts +26 -0
- package/types/iso-viewer/timeline-contract.d.ts +345 -0
- package/types/iso-viewer/timeline-engine.d.ts +20 -0
- package/types/iso-viewer/timeline-export.d.ts +5 -0
- package/types/iso-viewer/timeline-scale.d.ts +44 -0
- package/types/iso-viewer/timeline-scope.d.ts +33 -0
- package/types/iso-viewer/timeline-search.d.ts +52 -0
- package/types/iso-viewer/timeline-time.d.ts +8 -0
- package/types/iso-viewer/view-css.d.ts +7 -0
- package/types/iso-viewer/viewport.d.ts +50 -0
package/iso-systems.js
ADDED
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
var Of=Object.defineProperty;var fi=(t,e)=>{for(var n in e)Of(t,n,{get:e[n],enumerable:!0})};var Wc={};fi(Wc,{Bounds:()=>Sr,C:()=>Et,DiagError:()=>to,FONTS:()=>St,Kernel:()=>Dn,S:()=>st,VEl:()=>Gr,allowed:()=>_a,apply:()=>xr,bubble:()=>mi,buildSvg:()=>Zc,center:()=>vn,colorRef:()=>Vs,createHash:()=>Hc,depthSort:()=>Ar,didYouMean:()=>Ns,distance:()=>Ca,envelope:()=>di,esc:()=>wt,extendTheme:()=>tr,faceFrame:()=>na,fileLines:()=>ui,formatDiag:()=>La,formatDiags:()=>Vc,iso:()=>ke,keyGlyph:()=>hi,loadTheme:()=>er,matStr:()=>kr,n1:()=>ht,parse:()=>so,parseSvg:()=>Fa,placeholderFace:()=>$r,pt:()=>Sn,screenFaces:()=>Vn,screenGlass:()=>Pr,serialize:()=>no,sha256Hex:()=>ja,socketGlyph:()=>yi,tag:()=>fe,termLines:()=>vr,textWidth:()=>ms,themeCss:()=>eo,themeParts:()=>za,vdoc:()=>Uc});var Wl={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 st=34,Et=Math.cos(Math.PI/6),ke=(t,e,n=0)=>[(t-e)*Et*st,(t+e)*.5*st-n*st],ht=t=>{let e=Math.round(t*10)/10;return Object.is(e,-0)?"0":String(e)},Sn=t=>`${ht(t[0])},${ht(t[1])}`,wt=t=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");function fe(t,e={},n){let r="";for(let i in e){let o=e[i];o==null||o===!1||o===""||(r+=` ${i}="${wt(typeof o=="number"?ht(o):o)}"`)}return n===void 0?`<${t}${r}/>`:`<${t}${r}>${n}</${t}>`}var St={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=Wl[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 na(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)*st,h:(t.z1-t.z0)*st}}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)*st,h:(t.z1-t.z0)*st}}let[n,r]=ke(t.x0,t.y0,t.z1);return{m:[Et,.5,-Et,.5,n,r],w:(t.x1-t.x0)*st,h:(t.y1-t.y0)*st}}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(Sn).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=na(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},wt(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},wt(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,St.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)}},vn=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 di(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 mi(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 ui(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 hi(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 yi(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 $n=(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 $n(r[2],s,8+i*(e-18)/4,o,(e-18)/4-4,3)}).join("")},desktop(t,e){return $n("wall",5,5,t-10,e-10,2)+$n("bar",5,5,t-10,6)+$n("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+=$n("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 $n("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 $n("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 gi=Symbol.for("yaml.alias"),bi=Symbol.for("yaml.document"),$s=Symbol.for("yaml.map"),ra=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]===gi,Cs=t=>!!t&&typeof t=="object"&&t[Jt]===bi,es=t=>!!t&&typeof t=="object"&&t[Jt]===$s,Be=t=>!!t&&typeof t=="object"&&t[Jt]===ra,ze=t=>!!t&&typeof t=="object"&&t[Jt]===as,ts=t=>!!t&&typeof t=="object"&&t[Jt]===Ws;function Qe(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 gi:case $s:case as:case Ws:return!0}return!1}var wi=t=>(ze(t)||Qe(t))&&!!t.anchor;var ss=Symbol("break visit"),Xl=Symbol("skip children"),Ls=Symbol("remove node");function _s(t,e){let n=Ql(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=Xl;_s.REMOVE=Ls;function Kn(t,e,n,r){let i=ec(t,e,n,r);if(Ze(i)||Be(i))return tc(t,r,i),Kn(t,i,n,r);if(typeof i!="symbol"){if(Qe(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 xi(t,e){let n=Ql(e);Cs(t)?await qn(null,t.contents,n,Object.freeze([t]))===Ls&&(t.contents=null):await qn(null,t,n,Object.freeze([]))}xi.BREAK=ss;xi.SKIP=Xl;xi.REMOVE=Ls;async function qn(t,e,n,r){let i=await ec(t,e,n,r);if(Ze(i)||Be(i))return tc(t,r,i),qn(t,i,n,r);if(typeof i!="symbol"){if(Qe(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 Ql(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 ec(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 tc(t,e,n){let r=e[e.length-1];if(Qe(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 ki(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 ia(t){let e=new Set;return _s(t,{Value(n,r){r.anchor&&e.add(r.anchor)}}),e}function oa(t,e){for(let n=1;;++n){let r=`${t}${n}`;if(!e.has(r))return r}}function sc(t,e){let n=[],r=new Map,i=null;return{onAnchor:o=>{n.push(o),i??(i=ia(t));let s=oa(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)||Qe(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 ln(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=ln(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=ln(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=ln(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=ln(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||!wi(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 cn=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"?ln(o,{"":a},"",a):a}};var Js=class extends cn{constructor(e){super(gi),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)||wi(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=Si(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(ki(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 Si(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(Qe(e)){let r=0;for(let i of e.items){let o=Si(t,i,n);o>r&&(r=o)}return r}else if(Be(e)){let r=Si(t,e.key,n),i=Si(t,e.value,n);return Math.max(r,i)}return 1}var vi=t=>!t||typeof t!="function"&&typeof t!="object",be=class extends cn{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 cn{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(Qe(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(Qe(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:Qe(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 Qe(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(Qe(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 nc=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(`
|
|
4
|
+
`)?`
|
|
5
|
+
`+us(n,e):(t.endsWith(" ")?"":" ")+n;var aa="flow",$i="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,$=-1;n===$i&&(h=rc(t,h,e.length),h!==-1&&(p=h+d));for(let w;w=t[h+=1];){if(n===Or&&w==="\\"){switch(y=h,t[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}$=h}if(w===`
|
|
6
|
+
`)n===$i&&(h=rc(t,h,e.length)),p=h+e.length+d,f=void 0;else{if(w===" "&&m&&m!==" "&&m!==`
|
|
7
|
+
`&&m!==" "){let S=t[h+1];S&&S!==" "&&S!==`
|
|
8
|
+
`&&S!==" "&&(f=h)}if(h>=p)if(f)c.push(f),p=f+d,f=void 0;else if(n===Or){for(;m===" "||m===" ";)m=w,w=t[h+=1],u=!0;let S=h>$+1?h-2:y-1;if(l[S])return t;c.push(S),l[S]=!0,p=S+d,f=void 0}else u=!0}m=w}if(u&&a&&a(),c.length===0)return t;s&&s();let g=t.slice(0,c[0]);for(let w=0;w<c.length;++w){let S=c[w],O=c[w+1]||t.length;S===0?g=`
|
|
9
|
+
${e}${t.slice(0,O)}`:(n===Or&&l[S]&&(g+=`${t[S]}\\`),g+=`
|
|
10
|
+
${e}${t.slice(S+1,O)}`)}return g}function rc(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 Ai=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Mi=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||(Mi(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)+`
|
|
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,Ai(e,!1))}function la(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||(Mi(t)?" ":""),r="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
17
|
+
${n}`)+"'";return e.implicitKey?r:Er(r,n,aa,Ai(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=la:o&&!i?r=Tr:r=n?la:Tr}return r(t,e)}var ca;try{ca=new RegExp(`(^|(?<!
|
|
18
|
+
))
|
|
19
|
+
+(?!
|
|
20
|
+
|$)`,"g")}catch{ca=/\n+(?!\n|$)/g}function Pi({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||Mi(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?`|
|
|
21
|
+
`:`>
|
|
22
|
+
`;let p,f;for(f=n.length;f>0;--f){let O=n[f-1];if(O!==`
|
|
23
|
+
`&&O!==" "&&O!==" ")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(ca,`$&${c}`));let h=!1,y,$=-1;for(y=0;y<n.length;++y){let O=n[y];if(O===" ")h=!0;else if(O===`
|
|
26
|
+
`)$=y;else break}let g=n.substring(0,$<y?$+1:y);g&&(n=n.substring(g.length),g=g.replace(/\n+/g,`$&${c}`));let S=(h?c?"2":"1":"")+p;if(t&&(S+=" "+a(t.replace(/ ?[\r\n]+/g," ")),i&&i()),!l){let O=n.replace(/\n+/g,`
|
|
27
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),b=!1,E=Ai(r,!0);s!=="folded"&&e!==be.BLOCK_FOLDED&&(E.onOverflow=()=>{b=!0});let T=Er(`${g}${O}${m}`,c,$i,E);if(!b)return`>${S}
|
|
28
|
+
${c}${T}`}return n=n.replace(/\n+/g,`$&${c}`),`|${S}
|
|
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):Pi(t,e,n,r);if(!a&&!l&&i!==be.PLAIN&&o.includes(`
|
|
32
|
+
`))return Pi(t,e,n,r);if(Mi(o)){if(d==="")return e.forceBlockIndent=!0,Pi(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,aa,Ai(e,!1))}function Pn(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):Pi(s,e,n,r);case be.QUOTE_DOUBLE:return Tr(s.value,e);case be.QUOTE_SINGLE:return la(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 Oi(t,e){let n=Object.assign({blockQuote:!0,commentString:nc,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)||Qe(t))&&t.anchor;o&&ki(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)?Pn(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 ic({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(Qe(t)||!Ze(t)&&typeof t=="object"){let E="With simple keys, collection cannot be used as a key value";throw new Error(E)}}let m=!p&&(!t||f&&e==null&&!n.inFlow||Qe(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 $,g,w;Ze(e)?($=!!e.spaceBefore,g=e.commentBefore,w=e.comment):($=!1,g=null,w=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 S=!1,O=Qs(e,n,()=>S=!0,()=>h=!0),b=" ";if(f||$||g){if(b=$?`
|
|
36
|
+
`:"",g){let E=c(g);b+=`
|
|
37
|
+
${us(E,n.indent)}`}O===""&&!n.inFlow?b===`
|
|
38
|
+
`&&w&&(b=`
|
|
39
|
+
|
|
40
|
+
`):b+=`
|
|
41
|
+
${n.indent}`}else if(!m&&Qe(e)){let E=O[0],T=O.indexOf(`
|
|
42
|
+
`),C=T!==-1,M=n.inFlow??e.flow??e.items.length===0;if(C||!M){let I=!1;if(C&&(E==="&"||E==="!")){let k=O.indexOf(" ");E==="&"&&k!==-1&&k<T&&O[k+1]==="!"&&(k=O.indexOf(" ",k+1)),(k===-1||T<k)&&(I=!0)}I||(b=`
|
|
43
|
+
${n.indent}`)}}else(O===""||O[0]===`
|
|
44
|
+
`)&&(b="");return y+=b+O,n.inFlow?S&&r&&r():w&&!S?y+=js(y,n.indent,c(w)):h&&i&&i(),y}function Ei(t,e){(t==="debug"||t==="warn")&&console.warn(e)}var Ti="<<",As={identify:t=>t===Ti||typeof t=="symbol"&&t.description===Ti,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new be(Symbol(Ti)),{addToJSMap:fa}),stringify:()=>Ti},oc=(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 fa(t,e,n){let r=ac(t,n);if(ts(r))for(let i of r.items)pa(t,e,i);else if(Array.isArray(r))for(let i of r)pa(t,e,i);else pa(t,e,r)}function pa(t,e,n){let r=ac(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 ac(t,e){return t&&Ps(e)?e.resolve(t.doc,t):e}function Ni(t,e,{key:n,value:r}){if(Ze(n)&&n.addToJSMap)n.addToJSMap(t,e,r);else if(oc(t,n))fa(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=Oi(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)+'..."'),Ei(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 Pt(r,i)}var Pt=class t{constructor(e,n=null){Object.defineProperty(this,Jt,{value:ra}),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 Ni(n,r,this)}toString(e,n,r){return e?.doc?ic(this,e,n,r):JSON.stringify(this)}};function Ii(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(""),Ri(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(""),Ri(n,f,g.commentBefore,p))}p=!1;let $=Qs(h,l,()=>y=null,()=>p=!0);y&&($+=js($,o,c(y))),p&&y&&(p=!1),f.push(r+$)}let m;if(f.length===0)m=i.start+i.end;else{m=f[0];for(let u=1;u<f.length;++u){let h=f[u];m+=h?`
|
|
45
|
+
${d}${h}`:`
|
|
46
|
+
`}}return t?(m+=`
|
|
47
|
+
`+us(c(t),d),a&&a()):p&&s&&s(),m}function Vf({items:t},e,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:o,flowCollectionPadding:s,options:{commentString:a}}=e;r+=o;let d=Object.assign({},e,{indent:r,inFlow:!0,type:null}),c=!1,l=0,p=[];for(let u=0;u<t.length;++u){let h=t[u],y=null;if(Ze(h))h.spaceBefore&&p.push(""),Ri(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(""),Ri(e,p,g.commentBefore,!1),g.comment&&(c=!0));let w=Ze(h.value)?h.value:null;w?(w.comment&&(y=w.comment),w.commentBefore&&(c=!0)):h.value==null&&g?.comment&&(y=g.comment)}y&&(c=!0);let $=Qs(h,d,()=>y=null);c||(c=p.length>l||$.includes(`
|
|
48
|
+
`)),u<t.length-1?$+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(c||(c=p.reduce((g,w)=>g+w.length+2,2)+($.length+2)>e.options.lineWidth)),c&&($+=",")),y&&($+=js($,r,a(y))),p.push($),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 Ri({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 pn(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 Pt(e,e?.value):r=new Pt(e.key,e.value);let i=pn(this.items,r.key),o=this.schema?.sortMapEntries;if(i){if(!n)throw new Error(`Key ${r.key} already set`);ze(i.value)&&vi(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=pn(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){let i=pn(this.items,e)?.value;return(!n&&ze(i)?i.value:i)??void 0}has(e){return!!pn(this.items,e)}set(e,n){this.add(new Pt(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)Ni(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})),Ii(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=zi(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){let r=zi(e);if(typeof r!="number")return;let i=this.items[r];return!n&&ze(i)?i.value:i}has(e){let n=zi(e);return typeof n=="number"&&n<this.items.length}set(e,n){let r=zi(e);if(typeof r!="number")throw new Error(`Expected a valid index, not ${e}.`);let i=this.items[r];ze(i)&&vi(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?Ii(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 zi(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 fn={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),Pn(t,e,n,r)}};var An={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"&&An.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 Ci={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},Li={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)}},_i={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 Fi=t=>typeof t=="bigint"||Number.isInteger(t),da=(t,e,n,{intAsBigInt:r})=>r?BigInt(t):parseInt(t.substring(e),n);function lc(t,e,n){let{value:r}=t;return Fi(r)&&r>=0?n+r.toString(e):Ut(t)}var ji={identify:t=>Fi(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>da(t,2,8,n),stringify:t=>lc(t,8,"0o")},Bi={identify:Fi,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>da(t,0,10,n),stringify:Ut},Di={identify:t=>Fi(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>da(t,2,16,n),stringify:t=>lc(t,16,"0x")};var cc=[Ms,Os,fn,An,Nr,ji,Bi,Di,Ci,Li,_i];function pc(t){return typeof t=="bigint"||Number.isInteger(t)}var Vi=({value:t})=>JSON.stringify(t),Kf=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Vi},{identify:t=>t==null,createNode:()=>new be(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Vi},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Vi},{identify:pc,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})=>pc(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:Vi}],qf={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},fc=[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 Pn({comment:t,type:e,value:a},r,i,o)}};function ma(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 Pt(new be(null));if(r.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${r.commentBefore}
|
|
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 Pt(r)}}else e("Expected a sequence for this tag");return t}function ua(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:ma,createNode:ua};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=ua(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=ma(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 dc({value:t,source:e},n){return e&&(t?ha:ya).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var ha={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:dc},ya={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:dc};var mc={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},uc={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)}},hc={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 Ki(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 ga(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 yc={identify:Cr,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>Ki(t,2,2,n),stringify:t=>ga(t,2,"0b")},gc={identify:Cr,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>Ki(t,1,8,n),stringify:t=>ga(t,8,"0")},bc={identify:Cr,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>Ki(t,0,10,n),stringify:Ut},wc={identify:Cr,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>Ki(t,2,16,n),stringify:t=>ga(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 Pt(e.key,null):n=new Pt(e,null),pn(this.items,n.key)||this.items.push(n)}get(e,n){let r=pn(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=pn(this.items,e);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new Pt(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 ba(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 xc(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 qi={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})=>ba(t,n),stringify:xc},Gi={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=>ba(t,!1),stringify:xc},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=ba(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 wa=[Ms,Os,fn,An,ha,ya,yc,gc,bc,wc,mc,uc,hc,Rr,As,zr,Ir,Lr,qi,Gi,Jn];var kc=new Map([["core",cc],["failsafe",[Ms,Os,fn]],["json",fc],["yaml11",wa],["yaml-1.1",wa]]),Sc={binary:Rr,bool:Nr,float:_i,floatExp:Li,floatNaN:Ci,floatTime:Gi,int:Bi,intHex:Di,intOct:ji,intTime:qi,map:Ms,merge:As,null:An,omap:zr,pairs:Ir,seq:Os,set:Lr,timestamp:Jn},vc={"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 Zi(t,e,n){let r=kc.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(kc.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"?Sc[s]:s;if(!a){let d=JSON.stringify(s),c=Object.keys(Sc).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)?Zi(e,"compat"):e?Zi(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=i?vc:{},this.tags=Zi(n,this.name,r),this.toStringOptions=a??null,Object.defineProperty(this,$s,{value:Ms}),Object.defineProperty(this,as,{value:fn}),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 $c(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=Oi(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(`
|
|
56
|
+
`)+`
|
|
57
|
+
`}var dn=class t{constructor(e,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Jt,{value:bi});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:bi}});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=ia(this);e.anchor=!n||r.has(n)?oa(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,$=n.filter(y).map(String);$.length>0&&(n=n.concat($)),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}=sc(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&&Qe(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 Pt(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 Qe(this.contents)?this.contents.get(e,n):void 0}getIn(e,n){return Zn(e)?!n&&ze(this.contents)?this.contents.value:this.contents:Qe(this.contents)?this.contents.getIn(e,n):void 0}has(e){return Qe(this.contents)?this.contents.has(e):!1}hasIn(e){return Zn(e)?this.contents!==void 0:Qe(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"?ln(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 $c(this,e)}};function Xn(t){if(Qe(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)}},xa=(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+=`:
|
|
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,$=null,g=null,w=null,S=null,O=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 C=T.source.substring(1)||" ";p?p+=f+C:p=C,f="",c=!1;break}case"newline":c?p?p+=T.source:(!S||n!=="seq-item-ind")&&(d=!0):f+=T.source,c=!0,m=!0,(y||$)&&(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,O??(O=T.offset),c=!1,l=!1,u=!0;break;case"tag":{$&&o(T,"MULTIPLE_TAGS","A node can have at most one tag"),$=T,O??(O=T.offset),c=!1,l=!1,u=!0;break}case n:(y||$)&&o(T,"BAD_PROP_ORDER",`Anchors and tags must be after the ${T.source} indicator`),S&&o(T,"UNEXPECTED_TOKEN",`Unexpected ${T.source} in ${e??"collection"}`),S=T,c=n==="seq-item-ind"||n==="explicit-key-ind",l=!1;break;case"comma":if(e){w&&o(T,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),w=T,c=!1,l=!1;break}default:o(T,"UNEXPECTED_TOKEN",`Unexpected ${T.type} token`),c=!1,l=!1}let b=t[t.length-1],E=b?b.offset+b.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:w,found:S,spaceBefore:d,comment:p,hasNewline:m,anchor:y,tag:$,newlineAfterProp:g,end:E,start:O??E}}function mn(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(mn(e.key)||mn(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==="}")&&mn(e)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function Ui(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 Pc="All mapping items must start at the same column";function Ac({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",Pc)),!h.anchor&&!h.tag&&!m){c=h.end,h.comment&&(a.comment?a.comment+=`
|
|
64
|
+
`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||mn(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",Pc);n.atKey=!0;let $=h.end,g=f?t(n,f,h,i):e(n,$,p,null,h,i);n.schema.compat&&Br(r.indent,f,i),n.atKey=!1,Ui(n,a.items,g)&&i($,"DUPLICATE_KEY","Map keys must be unique");let w=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=w.end,w.found){y&&(u?.type==="block-map"&&!w.hasNewline&&i(d,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&h.start<w.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 S=u?t(n,u,w,i):e(n,d,m,null,w,i);n.schema.compat&&Br(r.indent,u,i),d=S.range[2];let O=new Pt(g,S);n.options.keepSourceTokens&&(O.srcToken=l),a.items.push(O)}else{y&&i(g.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),w.comment&&(g.comment?g.comment+=`
|
|
65
|
+
`+w.comment:g.comment=w.comment);let S=new Pt(g);n.options.keepSourceTokens&&(S.srcToken=l),a.items.push(S)}}return c&&c<d&&i(c,"IMPOSSIBLE","Map comment with trailing content"),a.range=[r.offset,d,c??d],a}function Mc({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 ka="Block collections are not allowed within flow collections",Sa=t=>t&&(t.type==="block-map"||t.type==="block-seq");function Oc({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 $=r.items[y],{start:g,key:w,sep:S,value:O}=$,b=Bs(g,{flow:a,indicator:"explicit-key-ind",next:w??S?.[0],offset:p,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!b.found){if(!b.anchor&&!b.tag&&!S&&!O){y===0&&b.comma?i(b.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):y<r.items.length-1&&i(b.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),b.comment&&(c.comment?c.comment+=`
|
|
66
|
+
`+b.comment:c.comment=b.comment),p=b.end;continue}!s&&n.options.strict&&mn(w)&&i(w,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(y===0)b.comma&&i(b.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(b.comma||i(b.start,"MISSING_CHAR",`Missing , between ${a} items`),b.comment){let E="";e:for(let T of g)switch(T.type){case"comma":case"space":break;case"comment":E=T.source.substring(1);break e;default:break e}if(E){let T=c.items[c.items.length-1];Be(T)&&(T=T.value??T.key),T.comment?T.comment+=`
|
|
67
|
+
`+E:T.comment=E,b.comment=b.comment.substring(E.length+1)}}if(!s&&!S&&!b.found){let E=O?t(n,O,b,i):e(n,b.end,S,null,b,i);c.items.push(E),p=E.range[2],Sa(O)&&i(E.range,"BLOCK_IN_FLOW",ka)}else{n.atKey=!0;let E=b.end,T=w?t(n,w,b,i):e(n,E,g,null,b,i);Sa(w)&&i(T.range,"BLOCK_IN_FLOW",ka),n.atKey=!1;let C=Bs(S??[],{flow:a,indicator:"map-value-ind",next:O,offset:T.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(C.found){if(!s&&!b.found&&n.options.strict){if(S)for(let k of S){if(k===C.found)break;if(k.type==="newline"){i(k,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}b.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 O&&("source"in O&&O.source?.[0]===":"?i(O,"MISSING_CHAR",`Missing space after : in ${a}`):i(C.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let M=O?t(n,O,C,i):C.found?e(n,C.end,S,null,C,i):null;M?Sa(O)&&i(M.range,"BLOCK_IN_FLOW",ka):C.comment&&(T.comment?T.comment+=`
|
|
68
|
+
`+C.comment:T.comment=C.comment);let I=new Pt(T,M);if(n.options.keepSourceTokens&&(I.srcToken=$),s){let k=c;Ui(n,k.items,T)&&i(E,"DUPLICATE_KEY","Map keys must be unique"),k.items.push(I)}else{let k=new Tt(n.schema);k.flow=!0,k.items.push(I);let v=(M??T).range;k.range=[T.range[0],v[1],v[2]],c.items.push(k)}p=M?M.range[2]:C.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),$=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",$),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 va(t,e,n,r,i,o){let s=n.type==="block-map"?Ac(t,e,n,r,o):n.type==="block-seq"?Mc(t,e,n,r,o):Oc(t,e,n,r,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function Ec(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 va(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),va(t,e,n,i,s)}let c=va(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 $a(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,$]=s[h];if($===""||$==="\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+$.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,$]=s[h];c+=y.length+$.length+1;let g=$[$.length-1]==="\r";if(g&&($=$.slice(0,-1)),$&&y.length<d){let S=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;n(c-$.length-(g?2:1),"BAD_INDENT",S),y=""}o===be.BLOCK_LITERAL?(p+=f+y.slice(d)+$,f=`
|
|
72
|
+
`):y.length>d||$[0]===" "?(f===" "?f=`
|
|
73
|
+
`:!m&&f===`
|
|
74
|
+
`&&(f=`
|
|
75
|
+
|
|
76
|
+
`),p+=f+y.slice(d)+$,f=`
|
|
77
|
+
`,m=!0):$===""?f===`
|
|
78
|
+
`?p+=`
|
|
79
|
+
`:f=`
|
|
80
|
+
`:(p+=f+$,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 Pa(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}`),Tc(t)}function Hf(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),Tc(t.slice(1,-1)).replace(/''/g,"'")}function Tc(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]===`
|
|
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===`
|
|
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===`
|
|
93
|
+
`||r==="\r")&&!(r==="\r"&&t[e+2]!==`
|
|
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 Aa(t,e,n,r){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?$a(t,e,r):Pa(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 Nc(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:Ma,composeEmptyNode:Yi};function Ma(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=Aa(t,e,d,r),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=Ec(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=Yi(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 Yi(t,e,n,r,{spaceBefore:i,comment:o,anchor:s,tag:a,end:d},c){let l={type:"scalar",offset:Nc(e,n,r),indent:-1,source:""},p=Aa(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 Rc(t,e,{offset:n,start:r,value:i,end:o},s){let a=Object.assign({_directives:e},t),d=new dn(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?Ma(c,i,l,s):Yi(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 Ic(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?`
|
|
98
|
+
|
|
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}=Ic(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(Qe(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:Ic(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=Rc(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 dn(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 Oa=Symbol("break visit"),rd=Symbol("skip children"),zc=Symbol("remove item");function Mn(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),Cc(Object.freeze([]),t,e)}Mn.BREAK=Oa;Mn.SKIP=rd;Mn.REMOVE=zc;Mn.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};Mn.parentCollection=(t,e)=>{let n=Mn.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 Cc(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=Cc(Object.freeze(t.concat([[i,s]])),o.items[s],n);if(typeof a=="number")s=a-1;else{if(a===Oa)return Oa;a===zc&&(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 Ea="\uFEFF",Ta="",Na="",Hi="";function Lc(t){switch(t){case Ea:return"byte-order-mark";case Ta:return"doc-mode";case Na:return"flow-error-end";case Hi:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
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 _c=new Set("0123456789ABCDEFabcdef"),od=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Wi=new Set(",[]{}"),ad=new Set(` ,[]{}
|
|
108
|
+
\r `),Ra=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]===Ea&&(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 Ta,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(Ra),"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 Na,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(Ra),"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(`
|
|
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(`
|
|
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 Hi,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&&Wi.has(o))break;n=r}else if(Ts(i)){let o=this.buffer[r+1];if(i==="\r"&&(o===`
|
|
121
|
+
`?(r+=1,i=`
|
|
122
|
+
`,o=this.buffer[r+1]):n=r),o==="#"||e&&Wi.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&&Wi.has(i))break;n=r}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Hi,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(Ra),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,r=this.charAt(1);if(Ts(r)||n&&Wi.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==="%"&&_c.has(this.buffer[e+1])&&_c.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===`
|
|
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 On=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 un(t,e){for(let n=0;n<t.length;++n)if(t[n].type===e)return!0;return!1}function Fc(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 Bc(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 Ji(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 Xi(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 jc(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!un(e.start,"explicit-key-ind")&&!un(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,Bc(e.value)?e.value.end?Xi(e.value.end,e.sep):e.value.end=e.sep:Xi(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=Lc(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"&&jc(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&&Fc(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":{Fc(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=Ji(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)){Xi(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(un(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(Bc(n.key)&&!un(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(un(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]}):un(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&&!un(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)){Xi(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||un(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=Ji(r),o=Qn(i);jc(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=Ji(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=Ji(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 On||null,prettyErrors:e}}function Qi(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(xa(t,n)),s.warnings.forEach(xa(t,n))),s}function Ia(t,e,n){let r;typeof e=="function"?r=e:n===void 0&&e&&typeof e=="object"&&(n=e);let i=Qi(t,n);if(!i)return null;if(i.warnings.forEach(o=>Ei(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=Ia(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 Dc=t=>Object.entries(t).map(([e,n])=>`--${e}:${n}`).join(";");function Vs(t,e){return e in t.light?`var(--${e})`:e}function eo(t){let{light:e,dark:n,rest:r}=za(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 za(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:Dc(t.light),dark:Dc(t.dark),rest:e}}var to=class extends Error{diags;constructor(e){super(e.map(n=>`${n.line}:${n.col} ${n.message}`).join(`
|
|
135
|
+
`)),this.diags=e}};function Ca(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=Ca(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 La(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 Vc(t,e,n){return t.map(r=>La(r,e,n)).join(`
|
|
139
|
+
|
|
140
|
+
`)}function Kc(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 so(t){let e=new On,n=Qi(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=Kc(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($=>Be($)&&ze($.key)&&String($.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 Kc(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":"'"},qc=t=>t.replace(/&(amp|lt|gt|quot|apos|#39);/g,(e,n)=>md[n]);function _a(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 Fa(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=qc(p[2]);f==="xmlns"||f.startsWith("xmlns:")||_a(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(qc(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",Gc=t=>t.replace(/var\(--([a-zA-Z][\w-]*)/g,"var(--iso-$1");function Zc(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=Gc(a):o.setAttribute(s,/var\(--/.test(a)?Gc(a):a);for(let s of i.children)o.append(typeof s=="string"?e.createTextNode(s):n(s));return o},r=Fa(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)}}},Uc={createElementNS:(t,e)=>new Gr(e)},Yc=t=>t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),yd=t=>Yc(t).replace(/"/g,""");function no(t,e=new Set(["style"])){if(typeof t=="string")return Yc(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,"<\\/"):no(i,e)).join(""):t.children.map(i=>no(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 ja(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 w=d(a[g-15],7)^d(a[g-15],18)^a[g-15]>>>3,S=d(a[g-2],17)^d(a[g-2],19)^a[g-2]>>>10;a[g]=a[g-16]+w+a[g-7]+S>>>0}let[l,p,f,m,u,h,y,$]=s;for(let g=0;g<64;g++){let w=$+(d(u,6)^d(u,11)^d(u,25))+(u&h^~u&y)+gd[g]+a[g]>>>0,S=(d(l,2)^d(l,13)^d(l,22))+(l&p^l&f^p&f)>>>0;$=y,y=h,h=u,u=m+w>>>0,m=f,f=p,p=l,l=w+S>>>0}s[0]+=l,s[1]+=p,s[2]+=f,s[3]+=m,s[4]+=u,s[5]+=h,s[6]+=y,s[7]+=$}return[...s].map(c=>c.toString(16).padStart(8,"0")).join("")}function Hc(t){if(t!=="sha256")throw new Error(`only sha256 here, not ${t}`);let e="",n={update(r){return e+=r,n},digest(r){return ja(e)}};return n}var wp={};fi(wp,{BOARD_3D:()=>yn,BOARD_CSS:()=>yp,FLAT_DEFAULTS:()=>al,FLAT_FONTS:()=>ll,GRID_CSS:()=>rl,LABEL_BUDGET:()=>Ao,MARKS_CSS:()=>sl,Obstacles:()=>Nn,PAGE_CSS:()=>tl,PLAYER_CSS:()=>Eo,PLAYER_UI_CSS:()=>nl,ROUTE_BUDGET:()=>uo,WALL_T:()=>Ks,assembly:()=>So,baseCss:()=>ar,boardCatalog:()=>gp,boardDiagram:()=>bp,boardErrors:()=>Ro,boardOf:()=>Io,boxAsset:()=>Xt,boxSilhouette:()=>pp,calloutRect:()=>Ja,cardAsset:()=>cl,cloudPath:()=>qa,compileRaw:()=>To,convexOverlap:()=>Jr,defaultLabel:()=>Xc,drawCloud:()=>sr,drawDecos:()=>Ka,drawingCss:()=>ei,durationFor:()=>Qa,facePainter:()=>Tn,flatHit:()=>hp,floorAt:()=>rr,floorOf:()=>fp,focusView:()=>ap,gateBox:()=>Hr,iconPainter:()=>Zr,inConvex:()=>Xa,kindsCss:()=>io,labelRect:()=>Xr,layoutFlat:()=>lr,lineRectArea:()=>rp,localAt:()=>cp,markCss:()=>oo,metricsMeasure:()=>up,midpoint:()=>el,noSource:()=>il,nodeKind:()=>En,nodeKindOr:()=>hs,offscreen:()=>ko,openList:()=>Ua,overlap2:()=>lo,overlaps:()=>No,paddingOf:()=>dp,parseEnd:()=>ls,place:()=>nr,placeBoard:()=>ti,placeCallout:()=>wo,placeNodeLabel:()=>Qr,placeholderIcon:()=>Va,plate:()=>Ur,polyBounds:()=>sn,polyRectArea:()=>or,rectArea:()=>Wa,regionKind:()=>At,regionRole:()=>Mo,registerMarks:()=>Jc,renderScene:()=>Oo,resolveSteps:()=>vo,routeAll:()=>ho,screenToGrid:()=>lp,silhouette:()=>cs,simplify:()=>Wr,snapMove:()=>mp,wallHeight:()=>ro,wallsOf:()=>Po});var At=(t,e)=>e!==void 0&&Object.hasOwn(t.regions,e)?t.regions[e]:void 0,En=(t,e)=>t.nodes[e??t.defaultNode],hs=(t,e)=>En(t,e)??t.nodes[t.defaultNode],ro=t=>Object.values(t.regions).find(e=>e.shape==="walled")?.z[1]??.8,io=t=>Object.values(t.regions).map(e=>e.css??"").join("");var Ba=Object.create(null),Da=[];function Jc(t){Object.assign(Ba,t.icons??{}),Object.assign(Vn,t.faces??{}),t.css&&!Da.includes(t.css)&&Da.push(t.css)}var oo=()=>Da.join(""),Zr=t=>Object.hasOwn(Ba,t)?Ba[t]:void 0,Tn=t=>Object.hasOwn(Vn,t)?Vn[t]:void 0;function Va(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 Ka(t,e,n){let r="";for(let i of n??[])i==="terminal"?r+=vr(t,e,3):i==="envelope"?r+=di(t,e):i==="bubble"?r+=mi(t,e):i==="file-lines"?r+=ui(t,e):typeof i=="object"&&(i.terminal&&(r+=vr(t,e,i.terminal)),i.icon&&(r+=(Zr(i.icon)??Va)(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)+Ka(a,d,bd(c,s))+(o?o(a,d):"")};return s}function Ur(t){let[e,n]=vn(t);return{x0:e-.75,y0:n-.75,x1:e+.75,y1:n+.75,z0:t.z0,z1:t.z0+.18}}function qa(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 $=c+(p-c)*y/u,g=l+(f-l)*y/u,w=m/u/2*1.08;h+=` A${w.toFixed(1)},${w.toFixed(1)} 0 0 1 ${$.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)*st,o=(e.y1-e.y0)*st,s=qa(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 Xc(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,Ga=["right-of","left-of","below","behind"];function nr(t,e,n,r,i,o={},s){let a=[],d=(k,v,x,R=!1,L="error")=>{let D=n.locate(k,{key:R});a.push({severity:L,message:v,line:D.line,col:D.col,path:k,hint:x})},c=[],l=new Map,p=[],f=new Map,m=new Set([...Object.keys(r.roles),...Object.keys(o)]);function u(k,v){let x=l.get(k.id);if(x){let R=n.locate(x.path+"/id");return d(k.path+"/id",`duplicate id "${k.id}" (first used on line ${R.line})`),!1}return l.set(k.id,k),c.push(k),k.parent=v,v?v.children.push(k):p.push(k),!0}let h=()=>({x0:0,y0:0,z0:0,x1:0,y1:0,z1:0});function y(k,v,x){let R={id:k.id,type:"node",path:v,children:[],box:h(),floor:0,node:k,appears:k.appears,disappears:k.disappears};u(R,x)&&(k.nodes??[]).forEach((L,D)=>y(L,`${v}/nodes/${D}`,R))}function $(k,v,x){let R={id:k.id,type:"region",path:v,children:[],box:h(),floor:0,region:k,appears:k.appears,disappears:k.disappears};u(R,x)&&((k.nodes??[]).forEach((L,D)=>y(L,`${v}/nodes/${D}`,R)),(k.regions??[]).forEach((L,D)=>$(L,`${v}/regions/${D}`,R)))}(t.regions??[]).forEach((k,v)=>$(k,`${e}/regions/${v}`,void 0)),(t.nodes??[]).forEach((k,v)=>y(k,`${e}/nodes/${v}`,void 0));let g=()=>l.keys(),w=()=>c.filter(k=>k.type==="region").map(k=>k.id);for(let k of[...c]){let v=k.node??k.region;if(v.in!==void 0){let R=l.get(v.in);if(!R){d(k.path+"/in",`unknown region "${v.in}"`+Yr(v.in,w()));continue}if(R.type!=="region"){d(k.path+"/in",`"${v.in}" is a node, not a region; put nodes on a node with its own "nodes:" list`);continue}if(k.parent&&k.parent!==R){d(k.path+"/in",`"${k.id}" is written inside "${k.parent.id}" but says in: ${v.in}; use one or the other`);continue}for(let L=R;L;L=L.parent)if(L===k){d(k.path+"/in",`"${k.id}" cannot be inside itself`);continue}k.parent||(p.splice(p.indexOf(k),1),k.parent=R,R.children.push(k))}if(k.node){let R=k.node.asset;R!==void 0&&!En(i,R)&&d(k.path+"/asset",`unknown asset "${R}"`+Yr(R,Object.keys(i.nodes)),`assets: ${Object.keys(i.nodes).join(", ")}`)}let x=(k.node??k.region).role;x!==void 0&&!m.has(x)&&d(k.path+"/role",`unknown colour role "${x}"`+Yr(x,m),`add it under "roles:" at the top of the file, or use one of: ${[...m].join(", ")}`)}for(let k of c){let v=k.region?.gate;if(!v?.node)continue;let x=l.get(v.node);if(!x){d(k.path+"/gate/node",`unknown node "${v.node}"`+Yr(v.node,g()));continue}if(x.type!=="node"){d(k.path+"/gate/node",`"${v.node}" is a region; a gate is a node`);continue}x.placedBy=k.id;let R=x.node;(R.at||Ga.some(L=>R[L]))&&d(x.path,`"${x.id}" is the gate of "${k.id}", which places it; its own placement is ignored`,void 0,!1,"warning")}let S=k=>k.gap??t.gap??2;function O(k){let v=k.node,x=hs(i,v.asset),R=v.size,L=x.size[0],D=x.size[1],G=x.size[2];if(R&&(L=R[0],D=R[1],R.length>2&&(G=R[2])),k.placedBy){let se=l.get(k.placedBy).region,_=se.gate,K=_.width??2,Z=R?Math.min(L,D):.3;G=R&&R.length>2?G:_.height??(se.height??ro(i))+.3,_.side==="e"||_.side==="w"?(L=Z,D=K):(L=K,D=Z)}return[L,D,G]}function b(k,v,x,R,L){for(let J of v)T(J);let D=v.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 Ga){let A=te[Ve];if(A===void 0)continue;let U=l.get(A);if(!U){d(`${J.path}/${Ve}`,`unknown id "${A}"`+Yr(A,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}`,`"${A}" is in ${ne(U)} but "${J.id}" is in ${ne(J)}; relative placement works between items in the same region`,U.placedBy?`"${A}" 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=Ga.find(A=>te[A]!==void 0&&l.get(te[A])&&G.has(l.get(te[A])));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)E(Se,f.get(l.get(te[Ve])),Ve,S(te),te.align??"center");else{let A=D.indexOf(J);A>0?E(Se,f.get(D[A-1]),R==="row"?"right-of":"below",S(te),"center"):(Se.x=x,Se.y=x)}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-x),ue=Math.min(0,j-x);if(ae||ue)for(let J of D){let te=f.get(J);te.x-=ae,te.y-=ue}return{w:V-ae+x,d:H-ue+x}}function E(k,v,x,R,L){let D=()=>{k.y=L==="start"?v.y:L==="end"?v.y+v.d-k.d:v.y+(v.d-k.d)/2},G=()=>{k.x=L==="start"?v.x:L==="end"?v.x+v.w-k.w:v.x+(v.w-k.w)/2};x==="right-of"?(k.x=v.x+v.w+R,D()):x==="left-of"?(k.x=v.x-R-k.w,D()):x==="below"?(k.y=v.y+v.d+R,G()):(k.y=v.y-R-k.d,G())}function T(k){if(k.type==="node"){let[_,K,Z]=O(k);f.set(k,{x:0,y:0,w:_,d:K,h:Z,z:k.node.z??0}),k.children.length&&b(k,k.children,0,"row",!0);return}let v=k.region,x=v.padding??At(i,v.kind)?.pad,R=!!v.size,L=b(k,k.children,x,v.flow??"row",R),D=v.size?v.size[0]:Math.max(L.w,x*2+.5),G=v.size?v.size[1]:Math.max(L.d,x*2+.5);if(!v.size&&v.gate){let _=(v.gate.width??2)+1;v.gate.side==="e"||v.gate.side==="w"?G=Math.max(G,_):D=Math.max(D,_)}let se=v.size&&v.size.length>2?v.size[2]:v.height??At(i,v.kind).z[1];f.set(k,{x:0,y:0,w:D,d:G,h:se,z:0})}b(void 0,p,0,t.flow??"row",!0);function C(k,v,x,R){let L=f.get(k),D=v+L.x,G=x+L.y;if(k.type==="region"){let se=At(i,k.region.kind),[_]=se.z,K=se.floor,Z=se.shape==="slab"&&At(i,k.parent?.region?.kind)?.shape==="slab"?0:_,Q=k.region.z??0,N=R+Z+Q,j=R+L.h+Q;k.box={x0:D,y0:G,z0:N,x1:D+L.w,y1:G+L.d,z1:j},k.floor=K?j:R}else{let se=R+L.z;k.box={x0:D,y0:G,z0:se,x1:D+L.w,y1:G+L.d,z1:se+L.h},k.floor=k.box.z1}for(let se of k.children)se.placedBy||C(se,D,G,k.floor)}for(let k of p)k.placedBy||C(k,0,0,0);if(s){let k=x=>Math.round(x/s)*s,v=x=>Math.round(x*1e9)/1e9;for(let x of c){if(x.placedBy)continue;let R=x.box,L=k(R.x0),D=k(R.x1),G=k(R.y0),se=k(R.y1);D-L<s&&(D=L+s),se-G<s&&(se=G+s),x.box={...R,x0:v(L),x1:v(D),y0:v(G),y1:v(se)};let _=x.node??x.region;_.at&&_.at.forEach((K,Z)=>{let Q=K/s;Math.abs(Q-Math.round(Q))>1e-6&&d(`${x.path}/at/${Z}`,`${K} is not on the ${s} grid; it is drawn at ${v(k(K))}`,void 0,!1,"warning")})}}for(let k of c){let v=k.region?.gate;if(!v?.node)continue;let x=l.get(v.node);!x||x.placedBy!==k.id||(x.box=Hr(k,f.get(x).h,f.get(x).w,f.get(x).d),x.floor=x.box.z1)}for(let k of c){let v=k.children.filter(x=>!x.placedBy);for(let x=0;x<v.length;x++)for(let R=x+1;R<v.length;R++){let L=v[x],D=v[R];ao(L,i)||ao(D,i)||lo(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(k.parent&&k.parent.type==="region"&&!k.placedBy){let x=k.parent.box,R=k.box,L=1e-6;(R.x0<x.x0-L||R.y0<x.y0-L||R.x1>x.x1+L||R.y1>x.y1+L)&&d(k.path,`"${k.id}" sticks out of region "${k.parent.id}"`,`make "${k.parent.id}" bigger, or leave out its "size" so it fits its contents`,!1,"warning")}}{let k=p.filter(v=>!v.placedBy);for(let v=0;v<k.length;v++)for(let x=v+1;x<k.length;x++){let R=k[v],L=k[x];lo(R.box,L.box)&&!ao(R,i)&&!ao(L,i)&&d(L.path,`"${L.id}" overlaps "${R.id}"`,'move one with "at", a relative placement, "gap" or "shift"',!1,"warning")}}let M=new Set,I=a.filter(k=>{let v=k.path+k.message;return M.has(v)?!1:(M.add(v),!0)});return{items:c,byId:l,roots:p,diags:I,catalog:i}}var ao=(t,e)=>t.type==="region"&&["zone","tunnel"].includes(At(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 lo(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,co=.05,wd=.6,po=.25,fo={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 Qc=new WeakMap;function rr(t,e,n){let r=Qc.get(t);if(!r){r=[];for(let s of t.items){if(s.type!=="region"||!At(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})}Qc.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 uo=5e5;function ho(t,e,n,r,i,o){let s=[],a=(w,S,O,b="error")=>{let E=r.locate(w);s.push({severity:b,message:S,line:E.line,col:E.col,path:w,hint:O})},d=t.routes??[],c={left:uo},l=0,p=()=>n.items.map(w=>w.id),f=new Map,m=[],u=[];d.forEach((w,S)=>{let O=`${e}/routes/${S}`;(f.has(w.id)||n.byId.has(w.id))&&a(O+"/id",`duplicate id "${w.id}"`),f.set(w.id,S);let b=w.kind??"send";i.has(b)||a(O+"/kind",`unknown flow kind "${b}"`+Za(b,i),`kinds: ${[...i].join(", ")}; add one under "kinds:"`);let E={id:w.id,raw:w,path:O,kind:b,points:[]},T=(C,M)=>{let{id:I}=ls(C),k=n.byId.get(I);if(!k){a(`${O}/${M}`,`unknown node "${I}"`+Za(I,p()));return}return k};E.from=T(w.from,"from"),E.to=T(w.to,"to"),m.push(E),u.push({r:E})});let h=new Map;for(let w of u){let{r:S}=w;if(!S.from||!S.to||S.raw.points)continue;let O=ls(S.raw.from).side,b=ls(S.raw.to).side,E=S.raw.via?.[0],T=S.raw.via?.[S.raw.via.length-1],C=(v,x)=>{if(Array.isArray(v))return{x0:v[0],x1:v[0],y0:v[1],y1:v[1],z0:0,z1:0};if(typeof v=="string"){let R=n.byId.get(ls(v).id);if(R)return R.box}return x.box},M=(v,x,R)=>{let L=x??xd(v.box,R);return{node:v,side:L,explicit:!!x,p:[0,0],z:0}};w.a=M(S.from,O,C(E,S.to)),w.b=M(S.to,b,C(T,S.from));let I=C(E,S.to),k=C(T,S.from);for(let[v,x]of[[w.a,I],[w.b,k]]){let R=`${v.node.id}.${v.side}`;h.has(R)||h.set(R,[]),h.get(R).push({e:v,other:[(x.x0+x.x1)/2,(x.y0+x.y1)/2]})}}for(let[,w]of h){let S=w[0].e,O=S.node.box,b=S.side,E=b==="e"||b==="w"?1:0;w.sort((v,x)=>v.other[E]-x.other[E]);let T=E?O.y0:O.x0,C=E?O.y1:O.x1,M=(T+C)/2,I=Math.max(0,C-T-.3),k=w.length>1?Math.min(wd,I/(w.length-1)):0;w.forEach((v,x)=>{let R=(x-(w.length-1)/2)*k,L=M+R,D=v.e.node.box.z0;if(b==="top"){v.e.p=[(O.x0+O.x1)/2,(O.y0+O.y1)/2],v.e.z=O.z1;return}let[G,se]=fo[b];v.e.p=E?[G>0?O.x1+co:O.x0-co,L]:[L,se>0?O.y1+co:O.y0-co],v.e.z=D})}let y=[];for(let w of n.items)w.type==="node"&&y.push(w.box);let $=[];for(let w of n.items.filter(S=>At(n.catalog,S.region?.kind)?.shape==="walled")){let{x0:S,y0:O,x1:b,y1:E}=w.box,T=Ks,C=w.region.gate,M=[[{x0:S,y0:O,x1:b,y1:O+T,z0:0,z1:0},"n"],[{x0:S,y0:E-T,x1:b,y1:E,z0:0,z1:0},"s"],[{x0:S,y0:O,x1:S+T,y1:E,z0:0,z1:0},"w"],[{x0:b-T,y0:O,x1:b,y1:E,z0:0,z1:0},"e"]];for(let[I,k]of M)if(C&&C.side===k){if(C.node)continue;let v=C.at??.5,x=C.width??2;if(k==="e"||k==="w"){let R=O+(E-O)*v;$.push({...I,y1:R-x/2},{...I,y0:R+x/2})}else{let R=S+(b-S)*v;$.push({...I,x1:R-x/2},{...I,x0:R+x/2})}}else $.push(I)}let g=new Map;for(let w of u){let{r:S,a:O,b}=w;if(S.raw.points){S.points=S.raw.points.map(L=>[L[0],L[1],L.length>2?L[2]:rr(n,L[0],L[1])+.01]);continue}if(!O||!b)continue;let E=[];(S.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(`${S.path}/via/${D}/${_}`,`${se} is not on the ${o} grid; it is drawn at ${G(se)}`,void 0,"warning")}),E.push({p:[G(L[0]),G(L[1])]})}else E.push({p:[L[0],L[1]]});else{let{id:G,side:se}=ls(L),_=n.byId.get(G);if(!_){a(`${S.path}/via/${D}`,`unknown node "${G}"`+Za(G,p()));return}let K=se&&se!=="top"?se:"n",[Z,Q]=fo[K],N=_.box;E.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 C=y.filter(L=>L!==O.node.box&&L!==b.node.box).concat(S.raw.cross?[]:$).filter(L=>!mo(O.node.box,L)&&!mo(b.node.box,L)&&!mo(L,O.node.box)&&!mo(L,b.node.box)),M=O.side==="top"?void 0:fo[O.side],I=b.side==="top"?void 0:fo[b.side],k=[O.p,...E.map(L=>L.p),b.p],v=[O.p],x=M,R=!0;for(let L=0;L+1<k.length;L++){let D=L+2===k.length,G=Sd(k[L],k[L+1],C,g,x,D&&I?[-I[0],-I[1]]:void 0,c);if(!G){R=!1;break}v.push(...G.slice(1));let se=v.length;if(se>=2){let _=Math.sign(v[se-1][0]-v[se-2][0]),K=Math.sign(v[se-1][1]-v[se-2][1]);x=[_,K]}}!R&&c.left<=0?(l++,v=[O.p,[b.p[0],O.p[1]],b.p]):R||(a(S.path,`no path found for route "${S.id}" from "${O.node.id}" to "${b.node.id}"`,'add "via" points, or use "points" to draw it by hand',"warning"),v=[O.p,[b.p[0],O.p[1]],b.p]),v=Wr(v);for(let L=0;L+1<v.length;L++)kd(g,v[L],v[L+1]);S.points=Pd(n,v,O,b)}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 (${uo.toLocaleString("en")} search steps)`,'split it into scenes, or give the busiest routes "via" points or "points"',"warning"),{routes:m,diags:s}}function mo(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 ep=(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=ep(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 tp(t,e,n){for(let r of n)if(t>r.x0-po&&t<r.x1+po&&e>r.y0-po&&e<r.y1+po)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,$=Math.max(0,f)+m,g=1.2,w=en,S=.06,O=[[1,0],[-1,0],[0,1],[0,-1]],b=h-u+1,E=$-y+1,T=(_,K)=>(_-u)*E+(K-y),C=new Int8Array(b*E).fill(-1),M=new Float64Array(b*E).fill(-1),I=new Float64Array(b*E*4).fill(1/0),k=(_,K)=>{let Z=T(_,K);return C[Z]<0&&(C[Z]=tp(c(_),l(K),n)?1:0),C[Z]===1},v=(_,K)=>{let Z=T(_,K);return M[Z]<0&&(M[Z]=r.get(ep(c(_),l(K)))??0),M[Z]},x=Ua(),R=(_,K)=>(Math.abs(_-p)+Math.abs(K-f))*w,L=i?O.findIndex(_=>_[0]===i[0]&&_[1]===i[1]):-1;x.push({i:0,j:0,d:L,g:0,f:R(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(;x.length()&&se++<2e5;){if(s.left--<=0)return null;let _=x.take();if(_.i===p&&_.j===f&&!(o&&_.d>=0&&(O[_.d][0]!==o[0]||O[_.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=O[K];if(_.d>=0&&Z[0]===-O[_.d][0]&&Z[1]===-O[_.d][1])continue;let Q=_.i+Z[0],N=_.j+Z[1];if(Q<u||Q>h||N<y||N>$||!D(Q,N)&&!G(Q,N)&&k(Q,N))continue;if((D(Q,N)||G(Q,N))&&k(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+w+j+v(Q,N)*S,H=T(Q,N)*4+K;I[H]<=V||(I[H]=V,x.push({i:Q,j:N,d:K,g:V,f:V+R(Q,N),prev:_,idx:0,hp:0}))}}return null}function Ua(){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(tp(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"||!At(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],$=u[h+1],g=(y+$)/2,w=a(l+(f-l)*g,p+(m-p)*g),S=[l+(f-l)*y,p+(m-p)*y,w],O=[l+(f-l)*$,p+(m-p)*$,w],b=s[s.length-1];b&&(Math.abs(b[0]-S[0])>1e-6||Math.abs(b[1]-S[1])>1e-6||Math.abs(b[2]-S[2])>1e-6)?s.push(S):b||s.push(S),s.push(O)}}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 Za(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 Wa(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 rp(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,go=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)}},Ya=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]},bo=new WeakMap;function hn(t,e){let n=bo.get(t);for((!n||n.n>t.length)&&bo.set(t,n=new go);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 sp(t){let e=bo.get(t);for((!e||e.n>t.length)&&bo.set(t,e=new go);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=>Ya(t),yo=t=>[t.x,t.y,t.x+t.w,t.y+t.h];function np(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 Nn=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(hn(this.solids,ir),...yo(e)))n+=or(this.solids[r],e);return n}hiddenPoly(e){let n=0;for(let r of qs(hn(this.solids,ir),...Ya(e)))n+=Jr(e,this.solids[r]);return n}costPoly(e,n=1/0){let r=Ya(e),i=0;for(let o of qs(hn(this.polys,s=>ir(s.poly)),...r))i+=Jr(e,this.polys[o].poly);for(let o of qs(hn(this.rects,s=>yo(s.r)),...r))i+=or(e,this.rects[o].r)*2;for(let o of qs(hn(this.slants,ir),...r))i+=Jr(e,this.slants[o])*2;if(i>=n)return i;for(let o of qs(sp(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]=np(d,c,p,r);for(let u=f;u<=m;u++)Xa(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=yo(e),o=0;for(let s of qs(hn(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(hn(this.rects,a=>yo(a.r)),...i)){let a=this.rects[s];(a.owner!==n||!n)&&(o+=Wa(a.r,e)*2)}for(let s of qs(hn(this.slants,ir),...i))o+=or(this.slants[s],e)*2;if(r){let s=-1,a=0;for(let d of qs(sp(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,$]=np(f,m,h,i);for(let g=y;g<=$;g++){let w=f[0]+(m[0]-f[0])*(g+.5)/h,S=f[1]+(m[1]-f[1])*(g+.5)/h;w>=e.x&&w<=e.x+e.w&&S>=e.y&&S<=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}},ip=14;function Xr(t,e,n,r){let i=Math.max(t.name?ms(t.name,St.lbl):0,t.sub?ms(t.sub,St.sub):0)+4,o=(t.name?1:0)+(t.sub?1:0),s=n-(t.name?11:9)-1,a=(o-1)*ip+(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)*ip+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),$=r.cost(y,i,.15)*2+h.pen;$<u&&(u=$,m={x:h.x,y:h.y,anchor:h.anchor,rect:y})}return m}function Ja(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 wo(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=Ja(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 op=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},Ha=t=>op(t)<0?[...t].reverse():t;function Xa(t,e){let n=Ha(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=Ha(t),r=Ha(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(op(n)):0}var xo=24;function ko(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)-xo,dy:0}:c==="right"?{edge:c,dx:n+i-t.x+xo,dy:0}:c==="top"?{edge:c,dx:0,dy:-(t.y+t.h-r)-xo}:{edge:c,dx:0,dy:r+o-t.y+xo}}function So(t,e,n){let r=S=>{let O=0;for(let b=S.parent;b;b=b.parent)O++;return O},i=S=>S.box.x0+S.box.y0+S.box.z0*.01,o=t.items.filter(S=>S.type==="region").sort((S,O)=>r(S)-r(O)||i(S)-i(O)),s=t.items.filter(S=>S.type==="node").sort((S,O)=>i(S)-i(O)||S.box.z0-O.box.z0),a=[],d=Math.min(90,400/Math.max(1,o.length)),c=650;o.forEach((S,O)=>{let b=sn(cs(S.box));a.push({id:S.id,kind:"region",...ko(b,n),delay:Math.round(O*d),dur:c,bbox:b})});let l=250+Math.round(d*o.length),p=Math.min(70,700/Math.max(1,s.length)),f=600;s.forEach((S,O)=>{let b=sn(cs(S.box));a.push({id:S.id,kind:"node",...ko(b,n),delay:Math.round(l+O*p),dur:f,bbox:b})});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,$=e.filter(S=>S.points.length>=2).map((S,O)=>({id:S.id,delay:Math.round(u+O*h),dur:y})),g={delay:u+200,dur:400},w=Math.max(...a.map(S=>S.delay+S.dur),...$.map(S=>S.delay+S.dur),g.delay+g.dur);return{pieces:a,routes:$,labels:g,total:w}}function Qa(t){return Math.max(5600,Math.min(12500,2600+t.length*40))}function vo(t,e,n,r,i,o){let s=[],a=(M,I,k,v="error")=>{let x=i.locate(M);s.push({severity:v,message:I,line:x.line,col:x.col,path:M,hint:k})},d=t.steps??[],c=new Set(Object.keys(o.kinds)),l=new Map(r.map(M=>[M.id,M])),p=()=>[...n.byId.keys(),...l.keys()],f=new Map;d.forEach((M,I)=>{M.id&&(f.has(M.id)&&a(`${e}/steps/${I}/id`,`duplicate step id "${M.id}"`),f.set(M.id,I+1))});let m=d.length,u=(M,I)=>{if(typeof M=="number"){if(M<1||M>m){a(I,`there is no step ${M}; this scene has ${m} step(s)`);return}return M}let k=f.get(M);return k===void 0&&a(I,`unknown step "${M}"`+ys(M,f.keys())),k},h=M=>Vs(o,o.kinds[M]?.color??"control"),y=[],$=M=>{y.includes(M)||y.push(M)};for(let M of r)$(M.kind);let g={},w=(M,I,k,v)=>{if(I===void 0&&k===void 0)return;let x=I!==void 0?u(I,v+"/appears"):1,R=k!==void 0?u(k,v+"/disappears"):m+1;g[M]=Array.from({length:m},(L,D)=>D+1>=(x??1)&&D+1<(R??m+1))};for(let M of n.items)w(M.id,M.appears,M.disappears,M.path);for(let M of r)w(M.id,M.raw.appears,M.raw.disappears,M.path);let S=[],O=[],b=[],E=[],T=()=>{for(let M of r){if(M.raw.appears!==void 0||M.raw.disappears!==void 0)continue;let I=[M.from,M.to].map(k=>k&&(g[k.id]??C(k)));I.some(Boolean)&&(g[M.id]=Array.from({length:m},(k,v)=>I.every(x=>!x||x[v])))}},C=M=>{for(let I=M.parent;I;I=I.parent)if(g[I.id])return g[I.id]};return d.forEach((M,I)=>{let k=I+1,v=`${e}/steps/${I}`,x=M.kind??"control";c.has(x)||a(v+"/kind",`unknown flow kind "${x}"`+ys(x,c)),$(x);let R=new Set,L=[];(M.animate??[]).forEach((_,K)=>{let Z=Array.isArray(_)?_:[_],Q=[];Z.forEach((N,j)=>{let V=Array.isArray(_)?`${v}/animate/${K}/${j}`:`${v}/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;$(J),Q.push({route:H,kind:J,color:h(J)}),R.add(H),ue.from&&R.add(ue.from.id),ue.to&&R.add(ue.to.id)}),Q.length&&L.push(Q)});let D=[];(M.pulse??[]).forEach((_,K)=>{let Z=n.byId.get(_);if(!Z){a(`${v}/pulse/${K}`,`unknown node "${_}"`+ys(_,n.byId.keys()));return}let Q,N,j,V,H=Z.node?En(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]),R.add(_)}),(M.highlight??[]).forEach((_,K)=>{!n.byId.has(_)&&!l.has(_)&&a(`${v}/highlight/${K}`,`unknown id "${_}"`+ys(_,p())),R.add(_)});for(let[_,K]of[["show",!0],["hide",!1]])(M[_]??[]).forEach((Z,Q)=>{if(!n.byId.has(Z)&&!l.has(Z)){a(`${v}/${_}/${Q}`,`unknown id "${Z}"`+ys(Z,p()));return}let N=g[Z]??(g[Z]=Array(m).fill(!K));for(let j=I;j<m;j++)N[j]=K});if((M.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(`${v}/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??x;c.has(N)||a(`${v}/say/${K}/kind`,`unknown flow kind "${N}"`+ys(N,c)),O.push({step:k,x:Z+(_.dx??0),y:Q+(_.dy??(Array.isArray(_.at)?0:-46)),ax:Z,ay:Q,text:_.text,kind:N,anchor:_.anchor??"middle"})}),(M.mark??[]).forEach((_,K)=>{if(_.at){b.push({step:k,p:[_.at[0],_.at[1],_.at[2]??.36]});return}let Z=_.on?l.get(_.on):void 0;if(!Z){a(`${v}/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];b.push({step:k,p:[Q[0],Q[1],Q[2]+.6],on:Z.id}),R.add(Z.id)}),t.badges&&M.badge!==!1){let _=Array.isArray(M.badge)?[M.badge[0],M.badge[1],M.badge[2]??.36]:void 0,K=typeof M.badge=="string"?M.badge:L[0]?.[0]?.route,Z=K?l.get(K):void 0;if(!_)if(Z)_=el(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 M.badge=="string"&&a(`${v}/badge`,`unknown id "${M.badge}"`+ys(M.badge,p()));_&&E.push({step:k,num:M.number??k,kind:x,p:_})}for(let _ of[...R])for(let K=n.byId.get(_)?.parent;K;K=K.parent)R.add(K.id);for(let _ of n.items)_.region?.kind==="tunnel"&&(_.region.around??[]).some(K=>R.has(K))&&R.add(_.id);let G;if(M.focus?.length){let _=1/0,K=1/0,Z=-1/0,Q=-1/0;M.focus.forEach((N,j)=>{let V=n.byId.get(N);if(!V){a(`${v}/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)}R.add(N)}),_<1/0&&(G=[Math.round(_-60),Math.round(K-70),Math.round(Z+60),Math.round(Q+40)])}let se=M.caption??"";S.push({n:k,num:M.number??k,kind:x,color:h(x),heading:M.heading,caption:se,command:M.command??"",phases:L,pulses:D,lit:[...R],duration:M.duration===void 0||M.duration==="auto"?Qa(se):M.duration,...G?{focus:G}:{}})}),T(),{steps:S,says:O,marks:b,badges:E,vis:g,diags:s,kindsUsed:y}}function el(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 ap(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 Mo=(t,e)=>e.role??At(t,e.kind)?.role,$o=(t,e)=>At(t,e.region.kind)?.shape;function Oo({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 Nn;c.budget.spots=Ao;let l=x=>r.vis[x]?{"data-vis":"1"}:{},p=e.items.filter(x=>x.type==="region"),f=x=>{let R=0;for(let L=x.parent;L;L=L.parent)R++;return R},m=e.catalog,u=p.filter(x=>$o(m,x)!=="walled"&&$o(m,x)!=="tunnel"),h=Ar(u.map(x=>({box:x.box,r:x}))).map(x=>x.r).sort((x,R)=>f(x)-f(R));for(let x of h)d.base+=Md(a,m,x,l(x.id),s);for(let x of p.filter(R=>$o(m,R)==="walled")){for(let L of Po(x))c.solids.push(cs(L));for(let L of Po(x))d.blocks.push({box:L,svg:fe("g",{class:`blk k-${Mo(m,x.region)} wall${x.region.ghost?" ghost":""}`,"data-id":x.id,"data-dim":"1",...l(x.id)},a.blockFaces(L))});let R=x.region.gate;if(R&&!R.node){let L=Hr(x,R.height??(x.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":x.id,...l(x.id)},a.blockFaces(L))})}x.region.label&&(x.region["label-style"]??"face")!=="none"&&(d.labels+=a.faceText(x.box.x0+.3,x.box.y1,x.box.z0+.13,x.region.label,"slabname sm fz",St.sm,"left","start",{"data-id":x.id,...l(x.id)}))}for(let x of p.filter(R=>$o(m,R)==="tunnel"))d.air+=Ed(a,x,l(x.id));let y=e.items.filter(x=>x.type==="node");for(let x of y){let R=x.node,L=hs(m,R.asset),D=R.ghost||(R.deco??[]).includes("ghost"),G=["blk",`k-${R.role??L.role}`,L.cls,D?"ghost":""].filter(Boolean).join(" ");d.blocks.push({box:x.box,svg:fe("g",{class:G,"data-id":x.id,"data-dim":"1",...l(x.id)},L.draw(a,x.box,R))}),c.polys.push({poly:cs(x.box),owner:x.id}),c.solids.push(cs(x.box))}let $=Ar(d.blocks).map(x=>x.svg).join(""),g=new Set,w={};for(let x of n){if(x.points.length<2)continue;let R=x.points.map(G=>ke(G[0],G[1],G[2]));R.forEach(G=>a.bounds.add(G));let L="M"+R.map(Sn).join(" L");w[x.id]=L;let D=x.raw.arrow!==!1;D&&g.add(x.kind),d.flows+=fe("g",{"data-hl":x.id,"data-id":x.id,...l(x.id)},fe("path",{d:L,class:`flow f-${x.kind}`,"marker-end":D?`url(#ah-${o}-${x.kind})`:void 0})),c.lines.push({pts:R,owner:x.id})}for(let x of g)a.def(`ah-${o}-${x}`,fe("marker",{id:`ah-${o}-${x}`,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[x]?.color??"control")}`})));for(let x of a.planePolys)c.slants.push(x);let S=y.filter(x=>x.node.label||x.node.sub).sort((x,R)=>(R.box.x1-R.box.x0)*(R.box.y1-R.box.y0)-(x.box.x1-x.box.x0)*(x.box.y1-x.box.y0));for(let x of S)d.labels+=Od(a,m,x,c,l(x.id));let O=[];for(let x of n)if(x.raw.label&&x.points.length>=2){let R=Td(a,x,c,l(x.id),e);d.floor+=R.svg,R.warning&&O.push({path:`${x.path}/label`,message:R.warning}),c.budget.over&&!c.budget.told&&(c.budget.told=!0,O.push({path:x.path,message:`from route "${x.id}" on, route labels were placed without weighing what other labels and lines cover: the scene is too large to search every spot (${Ao.toLocaleString("en")} spots); split it into scenes, or give the labels "along", "side" or "at"`}))}(t.notes??[]).forEach((x,R)=>{let L=Nd(a,x,e,n,`${o}-note-${R}`);x.floor?d.floor+=L:d.labels+=L});let b=[],E=new Map;for(let x of r.says){let R=E.get(x.step)??c.fork();E.set(x.step,R);let L=ms(x.text,St.say)+18,D=wo(L,x.ax,x.ay,{x:x.x,y:x.y,anchor:x.anchor},R);R.rects.push({r:D.rect,owner:""}),b.push({step:x.step,...D.rect,text:x.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[x.kind]?.color??"control");d.marks+=fe("g",{class:"say","data-step":x.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}`},wt(x.text)))}for(let x of r.marks){let[R,L]=ke(...x.p);a.bounds.addRect(R-12,L-12,24,24),d.marks+=fe("g",{class:"xm","data-step":x.step,"data-hl":x.on},fe("circle",{cx:R,cy:L,r:10})+fe("path",{d:`M${ht(R-4.5)},${ht(L-4.5)} L${ht(R+4.5)},${ht(L+4.5)} M${ht(R+4.5)},${ht(L-4.5)} L${ht(R-4.5)},${ht(L+4.5)}`}))}for(let x of r.badges){let[R,L]=ke(...x.p);a.bounds.addRect(R-13,L-13,26,26),d.badges+=fe("g",{class:`badge c-${x.kind}`,"data-go":x.step,"data-badge":x.step,tabindex:"0",role:"button","aria-label":`Step ${x.num}`},fe("circle",{cx:R,cy:L,r:11.5})+fe("text",{x:R,y:L+.5},String(x.num)))}let T=a.bounds,C=22,M=T.empty?[0,0,100,100]:[Math.floor(T.x0-C),Math.floor(T.y0-C),Math.ceil(T.x1-T.x0+C*2),Math.ceil(T.y1-T.y0+C*2)],I=[...a.defs.values()].join(""),k=(x,R)=>fe("g",{class:"g-"+x},R);return{svg:fe("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:M.join(" "),role:"img","aria-label":t.aria??t.title,"data-scene":o},fe("defs",{},I)+k("base",d.base)+k("floor",d.floor)+k("flows",d.flows)+k("blocks",$)+k("air",d.air)+k("labels",d.labels)+k("marks",d.marks)+k("badges",d.badges)+k("anim","")),viewBox:M,texts:a.texts,paths:w,warnings:O,callouts:b,assembly:So(e,n,M)}}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${Sn(d)}L${Sn(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=Mo(e,o),d=At(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=c==="slab",u=m?s.z0+.28:s.z0+Math.min(.1,(s.z1-s.z0)*.25);p+=fe("g",l,t.faceText(s.x0+(m?.6:.3),s.y1,u,o.label,m?"slabname":"slabname sm",m?St.slabname:St.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",St.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 Po(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,$=u==="e"||u==="w"?n+(i-n)*h:e+(r-e)*h;return[[f,$-y/2],[$+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 Nn,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",St.lbl,l.anchor,{},n.id)),o.sub&&(p+=t.text(l.x,o.label?l.y+14:l.y,o.sub,"sub mono",St.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",St.tunname,"left","start"):t.faceText(o,s-.35,a+.18,f,"tunname",St.tunname,"right","start")),fe("g",{class:"tunnel","data-id":e.id,"data-dim":"1",...n},c)}var Ao=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=St.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 w=c[g],S=c[g+1];Math.abs(w[2]-S[2])>1e-6||l.push({i:g,len:Math.hypot(S[0]-w[0],S[1]-w[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,w)=>w.len-g.len),f=.22,m=11/st,u=g=>{let w=ms(g,d)/st,S,O=1/0,b=0;e:for(let E of p.length?p:l){let T=c[E.i],C=c[E.i+1],M=T[2],I=Math.abs(T[1]-C[1])<1e-6,k=I?Math.min(T[0],C[0]):Math.min(T[1],C[1]),v=I?Math.max(T[0],C[0]):Math.max(T[1],C[1]),x=I?T[1]:T[0],R=o.side==="left"?[-1]:o.side==="right"?[1]:[-1,1],L=[];for(let D=k+.3;D<=Math.max(k+.3,v-w-.2)+1e-9;D+=.4)L.push(D);for(let D=v-w-.2+.4;D<v+.5&&v-k<w+.5;D+=.6)L.push(D);for(let D of R)for(let G of L){if(O<=b*.5)break e;let se=D<0?x-f:x+f+m,_,K,Z;if(I?(_=G,K=se,Z=[ke(_,K-m,M),ke(_+w,K-m,M),ke(_+w,K,M),ke(_,K,M)]):(_=se,K=G+w,Z=[ke(_-m,K,M),ke(_-m,K-w,M),ke(_,K-w,M),ke(_,K,M)]),(I?[[_,K-m],[_+w,K-m],[_+w,K],[_,K]]:[[_-m,K],[_-m,K-w],[_,K-w],[_,K]]).some(([ae,ue])=>Math.abs(rr(i,ae,ue)+.01-M)>.001)){b++;continue}let N=n.hiddenPoly(Z),j=N*50+b*.5,V=n.budget.spots-- >0;V||(n.budget.over=!0);let H=j>=O?1/0:V?j+n.costPoly(Z,O-j):j;b++,H<O&&(O=H,S={x:_,y:K,z:M,dir:I?"x":"y",rect:sn(Z),poly:Z,hidden:N})}}return S&&S.hidden<6?S:void 0},h=o.text,y=u(h),$;if(!y){let g=o.text.split(/(\s+)/);for(let w=g.length-1;w>0&&!y;w--){let S=g.slice(0,w).join("").trimEnd().replace(/[\s,;:·–-]+$/,"")+"\u2026";if(S.length<6)break;let O=u(S);O&&(y=O,h=S)}$=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?$+='; give it "along", "side" or "at", or move the nodes apart':$+='; 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:$}):{svg:"",warning:$}}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",St.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",$="";return e.label&&($+=t.text(u,h,e.label,"lbl",St.lbl,y)),e.sub&&($+=t.text(u,e.label?h+14:h,e.sub,"sub mono",St.sub,y)),fe("g",d,$)}return""}var tl=`
|
|
143
|
+
*{box-sizing:border-box}
|
|
144
|
+
html,body{margin:0}
|
|
145
|
+
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}
|
|
146
|
+
code,pre,.mono{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}
|
|
147
|
+
code{font-size:.92em;background:var(--code-bg);padding:1px 5px;border-radius:5px;overflow-wrap:anywhere}
|
|
148
|
+
.wrap{max-width:1180px;margin:0 auto;padding:32px 16px 64px}
|
|
149
|
+
header.page{display:flex;flex-wrap:wrap;gap:12px 24px;align-items:flex-end;justify-content:space-between;margin-bottom:8px}
|
|
150
|
+
h1{font-size:clamp(24px,4vw,34px);line-height:1.15;margin:0;letter-spacing:-.01em}
|
|
151
|
+
.lede{color:var(--muted);max-width:76ch;margin:8px 0 0}
|
|
152
|
+
.pills{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
|
|
153
|
+
.pill{display:inline-block;font-size:12px;font-weight:600;padding:3px 10px;border-radius:99px;border:1px solid var(--line);color:var(--muted);background:var(--surface)}
|
|
154
|
+
.theme{font:inherit;font-size:12px;border:1px solid var(--line);background:var(--surface);color:var(--muted);border-radius:99px;padding:3px 10px;cursor:pointer}
|
|
155
|
+
h2{font-size:20px;margin:44px 0 4px;letter-spacing:-.005em;text-wrap:balance}
|
|
156
|
+
.sec-sub{color:var(--muted);margin:0 0 14px;font-size:14px;max-width:84ch}
|
|
157
|
+
.figure{background:var(--surface);border:1px solid var(--line);border-radius:16px;margin:12px 0 10px;overflow:hidden}
|
|
158
|
+
.scroller{overflow-x:auto;-webkit-overflow-scrolling:touch}
|
|
159
|
+
.scroller svg{display:block;width:100%;min-width:720px;height:auto}
|
|
160
|
+
.legend{display:flex;flex-wrap:wrap;gap:6px 18px;padding:10px 18px;border-top:1px solid var(--line);font-size:12.5px;color:var(--muted)}
|
|
161
|
+
.legend:empty{display:none}
|
|
162
|
+
.legend span{display:inline-flex;align-items:center;gap:8px}
|
|
163
|
+
.legend i{display:inline-block;width:26px;height:0;border-top:3px solid}
|
|
164
|
+
.legend i.box{height:10px;border-width:1.5px;border-style:solid;border-radius:2px}
|
|
165
|
+
footer{margin-top:40px;font-size:12.5px;color:var(--muted)}
|
|
166
|
+
`,ei=t=>Rd+io(t)+Id+oo(),Rd=`
|
|
167
|
+
/* blocks: hue per role, lightness per face and theme */
|
|
168
|
+
.blk .top{fill:hsl(var(--h) var(--s) var(--l-top))}
|
|
169
|
+
.blk .lft{fill:hsl(var(--h) var(--s) var(--l-left))}
|
|
170
|
+
.blk .rgt{fill:hsl(var(--h) var(--s) var(--l-right))}
|
|
171
|
+
.blk polygon,.blk path.top,.blk path.lft{stroke:hsl(var(--h) var(--s) var(--l-edge));stroke-width:.8;stroke-linejoin:round}
|
|
172
|
+
.blk .det{stroke:hsl(var(--h) var(--s) var(--l-edge));stroke-width:1.4;fill:none;stroke-linecap:round;opacity:.7}
|
|
173
|
+
.k-slab .top{fill:var(--slab-top)} .k-slab .lft{fill:var(--slab-l)} .k-slab .rgt{fill:var(--slab-r)}
|
|
174
|
+
.k-pad .top{fill:var(--pad-top)}
|
|
175
|
+
.wall polygon{fill-opacity:.34}
|
|
176
|
+
.zone polygon{fill:hsl(var(--h) var(--s) 50% / .12);stroke:hsl(var(--h) var(--s) 45% / .55);stroke-dasharray:5 4;stroke-width:1.2}
|
|
177
|
+
.ghost polygon{fill:transparent!important;stroke:var(--muted);stroke-dasharray:4 4;stroke-width:1.2}
|
|
178
|
+
.ghost .det{opacity:.45}
|
|
179
|
+
.blk polygon.ico-unknown{fill:none;stroke:hsl(var(--h) var(--s) var(--l-edge));stroke-width:1.2;stroke-dasharray:3 2.5}
|
|
180
|
+
.blk .ico-unknown-q{stroke:hsl(var(--h) var(--s) var(--l-edge));stroke-width:1.6;stroke-linecap:round;fill:none}
|
|
181
|
+
.blk polygon.sock-hole{fill:hsl(var(--h) var(--s) 18%);opacity:.8}
|
|
182
|
+
.scr .t{fill:#1d1f27;stroke:#3a3b44;stroke-width:.6}
|
|
183
|
+
.scr .ln{stroke:#8fd3b0;stroke-width:1.2;stroke-linecap:round}
|
|
184
|
+
.scr .bar{fill:#2a2c36}
|
|
185
|
+
.scr .win{fill:#e9e9ee}
|
|
186
|
+
.scr .wall{fill:#3b5bbd}
|
|
187
|
+
.scr .glass{fill:#0d0e12;stroke:#3a3b44;stroke-width:1}
|
|
188
|
+
.scr .w{fill:#f4f4f2}
|
|
189
|
+
.scr .d{fill:#0b0b0d}
|
|
190
|
+
.scr .m{fill:#3a3934}
|
|
191
|
+
.scr .unk{fill:none;stroke:#8a8d99;stroke-width:1;stroke-dasharray:3 2.5}
|
|
192
|
+
.scr .unk-q{fill:none;stroke:#8a8d99;stroke-width:1.4;stroke-linecap:round}
|
|
193
|
+
.scr .unk-dot{fill:#8a8d99}
|
|
194
|
+
.orb .ball{fill:url(#orbG);stroke:#8a8b93;stroke-width:.8}
|
|
195
|
+
.orb .shade{fill:#000;opacity:.18}
|
|
196
|
+
.orb .eye{fill:#0b0b0d}
|
|
197
|
+
.person .body{fill:hsl(var(--h) var(--s) var(--l-left));stroke:hsl(var(--h) var(--s) var(--l-edge));stroke-width:.8}
|
|
198
|
+
.person .head{fill:hsl(var(--h) var(--s) var(--l-top));stroke:hsl(var(--h) var(--s) var(--l-edge));stroke-width:.8}
|
|
199
|
+
|
|
200
|
+
/* text */
|
|
201
|
+
.lbl{font-size:13px;font-weight:700;fill:var(--ink);paint-order:stroke;stroke:var(--surface);stroke-width:4px;stroke-linejoin:round}
|
|
202
|
+
.sub{font-size:11px;fill:var(--muted);font-weight:400;paint-order:stroke;stroke:var(--surface);stroke-width:4px;stroke-linejoin:round}
|
|
203
|
+
.floor{font-size:11px;font-weight:600;letter-spacing:.01em}
|
|
204
|
+
.floor.t-control{fill:var(--muted)}
|
|
205
|
+
.slabname{font-size:15px;font-weight:800;fill:var(--muted);letter-spacing:.12em;opacity:.8}
|
|
206
|
+
.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}
|
|
208
|
+
.tunnel .top{fill:hsl(205 85% 65% / .22)}
|
|
209
|
+
.tunnel .rib{fill:none;stroke:hsl(205 75% 45% / .5);stroke-width:1}
|
|
210
|
+
.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
|
+
|
|
212
|
+
/* flows */
|
|
213
|
+
.flow{fill:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:round}
|
|
214
|
+
`,ar=t=>tl+ei(t),sl=`
|
|
215
|
+
/* step marks */
|
|
216
|
+
.xm circle{fill:var(--surface);stroke:var(--blocked);stroke-width:2.5}
|
|
217
|
+
.xm path{stroke:var(--blocked);stroke-width:3;stroke-linecap:round}
|
|
218
|
+
.say rect{fill:var(--surface);stroke-width:1.5}
|
|
219
|
+
.say text{font-size:12px;font-weight:600}
|
|
220
|
+
.badge{cursor:pointer}
|
|
221
|
+
.badge circle{fill:var(--c);stroke:var(--surface);stroke-width:2.5}
|
|
222
|
+
.badge text{font-size:11.5px;font-weight:800;fill:var(--on);text-anchor:middle;dominant-baseline:central;pointer-events:none}
|
|
223
|
+
.tok{stroke:var(--surface);stroke-width:2.5}
|
|
224
|
+
.pulse{fill:none;stroke-width:2.5;transform-box:fill-box;transform-origin:center;animation:pulse 1.5s ease-out infinite}
|
|
225
|
+
@keyframes pulse{from{transform:scale(.35);opacity:.95}to{transform:scale(1.5);opacity:0}}
|
|
226
|
+
.sub{stroke-width:5px}
|
|
227
|
+
|
|
228
|
+
/* step focus: what a step does not touch dims; things that appear later are hidden */
|
|
229
|
+
[data-hl],[data-id],[data-step]{transition:opacity .25s}
|
|
230
|
+
svg.focus [data-hl]:not(.hl){opacity:.12}
|
|
231
|
+
svg.focus.dim-all [data-dim]:not(.hl){opacity:.14}
|
|
232
|
+
svg.focus .badge:not(.on){opacity:.14}
|
|
233
|
+
svg.all .badge{opacity:1}
|
|
234
|
+
svg.focus.all [data-hl]:not(.hl),svg.focus.all.dim-all [data-dim]:not(.hl){opacity:.9}
|
|
235
|
+
svg [data-step]:not(.on),svg.all [data-step]{opacity:0!important;pointer-events:none}
|
|
236
|
+
.pre{opacity:0!important;pointer-events:none}
|
|
237
|
+
`,nl=`
|
|
238
|
+
/* player */
|
|
239
|
+
.player{display:flex;align-items:flex-start;gap:10px 14px;padding:12px 16px;border-top:1px solid var(--line);flex-wrap:wrap}
|
|
240
|
+
.ctrls{display:flex;gap:6px;flex:none}
|
|
241
|
+
.pbtn{font:inherit;font-size:13px;font-weight:700;display:inline-flex;align-items:center;gap:6px;border:1px solid var(--line);background:var(--bg);color:var(--ink);border-radius:99px;padding:6px 14px;cursor:pointer}
|
|
242
|
+
.pbtn.icon{padding:6px 11px}
|
|
243
|
+
.pbtn:hover{border-color:var(--muted)}
|
|
244
|
+
.pbtn:disabled{opacity:.6;cursor:default}
|
|
245
|
+
.pbtn.primary{background:var(--ink);color:var(--surface);border-color:var(--ink);min-width:92px;justify-content:center}
|
|
246
|
+
.pbtn:focus-visible,.dot:focus-visible,.badge:focus-visible{outline:2px solid var(--send);outline-offset:2px}
|
|
247
|
+
.cap{flex:1 1 360px;min-width:0}
|
|
248
|
+
.cap-h{font-size:14.5px;font-weight:700;display:flex;align-items:center;gap:8px}
|
|
249
|
+
.cap-h .cnt{margin-left:auto;font-weight:500;color:var(--muted);font-size:12px;white-space:nowrap}
|
|
250
|
+
.num{flex:none;display:inline-grid;place-items:center;width:22px;height:22px;border-radius:50%;background:var(--c,var(--control));color:var(--on);font-size:11px;font-weight:800}
|
|
251
|
+
.cap-t{font-size:13.5px;color:var(--ink);margin:4px 0 0;max-width:92ch;min-height:3.1em}
|
|
252
|
+
.cap-c{margin:8px 0 0;background:var(--code-bg);border-radius:8px;padding:7px 10px;font-size:12px;line-height:1.5;white-space:pre-wrap;overflow-wrap:anywhere;max-height:9.5em;overflow-y:auto;color:var(--ink)}
|
|
253
|
+
.cap-c:empty{display:none}
|
|
254
|
+
.prog{height:3px;background:var(--line);border-radius:3px;overflow:hidden;margin-top:9px}
|
|
255
|
+
.prog i{display:block;height:100%;width:0;background:var(--c,var(--ink))}
|
|
256
|
+
.dots{display:flex;gap:5px;flex-wrap:wrap;flex-basis:100%;padding-left:2px;order:4}
|
|
257
|
+
.dot{width:10px;height:10px;border-radius:50%;background:var(--line);border:0;padding:0;cursor:pointer}
|
|
258
|
+
.dot.on{background:var(--ink)} .dot.done{background:var(--muted)}
|
|
259
|
+
details.steps{margin:0 0 8px;font-size:13.5px}
|
|
260
|
+
details.steps summary{cursor:pointer;color:var(--muted);font-size:13px}
|
|
261
|
+
details.steps ol{margin:8px 0 0;padding-left:22px;max-width:92ch}
|
|
262
|
+
details.steps li{margin:6px 0}
|
|
263
|
+
details.steps li code{font-size:11.5px}
|
|
264
|
+
@media (prefers-reduced-motion:reduce){.pulse{animation:none;opacity:.8}}
|
|
265
|
+
@media (max-width:560px){.cap{flex-basis:100%}}
|
|
266
|
+
.still .pulse{animation:none;opacity:.85}
|
|
267
|
+
.still *,.still *::before{transition:none!important}
|
|
268
|
+
.still .prog{display:none}
|
|
269
|
+
.still .ctrls,.still .tools{display:none}
|
|
270
|
+
.tools{display:flex;gap:6px;flex:none;order:3;margin-left:auto}
|
|
271
|
+
.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)}`,rl=`
|
|
273
|
+
.grid{display:none;fill:none;stroke:var(--ink);stroke-width:.6;opacity:.16;pointer-events:none}
|
|
274
|
+
svg.show-grid .grid{display:inline}
|
|
275
|
+
svg.pre-assemble > g:not(.g-anim){opacity:0}
|
|
276
|
+
`,Eo=sl+nl+rl;var il=t=>({data:t,locate:()=>({line:0,col:0}),span:()=>{},diags:[]});function To(t,e,n,r=il(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=ho(l,f,u,r,new Set(Object.keys(a.kinds)),m.snap);s.push(...h.diags);let y=vo(l,f,u,h.routes,r,a);s.push(...y.diags),s.push(...zd(l,f,n,r));let $=Oo({scene:l,layout:u,routes:h.routes,steps:y,theme:a,id:l.id,gridStep:m.step??m.snap??1});for(let g of $.warnings){let w=r.locate(g.path);s.push({severity:"warning",message:g.message,line:w.line,col:w.col,path:g.path})}d.push({id:l.id,raw:l,layout:u,routes:h.routes,steps:y,rendered:$,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&&!Tn(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 lp(t,e){let n=t/(Et*st),r=2*e/st;return[(n+r)/2,(r-n)/2]}function cp(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 pp(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 fp(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 dp=(t,e)=>e?.padding??At(t,e?.kind)?.pad??0;function mp(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 No(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 al=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}),ll={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}},up=(t,e)=>ms(t,ll[e]);function Ro(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]&&!ol(l,p)&&!ol(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 ol=(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 ol(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)),$=[];for(let N=0;N<h;N++){$.push([]);for(let j=0;j<y;j++)$[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},w=new Array(h+1).fill(0),S=new Array(y+1).fill(0);for(let N=0;N<y;N++)for(let j=1;j<h;j++){let V=g($[j-1][N],$[j][N],!1);V&&(w[j]=Math.max(w[j],V-i))}for(let N=0;N<h;N++)for(let j=1;j<y;j++){let V=g($[N][j-1],$[N][j],!0);V&&(S[j]=Math.max(S[j],V-o))}let O=N=>{let j=N*(n+i);for(let V=1;V<=N;V++)j+=w[V];return j},b=N=>{let j=N*(r+o);for(let V=1;V<=N;V++)j+=S[V];return j},E=(N,j,V,H)=>V===j?N(j):N(j)+(H-j)*(N(V)-N(j))/(V-j),T=c.map(()=>new Set),C=(N,j)=>{for(let V=N;V>=0;V=f[V])T[V].add(j)};c.forEach((N,j)=>{C(j,N.cells[1]),C(j,N.cells[3])});for(let N of t.cards){let j=$[N.cell[0]][N.cell[1]];j.length&&C(j[j.length-1],N.cell[1])}let M=c.map(()=>new Map),I=(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?M[f[N]].get(V[0]):b(V[0]);M[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(I($[J][V[ae-1]],N),I($[J][V[ae]],N),!0));H+=r+Math.max(o,ue),M[N].set(V[ae],H)}}let k=c.map(()=>new Set),v=(N,j)=>{for(let V=N;V>=0;V=f[V])k[V].add(j)};c.forEach((N,j)=>{v(j,N.cells[0]),v(j,N.cells[2])});for(let N of t.cards){let j=$[N.cell[0]][N.cell[1]];j.length&&v(j[j.length-1],N.cell[0])}let x=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=[...k[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)x[N].set(ae,E(O,j[0],j[2],ae));continue}let H=f[N]>=0?x[f[N]].get(V[0]):O(V[0]);x[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(I($[V[ae-1]][J],N),I($[V[ae]][J],N),!1));H+=n+Math.max(i,ue),x[N].set(V[ae],H)}}let R=(N,j)=>{let V=$[N][j],H=V.length?V[V.length-1]:-1;return H>=0?[x[H].get(N),M[H].get(j)]:[O(N),b(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=$[J.cell[0]][J.cell[1]];te[te.length-1]===N&&(V.push(x[N].get(J.cell[0])),H.push(M[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(M[N].get(J));for(let J of[j[0],j[2]])t.cards.some(te=>te.cell[0]===J&&ae(te))||V.push(x[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=>R(N.cell[0],N.cell[1])),se=t.cards.map(N=>{let j=$[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((A,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((A,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 A of ae)A.t<te.b&&te.t<A.b&&A.r<=te.l+1e-6&&(Se=Math.max(Se,A.r+(A.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:R,cardAt:N=>G[N]}}function lr(t,e,n={}){if(n.wrap){let{wrap:P,...F}=n;return lr(Ld(t,e,P.aspect,F),e,F)}let r=Ro(t);if(r.length)throw new Error(`the board has ${r.length} error${r.length>1?"s":""}:
|
|
277
|
+
${r.join(`
|
|
278
|
+
`)}`);let i={...al,...n},{W:o,H:s}=i,a=P=>Math.round(P*10)/10,d=[],c=t.panels??[],{prect:l,parentIx:p,depthOf:f,cardAt:m}=ti(t,i),u=c.map((P,F)=>{let B=l[F],oe=e(P.label??"","title")+(P.sub?e(P.sub,"titleSub"):0);return{...P,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(P=>{let[F,B]=m(t.cards.indexOf(P));return{...P,rect:{l:F,t:B,r:F+o,b:B+s}}}),y=new Map;u.forEach(P=>y.set(P.id,P.rect)),h.forEach(P=>y.set(P.id,P.rect));let $=h.map(P=>P.rect),g=u.map(P=>P.rect),w=u.filter(P=>P.label).map(P=>P.title),S=(P,F)=>P.l>=F.l&&P.r<=F.r&&P.t>=F.t&&P.b<=F.b,O=(P,F,B,oe)=>Math.min(P[0],F[0])<B.r+oe&&Math.max(P[0],F[0])>B.l-oe&&Math.min(P[1],F[1])<B.b+oe&&Math.max(P[1],F[1])>B.t-oe,b=(P,F)=>g.reduce((B,oe)=>{if(P[0]===F[0]){let re=Math.min(P[1],F[1]),Ae=Math.max(P[1],F[1]);P[0]>oe.l&&P[0]<oe.r&&(B+=[oe.t,oe.b].filter(ye=>ye>re+1&&ye<Ae-1).length)}else{let re=Math.min(P[0],F[0]),Ae=Math.max(P[0],F[0]);P[1]>oe.t&&P[1]<oe.b&&(B+=[oe.l,oe.r].filter(ye=>ye>re+1&&ye<Ae-1).length)}return B},0),E=(P,F)=>g.some(B=>P[1]===F[1]?[B.t,B.b].some(oe=>Math.abs(P[1]-oe)<16&&Math.max(P[0],F[0])>B.l&&Math.min(P[0],F[0])<B.r):[B.l,B.r].some(oe=>Math.abs(P[0]-oe)<16&&Math.max(P[1],F[1])>B.t&&Math.min(P[1],F[1])<B.b)),T=(P,F,B,oe)=>g.filter(re=>re!==B&&re!==oe&&!S(B,re)&&!S(oe,re)&&O(P,F,{l:re.l+3,r:re.r-3,t:re.t+3,b:re.b-3},0)).length,C=[],M=new Map,I=new Map,k=(P,F)=>{C.push([P,F]);let[B,oe]=P[1]===F[1]?[M,P[1]]:P[0]===F[0]?[I,P[0]]:[void 0,0];if(!B)return;let re=Math.floor(oe/6);(B.get(re)??B.set(re,[]).get(re)).push([P,F])},v=(P,F)=>{let B=P[1]===F[1];if(!B&&P[0]!==F[0])return 0;let oe=B?1:0,re=B?0:1,Ae=B?M:I,ye=Math.floor(P[oe]/6),rt=Math.min(P[re],F[re]),Te=Math.max(P[re],F[re]),we=0;for(let Ie=ye-1;Ie<=ye+1;Ie++)for(let[De,ut]of Ae.get(Ie)??[])Math.abs(P[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},x=[...y.values()],R=Math.min(...x.map(P=>P.l)),L=Math.max(...x.map(P=>P.r)),D=Math.min(...x.map(P=>P.t)),G=Math.max(...x.map(P=>P.b)),se=(P,F)=>{let B=(P+F)/2;return[B,B-12,B+12,B-24,B+24]},_=(()=>{let P=[];return $.forEach(F=>$.forEach(B=>{B.t>F.b&&B.l<F.r+400&&B.r>F.l-400&&P.push(...se(F.b,B.t))})),P.push(D-22,D-34,G+22,G+34),[...new Set(P.map(Math.round))]})(),K=(()=>{let P=[];return $.forEach(F=>$.forEach(B=>{B.l>F.r&&P.push(...se(F.r,B.l))})),P.push(R-22,R-34,L+22,L+34),[...new Set(P.map(Math.round))]})(),Z=new Map,Q=new Map,N=P=>{let F=Z.get(P);return F||Z.set(P,F=$.filter(B=>P<B.b+6&&P>B.t-6)),F},j=P=>{let F=Q.get(P);return F||Q.set(P,F=$.filter(B=>P<B.r+6&&P>B.l-6)),F},V=i.crossPanel/i.overlap,H=i.border/i.overlap,ae=i.nearEdge/i.overlap;function ue(P,F,B,oe,re=!0){let Ae=0;for(let we=1;we<P.length;we++)Ae+=Math.abs(P[we-1][0]-P[we][0])+Math.abs(P[we-1][1]-P[we][1]);let ye=Ae+i.bend*(P.length-2);if(ye>=oe)return ye;let rt=0,Te=0;for(let we=1;we<P.length;we++){let Ie=P[we-1],De=P[we];if(re){if(ce(Ie,De,F,B)||E(Ie,De))return 1/0;continue}for(let ut of Ie[1]===De[1]?N(Ie[1]):j(Ie[0]))ut!==F&&ut!==B&&O(Ie,De,ut,6)&&rt++;for(let ut of w)O(Ie,De,ut,2)&&rt++}for(let we=1;we<P.length;we++){let Ie=P[we-1],De=P[we];if(Te+=v(Ie,De)+V*T(Ie,De,F,B)+H*b(Ie,De),E(Ie,De)&&(Te+=ae),ye+i.overlap*Te>=oe)return ye+i.overlap*Te}return ye+i.overlap*Te+rt*1e5}let J=P=>(P.l+P.r)/2,te=P=>(P.t+P.b)/2,Se=[0,-22,22,-44,44],Ve={bc:1/0},A=(P,F,B,oe)=>Math.abs(P-B)+Math.abs(F-oe),U=(P,F,B,oe,re,Ae,ye,rt)=>{let Te=0;return Te+=A(P,F,B,oe),Te+=A(B,oe,re,Ae),Te+=A(re,Ae,ye,rt),Te+i.bend*2},ne=(P,F,B,oe,re,Ae,ye,rt,Te,we)=>{let Ie=0;return Ie+=A(P,F,B,oe),Ie+=A(B,oe,re,Ae),Ie+=A(re,Ae,ye,rt),Ie+=A(ye,rt,Te,we),Ie+i.bend*3},ce=(P,F,B,oe)=>{for(let re of P[1]===F[1]?N(P[1]):j(P[0]))if(re!==B&&re!==oe&&O(P,F,re,6))return!0;for(let re of w)if(O(P,F,re,2))return!0;return E(P,F)};function Ce(P,F,B,oe){let re=Math.max(P.l,F.l),Ae=Math.min(P.r,F.r);if(Ae-re>24)for(let it of Se){let lt=(re+Ae)/2+it;lt>re+8&<<Ae-8&&B(F.t>=P.b?[[lt,P.b],[lt,F.t]]:[[lt,P.t],[lt,F.b]])}let ye=Math.max(P.t,F.t),rt=Math.min(P.b,F.b);if(rt-ye>16)for(let it of[0,-10,10]){let lt=(ye+rt)/2+it;B(F.l>=P.r?[[P.r,lt],[F.l,lt]]:[[P.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),xn=new Uint8Array(Se.length*Te),$t=(it,lt,ks,jt)=>oe?(it[lt]||(it[lt]=ce(ks,jt,P,F)?2:1),it[lt]===1):!0;Se.forEach((it,lt)=>Se.forEach((ks,jt)=>{let It=J(P)+it,Lt=J(F)+ks,Bt=te(P)+it/3,gt=te(F)+ks/3;_.forEach((je,Ss)=>{let ct=je>P.b?P.b:je<P.t?P.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&&$t(Ie,lt*we+Ss,[It,ct],[It,je])&&$t(De,jt*we+Ss,[Lt,je],[Lt,Qt])&&B([[It,ct],[It,je],[Lt,je],[Lt,Qt]])}),K.forEach((je,Ss)=>{let ct=je>P.r?P.r:je<P.l?P.l:null,Qt=je>F.r?F.r:je<F.l?F.l:null;ct!==null&&Qt!==null&&U(ct,Bt,je,Bt,je,gt,Qt,gt)<Ve.bc&&$t(ut,lt*Te+Ss,[ct,Bt],[je,Bt])&&$t(xn,jt*Te+Ss,[je,gt],[Qt,gt])&&B([[ct,Bt],[je,Bt],[je,gt],[Qt,gt]])}),it===0&&ks===0&&K.forEach((je,Ss)=>_.forEach((ct,Qt)=>{let z=je>P.r?P.r:je<P.l?P.l:null,q=ct>F.b?F.b:ct<F.t?F.t:null;z!==null&&q!==null&&ne(z,Bt,je,Bt,je,ct,Lt,ct,Lt,q)<Ve.bc&&$t(ut,lt*Te+Ss,[z,Bt],[je,Bt])&&$t(De,jt*we+Qt,[Lt,ct],[Lt,q])&&B([[z,Bt],[je,Bt],[je,ct],[Lt,ct],[Lt,q]]);let W=ct>P.b?P.b:ct<P.t?P.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,gt,ee,gt)<Ve.bc&&$t(Ie,lt*we+Qt,[It,W],[It,ct])&&$t(xn,jt*Te+Ss,[je,gt],[ee,gt])&&B([[It,W],[It,ct],[je,ct],[je,gt],[ee,gt]])}));let jn=J(P)<F.l?F.l:J(P)>F.r?F.r:null,Dt=gt<P.t?P.t:gt>P.b?P.b:null;jn!==null&&Dt!==null&&B([[It,Dt],[It,gt],[jn,gt]]);let kn=te(P)<F.t?F.t:te(P)>F.b?F.b:null,Bn=Lt<P.l?P.l:Lt>P.r?P.r:null;kn!==null&&Bn!==null&&B([[Bn,Bt],[Lt,Bt],[Lt,kn]])}))}function le(P,F,B,oe){for(let re of Se){let Ae=J(P)+re,ye=te(P)+re/3,rt=[[[Ae,P.t],[Ae,F.t]],[[P.r,ye],[F.r,ye]],[[Ae,P.b],[Ae,F.b]],[[P.l,ye],[F.l,ye]]];for(let Te of rt)oe(B?[Te[1],Te[0]]:Te)}}let Ke=(P,F,B,oe)=>{let re=null;return Ve.bc=1/0,P(Ae=>{let ye=ue(Ae,F,B,Ve.bc,oe);ye<Ve.bc&&(Ve.bc=ye,re=Ae)},oe),re},ve=[],de=P=>g.some(F=>[F.l,F.r].some(B=>P.l<B+3&&P.r>B-3&&P.b>F.t&&P.t<F.b)||[F.t,F.b].some(B=>P.t<B+3&&P.b>B-3&&P.r>F.l&&P.l<F.r)),Oe=P=>C.filter(([F,B])=>O(F,B,P,1)).length,We=P=>w.some(F=>P.l<F.r&&P.r>F.l&&P.t<F.b&&P.b>F.t),Re=P=>$.filter(F=>P.l<F.r+3&&P.r>F.l-3&&P.t<F.b+3&&P.b>F.t-3).length,at=P=>ve.filter(F=>P.l<F.r+4&&P.r>F.l-4&&P.t<F.b+2&&P.b>F.t-2).length,yt=P=>50*mt(P)+3*Oe(P)+(de(P)?1:0)+(We(P)?5:0)+5*Re(P)+5*at(P),Ye=P=>Oe(P)>0||de(P)||We(P)||Re(P)>0||at(P)>0,dt=[];(t.links??[]).forEach((P,F)=>{let B=P.id??`link-${F}`,oe=y.get(P.aOn??P.a),re=y.get(P.bOn??P.b);if(oe===re){d.push(`link "${B}" joins "${P.aOn??P.a}" to itself: not drawn`),dt.push({...P,id:B,points:[],routed:!1});return}let Ae=S(oe,re)?Te=>le(oe,re,!1,Te):S(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({...P,id:B,points:[],routed:!1});return}for(let Te=1;Te<ye.length;Te++)k(ye[Te-1],ye[Te]);dt.push({...P,id:B,points:ye,routed:rt})});let nt=[];for(let P=0;P<C.length;P++)for(let F=P+1;F<C.length;F++){let[B,oe]=C[P],[re,Ae]=C[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=P=>nt.filter(([F,B])=>F>P.l-2&&F<P.r+2&&B>P.t-2&&B<P.b+2).length;for(let P of dt){let F=P,B=P.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,xn=we[1]===Ie[1]?[0,-.3,.3,-.15,.15].flatMap($t=>{let it=De+$t*Math.abs(we[0]-Ie[0]);return[[it,ut-6,"middle"],[it,ut+15,"middle"]]}):[0,-.3,.3].flatMap($t=>{let it=ut+4+$t*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[$t,it,lt]of xn){let ks=lt==="middle"?$t-Ae/2:lt==="end"?$t-Ae:$t,jt={l:ks,r:ks+Ae,t:it-11,b:it+3};if(!Ye(jt)){ye=[$t,it,lt,jt];break}let It=yt(jt);It<Te&&(Te=It,rt=[$t,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]),P.at={x:a(ye[0]),y:a(ye[1]),anchor:ye[2],box:ye[3],text:F.label}}let pe=[],Fe=[];for(let P of[...x,...ve,...u.map(F=>F.title)])pe.push(P.l,P.r),Fe.push(P.t,P.b);for(let P of dt)for(let F of P.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 hp(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(Ro(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(b=>b.range[1])),$=Math.max(...m.map(b=>b.range[3]))-y+1,g=t.cards.map(b=>({...b,cell:[...b.cell]})),w=e.map(b=>({...b,cells:[...b.cells]}));for(let b of g)b.cell[1]>l&&(b.cell[1]+=$);let S=new Set;for(let b=s;b>=0&&!S.has(b);b=i(e[b].cells,b))S.add(b);w.forEach((b,E)=>{b.cells[1]>l?(b.cells[1]+=$,b.cells[3]+=$):(S.has(E)||b.cells[1]<=l&&b.cells[3]>l)&&(b.cells[3]+=$)});let O=u;for(let b of m){let E=O-b.range[0],T=h+(b.range[1]-y)-b.range[1],C=M=>M[0]>=b.range[0]&&M[0]<=b.range[2]&&M[1]>=b.range[1]&&M[1]<=b.range[3];t.cards.forEach((M,I)=>{C([M.cell[0],M.cell[1]])&&(g[I].cell=[M.cell[0]+E,M.cell[1]+T])}),e.forEach((M,I)=>{n(M.cells,b.range)&&(w[I].cells=[M.cells[0]+E,M.cells[1]+T,M.cells[2]+E,M.cells[3]+T])}),O+=b.range[2]-b.range[0]+1}e.forEach((b,E)=>{let T=t.cards.map((C,M)=>n([C.cell[0],C.cell[1],C.cell[0],C.cell[1]],b.cells)?g[M].cell:void 0).filter(C=>!!C);T.length&&(w[E].cells=[Math.min(...T.map(C=>C[0])),Math.min(...T.map(C=>C[1])),Math.max(...T.map(C=>C[0])),Math.max(...T.map(C=>C[1]))])}),yield{cards:g,panels:w,links:t.links}}}}}function Io(t,e=()=>!0){let n=t.layout.items.filter(b=>e(b.id)),r=t.layout.catalog,i=b=>b.type==="node"&&!b.children.some(E=>E.type==="node"&&e(E.id)),o=n.filter(i),s=b=>{let E=[];for(let T=b;T;T=T.parent)E.unshift(T);return E},a=new Map(o.map(b=>[b.id,s(b)])),d=(b,E)=>{let T=a.get(b.id),C=a.get(E.id),M=0;for(;M<T.length&&M<C.length&&T[M]===C[M];)M++;return[T[M].box,C[M].box]},c=1e-6,l=(b,E)=>{let[T,C]=d(b,E);return T.y1<=C.y0+c&&T.x0<C.x1-c&&C.x0<T.x1-c},p=(b,E)=>{let[T,C]=d(b,E);return T.x1<=C.x0+c&&T.y0<C.y1-c&&C.y0<T.y1-c},f=(b,E)=>{let T=new Map,C=[];for(let M of[...o].sort((I,k)=>E(I)-E(k))){let I=0;for(let k of C)T.get(k.id)+1>I&&b(k,M)&&(I=T.get(k.id)+1);T.set(M.id,I),C.push(M)}return T},m=f(l,b=>b.box.y0),u=f(p,b=>b.box.x0),h=Math.min(...o.map(b=>b.box.x1-b.box.x0))/2;for(let b of o)if(!b.parent)for(let E of o)E.parent&&E.box.x0<=b.box.x0+h&&u.set(b.id,Math.max(u.get(b.id),u.get(E.id)));let y=new Map;for(let b of o)y.set(b.id,[u.get(b.id),m.get(b.id)]);let $=new Map;for(let b of o){let E=y.get(b.id),T=$.get(String(E));if(T!==void 0&&T!==b.id){for(let[,C]of y)C[0]>E[0]&&C!==E&&C[0]++;E[0]++,$.clear();for(let C of o)$.set(String(y.get(C.id)),C.id)}else $.set(String(E),b.id)}let g=o.map(b=>{let E=b.node,T=hs(r,E.asset);return{id:b.id,label:E.label??b.id,sub:E.sub,role:E.role??T.role,ghost:E.ghost||void 0,cell:y.get(b.id)}}),w=[];for(let b of n){if(i(b))continue;let E=[],T=v=>{for(let x of v.children){let R=y.get(x.id);R&&E.push(R),T(x)}};if(T(b),!E.length)continue;let C=E.map(v=>v[0]),M=E.map(v=>v[1]),I=b.type==="region"?b.region.label:b.node.label??b.id,k=b.type==="region"?b.region.role??At(r,b.region.kind)?.role:b.node.role??hs(r,b.node.asset).role;w.push({id:b.id,label:I,sub:b.type==="node"?b.node.sub:void 0,role:k,cells:[Math.min(...C),Math.min(...M),Math.max(...C),Math.max(...M)]})}let S=new Set([...g.map(b=>b.id),...w.map(b=>b.id)]),O=[];for(let b of t.routes){if(!e(b.id))continue;let E=ls(b.raw.from).id,T=ls(b.raw.to).id;if(!S.has(E)||!S.has(T))continue;let C=typeof b.raw.label=="string"?b.raw.label:b.raw.label?.text;O.push({id:b.id,a:E,b:T,kind:b.kind,label:C})}return{cards:g,panels:w,links:O}}var yn={W:4,D:2,H:.9,GX:2,GY:2.4,PAD:.6,CH:2.2,PANEL_H:.3},yp=`
|
|
279
|
+
.blk .card-name{font-size:13px;font-weight:600;fill:var(--ink)}
|
|
280
|
+
.blk .card-sub{font-size:10px;fill:var(--ink);opacity:.75}
|
|
281
|
+
.blk.ghost .card-name,.blk.ghost .card-sub{fill:var(--muted)}
|
|
282
|
+
`;function cl(t){return{name:"card",description:"A card: a slab with its name on its front face",size:[yn.W,yn.D,yn.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",St.lbl,"left","start"),i.sub&&(o+=e.faceText(n.x0+.2,n.y1,n.z0+s*.14,i.sub,"card-sub",St.sub,"left","start")),o}}}function gp(t){let e=new Map(t.cards.map(n=>[n.id,{label:n.label,sub:n.sub}]));return{regions:{panel:{shape:"slab",pad:yn.PAD,z:[yn.PANEL_H,0],floor:!0,role:"grey",labelStyle:"floor"}},nodes:{card:cl(n=>e.get(n))},defaultNode:"card"}}function bp(t,e={}){let n=yn,{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,$)=>{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=$)}),h},l=s.map((u,h)=>{let y=r[h],$=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-$.l),a(y.t-$.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)),$=c(u),g=$>=0?r[$]:{l:0,t:0},w={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]};($>=0?l[$].nodes:f).push(w)}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={};fi(lf,{APPEARS:()=>Pp,BASE_FIELDS:()=>Sl,BINS:()=>zp,BIN_MS:()=>bs,CARD:()=>xt,DUAL_VIEW_CSS:()=>af,IDLES:()=>Ap,MAX_ZOOM:()=>kp,MIN_ZOOM:()=>xp,P3:()=>Ue,SEGMENT_NAME:()=>Lo,SEVERITIES:()=>ns,TIMELINE_VERSION:()=>Ip,activityOf:()=>Ol,attr:()=>Rs,binNext:()=>Vo,binStart:()=>Rn,cardMotion:()=>Mp,cls:()=>Ep,crumbs:()=>fr,dualView:()=>nf,escapeName:()=>jo,extent:()=>zo,findGaps:()=>Ko,fitWithOverlay:()=>Tp,flatCss:()=>Xp,flatSvg:()=>Ho,formatScope:()=>Cp,gapKey:()=>zn,gapLabel:()=>In,h:()=>X,hasSegment:()=>Fp,highlights:()=>ri,isZone:()=>Dp,isoVars:()=>Np,join:()=>Lp,kindOf:()=>cr,legend:()=>kl,levelOf:()=>qt,markConnectors:()=>Xo,md:()=>Gs,measureIn:()=>Wo,memorySource:()=>Zp,modeFor:()=>Ml,morphSvgs:()=>sf,mountTimeline:()=>Wp,n:()=>ml,nameOf:()=>pr,node:()=>Op,offsetAt:()=>Yt,overlayPaint:()=>vp,parentOf:()=>_p,prefixAt:()=>nn,prune:()=>hl,pts:()=>si,rangeOf:()=>ni,readTime:()=>vl,rectOf:()=>Qp,renderPage:()=>Rp,rewrite:()=>ul,scope:()=>gl,scopePattern:()=>_o,scopeRules:()=>Fo,scopeSelector:()=>yl,searchFor:()=>dr,severities:()=>jp,stepData:()=>xl,storedMode:()=>rf,ticks:()=>qo,timeScale:()=>mr,toCSV:()=>Zo,toJSON:()=>Go,unite:()=>Co,viewToggle:()=>of,viewport:()=>Sp,within:()=>rs});var xp=.1,kp=8;function Sp(t,e){let n,r,i=!1,o=0,s=0,a=0,d=0,c=0,l=!1,p=()=>{let E=t.getBoundingClientRect();return{w:Math.max(1,E.width),h:Math.max(1,E.height)}},f=(E=n)=>{let T=p();return Math.min(T.w/E.w,T.h/E.h)},m=E=>{o++;try{E()}finally{o--}};function u(){let E=e.svg();if(!E||!n)return;o||(i=!0);let T=p(),C=f(),M=T.w/C,I=T.h/C;n={x:n.x+(n.w-M)/2,y:n.y+(n.h-I)/2,w:M,h:I},E.setAttribute("viewBox",`${n.x.toFixed(2)} ${n.y.toFixed(2)} ${n.w.toFixed(2)} ${n.h.toFixed(2)}`),s=C,e.onApply(C),a&&Math.abs(C/a-1)>.02&&(cancelAnimationFrame(d),d=requestAnimationFrame(()=>{d=0,e.onRezoom()}))}let h=(E,T)=>{let C=t.getBoundingClientRect(),M=f();return{x:n.x+(E-C.left)/M,y:n.y+(T-C.top)/M}};function y(E,T,C){if(!n)return;let M=f(),I=Math.min(8,Math.max(.1,M*E)),k=t.getBoundingClientRect(),v=T??k.left+k.width/2,x=C??k.top+k.height/2,R=h(v,x),L=p();n={x:R.x-(v-k.left)/I,y:R.y-(x-k.top)/I,w:L.w/I,h:L.h/I},u()}function $(E=r){if(!E)return;let T=p(),C=24,M=Math.min(8,Math.max(.1,Math.min((T.w-C*2)/E.w,(T.h-C*2)/E.h))),I=E.x+E.w/2,k=E.y+E.h/2,v={x:I-T.w/M/2,y:k-T.h/M/2,w:T.w/M,h:T.h/M};if(n&&Math.abs(v.w/n.w-1)<.001&&Math.abs(v.h/n.h-1)<.001&&Math.abs(v.x-n.x)<v.w*.001&&Math.abs(v.y-n.y)<v.h*.001){u();return}n=v,u()}function g(){for(let E=0,T="";E<4;E++){let C=e.itemsBox()??r;if(!C)return;let M=[C.x,C.y,C.w,C.h].map(k=>Math.round(k)).join();if(M===T)break;T=M;let I=Math.max(24,Math.min(C.w,C.h)*.06);if(m(()=>$({x:C.x-I,y:C.y-I,w:C.w+I*2,h:C.h+I*2})),!e.marksShowing()||!a||Math.abs(f()/a-1)<=.02)break;cancelAnimationFrame(d),d=0,e.onRezoom()}i=!1}function w(){if(i||!e.svg()||!n)return;let E=t.getBoundingClientRect();E.width<2||E.height<2||g()}function S(){if(!n)return;let E=f();y(1/E)}function O(){return new Promise(E=>{let T=0,C=s,M=()=>{if(l){E();return}let I=!!(d||c)||s!==C;C=s,T=I?0:T+1,T>=2?E():requestAnimationFrame(M)};requestAnimationFrame(M)})}let b=new ResizeObserver(()=>{if(!(!n||l)){if(i&&s){let E=p(),T=n.x+n.w/2,C=n.y+n.h/2;n={x:T-E.w/s/2,y:C-E.h/s/2,w:E.w/s,h:E.h/s}}i||(cancelAnimationFrame(c),c=requestAnimationFrame(()=>{c=0,l||w()})),m(u)}});return b.observe(t),{get view(){return n},set view(E){n=E},get full(){return r},set full(E){r=E},get moved(){return i},get zoom(){return s},painted(E){a=E},size:p,scale:f,quietly:m,applyView:u,toSvg:h,zoomAt:y,fit:$,fitItems:g,autoFit:w,actual:S,settled:O,dispose(){cancelAnimationFrame(c),cancelAnimationFrame(d),b.disconnect(),l=!0}}}var vt="http://www.w3.org/2000/svg",xt={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*st,(t+e)*.5*st-n*st],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(vt,"g");y.setAttribute("class",`live-badge ${m.cls} ${h}`.trim());let $=8/d,g=o.createElementNS(vt,"circle");if(g.setAttribute("cx",String(p)),g.setAttribute("cy",String(f)),g.setAttribute("r",String($)),y.append(g),"g"in m){let S=o.createElementNS(vt,"text");S.setAttribute("x",String(p)),S.setAttribute("y",String(f)),S.style.fontSize=`${(10/d).toFixed(2)}px`,S.textContent=m.g,y.append(S)}else{let S=o.createElementNS(vt,"use");S.setAttribute("href",t.iconHref(m.icon));let O=11/d;S.setAttribute("x",String(p-O/2)),S.setAttribute("y",String(f-O/2)),S.setAttribute("width",String(O)),S.setAttribute("height",String(O)),y.append(S)}let w=o.createElementNS(vt,"title");w.textContent=u,y.append(w),s(y)},l=(p,f)=>{for(let m of t.outlinesFor(p)){if(m.kind!=="poly")continue;let u=o.createElementNS(vt,"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(vt,"title");m.textContent=p.title;let u=o.createElementNS(vt,"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(vt,"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(vt,"g");c.setAttribute("class",`live-extra${d.cls}`);for(let[w,S]of d.data)c.setAttribute(w,S);let{x:l,y:p,w:f,hgt:m,k:u}=d.rect,h=o.createElementNS(vt,"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(vt,"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 $=o.createElementNS(vt,"text");$.setAttribute("class","sub"),$.setAttribute("x",String(l+8/u)),$.setAttribute("y",String(p+27/u)),$.style.fontSize=`${(9/u).toFixed(2)}px`,$.textContent=d.line2;let g=o.createElementNS(vt,"title");g.textContent=d.title,c.append(h,y,$,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+xt.above+m,Z=K+xt.h,Q=[Ue(p-xt.half,f+xt.t,K),Ue(p+xt.half,f+xt.t,K),Ue(p+xt.half,f-xt.t,Z),Ue(p-xt.half,f+xt.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]))},!No(u,d))break;m+=xt.lift}d.push(u);let h=l.z1+xt.above+m,y=h+xt.h,$=p-xt.half,g=p+xt.half,w=f+xt.t,S=f-xt.t,O=o.createElementNS(vt,"g");O.setAttribute("class",`${e}-card${c.cls}`);for(let[_,K]of c.data)O.setAttribute(_,K);let[b,E]=Ue(p,f,l.z1+.15),T=`${b.toFixed(1)}px ${E.toFixed(1)}px`;O.style.transformOrigin=T;let C=o.createElementNS(vt,"g");C.setAttribute("class",`${e}-float`),C.style.transformOrigin=T;let M=[];for(let _=Math.min(c.count-1,3);_>=1;_--){let K=_*xt.fan,Z=S-(_-1)*(2*xt.t+xt.gap)-xt.gap,Q=Z-2*xt.t,N=$+K,j=g+K,V=h+K,H=y+K,ae=(ue,J)=>{let te=o.createElementNS(vt,"polygon");te.setAttribute("class",`${e}-face stacked ${ue}`),te.setAttribute("points",si(J)),C.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)]),M.push({x0:N,x1:j,y0:Q,y1:Z,z0:V,z1:H})}let I=o.createElementNS(vt,"polygon");I.setAttribute("class",`${e}-tail`),I.setAttribute("points",si([Ue(p-.5,w,h+.05),Ue(p+.5,w,h+.05),Ue(p,f,l.z1+.15)]));let k=(_,K)=>{let Z=o.createElementNS(vt,"polygon");return Z.setAttribute("class",_),Z.setAttribute("points",si(K)),Z},v=k(`${e}-face front`,[Ue($,w,h),Ue(g,w,h),Ue(g,w,y),Ue($,w,y)]);C.append(I,k(`${e}-face top`,[Ue($,S,y),Ue(g,S,y),Ue(g,w,y),Ue($,w,y)]),k(`${e}-face side`,[Ue(g,S,h),Ue(g,w,h),Ue(g,w,y),Ue(g,S,y)]),v);let[x,R]=Ue($,w,y),L=40,D=o.createElementNS(vt,"g");D.setAttribute("transform",`matrix(${(Et*st/L).toFixed(4)} ${(.5*st/L).toFixed(4)} 0 ${(st/L).toFixed(4)} ${x.toFixed(1)} ${R.toFixed(1)})`);let G=(_,K,Z,Q)=>{let N=o.createElementNS(vt,"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(vt,"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)))}C.append(D);let se=o.createElementNS(vt,"title");se.textContent=c.title,O.append(C,se),t.onCard?.(O,{cx:p,cy:f,tipZ:l.z1+.15,card:{x0:$,x1:g,y0:S,y1:w,z0:h,z1:y},panes:M.reverse()}),s(O)}}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 Fd(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 pl=t=>t<0?0:t>1?1:1-Math.pow(1-t,3),$p=t=>t<0?0:t>1?1:t*t*t,fl=Math.PI*2,dl={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(I){c=0;for(let[k,v]of a){if(!k.isConnected){a.delete(k);continue}let x;if(v.repeat){if(x=(I+(v.offset??0))%v.repeat/v.dur,x>1){d.has(k)&&(t.restore(k),d.delete(k),k.style.removeProperty("transform"));continue}}else if(x=(I-v.start)/v.dur,x>=1){u(k,v);continue}let R=v.frame(Math.max(0,x));t.spin(k,R.theta,R.lift),d.add(k),f.set(k,R),R.scale!==1?k.style.transform=`scale(${R.scale.toFixed(4)})`:k.style.removeProperty("transform"),l++}a.size&&(c=requestAnimationFrame(m))}function u(I,k){a.delete(I),d.has(I)&&(t.restore(I),d.delete(I)),I.style.removeProperty("transform"),k.done?.()}function h(I){let k=a.get(I.card);k&&u(I.card,k),a.set(I.card,I),c||(c=requestAnimationFrame(m))}let y=8,$=0,g=I=>($++,I.finally(()=>{$--}));function w(I){return!o.enabled||$>=y?Promise.resolve():g(O(I))}function S(I){return!o.enabled||$>=y?Promise.resolve():g(b(I))}function O(I){let k=dl.appear[o.appear]/s;if(o.appear==="spin")return new Promise(R=>h({card:I,start:performance.now(),dur:k,frame:L=>({theta:(1-pl(L))*fl,lift:0,scale:Math.max(.001,pl(L))}),done:R}));let v=o.appear==="scale"?[{transform:"scale(0)"},{transform:"scale(1)"}]:o.appear==="dissolve"?[{opacity:0,filter:"blur(4px)"},{opacity:1,filter:"blur(0px)"}]:[{transform:"scale(0)",easing:"cubic-bezier(.3,0,.4,1)"},{transform:"scale(1.16)",offset:.55,easing:"ease-in-out"},{transform:"scale(.95)",offset:.78,easing:"ease-in-out"},{transform:"scale(1)"}];return I.animate(v,{duration:k,easing:o.appear==="inflate"?"linear":"ease-out"}).finished.then(()=>{},()=>{})}function b(I){let k=dl.disappear[o.appear]/s;if(o.appear==="spin")return new Promise(R=>h({card:I,start:performance.now(),dur:k,frame:L=>({theta:$p(L)*fl,lift:0,scale:Math.max(.001,1-$p(L))}),done:()=>{I.style.transform="scale(0)",R()}}));let v=o.appear==="scale"?[{transform:"scale(1)"},{transform:"scale(0)"}]:o.appear==="dissolve"?[{opacity:1,filter:"blur(0px)"},{opacity:0,filter:"blur(4px)"}]:[{transform:"scale(1)"},{transform:"scale(1.08)",offset:.3},{transform:"scale(0)"}];return I.animate(v,{duration:k,easing:"ease-in",fill:"forwards"}).finished.then(()=>{},()=>{})}function E(I){p.get(I)?.cancel(),p.delete(I);let k=a.get(I);k?.repeat&&u(I,k)}function T(I,k){if(E(I),!o.enabled||o.idle==="none"||I.classList.contains("still"))return;let v=I.getAttribute(r)??I.getAttribute(i)??"",x=(k??dl.period[o.idle])/s,R=Fd(v)*x;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:I,start:0,dur:_,repeat:x,offset:R,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)+pl(j)*fl,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=I.querySelector(`.${n}-float`)??I,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:x,iterations:1/0,easing:o.idle==="jiggle"?"linear":"ease-in-out"});se.startTime=(document.timeline.currentTime??0)-((document.timeline.currentTime??0)+R)%x,p.set(I,se)}function C(I,k,v,x,R=!1){R&&(x=!1);for(let[D,G]of k)!I.has(D)&&!R&&w(G),!p.has(G)&&!a.get(G)?.repeat&&T(G);if(!o.enabled||!x)return;let L=t.leavingLayer();if(L)for(let[D,G]of v){let se=I.get(D);!se||k.has(D)||(E(se),se.setAttribute("class",`${n}-leaving${G?" expired":""}`),se.removeAttribute(i),L.append(se),S(se).then(()=>se.remove()))}}function M(I){for(let[k,v]of[...a])u(k,v);c&&cancelAnimationFrame(c),c=0;for(let k of document.getAnimations())k.effect?.target?.closest?.(`.live-layer, .${n}-leaving-layer`)&&k.cancel();t.leavingLayer()?.replaceChildren()}return{get settings(){return{...o}},set(I,k){let v=o;if(o={...o,...I},(!o.enabled||v.idle!==o.idle||v.enabled!==o.enabled)&&(M(void 0),o.enabled))for(let x of k)T(x)},update:C,appear:w,disappear:S,startIdle:T,stopIdle:E,stopAll:M,async preview(I){o.enabled&&await Promise.all(I.map(async k=>{if(E(k),await w(k),o.idle!=="none"&&!k.classList.contains("still")){let v=o.idle==="pirouette"?1800:1400;T(k,v),await new Promise(x=>setTimeout(x,v*2.2/s)),E(k)}else await new Promise(v=>setTimeout(v,700/s));await S(k);for(let v of k.getAnimations())v.cancel();k.style.removeProperty("transform"),T(k)}))},get stats(){return{jobs:a.size,raf:!!c,frames:l,effects:$}},setSpeed(I){s=I},lastFrame:I=>f.get(I)}}var ml=t=>String(Math.round(t*100)/100),Op=(t,e={},...n)=>({name:t,attrs:Object.entries(e).map(([r,i])=>[r,typeof i=="number"?ml(i):i]),children:n});function ul(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=>ul(r,e))}}function hl(t,e){if(typeof t=="string")return t;if(!e(t))return{...t,children:t.children.map(n=>hl(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 zo(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 Co=(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=Co(t,zo(o));return i=r(s),o=n(i),s=Co(t,zo(o)),i=r(s),{k:i,box:s,live:o}}var Np=t=>t.replace(/--([a-zA-Z][\w-]*)/g,"--iso-$1");function jd(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 Bd(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 yl(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 gl(t,e,n){let r="";for(let[i,o]of jd(t)){if(i.startsWith("@keyframes")){r+=`@keyframes iso-${i.slice(10).trim()}{${o}}
|
|
283
|
+
`;continue}if(i.startsWith("@media")||i.startsWith("@supports")){r+=`${i}{${gl(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+=`${Bd(i).map(s=>yl(s,e,n)).join(",")}{${o.replace(/\banimation:\s*([a-z][\w-]*)/g,"animation:iso-$1")}}
|
|
285
|
+
`}return r}var bl=["<","script"].join("");function Gs(t){return t?wt(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(/&/g,"&"))?`<a href="${r}">${n}</a>`:n):""}var wl=t=>(t??"").split(/\n\s*\n/).filter(Boolean).map(e=>`<p class="sec-sub">${Gs(e.trim())}</p>`).join("");function xl(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 kl(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=At(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 Dd(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>
|
|
287
|
+
<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">
|
|
289
|
+
<div class="ctrls">
|
|
290
|
+
<button class="pbtn icon" type="button" data-a="prev" aria-label="Previous step">\u2039</button>
|
|
291
|
+
<button class="pbtn primary" type="button" data-a="play" aria-label="Play">\u25B6 Play</button>
|
|
292
|
+
<button class="pbtn icon" type="button" data-a="next" aria-label="Next step">\u203A</button>
|
|
293
|
+
</div>
|
|
294
|
+
${n}
|
|
295
|
+
<div class="cap" aria-live="polite">
|
|
296
|
+
<div class="cap-h"><span class="num" style="background:${r.color}">${r.num}</span><span class="h">${wt(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">${wt(r.command)}</pre>
|
|
299
|
+
<div class="prog"><i></i></div>
|
|
300
|
+
</div>
|
|
301
|
+
<div class="dots"></div>
|
|
302
|
+
</div>`}function Vd(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>${wt(n.heading)}.</b> ${Gs(n.caption)}${n.command?`<br><code>${wt(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-${wt(s.id)}">
|
|
304
|
+
<h2>${wt(s.raw.title)}</h2>
|
|
305
|
+
${wl(s.raw.caption)}
|
|
306
|
+
<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
|
+
${Dd(s)}
|
|
309
|
+
<div class="legend">${kl(t,s)}</div>
|
|
310
|
+
</div>
|
|
311
|
+
${Vd(s)}
|
|
312
|
+
${s.raw.after?`<div class="after">${wl(s.raw.after)}</div>`:""}
|
|
313
|
+
</section>`).join(`
|
|
314
|
+
`);return`<!doctype html>
|
|
315
|
+
<html lang="en">
|
|
316
|
+
<head>
|
|
317
|
+
<meta charset="utf-8">
|
|
318
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
319
|
+
<title>${wt(r)}</title>
|
|
320
|
+
${n.lede?`<meta name="description" content="${wt(n.lede)}">`:""}
|
|
321
|
+
<style>
|
|
322
|
+
${eo(t.theme)}${ar(t.catalog)}${Eo}
|
|
323
|
+
</style>
|
|
324
|
+
${e.extraHead??""}
|
|
325
|
+
</head>
|
|
326
|
+
<body>
|
|
327
|
+
<div class="wrap">
|
|
328
|
+
<header class="page">
|
|
329
|
+
<div>
|
|
330
|
+
<h1>${wt(r)}</h1>
|
|
331
|
+
${n.lede?`<p class="lede">${Gs(n.lede)}</p>`:""}
|
|
332
|
+
</div>
|
|
333
|
+
<div class="pills">${i}<button class="theme" id="themeBtn" type="button">Theme</button></div>
|
|
334
|
+
</header>
|
|
335
|
+
${o}
|
|
336
|
+
${n.after?wl(n.after):""}
|
|
337
|
+
${n.footer?`<footer>${Gs(n.footer)}</footer>`:""}
|
|
338
|
+
</div>
|
|
339
|
+
${bl} type="application/json" id="diagram-steps">${xl(t).replace(/</g,"\\u003c")}<\/script>
|
|
340
|
+
${bl}>
|
|
341
|
+
(function(){
|
|
342
|
+
var root=document.documentElement, m=/theme=(light|dark)/.exec(location.hash);
|
|
343
|
+
try{var t=localStorage.getItem('diagram-theme'); if(t) root.dataset.theme=t;}catch(e){}
|
|
344
|
+
if(m) root.dataset.theme=m[1];
|
|
345
|
+
document.getElementById('themeBtn').addEventListener('click',function(){
|
|
346
|
+
var dark=root.dataset.theme?root.dataset.theme==='dark':matchMedia('(prefers-color-scheme: dark)').matches;
|
|
347
|
+
root.dataset.theme=dark?'light':'dark';
|
|
348
|
+
try{localStorage.setItem('diagram-theme',root.dataset.theme);}catch(e){}
|
|
349
|
+
});
|
|
350
|
+
})();
|
|
351
|
+
<\/script>
|
|
352
|
+
${e.runtime?`${bl}>${e.runtime}<\/script>`:""}
|
|
353
|
+
${e.extraBody??""}
|
|
354
|
+
</body>
|
|
355
|
+
</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,Lo="(?:[^/:%\\s]|%[0-9A-F]{2})+",ns=["debug","info","notice","warning","error"],zp=["1m","1h","1d"],bs={"1m":6e4,"1h":36e5,"1d":864e5},_o=t=>`^(?:(?:${t.kinds.join("|")}):(?:${Lo})(?:/(?:${t.kinds.join("|")}):(?:${Lo}))*)?$`;function Fo(t){let e=new RegExp(_o(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 jo=t=>t.replace(/[%/:\s]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0")}`),Cp=t=>t.map(e=>`${e.kind}:${jo(e.name)}`).join("/"),Lp=(t,e,n)=>(t?`${t}/`:"")+`${e}:${jo(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 Sl=["kind","source","severity","scope","since","before"];function Kd(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 qd=/^(\d+)(s|m|h|d|w)$/,Gd={s:1e3,m:6e4,h:36e5,d:864e5,w:7*864e5};function vl(t,e){let n=qd.exec(t);if(n)return e-Number(n[1])*Gd[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 Zd(t,e,n=Date.now()){let r=[],i=[];for(let o of Kd(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=vl(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 Bo=t=>ns.indexOf(t),Ud={"=":"eq",">=":"ge",">":"gt","<=":"le","<":"lt"};function Yd(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:Ud[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 Hd(t,e){let n=[],r=new Map;for(let i of e.terms){let o=Yd(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 Wd(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=Bo(n.severity),o=Bo(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=[...Sl,...t.links],n=(a,d=Date.now())=>Zd(e,a,d),r=a=>Hd(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=>Wd(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=>Bo(e)>=Bo(t));var Bp=new Map,Do=new Map;function Yt(t,e){if(!t||t==="UTC")return 0;let n=`${t}|${Math.floor(e/(15*6e4))}`,r=Do.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 Do.size>5e4&&Do.clear(),Do.set(n,a),a}var Dp=t=>{try{return new Intl.DateTimeFormat("en-US",{timeZone:t}),!0}catch{return!1}};function Rn(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):Vo(o,n)<=t&&(o=Vo(o,n)),o}function Vo(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 gn=6e4,bn=36e5,ws=864e5;function Ko(t,e,n,r={}){let i=Math.max((r.minFrac??.15)*(n-e),r.minMs??10*gn),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 In(t){if(t>=ws){let e=Math.floor(t/ws),n=Math.round((t-e*ws)/bn);return n?`${e} d ${n} h`:`${e} d`}if(t>=bn){let e=Math.floor(t/bn),n=Math.round((t-e*bn)/gn);return n&&e<10?`${e} h ${n} min`:`${e} h`}return`${Math.max(1,Math.round(t/gn))} min`}var zn=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(w=>w.to>t&&w.from<e).map(w=>({from:Math.max(t,w.from),to:Math.min(e,w.to),w:i.weights?.get(zn(w))??0})).sort((w,S)=>w.from-S.from),c=d.reduce((w,S)=>w+(S.to-S.from)*(1-S.w),0),l=d.reduce((w,S)=>w+(1-S.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 w of d){m+=(w.from-u)*p,f.push([w.from,m]);let S=(1-w.w)*o+w.w*p*(w.to-w.from);h.push({from:w.from,to:w.to,x0:m,x1:m+S,weight:w.w}),m+=S,f.push([w.to,m]),u=w.to}f.push([e,m+(e-u)*p]);let y=w=>{if(w<=t)return(w-t)*p;if(w>=e)return f[f.length-1][1]+(w-e)*p;let S=0,O=f.length-1;for(;O-S>1;){let M=S+O>>1;f[M][0]<=w?S=M:O=M}let[b,E]=f[S],[T,C]=f[O];return T===b?E:E+(w-b)/(T-b)*(C-E)},$=w=>h.find(S=>S.weight<1&&w>S.x0&&w<S.x1);return{t0:t,t1:e,width:s,cuts:h,x:y,t:w=>{let S=$(w);if(S)return w-S.x0<S.x1-w?S.from:S.to;if(w<=0)return t+w/p;let O=0,b=f.length-1;if(w>=f[b][1])return e+(w-f[b][1])/p;for(;b-O>1;){let I=O+b>>1;f[I][1]<=w?O=I:b=I}let[E,T]=f[O],[C,M]=f[b];return M===T?E:E+(w-T)/(M-T)*(C-E)},cutAt:$,msPerPx:1/p}}var $l=[1e3,5e3,15e3,3e4,gn,5*gn,15*gn,30*gn,bn,3*bn,6*bn,12*bn,ws,2*ws,7*ws,14*ws,28*ws];function qo(t,e,n=80){let r=$l.find(d=>d/t.msPerPx>=n)??$l[$l.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<gn?`${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 Jd=["id","time","t","dur","scope","source","kind","severity","summary"],Xd=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 Go(t,e=[]){let n=new Set(e);return JSON.stringify(t.map(r=>Vp(r,n)),null,2)+`
|
|
357
|
+
`}function Zo(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=[...Jd,...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(Xd).join(","));return[s.join(","),...a].join(`\r
|
|
358
|
+
`)+`\r
|
|
359
|
+
`}var Qd=864e5,Is=36e5,Uo=(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=Rn(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 Pl(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}=Fo(e),{parseSearch:o,matchAst:s,toAst:a}=dr(e),d=A=>Object.fromEntries(e.flags.filter(U=>A?.[U]).map(U=>[U,!0])),c=n.now??r.now,l=(r.names??[]).flatMap(A=>(A.aliases??[]).map(U=>[U,A.scope])).sort((A,U)=>U[0].length-A[0].length),p=new Map,f=A=>{if(!l.length)return A;let U=p.get(A);if(U===void 0){let ne=l.find(([ce])=>rs(A,ce));U=ne?ne[1]+A.slice(ne[0].length):A,p.set(A,U)}return U},m=new Map((r.names??[]).map(A=>[A.scope,A])),u=A=>l.length?{...A,scope:f(A.scope)}:A,h=A=>`${A.source}\0${A.id}`,y=t.events.map(u).sort(Uo),$=new Map;for(let A of y)$.set(h(A),A);let g=y.filter(A=>A.dur!==void 0&&!A.open),w=g.reduce((A,U)=>Math.max(A,U.dur),0),S=new Map;for(let A of y)A.open&&S.set(h(A),A);let O=new Map,b=new Set,E=A=>{for(let U=qt(A);U>=1;U--){let ne=nn(A,U);if(b.has(ne))break;b.add(ne)}},T=new Map;for(let A of r.sources)for(let U of A.series)T.set(U.name,U.type);let C=r.sources.flatMap(A=>(A.sensitive??[]).map(U=>`${A.name}.${U}`)),M=new Map;for(let A of r.sources)M.set(A.name,{events:A.defaultRetention.events,rollups:{...A.defaultRetention.rollups},setBy:"default"});for(let A of r.retention)M.set(A.source,{events:A.events,rollups:{...A.rollups},setBy:A.setBy});let I=new Map;for(let A of r.sources)for(let U of A.series)I.set(U.name,A.name);function k(A){let U=f(A.scope),ne=`${A.series}\0${U}`,ce=O.get(ne);ce||(ce={series:A.series,scope:U,fine:[],cache:new Map},O.set(ne,ce),E(U));let Ce="value"in A?{t:A.t,min:A.value,max:A.value,sum:A.value,count:1}:{t:A.t,min:A.min,max:A.max,sum:A.sum,count:A.count};Pl(ce.fine,Ce,le=>le.t===Ce.t,(le,Ke)=>le.t-Ke.t),ce.cache.clear()}for(let A of y)E(A.scope);for(let A of t.metrics)k(A);let v=new Map,x=new Set,R=(A,U)=>{x.add(A.source);let ne=v.get(A.scope);ne||v.set(A.scope,ne=new Map);let ce=ne.get(A.source);ce||ne.set(A.source,ce=new Map);let Ce=Math.floor(A.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,A.t),le.last=Math.max(le.last,A.t);else if(A.t===le.first||A.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===A.scope&&ve.source===A.source&&(le.first=Math.min(le.first,ve.t),le.last=Math.max(le.last,ve.t))}}le.severity[A.severity]=(le.severity[A.severity]??0)+U,le.kinds[A.kind]=(le.kinds[A.kind]??0)+U,le.severity[A.severity]===0&&delete le.severity[A.severity],le.kinds[A.kind]===0&&delete le.kinds[A.kind],le.count||ce.delete(Ce)};for(let A of y)R(A,1);let L=(A,U,ne)=>{let ce=`${U}|${ne??""}`,Ce=A.cache.get(ce);return Ce||(Ce=U==="1d"?Kp(L(A,"1h",ne),"1d",ne):Kp(A.fine,U,ne),A.cache.set(ce,Ce)),Ce},D=A=>A===null?-1/0:c-A*Qd,G=A=>D(M.get(A)?.events??null),se=(A,U)=>{let ne=M.get(A);return D(ne?U?ne.rollups[U]:ne.events:null)};function _(A){let U=[];for(let ne of new Set(A)){let ce=M.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 O.values())if(I.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(A){let U=A.where,ne={from:A.from,to:A.to},ce=[];if(!U&&A.q){let Re=o(A.q,c);U=a(Re),ne=ni(Re,A.from,A.to),ce=Re.warnings}let Ce=s(U,C),le=A.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,A.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(A){let U=qt(A.scope),ne=U+A.depth,ce=new Map,Ce=de=>{let Oe=ce.get(de);return Oe===void 0&&!ce.has(de)&&(Oe=rs(de,A.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 b)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<A.depth?{own:!0}:{},children:le(de),count:0},Ke.set(de,Oe)}return Oe};for(let de of b)qt(de)===ne&&rs(de,A.scope)&&ve(de);return ne===0&&ve(""),{at:Ce,add:ve,rows:Ke}}let Q=A=>[...A.values()].sort((U,ne)=>U.scope===ne.scope?0:U.scope<ne.scope?-1:1);function N(A,U){let ne=[];for(let ce=Zs(g,A-w);ce<g.length&&g[ce].t<A;ce++)g[ce].t+g[ce].dur>A&&ne.push(g[ce]);for(let ce of S.values())ce.t<A&&c>A&&ne.push(ce);for(let ce=Zs(y,A);ce<y.length&&y[ce].t<U;ce++)ne.push(y[ce]);return ne}function j(A,U,ne,ce){let Ce=A.series?new Set(A.series):void 0,le=new Map;for(let ve of O.values()){if(Ce&&!Ce.has(ve.series))continue;let de=U(ve.scope);if(de===void 0)continue;let Oe=I.get(ve.series)??"",We=se(Oe,A.bin),Re=A.bin?L(ve,A.bin,A.tz):ve.fine;for(let at=Zs(Re,A.bin?Rn(ne,A.bin,A.tz):ne);at<Re.length&&Re[at].t<ce;at++){let yt=Re[at];if(yt.t<We)continue;let Ye=`${ve.series}\0${de}\0${yt.t}`,dt=le.get(Ye);dt?Gp(dt,yt):le.set(Ye,{series:ve.series,scope:de,t:yt.t,bin:A.bin??"1m",min:yt.min,max:yt.max,sum:yt.sum,count:yt.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 A.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=A=>`${A.t}:${A.id}`,H=(A,U)=>{let ne=U.indexOf(":"),ce=Number(U.slice(0,ne)),Ce=U.slice(ne+1);return A.t>ce||A.t===ce&&A.id>Ce};function ae(A){if(A.bin!=="1h"&&A.bin!=="1d"||(A.where?.all.length??0)||A.q||A.filters?.kind?.length||A.filters?.severity?.length||A.filters?.scope?.length||Yt(A.tz,A.from)%Is||Yt(A.tz,A.to)%Is)return;let U=A.filters?.source?.length?new Set(A.filters.source):void 0,ne=pe=>Math.max(A.from,G(pe)),{at:ce,add:Ce,rows:le}=Z(A),Ke=new Set,ve=new Map,de=0,Oe=(pe,Fe)=>{let Ne=Rn(Fe,A.bin,A.tz),pt=`${pe}\0${Ne}`,P=ve.get(pt);return P||(P={scope:pe,t:Ne,bin:A.bin,count:0,severity:{},kinds:{}},ve.set(pt,P)),P},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(A.to/Is)*Is;for(let[pe,Fe]of v){let Ne=ce(pe);if(Ne!==void 0)for(let[pt,P]of Fe){if(U&&!U.has(pt))continue;let F=Math.ceil(ne(pt)/Is)*Is;for(let[B,oe]of P){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,A.scope)&&(!U||U.has(pe.source))&&pe.t>=G(pe.source)&&ce(pe.scope)!==void 0,yt=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 x){if(U&&!U.has(pe))continue;let Fe=ne(pe),Ne=Math.ceil(Fe/Is)*Is,pt=Ne>=Re?[[Fe,A.to]]:[[Fe,Ne],[Re,A.to]];for(let[P,F]of pt)for(let B=Zs(y,P);B<y.length&&y[B].t<F;B++){let oe=y[B];oe.source===pe&&at(oe)&&yt(oe)}}let Ye=bs[A.bin],dt=[];for(let pe=Zs(g,A.from-w);pe<g.length&&g[pe].t<A.from;pe++){let Fe=g[pe];Fe.t+Fe.dur>A.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 S.values())pe.t<A.from&&c>A.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,A.from);pe<g.length&&g[pe].t<A.to&&dt.length<5e3;pe++)g[pe].dur>=Ye&&at(g[pe])&&dt.push(g[pe]);for(let pe of S.values())pe.t>=A.from&&pe.t<A.to&&dt.length<5e3&&at(pe)&&dt.push(pe);let nt=j(A,ce,A.from,A.to);for(let pe of nt){let Fe=I.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(A){if(!i(A.scope))throw new Error(`not a scope path: ${JSON.stringify(A.scope)}`);let U=ae(A);if(U)return U;let{test:ne,range:ce,warnings:Ce}=K(A),{at:le,add:Ke,rows:ve}=Z(A),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(Uo);let We=j(A,le,ce.from,ce.to);for(let nt of We){let mt=I.get(nt.series);mt&&de.add(mt)}let Re={timeline:1,type:"result",total:Oe.length,...Ce.length?{warnings:Ce}:{}};if(A.bin){let nt=bs[A.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),P=Rn(Ne.t,A.bin,A.tz),F=`${pt}\0${P}`,B=mt.get(F);B||(B={scope:pt,t:P,bin:A.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,A.limit??2e3)),yt=A.cursor?Oe.findIndex(nt=>H(nt,A.cursor)):0,Ye=yt<0?[]:Oe.slice(yt,yt+at),dt=yt>=0&&yt+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=A=>ns.includes(A),Se=0;function Ve(A){let U=h(A),ne=$.get(U);ne&&(qp(y,ne.t,ce=>ce===ne),R(ne,-1),ne.dur!==void 0&&!ne.open&&qp(g,ne.t,ce=>ce===ne),S.delete(U)),$.set(U,A),R(A,1),Pl(y,A,()=>!1,Uo),A.open?S.set(U,A):A.dur!==void 0&&(Pl(g,A,()=>!1,Uo),w=Math.max(w,A.dur)),E(A.scope)}return{async catalog(){return{...r,now:c,retention:_(r.sources.map(A=>A.name))}},query:ue,subscribe(A,U){let ne={q:A,on:U};return J.add(ne),()=>{J.delete(ne)}},...n.stateAt?{stateAt:(A,U)=>n.stateAt(A,U)}:{},append(A,U=[],ne){ne!==void 0&&(c=Math.max(c,ne));let ce=new Set(b),Ce=A.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)k(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=[...b].filter(Ye=>!ce.has(Ye)),at=qt(le.q.scope)+le.q.depth,yt=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,...yt.length?{rows:yt}:{},now:c,resume:String(Se)})}},setRetention(A,U){M.set(A,{events:U.events,rollups:{...U.rollups},setBy:"user"})},get now(){return c},get size(){let A=0;for(let U of O.values())A+=U.fine.length;return{events:y.length,samples:A}}}}var Up="http://www.w3.org/2000/svg",Cn=22,Yo=38,Us=26,em=210,tm=24,ii=6e4,Ln=36e5,ps=864e5,Yp={"15m":15*ii,"1h":Ln,"1d":ps,"1w":7*ps},Hp=t=>ns.indexOf(t),sm={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()}},Al=t=>t<1e3?`${Math.round(t)} ms`:t<ii?`${(t/1e3).toFixed(1)} s`:In(t),nm=(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 Ml(t,e){if(t<=3*Ln)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 Ol(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=(z="system")=>{t.style.colorScheme=z==="system"?"light dark":z,z==="system"?delete t.dataset.theme:t.dataset.theme=z};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,$="",g={from:0,to:0,mode:{kind:"single"},key:""},w,S,O,b,E=!0,T=0,C=0,M=!1,I,k=[],v=[],x=-1,R=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 z of["15m","1h","1d","1w","run"]){let q=X("button",{type:"button",class:"seg","data-v":z,title:z==="run"?"The latest run":`The last ${z}`},z==="run"?"this run":z);q.addEventListener("click",()=>xn(z)),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"}),A=X("select",{class:"input tlx-sev","aria-label":"Severity"},X("option",{value:""},"every severity"),...ns.slice(1).map(z=>X("option",{value:z},`${z} 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,A,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),yt=()=>{let z=(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(z).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=(z,q)=>d?.names?.find(W=>W.scope===z)?.label??q,dt=z=>z.kind==="metric"?Yo:Cn,nt=()=>Ml(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(z){z.scope!==void 0&&(c=z.scope),z.depth!==void 0&&(l=z.depth),p=z.q??"",ue.value=p,f=z.filters??{},A.value=f.severity?.length?f.severity[0]:"",u=z.collapseGaps??e.collapseGaps??!0,V.checked=u,H=!z.quietRows,ae.checked=H,R.clear(),L.clear();let q=z.range;q&&"last"in q?xn(q.last,!1):q&&(h={t0:q.from,t1:q.to}),$t(!!z.live,!1)}let Ne=()=>{let z=pe();if(e.onViewChange?.(z),!!e.urlState)try{history.replaceState(null,"",`#timeline=${encodeURIComponent(JSON.stringify(z))}`)}catch{}},pt=()=>{if(!e.urlState)return;let z=/#timeline=(.+)$/.exec(location.hash);if(z)try{return JSON.parse(decodeURIComponent(z[1]))}catch{return}};function P(z,q,W,ee={}){let me=s(p,mt(),z,q);k=me.warnings;let Le=p?[]:f.source?[...se].filter(([,et])=>f.source.includes(et.source)).map(([et])=>et):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(z=!1){let q=nt(),W=F(),ee=h.t1-h.t0;if(!z&&y&&W===g.key&&h.t0>=g.from&&h.t1<=g.to){re();return}if(C){M=!0;return}C++;let me=h.t0-ee/2,Le=Math.min(h.t1+ee/2,Math.max(h.t1,mt()+ee*.1));try{let et=await e.source.query(P(me,Le,q,q.kind==="single"?{limit:1e4}:{}));q.kind==="single"&&et.next&&(et=await e.source.query(P(me,Le,{kind:"binned",bin:"1m"}))),y=et,$=W,g={from:me,to:Le,mode:q,key:W}}catch(et){Ce.textContent=`The history couldn't be read: ${String(et?.message??et)}`}finally{C--}re(),Ne(),M&&(M=!1,B())}function oe(){let z=at(),q=nt();if(D=[],u&&y){let W=new Map([...se].map(([ee,me])=>[ee,me.type]));D=Ko(Ol(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=>!(R.has(zn(ee))&&(L.get(zn(ee))??1)>=1))}G=mr(h.t0,h.t1,z,D,{cut:tm,weights:L})}let re=()=>{T||(T=requestAnimationFrame(Ae))};function Ae(){T=0,oe();let z=at(),q=yt(),W=g.mode,ee=[],me=Us;for(let Y of q)ee.push(me),me+=dt(Y);let Le=Math.max(me,Us+Cn);de.setAttribute("width",String(z)),de.setAttribute("height",String(Le)),de.setAttribute("viewBox",`0 0 ${z} ${Le}`);let et=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:z,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:z-Me(os),height:Le-Us}));for(let Y of qo(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)}b&&Ee.push(ft("rect",{class:"tlx-brush",x:Me(b.from),y:0,width:Math.max(1,Me(b.to)-Me(b.from)),height:Le}));let ci=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):[],Gl=new Map;q.forEach((Y,he)=>{Y.kind==="row"&&Gl.set(Y.row.scope,he)});let pi=Y=>{let he=qt(c)+l,Ge=qt(Y)>=he?nn(Y,he):Y;return Gl.get(Ge)},wr=Y=>ee[Y]+dt(q[Y])>=et&&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:z,height:dt(Y)}))}),W.kind==="binned"){let Y=new Map;for(let he of y?.bins??[]){let Ge=pi(he.scope);Ge!==void 0&&Y.set(Ge,Math.max(Y.get(Ge)??0,he.count))}for(let he of y?.bins??[]){let Ge=pi(he.scope);if(Ge===void 0||!wr(Ge))continue;let tt=Me(he.t),He=Me(he.t+bs[he.bin]);if(He<0||tt>z)continue;let bt=[...ns].reverse().find(fs=>(he.severity[fs]??0)>0)??"info",Vt=Math.max(2,(Cn-8)*Math.sqrt(he.count)/Math.sqrt(Y.get(Ge)||1));Ee.push(ft("rect",{class:"tlx-countbar",x:tt,y:ee[Ge]+Cn-3-Vt,width:Math.max(1,He-tt-.5),height:Vt,"data-t":he.t},`${Ht(he.t,n)}: ${he.count} event${he.count===1?"":"s"}${bt!=="info"&&bt!=="debug"?`, the worst ${bt}`:""}`)),(bt==="warning"||bt==="error")&&Ee.push(ft("rect",{class:`tlx-heat sev-${bt}`,x:tt,y:ee[Ge]+Cn-(bt==="error"?4:3),width:Math.max(1,He-tt-.5),height:bt==="error"?3:2}))}}for(let Y of ci){let he=pi(Y.scope);if(he===void 0||!wr(he))continue;let Ge=Y.open?os:Y.t+(Y.dur??0),tt=Me(Y.t),He=Me(Ge);if(He<-2||tt>z+2)continue;let bt=`tlx-span sev-${Y.severity}${Y.open?" open":""}${O?.id===Y.id?" selected":""}`,Vt=`${Y.summary} \xB7 ${Ht(Y.t,n)}${Y.open?", still going":`, ${Al(Ge-Y.t)}`}`,fs=ee[he]+5,an=W.kind==="binned"?4:8,ds=tt;for(let vs of G.cuts)vs.weight>=1||vs.x1<=tt||vs.x0>=He||(vs.x0>ds&&Ee.push(ft("rect",{class:bt,x:ds,y:fs,width:Math.max(1,vs.x0-ds),height:an,rx:2,"data-id":Y.id},Vt)),Ee.push(ft("path",{class:`${bt} through`,d:`M${vs.x0} ${fs+an/2} H${vs.x1}`,"data-id":Y.id},`${Vt} (lasted through the break)`)),ds=vs.x1);He>ds&&Ee.push(ft("rect",{class:bt,x:Math.max(-2,ds),y:fs,width:Math.max(2,Math.min(z+2,He)-Math.max(-2,ds)),height:an,rx:2,"data-id":Y.id},Vt))}let Zl=new Map;for(let Y of $f){let he=pi(Y.scope);if(he===void 0||!wr(he))continue;let Ge=Me(Y.t);if(Ge<-6||Ge>z+6||Ge-(Zl.get(he)??-1/0)<3)continue;Zl.set(he,Ge);let tt=ee[he]+Cn/2+2,He=4,bt=sm[Y.severity],Vt=bt==="diamond"?`M${Ge} ${tt-He-1} l${He+1} ${He+1} l${-He-1} ${He+1} l${-He-1} ${-He-1} z`:bt==="triangle"?`M${Ge} ${tt-He-1} l${He+1} ${2*He+1} h${-2*He-2} z`:bt==="square"?`M${Ge-He+.5} ${tt-He+.5} h${2*He-1} v${2*He-1} h${-2*He+1} z`:"",fs=`${Ht(Y.t,n)} \xB7 ${Y.summary}`,an=`tlx-mark sev-${Y.severity}${O?.id===Y.id?" selected":""}${x>=0&&v[x]?.id===Y.id?" hit":""}`;Ee.push(Vt?ft("path",{class:an,d:Vt,"data-id":Y.id},fs):ft("circle",{class:an,cx:Ge,cy:tt,r:bt==="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 tt=[...Ge].sort((ot,Kt)=>ot[0]-Kt[0]);if(!tt.length)return;let He=W.kind==="binned"?bs[W.bin]:ii,bt=ot=>Y.type==="gauge"?ot.sum/Math.max(1,ot.count):ot.sum,Vt=Math.max(1e-9,...tt.map(([,ot])=>Y.type==="gauge"?ot.max:bt(ot))),fs=ee[he]+Yo-4,an=Yo-10,ds=ot=>fs-ot/Vt*an;if(Y.type==="gauge"){let ot=tt.map(([Kt,_t])=>`${Me(Kt)},${ds(_t.max)}`).join(" ")+" "+[...tt].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:tt.map(([Kt,_t])=>`${Me(Kt+He/2)},${ds(bt(_t))}`).join(" ")}))}else{let ot="",Kt=-1/0;for(let[_t,Pf]of tt){let Af=Me(_t),Ul=Me(_t+He),Yl=ds(bt(Pf));ot+=_t>Kt?`M${Af} ${fs} V${Yl} H${Ul}`:` V${Yl} H${Ul}`,Kt=_t+He;let Hl=tt.find(([Mf])=>Mf>_t);(!Hl||Hl[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 ${nm(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 bt=`M${He} 0`;for(let Vt=0;Vt<Le;Vt+=8)bt+=` L${He+(Vt/8%2?-3:3)} ${Vt+8}`;return bt},Ge=ft("g",{class:"tlx-cut",tabindex:0,role:"button","data-from":Y.from,"data-to":Y.to,"aria-label":`A break of ${In(Y.to-Y.from)} with nothing shown, from ${Ht(Y.from,n)} to ${Ht(Y.to,n)}: press to open it`},`${In(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 tt=ft("text",{class:"tlx-cut-label",x:(Y.x0+Y.x1)/2,y:15,"text-anchor":"middle"});tt.textContent=In(Y.to-Y.from),Ge.append(tt),Ee.push(Ge)}if(w!==void 0){let Y=Me(w);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(w,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:${Yo}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:${Cn}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(tt=>he[tt])??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 tt=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");tt.addEventListener("click",()=>it(he.scope)),Ge.append(tt)}return Ge})),Ke.style.width=`${em}px`,ye()}function ye(){K.replaceChildren(...fr(c).flatMap((ee,me,Le)=>{let et=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 et.addEventListener("click",()=>{ee.scope!==c&&(c=ee.scope,l=1,B(!0))}),me?[X("span",{class:"tlx-sep","aria-hidden":"true"},"/"),et]:[et]})),Q.setAttribute("aria-pressed",String(m)),Q.classList.toggle("on",m),N.hidden=!m||E;let z=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 ${z.kind==="single"?"single events":`bins of ${z.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=!k.length,ce.textContent=k.join(" \xB7 "),J.textContent=p?v.length?`${x+1>0?`${x+1} of `:""}${v.length}${v.length>=2e3?"+":""} hit${v.length===1?"":"s"}`:`${q?`${q} hit${q===1?"":"s"}`:"no hits"}`:"";for(let ee of Z.querySelectorAll(".seg"))ee.classList.remove("on");le.textContent=w===void 0?"":S?(()=>{let ee=e.stamp?.(S)??{};return`Canvas: the state recorded at ${Ht(Date.parse(ee.at??"")||w,n)}${ee.tag?` (${ee.tag})`:""}`})():"No state recorded here",le.classList.toggle("none",w!==void 0&&!S)}function rt(){Ve.replaceChildren();for(let z of d?.sources??[]){let q=!f.source?.length||f.source.includes(z.name),W=X("button",{type:"button",class:`tlx-chip${q?" on":""}${z.status==="not-yet"?" notyet":""}`,"aria-pressed":String(q&&z.status!=="not-yet"),disabled:z.status==="not-yet",title:z.status==="not-yet"?`${z.title}: not kept yet`:`${z.title}${Te(z)}`},z.name);z.status!=="not-yet"&&W.addEventListener("click",()=>we(z.name)),Ve.append(W)}}let Te=z=>{let q=d?.retention.find(W=>W.source===z.name);return q?` (kept ${q.events===null?"until deleted":`${q.events} days`})`:""};function we(z){let q=(d?.sources??[]).filter(ee=>ee.status==="kept").map(ee=>ee.name),W=f.source?.length?[...f.source]:[...q];W=W.includes(z)?W.filter(ee=>ee!==z):[...W,z],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(),x=-1,B(!0),De()},250)}),ue.addEventListener("keydown",z=>{z.key==="Enter"&&(z.preventDefault(),clearTimeout(Ie),p=ue.value.trim(),B(!0).then(()=>De()).then(()=>ut(z.shiftKey?-1:1)))});async function De(){if(!p){v=[],x=-1,ye();return}let z=h.t1-h.t0;v=(await e.source.query(P(h.t0-z*4,Math.max(h.t1+z*4,mt()),{kind:"single"},{limit:2e3}))).events??[],x=Math.min(x,v.length-1),ye()}function ut(z){if(!v.length)return;let q=(h.t0+h.t1)/2;x<0?x=z>0?Math.max(0,v.findIndex(me=>me.t>=q)):Math.max(0,v.length-1-[...v].reverse().findIndex(me=>me.t<=q)):x=(x+z+v.length)%v.length;let W=v[x],ee=Math.min(h.t1-h.t0,2*Ln);h={t0:W.t-ee/2,t1:W.t+ee/2},E=!1,gt(W),B()}te.addEventListener("click",()=>ut(-1)),Se.addEventListener("click",()=>ut(1)),A.addEventListener("change",()=>{let z=A.value;f={...f,...z?{severity:ns.filter(q=>Hp(q)>=Hp(z))}:{}},z||delete f.severity,B(!0),De()});async function xn(z,q=!0){let W=mt();if(z==="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??Ln)*.02,t1:(me.open?W:me.t+(me.dur??Ln))+(me.dur??Ln)*.04}:{t0:W-ps,t1:W+ps*.02}}else h={t0:W-Yp[z],t1:W+Yp[z]*.02};E=!0,R.clear(),L.clear(),q&&B()}function $t(z,q=!0){if(m=z,I?.(),I=void 0,z&&e.source.subscribe){let W=0,ee=0;I=e.source.subscribe(P(mt()-Ln,mt()+365*ps,{kind:"single"}),me=>{if(d&&(d.now=Math.max(d.now,me.now)),E){let et=h.t1-h.t0;h={t0:me.now-et*.98,t1:me.now+et*.02}}let Le=Date.now();Le-W>500?(W=Le,B(!0)):ee||(ee=setTimeout(()=>{ee=0,W=Date.now(),B(!0)},500))}),E=!0}q&&(ye(),Ne())}Q.addEventListener("click",()=>$t(!m)),N.addEventListener("click",()=>{E=!0;let z=h.t1-h.t0,q=mt();h={t0:q-z*.98,t1:q+z*.02},B()}),j.addEventListener("click",()=>{lt()}),V.addEventListener("change",()=>{u=V.checked,R.clear(),L.clear(),re(),Ne()}),ae.addEventListener("change",()=>{H=ae.checked,re(),Ne()});function it(z){let q=y?.rows.find(W=>W.scope===z);c=z,l=q&&q.children===0?0:1,b=void 0,We.hidden=!0,B(!0)}async function lt(){let z=mt(),W=((await e.source.query({timeline:1,type:"query",scope:c,depth:0,from:z-400*ps,to:z+1,bin:"1d",tz:n}).catch(()=>{}))?.bins??[]).map(me=>me.t),ee=W.length?Math.min(...W):z-7*ps;h={t0:ee,t1:z+(z-ee)*.02},E=!0,B()}let ks=0;async function jt(z){if(w=z,re(),z===void 0){S=void 0;return}let q=++ks,W=e.source.stateAt?await e.source.stateAt(c,z).catch(()=>{}):void 0;q===ks&&(S=W,e.onPlayhead?.(z,W),ye())}async function It(z,q){b={from:Math.min(z,q),to:Math.max(z,q)},re();let W=await e.source.query(P(b.from,b.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?Al(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",()=>gt(Ee)),Me.addEventListener("keydown",Ot=>{Ot.key==="Enter"&>(Ee)}),Me}),et=X("button",{type:"button",class:"btn sm quiet","aria-label":"Close the table"},"Close");et.addEventListener("click",()=>{b=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(b.from,n)} \u2013 ${Ht(b.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"),et),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(!b)return[];let z=[],q;do{let W=await e.source.query(P(b.from,b.to,{kind:"single"},{limit:1e4,...q?{cursor:q}:{}}));z.push(...W.events??[]),q=W.next}while(q&&z.length<2e5);return z}async function Bt(z){let q=await Lt(),W=z==="json"?Go(q,_):Zo(q,_),ee=`timeline-${new Date(b.from).toISOString().slice(0,16).replace(/:/g,"")}.${z}`,me=z==="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 gt(z){if(O=z,re(),!z){Re.hidden=!0;return}let q=d?.sources.find(Me=>Me.name===z.source),W=new Set(q?.sensitive??[]),ee=o(p),me=Me=>{let Ot=[],Gt=0;for(let[os,ci]of ri(ee,Me))Ot.push(Me.slice(Gt,os),X("mark",null,Me.slice(os,ci))),Gt=ci;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},et=Object.entries(z.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",()=>gt(void 0));let Ee=fr(z.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,z.kind),zs),X("p",{class:`tlx-sev sev-${z.severity}`},`${z.severity} \xB7 ${q?.title??z.source}`),X("p",{class:"tlx-sum"},...me(z.summary)),X("p",null,Ht(z.t,n),z.dur!==void 0?` \xB7 ${Al(z.dur)}${z.open?" so far":""}`:z.open?" \xB7 still going":""),X("p",{class:"tlx-crumbs small"},...Ee),...et.length?[X("table",{class:"tlx-attrs"},X("tbody",null,...et))]:[],X("div",{class:"tlx-links"},...(e.actions?.(z)??[]).map(([Me,Ot])=>Le(Me,Ot)))),Re.hidden=!1}function jn(z,q){let W=zn({from:z,to:q});if(!D.find(et=>et.from===z&&et.to===q))return;if(R.add(W),!i){L.set(W,1),re();return}let me=performance.now(),Le=et=>{let zs=Math.min(1,(et-me)/260);L.set(W,1-(1-zs)**3),Ae(),zs<1&&requestAnimationFrame(Le)};requestAnimationFrame(Le)}let Dt,kn=z=>z.clientX-de.getBoundingClientRect().left;de.addEventListener("pointerdown",z=>{let q=kn(z),W=z.clientY-de.getBoundingClientRect().top,ee=z.target.closest?.(".tlx-cut");if(ee){z.preventDefault(),jn(Number(ee.getAttribute("data-from")),Number(ee.getAttribute("data-to")));return}de.setPointerCapture(z.pointerId),Dt={kind:W<Us||z.shiftKey?"brush":z.target.classList.contains("tlx-handle")?"scrub":"pan",x0:q,t0:G.t(q),v0:h,moved:!1},z.preventDefault(),ve.focus({preventScroll:!0})}),de.addEventListener("pointermove",z=>{if(!Dt)return;let q=kn(z);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},E=!1,B()}else Dt.kind==="scrub"?jt(G.t(q)):(b={from:Math.min(Dt.t0,G.t(q)),to:Math.max(Dt.t0,G.t(q))},re())}),de.addEventListener("pointerup",z=>{let q=Dt;if(Dt=void 0,!q)return;let W=kn(z);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=z.target.closest?.("[data-id]")?.getAttribute("data-id"),me=ee?[...y?.events??[],...y?.spans??[]].find(Le=>Le.id===ee):void 0;me?(gt(me),jt(me.t)):jt(G.t(W))}}),de.addEventListener("keydown",z=>{let q=z.target.closest?.(".tlx-cut");q&&(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),jn(Number(q.getAttribute("data-from")),Number(q.getAttribute("data-to"))))}),de.addEventListener("wheel",z=>{z.preventDefault();let q=kn(z);if(z.shiftKey||Math.abs(z.deltaX)>Math.abs(z.deltaY)){let W=(z.shiftKey?z.deltaY:z.deltaX)*G.msPerPx;h={t0:h.t0+W,t1:h.t1+W},E=!1}else Bn(G.t(q),Math.exp(z.deltaY*.0015),q/at());B()},{passive:!1});function Bn(z,q,W=.5){let ee=Math.min(400*ps,Math.max(1e4,(h.t1-h.t0)*q));h={t0:z-W*ee,t1:z+(1-W)*ee},R.clear(),L.clear(),q<1&&(E=m&&h.t1>=mt())}ve.addEventListener("keydown",z=>{let q=h.t1-h.t0;if(z.key==="ArrowLeft"||z.key==="ArrowRight"){let W=q*.15*(z.key==="ArrowLeft"?-1:1);h={t0:h.t0+W,t1:h.t1+W},E=!1}else if(z.key==="+"||z.key==="=")Bn((h.t0+h.t1)/2,.6);else if(z.key==="-"||z.key==="_")Bn((h.t0+h.t1)/2,1/.6);else if(z.key==="n"||z.key==="N"){ut(z.shiftKey?-1:1),z.preventDefault();return}else if(z.key==="Escape")gt(void 0),b=void 0,We.hidden=!0;else return;z.preventDefault(),B()}),t.addEventListener("keydown",z=>{z.key==="/"&&document.activeElement!==ue&&!z.target.closest("input, select, textarea")&&(z.preventDefault(),ue.focus())}),Oe.addEventListener("scroll",()=>re(),{passive:!0}),ne.addEventListener("click",async()=>{let z=`${fr(c).slice(-1)[0].label}${p?`: ${p}`:""}`.slice(0,80);await e.saveView?.({...pe(),name:z}),await Ss()});let je=[];async function Ss(){e.views&&(je=await e.views(),U.replaceChildren(X("option",{value:""},"Saved views\u2026"),...je.map((z,q)=>X("option",{value:String(q)},z.name))))}U.addEventListener("change",()=>{let z=je[Number(U.value)];z&&(Fe(z),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(z){return Fe(z),rt(),B(!0)},setRange(z,q){return h={t0:z,t1:q},E=!1,B()},setPlayhead:jt,setLive:$t,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 S},get hits(){return v},get selected(){return O},get follow(){return E},openCut:jn,showTable:It,rangeEvents:Lt,exportRange:Bt,select:gt,stepHit:ut,drill:it,findHits:De,paint:Ae,lines:yt},dispose(){I?.(),ct?.disconnect(),T&&cancelAnimationFrame(T),t.replaceChildren()}}}var rm={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 Ho(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]},wt(m.label)+(m.sub?fe("tspan",{class:"pls",dx:10},wt(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},wt(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)},wt(m.label))+(m.sub?fe("text",{class:"st",x:Wt(u.l+14),y:Wt(u.t+42)},wt(m.sub)):""))}let f="";for(let[m,u]of s)for(let h of u){let y=rm[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=`
|
|
360
|
+
.flat{font-family:inherit}
|
|
361
|
+
.flat .card{cursor:pointer;outline:none}
|
|
362
|
+
.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}
|
|
363
|
+
.flat .card:hover .face,.flat .card:focus-visible .face{fill:hsl(var(--h) var(--s) calc(var(--l-top) + 6%))}
|
|
364
|
+
.flat .card.ghost{opacity:.4}
|
|
365
|
+
.flat .card .lt{font-size:13px;font-weight:600;fill:var(--ink)}
|
|
366
|
+
.flat .card .st{font-size:10px;fill:var(--ink);opacity:.8}
|
|
367
|
+
.flat .panel .face{fill:color-mix(in srgb,hsl(var(--h) var(--s) var(--l-top)) 22%,var(--surface));stroke:color-mix(in srgb,hsl(var(--h) var(--s) var(--l-top)) 40%,var(--line));stroke-width:1}
|
|
368
|
+
.flat .pl{font-size:12px;font-weight:700;letter-spacing:.02em;fill:var(--ink)}
|
|
369
|
+
.flat .pls{font-size:10.5px;font-weight:400;letter-spacing:0;fill:var(--muted)}
|
|
370
|
+
.flat .conn{fill:none;stroke:var(--ink);stroke-width:1.5}
|
|
371
|
+
.flat .mk{fill:var(--ink)}
|
|
372
|
+
.flat .cl{font-size:10.5px;font-weight:600;fill:var(--ink);paint-order:stroke;stroke:var(--surface);stroke-width:4px;stroke-linejoin:round}
|
|
373
|
+
.flat .card.sel .face{stroke:var(--accent,#2f6fd6);stroke-width:2.4}
|
|
374
|
+
.flat .panel.sel .face{stroke:var(--accent,#2f6fd6);stroke-width:2}
|
|
375
|
+
.flat .conn.hot{stroke-width:3}
|
|
376
|
+
.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 im={name:["card","lt"],sub:["card","st"],title:["panel","pl"],titleSub:["panel","pls"],label:["","cl"]};function Wo(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(im)){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 wn="http://www.w3.org/2000/svg";function Xo(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 om=(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||!om(i.motion))return;let s=Nl(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 _n=t=>Math.max(0,Math.min(1,t)),Tl=t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2;function Jo(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 El=(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}},am=(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 lm(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 Nl(t,e,n,r){let i=t.getBoundingClientRect(),o=document.createElementNS(wn,"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=O=>{let b=document.createElementNS(wn,"g");return b.setAttribute("transform",am(O,i)),b},a=O=>O.hasAttribute("data-a")||O.hasAttribute("data-for"),d=O=>{let b=new Map;for(let E of O.querySelectorAll("[data-id]")){if(a(E)||E.parentElement?.closest("[data-id]")||E.closest(".overlay"))continue;let T=E.getAttribute("data-id");(b.get(T)??b.set(T,[]).get(T)).push(E)}return b},c=d(e),l=d(n),p=document.createElementNS(wn,"g"),f=document.createElementNS(wn,"g"),m=s(e),u=s(n);for(let O of e.querySelectorAll("[data-a],[data-for]"))O.closest(".overlay")||m.appendChild(Jo(O));for(let O of n.querySelectorAll("[data-a],[data-for]"))O.closest(".overlay")||u.appendChild(Jo(O));p.appendChild(m),f.appendChild(u);let h=[...u.querySelectorAll("path")].map(O=>{let b=O.getTotalLength?.()??0;return{p:O,len:b}}),y=[...u.children].filter(O=>O.tagName.toLowerCase()==="text"),$=[...(r==="2d"?c:l).keys()],g=[],w=document.createElementNS(wn,"g");for(let O of new Set([...$,...c.keys(),...l.keys()])){let b=c.get(O),E=l.get(O),T={};if(b){T.a=ef(b.map(R=>El(R,i)));let v=document.createElementNS(wn,"g"),x=s(e);for(let R of b)x.appendChild(Jo(R));v.appendChild(x),T.src=v}if(E){T.b=ef(E.map(R=>El(R,i)));let v=document.createElementNS(wn,"g"),x=s(n);for(let R of E)x.appendChild(Jo(R));v.appendChild(x),T.dst=v}let C=r==="3d"?b?.[0]:E?.[0],M=r==="3d"?E?.[0]:b?.[0],I=C?lm(C,i):void 0,k=M?.querySelector("rect.face");if(I&&k){let v=El(k,i),x=[[v.x,v.y],[v.x+v.w,v.y],[v.x+v.w,v.y+v.h],[v.x,v.y+v.h]],R=I.pts.reduce((_,K,Z)=>K[0]<I.pts[_][0]?Z:_,0),L=[...I.pts.slice(R),...I.pts.slice(0,R)],D=[L[0],L[1],L[2],L[3]],G=getComputedStyle(k).fill,se=document.createElementNS(wn,"polygon");T.face=se,T.faceFrom=r==="3d"?D:x,T.faceTo=r==="3d"?x:D,T.faceFill=r==="3d"?[I.fill,G]:[G,I.fill]}T.src&&w.appendChild(T.src),T.face&&w.appendChild(T.face),T.dst&&w.appendChild(T.dst),g.push(T)}o.append(p,w,f);let S=(O,b,E)=>`color-mix(in srgb, ${O} ${Math.round((1-E)*100)}%, ${b})`;return{svg:o,at(O){let b=_n(O/.2),E=Tl(_n((O-.2)/.6)),T=_n((O-.8)/.2);p.setAttribute("opacity",String(1-b));for(let{p:C,len:M}of h)C.style.strokeDasharray=`${M} ${M}`,C.style.strokeDashoffset=String(M*(1-T));f.setAttribute("opacity",String(T>0?1:0));for(let C of y)C.style.opacity=String(T);for(let C of g)if(C.src&&(C.src.setAttribute("transform",C.a&&C.b?tf(C.a,C.b,E):""),C.src.setAttribute("opacity",String(C.b?1-_n(E/(C.face?.35:.6)):1-E))),C.dst&&(C.dst.setAttribute("transform",C.a&&C.b?tf(C.b,C.a,1-E):""),C.dst.setAttribute("opacity",String(C.a?_n((E-(C.face?.65:.4))/(C.face?.35:.6)):E))),C.face){let M=C.faceFrom.map((I,k)=>[I[0]+(C.faceTo[k][0]-I[0])*E,I[1]+(C.faceTo[k][1]-I[1])*E]);C.face.setAttribute("points",M.map(I=>I.join(",")).join(" ")),C.face.style.fill=S(C.faceFill[0],C.faceFill[1],E),C.face.setAttribute("opacity",String(E<.08?E/.08:E>.92?(1-E)/.08:1))}}}}var cm=0;function nf(t,e,n={}){let r=`dv${++cm}`,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??Io(e);Xo(a,e,d);let c=new Set(e.routes.map(M=>M.id));for(let M of a.querySelectorAll("g[data-id]")){let I=M.getAttribute("data-id");c.has(I)||M.hasAttribute("tabindex")||!M.querySelector("polygon")||(M.setAttribute("tabindex","0"),M.setAttribute("role","button"),M.setAttribute("aria-label",I))}let l=Wo(s),p=lr(d,l,n.flat);l.dispose(),s.innerHTML=Ho(p,{id:r,title:n.title,styles:n.styles});let f=s.querySelector("svg");for(let M of[a,f])M.style.display="block",M.style.width="100%",M.style.height="auto";n.title&&a.setAttribute("aria-label",n.title);let m=n.mode??"3d",u,h=M=>M==="3d"?o:s,y=M=>M==="3d"?a:f,$=M=>{o.hidden=M!=="3d",s.hidden=M!=="2d";for(let I of[o,s])I.style.cssText="";i.style.height="",i.dataset.mode=M};$(m);let g=()=>{for(let M of[a,f]){for(let I of M.querySelectorAll("[data-id]"))I.classList.toggle("sel",!!u&&I.getAttribute("data-id")===u);for(let I of M.querySelectorAll("[data-a]")){let k=!!u&&(I.getAttribute("data-a")===u||I.getAttribute("data-b")===u);I.classList.toggle("hot",k),I.classList.toggle("dim",!!u&&!k),M.querySelector(`[data-for="${CSS.escape(I.getAttribute("data-id")??"")}"]`)?.classList.toggle("dim",!!u&&!k)}}},w=M=>{u=M,g()},S=M=>{let I=M.target.closest?.("[data-id]");if(!I||!i.contains(I)||I.hasAttribute("data-a"))return;let k=I.getAttribute("data-id");w(k),n.onSelect?.(k)},O=M=>{(M.key==="Enter"||M.key===" ")&&M.target.matches?.("[data-id][tabindex]")&&(M.preventDefault(),S(M))};i.addEventListener("click",S),i.addEventListener("keydown",O);let b,E=()=>{if(!b)return;cancelAnimationFrame(b.frame),b.layer.remove();let M=b;b=void 0,m=M.to,$(m),g(),M.done()},T=M=>{!M||!u||y(m).querySelector(`[data-id="${CSS.escape(u)}"][tabindex]`)?.focus({preventScroll:!0})};return{get mode(){return b?b.to:m},layout:p,root:i,morph:M=>{let I=i.contains(document.activeElement);if(b&&E(),M===m)return T(I),Promise.resolve();let k=n.motion??"auto";return k==="never"||k==="auto"&&typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches||!(n.duration??600)?(m=M,$(m),g(),T(I),Promise.resolve()):new Promise(x=>{let R=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(M).getBoundingClientRect().height;i.style.height=`${L}px`;let G=Nl(i,y(R),y(M),R);i.appendChild(G.svg);let se=n.duration??600,_=performance.now(),K={frame:0,layer:G.svg,to:M,done:()=>{T(I),x()}},Z=Q=>{if(b!==K)return;let N=Math.min(1,(Q-_)/se);G.at(N),i.style.height=`${L+(D-L)*Tl(_n((N-.2)/.6))}px`,N<1?K.frame=requestAnimationFrame(Z):E()};b=K,K.frame=requestAnimationFrame(Z)})},select:w,get selected(){return u},svgOf:y,destroy(){b&&E(),i.removeEventListener("click",S),i.removeEventListener("keydown",O),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=`
|
|
379
|
+
.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
|
+
.view-switch button{font:inherit;border:0;background:none;color:var(--ink);padding:6px 10px;cursor:pointer}
|
|
381
|
+
.view-switch button+button{border-left:1px solid var(--line)}
|
|
382
|
+
.view-switch button[aria-pressed=true]{background:var(--accent,#2f6fd6);color:#fff}
|
|
383
|
+
.view-switch button:focus-visible{outline:2px solid var(--accent,#2f6fd6);outline-offset:-2px}
|
|
384
|
+
.dual-view [data-id][tabindex]:focus-visible{outline:none}
|
|
385
|
+
.dual-view .blk.sel polygon{stroke:var(--accent,#2f6fd6);stroke-width:2.4}
|
|
386
|
+
.dual-view [data-a].dim{opacity:.3}
|
|
387
|
+
.dual-view [data-a].hot path{stroke-width:3.4}
|
|
388
|
+
`;var vf={};fi(vf,{BASE_CSS:()=>ff,DRAWING_CSS:()=>pf,NODE_ASSETS:()=>oi,REGION_KINDS:()=>Rl,compile:()=>Sf,getAsset:()=>cf,systems:()=>Ys});var pm={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]=vn(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")}},fm={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]},dm={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]},mm={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]=vn(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,$=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),w=ke(u[0],u[1],y),S=2*o*st,O=s*st,b=[(w[0]-g[0])/S,(w[1]-g[1])/S,0,1,g[0],g[1]],E=Tn(n.face??"terminal")??$r;return $+=t.onMatrix(b,S,O,(T,C)=>Pr(T,C)+E(T,C),"scr"),$}},um={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=Tn(n.face??"terminal")??$r;return t.blockFaces(e)+t.onFace(e,"left",(i,o)=>Pr(i,o)+r(i,o),"scr")}},hm={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)},oi={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)=>hi(t,e)),socket:Xt("socket","A socket: a small box with a round opening on top.",[1.2,1.2,.5],"socket",[],(t,e)=>yi(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:fm,person:dm,screen:mm,monitor:um,cloud:hm,volume:pm};function cf(t){return oi[t??"block"]}var ym="border-color:hsl(38 80% 45%);background:hsl(38 80% 55% / .2)",Rl={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:ym,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:Rl,nodes:oi,defaultNode:"block"};var pf=ei(Ys),ff=ar(Ys);var mf=ea,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"}}},ai=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},Il={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"}}},kt={type:"array",items:{type:"number"},minItems:2,maxItems:2},zl={enum:["start","center","end"]},_e={anyOf:[{type:"string"},{type:"integer",minimum:1}]};function on(t,{instancePath:e="",parentData:n,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=on.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:kt,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:kt,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:kt.items.type,parentSchema:kt.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:kt.type,parentSchema:kt,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:zl.enum},message:"must be equal to one of the allowed values",schema:zl.enum,parentSchema:zl,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:kt,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:kt,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:kt.items.type,parentSchema:kt.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:kt.type,parentSchema:kt,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 on.errors=s,a===0}on.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"}}}]},Cl=new RegExp("^[a-z][a-z0-9-]*$","u"),Ll={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),on(t,{instancePath:e,parentData:n,parentDataProperty:r,rootData:i,dynamicAnchors:o})||(s=s===null?on.errors:s.concat(on.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 $=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 w={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=[w]:s.push(w),a++}if(m.terminal!==void 0){let g=m.terminal;if(!(typeof g=="number"&&!(g%1)&&!isNaN(g))){let w={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=[w]:s.push(w),a++}if(typeof g=="number"){if(g>8||isNaN(g)){let w={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=[w]:s.push(w),a++}if(g<1||isNaN(g)){let w={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=[w]:s.push(w),a++}}}if(m.icon!==void 0){let g=m.icon;if(typeof g=="string"){if(!Cl.test(g)){let w={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=[w]:s.push(w),a++}}else{let w={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=[w]:s.push(w),a++}}if(m.screen!==void 0){let g=m.screen;if(typeof g=="string"){if(!Cl.test(g)){let w={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=[w]:s.push(w),a++}}else{let w={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=[w]:s.push(w),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=$===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(!Cl.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++)Ll.validate(l[f],{instancePath:e+"/nodes/"+f,parentData:l,parentDataProperty:f,rootData:i,dynamicAnchors:o})||(s=s===null?Ll.validate.errors:s.concat(Ll.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 _l={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),on(t,{instancePath:e,parentData:n,parentDataProperty:r,rootData:i,dynamicAnchors:o})||(s=s===null?on.errors:s.concat(on.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:Il.enum},message:"must be equal to one of the allowed values",schema:Il.enum,parentSchema:Il,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++)_l.validate(c[p],{instancePath:e+"/regions/"+p,parentData:c,parentDataProperty:p,rootData:i,dynamicAnchors:o})||(s=s===null?_l.validate.errors:s.concat(_l.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"}}},rn={type:"string",pattern:"^[A-Za-z][A-Za-z0-9_-]*(\\.(n|e|s|w|top))?$"},Fl=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(!ai.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(!Fl.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:rn,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:rn.type,parentSchema:rn,data:m};s===null?s=[u]:s.push(u),a++}}if(t.to!==void 0){let m=t.to;if(typeof m=="string"){if(!Fl.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:rn,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:rn.type,parentSchema:rn,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],$=a,g=!1,w=a;if(Array.isArray(y)){if(y.length>2){let b={instancePath:e+"/via/"+h,schemaPath:"#/$defs/point2/maxItems",keyword:"maxItems",params:{limit:2},message:"must NOT have more than 2 items",schema:2,parentSchema:kt,data:y};s===null?s=[b]:s.push(b),a++}if(y.length<2){let b={instancePath:e+"/via/"+h,schemaPath:"#/$defs/point2/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:kt,data:y};s===null?s=[b]:s.push(b),a++}let O=y.length;for(let b=0;b<O;b++){let E=y[b];if(typeof E!="number"){let T={instancePath:e+"/via/"+h+"/"+b,schemaPath:"#/$defs/point2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:kt.items.type,parentSchema:kt.items,data:E};s===null?s=[T]:s.push(T),a++}}}else{let O={instancePath:e+"/via/"+h,schemaPath:"#/$defs/point2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:kt.type,parentSchema:kt,data:y};s===null?s=[O]:s.push(O),a++}var c=w===a;g=g||c;let S=a;if(typeof y=="string"){if(!Fl.test(y)){let O={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:rn,data:y};s===null?s=[O]:s.push(O),a++}}else{let O={instancePath:e+"/via/"+h,schemaPath:"#/$defs/endpoint/type",keyword:"type",params:{type:"string"},message:"must be string",schema:rn.type,parentSchema:rn,data:y};s===null?s=[O]:s.push(O),a++}var c=S===a;if(g=g||c,g)a=$,s!==null&&($?s.length=$:s=null);else{let O={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=[O]:s.push(O),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 $=y.length;for(let g=0;g<$;g++){let w=y[g];if(typeof w!="number"){let S={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:w};s===null?s=[S]:s.push(S),a++}}}else{let $={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=[$]:s.push($),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 $=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 w={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=[w]:s.push(w),a++}if(m.text!==void 0){let g=m.text;if(typeof g!="string"){let w={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=[w]:s.push(w),a++}}if(m.along!==void 0){let g=m.along;if(!(typeof g=="number"&&!(g%1)&&!isNaN(g))){let w={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=[w]:s.push(w),a++}if(typeof g=="number"&&(g<1||isNaN(g))){let w={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=[w]:s.push(w),a++}}if(m.side!==void 0){let g=m.side;if(!(g==="left"||g==="right")){let w={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=[w]:s.push(w),a++}}if(m.at!==void 0){let g=m.at;if(Array.isArray(g)){if(g.length>3){let S={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]:s.push(S),a++}if(g.length<2){let S={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]:s.push(S),a++}let w=g.length;for(let S=0;S<w;S++){let O=g[S];if(typeof O!="number"){let b={instancePath:e+"/label/at/"+S,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:O};s===null?s=[b]:s.push(b),a++}}}else{let w={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=[w]:s.push(w),a++}}if(m.dir!==void 0){let g=m.dir;if(!(g==="x"||g==="y")){let w={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=[w]:s.push(w),a++}}if(m.anchor!==void 0){let g=m.anchor;if(!(g==="start"||g==="middle"||g==="end")){let w={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=[w]:s.push(w),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=$===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 $=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=$===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 $=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=$===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(!ai.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 w={instancePath:e+"/at",schemaPath:"#/$defs/point2/maxItems",keyword:"maxItems",params:{limit:2},message:"must NOT have more than 2 items",schema:2,parentSchema:kt,data:m};s===null?s=[w]:s.push(w),a++}if(m.length<2){let w={instancePath:e+"/at",schemaPath:"#/$defs/point2/minItems",keyword:"minItems",params:{limit:2},message:"must NOT have fewer than 2 items",schema:2,parentSchema:kt,data:m};s===null?s=[w]:s.push(w),a++}let g=m.length;for(let w=0;w<g;w++){let S=m[w];if(typeof S!="number"){let O={instancePath:e+"/at/"+w,schemaPath:"#/$defs/point2/items/type",keyword:"type",params:{type:"number"},message:"must be number",schema:kt.items.type,parentSchema:kt.items,data:S};s===null?s=[O]:s.push(O),a++}}}else{let g={instancePath:e+"/at",schemaPath:"#/$defs/point2/type",keyword:"type",params:{type:"array"},message:"must be array",schema:kt.type,parentSchema:kt,data:m};s===null?s=[g]:s.push(g),a++}var l=y===a;if(h=h||l,l)var c=!0;let $=a;if(Array.isArray(m)){if(m.length>3){let w={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=[w]:s.push(w),a++}if(m.length<3){let w={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=[w]:s.push(w),a++}let g=m.length;for(let w=0;w<g;w++){let S=m[w];if(typeof S!="number"){let O={instancePath:e+"/at/"+w,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};s===null?s=[O]:s.push(O),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=$===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 $=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=$===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 $=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=$===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}]}}},Qo={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 b={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=[b]:s.push(b),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 b={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=[b]:s.push(b),a++}if(Object.keys(t).length<1){let b={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=[b]:s.push(b),a++}for(let b in t){let E=t[b];if(typeof E!="string"){let T={instancePath:e+"/"+b.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:E};s===null?s=[T]:s.push(T),a++}}}else{let b={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=[b]:s.push(b),a++}var y=h===a;if(m=m||y,y)var $=!0;if(m)a=f,s!==null&&(f?s.length=f:s=null);else{let b={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=[b]:s.push(b),a++}var S=p===a;l=l||S;let g=a;if(Array.isArray(t)){let b=t.length;for(let E=0;E<b;E++){let T=t[E],C=a,M=!1,I=a;if(typeof T!="string"){let v={instancePath:e+"/"+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=[v]:s.push(v),a++}var w=I===a;M=M||w;let k=a;if(T&&typeof T=="object"&&!Array.isArray(T)){if(Object.keys(T).length>1){let v={instancePath:e+"/"+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=[v]:s.push(v),a++}if(Object.keys(T).length<1){let v={instancePath:e+"/"+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=[v]:s.push(v),a++}for(let v in T){let x=T[v];if(typeof x!="string"){let R={instancePath:e+"/"+E+"/"+v.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:x};s===null?s=[R]:s.push(R),a++}}}else{let v={instancePath:e+"/"+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=[v]:s.push(v),a++}var w=k===a;if(M=M||w,M)a=C,s!==null&&(C?s.length=C:s=null);else{let v={instancePath:e+"/"+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=[v]:s.push(v),a++}}}else{let b={instancePath:e,schemaPath:"#/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array",schema:Qo.anyOf[1].type,parentSchema:Qo.anyOf[1],data:t};s===null?s=[b]:s.push(b),a++}var S=g===a;if(l=l||S,S)var O=!0;if(l)a=c,s!==null&&(c?s.length=c:s=null);else{let b={instancePath:e,schemaPath:"#/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf",schema:Qo.anyOf,parentSchema:Qo,data:t};s===null?s=[b]:s.push(b),a++}return yr.errors=s,d.props=$,d.items=O,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(!ai.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 $={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=[$]:s.push($),a++}if(h.at!==void 0){let y=h.at,$=a,g=!1,w=a;if(typeof y=="string"){if(!Rt.test(y)){let O={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=[O]:s.push(O),a++}}else{let O={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=[O]:s.push(O),a++}var c=w===a;g=g||c;let S=a;if(Array.isArray(y)){if(y.length>3){let b={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=[b]:s.push(b),a++}if(y.length<2){let b={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=[b]:s.push(b),a++}let O=y.length;for(let b=0;b<O;b++){let E=y[b];if(typeof E!="number"){let T={instancePath:e+"/say/"+u+"/at/"+b,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:E};s===null?s=[T]:s.push(T),a++}}}else{let O={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=[O]:s.push(O),a++}var c=S===a;if(g=g||c,g)a=$,s!==null&&($?s.length=$:s=null);else{let O={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=[O]:s.push(O),a++}}if(h.text!==void 0){let y=h.text;if(typeof y!="string"){let $={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=[$]:s.push($),a++}}if(h.kind!==void 0){let y=h.kind;if(typeof y!="string"){let $={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=[$]:s.push($),a++}}if(h.dx!==void 0){let y=h.dx;if(typeof y!="number"){let $={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=[$]:s.push($),a++}}if(h.dy!==void 0){let y=h.dy;if(typeof y!="number"){let $={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=[$]:s.push($),a++}}if(h.anchor!==void 0){let y=h.anchor;if(!(y==="start"||y==="middle"||y==="end")){let $={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=[$]:s.push($),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 $={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=[$]:s.push($),a++}if(h.on!==void 0){let y=h.on;if(typeof y=="string"){if(!Rt.test(y)){let $={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=[$]:s.push($),a++}}else{let $={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=[$]:s.push($),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 $=y.length;for(let g=0;g<$;g++){let w=y[g];if(typeof w!="number"){let S={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:w};s===null?s=[S]:s.push(S),a++}}}else{let $={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=[$]:s.push($),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 $=a;if(Array.isArray(f)){if(f.length>3){let w={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=[w]:s.push(w),a++}if(f.length<2){let w={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=[w]:s.push(w),a++}let g=f.length;for(let w=0;w<g;w++){let S=f[w];if(typeof S!="number"){let O={instancePath:e+"/badge/"+w,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};s===null?s=[O]:s.push(O),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=$===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 $={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=[$]:s.push($),a++}var p=h===a;u=u||p;let y=a;if(!(typeof f=="number"&&!(f%1)&&!isNaN(f))){let $={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=[$]:s.push($),a++}if(typeof f=="number"&&(f<500||isNaN(f))){let $={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=[$]:s.push($),a++}var p=y===a;if(u=u||p,u)a=m,s!==null&&(m?s.length=m:s=null);else{let $={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=[$]:s.push($),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(!ai.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 $=0;$<y;$++){let g=l[$];if(typeof g!="string"){let w={instancePath:e+"/legend/"+$,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=[w]:s.push(w),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 ea(t,{instancePath:e="",parentData:n,parentDataProperty:r,rootData:i=t,dynamicAnchors:o={}}={}){let s=null,a=0,d=ea.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(!ai.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 ea.errors=s,a===0}ea.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function gm(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 bm=new Map([["ab60a1c5:10916",mf]]);function jl(t){let e=bm.get(gm(t));if(!e)throw new Error(`schema not precompiled into the page: ${t.$id??t.title??"?"}`);return e}var Bl={$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 Vl=[];function uf(t){Vl.includes(t)||Vl.push(t)}function Dl(t){for(let e of Vl){let n=e(t);if(n!==void 0)return n}return t?"this item":"the file"}function sa(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"},li=new Map;function yf(t,e){li.set(t,e)}var Kl=new Map;function gf(t,e){Kl.set(t,(n,r)=>e(sa(n),r))}var ql=[];function bf(t,e){ql.some(([n])=>n===t)||ql.push([t,e])}function xm(t){let e=t.parentSchema,n=Object.keys(e?.properties??{});e?.$ref&&li.has(e.$ref)&&n.push(...li.get(e.$ref).filter(r=>!n.includes(r)));for(let r of e?.allOf??[])r.$ref&&li.has(r.$ref)&&n.push(...li.get(r.$ref));return n}function ta(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=`${Dl(r)} is missing "${a.missingProperty}"`;break;case"additionalProperties":case"unevaluatedProperties":{let c=String(a.additionalProperty??a.unevaluatedProperty),l=xm(t),p=Ns(c,l);return i=`unknown key "${c}" in ${Dl(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=`${sa(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=Kl.has(r)?Kl.get(r)(t.data,a.allowedValue):`must be ${JSON.stringify(a.allowedValue)}`;break;case"type":i=`expected ${hf[String(a.type)]??a.type}, got ${sa(t.data)}`;break;case"pattern":let d=ql.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 ${Dl(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(ta(l,e));else if(c.length)i.push(...c.map(p=>ta(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=>ta(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:`${sa(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(ta(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=jl(Bl),km=Object.keys(Bl.$defs.placement.properties);yf("#/$defs/placement",km);gf("/isodiag",t=>`"isodiag" must be 1 (the format version), got ${t}`);var Sm={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?Sm[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=so(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 To(s,e,Ys,r,t,n,i)}export{Wc as core,wp as objects,vf as systems,lf as viewer};
|