nodejs-map 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +95 -2
- package/dist/app/assets/app.worker-PoneE3J2.js +8 -0
- package/dist/app/assets/app.worker-PoneE3J2.js.map +1 -0
- package/dist/app/assets/atlas.worker-B0xwOHwo.js +2 -0
- package/dist/app/assets/atlas.worker-B0xwOHwo.js.map +1 -0
- package/dist/app/assets/cm-BiB0hvWw.js +13 -0
- package/dist/app/assets/cm-BiB0hvWw.js.map +1 -0
- package/dist/app/assets/dist-B37Ex44M.js +2 -0
- package/dist/app/assets/dist-B37Ex44M.js.map +1 -0
- package/dist/app/assets/dist-hDhUT_Vg.js +2 -0
- package/dist/app/assets/dist-hDhUT_Vg.js.map +1 -0
- package/dist/app/assets/index-2K-ozYKf.js +16 -0
- package/dist/app/assets/index-2K-ozYKf.js.map +1 -0
- package/dist/app/assets/index-Cw18rDSZ.css +1 -0
- package/dist/app/assets/map-Cnxgv4Ve.js +129 -0
- package/dist/app/assets/map-Cnxgv4Ve.js.map +1 -0
- package/dist/app/assets/map-Cz4s03Wm.css +1 -0
- package/dist/app/assets/sdf-label-font-1nAa0TP8.png +0 -0
- package/dist/app/config.json +5 -0
- package/dist/app/favicon.svg +1 -0
- package/dist/app/index.html +21 -0
- package/dist/atlas/v26.13.1/build-report.json +178 -0
- package/dist/atlas/v26.13.1/chunks/lib.bootstrap.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/lib.core.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/lib.crypto.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/lib.devtools.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/lib.events.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/lib.fs.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/lib.modules.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/lib.net.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/lib.net.1.json +1 -0
- package/dist/atlas/v26.13.1/chunks/lib.platform.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/lib.process.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/lib.rest.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/lib.streams.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/lib.timers.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/lib.workers.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/lib.zlib.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/src.callbacks.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/src.crypto.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/src.diag.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/src.fs.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/src.inspector.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/src.loop.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/src.modules.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/src.napi.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/src.net.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/src.net.1.json +1 -0
- package/dist/atlas/v26.13.1/chunks/src.process.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/src.rest.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/src.support.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/src.zlib.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/uv.api.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/uv.backends.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/uv.fs.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/uv.loop.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/uv.net.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/uv.rest.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/uv.threadpool.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.api.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.asmjs.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.ast.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.base.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.baseline.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.bigint.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.builtins.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.codegen.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.codegen.riscv.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.common.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.compiler-dispatcher.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.compiler.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.compiler.backend.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.compiler.turboshaft.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.d8.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.date.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.debug.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.deoptimizer.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.diagnostics.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.dumpling.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.execution.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.extensions.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.flags.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.fuzzilli.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.handles.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.heap.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.heap.cppgc.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.ic.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.init.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.inspector.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.interpreter.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.json.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.libplatform.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.libsampler.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.logging.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.maglev.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.numbers.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.objects.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.parsing.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.profiler.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.regexp.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.root.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.roots.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.runtime.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.sandbox.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.snapshot.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.strings.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.tasks.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.torque.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.tracing.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.trap-handler.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.utils.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.wasm.0.json +1 -0
- package/dist/atlas/v26.13.1/chunks/v8.zone.0.json +1 -0
- package/dist/atlas/v26.13.1/edges.json +1 -0
- package/dist/atlas/v26.13.1/files.json +1 -0
- package/dist/atlas/v26.13.1/index.json +1 -0
- package/dist/atlas/v26.13.1/link-check.json +16 -0
- package/dist/atlas/v26.13.1/search.json +1 -0
- package/dist/cli.js +6002 -0
- package/dist/examples.json +1 -0
- package/dist/lessons/async-await-chain.nmrec.gz +0 -0
- package/dist/lessons/beforeexit-and-exit.nmrec.gz +0 -0
- package/dist/lessons/dns-lookup-thread-pool.nmrec.gz +0 -0
- package/dist/lessons/esm-twist.nmrec.gz +0 -0
- package/dist/lessons/eventemitter-is-synchronous.nmrec.gz +0 -0
- package/dist/lessons/fs-promises-await.nmrec.gz +0 -0
- package/dist/lessons/fs-sync-vs-async.nmrec.gz +0 -0
- package/dist/lessons/index.json +621 -0
- package/dist/lessons/interval-and-clear.nmrec.gz +0 -0
- package/dist/lessons/nested-ticks-and-microtasks.nmrec.gz +0 -0
- package/dist/lessons/pbkdf2-six-jobs-four-threads.nmrec.gz +0 -0
- package/dist/lessons/pool-with-two-threads.nmrec.gz +0 -0
- package/dist/lessons/readfile-thread-pool.nmrec.gz +0 -0
- package/dist/lessons/tcp-round-trip.nmrec.gz +0 -0
- package/dist/lessons/tick-before-promise.nmrec.gz +0 -0
- package/dist/lessons/timeout-vs-immediate-io.nmrec.gz +0 -0
- package/dist/lessons/timeout-vs-immediate-main.nmrec.gz +0 -0
- package/dist/lessons/timer-vs-file-read.nmrec.gz +0 -0
- package/dist/lessons/timers-phase.nmrec.gz +0 -0
- package/dist/preload.cjs +477 -0
- package/package.json +25 -4
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./cm-BiB0hvWw.js","./dist-B37Ex44M.js","./map-Cnxgv4Ve.js","./map-Cz4s03Wm.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
var e,t,n,r,i,a,o,s,c,l,u,d=Symbol.for(`pv`),f={},p=[],m=/^m(i|n|o|s|text|space)$/,h=Array.isArray,g=p.slice,_=Object.assign;function v(e){e&&e.parentNode&&e.remove()}function y(e,t,n){var r,i,a,o={},s=arguments.length;for(a in t)a==`key`?r=t[a]:a==`ref`&&typeof e!=`function`?i=t[a]:o[a]=t[a];return s>2&&(o.children=s>3?g.call(arguments,2):n),b(e,o,r,i,null)}function b(n,r,i,a,o){var s={type:n,props:r,key:i,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:d,__v:o||++t,__i:-1,__u:0};return!o&&e.vnode&&e.vnode(s),s}function x(e){return e.children}function S(e,t){this.props=e,this.context=t,this.__g=0}function C(e,t){if(t==null)return e.__&&C(e.__,e.__i+1);for(var n;t<e.__k.length;t++)if((n=e.__k[t])&&n.__e)return n.__e;return typeof e.type!=`function`||e.props.__P?null:C(e)}function w(t){var n,r=t.__v,i=r.__e,a=[],o=[],s=t.__P;s&&((n=_({constructor:d},r)).__v=r.__v+1,e.vnode&&e.vnode(n),ce(s,n,r,t.__n,s.namespaceURI,32&r.__u?[i]:null,a,i||C(r),32&r.__u,o),n.__v=r.__v,n.__.__k[n.__i]=n,de(a,n,o),r.__=r.__e=null,n.__e!=i&&ee(n))}function ee(e){if((e=e.__)&&e.__c&&!e.props.__P)return e.__e=null,e.__k.some(function(t){return t&&(e.__e=t.__e)}),ee(e)}function T(t){(8&t.__g||(t.__g|=8,r.push(t),a++))&&i==e.debounceRendering||((i=e.debounceRendering)||queueMicrotask)(E)}function E(){try{for(var e,t=1;r.length;)r.length>t&&r.sort(o),e=r.shift(),t=r.length,8&e.__g&&w(e)}finally{(a=r.length)&&(i||queueMicrotask)(E)}}function te(e,t,n,r,i,a,o,s,c,l,u){var d,m,h,g,_,v,y=r.__k||p,b=t.length;for(c=ne(n,t,y,c,b),d=0;d<b;d++)(h=n.__k[d])!=null&&(m=~h.__i&&y[h.__i]||f,h.__i=d,v=ce(e,h,m,i,a,o,s,c,l,u),g=h.__e,(m.ref!=h.ref||8&m.__u)&&(m.ref&&pe(m.ref,null,h,m),h.ref&&u.push(h.ref,h.__c||g,h)),_||=g,4&h.__u?(c=re(h,c,e,!m.__v),m.__e&&(m.__e=null)):typeof h.type==`function`&&v!==void 0?c=v:g&&(c=g.nextSibling),h.__u&=-21);return n.__e=_,c}function ne(e,t,n,r,i){var a,o,s,c,l,u,f,p,m,g=n.length,_=g,v=0,y=0,S=e.__k=Array(i);for(a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o!=`object`||o.constructor===String?o=S[a]=b(null,o):h(o)?o=S[a]=b(x,{children:o}):o.constructor===d&&o.__b?o=S[a]=b(o.type,o.props,o.key,o.ref,o.__v):S[a]=o,c=a+v,o.__=e,o.__b=e.__b+1,s=null,~(l=o.__i=ie(o,n,c,_))&&(_--,(s=n[l])&&(s.__u|=2)),s&&s.__v?(o.__u|=16,l==c-1?v--:l==c+1?v++:l!=c&&(l>c?v--:v++,y=1)):(~l||(i>g?v--:i<g&&v++),typeof o.type!=`function`&&(o.__u|=4))):S[a]=null;if(y){for(u=[],f=[],a=0;a<i;a++)if((o=S[a])&&16&o.__u){for(v=0,p=u.length;v<p;)u[m=v+p>>1]<o.__i?v=m+1:p=m;u[v]=o.__i,f[a]=v+1}for(v=u.length;a--;)f[a]&&(f[a]==v?v--:S[a].__u|=4)}if(_)for(a=0;a<g;a++)!(s=n[a])||2&s.__u||(s.__e==r&&(r=C(s)),me(s,s));return r}function re(e,t,n,r){var i,a,o,s;if(typeof e.type==`function`){if(e.props.__P)return t;if(i=e.__k)for(a=0;a<i.length;a++)i[a]&&(i[a].__=e,t=re(i[a],t,n,!1));return t}for(t&&!t.parentNode&&(t=C(e))&&!t.parentNode&&(t=null),o=e.__e,s=t;s&&s.nodeType==8;)s=s.nextSibling;for(o!=s&&(!r&&n.moveBefore&&o.parentNode?n.moveBefore(o,t):n.insertBefore(o,t||null)),t=o;(t&&=t.nextSibling)&&t.nodeType==8&&!t.data.startsWith(`$s`););return t}function ie(e,t,n,r){var i,a=e.key,o=e.type,s=t[n],c=s&&!(2&s.__u);if(s===null&&a==null||c&&a==s.key&&o==s.type)return n;if(r>+!!c){for(i=n-1;i>=0;i--)if((s=t[i])&&!(2&s.__u)&&a==s.key&&o==s.type)return i;for(i=n+1;i<t.length;i++)if((s=t[i])&&!(2&s.__u)&&a==s.key&&o==s.type)return i}return-1}function ae(e,t,n){n??=``,t[0]==`-`?e.setProperty(t,n):e[t]=n}function oe(e,t,n,r,i){var a,o;if(t==`style`){if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||ae(e.style,t);if(n)for(t in n)r&&n[t]==r[t]||ae(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)typeof n!=`function`&&(n=null),typeof r!=`function`&&(r=null),(e.__e||={})[t]=n,n&&r||(o=u[t]||(u[t]=se(t)),(e.__a||={})[t]=l,a=t!=(t=t.replace(c,`$1`)),(t=t.slice(2))[0]<`a`&&(t=t.toLowerCase()),n?e.addEventListener(t,o,a):e.removeEventListener(t,o,a));else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;return}catch{}if(typeof n==`function`)return;n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n)}}function se(t){return function(n){var r=this.__e;if(r){if(r=r[t],n[s]==null)n[s]=l++;else if(n[s]<this.__a[t])return;return r(e.event?e.event(n):n)}}}function ce(t,n,r,i,a,o,s,c,l,u){var f,m,g,y,b,w,ee,T,E,ne,re,ie,ae,oe,se,ce,de,pe,ge=n.type;if(n.constructor!==d)return null;128&r.__u&&(l=32&r.__u,f=r.__c.__z)&&(n.__u|=l,m=o=[],f.nodeType==8?c=le(f,o):o.push(f),c=o[0]||c),(f=e.__b)&&f(n);e:if(typeof ge==`function`){g=s.length;try{if(T=n.props,E=(f=ge.prototype)&&f.render,ne=(f=ge.contextType)&&i[f.__c],re=f?ne?ne.props.value:f.__:i,(y=r.__c)?(n.__c=y,2&y.__g&&(y.__g|=1)):(E?n.__c=y=new ge(T,re):(n.__c=y=new S(T,re),y.constructor=ge,y.render=he),ne&&ne.sub(y),y.state||(y.state={}),y.__n=i,y.__g|=8,y.__h=[],y.__k=[]),E&&(y.__s||(y.__s=y.state),ge.getDerivedStateFromProps&&(y.__s==y.state&&(y.__s=_({},y.__s)),_(y.__s,ge.getDerivedStateFromProps(T,y.__s)))),b=y.props,w=y.state,y.__v=n,r.__c){if(T!==b&&E&&!ge.getDerivedStateFromProps&&y.componentWillReceiveProps&&y.componentWillReceiveProps(T,re),n.__v==r.__v&&!(8&y.__g)||!(4&y.__g)&&y.shouldComponentUpdate&&!1===y.shouldComponentUpdate(T,y.__s,re)){n.__v!=r.__v&&(y.props=T,y.state=y.__s,y.__g&=-9),n.__e=r.__e,n.__k=r.__k,n.__k.some(function(e){e&&(e.__=n)}),p.push.apply(y.__h,y.__k),y.__k=[],y.__h.length&&s.push(y),c=C(r);break e}y.componentWillUpdate&&y.componentWillUpdate(T,y.__s,re),E&&y.componentDidUpdate&&y.__h.push(function(){y.componentDidUpdate(b,w,ee)})}else E&&!ge.getDerivedStateFromProps&&y.componentWillMount&&y.componentWillMount(),E&&y.componentDidMount&&y.__h.push(y.componentDidMount);y.context=re,y.props=T,y.__P=t,y.__g&=-5,ie=e.__r,ae=E?25:0;do y.__g&=-9,ie&&ie(n),f=y.render(y.props,y.state=y.__s,y.context);while(8&y.__g&&++ae<25);E&&(p.push.apply(y.__h,y.__k),y.__k=[]),y.state=y.__s,y.getChildContext&&(i=_({},i,y.getChildContext())),E&&r.__c&&y.getSnapshotBeforeUpdate&&(ee=y.getSnapshotBeforeUpdate(b,w)),oe=f&&f.type===x&&f.key==null?f.props.children:f,T.__P&&(f=c,a=(t=T.__P).namespaceURI,l=o=null,r.props&&r.props.__P!=t&&(r.__k.some(function(e){e&&me(e,e)}),r.__k=null),c=r.__k?C(r,0):null),c=te(t,h(oe)?oe:[oe],n,r,i,a,o,s,c,l,u),T.__P&&(n.__e=null,c=f),n.__u&=-161,m&&m.some(v),y.__h.length&&s.push(y),1&y.__g&&(y.__g&=-4)}catch(t){if(s.length=g,n.__v=null,l||o){if(t&&t.then){if(n.__u|=128|l,o){for(~(de=o.indexOf(c||void 0))||(de=o.length);(pe=o[de-1])&&pe.nodeType==8;)de--;for(;de<o.length;de++)if(pe=o[de]){if(o[de]=null,se){if(pe==ce)break}else{if(pe.nodeType!=8)break;pe.data.startsWith(`$s`)&&(ce=le(se=pe))}}}if(!se){for(;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;se=c}(f=le(se=n.__c.__z||(n.__c.__z=se)))?(n.__e=se,c=f):n.__e=c,c&&=c.nextSibling}else o&&o.some(v)}else n.__e=r.__e;n.__k||=r.__k||[],t&&t.then||ue(n),e.__e(t,n,r)}}else c=n.__e=fe(r.__e,n,r,i,a,o,s,l,u,t);return(f=e.diffed)&&f(n),c}function le(e,t){if(e&&e.nodeType==8&&e.data.startsWith(`$s`))for(var n=1;e=e.nextSibling;){if(e.nodeType==8){if(e.data.startsWith(`$s`))n++;else if(e.data.startsWith(`/$s`)&&!--n)return e}t&&t.push(e)}}function ue(e){e&&(e.__c&&(e.__c.__g|=4),e.__k&&e.__k.some(ue))}function de(t,n,r){for(var i=0;i<r.length;)pe(r[i++],r[i++],r[i++]);e.__c&&e.__c(n,t),t.some(function(n){try{t=n.__h,n.__h=[],t.some(function(e){e.call(n)})}catch(t){e.__e(t,n.__v)}})}function fe(t,n,r,i,a,o,s,c,l,u){var d,p,_,y,b,x,S,w,ee=r.props||f,T=n.props,E=n.type;if(E==`svg`?a=`http://www.w3.org/2000/svg`:E==`math`?a=`http://www.w3.org/1998/Math/MathML`:a||=`http://www.w3.org/1999/xhtml`,o){for(d=0;d<o.length;d++)if((b=o[d])&&(E?b.localName==E:b.nodeType==3)){t=b,o[d]=null;break}}if(!t){if(w=u.ownerDocument||document,!E)return w.createTextNode(T);t=w.createElementNS(a,E,T.is?T:u),c&&=(e.__m&&e.__m(n,o),!1),o=null}if(E){if(u=E==`template`&&t.content||t,o=E==`textarea`&&T.defaultValue!=null?null:o&&g.call(u.childNodes),!c&&o)for(ee={},d=0;d<t.attributes.length;d++)ee[(b=t.attributes[d]).name]=b.value;for(d in ee)b=ee[d],d==`dangerouslySetInnerHTML`?_=b:d==`children`||d in T||d==`value`&&`defaultValue`in T||d==`checked`&&`defaultChecked`in T||oe(t,d,null,b,a);for(d in T)b=T[d],d==`children`?y=b:d==`dangerouslySetInnerHTML`?p=b:d==`value`?x=b:d==`checked`?S=b:c&&typeof b!=`function`||ee[d]===b||oe(t,d,b,ee[d],a);p?(c||_&&(p.__html==_.__html||p.__html==t.innerHTML)||(t.innerHTML=p.__html),n.__k=[]):(_&&(t.textContent=``),(E==`foreignObject`||a==`http://www.w3.org/1998/Math/MathML`&&m.test(E))&&(a=`http://www.w3.org/1999/xhtml`),te(u,h(y)?y:[y],n,r,i,a,o,s,o?o[0]:r.__k&&C(r,0),c,l),o&&o.some(v)),c&&E!=`textarea`||(d=`value`,E==`progress`&&x==null?t.removeAttribute(d):x==null||x===t[d]&&(E!=`progress`||x)||oe(t,d,x,ee[d],a),d=`checked`,S!=null&&S!=t[d]&&oe(t,d,S,ee[d],a))}else ee===T||c&&t.data==T||(t.data=T);return t}function pe(t,n,r,i){try{typeof t==`function`?n?n.__x=t(n)||1:(i&&=i.__c||i.__e)&&(n=i.__x)&&(i.__x=null,typeof n==`function`?n():t(null)):t.current=n}catch(t){e.__e(t,r)}}function me(t,n,r){var i,a,o,s;if(e.unmount&&e.unmount(t),!(i=t.ref)||i.current&&i.current!=t.__e||pe(i,null,n,t),i=t.__c){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(t){e.__e(t,n)}i.__P=i.__n=null}if(i=t.__k)for(s=0;s<i.length;s++)i[s]&&me(i[s],n,typeof t.type!=`function`||r&&!t.props.__P);!r&&(i=t.__c)&&(i=i.__z)&&(a=le(i,o=[]))&&(i==t.__e&&o.some(v),v(a),v(i)),r||v(t.__e),t.__e=t.__c=t.__=null}function he(e,t,n){return this.constructor(e,n)}function ge(t,n){var r,i,a,o;e.__&&e.__(t,n),n.nodeType==9&&(n=n.documentElement),i=(r=t&&32&t.__u)?null:n.__k,n.__k=b(x,{children:[t]}),a=[],o=[],ce(n,n.__k,i||f,f,n.namespaceURI,i?null:n.firstChild?g.call(n.childNodes):null,a,i?i.__e:n.firstChild,r,o),de(a,n.__k,o),n.__k.props.children=null}e={__e:function(e,t,n,r){for(var i,o,s;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((s=(o=i.constructor)&&o.getDerivedStateFromError)&&i.setState(o.getDerivedStateFromError(e)),i.componentDidCatch&&(i.componentDidCatch(e,r||{}),s=1),s&&8&i.__g)return void(i.__g|=2)}catch(t){e=t}}throw a=0,e}},t=0,n=function(e){return e!=null&&e.constructor===d},S.prototype.setState=function(e,t){var n=this.__s;n&&n!=this.state||(n=this.__s=_({},this.state)),typeof e==`function`&&(e=e(_({},n),this.props)),e&&(_(n,e),this.__v&&(t&&this.__k.push(t),T(this)))},S.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),T(this))},S.prototype.render=x,r=[],a=0,o=function(e,t){return e.__v.__b-t.__v.__b},s=Symbol(),c=/(PointerCapture)$|Capture$/i,l=0,u={};var _e=new Set;function ve(e){if(!_e.has(e)){_e.add(e);try{performance.mark(`nm:${e}`)}catch{}}}var ye,D,be,xe,Se=Object.is,Ce=0,we=[],Te=[],O=e,Ee=O.__b,De=O.__r,Oe=O.diffed,ke=O.__c,Ae=O.unmount,je=O.__;function Me(e,t){O.__h&&O.__h(D,e,Ce||t),Ce=0;var n=D.__H||(D.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function k(e){return Ce=1,Ne(Ge,e)}function Ne(e,t,n){var r=Me(ye++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Ge(void 0,t),function(e){var t=(r.__N||r.__)[0],n=r.t(t,e);Se(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=D,!D.__f)){D.__f=!0;var i=D.shouldComponentUpdate;D.shouldComponentUpdate=function(e,t,n){var r=this.__H;if(!r)return!0;var a=!1,o=this.props!=e;if(r.__.some(function(e){e.__N&&(a=!0,Se(e.__[0],e.__N[0])||(o=!0))}),i){var s=i.call(this,e,t,n);return a?s||o:s}return!a||o}}return r.__}function A(e,t){var n=Me(ye++,3);!O.__s&&We(n.__H,t)&&(n.__P=!0,n.__=e,n.u=t,D.__H.__h.push(n))}function Pe(e,t){var n=Me(ye++,4);!O.__s&&We(n.__H,t)&&(n.__P=!1,n.__=e,n.u=t,D.__h.push(n))}function j(e){return Ce=5,Fe(function(){return{current:e}},[])}function Fe(e,t){var n=Me(ye++,7);return We(n.__H,t)&&(n.__=e(),n.__H=t),n.__}function Ie(e,t){return Ce=8,Fe(function(){return e},t)}function Le(){var e=Me(ye++,11);if(!e.__){for(var t=D.__v;!t.__m&&t.__;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__=`P`+n[0]+`-`+n[1]++}return e.__}function Re(){var e;do{for(;e=Te.shift();)try{He(e)}catch(t){O.__e(t,{__:(e=e.__P)&&e.__v})}for(;e=we.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(He),t.__h.some(Ue),t.__h=[]}catch(n){t.__h=[],O.__e(n,e.__v)}}}while(Te.length)}O.__b=function(e){D=null,Ee&&Ee(e)},O.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),je&&je(e,t)},O.__r=function(e){De&&De(e),ye=0;var t=(D=e.__c).__H;t&&(be==D?D.__h=[]:(t.__h.some(He),t.__h.some(Ue),ye=0),t.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})),be=D},O.diffed=function(e){Oe&&Oe(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&Ve(we.push(t)),t.__H.__.some(function(e){e.u&&(e.__H=e.u)})),be=D=null},O.__c=function(e,t){t.some(function(e){try{e.__h.some(He),e.__h=e.__h.filter(function(e){return!e.__||Ue(e)})}catch(t){e.__h=[function(){throw t}]}}),ke&&ke(e,t)},O.unmount=function(e){Ae&&Ae(e);var t,n,r=e.__c;r&&r.__H&&(r.__H.__.some(function(r){try{if(r.__P&&r.__c){if(n===void 0){for(n=e.__;n&&(!n.__c||!n.__c.__P);)n=n.__;n&&=n.__c}r.__P=n,Ve(Te.push(r))}else He(r)}catch(e){t=e}}),r.__H=void 0,t&&O.__e(t,r.__v))};var ze=typeof requestAnimationFrame==`function`;function Be(e){var t,n=function(){clearTimeout(r),ze&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);ze&&(t=requestAnimationFrame(n))}function Ve(e){e!=1&&xe==O.requestAnimationFrame||((xe=O.requestAnimationFrame)||Be)(Re)}function He(e){var t=D,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),D=t}function Ue(e){var t=D;e.__c=e.__(),D=t}function We(e,t){return!e||e.length!=t.length||t.some(function(t,n){return!Se(t,e[n])})}function Ge(e,t){return typeof t==`function`?t(e):t}var Ke=Symbol.for(`pv`),qe=0;Array.isArray;function M(t,n,r,i,a,o){n||={};var s,c,l=n;if(`ref`in l&&typeof t!=`function`)for(c in l={},n)c==`ref`?s=n[c]:l[c]=n[c];var u={type:t,props:l,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:Ke,__v:--qe,__i:-1,__u:0};return(a||o)&&(u.__source=a,u.__self=o),e.vnode&&e.vnode(u),u}var Je=(function(){let e=typeof document<`u`&&document.createElement(`link`).relList;return e&&e.supports&&e.supports(`modulepreload`)?`modulepreload`:`preload`})(),Ye=function(e,t){return new URL(e,t).href},Xe={},Ze={},Qe=function(e){return e.pathname.endsWith(`.css`)},$e=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw delete e[t],n});return e[t]=i,i},et=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=Ye(t,n);let r=s(t),i=Qe(r);return $e(Xe,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}let t=i?e.styles:e.all,n=i?Ze[r.href]:void 0;if(!n&&t.has(r.href))return;let o=document.createElement(`link`);if(o.rel=i?`stylesheet`:Je,i||(o.as=`script`),o.crossOrigin=``,o.href=r.href,a&&o.setAttribute(`nonce`,a),n&&delete Ze[r.href],n?.isConnected?n.replaceWith(o):document.head.appendChild(o),i)return new Promise((e,t)=>{let n=i=>{o.removeEventListener(`load`,n),o.removeEventListener(`error`,n),i.type===`error`?(Ze[r.href]=o,t(Error(`Unable to preload CSS for ${r}`))):e(i)};o.addEventListener(`load`,n),o.addEventListener(`error`,n)})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},tt=null;function nt(){return tt??=et(()=>import(`./cm-BiB0hvWw.js`).then(e=>e.t),__vite__mapDeps([0,1]),import.meta.url),tt}function rt(e){let t=j(null),n=j(null),[r,i]=k(!1),[a,o]=k(!1),s=j(e);s.current=e;let c=e.onToggleBreakpoint!==void 0,l=j(null),u=j(0);return A(()=>{let e=!0;return nt().then(r=>{if(!e||!t.current)return;let a=s.current;n.current=r.createCodeView({parent:t.current,doc:a.text,language:a.language,readOnly:a.readOnly,label:a.label,onChange:e=>{l.current=e,u.current++,s.current.onChange?.(e)},...c?{onToggleBreakpoint:e=>s.current.onToggleBreakpoint?.(e),onBreakpointsMoved:e=>s.current.onBreakpointsMoved?.(e)}:{}}),i(!0),ve(`editor`)},()=>{e&&o(!0)}),()=>{e=!1,n.current?.destroy(),n.current=null}},[c]),A(()=>{e.text===l.current?u.current=0:u.current>0?u.current--:n.current?.setDoc(e.text)},[r,e.text]),A(()=>{n.current?.setLanguage(e.language)},[r,e.language]),A(()=>{n.current?.setReadOnly(e.readOnly)},[r,e.readOnly]),A(()=>{n.current?.setLabel(e.label)},[r,e.label]),A(()=>{n.current?.setBreakpoints(e.breakpoints??[])},[r,e.breakpoints,e.text]),A(()=>{let e=0,r,i=()=>{let a=t.current;n.current&&a&&(a.offsetParent===null||document.hidden?r=setTimeout(()=>{e=requestAnimationFrame(i)},250):n.current.setLineMark(s.current.lineMark??null))};return e=requestAnimationFrame(i),()=>{cancelAnimationFrame(e),clearTimeout(r)}},[r,e.lineMark?.line,e.lineMark?.kind,e.text]),A(()=>{n.current?.setRange(e.range??null,!0)},[r,e.range?.start,e.range?.end,e.revealKey,e.text]),M(`div`,{class:`code`,children:[M(`div`,{ref:t,class:`code__cm`}),r?null:M(`pre`,{class:`code__plain mono`,tabIndex:0,"aria-label":e.label,children:e.text}),a?M(`p`,{class:`code__note warn-text`,children:`The code editor could not be loaded; the text is shown without highlighting and cannot be edited here.`}):null]})}var it={enabled:!0,reason:null},at=e=>({enabled:!1,reason:e}),N={notConnected:`The helper is not connected. Start nodejs-map again in a terminal.`,noProvider:`No Node.js is selected.`,providerUnavailable:`This Node.js is not available.`,jsDebugger:`This Node.js cannot be debugged: the helper could not use its inspector.`,gatePhase:`Needs the probe build. An official Node.js can only be paused at a JavaScript statement, not between event loop phases.`,gateTimer:`Needs the probe build. An official Node.js cannot stop just before a timer fires.`,gatePoolStart:`Needs the probe build. An official Node.js cannot stop a thread pool thread before it starts a job.`,gatePoolPost:`Needs the probe build. An official Node.js cannot stop a thread pool thread before it hands back a result.`,nothingRunning:`Nothing is running.`,starting:`The program is starting.`,freeRun:`This run was started with Run. Use Debug to pause and step.`,notPaused:`The program is not paused.`,alreadyPaused:`The program is already paused.`,notAtGate:`The program is not stopped at a gate.`,atGate:`The program is stopped at a gate. Resume it first.`};function ot(e,t){let n=t[`gates.${e}`]??t.gates;if(n)return n;switch(e){case`phase`:return N.gatePhase;case`timer`:return N.gateTimer;case`poolStart`:return N.gatePoolStart;case`poolPost`:return N.gatePoolPost}}function st(e){let{connected:t,provider:n,notes:r,status:i,mode:a}=e,o=n?.caps??null,s=i===`running`||i===`paused`||i===`gated`,c=t?n?n.available?i===`starting`?N.starting:null:n.why??N.providerUnavailable:N.noProvider:N.notConnected,l=c??(o&&!o.jsDebugger?r.jsDebugger??N.jsDebugger:null),u=e=>t?i===`starting`?at(N.starting):s?e?e():it:at(N.nothingRunning):at(N.notConnected),d=e=>o&&!o.jsDebugger?at(r.jsDebugger??N.jsDebugger):u(()=>a===`free`?at(N.freeRun):i===`gated`?at(N.atGate):e?i===`paused`?it:at(N.notPaused):i===`paused`?at(N.alreadyPaused):it),f=(e,a)=>t?!o||!o.gates[e]?at(ot(e,r)):a===`arm`&&!s?i===`starting`?at(N.starting):n&&!n.available?at(n.why??N.providerUnavailable):it:u(()=>a===`resume`?i===`gated`?it:at(N.notAtGate):it):at(N.notConnected);return{run:c?at(c):it,debug:l?at(l):it,stop:t?s||i===`starting`?it:at(N.nothingRunning):at(N.notConnected),pause:d(!1),resume:d(!0),stepOver:d(!0),stepInto:d(!0),stepOut:d(!0),pauseAtNextPhase:f(`phase`,`arm`),stepPhase:f(`phase`,`act`),runToPhase:f(`phase`,`act`),gateTimer:f(`timer`,`arm`),gatePoolStart:f(`poolStart`,`arm`),gatePoolPost:f(`poolPost`,`arm`),gateResume:f(`phase`,`resume`)}}function ct(e){let t=[`pauseAtNextPhase`,`stepPhase`,`runToPhase`];if(t.some(t=>e[t].enabled))return null;let n=new Set(t.map(t=>e[t].reason));if(n.size!==1)return null;let[r]=n;return r??null}var lt=`nodejs-map/atlas@1`,ut=`nodejs-map/atlas-chunk@1`,dt=`nodejs-map/atlas-files@1`,ft=`nodejs-map/atlas-search@1`,pt=`nodejs-map/atlas-edges@1`,mt=[`id`,`p`,`k`,`n`,`x`,`y`,`w`,`h`,`a`,`b`,`v`],ht=class extends Error{problems;constructor(e,t){super(`invalid ${e}: ${t.slice(0,5).join(`; `)}${t.length>5?` (+${t.length-5} more)`:``}`),this.name=`AtlasValidationError`,this.problems=t}},gt=50,_t=new Set([`unix`,`linux`,`darwin`,`win`]),vt=new Set([`region`,`group`,`feature`,`single`]),yt=new Set([`d`,`f`,`s`]),bt=/^(?!\/)(?!.*(^|\/)\.\.(\/|$))[A-Za-z0-9_@+.,~=\-/]+$/,xt=/^(?!\/)(?!.*(^|\/)\.\.(\/|$))[A-Za-z0-9_.\-/]+\.json$/,St=class{problems=[];fail(e){this.problems.length<gt&&this.problems.push(e)}isObj(e,t){return typeof e==`object`&&e&&!Array.isArray(e)?!0:(this.fail(`${t}: expected an object`),!1)}str(e,t,n=!1){return e===void 0&&n||typeof e==`string`&&e.length>0&&e.length<4096?!0:(this.fail(`${t}: expected a non-empty string`),!1)}int(e,t,n=0,r=2**53-1,i=!1){return e===null&&i||typeof e==`number`&&Number.isInteger(e)&&e>=n&&e<=r?!0:(this.fail(`${t}: expected an integer in ${n}..${r}${i?` or null`:``}`),!1)}path(e,t){return typeof e==`string`&&bt.test(e)?!0:(this.fail(`${t}: not a safe relative repository path`),!1)}rect(e,t){if(!Array.isArray(e)||e.length!==4)return this.fail(`${t}: rect must be [x, y, w, h]`),!1;let n=!0;return e.forEach((e,r)=>{n=this.int(e,`${t}[${r}]`,r<2?-10:0,10010)&&n}),n}range(e,t){if(!this.isObj(e,t))return!1;let n=this.path(e.path,`${t}.path`)&&this.int(e.start,`${t}.start`,1)&&this.int(e.end,`${t}.end`,1)&&this.str(e.sym,`${t}.sym`);return n&&e.end<e.start&&(this.fail(`${t}: end before start`),n=!1),e.os!==void 0&&!_t.has(e.os)&&(this.fail(`${t}.os: unknown OS tag`),n=!1),e.url!==void 0&&!(typeof e.url==`string`&&e.url.startsWith(`https://github.com/nodejs/node/blob/`))&&(this.fail(`${t}.url: not a nodejs/node GitHub permalink`),n=!1),n}};function Ct(e,t,n){if(e.problems.length)throw new ht(t,e.problems);return n}function wt(e){let t=new St;if(!t.isObj(e,`index`))return Ct(t,`index`,e);e.schema!==`nodejs-map/atlas@1`&&t.fail(`schema: expected "${lt}", got ${JSON.stringify(e.schema)}`);let n=e.node;t.isObj(n,`node`)&&(t.str(n.version,`node.version`),typeof n.commit==`string`&&/^[0-9a-f]{40}$/.test(n.commit)||t.fail(`node.commit: expected a 40-hex commit`),n.repo!==`nodejs/node`&&t.fail(`node.repo: expected "nodejs/node"`));let r=e.world;t.isObj(r,`world`)&&(t.int(r.w,`world.w`,1),t.int(r.h,`world.h`,1));for(let n of[`files`,`search`,`edges`])typeof e[n]==`string`&&xt.test(e[n])||t.fail(`${n}: expected a relative .json URL`);let i=new Set([`o:world`]),a=e.boxes;Array.isArray(a)?a.forEach((e,n)=>{let r=`boxes[${n}]`;if(!t.isObj(e,r))return;t.str(e.id,`${r}.id`)&&(i.has(e.id)&&t.fail(`${r}.id: duplicate ${e.id}`),i.add(e.id)),i.has(e.p)||t.fail(`${r}.p: parent ${JSON.stringify(e.p)} must appear earlier`),vt.has(e.k)||t.fail(`${r}.k: unknown kind`),t.int(e.t,`${r}.t`,1,3),t.str(e.n,`${r}.n`),t.str(e.d,`${r}.d`,!0),t.rect(e.r,`${r}.r`);let a=e.loc;Array.isArray(a)?a.forEach((e,n)=>t.range(e,`${r}.loc[${n}]`)):a!==null&&t.isObj(a,`${r}.loc`)&&t.path(a.tree,`${r}.loc.tree`),e.k===`feature`&&!(Array.isArray(a)&&a.length>0)&&t.fail(`${r}: a feature needs at least one code range`)}):t.fail(`boxes: expected an array`);let o=e.paths;Array.isArray(o)?o.forEach((e,n)=>{let r=`paths[${n}]`;if(!t.isObj(e,r))return;t.str(e.id,`${r}.id`),t.str(e.title,`${r}.title`),e.certainty!==`model`&&t.fail(`${r}.certainty: curated paths are "model"`);let i=(e,n)=>{Array.isArray(e)?e.forEach((e,r)=>{let i=`${n}[${r}]`;t.isObj(e,i)&&(t.str(e.id,`${i}.id`),t.str(e.title,`${i}.title`),t.str(e.desc,`${i}.desc`),e.thread!==`main`&&e.thread!==`pool`&&t.fail(`${i}.thread: main or pool`),!Array.isArray(e.locs)||e.locs.length===0?t.fail(`${i}.locs: at least one location`):e.locs.forEach((e,n)=>t.range(e,`${i}.locs[${n}]`)))}):t.fail(`${n}: expected an array`)};i(e.steps,`${r}.steps`),Array.isArray(e.branches)?e.branches.forEach((e,n)=>{t.isObj(e,`${r}.branches[${n}]`)&&i(e.steps,`${r}.branches[${n}].steps`)}):t.fail(`${r}.branches: expected an array`)}):t.fail(`paths: expected an array`);let s=e.chunks;Array.isArray(s)?s.forEach((e,n)=>{let r=`chunks[${n}]`;t.isObj(e,r)&&(t.str(e.id,`${r}.id`),i.has(e.group)||t.fail(`${r}.group: unknown box ${JSON.stringify(e.group)}`),typeof e.url==`string`&&xt.test(e.url)||t.fail(`${r}.url: expected a relative .json URL`),t.rect(e.r,`${r}.r`),t.int(e.rows,`${r}.rows`,1),t.int(e.bytes,`${r}.bytes`,1))}):t.fail(`chunks: expected an array`);let c=e.aliases;if(t.isObj(c,`aliases`))for(let[e,n]of Object.entries(c))typeof n!=`string`&&t.fail(`aliases.${e}: expected a string`);return Ct(t,`index`,e)}function Tt(e,t){let n=new St;if(!n.isObj(e,`chunk`))return Ct(n,`chunk`,e);e.schema!==`nodejs-map/atlas-chunk@1`&&n.fail(`schema: expected "${ut}"`),n.str(e.id,`id`),n.str(e.group,`group`),JSON.stringify(e.cols)!==JSON.stringify(mt)&&n.fail(`cols: unexpected column list`);let r=e.rows;if(!Array.isArray(r))n.fail(`rows: expected an array`);else{let i=new Set;r.forEach((r,a)=>{let o=`rows[${a}]`;if(!Array.isArray(r)||r.length!==10&&r.length!==11){n.fail(`${o}: expected 10 or 11 columns`);return}let[s,c,l,u,d,f,p,m,h,g,_]=r;if(!n.str(s,`${o}.id`))return;let v=s;(typeof c!=`string`||!i.has(c)&&c!==e.group&&!t?.has(c))&&n.fail(`${o}.p: parent ${JSON.stringify(c)} unknown or after its child`),yt.has(l)||n.fail(`${o}.k: d, f or s`),n.str(u,`${o}.n`),n.rect([d,f,p,m],`${o}.rect`),l===`d`?v.startsWith(`d:`)||n.fail(`${o}: directory id must start with d:`):l===`f`?(v.startsWith(`f:`)?n.path(v.slice(2),`${o}.path`):n.fail(`${o}: file id must start with f:`),n.int(g,`${o}.b`,0,2**53-1,!0)):l===`s`&&(/^s:[^#]+#.+$/.test(v)?n.path(v.slice(2,v.indexOf(`#`)),`${o}.path`):n.fail(`${o}: function id must be s:<path>#<name>`),n.int(h,`${o}.a`,1)&&n.int(g,`${o}.b`,1)&&g<h&&n.fail(`${o}: end before start`)),_!==void 0&&typeof _!=`string`&&n.fail(`${o}.v: expected a string`),i.add(v)})}return Ct(n,`chunk`,e)}function Et(e,t){let n=new St;return n.isObj(e,`files`)&&(e.schema!==`nodejs-map/atlas-files@1`&&n.fail(`schema: expected "${dt}"`),Array.isArray(e.files)?e.files.forEach((e,r)=>{!Array.isArray(e)||e.length!==3?n.fail(`files[${r}]: expected [path, chunk, lines]`):(n.path(e[0],`files[${r}][0]`),n.int(e[1],`files[${r}][1]`,0,t-1),n.int(e[2],`files[${r}][2]`,0))}):n.fail(`files: expected an array`)),Ct(n,`files`,e)}function Dt(e){let t=new St;return t.isObj(e,`search`)&&(e.schema!==`nodejs-map/atlas-search@1`&&t.fail(`schema: expected "${ft}"`),Array.isArray(e.entries)?e.entries.forEach((e,n)=>{Array.isArray(e)&&e.length===2&&typeof e[0]==`string`&&typeof e[1]==`string`||t.fail(`entries[${n}]: expected [label, id]`)}):t.fail(`entries: expected an array`)),Ct(t,`search`,e)}function Ot(e){let t=new St;return t.isObj(e,`edges`)&&(e.schema!==`nodejs-map/atlas-edges@1`&&t.fail(`schema: expected "${pt}"`),e.certainty!==`inferred`&&t.fail(`certainty: extracted edges are "inferred"`),Array.isArray(e.edges)?e.edges.forEach((e,n)=>{t.isObj(e,`edges[${n}]`)&&(t.str(e.kind,`edges[${n}].kind`),t.str(e.from,`edges[${n}].from`))}):t.fail(`edges: expected an array`)),Ct(t,`edges`,e)}var kt=`nodejs/node`,At=e=>e.split(`/`).map(encodeURIComponent).join(`/`),jt=(e,t)=>e?t&&t!==e?`#L${e}-L${t}`:`#L${e}`:``;function Mt(e,t,n,r){return`https://github.com/${kt}/blob/${e}/${At(t)}${jt(n,r)}`}function Nt(e,t){return`https://github.com/${kt}/tree/${e}/${At(t)}`}function Pt(e,t,n,r){return`https://github.dev/${kt}/blob/${e}/${At(t)}${jt(n,r)}`}var Ft=`Opens in the GitHub web editor (github.dev, which redirects to vscode.dev). The line selection works only when you are signed in to GitHub; otherwise you land on a sign-in page.`;function It(e,t){return`https://raw.githubusercontent.com/${kt}/${e}/${At(t)}`}function Lt(e,t){return e===void 0?!0:e===`win`?t===`win32`:e===`unix`?t===`linux`||t===`darwin`:e===t}function Rt(e,t){let n,r=-1;for(let i of e){if(!Lt(i.os,t))continue;let e=i.os===void 0?1:i.os===`unix`?2:3;e>r&&(n=i,r=e)}return n}function zt(e,t,n){let r=Rt(t.ranges,n);if(r)return{github:Mt(e,r.path,r.start,r.end),githubDev:Pt(e,r.path,r.start,r.end),raw:It(e,r.path),range:r};if(t.file)return{github:Mt(e,t.file.path),githubDev:Pt(e,t.file.path),raw:It(e,t.file.path)};if(t.tree)return{github:Nt(e,t.tree)}}function Bt(e){let t=/^node:([a-z0-9_][a-z0-9_./-]*)$/i.exec(e);if(!t||t[1]===void 0||t[1].includes(`..`))return null;let n=t[1];return`lib/${n}${/\.(m?js|cjs)$/.test(n)?``:`.js`}`}var Vt={d:`dir`,f:`file`,s:`fn`},Ht=`o:world`;function Ut(e){let t={id:e.id,parent:e.p,kind:e.k,tier:e.t,title:e.n,rect:e.r,ranges:[]};return e.d!==void 0&&(t.desc=e.d),Array.isArray(e.loc)?t.ranges=e.loc:e.loc&&(t.tree=e.loc.tree),t}function Wt(e,t){let[n,r,i,a,o,s,c,l,u,d,f]=e,p={id:n,parent:r,kind:Vt[i]??`file`,tier:3,title:a,rect:[o,s,c,l],ranges:[],chunk:t};if(i===`s`&&u!==null&&d!==null?p.ranges=[{path:n.slice(2,n.indexOf(`#`)),start:u,end:d,sym:a}]:i===`f`?p.file={path:n.slice(2),lines:d}:i===`d`&&(p.tree=n.slice(n.indexOf(`:`,2)+1)),f!==void 0){p.variant=f;for(let e of p.ranges)e.cond=f}return p}var Gt=class{#e;#t;#n;#r=new Map;#i=new Map;#a=new Map;#o=new Map;#s;#c;#l;constructor(e){this.#e=e.fetchJson,this.#t=e.indexUrl??`index.json`}async load(){if(this.#n)return this.#n;let e=wt(await this.#e(this.#t));this.#n=e;for(let t of e.boxes)this.#u(Ut(t));return e}get index(){if(!this.#n)throw Error(`AtlasStore: call load() first`);return this.#n}get commit(){return this.index.node.commit}#u(e){if(this.#r.has(e.id))return;this.#r.set(e.id,e);let t=this.#i.get(e.parent);t?t.push(e.id):this.#i.set(e.parent,[e.id])}resolveAlias(e){let t=this.index.aliases,n=e;for(let e=0;e<16&&Object.hasOwn(t,n);e++)n=t[n];return n}getBox(e){return this.#r.get(this.resolveAlias(e))}async box(e){let t=this.resolveAlias(e),n=this.#r.get(t);if(n)return n;if(t.startsWith(`f:`)||t.startsWith(`s:`)){let e=t.startsWith(`f:`)?t.slice(2):t.slice(2,t.indexOf(`#`)),n=await this.#f(e);n&&await this.loadChunk(n.id)}else if(t.startsWith(`d:`)){let e=`o:${t.slice(2,t.indexOf(`:`,2))}`;for(let t of this.index.chunks)t.group===e&&await this.loadChunk(t.id)}return this.#r.get(t)}children(e){return(this.#i.get(e)??[]).map(e=>this.#r.get(e)).filter(e=>e!==void 0)}absRect(e){let t=this.resolveAlias(e),n=this.#a.get(t);if(n)return n;if(t===Ht)return{x:0,y:0,w:this.index.world.w,h:this.index.world.h};let r=this.#r.get(t);if(!r)return;let i=this.absRect(r.parent);if(!i)return;let[a,o,s,c]=r.rect,l={x:i.x+a/1e4*i.w,y:i.y+o/1e4*i.h,w:s/1e4*i.w,h:c/1e4*i.h};return this.#a.set(t,l),l}loadChunk(e){let t=this.#o.get(e);if(!t){let n=this.index.chunks.find(t=>t.id===e);if(!n)return Promise.reject(Error(`unknown chunk ${e}`));t=this.#e(n.url).then(e=>{let t=Tt(e,new Set(this.#r.keys()));if(t.id!==n.id||t.group!==n.group)throw Error(`chunk ${n.url} does not match the manifest`);for(let e of t.rows)this.#u(Wt(e,t.id));return t}),t.catch(()=>this.#o.delete(e)),this.#o.set(e,t)}return t}chunksInView(e){let t=[];for(let n of this.index.chunks){let r=this.absRect(n.group);if(!r)continue;let[i,a,o,s]=n.r,c={x:r.x+i/1e4*r.w,y:r.y+a/1e4*r.h,w:o/1e4*r.w,h:s/1e4*r.h};c.x<e.x+e.w&&c.x+c.w>e.x&&c.y<e.y+e.h&&c.y+c.h>e.y&&t.push(n)}return t}async loadInView(e){await Promise.all(this.chunksInView(e).map(e=>this.loadChunk(e.id)))}#d(){return this.#s??=this.#e(this.index.files).then(e=>{let t=Et(e,this.index.chunks.length);return new Map(t.files.map(([e,t,n])=>[e,[t,n]]))}),this.#s}async#f(e){let t=(await this.#d()).get(e);return t?this.index.chunks[t[0]]:void 0}async lineCount(e){return(await this.#d()).get(e)?.[1]}async locate(e,t){let n=await this.#f(e);if(!n)return;await this.loadChunk(n.id);let r=`f:${e}`,i,a=e=>{for(let n of this.children(e)){let e=n.ranges[0];!e||t<e.start||t>e.end||((!i||e.end-e.start<=i.ranges[0].end-i.ranges[0].start)&&(i=n),a(n.id))}};return a(r),i?i.id:this.#r.has(r)?r:void 0}async locateScript(e,t){let n=Bt(e);return n?this.locate(n,t):void 0}pickRange(e,t){return Rt(e.ranges,t)}links(e,t){return zt(this.commit,e,t)}async search(e,t=20){this.#c??=this.#e(this.index.search).then(e=>Dt(e).entries);let n=await this.#c,r=e.trim().toLowerCase();if(!r)return[];let i=[];for(let[e,t]of n){let n=e.toLowerCase(),a=n.indexOf(r);if(a<0)continue;let o=n.split(/::|\.|\//).pop()??n,s=n===r||o===r?0:o.startsWith(r)?1:a===0?2:3;i.push({id:t,label:e,score:s*1e4+n.length})}return i.sort((e,t)=>e.score-t.score||(e.label<t.label?-1:+(e.label>t.label))),i.slice(0,t)}edges(){return this.#l??=this.#e(this.index.edges).then(Ot),this.#l}boxesOfTier(e){return this.index.boxes.filter(t=>t.t===e).map(e=>this.#r.get(e.id))}},P={uvRun:{id:`o:loop.run`,meaning:`uv_run: the event loop. Runs due timers once, then turns: pending, idle, prepare, poll, pending again, check, close, timers.`},phaseTimers:{id:`o:phase.timers`,meaning:`Timers phase: uv__run_timers runs every libuv timer whose time has come (Node uses one for all JS timers).`},phasePending:{id:`o:phase.pending`,meaning:`Pending phase: callbacks deferred from the previous turn; on Windows, completed I/O requests run here.`},phaseIdle:{id:`o:phase.idle`,meaning:`Idle phase: idle handles; Node keeps one active while immediates are queued so poll does not block.`},phasePrepare:{id:`o:phase.prepare`,meaning:`Prepare phase: prepare handles, just before the loop waits for I/O.`},phasePoll:{id:`o:phase.poll`,meaning:`Poll phase: waits for I/O (epoll, kqueue or IOCP) up to the next timer and runs what is ready.`},phaseCheck:{id:`o:phase.check`,meaning:`Check phase: check handles; Node runs setImmediate callbacks here.`},phaseClosing:{id:`o:phase.close`,meaning:`Close phase: close callbacks of handles closed during this turn.`},loopTime:{id:`o:loop.updateTime`,meaning:`The loop clock: libuv reads the time once per turn; timers compare against this cached time.`},spinEventLoop:{id:`o:loop.spin`,meaning:`Node's loop driver: calls uv_run until there is no more work, then emits beforeExit.`},tickEnqueue:{id:`o:tick.nextTick`,meaning:`process.nextTick: pushes a callback onto the nextTick queue.`},tickDrain:{id:`o:tick.drain`,meaning:`processTicksAndRejections: runs the nextTick queue, then microtasks, until both are empty.`},runNextTicks:{id:`o:tick.runNextTicks`,meaning:`runNextTicks: drains nextTicks and microtasks between two timer or immediate callbacks.`},microtaskEnqueue:{id:`o:microtask.queueMicrotask`,meaning:`queueMicrotask: puts a callback on V8's microtask queue.`},microtaskCallback:{id:`o:microtask.runCallback`,meaning:`runMicrotask: the wrapper that runs a queueMicrotask callback with async_hooks before/after.`},microtaskCheckpoint:{id:`o:microtask.checkpoint`,meaning:`MicrotaskQueue::PerformCheckpoint: V8 runs all queued microtasks if it is not already doing so.`},microtaskDrain:{id:`o:microtask.run`,meaning:`MicrotaskQueue::RunMicrotasks: V8 runs every queued microtask (promise reactions, queueMicrotask callbacks).`},runMicrotasksBinding:{id:`o:microtask.binding`,meaning:`runMicrotasks(): the C++ binding processTicksAndRejections calls to make V8 drain the microtask queue.`},promiseThen:{id:`o:v8.promiseThen`,meaning:`Promise.prototype.then (V8 Torque builtin).`},performPromiseThen:{id:`o:v8.performPromiseThen`,meaning:`PerformPromiseThen: stores the reaction, or queues a reaction job at once if the promise is already settled.`},triggerPromiseReactions:{id:`o:v8.triggerReactions`,meaning:`TriggerPromiseReactions: when a promise settles, turns each stored reaction into a queued job.`},promiseReactionEnqueue:{id:`o:v8.enqueueMicrotask`,meaning:`EnqueueMicrotask builtin: where a promise reaction job (or any microtask) is appended to the microtask queue.`},runMicrotasksBuiltin:{id:`o:v8.runMicrotasksBuiltin`,meaning:`RunMicrotasks builtin: the loop inside V8 that takes jobs off the microtask queue.`},runSingleMicrotask:{id:`o:v8.runSingleMicrotask`,meaning:`RunSingleMicrotask: runs one job, dispatching on its kind (callable, promise reaction, ...).`},promiseReactionRun:{id:`o:v8.promiseReactionJob`,meaning:`PromiseReactionJob: runs a .then/.catch handler with the settled value and settles the derived promise.`},timerSet:{id:`o:timers.setTimeout`,meaning:`setTimeout: creates a Timeout and inserts it into the timer lists.`},setInterval:{id:`o:timers.setInterval`,meaning:`setInterval: a Timeout that is re-inserted after each run.`},timerInsert:{id:`o:timers.insert`,meaning:`insert: appends the timer to the list for its duration; a new earliest list reschedules the libuv timer.`},scheduleTimer:{id:`o:timers.scheduleTimer`,meaning:`Environment::ScheduleTimer: starts the single libuv timer for the earliest JS timer.`},timersNative:{id:`o:timers.runTimers`,meaning:`Environment::RunTimers: the libuv timer callback; calls processTimers in JS and reschedules.`},timersProcess:{id:`o:timers.processTimers`,meaning:`processTimers: walks the due timer lists in expiry order.`},listOnTimeout:{id:`o:timers.listOnTimeout`,meaning:`listOnTimeout: runs each due timer of one list; nextTicks and microtasks run between timers.`},uvRunTimers:{id:`o:phase.timers`,meaning:`uv__run_timers: libuv runs timers whose timeout is not later than the loop time.`},immediateSet:{id:`o:immediate.setImmediate`,meaning:`setImmediate: creates an Immediate and appends it to the immediate queue.`},immediateNative:{id:`o:immediate.check`,meaning:`Environment::CheckImmediate: the check-phase callback that calls processImmediate.`},immediateProcess:{id:`o:immediate.process`,meaning:`processImmediate: runs the queued immediates; nextTicks and microtasks run between them.`},toggleImmediateRef:{id:`o:immediate.toggleRef`,meaning:`Environment::ToggleImmediateRef: starts/stops an idle handle so poll does not block while immediates wait.`},poolQueueWork:{id:`o:pool.queue_work`,meaning:`uv_queue_work: the public "run this function on the thread pool" call.`},poolSubmit:{id:`o:pool.submit`,meaning:`uv__work_submit: queues work for the pool (starts the threads on first use).`},poolPost:{id:`o:pool.post`,meaning:`post: appends to the shared work queue and wakes an idle pool thread.`},poolWorker:{id:`o:pool.worker`,meaning:`worker: a pool thread; waits, runs one work item, posts the result back.`},poolDone:{id:`o:pool.done`,meaning:`uv__work_done: on the main thread, runs the after-work callbacks of finished items.`},poolWake:{id:`o:pool.asyncSend`,meaning:`uv_async_send: wakes the loop from another thread (eventfd/pipe on Unix, a completion packet on Windows).`},scheduleWork:{id:`o:cb.ScheduleWork`,meaning:`ThreadPoolWork::ScheduleWork: Node's wrapper around uv_queue_work for fs, crypto and zlib jobs.`},asyncWrapMakeCallback:{id:`o:cb.MakeCallback`,meaning:`AsyncWrap::MakeCallback: calls a JS callback for an async resource (async_hooks before/after).`},makeCallback:{id:`o:cb.InternalMakeCallback`,meaning:`InternalMakeCallback: opens a callback scope, calls the function, closes the scope.`},callbackScopeClose:{id:`o:cb.ScopeClose`,meaning:`InternalCallbackScope::Close: after a callback, runs microtasks or the nextTick drain.`},inspectorPause:{id:`o:inspector.pause`,meaning:`runMessageLoopOnPause: the main thread waits here while a breakpoint holds JavaScript.`},fsReadFile:{id:`o:fs.readFile`,meaning:`fs.readFile: small files in one thread-pool job (ReadFileJob), large ones in chunks.`},fsReadFileJobRun:{id:`o:fs.ReadFileJob.Run`,meaning:`ReadFileJob::Run: schedules the whole read on the thread pool.`},fsReadFileJobWork:{id:`o:fs.ReadFileJob.DoThreadPoolWork`,meaning:`ReadFileJob::DoThreadPoolWork: open, fstat, read, close on a pool thread.`},fsReadFileJobAfter:{id:`o:fs.ReadFileJob.AfterThreadPoolWork`,meaning:`ReadFileJob::AfterThreadPoolWork: builds the Buffer and calls back into JS.`},fsReqCallback:{id:`o:fs.reqCallback`,meaning:`FSReqCallback::Resolve: delivers the result of an async fs request to its JS callback.`},fsReqPromise:{id:`o:fs.reqPromise`,meaning:`FSReqPromise::Resolve: settles the promise of an fs/promises request.`},cryptoPbkdf2:{id:`o:crypto.pbkdf2`,meaning:`crypto.pbkdf2: creates a PBKDF2Job and runs it on the thread pool.`},cryptoRandomBytes:{id:`o:crypto.randomBytes`,meaning:`crypto.randomBytes: creates a RandomBytesJob and runs it on the thread pool.`},cryptoJobRun:{id:`o:crypto.jobRun`,meaning:`CryptoJob::Run: runs a crypto job now (sync) or schedules it on the thread pool (async).`},cryptoDeriveBitsWork:{id:`o:crypto.deriveBitsWork`,meaning:`DeriveBitsJob::DoThreadPoolWork: the pool-thread side of pbkdf2, randomBytes, scrypt, hkdf...`},cryptoPbkdf2DeriveBits:{id:`o:crypto.pbkdf2DeriveBits`,meaning:`PBKDF2Traits::DeriveBits: the PBKDF2 computation (OpenSSL) on a pool thread.`},cryptoRandomBytesDeriveBits:{id:`o:crypto.randomBytesDeriveBits`,meaning:`RandomBytesTraits::DeriveBits: fills the buffer with random bytes on a pool thread.`},cryptoJobAfter:{id:`o:crypto.jobAfter`,meaning:`CryptoJob::AfterThreadPoolWork: back on the main thread, calls job.ondone in JS.`},zlibProcessChunk:{id:`o:zlib.processChunk`,meaning:`processChunk: hands one chunk to the native zlib handle (async write).`},zlibWrite:{id:`o:zlib.write`,meaning:`CompressionStream::Write: queues compression work on the thread pool.`},zlibWork:{id:`o:zlib.work`,meaning:`ZlibContext::DoThreadPoolWork: runs deflate/inflate on a pool thread.`},zlibAfter:{id:`o:zlib.after`,meaning:`CompressionStream::AfterThreadPoolWork: back on the main thread, calls the JS write callback.`},dnsLookup:{id:`o:dns.lookup`,meaning:`dns.lookup: asks the OS resolver (getaddrinfo) on the thread pool, not c-ares.`},dnsGetAddrInfo:{id:`o:dns.getAddrInfo`,meaning:`GetAddrInfo (C++): starts uv_getaddrinfo with AfterGetAddrInfo as callback.`},uvGetaddrinfo:{id:`o:dns.uvGetaddrinfo`,meaning:`uv_getaddrinfo: queues the lookup as slow I/O work on the thread pool.`},getaddrinfoWork:{id:`o:dns.getaddrinfoWork`,meaning:`uv__getaddrinfo_work: calls the OS getaddrinfo on a pool thread.`},dnsAfterGetAddrInfo:{id:`o:dns.afterGetAddrInfo`,meaning:`AfterGetAddrInfo: back on the main thread, converts the addresses and calls oncomplete in JS.`},streamRead:{id:`o:net.streamRead`,meaning:`LibuvStreamWrap::OnUvRead: data arrived on a TCP socket, pipe or TTY; calls onread in JS.`},streamAfterWrite:{id:`o:net.afterWrite`,meaning:`LibuvStreamWrap::AfterUvWrite: a write finished; calls the write callback.`},streamAfterShutdown:{id:`o:net.afterShutdown`,meaning:`LibuvStreamWrap::AfterUvShutdown: the write side was shut down.`},onConnection:{id:`o:net.onConnection`,meaning:`ConnectionWrap::OnConnection: a server accepted a connection.`},afterConnect:{id:`o:net.afterConnect`,meaning:`ConnectionWrap::AfterConnect: an outgoing connect finished.`},udpRecv:{id:`o:net.udpRecv`,meaning:`UDPWrap::OnRecv: a datagram arrived.`},processExit:{id:`o:proc.onExit`,meaning:`ProcessWrap::OnExit: a child process exited.`},fsEvent:{id:`o:fs.watchEvent`,meaning:`FSEventWrap::OnEvent: fs.watch saw a change.`},statWatcher:{id:`o:fs.statWatcher`,meaning:`StatWatcher::Callback: fs.watchFile polled a changed stat.`},httpIncoming:{id:`o:http.incoming`,meaning:`IncomingMessage: a received HTTP request (server) or response (client).`},httpClientRequest:{id:`o:http.clientRequest`,meaning:`ClientRequest: an outgoing HTTP request.`},udpSendDone:{id:`o:net.udpSendDone`,meaning:`UDPWrap::OnSendDone: a datagram send finished; calls oncomplete in JS.`},dnsChannel:{id:`o:dns.channel`,meaning:`ChannelWrap::New: creates the c-ares resolver channel used by dns.resolve* and dns.Resolver.`},dnsQueryResponse:{id:`o:dns.queryResponse`,meaning:`QueryWrap::QueueResponseCallback: defers a c-ares answer with SetImmediate, so its callback runs in the check phase.`},nativeImmediatesRun:{id:`o:immediate.native`,meaning:`Environment::RunAndClearNativeImmediates: runs C++ SetImmediate callbacks (such as c-ares answers) from CheckImmediate.`},streamShutdownQueue:{id:`o:uv.shutdown`,meaning:`uv_shutdown: on Unix, with no writes pending, puts the stream on the pending queue (uv__io_feed); on Windows (TCP), queues a pending request.`},streamShutdownRun:{id:`o:uv.shutdownDone`,meaning:`Where the shutdown callback runs: uv__drain on Unix (from the pending phase), uv__process_tcp_shutdown_req on Windows (TCP).`},uvClose:{id:`o:loop.uvClose`,meaning:`uv_close: starts closing a handle; its close callback always runs later, in the close phase.`},closeCallbacks:{id:`o:loop.finishClose`,meaning:`Where a close callback runs: uv__finish_close (called by uv__run_closing_handles) on Unix, uv__process_endgames on Windows.`},handleOnClose:{id:`o:cb.handleOnClose`,meaning:`HandleWrap::OnClose: Node's close callback for every handle; calls the JS handle's onclose.`},streamFinished:{id:`o:streams.eos`,meaning:`eos (stream.finished): calls back once a stream has ended, finished or errored; used by pipeline.`},messagePortOnMessage:{id:`o:worker.onMessage`,meaning:`MessagePort::OnMessage: delivers queued messages from another thread to the JS listener of the port.`},workerExit:{id:`o:worker.onExit`,meaning:`Worker::JoinThread: after the worker thread stopped, calls onexit in the parent thread.`}},Kt={timers:P.phaseTimers.id,pending:P.phasePending.id,idle:P.phaseIdle.id,prepare:P.phasePrepare.id,poll:P.phasePoll.id,check:P.phaseCheck.id,closing:P.phaseClosing.id},qt={Timeout:{id:P.listOnTimeout.id,title:`setTimeout / setInterval timer`,meaning:`setTimeout / setInterval timer; its callback runs from listOnTimeout.`},Immediate:{id:P.immediateProcess.id,title:`setImmediate`,meaning:`setImmediate; its callback runs from processImmediate in the check phase.`},TickObject:{id:P.tickDrain.id,title:`process.nextTick`,meaning:`process.nextTick; its callback runs from processTicksAndRejections.`},PROMISE:{id:P.promiseReactionRun.id,title:`promise`,meaning:`A promise (reported while an async hook is enabled); its reactions run as microtasks.`},Microtask:{id:P.microtaskCallback.id,title:`queueMicrotask`,meaning:`queueMicrotask callback; runs from the microtask queue via runMicrotask.`},FSREQCALLBACK:{id:P.fsReqCallback.id,title:`fs request (callback)`,meaning:`Callback-style fs request. fs.readFile's ReadFileJob reports this type too (its callback comes from ReadFileJob::AfterThreadPoolWork).`},FSREQPROMISE:{id:P.fsReqPromise.id,title:`fs/promises request`,meaning:`fs/promises request.`},PBKDF2REQUEST:{id:P.cryptoJobAfter.id,title:`pbkdf2 request`,meaning:`crypto.pbkdf2 job; work in PBKDF2Traits::DeriveBits on the pool.`},RANDOMBYTESREQUEST:{id:P.cryptoJobAfter.id,title:`randomBytes request`,meaning:`crypto.randomBytes / randomFill job; work in RandomBytesTraits::DeriveBits on the pool.`},SCRYPTREQUEST:{id:P.cryptoJobAfter.id,title:`scrypt request`,meaning:`crypto.scrypt job on the pool.`},GETADDRINFOREQWRAP:{id:P.dnsAfterGetAddrInfo.id,title:`dns.lookup request`,meaning:`dns.lookup request; getaddrinfo runs on the pool.`},ZLIB:{id:P.zlibAfter.id,title:`zlib stream`,meaning:`zlib stream; each chunk is compressed on the pool.`},TCPWRAP:{id:P.streamRead.id,title:`TCP connection`,meaning:`TCP socket handle; reads arrive in the poll phase.`},TCPSERVERWRAP:{id:P.onConnection.id,title:`TCP server`,meaning:`TCP server handle; new connections arrive in the poll phase.`},TCPCONNECTWRAP:{id:P.afterConnect.id,title:`TCP connect request`,meaning:`Outgoing TCP connect request.`},PIPEWRAP:{id:P.streamRead.id,title:`pipe`,meaning:`Pipe handle (also stdio pipes).`},PIPECONNECTWRAP:{id:P.afterConnect.id,title:`pipe connect request`,meaning:`Outgoing pipe connect request.`},TTYWRAP:{id:P.streamRead.id,title:`terminal (TTY)`,meaning:`TTY handle (terminal stdio).`},WRITEWRAP:{id:P.streamAfterWrite.id,title:`stream write`,meaning:`A stream write request.`},SHUTDOWNWRAP:{id:P.streamAfterShutdown.id,title:`stream shutdown`,meaning:`A stream shutdown request; on Unix uv__drain runs its callback - in the pending phase when no write was waiting, else in poll after the last write.`},UDPWRAP:{id:P.udpRecv.id,title:`UDP socket`,meaning:`UDP socket handle.`},PROCESSWRAP:{id:P.processExit.id,title:`child process`,meaning:`Child process handle.`},FSEVENTWRAP:{id:P.fsEvent.id,title:`fs.watch watcher`,meaning:`fs.watch handle.`},STATWATCHER:{id:P.statWatcher.id,title:`fs.watchFile watcher`,meaning:`fs.watchFile handle.`},HTTPINCOMINGMESSAGE:{id:P.httpIncoming.id,title:`HTTP incoming message`,meaning:`HTTP incoming message (server request or client response).`},QUERYWRAP:{id:P.dnsQueryResponse.id,title:`DNS query (dns.resolve*)`,meaning:`A c-ares query; the answer is deferred with SetImmediate, so the callback runs in the check phase.`},DNSCHANNEL:{id:P.dnsChannel.id,title:`DNS resolver (c-ares)`,meaning:`The c-ares channel behind dns.resolve* and dns.Resolver; created when the dns module loads.`},PIPESERVERWRAP:{id:P.onConnection.id,title:`pipe server`,meaning:`Pipe (named pipe / Unix socket) server handle; new connections arrive in the poll phase.`},UDPSENDWRAP:{id:P.udpSendDone.id,title:`UDP send`,meaning:`A UDP send request.`},STREAM_END_OF_STREAM:{id:P.streamFinished.id,title:`stream finished callback`,meaning:`stream.finished / pipeline callback, bound to the context where it was registered.`},MESSAGEPORT:{id:P.messagePortOnMessage.id,title:`MessagePort (worker messages)`,meaning:`A message channel between threads; messages are delivered by MessagePort::OnMessage.`},WORKER:{id:P.workerExit.id,title:`worker thread`,meaning:`A worker_threads Worker as seen from the parent thread.`},HTTPCLIENTREQUEST:{id:P.httpClientRequest.id,title:`HTTP client request`,meaning:`HTTP client request.`}},Jt=Object.fromEntries(Object.entries(qt).map(([e,t])=>[e,t.id])),Yt={nextTick:`nextTick queue`,microtask:`Microtask queue`,timers:`Timers`,immediate:`Immediates`,pool:`Thread pool requests`,io:`Pending I/O`,close:`Close callbacks`},Xt={nextTick:`process.nextTick callbacks. Drained after the current callback, before promises.`,microtask:`Promise reactions and queueMicrotask callbacks (V8). Drained after the nextTick queue.`,timers:`setTimeout and setInterval. Run in the timers phase when their time has come.`,immediate:`setImmediate callbacks. Run in the check phase.`,pool:`Requests whose work runs on the libuv thread pool.`,io:`Requests and handles waiting on the operating system.`,close:`Handles waiting for their close callback.`},Zt={timers:`timers`,pending:`pending`,idle:`idle`,prepare:`prepare`,poll:`poll`,check:`check`,closing:`close`},Qt={hooks:`async_hooks`,trace:`trace events`,cdp:`debugger`,probe:`probe build`,helper:`helper`,rule:`rule`},$t={hooks:`Reported by async_hooks inside the program.`,trace:`Reported by Node's own trace events.`,cdp:`Reported by the JavaScript debugger (DevTools protocol).`,probe:`Reported by the probe build from inside libuv and Node.`,helper:`Reported by the nodejs-map helper process.`,rule:`Worked out by a rule from other events.`},en=new Intl.NumberFormat(`en`,{maximumFractionDigits:1,minimumFractionDigits:1}),tn=new Intl.NumberFormat(`en`,{maximumFractionDigits:3,minimumFractionDigits:3}),nn=new Intl.NumberFormat(`en`,{maximumFractionDigits:0});function rn(e){if(!Number.isFinite(e))return`-`;let t=Math.abs(e);return t<1e3?`${nn.format(e)} µs`:t<1e6?`${tn.format(e/1e3)} ms`:`${tn.format(e/1e6)} s`}function an(e){return Number.isFinite(e)?Math.abs(e)<1e3?`${en.format(e)} ms`:`${en.format(e/1e3)} s`:`-`}function on(e){return nn.format(e)}function sn(e,t,n=`${t}s`){return`${on(e)} ${e===1?t:n}`}function cn(e){let t=e.replace(/[?#].*$/,``).split(/[\\/]/);for(let e=t.length-1;e>=0;e--){let n=t[e];if(n)try{return decodeURIComponent(n)}catch{return n}}return e}function ln(e,t){return e===t||!e.startsWith(`node:`)&&cn(e)===cn(t)}function un(e,t=160){let n=``;for(let r of e){if(n.length>=t)return`${n}…`;let e=r.codePointAt(0);n+=r===`
|
|
3
|
+
`?`⏎`:r===` `?` `:e<32||e===127?`�`:r}return n}var dn={GETNAMEINFOREQWRAP:`dns.lookupService request`};function fn(e){let t=qt[e]?.title;if(t)return t;let n=dn[e];if(n)return n;let r=/^([A-Z0-9]{2,24})REQUEST$/.exec(e);return r&&r[1]?`${r[1].toLowerCase()} request`:null}function pn(e){let t=e.label?un(e.label,60):fn(e.type);return t?`${t} #${e.id} (${e.type})`:`${e.type} #${e.id}`}var mn=[`run`,`output`,`callbacks`,`queues`,`loop`,`timers`,`pool`,`items`,`debug`,`signals`],hn={run:`Run`,output:`Output`,callbacks:`Callbacks`,queues:`Queues`,loop:`Loop`,timers:`Timers`,pool:`Pool`,items:`Items`,debug:`Debugger`,signals:`Raw signals`},gn=Symbol.for(`preact-signals`);function _n(){if(Sn>1)Sn--;else{var e,t=!1;for((function(){var e=En;for(En=void 0;e!==void 0;){var t=e.S;if(t.v===e.v)for(var n=t.t;n!==void 0;n=n.x)n.i===e.i&&(n.i=t.i);e=e.o}})();xn!==void 0;){var n=xn;for(xn=void 0,Cn++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&An(n))try{n.c()}catch(n){t||=(e=n,!0)}n=r}}if(Cn=0,Sn--,t)throw e}}function vn(e){if(Sn>0)return e();Tn=++wn,Sn++;try{return e()}finally{_n()}}var yn,F=void 0;function bn(e){var t=F,n=yn;F=void 0,yn=void 0;try{return e()}finally{F=t,yn=n}}var xn=void 0,Sn=0,Cn=0,wn=0,Tn=0,En=void 0,Dn=0;function On(e){if(F!==void 0){var t=e.n;if(t===void 0||t.t!==F)return t={i:0,S:e,p:F.s,n:void 0,t:F,e:void 0,x:void 0,r:t},F.s!==void 0&&(F.s.n=t),F.s=t,e.n=t,32&F.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=F.s,t.n=void 0,F.s.n=t,F.s=t),t}}function kn(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}kn.prototype.brand=gn,kn.prototype.h=function(){return!0},kn.prototype.S=function(e){var t=this,n=this.t;n!==e&&e.e===void 0&&(e.x=n,this.t=e,n===void 0?bn(function(){var e;(e=t.W)==null||e.call(t)}):n.e=e)},kn.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,r=e.x;n!==void 0&&(n.x=r,e.e=void 0),r!==void 0&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,r===void 0&&bn(function(){var e;(e=t.Z)==null||e.call(t)}))}},kn.prototype.subscribe=function(e){var t=this;return Rn(function(){var n=t.value;bn(function(){return e(n)})},{name:`sub`})},kn.prototype.valueOf=function(){return this.value},kn.prototype.toString=function(){return this.value+``},kn.prototype.toJSON=function(){return this.value},kn.prototype.peek=function(){var e=this;return bn(function(){return e.value})},Object.defineProperty(kn.prototype,"value",{get:function(){var e=On(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Cn>100)throw Error(`Cycle detected`);(function(e){Sn!==0&&Cn===0&&e.l!==Tn&&(e.l=Tn,En={S:e,v:e.v,i:e.i,o:En})})(this),this.v=e,this.i++,Dn++,Sn++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{_n()}}}});function I(e,t){return new kn(e,t)}function An(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function jn(e){for(var t=e.s;t!==void 0;t=t.n){var n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function Mn(e){for(var t=e.s,n=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=n}function Nn(e,t){kn.call(this,void 0,t),this.x=e,this.s=void 0,this.g=Dn-1,this.f=4}Nn.prototype=new kn,Nn.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Dn))return!0;if(this.g=Dn,this.f|=1,this.i>0&&!An(this))return this.f&=-2,!0;var e=F;try{jn(this),F=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return F=e,Mn(this),this.f&=-2,!0},Nn.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}kn.prototype.S.call(this,e)},Nn.prototype.U=function(e){if(this.t!==void 0&&(kn.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}},Nn.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(Nn.prototype,"value",{get:function(){if(1&this.f)throw Error(`Cycle detected`);var e=On(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function L(e,t){return new Nn(e,t)}function Pn(e){var t=e.j;if(e.j=void 0,typeof t==`function`){Sn++;var n=F;F=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,Fn(e),t}finally{F=n,_n()}}}function Fn(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Pn(e)}function In(e){if(F!==this)throw Error(`Out-of-order effect`);Mn(this),F=e,this.f&=-2;try{8&this.f&&Fn(this)}finally{_n()}}function Ln(e,t){this.x=e,this.j=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,yn&&yn.push(this)}Ln.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t==`function`&&(this.j=t)}finally{e()}},Ln.prototype.S=function(){if(1&this.f)throw Error(`Cycle detected`);this.f|=1,this.f&=-9,Pn(this),jn(this),Sn++;var e=F;return F=this,In.bind(this,e)},Ln.prototype.N=function(){2&this.f||(this.f|=2,this.u=xn,xn=this)},Ln.prototype.d=function(){this.f|=8,1&this.f||Fn(this)},Ln.prototype.dispose=function(){this.d()};function Rn(e,t){var n=new Ln(e,t);try{n.c()}catch(e){throw n.d(),e}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var zn,Bn,Vn,Hn=typeof window<`u`&&!!window.__PREACT_SIGNALS_DEVTOOLS__,Un=[],Wn=[];Rn(function(){zn=this.N})();function Gn(t,n){e[t]=n.bind(null,e[t]||function(){})}function Kn(e){if(Vn){var t=Vn;Vn=void 0,t()}Vn=e&&e.S()}function qn(e){var t=this,r=e.data,i=Yn(r);i.name=`ReactiveDom`,i.value=r;var a=Fe(function(){for(var e=t,r=t.__v;r=r.__;)if(r.__c){r.__c.__$f|=4;break}var a=L(function(){var e=i.value.value;return e===0?0:!0===e?``:e||``}),o=L(function(){return!Array.isArray(a.value)&&!n(a.value)}),s=Rn(function(){if(this.N=tr,o.value){var t=a.value;e.__v&&e.__v.__e&&e.__v.__e.nodeType===3&&(e.__v.__e.data=t)}}),c=t.__$u.d;return t.__$u.d=function(){s(),c.call(this)},[o,a]},[]),o=a[0],s=a[1];return o.value?s.peek():s.value}qn.displayName=`ReactiveTextNode`,Object.defineProperties(kn.prototype,{constructor:{configurable:!0,value:y(x,null).constructor},type:{configurable:!0,value:qn},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}}),Gn(`__b`,function(e,t){if(Kn(),Bn=void 0,typeof t.type==`string`){var n,r=t.props;for(var i in r)if(i!==`children`){var a=r[i];a instanceof kn&&(n||(t.__np=n={}),n[i]=a,r[i]=a.peek())}}e(t)}),Gn(`__r`,function(e,t){if(e(t),t.type!==x){Kn();var n,r=t.__c;r&&(r.__$f&=-2,(n=r.__$u)===void 0&&(r.__$u=n=function(e,t){var n;return Rn(function(){n=this},{name:t}),n.c=e,n}(function(e){return function(){var t;Hn&&((t=this.y)==null||t.call(this)),e.__$f|=1,e.setState({})}}(r),typeof t.type==`function`?t.type.displayName||t.type.name:``))),Bn=r,Kn(n)}}),Gn(`__e`,function(e,t,n,r){Kn(),Bn=void 0,e(t,n,r)}),Gn(`diffed`,function(e,t){Kn(),Bn=void 0;var n;if(typeof t.type==`string`&&(n=t.__e)){var r=t.__np,i=t.props,a=n.U;if(a)for(var o in a){var s=a[o];s===void 0||r&&o in r||(s.d(),a[o]=void 0)}if(r)for(var c in a||(a={},n.U=a),r){var l=a[c],u=r[c];l===void 0?(l=Jn(n,c,u,i),a[c]=l):l.o(u,i)}}e(t)});function Jn(e,t,n,r){var i=t in e&&e.ownerSVGElement===void 0,a=I(n);return{o:function(e,t){a.value=e,r=t},d:Rn(function(){this.N=tr;var n=a.value.value;r[t]!==n&&(r[t]=n,i?e[t]=n:n!=null&&(!1!==n||t[4]===`-`)?e.setAttribute(t,n):e.removeAttribute(t))})}}Gn(`unmount`,function(e,t){if(typeof t.type==`string`){var n=t.__e;if(n){var r=n.U;if(r)for(var i in n.U=void 0,r){var a=r[i];a&&a.d()}}var o=t.__np;if(o){var s=t.props;for(var c in o)s[c]=o[c]}t.__np=void 0}else{var l=t.__c;if(l){l.__$f|=8;var u=l.__$u;u&&(l.__$u=void 0,u.d())}}e(t)}),Gn(`__h`,function(e,t,n,r){r<3&&(t.__$f|=2),e(t,n,r)}),S.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var n=this.__$u,r=n&&n.s!==void 0;for(var i in t)return!0;if(this.__f||typeof this.u==`boolean`&&!0===this.u){var a=2&this.__$f;if(!(r||a||4&this.__$f)||1&this.__$f)return!0}else if(!(r||4&this.__$f)||3&this.__$f)return!0;for(var o in e)if(o!==`__source`&&e[o]!==this.props[o])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};function Yn(e,t){return Fe(function(){return I(e,t)},[])}var Xn=typeof requestAnimationFrame>`u`?setTimeout:function(e){var t=function(){clearTimeout(n),cancelAnimationFrame(r),e()},n=setTimeout(t,35),r=requestAnimationFrame(t)},Zn=function(e){queueMicrotask(function(){queueMicrotask(e)})};function Qn(){vn(function(){for(var e;e=Un.shift();)zn.call(e)})}function $n(){Un.push(this)===1&&(e.requestAnimationFrame||Xn)(Qn)}function er(){vn(function(){for(var e;e=Wn.shift();)zn.call(e)})}function tr(){Wn.push(this)===1&&(e.requestAnimationFrame||Zn)(er)}function nr(e,t){var n=j(e);n.current=e;var r=Bn;A(function(){return Rn(function(){if(this.N=$n,!(r&&8&r.__$f))return n.current()},t)},[])}var rr=[`cb.nextTick`,`cb.microtask`,`cb.timers`,`cb.immediate`,`cb.pool`,`cb.io`,`cb.close`,`cb.other`,`stdout`,`stderr`,`pause`,`pool`,`note`],ir=[null,`timers`,`pending`,`idle`,`prepare`,`poll`,`check`,`closing`],ar=[null,`observed`,`inferred`,`model`],or=e=>Object.assign(Object.create(null),e);or({nextTick:0,microtask:1,timers:2,immediate:3,pool:4,io:5,close:6}),or({timers:1,pending:2,idle:3,prepare:4,poll:5,check:6,closing:7});var sr=class extends Error{line;constructor(e,t){super(t===void 0?e:`line ${t}: ${e}`),this.name=`RecordingError`,this.line=t}},cr={text:1e6,name:512,frames:200,args:32,sources:64};function lr(e,t){throw new sr(`${e}: ${t}`)}var ur=e=>(t,n)=>(typeof t!=`string`&&lr(n,`must be a string`),t.length>e&&lr(n,`string longer than ${e}`),t),R=ur(cr.name),dr=ur(cr.text),fr=(e,t)=>(typeof e==`number`&&Number.isFinite(e)||lr(t,`must be a finite number`),e),pr=(e,t)=>(fr(e,t),e<0&&lr(t,`must not be negative`),e),mr=(e,t)=>(typeof e==`number`&&Number.isSafeInteger(e)||lr(t,`must be an integer`),e),hr=(e,t)=>((typeof e!=`number`||!Number.isInteger(e)||e<1||e>1024)&&lr(t,`must be a whole number from 1 to 1024`),e),z=(e,t)=>(mr(e,t),e<0&&lr(t,`must not be negative`),e),gr=(e,t)=>(typeof e!=`boolean`&&lr(t,`must be true or false`),e),B=(...e)=>(t,n)=>(typeof t==`string`&&e.includes(t)||lr(n,`must be one of ${e.join(`, `)}`),t),_r=e=>(t,n)=>t===null?null:e(t,n),V=e=>({check:e}),H=e=>({check:e,optional:!0});function vr(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function yr(e,t,n,r){vr(t)||lr(n,`must be an object`);let i={};for(let i of Object.keys(t))!Object.hasOwn(e,i)&&!(r&&r.has(i))&&lr(n,`unknown field "${i}"`);for(let r of Object.keys(e)){let a=e[r],o=Object.hasOwn(t,r)?t[r]:void 0;o===void 0?a.optional||lr(n,`missing field "${r}"`):i[r]=a.check(o,n===``?r:`${n}.${r}`)}return i}var br=e=>(t,n)=>yr(e,t,n),xr={url:V(R),line:V(z),col:H(z)},Sr={fn:V(R),loc:V(br(xr)),origin:V(B(`user`,`node`,`other`)),at:H(R)},Cr={version:V(R),v8:V(R),uv:V(R),platform:V(R),arch:V(R)},wr=B(`observed`,`inferred`,`model`),Tr={provider:V(B(`user`,`pinned`,`probe`)),jsDebugger:V(gr),asyncItems:V(gr),poolThreads:V(B(`delayed`,`live`,`none`)),phasesTimersCheck:V(B(`observed`,`inferred`,`model`,`none`)),phasesOther:V(B(`observed`,`inferred`,`model`,`none`)),gates:V(br({phase:V(gr),timer:V(gr),poolStart:V(gr),poolPost:V(gr)})),frozenClock:V(gr)},Er=B(`timers`,`pending`,`idle`,`prepare`,`poll`,`check`,`closing`),Dr=B(`nextTick`,`microtask`,`timers`,`immediate`,`pool`,`io`,`close`),Or=(e,t)=>(Array.isArray(e)||lr(t,`must be a list`),e.length>cr.frames&&lr(t,`more than ${cr.frames} frames`),e.map((e,n)=>yr(Sr,e,`${t}[${n}]`))),kr=(e,t)=>{vr(e)||lr(t,`must be an object`);let n=Object.keys(e);n.length>cr.args&&lr(t,`more than ${cr.args} keys`);let r=Object.create(null);for(let i of n){i.length>cr.name&&lr(t,`key too long`);let n=e[i];n===null||typeof n==`boolean`||typeof n==`number`&&Number.isFinite(n)||typeof n==`string`&&n.length<=cr.text?r[i]=n:lr(`${t}.${i}`,`must be a string, a finite number, true, false or null`)}return Object.assign({},r)},Ar={k:V(R),t:V(fr),tq:H(B(`approx`,`tie`)),src:V(B(`hooks`,`trace`,`cdp`,`probe`,`helper`,`rule`)),c:V(wr),rule:H(ur(32)),at:H(R),tid:H(z)},jr={"run.start":{node:V(br(Cr)),caps:V(br(Tr)),mode:V(B(`free`,`debug`)),program:V(R),poolSize:V(z)},"run.end":{code:V(_r(mr)),signal:V(_r(R))},output:{stream:V(B(`stdout`,`stderr`)),text:V(dr)},"item.new":{id:V(z),type:V(R),trigger:V(z),label:H(R),loc:H(br(xr))},"callback.start":{id:V(z),type:V(R),close:H(gr)},"callback.end":{id:V(z)},"item.gone":{id:V(z)},"promise.settled":{id:V(z)},"timer.set":{id:V(z),delayMs:V(pr),repeat:V(gr)},"loop.sample":{loopCount:V(z),events:V(z),eventsWaiting:V(z)},scope:{name:V(R),durUs:V(pr)},"pool.thread":{edge:V(B(`start`,`end`)),name:V(R)},signal:{cat:V(R),name:V(R),ph:V(ur(8)),ref:H(R),args:H(kr)},"queue.add":{queue:V(Dr),id:V(z)},"queue.remove":{queue:V(Dr),id:V(z),why:V(B(`cancel`,`gone`))},"loop.turn":{n:V(z)},"phase.enter":{phase:V(Er),turn:H(z),afterPoll:H(gr),pollTimeoutMs:H(fr)},"phase.leave":{phase:V(Er),turn:H(z),afterPoll:H(gr)},"timer.fired":{lateMs:H(fr)},"pool.queued":{job:V(R),kind:V(B(`fs`,`dns`,`crypto`,`zlib`,`user`,`unknown`)),op:H(R),id:H(z)},"pool.started":{job:V(R),thread:V(z)},"pool.finished":{job:V(R),thread:V(z)},"pool.posted":{job:V(R),thread:V(z)},"pool.delivered":{job:V(R)},"pool.cancelled":{job:V(R)},"pool.link":{job:V(R),id:V(z)},"pool.size":{size:V(hr)},"debug.paused":{reason:V(B(`breakpoint`,`step`,`pause`,`exception`,`entry`,`other`)),frames:V(Or),timeKeptRunning:V(gr)},"debug.resumed":{pausedMs:V(pr)},"gate.stopped":{gate:V(B(`phase`,`turn`,`timer`,`poolStart`,`poolPost`,`poolDone`,`manual`)),phase:H(Er),job:H(R)},"gate.released":{stoppedMs:V(pr)},"clock.frozen":{why:H(B(`gate`,`breakpoint`))},"clock.unfrozen":{hiddenMs:V(pr)},note:{level:V(B(`info`,`warn`)),text:V(ur(2e3))}};new Set(Object.keys(jr));var Mr=new Map;for(let e of Object.keys(jr))Mr.set(e,{...Ar,...jr[e]});var U={callbackScopeCtor:`o:cb.InternalMakeCallback`,callbackScopeClose:`s:src/api/callback.cc#node::InternalCallbackScope::Close`,runTimers:`s:src/env.cc#node::Environment::RunTimers`,scheduleTimer:`s:src/env.cc#node::Environment::ScheduleTimer`,checkImmediate:`s:src/env.cc#node::Environment::CheckImmediate`,toggleImmediateRef:`s:src/env.cc#node::Environment::ToggleImmediateRef`,uvRunTimers:`s:deps/uv/src/timer.c#uv__run_timers`,processTimers:`s:lib/internal/timers.js#getTimerCallbacks/processTimers`,listOnTimeout:`o:timers.listOnTimeout`,processImmediate:`s:lib/internal/timers.js#getTimerCallbacks/processImmediate`,timeoutCtor:`s:lib/internal/timers.js#Timeout.prototype.constructor`,immediateCtor:`s:lib/internal/timers.js#Immediate.prototype.constructor`,timerInsert:`s:lib/internal/timers.js#insert`,nextTick:`s:lib/internal/process/task_queues.js#nextTick`,processTicks:`s:lib/internal/process/task_queues.js#processTicksAndRejections`,queueMicrotask:`s:lib/internal/process/task_queues.js#queueMicrotask`,runMicrotask:`s:lib/internal/process/task_queues.js#runMicrotask`,promiseInitHook:`s:lib/internal/async_hooks.js#promiseInitHook`,promiseBeforeHook:`s:lib/internal/async_hooks.js#promiseBeforeHook`,uvRunUnix:`s:deps/uv/src/unix/core.c#uv_run`,uvRunWin:`s:deps/uv/src/win/core.c#uv_run`,uvPollWin:`s:deps/uv/src/win/core.c#uv__poll`,uvProcessReqs:`s:deps/uv/src/win/core.c#uv__process_reqs`,uvIoPollLinux:`s:deps/uv/src/unix/linux.c#uv__io_poll`,uvAsyncIo:`s:deps/uv/src/unix/async.c#uv__async_io`,uvAsyncWakeupWin:`s:deps/uv/src/win/async.c#uv__process_async_wakeup_req`,worker:`s:deps/uv/src/threadpool.c#worker`,post:`s:deps/uv/src/threadpool.c#post`,workSubmit:`s:deps/uv/src/threadpool.c#uv__work_submit`,workDone:`s:deps/uv/src/threadpool.c#uv__work_done`,initThreads:`s:deps/uv/src/threadpool.c#init_threads`,scheduleWork:`s:src/threadpoolwork-inl.h#node::ThreadPoolWork::ScheduleWork`,fsWorkUnix:`s:deps/uv/src/unix/fs.c#uv__fs_work`,fsWorkWin:`s:deps/uv/src/win/fs.c#uv__fs_work`,getaddrinfoUnix:`s:deps/uv/src/unix/getaddrinfo.c#uv_getaddrinfo`,getaddrinfoWin:`s:deps/uv/src/win/getaddrinfo.c#uv_getaddrinfo`,uvMetricsInfo:`s:src/node_perf.cc#node::performance::UvMetricsInfo`,queryResponse:`s:src/cares_wrap.h#node::cares_wrap::QueryWrap::QueueResponseCallback`,handleOnClose:`s:src/handle_wrap.cc#node::HandleWrap::OnClose`,closingUnix:`s:deps/uv/src/unix/core.c#uv__run_closing_handles`,closingWin:`s:deps/uv/src/win/core.c#uv__process_endgames`,ioFeed:`s:deps/uv/src/unix/core.c#uv__io_feed`,runPending:`s:deps/uv/src/unix/core.c#uv__run_pending`,streamIo:`s:deps/uv/src/unix/stream.c#uv__stream_io`,writeReqFinish:`s:deps/uv/src/unix/stream.c#uv__write_req_finish`,shutdownUnix:`s:deps/uv/src/unix/stream.c#uv_shutdown`},W={phaseTimers:`o:phase.timers`,phasePending:`o:phase.pending`,phasePoll:`o:phase.poll`,phaseCheck:`o:phase.check`,tickDrain:`o:tick.drain`,microtaskDrain:`o:microtask.run`,promiseReactionEnqueue:`o:v8.enqueueMicrotask`,promiseReactionRun:`o:v8.promiseReactionJob`,performPromiseThen:`o:v8.performPromiseThen`,triggerReactions:`o:v8.triggerReactions`,poolSubmit:`o:pool.submit`,poolWorker:`o:pool.worker`,poolDone:`o:pool.done`,makeCallback:`o:cb.InternalMakeCallback`,uvRun:`o:loop.run`,dnsQueryResponse:`o:dns.queryResponse`,nativeImmediatesRun:`o:immediate.native`,shutdownQueue:`o:uv.shutdown`,shutdownRun:`o:uv.shutdownDone`,closeCallbacks:`o:loop.finishClose`,handleOnClose:`o:cb.handleOnClose`},Nr=[{id:`C0`,title:`A callback started or ended`,statement:`Node calls the async_hooks "before" hook just before it runs the JavaScript callback of an async item and "after" when the callback has returned. We report these two moments as they are.`,yields:`observed`,platform:`all`,cites:[U.callbackScopeCtor,U.callbackScopeClose,U.listOnTimeout,U.processImmediate,U.processTicks]},{id:`T0`,title:`The timers phase ran timer callbacks`,statement:`Node reports a timed scope named RunTimers each time libuv's timers step calls Node's one timer. From its start to its end the loop is in the timers phase and is running due setTimeout and setInterval callbacks.`,yields:`observed`,platform:`all`,cites:[U.runTimers,U.uvRunTimers,U.scheduleTimer,W.phaseTimers]},{id:`T1`,title:`A timer callback implies the timers phase`,statement:`A callback of an item of type Timeout started and no RunTimers scope has been reported for that moment (trace events arrive later than hooks). Timeout callbacks are only ever run by processTimers, which libuv calls in its timers step, so the loop is in the timers phase.`,yields:`inferred`,platform:`all`,cites:[U.processTimers,U.listOnTimeout,U.runTimers,W.phaseTimers]},{id:`T2`,title:`A timer callback inside a reported timers scope`,statement:`A Timeout callback started between the start and the end of a RunTimers scope that Node reported. Both facts are observed, so this callback ran in the timers phase.`,yields:`observed`,platform:`all`,cites:[U.runTimers,U.listOnTimeout]},{id:`I0`,title:`The check phase ran`,statement:`Node reports a timed scope named CheckImmediate from the callback of a libuv check handle that is always active. It runs once in every loop turn, in the check phase, whether or not the program used setImmediate.`,yields:`observed`,platform:`all`,cites:[U.checkImmediate,W.phaseCheck]},{id:`I1`,title:`An immediate callback implies the check phase`,statement:`A callback of an item of type Immediate started and no CheckImmediate scope has been reported for that moment. Immediate callbacks are only run by processImmediate, which Node calls from the check phase.`,yields:`inferred`,platform:`all`,cites:[U.processImmediate,U.checkImmediate,W.phaseCheck]},{id:`I2`,title:`An immediate callback inside a reported check scope`,statement:`An Immediate callback started between the start and the end of a CheckImmediate scope that Node reported.`,yields:`observed`,platform:`all`,cites:[U.checkImmediate,U.processImmediate]},{id:`P1u`,title:`A thread pool result is delivered inside the poll step (Linux, macOS)`,statement:`A callback of a thread-pool-backed item (file system, dns.lookup, crypto, zlib) started outside the timers and check phases. On Unix a finished job wakes the loop through an async handle, and libuv runs the callback from uv__io_poll, so the loop is in the poll phase.`,yields:`inferred`,platform:`unix`,cites:[U.uvRunUnix,U.uvIoPollLinux,U.uvAsyncIo,U.workDone,W.phasePoll]},{id:`P1w`,title:`A thread pool result is delivered after the poll step (Windows)`,statement:`A callback of a thread-pool-backed item started outside the timers and check phases. On Windows uv__poll only collects finished requests; their callbacks run in uv__process_reqs, which uv_run calls right after the poll and again at the top of the next turn. We show this as the pending step.`,yields:`inferred`,platform:`win32`,cites:[U.uvRunWin,U.uvPollWin,U.uvProcessReqs,U.uvAsyncWakeupWin,U.workDone,W.phasePending]},{id:`P2`,title:`A handle callback that is not its close callback is delivered by the poll step`,statement:`A callback of a handle (TCP socket or server, pipe, terminal, UDP socket, child process, signal, file watcher) started outside the timers and check phases, and the helper saw that it is not the handle's close callback (rule CL1). Data, connections and other events of a handle are read in the poll step: on Unix libuv calls back from there; on Windows uv__poll only collects them and the callbacks run in uv__process_reqs right after, which we show as the pending step after the poll. On Windows the same holds for write, shutdown, connect and send requests. No phase is inferred, rather than a wrong one, in these cases: write, shutdown, connect and send requests on Unix (libuv finishes them from uv__stream_io in the poll step when data was still waiting to be written, and otherwise queues the stream with uv__io_feed so that the callback runs in a pending pass: a shutdown with no write waiting runs in the pending step, one behind queued writes in the poll step, and the type does not say which); message ports and every other kind of item, whose callbacks can be made from several steps; a handle whose close state the helper could not read.`,yields:`inferred`,platform:`all`,cites:[U.uvRunUnix,U.uvRunWin,U.uvProcessReqs,U.streamIo,U.ioFeed,U.runPending,U.writeReqFinish,U.shutdownUnix,W.shutdownQueue,W.shutdownRun,W.phasePoll,W.phasePending]},{id:`CL1`,title:`A handle's close callback runs in the closing step`,statement:`A callback of a handle started, and the handle object carries the property Node sets when close(callback) is called (handle_onclose). After close() the handle gets no other callback, so this one is the close callback: libuv makes it in the closing step at the end of the turn (uv__run_closing_handles on Unix, uv__process_endgames on Windows), and Node passes it on from HandleWrap::OnClose.`,yields:`inferred`,platform:`all`,cites:[U.handleOnClose,U.closingUnix,U.closingWin,U.uvRunUnix,U.uvRunWin,W.handleOnClose,W.closeCallbacks]},{id:`I3`,title:`A dns.resolve answer is delivered in the check phase`,statement:`A callback of a QUERYWRAP item (dns.resolve and its relatives, answered by c-ares) started outside a reported scope. Node does not call back when the answer arrives on the socket: QueryWrap::QueueResponseCallback defers it with SetImmediate, so it runs with the native immediates in the check phase, on every system.`,yields:`inferred`,platform:`all`,cites:[U.queryResponse,U.checkImmediate,W.dnsQueryResponse,W.nativeImmediatesRun,W.phaseCheck]},{id:`K1`,title:`A nextTick callback ran from the tick queue`,statement:`A callback of an item of type TickObject started. process.nextTick creates exactly one TickObject per call and processTicksAndRejections runs them in order when the current callback scope closes, before the loop continues.`,yields:`inferred`,platform:`all`,cites:[U.nextTick,U.processTicks,U.callbackScopeClose,W.tickDrain]},{id:`M1`,title:`A microtask ran`,statement:`A callback of an item of type PROMISE or Microtask started. Promise reactions and queueMicrotask callbacks are jobs on V8's microtask queue, drained after the nextTick queue and whenever a callback scope closes.`,yields:`inferred`,platform:`all`,cites:[U.promiseBeforeHook,U.runMicrotask,U.processTicks,U.callbackScopeClose,W.microtaskDrain,W.promiseReactionRun]},{id:`L1`,title:`Loop counters`,statement:`performance.nodeTiming.uvMetricsInfo returns libuv's own counters. loopCount is increased once per turn, just before the poll step. We read it when a top-level callback starts, so the value is exact but the moment a turn began is not known from it.`,yields:`observed`,platform:`all`,cites:[U.uvMetricsInfo,U.uvRunUnix,U.uvRunWin]},{id:`L2`,title:`Loop turns from the check phase`,statement:`CheckImmediate is reported once per loop turn (rule I0). The timers step that follows it belongs to the same turn. The first callback or scope after that starts the next turn; we place the turn boundary there.`,yields:`inferred`,platform:`all`,cites:[U.checkImmediate,U.uvRunUnix,U.uvRunWin,W.uvRun]},{id:`L3`,title:`Loop turns from the loop counter`,statement:`The loop counter read when a callback starts (rule L1) is higher than at the previous callback, so at least one new turn began in between. Until trace events arrive we place the turn boundary at this callback. Turns in which no callback of ours ran are skipped.`,yields:`inferred`,platform:`all`,cites:[U.uvMetricsInfo,U.uvRunUnix,U.uvRunWin,W.uvRun]},{id:`W0`,title:`A job was submitted to, or came back from, the thread pool`,statement:`Node's ThreadPoolWork reports a trace event with the job's address when it submits work to libuv and another when the result is delivered on the main thread.`,yields:`observed`,platform:`all`,cites:[U.scheduleWork,U.workSubmit,U.workDone,W.poolSubmit,W.poolDone]},{id:`W1`,title:`Which async item a pool job belongs to`,statement:`The trace event for a submitted job follows the creation of an async item of a thread-pool-backed type on the main thread, in the same synchronous call. We take that item as the owner of the job. The trace event itself carries no async id.`,yields:`inferred`,platform:`all`,cites:[U.scheduleWork,U.workSubmit]},{id:`W2`,title:`A pool thread started a job`,statement:`Node's ThreadPoolWork reports a trace event from the pool thread when the work function begins. The event carries the real thread id and the kind of job, but not which job.`,yields:`observed`,platform:`all`,cites:[U.scheduleWork,U.worker,W.poolWorker]},{id:`W2b`,title:`Which job a pool thread started`,statement:`libuv keeps one first-in first-out work queue for all pool threads. The n-th "started" report for a kind of job is therefore the n-th submitted job of that kind. Two threads that take jobs within the same microsecond can report in swapped order.`,yields:`inferred`,platform:`all`,cites:[U.worker,U.post,U.workSubmit]},{id:`W3`,title:`A pool thread finished a job`,statement:`The pool thread reports a trace event when the work function returns. The thread and the time are observed; the job is the one that thread started (rule W2b).`,yields:`inferred`,platform:`all`,cites:[U.scheduleWork,U.worker]},{id:`W4`,title:`The result of a pool job was delivered`,statement:`The pool thread appends the finished job to the loop's done queue and wakes the loop; uv__work_done runs the after-work callbacks on the main thread in that order. The "result delivered" trace event with the job's address marks this, and the callback of the owning item follows.`,yields:`inferred`,platform:`all`,cites:[U.worker,U.workDone,W.poolDone]},{id:`W5`,title:`A job is waiting for a free pool thread`,statement:`A job was submitted while as many jobs as the pool has threads were running. It waits in the queue. This count is incomplete: file system requests and dns.lookup hold pool threads without reporting from them, and dns.lookup may use at most half of the threads.`,yields:`inferred`,platform:`all`,cites:[U.worker,U.post,U.initThreads]},{id:`W6`,title:`File system requests and dns.lookup use the pool without thread reports`,statement:`Classic file system requests and dns.lookup are handed to the pool by libuv itself, not through ThreadPoolWork. Node reports their start and end on the main thread only. We show them as queued pool work; which thread ran them, and when, is not available on an official build.`,yields:`inferred`,platform:`all`,cites:[U.fsWorkUnix,U.fsWorkWin,U.getaddrinfoUnix,U.getaddrinfoWin,U.workSubmit]},{id:`X1`,title:`The first use of the thread pool blocks the main thread`,statement:`The pool threads are created on the first submission, and the submitting thread waits until all of them have started. A gap on the main thread right after the first submission is this wait.`,yields:`inferred`,platform:`all`,cites:[U.workSubmit,U.initThreads]},{id:`W7`,title:`The pool size is read when the pool is first used`,statement:`libuv creates the pool threads at the first submission and reads UV_THREADPOOL_SIZE only then (no value: 4 threads; 0 or text that is not a number: 1; at most 1024). A program can therefore still set the variable before its first pool request. The helper reads the variable when the first thread-pool-backed async item is created and reports the size when it differs from the one the run started with. A use of the pool that creates no such item (a native add-on, a worker thread) is not seen.`,yields:`inferred`,platform:`all`,cites:[U.initThreads,U.workSubmit]},{id:`G1`,title:`Thread reports are missing for a pool job`,statement:`Every ThreadPoolWork job reports one start and one end from its pool thread. When a job was submitted and delivered but one of the two reports is absent, it was dropped while trace events were being read from the target. The job ran; its thread or times are not known.`,yields:`inferred`,platform:`all`,cites:[U.scheduleWork]},{id:`QT`,title:`A new Timeout waits in the timer lists`,statement:`An async item of type Timeout was created. setTimeout and setInterval construct a Timeout and insert it into the timer lists in the same call, so the item is waiting in the timers queue.`,yields:`inferred`,platform:`all`,cites:[U.timeoutCtor,U.timerInsert]},{id:`QT2`,title:`A repeating timer waits again after it ran`,statement:`The callback of a Timeout created by setInterval returned and the timer was not cleared. listOnTimeout inserts a repeating timer again after each run.`,yields:`inferred`,platform:`all`,cites:[U.listOnTimeout,U.timerInsert]},{id:`QI`,title:`A new Immediate waits in the immediate queue`,statement:`An async item of type Immediate was created. The Immediate constructor appends itself to the immediate queue.`,yields:`inferred`,platform:`all`,cites:[U.immediateCtor,U.processImmediate,U.toggleImmediateRef]},{id:`QK`,title:`A new TickObject waits in the nextTick queue`,statement:`An async item of type TickObject was created. process.nextTick pushes exactly one TickObject onto the tick queue per call.`,yields:`inferred`,platform:`all`,cites:[U.nextTick]},{id:`QM`,title:`A queueMicrotask callback waits in the microtask queue`,statement:`An async item of type Microtask was created. queueMicrotask creates it and enqueues the callback on V8's microtask queue in the same call.`,yields:`inferred`,platform:`all`,cites:[U.queueMicrotask,W.promiseReactionEnqueue]},{id:`QP`,title:`A promise reaction is queued when its promise settles`,statement:`then, catch, finally and await register a reaction on a promise and create a second promise for it (async_hooks reports that one with the first as its trigger). V8 puts the reaction job on the microtask queue when the first promise settles, or at once when it has already settled. The helper sees settling through the promiseResolve hook, which fires on fulfil and reject and not when a promise is merely resolved with another promise. So the reaction is shown in the microtask queue from the later of the two moments, creation and settling, until its callback starts. A promise that is only created while another promise's callback runs is not a reaction (its trigger is the running callback); neither is a promise that settles or runs before its trigger has settled (the wrapper an await makes around a plain value). Reactions of a promise whose settling was not seen are not shown as queued; they simply run.`,yields:`inferred`,platform:`all`,cites:[U.promiseInitHook,W.performPromiseThen,W.triggerReactions,W.promiseReactionEnqueue]},{id:`QP2`,title:`A reaction that was shown as queued did not run in its turn`,statement:`The microtask queue is first-in first-out and is emptied completely before the next timer, immediate or I/O callback. When a reaction that rule QP put in the queue is overtaken by a later microtask, or is still listed when such a callback starts, it was not in the queue: rule QP was wrong for this promise. The entry is removed here rather than left standing.`,yields:`inferred`,platform:`all`,cites:[W.promiseReactionEnqueue,W.triggerReactions]},{id:`QW`,title:`A new thread-pool-backed request waits for the pool`,statement:`An async item of a thread-pool-backed type was created (FSREQCALLBACK, FSREQPROMISE, GETADDRINFOREQWRAP, GETNAMEINFOREQWRAP, a crypto *REQUEST, zlib). Node creates the item and submits the work in the same call, so the request is with the thread pool until its callback starts.`,yields:`inferred`,platform:`all`,cites:[U.workSubmit,U.scheduleWork,W.poolSubmit]},{id:`QR`,title:`A new one-shot I/O request waits on the operating system`,statement:`An async item of a one-shot request type was created (a connect, write or shutdown request). It waits for the operating system until its callback starts.`,yields:`inferred`,platform:`all`,cites:[W.phasePoll,W.makeCallback]},{id:`QX`,title:`A waiting item went away without running`,statement:`An item that was waiting was reported as destroyed before any callback of it started (for example clearTimeout, clearImmediate or clearInterval). It left its queue.`,yields:`inferred`,platform:`all`,cites:[U.timeoutCtor,U.immediateCtor]}],Pr=new Set([`C0`,`T2`,`I2`,`L1`,`W2`,`W4`,`W5`,`W6`,`X1`]),Fr=Nr.filter(e=>!Pr.has(e.id)),Ir=Nr.filter(e=>Pr.has(e.id)),Lr=new Map(Fr.map(e=>[e.id,e]));function Rr(e){return Lr.get(e)}var zr=new Set([`TCPWRAP`,`TCPSERVERWRAP`,`PIPEWRAP`,`PIPESERVERWRAP`,`TTYWRAP`,`UDPWRAP`,`PROCESSWRAP`,`SIGNALWRAP`,`FSEVENTWRAP`,`STATWATCHER`,`MESSAGEPORT`]),Br=new Map([{id:`replay:main`,title:`The main script is running`,statement:`The run has started and no callback has started and the event loop has reported nothing yet. Node runs its start-up code and then the main script before it enters the loop, so the main thread is running one of the two. For an ES module the body itself runs inside promise callbacks, which then show as callbacks.`,yields:`inferred`,platform:`all`,cites:[`s:lib/internal/modules/run_main.js#executeUserEntryPoint`,`o:loop.run`]},{id:`replay:due`,title:`When a timer is due`,statement:`A timer was armed (set, or put back after a run) with a delay. We show it as due at the time of that event plus the delay, and measure lateness against that. Node starts the delay from the loop's cached clock, which was read at the start of the current loop turn, so the real due time can be earlier than shown by the time the current callback had already been running.`,yields:`inferred`,platform:`all`,cites:[`s:lib/internal/timers.js#Timeout.prototype.constructor`,`s:lib/internal/timers.js#insert`,`o:timers.listOnTimeout`]},{id:`replay:handle`,title:`A handle keeps waiting after its callback`,statement:`An item whose type is a libuv handle (a socket, a server, a pipe, a child process, a watcher) was waiting on the operating system and one of its callbacks ran. A handle stays registered with the loop until it is closed, so it is still shown as waiting. It leaves when it is reported destroyed.`,yields:`inferred`,platform:`all`,cites:[`s:src/handle_wrap.cc#node::HandleWrap::OnClose`,`o:phase.poll`]},{id:`replay:delivered`,title:`The result of a pool job reached the loop`,statement:`The callback of an item started, or the item was destroyed, while a pool job of that item was shown as finished or as still queued. The after-work callback on the main thread is what leads to that callback, so the work is done and its result is no longer waiting to be delivered. (File system requests and dns.lookup report nothing from the pool thread; for them the callback is the only sign that the work ran.)`,yields:`inferred`,platform:`all`,cites:[`s:deps/uv/src/threadpool.c#uv__work_done`,`o:pool.done`]}].map(e=>[e.id,e]));function Vr(e){return Br.get(e)}rr.length,typeof performance<`u`&&performance.now;var Hr=2e3,Ur=`rec=1.`,Wr=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`,Gr=new Int8Array(128).fill(-1);for(let e=0;e<64;e++)Gr[Wr.charCodeAt(e)]=e;var Kr=[`nextTick`,`microtask`,`timers`,`immediate`,`pool`,`io`,`close`];function qr(e,t,n){if(t===null)return e;let r=t.prepend.slice();for(let i of e){let e=n(i);e>=t.from&&e<t.to&&r.push(i)}for(let e of t.append)r.push(e);return r}var Jr=e=>e.seq,Yr=e=>e.index;function Xr(e,t){if(e===null){if(!t.full)throw Error(`a view patch needs the view before it`);return{...t.set,queues:t.queues,output:{total:t.output?.total??0,chars:t.output?.chars??0,chunks:t.output?.append??[]},log:t.log?.append??[]}}let n=e.queues;for(let r of Kr){let i=t.queues[r];i!==void 0&&(n===e.queues&&(n={...e.queues}),n[r]=i)}let r=t.output;return{...e,...t.set,queues:n,output:r===null?e.output:{total:r.total,chars:r.chars,chunks:t.full?r.append:qr(e.output.chunks,r,Jr)},log:t.full?t.log?.append??[]:qr(e.log,t.log,Yr)}}var Zr=[`observed`,`inferred`,`model`],Qr={observed:`Observed`,inferred:`Inferred`,model:`Model`},$r={observed:`Node.js reported this itself.`,inferred:`Worked out from other signals by a rule. Open the mark to read the rule and the source it relies on.`,model:`An illustration of how this part works, not a measurement of this run.`},ei={observed:2,inferred:1,model:0};function ti(e,t){return ei[e]<=ei[t]?e:t}var ni=[{id:`app:phase-ring`,title:`The ring of loop phases`,statement:`uv_run runs its steps in a fixed order: timers once before the first turn, then in every turn pending, idle, prepare, poll, pending again, check, close and timers. The ring draws that order as a picture. Which phase is lit comes from the events of this run and carries its own mark; the ring itself measures nothing.`,yields:`model`,platform:`all`,cites:[`s:deps/uv/src/unix/core.c#uv_run`,`s:deps/uv/src/win/core.c#uv_run`,`o:loop.run`]}],ri=`app:phase-ring`;function ii(e){if(e)return Rr(e)??Ir.find(t=>t.id===e)??Vr(e)??ni.find(t=>t.id===e)}var ai={all:`Windows, macOS and Linux`,unix:`macOS and Linux`,win32:`Windows`},oi=80;function si(e){let t=[0];for(let n=e.indexOf(`
|
|
4
|
+
`);n>=0;n=e.indexOf(`
|
|
5
|
+
`,n+1))t.push(n+1);return t}function ci(e,t){let n=0,r=e.length-1;for(;n<r;){let i=n+r+1>>1;e[i]<=t?n=i:r=i-1}return n+1}var li=new Set([`ArrowFunction`,`FunctionExpression`,`ClassExpression`]),ui=new Set([`extends`,`ParamList`,`ClassBody`,`Block`,`⚠`]);function di(e,t,n){switch(e.name){case`FunctionDeclaration`:case`ClassDeclaration`:{let r=null;for(let t=e.firstChild;t&&(t.name===`VariableDefinition`&&(r=t),!(r||ui.has(t.name)));t=t.nextSibling);let i=r?t.slice(r.from,r.to):`default`;n.push({name:i,kind:e.name===`ClassDeclaration`?`class`:`function`,from:e.from,to:e.to});return}case`VariableDeclaration`:{let r=null;for(let i=e.firstChild;i;i=i.nextSibling)i.name===`VariableDefinition`?r=i:r&&li.has(i.name)&&(n.push({name:t.slice(r.from,r.to),kind:i.name===`ClassExpression`?`class`:`function`,from:e.from,to:i.to}),r=null);return}case`ExportDeclaration`:for(let r=e.firstChild;r;r=r.nextSibling)di(r,t,n);return;case`ExpressionStatement`:{let r=e.getChild(`AssignmentExpression`);if(!r)return;let i=null;for(let a=r.firstChild;a;a=a.nextSibling)if(a.name===`MemberExpression`&&!i)i=a;else if(i&&li.has(a.name)){let r=t.slice(i.from,i.to),o=/^(?:module\.)?exports\.([A-Za-z_$][\w$]*)$/.exec(r);o&&o[1]&&n.push({name:o[1],kind:a.name===`ClassExpression`?`class`:`function`,from:e.from,to:a.to})}return}}}function fi(e){return`u:${e.replace(/[\r\n#]/g,`_`).slice(0,200)}`}function pi(e,t,n){let r=fi(e),i=si(t),a=t.length===0?1:ci(i,t.length-+!!t.endsWith(`
|
|
6
|
+
`)),o=[{id:r,parent:null,label:e.slice(0,oi),lines:{start:1,end:Math.max(1,a)}}],s=[],c=n.parse(t).topNode;for(let e=c.firstChild;e;e=e.nextSibling)di(e,t,s);let l=new Map;for(let e of s){if(o.length>=400)break;let t=(l.get(e.name)??0)+1;l.set(e.name,t);let n=`${r}#${e.name}${t>1?`~${t}`:``}`;o.push({id:n,parent:r,label:(e.kind===`class`?`class ${e.name}`:`${e.name}()`).slice(0,oi),lines:{start:ci(i,e.from),end:ci(i,Math.max(e.from,e.to-1))}})}return o}function mi(e,t,n){let r=fi(t),i;for(let t of e)t.id!==r&&t.parent!==r||!t.lines||n<t.lines.start||n>t.lines.end||(!i||!i.lines||t.lines.end-t.lines.start<=i.lines.end-i.lines.start)&&(i=t);return i}function hi(e,t){if(!e)return[];let n=new Map,r=(e,t,r,i)=>{if(!e)return;let a=`${t}\n${e}`,o=n.get(a);if(o){o.certainty=ti(o.certainty,r),i&&!o.badge&&(o.badge=i);return}let s={id:e,role:t,certainty:r};i&&(s.badge=i),n.set(a,s)};for(let t of e.focus.waiting){let e=t.waiting+t.poolWaiting,n=[];e>0&&n.push(`${e} waiting`),t.poolDone>0&&n.push(`${t.poolDone} finished`),n.length>0&&r(t.at,`waiting`,t.c,n.join(`, `))}e.loop.phase&&e.loop.phaseFrom&&r(Kt[e.loop.phase],`active`,e.loop.phaseFrom.c,`${e.loop.phase} phase`);let i=e.main.stack[e.main.stack.length-1];i&&r(Jt[i.item.type],`active`,i.from.c);let a=new Map;for(let t of e.pool.threads){let e=t.job;if(!e)continue;let n=e.started??e.queued,r=e.at??P.poolWorker.id,i=n?n.c:`inferred`,o=a.get(r);o?(o.n++,o.c=ti(o.c,i)):a.set(r,{n:1,c:i})}for(let[e,t]of a)r(e,`active`,t.c,t.n===1?`1 pool thread running`:`${t.n} pool threads running`);if(e.focus.at&&e.focus.from&&r(e.focus.at,`active`,e.focus.from.c),e.debug.paused&&e.debug.from){let n=e.debug.from.c;r(P.inspectorPause.id,`active`,n,`paused`);let i=e.debug.frames[0];i&&(i.at?r(i.at,`active`,n,`paused here`):i.origin===`user`&&t.programName&&ln(i.loc.url,t.programName)&&r(mi(t.userBoxes,t.programName,i.loc.line)?.id,`active`,n,`line ${i.loc.line}`))}return[...n.values()]}function gi(e){if(!e)return null;if(e.debug.paused&&e.debug.from){let t=e.debug.frames.find(e=>e.origin===`node`&&e.at);if(t?.at)return{id:t.at,certainty:e.debug.from.c}}let t=e.main.stack[e.main.stack.length-1],n=t?Jt[t.item.type]:void 0;return t&&n?{id:n,certainty:t.from.c}:e.loop.phase&&e.loop.phaseFrom?{id:Kt[e.loop.phase],certainty:e.loop.phaseFrom.c}:null}var _i={hello:`welcome`,run:`run.started`,stop:`ok`,"debug.breakpoints":`ok`,"debug.do":`ok`,"debug.scopes":`debug.scopes`,"debug.props":`debug.props`,source:`source`,"gate.do":`ok`,"files.list":`files.list`,"files.read":`files.read`},vi=/^\s*\{\s*"op"\s*:\s*"events"\s*[,}]/,yi=class extends Error{constructor(e){super(e),this.name=`HelperError`}},bi=class{#e;#t;#n=new Map;#r=1;#i=!1;#a=!1;#o;constructor(e){this.#t=e,this.#e=e.socket,this.#o=new Promise((e,t)=>{this.#e.onopen=()=>{this.#i=!0,e()},this.#e.onerror=()=>t(new yi(`Could not connect to the helper.`)),this.#e.onclose=()=>{t(new yi(`The connection to the helper closed.`)),this.#s()}}),this.#o.catch(()=>void 0),this.#e.onmessage=e=>this.#c(e.data)}async hello(){let e=await this.request({op:`hello`,protocol:1});if(e.protocol!==1)throw new yi(`This page speaks helper protocol 1, the helper speaks ${String(e.protocol)}. Restart nodejs-map so both come from the same version.`);return e}async request(e){if(await this.#o,this.#a)throw new yi(`The connection to the helper closed.`);let t=this.#r++;return new Promise((n,r)=>{let i=setTimeout(()=>{this.#n.delete(t),r(new yi(`The helper did not answer "${e.op}".`))},this.#t.timeoutMs??15e3);this.#n.set(t,{op:e.op,resolve:n,reject:r,timer:i}),this.#e.send(JSON.stringify({...e,id:t}))})}close(){this.#e.close(),this.#s()}get isOpen(){return this.#i&&!this.#a}#s(){if(!this.#a){this.#a=!0;for(let e of this.#n.values())clearTimeout(e.timer),e.reject(new yi(`The connection to the helper closed.`));this.#n.clear(),this.#t.onClose()}}#c(e){if(typeof e!=`string`)return;if(vi.test(e.length>64?e.slice(0,64):e)){this.#t.onEventsText(e);return}let t;try{t=JSON.parse(e)}catch{return}if(typeof t==`object`&&t&&typeof t.op==`string`){if(t.op===`events`)this.#t.onEventsText(e);else if(`re`in t&&typeof t.re==`number`){let e=this.#n.get(t.re);if(!e)return;this.#n.delete(t.re),clearTimeout(e.timer),t.op===`error`?e.reject(new yi(String(t.message))):t.op===_i[e.op]?e.resolve(t):e.reject(new yi(`Unexpected reply "${t.op}" to "${e.op}".`))}else(t.op===`run.ended`||t.op===`notice`)&&this.#t.onPush(t)}}};function xi(e,t){let n=new URL(e,t);return n.protocol=n.protocol===`https:`?`wss:`:`ws:`,n.hash=``,n.href}var Si={description:null,atlasId:null,path:null,start:null,end:null,line:null,scriptUrl:null,variant:null,github:null,githubDev:null,raw:null,note:null};function Ci(e){return e===`win32`||e===`darwin`?e:`linux`}function wi(e,t,n,r,i){return{...Si,title:t,path:n,start:r,end:i,github:Mt(e,n,r??void 0,i??void 0),githubDev:Pt(e,n,r??void 0,i??void 0),raw:It(e,n)}}async function Ti(e,t,n){let r;try{r=await e.box(n)}catch{return{...Si,title:n,atlasId:n,note:`The map data for this place could not be loaded.`}}if(!r)return{...Si,title:n,atlasId:n,note:`This place (${n}) is not in the map for Node ${e.index.node.version}.`};let i=e.commit,a=e.pickRange(r,t);if(a)return{...wi(i,r.title,a.path,a.start,a.end),description:r.desc??null,atlasId:r.id,variant:a.cond??r.variant??null,scriptUrl:null};if(r.ranges.length>0){let e=r.ranges[0];return{...Si,title:r.title,description:r.desc??null,atlasId:r.id,note:`This code does not exist on ${t===`win32`?`Windows`:t===`darwin`?`macOS`:`Linux`}${e?`; it lives in ${e.path}`:``}.`}}return r.file?{...wi(i,r.title,r.file.path,null,null),description:r.desc??null,atlasId:r.id}:r.tree?{...Si,title:r.title,description:r.desc??null,atlasId:r.id,github:Nt(i,r.tree),note:`This box is a folder. Zoom in on the map to reach its files, or open the folder on GitHub.`}:{...Si,title:r.title,description:r.desc??null,atlasId:r.id,note:`This box has no source in Node.js itself.`}}async function Ei(e,t){let n=t.fn||`(anonymous)`,r=Bt(t.loc.url);if(!r)return{...Si,title:n,note:`${t.loc.url} is not part of Node's own JavaScript, so there is no source to link to.`};if(!e)return{...Si,title:n,path:r,line:t.loc.line,scriptUrl:t.loc.url,note:null};let i=e.commit,a=t.at;if(!a)try{a=await e.locate(r,t.loc.line)}catch{a=void 0}let o=t.loc.line,s=t.loc.line;if(a){let n=(await e.box(a).catch(()=>void 0))?.ranges.find(e=>e.path===r&&t.loc.line>=e.start&&t.loc.line<=e.end);n&&(o=n.start,s=n.end)}return{...wi(i,n,r,o,s),atlasId:a??null,line:t.loc.line,scriptUrl:t.loc.url}}function Di(e){return/\.(?:m?js|cjs)$/i.test(e)?`javascript`:/\.(?:c|cc|cpp|cxx|h|hh|hpp|inl|inc)$/i.test(e)?`cpp`:`plain`}function Oi(e){return/^v\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(e)}function ki(e){return e.endsWith(`/`)?e:`${e}/`}function Ai(e,t){let n;try{n=new URL(t,e)}catch{return null}return n.origin!==e.origin||!n.pathname.startsWith(e.pathname)?null:n.href}function ji(e){let t=I({status:`none`}),n=``;return{state:t,async load(r,i){let a=new URL(ki(r),e.pageUrl());if(a.href===n)return;n=a.href,t.value={status:`loading`,tag:i};let o=new Gt({fetchJson:t=>{let n=Ai(a,t);return n===null?Promise.reject(Error(`The atlas names a file outside its folder: ${t}`)):e.fetchJson(n)}});try{let e=await o.load();if(n!==a.href)return;t.value={status:`ready`,tag:`v${e.node.version.replace(/^v/,``)}`,commit:e.node.commit,store:o,base:a.href},ve(`atlas`)}catch(e){if(n!==a.href)return;n=``,t.value={status:`missing`,tag:i,reason:e instanceof Error?e.message:String(e)}}},unavailable(e,r){n=``,t.value={status:`missing`,tag:e,reason:r}}}}async function Mi(e){let t;try{t=await fetch(e,{credentials:`same-origin`})}catch{throw Error(`could not be loaded (no connection?)`)}if(!t.ok)throw Error(t.status===404?`is not on this site`:`could not be loaded (HTTP ${t.status})`);return await t.json()}var Ni=600;function Pi(e){if(e!==void 0)try{let t=new URL(e);return t.protocol!==`https:`&&t.protocol!==`http:`?void 0:(t.hash=``,t.search=``,t.href)}catch{return}}function Fi(e){if(typeof e!=`object`||!e)throw Error(`config.json is not an object.`);let t=e,n=e=>{let n=t[e];if(n!==void 0){if(typeof n!=`string`)throw Error(`config.json: "${e}" must be text.`);return n}},r=t.atlasBase;if(typeof r!=`string`)throw Error(`config.json: "atlasBase" is missing.`);let i=n(`examples`),a=n(`lessons`);if(t.mode===`helper`){if(typeof t.ws!=`string`)throw Error(`config.json: "ws" is missing.`);let e=Pi(n(`playerUrl`));return{mode:`helper`,ws:t.ws,atlasBase:r,...i===void 0?{}:{examples:i},...a===void 0?{}:{lessons:a},...e===void 0?{}:{playerUrl:e}}}if(t.mode===`player`)return{mode:`player`,atlasBase:r,...a===void 0?{}:{lessons:a}};throw Error(`config.json: "mode" must be "helper" or "player".`)}function Ii(e){let t=I(null),n=I(`none`),r=I(null),i=I([]),a=I(null),o=null,s=1,c=(e,t)=>{let n={id:s++,level:e,text:t.slice(0,Ni)};i.value=[...i.value,n].slice(-5)};return{config:t,mode:L(()=>t.value?.mode??null),status:n,welcome:r,providers:L(()=>r.value?.providers??[]),notes:L(()=>r.value?.notes??{}),notices:i,error:a,setConfig(e){t.value=e},async connect(t){n.value=`connecting`,a.value=null;let i=!1,s=new bi({socket:e.makeSocket(t),onEventsText:e.onEventsText,onPush(t){t.op===`notice`?c(t.level,String(t.text)):e.onRunEnded(t)},onClose(){o===s&&n.value!==`failed`&&(n.value=i?`closed`:`failed`,a.value=i?`The helper stopped or the connection was lost. Start nodejs-map again in a terminal, then reload this page.`:`Could not connect to the helper. Start nodejs-map again in a terminal; this page works only with the helper that opened it.`)}});o=s;try{r.value=await s.hello(),i=!0,n.value=`open`}catch(e){o===s&&n.value===`connecting`&&(n.value=`failed`,a.value=e instanceof yi?e.message:`Could not connect to the helper.`),s.close()}},request(e){return!o||n.value!==`open`?Promise.reject(new yi(`The helper is not connected.`)):o.request(e)},notify:c,dismiss(e){i.value=i.value.filter(t=>t.id!==e)}}}var Li=[`nextTick`,`microtask`,`timers`,`immediate`,`pool`,`io`,`close`],Ri={maxEntries:60,maxOutput:0,maxNotes:5,maxLog:0,items:`none`},zi=600,Bi=1e3;function Vi(){return{position:I(0),length:I(0),ready:I(0),live:I(!1),version:I(0),t:I(0),run:I(null),main:I(null),loop:I(null),timers:I(null),pool:I(null),output:I(null),debug:I(null),notes:I(null),focus:I(null),problems:I(null),itemCount:I(0),queues:Object.fromEntries(Li.map(e=>[e,I(null)]))}}function Hi(e,t){let n=I(null),r=Vi(),i=(e,t)=>{vn(()=>{n.value=e,a.value=t,r.position.value=e.position,r.length.value=e.length,r.ready.value=e.ready,r.live.value=e.live,r.version.value=e.version,r.t.value=e.t,r.run.value=e.run,r.main.value=e.main,r.loop.value=e.loop,r.timers.value=e.timers,r.pool.value=e.pool,r.output.value=e.output,r.debug.value=e.debug,r.notes.value=e.notes,r.focus.value=e.focus,r.problems.value=e.problems,r.itemCount.value=e.items.total;for(let t of Li)r.queues[t].value=e.queues[t]})},a=I(null),o=I(null),s=I(null),c=I({status:`idle`,mode:null,length:0,run:null}),l=I(null),u=I(!1),d=new Map,f=1,p=0,m=!1,h=0,g=null,_=!1,v=null,y=(t,n)=>{_||e.postMessage(t,n)},b=()=>{if(t.now()<p)return!0;let e=a.peek(),r=n.peek();return!!(e&&(e.playing||e.live)||r&&(r.live||r.ready<r.length))},x=e=>{g=null,_||((!m||e-h>Bi)&&(m=!0,h=e,y({op:`tick`,now:e})),b()&&(g=t.request(x)))},S=()=>{p=t.now()+zi,!g&&!_&&(g=t.request(x))},C=e=>new Promise((t,n)=>{let r=f++;d.set(r,{resolve:t,reject:n}),e(r),S()}),w=(e,t,n)=>{if(e===null)return!1;let r=d.get(e);return r?(d.delete(e),n===void 0?r.resolve(t):r.reject(Error(n)),!0):!1};return e.onmessage=e=>{let t=e.data;switch(t.op){case`ready`:return;case`view`:i(t.view,t.player);return;case`patch`:{let e;try{e=Xr(n.peek(),t.patch)}catch{y({op:`configure`,views:`patch`}),S();return}i(e,t.player);return}case`timeline`:o.value=t.summary;return;case`markers`:s.value=t.markers;return;case`answer`:w(t.re,t.answer);return;case`saved`:w(t.re,t.bytes);return;case`shared`:w(t.re,t.result);return;case`opened`:w(t.re,{header:t.header,events:t.events});return;case`error`:case`app.error`:w(t.re,void 0,t.message)||(l.value=t.message);return;case`app.opened`:w(t.re,{header:t.header,events:t.events}),S();return;case`app.log`:w(t.re,t.window);return;case`app.ticked`:m=!1;return;case`app.tail`:c.value={...t.tail,run:t.run},S();return}},e.onerror=()=>{l.value=`The part of the app that reads events stopped working. Reload the page.`},y({op:`configure`,view:Ri,views:`patch`,clock:`external`,markers:!0}),u.value=!0,S(),{view:n,parts:r,player:a,timeline:o,markers:s,tail:c,problem:l,ready:u,command(e){y({op:`player`,cmd:e}),S()},query(e){return C(t=>y({op:`query`,id:t,q:e}))},log(e,t,n,r){return C(i=>y({op:`app.log`,id:i,filter:e,offset:t,limit:n,position:r}))},setTimeline(e,t){v&&v.width===e&&v.axis===t||(v={width:e,axis:t},y({op:`configure`,timeline:{width:e,axis:t}}),S())},setViewCaps(e){y({op:`configure`,view:e}),S()},newRun(){l.value=null,y({op:`app.newRun`}),S()},setRun(e){y({op:`app.run`,run:e}),S()},eventsText(e){y({op:`app.eventsText`,text:e}),g||S()},runEnded(e){y({op:`app.runEnded`,run:e}),S()},open(e){return l.value=null,C(t=>y({op:`app.open`,id:t,data:e}))},openFragment(e){return l.value=null,C(t=>y({op:`app.openFragment`,id:t,fragment:e}))},close(){y({op:`app.close`}),S()},save(e,t){return C(n=>y({op:`save`,id:n,header:e,gzip:t}))},share(e){return C(t=>y({op:`share`,id:t,header:e}))},dispose(){_=!0,g?.();for(let e of d.values())e.reject(Error(`The player was closed.`));d.clear()}}}var Ui=[.1,.25,.5,1,2,4,8,16],Wi=`// Edit this program, then press Run.
|
|
7
|
+
const fs = require('node:fs');
|
|
8
|
+
|
|
9
|
+
setTimeout(() => console.log('timeout'), 0);
|
|
10
|
+
setImmediate(() => console.log('immediate'));
|
|
11
|
+
fs.readFile(__filename, () => console.log('file read'));
|
|
12
|
+
process.nextTick(() => console.log('nextTick'));
|
|
13
|
+
Promise.resolve().then(() => console.log('promise'));
|
|
14
|
+
console.log('main script done');
|
|
15
|
+
`,Gi=[`code`,`now`,`stack`,`queues`,`pool`,`output`,`events`,`source`,`lessons`],Ki=(...e)=>t=>typeof t==`string`&&e.includes(t)?t:void 0,qi=(e,t)=>n=>typeof n==`number`&&Number.isFinite(n)?Math.min(t,Math.max(e,n)):void 0,Ji=e=>typeof e==`boolean`?e:void 0,Yi=.2,Xi=.8,Zi=.12,Qi=.88,$i=1024,ea={theme:Ki(`system`,`light`,`dark`),splitMap:qi(Yi,Xi),splitEditor:qi(Yi,Xi),splitSheet:qi(Zi,Qi),module:Ki(`commonjs`,`esm`),poolSize:e=>e===null?null:typeof e==`number`&&Number.isInteger(e)&&e>=1&&e<=1024?e:void 0,pauseOnStart:Ji,itemLocations:Ji,provider:Ki(`user`,`pinned`,`probe`),speed:e=>typeof e==`number`&&Ui.includes(e)?e:void 0,followAction:Ji,snippet:e=>typeof e==`string`&&e.length<=2e5?e:void 0,snippetName:e=>typeof e==`string`&&/^\w[\w.-]{0,80}$/.test(e)?e:void 0,tab:Ki(...Gi),timelineAxis:Ki(`index`,`time`),breakpoints:e=>{if(typeof e!=`object`||!e||Array.isArray(e))return;let t={};for(let[n,r]of Object.entries(e)){if(!Array.isArray(r))continue;let e=r.filter(e=>Number.isInteger(e)&&e>=1&&e<1e7);e.length>0&&(t[n]=[...new Set(e)].sort((e,t)=>e-t))}return t}},ta={theme:`system`,splitMap:.56,splitEditor:.48,splitSheet:.6,module:`commonjs`,poolSize:null,pauseOnStart:!1,itemLocations:!1,provider:`user`,speed:1,followAction:!0,snippet:Wi,snippetName:`snippet.js`,breakpoints:{},tab:`now`,timelineAxis:`index`},na=`nodejs-map.settings.v1`;function ra(e){let t={...ta};if(e===null)return t;let n;try{n=JSON.parse(e)}catch{return t}if(typeof n!=`object`||!n)return t;for(let e of Object.keys(ea)){if(!Object.hasOwn(n,e))continue;let r=ea[e](n[e]);r!==void 0&&(t[e]=r)}return t}function ia(e,t=e=>void setTimeout(e,250)){let n=null;try{n=e?.getItem(`nodejs-map.settings.v1`)??null}catch{}let r=ra(n),i=Object.fromEntries(Object.keys(r).map(e=>[e,I(r[e])])),a=!1,o=!0,s=()=>JSON.stringify(Object.fromEntries(Object.entries(i).map(([e,t])=>[e,t.value])));return{settings:i,dispose:Rn(()=>{s(),o?o=!1:!a&&e&&(a=!0,t(()=>{a=!1;try{e.setItem(na,s())}catch{}}))})}}function aa(){try{return typeof localStorage>`u`?null:localStorage}catch{return null}}var G=ia(aa()).settings,oa=200;function sa(e){if(typeof e!=`object`||!e)throw Error(`not an object`);let t=e.examples;if(!Array.isArray(t))throw Error(`no "examples" list`);let n=[];for(let e of t.slice(0,oa)){if(typeof e!=`object`||!e)continue;let t=e;typeof t.id==`string`&&typeof t.title==`string`&&typeof t.text==`string`&&(t.text.length>2e5||n.push({id:t.id.slice(0,80),title:t.title.slice(0,120),summary:typeof t.summary==`string`?t.summary.slice(0,600):``,module:t.module===`esm`?`esm`:`commonjs`,text:t.text,racy:t.racy===!0}))}return n}function ca(e){return`${e.id.replace(/[^\w.-]+/g,`-`).replace(/^[.-]+/,``).slice(0,60)||`example`}${e.module===`esm`?`.mjs`:`.js`}`}function la(e){let{settings:t}=e,n=I({kind:`snippet`}),r=I({status:`none`}),i=0,a=L(()=>{let e=n.value;return e.kind===`file`?e.path:t.snippetName.value}),o=(e,n)=>{let r={...t.breakpoints.value};n.length>0?r[e]=n:delete r[e],t.breakpoints.value=r};return{source:n,name:a,text:L(()=>{let e=n.value;return e.kind===`file`?e.text??``:t.snippet.value}),readOnly:L(()=>n.value.kind===`file`),breakpoints:L(()=>t.breakpoints.value[a.value]??[]),examples:r,setSnippetText(e){n.value.kind!==`snippet`||e.length>2e5||(t.snippet.value=e)},useSnippet(){i++,n.value={kind:`snippet`}},loadExample(e){i++,t.snippet.value=e.text,t.snippetName.value=ca(e),t.module.value=e.module,n.value={kind:`snippet`}},async openFile(t){let r=++i;n.value={kind:`file`,path:t,text:null,error:null};try{let a=await e.readFile(t);r===i&&(n.value={kind:`file`,path:t,text:a,error:null})}catch(e){r===i&&(n.value={kind:`file`,path:t,text:null,error:e instanceof Error?e.message:String(e)})}},listFiles:t=>e.listFiles(t),async loadExamples(t){r.value={status:`loading`};try{r.value={status:`ready`,examples:sa(await e.fetchJson(t))}}catch(e){r.value={status:`failed`,reason:e instanceof Error?e.message:String(e)}}},toggleBreakpoint(e){if(!Number.isInteger(e)||e<1)return;let n=a.value,r=t.breakpoints.value[n]??[];o(n,r.includes(e)?r.filter(t=>t!==e):[...r,e].sort((e,t)=>e-t))},setBreakpoints(e){let n=[...new Set(e.filter(e=>Number.isInteger(e)&&e>=1))].sort((e,t)=>e-t),r=t.breakpoints.value[a.value]??[];n.length===r.length&&n.every((e,t)=>e===r[t])||o(a.value,n)},ref(){let e=n.value;return e.kind===`file`?e.text===null?null:{kind:`file`,path:e.path}:{kind:`snippet`,name:t.snippetName.value,text:t.snippet.value,module:t.module.value}},breakpointList(){let e=a.value;return(t.breakpoints.value[e]??[]).map(t=>({file:e,line:t}))}}}var ua=200,da=200;function fa(e){if(typeof e!=`object`||!e)throw Error(`not an object`);let t=e.lessons;if(!Array.isArray(t))throw Error(`no "lessons" list`);let n=[];for(let e of t.slice(0,ua)){if(typeof e!=`object`||!e)continue;let t=e;if(typeof t.id!=`string`||typeof t.title!=`string`||typeof t.recording!=`string`)continue;let r={id:t.id.slice(0,80),title:t.title.slice(0,120),summary:typeof t.summary==`string`?t.summary.slice(0,600):``,recording:t.recording,node:typeof t.node==`string`?t.node.slice(0,20):``};if(Array.isArray(t.steps)){let e=[];for(let n of t.steps.slice(0,da)){if(typeof n!=`object`||!n)continue;let t=n;typeof t.index!=`number`||!Number.isInteger(t.index)||t.index<0||e.push({index:t.index,title:typeof t.title==`string`?t.title.slice(0,120):``,text:typeof t.text==`string`?t.text.slice(0,2e3):``})}e.sort((e,t)=>e.index-t.index),r.steps=e}n.push(r)}return n}function pa(e,t){let n,r;try{r=new URL(`.`,e),n=new URL(t,e)}catch{return null}return n.origin!==r.origin||!n.pathname.startsWith(r.pathname)?null:n.href}function ma(e,t){return`${(e??`recording`).replace(/\.[a-z]{1,4}$/i,``).replace(/[^\w.-]+/g,`-`).replace(/^[-.]+|[-.]+$/g,``).slice(0,60)||`recording`}.nodejs-map${t?`.gz`:``}`}function ha(e){return e instanceof Error?e.message:String(e)}function ga(e){let{settings:t,connection:n,player:r,program:i}=e,a=I(`empty`),o=I(null),s=I(!1),c=I(!1),l=I(!1),u=I({phase:!1,timer:!1,poolStart:!1,poolPost:!1}),d=I({status:`none`}),f=I(``),p=I(null),m=null,h=0,g=e=>{f.value=f.value===e?`${e} `:e},_=L(()=>{let e=n.providers.value;return e.find(e=>e.id===t.provider.value)??e.find(e=>e.available)??e[0]??null}),v=L(()=>{if(c.value)return`starting`;if(a.value!==`live`||!l.value)return`idle`;switch(r.tail.value.status){case`paused`:return`paused`;case`gated`:return`gated`;case`ended`:return`idle`;default:return`running`}}),y=L(()=>a.value===`live`&&l.value?r.tail.value.mode:null),b=L(()=>st({connected:n.status.value===`open`,provider:_.value,notes:n.notes.value,status:v.value,mode:y.value})),x=L(()=>r.parts.run.value?.caps??(a.value===`recording`?null:_.value?.caps??null)),S=L(()=>r.parts.run.value?.node??o.value?.header.node??(a.value===`recording`?null:_.value?.node??null)),C=e=>{let t=ha(e);p.value=t,g(t)},w=e=>{let t=b.value[e];return!t.enabled&&(t.reason&&g(t.reason),!0)},ee=null,T=()=>l.value?ee:null,E=e=>{let t=u.value,n=e.caps.gates,r={};return t.phase&&n.phase&&(r.phase=!0),t.timer&&n.timer&&(r.timer=!0),t.poolStart&&n.poolStart&&(r.poolStart=!0),t.poolPost&&n.poolPost&&(r.poolPost=!0),Object.keys(r).length>0?{gates:r}:{}},te=async()=>{let e=T();if(e){try{await n.request({op:`stop`,run:e})}catch{}l.value=!1}},ne=async(t,n,i,c)=>{let l=++h;p.value=null,s.value=!0;try{await te();let s=await t();if(l!==h)return;a.value=`recording`,o.value={header:s.header,events:s.events,origin:n,label:i,lesson:c},m=null,e.onNewContent?.(c?`lesson`:`recording`),r.command({do:`pause`}),r.command({do:`seek`,position:c?.steps?.[0]?c.steps[0].index+1:0}),g(`Opened a recording with ${s.events} events. Nothing was run.`)}catch(e){if(l!==h)return;C(Error(`This recording could not be opened: ${ha(e)}`))}finally{l===h&&(s.value=!1)}},re=t=>{if(a.value===`recording`){let e=o.value;if(!e)return null;let{sources:n,...r}=e.header;return t&&n?{...r,sources:n}:r}if(a.value!==`live`||!m)return null;let r=e.atlas()??n.welcome.value?.atlas??null;if(!r)return null;let i={format:`nodejs-map-recording`,version:1,created:e.now().toISOString(),tool:n.welcome.value?.tool??`0.0.0`,node:m.node,atlas:{tag:r.tag,commit:r.commit},title:m.name};return t&&m.text!==null&&(i.sources=[{name:m.name,text:m.text}]),i};return{kind:a,recording:o,opening:s,provider:_,liveStatus:v,controls:b,caps:x,node:S,gates:u,lessons:d,announcement:f,error:p,announce:g,clearError(){p.value=null},async start(s){if(w(s===`debug`?`debug`:`run`))return;let u=i.ref(),d=_.value;if(!u||!d)g(`The program is still loading.`);else{h++,p.value=null,c.value=!0,a.value=`live`,o.value=null,m={name:i.name.value,text:i.text.value,node:d.node},r.newRun(),r.command({do:`follow`,on:!0}),e.onNewContent?.(`run`);try{let e=t.poolSize.value,a=await n.request({op:`run`,program:u,mode:s,provider:d.id,breakpoints:s===`debug`?i.breakpointList():[],...e===null?{}:{poolSize:e},...s===`debug`&&t.pauseOnStart.value?{pauseOnStart:!0}:{},...t.itemLocations.value?{itemLocations:!0}:{},...E(d)});ee=a.run,r.setRun(a.run),l.value=!0,g(s===`debug`?`Debug run started.`:`Run started.`)}catch(e){C(Error(`The run could not start: ${ha(e)}`))}finally{c.value=!1}}},async stop(){if(w(`stop`))return;let e=T();if(e)try{await n.request({op:`stop`,run:e}),g(`Stop requested.`)}catch(e){C(e)}},async debug(e){if(w(e))return;let t=T();if(t)try{await n.request({op:`debug.do`,run:t,action:e})}catch(e){C(e)}},async pauseOrResume(){await this.debug(v.value===`paused`?`resume`:`pause`)},async gate(e){let t=e.kind===`resume`?`gateResume`:e.kind;if(w(t))return;let r=T();if(r)try{await n.request({op:`gate.do`,run:r,action:e})}catch(e){C(e)}},async setGate(e,t){if(w(e===`phase`?`pauseAtNextPhase`:e===`timer`?`gateTimer`:e===`poolStart`?`gatePoolStart`:`gatePoolPost`))return;let r=T();if(!r||e===`phase`)u.value={...u.value,[e]:t},g(t?`Armed for the next run.`:`No longer armed.`);else try{await n.request({op:`gate.do`,run:r,action:{kind:`set`,gate:e,on:t}}),u.value={...u.value,[e]:t}}catch(e){C(e)}},syncBreakpoints(){let e=T();e&&y.value===`debug`&&n.request({op:`debug.breakpoints`,run:e,breakpoints:i.breakpointList()}).catch(C)},handleRunEnded(e){r.runEnded(e.run),e.run===ee&&l.value&&(l.value=!1,g(e.signal?`The run was ended by signal ${e.signal}.`:`The run ended with exit code ${String(e.code)}.`))},openRecordingData(e,t){return ne(()=>r.open(e),`file`,t.slice(0,200),null)},openRecordingFragment(e){return ne(()=>r.openFragment(e),`link`,`Shared link`,null)},async openLesson(t){let n=d.value,i=n.status===`ready`?pa(n.baseUrl,t.recording):null;i?await ne(async()=>r.open(await e.fetchBytes(i)),`lesson`,t.title,t):C(Error(`This lesson names a recording outside the lessons folder; it was not opened.`))},closeRecording(){h++,s.value=!1,o.value=null,a.value=`empty`,r.close(),g(`Recording closed.`)},async loadLessons(t){let n=new URL(t,e.pageUrl()).href;d.value={status:`loading`};try{d.value={status:`ready`,lessons:fa(await e.fetchJson(n)),baseUrl:n}}catch(e){d.value={status:`failed`,reason:ha(e)}}},headerForSave:re,async save(e){let t=re(e.includeSource);if(!t)return null;try{return{bytes:await r.save(t,e.gzip),fileName:ma(t.title,e.gzip)}}catch(e){return C(Error(`The recording could not be saved: ${ha(e)}`)),null}},async share(e){let t=re(e);if(!t)return null;try{return await r.share(t)}catch(e){return C(Error(`The link could not be made: ${ha(e)}`)),null}}}}var _a=40;function va(e){let t=I(null),n=I({status:`none`}),r=new Map,i=0,a=(e,t)=>{r.delete(e),r.set(e,t),r.size>_a&&r.delete(r.keys().next().value)},o=async(t,o)=>{if(!t.path||!t.raw&&!t.scriptUrl){n.value={status:`none`};return}let s=t.raw??`program:${String(t.scriptUrl)}`,c=r.get(s);if(c){n.value={status:`ready`,...c};return}n.value={status:`loading`};let l=null;if(t.scriptUrl)try{let n=await e.fetchFromProgram(t.scriptUrl);n!==null&&(l={text:n,from:`program`})}catch{}if(!l&&!t.raw)o===i&&(n.value={status:`unavailable`,reason:`The text of this file is available only while the program runs.`});else{if(!l)try{l={text:await e.fetchText(t.raw),from:`github`}}catch{o===i&&(n.value={status:`unavailable`,reason:`The text of this file comes from GitHub and needs a connection. The path, the lines and the links below still work.`});return}l.text.length>6e6?o===i&&(n.value={status:`unavailable`,reason:`This file is too large to show here. Open it on GitHub.`}):(a(s,l),o===i&&(n.value={status:`ready`,...l}))}};return{target:t,text:n,show(e){let n=++i;t.value=e,o(e,n)},showLater(e){let n=++i;e.then(e=>{n===i&&(t.value=e,o(e,n))},()=>void 0)},clear(){i++,t.value=null,n.value={status:`none`}}}}async function ya(e){let t=await fetch(e,{credentials:`omit`,referrerPolicy:`no-referrer`,mode:`cors`});if(!t.ok)throw Error(`HTTP ${t.status}`);return t.text()}function ba(){return{narrow:I(!1),dialog:I(null),mark:I(null),selected:I(null),flyTo:I(null),hint:I(null),reveal:I(null),recordingSource:I(0),frame:I(0)}}var xa=()=>location.href.replace(/#.*$/,``);function Sa(){let e=new Worker(new URL(new URL(`app.worker-PoneE3J2.js`,import.meta.url).href,``+import.meta.url),{type:`module`,name:`nodejs-map-replay`}),t={postMessage:(t,n)=>e.postMessage(t,n??[]),onmessage:null,onerror:null};return e.onmessage=e=>t.onmessage?.(e),e.onerror=e=>t.onerror?.(e),t}var K=Hi(Sa(),{request(e){let t=requestAnimationFrame(e);return()=>cancelAnimationFrame(t)},now:()=>performance.now()}),q=ba(),J=Ii({makeSocket:e=>new WebSocket(e),onEventsText:e=>K.eventsText(e),onRunEnded:e=>X.handleRunEnded(e)}),Y=la({settings:G,listFiles:async e=>(await J.request({op:`files.list`,dir:e})).entries,readFile:async e=>(await J.request({op:`files.read`,path:e})).text,fetchJson:Mi}),Ca=ji({pageUrl:xa,fetchJson:Mi}),X=ga({settings:G,connection:J,player:K,program:Y,fetchJson:Mi,async fetchBytes(e){let t=await fetch(e,{credentials:`same-origin`});if(!t.ok)throw Error(`the file could not be loaded (HTTP ${t.status})`);return t.arrayBuffer()},pageUrl:xa,now:()=>new Date,atlas(){let e=Ca.state.value;return e.status===`ready`?{tag:e.tag,commit:e.commit}:null},onNewContent(e){oo(),e===`lesson`&&(G.followAction.value=!0)}}),wa=va({fetchText:ya,async fetchFromProgram(e){let t=K.tail.value.run;return X.kind.value!==`live`||!t||X.liveStatus.value===`idle`?null:(await J.request({op:`source`,run:t,url:e})).text}}),Ta=L(()=>J.mode.value===`helper`),Ea=L(()=>K.parts.length.value>0),Da=L(()=>Ci(X.node.value?.platform)),Oa=L(()=>{let e=X.recording.value;if(X.kind.value===`recording`&&e){let t=e.header.sources??[],n=t[Math.min(q.recordingSource.value,t.length-1)];return n?{name:n.name,text:n.text,missing:null,readOnly:!0,origin:`recording`,files:t.map(e=>e.name)}:{name:e.header.title??`recording`,text:null,missing:`This recording does not include the text of the program.`,readOnly:!0,origin:`recording`,files:[]}}if(J.mode.value!==`helper`)return{name:`program`,text:null,missing:J.mode.value===null?`Starting...`:`Open a recording or a lesson. The text of its program is shown here when the recording includes it.`,readOnly:!0,origin:`program`,files:[]};let t=Y.source.value;return t.kind===`file`&&t.text===null?{name:t.path,text:null,missing:t.error?`This file could not be read: ${t.error}`:`Reading the file...`,readOnly:!0,origin:`program`,files:[]}:{name:Y.name.value,text:Y.text.value,missing:null,readOnly:Y.readOnly.value,origin:`program`,files:[]}}),ka=I([]),Aa=[],ja=L(()=>{let{focus:e,loop:t,main:n,pool:r,debug:i}=K.parts,a=hi(e.value&&t.value&&n.value&&r.value&&i.value?{focus:e.value,loop:t.value,main:n.value,pool:r.value,debug:i.value}:null,{userBoxes:ka.value,programName:Oa.value.name});return a.length===Aa.length&&a.every((e,t)=>{let n=Aa[t];return e.id===n.id&&e.role===n.role&&e.certainty===n.certainty&&e.badge===n.badge})||(Aa=a),Aa}),Ma=null,Na=L(()=>{let e=Pa();return(e===null||Ma===null||e.line!==Ma.line||e.kind!==Ma.kind||e.certainty!==Ma.certainty)&&(Ma=e),Ma});function Pa(){let e=K.parts.debug.value,t=K.parts.main.value,n=Oa.value.name;if(!e||!t)return null;if(e.paused){let t=e.frames[Math.min(q.frame.value,e.frames.length-1)];return t&&t.origin===`user`&&ln(t.loc.url,n)?{line:t.loc.line,kind:`paused`,certainty:e.from?.c??`observed`}:null}let r=t.stack[t.stack.length-1],i=r?.item.loc;return r&&i&&ln(i.url,n)?{line:i.line,kind:`origin`,certainty:r.item.created?.c??`observed`}:null}function Fa(e){G.tab.value=e,q.narrow.value&&G.splitSheet.value>.75&&(G.splitSheet.value=.6)}function Ia(e){q.selected.value=e,q.flyTo.value=e}function La(e){if(e.startsWith(`u:`)){let t=ka.value.find(t=>t.id===e);t?.lines&&Ba(t.lines.start,t.lines.end);return}let t=Ca.state.value;t.status===`ready`?wa.showLater(Ti(t.store,Da.value,e)):wa.show({title:e,description:null,atlasId:e,path:null,start:null,end:null,line:null,scriptUrl:null,variant:null,github:null,githubDev:null,raw:null,note:`The map for this Node.js version is not loaded, so this place cannot be resolved to a file.`}),Fa(`source`)}function Ra(e){if(e.origin===`user`){Ba(e.loc.line,e.loc.line);return}let t=Ca.state.value;wa.showLater(Ei(t.status===`ready`?t.store:null,e)),e.at&&(q.selected.value=e.at),Fa(`source`)}var za=0;function Ba(e,t){q.reveal.value={start:e,end:t,ticket:++za},q.narrow.value&&Fa(`code`)}function Va(e){K.command({do:`pause`}),K.command({do:`seek`,position:e+1})}function Ha(e,t){K.command({do:`step`,kind:e,direction:t})}function Ua(e){q.mark.value=e}function Wa(e){let t=Ui.indexOf(G.speed.value),n=Ui[Math.min(Ui.length-1,Math.max(0,(t<0?Ui.indexOf(1):t)+e))];n!==void 0&&(G.speed.value=n)}function Ga(){let e=G.theme.value===`dark`||G.theme.value===`system`&&matchMedia(`(prefers-color-scheme: dark)`).matches;G.theme.value=e?`light`:`dark`}function Ka(e,t,n){let r=URL.createObjectURL(new Blob([e],{type:n})),i=document.createElement(`a`);i.href=r,i.download=t,i.rel=`noopener`,document.body.append(i),i.click(),i.remove(),setTimeout(()=>URL.revokeObjectURL(r),1e4)}async function qa(e){e.size>314572800?X.announce(`This file is too large to be a recording.`):await X.openRecordingData(await e.arrayBuffer(),e.name)}function Ja(){let e=J.config.value;return e?e.mode===`player`?xa():e.playerUrl??null:null}var Ya=I(null);function Xa(e){return e.replace(/^#/,``).split(`&`).some(e=>e.startsWith(Ur))}async function Za(){Xa(location.hash)&&await X.openRecordingFragment(location.hash)}async function Qa(){let e;try{e=Fi(await Mi(new URL(`config.json`,xa()).href))}catch(e){Ya.value=`nodejs-map could not read its configuration (config.json): ${e instanceof Error?e.message:String(e)}`;return}if(J.setConfig(e),ve(`config`),e.lessons!==void 0&&X.loadLessons(e.lessons).then(()=>ve(`lessons`)),e.mode===`helper`){e.examples!==void 0&&Y.loadExamples(new URL(e.examples,xa()).href),await J.connect(xi(e.ws,xa()));let t=J.welcome.value;t&&ve(`connected`),t?.openFile&&Y.openFile(t.openFile)}else Xa(location.hash)||(G.tab.value=`lessons`);await Za(),addEventListener(`hashchange`,()=>void Za())}Rn(()=>{let e=G.theme.value;e===`system`?delete document.documentElement.dataset.theme:document.documentElement.dataset.theme=e});{let e=matchMedia(`(max-width: 760px)`);q.narrow.value=e.matches,e.addEventListener(`change`,e=>{q.narrow.value=e.matches})}Rn(()=>{let e=J.config.value;if(!e)return;if(e.mode===`helper`){let e=J.welcome.value?.atlas;if(!e)return;if(!Oi(e.tag)){Ca.unavailable(e.tag.slice(0,40),`the helper named a version this page cannot look up`);return}Ca.load(`${ki(e.baseUrl)}${e.tag}/`,e.tag);return}let t=X.recording.value?.header,n=X.lessons.value,r=t?t.atlas.tag:n.status===`ready`&&n.lessons[0]?`v${n.lessons[0].node}`:null;r!==null&&(Oi(r)?Ca.load(`${ki(e.atlasBase)}${r}/`,r):Ca.unavailable(r.slice(0,40),`its version name is not one this site can look up`))}),Rn(()=>{let e=G.speed.value;K.ready.value&&K.command({do:`speed`,speed:e})}),Rn(()=>{let e=G.tab.value===`output`;K.ready.value&&K.setViewCaps({maxOutput:e?150:0})}),Rn(()=>{Y.breakpoints.value,bn(()=>X.syncBreakpoints())}),Rn(()=>{K.parts.debug.value?.from?.index,q.frame.value=0});{let e,t=0;Rn(()=>{let{name:n,text:r}=Oa.value;clearTimeout(e);let i=++t;r===null?ka.value=[]:e=setTimeout(()=>{et(async()=>{let{parser:e}=await import(`./dist-B37Ex44M.js`).then(e=>e.t);return{parser:e}},[],import.meta.url).then(({parser:e})=>{i===t&&(ka.value=pi(n,r,e))})},400)})}var $a=180,eo=900,to=`o:world`,no=null,ro=6;function io(){G.followAction.value&&(G.followAction.value=!1,X.announce(`You moved the map, so it no longer follows the program. Turn Follow on to let it move again.`))}function ao(e,t=0,n=0){e===`down`?no={x:t,y:n}:e===`move`?no&&Math.hypot(t-no.x,n-no.y)>ro&&(no=null,io()):e===`up`?no=null:io()}function oo(){q.flyTo.value=to}{let e,t=null,n=0,r=null,i=!0;Rn(()=>{let e=K.parts.length.value===0;e&&!i&&(t=null,r=null),i=e}),Rn(()=>{if(!G.followAction.value){t=null,r=null,clearTimeout(e);return}let{debug:i,main:a,loop:o,focus:s}=K.parts,c=i.value,l=a.value,u=o.value,d=s.value;if(!c||!l||!u||!d)return;let f=K.player.value?.playing===!0,p=gi({debug:c,main:l,loop:u}),m=f?p?.id??null:(c.paused?p?.id:null)??d.at??d.waiting[0]?.at??p?.id??null,h=G.tab.value===`source`,g=Ca.state.value;if(h||(r=null),m===null)return;let _=m!==t,v=h&&g.status===`ready`&&m!==r;if(!_&&!v)return;clearTimeout(e);let y=Math.max($a,_&&f?n+eo-performance.now():0);e=setTimeout(()=>{G.followAction.peek()&&(_&&(t=m,n=performance.now(),q.flyTo.value=m),v&&g.status===`ready`&&(r=m,wa.showLater(Ti(g.store,Da.peek(),m))))},y)})}function Z({label:e,children:t,state:n,onAct:r,keys:i,pressed:a,kind:o=`plain`,class:s}){let c=Le(),l=n&&!n.enabled?n.reason??`Not available.`:null,u=l?`${e}: ${l}`:null,d=()=>{u&&(q.hint.value=u)},f=()=>{u&&q.hint.value===u&&(q.hint.value=null)};return M(`button`,{type:`button`,class:`ctl ctl--${o}${l?` is-off`:``}${a?` is-pressed`:``}${s?` ${s}`:``}`,"aria-label":e,"aria-disabled":l?`true`:void 0,"aria-pressed":a===void 0?void 0:a?`true`:`false`,"aria-describedby":l?c:void 0,title:u??(i?`${e} (${i})`:e),onFocus:d,onBlur:f,onPointerEnter:d,onPointerLeave:e=>{e.pointerType===`mouse`&&document.activeElement!==e.currentTarget&&f()},onClick:()=>{u?(q.hint.value=u,X.announce(u)):(q.hint.value=null,r())},children:[t??e,l?M(`span`,{id:c,class:`sr-only`,children:[`Not available. `,l]}):null]})}var so={play:`M4.5 2.8v10.4L13 8z`,pause:`M4 3h3v10H4zM9 3h3v10H9z`,stop:`M3.5 3.5h9v9h-9z`,stepForward:`M3 3l7 5-7 5zM11 3h2v10h-2z`,stepBack:`M13 3L6 8l7 5zM3 3h2v10H3z`,toStart:`M4 3h2v10H4zM13 3L7 8l6 5z`,toEnd:`M10 3h2v10h-2zM3 3l6 5-6 5z`,stepOver:`M2.5 9a5.5 5.5 0 0 1 10.3-2.7l1.2-1.6.6 4.6-4.5-.9 1.5-1.2A3.9 3.9 0 0 0 4.1 9zM6.6 11.4a1.6 1.6 0 1 0 3.2 0 1.6 1.6 0 0 0-3.2 0z`,stepInto:`M7.2 1.5h1.6v5.9l2-2 1.1 1.1L8 10.4 4.1 6.5l1.1-1.1 2 2zM6.4 12.6a1.6 1.6 0 1 0 3.2 0 1.6 1.6 0 0 0-3.2 0z`,stepOut:`M7.2 10.4h1.6V4.5l2 2 1.1-1.1L8 1.5 4.1 5.4l1.1 1.1 2-2zM6.4 12.6a1.6 1.6 0 1 0 3.2 0 1.6 1.6 0 0 0-3.2 0z`,bug:`M5.5 3.2A2.6 2.6 0 0 1 8 1.5a2.6 2.6 0 0 1 2.5 1.7l1.4-1 .8 1.2-1.7 1.2c.3.5.5 1.1.5 1.7h2v1.5h-2v1.2l1.9 1.3-.8 1.3-1.5-1A3.5 3.5 0 0 1 8 13.5a3.5 3.5 0 0 1-3.1-2l-1.5 1-.8-1.2 1.9-1.3V7.8h-2V6.3h2c0-.6.2-1.2.5-1.7L3.3 3.4l.8-1.2z`,close:`M3.6 2.5L8 6.9l4.4-4.4 1.1 1.1L9.1 8l4.4 4.4-1.1 1.1L8 9.1l-4.4 4.4-1.1-1.1L6.9 8 2.5 3.6z`,help:`M8 1.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13zm-.8 9.2h1.6v1.6H7.2zM8 3.7c1.5 0 2.6 1 2.6 2.3 0 1-.6 1.6-1.2 2-.5.4-.7.6-.7 1.2H7.3c0-1.1.5-1.6 1.1-2 .5-.4.8-.6.8-1.1 0-.5-.5-.9-1.2-.9s-1.2.4-1.3 1.1L5.2 6C5.4 4.600 6.500 3.700 8 3.700z`,theme:`M8 1.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13zM8 3v10A5 5 0 0 1 8 3z`,map:`M8 1.5c-2.5 0-4.500 1.900-4.500 4.400 0 3.100 4.500 8.600 4.500 8.600s4.500-5.500 4.500-8.600c0-2.500-2-4.400-4.500-4.400zm0 6.200a1.800 1.800 0 1 1 0-3.600 1.800 1.800 0 0 1 0 3.600z`,code:`M5.600 3.800l1.100 1.100L3.600 8l3.100 3.100-1.100 1.100L1.400 8zM10.400 3.800l4.200 4.200-4.200 4.200-1.100-1.100L12.400 8 9.300 4.900z`,external:`M9 2h5v5h-1.500V4.600L7.600 9.500 6.500 8.400l4.900-4.900H9zM3 4h4v1.500H4.500v6h6V9H12v4H3z`,save:`M3 2h8l2 2v10H3zM5 3.500v3h5v-3zM5 9.500v3h6v-3z`,open:`M2 3.500h4.500l1.500 1.500H14v8H2zM3.500 6.500v5h9v-5z`,share:`M12 1.800a2.200 2.200 0 1 1-1.800 3.500L6.400 7.300a2.200 2.200 0 0 1 0 1.400l3.800 2a2.200 2.200 0 1 1-.7 1.300l-3.800-2a2.200 2.200 0 1 1 0-4l3.800-2A2.200 2.200 0 0 1 12 1.800z`,follow:`M8 1.500a6.500 6.500 0 1 0 0 13 6.500 6.500 0 0 0 0-13zM8 3a5 5 0 1 1 0 10A5 5 0 0 1 8 3zm0 2.500a2.500 2.500 0 1 0 0 5 2.500 2.500 0 0 0 0-5z`,chevronUp:`M8 4.500l5.500 5.500-1.100 1.100L8 6.700l-4.400 4.400L2.500 10z`,chevronDown:`M8 11.500L2.500 6l1.100-1.100L8 9.300l4.400-4.400L13.500 6z`,chevronRight:`M11.500 8L6 13.500l-1.100-1.100L9.300 8 4.900 3.600 6 2.500z`,jump:`M2 7.200h8.300L7.700 4.600l1.100-1.100L13.300 8l-4.500 4.500-1.100-1.100 2.600-2.600H2z`,legend:`M8 1.500a6.500 6.500 0 1 0 0 13 6.500 6.500 0 0 0 0-13zm-.800 5.700h1.600v4.500H7.200zm0-2.900h1.600v1.600H7.200z`};function Q({name:e}){return M(`svg`,{class:`icon`,viewBox:`0 0 16 16`,width:`16`,height:`16`,"aria-hidden":`true`,focusable:`false`,children:M(`path`,{d:so[e],fill:`currentColor`,"fill-rule":`evenodd`})})}var co=[`timers`,`pending`,`idle`,`prepare`,`poll`,`check`,`closing`];function lo(){let e=Y.source.value.kind===`snippet`,t=G.poolSize.value,n=X.controls.value.debug.reason,r=[e?G.module.value===`esm`?`ES module`:`CommonJS`:`file`,t===null?`default pool size`:`pool size ${t}`,G.pauseOnStart.value?`pause on start`:null,G.itemLocations.value?`item locations`:null].filter(Boolean).join(` · `);return M(`details`,{class:`fold`,children:[M(`summary`,{class:`fold__summary`,children:[M(`span`,{class:`label`,children:`Options`}),M(`span`,{class:`fold__state muted`,children:r})]}),M(`div`,{class:`runopts`,role:`group`,"aria-label":`Options for the next run`,children:[M(`label`,{class:`field field--inline`,title:e?`How Node.js loads the snippet`:`A file runs the way Node.js would run it; this choice applies to the editor snippet only`,children:[M(`span`,{class:`field__label`,children:`Module`}),M(`select`,{class:`select`,disabled:!e,value:G.module.value,onChange:e=>{G.module.value=e.currentTarget.value===`esm`?`esm`:`commonjs`},children:[M(`option`,{value:`commonjs`,children:`CommonJS`}),M(`option`,{value:`esm`,children:`ES module`})]})]}),M(`label`,{class:`field field--inline`,title:`UV_THREADPOOL_SIZE for the next run. Empty leaves the environment alone (libuv's default is 4).`,children:[M(`span`,{class:`field__label`,children:`Pool size`}),M(`input`,{class:`input input--num`,type:`number`,inputMode:`numeric`,min:1,max:$i,placeholder:`default`,value:t??``,onChange:e=>{let t=e.currentTarget.value.trim(),n=Number(t);G.poolSize.value=t!==``&&Number.isInteger(n)&&n>=1&&n<=1024?n:null}})]}),M(`label`,{class:`check`,title:n??`Debug stops at the first statement of the program`,children:[M(`input`,{type:`checkbox`,checked:G.pauseOnStart.value,onChange:e=>{G.pauseOnStart.value=e.currentTarget.checked}}),`Pause on start (Debug)`]}),M(`label`,{class:`check runopts__wide`,title:`For every timer, promise, request and handle, the helper captures a stack to find the line of your program that created it.`,children:[M(`input`,{type:`checkbox`,checked:G.itemLocations.value,onChange:e=>{G.itemLocations.value=e.currentTarget.checked}}),M(`span`,{children:[`Record the line that created each item. `,M(`span`,{class:`muted`,children:`Slows programs that create many items: about 1.9 times as long for 20,000 timers.`})]})]})]})]})}function uo(){let e=X.controls.value,t=X.gates.value,[n,r]=k(`poll`),i=ct(e),a=X.provider.value?.caps.gates.phase===!0,o=X.liveStatus.value,s=o===`running`||o===`paused`||o===`gated`,c=[t.phase?`stop at the first phase`:null,t.timer?`before timers`:null,t.poolStart?`before pool jobs start`:null,t.poolPost?`before pool results are posted`:null].filter(e=>e!==null),l=a?s?`the program is running: these act now`:c.length>0?`armed for the next run: ${c.join(`, `)}`:`choose here before you run: a program is over in milliseconds`:`not on this Node.js: needs the probe build`,u=j(null);return A(()=>{u.current&&(u.current.open=a)},[a]),M(`details`,{class:`fold gates`,ref:u,children:[M(`summary`,{class:`fold__summary`,children:[M(`span`,{class:`label`,children:`Loop gates`}),M(`span`,{class:`fold__state${c.length>0&&a&&!s?` fold__state--armed`:` muted`}`,children:l})]}),M(`div`,{class:`gates__row`,role:`group`,"aria-label":`Event loop gates (probe build)`,children:[s||!a?M(Z,{label:`Pause at the next phase`,state:e.pauseAtNextPhase,onAct:()=>void X.gate({kind:`pauseAtNextPhase`}),children:`Next phase`}):M(Z,{label:`Start the next run stopped at the first phase`,pressed:t.phase,state:e.pauseAtNextPhase,onAct:()=>void X.setGate(`phase`,!t.phase),children:`Start stopped at the first phase`}),M(Z,{label:`Step one phase`,state:e.stepPhase,onAct:()=>void X.gate({kind:`stepPhase`}),children:`Step phase`}),M(`span`,{class:`gates__runto`,children:[M(Z,{label:`Run to the ${Zt[n]} phase`,state:e.runToPhase,onAct:()=>void X.gate({kind:`runToPhase`,phase:n}),children:`Run to`}),M(`select`,{class:`select`,"aria-label":`Phase to run to`,value:n,onChange:e=>r(e.currentTarget.value),children:co.map(e=>M(`option`,{value:e,children:Zt[e]},e))})]}),M(`span`,{class:`label gates__title`,children:`Stop before`}),M(Z,{label:`Stop before a timer fires`,pressed:t.timer,state:e.gateTimer,onAct:()=>void X.setGate(`timer`,!t.timer),children:`Timer`}),M(Z,{label:`Stop before a pool thread starts a job`,pressed:t.poolStart,state:e.gatePoolStart,onAct:()=>void X.setGate(`poolStart`,!t.poolStart),children:`Pool start`}),M(Z,{label:`Stop before a pool thread posts its result`,pressed:t.poolPost,state:e.gatePoolPost,onAct:()=>void X.setGate(`poolPost`,!t.poolPost),children:`Pool post`}),M(Z,{label:`Resume from the gate`,state:e.gateResume,onAct:()=>void X.gate({kind:`resume`}),children:`Resume`})]}),i?M(`p`,{class:`gates__why`,children:i}):null]})}function fo(){let e=X.controls.value,t=X.liveStatus.value===`paused`;return M(`div`,{class:`runbar`,children:[M(`div`,{class:`toolbar`,role:`toolbar`,"aria-label":`Run and debug`,children:[M(Z,{label:`Run`,kind:`primary`,keys:`Ctrl+Enter`,state:e.run,onAct:()=>void X.start(`free`),children:[M(Q,{name:`play`}),M(`span`,{children:`Run`})]}),M(Z,{label:`Debug`,keys:`Ctrl+Shift+Enter`,state:e.debug,onAct:()=>void X.start(`debug`),children:[M(Q,{name:`bug`}),M(`span`,{children:`Debug`})]}),M(Z,{label:`Stop`,kind:`danger`,keys:`Ctrl+.`,state:e.stop,onAct:()=>void X.stop(),children:[M(Q,{name:`stop`}),M(`span`,{children:`Stop`})]}),M(`span`,{class:`toolbar__sep`,"aria-hidden":`true`}),t?M(Z,{label:`Resume the program`,keys:`F8`,class:`ctl--icon`,state:e.resume,onAct:()=>void X.debug(`resume`),children:M(Q,{name:`play`})}):M(Z,{label:`Pause the program`,keys:`F8`,class:`ctl--icon`,state:e.pause,onAct:()=>void X.debug(`pause`),children:M(Q,{name:`pause`})}),M(Z,{label:`Step over`,keys:`F10`,class:`ctl--icon`,state:e.stepOver,onAct:()=>void X.debug(`stepOver`),children:M(Q,{name:`stepOver`})}),M(Z,{label:`Step into`,keys:`F11`,class:`ctl--icon`,state:e.stepInto,onAct:()=>void X.debug(`stepInto`),children:M(Q,{name:`stepInto`})}),M(Z,{label:`Step out`,keys:`Shift+F11`,class:`ctl--icon`,state:e.stepOut,onAct:()=>void X.debug(`stepOut`),children:M(Q,{name:`stepOut`})})]}),M(`div`,{class:`runbar__folds`,children:[M(lo,{}),M(uo,{})]})]})}var po={observed:void 0,inferred:`4.6 3.25`,model:`0.01 3.13`};function mo({c:e}){return M(`svg`,{class:`mark-glyph mark-glyph--${e}`,viewBox:`0 0 14 14`,width:`14`,height:`14`,"aria-hidden":`true`,focusable:`false`,children:[M(`circle`,{cx:`7`,cy:`7`,r:`5`,fill:`none`,stroke:`currentColor`,"stroke-width":e===`model`?2:1.75,"stroke-dasharray":po[e],"stroke-linecap":e===`model`?`round`:`butt`}),e===`observed`?M(`circle`,{cx:`7`,cy:`7`,r:`2.4`,fill:`currentColor`}):null]})}function ho({c:e,rule:t=null,index:n=null,subject:r,tabbable:i=!0}){return M(`button`,{type:`button`,class:`mark mark--${e}`,"aria-label":`${Qr[e]}. How we know: ${r}`,title:`${Qr[e]} - how we know`,tabIndex:i?0:-1,"data-certainty":e,onClick:i=>{i.stopPropagation(),Ua({certainty:e,ruleId:t,index:n,subject:r})},children:M(mo,{c:e})})}function go({fact:e,subject:t,tabbable:n}){return e?M(ho,{c:e.c,rule:e.rule,index:e.index,subject:t,...n===void 0?{}:{tabbable:n}}):null}function _o(){let e=Oa.value,t=Na.value,n=e.origin===`recording`;return M(`div`,{class:`editor__head`,children:[e.files.length>1?M(`select`,{class:`select`,"aria-label":`File of the recording`,value:Math.min(q.recordingSource.value,e.files.length-1),onChange:e=>{q.recordingSource.value=Number(e.currentTarget.value)},children:e.files.map((e,t)=>M(`option`,{value:t,children:e},t))}):M(`span`,{class:`editor__name mono ellipsis`,title:e.name,children:e.name}),M(`span`,{class:`editor__kind muted`,children:n?`from the recording · read-only · never run`:Y.source.value.kind===`file`?`file on disk · read-only here · Run starts the file itself`:Ta.value?`snippet · ${G.module.value===`esm`?`ES module`:`CommonJS`}`:`read-only`}),t?M(`button`,{type:`button`,class:`editor__line mark-inline mark--${t.certainty}`,title:`How we know`,onClick:()=>Ua({certainty:t.certainty,ruleId:null,index:null,subject:t.kind===`paused`?`JavaScript is paused on line ${t.line}`:`the callback that is running was scheduled on line ${t.line} (where it runs is not known without a pause)`}),children:[M(mo,{c:t.certainty}),t.kind===`paused`?`paused on line ${t.line}`:`running callback was scheduled on line ${t.line}`]}):null]})}function vo(){let e=Oa.value,t=Ta.value,n=e.origin===`program`&&t,r=q.reveal.value,i=Na.value,a=X.kind.value===`live`&&X.liveStatus.value!==`idle`&&!e.readOnly?`Edits apply to the next run.`:null;return M(`section`,{class:`editor`,"aria-label":`Program`,children:[t?M(fo,{}):null,M(_o,{}),e.text===null?M(`p`,{class:`empty`,children:e.missing}):M(rt,{text:e.text,language:`javascript`,readOnly:e.readOnly,label:e.readOnly?`Program text of ${e.name}, read-only`:`Program text of ${e.name}`,onChange:n?e=>Y.setSnippetText(e):void 0,breakpoints:n?Y.breakpoints.value:void 0,onToggleBreakpoint:n?e=>Y.toggleBreakpoint(e):void 0,onBreakpointsMoved:n?e=>Y.setBreakpoints(e):void 0,lineMark:i?{line:i.line,kind:i.kind}:null,range:r?{start:r.start,end:r.end}:null,revealKey:r?.ticket}),a?M(`p`,{class:`editor__note muted`,children:a}):null]})}var $=(e,t={})=>({key:e,...t}),yo=[{id:`player.toggle`,group:`Playback`,label:`Play or pause`,combos:[$(` `),$(`k`)]},{id:`player.slower`,group:`Playback`,label:`Slower`,combos:[$(`-`)]},{id:`player.faster`,group:`Playback`,label:`Faster`,combos:[$(`+`),$(`=`)]},{id:`player.start`,group:`Playback`,label:`Go to the start`,combos:[$(`Home`)]},{id:`player.end`,group:`Playback`,label:`Go to the end`,combos:[$(`End`)]},{id:`player.followLive`,group:`Playback`,label:`Follow the live run`,combos:[$(`l`)]},{id:`player.stepBack`,group:`Stepping through the recording`,label:`Previous step`,combos:[$(`ArrowLeft`)]},{id:`player.stepForward`,group:`Stepping through the recording`,label:`Next step`,combos:[$(`ArrowRight`)]},{id:`player.eventBack`,group:`Stepping through the recording`,label:`Previous event (raw signals too)`,combos:[$(`ArrowLeft`,{shift:!0}),$(`,`)]},{id:`player.eventForward`,group:`Stepping through the recording`,label:`Next event (raw signals too)`,combos:[$(`ArrowRight`,{shift:!0}),$(`.`)]},{id:`player.callbackBack`,group:`Stepping through the recording`,label:`Previous callback`,combos:[$(`c`,{shift:!0})]},{id:`player.callbackForward`,group:`Stepping through the recording`,label:`Next callback`,combos:[$(`c`)]},{id:`player.phaseBack`,group:`Stepping through the recording`,label:`Previous loop phase`,combos:[$(`p`,{shift:!0})]},{id:`player.phaseForward`,group:`Stepping through the recording`,label:`Next loop phase`,combos:[$(`p`)]},{id:`player.turnBack`,group:`Stepping through the recording`,label:`Previous loop turn`,combos:[$(`t`,{shift:!0})]},{id:`player.turnForward`,group:`Stepping through the recording`,label:`Next loop turn`,combos:[$(`t`)]},{id:`player.outputBack`,group:`Stepping through the recording`,label:`Previous output`,combos:[$(`o`,{shift:!0})]},{id:`player.outputForward`,group:`Stepping through the recording`,label:`Next output`,combos:[$(`o`)]},{id:`player.pauseBack`,group:`Stepping through the recording`,label:`Previous debugger pause`,combos:[$(`b`,{shift:!0})]},{id:`player.pauseForward`,group:`Stepping through the recording`,label:`Next debugger pause`,combos:[$(`b`)]},{id:`run.run`,group:`Running and debugging`,label:`Run`,combos:[$(`Enter`,{ctrl:!0})],helperOnly:!0},{id:`run.debug`,group:`Running and debugging`,label:`Debug`,combos:[$(`Enter`,{ctrl:!0,shift:!0})],helperOnly:!0},{id:`run.stop`,group:`Running and debugging`,label:`Stop`,combos:[$(`.`,{ctrl:!0})],helperOnly:!0},{id:`debug.pauseResume`,group:`Running and debugging`,label:`Pause or resume the program`,combos:[$(`F8`),$(`\\`,{ctrl:!0})],helperOnly:!0},{id:`debug.stepOver`,group:`Running and debugging`,label:`Step over`,combos:[$(`F10`),$(`'`,{ctrl:!0})],helperOnly:!0},{id:`debug.stepInto`,group:`Running and debugging`,label:`Step into`,combos:[$(`F11`),$(`;`,{ctrl:!0})],helperOnly:!0},{id:`debug.stepOut`,group:`Running and debugging`,label:`Step out`,combos:[$(`F11`,{shift:!0}),$(`:`,{ctrl:!0,shift:!0})],helperOnly:!0},{id:`view.followAction`,group:`View`,label:`Follow the action on the map and in the source panel`,combos:[$(`f`)]},{id:`view.legend`,group:`View`,label:`Open the certainty legend`,combos:[$(`i`)]},{id:`view.theme`,group:`View`,label:`Switch between light and dark`,combos:[$(`d`,{shift:!0})]},{id:`view.help`,group:`View`,label:`Show keyboard shortcuts`,combos:[$(`?`),$(`F1`)]},{id:`view.tab1`,group:`View`,label:`Show panel 1 to 8`,combos:[$(`1`)]},{id:`view.tab2`,group:`View`,label:`Show panel 2`,combos:[$(`2`)]},{id:`view.tab3`,group:`View`,label:`Show panel 3`,combos:[$(`3`)]},{id:`view.tab4`,group:`View`,label:`Show panel 4`,combos:[$(`4`)]},{id:`view.tab5`,group:`View`,label:`Show panel 5`,combos:[$(`5`)]},{id:`view.tab6`,group:`View`,label:`Show panel 6`,combos:[$(`6`)]},{id:`view.tab7`,group:`View`,label:`Show panel 7`,combos:[$(`7`)]},{id:`view.tab8`,group:`View`,label:`Show panel 8`,combos:[$(`8`)]}];function bo(e){return e.length===1}function xo(e,t){let n=t.ctrlKey||t.metaKey;return!!e.ctrl!==n||!!e.alt!==t.altKey?!1:/^[a-z]$/i.test(e.key)?t.key.toLowerCase()===e.key.toLowerCase()&&!!e.shift===t.shiftKey:bo(e.key)&&e.key!==` `?t.key===e.key&&(!e.shift||t.shiftKey):t.key===e.key&&!!e.shift===t.shiftKey}function So(e,t,n){for(let r of yo)if(!r.helperOnly||n)for(let n of r.combos){if(!xo(n,e))continue;let i=!n.ctrl&&!n.alt&&!/^F\d+$/.test(n.key);if(!(t&&i))return r.id}return null}var Co={" ":`Space`,ArrowLeft:`←`,ArrowRight:`→`,ArrowUp:`↑`,ArrowDown:`↓`};function wo(e,t=!1){let n=[];return e.ctrl&&n.push(t?`⌘`:`Ctrl`),e.alt&&n.push(t?`⌥`:`Alt`),e.shift&&n.push(`Shift`),n.push(Co[e.key]??(e.key.length===1?e.key.toUpperCase():e.key)),n}function To(e,t){let{start:n,width:r}=e;if(r<=0)return 0;let i=0,a=r-1;for(;i<a;){let e=i+a+1>>1;n[e]<=t?i=e:a=e-1}return i}function Eo(e,t){if(e.length<=0||e.width<=0)return 0;let n=Math.min(Math.max(0,t),e.length);if(e.axis===`index`){let t=e.to-e.from;return t<=0?0:Math.min(1,Math.max(0,(n-e.from)/t))}if(n<=0)return 0;let r=To(e,n-1),i=e.start[r],a=e.events[r],o=a>0?Math.min(1,(n-i)/a):1;return Math.min(1,(r+o)/e.width)}function Do(e,t){let n=Math.min(1,Math.max(0,t));return e.axis===`time`?{do:`seekTime`,t:e.from+n*(e.to-e.from)}:{do:`seek`,position:Math.min(e.length,Math.max(0,Math.round(e.from+n*(e.to-e.from))))}}function Oo(e,t){return e<=0||t<=0?0:Math.min(1,Math.sqrt(e/t))}function ko(e){return Math.min(1e3,Math.max(50,Math.floor(e/2)))}function Ao(){let e=j(null),[t,n]=k({width:0,height:0});return Pe(()=>{let t=e.current;if(!t)return;let r=()=>{let e=t.clientWidth,r=t.clientHeight;n(t=>t.width===e&&t.height===r?t:{width:e,height:r})};r();let i=new ResizeObserver(r);return i.observe(t),()=>i.disconnect()},[]),[e,t]}function jo(e){return typeof matchMedia==`function`&&matchMedia(e).matches}function Mo(e){let[t,n]=k(()=>jo(e));return A(()=>{let t=matchMedia(e),r=()=>n(t.matches);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}function No(){return Mo(`(pointer: coarse)`)?44:24}function Po(e){if(e.ctrlKey||e.metaKey||e.altKey)return;let t=e.currentTarget,n=document.activeElement,r=e.key;if(r===`m`||r===`i`||r===`j`){let i=n?.closest(`[data-rowbox]`);if(!i||!t.contains(i))return;let a=r===`m`?`[data-act="map"]`:r===`i`?`.mark`:`[data-act="jump"]`,o=i.querySelector(a);if(!o)return;e.preventDefault(),e.stopPropagation(),o.click();return}if(r!==`ArrowDown`&&r!==`ArrowUp`&&r!==`Home`&&r!==`End`)return;let i=[...t.querySelectorAll(`[data-row]`)];if(i.length===0)return;let a=n?i.indexOf(n):-1,o=a;if(o=r===`ArrowDown`?Math.min(i.length-1,a+1):r===`ArrowUp`?Math.max(0,a-1):r===`Home`?0:i.length-1,o===a||o<0)return;e.preventDefault(),e.stopPropagation();for(let e of i)e.tabIndex=-1;let s=i[o];s.tabIndex=0,s.focus()}var Fo=[{keys:[`↑`,`↓`],label:`Move between rows of a list`},{keys:[`Enter`],label:`Go to the event of the row`},{keys:[`M`],label:`Show the row on the map`},{keys:[`I`],label:`Explain the certainty mark of the row`}],Io=44,Lo=[[`cb.nextTick`,`--q-nextTick`],[`cb.microtask`,`--q-microtask`],[`cb.timers`,`--q-timers`],[`cb.immediate`,`--q-immediate`],[`cb.pool`,`--q-pool`],[`cb.io`,`--q-io`],[`cb.close`,`--q-close`],[`cb.other`,`--ink-3`]].map(([e,t])=>({index:rr.indexOf(e),color:t})),Ro={timers:`--q-timers`,pending:`--q-pool`,idle:`--line-strong`,prepare:`--line-strong`,poll:`--q-io`,check:`--q-immediate`,closing:`--q-close`},zo=null;function Bo(e,t){let n=`${t}|${matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}`;if(zo?.key===n)return zo.get;let r=getComputedStyle(e),i=new Map,a=e=>{let t=i.get(e);return t===void 0&&(t=r.getPropertyValue(e).trim()||`#888`,i.set(e,t)),t};for(let e of[`--surface-2`,`--line-strong`,`--warn`,`--ink-3`,`--ink`,`--danger`,...Lo.map(e=>e.color),...Object.values(Ro)])a(e);return zo={key:n,get:e=>i.get(e)??`#888`},zo.get}function Vo(e,t){let n=e.getContext(`2d`);if(!n)return;let r=Math.min(3,window.devicePixelRatio||1),i=Math.max(1,Math.floor(t.width)),a=t.height>0?Math.floor(t.height):Io;(e.width!==Math.round(i*r)||e.height!==Math.round(a*r))&&(e.width=Math.round(i*r),e.height=Math.round(a*r)),n.setTransform(r,0,0,r,0,0);let o=Bo(e,t.theme);n.clearRect(0,0,i,a),n.fillStyle=o(`--surface-2`),n.fillRect(0,0,i,a);let s=t.summary;if(!s||s.length===0||s.width===0)return;let c=i/s.width,l=rr.length,u=a-9,d=u-7,f=1;for(let e=0;e<s.width;e++){let t=0;for(let n of Lo)t+=s.counts[e*l+n.index];t>f&&(f=t)}let p=o(`--warn`);for(let e=0;e<s.width;e++){let t=e*c,r=ir[s.phase[e]];if(r){let i=ar[s.phaseCertainty[e]],a=i===`inferred`?2:i===`model`?3:1;e%a===0&&(n.fillStyle=o(Ro[r]??`--line-strong`),n.fillRect(t,0,Math.max(1,c-(a>1?.5:0)),5))}let i=0;for(let t of Lo)i+=s.counts[e*l+t.index];if(i>0){let r=Math.max(2,Oo(i,f)*d),a=u;for(let u of Lo){let d=s.counts[e*l+u.index];if(d===0)continue;let f=d/i*r;n.fillStyle=o(u.color),n.fillRect(t,a-f,Math.max(1,c-.5),f),a-=f}}else s.events[e]>0&&(n.fillStyle=o(`--line-strong`),n.fillRect(t,u-1,Math.max(1,c-.5),1));if(s.paused[e]){n.strokeStyle=p,n.lineWidth=1,n.save(),n.beginPath(),n.rect(t,7,c,d),n.clip(),n.beginPath();for(let e=-a;e<c+a;e+=4)n.moveTo(t+e,u),n.lineTo(t+e+d,7);n.stroke(),n.restore()}}let m=t.markers;if(m){let e=e=>(To(s,e)+.5)*c;if(m.turnIndex.length>0&&m.turnIndex.length<=i/3){n.fillStyle=o(`--ink-3`);for(let t=0;t<m.turnIndex.length;t++)n.fillRect(Math.round(e(m.turnIndex[t])),a-7,1,7)}let t=o(`--ink`),r=o(`--danger`),l=-10;for(let i=0;i<m.outputIndex.length;i++){let o=Math.round(e(m.outputIndex[i]));o!==l&&(l=o,m.outputStream[i]===1?(n.fillStyle=r,n.beginPath(),n.moveTo(o-2.5,a-1),n.lineTo(o+2.5,a-1),n.lineTo(o,a-6),n.fill()):(n.fillStyle=t,n.fillRect(o-1,a-4,3,3)))}n.fillStyle=p;for(let t of m.pauses){let r=e(t.index);n.fillRect(Math.round(r)-1,7,2,d)}}}function Ho(){let[e,t]=Ao(),n=j(null),r=j(null),i=j(null),a=j(0),o=K.timeline.value,s=K.markers.value,c=K.player.value,l=G.timelineAxis.value,u=G.theme.value,d=c?.position??0,f=c?.length??0;A(()=>{t.width>0&&K.setTimeline(ko(t.width),l)},[t.width,l]),A(()=>(cancelAnimationFrame(a.current),a.current=requestAnimationFrame(()=>{n.current&&Vo(n.current,{summary:o,markers:s,width:t.width,height:t.height,theme:u})}),()=>cancelAnimationFrame(a.current)),[o?.version,o?.width,o?.axis,o?.length,s?.version,s?.outputIndex.length,t.width,t.height,u]),Pe(()=>{let e=o&&o.length>0?Eo(o,d)*t.width:0;r.current?.style.setProperty(`transform`,`translateX(${Math.min(Math.max(0,t.width-2),Math.max(0,Math.round(e)-1))}px)`),i.current?.style.setProperty(`transform`,`translateX(${e}px)`)},[o,d,t.width]),A(()=>{let e=matchMedia(`(prefers-color-scheme: dark)`),t=()=>{n.current&&Vo(n.current,{summary:K.timeline.peek(),markers:K.markers.peek(),width:n.current.clientWidth,height:n.current.clientHeight,theme:`system`})};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let p=t=>{let n=e.current;if(!n||!o||o.length===0)return;let r=n.getBoundingClientRect();K.command({do:`pause`}),K.command(Do(o,(t-r.left)/Math.max(1,r.width)))},m=j(null),h=f===0;return M(`div`,{ref:e,class:`timeline${h?` is-empty`:``}`,role:`slider`,tabIndex:0,"aria-label":`Position in the run`,"aria-valuemin":0,"aria-valuemax":f,"aria-valuenow":d,"aria-valuetext":h?`No events`:`After event ${d} of ${f}, at ${rn(c?.t??0)}`,"aria-disabled":h?`true`:void 0,onPointerDown:e=>{e.button!==0||h||(e.currentTarget.setPointerCapture(e.pointerId),p(e.clientX))},onPointerMove:e=>{if(!e.currentTarget.hasPointerCapture(e.pointerId))return;let t=e.clientX;m.current!==null&&cancelAnimationFrame(m.current),m.current=requestAnimationFrame(()=>{m.current=null,p(t)})},onKeyDown:e=>{if(h||e.ctrlKey||e.metaKey||e.altKey)return;let t=Math.max(1,Math.round(f/10)),n=!0;e.key===`ArrowLeft`||e.key===`ArrowDown`?Ha(e.shiftKey?`event`:`step`,-1):e.key===`ArrowRight`||e.key===`ArrowUp`?Ha(e.shiftKey?`event`:`step`,1):e.key===`PageDown`?K.command({do:`seek`,position:Math.max(0,d-t)}):e.key===`PageUp`?K.command({do:`seek`,position:Math.min(f,d+t)}):e.key===`Home`?K.command({do:`seek`,position:0}):e.key===`End`?K.command({do:`seek`,position:f}):n=!1,n&&(e.preventDefault(),e.stopPropagation())},children:[M(`canvas`,{ref:n,class:`timeline__canvas`,"aria-hidden":`true`}),M(`div`,{ref:i,class:`timeline__future`,hidden:h}),M(`div`,{ref:r,class:`timeline__cursor`,hidden:h}),h?M(`span`,{class:`timeline__empty muted`,children:`The run will appear here.`}):null]})}var Uo=[{kind:`step`,label:`Step`,hint:`One meaningful event; raw signals ride along`},{kind:`event`,label:`Event`,hint:`One event of the list, raw signals included`},{kind:`callback`,label:`Callback`,hint:`To the start of the next or previous callback`},{kind:`phase`,label:`Phase`,hint:`To the next or previous loop phase`},{kind:`turn`,label:`Loop turn`,hint:`To the next or previous loop turn`},{kind:`output`,label:`Output`,hint:`To the next or previous write to stdout or stderr`},{kind:`pause`,label:`Pause`,hint:`To the next or previous debugger pause or gate stop`}],Wo=I(`step`),Go=e=>({enabled:!1,reason:e}),Ko={enabled:!0,reason:null};function qo(){return M(`select`,{class:`select`,"aria-label":`What the step buttons move by`,value:Wo.value,onChange:e=>{Wo.value=e.currentTarget.value},children:Uo.map(e=>M(`option`,{value:e.kind,title:e.hint,children:[`by `,e.label.toLowerCase()]},e.kind))})}function Jo(){return M(`select`,{class:`select`,"aria-label":`Playback speed`,value:String(G.speed.value),onChange:e=>{let t=Number(e.currentTarget.value);Ui.includes(t)&&(G.speed.value=t)},children:Ui.map(e=>M(`option`,{value:String(e),children:[e,`×`]},e))})}function Yo(){let e=K.player.value,t=e?.length??0,n=e?.position??0,r=t===0,i=Go(`There is no run or recording to play yet.`),a=n<=0,o=n>=t,s=Uo.find(e=>e.kind===Wo.value)??Uo[0],c=e?.live??!1,l=e?.deadTime??null,u=q.narrow.value,d=M(Z,{label:`Back one ${s.label.toLowerCase()}`,keys:`←`,class:`ctl--icon`,state:r?i:a?Go(`Already at the start.`):Ko,onAct:()=>Ha(s.kind,-1),children:M(Q,{name:`stepBack`})}),f=M(Z,{label:e?.playing?`Pause playback`:`Play`,keys:`Space`,kind:`primary`,class:`ctl--icon transport__play`,state:r?i:Ko,onAct:()=>{!e?.playing&&o&&!c&&K.command({do:`seek`,position:0}),K.command({do:`toggle`})},children:M(Q,{name:e?.playing?`pause`:`play`})}),p=M(Z,{label:`Forward one ${s.label.toLowerCase()}`,keys:`→`,class:`ctl--icon`,state:r?i:o?Go(`Already at the end.`):Ko,onAct:()=>Ha(s.kind,1),children:M(Q,{name:`stepForward`})}),m=M(Z,{label:G.followAction.value?`The map follows the program. Turn following off.`:`Let the map follow the program`,keys:`F`,pressed:G.followAction.value,class:`transport__follow`,onAct:()=>{G.followAction.value=!G.followAction.value},children:[M(Q,{name:`follow`}),M(`span`,{class:`transport__follow-word`,children:`Follow`})]});return u?M(`footer`,{class:`transport`,"aria-label":`Playback`,children:[M(Ho,{}),M(`div`,{class:`toolbar transport__buttons`,role:`toolbar`,"aria-label":`Playback controls`,children:[d,f,p,M(`span`,{class:`transport__pos num`,"aria-hidden":`true`,children:r?`-`:`${n} / ${t}`}),m,M(`button`,{type:`button`,class:`ctl ctl--plain transport__menu`,"aria-haspopup":`dialog`,"aria-label":`Playback options: speed ${G.speed.value}×, stepping by ${s.label.toLowerCase()}`,onClick:()=>q.dialog.value=`playback`,children:[G.speed.value,`× · `,s.label.toLowerCase()]})]})]}):M(`footer`,{class:`transport`,"aria-label":`Playback`,children:[M(`div`,{class:`toolbar transport__buttons`,role:`toolbar`,"aria-label":`Playback controls`,children:[M(Z,{label:`Go to the start`,keys:`Home`,class:`ctl--icon`,state:r?i:a?Go(`Already at the start.`):Ko,onAct:()=>K.command({do:`seek`,position:0}),children:M(Q,{name:`toStart`})}),d,f,p,M(Z,{label:`Go to the end`,keys:`End`,class:`ctl--icon`,state:r?i:o?Go(`Already at the end.`):Ko,onAct:()=>K.command({do:`seek`,position:t}),children:M(Q,{name:`toEnd`})}),M(`span`,{title:s.hint,children:M(qo,{})}),M(Jo,{})]}),M(Ho,{}),M(`div`,{class:`transport__status`,children:[M(`span`,{class:`transport__pos num`,"aria-hidden":`true`,children:[r?`-`:`${n} / ${t}`,M(`span`,{class:`muted`,children:[` · `,r?``:rn(e?.t??0)]})]}),l?M(`span`,{class:`transport__dead muted`,role:`status`,children:l.during===`nothing`?`Skipping ${an(l.ms)} in which the loop only waited`:`Skipping ${an(l.ms)} in which JavaScript ran without events`}):null,m,M(`button`,{type:`button`,class:`ctl ctl--plain`,"aria-pressed":G.timelineAxis.value===`time`?`true`:`false`,title:`Draw the strip by time instead of by event count. By time, long waits take room and bursts are narrow.`,onClick:()=>{G.timelineAxis.value=G.timelineAxis.value===`time`?`index`:`time`},children:G.timelineAxis.value===`time`?`By time`:`By events`}),Ta.value?M(Z,{label:`Follow the live run`,keys:`L`,pressed:!!(e?.follow&&c),state:c?Ko:Go(`Only while a run is in progress. A recording or a finished run has no live end to follow.`),onAct:()=>K.command({do:`follow`,on:!(e?.follow??!1)}),children:[M(`span`,{class:`live-dot${e?.following?` is-on`:``}`,"aria-hidden":`true`}),`Live`]}):null]})]})}function Xo({kind:e,children:t,onDismiss:n,role:r=`status`}){return M(`div`,{class:`banner banner--${e}`,role:r,children:[M(`div`,{class:`banner__text`,children:t}),n?M(`button`,{type:`button`,class:`ctl ctl--plain ctl--icon`,"aria-label":`Dismiss this message`,onClick:n,children:M(Q,{name:`close`})}):null]})}function Zo(){let e=K.parts.debug.value;if(!e)return null;let t=K.parts.live.value&&K.parts.position.peek()===K.parts.length.peek();if(e.paused&&e.timeKeptRunning)return M(Xo,{kind:`warn`,children:[M(`strong`,{children:[`JavaScript `,t?`is`:`was`,` paused here, but real time kept running.`]}),` Timers keep coming due and thread pool threads keep working while the program is stopped, so what happens after this pause may differ from a run without pauses.`]});if(e.paused&&!e.timeKeptRunning)return M(Xo,{kind:`info`,children:[M(`strong`,{children:`Paused with the clock frozen.`}),` The probe build holds the loop clock and the pool threads during this pause. The operating system and network peers are not held.`]});if(e.gate.stopped)return M($o,{});let n=e.lastPause;return n&&n.timeKeptRunning&&e.pauses>0?M(Xo,{kind:`info`,children:[`This run was paused `,e.pauses,` time`,e.pauses===1?``:`s`,` before this point (last for `,an(n.pausedMs),`). Real time kept running during the pauses, so the order of what follows may differ from a run without pauses.`]}):null}var Qo={phase:`before a loop phase`,turn:`at the start of a loop turn`,timer:`before Node's timer callback`,poolStart:`a pool thread holds a job it has not started`,poolPost:`a pool thread holds a finished job it has not posted`,poolDone:`the loop holds a result before its done-callback`,manual:`stopped on request`};function $o(){let e=K.parts.debug.value;if(!e)return null;let t=e.gate,n=X.controls.value,r=X.liveStatus.value===`gated`&&K.parts.live.value&&K.parts.position.peek()===K.parts.length.peek(),i=[t.phase?`${Zt[t.phase]} phase`:null,t.job?`job ${un(t.job,24)}`:null].filter(Boolean).join(`, `);return M(Xo,{kind:`warn`,children:M(`div`,{class:`gatebanner`,children:[M(`div`,{children:[M(`strong`,{children:[`Stopped at the `,t.gate??`?`,` gate`,t.gate&&Qo[t.gate]?`: ${Qo[t.gate]}`:``,i?` (${i})`:``,`.`]}),` `,e.clock.frozen?`The loop clock is frozen and the pool threads are held, so timers do not come due and no new pool work starts.`:`The program is held inside Node.js, between JavaScript callbacks.`,` `,`Not held: work already running on a pool thread, Date.now(), the operating system and network peers.`]}),r?M(`div`,{class:`gatebanner__acts`,children:[M(Z,{label:`Step one phase`,kind:`primary`,state:n.stepPhase,onAct:()=>void X.gate({kind:`stepPhase`})}),M(Z,{label:`Resume from the gate`,state:n.gateResume,onAct:()=>void X.gate({kind:`resume`}),children:`Resume`})]}):null]})})}function es(){let e=J.welcome.value,t=X.provider.value;return!e||e.atlas.matchesNode?null:M(Xo,{kind:`warn`,children:[M(`strong`,{children:`The map is for another Node.js version.`}),` It was built for `,e.atlas.tag,t?`; your Node.js is ${t.node.version}`:``,`. Boxes and line numbers may be slightly off for your version. Links still open the code of `,e.atlas.tag,`.`]})}function ts(){let e=Ya.value,t=J.status.value,n=J.error.value,r=J.notices.value,i=X.error.value,a=K.problem.value,o=Ca.state.value,s=X.recording.value;return M(`div`,{class:`banners`,children:[e?M(Xo,{kind:`error`,role:`alert`,children:e}):null,t===`connecting`?M(Xo,{kind:`info`,children:`Connecting to the helper...`}):null,(t===`closed`||t===`failed`)&&n?M(Xo,{kind:`error`,role:`alert`,children:[n,` Recordings can still be opened and played.`]}):null,M(es,{}),s&&o.status===`missing`?M(Xo,{kind:`warn`,children:[`This recording was made on Node.js `,s.header.node.version,`. The map for `,o.tag,` is not available here, so the map stays empty; the panels show the recording in full.`]}):null,X.opening.value?M(Xo,{kind:`info`,children:`Opening the recording. Nothing is being run.`}):null,i?M(Xo,{kind:`error`,role:`alert`,onDismiss:()=>X.clearError(),children:i}):null,a?M(Xo,{kind:`warn`,children:a}):null,r.map(e=>M(Xo,{kind:e.level,onDismiss:()=>J.dismiss(e.id),children:e.text},e.id)),M(Zo,{})]})}function ns(){let e=J.providers.value,t=X.provider.value;return e.length===0?null:M(`label`,{class:`field field--inline topbar__provider`,title:X.liveStatus.value===`idle`?`The Node.js binary that runs your program`:`Applies to the next run`,children:[M(`span`,{class:`field__label`,children:`Node`}),M(`select`,{class:`select`,value:t?.id??``,onChange:e=>{let t=e.currentTarget.value;(t===`user`||t===`pinned`||t===`probe`)&&(G.provider.value=t)},children:e.map(e=>M(`option`,{value:e.id,disabled:!e.available,children:[e.title,e.available?``:` - not available${e.why?`: ${e.why}`:``}`]},e.id))})]})}function rs({compact:e=!1}){let t=X.kind.value,n=X.recording.value,r=Ta.value;if(t===`recording`&&n)return M(`div`,{class:`topbar__what`,children:[M(`span`,{class:`badge badge--recording`,title:`A recording is played back from its event list. Nothing is run.`,children:`Recording`}),M(`span`,{class:`topbar__name ellipsis`,title:n.label,children:n.lesson?.title??n.header.title??n.label}),e?null:M(x,{children:[M(`span`,{class:`muted topbar__detail ellipsis`,children:[`Node `,n.header.node.version,` · `,n.events,` events`,n.origin===`link`?` · from a link`:n.origin===`lesson`?` · lesson`:``]}),M(`button`,{type:`button`,class:`ctl ctl--plain`,onClick:()=>X.closeRecording(),children:r?`Close and return to the editor`:`Close`})]})]});if(!r)return M(`div`,{class:`topbar__what topbar__what--plain`,children:M(`span`,{class:`muted`,children:`Player: opens recordings and lessons. It cannot run code.`})});let i=X.liveStatus.value,a=t===`live`&&i===`idle`&&Ea.value;return M(`div`,{class:`topbar__what`,children:[M(`button`,{type:`button`,class:`ctl ctl--plain topbar__program`,"aria-haspopup":`dialog`,title:`Choose what to run: the snippet, an example or a file`,onClick:()=>q.dialog.value=`program`,children:[M(Q,{name:`code`}),M(`span`,{class:`ellipsis`,children:Oa.value.name}),M(Q,{name:`chevronDown`})]}),t===`live`?M(`span`,{class:`badge badge--${i===`idle`?`ended`:`live`}`,children:i===`starting`?`Starting`:i===`running`?`Live run`:i===`paused`?`Live run, paused`:i===`gated`?`Live run, at a gate`:a?`Finished run`:`Run`}):null]})}function is(){return M(`button`,{type:`button`,class:`ctl ctl--plain topbar__legend`,"aria-haspopup":`dialog`,title:`What the three marks mean (I)`,onClick:()=>q.dialog.value=`legend`,children:Zr.map(e=>M(`span`,{class:`legend-item mark--${e}`,children:[M(mo,{c:e}),M(`span`,{class:`legend-item__word`,children:Qr[e]})]},e))})}function as({words:e=!1}){let t=e=>{let t=e.currentTarget,n=t.files?.[0];t.value=``,n&&(q.dialog.value===`more`&&(q.dialog.value=null),qa(n))},n=Ea.value?{enabled:!0,reason:null}:{enabled:!1,reason:`There is no run or recording yet.`},r=e?`topbar__word topbar__word--always`:`topbar__word`;return M(`div`,{class:`toolbar`,role:`toolbar`,"aria-label":`Recordings`,children:[M(`label`,{class:`ctl ctl--plain ctl--file`,title:`Open a recording file. It is played back; nothing is run.`,children:[M(Q,{name:`open`}),M(`span`,{class:r,children:`Open`}),M(`input`,{type:`file`,class:`sr-only`,accept:`.nodejs-map,.gz,.ndjson,.txt,application/gzip,text/plain`,"aria-label":`Open a recording file`,onChange:t})]}),M(Z,{label:`Save as a recording file`,state:n,onAct:()=>q.dialog.value=`save`,children:[M(Q,{name:`save`}),M(`span`,{class:r,children:`Save`})]}),M(Z,{label:`Share as a link`,state:n,onAct:()=>q.dialog.value=`share`,children:[M(Q,{name:`share`}),M(`span`,{class:r,children:`Share`})]})]})}function os(){let e=Ta.value;return q.narrow.value?M(`header`,{class:`topbar`,children:[M(`h1`,{class:`topbar__brand`,children:`nodejs-map`}),M(rs,{compact:!0}),M(`button`,{type:`button`,class:`ctl ctl--plain topbar__more`,"aria-haspopup":`dialog`,"aria-label":`More: open, save, share, legend, theme, help`,onClick:()=>q.dialog.value=`more`,children:`More`})]}):M(`header`,{class:`topbar`,children:[M(`h1`,{class:`topbar__brand`,children:`nodejs-map`}),M(rs,{}),M(`div`,{class:`topbar__right`,children:[e?M(ns,{}):null,M(as,{}),M(is,{}),M(`button`,{type:`button`,class:`ctl ctl--plain ctl--icon`,"aria-label":`Switch between light and dark`,title:`Light or dark (Shift+D)`,onClick:Ga,children:M(Q,{name:`theme`})}),M(`button`,{type:`button`,class:`ctl ctl--plain ctl--icon`,"aria-label":`Keyboard shortcuts and help`,"aria-haspopup":`dialog`,title:`Keyboard shortcuts (?)`,onClick:()=>q.dialog.value=`help`,children:M(Q,{name:`help`})})]})]})}function ss({title:e,onClose:t,children:n,wide:r}){let i=j(null),a=Le(),o=j(!0),s=()=>{o.current&&t()};return A(()=>{let e=i.current;if(!e)return;let t=document.activeElement instanceof HTMLElement?document.activeElement:null;return e.open||e.showModal(),()=>{o.current=!1,e.open&&e.close(),t?.isConnected&&(document.activeElement===document.body||document.activeElement===null||e.contains(document.activeElement))&&t.focus()}},[]),M(`dialog`,{ref:i,class:`dialog${r?` dialog--wide`:``}`,"aria-labelledby":a,onClose:s,onCancel:e=>{e.preventDefault(),s()},onClick:e=>{e.target===i.current&&s()},children:[M(`header`,{class:`dialog__head`,children:[M(`h2`,{id:a,class:`dialog__title`,children:e}),M(`button`,{type:`button`,class:`ctl ctl--plain ctl--icon`,"aria-label":`Close`,onClick:s,children:M(Q,{name:`close`})})]}),M(`div`,{class:`dialog__body`,children:n})]})}var cs=()=>{q.dialog.value=null};function ls(){return M(ss,{title:`How sure is each thing on screen?`,onClose:cs,children:[M(`p`,{class:`dialog__lead`,children:`Everything nodejs-map shows about your program carries one of three marks. The shape of the mark tells them apart; the colour only repeats it.`}),M(`ul`,{class:`legend`,children:Zr.map(e=>M(`li`,{class:`legend__row edge edge--${e}`,children:[M(`span`,{class:`mark-inline mark--${e}`,children:M(mo,{c:e})}),M(`div`,{children:[M(`strong`,{children:Qr[e]}),M(`span`,{class:`muted`,children:[` · `,e===`observed`?`solid`:e===`inferred`?`dashed`:`dotted`,` line`]}),M(`p`,{children:$r[e]})]})]},e))}),M(`p`,{children:`The same three line styles mark the left edge of rows, the lit segment of the phase ring, the phase band of the timeline and the highlights on the map. Select any mark to read how that fact is known: for an inferred or model fact, the rule that produced it and the Node.js source the rule relies on.`})]})}function us({id:e}){let t=Ca.state.value,n=Da.value,[r,i]=k(null);A(()=>{let r=!0;if(i(null),t.status===`ready`)return Ti(t.store,n,e).then(e=>{r&&i(e)}),()=>{r=!1}},[e,t,n]);let a=r&&r.start!==null&&r.end!==null?`#L${r.start}-L${r.end}`:``;return M(`li`,{class:`cite`,children:[M(`div`,{class:`cite__main`,children:[M(`span`,{class:`cite__title`,children:r?r.title:e}),r?.path?M(`span`,{class:`cite__path mono muted`,children:[r.path,a]}):M(`span`,{class:`cite__path mono muted`,children:t.status===`ready`?r?r.note??e:`Looking it up...`:e})]}),M(`div`,{class:`cite__acts`,children:[r?.github?M(`a`,{class:`ctl ctl--plain`,href:r.github,target:`_blank`,rel:`noreferrer noopener`,children:[M(Q,{name:`external`}),M(`span`,{children:`GitHub`})]}):null,M(`button`,{type:`button`,class:`ctl ctl--plain`,onClick:()=>{q.mark.value=null,La(e)},children:`Read here`}),M(`button`,{type:`button`,class:`ctl ctl--plain ctl--icon`,"aria-label":`Show ${r?.title??e} on the map`,title:`Show on the map`,onClick:()=>{q.mark.value=null,Ia(e)},children:M(Q,{name:`map`})})]})]})}function ds({rule:e}){let t=Ca.state.value;return M(`section`,{class:`rule`,"aria-label":`Rule ${e.id}`,children:[M(`h3`,{class:`rule__title`,children:[M(`span`,{class:`rule__id mono`,children:e.id}),` `,e.title]}),M(`p`,{class:`rule__statement`,children:e.statement}),M(`dl`,{class:`facts`,children:[M(`div`,{children:[M(`dt`,{children:`Produces`}),M(`dd`,{children:[M(`span`,{class:`mark-inline mark--${e.yields}`,children:M(mo,{c:e.yields})}),` `,Qr[e.yields].toLowerCase(),` facts`]})]}),M(`div`,{children:[M(`dt`,{children:`Holds on`}),M(`dd`,{children:ai[e.platform]})]})]}),M(`h4`,{class:`label`,children:`Node.js source this rule relies on`}),t.status===`ready`?null:M(`p`,{class:`callout callout--info`,children:`The map data is not loaded, so the citations below are shown by their ids and cannot be turned into links to files.`}),M(`ul`,{class:`cites`,children:e.cites.map(e=>M(us,{id:e},e))})]})}function fs(){let e=q.mark.value;if(!e)return null;let t=ii(e.ruleId),n=()=>{q.mark.value=null};return M(ss,{title:`How we know`,onClose:n,wide:!0,children:[M(`p`,{class:`markdlg__subject`,children:e.subject}),M(`p`,{class:`markdlg__certainty edge edge--${e.certainty}`,children:[M(`span`,{class:`mark-inline mark--${e.certainty}`,children:M(mo,{c:e.certainty})}),M(`span`,{children:[M(`strong`,{children:[Qr[e.certainty],`.`]}),` `,$r[e.certainty]]})]}),t?M(ds,{rule:t}):e.ruleId?M(`p`,{class:`callout callout--warn`,children:[`The event names rule `,M(`span`,{class:`mono`,children:e.ruleId}),`, which this version of nodejs-map does not know. The recording may come from a newer version.`]}):e.certainty===`observed`?M(`p`,{children:`No rule was needed: the fact is shown as Node.js reported it.`}):M(`p`,{class:`callout callout--warn`,children:`This fact is not observed, yet its event names no rule. That is a defect in what produced the event; treat the fact with care.`}),e.index===null?null:M(`p`,{class:`dialog__acts`,children:M(`button`,{type:`button`,class:`ctl ctl--plain`,onClick:()=>{let t=e.index;n(),t!==null&&(Va(t),Fa(`events`))},children:[M(Q,{name:`jump`}),M(`span`,{children:[`Go to event `,e.index+1]})]})})]})}var ps=[`Playback`,`Stepping through the recording`,`Running and debugging`,`View`],ms=new Set([`view.tab2`,`view.tab3`,`view.tab4`,`view.tab5`,`view.tab6`,`view.tab7`,`view.tab8`]);function hs({keys:e}){return M(`span`,{class:`keys`,children:e.map((e,t)=>M(`kbd`,{children:e},t))})}function gs({shortcut:e,mac:t}){let n=e.id===`view.tab1`;return M(`tr`,{children:[M(`th`,{scope:`row`,children:e.label}),M(`td`,{children:n?M(hs,{keys:[`1`,`…`,`8`]}):e.combos.map((e,n)=>M(`span`,{children:[n>0?M(`span`,{class:`muted`,children:` or `}):null,M(hs,{keys:wo(e,t)})]},n))})]})}function _s(){let e=Ta.value,t=/Mac|iPhone|iPad/.test(navigator.platform);return M(ss,{title:`Keyboard shortcuts`,onClose:cs,wide:!0,children:[M(`p`,{class:`dialog__lead`,children:`Single-key shortcuts work whenever you are not typing in the editor or in a field. Tab leaves the editor.`}),ps.map(n=>{let r=yo.filter(t=>t.group===n&&!ms.has(t.id)&&(e||!t.helperOnly));return r.length===0?null:M(`table`,{class:`keytable`,children:[M(`caption`,{class:`label`,children:n}),M(`tbody`,{children:r.map(e=>M(gs,{shortcut:e,mac:t},e.id))})]},n)}),M(`table`,{class:`keytable`,children:[M(`caption`,{class:`label`,children:`In lists and panels`}),M(`tbody`,{children:[Fo.map(e=>M(`tr`,{children:[M(`th`,{scope:`row`,children:e.label}),M(`td`,{children:M(hs,{keys:e.keys})})]},e.label)),e?M(`tr`,{children:[M(`th`,{scope:`row`,children:`Toggle a breakpoint on the current line (in the editor)`}),M(`td`,{children:M(hs,{keys:[`F9`]})})]}):null]})]}),e?M(`p`,{class:`muted`,children:`Some browsers keep F11 for full screen; Ctrl+; and Ctrl+Shift+; always work for step into and step out.`}):null,e?M(`section`,{class:`helpnote`,children:[M(`h3`,{class:`label`,children:`What a pause stops`}),M(`p`,{children:[J.notes.value.frozenClock??`On an official Node.js build a breakpoint stops JavaScript only: the clock, the thread pool and the operating system keep running, which can change what happens next.`,` `,`The probe build can hold the loop clock and the pool threads during a pause; the operating system and network peers are never held.`]})]}):null]})}function vs(){let[e,t]=k(``),[n,r]=k({status:`loading`});A(()=>{let t=!0;return r({status:`loading`}),Y.listFiles(e).then(e=>{t&&r({status:`ready`,entries:e.slice(0,2e3)})},e=>{t&&r({status:`failed`,reason:e instanceof Error?e.message:String(e)})}),()=>{t=!1}},[e]);let i=e.includes(`/`)?e.slice(0,e.lastIndexOf(`/`)):``;return M(`div`,{class:`files`,children:[M(`p`,{class:`files__where mono`,children:[J.welcome.value?.folder??`folder`,`/`,e]}),n.status===`loading`?M(`p`,{class:`muted`,children:`Reading the folder...`}):null,n.status===`failed`?M(`p`,{class:`warn-text`,children:[`The folder could not be read: `,n.reason]}):null,n.status===`ready`?M(`ul`,{class:`files__list`,children:[e===``?null:M(`li`,{children:M(`button`,{type:`button`,class:`files__entry`,onClick:()=>t(i),children:[M(Q,{name:`chevronUp`}),M(`span`,{children:`Up one folder`})]})}),n.entries.length===0?M(`li`,{class:`muted`,children:`This folder is empty.`}):null,n.entries.map(e=>{let n=e.path.includes(`/`)?e.path.slice(e.path.lastIndexOf(`/`)+1):e.path,r=/\.(?:m?js|cjs)$/i.test(n);return M(`li`,{children:e.kind===`dir`?M(`button`,{type:`button`,class:`files__entry`,onClick:()=>t(e.path),children:[M(Q,{name:`open`}),M(`span`,{class:`mono`,children:[n,`/`]})]}):M(`button`,{type:`button`,class:`files__entry`,disabled:!r,title:r?`Show this file; Run starts it`:`Only .js, .mjs and .cjs files can be run`,onClick:()=>{Y.openFile(e.path),cs()},children:[M(Q,{name:`code`}),M(`span`,{class:`mono`,children:n})]})},e.path)})]}):null]})}function ys(){let e=Y.examples.value,t=Y.source.value;return M(ss,{title:`Choose a program`,onClose:cs,wide:!0,children:[M(`p`,{class:`dialog__lead`,children:`Choosing a program only shows it. It runs when you press Run or Debug.`}),M(`section`,{class:`pick`,children:[M(`h3`,{class:`label`,children:`Editor snippet`}),M(`button`,{type:`button`,class:`card`,onClick:()=>{Y.useSnippet(),cs()},children:[M(`span`,{class:`card__title`,children:[`Edit a snippet`,t.kind===`snippet`?` (current)`:``]}),M(`span`,{class:`card__text`,children:`Your text is kept in this browser between visits.`})]})]}),M(`section`,{class:`pick`,children:[M(`h3`,{class:`label`,children:`Examples`}),e.status===`ready`&&e.examples.length>0?M(`ul`,{class:`cards cards--dense`,children:e.examples.map(e=>M(`li`,{children:M(`button`,{type:`button`,class:`card`,onClick:()=>{Y.loadExample(e),cs()},children:[M(`span`,{class:`card__title`,children:e.title}),M(`span`,{class:`card__text`,children:e.summary}),e.racy?M(`span`,{class:`card__meta muted`,children:`The output order is a race and can differ between runs.`}):null]})},e.id))}):M(`p`,{class:`muted`,children:e.status===`loading`?`Loading the examples...`:e.status===`failed`?`The examples could not be loaded: ${e.reason}`:`This copy has no built-in examples.`}),M(`p`,{class:`muted`,children:`Loading an example replaces the text of the snippet.`})]}),M(`section`,{class:`pick`,children:[M(`h3`,{class:`label`,children:`A file from the folder nodejs-map was started in`}),M(vs,{})]})]})}function bs({value:e,onChange:t}){let n=!!X.headerForSave(!0)?.sources?.length;return M(`fieldset`,{class:`choice`,children:[M(`legend`,{children:`Include the text of the program?`}),M(`label`,{class:`check`,children:[M(`input`,{type:`radio`,name:`include-source`,checked:!e,onChange:()=>t(!1)}),`No. The recording holds the events and the output only.`]}),M(`label`,{class:`check`,children:[M(`input`,{type:`radio`,name:`include-source`,checked:e,disabled:!n,onChange:()=>t(!0)}),`Yes. Anyone who gets the recording can read the program.`]}),n?null:M(`p`,{class:`muted`,children:`The text of the program is not available for this run, so it cannot be included.`}),M(`p`,{class:`muted`,children:`Either way the recording contains everything the program printed.`})]})}function xs(){let[e,t]=k(!1),[n,r]=k(!0),[i,a]=k(!1);return M(ss,{title:`Save the recording`,onClose:cs,children:[M(bs,{value:e,onChange:t}),M(`label`,{class:`check`,children:[M(`input`,{type:`checkbox`,checked:n,onChange:e=>r(e.currentTarget.checked)}),`Compress the file (gzip). Uncompressed, it is plain text you can read.`]}),M(`p`,{class:`dialog__acts`,children:M(`button`,{type:`button`,class:`ctl ctl--primary`,disabled:i,onClick:()=>{a(!0),X.save({includeSource:e,gzip:n}).then(e=>{a(!1),e&&(Ka(e.bytes,e.fileName,n?`application/gzip`:`text/plain`),X.announce(`Saved ${e.fileName}.`),cs())})},children:[M(Q,{name:`save`}),M(`span`,{children:i?`Saving...`:`Save file`})]})}),X.error.value?M(`p`,{class:`warn-text`,children:X.error.value}):null]})}function Ss(){let[e,t]=k(!1),[n,r]=k(null),[i,a]=k(!1),[o,s]=k(!1),c=Ja(),l=n?.ok&&c?`${c}#${n.fragment}`:null;return A(()=>{r(null),s(!1)},[e]),M(ss,{title:`Share as a link`,onClose:cs,children:[M(`p`,{class:`dialog__lead`,children:`A share link carries the whole recording in the part of the address after “#”. That part is not sent to any server; whoever opens the link plays the recording, nothing is run.`}),M(bs,{value:e,onChange:t}),M(`p`,{class:`dialog__acts`,children:M(`button`,{type:`button`,class:`ctl ctl--primary`,disabled:i,onClick:()=>{a(!0),X.share(e).then(e=>{a(!1),r(e)})},children:[M(Q,{name:`share`}),M(`span`,{children:i?`Making the link...`:`Make the link`})]})}),n&&!n.ok?M(`div`,{class:`callout callout--warn`,children:[M(`p`,{children:[`This recording is too big for a link: it would take `,n.length.toLocaleString(`en`),` characters and the limit is `,n.limit.toLocaleString(`en`),`. Share the file instead.`]}),M(`p`,{class:`dialog__acts`,children:M(`button`,{type:`button`,class:`ctl ctl--plain`,onClick:()=>q.dialog.value=`save`,children:[M(Q,{name:`save`}),M(`span`,{children:`Save the file`})]})})]}):null,n?.ok&&l?M(`div`,{class:`sharelink`,children:[M(`label`,{class:`field`,children:[M(`span`,{class:`field__label`,children:[`Link (`,n.length.toLocaleString(`en`),` characters)`]}),M(`input`,{class:`input mono`,type:`text`,readOnly:!0,value:l,onFocus:e=>e.currentTarget.select()})]}),M(`p`,{class:`dialog__acts`,children:M(`button`,{type:`button`,class:`ctl ctl--plain`,onClick:()=>{navigator.clipboard.writeText(l).then(()=>s(!0),()=>s(!1))},children:o?`Copied`:`Copy the link`})}),n.fitsEverywhere?null:M(`p`,{class:`muted`,children:[`This link is longer than `,Hr.toLocaleString(`en`),` characters. Browsers open it, but some chat and mail programs cut long links; if it arrives broken, share the file.`]})]}):null,n?.ok&&!l?M(`div`,{class:`callout callout--info`,children:[M(`p`,{children:[`The recording fits in a link (`,n.length.toLocaleString(`en`),` characters), but this page runs on your own machine and its address works for nobody else. Save the file and open it in the nodejs-map player website to get a link others can use.`]}),M(`p`,{class:`dialog__acts`,children:M(`button`,{type:`button`,class:`ctl ctl--plain`,onClick:()=>q.dialog.value=`save`,children:[M(Q,{name:`save`}),M(`span`,{children:`Save the file`})]})})]}):null,X.error.value?M(`p`,{class:`warn-text`,children:X.error.value}):null]})}function Cs(){let e=X.recording.value,t=Ta.value;return M(ss,{title:`More`,onClose:cs,children:[e?M(`div`,{class:`more__now`,children:[M(`p`,{children:[M(`strong`,{children:e.lesson?.title??e.header.title??e.label}),M(`br`,{}),M(`span`,{class:`muted`,children:[`Recording · Node `,e.header.node.version,` · `,e.events,` events. It is played back; nothing is run.`]})]}),M(`button`,{type:`button`,class:`ctl ctl--plain`,onClick:()=>{X.closeRecording(),cs()},children:t?`Close the recording and return to the editor`:`Close the recording`})]}):t?null:M(`p`,{class:`muted`,children:`This is the player: it opens recordings and lessons. It cannot run code.`}),t?M(ns,{}):null,M(as,{words:!0}),M(`p`,{class:`dialog__acts`,children:[M(`button`,{type:`button`,class:`ctl ctl--plain`,onClick:()=>q.dialog.value=`legend`,children:[Zr.map(e=>M(`span`,{class:`mark-inline mark--${e}`,children:M(mo,{c:e})},e)),M(`span`,{children:`What the marks mean`})]}),M(`button`,{type:`button`,class:`ctl ctl--plain`,onClick:Ga,children:[M(Q,{name:`theme`}),M(`span`,{children:`Light or dark`})]}),M(`button`,{type:`button`,class:`ctl ctl--plain`,onClick:()=>q.dialog.value=`help`,children:[M(Q,{name:`help`}),M(`span`,{children:`Help`})]})]})]})}function ws(){let e=K.player.value,t=e?.length??0,n=e?.live??!1;return M(ss,{title:`Playback`,onClose:cs,children:[M(`div`,{class:`playback`,children:[M(`label`,{class:`field`,children:[M(`span`,{class:`field__label`,children:`Speed`}),M(Jo,{})]}),M(`label`,{class:`field`,children:[M(`span`,{class:`field__label`,children:`The step buttons move by`}),M(qo,{})]})]}),M(`p`,{class:`dialog__acts`,children:[M(`button`,{type:`button`,class:`ctl ctl--plain`,disabled:t===0,onClick:()=>K.command({do:`seek`,position:0}),children:[M(Q,{name:`toStart`}),M(`span`,{children:`Go to the start`})]}),M(`button`,{type:`button`,class:`ctl ctl--plain`,disabled:t===0,onClick:()=>K.command({do:`seek`,position:t}),children:[M(Q,{name:`toEnd`}),M(`span`,{children:`Go to the end`})]})]}),M(`label`,{class:`check`,children:[M(`input`,{type:`checkbox`,checked:G.timelineAxis.value===`time`,onChange:e=>{G.timelineAxis.value=e.currentTarget.checked?`time`:`index`}}),`Draw the strip by time instead of by event count`]}),Ta.value?M(`label`,{class:`check`,children:[M(`input`,{type:`checkbox`,checked:!!e?.follow,disabled:!n,onChange:e=>K.command({do:`follow`,on:e.currentTarget.checked})}),`Follow the live run`,n?``:` (only while a run is in progress)`]}):null]})}function Ts(){A(()=>{let e=e=>!!(e.dataTransfer&&[...e.dataTransfer.types].includes(`Files`)),t=t=>{e(t)&&(t.preventDefault(),t.dataTransfer&&(t.dataTransfer.dropEffect=`copy`),document.documentElement.classList.add(`is-dropping`))},n=()=>document.documentElement.classList.remove(`is-dropping`),r=t=>{if(n(),!e(t))return;t.preventDefault();let r=t.dataTransfer?.files[0];r&&qa(r)};return addEventListener(`dragover`,t),addEventListener(`dragleave`,n),addEventListener(`drop`,r),()=>{removeEventListener(`dragover`,t),removeEventListener(`dragleave`,n),removeEventListener(`drop`,r)}},[])}function Es(){if(q.mark.value)return M(fs,{});switch(q.dialog.value){case`legend`:return M(ls,{});case`help`:return M(_s,{});case`program`:return M(ys,{});case`save`:return M(xs,{});case`share`:return M(Ss,{});case`more`:return M(Cs,{});case`playback`:return M(ws,{});default:return null}}function Ds({flyTo:e}){return nr(()=>{e.value!==null&&(e.value=null)}),M(`p`,{class:`map__status`,children:`Map loading...`})}var Os=Object.values(Object.assign({"../map/index.ts":()=>et(()=>import(`./map-Cnxgv4Ve.js`),__vite__mapDeps([2,3]),import.meta.url)}))[0];function ks(){let e=Ca.state.value,[t,n]=k(null),[r,i]=k(!1);A(()=>{if(!Os)return;let e=!0;return Os().then(t=>{e&&n(()=>t.MapPanel)},()=>{e&&i(!0)}),()=>{e=!1}},[]);let a;if(e.status===`none`)a=M(`p`,{class:`map__status`,children:`The map appears when a recording or a lesson is open: each recording names the Node.js version whose map it needs.`});else if(e.status===`loading`)a=M(`p`,{class:`map__status`,children:[`Loading the map of Node.js `,e.tag,`...`]});else if(e.status===`missing`)a=M(`p`,{class:`map__status`,role:`alert`,children:[`The map of Node.js `,e.tag,` is not available here (`,e.reason,`). The panels still show the run; places cannot be shown on a map or opened as source.`]});else if(r)a=M(`p`,{class:`map__status`,role:`alert`,children:`The map could not be loaded. Reload the page to try again.`});else{let n={atlas:e.store,atlasBase:e.base,platform:Da.value,highlights:ja,userBoxes:ka,selected:q.selected,flyTo:q.flyTo,onOpenSource:La};a=M(t||Ds,{...n},e.commit)}return M(`section`,{class:`map`,"aria-label":`Map of Node.js`,onPointerDownCapture:e=>ao(`down`,e.clientX,e.clientY),onPointerMoveCapture:e=>{(e.buttons!==0||e.pointerType===`touch`)&&ao(`move`,e.clientX,e.clientY)},onPointerUpCapture:()=>ao(`up`),onPointerCancelCapture:()=>ao(`up`),onWheelCapture:()=>ao(`zoom`),onKeyDownCapture:e=>{!(e.target instanceof HTMLInputElement||e.target instanceof HTMLSelectElement)&&(e.key.startsWith(`Arrow`)||e.key===`+`||e.key===`-`||e.key===`=`||e.key===`0`)&&ao(`zoom`)},children:a})}function As(e,t){if(e.all)return Math.min(t,e.total)-1;let n=e.rows,r=n[0],i=n[n.length-1];if(!r||!i)return e.total===0?-1:void 0;if(t<=r.index)return e.offset===0?-1:void 0;if(t>i.index+1)return e.offset+n.length===e.total?e.total-1:void 0;let a=0,o=n.length;for(;a<o;){let e=a+o>>1;n[e].index<t?a=e+1:o=e}return e.offset+a-1}function js(e,t){function n(n){return this.shouldComponentUpdate=e=>!t(this.props,e),e(n)}return n.displayName=`memo(${e.name||`component`})`,n}var Ms=8e6;function Ns(e,t,n,r,i=6){if(r<=0||n<=0)return{first:0,end:0,totalHeight:0,offset:0};let a=r*n,o=Math.min(a,Ms),s=Math.max(1,Math.ceil(t/n)),c=Math.max(0,o-t),l=Math.min(Math.max(0,e),c),u;if(a<=8e6)u=Math.floor(l/n);else{let e=Math.max(0,r-s);u=c===0?0:Math.round(l/c*e)}let d=Math.max(0,u-i);return{first:d,end:Math.min(r,u+s+i),totalHeight:o,offset:a<=8e6?d*n:l-(u-d)*n}}function Ps(e,t,n,r,i,a=`nearest`){if(i<=0||e<0||e>=i)return null;let o=i*r;if(o<=8e6){let i=e*r,s=Math.max(0,o-n),c=a===`page`?Math.floor(n/3/r)*r:0;return i<t?Math.max(0,a===`page`?Math.min(s,i+r+c-n):i):i+r>t+n?Math.min(s,a===`page`?Math.max(0,i-c):i+r-n):null}let s=Math.max(1,Math.ceil(n/r)),c=Math.max(1,i-s),l=Math.max(0,Ms-n),u=Math.round(Math.min(t,l)/Math.max(1,l)*c);return e>=u&&e<u+s-1?null:Math.min(c,Math.max(0,e-Math.floor(s/2)))/c*l}var Fs=80;function Is({count:e,rowHeight:t,renderRow:n,onWindow:r,keepVisible:i=null,label:a,class:o,onKeyDown:s,activeDescendant:c}){let[l,u]=Ao(),d=j(0),[,f]=k(0),p=j(null),m=j(null),h=j(``),g=j(0),_=`${String(i)}|${+(u.height>0)}|${t}`;if(_!==h.current&&(h.current=_,i!==null&&u.height>0)){let n=Ps(i,d.current,u.height,t,e,`page`);n!==null&&(d.current=n,l.current&&(l.current.scrollTop=n,g.current=performance.now()+Fs))}let v=Ns(d.current,u.height,t,e,3);Pe(()=>{p.current?.style.setProperty(`height`,`${v.totalHeight}px`),m.current?.style.setProperty(`transform`,`translateY(${v.offset}px)`)},[v.totalHeight,v.offset]),A(()=>{r?.(v.first,v.end)},[v.first,v.end,r]);let y=[];for(let e=v.first;e<v.end;e++)y.push(n(e));return M(`div`,{ref:l,class:`vlist${o?` ${o}`:``}`,role:`listbox`,tabIndex:0,"aria-label":a,"aria-activedescendant":c,onScroll:e=>{if(performance.now()<g.current)return;let t=e.currentTarget.scrollTop;Math.abs(t-d.current)<1||(d.current=t,f(e=>e+1))},onKeyDown:s,children:M(`div`,{ref:p,class:`vlist__spacer`,children:M(`div`,{ref:m,class:`vlist__rows`,children:y})})})}function Ls({at:e,what:t}){return e?M(`button`,{type:`button`,class:`row__act`,"data-act":`map`,tabIndex:-1,"aria-label":`Show ${t} on the map`,title:`Show on the map (M)`,onClick:()=>Ia(e),children:M(Q,{name:`map`})}):null}function Rs({item:e}){let t=e.loc;if(!t)return null;let n=`${cn(t.url)}:${t.line}`;return ln(t.url,Oa.value.name)?M(`button`,{type:`button`,class:`row__loc link mono`,tabIndex:-1,title:`Show this line in the editor`,onClick:()=>Ba(t.line,t.line),children:n}):M(`span`,{class:`row__loc mono muted`,children:n})}function zs({item:e,queue:t}){let n=e.label?un(e.label,40):fn(e.type);return M(`span`,{class:`chip${t?` chip--${t}`:``}`,title:qt[e.type]?.meaning??`async_hooks type ${e.type}`,children:[M(`span`,{class:`chip__kind`,children:n??e.type}),M(`span`,{class:`chip__id num`,children:[`#`,e.id]}),n?M(`span`,{class:`chip__label`,children:e.type}):null]})}function Bs(e){return Jt[e.type]}function Vs({fact:e,certainty:t,rule:n,subject:r,children:i,meta:a,mapId:o,tag:s,selected:c,onActivate:l,first:u}){let d=e?.c??t??`observed`,f=l??(e?()=>Va(e.index):void 0);return M(`li`,{class:`row edge edge--${d}${c?` is-selected`:``}`,"data-rowbox":!0,children:[M(ho,{c:d,rule:e?.rule??n??null,index:e?.index??null,subject:r,tabbable:!1}),M(`button`,{type:`button`,class:`row__main`,"data-row":!0,tabIndex:u?0:-1,"aria-current":c?`true`:void 0,title:e?`Go to event ${e.index+1} at ${rn(e.t)}`:void 0,onClick:f,children:[s?M(`span`,{class:`row__tag`,children:s}):null,i]}),a?M(`span`,{class:`row__meta`,children:a}):null,M(Ls,{at:o,what:r})]})}function Hs({children:e}){return M(`p`,{class:`empty`,children:e})}function Us({title:e,count:t,aside:n,children:r,class:i}){return M(`section`,{class:`section${i?` ${i}`:``}`,children:[M(`header`,{class:`section__head`,children:[M(`h3`,{class:`label`,children:e}),t===void 0?null:M(`span`,{class:`section__count num`,children:t}),n?M(`span`,{class:`section__aside`,children:n}):null]}),r]})}function Ws({helper:e}){return M(Hs,{children:e?`Nothing to show yet. Press Run to start the program, or open a recording.`:`Nothing to show yet. Open a recording or pick a lesson.`})}var Gs=60,Ks=12,qs=I(mn.filter(e=>e!==`signals`)),Js=I(Zr),Ys=I(!0);function Xs(e,t){return e.includes(t)?e.filter(e=>e!==t):[...e,t]}var Zs=js(function({row:e,event:t,now:n,future:r}){return t?M(`div`,{id:`ev-${e}`,class:`ev edge edge--${t.c}${n?` is-now`:``}${r?` is-future`:``}`,role:`option`,"aria-selected":n?`true`:`false`,children:[M(ho,{c:t.c,rule:t.rule,index:t.index,subject:t.text,tabbable:!1}),M(`span`,{class:`ev__n num`,children:t.index+1}),M(`span`,{class:`ev__t num`,title:t.approx?`The order of this event against its neighbours is approximate`:void 0,children:[t.approx?`~`:``,rn(t.t)]}),M(`button`,{type:`button`,class:`ev__text`,tabIndex:-1,title:t.k,onClick:()=>Va(t.index),children:t.text}),M(`span`,{class:`ev__src muted`,title:$t[t.src]??t.src,children:[Qt[t.src]??t.src,t.rule?` · ${t.rule}`:``]}),M(Ls,{at:t.at,what:`this event's place`})]}):M(`div`,{class:`ev ev--blank`,id:`ev-${e}`,role:`option`,"aria-selected":`false`})},(e,t)=>e.row===t.row&&e.now===t.now&&e.future===t.future&&(e.event===t.event||e.event!==void 0&&t.event!==void 0&&e.event.index===t.event.index&&e.event.text===t.event.text&&e.event.c===t.event.c&&e.event.t===t.event.t));function Qs(){let e=No(),t=qs.value,n=Js.value,r=Ys.value,[i,a]=k(null),o=j({first:0,end:0}),s=j(!1),c=j(!1),l=K.parts.version.value,u=K.parts.position.value,d=K.parts.length.value,f=j({groups:t,certainty:n,position:u,version:l});f.current={groups:t,certainty:n,position:u,version:l};let p=j(null),m=Ie(()=>{if(s.current){c.current=!0;return}s.current=!0;let e=f.current,t={groups:e.groups,certainty:e.certainty},{first:n,end:r}=o.current,i=Math.max(0,n-Gs),l=Math.max(1,r-n)+120;K.log(t,i,l,e.position).then(t=>{f.current.groups===e.groups&&f.current.certainty===e.certainty&&(p.current={groups:e.groups,certainty:e.certainty,version:e.version},a(t))}).catch(()=>void 0).finally(()=>{s.current=!1,c.current&&(c.current=!1,m())})},[]),h=i?As(i,u):void 0,g=h??(i&&i.position===u?i.cursorRow:-1),_=i?.total??0,v=j(i);v.current=i;let y=Ie((e,t)=>{let n=v.current;return n?n.offset<=Math.max(0,e-Ks)&&n.offset+n.rows.length>=Math.min(n.total,t+Ks):!1},[]),b=!p.current||p.current.groups!==t||p.current.certainty!==n||p.current.version!==l,x=h===void 0&&(!i||i.position!==u);A(()=>{(b||x||!y(o.current.first,o.current.end))&&m()},[b,x,i,m,y]);let S=Ie((e,t)=>{o.current={first:e,end:t},y(e,t)||m()},[m,y]);if(d===0)return M(Ws,{helper:Ta.value});let C=e=>i&&e>=i.offset?i.rows[e-i.offset]:void 0;return M(`div`,{class:`events`,children:[M(`div`,{class:`events__filters`,role:`group`,"aria-label":`Filter the event list`,children:[M(`div`,{class:`filter-row`,children:mn.map(e=>M(`button`,{type:`button`,class:`pill${t.includes(e)?` is-on`:``}`,"aria-pressed":t.includes(e)?`true`:`false`,onClick:()=>qs.value=Xs(t,e),children:hn[e]},e))}),M(`div`,{class:`filter-row`,children:[Zr.map(e=>M(`button`,{type:`button`,class:`pill pill--mark${n.includes(e)?` is-on`:``}`,"aria-pressed":n.includes(e)?`true`:`false`,onClick:()=>Js.value=Xs(n,e),children:[M(`span`,{class:`mark-inline mark--${e}`,children:M(mo,{c:e})}),Qr[e]]},e)),M(`label`,{class:`check`,children:[M(`input`,{type:`checkbox`,checked:r,onChange:e=>Ys.value=e.currentTarget.checked}),`Keep the current event in view`]}),M(`span`,{class:`events__count num muted`,children:[_,` of `,i?.length??d,` events`]})]})]}),M(Is,{class:`events__list`,label:`Events of the run. Up and Down move the player; I explains the mark; M shows the place on the map.`,count:_,rowHeight:e,onWindow:S,keepVisible:r&&g>=0?g:null,onKeyDown:e=>{if(e.ctrlKey||e.metaKey||e.altKey)return;let t=e.key===`ArrowDown`?1:e.key===`ArrowUp`?-1:e.key===`PageDown`?20:e.key===`PageUp`?-20:0,n=C(g);if(t!==0||e.key===`Home`||e.key===`End`){e.preventDefault(),e.stopPropagation();let n=e.key===`Home`?0:e.key===`End`?_-1:Math.min(_-1,Math.max(0,g+t)),r=C(n);Ys.value=!0,r?Va(r.index):(o.current={first:Math.max(0,n-10),end:n+10},m())}else n&&(e.key===`i`?(e.preventDefault(),e.stopPropagation(),Ua({certainty:n.c,ruleId:n.rule,index:n.index,subject:n.text})):e.key===`m`&&n.at&&(e.preventDefault(),e.stopPropagation(),Ia(n.at)))},activeDescendant:g>=0?`ev-${g}`:void 0,renderRow:e=>{let t=C(e);return M(Zs,{row:e,event:t,now:e===g,future:t!==void 0&&t.index>=u},e)}})]})}function $s({lesson:e}){let t=e.steps??[],n=K.parts.position.value,r=-1;for(let e=0;e<t.length;e++)(t[e]?.index??1/0)<n&&(r=e);let i=e=>{let n=t[e];n&&(K.command({do:`pause`}),K.command({do:`seek`,position:n.index+1}))},a=t[r];return M(`section`,{class:`lesson`,"aria-label":`Lesson: ${e.title}`,children:t.length===0?M(x,{children:[M(`h3`,{class:`lesson__step`,children:e.title}),M(`p`,{class:`lesson__text`,children:e.summary||`This lesson has no written steps. Press play, or step through it.`})]}):M(x,{children:[M(`h3`,{class:`lesson__step`,"aria-live":`polite`,children:a?M(x,{children:[M(`span`,{class:`lesson__n num`,children:[r+1,`/`,t.length]}),` `,a.title||`Event ${a.index+1}`]}):e.title}),M(`p`,{class:`lesson__text`,children:a?a.text:e.summary||`Press Next step to begin.`}),M(`div`,{class:`steps__nav`,children:[M(`button`,{type:`button`,class:`ctl ctl--plain`,disabled:r<=0,onClick:()=>i(r-1),children:`Previous step`}),M(`button`,{type:`button`,class:`ctl ctl--primary`,disabled:r>=t.length-1,onClick:()=>i(r+1),children:`Next step`})]}),M(`details`,{class:`lesson__more`,children:[M(`summary`,{children:[`About this lesson, and all `,t.length,` steps`]}),M(`p`,{class:`lesson__title`,children:e.title}),e.summary?M(`p`,{class:`lessons__summary`,children:e.summary}):null,M(`ol`,{class:`steps`,onKeyDown:Po,"aria-label":`Steps of the lesson`,children:t.map((e,t)=>M(`li`,{class:`step${t===r?` is-current`:``}`,"data-rowbox":!0,children:M(`button`,{type:`button`,class:`step__head`,"data-row":!0,tabIndex:t===Math.max(0,r)?0:-1,"aria-current":t===r?`step`:void 0,onClick:()=>i(t),children:[M(`span`,{class:`step__n num`,children:t+1}),M(`span`,{class:`step__title`,children:e.title||`Event ${e.index+1}`}),M(`span`,{class:`num muted`,children:[`event `,e.index+1]})]})},t))})]})]})})}function ec(){let e=X.lessons.value;if(e.status===`none`)return M(Hs,{children:`This copy of nodejs-map has no recorded lessons.`});if(e.status===`loading`)return M(Hs,{children:`Loading the lessons...`});if(e.status===`failed`)return M(`p`,{class:`empty warn-text`,children:[`The lessons could not be loaded: `,e.reason]});if(e.lessons.length===0)return M(Hs,{children:`There are no lessons yet.`});let t=X.recording.value?.lesson?.id??null;return M(`ul`,{class:`cards`,children:e.lessons.map(e=>M(`li`,{children:M(`button`,{type:`button`,class:`card${e.id===t?` is-open`:``}`,disabled:X.opening.value,onClick:()=>void X.openLesson(e),children:[M(`span`,{class:`card__title`,children:e.title}),M(`span`,{class:`card__text`,children:e.summary}),M(`span`,{class:`card__meta muted`,children:[`Recording`,e.node?` made on Node ${e.node}`:``,e.steps?.length?` · ${e.steps.length} steps`:``,` · opens without running anything`]})]})},e.id))})}function tc(){let e=Y.examples.value;return e.status===`none`?null:M(Us,{title:`Programs to run`,children:[e.status===`loading`?M(Hs,{children:`Loading the examples...`}):null,e.status===`failed`?M(`p`,{class:`empty warn-text`,children:[`The examples could not be loaded: `,e.reason]}):null,e.status===`ready`?M(`ul`,{class:`cards`,children:e.examples.map(e=>M(`li`,{children:M(`button`,{type:`button`,class:`card`,onClick:()=>{Y.loadExample(e),X.announce(`Loaded ${e.title} into the editor. It has not been run.`),q.narrow.value&&Fa(`code`)},children:[M(`span`,{class:`card__title`,children:e.title}),M(`span`,{class:`card__text`,children:e.summary}),M(`span`,{class:`card__meta muted`,children:[e.module===`esm`?`ES module`:`CommonJS`,e.racy?` · the output order is a race and can differ between runs`:``,` · loads into the editor, runs only when you press Run`]})]})},e.id))}):null]})}function nc(){let e=Ta.value,t=X.recording.value?.lesson??null,n=M(x,{children:[e?M(tc,{}):null,M(Us,{title:e?`Recorded lessons`:`Lessons`,children:M(ec,{})})]});return M(`div`,{class:`panel-scroll lessons`,children:t?M(x,{children:[M($s,{lesson:t}),M(`details`,{class:`lesson__more`,children:[M(`summary`,{children:e?`Other examples and lessons`:`Other lessons`}),n]})]}):n})}var rc=K.parts,ic=[`timers`,`pending`,`idle`,`prepare`,`poll`,`check`,`closing`],ac={observed:void 0,inferred:`7 4`,model:`1.5 4`};function oc(e,t,n){let r=.07,i=e/t*2*Math.PI-Math.PI/2+r,a=(e+1)/t*2*Math.PI-Math.PI/2-r,o=e=>`${(50+n*Math.cos(e)).toFixed(2)} ${(50+n*Math.sin(e)).toFixed(2)}`;return`M ${o(i)} A ${n} ${n} 0 0 1 ${o(a)}`}var sc=ic.map((e,t)=>oc(t,ic.length,40));function cc(){let e=rc.loop.value;if(!e)return null;let t=e.phase,n=e.phaseFrom?.c??`inferred`,r=Da.value,i=r===`win32`?`Windows`:r===`darwin`?`macOS`:`Linux`;return M(`div`,{class:`ring`,children:[M(`svg`,{class:`ring__svg`,viewBox:`0 0 100 100`,role:`img`,"aria-label":t?`Event loop phase: ${Zt[t]}`:`Event loop: no phase known at this point`,children:[ic.map((e,r)=>{let i=e===t;return M(`path`,{d:sc[r],class:`ring__seg${i?` is-lit ring__seg--${n}`:``}`,fill:`none`,"stroke-width":i?9:5,"stroke-dasharray":i?ac[n]:void 0,"stroke-linecap":`butt`},e)}),M(`text`,{x:`50`,y:`47`,"text-anchor":`middle`,class:`ring__turn-label`,children:`turn`}),M(`text`,{x:`50`,y:`62`,"text-anchor":`middle`,class:`ring__turn`,children:e.turn??`-`})]}),M(`div`,{class:`ring__side`,children:[M(`ol`,{class:`ring__list`,"aria-label":`Loop phases in the order libuv runs them`,onKeyDown:Po,children:ic.map((n,r)=>{let i=n===t;return M(`li`,{class:`ring__item${i?` is-lit`:``}`,"data-rowbox":!0,children:[M(`button`,{type:`button`,class:`ring__phase`,"data-row":!0,tabIndex:r===0?0:-1,"aria-current":i?`step`:void 0,title:`Show the ${Zt[n]} phase on the map`,onClick:()=>Ia(Kt[n]),children:[M(`span`,{class:`ring__n num`,children:r+1}),Zt[n]]}),i?M(go,{fact:e.phaseFrom,subject:`the loop is in the ${Zt[n]} phase`,tabbable:!1}):null]},n)})}),M(`p`,{class:`ring__note`,children:[M(ho,{c:`model`,rule:ri,subject:`the ring of loop phases`}),M(`span`,{children:[`Order of uv_run in libuv`,X.node.value?` ${X.node.value.uv}`:``,` on `,i,`.`,` `,r===`win32`?`On Windows, finished I/O and thread pool results are delivered in the pending step, right after poll.`:`On ${i}, thread pool results and most I/O callbacks are delivered inside the poll step.`]})]}),e.turn===null?null:M(`p`,{class:`ring__fact`,children:[M(go,{fact:e.turnFrom,subject:`loop turn ${e.turn}`}),M(`span`,{children:[`Loop turn `,e.turn]})]}),!t&&e.lastPhase?M(`p`,{class:`ring__fact`,children:[M(go,{fact:e.lastPhase.left,subject:`the loop left the ${Zt[e.lastPhase.phase]} phase`}),M(`span`,{children:[`Between phases. Last one: `,Zt[e.lastPhase.phase],`.`]})]}):null,e.lastSample?M(`p`,{class:`ring__fact`,children:[M(go,{fact:e.lastSample.from,subject:`libuv loop counters`}),M(`span`,{class:`num`,children:[`libuv counters: loop count `,e.lastSample.loopCount,`, events `,e.lastSample.events,`, waiting `,e.lastSample.eventsWaiting]})]}):null]})]})}function lc(e){let t=e.queue?` from ${Yt[e.queue].toLowerCase()}`:``;switch(e.via){case`phase`:return`Taken${t} by the event loop${e.phase?` in the ${Zt[e.phase]} phase`:``}.`;case`nextTick`:return`Taken${t} by the nextTick drain, after the previous callback returned.`;case`microtask`:return`Taken${t} by the microtask drain, after the nextTick queue was empty.`;default:return`How it got onto the main thread is not known from the events.`}}function uc(e){let[t,n]=k(null),r=e?.from.index??-1,i=e!==void 0&&e.queue!==`close`&&zr.has(e.item.type);return A(()=>{if(!i)return;let e=!0;return K.query({what:`events`,from:r,to:r+1}).then(t=>{let i=t.entries[0]?.event;e&&n({index:r,close:i?.k===`callback.start`&&i.close===!0})}).catch(()=>void 0),()=>{e=!1}},[r,i]),e?.queue===`close`||t!==null&&t.index===r&&t.close}function dc(){let e=rc.main.value,t=rc.run.value?.status??`idle`,n=e?.stack[e.stack.length-1],r=uc(e?.doing===`callback`?n:void 0);return e?e.doing===`callback`&&n?M(`div`,{children:[M(`p`,{class:`now__line`,children:[M(go,{fact:n.from,subject:`the callback of ${pn(n.item)} is running`}),M(`span`,{children:[`Running the `,r?`close callback`:`callback`,` of `,M(zs,{item:n.item,queue:n.queue}),n.depth>0?M(`span`,{class:`muted`,children:` (started inside another callback)`}):null]})]}),M(`p`,{class:`now__line`,children:[n.viaFrom?M(go,{fact:n.viaFrom,subject:`how ${pn(n.item)} reached the main thread`}):M(`span`,{class:`mark-gap`}),M(`span`,{children:lc(n)})]})]}):e.doing===`main`?M(`p`,{class:`now__line`,children:[M(go,{fact:e.from,subject:`the main script is running`}),M(`span`,{children:`Running the main script: the program's top-level code, before the event loop starts turning.`})]}):M(`p`,{class:`now__line`,children:[e.from?M(go,{fact:e.from,subject:`no JavaScript is running`}):M(`span`,{class:`mark-gap`}),M(`span`,{children:t===`idle`?`The run has not started.`:t===`ended`?`The run has ended.`:`No JavaScript is running: the main thread is in the event loop, between callbacks.`})]}):null}function fc(){let e=rc.main.value,t=rc.version.value,n=(e?.stack[e.stack.length-1])?.item.id??null,[r,i]=k(null);if(A(()=>{if(n===null)return;let e=!0;return K.query({what:`why`,id:n}).then(t=>{e&&i({id:n,items:t.chain})}).catch(()=>void 0),()=>{e=!1}},[n,t]),n===null)return M(Hs,{children:`No callback is running at this point, so there is no chain to show.`});let a=r&&r.id===n?r.items:[];return a.length===0?M(Hs,{children:`Reading the chain...`}):M(`ol`,{class:`rows chain`,onKeyDown:Po,"aria-label":`Why this callback ran, newest first`,children:[a.map((e,t)=>M(Vs,{fact:e.created??e.lastStart,certainty:`inferred`,subject:e.created?`${pn(e)} was created`:`${pn(e)} exists`,mapId:Bs(e),tag:t===0?`running`:`scheduled it`,first:t===0,meta:M(Rs,{item:e}),children:[M(zs,{item:e,queue:e.queues[0]??null}),e.created?null:M(`span`,{class:`muted`,children:` created before recording began`})]},e.id)),M(`li`,{class:`row row--plain`,children:[M(`span`,{class:`mark-gap`}),M(`span`,{class:`row__text muted`,children:(a[a.length-1]?.trigger??0)<=1?`which the main script scheduled.`:`whose own trigger was not recorded.`})]})]})}function pc(){return M(`dd`,{class:`num`,children:[sn(rc.position.value,`event`),` of `,rc.length.value,` · `,rn(rc.t.value)]})}function mc(){let e=rc.run.value;if(!e)return null;let t=e.status===`idle`?`Not started`:e.status===`running`?`Running`:e.status===`paused`?`Paused at a JavaScript statement`:e.status===`gate`?`Stopped at a gate`:e.signal?`Ended by ${e.signal}`:`Ended, exit code ${String(e.exitCode)}`;return M(`dl`,{class:`facts`,children:[M(`div`,{children:[M(`dt`,{children:`Program`}),M(`dd`,{children:[e.program??`-`,` `,e.mode?M(`span`,{class:`muted`,children:[`(`,e.mode===`debug`?`debug run`:`free run`,`)`]}):null]})]}),M(`div`,{children:[M(`dt`,{children:`State`}),M(`dd`,{children:[t,` `,M(go,{fact:e.status===`ended`?e.ended:e.started,subject:`run state: ${t}`})]})]}),M(`div`,{children:[M(`dt`,{children:`Position`}),M(pc,{})]}),e.node?M(`div`,{children:[M(`dt`,{children:`Node.js`}),M(`dd`,{children:[e.node.version,` `,M(`span`,{class:`muted`,children:[`(`,e.node.platform,` `,e.node.arch,`, libuv `,e.node.uv,`, pool size `,e.poolSize??`?`,`)`]})]})]}):null]})}function hc(){let e=rc.notes.value;return!e||e.items.length===0?null:M(Us,{title:`Notes from the tool`,count:e.total,children:M(`ul`,{class:`notes`,children:e.items.map(e=>M(`li`,{class:`now__line${e.level===`warn`?` warn-text`:``}`,children:[M(go,{fact:e.from,subject:`a note from nodejs-map`}),M(`span`,{children:un(e.text,400)})]},e.seq))})})}function gc(){let e=rc.debug.value,t=e?.lastPause;return!e||!t||e.paused?null:M(`p`,{class:`now__line muted`,children:[M(go,{fact:t.resumed,subject:`the latest debugger pause`}),M(`span`,{children:[`Last pause: `,an(t.pausedMs),`.`,t.timeKeptRunning?` Real time kept running during it.`:``]})]})}function _c(){let e=rc.problems.value;return!e||e.unknown+e.malformed+e.inconsistent===0?null:M(`p`,{class:`now__line warn-text`,children:[M(`span`,{class:`mark-gap`}),M(`span`,{children:[`This event list has problems: `,e.unknown,` of unknown kind, `,e.malformed,` malformed, `,e.inconsistent,` that disagree with earlier events. The view may be incomplete.`]})]})}function vc(){return Ea.value?M(`div`,{class:`panel-scroll now`,children:[M(mc,{}),M(Us,{title:`Main thread`,children:M(`div`,{class:`now__doing`,children:M(dc,{})})}),M(Us,{title:`Event loop`,children:M(cc,{})}),M(Us,{title:`Why this callback ran`,children:M(fc,{})}),M(hc,{}),M(gc,{}),M(_c,{})]}):M(Ws,{helper:Ta.value})}var yc=2e4;function bc(e){return e.slice(0,yc).replace(/\u001b\[[0-9;?]*[ -/]*[@-~]/g,``).replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/g,`�`)}function xc({chunk:e,first:t}){let n=e.text.length>yc;return M(`li`,{class:`out out--${e.stream}`,"data-rowbox":!0,children:M(`button`,{type:`button`,class:`out__text mono`,"data-row":!0,tabIndex:t?0:-1,title:`${e.stream}, event ${e.index+1} at ${rn(e.t)}. Activate to go there.`,onClick:()=>Va(e.index),children:[e.stream===`stderr`?M(`span`,{class:`out__tag`,children:`stderr`}):null,bc(e.text),n?M(`span`,{class:`muted`,children:[` … (`,e.text.length-yc,` more characters)`]}):null]})})}function Sc(){let e=K.parts.output.value,t=j(null),n=e?.total??0,r=j(!0);return A(()=>{let e=t.current;e&&r.current&&(e.scrollTop=e.scrollHeight)},[n]),!Ea.value||!e?M(Ws,{helper:Ta.value}):M(`div`,{class:`panel-scroll output`,ref:t,onScroll:e=>{let t=e.currentTarget;r.current=t.scrollHeight-t.scrollTop-t.clientHeight<24},children:[M(`p`,{class:`note`,children:[M(ho,{c:`observed`,subject:`program output`}),M(`span`,{children:[e.total,` write`,e.total===1?``:`s`,` so far, read from the program's stdout and stderr by the helper.`,e.total>e.chunks.length?` Showing the latest ${e.chunks.length}.`:``]})]}),e.chunks.length===0?M(Hs,{children:e.total>0?`Reading the output...`:`The program has written nothing up to this point.`}):M(`ol`,{class:`outs`,"aria-label":`Program output, oldest first`,onKeyDown:Po,children:e.chunks.map((e,t)=>M(xc,{chunk:e,first:t===0},e.seq))})]})}var Cc=K.parts,wc=60;function Tc(e){return`${e.kind}${e.op?` ${un(e.op,30)}`:``}`}function Ec({job:e}){return M(x,{children:[M(`span`,{class:`chip chip--pool`,children:[M(`span`,{class:`chip__kind`,children:Tc(e)}),M(`span`,{class:`chip__id mono`,children:un(e.job,18)})]}),e.item?M(x,{children:[` for `,M(zs,{item:e.item})]}):M(`span`,{class:`muted`,children:` owner not known`})]})}function Dc({thread:e}){let t=e.job,n=t?t.started??t.queued:null;return M(`li`,{class:`lane${t?` is-busy`:``} edge edge--${n?.c??`observed`}`,"data-rowbox":!0,children:[M(`div`,{class:`lane__id`,children:[M(`span`,{class:`lane__n`,children:[`Thread `,e.thread]}),M(`span`,{class:`lane__tid num muted`,title:e.tid===null?`Node did not report a thread id for this lane`:`Operating-system thread id, as Node reported it`,children:e.tid===null?`no tid`:`tid ${e.tid}`})]}),M(`div`,{class:`lane__job`,children:t?M(x,{children:[M(go,{fact:n,subject:`pool thread ${e.thread} runs job ${t.job}`,tabbable:!1}),M(`button`,{type:`button`,class:`row__main`,"data-row":!0,tabIndex:-1,title:n?`Go to event ${n.index+1}`:void 0,onClick:()=>n&&Va(n.index),children:M(Ec,{job:t})}),t.started?M(`span`,{class:`num muted`,children:[`since `,rn(t.started.t)]}):null,M(Ls,{at:t.at??P.poolWorker.id,what:`pool thread ${e.thread}`})]}):M(`span`,{class:`muted lane__idle`,children:`idle`})}),M(`span`,{class:`lane__count num muted`,title:e.extra?`The events showed this thread although it is above the pool size`:`Jobs this thread has started so far`,children:[e.jobs,` job`,e.jobs===1?``:`s`,e.extra?` · beyond the pool size`:``]})]})}function Oc({jobs:e,total:t,label:n,tag:r,which:i}){if(e.length===0)return M(Hs,{children:`None.`});let a=e.slice(0,wc);return M(`ol`,{class:`rows`,onKeyDown:Po,"aria-label":n,children:[a.map((e,t)=>{let n=i===`queued`?e.queued:e.finished??e.started??e.queued;return M(Vs,{fact:n,certainty:`inferred`,subject:`pool job ${e.job} ${i===`queued`?`waits for a thread`:`is finished and waits for delivery`}`,tag:t===0?r:void 0,first:t===0,mapId:e.at??(i===`queued`?P.poolSubmit.id:P.poolDone.id),meta:M(x,{children:[e.thread===null?null:M(`span`,{class:`muted num`,children:[`thread `,e.thread]}),n?M(`span`,{class:`muted num`,children:[`since `,rn(n.t)]}):null]}),children:M(Ec,{job:e})},e.job)}),t>a.length?M(`li`,{class:`row row--plain`,children:[M(`span`,{class:`mark-gap`}),M(`span`,{class:`row__text muted`,children:[`and `,t-a.length,` more.`]})]}):null]})}function kc(){let e=X.caps.value?.poolThreads??null;return e===`delayed`?M(`details`,{class:`callout callout--info callout--fold`,children:[M(`summary`,{children:[M(`strong`,{children:`Exact, but delayed.`}),` `,M(`span`,{class:`callout__more`,children:`more`})]}),M(`p`,{children:`Thread ids and job times are the ones Node reported, so they are exact. On an official build they come from trace events, which arrive later than the rest: during a live run this panel can lag behind the other panels, and the helper re-orders the event list when they arrive.`})]}):e===`none`?M(`p`,{class:`callout callout--warn`,role:`note`,children:`This Node.js gives no thread pool data. The lanes below stay empty; requests that use the pool are still listed under "Requests with the pool".`}):null}function Ac(){let e=Cc.pool.value,t=Cc.queues.pool.value;if(!Ea.value||!e||!t)return M(Ws,{helper:Ta.value});let n=e.held;return M(`div`,{class:`panel-scroll pool`,children:[M(kc,{}),e.leftAtEnd?M(`p`,{class:`callout callout--warn`,role:`note`,children:`The run ended with thread pool work unfinished or undelivered: what is still listed below never reached its callback.`}):null,n?M(`p`,{class:`now__line`,children:[M(go,{fact:n.from,subject:`a gate holds pool job ${n.job}`}),M(`span`,{children:[`Held at the `,n.gate,` gate: job `,M(`span`,{class:`mono`,children:un(n.job,18)}),` `,n.where===`loop`?`is with the loop, before its done-callback`:n.thread===null?`is on a pool thread`:`is on thread ${n.thread}`,`.`]})]}):null,M(Us,{title:`Threads`,...e.size===null?{}:{count:`pool size ${e.size}`},aside:e.sizeFrom?M(go,{fact:e.sizeFrom,subject:`the thread pool has ${String(e.size)} threads`}):void 0,children:e.threads.length===0?M(Hs,{children:`No pool thread has been seen yet. libuv creates the threads on the first job.`}):M(`ol`,{class:`lanes`,onKeyDown:Po,"aria-label":`Thread pool threads`,children:e.threads.map(e=>M(Dc,{thread:e},e.thread))})}),M(`div`,{class:`pool__lines`,children:[M(Us,{title:`Waiting for a thread`,count:e.waiting.length,children:M(Oc,{jobs:e.waiting,total:e.waiting.length,label:`Jobs waiting for a pool thread, oldest first`,tag:`next`,which:`queued`})}),M(Us,{title:`Finished, not delivered`,count:e.done.length,children:M(Oc,{jobs:e.done,total:e.done.length,label:`Finished jobs whose result has not reached the loop, oldest first`,tag:`next`,which:`finished`})})]}),M(Us,{title:`Requests with the pool`,count:t.total,children:t.total===0?M(Hs,{children:`None.`}):M(`ol`,{class:`rows`,onKeyDown:Po,"aria-label":`Async requests whose work is with the thread pool`,children:t.entries.slice(0,wc).map((e,t)=>M(Vs,{fact:e.from,subject:`${pn(e.item)} is with the thread pool`,first:t===0,mapId:e.at??P.poolSubmit.id,meta:M(`span`,{class:`muted num`,children:[`since `,rn(e.from.t)]}),children:M(zs,{item:e.item,queue:`pool`})},e.item.id))})}),M(Us,{title:`Totals`,children:[M(`dl`,{class:`facts facts--inline`,children:[M(`div`,{children:[M(`dt`,{children:`queued`}),M(`dd`,{class:`num`,children:e.counts.queued})]}),M(`div`,{children:[M(`dt`,{children:`started`}),M(`dd`,{class:`num`,children:e.counts.started})]}),M(`div`,{children:[M(`dt`,{children:`finished`}),M(`dd`,{class:`num`,children:e.counts.finished})]}),M(`div`,{children:[M(`dt`,{children:`delivered`}),M(`dd`,{class:`num`,children:e.counts.delivered})]})]}),e.tids.length>0?M(`ul`,{class:`tids`,"aria-label":`Real thread ids seen in trace events`,children:e.tids.map(e=>M(`li`,{class:`tids__item`,children:[M(go,{fact:e.from,subject:`thread ${e.tid} reported by Node`}),M(`span`,{class:`num`,children:[`tid `,e.tid]}),M(`span`,{class:`muted`,children:[e.busy?`busy with ${un(e.name,30)}`:`idle`,` · `,e.starts,` started, `,e.ends,` finished`]})]},e.tid))}):null]})]})}var jc=K.parts,Mc=60,Nc=[`nextTick`,`microtask`,`timers`,`immediate`,`io`,`close`];function Pc({name:e,total:t}){return M(`header`,{class:`section__head queue__head`,title:Xt[e],children:[M(`span`,{class:`swatch swatch--${e}`,"aria-hidden":`true`}),M(`h3`,{class:`label`,children:Yt[e]}),M(`span`,{class:`section__count num`,children:t})]})}function Fc({shown:e,total:t}){return t<=e?null:M(`li`,{class:`row row--plain`,children:[M(`span`,{class:`mark-gap`}),M(`span`,{class:`row__text muted`,children:[`and `,t-e,` more behind these.`]})]})}function Ic({what:e}){return M(`p`,{class:`note`,children:[M(`span`,{class:`mark-gap`}),M(`span`,{children:[`The run ended with `,e,` still waiting here. They never ran.`]})]})}function Lc({name:e}){let t=jc.queues[e].value;if(!t)return null;let n=t.entries.slice(0,Mc);return M(`section`,{class:`section queue queue--${t.name}`,children:[M(Pc,{name:t.name,total:t.total}),t.total===0?M(Hs,{children:`Empty.`}):M(`ol`,{class:`rows`,onKeyDown:Po,"aria-label":`${Yt[t.name]}, next to run first`,children:[n.map((e,n)=>M(Vs,{fact:e.from,subject:`${pn(e.item)} waits in ${Yt[t.name].toLowerCase()}`,tag:n===0?t.name===`io`?`oldest`:`next`:void 0,first:n===0,mapId:e.at??Bs(e.item),meta:M(x,{children:[e.runs>0?M(`span`,{class:`muted num`,children:[`ran `,e.runs,`×`]}):null,M(Rs,{item:e.item}),M(`span`,{class:`num muted`,children:[`since `,rn(e.from.t)]})]}),children:M(zs,{item:e.item,queue:t.name})},e.item.id)),M(Fc,{shown:n.length,total:t.total})]}),t.leftAtEnd?M(Ic,{what:t.total===1?`this item`:`these items`}):null]})}function Rc({timer:e}){let t=(e.dueT-jc.t.value)/1e3;return M(`span`,{class:`num due`,children:[M(go,{fact:e.dueFrom,subject:`when ${pn(e.item)} is due`,tabbable:!1}),t>=0?`due in ${an(t)}`:`overdue by ${an(-t)}`]})}function zc(e){return M(x,{children:[M(Rs,{item:e.item}),M(`span`,{class:`num`,children:an(e.delayMs)}),e.state===`waiting`?M(Rc,{timer:e}):null,e.lateMs!==null&&e.state!==`waiting`?M(`span`,{class:`num due`,children:[M(go,{fact:e.dueFrom,subject:`how late ${pn(e.item)} ran`,tabbable:!1}),`ran `,an(Math.max(0,e.lateMs)),` late`]}):null]})}function Bc(){let e=jc.timers.value;if(!e)return null;let t=e.active.slice(0,Mc),n=e.recent.slice(-8).reverse(),r=e.counts.waiting+e.counts.running;return M(`section`,{class:`section queue queue--timers`,children:[M(Pc,{name:`timers`,total:r}),t.length===0?M(Hs,{children:`No timer is waiting.`}):M(`ol`,{class:`rows`,onKeyDown:Po,"aria-label":`Timers, soonest due first`,children:[t.map((e,t)=>M(Vs,{fact:e.armed,subject:`${pn(e.item)} is ${e.state===`running`?`running`:`waiting`}`,tag:e.state===`running`?`running`:t===0?`due first`:void 0,first:t===0,mapId:Bs(e.item),meta:zc(e),children:[M(zs,{item:e.item,queue:`timers`}),e.repeat?M(`span`,{class:`muted`,children:` repeats`}):null]},e.item.id)),M(Fc,{shown:t.length,total:r})]}),e.leftAtEnd?M(Ic,{what:r===1?`this timer`:`these timers`}):null,e.fired.count>0&&e.fired.last?M(`p`,{class:`note`,children:[M(go,{fact:e.fired.last.from,subject:`Node's libuv timer came due`}),M(`span`,{children:[`Node's one libuv timer has come due `,e.fired.count,` time`,e.fired.count===1?``:`s`,e.fired.last.lateMs===null?``:`; last time ${an(e.fired.last.lateMs)} late`,`.`]})]}):null,n.length>0?M(`details`,{class:`recent`,children:[M(`summary`,{children:[`Finished or cleared (`,e.counts.done+e.counts.cleared,`)`]}),M(`ol`,{class:`rows`,onKeyDown:Po,"aria-label":`Timers that ran or were cleared, latest first`,children:n.map((e,t)=>M(Vs,{fact:e.cleared??e.lastRun??e.set,subject:`${pn(e.item)} ${e.state===`cleared`?`was cleared`:`ran`}`,tag:e.state===`cleared`?`cleared`:`ran`,first:t===0,mapId:Bs(e.item),meta:zc(e),children:M(zs,{item:e.item,queue:`timers`})},e.item.id))})]}):null]})}function Vc(){let e=jc.queues.pool.value?.total??0;return M(Us,{title:`Elsewhere`,children:M(`p`,{class:`note`,children:[M(`span`,{class:`mark-gap`}),M(`span`,{children:[e,` request`,e===1?``:`s`,` with the thread pool: see the Thread pool panel. `,jc.itemCount.value,` async items seen so far.`]})]})})}function Hc(){return Ea.value?M(`div`,{class:`panel-scroll queues`,children:[Nc.map(e=>e===`timers`?M(Bc,{},e):M(Lc,{name:e},e)),M(Vc,{})]}):M(Ws,{helper:Ta.value})}function Uc(){return M(`label`,{class:`check`,title:`During a run or playback, keep this panel and the map on the code of the current phase or of the current frame in Node's own JavaScript`,children:[M(`input`,{type:`checkbox`,checked:G.followAction.value,onChange:e=>{G.followAction.value=e.currentTarget.checked}}),`Follow the action`]})}function Wc(){let e=wa.target.value,t=wa.text.value,n=Ca.state.value;if(!e)return M(`div`,{class:`panel-scroll source`,children:[M(`div`,{class:`source__bar`,children:M(Uc,{})}),M(Hs,{children:`Open a box on the map, a stack frame, an event or a rule citation to read its code here. Node's source is not part of this app: it is fetched from GitHub at the exact commit of the Node.js version, when you open it.`})]});let r=e.start!==null&&e.end!==null?e.start===e.end?`line ${e.start}`:`lines ${e.start}-${e.end}`:null;return M(`div`,{class:`source`,children:[M(`header`,{class:`source__head`,children:[M(`div`,{class:`source__title`,children:[M(`h3`,{class:`source__name`,children:e.title}),e.atlasId?M(`button`,{type:`button`,class:`ctl ctl--plain ctl--icon`,"aria-label":`Show on the map`,title:`Show on the map`,onClick:()=>e.atlasId&&Ia(e.atlasId),children:M(Q,{name:`map`})}):null]}),e.description?M(`p`,{class:`source__desc`,children:e.description}):null,e.path?M(`p`,{class:`source__path mono`,children:[e.path,r?M(`span`,{class:`muted`,children:[` · `,r]}):null,n.status===`ready`?M(`span`,{class:`muted`,children:[` · Node `,n.tag,` @ `,n.commit.slice(0,10)]}):null]}):null,e.variant?M(`p`,{class:`source__variant mono muted`,children:[`when: `,e.variant]}):null,M(`div`,{class:`source__bar`,children:[e.github?M(`a`,{class:`ctl ctl--plain`,href:e.github,target:`_blank`,rel:`noreferrer noopener`,children:[M(Q,{name:`external`}),M(`span`,{children:`Open on GitHub`})]}):null,e.githubDev?M(`a`,{class:`ctl ctl--plain`,href:e.githubDev,target:`_blank`,rel:`noreferrer noopener`,title:Ft,children:[M(Q,{name:`external`}),M(`span`,{children:[`Open in web editor `,M(`span`,{class:`muted`,children:`(needs GitHub sign-in)`})]})]}):null,M(Uc,{})]})]}),e.note?M(`p`,{class:`callout callout--info`,children:e.note}):null,t.status===`loading`?M(Hs,{children:`Fetching the text...`}):null,t.status===`unavailable`?M(`p`,{class:`callout callout--warn`,children:t.reason}):null,t.status===`ready`&&e.path?M(x,{children:[M(rt,{text:t.text,language:Di(e.path),readOnly:!0,label:`Source of ${e.path}, read-only`,range:e.start!==null&&e.end!==null?{start:e.start,end:e.end}:null,lineMark:e.line===null?null:{line:e.line,kind:`paused`},revealKey:`${e.path}:${String(e.start)}`}),M(`p`,{class:`source__from muted`,children:t.from===`program`?`Text read from the running program through the helper.`:`Text fetched from raw.githubusercontent.com at this commit; it is kept in memory only.`})]}):null]})}var Gc=K.parts,Kc=500,qc=8;function Jc(e,t){let[n,r]=k({key:e,loaded:{status:`loading`}});return A(()=>{let n=!0;return r({key:e,loaded:{status:`loading`}}),t().then(t=>{n&&r({key:e,loaded:{status:`ready`,value:t}})},t=>{n&&r({key:e,loaded:{status:`failed`,reason:t instanceof Error?t.message:String(t)}})}),()=>{n=!1}},[e]),n.key===e?n.loaded:{status:`loading`}}function Yc({run:e,objectId:t,depth:n,pauseKey:r}){let i=Jc(`${r}|${t}`,async()=>(await J.request({op:`debug.props`,run:e,objectId:t})).variables);if(i.status===`loading`)return M(`p`,{class:`vars__note muted`,children:`Reading...`});if(i.status===`failed`)return M(`p`,{class:`vars__note warn-text`,children:[`Could not read the values: `,i.reason]});let a=i.value;return a.length===0?M(`p`,{class:`vars__note muted`,children:`Empty.`}):M(`ul`,{class:`vars`,children:[a.slice(0,Kc).map((t,i)=>M(Xc,{run:e,variable:t,depth:n,pauseKey:r},`${i}:${t.name}`)),a.length>Kc?M(`li`,{class:`vars__note muted`,children:[`and `,a.length-Kc,` more that are not shown.`]}):null]})}function Xc({run:e,variable:t,depth:n,pauseKey:r}){let[i,a]=k(!1),o=t.objectId!==void 0&&n<qc,s=M(x,{children:[M(`span`,{class:`vars__name mono`,children:un(t.name,80)}),M(`span`,{class:`vars__sep`,children:`: `}),M(`span`,{class:`vars__value mono vars__value--${/^[a-z]+$/.test(t.type)?t.type:`other`}`,children:un(t.preview,200)})]});return M(`li`,{class:`vars__item`,children:[o?M(`button`,{type:`button`,class:`vars__toggle`,"aria-expanded":i?`true`:`false`,onClick:()=>a(!i),children:[M(Q,{name:i?`chevronDown`:`chevronRight`}),s]}):M(`span`,{class:`vars__leaf`,children:s}),i&&t.objectId!==void 0?M(Yc,{run:e,objectId:t.objectId,depth:n+1,pauseKey:r}):null]})}function Zc({run:e,scope:t,pauseKey:n,startOpen:r}){let[i,a]=k(r);return M(`li`,{class:`scope`,children:[M(`button`,{type:`button`,class:`scope__head`,"aria-expanded":i?`true`:`false`,onClick:()=>a(!i),children:[M(Q,{name:i?`chevronDown`:`chevronRight`}),M(`span`,{class:`label`,children:un(t.kind,30)}),t.name?M(`span`,{class:`mono muted`,children:[` `,un(t.name,60)]}):null]}),i?M(Yc,{run:e,objectId:t.objectId,depth:0,pauseKey:n}):null]})}function Qc({debug:e,frame:t}){let n=K.tail.value.run,r=Gc.position.value===Gc.length.value,i=X.kind.value===`live`&&X.liveStatus.value===`paused`&&r&&n!==null,a=`${String(n)}|${e.from?.index??-1}|${t}`;return!i||n===null?M(Hs,{children:X.kind.value===`recording`?`Variables are not part of a recording: they can be read only from a program that is paused right now.`:`Variables can be read only at the pause the program is in right now. Move the player to the end of the run to see them.`}):M($c,{run:n,frame:t,pauseKey:a},a)}function $c({run:e,frame:t,pauseKey:n}){let r=Jc(n,async()=>(await J.request({op:`debug.scopes`,run:e,frame:t})).scopes);return r.status===`loading`?M(Hs,{children:`Reading the scopes...`}):r.status===`failed`?M(`p`,{class:`empty warn-text`,children:[`Could not read the scopes: `,r.reason]}):r.value.length===0?M(Hs,{children:`This frame has no scopes.`}):M(`ul`,{class:`scopes`,children:r.value.map((t,r)=>M(Zc,{run:e,scope:t,pauseKey:n,startOpen:r===0},`${r}:${t.objectId}`))})}function el(e){return`${e.origin===`node`?e.loc.url:cn(e.loc.url)}:${e.loc.line}`}function tl({debug:e}){let t=e.frames,n=Math.min(q.frame.value,t.length-1);return M(x,{children:[M(Us,{title:`Call stack`,count:t.length,aside:M(`span`,{class:`muted`,children:[`paused: `,e.reason??`unknown reason`]}),children:M(`ol`,{class:`rows`,onKeyDown:Po,"aria-label":`JavaScript call stack, innermost first`,children:t.map((t,r)=>M(Vs,{fact:e.from,subject:`stack frame ${t.fn||`(anonymous)`}`,selected:r===n,first:r===0,mapId:t.at??null,tag:t.origin===`node`?`node`:t.origin===`other`?`other`:void 0,meta:M(`span`,{class:`mono muted`,children:el(t)}),onActivate:()=>{q.frame.value=r,Ra(t)},children:M(`span`,{class:`mono`,children:un(t.fn||`(anonymous)`,80)})},r))})}),M(Us,{title:`Scopes of frame ${n+1}`,children:M(Qc,{debug:e,frame:n})})]})}function nl(){let e=Gc.main.value?.stack??[];return M(Us,{title:`Callbacks on the main thread`,count:e.length,children:[e.length===0?M(Hs,{children:`No callback is running at this point.`}):M(`ol`,{class:`rows`,onKeyDown:Po,"aria-label":`Callbacks on the main thread, innermost first`,children:[...e].reverse().map((e,t)=>M(Vs,{fact:e.from,subject:`the callback of ${pn(e.item)}`,first:t===0,mapId:Bs(e.item),meta:M(Rs,{item:e.item}),children:M(zs,{item:e.item,queue:e.queue})},e.from.index))}),M(`p`,{class:`note`,children:[M(`span`,{class:`mark-gap`}),M(`span`,{children:[`The JavaScript call stack is recorded only where the debugger pauses.`,` `,Ta.value?`Start the program with Debug and set a breakpoint to see it.`:`This position is not a pause.`]})]})]})}function rl(){let e=Gc.debug.value;return!Ea.value||!e?M(Ws,{helper:Ta.value}):M(`div`,{class:`panel-scroll stack`,children:e.paused?M(tl,{debug:e}):e.gate.stopped?M(x,{children:[M(`p`,{class:`now__line`,children:[M(go,{fact:e.gate.from,subject:`the program is stopped at a gate`}),M(`span`,{children:[`Stopped at the `,e.gate.gate??`?`,` gate`,e.gate.phase?` (${e.gate.phase} phase)`:``,`. No JavaScript is on the stack: the program is held inside Node, between JavaScript callbacks.`]})]}),M(nl,{})]}):M(nl,{})})}var il=[{id:`code`,label:`Code`,panel:vo},{id:`now`,label:`Now`,panel:vc},{id:`stack`,label:`Stack`,panel:rl},{id:`queues`,label:`Queues`,panel:Hc,badge:()=>{let e=K.parts.queues,t=t=>e[t].value?.total??0;return t(`nextTick`)+t(`microtask`)+t(`timers`)+t(`immediate`)+t(`io`)+t(`close`)}},{id:`pool`,label:`Thread pool`,panel:Ac,badge:()=>K.parts.queues.pool.value?.total??null},{id:`output`,label:`Output`,panel:Sc,badge:()=>K.parts.output.value?.total??null},{id:`events`,label:`Events`,panel:Qs},{id:`source`,label:`Source`,panel:Wc},{id:`lessons`,label:`Lessons`,panel:nc}];function al(e){return e?il:il.filter(e=>e.id!==`code`)}function ol(){let e=q.narrow.value,t=al(e),n=Ta.value,r=G.tab.value,i=t.find(e=>e.id===r)??t.find(e=>e.id===`now`),a=i.panel,o=j(null),s=t.map(e=>{let t=e.badge?.()??0;return t>0?String(Math.min(t,1e3)).length:0}).join(``),c=()=>{let e=o.current;e&&(e.classList.toggle(`can-left`,e.scrollLeft>2),e.classList.toggle(`can-right`,e.scrollLeft+e.clientWidth<e.scrollWidth-2))};return Pe(()=>{let e=o.current,t=e?.querySelector(`#tab-${i.id}`);e&&t&&(t.offsetLeft-24<e.scrollLeft?e.scrollLeft=Math.max(0,t.offsetLeft-24):t.offsetLeft+t.offsetWidth+24>e.scrollLeft+e.clientWidth&&(e.scrollLeft=t.offsetLeft+t.offsetWidth+24-e.clientWidth)),c()},[i.id,e,t.length,s]),A(()=>{let e=o.current;if(!e)return;let t=new ResizeObserver(c);return t.observe(e),()=>t.disconnect()},[]),M(`section`,{class:`panels${e?` panels--sheet`:``}`,"aria-label":`Panels`,children:[M(`div`,{class:`panels__bar`,children:M(`div`,{class:`tabs`,role:`tablist`,"aria-label":`Panels`,ref:o,onKeyDown:e=>{let n=t.indexOf(i),r=-1;if(e.key===`ArrowRight`?r=(n+1)%t.length:e.key===`ArrowLeft`?r=(n-1+t.length)%t.length:e.key===`Home`?r=0:e.key===`End`&&(r=t.length-1),r<0)return;e.preventDefault(),e.stopPropagation();let a=t[r];Fa(a.id),e.currentTarget.querySelector(`#tab-${a.id}`)?.focus()},onScroll:c,children:t.map(e=>{let t=e.id===i.id,r=e.badge?.()??null,a=e.id===`lessons`&&n?`Examples`:e.label;return M(`button`,{id:`tab-${e.id}`,type:`button`,role:`tab`,class:`tab${t?` is-selected`:``}`,"aria-selected":t?`true`:`false`,"aria-controls":`tabpanel`,tabIndex:t?0:-1,onClick:()=>Fa(e.id),children:[a,r!==null&&r>0?M(`span`,{class:`tab__count num`,children:r>999?`999+`:r}):null]},e.id)})})}),M(`div`,{id:`tabpanel`,class:`panels__body`,role:`tabpanel`,"aria-labelledby":`tab-${i.id}`,children:M(a,{})})]})}function sl({axis:e,value:t,label:n,min:r=Yi,max:i=Xi,class:a}){let o=e=>Math.min(i,Math.max(r,e)),s=n=>{let r=n.currentTarget.parentElement;if(!r)return;let i=r.getBoundingClientRect(),a=e===`x`?(n.clientX-i.left)/i.width:(n.clientY-i.top)/i.height;Number.isFinite(a)&&(t.value=o(a))};return M(`div`,{class:`splitter splitter--${e}${a?` ${a}`:``}`,role:`separator`,tabIndex:0,"aria-orientation":e===`x`?`vertical`:`horizontal`,"aria-label":n,"aria-valuemin":Math.round(r*100),"aria-valuemax":Math.round(i*100),"aria-valuenow":Math.round(t.value*100),onPointerDown:e=>{e.button===0&&(e.currentTarget.setPointerCapture(e.pointerId),e.preventDefault())},onPointerMove:e=>{e.currentTarget.hasPointerCapture(e.pointerId)&&s(e)},onKeyDown:n=>{let a=e===`x`?`ArrowLeft`:`ArrowUp`,s=e===`x`?`ArrowRight`:`ArrowDown`,c=null;n.key===a?c=t.value-.04:n.key===s?c=t.value+.04:n.key===`Home`?c=r:n.key===`End`&&(c=i),c!==null&&(n.preventDefault(),n.stopPropagation(),t.value=o(c))}})}function cl(e){if(!(e instanceof HTMLElement))return!1;if(e.isContentEditable||e.closest(`.code__cm`))return!0;let t=e.tagName;if(t===`TEXTAREA`||t===`SELECT`)return!0;if(t===`INPUT`){let t=e.type;return t!==`checkbox`&&t!==`radio`&&t!==`button`&&t!==`file`}return!1}function ll(e){switch(e){case`player.toggle`:return K.command({do:`toggle`});case`player.stepForward`:return Ha(`step`,1);case`player.stepBack`:return Ha(`step`,-1);case`player.eventForward`:return Ha(`event`,1);case`player.eventBack`:return Ha(`event`,-1);case`player.callbackForward`:return Ha(`callback`,1);case`player.callbackBack`:return Ha(`callback`,-1);case`player.phaseForward`:return Ha(`phase`,1);case`player.phaseBack`:return Ha(`phase`,-1);case`player.turnForward`:return Ha(`turn`,1);case`player.turnBack`:return Ha(`turn`,-1);case`player.outputForward`:return Ha(`output`,1);case`player.outputBack`:return Ha(`output`,-1);case`player.pauseForward`:return Ha(`pause`,1);case`player.pauseBack`:return Ha(`pause`,-1);case`player.start`:return K.command({do:`seek`,position:0});case`player.end`:return K.command({do:`seek`,position:K.player.value?.length??0});case`player.slower`:return Wa(-1);case`player.faster`:return Wa(1);case`player.followLive`:return K.command({do:`follow`,on:!(K.player.value?.follow??!1)});case`view.followAction`:G.followAction.value=!G.followAction.value,X.announce(G.followAction.value?`Following the action.`:`No longer following the action.`);return;case`run.run`:X.start(`free`);return;case`run.debug`:X.start(`debug`);return;case`run.stop`:X.stop();return;case`debug.pauseResume`:X.pauseOrResume();return;case`debug.stepOver`:X.debug(`stepOver`);return;case`debug.stepInto`:X.debug(`stepInto`);return;case`debug.stepOut`:X.debug(`stepOut`);return;case`view.legend`:q.dialog.value=`legend`;return;case`view.help`:q.dialog.value=`help`;return;case`view.theme`:return Ga();default:{let t=Number(e.slice(8)),n=al(q.narrow.value)[t-1];n&&Fa(n.id)}}}function ul(){A(()=>{let e=e=>{if(e.defaultPrevented||e.isComposing||document.querySelector(`dialog[open]`))return;let t=e.target;if((e.key===` `||e.key===`Enter`)&&t instanceof HTMLElement&&t.closest(`button, a, summary, [role="tab"], [role="slider"], [role="separator"], input, select`)&&!(e.ctrlKey||e.metaKey))return;let n=So(e,cl(t),Ta.value);n&&(e.preventDefault(),ll(n))};return addEventListener(`keydown`,e),()=>removeEventListener(`keydown`,e)},[])}function dl(){let e=q.hint.value;return A(()=>{if(!e)return;let t=setTimeout(()=>{q.hint.value===e&&(q.hint.value=null)},8e3);return()=>clearTimeout(t)},[e]),e?M(`p`,{class:`hint`,children:e}):null}function fl(){let e=q.narrow.value,t=j(null),n=j(null),r=G.splitMap.value,i=G.splitEditor.value,a=G.splitSheet.value;return ul(),Ts(),Pe(()=>{t.current?.style.setProperty(`--split-map`,String(r)),t.current?.style.setProperty(`--split-sheet`,String(a)),n.current?.style.setProperty(`--split-editor`,String(i))},[r,i,a,e]),M(`div`,{class:`app${e?` app--narrow`:``}`,children:[M(`a`,{class:`skip`,href:`#tabpanel`,children:`Skip to the panels`}),M(os,{}),M(ts,{}),M(`div`,{class:`layout`,ref:t,children:[M(ks,{}),e?M(x,{children:[M(sl,{axis:`y`,value:G.splitSheet,min:Zi,max:Qi,class:`splitter--sheet`,label:`Drag to give the panels more or less height`}),M(ol,{})]}):M(x,{children:[M(sl,{axis:`x`,value:G.splitMap,label:`Resize the map and the side panels`}),M(`div`,{class:`side`,ref:n,children:[M(vo,{}),M(sl,{axis:`y`,value:G.splitEditor,label:`Resize the editor and the panels`}),M(ol,{})]})]})]}),M(dl,{}),M(Yo,{}),M(`p`,{class:`sr-only`,role:`status`,"aria-live":`polite`,children:X.announcement.value}),M(Es,{})]})}ve(`script`);var pl=document.getElementById(`app`);pl&&(pl.textContent=``,ge(M(fl,{}),pl),ve(`rendered`),Qa());export{Rt as a,A as c,x as d,Lt as i,j as l,nr as n,et as o,Ft as r,M as s,Yn as t,k as u};
|
|
16
|
+
//# sourceMappingURL=index-2K-ozYKf.js.map
|